Update git submodules
[LibreOffice.git] / sw / source / core / inc / unotextmarkup.hxx
blob3f2a7d447c6af4c0c2c261c170b6937867a36991
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/text/XTextMarkup.hpp>
25 #include <com/sun/star/text/XMultiTextMarkup.hpp>
27 #include <unobaseclass.hxx>
29 #include <map>
31 namespace com::sun::star::container { class XStringKeyMap; }
32 namespace com::sun::star::text { class XTextRange; }
33 class SwTextNode;
34 class ModelToViewHelper;
36 /** Implementation of the css::text::XTextMarkup interface
38 class SwXTextMarkup
39 : public ::cppu::WeakImplHelper
40 < css::text::XTextMarkup
41 , css::text::XMultiTextMarkup
44 public:
45 SwXTextMarkup(SwTextNode *const rTextNode,
46 const ModelToViewHelper& rConversionMap);
47 virtual ~SwXTextMarkup() override;
49 // css::text::XTextMarkup:
50 virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override;
52 virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
53 const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) override;
55 virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const css::uno::Reference< css::text::XTextRange> & xRange,
56 const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) override;
58 // css::text::XMultiTextMarkup:
59 virtual void SAL_CALL commitMultiTextMarkup( const css::uno::Sequence< css::text::TextMarkupDescriptor >& aMarkups ) override;
61 private:
62 SwXTextMarkup( const SwXTextMarkup & ) = delete;
63 SwXTextMarkup & operator =( const SwXTextMarkup & ) = delete;
65 struct Impl;
66 ::sw::UnoImplPtr<Impl> m_pImpl;
68 protected:
69 SwTextNode* GetTextNode();
70 void ClearTextNode();
71 const ModelToViewHelper& GetConversionMap() const;
74 /** Implementation of the css::container::XStringKeyMap interface
76 class SwXStringKeyMap final :
77 public ::cppu::WeakImplHelper<
78 css::container::XStringKeyMap>
80 public:
81 SwXStringKeyMap();
83 // css::container::XStringKeyMap:
84 virtual css::uno::Any SAL_CALL getValue(const OUString & aKey) override;
85 virtual sal_Bool SAL_CALL hasValue(const OUString & aKey) override;
86 virtual void SAL_CALL insertValue(const OUString & aKey, const css::uno::Any & aValue) override;
87 virtual ::sal_Int32 SAL_CALL getCount() override;
88 virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) override;
89 virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) override;
91 private:
92 SwXStringKeyMap(SwXStringKeyMap const &) = delete;
93 void operator =(SwXStringKeyMap const &) = delete;
95 virtual ~SwXStringKeyMap() override {}
97 std::map< OUString, css::uno::Any > maMap;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */