Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/framework/source/classes/taskcreator.cxx
Line
Count
Source
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
#include <classes/taskcreator.hxx>
21
#include <services/taskcreatorsrv.hxx>
22
#include <services.h>
23
#include <taskcreatordefs.hxx>
24
25
#include <com/sun/star/frame/Desktop.hpp>
26
#include <com/sun/star/frame/TaskCreator.hpp>
27
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
28
#include <com/sun/star/beans/NamedValue.hpp>
29
30
#include <rtl/ref.hxx>
31
32
#include <utility>
33
34
namespace framework{
35
36
/*-****************************************************************************************************
37
    @short      initialize instance with necessary information
38
    @descr      We need a valid uno service manager to create or instantiate new services.
39
                All other information to create frames or tasks come in on right interface methods.
40
41
    @param      xContext
42
                    points to the valid uno service manager
43
*//*-*****************************************************************************************************/
44
TaskCreator::TaskCreator( css::uno::Reference< css::uno::XComponentContext > xContext )
45
7.85k
    : m_xContext    (std::move( xContext ))
46
7.85k
{
47
7.85k
}
48
49
/*-****************************************************************************************************
50
    @short      deinitialize instance
51
    @descr      We should release all used resource which are not needed any longer.
52
*//*-*****************************************************************************************************/
53
TaskCreator::~TaskCreator()
54
7.85k
{
55
7.85k
}
56
57
/*-****************************************************************************************************
58
    TODO document me
59
*//*-*****************************************************************************************************/
60
css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUString& sName, const comphelper::SequenceAsHashMap& rDescriptor )
61
7.85k
{
62
7.85k
    rtl::Reference< TaskCreatorService > xCreator = new TaskCreatorService(m_xContext);
63
64
7.85k
    css::uno::Sequence< css::uno::Any > lArgs
65
7.85k
    {
66
7.85k
        css::uno::Any(css::beans::NamedValue(ARGUMENT_PARENTFRAME, css::uno::Any(css::uno::Reference< css::frame::XFrame >( css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY_THROW)))) ,
67
7.85k
        css::uno::Any(css::beans::NamedValue(ARGUMENT_CREATETOPWINDOW, css::uno::Any(true))),
68
7.85k
        css::uno::Any(css::beans::NamedValue(ARGUMENT_MAKEVISIBLE, css::uno::Any(false))),
69
7.85k
        css::uno::Any(css::beans::NamedValue(ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE, css::uno::Any(true))),
70
7.85k
        css::uno::Any(css::beans::NamedValue(ARGUMENT_FRAMENAME, css::uno::Any(sName))),
71
7.85k
        css::uno::Any(css::beans::NamedValue(ARGUMENT_HIDDENFORCONVERSION, css::uno::Any(rDescriptor.getUnpackedValueOrDefault(ARGUMENT_HIDDENFORCONVERSION, false))))
72
7.85k
    };
73
7.85k
    css::uno::Reference< css::frame::XFrame > xTask(xCreator->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW);
74
7.85k
    return xTask;
75
7.85k
}
76
77
} // namespace framework
78
79
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */