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 INCLUDED_SW_SOURCE_CORE_INC_UNOTEXTMARKUP_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_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 : 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 *const rTxtNode,
55 : 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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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) SAL_OVERRIDE;
77 :
78 : SwTxtNode* mpTxtNode;
79 : const ModelToViewHelper maConversionMap;
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 OUString & aKey) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::container::NoSuchElementException, std::exception) SAL_OVERRIDE;
93 : virtual sal_Bool SAL_CALL hasValue(const OUString & aKey) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : 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, std::exception) SAL_OVERRIDE;
95 : virtual ::sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
97 : virtual ::com::sun::star::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
98 :
99 : private:
100 : SwXStringKeyMap(SwXStringKeyMap &); // not defined
101 : void operator =(SwXStringKeyMap &); // not defined
102 :
103 0 : virtual ~SwXStringKeyMap() {}
104 :
105 : std::map< OUString, ::com::sun::star::uno::Any > maMap;
106 : };
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|