diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /unoxml/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'unoxml/inc')
-rw-r--r-- | unoxml/inc/event.hxx | 70 | ||||
-rw-r--r-- | unoxml/inc/eventdispatcher.hxx | 80 | ||||
-rw-r--r-- | unoxml/inc/mouseevent.hxx | 102 | ||||
-rw-r--r-- | unoxml/inc/mutationevent.hxx | 85 | ||||
-rw-r--r-- | unoxml/inc/node.hxx | 298 | ||||
-rw-r--r-- | unoxml/inc/pch/precompiled_unoxml.cxx | 12 | ||||
-rw-r--r-- | unoxml/inc/pch/precompiled_unoxml.hxx | 72 | ||||
-rw-r--r-- | unoxml/inc/uievent.hxx | 70 |
8 files changed, 789 insertions, 0 deletions
diff --git a/unoxml/inc/event.hxx b/unoxml/inc/event.hxx new file mode 100644 index 0000000000..216bf2775e --- /dev/null +++ b/unoxml/inc/event.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/types.h> + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/xml/dom/events/XEvent.hpp> +#include <com/sun/star/xml/dom/events/XEventTarget.hpp> +#include <com/sun/star/util/Time.hpp> + +#include <cppuhelper/implbase.hxx> +#include <mutex> + +namespace DOM::events +{ +class CEvent : public cppu::WeakImplHelper< css::xml::dom::events::XEvent > +{ +friend class CEventDispatcher; + +protected: + std::mutex m_Mutex; + bool m_canceled; + OUString m_eventType; + css::uno::Reference< css::xml::dom::events::XEventTarget > m_target; + css::uno::Reference< css::xml::dom::events::XEventTarget > m_currentTarget; + css::xml::dom::events::PhaseType m_phase; + bool m_bubbles; + bool m_cancelable; + css::util::Time m_time; + +public: + + explicit CEvent(); + + virtual ~CEvent() override; + virtual OUString SAL_CALL getType() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getTarget() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getCurrentTarget() override; + virtual css::xml::dom::events::PhaseType SAL_CALL getEventPhase() override; + virtual sal_Bool SAL_CALL getBubbles() override; + virtual sal_Bool SAL_CALL getCancelable() override; + virtual css::util::Time SAL_CALL getTimeStamp() override; + virtual void SAL_CALL stopPropagation() override; + virtual void SAL_CALL preventDefault() override; + virtual void SAL_CALL initEvent( + const OUString& eventTypeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg) override; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/eventdispatcher.hxx b/unoxml/inc/eventdispatcher.hxx new file mode 100644 index 0000000000..9ecd42585d --- /dev/null +++ b/unoxml/inc/eventdispatcher.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <map> + +#include <libxml/tree.h> + +#include <rtl/ustring.hxx> + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/xml/dom/XNode.hpp> +#include <com/sun/star/xml/dom/events/XEvent.hpp> + +namespace osl { class Mutex; } + +namespace DOM { + +class CDocument; + +namespace events { + +typedef std::multimap< xmlNodePtr, css::uno::Reference< css::xml::dom::events::XEventListener> > ListenerMap; +typedef std::map<OUString, ListenerMap> TypeListenerMap; + +class CEventDispatcher +{ +private: + TypeListenerMap m_CaptureListeners; + TypeListenerMap m_TargetListeners; + +public: + void addListener( + xmlNodePtr pNode, + const OUString& aType, + const css::uno::Reference<css::xml::dom::events::XEventListener>& aListener, + bool bCapture); + + void removeListener( + xmlNodePtr pNode, + const OUString& aType, + const css::uno::Reference<css::xml::dom::events::XEventListener>& aListener, + bool bCapture); + + static void callListeners( + TypeListenerMap const& rTMap, + xmlNodePtr const pNode, + const OUString& aType, + const css::uno::Reference< css::xml::dom::events::XEvent >& xEvent); + + void dispatchEvent( + DOM::CDocument & rDocument, + ::osl::Mutex & rMutex, + xmlNodePtr const pNode, + css::uno::Reference<css::xml::dom::XNode> const& xNode, + css::uno::Reference< css::xml::dom::events::XEvent > const& xEvent) const; + + ~CEventDispatcher(); +}; + +}} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/mouseevent.hxx b/unoxml/inc/mouseevent.hxx new file mode 100644 index 0000000000..1b4ffe391c --- /dev/null +++ b/unoxml/inc/mouseevent.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/xml/dom/events/PhaseType.hpp> +#include <com/sun/star/xml/dom/events/XMouseEvent.hpp> + +#include <cppuhelper/implbase.hxx> + +#include "uievent.hxx" + +namespace DOM::events { + +typedef ::cppu::ImplInheritanceHelper< CUIEvent, css::xml::dom::events::XMouseEvent > + CMouseEvent_Base; + +class CMouseEvent final + : public CMouseEvent_Base +{ + sal_Int32 m_screenX; + sal_Int32 m_screenY; + sal_Int32 m_clientX; + sal_Int32 m_clientY; + bool m_ctrlKey; + bool m_shiftKey; + bool m_altKey; + bool m_metaKey; + sal_Int16 m_button; + +public: + explicit CMouseEvent(); + + virtual sal_Int32 SAL_CALL getScreenX() override; + virtual sal_Int32 SAL_CALL getScreenY() override; + virtual sal_Int32 SAL_CALL getClientX() override; + virtual sal_Int32 SAL_CALL getClientY() override; + virtual sal_Bool SAL_CALL getCtrlKey() override; + virtual sal_Bool SAL_CALL getShiftKey() override; + virtual sal_Bool SAL_CALL getAltKey() override; + virtual sal_Bool SAL_CALL getMetaKey() override; + virtual sal_Int16 SAL_CALL getButton() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getRelatedTarget() override; + + virtual void SAL_CALL initMouseEvent( + const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const css::uno::Reference< css::xml::dom::views::XAbstractView >& viewArg, + sal_Int32 detailArg, + sal_Int32 screenXArg, + sal_Int32 screenYArg, + sal_Int32 clientXArg, + sal_Int32 clientYArg, + sal_Bool ctrlKeyArg, + sal_Bool altKeyArg, + sal_Bool shiftKeyArg, + sal_Bool metaKeyArg, + sal_Int16 buttonArg, + const css::uno::Reference< css::xml::dom::events::XEventTarget >& relatedTargetArg) override; + + // delegate to CUIevent + virtual css::uno::Reference< css::xml::dom::views::XAbstractView > SAL_CALL getView() override; + virtual sal_Int32 SAL_CALL getDetail() override; + virtual void SAL_CALL initUIEvent(const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const css::uno::Reference< css::xml::dom::views::XAbstractView >& viewArg, + sal_Int32 detailArg) override; + virtual OUString SAL_CALL getType() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getTarget() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getCurrentTarget() override; + virtual css::xml::dom::events::PhaseType SAL_CALL getEventPhase() override; + virtual sal_Bool SAL_CALL getBubbles() override; + virtual sal_Bool SAL_CALL getCancelable() override; + virtual css::util::Time SAL_CALL getTimeStamp() override; + virtual void SAL_CALL stopPropagation() override; + virtual void SAL_CALL preventDefault() override; + virtual void SAL_CALL initEvent( + const OUString& eventTypeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg) override; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/mutationevent.hxx b/unoxml/inc/mutationevent.hxx new file mode 100644 index 0000000000..0a7bd76b66 --- /dev/null +++ b/unoxml/inc/mutationevent.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/types.h> + +#include <com/sun/star/uno/Reference.h> + +#include <com/sun/star/xml/dom/events/PhaseType.hpp> +#include <com/sun/star/xml/dom/events/AttrChangeType.hpp> +#include <com/sun/star/xml/dom/events/XMutationEvent.hpp> + +#include <cppuhelper/implbase.hxx> + +#include "event.hxx" + +namespace DOM::events { + +typedef ::cppu::ImplInheritanceHelper< CEvent, css::xml::dom::events::XMutationEvent > + CMutationEvent_Base; + +class CMutationEvent final + : public CMutationEvent_Base +{ + css::uno::Reference< css::xml::dom::XNode > m_relatedNode; + OUString m_prevValue; + OUString m_newValue; + OUString m_attrName; + css::xml::dom::events::AttrChangeType m_attrChangeType; + +public: + explicit CMutationEvent(); + + virtual ~CMutationEvent() override; + + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getRelatedNode() override; + virtual OUString SAL_CALL getPrevValue() override; + virtual OUString SAL_CALL getNewValue() override; + virtual OUString SAL_CALL getAttrName() override; + virtual css::xml::dom::events::AttrChangeType SAL_CALL getAttrChange() override; + virtual void SAL_CALL initMutationEvent( + const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const css::uno::Reference< css::xml::dom::XNode >& relatedNodeArg, + const OUString& prevValueArg, + const OUString& newValueArg, + const OUString& attrNameArg, + css::xml::dom::events::AttrChangeType attrChangeArg) override; + + // delegate to CEvent, since we are inheriting from CEvent and XEvent + virtual OUString SAL_CALL getType() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getTarget() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getCurrentTarget() override; + virtual css::xml::dom::events::PhaseType SAL_CALL getEventPhase() override; + virtual sal_Bool SAL_CALL getBubbles() override; + virtual sal_Bool SAL_CALL getCancelable() override; + virtual css::util::Time SAL_CALL getTimeStamp() override; + virtual void SAL_CALL stopPropagation() override; + virtual void SAL_CALL preventDefault() override; + virtual void SAL_CALL initEvent( + const OUString& eventTypeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg) override; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/node.hxx b/unoxml/inc/node.hxx new file mode 100644 index 0000000000..17e474bf96 --- /dev/null +++ b/unoxml/inc/node.hxx @@ -0,0 +1,298 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <libxml/tree.h> + +#include <sal/types.h> +#include <rtl/ref.hxx> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> + +#include <cppuhelper/implbase.hxx> + +#include <sax/fastattribs.hxx> + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/xml/dom/XNode.hpp> +#include <com/sun/star/xml/dom/XNodeList.hpp> +#include <com/sun/star/xml/dom/XNamedNodeMap.hpp> +#include <com/sun/star/xml/dom/NodeType.hpp> +#include <com/sun/star/xml/dom/events/XEventTarget.hpp> +#include <com/sun/star/xml/dom/events/XEvent.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> + +#include <unordered_map> + +namespace DOM +{ + struct Context + { + Context( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& i_xHandler, + sax_fastparser::FastTokenHandlerBase* pTokenHandler ) : + maNamespaces( 1, std::vector<Namespace>() ), + maNamespaceMap(101), + mxAttribList(new sax_fastparser::FastAttributeList(pTokenHandler)), + mxCurrentHandler(i_xHandler), + mxDocHandler(i_xHandler), + mxTokenHandler(pTokenHandler) + {} + + struct Namespace + { + OString maPrefix; + sal_Int32 mnToken; + + const OString& getPrefix() const { return maPrefix; } + }; + + typedef std::vector< std::vector<Namespace> > NamespaceVectorType; + typedef std::unordered_map< OUString, sal_Int32 > NamespaceMapType; + + /// outer vector: xml context; inner vector: current NS + NamespaceVectorType maNamespaces; + NamespaceMapType maNamespaceMap; + ::rtl::Reference<sax_fastparser::FastAttributeList> mxAttribList; + css::uno::Reference<css::xml::sax::XFastContextHandler> mxCurrentHandler; + css::uno::Reference<css::xml::sax::XFastDocumentHandler> mxDocHandler; + rtl::Reference<sax_fastparser::FastTokenHandlerBase> mxTokenHandler; + }; + + void pushContext(Context& io_rContext); + void popContext(Context& io_rContext); + + sal_Int32 getTokenWithPrefix( const Context& rContext, const char* xPrefix, const char* xName ); + sal_Int32 getToken( const Context& rContext, const char* xName ); + + /// add namespaces on this node to context + void addNamespaces(Context& io_rContext, xmlNodePtr pNode); + + class CDocument; + + class SAL_LOPLUGIN_ANNOTATE("crosscast") CNode + : public cppu::WeakImplHelper< css::xml::dom::XNode, css::xml::dom::events::XEventTarget > + { + friend class CDocument; + friend class CElement; + friend class CAttributesMap; + + private: + bool m_bUnlinked; /// node has been removed from document + + protected: + css::xml::dom::NodeType const m_aNodeType; + /// libxml node; NB: not const, because invalidate may reset it to 0! + xmlNodePtr m_aNodePtr; + + ::rtl::Reference< CDocument > const m_xDocument; + ::osl::Mutex & m_rMutex; + + // for initialization by classes derived through ImplInheritanceHelper + CNode(CDocument const& rDocument, ::osl::Mutex const& rMutex, + css::xml::dom::NodeType const& reNodeType, xmlNodePtr const& rpNode); + void invalidate(); + + void dispatchSubtreeModified(); + + void checkNoParent(css::uno::Reference< css::xml::dom::XNode >const& xNode); + + static void checkNoParent(const xmlNodePtr pNode); + + void checkSameOwner(css::uno::Reference< css::xml::dom::XNode >const& xNode); + + public: + + virtual ~CNode() override; + + xmlNodePtr GetNodePtr() { return m_aNodePtr; } + + virtual CDocument & GetOwnerDocument(); + + // recursively create SAX events + virtual void saxify(const css::uno::Reference< css::xml::sax::XDocumentHandler >& i_xHandler); + + // recursively create SAX events + virtual void fastSaxify( Context& io_rContext ); + + // constrains child relationship between nodes based on type + virtual bool IsChildTypeAllowed(css::xml::dom::NodeType nodeType, + css::xml::dom::NodeType const* pReplacedNodeType); + + // ---- DOM interfaces + + /** + Adds the node newChild to the end of the list of children of this node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL + appendChild(css::uno::Reference< css::xml::dom::XNode > const& xNewChild) override; + + /** + Returns a duplicate of this node, i.e., serves as a generic copy + constructor for nodes. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override; + + /** + A NamedNodeMap containing the attributes of this node + (if it is an Element) or null otherwise. + */ + virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes() override; + + /** + A NodeList that contains all children of this node. + */ + virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override; + + /** + The first child of this node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override; + + /** + The last child of this node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override; + + /** + Returns the local part of the qualified name of this node. + */ + virtual OUString SAL_CALL getLocalName() override; + + /** + The namespace URI of this node, or null if it is unspecified. + */ + virtual OUString SAL_CALL getNamespaceURI() override; + + /** + The node immediately following this node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override; + + /** + The name of this node, depending on its type; see the table above. + -- virtual implemented by actual node types + */ + virtual OUString SAL_CALL getNodeName() override; + + /** + A code representing the type of the underlying object, as defined above. + */ + virtual css::xml::dom::NodeType SAL_CALL getNodeType() override; + + /** + The value of this node, depending on its type; see the table above. + -- virtual implemented by actual node types + */ + virtual OUString SAL_CALL getNodeValue() override; + + /** + The Document object associated with this node. + */ + virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override; + + /** + The parent of this node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override; + + /** + The namespace prefix of this node, or null if it is unspecified. + */ + virtual OUString SAL_CALL getPrefix() override; + + /** + The node immediately preceding this node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override; + + /** + Returns whether this node (if it is an element) has any attributes. + */ + virtual sal_Bool SAL_CALL hasAttributes() override; + + /** + Returns whether this node has any children. + */ + virtual sal_Bool SAL_CALL hasChildNodes() override; + + /** + Inserts the node newChild before the existing child node refChild. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore( + const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& refChild) override; + + /** + Tests whether the DOM implementation implements a specific feature and + that feature is supported by this node. + */ + virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver) override; + + /** + Puts all Text nodes in the full depth of the sub-tree underneath this + Node, including attribute nodes, into a "normal" form where only structure + (e.g., elements, comments, processing instructions, CDATA sections, and + entity references) separates Text nodes, i.e., there are neither adjacent + Text nodes nor empty Text nodes. + */ + virtual void SAL_CALL normalize() override; + + /** + Removes the child node indicated by oldChild from the list of children, + and returns it. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode >& oldChild) override; + + /** + Replaces the child node oldChild with newChild in the list of children, + and returns the oldChild node. + */ + virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild( + const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& oldChild) override; + + /** + The value of this node, depending on its type; see the table above. + */ + virtual void SAL_CALL setNodeValue(const OUString& nodeValue) override; + + /** + The namespace prefix of this node, or null if it is unspecified. + */ + virtual void SAL_CALL setPrefix(const OUString& prefix) override; + + + // --- XEventTarget + virtual void SAL_CALL addEventListener(const OUString& eventType, + const css::uno::Reference< css::xml::dom::events::XEventListener >& listener, + sal_Bool useCapture) override; + + virtual void SAL_CALL removeEventListener(const OUString& eventType, + const css::uno::Reference< css::xml::dom::events::XEventListener >& listener, + sal_Bool useCapture) override; + + virtual sal_Bool SAL_CALL dispatchEvent(const css::uno::Reference< css::xml::dom::events::XEvent >& evt) override; + }; + + /// eliminate redundant namespace declarations + void nscleanup(const xmlNodePtr aNode, const xmlNodePtr aParent); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/pch/precompiled_unoxml.cxx b/unoxml/inc/pch/precompiled_unoxml.cxx new file mode 100644 index 0000000000..e83e918909 --- /dev/null +++ b/unoxml/inc/pch/precompiled_unoxml.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "precompiled_unoxml.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/pch/precompiled_unoxml.hxx b/unoxml/inc/pch/precompiled_unoxml.hxx new file mode 100644 index 0000000000..f54942ca91 --- /dev/null +++ b/unoxml/inc/pch/precompiled_unoxml.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + This file has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2021-03-08 13:22:28 using: + ./bin/update_pch unoxml unoxml --cutoff=1 --exclude:system --exclude:module --exclude:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./unoxml/inc/pch/precompiled_unoxml.hxx "make unoxml.build" --find-conflicts +*/ + +#include <sal/config.h> +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <memory> +#include <stdarg.h> +#include <string.h> +#include <string_view> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <osl/mutex.hxx> +#include <rtl/instance.hxx> +#include <rtl/ustrbuf.hxx> +#include <sal/log.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/xml/dom/DOMException.hpp> +#include <com/sun/star/xml/dom/DocumentBuilder.hpp> +#include <com/sun/star/xml/dom/events/XDocumentEvent.hpp> +#include <com/sun/star/xml/dom/events/XMutationEvent.hpp> +#include <com/sun/star/xml/sax/FastToken.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/xpath/XPathException.hpp> +#include <comphelper/attributelist.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <libxml/tree.h> +#include <libxml/xmlerror.h> +#include <libxml/xmlstring.h> +#include <libxml/xpath.h> +#include <libxml/xpathInternals.h> +#include <o3tl/safeint.hxx> +#include <sax/fastattribs.hxx> +#include <comphelper/diagnose_ex.hxx> +#include <ucbhelper/commandenvironment.hxx> +#include <ucbhelper/content.hxx> +#include <xmloff/xmlimp.hxx> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/inc/uievent.hxx b/unoxml/inc/uievent.hxx new file mode 100644 index 0000000000..cfa39c5c4b --- /dev/null +++ b/unoxml/inc/uievent.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/types.h> + +#include <com/sun/star/xml/dom/events/PhaseType.hpp> +#include <com/sun/star/xml/dom/events/XUIEvent.hpp> +#include <com/sun/star/xml/dom/views/XAbstractView.hpp> + +#include <cppuhelper/implbase.hxx> + +#include "event.hxx" + +namespace DOM::events { + +typedef ::cppu::ImplInheritanceHelper< CEvent, css::xml::dom::events::XUIEvent > CUIEvent_Base; + +class CUIEvent + : public CUIEvent_Base +{ + sal_Int32 m_detail; + css::uno::Reference< css::xml::dom::views::XAbstractView > m_view; + +public: + explicit CUIEvent(); + + virtual css::uno::Reference< css::xml::dom::views::XAbstractView > SAL_CALL getView() override; + virtual sal_Int32 SAL_CALL getDetail() override; + virtual void SAL_CALL initUIEvent(const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const css::uno::Reference< css::xml::dom::views::XAbstractView >& viewArg, + sal_Int32 detailArg) override; + + // delegate to CEvent, since we are inheriting from CEvent and XEvent + virtual OUString SAL_CALL getType() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getTarget() override; + virtual css::uno::Reference< css::xml::dom::events::XEventTarget > SAL_CALL getCurrentTarget() override; + virtual css::xml::dom::events::PhaseType SAL_CALL getEventPhase() override; + virtual sal_Bool SAL_CALL getBubbles() override; + virtual sal_Bool SAL_CALL getCancelable() override; + virtual css::util::Time SAL_CALL getTimeStamp() override; + virtual void SAL_CALL stopPropagation() override; + virtual void SAL_CALL preventDefault() override; + virtual void SAL_CALL initEvent( + const OUString& eventTypeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg) override; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |