LibreOffice Module sw (master)  1
unotextmarkup.hxx
Go to the documentation of this file.
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 
46  : public ::cppu::WeakImplHelper
47  < css::text::XTextMarkup
48  , css::text::XMultiTextMarkup
49  >
50 {
51 public:
52  SwXTextMarkup(SwTextNode *const rTextNode,
53  const ModelToViewHelper& rConversionMap);
54  virtual ~SwXTextMarkup() override;
55 
56  // css::text::XTextMarkup:
57  virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override;
58 
59  virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
60  const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) override;
61 
62  virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const css::uno::Reference< css::text::XTextRange> & xRange,
63  const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) override;
64 
65  // css::text::XMultiTextMarkup:
66  virtual void SAL_CALL commitMultiTextMarkup( const css::uno::Sequence< css::text::TextMarkupDescriptor >& aMarkups ) override;
67 
68 private:
69  SwXTextMarkup( const SwXTextMarkup & ) = delete;
70  SwXTextMarkup & operator =( const SwXTextMarkup & ) = delete;
71 
72  struct Impl;
74 
75 protected:
77  void ClearTextNode();
78  const ModelToViewHelper& GetConversionMap() const;
79 };
80 
84  public ::cppu::WeakImplHelper<
85  css::container::XStringKeyMap>
86 {
87 public:
89 
90  // css::container::XStringKeyMap:
91  virtual css::uno::Any SAL_CALL getValue(const OUString & aKey) override;
92  virtual sal_Bool SAL_CALL hasValue(const OUString & aKey) override;
93  virtual void SAL_CALL insertValue(const OUString & aKey, const css::uno::Any & aValue) override;
94  virtual ::sal_Int32 SAL_CALL getCount() override;
95  virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) override;
96  virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) override;
97 
98 private:
99  SwXStringKeyMap(SwXStringKeyMap const &) = delete;
100  void operator =(SwXStringKeyMap const &) = delete;
101 
102  virtual ~SwXStringKeyMap() override {}
103 
104  std::map< OUString, css::uno::Any > maMap;
105 };
106 
107 #endif
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Any SAL_CALL getValue(const OUString &aKey) override
virtual sal_Bool SAL_CALL hasValue(const OUString &aKey) override
Implementation of the css::text::XTextMarkup interface.
virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) override
SwTextNode * GetTextNode()
virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override
void ClearTextNode()
virtual ~SwXTextMarkup() override
void operator=(SwXStringKeyMap const &)=delete
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
std::map< OUString, css::uno::Any > maMap
virtual void SAL_CALL commitMultiTextMarkup(const css::uno::Sequence< css::text::TextMarkupDescriptor > &aMarkups) override
virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) override
virtual void SAL_CALL insertValue(const OUString &aKey, const css::uno::Any &aValue) override
virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString &aIdentifier,::sal_Int32 nStart,::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
SwXTextMarkup(SwTextNode *const rTextNode, const ModelToViewHelper &rConversionMap)
Implementation of the css::container::XStringKeyMap interface.
QPRO_FUNC_TYPE const nType
unsigned char sal_Bool
::sw::UnoImplPtr< Impl > m_pImpl
SwXTextMarkup & operator=(const SwXTextMarkup &)=delete
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual ~SwXStringKeyMap() override
virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString &aIdentifier, const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
def text(shape, st)
sal_Int32 const nLength
virtual ::sal_Int32 SAL_CALL getCount() override
const ModelToViewHelper & GetConversionMap() const