LibreOffice Module basctl (master) 1
uiobject.cxx
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
10#include <memory>
11#include "uiobject.hxx"
12#include <vcl/xtextedt.hxx>
13
14namespace basctl
15{
17 : WindowUIObject(xEditorWindow)
18 , mxEditorWindow(xEditorWindow)
19{
20}
21
23{
25
26 ExtTextEngine* pEditEngine = mxEditorWindow->GetEditEngine();
27 sal_Int32 i, nParas;
28 OUStringBuffer aRes;
29 for (i = 0, nParas = pEditEngine->GetParagraphCount(); i < nParas; ++i)
30 {
31 aRes.append(pEditEngine->GetText(i) + "\n");
32 }
33
34 aMap["Text"] = aRes.makeStringAndClear();
35
36 return aMap;
37}
38
39std::unique_ptr<UIObject> EditorWindowUIObject::create(vcl::Window* pWindow)
40{
41 basctl::EditorWindow* pEditorWindow = dynamic_cast<basctl::EditorWindow*>(pWindow);
42 assert(pEditorWindow);
43 return std::unique_ptr<UIObject>(new EditorWindowUIObject(pEditorWindow));
44}
45
46OUString EditorWindowUIObject::get_name() const { return "EditorWindowUIObject"; }
47
48} // namespace basctl
49
50/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString GetText(LineEnd aSeparator=LINEEND_LF) const
sal_uInt32 GetParagraphCount() const
virtual StringMap get_state() override
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:39
virtual OUString get_name() const override
Definition: uiobject.cxx:46
EditorWindowUIObject(const VclPtr< basctl::EditorWindow > &xEditorWindow)
Definition: uiobject.cxx:16
VclPtr< basctl::EditorWindow > mxEditorWindow
Definition: uiobject.hxx:20
virtual StringMap get_state() override
Definition: uiobject.cxx:22
int i
HashMap_OWString_Interface aMap
std::map< OUString, OUString > StringMap