Example #1
0
STDMETHODIMP CSwatchesList::put_swatches(IPDSwatches *newVal)
{
	DeselectAll();

	if (m_swatches)
	{
		CComQIPtr<INotifySend> cp = m_swatches;
		cp->Unadvise(this);
	}

	m_swatches = newVal;

	if (m_swatches)
	{
		CComQIPtr<INotifySend> cp = m_swatches;
		DWORD cookie;
		cp->Advise(this, &cookie);
	}

	if (m_hWnd)
	{
		OnSize();
		InvalidateRect(&m_areaRect);
	}

	return S_OK;
}
Example #2
0
STDMETHODIMP CPDObjectFrame::appendSubObject(IPDObjectWithBrush *object)
{
	if (object == NULL) return E_INVALIDARG;

// TODO, remove from previous parent (if any)

	object->AddRef();

	CComQIPtr<IPDObject> o = object;
	o->put_parent(this);
	o->put_document(m_pDocument);

	/*
	{
		CPDObjectImpl<IPDObject>* pObject = static_cast<CPDObjectImpl<IPDObject>*>(o.p);
		pObject->CalculateBounds();
	}
	*/

	CComQIPtr<INotifySend> cp = object;
	DWORD cookie;
	cp->Advise(this, &cookie);

	m_subObjects->m_items.Add(o);

	CComQIPtr<IPDObjectStroke> stroke = object;
	CComQIPtr<IPDObjectFill> fill = object;
	if (stroke)
		m_activeStroke = stroke;
	else
		m_activeFill = fill;

	return FireOnChanged(NOTIFY_ADD, object, DISPID_UNKNOWN);
}
Example #3
0
// TODO, move this code into CPDObjectWrappableImpl
STDMETHODIMP CPDObjectFrame::put_textWrap(/*[in]*/ PDTextWrap newVal)
{
	if (m_textWrap != newVal)
	{
		m_textWrap = newVal;

		if (m_wrapPath)
		{
			CComQIPtr<INotifySend> cp = m_wrapPath;
			cp->Unadvise(this);
			m_wrapPath->Release();
			m_wrapPath = NULL;
		}

		m_editedWrapPath = FALSE;

		if (m_textWrap == TEXTWRAP_SHAPE || m_textWrap == TEXTWRAP_BBOX)
		{
			CComObject<CPDPath>::CreateInstance(&m_wrapPath);
			m_wrapPath->AddRef();

			RecreateWrapPath();

			CComQIPtr<INotifySend> cp = m_wrapPath;
			DWORD cookie;
			cp->Advise(this, &cookie);
		}

		// TODO notify ??
		FireOnChanged(NOTIFY_MODIFY, GetUnknown(), DISPID_UNKNOWN);
	}

	return S_OK;
}
Example #4
0
STDMETHODIMP CPDObjectFrame::put_content(IPDObject *object)
{
	object->AddRef();

// First remove it from previous parent
	if (object)
	{
		CComPtr<IPDObjectUnknown> parent;
		object->get_parent(&parent);

		if (parent)
		{
			parent->removeObject(object);
		}
	}

	// Remove previous content
	if (m_content)
	{
		ATLASSERT(m_children->m_items.GetSize() == 1);
		ATLASSERT(m_content == m_children->m_items[0]);

		CComQIPtr<INotifySend> cp = m_content;
		cp->Unadvise(this);

		m_children->m_items.RemoveAll();

		FireOnChanged(NOTIFY_REMOVE, m_content, DISPID_UNKNOWN);

		m_content->Release();
		m_content = NULL;
	}
	else
		ATLASSERT(m_children->m_items.GetSize() == 0);

	m_content = object;

	if (m_content)
	{
		{
			CPDObjectImpl<IPDObject>* pObject = static_cast<CPDObjectImpl<IPDObject>*>(m_content);
			pObject->m_parent = static_cast<CPDObjectUnknownImpl<IPDObjectUnknown>*>((IPDObjectUnknown*)this);
			pObject->attachToSpread(pObject->m_parent);
		}

		m_children->m_items.Add(m_content);

		{
			CComQIPtr<INotifySend> cp = m_content;
			DWORD cookie;
			cp->Advise(this, &cookie);
		}

		FireOnChanged(NOTIFY_ADD, m_content, DISPID_UNKNOWN);
	}

	//pObject->CalculateBounds();	// TODO Have this ???

	return S_OK;
}
Example #5
0
File: WgBHO.cpp Project: naroya/fdm
STDMETHODIMP CWgBHO::Connect()
{
	HRESULT hr;
	CComQIPtr <IConnectionPoint> spCP;

	hr = m_spCPC->FindConnectionPoint (DIID_DWebBrowserEvents2, &spCP);
	if (FAILED (hr))
		return hr;

	IWgBHO *pThis = (IWgBHO*) this;

	hr = spCP->Advise (pThis, &m_dwCookie);

	return S_OK;
}
Example #6
0
STDMETHODIMP CPDObjectSymbolInstance::put_symbol(IPDSymbol *newVal)
{
    if (m_symbol)
    {
        CComQIPtr<INotifySend> cp = m_symbol;
        cp->Unadvise(this);
    }

    m_symbol = newVal;

    if (m_symbol)
    {
        CComQIPtr<INotifySend> cp = m_symbol;
        DWORD cookie;
        cp->Advise(this, &cookie);
    }

    CalculateBounds();

    return S_OK;
}
Example #7
0
Node* Node::insertNode(Node* _newChild, Node* _pBefore)
{
	ChildNode* newChild = dynamic_cast<ChildNode*>(_newChild);
	ChildNode* pBefore = dynamic_cast<ChildNode*>(_pBefore);

	Node* pPrevParent = newChild->get_parentNode();
	if (pPrevParent)
	{
		pPrevParent->removeChild(newChild);
	}

	ChildNode* pAfter;

	if (pBefore)
		pAfter = pBefore->get_previousSibling();
	else
		pAfter = m_lastChild;

	newChild->set_nextSibling(pBefore);
	newChild->set_previousSibling(pAfter);

	if (pAfter == NULL)
		m_firstChild = newChild;
	else
		pAfter->set_nextSibling(newChild);

	if (pBefore == NULL)
		m_lastChild = newChild;
	else
		pBefore->set_previousSibling(newChild);

	if (pBefore)
	{
		for (int i = 0; i < m_childNodes->m_items.GetSize(); i++)
		{
			if (m_childNodes->m_items[i] == pBefore)
			{
				m_childNodes->m_items.InsertAt(i, newChild);
			//	m_childNodes->m_items.insert(&m_childNodes->m_items[i], newChild);
				break;
			}
		}
	}
	else
	{
		m_childNodes->m_items.Add(newChild);
	}

// Set new child node's parent to this element
	newChild->set_parentNode(this);

//	TRACE("TODO\n");
#if 0
// Update computed xmlspace for inserted child(ren)
	CComQIPtr<ILDOMElement> newElement((IUnknown*)newChild);
	if (newElement)
	{
		CComBSTR xmlspace;
		newElement->getAttribute(OLESTR("xml:space"), &xmlspace);
		if (xmlspace.Length()==0)	// inherit from parent
		{
			CComQIPtr<CLDOMElementImplImpl>((IUnknown*)newChild)->m_xmlspace = m_xmlspace;
		}
		else	// explicitly set
		{
			CComQIPtr<CLDOMElementImplImpl>((IUnknown*)newChild)->m_xmlspace = cmpbstr(xmlspace, OLESTR("preserve")) == 0;
		}
	// TODO, update recursively for newChild
	}
#endif
	// SMIL Animation (TODO, not very well thought trough)
#if 0
	{
		CLDOMDocument* pDocument = static_cast<CLDOMDocument*>(static_cast<CLDOMDocumentImpl<ILDOMDocument>*>(m_ownerDocument));

		if (pDocument)
		{
			CComQIPtr<ILDOMElement> newElement = newChild;

			if (newElement)
			{
			// SMIL Animation (connect animate/set etc. elements to the elements they target)
				pDocument->BuildAnimationListForAllElements(newElement, pDocument->m_documentElement);

			// Set baseVal/animVal from attributes and parse 'style' attributes
				pDocument->UpdateAnimationElements(newElement);
			}
		}
	}
#endif

//	TRACE("TODO\n");
#if 0
	// Timing stuff (TODO)
	{
		ElementTimeImplImpl* elementTimeImpl((IUnknown*)newChild);
		if (elementTimeImpl)
		{
			elementTimeImpl->CalculateTimeBeforeParent();

			CComPtr<ILElementTimeContainer> parentTimeContainer;
			elementTimeImpl->get_parentTimeContainer(&parentTimeContainer);
			CComQIPtr<CLElementTimeContainerImplImpl> parentTimeContainerImpl((IUnknown*)parentTimeContainer);
			if (parentTimeContainerImpl)
			{
				parentTimeContainerImpl->RecalculateTime();
			}

			elementTimeImpl->CalculateTimeAfterParent();
		}
	}

	CComQIPtr<ILAnimationElement, &IID_ILAnimationElement> animation = (IUnknown*)newChild;
	if (animation)
	{
		CComQIPtr<CLAnimationElementImplImpl> pAnimation((IUnknown*)animation);

		pAnimation->SetValuesFromAttributes();
	}
#endif

	{
#if 0	// TODO
		for (int i = 0; i < m_pNodes.GetSize(); i++)
		{
			ASSERT(0);
			m_pNodes[i]->OnInsertedChild(newChild);
		}
#endif

#if 0
		if (TRUE)	// TODO, probably remove this (use above loop only)
		{
			CComQIPtr<INotifySend, &IID_INotifySend> cp = newChild;
			if (cp)
			{
				CComQIPtr<INotifyGet, &IID_INotifyGet> get = (IUnknown*)thisNode;
				if (get)
				{
					DWORD cookie;
					cp->Advise(get, &cookie);
				}

				cp->FireOnChanged(NOTIFY_ADD, newChild, DISPID_UNKNOWN);
			}
		}
#endif
	}

//	CComPtr<ILDOMDocument> ownerDocument;
//	newChild->get_ownerDocument(&ownerDocument);
//	if (ownerDocument)
	{
////////////////////////////////
// create an event notification

		DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(m_ownerDocument);

		if (ownerDocumentEvent == NULL)
			ownerDocumentEvent = dynamic_cast<DocumentEvent*>(this);

		if (ownerDocumentEvent)
		{
			MutationEvent* event = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));

			EventTarget* eventTarget = dynamic_cast<EventTarget*>(newChild);

		//
			event->initMutationEvent(S("DOMNodeInserted"), true, false, this, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);

			bool doDefault = eventTarget->dispatchEvent(event);

			if (IsDocumentOrPartOfDocument(this))
			{
			// Send "DOMNodeInsertedIntoDocument" to the node and it's children
				NodeInsertedIntoDocument(newChild);
			}
		}

		{
			Node* p = this;
			while (p)
			{
				if (p->m_pNode)
				{
					p->m_pNode->m_bArrangeValid = false;
				}

				p = p->get_parentNode();
			}
		}

#if 0
	//
		event->initMutationEvent(OLESTR("DOMSubtreeModified"), VARIANT_TRUE, VARIANT_FALSE, thisNode, NULL, NULL, NULL, CHANGE_UNKNOWN);
		eventTarget->dispatchEvent(event, &doDefault);
#endif
	}

	return newChild;
}