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_TEXTAPI_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_TEXTAPI_HXX
23 #include <editeng/unoedsrc.hxx>
24 #include <editeng/unotext.hxx>
25 #include <editeng/outlobj.hxx>
29 struct SwTextAPIEditSource_Impl
;
30 class SwTextAPIEditSource final
: public SvxEditSource
32 SwTextAPIEditSource_Impl
* m_pImpl
;
34 void EnsureOutliner();
35 virtual std::unique_ptr
<SvxEditSource
> Clone() const override
;
36 virtual SvxTextForwarder
* GetTextForwarder() override
;
37 virtual void UpdateData() override
;
38 explicit SwTextAPIEditSource( const SwTextAPIEditSource
& rSource
);
41 SwTextAPIEditSource(SwDoc
* pDoc
);
42 virtual ~SwTextAPIEditSource() override
;
45 void SetText( OutlinerParaObject
const & rText
);
46 void SetString( const OUString
& rText
);
47 std::optional
<OutlinerParaObject
> CreateText();
48 OUString
GetText() const;
51 class SwTextAPIObject final
: public SvxUnoText
53 std::unique_ptr
<SwTextAPIEditSource
> m_pSource
;
55 SwTextAPIObject( std::unique_ptr
<SwTextAPIEditSource
> p
);
56 virtual ~SwTextAPIObject() noexcept override
;
57 void DisposeEditSource() { m_pSource
->Dispose(); }
58 std::optional
<OutlinerParaObject
> CreateText() { return m_pSource
->CreateText(); }
59 void SetString( const OUString
& rText
) { m_pSource
->SetString( rText
); }
60 void SetText( OutlinerParaObject
const & rText
) { m_pSource
->SetText( rText
); }
61 OUString
GetText() const { return m_pSource
->GetText(); }
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */