lok: calc - send other views our selection in their co-ordinates.
[LibreOffice.git] / include / svx / unopage.hxx
blob6814f859904af4561da58088b5d3206894368c43
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SVX_UNOPAGE_HXX
20 #define INCLUDED_SVX_UNOPAGE_HXX
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 <editeng/mutxhelp.hxx>
31 #include <svx/svxdllapi.h>
33 #include <cppuhelper/implbase7.hxx>
34 #include <comphelper/servicehelper.hxx>
36 #include <memory>
38 class SdrPage;
39 class SdrModel;
40 class SdrView;
41 class SdrPageView;
42 class SdrObject;
43 class SvxShape;
44 class SvxShapeGroup;
45 class SvxShapeConnector;
46 enum class SdrInventor : sal_uInt32;
48 /**
49 * Macros to convert Twips<->100tel mm
51 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
52 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
54 class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper7< css::drawing::XDrawPage,
55 css::drawing::XShapeGrouper,
56 css::drawing::XShapes2,
57 css::drawing::XShapes3,
58 css::lang::XServiceInfo,
59 css::lang::XUnoTunnel,
60 css::lang::XComponent>,
61 protected SvxMutexHelper
63 protected:
64 cppu::OBroadcastHelper mrBHelper;
66 SdrPage* mpPage; // TTTT should be reference
67 SdrModel* mpModel; // TTTT probably not needed -> use from SdrPage
68 std::unique_ptr<SdrView> mpView;
70 void SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
71 void SelectObjectInView( const css::uno::Reference< css::drawing::XShape >& xShape, SdrPageView* pPageView ) throw();
73 virtual void disposing() throw();
75 public:
76 SvxDrawPage(SdrPage* pPage);
77 virtual ~SvxDrawPage() throw() override;
79 // Internals
80 SdrPage* GetSdrPage() const { return mpPage; }
82 // Creation of a SdrObject and insertion into the SdrPage
83 SdrObject *CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) throw();
85 // Determine Type and Inventor
86 static void GetTypeAndInventor( sal_uInt16& rType, SdrInventor& rInventor, const OUString& aName ) throw();
88 // Creating a SdrObject using it's Description.
89 // Can be used by derived classes to support their owen Shapes (e.g. Controls).
90 /// @throws css::uno::RuntimeException
91 virtual SdrObject *CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape );
93 /// @throws css::uno::RuntimeException
94 static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage = nullptr, OUString const & referer = OUString() );
96 // The following method is called if a SvxShape object is to be created.
97 // Derived classes can create a derivation or an SvxShape aggregating object.
98 /// @throws css::uno::RuntimeException
99 virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const;
101 UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
103 // XInterface
104 virtual void SAL_CALL release() throw() override;
106 // XShapes
107 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
108 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
110 // XShapes2
111 virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
112 virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
114 // XShapes3
115 virtual void SAL_CALL sort( const css::uno::Sequence< sal_Int32 >& sortOrder ) override;
117 // XElementAccess
118 virtual css::uno::Type SAL_CALL getElementType() override;
119 virtual sal_Bool SAL_CALL hasElements() override;
121 // XIndexAccess
122 virtual sal_Int32 SAL_CALL getCount() override ;
123 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
125 // XShapeGrouper
126 virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
127 virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override;
129 // XServiceInfo
130 virtual OUString SAL_CALL getImplementationName() override;
131 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
132 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
134 // XComponent
135 virtual void SAL_CALL dispose() override;
136 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
137 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
140 #endif
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */