LibreOffice Module svx (master)  1
unopage.hxx
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  * 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>
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>
32 #include <svx/svdobjkind.hxx>
33 
34 #include <cppuhelper/implbase7.hxx>
36 
37 #include <memory>
38 
39 class SdrPage;
40 class SdrModel;
41 class SdrView;
42 class SdrPageView;
43 class SdrObject;
44 class SvxShape;
45 class SvxShapeGroup;
46 class SvxShapeConnector;
47 enum class SdrInventor : sal_uInt32;
48 
52 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
53 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
54 
55 class SVXCORE_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper7< css::drawing::XDrawPage,
56  css::drawing::XShapeGrouper,
57  css::drawing::XShapes2,
58  css::drawing::XShapes3,
59  css::lang::XServiceInfo,
60  css::lang::XUnoTunnel,
61  css::lang::XComponent>,
62  protected SvxMutexHelper
63 {
64  protected:
66 
67  SdrPage* mpPage; // TTTT should be reference
68  SdrModel* mpModel; // TTTT probably not needed -> use from SdrPage
69  std::unique_ptr<SdrView> mpView;
70 
71  void SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
72  void SelectObjectInView( const css::uno::Reference< css::drawing::XShape >& xShape, SdrPageView* pPageView ) throw();
73 
74  virtual void disposing() throw();
75 
76  public:
77  SvxDrawPage(SdrPage* pPage);
78  virtual ~SvxDrawPage() throw() override;
79 
80  // Internals
81  SdrPage* GetSdrPage() const { return mpPage; }
82 
83  // Creation of a SdrObject and insertion into the SdrPage
84  SdrObject *CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) throw();
85 
86  // Determine Type and Inventor
87  static void GetTypeAndInventor( SdrObjKind& rType, SdrInventor& rInventor, const OUString& aName ) throw();
88 
89  // Creating a SdrObject using it's Description.
90  // Can be used by derived classes to support their owen Shapes (e.g. Controls).
92  virtual SdrObject *CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape );
93 
95  static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage = nullptr, OUString const & referer = OUString() );
96 
97  // The following method is called if a SvxShape object is to be created.
98  // Derived classes can create a derivation or an SvxShape aggregating object.
100  virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const;
101 
102  UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
103 
104  // XInterface
105  virtual void SAL_CALL release() throw() override;
106 
107  // XShapes
108  virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
109  virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
110 
111  // XShapes2
112  virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
113  virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
114 
115  // XShapes3
116  virtual void SAL_CALL sort( const css::uno::Sequence< sal_Int32 >& sortOrder ) override;
117 
118  // XElementAccess
119  virtual css::uno::Type SAL_CALL getElementType() override;
120  virtual sal_Bool SAL_CALL hasElements() override;
121 
122  // XIndexAccess
123  virtual sal_Int32 SAL_CALL getCount() override ;
124  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
125 
126  // XShapeGrouper
127  virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
128  virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override;
129 
130  // XServiceInfo
131  virtual OUString SAL_CALL getImplementationName() override;
132  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
133  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
134 
135  // XComponent
136  virtual void SAL_CALL dispose() override;
137  virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
138  virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
139 };
140 
141 #endif
142 
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
void SelectObjectsInView(const css::uno::Reference< css::drawing::XShapes > &aShapes, SdrPageView *pPageView)
Definition: unopage.cxx:403
virtual void disposing()
Definition: unopage.cxx:91
SdrObject * CreateSdrObject(const css::uno::Reference< css::drawing::XShape > &xShape, bool bBeginning=false)
Definition: unopage.cxx:834
SdrInventor
Definition: svdobj.hxx:100
SdrObjKind
Definition: svdobjkind.hxx:24
SdrPage * mpPage
Definition: unopage.hxx:67
SdrModel * mpModel
Definition: unopage.hxx:68
void SelectObjectInView(const css::uno::Reference< css::drawing::XShape > &xShape, SdrPageView *pPageView)
Definition: unopage.cxx:425
std::unique_ptr< SdrView > mpView
Definition: unopage.hxx:69
unsigned char sal_Bool
Abstract DrawObject.
Definition: svdobj.hxx:260
cppu::OBroadcastHelper mrBHelper
Definition: unopage.hxx:65
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365
struct _ADOIndex Index