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 
33 #include <cppuhelper/implbase7.hxx>
35 
36 #include <memory>
37 
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;
47 
51 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
52 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
53 
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
62 {
63  protected:
65 
66  SdrPage* mpPage; // TTTT should be reference
67  SdrModel* mpModel; // TTTT probably not needed -> use from SdrPage
68  std::unique_ptr<SdrView> mpView;
69 
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();
72 
73  virtual void disposing() throw();
74 
75  public:
76  SvxDrawPage(SdrPage* pPage);
77  virtual ~SvxDrawPage() throw() override;
78 
79  // Internals
80  SdrPage* GetSdrPage() const { return mpPage; }
81 
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();
84 
85  // Determine Type and Inventor
86  static void GetTypeAndInventor( sal_uInt16& rType, SdrInventor& rInventor, const OUString& aName ) throw();
87 
88  // Creating a SdrObject using it's Description.
89  // Can be used by derived classes to support their owen Shapes (e.g. Controls).
91  virtual SdrObject *CreateSdrObject_( const css::uno::Reference< css::drawing::XShape >& xShape );
92 
94  static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage = nullptr, OUString const & referer = OUString() );
95 
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.
99  virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const;
100 
101  UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
102 
103  // XInterface
104  virtual void SAL_CALL release() throw() override;
105 
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;
109 
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;
113 
114  // XShapes3
115  virtual void SAL_CALL sort( const css::uno::Sequence< sal_Int32 >& sortOrder ) override;
116 
117  // XElementAccess
118  virtual css::uno::Type SAL_CALL getElementType() override;
119  virtual sal_Bool SAL_CALL hasElements() override;
120 
121  // XIndexAccess
122  virtual sal_Int32 SAL_CALL getCount() override ;
123  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
124 
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;
128 
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;
133 
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;
138 };
139 
140 #endif
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
void SelectObjectsInView(const css::uno::Reference< css::drawing::XShapes > &aShapes, SdrPageView *pPageView)
Definition: unopage.cxx:406
virtual void disposing()
Definition: unopage.cxx:94
SdrObject * CreateSdrObject(const css::uno::Reference< css::drawing::XShape > &xShape, bool bBeginning=false)
Definition: unopage.cxx:845
SdrInventor
Definition: svdobj.hxx:152
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
SdrPage * mpPage
Definition: unopage.hxx:66
SdrModel * mpModel
Definition: unopage.hxx:67
void SelectObjectInView(const css::uno::Reference< css::drawing::XShape > &xShape, SdrPageView *pPageView)
Definition: unopage.cxx:428
std::unique_ptr< SdrView > mpView
Definition: unopage.hxx:68
unsigned char sal_Bool
Abstract DrawObject.
Definition: svdobj.hxx:312
cppu::OBroadcastHelper mrBHelper
Definition: unopage.hxx:64
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
struct _ADOIndex Index