1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _UNOTEXTMARKUP_HXX 25 #define _UNOTEXTMARKUP_HXX 26 27 #include <cppuhelper/implbase1.hxx> 28 #include <cppuhelper/implbase2.hxx> 29 #include <com/sun/star/text/XTextMarkup.hpp> 30 #include <com/sun/star/text/XMultiTextMarkup.hpp> 31 #include <calbck.hxx> 32 #include <modeltoviewhelper.hxx> 33 34 #include <map> 35 36 namespace com { namespace sun { namespace star { namespace container { 37 class XStringKeyMap; 38 } } } } 39 40 namespace com { namespace sun { namespace star { namespace text { 41 class XTextRange; 42 } } } } 43 44 45 class SwTxtNode; 46 class SfxPoolItem; 47 48 /** Implementation of the css::text::XTextMarkup interface 49 */ 50 class SwXTextMarkup: 51 public ::cppu::WeakImplHelper2 52 < 53 ::com::sun::star::text::XTextMarkup, 54 ::com::sun::star::text::XMultiTextMarkup 55 >, 56 public SwClient 57 { 58 public: 59 SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper::ConversionMap* pConversionMap ); 60 virtual ~SwXTextMarkup(); 61 62 // ::com::sun::star::text::XTextMarkup: 63 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException); 64 65 virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, 66 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException); 67 68 virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange> & xRange, 69 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException); 70 71 72 73 // ::com::sun::star::text::XMultiTextMarkup: 74 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); 75 76 private: 77 SwXTextMarkup( const SwXTextMarkup & ); // not defined 78 SwXTextMarkup & operator =( const SwXTextMarkup & ); // not defined 79 80 protected: 81 //SwClient 82 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew); 83 84 SwTxtNode* mpTxtNode; 85 const ModelToViewHelper::ConversionMap* mpConversionMap; 86 87 }; 88 89 90 /** Implementation of the ::com::sun::star::container::XStringKeyMap interface 91 */ 92 class SwXStringKeyMap: 93 public ::cppu::WeakImplHelper1< 94 ::com::sun::star::container::XStringKeyMap> 95 { 96 public: 97 SwXStringKeyMap(); 98 99 // ::com::sun::star::container::XStringKeyMap: 100 virtual ::com::sun::star::uno::Any SAL_CALL getValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException); 101 virtual ::sal_Bool SAL_CALL hasValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException); 102 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); 103 virtual ::sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException); 104 virtual ::rtl::OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 105 virtual ::com::sun::star::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 106 107 private: 108 SwXStringKeyMap(SwXStringKeyMap &); // not defined 109 void operator =(SwXStringKeyMap &); // not defined 110 ~SwXStringKeyMap()111 virtual ~SwXStringKeyMap() {} 112 113 std::map< rtl::OUString, ::com::sun::star::uno::Any > maMap; 114 }; 115 116 #endif 117 118 119