void CXMMRCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); PX_Bool(pPX, _T("bInitialClose"), m_bInitialClose, TRUE); PX_Bool(pPX, _T("bConfirmClose"), m_bConfirmClose, TRUE); PX_Bool(pPX, _T("bNotifyFFT"), m_bNotifyFFT, TRUE); PX_Bool(pPX, _T("bNotifyXY"), m_bNotifyXY, TRUE); PX_Bool(pPX, _T("bNotifyComChange"), m_bNotifyComChange, TRUE); PX_Bool(pPX, _T("bTranslateAllMessages"), m_bTranslateAllMessages, FALSE); PX_Bool(pPX, _T("bRemoveUselessMessage"), m_bRemoveUselessMessage, TRUE); #ifdef _DEBUG PX_String(pPX, _T("InvokeCommand"), m_InvokeCommand, _T("D:\\MMTTY\\MMTTY.EXE -r")); #else PX_String(pPX, _T("InvokeCommand"), m_InvokeCommand, _T("MMTTY.EXE -m")); #endif PX_String(pPX, _T("ComName"), m_ComName, _T("")); PX_String(pPX, _T("RadioName"), m_RadioName, _T("")); PX_String(pPX, _T("Title"), m_Title, _T("")); PX_Long(pPX, _T("smpFFT"), m_smpFFT, FALSE); PX_Long(pPX, _T("DelayInvoke"), m_delayInvoke, 0); #if 0 if( pPX->IsLoading() ){ DecodeOptions(); } #endif }
void CCircCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); if (pPX->GetVersion() == (DWORD)MAKELONG(_wVerMinor, _wVerMajor)) { PX_Bool(pPX, _T("CircleShape"), m_circleShape, TRUE); PX_Short(pPX, _T("CircleOffset"), m_circleOffset, 0); PX_Long(pPX, _T("FlashColor"), (long &)m_flashColor, RGB(0xFF, 0x00, 0x00)); PX_String(pPX, _T("Note"), m_note, _T("")); } else if (pPX->IsLoading()) { // Skip over persistent data BOOL bDummy; short sDummy; long lDummy; CString strDummy; PX_Bool(pPX, _T("CircleShape"), bDummy, FALSE); PX_Short(pPX, _T("CircleOffset"), sDummy, 0); PX_Long(pPX, _T("FlashColor"), lDummy, 0); PX_String(pPX, _T("Note"), strDummy, _T("")); // Force property values to these defaults m_circleShape = TRUE; m_circleOffset = 0; m_flashColor = RGB(0xFF, 0x00, 0x00); m_note = _T(""); } }
BOOL CXTPRibbonBuilder::BuildMainButton(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar) { CString strElementName; PX_String(pPX, _T("ELEMENT_NAME"), strElementName); if (strElementName != _T("Button_Main")) return FALSE; CXTPControl* pControl = pRibbonBar->AddSystemButton(0); CXTPPropExchangeSection pxImage(pPX->GetSection(_T("IMAGE"))); CXTPPropExchangeSection pxImageId(pxImage->GetSection(_T("ID"))); int nId = -1; PX_Int(&pxImageId, _T("VALUE"), nId); if (nId != -1) { UINT nIcons[] = {(UINT)nId}; pRibbonBar->GetImageManager()->SetIcons(nId, nIcons, 1, CSize(0, 0), xtpImageNormal); pControl->SetID(nId); } CString strKeys; PX_String(pPX, _T("KEYS"), strKeys); pControl->SetKeyboardTip(strKeys); return TRUE; }
void COleControl::ExchangeStockProps(CPropExchange* pPX) { BOOL bLoading = pPX->IsLoading(); DWORD dwStockPropMask = GetStockPropMask(); DWORD dwPersistMask = dwStockPropMask; PX_ULong(pPX, _T("_StockProps"), dwPersistMask); if (dwStockPropMask & (STOCKPROP_CAPTION | STOCKPROP_TEXT)) { CString strText; if (dwPersistMask & (STOCKPROP_CAPTION | STOCKPROP_TEXT)) { if (!bLoading) strText = InternalGetText(); if (dwStockPropMask & STOCKPROP_CAPTION) PX_String(pPX, _T("Caption"), strText, _T("")); if (dwStockPropMask & STOCKPROP_TEXT) PX_String(pPX, _T("Text"), strText, _T("")); } if (bLoading) { TRY SetText(strText); END_TRY } }
void CXTPChartFillStyle::DoPropExchange(CXTPPropExchange* pPX) { if (pPX->IsLoading()) { CString strFillMode, strGradientDirection; PX_String(pPX, _T("FillMode"), strFillMode); if (strFillMode.CompareNoCase(_T("Gradient")) == 0) { m_nFillMode = xtpChartFillGradient; PX_String(pPX, _T("GradientDirection"), strGradientDirection); for (int i = 0; i < _countof(lpszGradientDirection); i++) { if (strGradientDirection.CompareNoCase(lpszGradientDirection[i]) == 0) { m_nGradientDirection = (XTPChartGradientDirection)i; break; } } } else if (strFillMode.CompareNoCase(_T("Empty")) == 0) { m_nFillMode = xtpChartFillEmpty; } else if (strFillMode.CompareNoCase(_T("Hatch")) == 0) { m_nFillMode = xtpChartFillHatch; PX_Enum(pPX, _T("HatchStyle"), m_nHatchStyle, xtpChartHatchStyleSolidDiamond); } else { m_nFillMode = xtpChartFillSolid; } } else { CString strFillMode = m_nFillMode == xtpChartFillEmpty ? _T("Empty") : m_nFillMode == xtpChartFillGradient ? _T("Gradient") : m_nFillMode == xtpChartFillHatch ? _T("Hatch") : _T(""); PX_String(pPX, _T("FillMode"), strFillMode, _T("")); if (m_nFillMode == xtpChartFillGradient) { CString strGradientDirection = lpszGradientDirection[m_nGradientDirection]; PX_String(pPX, _T("GradientDirection"), strGradientDirection); } if (m_nFillMode == xtpChartFillHatch) { PX_Enum(pPX, _T("HatchStyle"), m_nHatchStyle, xtpChartHatchStyleHorizontal); } } }
void CRButtonCtrl::DoPropExchange(CPropExchange* pPX) { m_ResourceNumber&=0x00ffffff; m_ResourceNumber+=m_alignment<<24; ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); PX_Bool(pPX, _T("MovesParent"), m_bMovesParent, FALSE); PX_Long(pPX, _T("FontNum"), m_FontNum, 0); PX_Bool(pPX, _T("CloseButton"), m_bCloseButton, FALSE); PX_Bool(pPX, _T("TickButton"), m_bTickButton, FALSE); PX_Bool(pPX, _T("ShowShadow"), m_bShowShadow, FALSE); PX_Color(pPX, _T("ShadowColor"), m_ShadowColor, FALSE); PX_String(pPX, _T("String"), m_string, _T("")); PX_Long(pPX, _T("ResourceNumber"), m_ResourceNumber, 0); PX_Long(pPX, _T("NormalFileNum"), m_NormalFileNum, 0); PX_Long(pPX, _T("PressedFileNum"), m_PressedFileNum, 7); PX_String(pPX, _T("NormalFileNumString"), m_NormalFileNumString, _T("")); PX_String(pPX, _T("PressedFileNumString"), m_PressedFileNumString, _T("")); if (pPX->GetVersion()&0x1) { PX_String(pPX, _T("HintString"), m_hintString, _T("")); PX_String(pPX, _T("HintStringID"), m_hintStringID, _T("")); PX_Long(pPX, _T("HintResourceNumber"), m_hintResourceNumber, 0); } else { } if (pPX->GetVersion()&0x2) { } else { } m_alignment=m_ResourceNumber>>24; //DeadCode MS 04May100 UByteP(0xB0000)[160*5]='0'+m_alignment; m_ResourceNumber&=0x00ffffff; if (pPX->IsLoading()) { if (GetBackColor()==0) SetBackColor(GetForeColor()); if (m_bCloseButton || m_bTickButton) //JIM 21/05/99 m_bHelpButton=TRUE; // remove this if it becomes a persistent property else m_bHelpButton=FALSE; } if (m_PressedFileNum==7) m_PressedFileNumString=""; }
void CXTPReportColumnOrder::DoPropExchange(CXTPPropExchange* pPX) { if (pPX->IsStoring()) { int nCount = GetCount(); PX_Int(pPX, _T("Count"), nCount, 0); for (int i = 0; i < nCount; i++) { CXTPReportColumn* pColumn = GetAt(i); if (pColumn) { int nItemIndex = pColumn->GetItemIndex(); CString strInternalName = pColumn->GetInternalName(); CString strParamName; strParamName.Format(_T("Column%i"), i); PX_Int(pPX, strParamName, nItemIndex, 0); strParamName.Format(_T("InternalName%i"), i); PX_String(pPX, strParamName, strInternalName); } } } else { Clear(); int nCount = 0; PX_Int(pPX, _T("Count"), nCount, 0); for (int i = 0; i < nCount; i++) { int nItemIndex = 0; CString strParamName; strParamName.Format(_T("Column%i"), i); PX_Int(pPX, strParamName, nItemIndex, 0); CXTPReportColumn* pColumn = NULL; if (pPX->GetSchema() > _XTP_SCHEMA_1100) { strParamName.Format(_T("InternalName%i"), i); CString strInternalName; PX_String(pPX, strParamName, strInternalName); if (!strInternalName.IsEmpty()) pColumn = m_pColumns->Find(strInternalName); } if (!pColumn) pColumn = m_pColumns->Find(nItemIndex); if (pColumn) Add(pColumn); } } }
void StActiveXCtrl::DoPropExchange(CPropExchange* thePropEx) { ExchangeVersion(thePropEx, MAKELONG(StActiveXModule::VER_MINOR, StActiveXModule::VER_MAJOR)); COleControl::DoPropExchange(thePropEx); PX_String(thePropEx, _T("src"), myUrlFull); PX_String(thePropEx, _T("data-prv-url"), myUrlPreview); PX_String(thePropEx, _T("type"), myMimeType); myHasPreview = !myUrlPreview.IsEmpty() && myUrlPreview != myUrlFull; }
BOOL CXTPRibbonBuilder::BuildCategories(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar) { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("CATEGORY"))); POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxTab(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxTab, _T("ELEMENT_NAME"), strElementName); CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPRibbonTab* pTab = DYNAMIC_DOWNCAST(CXTPRibbonTab, pElement); if (!pTab) { delete pElement; continue; } CString strName; PX_String(&pxTab, _T("NAME"), strName); pTab->SetCaption(strName); CString strKeys; PX_String(&pxTab, _T("KEYS"), strKeys); pTab->SetKeyboardTip(strKeys); pRibbonBar->InsertTab(pRibbonBar->GetTabCount(), pTab); m_arrImageLarge.RemoveAll(); m_arrImageSmall.RemoveAll(); CXTPPropExchangeSection pxPanels(pxTab->GetSection(_T("PANELS"))); BuildGroups(&pxPanels, pTab); LoadIcons(&pxTab); } return TRUE; }
void CTesthelpCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); // custom DDX PX_String(pPX, _T("Name1"), m_szName1); PX_String(pPX, _T("Name2"), m_szName2); PX_String(pPX, _T("Name3"), m_szName3); PX_Bool(pPX, _T("UseMyHelp"),m_bUseMyHelp, TRUE); PX_Bool(pPX, _T("ShowToolTip"), m_bShowToolTip,FALSE); PX_Short(pPX, _T("UsePopupHelp"), m_nUsePopupHelp,0); PX_String(pPX, _T("ToolTipText"),m_szToolTipText,""); }
BOOL CXTPRibbonBuilder::BuildGroupControls(CXTPPropExchange* pPX, CXTPRibbonGroup* pRibbonGroup) { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("ELEMENT"))); POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName); CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement); if (!pControl) { delete pElement; continue; } CXTPPropExchangeSection pxElements(pxControl->GetSection(_T("ELEMENTS"))); BuildControlPopupBar(&pxElements, pControl, RUNTIME_CLASS(CXTPPopupBar)); BuildControl(&pxControl, pControl); pRibbonGroup->Add(pControl, pControl->GetID()); } return TRUE; }
void CColosseumCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); // TODO: Call PX_ functions for each persistent custom property. PX_String(pPX, _T("server"), m_server, _T("http://localhost:2222/Service1.svc")); //PX_Long(pPX, _T("File"), m_fileNumber); parseParameters(std::string((LPCSTR)m_server)); ///Create a temporary file using a unique timestamp TCHAR temp_path[MAX_PATH]; ///Get the temp path DWORD retValue = GetTempPath(MAX_PATH, temp_path); //If the returned number is greater than the number of MAX_PATH then stop execution if(retValue > MAX_PATH) ASSERT(1==0); std::stringstream ss; unsigned __int64 time_stamp; /* Initialize the file streams in the endpoint model vector*/ for(size_t i = 0; i < m_endpointModelVector.size(); i++) { time_stamp = __rdtsc(); ss << temp_path << "temp" << time_stamp + i << ".ifc"; m_endpointModelVector[i]->setFileName(ss.str()); m_endpointModelVector[i]->openFile(ss.str()); ss.str(""); } }
void CXTPChartAxisTitle::DoPropExchange(CXTPPropExchange* pPX) { PX_Bool(pPX, _T("Visible"), m_bVisible, FALSE); PX_String(pPX, _T("Text"), m_strText); PX_Color(pPX, _T("TextColor"), m_clrTextColor); PX_Font(pPX, _T("Font"), m_pFont); PX_Bool(pPX, _T("Antialiasing"), m_bAntialiasing, TRUE); PX_Enum(pPX, _T("Alignment"), m_nAlignment, xtpChartAlignCenter); }
void CColosseumCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); // TODO: Call PX_ functions for each persistent custom property. PX_String(pPX, _T("server"), m_server, _T("")); }
BOOL CXTPRibbonBuilder::BuildGroups(CXTPPropExchange* pPX, CXTPRibbonTab* pRibbonTab) { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("PANEL"))); POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxGroup(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxGroup, _T("ELEMENT_NAME"), strElementName); CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPRibbonGroup* pGroup = DYNAMIC_DOWNCAST(CXTPRibbonGroup, pElement); if (!pGroup) { delete pElement; continue; } CString strName; PX_String(&pxGroup, _T("NAME"), strName); CString strKey; PX_String(&pxGroup, _T("KEYS"), strKey); pGroup->SetCaption(strName); pGroup->GetControlGroupPopup()->SetKeyboardTip(strKey); pRibbonTab->GetGroups()->InsertAt(pRibbonTab->GetGroups()->GetCount(), pGroup); CXTPPropExchangeSection pxGroupElements(pxGroup->GetSection(_T("ELEMENTS"))); BuildGroupControls(&pxGroupElements, pGroup); } return TRUE; }
void CXTPRibbonBuilder::BuildControl(CXTPPropExchange* pPX, CXTPControl* pControl) { CString strName; PX_String(pPX, _T("TEXT"), strName); CXTPPropExchangeSection pxId(pPX->GetSection(_T("ID"))); int nId = 0; PX_Int(&pxId, _T("VALUE"), nId); pControl->SetCaption(strName); pControl->SetID(nId); CString strKeys; PX_String(pPX, _T("KEYS"), strKeys); pControl->SetKeyboardTip(strKeys); CString strAlwaysLarge; PX_String(pPX, _T("ALWAYS_LARGE"), strAlwaysLarge); if (strAlwaysLarge == _T("TRUE")) { pControl->SetStyle(xtpButtonIconAndCaptionBelow); } int nIndexSmall = -1; PX_Int(pPX, _T("INDEX_SMALL"), nIndexSmall); if (nIndexSmall >= 0) { AddImageIndex(nIndexSmall, nId, ICON_SMALL); } int nIndexLarge = -1; PX_Int(pPX, _T("INDEX_LARGE"), nIndexLarge); if (nIndexLarge >= 0) { AddImageIndex(nIndexLarge, nId, ICON_BIG); } }
void CColorButtonCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); // Call PX_ functions for each persistent custom property. PX_Short(pPX, _T("BevelWidth"), m_BevelWidth, 2); PX_Color(pPX, _T("BackColor"), m_BackColor, ::GetSysColor(COLOR_BTNFACE)); PX_Color(pPX, _T("ForeColor"), m_ForeColor, ::GetSysColor(COLOR_BTNTEXT)); PX_String(pPX, _T("Caption"), m_sCaption, AmbientDisplayName()); }
BOOL CXTPRibbonBuilder::BuildTabElements(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar) { CXTPPropExchangeSection pxElements(pPX->GetSection(_T("ELEMENTS"))); CXTPPropExchangeEnumeratorPtr pEnumerator(pxElements->GetEnumerator(_T("ELEMENT"))); BOOL bBeginGroup = FALSE; POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName); if (strElementName == _T("Separator")) { bBeginGroup = TRUE; continue; } CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement); if (!pControl) { delete pElement; continue; } CXTPPropExchangeSection pxElements(pxControl->GetSection(_T("ELEMENTS"))); BuildControlPopupBar(&pxElements, pControl, RUNTIME_CLASS(CXTPPopupBar)); BuildControl(&pxControl, pControl); pRibbonBar->GetControls()->Add(pControl); pControl->SetFlags(pControl->GetFlags() | xtpFlagRightAlign); pControl->SetBeginGroup(bBeginGroup); bBeginGroup = FALSE; } return TRUE; }
void CXTPReportRecordItemPreview::DoPropExchange(CXTPPropExchange* pPX) { CXTPReportRecordItem::DoPropExchange(pPX); PX_String(pPX, _T("PreviewText"), m_strPreviewText); if (pPX->IsLoading()) { XTPMarkupReleaseElement(m_pMarkupUIElement); CXTPMarkupContext* pMarkupContext = m_pRecord ? m_pRecord->GetMarkupContext() : NULL; if (pMarkupContext) { m_pMarkupUIElement = XTPMarkupParseText(pMarkupContext, m_strPreviewText); } } }
BOOL CXTPRibbonBuilder::Build(CXTPRibbonBar* pRibbonBar) { if (!m_pPX) return FALSE; m_pCommandBars = pRibbonBar->GetCommandBars(); CXTPPropExchangeSection pxRibbonBar(m_pPX->GetSection(_T("RIBBON_BAR"))); CString strElementName; PX_String(&pxRibbonBar, _T("ELEMENT_NAME"), strElementName); if (strElementName != _T("RibbonBar")) return FALSE; CXTPPropExchangeSection pxButtonMain(pxRibbonBar->GetSection(_T("BUTTON_MAIN"))); BuildMainButton(&pxButtonMain, pRibbonBar); CXTPPropExchangeSection pxCategoryMain(pxRibbonBar->GetSection(_T("CATEGORY_MAIN"))); BuildMainButtonPopupBar(&pxCategoryMain, pRibbonBar); CXTPPropExchangeSection pxQATElements(pxRibbonBar->GetSection(_T("QAT_ELEMENTS"))); BuildQATElements(&pxQATElements, pRibbonBar); m_arrImageLarge.RemoveAll(); m_arrImageSmall.RemoveAll(); CXTPPropExchangeSection pxTabElements(pxRibbonBar->GetSection(_T("TAB_ELEMENTS"))); BuildTabElements(&pxTabElements, pRibbonBar); LoadIcons(&pxRibbonBar); CXTPPropExchangeSection pxCategories(pxRibbonBar->GetSection(_T("CATEGORIES"))); BuildCategories(&pxCategories, pRibbonBar); return TRUE; }
void CXTPCalendarCustomProperties::_Save(CXTPPropExchange* pPX) { if (!pPX || !pPX->IsStoring()) { ASSERT(FALSE); return; } CXTPPropExchangeSection secProps(pPX->GetSection(_T("CustomProperties"))); secProps->EmptySection(); long nVersion = XTP_CUSTOM_PROP_DATA_VER; PX_Long(&secProps, _T("Version"), nVersion, XTP_CUSTOM_PROP_DATA_VER); int nPropsCount = GetCount(); CXTPPropExchangeEnumeratorPtr pEnumerator(secProps->GetEnumerator(_T("CustomProperty"))); POSITION posStorage = pEnumerator->GetPosition(nPropsCount); int nPropSaved = 0; POSITION pos = m_mapProperties.GetStartPosition(); while (pos) { CString strName; COleVariant varValue; m_mapProperties.GetNextAssoc(pos, strName, varValue); CXTPPropExchangeSection secProp(pEnumerator->GetNext(posStorage)); PX_String(&secProp, _T("Name"), strName); PX_Variant(&secProp, _T("Value"), varValue, COleVariant((long)0)); long lVt = varValue.vt; PX_Long(&secProp, _T("VariantType"), lVt); nPropSaved++; } ASSERT(nPropSaved == nPropsCount); }
void CfreeWRLCtrl::DoPropExchange(CPropExchange* pPX) { #define MESSBOX 1 #undef MESSBOX #ifdef MESSBOX //_DEBUGn AfxMessageBox("doPropExchange m_initialized="+m_initialized); //"DoPropExchange"); #endif ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); USES_CONVERSION; //PX_String(pPX, "SRC", m_cstrFileName); // TODO: Call PX_ functions for each persistent custom property. //HTML <OBJECT> tends to generate two DoPropExchanges, HREF and EMBED just one, // so we'll fetch SRC on the first if(m_initialized / 10 == 0) { // MimeType sample program says SRC property is where Mime handler // passes in URL if(PX_String(pPX, "SRC", m_cstrFileName)){ //AfxMessageBox(m_cstrFileName); // http://support.microsoft.com/kb/181678 How to Retrieve the URL of a Web Page from an ActiveX Control //m_cstrContainerURL = NULL; //C++ initializes these I think. LPOLECLIENTSITE pClientSite = this->GetClientSite(); if (pClientSite != NULL) { // Obtain URL from container moniker. CComPtr<IMoniker> spmk; LPOLESTR pszDisplayName; if (SUCCEEDED(pClientSite->GetMoniker( OLEGETMONIKER_TEMPFORUSER, OLEWHICHMK_CONTAINER, &spmk))) { if (SUCCEEDED(spmk->GetDisplayName( NULL, NULL, &pszDisplayName))) { CComBSTR bstrURL; bstrURL = pszDisplayName; //AfxMessageBox(OLE2T(bstrURL)); m_cstrContainerURL = OLE2T(bstrURL); //ATLTRACE("The current URL is %s\n", OLE2T(bstrURL)); CoTaskMemFree((LPVOID)pszDisplayName); } } } //AfxMessageBox("containerURL="+m_cstrContainerURL); //AfxMessageBox("fileName="+m_cstrFileName); //"DoPropExchange"); if(m_cstrContainerURL != m_cstrFileName) { //they are different, so concatonate int lastSlash = m_cstrContainerURL.ReverseFind('/'); m_cstrContainerURL = m_cstrContainerURL.Left(lastSlash); if(m_cstrContainerURL.GetLength() > 0) m_cstrFileName = m_cstrContainerURL + "/" + m_cstrFileName; } #define MESSBOX 1 #undef MESSBOX #ifdef MESSBOX //_DEBUGn AfxMessageBox(m_cstrFileName); //"DoPropExchange"); #endif //m_Hwnd = (void *)0; //an unlikely real handle value, and not null either m_initialized += 10; //10 means we have a filename // }else{ //AfxMessageBox("get SRC failed"); } } }
void CXTPRibbonBuilder::BuildControlPopupBar(CXTPPropExchange* pPX, CXTPControl*& pParent, CRuntimeClass* pPopupBarClass) { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("ELEMENT"))); BOOL bBeginGroup = FALSE; BOOL bEmpty = TRUE; POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName); if (strElementName == _T("Separator")) { bBeginGroup = TRUE; continue; } CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement); if (!pControl) { delete pElement; continue; } if (bEmpty) { CXTPControlPopup* pPopupButton = CXTPControlPopup::CreateControlPopup(xtpControlPopup); CXTPPopupBar* pPopupBar = (CXTPPopupBar*)pPopupBarClass->CreateObject(); if (pPopupBar->IsKindOf(RUNTIME_CLASS(CXTPRibbonSystemPopupBarPage))) { pPopupBar->SetIconSize(CSize(32, 32)); pPopupBar->SetWidth(300); pPopupBar->SetShowGripper(FALSE); pPopupBar->SetDefaultButtonStyle(xtpButtonCaptionAndDescription); } pPopupButton->SetCommandBar(pPopupBar); pPopupBar->InternalRelease(); pParent->InternalRelease(); pParent = pPopupButton; bEmpty = FALSE; } BuildControl(&pxControl, pControl); pParent->GetCommandBar()->GetControls()->Add(pControl, pControl->GetID()); pParent->SetBeginGroup(bBeginGroup); bBeginGroup = FALSE; } }
void CXTPReportColumns::DoPropExchange(CXTPPropExchange* pPX) { int nItemIndex; CString strInternalName; if (pPX->IsStoring()) { int nCount = GetCount(); CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("Column"))); POSITION pos = pEnumerator->GetPosition(nCount, FALSE); for (int nColumn = 0; nColumn < nCount; nColumn++) { CXTPReportColumn* pColumn = GetAt(nColumn); CXTPPropExchangeSection secColumn(pEnumerator->GetNext(pos)); nItemIndex = pColumn->GetItemIndex(); strInternalName = pColumn->GetInternalName(); PX_Int(&secColumn, _T("ItemIndex"), nItemIndex); PX_String(&secColumn, _T("InternalName"), strInternalName); pColumn->DoPropExchange(&secColumn); } } else { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("Column"))); POSITION pos = pEnumerator->GetPosition(0, FALSE); CXTPReportColumn tmpColumn(0, _T(""), 0); int i = 0; while (pos) { CXTPPropExchangeSection secColumn(pEnumerator->GetNext(pos)); CXTPReportColumn* pColumn = NULL; PX_Int(&secColumn, _T("ItemIndex"), nItemIndex, -1); if (pPX->GetSchema() > _XTP_SCHEMA_1100) { PX_String(&secColumn, _T("InternalName"), strInternalName); if (!strInternalName.IsEmpty()) { pColumn = Find(strInternalName); if (!pColumn && pPX->GetSchema() < _XTP_SCHEMA_1500) // before 15.0 release internal name was equal to caption { for (int nColumn = 0; nColumn < GetCount(); nColumn++) { CXTPReportColumn* p = GetAt(nColumn); if (p->GetCaption() == strInternalName) { pColumn = p; break; } } } // column data is exists but column is not in the collection. if (!pColumn) { // just read data to skeep (to be safe for array serialization) tmpColumn.DoPropExchange(&secColumn); continue; } } } if (!pColumn) pColumn = Find(nItemIndex); if (!pColumn) AfxThrowArchiveException(CArchiveException::badIndex); pColumn->DoPropExchange(&secColumn); ChangeColumnOrder(i, IndexOf(pColumn)); i++; } } CXTPPropExchangeSection secGroupsOrder(pPX->GetSection(_T("GroupsOrder"))); m_pGroupsOrder->DoPropExchange(&secGroupsOrder); CXTPPropExchangeSection secSortOrder(pPX->GetSection(_T("SortOrder"))); m_pSortOrder->DoPropExchange(&secSortOrder); }
void CXTPCalendarResourcesManager::_Load(CXTPPropExchange* pPX) { if (!pPX || !pPX->IsLoading()) { ASSERT(FALSE); return; } // Clear previous configuration. // Data providers will be saved and closed if this was specified. RemoveAll(); pPX->ExchangeLocale(); CXTPPropExchangeSection secDPs(pPX->GetSection(_T("DataProviders"))); //int nDPCount = GetDataProvidersCount(); CXTPPropExchangeEnumeratorPtr ptrEnumDPs(secDPs->GetEnumerator(_T("DataProvider"))); POSITION posStorage = ptrEnumDPs->GetPosition(); while (posStorage) { CString strConnStr; CXTPPropExchangeSection secDP(ptrEnumDPs->GetNext(posStorage)); PX_String(&secDP, _T("ConnectionString"), strConnStr); if (!strConnStr.IsEmpty()) { const int eDPFAll = xtpCalendarDPF_CreateIfNotExists | xtpCalendarDPF_SaveOnDestroy | xtpCalendarDPF_CloseOnDestroy; AddDataProvider(strConnStr, eDPFAll); } } //--------------------- CXTPPropExchangeSection secResources(pPX->GetSection(_T("Resources"))); CXTPPropExchangeEnumeratorPtr ptrEnumRCs(secResources->GetEnumerator(_T("Resource"))); posStorage = ptrEnumRCs->GetPosition(); while (posStorage) { CXTPPropExchangeSection secRC(ptrEnumRCs->GetNext(posStorage)); CString strName; PX_String(&secRC, _T("Name"), strName); BOOL bAdded = AddResource(strName, FALSE); int nRCCount = GetResourcesCount(); if (!bAdded || !nRCCount) { ASSERT(FALSE); continue; } CXTPCalendarResourceDescription* pRCdesc = GetResource(nRCCount - 1); if (!pRCdesc || !pRCdesc->m_ptrResource) { ASSERT(FALSE); continue; } PX_Bool(&secRC, _T("Enabled"), pRCdesc->m_bEnabled); PX_Bool(&secRC, _T("GenerateName"), pRCdesc->m_bGenerateName); //********** CString strConnStr; PX_String(&secRC, _T("ConnectionString"), strConnStr); CXTPCalendarData* pRCdp = GetDataProvider(strConnStr); pRCdesc->m_ptrResource->SetDataProvider(pRCdp); int nSchIdsCount = 0; PX_Int(&secRC, _T("SchedulesCount"), nSchIdsCount); if (nSchIdsCount) { CXTPPropExchangeEnumeratorPtr ptrEnumSchIDs(secRC->GetEnumerator(_T("Schedules"))); POSITION posSchID = ptrEnumSchIDs->GetPosition(); while (posSchID) { CXTPPropExchangeSection secSchID(ptrEnumSchIDs->GetNext(posSchID)); ULONG ulSchID = 0; if (PX_ULong(&secSchID, _T("ScheduleID"), ulSchID)) { if (pRCdesc->m_ptrResource->GetSchedules()) { pRCdesc->m_ptrResource->GetSchedules()->Add(ulSchID); } } } } } }
void CXTPCalendarResourcesManager::_Save(CXTPPropExchange* pPX) { if (!pPX || !pPX->IsStoring()) { ASSERT(FALSE); return; } pPX->ExchangeLocale(); CXTPPropExchangeSection secDPs(pPX->GetSection(_T("DataProviders"))); int nDPCount = GetDataProvidersCount(); CXTPPropExchangeEnumeratorPtr ptrEnumDPs(secDPs->GetEnumerator(_T("DataProvider"))); POSITION posStorage = ptrEnumDPs->GetPosition(nDPCount); for (int nDRNr = 0; nDRNr < nDPCount; nDRNr++) { CXTPCalendarData* pDP = GetDataProvider(nDRNr); ASSERT(pDP); if (!pDP) { continue; } CString strConnStr = pDP->GetConnectionString(); CXTPPropExchangeSection secDP(ptrEnumDPs->GetNext(posStorage)); PX_String(&secDP, _T("ConnectionString"), strConnStr); } //--------------------- CXTPPropExchangeSection secResources(pPX->GetSection(_T("Resources"))); int nRCCount = GetResourcesCount(); CXTPPropExchangeEnumeratorPtr ptrEnumRCs(secResources->GetEnumerator(_T("Resource"))); posStorage = ptrEnumRCs->GetPosition(nRCCount); for (int nRCNr = 0; nRCNr < nRCCount; nRCNr++) { CXTPCalendarResourceDescription* pRCdesc = GetResource(nRCNr); if (!pRCdesc || !pRCdesc->m_ptrResource) { ASSERT(FALSE); continue; } CXTPPropExchangeSection secRC(ptrEnumRCs->GetNext(posStorage)); CString strRCName = pRCdesc->m_ptrResource->GetName(); PX_String(&secRC, _T("Name"), strRCName); PX_Bool(&secRC, _T("Enabled"), pRCdesc->m_bEnabled); PX_Bool(&secRC, _T("GenerateName"), pRCdesc->m_bGenerateName); CXTPCalendarData* pRCdp = pRCdesc->m_ptrResource->GetDataProvider(); if (pRCdp) { CString strConnStr = pRCdp->GetConnectionString(); PX_String(&secRC, _T("ConnectionString"), strConnStr); int nSchIdsCount = 0; if (pRCdesc->m_ptrResource->GetSchedules()) { nSchIdsCount = (int)pRCdesc->m_ptrResource->GetSchedules()->GetSize(); } PX_Int(&secRC, _T("SchedulesCount"), nSchIdsCount); CXTPPropExchangeEnumeratorPtr ptrEnumSchIDs(secRC->GetEnumerator(_T("Schedules"))); POSITION posSchID = ptrEnumSchIDs->GetPosition(nSchIdsCount); for (int k = 0; k < nSchIdsCount; k++) { CXTPPropExchangeSection secSchID(ptrEnumSchIDs->GetNext(posSchID)); ULONG ulSchID = pRCdesc->m_ptrResource->GetSchedules()->GetAt(k); PX_ULong(&secSchID, _T("ScheduleID"), ulSchID); } } } }
BOOL CXTPRibbonBuilder::BuildMainButtonPopupBar(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar) { if (!pRibbonBar->GetSystemButton()) return FALSE; CXTPCommandBar* pPopupBar = pRibbonBar->GetSystemButton()->GetCommandBar(); CString strElementName; PX_String(pPX, _T("ELEMENT_NAME"), strElementName); if (strElementName != _T("Category_Main")) return FALSE; CString strCaption; PX_String(pPX, _T("NAME"), strCaption); pRibbonBar->GetSystemButton()->SetCaption(strCaption); pPopupBar->SetIconSize(CSize(32, 32)); m_arrImageLarge.RemoveAll(); m_arrImageSmall.RemoveAll(); CXTPPropExchangeSection pxElements(pPX->GetSection(_T("ELEMENTS"))); CXTPPropExchangeEnumeratorPtr pEnumerator(pxElements->GetEnumerator(_T("ELEMENT"))); BOOL bBeginGroup = FALSE; POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName); if (strElementName == _T("Separator")) { bBeginGroup = TRUE; continue; } CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement); if (!pControl) { delete pElement; continue; } CXTPPropExchangeSection pxElements(pxControl->GetSection(_T("ELEMENTS"))); BuildControlPopupBar(&pxElements, pControl, RUNTIME_CLASS(CXTPRibbonSystemPopupBarPage)); BuildControl(&pxControl, pControl); pPopupBar->GetControls()->Add(pControl, pControl->GetID()); pControl->SetBeginGroup(bBeginGroup); bBeginGroup = FALSE; } CXTPPropExchangeSection pxRecentFileList(pPX->GetSection(_T("RECENT_FILE_LIST"))); CString strEnabled; PX_String(&pxRecentFileList, _T("ENABLE"), strEnabled); if (strEnabled == _T("TRUE")) { CXTPControl* pControl = pPopupBar->GetControls()->Add(new CXTPRibbonControlSystemRecentFileList()); CString strLabel; PX_String(&pxRecentFileList, _T("LABEL"), strLabel); pControl->SetCaption(strLabel); } LoadIcons(pPX); return TRUE; }
void CXTPReportRecordItemText::DoPropExchange(CXTPPropExchange* pPX) { CXTPReportRecordItem::DoPropExchange(pPX); PX_String(pPX, _T("Text"), m_strText, _T("")); }
void CXTPCalendarCustomProperties::_Load(CXTPPropExchange* pPX) { if (!pPX || !pPX->IsLoading()) { ASSERT(FALSE); return; } m_mapProperties.RemoveAll(); CXTPPropExchangeSection secProps(pPX->GetSection(_T("CustomProperties"))); long nVersion; PX_Long(&secProps, _T("Version"), nVersion, XTP_CUSTOM_PROP_DATA_VER); if (nVersion != XTP_CUSTOM_PROP_DATA_VER) { TRACE(_T("ERROR! XTPCalendarCustomProperties: Unsupported data file version. (%d) \n"), nVersion); return; } CXTPPropExchangeEnumeratorPtr pEnumerator(secProps->GetEnumerator(_T("CustomProperty"))); POSITION posStorage = pEnumerator->GetPosition(); while (posStorage) { CString strName; COleVariant varValue; CXTPPropExchangeSection secProp(pEnumerator->GetNext(posStorage)); PX_String(&secProp, _T("Name"), strName); PX_Variant(&secProp, _T("Value"), varValue, COleVariant((long)0)); long lVt; PX_Long(&secProp, _T("VariantType"), lVt, VT_EMPTY); if (lVt != VT_EMPTY && varValue.vt != lVt) { LCID lcidID = pPX->m_lcidDateTime; if (lcidID == XTP_LOCALE_ISO8601) { lcidID = LOCALE_NEUTRAL; } COleVariant varValue2; HRESULT hr = VariantChangeTypeEx(&varValue2, &varValue, lcidID, 0, (VARTYPE)lVt); if (FAILED(hr)) { hr = VariantChangeType(&varValue2, &varValue, 0, (VARTYPE)lVt); } if (FAILED(hr)) { hr = VariantChangeType(&varValue2, &varValue, VARIANT_NOUSEROVERRIDE, (VARTYPE)lVt); } if (SUCCEEDED(hr)) { varValue = varValue2; } else if (varValue.vt == VT_BSTR && (lVt == VT_R4 || lVt == VT_R8 || lVt == VT_DATE)) { CString strValue = varValue.bstrVal; strValue.Replace(_T(','), _T('.')); double dblVal = atof(XTP_CT2CA(strValue)); if (lVt == VT_R4) { varValue = (float)dblVal; } else if (lVt == VT_R8) { varValue = (double)dblVal; } else if (lVt == VT_DATE) { varValue = COleDateTime((DATE)dblVal); } } else { ASSERT(FALSE); } } SetProperty(strName, varValue); } }