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