xref: /aoo41x/main/sw/inc/unotextmarkup.hxx (revision 1d2dbeb0)
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 class SwTxtNode;
41 class SfxPoolItem;
42 
43 /** Implementation of the css::text::XTextMarkup interface
44  */
45 class SwXTextMarkup:
46     public ::cppu::WeakImplHelper2
47     <
48         ::com::sun::star::text::XTextMarkup,
49         ::com::sun::star::text::XMultiTextMarkup
50     >,
51     public SwClient
52 {
53 public:
54     SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper::ConversionMap* pConversionMap );
55     virtual ~SwXTextMarkup();
56 
57     // ::com::sun::star::text::XTextMarkup:
58     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException);
59     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);
60 
61     // ::com::sun::star::text::XMultiTextMarkup:
62     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);
63 
64 private:
65     SwXTextMarkup( const SwXTextMarkup & ); // not defined
66     SwXTextMarkup & operator =( const SwXTextMarkup & ); // not defined
67 
68 protected:
69     //SwClient
70    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
71 
72     SwTxtNode* mpTxtNode;
73     const ModelToViewHelper::ConversionMap* mpConversionMap;
74 
75 };
76 
77 
78 /** Implementation of the ::com::sun::star::container::XStringKeyMap interface
79  */
80 class SwXStringKeyMap:
81     public ::cppu::WeakImplHelper1<
82         ::com::sun::star::container::XStringKeyMap>
83 {
84 public:
85     SwXStringKeyMap();
86 
87     // ::com::sun::star::container::XStringKeyMap:
88     virtual ::com::sun::star::uno::Any SAL_CALL getValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
89     virtual ::sal_Bool SAL_CALL hasValue(const ::rtl::OUString & aKey) throw (::com::sun::star::uno::RuntimeException);
90     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);
91     virtual ::sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
92     virtual ::rtl::OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
93     virtual ::com::sun::star::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
94 
95 private:
96     SwXStringKeyMap(SwXStringKeyMap &); // not defined
97     void operator =(SwXStringKeyMap &); // not defined
98 
99     virtual ~SwXStringKeyMap() {}
100 
101     std::map< rtl::OUString, ::com::sun::star::uno::Any > maMap;
102 };
103 
104 #endif
105 
106 
107