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/implbase.hxx>
24 :
25 : #include <com/sun/star/text/XTextMarkup.hpp>
26 : #include <com/sun/star/text/XMultiTextMarkup.hpp>
27 :
28 : #include <unobaseclass.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 SwTextNode;
41 : class ModelToViewHelper;
42 : class SfxPoolItem;
43 :
44 : /** Implementation of the css::text::XTextMarkup interface
45 : */
46 : class SwXTextMarkup
47 : : public ::cppu::WeakImplHelper
48 : < ::com::sun::star::text::XTextMarkup
49 : , ::com::sun::star::text::XMultiTextMarkup
50 : >
51 : {
52 : public:
53 : SwXTextMarkup(SwTextNode *const rTextNode,
54 : const ModelToViewHelper& rConversionMap);
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, std::exception) SAL_OVERRIDE;
59 :
60 : virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
61 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 :
63 : virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange> & xRange,
64 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > & xMarkupInfoContainer) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 :
66 : // ::com::sun::star::text::XMultiTextMarkup:
67 : 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;
68 :
69 : private:
70 : SwXTextMarkup( const SwXTextMarkup & ) SAL_DELETED_FUNCTION;
71 : SwXTextMarkup & operator =( const SwXTextMarkup & ) SAL_DELETED_FUNCTION;
72 :
73 : struct Impl;
74 : ::sw::UnoImplPtr<Impl> m_pImpl;
75 :
76 : protected:
77 : SwTextNode* GetTextNode();
78 : void ClearTextNode();
79 : const ModelToViewHelper& GetConversionMap();
80 : };
81 :
82 : /** Implementation of the ::com::sun::star::container::XStringKeyMap interface
83 : */
84 : class SwXStringKeyMap:
85 : public ::cppu::WeakImplHelper<
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 &) SAL_DELETED_FUNCTION;
101 : void operator =(SwXStringKeyMap &) SAL_DELETED_FUNCTION;
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: */
|