Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/unopage.hxx
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
#ifndef INCLUDED_SVX_UNOPAGE_HXX
20
#define INCLUDED_SVX_UNOPAGE_HXX
21
22
#include <com/sun/star/lang/XComponent.hpp>
23
#include <cppuhelper/interfacecontainer.hxx>
24
#include <com/sun/star/lang/XServiceInfo.hpp>
25
#include <com/sun/star/drawing/XDrawPage.hpp>
26
#include <com/sun/star/drawing/XShapes2.hpp>
27
#include <com/sun/star/drawing/XShapes3.hpp>
28
#include <com/sun/star/drawing/XShapeGrouper.hpp>
29
#include <com/sun/star/lang/XUnoTunnel.hpp>
30
#include <com/sun/star/form/XFormsSupplier2.hpp>
31
#include <svx/svxdllapi.h>
32
#include <svx/svdobjkind.hxx>
33
#include <rtl/ref.hxx>
34
35
#include <cppuhelper/implbase.hxx>
36
#include <comphelper/servicehelper.hxx>
37
#include <comphelper/compbase.hxx>
38
#include <comphelper/interfacecontainer4.hxx>
39
40
#include <memory>
41
42
class SdrPage;
43
class SdrModel;
44
class SdrView;
45
class SdrPageView;
46
class SdrObject;
47
class SvxShape;
48
enum class SdrInventor : sal_uInt32;
49
50
class SVXCORE_DLLPUBLIC SvxDrawPage :
51
                                    public ::comphelper::WeakImplHelper< css::drawing::XDrawPage,
52
                                               css::drawing::XShapeGrouper,
53
                                               css::drawing::XShapes2,
54
                                               css::drawing::XShapes3,
55
                                               css::lang::XServiceInfo,
56
                                               css::lang::XUnoTunnel,
57
                                               css::lang::XComponent,
58
                                               css::form::XFormsSupplier2>
59
60
{
61
 protected:
62
    comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maEventListeners;
63
    SdrPage*        mpPage;     // TTTT should be reference
64
    SdrModel*       mpModel;    // TTTT probably not needed -> use from SdrPage
65
    std::unique_ptr<SdrView> mpView;
66
67
    void    SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView*   pPageView ) noexcept;
68
    void    SelectObjectInView( const css::uno::Reference< css::drawing::XShape >& xShape, SdrPageView*  pPageView ) noexcept;
69
70
    virtual void disposing() noexcept;
71
72
 public:
73
    SvxDrawPage(SdrPage* pPage);
74
    virtual ~SvxDrawPage() noexcept override;
75
76
    // Internals
77
36.0k
    SdrPage* GetSdrPage() const { return mpPage; }
78
79
    // Creation of a SdrObject and insertion into the SdrPage
80
    rtl::Reference<SdrObject> CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) noexcept;
81
82
    // Determine Type and Inventor
83
    static void GetTypeAndInventor( SdrObjKind& rType, SdrInventor& rInventor, const OUString& aName ) noexcept;
84
85
    // Creating a SdrObject using it's Description.
86
    // Can be used by derived classes to support their own Shapes (e.g. Controls).
87
    /// @throws css::uno::RuntimeException
88
    virtual rtl::Reference<SdrObject> CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape );
89
90
    /// @throws css::uno::RuntimeException
91
    static rtl::Reference<SvxShape> CreateShapeByTypeAndInventor( SdrObjKind nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage = nullptr, OUString const & referer = OUString() );
92
93
    // The following method is called if a SvxShape object is to be created.
94
    // Derived classes can create a derivation or an SvxShape aggregating object.
95
    /// @throws css::uno::RuntimeException
96
    virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const;
97
98
    UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
99
100
    // XShapes
101
    virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
102
    virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
103
104
    // XShapes2
105
    virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
106
    virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
107
108
    // XShapes3
109
    virtual void SAL_CALL sort( const css::uno::Sequence< sal_Int32 >& sortOrder ) override;
110
111
    // XElementAccess
112
    virtual css::uno::Type SAL_CALL getElementType() override;
113
    virtual sal_Bool SAL_CALL hasElements() override;
114
115
    // XIndexAccess
116
    virtual sal_Int32 SAL_CALL getCount() override ;
117
    virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
118
119
    // XShapeGrouper
120
    virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
121
    virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override;
122
123
    // XServiceInfo
124
    virtual OUString SAL_CALL getImplementationName() override;
125
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
126
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
127
128
    // XComponent
129
    virtual void SAL_CALL dispose() override;
130
    virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
131
    virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
132
133
    // XFormsSupplier
134
    virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override;
135
136
    // XFormsSupplier2
137
    virtual sal_Bool SAL_CALL hasForms() override;
138
};
139
140
#endif
141
142
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */