1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #ifndef INCLUDED_SW_INC_UNOREDLINE_HXX 20 #define INCLUDED_SW_INC_UNOREDLINE_HXX 21 22 #include <svl/listener.hxx> 23 #include <com/sun/star/container/XEnumerationAccess.hpp> 24 #include "unotext.hxx" 25 #include "ndindex.hxx" 26 27 class SwRangeRedline; 28 29 /** 30 * SwXRedlineText provides an XText which may be used to write 31 * directly into a redline node. It got implemented to enable XML 32 * import of redlines and should not be used directly via the API. 33 */ 34 class SwXRedlineText final : 35 public SwXText, 36 public cppu::OWeakObject, 37 public css::container::XEnumerationAccess 38 { 39 SwNodeIndex aNodeIndex; 40 virtual const SwStartNode *GetStartNode() const override; 41 42 public: 43 SwXRedlineText(SwDoc* pDoc, const SwNodeIndex& aNodeIndex); 44 45 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; acquire()46 virtual void SAL_CALL acquire( ) throw() override {OWeakObject::acquire();} release()47 virtual void SAL_CALL release( ) throw() override {OWeakObject::release();} 48 49 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; 50 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; 51 52 //XText 53 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; 54 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; 55 56 //XEnumerationAccess 57 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; 58 59 //XElementAccess (via XEnumerationAccess) 60 virtual css::uno::Type SAL_CALL getElementType( ) override; 61 virtual sal_Bool SAL_CALL hasElements( ) override; 62 }; 63 64 typedef cppu::WeakImplHelper<css::container::XEnumerationAccess> SwXRedlineBaseClass; 65 66 class SwXRedline final 67 : public SwXRedlineBaseClass 68 , public SwXText 69 , public SvtListener 70 { 71 SwDoc* pDoc; 72 SwRangeRedline* pRedline; 73 public: 74 SwXRedline(SwRangeRedline& rRedline, SwDoc& rDoc); 75 virtual ~SwXRedline() override; 76 77 78 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; acquire()79 virtual void SAL_CALL acquire( ) throw() override {OWeakObject::acquire();} release()80 virtual void SAL_CALL release( ) throw() override {OWeakObject::release();} 81 82 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; 83 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; 84 85 //XText 86 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; 87 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; 88 89 //XPropertySet 90 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; 91 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; 92 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; 93 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; 94 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; 95 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; 96 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; 97 98 //XEnumerationAccess 99 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; 100 101 //XElementAccess 102 virtual css::uno::Type SAL_CALL getElementType( ) override; 103 virtual sal_Bool SAL_CALL hasElements( ) override; 104 GetRedline() const105 const SwRangeRedline* GetRedline() const {return pRedline;} 106 virtual void Notify( const SfxHint& ) override; 107 }; 108 109 namespace sw 110 { 111 struct SW_DLLPUBLIC FindRedlineHint final: SfxHint 112 { 113 const SwRangeRedline& m_rRedline; 114 SwXRedline** m_ppXRedline; FindRedlineHintsw::FindRedlineHint115 FindRedlineHint(const SwRangeRedline& rRedline, SwXRedline** ppXRedline) : m_rRedline(rRedline), m_ppXRedline(ppXRedline) {} 116 }; 117 } 118 119 #endif 120 121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 122