LibreOffice Module sw (master)  1
unoflatpara.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_UNOFLATPARA_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNOFLATPARA_HXX
22 
23 #include <cppuhelper/implbase.hxx>
24 
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/lang/XUnoTunnel.hpp>
27 #include <com/sun/star/text/XFlatParagraph.hpp>
28 #include <com/sun/star/text/XFlatParagraphIterator.hpp>
29 #include <svl/listener.hxx>
30 #include "unotextmarkup.hxx"
31 
32 #include <set>
33 
34 namespace com { namespace sun { namespace star { namespace container {
35  class XStringKeyMap;
36 } } } }
37 
38 namespace com { namespace sun { namespace star { namespace text {
39  class XTextRange;
40 } } } }
41 
42 class SwTextNode;
43 class SwDoc;
45 
46 typedef ::cppu::ImplInheritanceHelper
48 , css::beans::XPropertySet
49 , css::text::XFlatParagraph
50 , css::lang::XUnoTunnel
52 
54  : public SwXFlatParagraph_Base
55 {
56 public:
57  SwXFlatParagraph( SwTextNode& rTextNode, const OUString& aExpandText, const ModelToViewHelper& rConversionMap );
58  virtual ~SwXFlatParagraph() override;
59 
60  // XPropertySet
61  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
62  getPropertySetInfo() override;
63  virtual void SAL_CALL setPropertyValue(
64  const OUString& rPropertyName,
65  const css::uno::Any& rValue) override;
66  virtual css::uno::Any SAL_CALL getPropertyValue(
67  const OUString& rPropertyName) override;
68  virtual void SAL_CALL addPropertyChangeListener(
69  const OUString& rPropertyName,
70  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
71  virtual void SAL_CALL removePropertyChangeListener(
72  const OUString& rPropertyName,
73  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
74  virtual void SAL_CALL addVetoableChangeListener(
75  const OUString& rPropertyName,
76  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
77  virtual void SAL_CALL removeVetoableChangeListener(
78  const OUString& rPropertyName,
79  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
80 
81  // text::XTextMarkup:
82  virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override;
83 
84  virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString & aIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
85  const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) override;
86 
87  virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const css::uno::Reference< css::text::XTextRange> & xRange,
88  const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) override;
89 
90  // text::XFlatParagraph:
91  virtual OUString SAL_CALL getText() override;
92  virtual sal_Bool SAL_CALL isModified() override;
93  virtual void SAL_CALL setChecked(::sal_Int32 nType, sal_Bool bVal) override;
94  virtual sal_Bool SAL_CALL isChecked(::sal_Int32 nType) override;
95  virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) override;
96  virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen) override;
97  virtual void SAL_CALL changeText(::sal_Int32 nPos, ::sal_Int32 nLen, const OUString & aNewText, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) override;
98  virtual void SAL_CALL changeAttributes(::sal_Int32 nPos, ::sal_Int32 nLen, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) override;
99  virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() override;
100 
102 
103  static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
104 
105  // XUnoTunnel
106  virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId) override;
107 
108 private:
109  SwXFlatParagraph( const SwXFlatParagraph & ) = delete;
110  SwXFlatParagraph & operator = ( const SwXFlatParagraph & ) = delete;
111 
112  OUString const maExpandText;
113 };
114 
116  public ::cppu::WeakImplHelper
117  <
118  css::text::XFlatParagraphIterator
119  >,
120  public SvtListener
121 {
122 public:
123  SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, bool bAutomatic );
124  virtual ~SwXFlatParagraphIterator() override;
125 
126  // text::XFlatParagraphIterator:
127  virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() override;
128  virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() override;
129  virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() override;
130  virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaBefore(const css::uno::Reference< css::text::XFlatParagraph > & xPara) override;
131  virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaAfter(const css::uno::Reference< css::text::XFlatParagraph > & xPara) override;
132 
133  virtual void Notify( const SfxHint& ) override;
134 
135 private:
138 
139  // container to hold the 'hard' references as long as necessary and valid
140  std::set< css::uno::Reference< css::text::XFlatParagraph > > m_aFlatParaList;
141 
143  const sal_Int32 mnType;
144  const bool mbAutomatic;
145 
146  sal_uLong mnCurrentNode; // used for non-automatic mode
147  sal_uLong mnEndNode; // used for non-automatic mode
148 };
149 
150 #endif
151 
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString const maExpandText
virtual OUString SAL_CALL getText() override
SwXFlatParagraphIterator(SwDoc &rDoc, sal_Int32 nType, bool bAutomatic)
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL changeText(::sal_Int32 nPos,::sal_Int32 nLen, const OUString &aNewText, const css::uno::Sequence< css::beans::PropertyValue > &aAttributes) override
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaAfter(const css::uno::Reference< css::text::XFlatParagraph > &xPara) override
sal_uIntPtr sal_uLong
Implementation of the css::text::XTextMarkup interface.
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: doc.hxx:185
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual sal_Bool SAL_CALL isModified() override
SwTextNode * GetTextNode()
virtual void Notify(const SfxHint &) override
::cppu::ImplInheritanceHelper< SwXTextMarkup, css::beans::XPropertySet, css::text::XFlatParagraph, css::lang::XUnoTunnel > SwXFlatParagraph_Base
Definition: unoflatpara.hxx:44
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaBefore(const css::uno::Reference< css::text::XFlatParagraph > &xPara) override
FUNC_TYPE const nType
std::set< css::uno::Reference< css::text::XFlatParagraph > > m_aFlatParaList
virtual ~SwXFlatParagraphIterator() override
virtual void SAL_CALL changeAttributes(::sal_Int32 nPos,::sal_Int32 nLen, const css::uno::Sequence< css::beans::PropertyValue > &aAttributes) 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
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() override
virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos,::sal_Int32 nLen) override
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() override
unsigned char sal_Bool
SwXFlatParagraph & operator=(const SwXFlatParagraph &)=delete
virtual sal_Bool SAL_CALL isChecked(::sal_Int32 nType) override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
const sal_Int32 mnType
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
SwXFlatParagraph(SwTextNode &rTextNode, const OUString &aExpandText, const ModelToViewHelper &rConversionMap)
Definition: unoflatpara.cxx:69
virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() override
virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos,::sal_Int32 nLen) override
def text(shape, st)
virtual ~SwXFlatParagraph() override
Definition: unoflatpara.cxx:75
virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
sal_Int32 const nLength
sal_Int32 nPos
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unoflatpara.cxx:93
virtual void SAL_CALL setChecked(::sal_Int32 nType, sal_Bool bVal) override
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unoflatpara.cxx:82
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
SwXFlatParagraphIterator & operator=(const SwXFlatParagraphIterator &)=delete