Line data Source code
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 :
20 : #ifndef _UNOTEXTMARKUP_HXX
21 : #define _UNOTEXTMARKUP_HXX
22 :
23 : #include <cppuhelper/implbase1.hxx>
24 : #include <cppuhelper/implbase2.hxx>
25 : #include <com/sun/star/text/XTextMarkup.hpp>
26 : #include <com/sun/star/text/XMultiTextMarkup.hpp>
27 : #include <calbck.hxx>
28 : #include <modeltoviewhelper.hxx>
29 :
30 : #include <map>
31 :
32 : namespace com { namespace sun { namespace star { namespace container {
33 : class XStringKeyMap;
34 : } } } }
35 :
36 : namespace com { namespace sun { namespace star { namespace text {
37 : class XTextRange;
38 : } } } }
39 :
40 :
41 : class SwTxtNode;
42 : class SfxPoolItem;
43 :
44 : /** Implementation of the css::text::XTextMarkup interface
45 : */
46 : class SwXTextMarkup:
47 : public ::cppu::WeakImplHelper2
48 : <
49 : ::com::sun::star::text::XTextMarkup,
50 : ::com::sun::star::text::XMultiTextMarkup
51 : >,
52 : public SwClient
53 : {
54 : public:
55 : SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper& rConversionMap );
56 : virtual ~SwXTextMarkup();
57 :
58 : // ::com::sun::star::text::XTextMarkup:
59 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() throw (::com::sun::star::uno::RuntimeException);
60 :
61 : virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
62 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException);
63 :
64 : virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange> & xRange,
65 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException);
66 :
67 : // ::com::sun::star::text::XMultiTextMarkup:
68 : 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);
69 :
70 : private:
71 : SwXTextMarkup( const SwXTextMarkup & ); // not defined
72 : SwXTextMarkup & operator =( const SwXTextMarkup & ); // not defined
73 :
74 : protected:
75 : //SwClient
76 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
77 :
78 : SwTxtNode* mpTxtNode;
79 : const ModelToViewHelper maConversionMap;
80 : };
81 :
82 :
83 : /** Implementation of the ::com::sun::star::container::XStringKeyMap interface
84 : */
85 : class SwXStringKeyMap:
86 : public ::cppu::WeakImplHelper1<
87 : ::com::sun::star::container::XStringKeyMap>
88 : {
89 : public:
90 : SwXStringKeyMap();
91 :
92 : // ::com::sun::star::container::XStringKeyMap:
93 : virtual ::com::sun::star::uno::Any SAL_CALL getValue(const OUString & aKey) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException);
94 : virtual ::sal_Bool SAL_CALL hasValue(const OUString & aKey) throw (::com::sun::star::uno::RuntimeException);
95 : virtual void SAL_CALL insertValue(const 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);
96 : virtual ::sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
97 : virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
98 : virtual ::com::sun::star::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
99 :
100 : private:
101 : SwXStringKeyMap(SwXStringKeyMap &); // not defined
102 : void operator =(SwXStringKeyMap &); // not defined
103 :
104 0 : virtual ~SwXStringKeyMap() {}
105 :
106 : std::map< OUString, ::com::sun::star::uno::Any > maMap;
107 : };
108 :
109 : #endif
110 :
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|