LRESULT CSVGSymbolsDlg::OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (m_selectedItemIndex >= 0) { CComPtr<IWebXMLViewGroup> viewGroup; m_document->GetActiveViewGroup(&viewGroup); if (viewGroup) { CEXMLViewGroup* pViewGroup = static_cast<CEXMLViewGroup*>(viewGroup.p); // CElementImpl* pElement = ((CEXMLDocument*)m_document.p)->m_pTree->FindDOMElement(m_items[m_selectedItemIndex]); CComPtr<IEElement> pElement; m_document->GetEElementFromDOMElement(m_items[m_selectedItemIndex], &pElement); pViewGroup->ActivateElement(pElement, 0, NULL); } } return 0; }
LRESULT CSVGFontsDlg::OnFontNewFont(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { if (m_document) { CComQIPtr<IEDocument> eDocument = m_document; CComPtr<ILDOMDocument> document; m_document->get_DOMDocument(&document); CSVGFilterOptionsDlg dlg; dlg.m_document = document; if (dlg.DoModal() == IDOK) { CComPtr<IOleUndoManager> undoManager; eDocument->get_undoManager(&undoManager); CComObject<CUndoParent>* pParentUndo; CComObject<CUndoParent>::CreateInstance(&pParentUndo); if (pParentUndo) { pParentUndo->AddRef(); // ??? undoManager->Open(pParentUndo); CComPtr<ILSVGElement> svgDefsElement; m_document->FindOrCreateSVGDefs(&svgDefsElement); if (svgDefsElement) { CComPtr<ILSVGFilterElement> svgElement; document->createElementNS(L"http://www.w3.org/2000/svg", L"font", (ILDOMElement**)&svgElement); if (svgElement) { svgElement->setAttribute(L"id", dlg.m_id); CComObject<CWEUndoNewElement>* pUndo; CComObject<CWEUndoNewElement>::CreateInstance(&pUndo); if (pUndo) { // pUndo->AddRef(); pUndo->m_pDocument = static_cast<CEXMLDocument*>(m_document.p); pUndo->DoInitial(undoManager, svgElement, svgDefsElement, NULL); // TODO: do this here? CComPtr<IEXMLViewGroup> viewGroup; m_document->GetActiveViewGroup(&viewGroup); if (viewGroup) { CEXMLViewGroup* pViewGroup = static_cast<CEXMLViewGroup*>(viewGroup.p); // CElementImpl* pElement = ((CEXMLDocument*)m_document.p)->m_pTree->FindDOMElement(svgFilterElement); CComPtr<IEElement> pElement; m_document->GetEElementFromDOMElement(svgElement, &pElement); pViewGroup->ActivateElement(pElement, 0, NULL); } } } } undoManager->Close(pParentUndo, TRUE/*commit*/); } } } return 0; }