Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVDOUNO_HXX
30 : : #define _SVDOUNO_HXX
31 : :
32 : : #include <com/sun/star/awt/XControlModel.hpp>
33 : : #include <com/sun/star/awt/XControl.hpp>
34 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 : : #include <com/sun/star/awt/XControlContainer.hpp>
36 : : #include "svx/svxdllapi.h"
37 : : #include <svx/svdorect.hxx>
38 : :
39 : : //************************************************************
40 : : // Vorausdeklarationen
41 : : //************************************************************
42 : :
43 : : class SdrView;
44 : : class SdrPageWindow;
45 : : class SdrControlEventListenerImpl;
46 : :
47 : : namespace sdr { namespace contact {
48 : : class ViewContactOfUnoControl;
49 : : }}
50 : :
51 : : //************************************************************
52 : : // SdrUnoObj
53 : : //************************************************************
54 : :
55 : : struct SdrUnoObjDataHolder;
56 : : class SVX_DLLPUBLIC SdrUnoObj : public SdrRectObj
57 : : {
58 : : friend class SdrPageView;
59 : : friend class SdrControlEventListenerImpl;
60 : :
61 : : SdrUnoObjDataHolder* m_pImpl;
62 : :
63 : : String aUnoControlModelTypeName;
64 : : String aUnoControlTypeName;
65 : : sal_Bool bOwnUnoControlModel;
66 : :
67 : : protected:
68 : : ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > xUnoControlModel; // kann auch von aussen gesetzt werden
69 : :
70 : : private:
71 : : SVX_DLLPRIVATE void CreateUnoControlModel(const String& rModelName);
72 : : SVX_DLLPRIVATE void CreateUnoControlModel(const String& rModelName,
73 : : const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac );
74 : :
75 : : public:
76 : : TYPEINFO();
77 : :
78 : : explicit SdrUnoObj(const String& rModelName, sal_Bool bOwnsModel = sal_True);
79 : : SdrUnoObj(const String& rModelName,
80 : : const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac,
81 : : sal_Bool bOwnsModel = sal_True);
82 : : virtual ~SdrUnoObj();
83 : :
84 : : virtual void SetPage(SdrPage* pNewPage);
85 : : virtual void SetModel(SdrModel* pModel);
86 : :
87 : : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
88 : : virtual sal_uInt16 GetObjIdentifier() const;
89 : :
90 : : virtual SdrUnoObj* Clone() const;
91 : : SdrUnoObj& operator= (const SdrUnoObj& rObj);
92 : : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
93 : : virtual void NbcSetLayer(SdrLayerID nLayer);
94 : :
95 : : // SpecialDrag support
96 : : virtual bool hasSpecialDrag() const;
97 : :
98 : : // FullDrag support
99 : : virtual bool supportsFullDrag() const;
100 : : virtual SdrObject* getFullDragClone() const;
101 : :
102 : : virtual void TakeObjNameSingul(XubString& rName) const;
103 : : virtual void TakeObjNamePlural(XubString& rName) const;
104 : :
105 : : virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
106 : :
107 : 3 : ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > GetUnoControlModel() const {return xUnoControlModel;}
108 : : ::com::sun::star::uno::Reference< com::sun::star::awt::XControl > GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const;
109 : :
110 : : /** retrieves a temporary XControl instance for a given output device
111 : :
112 : : The method GetUnoControl, used to retrieve the XControl whose parent is a given device, only works
113 : : if the SdrUnoObj has already been painted at least once onto this device. However, there are valid
114 : : scenarios where you need certain information on how a control is painted onto a window, without
115 : : actually painting it. For example, you might be interested in the DeviceInfo of an UNO control.
116 : :
117 : : For those cases, you can ontain an XControl which behaves as the control which *would* be used to
118 : : paint onto a window.
119 : :
120 : : @param _rWindow
121 : : the window for which should act as parent for the temporary control
122 : : @param _inout_ControlContainer
123 : : the control container belonging to the window, necessary as context
124 : : for the newly created control. A control container is usually created by calling
125 : : VCLUnoHelper::CreateControlContainer.
126 : : If _inout_ControlContainer is <NULL/>, it will be created internally, and passed to the caller.
127 : : In this case, the caller also takes ownership of the control container, and is responsible for
128 : : disposing it when not needed anymore.
129 : : @return
130 : : The requested control. This control is temporary only, and the caller is responsible for it.
131 : : In particular, the caller is required to dispose it when it's not needed anymore.
132 : :
133 : : */
134 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
135 : : GetTemporaryControlForWindow(
136 : : const Window& _rWindow,
137 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _inout_ControlContainer
138 : : ) const;
139 : :
140 : : const String& GetUnoControlModelTypeName() const { return aUnoControlTypeName; }
141 : : const String& GetUnoControlTypeName() const { return aUnoControlTypeName; }
142 : :
143 : : virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& xModel );
144 : :
145 : : protected:
146 : : // SdrObject overridables
147 : : virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact();
148 : :
149 : : private:
150 : : /** retrieves the typed ViewContact for the object
151 : : @param _out_rpContact
152 : : Upon successfull return, ->_out_rpContact contains the ViewContact.
153 : : @return
154 : : <TRUE/> if and only if the contact was successfully retrieved. In this case,
155 : : ->_out_rpContact contains a pointer to this contact.
156 : : A failure to retrieve the contact object fires an assertion in non-product builds.
157 : : */
158 : : SVX_DLLPRIVATE bool impl_getViewContact( ::sdr::contact::ViewContactOfUnoControl*& _out_rpContact ) const;
159 : : };
160 : :
161 : :
162 : : #endif // _SVDOUNO_HXX
163 : :
164 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|