1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNOFLATPARA_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNOFLATPARA_HXX
23 #include <cppuhelper/implbase.hxx>
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 <tools/solar.h>
31 #include "unotextmarkup.hxx"
35 namespace com::sun::star::container
{ class XStringKeyMap
; }
36 namespace com::sun::star::text
{ class XTextRange
; }
39 class ModelToViewHelper
;
41 typedef ::cppu::ImplInheritanceHelper
43 , css::beans::XPropertySet
44 , css::text::XFlatParagraph
45 , css::lang::XUnoTunnel
46 > SwXFlatParagraph_Base
;
48 class SwXFlatParagraph
49 : public SwXFlatParagraph_Base
52 SwXFlatParagraph( SwTextNode
& rTextNode
, const OUString
& aExpandText
, const ModelToViewHelper
& rConversionMap
);
53 virtual ~SwXFlatParagraph() override
;
56 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
57 getPropertySetInfo() override
;
58 virtual void SAL_CALL
setPropertyValue(
59 const OUString
& rPropertyName
,
60 const css::uno::Any
& rValue
) override
;
61 virtual css::uno::Any SAL_CALL
getPropertyValue(
62 const OUString
& rPropertyName
) override
;
63 virtual void SAL_CALL
addPropertyChangeListener(
64 const OUString
& rPropertyName
,
65 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
66 virtual void SAL_CALL
removePropertyChangeListener(
67 const OUString
& rPropertyName
,
68 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
69 virtual void SAL_CALL
addVetoableChangeListener(
70 const OUString
& rPropertyName
,
71 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
72 virtual void SAL_CALL
removeVetoableChangeListener(
73 const OUString
& rPropertyName
,
74 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
77 virtual css::uno::Reference
< css::container::XStringKeyMap
> SAL_CALL
getMarkupInfoContainer() override
;
79 virtual void SAL_CALL
commitStringMarkup(::sal_Int32 nType
, const OUString
& aIdentifier
, ::sal_Int32 nStart
, ::sal_Int32 nLength
,
80 const css::uno::Reference
< css::container::XStringKeyMap
> & xMarkupInfoContainer
) override
;
82 virtual void SAL_CALL
commitTextRangeMarkup(::sal_Int32 nType
, const OUString
& aIdentifier
, const css::uno::Reference
< css::text::XTextRange
> & xRange
,
83 const css::uno::Reference
< css::container::XStringKeyMap
> & xMarkupInfoContainer
) override
;
85 // text::XFlatParagraph:
86 virtual OUString SAL_CALL
getText() override
;
87 virtual sal_Bool SAL_CALL
isModified() override
;
88 virtual void SAL_CALL
setChecked(::sal_Int32 nType
, sal_Bool bVal
) override
;
89 virtual sal_Bool SAL_CALL
isChecked(::sal_Int32 nType
) override
;
90 virtual css::lang::Locale SAL_CALL
getLanguageOfText(::sal_Int32 nPos
, ::sal_Int32 nLen
) override
;
91 virtual css::lang::Locale SAL_CALL
getPrimaryLanguageOfText(::sal_Int32 nPos
, ::sal_Int32 nLen
) override
;
92 virtual void SAL_CALL
changeText(::sal_Int32 nPos
, ::sal_Int32 nLen
, const OUString
& aNewText
, const css::uno::Sequence
< css::beans::PropertyValue
> & aAttributes
) override
;
93 virtual void SAL_CALL
changeAttributes(::sal_Int32 nPos
, ::sal_Int32 nLen
, const css::uno::Sequence
< css::beans::PropertyValue
> & aAttributes
) override
;
94 virtual css::uno::Sequence
< ::sal_Int32
> SAL_CALL
getLanguagePortions() override
;
96 using SwXTextMarkup::GetTextNode
;
98 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
101 virtual sal_Int64 SAL_CALL
getSomething(const css::uno::Sequence
< sal_Int8
>& rId
) override
;
104 SwXFlatParagraph( const SwXFlatParagraph
& ) = delete;
105 SwXFlatParagraph
& operator = ( const SwXFlatParagraph
& ) = delete;
107 OUString maExpandText
;
110 class SwXFlatParagraphIterator
:
111 public ::cppu::WeakImplHelper
113 css::text::XFlatParagraphIterator
118 SwXFlatParagraphIterator( SwDoc
& rDoc
, sal_Int32 nType
, bool bAutomatic
);
119 virtual ~SwXFlatParagraphIterator() override
;
121 // text::XFlatParagraphIterator:
122 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getFirstPara() override
;
123 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getNextPara() override
;
124 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getLastPara() override
;
125 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getParaBefore(const css::uno::Reference
< css::text::XFlatParagraph
> & xPara
) override
;
126 virtual css::uno::Reference
< css::text::XFlatParagraph
> SAL_CALL
getParaAfter(const css::uno::Reference
< css::text::XFlatParagraph
> & xPara
) override
;
128 virtual void Notify( const SfxHint
& ) override
;
131 SwXFlatParagraphIterator( const SwXFlatParagraphIterator
& ) = delete;
132 SwXFlatParagraphIterator
& operator =(const SwXFlatParagraphIterator
& ) = delete;
134 // container to hold the 'hard' references as long as necessary and valid
135 std::set
< css::uno::Reference
< css::text::XFlatParagraph
> > m_aFlatParaList
;
138 const sal_Int32 mnType
;
139 const bool mbAutomatic
;
141 sal_uLong mnCurrentNode
; // used for non-automatic mode
142 sal_uLong mnEndNode
; // used for non-automatic mode
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */