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 : : #include "RptObject.hxx"
29 : : #include <vector>
30 : : #include <algorithm>
31 : :
32 : : #include <RptDef.hxx>
33 : : #include <svx/unoshape.hxx>
34 : : #include "RptModel.hxx"
35 : : #include "RptObjectListener.hxx"
36 : : #include <toolkit/helper/vclunohelper.hxx>
37 : : #include <toolkit/helper/convert.hxx>
38 : : #include "RptPage.hxx"
39 : : #include "corestrings.hrc"
40 : : #include <dbaccess/dbsubcomponentcontroller.hxx>
41 : : #include "ModuleHelper.hxx"
42 : :
43 : : #include <RptResId.hrc>
44 : : #include <svx/xflclit.hxx>
45 : : #include <svx/xlnclit.hxx>
46 : : #include <svx/xlndsit.hxx>
47 : : #include <svx/xlineit0.hxx>
48 : : #include <svx/sderitm.hxx>
49 : : #include <svx/xlnwtit.hxx>
50 : : #include <svx/xlntrit.hxx>
51 : : #include <com/sun/star/style/XStyle.hpp>
52 : : #include <com/sun/star/awt/XTabControllerModel.hpp>
53 : : #include <com/sun/star/awt/XUnoControlContainer.hpp>
54 : : #include <com/sun/star/awt/XVclContainerPeer.hpp>
55 : : #include <com/sun/star/awt/XWindow.hpp>
56 : : #include <com/sun/star/awt/TextAlign.hpp>
57 : : #include <com/sun/star/beans/XPropertySet.hpp>
58 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
59 : : #include <com/sun/star/script/XScriptEventsSupplier.hpp>
60 : : #include <com/sun/star/container/XContainer.hpp>
61 : : #include <com/sun/star/lang/XServiceInfo.hpp>
62 : : #include <com/sun/star/report/XShape.hpp>
63 : : #include <com/sun/star/report/XFixedLine.hpp>
64 : : #include <com/sun/star/chart/ChartDataRowSource.hpp>
65 : : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
66 : : #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
67 : : #include <com/sun/star/chart2/XChartDocument.hpp>
68 : : #include <com/sun/star/style/VerticalAlignment.hpp>
69 : : #include <com/sun/star/style/ParagraphAdjust.hpp>
70 : : #include <com/sun/star/report/XFormattedField.hpp>
71 : : #include <comphelper/genericpropertyset.hxx>
72 : : #include <comphelper/processfactory.hxx>
73 : : #include <comphelper/property.hxx>
74 : : #include <tools/diagnose_ex.h>
75 : : #include "PropertyForward.hxx"
76 : : #include <connectivity/dbtools.hxx>
77 : : #include <connectivity/dbconversion.hxx>
78 : : #include "UndoActions.hxx"
79 : : #include "UndoEnv.hxx"
80 : : #include <algorithm>
81 : : #include <functional>
82 : :
83 : : namespace rptui
84 : : {
85 : :
86 : : using namespace ::com::sun::star;
87 : : using namespace uno;
88 : : using namespace beans;
89 : : using namespace reportdesign;
90 : : using namespace container;
91 : : using namespace script;
92 : : using namespace report;
93 : : //----------------------------------------------------------------------------
94 : 0 : sal_uInt16 OObjectBase::getObjectType(const uno::Reference< report::XReportComponent>& _xComponent)
95 : : {
96 [ # # ]: 0 : uno::Reference< lang::XServiceInfo > xServiceInfo( _xComponent , uno::UNO_QUERY );
97 : : OSL_ENSURE(xServiceInfo.is(),"Who deletes the XServiceInfo interface!");
98 [ # # ]: 0 : if ( xServiceInfo.is() )
99 : : {
100 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ))
[ # # ][ # # ]
101 : 0 : return OBJ_DLG_FIXEDTEXT;
102 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ))
[ # # ][ # # ]
103 : : {
104 [ # # ]: 0 : uno::Reference< report::XFixedLine> xFixedLine(_xComponent,uno::UNO_QUERY);
105 [ # # ][ # # ]: 0 : return xFixedLine->getOrientation() ? OBJ_DLG_HFIXEDLINE : OBJ_DLG_VFIXEDLINE;
[ # # ]
106 : : }
107 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL))
[ # # ][ # # ]
108 : 0 : return OBJ_DLG_IMAGECONTROL;
109 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ))
[ # # ][ # # ]
110 : 0 : return OBJ_DLG_FORMATTEDFIELD;
111 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ) )
[ # # ][ # # ]
112 : 0 : return OBJ_OLE2;
113 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( SERVICE_SHAPE ))
[ # # ][ # # ]
114 : 0 : return OBJ_CUSTOMSHAPE;
115 [ # # ][ # # ]: 0 : if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
[ # # ][ # # ]
116 : 0 : return OBJ_DLG_SUBREPORT;
117 : 0 : return OBJ_OLE2;
118 : : }
119 : 0 : return 0;
120 : : }
121 : : // -----------------------------------------------------------------------------
122 : 0 : SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportComponent>& _xComponent)
123 : : {
124 : 0 : SdrObject* pNewObj = NULL;
125 : 0 : sal_uInt16 nType = OObjectBase::getObjectType(_xComponent);
126 [ # # # # : 0 : switch( nType )
# # # ]
127 : : {
128 : : case OBJ_DLG_FIXEDTEXT:
129 : : {
130 : : OUnoObject* pUnoObj = new OUnoObject( _xComponent
131 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))
132 [ # # ][ # # ]: 0 : ,OBJ_DLG_FIXEDTEXT);
[ # # ]
133 : 0 : pNewObj = pUnoObj;
134 : :
135 [ # # ][ # # ]: 0 : uno::Reference<beans::XPropertySet> xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
136 [ # # ]: 0 : if ( xControlModel.is() )
137 [ # # ][ # # ]: 0 : xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::makeAny(sal_True));
[ # # ][ # # ]
138 : : }
139 : 0 : break;
140 : : case OBJ_DLG_IMAGECONTROL:
141 : : pNewObj = new OUnoObject(_xComponent
142 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))
143 [ # # ][ # # ]: 0 : ,OBJ_DLG_IMAGECONTROL);
144 : 0 : break;
145 : : case OBJ_DLG_FORMATTEDFIELD:
146 : : pNewObj = new OUnoObject( _xComponent
147 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))
148 [ # # ][ # # ]: 0 : ,OBJ_DLG_FORMATTEDFIELD);
149 : 0 : break;
150 : : case OBJ_DLG_HFIXEDLINE:
151 : : case OBJ_DLG_VFIXEDLINE:
152 : : pNewObj = new OUnoObject( _xComponent
153 : : ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))
154 [ # # ][ # # ]: 0 : ,nType);
155 : 0 : break;
156 : : case OBJ_CUSTOMSHAPE:
157 : 0 : pNewObj = OCustomShape::Create( _xComponent );
158 : : try
159 : : {
160 : 0 : sal_Bool bOpaque = sal_False;
161 [ # # ][ # # ]: 0 : _xComponent->getPropertyValue(PROPERTY_OPAQUE) >>= bOpaque;
[ # # ][ # # ]
162 [ # # ]: 0 : pNewObj->SetLayer(bOpaque ? RPT_LAYER_FRONT : RPT_LAYER_BACK);
163 : : }
164 : 0 : catch(const uno::Exception&)
165 : : {
166 : : DBG_UNHANDLED_EXCEPTION();
167 : : }
168 : 0 : break;
169 : : case OBJ_DLG_SUBREPORT:
170 : : case OBJ_OLE2:
171 : 0 : pNewObj = OOle2Obj::Create( _xComponent,nType );
172 : 0 : break;
173 : : default:
174 : : OSL_FAIL("Unknown object id");
175 : 0 : break;
176 : : }
177 : :
178 : 0 : ensureSdrObjectOwnership( _xComponent );
179 : :
180 : 0 : return pNewObj;
181 : : }
182 : : // -----------------------------------------------------------------------------
183 : : namespace
184 : : {
185 [ # # ]: 0 : class ParaAdjust : public AnyConverter
186 : : {
187 : : public:
188 : 0 : virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& _sPropertyName,const ::com::sun::star::uno::Any& lhs) const
189 : : {
190 : 0 : uno::Any aRet;
191 [ # # ]: 0 : if (_sPropertyName.equalsAsciiL(PROPERTY_PARAADJUST.ascii, PROPERTY_PARAADJUST.length))
192 : : {
193 : 0 : sal_Int16 nTextAlign = 0;
194 : 0 : lhs >>= nTextAlign;
195 [ # # # # ]: 0 : switch(nTextAlign)
196 : : {
197 : : case awt::TextAlign::LEFT:
198 : 0 : nTextAlign = style::ParagraphAdjust_LEFT;
199 : 0 : break;
200 : : case awt::TextAlign::CENTER:
201 : 0 : nTextAlign = style::ParagraphAdjust_CENTER;
202 : 0 : break;
203 : : case awt::TextAlign::RIGHT:
204 : 0 : nTextAlign = style::ParagraphAdjust_RIGHT;
205 : 0 : break;
206 : : default:
207 : : OSL_FAIL("Illegal text alignment value!");
208 : 0 : break;
209 : : }
210 [ # # ]: 0 : aRet <<= (style::ParagraphAdjust)nTextAlign;
211 : : }
212 : : else
213 : : {
214 : 0 : sal_Int16 nTextAlign = 0;
215 : 0 : sal_Int16 eParagraphAdjust = 0;
216 : 0 : lhs >>= eParagraphAdjust;
217 [ # # # # ]: 0 : switch(eParagraphAdjust)
218 : : {
219 : : case style::ParagraphAdjust_LEFT:
220 : : case style::ParagraphAdjust_BLOCK:
221 : 0 : nTextAlign = awt::TextAlign::LEFT;
222 : 0 : break;
223 : : case style::ParagraphAdjust_CENTER:
224 : 0 : nTextAlign = awt::TextAlign::CENTER;
225 : 0 : break;
226 : : case style::ParagraphAdjust_RIGHT:
227 : 0 : nTextAlign = awt::TextAlign::RIGHT;
228 : 0 : break;
229 : : default:
230 : : OSL_FAIL("Illegal text alignment value!");
231 : 0 : break;
232 : : }
233 [ # # ]: 0 : aRet <<= nTextAlign;
234 : : }
235 : 0 : return aRet;
236 : : }
237 : : };
238 : : }
239 : : // -----------------------------------------------------------------------------
240 : 0 : const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId)
241 : : {
242 [ # # # # : 0 : switch(_nObjectId)
# ]
243 : : {
244 : : case OBJ_DLG_IMAGECONTROL:
245 : : {
246 [ # # ][ # # ]: 0 : static TPropertyNamePair s_aNameMap;
[ # # ][ # # ]
247 [ # # ]: 0 : if ( s_aNameMap.empty() )
248 : : {
249 [ # # ][ # # ]: 0 : ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
250 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
251 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)));
[ # # ][ # # ]
[ # # ]
252 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ][ # # ]
253 : : }
254 : 0 : return s_aNameMap;
255 : : }
256 : :
257 : : case OBJ_DLG_FIXEDTEXT:
258 : : {
259 [ # # ][ # # ]: 0 : static TPropertyNamePair s_aNameMap;
[ # # ][ # # ]
260 [ # # ]: 0 : if ( s_aNameMap.empty() )
261 : : {
262 [ # # ][ # # ]: 0 : ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
263 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
264 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
265 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
266 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter)));
[ # # ][ # # ]
[ # # ]
267 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter)));
[ # # ][ # # ]
[ # # ]
268 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter)));
[ # # ][ # # ]
[ # # ]
269 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)));
[ # # ][ # # ]
[ # # ]
270 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)));
[ # # ][ # # ]
[ # # ]
271 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
272 : :
273 [ # # ][ # # ]: 0 : ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust());
274 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
275 : : }
276 : 0 : return s_aNameMap;
277 : : }
278 : : case OBJ_DLG_FORMATTEDFIELD:
279 : : {
280 [ # # ][ # # ]: 0 : static TPropertyNamePair s_aNameMap;
[ # # ][ # # ]
281 [ # # ]: 0 : if ( s_aNameMap.empty() )
282 : : {
283 [ # # ][ # # ]: 0 : ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
284 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
285 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
286 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
287 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter)));
[ # # ][ # # ]
[ # # ]
288 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter)));
[ # # ][ # # ]
[ # # ]
289 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter)));
[ # # ][ # # ]
[ # # ]
290 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)));
[ # # ][ # # ]
[ # # ]
291 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)));
[ # # ][ # # ]
[ # # ]
292 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)));
[ # # ][ # # ]
[ # # ]
293 [ # # ][ # # ]: 0 : ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust());
294 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
295 : : }
296 : 0 : return s_aNameMap;
297 : : }
298 : :
299 : : case OBJ_CUSTOMSHAPE:
300 : : {
301 [ # # ][ # # ]: 0 : static TPropertyNamePair s_aNameMap;
[ # # ][ # # ]
302 [ # # ]: 0 : if ( s_aNameMap.empty() )
303 : : {
304 [ # # ][ # # ]: 0 : ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
305 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")),TPropertyConverter(PROPERTY_CONTROLBACKGROUND,aNoConverter)));
[ # # ][ # # ]
[ # # ][ # # ]
306 [ # # ][ # # ]: 0 : s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter)));
[ # # ][ # # ]
[ # # ][ # # ]
307 : : }
308 : 0 : return s_aNameMap;
309 : : }
310 : :
311 : : default:
312 : 0 : break;
313 : : }
314 [ # # ][ # # ]: 0 : static TPropertyNamePair s_aEmptyNameMap;
[ # # ][ # # ]
315 : 0 : return s_aEmptyNameMap;
316 : : }
317 : : // -----------------------------------------------------------------------------
318 : :
319 : : DBG_NAME( rpt_OObjectBase )
320 : 0 : OObjectBase::OObjectBase(const uno::Reference< report::XReportComponent>& _xComponent)
321 : 0 : :m_bIsListening(sal_False)
322 : : {
323 : : DBG_CTOR( rpt_OObjectBase,NULL);
324 [ # # ]: 0 : m_xReportComponent = _xComponent;
325 : 0 : }
326 : : //----------------------------------------------------------------------------
327 : 0 : OObjectBase::OObjectBase(const ::rtl::OUString& _sComponentName)
328 : : :m_sComponentName(_sComponentName)
329 : 0 : ,m_bIsListening(sal_False)
330 : : {
331 : : DBG_CTOR( rpt_OObjectBase,NULL);
332 : 0 : }
333 : : //----------------------------------------------------------------------------
334 : 0 : OObjectBase::~OObjectBase()
335 : : {
336 : : DBG_DTOR( rpt_OObjectBase,NULL);
337 [ # # ]: 0 : m_xMediator.reset();
338 [ # # ]: 0 : if ( isListening() )
339 [ # # ]: 0 : EndListening();
340 : 0 : m_xReportComponent.clear();
341 [ # # ]: 0 : }
342 : : // -----------------------------------------------------------------------------
343 : 0 : uno::Reference< report::XSection> OObjectBase::getSection() const
344 : : {
345 : 0 : uno::Reference< report::XSection> xSection;
346 [ # # ][ # # ]: 0 : OReportPage* pPage = dynamic_cast<OReportPage*>(GetImplPage());
347 [ # # ]: 0 : if ( pPage )
348 [ # # ][ # # ]: 0 : xSection = pPage->getSection();
349 : 0 : return xSection;
350 : : }
351 : : // -----------------------------------------------------------------------------
352 : 0 : uno::Reference< report::XReportComponent> OObjectBase::getReportComponent() const
353 : : {
354 : 0 : return m_xReportComponent;
355 : : }
356 : : // -----------------------------------------------------------------------------
357 : 0 : uno::Reference< beans::XPropertySet> OObjectBase::getAwtComponent()
358 : : {
359 : 0 : return uno::Reference< beans::XPropertySet>();
360 : : }
361 : : //----------------------------------------------------------------------------
362 : 0 : void OObjectBase::StartListening()
363 : : {
364 : : DBG_CHKTHIS( rpt_OObjectBase,NULL);
365 : : OSL_ENSURE(!isListening(), "OUnoObject::StartListening: already listening!");
366 : :
367 [ # # ][ # # ]: 0 : if ( !isListening() && m_xReportComponent.is() )
[ # # ]
368 : : {
369 : 0 : m_bIsListening = sal_True;
370 : :
371 [ # # ]: 0 : if ( !m_xPropertyChangeListener.is() )
372 : : {
373 [ # # ][ # # ]: 0 : m_xPropertyChangeListener = new OObjectListener( this );
374 : : // register listener to all properties
375 [ # # ]: 0 : m_xReportComponent->addPropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
376 : : }
377 : : }
378 : 0 : }
379 : : //----------------------------------------------------------------------------
380 : 0 : void OObjectBase::EndListening(sal_Bool /*bRemoveListener*/)
381 : : {
382 : : DBG_CHKTHIS( rpt_OObjectBase,NULL);
383 : : OSL_ENSURE(!m_xReportComponent.is() || isListening(), "OUnoObject::EndListening: not listening currently!");
384 : :
385 : 0 : m_bIsListening = sal_False;
386 [ # # ][ # # ]: 0 : if ( isListening() && m_xReportComponent.is() )
[ # # ]
387 : : {
388 : : // XPropertyChangeListener
389 [ # # ]: 0 : if ( m_xPropertyChangeListener.is() )
390 : : {
391 : : // remove listener
392 : : try
393 : : {
394 [ # # ][ # # ]: 0 : m_xReportComponent->removePropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
[ # # ]
395 : : }
396 : 0 : catch(const uno::Exception &)
397 : : {
398 : : OSL_FAIL("OObjectBase::EndListening: Exception caught!");
399 : : }
400 : : }
401 : 0 : m_xPropertyChangeListener.clear();
402 : : }
403 : 0 : }
404 : : //----------------------------------------------------------------------------
405 : 0 : void OObjectBase::SetPropsFromRect(const Rectangle& _rRect)
406 : : {
407 : : DBG_CHKTHIS( rpt_OObjectBase,NULL);
408 : : // set properties
409 [ # # ]: 0 : OReportPage* pPage = dynamic_cast<OReportPage*>(GetImplPage());
410 [ # # ][ # # ]: 0 : if ( pPage && !_rRect.IsEmpty() )
[ # # ]
411 : : {
412 [ # # ]: 0 : uno::Reference<report::XSection> xSection = pPage->getSection();
413 [ # # ][ # # ]: 0 : if ( xSection.is() && (static_cast<sal_uInt32>(_rRect.getHeight() + _rRect.Top()) > xSection->getHeight()) )
[ # # ][ # # ]
[ # # ]
414 [ # # ][ # # ]: 0 : xSection->setHeight(_rRect.getHeight() + _rRect.Top());
415 : :
416 : : // TODO
417 : : //pModel->GetRefDevice()->Invalidate(INVALIDATE_CHILDREN);
418 : : }
419 : 0 : }
420 : : //----------------------------------------------------------------------------
421 : 0 : void OObjectBase::_propertyChange( const beans::PropertyChangeEvent& /*evt*/ ) throw( uno::RuntimeException)
422 : : {
423 : : DBG_CHKTHIS( rpt_OObjectBase,NULL);
424 : 0 : }
425 : : //----------------------------------------------------------------------------
426 : 0 : void OObjectBase::SetObjectItemHelper(const SfxPoolItem& /*rItem*/)
427 : : {
428 : : // do nothing
429 : 0 : }
430 : :
431 : : //----------------------------------------------------------------------------
432 : 0 : sal_Bool OObjectBase::supportsService( const ::rtl::OUString& _sServiceName ) const
433 : : {
434 : : DBG_CHKTHIS( rpt_OObjectBase,NULL);
435 : 0 : sal_Bool bSupports = sal_False;
436 : :
437 [ # # ]: 0 : Reference< lang::XServiceInfo > xServiceInfo( m_xReportComponent , UNO_QUERY );
438 : : // TODO: cache xServiceInfo as member?
439 [ # # ]: 0 : if ( xServiceInfo.is() )
440 [ # # ][ # # ]: 0 : bSupports = xServiceInfo->supportsService( _sServiceName );
441 : :
442 : 0 : return bSupports;
443 : : }
444 : :
445 : : //----------------------------------------------------------------------------
446 : 0 : void OObjectBase::ensureSdrObjectOwnership( const uno::Reference< uno::XInterface >& _rxShape )
447 : : {
448 : : // UNDO in the report designer is implemented at the level of the XShapes, not
449 : : // at the level of SdrObjects. That is, if an object is removed from the report
450 : : // design, then this happens by removing the XShape from the UNO DrawPage, and
451 : : // putting this XShape (resp. the ReportComponent which wraps it) into an UNDO
452 : : // action.
453 : : // Unfortunately, the SvxDrawPage implementation usually deletes SdrObjects
454 : : // which are removed from it, which is deadly for us. To prevent this,
455 : : // we give the XShape implementation the ownership of the SdrObject, which
456 : : // ensures the SvxDrawPage won't delete it.
457 : 0 : SvxShape* pShape = SvxShape::getImplementation( _rxShape );
458 : : OSL_ENSURE( pShape, "OObjectBase::ensureSdrObjectOwnership: can't access the SvxShape!" );
459 [ # # ]: 0 : if ( pShape )
460 : : {
461 : : OSL_ENSURE( !pShape->HasSdrObjectOwnership(), "OObjectBase::ensureSdrObjectOwnership: called twice?" );
462 : 0 : pShape->TakeSdrObjectOwnership();
463 : : }
464 : 0 : }
465 : :
466 : : //----------------------------------------------------------------------------
467 : 0 : uno::Reference< uno::XInterface > OObjectBase::getUnoShapeOf( SdrObject& _rSdrObject )
468 : : {
469 [ # # ][ # # ]: 0 : uno::Reference< uno::XInterface > xShape( _rSdrObject.getWeakUnoShape() );
470 [ # # ]: 0 : if ( xShape.is() )
471 : 0 : return xShape;
472 : :
473 [ # # ][ # # ]: 0 : xShape = _rSdrObject.SdrObject::getUnoShape();
474 [ # # ]: 0 : if ( !xShape.is() )
475 : 0 : return xShape;
476 : :
477 [ # # ]: 0 : ensureSdrObjectOwnership( xShape );
478 : :
479 [ # # ]: 0 : m_xKeepShapeAlive = xShape;
480 : 0 : return xShape;
481 : : }
482 : :
483 : : //----------------------------------------------------------------------------
484 [ # # ][ # # ]: 0 : TYPEINIT1(OCustomShape, SdrObjCustomShape);
485 : : DBG_NAME( rpt_OCustomShape );
486 : 0 : OCustomShape::OCustomShape(const uno::Reference< report::XReportComponent>& _xComponent
487 : : )
488 : : :SdrObjCustomShape()
489 [ # # ]: 0 : ,OObjectBase(_xComponent)
490 : : {
491 : : DBG_CTOR( rpt_OCustomShape, NULL);
492 [ # # ][ # # ]: 0 : impl_setUnoShape( uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY) );
493 : 0 : m_bIsListening = sal_True;
494 : 0 : }
495 : : //----------------------------------------------------------------------------
496 : 0 : OCustomShape::OCustomShape(const ::rtl::OUString& _sComponentName)
497 : : :SdrObjCustomShape()
498 [ # # ]: 0 : ,OObjectBase(_sComponentName)
499 : : {
500 : : DBG_CTOR( rpt_OCustomShape, NULL);
501 : 0 : m_bIsListening = sal_True;
502 : 0 : }
503 : :
504 : : //----------------------------------------------------------------------------
505 [ # # ]: 0 : OCustomShape::~OCustomShape()
506 : : {
507 : : DBG_DTOR( rpt_OCustomShape, NULL);
508 [ # # ]: 0 : }
509 : : // -----------------------------------------------------------------------------
510 : 0 : sal_uInt16 OCustomShape::GetObjIdentifier() const
511 : : {
512 : 0 : return sal_uInt16(OBJ_CUSTOMSHAPE);
513 : : }
514 : : //----------------------------------------------------------------------------
515 : 0 : sal_uInt32 OCustomShape::GetObjInventor() const
516 : : {
517 : 0 : return ReportInventor;
518 : : }
519 : : //----------------------------------------------------------------------------
520 : 0 : SdrPage* OCustomShape::GetImplPage() const
521 : : {
522 : 0 : return GetPage();
523 : : }
524 : : //----------------------------------------------------------------------------
525 : 0 : void OCustomShape::SetSnapRectImpl(const Rectangle& _rRect)
526 : : {
527 : 0 : SetSnapRect( _rRect );
528 : 0 : }
529 : : //----------------------------------------------------------------------------
530 : 0 : sal_Int32 OCustomShape::GetStep() const
531 : : {
532 : : // get step property
533 : 0 : sal_Int32 nStep = 0;
534 : : OSL_FAIL("Who called me!");
535 : 0 : return nStep;
536 : : }
537 : : //----------------------------------------------------------------------------
538 : 0 : void OCustomShape::NbcMove( const Size& rSize )
539 : : {
540 [ # # ]: 0 : if ( m_bIsListening )
541 : : {
542 : 0 : m_bIsListening = sal_False;
543 : :
544 [ # # ]: 0 : if ( m_xReportComponent.is() )
545 : : {
546 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
547 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
548 [ # # ][ # # ]: 0 : m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.A());
[ # # ][ # # ]
549 [ # # ][ # # ]: 0 : m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.B());
[ # # ][ # # ]
[ # # ]
550 : : }
551 : :
552 : : // set geometry properties
553 : 0 : SetPropsFromRect(GetSnapRect());
554 : :
555 : 0 : m_bIsListening = sal_True;
556 : : }
557 : : else
558 : 0 : SdrObjCustomShape::NbcMove( rSize );
559 : 0 : }
560 : : //----------------------------------------------------------------------------
561 : 0 : void OCustomShape::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
562 : : {
563 : 0 : SdrObjCustomShape::NbcResize( rRef, xFract, yFract );
564 : :
565 : 0 : SetPropsFromRect(GetSnapRect());
566 : 0 : }
567 : : //----------------------------------------------------------------------------
568 : 0 : void OCustomShape::NbcSetLogicRect(const Rectangle& rRect)
569 : : {
570 : 0 : SdrObjCustomShape::NbcSetLogicRect(rRect);
571 : 0 : SetPropsFromRect(rRect);
572 : 0 : }
573 : : //----------------------------------------------------------------------------
574 : 0 : bool OCustomShape::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
575 : : {
576 : 0 : bool bResult = SdrObjCustomShape::EndCreate(rStat, eCmd);
577 [ # # ]: 0 : if ( bResult )
578 : : {
579 : 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
580 [ # # ]: 0 : if ( pRptModel )
581 : : {
582 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
583 [ # # ]: 0 : if ( !m_xReportComponent.is() )
584 [ # # ][ # # ]: 0 : m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
[ # # ]
585 : : }
586 : 0 : SetPropsFromRect(GetSnapRect());
587 : : }
588 : :
589 : 0 : return bResult;
590 : : }
591 : :
592 : : //----------------------------------------------------------------------------
593 : 0 : void OCustomShape::SetObjectItemHelper(const SfxPoolItem& rItem)
594 : : {
595 : 0 : SetObjectItem(rItem);
596 : : // TODO
597 : : //getSectionWindow()->getView()->AdjustMarkHdl();
598 : 0 : }
599 : :
600 : : // -----------------------------------------------------------------------------
601 : 0 : uno::Reference< beans::XPropertySet> OCustomShape::getAwtComponent()
602 : : {
603 : 0 : return uno::Reference< beans::XPropertySet>(m_xReportComponent,uno::UNO_QUERY);
604 : : }
605 : :
606 : : //----------------------------------------------------------------------------
607 : 0 : uno::Reference< uno::XInterface > OCustomShape::getUnoShape()
608 : : {
609 : 0 : uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this );
610 [ # # ]: 0 : if ( !m_xReportComponent.is() )
611 : : {
612 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
613 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
614 [ # # ][ # # ]: 0 : m_xReportComponent.set(xShape,uno::UNO_QUERY);
615 : : }
616 : 0 : return xShape;
617 : : }
618 : :
619 : : //----------------------------------------------------------------------------
620 : : //----------------------------------------------------------------------------
621 [ # # ][ # # ]: 0 : TYPEINIT1(OUnoObject, SdrUnoObj);
622 : : DBG_NAME( rpt_OUnoObject );
623 : : //----------------------------------------------------------------------------
624 : 0 : OUnoObject::OUnoObject(const ::rtl::OUString& _sComponentName
625 : : ,const ::rtl::OUString& rModelName
626 : : ,sal_uInt16 _nObjectType)
627 : : :SdrUnoObj(rModelName, sal_True)
628 : : ,OObjectBase(_sComponentName)
629 [ # # ][ # # ]: 0 : ,m_nObjectType(_nObjectType)
630 : : {
631 : : DBG_CTOR( rpt_OUnoObject, NULL);
632 [ # # ]: 0 : if ( !rModelName.isEmpty() )
633 [ # # ]: 0 : impl_initializeModel_nothrow();
634 : 0 : }
635 : : //----------------------------------------------------------------------------
636 : 0 : OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xComponent
637 : : ,const ::rtl::OUString& rModelName
638 : : ,sal_uInt16 _nObjectType)
639 : : :SdrUnoObj(rModelName, sal_True)
640 : : ,OObjectBase(_xComponent)
641 [ # # ][ # # ]: 0 : ,m_nObjectType(_nObjectType)
642 : : {
643 : : DBG_CTOR( rpt_OUnoObject, NULL);
644 [ # # ][ # # ]: 0 : impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) );
645 : :
646 [ # # ]: 0 : if ( !rModelName.isEmpty() )
647 [ # # ]: 0 : impl_initializeModel_nothrow();
648 : :
649 : 0 : }
650 : : //----------------------------------------------------------------------------
651 [ # # ]: 0 : OUnoObject::~OUnoObject()
652 : : {
653 : : DBG_DTOR( rpt_OUnoObject, NULL);
654 [ # # ]: 0 : }
655 : : // -----------------------------------------------------------------------------
656 : 0 : void OUnoObject::impl_initializeModel_nothrow()
657 : : {
658 : : try
659 : : {
660 [ # # ]: 0 : Reference< XFormattedField > xFormatted( m_xReportComponent, UNO_QUERY );
661 [ # # ]: 0 : if ( xFormatted.is() )
662 : : {
663 [ # # ][ # # ]: 0 : const Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW );
664 [ # # ]: 0 : const ::rtl::OUString sTreatAsNumberProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TreatAsNumber" ) );
665 [ # # ][ # # ]: 0 : xModelProps->setPropertyValue( sTreatAsNumberProperty, makeAny( sal_False ) );
[ # # ]
666 [ # # ][ # # ]: 0 : xModelProps->setPropertyValue( PROPERTY_VERTICALALIGN,m_xReportComponent->getPropertyValue(PROPERTY_VERTICALALIGN));
[ # # ][ # # ]
[ # # ][ # # ]
667 [ # # ]: 0 : }
668 : : }
669 : 0 : catch( const Exception& )
670 : : {
671 : : DBG_UNHANDLED_EXCEPTION();
672 : : }
673 : 0 : }
674 : : // -----------------------------------------------------------------------------
675 : 0 : void OUnoObject::impl_setReportComponent_nothrow()
676 : : {
677 [ # # ]: 0 : if ( m_xReportComponent.is() )
678 : : return;
679 : :
680 [ # # ]: 0 : OReportModel* pReportModel = static_cast<OReportModel*>(GetModel());
681 : : OSL_ENSURE( pReportModel, "OUnoObject::impl_setReportComponent_nothrow: no report model!" );
682 [ # # ]: 0 : if ( !pReportModel )
683 : : return;
684 : :
685 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock( pReportModel->GetUndoEnv() );
686 [ # # ][ # # ]: 0 : m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
687 : :
688 [ # # ][ # # ]: 0 : impl_initializeModel_nothrow();
689 : : }
690 : : // -----------------------------------------------------------------------------
691 : 0 : sal_uInt16 OUnoObject::GetObjIdentifier() const
692 : : {
693 : 0 : return sal_uInt16(m_nObjectType);
694 : : }
695 : : //----------------------------------------------------------------------------
696 : 0 : sal_uInt32 OUnoObject::GetObjInventor() const
697 : : {
698 : 0 : return ReportInventor;
699 : : }
700 : : //----------------------------------------------------------------------------
701 : 0 : SdrPage* OUnoObject::GetImplPage() const
702 : : {
703 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
704 : 0 : return GetPage();
705 : : }
706 : : //----------------------------------------------------------------------------
707 : 0 : void OUnoObject::SetSnapRectImpl(const Rectangle& _rRect)
708 : : {
709 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
710 : 0 : SetSnapRect( _rRect );
711 : 0 : }
712 : : //----------------------------------------------------------------------------
713 : 0 : sal_Int32 OUnoObject::GetStep() const
714 : : {
715 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
716 : : // get step property
717 : 0 : sal_Int32 nStep = 0;
718 : : OSL_FAIL("Who called me!");
719 : 0 : return nStep;
720 : : }
721 : :
722 : : //----------------------------------------------------------------------------
723 : 0 : void OUnoObject::NbcMove( const Size& rSize )
724 : : {
725 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
726 : :
727 [ # # ]: 0 : if ( m_bIsListening )
728 : : {
729 : : // stop listening
730 [ # # ]: 0 : OObjectBase::EndListening(sal_False);
731 : :
732 : 0 : bool bPositionFixed = false;
733 : 0 : Size aUndoSize(0,0);
734 : 0 : bool bUndoMode = false;
735 [ # # ]: 0 : if ( m_xReportComponent.is() )
736 : : {
737 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
738 [ # # ][ # # ]: 0 : if (pRptModel->GetUndoEnv().IsUndoMode())
[ # # ]
739 : : {
740 : : // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
741 : 0 : bUndoMode = true;
742 : : }
743 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
744 : :
745 : : // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
746 [ # # ][ # # ]: 0 : int nNewX = m_xReportComponent->getPositionX() + rSize.A();
747 [ # # ][ # # ]: 0 : m_xReportComponent->setPositionX(nNewX);
748 [ # # ][ # # ]: 0 : int nNewY = m_xReportComponent->getPositionY() + rSize.B();
749 [ # # ][ # # ]: 0 : if (nNewY < 0 && !bUndoMode)
750 : : {
751 : 0 : aUndoSize.B() = abs(nNewY);
752 : 0 : bPositionFixed = true;
753 : 0 : nNewY = 0;
754 : : }
755 [ # # ][ # # ]: 0 : m_xReportComponent->setPositionY(nNewY);
[ # # ]
756 : : }
757 [ # # ]: 0 : if (bPositionFixed)
758 : : {
759 [ # # ][ # # ]: 0 : GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
[ # # ][ # # ]
[ # # ]
760 : : }
761 : : // set geometry properties
762 [ # # ][ # # ]: 0 : SetPropsFromRect(GetLogicRect());
763 : :
764 : : // start listening
765 [ # # ]: 0 : OObjectBase::StartListening();
766 : : }
767 : : else
768 : 0 : SdrUnoObj::NbcMove( rSize );
769 : 0 : }
770 : :
771 : : //----------------------------------------------------------------------------
772 : :
773 : 0 : void OUnoObject::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
774 : : {
775 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
776 : 0 : SdrUnoObj::NbcResize( rRef, xFract, yFract );
777 : :
778 : : // stop listening
779 : 0 : OObjectBase::EndListening(sal_False);
780 : :
781 : : // set geometry properties
782 : 0 : SetPropsFromRect(GetLogicRect());
783 : :
784 : : // start listening
785 : 0 : OObjectBase::StartListening();
786 : 0 : }
787 : : //----------------------------------------------------------------------------
788 : 0 : void OUnoObject::NbcSetLogicRect(const Rectangle& rRect)
789 : : {
790 : 0 : SdrUnoObj::NbcSetLogicRect(rRect);
791 : : // stop listening
792 : 0 : OObjectBase::EndListening(sal_False);
793 : :
794 : : // set geometry properties
795 : 0 : SetPropsFromRect(rRect);
796 : :
797 : : // start listening
798 : 0 : OObjectBase::StartListening();
799 : 0 : }
800 : : //----------------------------------------------------------------------------
801 : :
802 : 0 : bool OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
803 : : {
804 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
805 : 0 : bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
806 [ # # ]: 0 : if ( bResult )
807 : : {
808 : 0 : impl_setReportComponent_nothrow();
809 : : // set labels
810 [ # # ]: 0 : if ( m_xReportComponent.is() )
811 : : {
812 : : try
813 : : {
814 [ # # ][ # # ]: 0 : if ( supportsService( SERVICE_FIXEDTEXT ) )
[ # # ]
815 : : {
816 [ # # ][ # # ]: 0 : m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) );
[ # # ][ # # ]
[ # # ][ # # ]
817 : : }
818 : : }
819 : 0 : catch(const uno::Exception&)
820 : : {
821 : : DBG_UNHANDLED_EXCEPTION();
822 : : }
823 : :
824 : 0 : impl_initializeModel_nothrow();
825 : : }
826 : : // set geometry properties
827 : 0 : SetPropsFromRect(GetLogicRect());
828 : : }
829 : :
830 : 0 : return bResult;
831 : : }
832 : : //----------------------------------------------------------------------------
833 : 0 : ::rtl::OUString OUnoObject::GetDefaultName(const OUnoObject* _pObj)
834 : : {
835 : 0 : sal_uInt16 nResId = 0;
836 : 0 : ::rtl::OUString aDefaultName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HERE WE HAVE TO INSERT OUR NAME!"));
837 [ # # ][ # # ]: 0 : if ( _pObj->supportsService( SERVICE_FIXEDTEXT ) )
[ # # ]
838 : : {
839 : 0 : nResId = RID_STR_CLASS_FIXEDTEXT;
840 : : }
841 [ # # ][ # # ]: 0 : else if ( _pObj->supportsService( SERVICE_FIXEDLINE ) )
[ # # ]
842 : : {
843 : 0 : nResId = RID_STR_CLASS_FIXEDLINE;
844 : : }
845 [ # # ][ # # ]: 0 : else if ( _pObj->supportsService( SERVICE_IMAGECONTROL ) )
[ # # ]
846 : : {
847 : 0 : nResId = RID_STR_CLASS_IMAGECONTROL;
848 : : }
849 [ # # ][ # # ]: 0 : else if ( _pObj->supportsService( SERVICE_FORMATTEDFIELD ) )
[ # # ]
850 : : {
851 : 0 : nResId = RID_STR_CLASS_FORMATTEDFIELD;
852 : : }
853 : :
854 [ # # ]: 0 : if (nResId)
855 [ # # ][ # # ]: 0 : aDefaultName = ::rtl::OUString( String(ModuleRes(nResId)) );
[ # # ][ # # ]
856 : :
857 : 0 : return aDefaultName;
858 : : }
859 : :
860 : : // -----------------------------------------------------------------------------
861 : 0 : void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt ) throw( uno::RuntimeException)
862 : : {
863 : : DBG_CHKTHIS( rpt_OUnoObject,NULL);
864 : 0 : OObjectBase::_propertyChange(evt);
865 [ # # ]: 0 : if (isListening())
866 : : {
867 [ # # ]: 0 : if ( evt.PropertyName == PROPERTY_CHARCOLOR )
868 : : {
869 [ # # ][ # # ]: 0 : Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
870 [ # # ]: 0 : if ( xControlModel.is() )
871 : : {
872 [ # # ]: 0 : OObjectBase::EndListening(sal_False);
873 : : try
874 : : {
875 [ # # ][ # # ]: 0 : xControlModel->setPropertyValue(PROPERTY_TEXTCOLOR,evt.NewValue);
[ # # ][ # # ]
876 : : }
877 [ # # ]: 0 : catch(uno::Exception&)
878 : : {
879 : : }
880 [ # # ]: 0 : OObjectBase::StartListening();
881 : 0 : }
882 : : }
883 [ # # ]: 0 : else if ( evt.PropertyName == PROPERTY_NAME )
884 : : {
885 [ # # ][ # # ]: 0 : Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
886 [ # # ][ # # ]: 0 : if ( xControlModel.is() && xControlModel->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ][ # # ]
887 : : {
888 : : // get old name
889 : 0 : ::rtl::OUString aOldName;
890 : 0 : evt.OldValue >>= aOldName;
891 : :
892 : : // get new name
893 : 0 : ::rtl::OUString aNewName;
894 : 0 : evt.NewValue >>= aNewName;
895 : :
896 [ # # ]: 0 : if ( !aNewName.equals(aOldName) )
897 : : {
898 : : // set old name property
899 [ # # ]: 0 : OObjectBase::EndListening(sal_False);
900 [ # # ]: 0 : if ( m_xMediator.is() )
901 [ # # ]: 0 : m_xMediator.get()->stopListening();
902 : : try
903 : : {
904 [ # # ][ # # ]: 0 : xControlModel->setPropertyValue( PROPERTY_NAME, evt.NewValue );
[ # # ][ # # ]
905 : : }
906 [ # # ]: 0 : catch(uno::Exception&)
907 : : {
908 : : }
909 [ # # ]: 0 : if ( m_xMediator.is() )
910 [ # # ]: 0 : m_xMediator.get()->startListening();
911 [ # # ]: 0 : OObjectBase::StartListening();
912 : 0 : }
913 : 0 : }
914 : : }
915 : : }
916 : 0 : }
917 : : // -----------------------------------------------------------------------------
918 : 0 : void OUnoObject::CreateMediator(sal_Bool _bReverse)
919 : : {
920 [ # # ]: 0 : if ( !m_xMediator.is() )
921 : : {
922 [ # # ]: 0 : impl_setReportComponent_nothrow();
923 : :
924 [ # # ][ # # ]: 0 : Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
925 [ # # ][ # # ]: 0 : if ( !m_xMediator.is() && m_xReportComponent.is() && xControlModel.is() )
[ # # ][ # # ]
926 [ # # ][ # # ]: 0 : m_xMediator = TMediator::createFromQuery(new OPropertyMediator(m_xReportComponent.get(),xControlModel,getPropertyNameMap(GetObjIdentifier()),_bReverse));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
927 [ # # ]: 0 : OObjectBase::StartListening();
928 : : }
929 : 0 : }
930 : : // -----------------------------------------------------------------------------
931 : 0 : uno::Reference< beans::XPropertySet> OUnoObject::getAwtComponent()
932 : : {
933 [ # # ]: 0 : return Reference<XPropertySet>(GetUnoControlModel(),uno::UNO_QUERY);
934 : : }
935 : :
936 : : // -----------------------------------------------------------------------------
937 : 0 : uno::Reference< uno::XInterface > OUnoObject::getUnoShape()
938 : : {
939 : 0 : return OObjectBase::getUnoShapeOf( *this );
940 : : }
941 : :
942 : 0 : OUnoObject& OUnoObject::operator=(const OUnoObject& rObj)
943 : : {
944 [ # # ]: 0 : if( this == &rObj )
945 : 0 : return *this;
946 [ # # ]: 0 : SdrUnoObj::operator=(rObj);
947 : :
948 [ # # ][ # # ]: 0 : Reference<XPropertySet> xSource(const_cast<OUnoObject&>(rObj).getUnoShape(), uno::UNO_QUERY);
949 [ # # ][ # # ]: 0 : Reference<XPropertySet> xDest(getUnoShape(), uno::UNO_QUERY);
950 [ # # ][ # # ]: 0 : if ( xSource.is() && xDest.is() )
[ # # ]
951 [ # # ][ # # ]: 0 : comphelper::copyProperties(xSource.get(), xDest.get());
[ # # ][ # # ]
[ # # ]
952 : :
953 : 0 : return *this;
954 : : }
955 : :
956 : 0 : OUnoObject* OUnoObject::Clone() const
957 : : {
958 : 0 : return CloneHelper< OUnoObject >();
959 : : }
960 : : //----------------------------------------------------------------------------
961 : : // OOle2Obj
962 : : //----------------------------------------------------------------------------
963 [ # # ][ # # ]: 0 : TYPEINIT1(OOle2Obj, SdrOle2Obj);
964 : : DBG_NAME( rpt_OOle2Obj );
965 : 0 : OOle2Obj::OOle2Obj(const uno::Reference< report::XReportComponent>& _xComponent,sal_uInt16 _nType)
966 : : :SdrOle2Obj()
967 : : ,OObjectBase(_xComponent)
968 : : ,m_nType(_nType)
969 [ # # ]: 0 : ,m_bOnlyOnce(true)
970 : : {
971 : : DBG_CTOR( rpt_OOle2Obj, NULL);
972 : :
973 [ # # ][ # # ]: 0 : impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) );
974 : 0 : m_bIsListening = sal_True;
975 : 0 : }
976 : : //----------------------------------------------------------------------------
977 : 0 : OOle2Obj::OOle2Obj(const ::rtl::OUString& _sComponentName,sal_uInt16 _nType)
978 : : :SdrOle2Obj()
979 : : ,OObjectBase(_sComponentName)
980 : : ,m_nType(_nType)
981 [ # # ]: 0 : ,m_bOnlyOnce(true)
982 : : {
983 : : DBG_CTOR( rpt_OOle2Obj, NULL);
984 : 0 : m_bIsListening = sal_True;
985 : 0 : }
986 : : //----------------------------------------------------------------------------
987 [ # # ]: 0 : OOle2Obj::~OOle2Obj()
988 : : {
989 : : DBG_DTOR( rpt_OOle2Obj, NULL);
990 [ # # ]: 0 : }
991 : : // -----------------------------------------------------------------------------
992 : 0 : sal_uInt16 OOle2Obj::GetObjIdentifier() const
993 : : {
994 : 0 : return m_nType;
995 : : }
996 : : //----------------------------------------------------------------------------
997 : 0 : sal_uInt32 OOle2Obj::GetObjInventor() const
998 : : {
999 : 0 : return ReportInventor;
1000 : : }
1001 : : //----------------------------------------------------------------------------
1002 : 0 : SdrPage* OOle2Obj::GetImplPage() const
1003 : : {
1004 : : DBG_CHKTHIS( rpt_OOle2Obj,NULL);
1005 : 0 : return GetPage();
1006 : : }
1007 : : //----------------------------------------------------------------------------
1008 : 0 : void OOle2Obj::SetSnapRectImpl(const Rectangle& _rRect)
1009 : : {
1010 : : DBG_CHKTHIS( rpt_OOle2Obj,NULL);
1011 : 0 : SetSnapRect( _rRect );
1012 : 0 : }
1013 : : //----------------------------------------------------------------------------
1014 : 0 : sal_Int32 OOle2Obj::GetStep() const
1015 : : {
1016 : : DBG_CHKTHIS( rpt_OOle2Obj,NULL);
1017 : : // get step property
1018 : 0 : sal_Int32 nStep = 0;
1019 : : OSL_FAIL("Who called me!");
1020 : 0 : return nStep;
1021 : : }
1022 : :
1023 : : //----------------------------------------------------------------------------
1024 : 0 : void OOle2Obj::NbcMove( const Size& rSize )
1025 : : {
1026 : : DBG_CHKTHIS( rpt_OOle2Obj,NULL);
1027 : :
1028 [ # # ]: 0 : if ( m_bIsListening )
1029 : : {
1030 : : // stop listening
1031 [ # # ]: 0 : OObjectBase::EndListening(sal_False);
1032 : :
1033 : 0 : bool bPositionFixed = false;
1034 : 0 : Size aUndoSize(0,0);
1035 : 0 : bool bUndoMode = false;
1036 [ # # ]: 0 : if ( m_xReportComponent.is() )
1037 : : {
1038 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
1039 [ # # ][ # # ]: 0 : if (pRptModel->GetUndoEnv().IsUndoMode())
[ # # ]
1040 : : {
1041 : : // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
1042 : 0 : bUndoMode = true;
1043 : : }
1044 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
1045 : :
1046 : : // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
1047 [ # # ][ # # ]: 0 : int nNewX = m_xReportComponent->getPositionX() + rSize.A();
1048 : : // can this hinder us to set components outside the area?
1049 : : // if (nNewX < 0)
1050 : : // {
1051 : : // nNewX = 0;
1052 : : // }
1053 [ # # ][ # # ]: 0 : m_xReportComponent->setPositionX(nNewX);
1054 [ # # ][ # # ]: 0 : int nNewY = m_xReportComponent->getPositionY() + rSize.B();
1055 [ # # ][ # # ]: 0 : if (nNewY < 0 && !bUndoMode)
1056 : : {
1057 : 0 : aUndoSize.B() = abs(nNewY);
1058 : 0 : bPositionFixed = true;
1059 : 0 : nNewY = 0;
1060 : : }
1061 [ # # ][ # # ]: 0 : m_xReportComponent->setPositionY(nNewY);
[ # # ]
1062 : : }
1063 [ # # ]: 0 : if (bPositionFixed)
1064 : : {
1065 [ # # ][ # # ]: 0 : GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
[ # # ][ # # ]
[ # # ]
1066 : : }
1067 : : // set geometry properties
1068 [ # # ][ # # ]: 0 : SetPropsFromRect(GetLogicRect());
1069 : :
1070 : : // start listening
1071 [ # # ]: 0 : OObjectBase::StartListening();
1072 : : }
1073 : : else
1074 : 0 : SdrOle2Obj::NbcMove( rSize );
1075 : 0 : }
1076 : :
1077 : : //----------------------------------------------------------------------------
1078 : :
1079 : 0 : void OOle2Obj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
1080 : : {
1081 : : DBG_CHKTHIS( rpt_OOle2Obj,NULL);
1082 : 0 : SdrOle2Obj::NbcResize( rRef, xFract, yFract );
1083 : :
1084 : : // stop listening
1085 : 0 : OObjectBase::EndListening(sal_False);
1086 : :
1087 : : // set geometry properties
1088 : 0 : SetPropsFromRect(GetLogicRect());
1089 : :
1090 : : // start listening
1091 : 0 : OObjectBase::StartListening();
1092 : 0 : }
1093 : : //----------------------------------------------------------------------------
1094 : 0 : void OOle2Obj::NbcSetLogicRect(const Rectangle& rRect)
1095 : : {
1096 : 0 : SdrOle2Obj::NbcSetLogicRect(rRect);
1097 : : // stop listening
1098 : 0 : OObjectBase::EndListening(sal_False);
1099 : :
1100 : : // set geometry properties
1101 : 0 : SetPropsFromRect(rRect);
1102 : :
1103 : : // start listening
1104 : 0 : OObjectBase::StartListening();
1105 : 0 : }
1106 : : //----------------------------------------------------------------------------
1107 : :
1108 : 0 : bool OOle2Obj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
1109 : : {
1110 : : DBG_CHKTHIS( rpt_OOle2Obj,NULL);
1111 : 0 : bool bResult = SdrOle2Obj::EndCreate(rStat, eCmd);
1112 [ # # ]: 0 : if ( bResult )
1113 : : {
1114 : 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
1115 [ # # ]: 0 : if ( pRptModel )
1116 : : {
1117 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
1118 [ # # ]: 0 : if ( !m_xReportComponent.is() )
1119 [ # # ][ # # ]: 0 : m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
[ # # ]
1120 : : }
1121 : : // set geometry properties
1122 : 0 : SetPropsFromRect(GetLogicRect());
1123 : : }
1124 : :
1125 : 0 : return bResult;
1126 : : }
1127 : :
1128 : 0 : uno::Reference< beans::XPropertySet> OOle2Obj::getAwtComponent()
1129 : : {
1130 : 0 : return uno::Reference< beans::XPropertySet>(m_xReportComponent,uno::UNO_QUERY);
1131 : : }
1132 : :
1133 : : // -----------------------------------------------------------------------------
1134 : 0 : uno::Reference< uno::XInterface > OOle2Obj::getUnoShape()
1135 : : {
1136 : 0 : uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this );
1137 [ # # ]: 0 : if ( !m_xReportComponent.is() )
1138 : : {
1139 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
1140 [ # # ][ # # ]: 0 : OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
1141 [ # # ][ # # ]: 0 : m_xReportComponent.set(xShape,uno::UNO_QUERY);
1142 : : }
1143 : 0 : return xShape;
1144 : : }
1145 : : // -----------------------------------------------------------------------------
1146 : 0 : uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const uno::Reference < embed::XEmbeddedObject >& _xObj)
1147 : : {
1148 : 0 : uno::Reference< chart2::data::XDatabaseDataProvider > xSource;
1149 [ # # ]: 0 : uno::Reference< embed::XComponentSupplier > xCompSupp(_xObj,uno::UNO_QUERY);
1150 [ # # ]: 0 : if( xCompSupp.is())
1151 : : {
1152 [ # # ][ # # ]: 0 : uno::Reference< chart2::XChartDocument> xChartDoc( xCompSupp->getComponent(), uno::UNO_QUERY );
[ # # ]
1153 [ # # ]: 0 : if ( xChartDoc.is() )
1154 : : {
1155 [ # # ][ # # ]: 0 : xSource.set(xChartDoc->getDataProvider(),uno::UNO_QUERY);
[ # # ]
1156 : 0 : }
1157 : : }
1158 : 0 : return xSource;
1159 : : }
1160 : :
1161 : 0 : OOle2Obj& OOle2Obj::operator=(const OOle2Obj& rObj)
1162 : : {
1163 [ # # ]: 0 : if( this == &rObj )
1164 : 0 : return *this;
1165 [ # # ]: 0 : SdrOle2Obj::operator=(rObj);
1166 : :
1167 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(rObj.GetModel());
1168 [ # # ][ # # ]: 0 : svt::EmbeddedObjectRef::TryRunningState( GetObjRef() );
1169 [ # # ][ # # ]: 0 : impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
[ # # ][ # # ]
1170 : :
1171 [ # # ][ # # ]: 0 : uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(rObj.GetObjRef()) );
1172 [ # # ][ # # ]: 0 : uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(GetObjRef()) );
1173 [ # # ][ # # ]: 0 : if ( xSource.is() && xDest.is() )
[ # # ]
1174 [ # # ][ # # ]: 0 : comphelper::copyProperties(xSource.get(),xDest.get());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1175 : :
1176 [ # # ][ # # ]: 0 : initializeChart(pRptModel->getReportDefinition().get());
[ # # ][ # # ]
1177 : :
1178 : 0 : return *this;
1179 : : }
1180 : :
1181 : : // -----------------------------------------------------------------------------
1182 : : // Clone() soll eine komplette Kopie des Objektes erzeugen.
1183 : 0 : OOle2Obj* OOle2Obj::Clone() const
1184 : : {
1185 : 0 : return CloneHelper< OOle2Obj >();
1186 : : }
1187 : : // -----------------------------------------------------------------------------
1188 : 0 : void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel)
1189 : : {
1190 : : try
1191 : : {
1192 [ # # ]: 0 : uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
1193 : 0 : uno::Reference< chart2::data::XDataReceiver > xReceiver;
1194 [ # # ]: 0 : uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
1195 [ # # ]: 0 : if( xCompSupp.is())
1196 [ # # ][ # # ]: 0 : xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
[ # # ]
1197 : : OSL_ASSERT( xReceiver.is());
1198 [ # # ]: 0 : if( xReceiver.is() )
1199 : : {
1200 [ # # ]: 0 : uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY);
1201 [ # # ][ # # ]: 0 : uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY);
[ # # ][ # # ]
1202 [ # # ][ # # ]: 0 : xReceiver->attachDataProvider( xDataProvider.get() );
[ # # ][ # # ]
1203 [ # # ]: 0 : }
1204 : : }
1205 : 0 : catch(const uno::Exception &)
1206 : : {
1207 : : }
1208 : 0 : }
1209 : : // -----------------------------------------------------------------------------
1210 : 0 : void OOle2Obj::initializeOle()
1211 : : {
1212 [ # # ]: 0 : if ( m_bOnlyOnce )
1213 : : {
1214 : 0 : m_bOnlyOnce = false;
1215 [ # # ]: 0 : uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
1216 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
1217 [ # # ][ # # ]: 0 : pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
[ # # ]
1218 : :
1219 [ # # ]: 0 : uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
1220 [ # # ]: 0 : if( xCompSupp.is() )
1221 : : {
1222 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY );
[ # # ]
1223 [ # # ]: 0 : if ( xChartProps.is() )
1224 [ # # ][ # # ]: 0 : xChartProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate")),uno::makeAny(util::DateTime(0,0,0,0,1,1,1900)));
[ # # ][ # # ]
1225 : 0 : }
1226 : : }
1227 : 0 : }
1228 : : // -----------------------------------------------------------------------------
1229 : 0 : void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel)
1230 : : {
1231 [ # # ]: 0 : uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
1232 : 0 : uno::Reference< chart2::data::XDataReceiver > xReceiver;
1233 [ # # ]: 0 : uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
1234 [ # # ]: 0 : if( xCompSupp.is())
1235 [ # # ][ # # ]: 0 : xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
[ # # ]
1236 : : OSL_ASSERT( xReceiver.is());
1237 [ # # ]: 0 : if( xReceiver.is() )
1238 : : {
1239 : : // lock the model to suppress any internal updates
1240 [ # # ]: 0 : uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY );
1241 [ # # ]: 0 : if( xChartModel.is() )
1242 [ # # ][ # # ]: 0 : xChartModel->lockControllers();
1243 : :
1244 [ # # ][ # # ]: 0 : if ( !lcl_getDataProvider(xObj).is() )
1245 [ # # ]: 0 : impl_createDataProvider_nothrow(_xModel);
1246 : :
1247 [ # # ]: 0 : OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
1248 [ # # ][ # # ]: 0 : pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
[ # # ]
1249 : :
1250 [ # # ]: 0 : ::comphelper::NamedValueCollection aArgs;
1251 [ # # ][ # # ]: 0 : aArgs.put( "CellRangeRepresentation", uno::makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "all" ) ) ) );
[ # # ]
1252 [ # # ][ # # ]: 0 : aArgs.put( "HasCategories", uno::makeAny( sal_True ) );
1253 [ # # ][ # # ]: 0 : aArgs.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
1254 [ # # ][ # # ]: 0 : aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
1255 [ # # ][ # # ]: 0 : xReceiver->setArguments( aArgs.getPropertyValues() );
[ # # ][ # # ]
1256 : :
1257 [ # # ]: 0 : if( xChartModel.is() )
1258 [ # # ][ # # ]: 0 : xChartModel->unlockControllers();
[ # # ]
1259 : 0 : }
1260 : 0 : }
1261 : : // -----------------------------------------------------------------------------
1262 : 0 : uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XReportDefinition>& _xReport)
1263 : : {
1264 [ # # ][ # # ]: 0 : uno::Reference<container::XNameAccess> xStyles = _xReport->getStyleFamilies();
1265 [ # # ][ # # ]: 0 : uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles"))),uno::UNO_QUERY);
[ # # ][ # # ]
1266 : :
1267 : 0 : uno::Reference< style::XStyle> xReturn;
1268 [ # # ][ # # ]: 0 : uno::Sequence< ::rtl::OUString> aSeq = xPageStyles->getElementNames();
1269 : 0 : const ::rtl::OUString* pIter = aSeq.getConstArray();
1270 : 0 : const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
1271 [ # # ][ # # ]: 0 : for(;pIter != pEnd && !xReturn.is() ;++pIter)
[ # # ]
1272 : : {
1273 [ # # ][ # # ]: 0 : uno::Reference< style::XStyle> xStyle(xPageStyles->getByName(*pIter),uno::UNO_QUERY);
[ # # ]
1274 [ # # ][ # # ]: 0 : if ( xStyle->isInUse() )
[ # # ]
1275 [ # # ]: 0 : xReturn = xStyle;
1276 : 0 : }
1277 [ # # ]: 0 : return xReturn;
1278 : : }
1279 : : //----------------------------------------------------------------------------
1280 : : //============================================================================
1281 : : } // rptui
1282 : : //============================================================================
1283 : :
1284 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|