diff options
Diffstat (limited to 'sw/source/core/inc/unoport.hxx')
-rw-r--r-- | sw/source/core/inc/unoport.hxx | 111 |
1 files changed, 59 insertions, 52 deletions
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx index 7c6ab857eb86..ec05eb1c038f 100644 --- a/sw/source/core/inc/unoport.hxx +++ b/sw/source/core/inc/unoport.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_CORE_INC_UNOPORT_HXX -#define INCLUDED_SW_SOURCE_CORE_INC_UNOPORT_HXX + +#pragma once #include <memory> #include <deque> @@ -30,7 +30,6 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <cppuhelper/implbase.hxx> @@ -38,6 +37,13 @@ #include <svl/listener.hxx> #include <unocrsr.hxx> +#include "unorefmark.hxx" +#include "unoidx.hxx" +#include "unofootnote.hxx" +#include "unometa.hxx" +#include "unocontentcontrol.hxx" +#include "unolinebreak.hxx" +#include "unobookmark.hxx" namespace com::sun::star::beans { struct PropertyValue; } namespace com::sun::star::text { class XTextField; } @@ -46,9 +52,11 @@ namespace com::sun::star::text { class XFootnote; } class SwFrameFormat; class SwRangeRedline; class SwTextRuby; +class SwXText; +class SwXTextPortion; typedef std::deque< - css::uno::Reference< css::text::XTextRange > > + rtl::Reference<SwXTextPortion> > TextRangeList_t; enum SwTextPortionType @@ -74,7 +82,10 @@ enum SwTextPortionType PORTION_FIELD_END, PORTION_FIELD_START_END, PORTION_ANNOTATION, - PORTION_ANNOTATION_END + PORTION_ANNOTATION_END, + PORTION_LINEBREAK, + PORTION_CONTENT_CONTROL, + PORTION_LIST_AUTOFMT }; class SwXTextPortion : public cppu::WeakImplHelper @@ -85,7 +96,6 @@ class SwXTextPortion : public cppu::WeakImplHelper css::text::XTextRange, css::beans::XPropertyState, css::container::XContentEnumerationAccess, - css::lang::XUnoTunnel, css::lang::XServiceInfo >, public SvtListener @@ -93,25 +103,21 @@ class SwXTextPortion : public cppu::WeakImplHelper private: const SfxItemPropertySet * m_pPropSet; - const css::uno::Reference< css::text::XText > - m_xParentText; - css::uno::Reference< css::text::XTextContent > - m_xRefMark; - css::uno::Reference< css::text::XTextContent > - m_xTOXMark; - css::uno::Reference< css::text::XTextContent > - m_xBookmark; - css::uno::Reference< css::text::XFootnote > - m_xFootnote; + const css::uno::Reference< SwXText > m_xParentText; + rtl::Reference< SwXReferenceMark > m_xRefMark; + rtl::Reference< SwXDocumentIndexMark > m_xTOXMark; + rtl::Reference< SwXBookmark > m_xBookmark; + rtl::Reference< SwXFootnote > m_xFootnote; css::uno::Reference< css::text::XTextField > m_xTextField; - css::uno::Reference< css::text::XTextContent > - m_xMeta; - std::unique_ptr< css::uno::Any > m_pRubyText; - std::unique_ptr< css::uno::Any > m_pRubyStyle; - std::unique_ptr< css::uno::Any > m_pRubyAdjust; - std::unique_ptr< css::uno::Any > m_pRubyIsAbove; - std::unique_ptr< css::uno::Any > m_pRubyPosition; + rtl::Reference< SwXMeta > m_xMeta; + rtl::Reference<SwXLineBreak> m_xLineBreak; + rtl::Reference<SwXContentControl> m_xContentControl; + std::optional< css::uno::Any > m_oRubyText; + std::optional< css::uno::Any > m_oRubyStyle; + std::optional< css::uno::Any > m_oRubyAdjust; + std::optional< css::uno::Any > m_oRubyIsAbove; + std::optional< css::uno::Any > m_oRubyPosition; sw::UnoCursorPointer m_pUnoCursor; SwFrameFormat* m_pFrameFormat; @@ -119,6 +125,10 @@ private: bool m_bIsCollapsed; + /// Expose the paragraph's RES_PARATR_LIST_AUTOFMT, not the char props of the underlying (empty) + /// text. + bool m_bIsListAutoFormat; + void init(const SwUnoCursor* pPortionCursor); protected: @@ -137,7 +147,7 @@ protected: const css::uno::Sequence< OUString >& aPropertyNames ); void GetPropertyValue( css::uno::Any &rVal, - const SfxItemPropertySimpleEntry& rEntry, SwUnoCursor *pUnoCursor, std::unique_ptr<SfxItemSet> &pSet ); + const SfxItemPropertyMapEntry& rEntry, SwUnoCursor *pUnoCursor, std::unique_ptr<SfxItemSet> &pSet ); /// @throws css::uno::RuntimeException css::uno::Sequence<css::beans::GetDirectPropertyTolerantResult> GetPropertyValuesTolerant_Impl( @@ -148,13 +158,13 @@ protected: virtual void Notify(const SfxHint& rHint) override; public: - SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< css::text::XText > const& rParent, SwTextPortionType eType ); - SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< css::text::XText > const& rParent, SwFrameFormat& rFormat ); + SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< SwXText > xParent, SwTextPortionType eType ); + SwXTextPortion(const SwUnoCursor* pPortionCursor, css::uno::Reference< SwXText > xParent, SwFrameFormat& rFormat ); // for Ruby SwXTextPortion(const SwUnoCursor* pPortionCursor, SwTextRuby const& rAttr, - css::uno::Reference< css::text::XText > const& xParent, + css::uno::Reference< SwXText > xParent, bool bIsEnd ); //XTextRange @@ -191,10 +201,6 @@ public: virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; - //XUnoTunnel - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - //XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; @@ -204,24 +210,34 @@ public: virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createContentEnumeration(const OUString& aServiceName) override; virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override; - void SetRefMark( css::uno::Reference< css::text::XTextContent > const & xMark) + void SetRefMark( rtl::Reference< SwXReferenceMark > const & xMark) { m_xRefMark = xMark; } - void SetTOXMark( css::uno::Reference< css::text::XTextContent > const & xMark) + void SetTOXMark( rtl::Reference< SwXDocumentIndexMark > const & xMark) { m_xTOXMark = xMark; } - void SetBookmark( css::uno::Reference< css::text::XTextContent > const & xMark) + void SetBookmark( rtl::Reference< SwXBookmark > const & xMark) { m_xBookmark = xMark; } - void SetFootnote( css::uno::Reference< css::text::XFootnote > const & xNote) + void SetFootnote( rtl::Reference< SwXFootnote > const & xNote) { m_xFootnote = xNote; } void SetTextField( css::uno::Reference< css::text::XTextField> const & xField) { m_xTextField = xField; } - void SetMeta( css::uno::Reference< css::text::XTextContent > const & xMeta) + void SetMeta( rtl::Reference< SwXMeta > const & xMeta) { m_xMeta = xMeta; } + void SetLineBreak(rtl::Reference<SwXLineBreak> const& xLineBreak) + { + m_xLineBreak = xLineBreak; + } + + void SetContentControl(const rtl::Reference<SwXContentControl>& xContentControl) + { + m_xContentControl = xContentControl; + } + void SetCollapsed(bool bSet) { m_bIsCollapsed = bSet;} SwTextPortionType GetTextPortionType() const { return m_ePortionType; } @@ -230,32 +246,25 @@ public: { return *m_pUnoCursor; } }; -class SwXTextPortionEnumeration +class SwXTextPortionEnumeration final : public ::cppu::WeakImplHelper < css::container::XEnumeration , css::lang::XServiceInfo - , css::lang::XUnoTunnel > { TextRangeList_t m_Portions; // contains all portions, filled by ctor sw::UnoCursorPointer m_pUnoCursor; -protected: virtual ~SwXTextPortionEnumeration() override; public: + /// @param bOnlyTextFields tries to return less data, but may return more than just text fields SwXTextPortionEnumeration(SwPaM& rParaCursor, - css::uno::Reference< css::text::XText > const & xParent, - const sal_Int32 nStart, const sal_Int32 nEnd ); + css::uno::Reference< SwXText > const & xParent, + const sal_Int32 nStart, const sal_Int32 nEnd, bool bOnlyTextFields = false ); SwXTextPortionEnumeration(SwPaM& rParaCursor, - TextRangeList_t const & rPortions ); - - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( - const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + TextRangeList_t && rPortions ); //XEnumeration virtual sal_Bool SAL_CALL hasMoreElements() override; @@ -268,7 +277,7 @@ public: getSupportedServiceNames() override; }; -class SwXRedlinePortion : public SwXTextPortion +class SwXRedlinePortion final : public SwXTextPortion { private: SwRangeRedline const& m_rRedline; @@ -283,7 +292,7 @@ public: SwXRedlinePortion( SwRangeRedline const& rRedline, SwUnoCursor const* pPortionCursor, - css::uno::Reference< css::text::XText > const& xParent, + css::uno::Reference< SwXText > const& xParent, bool const bIsStart); /// @throws std::exception @@ -301,6 +310,4 @@ public: const OUString& rPropertyName) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |