1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _UNOTEXTMARKUP_HXX 29 #define _UNOTEXTMARKUP_HXX 30 31 #include <cppuhelper/implbase1.hxx> 32 #include <cppuhelper/implbase2.hxx> 33 #include <com/sun/star/text/XTextMarkup.hpp> 34 #include <com/sun/star/text/XMultiTextMarkup.hpp> 35 #include <calbck.hxx> 36 #include <modeltoviewhelper.hxx> 37 38 #include <map> 39 40 namespace com { namespace sun { namespace star { namespace container { 41 class XStringKeyMap; 42 } } } } 43 44 class SwTxtNode; 45 class SfxPoolItem; 46 47 /** Implementation of the css::text::XTextMarkup interface 48 */ 49 class SwXTextMarkup: 50 public ::cppu::WeakImplHelper2 51 < 52 ::com::sun::star::text::XTextMarkup, 53 ::com::sun::star::text::XMultiTextMarkup 54 >, 55 public SwClient 56 { 57 public: 58 SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper::ConversionMap* pConversionMap ); 59 virtual ~SwXTextMarkup(); 60 61 // ::com::sun::star::text::XTextMarkup: 62 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException); 63 virtual void SAL_CALL commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException); 64 65 // ::com::sun::star::text::XMultiTextMarkup: 66 virtual void SAL_CALL commitMultiTextMarkup( const ::com::sun::star::uno::Sequence< ::com::sun::star::text::TextMarkupDescriptor >& aMarkups ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 67 68 private: 69 SwXTextMarkup( const SwXTextMarkup & ); // not defined 70 SwXTextMarkup & operator =( const SwXTextMarkup & ); // not defined 71 72 protected: 73 //SwClient 74 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew); 75 76 SwTxtNode* mpTxtNode; 77 const ModelToViewHelper::ConversionMap* mpConversionMap; 78 79 }; 80 81 82 /** Implementation of the ::com::sun::star::container::XStringKeyMap interface 83 */ 84 class SwXStringKeyMap: 85 public ::cppu::WeakImplHelper1< 86 ::com::sun::star::container::XStringKeyMap> 87 { 88 public: 89 SwXStringKeyMap(); 90 91 // ::com::sun::star::container::XStringKeyMap: 92 virtual ::com::sun::star::uno::Any SAL_CALL getValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException); 93 virtual ::sal_Bool SAL_CALL hasValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException); 94 virtual void SAL_CALL insertValue(const ::rtl::OUString & aKey, const ::com::sun::star::uno::Any & aValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException); 95 virtual ::sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException); 96 virtual ::rtl::OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 97 virtual ::com::sun::star::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 98 99 private: 100 SwXStringKeyMap(SwXStringKeyMap &); // not defined 101 void operator =(SwXStringKeyMap &); // not defined 102 103 virtual ~SwXStringKeyMap() {} 104 105 std::map< rtl::OUString, ::com::sun::star::uno::Any > maMap; 106 }; 107 108 #endif 109 110 111