Line data Source code
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 : #include "ReportDefinition.hxx"
20 :
21 : #include "FixedLine.hxx"
22 : #include "FixedText.hxx"
23 : #include "FormattedField.hxx"
24 : #include "Functions.hxx"
25 : #include "Groups.hxx"
26 : #include "ImageControl.hxx"
27 : #include "ReportComponent.hxx"
28 : #include "ReportHelperImpl.hxx"
29 : #include "RptDef.hxx"
30 : #include "RptModel.hxx"
31 : #include "Section.hxx"
32 : #include "Shape.hxx"
33 : #include "Tools.hxx"
34 : #include "UndoEnv.hxx"
35 : #include "core_resource.hrc"
36 : #include "core_resource.hxx"
37 : #include "corestrings.hrc"
38 :
39 : #include <com/sun/star/beans/PropertyAttribute.hpp>
40 : #include <com/sun/star/beans/XMultiPropertyStates.hpp>
41 : #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
42 : #include <com/sun/star/document/DocumentProperties.hpp>
43 : #include <com/sun/star/document/IndexedPropertyValues.hpp>
44 : #include <com/sun/star/document/EventObject.hpp>
45 : #include <com/sun/star/document/XEventListener.hpp>
46 : #include <com/sun/star/document/XExporter.hpp>
47 : #include <com/sun/star/document/XFilter.hpp>
48 : #include <com/sun/star/document/XImporter.hpp>
49 : #include <com/sun/star/embed/Aspects.hpp>
50 : #include <com/sun/star/embed/ElementModes.hpp>
51 : #include <com/sun/star/embed/EmbedMapUnits.hpp>
52 : #include <com/sun/star/embed/EntryInitModes.hpp>
53 : #include <com/sun/star/embed/XEmbedPersist.hpp>
54 : #include <com/sun/star/embed/XTransactedObject.hpp>
55 : #include <com/sun/star/embed/StorageFactory.hpp>
56 : #include <com/sun/star/frame/Desktop.hpp>
57 : #include <com/sun/star/frame/FrameSearchFlag.hpp>
58 : #include <com/sun/star/frame/XComponentLoader.hpp>
59 : #include <com/sun/star/io/XActiveDataSource.hpp>
60 : #include <com/sun/star/io/XSeekable.hpp>
61 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
62 : #include <com/sun/star/report/GroupKeepTogether.hpp>
63 : #include <com/sun/star/report/ReportPrintOption.hpp>
64 : #include <com/sun/star/report/XFunction.hpp>
65 : #include <com/sun/star/sdb/CommandType.hpp>
66 : #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
67 : #include <com/sun/star/style/GraphicLocation.hpp>
68 : #include <com/sun/star/style/NumberingType.hpp>
69 : #include <com/sun/star/style/PageStyleLayout.hpp>
70 : #include <com/sun/star/style/XStyle.hpp>
71 : #include <com/sun/star/table/BorderLine2.hpp>
72 : #include <com/sun/star/table/ShadowFormat.hpp>
73 : #include <com/sun/star/task/InteractionHandler.hpp>
74 : #include <com/sun/star/task/XStatusIndicator.hpp>
75 : #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
76 : #include <com/sun/star/ui/UIConfigurationManager.hpp>
77 : #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
78 : #include <com/sun/star/util/NumberFormatsSupplier.hpp>
79 : #include <com/sun/star/xml/AttributeData.hpp>
80 : #include <com/sun/star/xml/sax/Writer.hpp>
81 :
82 : #include <comphelper/broadcasthelper.hxx>
83 : #include <comphelper/documentconstants.hxx>
84 : #include <comphelper/genericpropertyset.hxx>
85 : #include <unotools/mediadescriptor.hxx>
86 : #include <comphelper/mimeconfighelper.hxx>
87 : #include <comphelper/namecontainer.hxx>
88 : #include <comphelper/namedvaluecollection.hxx>
89 : #include <comphelper/numberedcollection.hxx>
90 : #include <comphelper/proparrhlp.hxx>
91 : #include <comphelper/property.hxx>
92 : #include <comphelper/propertysetinfo.hxx>
93 : #include <comphelper/propertystatecontainer.hxx>
94 : #include <comphelper/seqstream.hxx>
95 : #include <comphelper/sequence.hxx>
96 : #include <comphelper/storagehelper.hxx>
97 : #include <comphelper/uno3.hxx>
98 : #include <connectivity/CommonTools.hxx>
99 : #include <connectivity/dbconversion.hxx>
100 : #include <connectivity/dbtools.hxx>
101 : #include <cppuhelper/exc_hlp.hxx>
102 : #include <cppuhelper/interfacecontainer.h>
103 : #include <cppuhelper/supportsservice.hxx>
104 : #include <dbaccess/dbaundomanager.hxx>
105 : #include <editeng/paperinf.hxx>
106 : #include <framework/titlehelper.hxx>
107 : #include <osl/thread.hxx>
108 : #include <svl/itempool.hxx>
109 : #include <svl/undo.hxx>
110 : #include <svx/svdlayer.hxx>
111 : #include <svx/unofill.hxx>
112 : #include <svx/xmleohlp.hxx>
113 : #include <svx/xmlgrhlp.hxx>
114 : #include <tools/debug.hxx>
115 : #include <tools/diagnose_ex.h>
116 : #include <unotools/moduleoptions.hxx>
117 : #include <unotools/saveopt.hxx>
118 : #include <unotools/streamwrap.hxx>
119 : #include <vcl/svapp.hxx>
120 : #include <vcl/virdev.hxx>
121 :
122 : #include <boost/bind.hpp>
123 : #include <boost/mem_fn.hpp>
124 : #include <boost/utility.hpp>
125 :
126 : // page styles
127 : #define SC_UNO_PAGE_LEFTBORDER "LeftBorder"
128 : #define SC_UNO_PAGE_RIGHTBORDER "RightBorder"
129 : #define SC_UNO_PAGE_BOTTBORDER "BottomBorder"
130 : #define SC_UNO_PAGE_TOPBORDER "TopBorder"
131 : #define SC_UNO_PAGE_LEFTBRDDIST "LeftBorderDistance"
132 : #define SC_UNO_PAGE_RIGHTBRDDIST "RightBorderDistance"
133 : #define SC_UNO_PAGE_BOTTBRDDIST "BottomBorderDistance"
134 : #define SC_UNO_PAGE_TOPBRDDIST "TopBorderDistance"
135 : #define SC_UNO_PAGE_BORDERDIST "BorderDistance"
136 : #define SC_UNO_PAGE_SHADOWFORM "ShadowFormat"
137 : #define SC_UNO_PAGE_PAPERTRAY "PrinterPaperTray"
138 : #define SC_UNO_PAGE_SCALEVAL "PageScale"
139 : #define SC_UNO_PAGE_SCALETOPAG "ScaleToPages"
140 : #define SC_UNO_PAGE_SCALETOX "ScaleToPagesX"
141 : #define SC_UNO_PAGE_SCALETOY "ScaleToPagesY"
142 : #define SC_UNO_PAGE_HDRBACKCOL "HeaderBackColor"
143 : #define SC_UNO_PAGE_HDRBACKTRAN "HeaderBackTransparent"
144 : #define SC_UNO_PAGE_HDRGRFFILT "HeaderBackGraphicFilter"
145 : #define SC_UNO_PAGE_HDRGRFLOC "HeaderBackGraphicLocation"
146 : #define SC_UNO_PAGE_HDRGRFURL "HeaderBackGraphicURL"
147 : #define SC_UNO_PAGE_HDRLEFTBOR "HeaderLeftBorder"
148 : #define SC_UNO_PAGE_HDRRIGHTBOR "HeaderRightBorder"
149 : #define SC_UNO_PAGE_HDRBOTTBOR "HeaderBottomBorder"
150 : #define SC_UNO_PAGE_HDRTOPBOR "HeaderTopBorder"
151 : #define SC_UNO_PAGE_HDRLEFTBDIS "HeaderLeftBorderDistance"
152 : #define SC_UNO_PAGE_HDRRIGHTBDIS "HeaderRightBorderDistance"
153 : #define SC_UNO_PAGE_HDRBOTTBDIS "HeaderBottomBorderDistance"
154 : #define SC_UNO_PAGE_HDRTOPBDIS "HeaderTopBorderDistance"
155 : #define SC_UNO_PAGE_HDRBRDDIST "HeaderBorderDistance"
156 : #define SC_UNO_PAGE_HDRSHADOW "HeaderShadowFormat"
157 : #define SC_UNO_PAGE_HDRLEFTMAR "HeaderLeftMargin"
158 : #define SC_UNO_PAGE_HDRRIGHTMAR "HeaderRightMargin"
159 : #define SC_UNO_PAGE_HDRBODYDIST "HeaderBodyDistance"
160 : #define SC_UNO_PAGE_HDRHEIGHT "HeaderHeight"
161 : #define SC_UNO_PAGE_HDRON "HeaderIsOn"
162 : #define SC_UNO_PAGE_HDRDYNAMIC "HeaderIsDynamicHeight"
163 : #define SC_UNO_PAGE_HDRSHARED "HeaderIsShared"
164 : #define SC_UNO_PAGE_FTRBACKCOL "FooterBackColor"
165 : #define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent"
166 : #define SC_UNO_PAGE_FTRGRFFILT "FooterBackGraphicFilter"
167 : #define SC_UNO_PAGE_FTRGRFLOC "FooterBackGraphicLocation"
168 : #define SC_UNO_PAGE_FTRGRFURL "FooterBackGraphicURL"
169 : #define SC_UNO_PAGE_FTRLEFTBOR "FooterLeftBorder"
170 : #define SC_UNO_PAGE_FTRRIGHTBOR "FooterRightBorder"
171 : #define SC_UNO_PAGE_FTRBOTTBOR "FooterBottomBorder"
172 : #define SC_UNO_PAGE_FTRTOPBOR "FooterTopBorder"
173 : #define SC_UNO_PAGE_FTRLEFTBDIS "FooterLeftBorderDistance"
174 : #define SC_UNO_PAGE_FTRRIGHTBDIS "FooterRightBorderDistance"
175 : #define SC_UNO_PAGE_FTRBOTTBDIS "FooterBottomBorderDistance"
176 : #define SC_UNO_PAGE_FTRTOPBDIS "FooterTopBorderDistance"
177 : #define SC_UNO_PAGE_FTRBRDDIST "FooterBorderDistance"
178 : #define SC_UNO_PAGE_FTRSHADOW "FooterShadowFormat"
179 : #define SC_UNO_PAGE_FTRLEFTMAR "FooterLeftMargin"
180 : #define SC_UNO_PAGE_FTRRIGHTMAR "FooterRightMargin"
181 : #define SC_UNO_PAGE_FTRBODYDIST "FooterBodyDistance"
182 : #define SC_UNO_PAGE_FTRHEIGHT "FooterHeight"
183 : #define SC_UNO_PAGE_FTRON "FooterIsOn"
184 : #define SC_UNO_PAGE_FTRDYNAMIC "FooterIsDynamicHeight"
185 : #define SC_UNO_PAGE_FTRSHARED "FooterIsShared"
186 :
187 : namespace reportdesign
188 : {
189 : using namespace com::sun::star;
190 : using namespace comphelper;
191 : using namespace rptui;
192 :
193 0 : void lcl_setModelReadOnly(const uno::Reference< embed::XStorage >& _xStorage,::boost::shared_ptr<rptui::OReportModel>& _rModel)
194 : {
195 0 : uno::Reference<beans::XPropertySet> xProp(_xStorage,uno::UNO_QUERY);
196 0 : sal_Int32 nOpenMode = embed::ElementModes::READ;
197 0 : if ( xProp.is() )
198 0 : xProp->getPropertyValue("OpenMode") >>= nOpenMode;
199 :
200 0 : _rModel->SetReadOnly((nOpenMode & embed::ElementModes::WRITE) != embed::ElementModes::WRITE);
201 0 : }
202 0 : void lcl_stripLoadArguments( utl::MediaDescriptor& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs )
203 : {
204 0 : _rDescriptor.erase( OUString( "StatusIndicator" ) );
205 0 : _rDescriptor.erase( OUString( "InteractionHandler" ) );
206 0 : _rDescriptor.erase( OUString( "Model" ) );
207 0 : _rDescriptor >> _rArgs;
208 0 : }
209 :
210 0 : void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator,
211 : uno::Sequence< uno::Any >& _rCallArgs )
212 : {
213 : try
214 : {
215 0 : _rxStatusIndicator = _rDescriptor.getUnpackedValueOrDefault( _rDescriptor.PROP_STATUSINDICATOR(), _rxStatusIndicator );
216 0 : if ( _rxStatusIndicator.is() )
217 : {
218 0 : _rxStatusIndicator->start( OUString(), (sal_Int32)1000000 );
219 :
220 0 : sal_Int32 nLength = _rCallArgs.getLength();
221 0 : _rCallArgs.realloc( nLength + 1 );
222 0 : _rCallArgs[ nLength ] <<= _rxStatusIndicator;
223 : }
224 : }
225 0 : catch (const uno::Exception&)
226 : {
227 : OSL_FAIL( "lcl_extractAndStartStatusIndicator: caught an exception!" );
228 : }
229 0 : }
230 :
231 : typedef ::comphelper::OPropertyStateContainer OStyle_PBASE;
232 : class OStyle;
233 : typedef ::comphelper::OPropertyArrayUsageHelper < OStyle
234 : > OStyle_PABASE;
235 : typedef ::cppu::WeakImplHelper2< style::XStyle, beans::XMultiPropertyStates> TStyleBASE;
236 :
237 : class OStyle : public ::comphelper::OMutexAndBroadcastHelper
238 : ,public TStyleBASE
239 : ,public OStyle_PBASE
240 : ,public OStyle_PABASE
241 : {
242 : awt::Size m_aSize;
243 :
244 : protected:
245 : void getPropertyDefaultByHandle( sal_Int32 _nHandle, uno::Any& _rDefault ) const SAL_OVERRIDE;
246 0 : virtual ~OStyle(){}
247 : public:
248 : OStyle();
249 :
250 :
251 : DECLARE_XINTERFACE( )
252 :
253 : // XPropertySet
254 : com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 : ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
256 : ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
257 :
258 : // XStyle
259 : sal_Bool SAL_CALL isUserDefined( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 : sal_Bool SAL_CALL isInUse( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
261 : OUString SAL_CALL getParentStyle( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
262 : void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw (container::NoSuchElementException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
263 :
264 : // XNamed
265 : OUString SAL_CALL getName( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
266 : void SAL_CALL setName( const OUString& aName ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
267 :
268 : // XMultiPropertyState
269 0 : uno::Sequence< beans::PropertyState > SAL_CALL getPropertyStates( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) SAL_OVERRIDE
270 : {
271 0 : return OStyle_PBASE::getPropertyStates(aPropertyNames);
272 : }
273 : void SAL_CALL setAllPropertiesToDefault( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
274 : void SAL_CALL setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
275 : uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
276 : };
277 :
278 0 : OStyle::OStyle()
279 : :OStyle_PBASE(m_aBHelper)
280 0 : ,m_aSize(21000,29700)
281 : {
282 0 : const ::Size aDefaultSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM );
283 0 : m_aSize.Height = aDefaultSize.Height();
284 0 : m_aSize.Width = aDefaultSize.Width();
285 :
286 0 : const style::GraphicLocation eGraphicLocation = style::GraphicLocation_NONE;
287 0 : const sal_Bool bFalse = sal_False;
288 0 : const sal_Bool bTrue = sal_True;
289 0 : const sal_Int32 nMargin = 2000;
290 : //const sal_Int32 nColor = COL_WHITE;
291 0 : const sal_Int32 nTransparent = COL_TRANSPARENT;
292 0 : const sal_Int32 nZero = 0;
293 0 : const sal_Int16 n16Zero = 0;
294 0 : const sal_Int16 nNummeringType = style::NumberingType::ARABIC;
295 0 : const OUString sName("Default");
296 0 : const OUString sEmpty;
297 0 : const table::BorderLine2 eBorderLine(0,0,0,0,0,0);
298 0 : const table::ShadowFormat eShadowFormat(table::ShadowLocation_NONE,0,0,0);
299 0 : const style::PageStyleLayout ePageStyleLayout = style::PageStyleLayout_ALL;
300 0 : const sal_Int32 nBound = beans::PropertyAttribute::BOUND;
301 0 : const sal_Int32 nMayBeVoid = beans::PropertyAttribute::MAYBEVOID;
302 :
303 0 : sal_Int32 i = 0;
304 0 : registerPropertyNoMember( PROPERTY_NAME, ++i,nBound,::getCppuType( static_cast< OUString *>(NULL) ), &sName );
305 :
306 0 : registerPropertyNoMember(PROPERTY_BACKCOLOR, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nTransparent);
307 :
308 0 : registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION, ++i,nBound,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation);
309 0 : registerPropertyNoMember(PROPERTY_BACKTRANSPARENT, ++i,nBound,::getBooleanCppuType() ,&bTrue);
310 0 : registerPropertyNoMember(SC_UNO_PAGE_BORDERDIST, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
311 0 : registerPropertyNoMember(SC_UNO_PAGE_BOTTBORDER, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
312 0 : registerPropertyNoMember(SC_UNO_PAGE_BOTTBRDDIST, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
313 0 : registerPropertyNoMember(PROPERTY_BOTTOMMARGIN, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nMargin);
314 0 : registerPropertyNoMember("DisplayName", ++i,nBound,::getCppuType((OUString*)0) ,&sEmpty);
315 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRBACKCOL, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nTransparent);
316 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRGRFFILT, ++i,nBound,::getCppuType((const OUString*)0) ,&sEmpty);
317 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRGRFLOC, ++i,nBound,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation);
318 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRGRFURL, ++i,nBound,::getCppuType((const OUString*)0) ,&sEmpty);
319 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRBACKTRAN, ++i,nBound,::getBooleanCppuType() ,&bTrue);
320 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRBODYDIST, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
321 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRBRDDIST, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
322 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBOR, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
323 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBDIS, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
324 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRHEIGHT, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
325 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRDYNAMIC, ++i,nBound,::getBooleanCppuType() ,&bFalse);
326 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRON, ++i,nBound,::getBooleanCppuType() ,&bFalse);
327 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRSHARED, ++i,nBound,::getBooleanCppuType() ,&bFalse);
328 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBOR, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
329 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBDIS, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
330 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTMAR, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
331 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBOR, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
332 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBDIS,++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
333 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTMAR, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
334 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRSHADOW, ++i,nBound,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat);
335 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBOR, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
336 0 : registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBDIS, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
337 :
338 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRBACKCOL, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nTransparent);
339 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRGRFFILT, ++i,nBound|nMayBeVoid,::getCppuType((const OUString*)0) ,&sEmpty);
340 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRGRFLOC, ++i,nBound|nMayBeVoid,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation);
341 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRGRFURL, ++i,nBound|nMayBeVoid,::getCppuType((const OUString*)0) ,&sEmpty);
342 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRBACKTRAN, ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bTrue);
343 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRBODYDIST, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
344 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRBRDDIST, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
345 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBOR, ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
346 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBDIS, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
347 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRHEIGHT, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
348 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRDYNAMIC, ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse);
349 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRON, ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse);
350 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRSHARED, ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse);
351 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBOR, ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
352 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBDIS, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
353 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTMAR, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
354 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBOR, ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
355 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBDIS,++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
356 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTMAR, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
357 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRSHADOW, ++i,nBound|nMayBeVoid,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat);
358 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBOR, ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
359 0 : registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBDIS, ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
360 :
361 0 : registerProperty(PROPERTY_HEIGHT, ++i,nBound,&m_aSize.Height, ::getCppuType((const sal_Int32*)0) );
362 0 : registerPropertyNoMember(PROPERTY_ISLANDSCAPE, ++i,nBound, ::getBooleanCppuType() ,&bFalse);
363 0 : registerPropertyNoMember(SC_UNO_PAGE_LEFTBORDER, ++i,nBound, ::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
364 0 : registerPropertyNoMember(SC_UNO_PAGE_LEFTBRDDIST, ++i,nBound, ::getCppuType((const sal_Int32*)0) ,&nZero);
365 0 : registerPropertyNoMember(PROPERTY_LEFTMARGIN, ++i,beans::PropertyAttribute::BOUND, ::getCppuType((const sal_Int32*)0) ,&nMargin);
366 0 : registerPropertyNoMember(PROPERTY_NUMBERINGTYPE, ++i,nBound,::getCppuType((const sal_Int16*)0) ,&nNummeringType);
367 0 : registerPropertyNoMember(SC_UNO_PAGE_SCALEVAL, ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
368 0 : registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT, ++i,nBound,::getCppuType((const style::PageStyleLayout*)0) ,&ePageStyleLayout);
369 0 : const OUString sPaperTray("[From printer settings]");
370 0 : registerPropertyNoMember(SC_UNO_PAGE_PAPERTRAY, ++i,nBound,::getCppuType((const OUString*)0) ,&sPaperTray);
371 0 : registerPropertyNoMember(SC_UNO_PAGE_RIGHTBORDER, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
372 0 : registerPropertyNoMember(SC_UNO_PAGE_RIGHTBRDDIST,++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
373 0 : registerPropertyNoMember(PROPERTY_RIGHTMARGIN, ++i,beans::PropertyAttribute::BOUND,::getCppuType((const sal_Int32*)0) ,&nMargin);
374 0 : registerPropertyNoMember(SC_UNO_PAGE_SCALETOPAG, ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
375 0 : registerPropertyNoMember(SC_UNO_PAGE_SCALETOX, ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
376 0 : registerPropertyNoMember(SC_UNO_PAGE_SCALETOY, ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
377 0 : registerPropertyNoMember(SC_UNO_PAGE_SHADOWFORM, ++i,nBound,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat);
378 0 : registerProperty(PROPERTY_PAPERSIZE, ++i,beans::PropertyAttribute::BOUND,&m_aSize,::getCppuType((const awt::Size*)0) );
379 0 : registerPropertyNoMember(SC_UNO_PAGE_TOPBORDER, ++i,nBound,::getCppuType((const table::BorderLine2*)0) ,&eBorderLine);
380 0 : registerPropertyNoMember(SC_UNO_PAGE_TOPBRDDIST, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
381 0 : registerPropertyNoMember(PROPERTY_TOPMARGIN, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nMargin);
382 0 : uno::Reference< container::XNameContainer> xAttribs = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast< xml::AttributeData* >(NULL)));
383 0 : registerPropertyNoMember("UserDefinedAttributes", ++i,nBound,::getCppuType((uno::Reference<container::XNameContainer>*)0) ,&xAttribs);
384 0 : registerProperty(PROPERTY_WIDTH, ++i,nBound,&m_aSize.Width,::getCppuType((const sal_Int32*)0) );
385 0 : registerPropertyNoMember("PrinterName", ++i,nBound,::getCppuType((const OUString*)0),&sEmpty);
386 0 : uno::Sequence<sal_Int8> aSe;
387 0 : registerPropertyNoMember("PrinterSetup", ++i,nBound,::getCppuType((const uno::Sequence<sal_Int8>*)0),&aSe);
388 :
389 :
390 0 : }
391 :
392 0 : IMPLEMENT_FORWARD_XINTERFACE2(OStyle,TStyleBASE,OStyle_PBASE)
393 :
394 0 : uno::Reference< beans::XPropertySetInfo> SAL_CALL OStyle::getPropertySetInfo() throw(uno::RuntimeException, std::exception)
395 : {
396 0 : return createPropertySetInfo( getInfoHelper() );
397 : }
398 :
399 0 : void OStyle::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, uno::Any& /*_rDefault*/ ) const
400 : {
401 0 : }
402 :
403 0 : ::cppu::IPropertyArrayHelper& OStyle::getInfoHelper()
404 : {
405 0 : return *const_cast<OStyle*>(this)->getArrayHelper();
406 : }
407 :
408 0 : ::cppu::IPropertyArrayHelper* OStyle::createArrayHelper( ) const
409 : {
410 0 : uno::Sequence< beans::Property > aProps;
411 0 : describeProperties(aProps);
412 0 : return new ::cppu::OPropertyArrayHelper(aProps);
413 : }
414 :
415 : // XStyle
416 0 : sal_Bool SAL_CALL OStyle::isUserDefined( ) throw (uno::RuntimeException, std::exception)
417 : {
418 0 : return sal_False;
419 : }
420 :
421 0 : sal_Bool SAL_CALL OStyle::isInUse( ) throw (uno::RuntimeException, std::exception)
422 : {
423 0 : return sal_True;
424 : }
425 :
426 0 : OUString SAL_CALL OStyle::getParentStyle( ) throw (uno::RuntimeException, std::exception)
427 : {
428 0 : return OUString();
429 : }
430 :
431 0 : void SAL_CALL OStyle::setParentStyle( const OUString& /*aParentStyle*/ ) throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
432 : {
433 0 : }
434 :
435 : // XNamed
436 0 : OUString SAL_CALL OStyle::getName( ) throw (uno::RuntimeException, std::exception)
437 : {
438 0 : OUString sName;
439 0 : getPropertyValue(PROPERTY_NAME) >>= sName;
440 0 : return sName;
441 : }
442 :
443 0 : void SAL_CALL OStyle::setName( const OUString& aName ) throw (uno::RuntimeException, std::exception)
444 : {
445 0 : setPropertyValue(PROPERTY_NAME,uno::makeAny(aName));
446 0 : }
447 :
448 0 : void SAL_CALL OStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException, std::exception)
449 : {
450 0 : }
451 :
452 0 : void SAL_CALL OStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
453 : {
454 0 : const OUString* pIter = aPropertyNames.getConstArray();
455 0 : const OUString* pEnd = pIter + aPropertyNames.getLength();
456 0 : for(;pIter != pEnd;++pIter)
457 0 : setPropertyToDefault(*pIter);
458 0 : }
459 :
460 0 : uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
461 : {
462 0 : uno::Sequence< uno::Any > aRet(aPropertyNames.getLength());
463 0 : const OUString* pIter = aPropertyNames.getConstArray();
464 0 : const OUString* pEnd = pIter + aPropertyNames.getLength();
465 0 : for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
466 0 : aRet[i] = getPropertyDefault(*pIter);
467 0 : return aRet;
468 : }
469 :
470 : namespace
471 : {
472 : class FactoryLoader : public ::osl::Thread
473 : {
474 : OUString m_sMimeType;
475 : uno::Reference< uno::XComponentContext > m_xContext;
476 : public:
477 0 : FactoryLoader(const OUString& _sMimeType,uno::Reference< uno::XComponentContext > const & _xContext)
478 : :m_sMimeType(_sMimeType)
479 0 : ,m_xContext(_xContext)
480 0 : {}
481 :
482 : protected:
483 0 : virtual ~FactoryLoader(){}
484 :
485 : /// Working method which should be overridden.
486 : virtual void SAL_CALL run() SAL_OVERRIDE;
487 : virtual void SAL_CALL onTerminated() SAL_OVERRIDE;
488 : };
489 :
490 0 : void SAL_CALL FactoryLoader::run()
491 : {
492 : try
493 : {
494 0 : uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(m_xContext);
495 0 : uno::Reference<frame::XComponentLoader> xFrameLoad(xDesktop,uno::UNO_QUERY);
496 0 : OUString sTarget("_blank");
497 0 : sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
498 0 : uno::Reference< frame::XFrame> xFrame = xDesktop->findFrame(sTarget,nFrameSearchFlag);
499 0 : xFrameLoad.set(xFrame,uno::UNO_QUERY);
500 :
501 0 : if ( xFrameLoad.is() )
502 : {
503 0 : uno::Sequence < beans::PropertyValue > aArgs( 3);
504 0 : sal_Int32 nLen = 0;
505 0 : aArgs[nLen].Name = "AsTemplate";
506 0 : aArgs[nLen++].Value <<= sal_False;
507 :
508 0 : aArgs[nLen].Name = "ReadOnly";
509 0 : aArgs[nLen++].Value <<= sal_True;
510 :
511 0 : aArgs[nLen].Name = "Hidden";
512 0 : aArgs[nLen++].Value <<= sal_True;
513 :
514 0 : ::comphelper::MimeConfigurationHelper aHelper(m_xContext);
515 0 : SvtModuleOptions aModuleOptions;
516 0 : uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL(
517 : aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(m_sMimeType) )),
518 : OUString(), // empty frame name
519 : 0,
520 : aArgs
521 0 : ),uno::UNO_QUERY);
522 0 : ::comphelper::disposeComponent(xModel);
523 0 : }
524 : }
525 0 : catch (const uno::Exception&)
526 : {
527 : DBG_UNHANDLED_EXCEPTION();
528 : }
529 0 : }
530 0 : void SAL_CALL FactoryLoader::onTerminated()
531 : {
532 0 : delete this;
533 0 : }
534 : }
535 :
536 : struct OReportDefinitionImpl
537 : {
538 : uno::WeakReference< uno::XInterface > m_xParent;
539 : ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners;
540 : ::cppu::OInterfaceContainerHelper m_aCloseListener;
541 : ::cppu::OInterfaceContainerHelper m_aModifyListeners;
542 : ::cppu::OInterfaceContainerHelper m_aDocEventListeners;
543 : ::std::vector< uno::Reference< frame::XController> > m_aControllers;
544 : uno::Sequence< beans::PropertyValue > m_aArgs;
545 :
546 : uno::Reference< report::XGroups > m_xGroups;
547 : uno::Reference< report::XSection> m_xReportHeader;
548 : uno::Reference< report::XSection> m_xReportFooter;
549 : uno::Reference< report::XSection> m_xPageHeader;
550 : uno::Reference< report::XSection> m_xPageFooter;
551 : uno::Reference< report::XSection> m_xDetail;
552 : uno::Reference< embed::XStorage > m_xStorage;
553 : uno::Reference< frame::XController > m_xCurrentController;
554 : uno::Reference< container::XIndexAccess > m_xViewData;
555 : uno::Reference< container::XNameAccess > m_xStyles;
556 : uno::Reference< container::XNameAccess> m_xXMLNamespaceMap;
557 : uno::Reference< container::XNameAccess> m_xGradientTable;
558 : uno::Reference< container::XNameAccess> m_xHatchTable;
559 : uno::Reference< container::XNameAccess> m_xBitmapTable;
560 : uno::Reference< container::XNameAccess> m_xTransparencyGradientTable;
561 : uno::Reference< container::XNameAccess> m_xDashTable;
562 : uno::Reference< container::XNameAccess> m_xMarkerTable;
563 : uno::Reference< report::XFunctions > m_xFunctions;
564 : uno::Reference< ui::XUIConfigurationManager2> m_xUIConfigurationManager;
565 : uno::Reference< util::XNumberFormatsSupplier> m_xNumberFormatsSupplier;
566 : uno::Reference< sdbc::XConnection> m_xActiveConnection;
567 : uno::Reference< frame::XTitle > m_xTitleHelper;
568 : uno::Reference< frame::XUntitledNumbers > m_xNumberedControllers;
569 : uno::Reference< document::XDocumentProperties > m_xDocumentProperties;
570 :
571 : ::boost::shared_ptr< ::comphelper::EmbeddedObjectContainer>
572 : m_pObjectContainer;
573 : ::boost::shared_ptr<rptui::OReportModel> m_pReportModel;
574 : ::rtl::Reference< ::dbaui::UndoManager > m_pUndoManager;
575 : OUString m_sCaption;
576 : OUString m_sCommand;
577 : OUString m_sFilter;
578 : OUString m_sMimeType;
579 : OUString m_sIdentifier;
580 : OUString m_sDataSourceName;
581 : awt::Size m_aVisualAreaSize;
582 : ::sal_Int64 m_nAspect;
583 : ::sal_Int16 m_nGroupKeepTogether;
584 : ::sal_Int16 m_nPageHeaderOption;
585 : ::sal_Int16 m_nPageFooterOption;
586 : ::sal_Int32 m_nCommandType;
587 : sal_Bool m_bControllersLocked;
588 : sal_Bool m_bModified;
589 : sal_Bool m_bEscapeProcessing;
590 : sal_Bool m_bSetModifiedEnabled;
591 :
592 0 : OReportDefinitionImpl(::osl::Mutex& _aMutex)
593 : :m_aStorageChangeListeners(_aMutex)
594 : ,m_aCloseListener(_aMutex)
595 : ,m_aModifyListeners(_aMutex)
596 : ,m_aDocEventListeners(_aMutex)
597 : ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT)
598 : ,m_sIdentifier(SERVICE_REPORTDEFINITION)
599 : // default visual area is 8 x 7 cm
600 : ,m_aVisualAreaSize( 8000, 7000 )
601 : ,m_nAspect(embed::Aspects::MSOLE_CONTENT)
602 : ,m_nGroupKeepTogether(0)
603 : ,m_nPageHeaderOption(0)
604 : ,m_nPageFooterOption(0)
605 : ,m_nCommandType(sdb::CommandType::TABLE)
606 : ,m_bControllersLocked(sal_False)
607 : ,m_bModified(sal_False)
608 : ,m_bEscapeProcessing(sal_True)
609 0 : ,m_bSetModifiedEnabled( sal_True )
610 0 : {}
611 :
612 0 : OReportDefinitionImpl(::osl::Mutex& _aMutex,const OReportDefinitionImpl& _aCopy)
613 : :m_aStorageChangeListeners(_aMutex)
614 : ,m_aCloseListener(_aMutex)
615 : ,m_aModifyListeners(_aMutex)
616 : ,m_aDocEventListeners(_aMutex)
617 : ,m_sMimeType(_aCopy.m_sMimeType)
618 : ,m_sIdentifier(_aCopy.m_sIdentifier)
619 : ,m_aVisualAreaSize(_aCopy.m_aVisualAreaSize)
620 : ,m_nAspect(_aCopy.m_nAspect)
621 : ,m_nGroupKeepTogether(_aCopy.m_nGroupKeepTogether)
622 : ,m_nPageHeaderOption(_aCopy.m_nPageHeaderOption)
623 : ,m_nPageFooterOption(_aCopy.m_nPageFooterOption)
624 : ,m_nCommandType(_aCopy.m_nCommandType)
625 : ,m_bControllersLocked(_aCopy.m_bControllersLocked)
626 : ,m_bModified(_aCopy.m_bModified)
627 : ,m_bEscapeProcessing(_aCopy.m_bEscapeProcessing)
628 0 : ,m_bSetModifiedEnabled(_aCopy.m_bSetModifiedEnabled)
629 0 : {}
630 : ~OReportDefinitionImpl();
631 : };
632 :
633 0 : OReportDefinitionImpl::~OReportDefinitionImpl()
634 : {
635 0 : }
636 :
637 0 : OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext)
638 : : ReportDefinitionBase(m_aMutex)
639 : ,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >())
640 0 : ,m_aProps(new OReportComponentProperties(_xContext))
641 0 : ,m_pImpl(new OReportDefinitionImpl(m_aMutex))
642 : {
643 0 : m_aProps->m_sName = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager());
644 0 : osl_atomic_increment(&m_refCount);
645 : {
646 0 : init();
647 0 : m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
648 0 : m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
649 0 : m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
650 : }
651 0 : osl_atomic_decrement( &m_refCount );
652 0 : }
653 :
654 0 : OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext
655 : ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
656 : ,uno::Reference< drawing::XShape >& _xShape)
657 : : ReportDefinitionBase(m_aMutex)
658 : ,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >())
659 0 : ,m_aProps(new OReportComponentProperties(_xContext))
660 0 : ,m_pImpl(new OReportDefinitionImpl(m_aMutex))
661 : {
662 0 : m_aProps->m_sName = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager());
663 0 : m_aProps->m_xFactory = _xFactory;
664 0 : osl_atomic_increment(&m_refCount);
665 : {
666 0 : m_aProps->setShape(_xShape,this,m_refCount);
667 0 : init();
668 0 : m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
669 0 : m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
670 0 : m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
671 : }
672 0 : osl_atomic_decrement( &m_refCount );
673 0 : }
674 :
675 0 : OReportDefinition::OReportDefinition(const OReportDefinition& _rCopy)
676 : : cppu::BaseMutex()
677 : ,ReportDefinitionBase(m_aMutex)
678 0 : ,ReportDefinitionPropertySet(_rCopy.m_aProps->m_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >())
679 : ,comphelper::IEmbeddedHelper()
680 0 : ,m_aProps(new OReportComponentProperties(*_rCopy.m_aProps))
681 0 : ,m_pImpl(new OReportDefinitionImpl(m_aMutex,*_rCopy.m_pImpl))
682 : {
683 0 : osl_atomic_increment(&m_refCount);
684 : {
685 0 : init();
686 0 : OGroups* pGroups = new OGroups(this,m_aProps->m_xContext);
687 0 : m_pImpl->m_xGroups = pGroups;
688 0 : pGroups->copyGroups(_rCopy.m_pImpl->m_xGroups);
689 0 : m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
690 0 : OSection::lcl_copySection(_rCopy.m_pImpl->m_xDetail,m_pImpl->m_xDetail);
691 :
692 0 : setPageHeaderOn(_rCopy.m_pImpl->m_xPageHeader.is());
693 0 : setPageFooterOn(_rCopy.m_pImpl->m_xPageFooter.is());
694 0 : setReportHeaderOn(_rCopy.m_pImpl->m_xReportHeader.is());
695 0 : setReportFooterOn(_rCopy.m_pImpl->m_xReportFooter.is());
696 0 : OSection::lcl_copySection(_rCopy.m_pImpl->m_xPageHeader,m_pImpl->m_xPageHeader);
697 0 : OSection::lcl_copySection(_rCopy.m_pImpl->m_xPageFooter,m_pImpl->m_xPageFooter);
698 0 : OSection::lcl_copySection(_rCopy.m_pImpl->m_xReportHeader,m_pImpl->m_xReportHeader);
699 0 : OSection::lcl_copySection(_rCopy.m_pImpl->m_xReportFooter,m_pImpl->m_xReportFooter);
700 : }
701 0 : osl_atomic_decrement( &m_refCount );
702 0 : }
703 :
704 0 : OReportDefinition::~OReportDefinition()
705 : {
706 0 : if ( !ReportDefinitionBase::rBHelper.bInDispose && !ReportDefinitionBase::rBHelper.bDisposed )
707 : {
708 0 : acquire();
709 0 : dispose();
710 : }
711 0 : }
712 :
713 0 : IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition, ReportDefinitionBase )
714 0 : void OReportDefinition::init()
715 : {
716 : try
717 : {
718 : static bool s_bFirstTime = true;
719 0 : if ( s_bFirstTime )
720 : {
721 0 : s_bFirstTime = false;
722 0 : const uno::Sequence< OUString > aMimeTypes = getAvailableMimeTypes();
723 0 : const OUString* pIter = aMimeTypes.getConstArray();
724 0 : const OUString* pEnd = pIter + aMimeTypes.getLength();
725 0 : for ( ; pIter != pEnd; ++pIter )
726 : {
727 0 : FactoryLoader* pCreatorThread = new FactoryLoader(*pIter,m_aProps->m_xContext);
728 0 : pCreatorThread->createSuspended();
729 0 : pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal);
730 0 : pCreatorThread->resume();
731 0 : }
732 : }
733 :
734 0 : m_pImpl->m_pReportModel.reset(new OReportModel(this));
735 0 : m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges();
736 0 : m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM );
737 0 : SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin();
738 0 : rAdmin.NewStandardLayer(RPT_LAYER_FRONT);
739 0 : rAdmin.NewLayer(OUString("back"), RPT_LAYER_BACK);
740 0 : rAdmin.NewLayer(OUString("HiddenLayer"), RPT_LAYER_HIDDEN);
741 :
742 0 : m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex );
743 0 : m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() );
744 :
745 0 : m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext);
746 0 : if ( !m_pImpl->m_xStorage.is() )
747 0 : m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
748 :
749 0 : uno::Reference<beans::XPropertySet> xStorProps(m_pImpl->m_xStorage,uno::UNO_QUERY);
750 0 : if ( xStorProps.is())
751 : {
752 0 : OUString sMediaType;
753 0 : xStorProps->getPropertyValue("MediaType") >>= sMediaType;
754 0 : if ( sMediaType.isEmpty() )
755 0 : xStorProps->setPropertyValue("MediaType",uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT));
756 : }
757 0 : m_pImpl->m_pObjectContainer.reset( new comphelper::EmbeddedObjectContainer(m_pImpl->m_xStorage , static_cast<cppu::OWeakObject*>(this) ) );
758 : }
759 0 : catch (const uno::Exception&)
760 : {
761 : DBG_UNHANDLED_EXCEPTION();
762 : }
763 0 : }
764 :
765 0 : void SAL_CALL OReportDefinition::dispose() throw(uno::RuntimeException, std::exception)
766 : {
767 0 : ReportDefinitionPropertySet::dispose();
768 0 : cppu::WeakComponentImplHelperBase::dispose();
769 0 : }
770 :
771 0 : void SAL_CALL OReportDefinition::disposing()
772 : {
773 0 : notifyEvent(OUString("OnUnload"));
774 :
775 0 : uno::Reference< frame::XModel > xHoldAlive( this );
776 :
777 0 : lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
778 0 : m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent );
779 0 : m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent );
780 0 : m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent );
781 0 : m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent );
782 :
783 : // SYNCHRONIZED --->
784 0 : SolarMutexGuard aSolarGuard;
785 0 : ::osl::ResettableMutexGuard aGuard(m_aMutex);
786 :
787 0 : m_pImpl->m_aControllers.clear();
788 :
789 0 : ::comphelper::disposeComponent(m_pImpl->m_xGroups);
790 0 : m_pImpl->m_xReportHeader.clear();
791 0 : m_pImpl->m_xReportFooter.clear();
792 0 : m_pImpl->m_xPageHeader.clear();
793 0 : m_pImpl->m_xPageFooter.clear();
794 0 : m_pImpl->m_xDetail.clear();
795 0 : ::comphelper::disposeComponent(m_pImpl->m_xFunctions);
796 :
797 : //::comphelper::disposeComponent(m_pImpl->m_xStorage);
798 : // don't dispose, this currently is the task of either the ref count going to
799 : // 0, or of the embedded object (if we're embedded, which is the only possible
800 : // case so far)
801 : // #i78366#
802 0 : m_pImpl->m_xStorage.clear();
803 0 : m_pImpl->m_xViewData.clear();
804 0 : m_pImpl->m_xCurrentController.clear();
805 0 : m_pImpl->m_xNumberFormatsSupplier.clear();
806 0 : m_pImpl->m_xStyles.clear();
807 0 : m_pImpl->m_xXMLNamespaceMap.clear();
808 0 : m_pImpl->m_xGradientTable.clear();
809 0 : m_pImpl->m_xHatchTable.clear();
810 0 : m_pImpl->m_xBitmapTable.clear();
811 0 : m_pImpl->m_xTransparencyGradientTable.clear();
812 0 : m_pImpl->m_xDashTable.clear();
813 0 : m_pImpl->m_xMarkerTable.clear();
814 0 : m_pImpl->m_xUIConfigurationManager.clear();
815 0 : m_pImpl->m_pReportModel.reset();
816 0 : m_pImpl->m_pObjectContainer.reset();
817 0 : m_pImpl->m_aArgs.realloc(0);
818 0 : m_pImpl->m_xTitleHelper.clear();
819 0 : m_pImpl->m_xNumberedControllers.clear();
820 : // <--- SYNCHRONIZED
821 0 : }
822 :
823 :
824 0 : OUString OReportDefinition::getImplementationName_Static( ) throw(uno::RuntimeException)
825 : {
826 0 : return OUString("com.sun.star.comp.report.OReportDefinition");
827 : }
828 :
829 0 : OUString SAL_CALL OReportDefinition::getImplementationName( ) throw(uno::RuntimeException, std::exception)
830 : {
831 0 : return getImplementationName_Static();
832 : }
833 :
834 0 : uno::Sequence< OUString > OReportDefinition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException)
835 : {
836 0 : uno::Sequence< OUString > aServices(1);
837 0 : aServices.getArray()[0] = SERVICE_REPORTDEFINITION;
838 :
839 0 : return aServices;
840 : }
841 :
842 0 : uno::Sequence< OUString > SAL_CALL OReportDefinition::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception)
843 : {
844 : // first collect the services which are supported by our aggregate
845 0 : uno::Sequence< OUString > aSupported;
846 0 : if ( m_aProps->m_xServiceInfo.is() )
847 0 : aSupported = m_aProps->m_xServiceInfo->getSupportedServiceNames();
848 :
849 : // append our own service, if necessary
850 0 : if ( 0 == ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION, true ).getLength() )
851 : {
852 0 : sal_Int32 nLen = aSupported.getLength();
853 0 : aSupported.realloc( nLen + 1 );
854 0 : aSupported[ nLen ] = SERVICE_REPORTDEFINITION;
855 : }
856 :
857 : // outta here
858 0 : return aSupported;
859 : }
860 :
861 0 : sal_Bool SAL_CALL OReportDefinition::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
862 : {
863 0 : return cppu::supportsService(this, _rServiceName);
864 : }
865 :
866 0 : uno::Any SAL_CALL OReportDefinition::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException, std::exception)
867 : {
868 0 : uno::Any aReturn = ReportDefinitionBase::queryInterface(_rType);
869 0 : if ( !aReturn.hasValue() )
870 0 : aReturn = ReportDefinitionPropertySet::queryInterface(_rType);
871 :
872 0 : return aReturn.hasValue() ? aReturn : (m_aProps->m_xProxy.is() ? m_aProps->m_xProxy->queryAggregation(_rType) : aReturn);
873 : }
874 0 : uno::Sequence< uno::Type > SAL_CALL OReportDefinition::getTypes( ) throw (uno::RuntimeException, std::exception)
875 : {
876 0 : if ( m_aProps->m_xTypeProvider.is() )
877 : return ::comphelper::concatSequences(
878 : ReportDefinitionBase::getTypes(),
879 0 : m_aProps->m_xTypeProvider->getTypes()
880 0 : );
881 0 : return ReportDefinitionBase::getTypes();
882 : }
883 :
884 0 : uno::Reference< uno::XInterface > OReportDefinition::create(uno::Reference< uno::XComponentContext > const & xContext)
885 : {
886 0 : return *(new OReportDefinition(xContext));
887 : }
888 :
889 : // XReportDefinition
890 0 : OUString SAL_CALL OReportDefinition::getCaption() throw (uno::RuntimeException, std::exception)
891 : {
892 0 : ::osl::MutexGuard aGuard(m_aMutex);
893 0 : return m_pImpl->m_sCaption;
894 : }
895 :
896 0 : void SAL_CALL OReportDefinition::setCaption( const OUString& _caption ) throw (uno::RuntimeException, std::exception)
897 : {
898 0 : set(PROPERTY_CAPTION,_caption,m_pImpl->m_sCaption);
899 0 : }
900 :
901 0 : ::sal_Int16 SAL_CALL OReportDefinition::getGroupKeepTogether() throw (uno::RuntimeException, std::exception)
902 : {
903 0 : ::osl::MutexGuard aGuard(m_aMutex);
904 0 : return m_pImpl->m_nGroupKeepTogether;
905 : }
906 :
907 0 : void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether ) throw (uno::RuntimeException, std::exception)
908 : {
909 0 : if ( _groupkeeptogether < report::GroupKeepTogether::PER_PAGE || _groupkeeptogether > report::GroupKeepTogether::PER_COLUMN )
910 : throwIllegallArgumentException("com::sun::star::report::GroupKeepTogether"
911 : ,*this
912 : ,1
913 0 : ,m_aProps->m_xContext);
914 0 : set(PROPERTY_GROUPKEEPTOGETHER,_groupkeeptogether,m_pImpl->m_nGroupKeepTogether);
915 0 : }
916 :
917 0 : ::sal_Int16 SAL_CALL OReportDefinition::getPageHeaderOption() throw (uno::RuntimeException, std::exception)
918 : {
919 0 : ::osl::MutexGuard aGuard(m_aMutex);
920 0 : return m_pImpl->m_nPageHeaderOption;
921 : }
922 :
923 0 : void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption ) throw (uno::RuntimeException, std::exception)
924 : {
925 0 : if ( _pageheaderoption < report::ReportPrintOption::ALL_PAGES || _pageheaderoption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
926 : throwIllegallArgumentException("com::sun::star::report::ReportPrintOption"
927 : ,*this
928 : ,1
929 0 : ,m_aProps->m_xContext);
930 0 : set(PROPERTY_PAGEHEADEROPTION,_pageheaderoption,m_pImpl->m_nPageHeaderOption);
931 0 : }
932 :
933 0 : ::sal_Int16 SAL_CALL OReportDefinition::getPageFooterOption() throw (uno::RuntimeException, std::exception)
934 : {
935 0 : ::osl::MutexGuard aGuard(m_aMutex);
936 0 : return m_pImpl->m_nPageFooterOption;
937 : }
938 :
939 0 : void SAL_CALL OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption ) throw (uno::RuntimeException, std::exception)
940 : {
941 0 : if ( _pagefooteroption < report::ReportPrintOption::ALL_PAGES || _pagefooteroption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
942 : throwIllegallArgumentException("com::sun::star::report::ReportPrintOption"
943 : ,*this
944 : ,1
945 0 : ,m_aProps->m_xContext);
946 0 : set(PROPERTY_PAGEFOOTEROPTION,_pagefooteroption,m_pImpl->m_nPageFooterOption);
947 0 : }
948 :
949 0 : OUString SAL_CALL OReportDefinition::getCommand() throw (uno::RuntimeException, std::exception)
950 : {
951 0 : ::osl::MutexGuard aGuard(m_aMutex);
952 0 : return m_pImpl->m_sCommand;
953 : }
954 :
955 0 : void SAL_CALL OReportDefinition::setCommand( const OUString& _command ) throw (uno::RuntimeException, std::exception)
956 : {
957 0 : set(PROPERTY_COMMAND,_command,m_pImpl->m_sCommand);
958 0 : }
959 :
960 0 : ::sal_Int32 SAL_CALL OReportDefinition::getCommandType() throw (uno::RuntimeException, std::exception)
961 : {
962 0 : ::osl::MutexGuard aGuard(m_aMutex);
963 0 : return m_pImpl->m_nCommandType;
964 : }
965 :
966 0 : void SAL_CALL OReportDefinition::setCommandType( ::sal_Int32 _commandtype ) throw (uno::RuntimeException, std::exception)
967 : {
968 0 : if ( _commandtype < sdb::CommandType::TABLE || _commandtype > sdb::CommandType::COMMAND )
969 : throwIllegallArgumentException("com::sun::star::sdb::CommandType"
970 : ,*this
971 : ,1
972 0 : ,m_aProps->m_xContext);
973 0 : set(PROPERTY_COMMANDTYPE,_commandtype,m_pImpl->m_nCommandType);
974 0 : }
975 :
976 0 : OUString SAL_CALL OReportDefinition::getFilter() throw (uno::RuntimeException, std::exception)
977 : {
978 0 : ::osl::MutexGuard aGuard(m_aMutex);
979 0 : return m_pImpl->m_sFilter;
980 : }
981 :
982 0 : void SAL_CALL OReportDefinition::setFilter( const OUString& _filter ) throw (uno::RuntimeException, std::exception)
983 : {
984 0 : set(PROPERTY_FILTER,_filter,m_pImpl->m_sFilter);
985 0 : }
986 :
987 0 : sal_Bool SAL_CALL OReportDefinition::getEscapeProcessing() throw (uno::RuntimeException, std::exception)
988 : {
989 0 : ::osl::MutexGuard aGuard(m_aMutex);
990 0 : return m_pImpl->m_bEscapeProcessing;
991 : }
992 :
993 0 : void SAL_CALL OReportDefinition::setEscapeProcessing( sal_Bool _escapeprocessing ) throw (uno::RuntimeException, std::exception)
994 : {
995 0 : set(PROPERTY_ESCAPEPROCESSING,_escapeprocessing,m_pImpl->m_bEscapeProcessing);
996 0 : }
997 :
998 0 : sal_Bool SAL_CALL OReportDefinition::getReportHeaderOn() throw (uno::RuntimeException, std::exception)
999 : {
1000 0 : ::osl::MutexGuard aGuard(m_aMutex);
1001 0 : return m_pImpl->m_xReportHeader.is();
1002 : }
1003 :
1004 0 : void SAL_CALL OReportDefinition::setReportHeaderOn( sal_Bool _reportheaderon ) throw (uno::RuntimeException, std::exception)
1005 : {
1006 0 : if ( bool(_reportheaderon) != m_pImpl->m_xReportHeader.is() )
1007 : {
1008 0 : setSection(PROPERTY_REPORTHEADERON,_reportheaderon,RPT_RESSTRING(RID_STR_REPORT_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportHeader);
1009 : }
1010 0 : }
1011 :
1012 0 : sal_Bool SAL_CALL OReportDefinition::getReportFooterOn() throw (uno::RuntimeException, std::exception)
1013 : {
1014 0 : ::osl::MutexGuard aGuard(m_aMutex);
1015 0 : return m_pImpl->m_xReportFooter.is();
1016 : }
1017 :
1018 0 : void SAL_CALL OReportDefinition::setReportFooterOn( sal_Bool _reportfooteron ) throw (uno::RuntimeException, std::exception)
1019 : {
1020 0 : if ( bool(_reportfooteron) != m_pImpl->m_xReportFooter.is() )
1021 : {
1022 0 : setSection(PROPERTY_REPORTFOOTERON,_reportfooteron,RPT_RESSTRING(RID_STR_REPORT_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportFooter);
1023 : }
1024 0 : }
1025 :
1026 0 : sal_Bool SAL_CALL OReportDefinition::getPageHeaderOn() throw (uno::RuntimeException, std::exception)
1027 : {
1028 0 : ::osl::MutexGuard aGuard(m_aMutex);
1029 0 : return m_pImpl->m_xPageHeader.is();
1030 : }
1031 :
1032 0 : void SAL_CALL OReportDefinition::setPageHeaderOn( sal_Bool _pageheaderon ) throw (uno::RuntimeException, std::exception)
1033 : {
1034 0 : if ( bool(_pageheaderon) != m_pImpl->m_xPageHeader.is() )
1035 : {
1036 0 : setSection(PROPERTY_PAGEHEADERON,_pageheaderon,RPT_RESSTRING(RID_STR_PAGE_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageHeader);
1037 : }
1038 0 : }
1039 :
1040 0 : sal_Bool SAL_CALL OReportDefinition::getPageFooterOn() throw (uno::RuntimeException, std::exception)
1041 : {
1042 0 : ::osl::MutexGuard aGuard(m_aMutex);
1043 0 : return m_pImpl->m_xPageFooter.is();
1044 : }
1045 :
1046 0 : void SAL_CALL OReportDefinition::setPageFooterOn( sal_Bool _pagefooteron ) throw (uno::RuntimeException, std::exception)
1047 : {
1048 0 : if ( bool(_pagefooteron) != m_pImpl->m_xPageFooter.is() )
1049 : {
1050 0 : setSection(PROPERTY_PAGEFOOTERON,_pagefooteron,RPT_RESSTRING(RID_STR_PAGE_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageFooter);
1051 : }
1052 0 : }
1053 :
1054 0 : uno::Reference< report::XGroups > SAL_CALL OReportDefinition::getGroups() throw (uno::RuntimeException, std::exception)
1055 : {
1056 0 : ::osl::MutexGuard aGuard(m_aMutex);
1057 0 : return m_pImpl->m_xGroups;
1058 : }
1059 :
1060 0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportHeader() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
1061 : {
1062 0 : ::osl::MutexGuard aGuard(m_aMutex);
1063 0 : if ( !m_pImpl->m_xReportHeader.is() )
1064 0 : throw container::NoSuchElementException();
1065 0 : return m_pImpl->m_xReportHeader;
1066 : }
1067 :
1068 0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageHeader() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
1069 : {
1070 0 : ::osl::MutexGuard aGuard(m_aMutex);
1071 0 : if ( !m_pImpl->m_xPageHeader.is() )
1072 0 : throw container::NoSuchElementException();
1073 0 : return m_pImpl->m_xPageHeader;
1074 : }
1075 :
1076 0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getDetail() throw (uno::RuntimeException, std::exception)
1077 : {
1078 0 : ::osl::MutexGuard aGuard(m_aMutex);
1079 0 : return m_pImpl->m_xDetail;
1080 : }
1081 :
1082 0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageFooter() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
1083 : {
1084 0 : ::osl::MutexGuard aGuard(m_aMutex);
1085 0 : if ( !m_pImpl->m_xPageFooter.is() )
1086 0 : throw container::NoSuchElementException();
1087 0 : return m_pImpl->m_xPageFooter;
1088 : }
1089 :
1090 0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportFooter() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
1091 : {
1092 0 : ::osl::MutexGuard aGuard(m_aMutex);
1093 0 : if ( !m_pImpl->m_xReportFooter.is() )
1094 0 : throw container::NoSuchElementException();
1095 0 : return m_pImpl->m_xReportFooter;
1096 : }
1097 :
1098 0 : uno::Reference< document::XEventBroadcaster > SAL_CALL OReportDefinition::getEventBroadcaster( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException, std::exception)
1099 : {
1100 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1101 0 : return this;
1102 : }
1103 :
1104 : // XReportComponent
1105 0 : REPORTCOMPONENT_MASTERDETAIL(OReportDefinition,*m_aProps)
1106 0 : REPORTCOMPONENT_IMPL(OReportDefinition,*m_aProps)
1107 0 : REPORTCOMPONENT_IMPL2(OReportDefinition,*m_aProps)
1108 :
1109 0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OReportDefinition::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
1110 : {
1111 0 : return ReportDefinitionPropertySet::getPropertySetInfo();
1112 : }
1113 :
1114 0 : void SAL_CALL OReportDefinition::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1115 : {
1116 0 : ReportDefinitionPropertySet::setPropertyValue( aPropertyName, aValue );
1117 0 : }
1118 :
1119 0 : uno::Any SAL_CALL OReportDefinition::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1120 : {
1121 0 : return ReportDefinitionPropertySet::getPropertyValue( PropertyName);
1122 : }
1123 :
1124 0 : void SAL_CALL OReportDefinition::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1125 : {
1126 0 : ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
1127 0 : }
1128 :
1129 0 : void SAL_CALL OReportDefinition::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1130 : {
1131 0 : ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
1132 0 : }
1133 :
1134 0 : void SAL_CALL OReportDefinition::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1135 : {
1136 0 : ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName, aListener );
1137 0 : }
1138 :
1139 0 : void SAL_CALL OReportDefinition::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1140 : {
1141 0 : ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
1142 0 : }
1143 :
1144 : // XChild
1145 0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getParent( ) throw (uno::RuntimeException, std::exception)
1146 : {
1147 0 : ::osl::MutexGuard aGuard(m_aMutex);
1148 0 : uno::Reference< container::XChild > xChild;
1149 0 : comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
1150 0 : if ( xChild.is() )
1151 0 : return xChild->getParent();
1152 0 : return m_pImpl->m_xParent;
1153 : }
1154 :
1155 0 : void SAL_CALL OReportDefinition::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
1156 : {
1157 0 : ::osl::MutexGuard aGuard(m_aMutex);
1158 0 : m_aProps->m_xParent = uno::Reference< container::XChild >(Parent,uno::UNO_QUERY);
1159 0 : m_pImpl->m_xParent = Parent;
1160 0 : uno::Reference< container::XChild > xChild;
1161 0 : comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
1162 0 : if ( xChild.is() )
1163 0 : xChild->setParent(Parent);
1164 0 : }
1165 :
1166 : // XCloneable
1167 0 : uno::Reference< util::XCloneable > SAL_CALL OReportDefinition::createClone( ) throw (uno::RuntimeException, std::exception)
1168 : {
1169 : OSL_FAIL("Not yet implemented correctly");
1170 0 : uno::Reference< report::XReportComponent> xSource = this;
1171 0 : uno::Reference< report::XReportDefinition> xSet(cloneObject(xSource,m_aProps->m_xFactory,SERVICE_REPORTDEFINITION),uno::UNO_QUERY_THROW);
1172 0 : return xSet.get();
1173 : }
1174 :
1175 0 : void OReportDefinition::setSection( const OUString& _sProperty
1176 : ,const sal_Bool& _bOn
1177 : ,const OUString& _sName
1178 : ,uno::Reference< report::XSection>& _member)
1179 : {
1180 0 : BoundListeners l;
1181 : {
1182 0 : ::osl::MutexGuard aGuard(m_aMutex);
1183 0 : prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l);
1184 0 : lcl_createSectionIfNeeded(_bOn ,this,_member,_sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON);
1185 0 : if ( _member.is() )
1186 0 : _member->setName(_sName);
1187 : }
1188 0 : l.notify();
1189 0 : }
1190 :
1191 : // XCloseBroadcaster
1192 0 : void SAL_CALL OReportDefinition::addCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1193 : {
1194 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1195 0 : if ( _xListener.is() )
1196 0 : m_pImpl->m_aCloseListener.addInterface(_xListener);
1197 0 : }
1198 :
1199 0 : void SAL_CALL OReportDefinition::removeCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1200 : {
1201 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1202 0 : m_pImpl->m_aCloseListener.removeInterface(_xListener);
1203 0 : }
1204 :
1205 : // XCloseable
1206 0 : void SAL_CALL OReportDefinition::close( sal_Bool _bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException, std::exception)
1207 : {
1208 0 : SolarMutexGuard aSolarGuard;
1209 :
1210 0 : ::osl::ResettableMutexGuard aGuard(m_aMutex);
1211 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1212 : // notify our container listeners
1213 0 : lang::EventObject aEvt( static_cast< ::cppu::OWeakObject* >( this ) );
1214 0 : aGuard.clear();
1215 0 : m_pImpl->m_aCloseListener.forEach<util::XCloseListener>(
1216 0 : ::boost::bind(&util::XCloseListener::queryClosing,_1,boost::cref(aEvt),boost::cref(_bDeliverOwnership)));
1217 0 : aGuard.reset();
1218 :
1219 :
1220 0 : ::std::vector< uno::Reference< frame::XController> > aCopy = m_pImpl->m_aControllers;
1221 0 : ::std::vector< uno::Reference< frame::XController> >::iterator aIter = aCopy.begin();
1222 0 : ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = aCopy.end();
1223 0 : for (;aIter != aEnd ; ++aIter)
1224 : {
1225 0 : if ( aIter->is() )
1226 : {
1227 : try
1228 : {
1229 0 : uno::Reference< util::XCloseable> xFrame( (*aIter)->getFrame(), uno::UNO_QUERY );
1230 0 : if ( xFrame.is() )
1231 0 : xFrame->close( _bDeliverOwnership );
1232 : }
1233 0 : catch (const util::CloseVetoException&) { throw; }
1234 0 : catch (const uno::Exception&)
1235 : {
1236 : OSL_FAIL( "ODatabaseDocument::impl_closeControllerFrames: caught an unexpected exception!" );
1237 : }
1238 : }
1239 : }
1240 :
1241 0 : aGuard.clear();
1242 0 : m_pImpl->m_aCloseListener.notifyEach(&util::XCloseListener::notifyClosing,aEvt);
1243 0 : aGuard.reset();
1244 :
1245 0 : dispose();
1246 0 : }
1247 :
1248 : // XModel
1249 0 : sal_Bool SAL_CALL OReportDefinition::attachResource( const OUString& /*_rURL*/, const uno::Sequence< beans::PropertyValue >& _aArguments ) throw (uno::RuntimeException, std::exception)
1250 : {
1251 : // LLA: we had a deadlock problem in our context, so we get the SolarMutex earlier.
1252 0 : SolarMutexGuard aSolarGuard;
1253 :
1254 0 : ::osl::MutexGuard aGuard(m_aMutex);
1255 0 : ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1256 0 : utl::MediaDescriptor aDescriptor( _aArguments );
1257 :
1258 0 : m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false );
1259 : try
1260 : {
1261 0 : fillArgs(aDescriptor);
1262 0 : m_pImpl->m_pReportModel->SetModified(sal_False);
1263 : }
1264 0 : catch (...)
1265 : {
1266 0 : m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
1267 0 : throw;
1268 : }
1269 0 : m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
1270 0 : return sal_True;
1271 : }
1272 :
1273 0 : void OReportDefinition::fillArgs(utl::MediaDescriptor& _aDescriptor)
1274 : {
1275 0 : uno::Sequence<beans::PropertyValue> aComponentData;
1276 0 : aComponentData = _aDescriptor.getUnpackedValueOrDefault("ComponentData",aComponentData);
1277 0 : if ( aComponentData.getLength() && (!m_pImpl->m_xActiveConnection.is() || !m_pImpl->m_xNumberFormatsSupplier.is()) )
1278 : {
1279 0 : ::comphelper::SequenceAsHashMap aComponentDataMap( aComponentData );
1280 0 : m_pImpl->m_xActiveConnection = aComponentDataMap.getUnpackedValueOrDefault("ActiveConnection",m_pImpl->m_xActiveConnection);
1281 0 : m_pImpl->m_xNumberFormatsSupplier = dbtools::getNumberFormats(m_pImpl->m_xActiveConnection);
1282 : }
1283 0 : if ( !m_pImpl->m_xNumberFormatsSupplier.is() )
1284 : {
1285 0 : m_pImpl->m_xNumberFormatsSupplier.set( util::NumberFormatsSupplier::createWithDefaultLocale( m_aProps->m_xContext ) );
1286 : }
1287 0 : lcl_stripLoadArguments( _aDescriptor, m_pImpl->m_aArgs );
1288 0 : OUString sCaption;
1289 0 : sCaption = _aDescriptor.getUnpackedValueOrDefault("DocumentTitle",sCaption);
1290 0 : setCaption(sCaption);
1291 0 : }
1292 :
1293 0 : OUString SAL_CALL OReportDefinition::getURL( ) throw (uno::RuntimeException, std::exception)
1294 : {
1295 0 : return OUString();
1296 : }
1297 :
1298 0 : uno::Sequence< beans::PropertyValue > SAL_CALL OReportDefinition::getArgs( ) throw (uno::RuntimeException, std::exception)
1299 : {
1300 0 : ::osl::MutexGuard aGuard(m_aMutex);
1301 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1302 0 : return m_pImpl->m_aArgs;
1303 : }
1304 :
1305 0 : void SAL_CALL OReportDefinition::connectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException, std::exception)
1306 : {
1307 0 : ::osl::MutexGuard aGuard(m_aMutex);
1308 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1309 0 : m_pImpl->m_aControllers.push_back(_xController);
1310 : sal_Int32 nCount;
1311 0 : if ( _xController.is() && m_pImpl->m_xViewData.is() && ( nCount = m_pImpl->m_xViewData->getCount()) != 0)
1312 : {
1313 0 : _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1));
1314 0 : }
1315 0 : }
1316 :
1317 0 : void SAL_CALL OReportDefinition::disconnectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException, std::exception)
1318 : {
1319 0 : ::osl::MutexGuard aGuard(m_aMutex);
1320 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1321 0 : ::std::vector< uno::Reference< frame::XController> >::iterator aFind = ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController);
1322 0 : if ( aFind != m_pImpl->m_aControllers.end() )
1323 0 : m_pImpl->m_aControllers.erase(aFind);
1324 0 : if ( m_pImpl->m_xCurrentController == _xController )
1325 0 : m_pImpl->m_xCurrentController.clear();
1326 0 : }
1327 :
1328 0 : void SAL_CALL OReportDefinition::lockControllers( ) throw (uno::RuntimeException, std::exception)
1329 : {
1330 0 : ::osl::MutexGuard aGuard(m_aMutex);
1331 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1332 0 : m_pImpl->m_bControllersLocked = sal_True;
1333 0 : }
1334 :
1335 0 : void SAL_CALL OReportDefinition::unlockControllers( ) throw (uno::RuntimeException, std::exception)
1336 : {
1337 0 : ::osl::MutexGuard aGuard(m_aMutex);
1338 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1339 0 : m_pImpl->m_bControllersLocked = sal_False;
1340 0 : }
1341 :
1342 0 : sal_Bool SAL_CALL OReportDefinition::hasControllersLocked( ) throw (uno::RuntimeException, std::exception)
1343 : {
1344 0 : ::osl::MutexGuard aGuard(m_aMutex);
1345 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1346 0 : return m_pImpl->m_bControllersLocked;
1347 : }
1348 :
1349 0 : uno::Reference< frame::XController > SAL_CALL OReportDefinition::getCurrentController( ) throw (uno::RuntimeException, std::exception)
1350 : {
1351 0 : ::osl::MutexGuard aGuard(m_aMutex);
1352 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1353 0 : return m_pImpl->m_xCurrentController;
1354 : }
1355 :
1356 0 : void SAL_CALL OReportDefinition::setCurrentController( const uno::Reference< frame::XController >& _xController ) throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
1357 : {
1358 0 : ::osl::MutexGuard aGuard(m_aMutex);
1359 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1360 0 : if ( ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController) == m_pImpl->m_aControllers.end() )
1361 0 : throw container::NoSuchElementException();
1362 0 : m_pImpl->m_xCurrentController = _xController;
1363 0 : }
1364 :
1365 0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getCurrentSelection( ) throw (uno::RuntimeException, std::exception)
1366 : {
1367 0 : return uno::Reference< uno::XInterface >();
1368 : }
1369 :
1370 0 : void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom,
1371 : const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor )
1372 : {
1373 0 : m_pImpl->m_xStorage = _xStorageToLoadFrom;
1374 :
1375 0 : utl::MediaDescriptor aDescriptor( _aMediaDescriptor );
1376 0 : fillArgs(aDescriptor);
1377 0 : aDescriptor.createItemIfMissing(OUString("Storage"),uno::makeAny(_xStorageToLoadFrom));
1378 :
1379 0 : uno::Sequence< uno::Any > aDelegatorArguments(_aMediaDescriptor.getLength());
1380 0 : uno::Any* pIter = aDelegatorArguments.getArray();
1381 0 : uno::Any* pEnd = pIter + aDelegatorArguments.getLength();
1382 0 : for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
1383 : {
1384 0 : *pIter <<= _aMediaDescriptor[i];
1385 : }
1386 0 : sal_Int32 nPos = aDelegatorArguments.getLength();
1387 0 : aDelegatorArguments.realloc(nPos+1);
1388 0 : beans::PropertyValue aPropVal;
1389 0 : aPropVal.Name = "Storage";
1390 0 : aPropVal.Value <<= _xStorageToLoadFrom;
1391 0 : aDelegatorArguments[nPos] <<= aPropVal;
1392 :
1393 0 : rptui::OXUndoEnvironment& rEnv = m_pImpl->m_pReportModel->GetUndoEnv();
1394 0 : rptui::OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
1395 : {
1396 : uno::Reference< document::XFilter > xFilter(
1397 0 : m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(OUString("com.sun.star.comp.report.OReportFilter"),aDelegatorArguments,m_aProps->m_xContext),
1398 0 : uno::UNO_QUERY_THROW );
1399 :
1400 0 : uno::Reference< document::XImporter> xImporter(xFilter,uno::UNO_QUERY_THROW);
1401 0 : uno::Reference<XComponent> xComponent(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
1402 0 : xImporter->setTargetDocument(xComponent);
1403 :
1404 0 : utl::MediaDescriptor aTemp;
1405 0 : aTemp << aDelegatorArguments;
1406 0 : xFilter->filter(aTemp.getAsConstPropertyValueList());
1407 :
1408 0 : lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
1409 0 : m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
1410 0 : }
1411 0 : }
1412 :
1413 : // XStorageBasedDocument
1414 0 : void SAL_CALL OReportDefinition::loadFromStorage( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom
1415 : , const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor ) throw (lang::IllegalArgumentException, frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1416 : {
1417 0 : ::osl::MutexGuard aGuard(m_aMutex);
1418 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1419 :
1420 0 : impl_loadFromStorage_nolck_throw( _xStorageToLoadFrom, _aMediaDescriptor );
1421 0 : }
1422 :
1423 0 : void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XStorage >& _xStorageToSaveTo, const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1424 : {
1425 0 : if ( !_xStorageToSaveTo.is() )
1426 0 : throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
1427 :
1428 0 : SolarMutexGuard aSolarGuard;
1429 0 : ::osl::MutexGuard aGuard(m_aMutex);
1430 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1431 : // create XStatusIndicator
1432 0 : uno::Reference<task::XStatusIndicator> xStatusIndicator;
1433 0 : uno::Sequence< uno::Any > aDelegatorArguments;
1434 0 : utl::MediaDescriptor aDescriptor( _aMediaDescriptor );
1435 0 : lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, aDelegatorArguments );
1436 :
1437 : // properties
1438 0 : uno::Sequence < beans::PropertyValue > aProps;
1439 :
1440 : // export sub streams for package, else full stream into a file
1441 0 : sal_Bool bWarn = sal_False, bErr = sal_False;
1442 0 : OUString sWarnFile, sErrFile;
1443 :
1444 0 : uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY);
1445 0 : if ( xProp.is() )
1446 : {
1447 0 : static const OUString sPropName("MediaType");
1448 0 : OUString sOldMediaType;
1449 0 : xProp->getPropertyValue(sPropName) >>= sOldMediaType;
1450 0 : if ( !xProp->getPropertyValue(sPropName).hasValue() || sOldMediaType.isEmpty() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT != sOldMediaType )
1451 0 : xProp->setPropertyValue( sPropName, uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT) );
1452 : }
1453 :
1454 : /** property map for export info set */
1455 : comphelper::PropertyMapEntry const aExportInfoMap[] =
1456 : {
1457 0 : { OUString("UsePrettyPrinting") , 0, ::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0 },
1458 0 : { OUString("StreamName") , 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
1459 0 : { OUString("StreamRelPath") , 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
1460 0 : { OUString("BaseURI") , 0, ::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
1461 : { OUString(), 0, css::uno::Type(), 0, 0 }
1462 0 : };
1463 0 : uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
1464 :
1465 0 : SvtSaveOptions aSaveOpt;
1466 0 : xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(aSaveOpt.IsPrettyPrinting()));
1467 0 : if ( aSaveOpt.IsSaveRelFSys() )
1468 : {
1469 0 : const OUString sVal( aDescriptor.getUnpackedValueOrDefault(aDescriptor.PROP_DOCUMENTBASEURL(),OUString()) );
1470 0 : xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sVal));
1471 : }
1472 0 : const OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString()) );
1473 0 : xInfoSet->setPropertyValue("StreamRelPath", uno::makeAny(sHierarchicalDocumentName));
1474 :
1475 :
1476 0 : sal_Int32 nArgsLen = aDelegatorArguments.getLength();
1477 0 : aDelegatorArguments.realloc(nArgsLen+1);
1478 0 : aDelegatorArguments[nArgsLen++] <<= xInfoSet;
1479 :
1480 0 : uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
1481 0 : uno::Reference< document::XGraphicObjectResolver > xGrfResolver;
1482 0 : SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(_xStorageToSaveTo,GRAPHICHELPER_MODE_WRITE);
1483 0 : xGrfResolver = pGraphicHelper;
1484 0 : pGraphicHelper->release();
1485 0 : SvXMLEmbeddedObjectHelper* pEmbeddedObjectHelper = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE );
1486 0 : xObjectResolver = pEmbeddedObjectHelper;
1487 0 : pEmbeddedObjectHelper->release();
1488 :
1489 0 : aDelegatorArguments.realloc(nArgsLen+2);
1490 0 : aDelegatorArguments[nArgsLen++] <<= xGrfResolver;
1491 0 : aDelegatorArguments[nArgsLen++] <<= xObjectResolver;
1492 :
1493 0 : uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
1494 0 : if( !bErr )
1495 : {
1496 0 : xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
1497 0 : if( !WriteThroughComponent(
1498 : xCom, "settings.xml",
1499 : "com.sun.star.comp.report.XMLSettingsExporter",
1500 0 : aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1501 : {
1502 0 : if( !bWarn )
1503 : {
1504 0 : bWarn = sal_True;
1505 0 : sWarnFile = "settings.xml";
1506 : }
1507 : }
1508 : }
1509 :
1510 0 : if( !bErr )
1511 : {
1512 0 : xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("meta.xml")));
1513 0 : if( !WriteThroughComponent(
1514 : xCom, "meta.xml",
1515 : "com.sun.star.comp.report.XMLMetaExporter",
1516 0 : aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1517 : {
1518 0 : if( !bWarn )
1519 : {
1520 0 : bWarn = sal_True;
1521 0 : sWarnFile = "meta.xml";
1522 : }
1523 : }
1524 : }
1525 :
1526 0 : if( !bErr )
1527 : {
1528 0 : xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("styles.xml")));
1529 0 : if( !WriteThroughComponent(
1530 : xCom, "styles.xml",
1531 : "com.sun.star.comp.report.XMLStylesExporter",
1532 0 : aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1533 : {
1534 0 : if( !bWarn )
1535 : {
1536 0 : bWarn = sal_True;
1537 0 : sWarnFile = "styles.xml";
1538 : }
1539 : }
1540 : }
1541 :
1542 0 : if ( !bErr )
1543 : {
1544 0 : xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
1545 0 : if( !WriteThroughComponent(
1546 : xCom, "content.xml",
1547 : "com.sun.star.comp.report.ExportFilter",
1548 0 : aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1549 : {
1550 0 : bErr = sal_True;
1551 0 : sErrFile = "content.xml";
1552 : }
1553 : }
1554 :
1555 0 : uno::Any aImage;
1556 0 : uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY);
1557 0 : if ( xCurrentController.is() )
1558 : {
1559 0 : xCurrentController->setVisualAreaSize(m_pImpl->m_nAspect,m_pImpl->m_aVisualAreaSize);
1560 0 : aImage = xCurrentController->getPreferredVisualRepresentation( m_pImpl->m_nAspect ).Data;
1561 : }
1562 0 : if ( aImage.hasValue() )
1563 : {
1564 0 : OUString sObject1("report");
1565 0 : OUString sPng("image/png");
1566 :
1567 0 : uno::Sequence<sal_Int8> aSeq;
1568 0 : aImage >>= aSeq;
1569 0 : uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq );
1570 0 : m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng);
1571 : }
1572 :
1573 0 : if ( !bErr )
1574 : {
1575 0 : sal_Bool bPersist = sal_False;
1576 0 : if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
1577 0 : bPersist = m_pImpl->m_pObjectContainer->StoreChildren(true,false);
1578 : else
1579 0 : bPersist = m_pImpl->m_pObjectContainer->StoreAsChildren(true,true,_xStorageToSaveTo);
1580 :
1581 0 : if( bPersist )
1582 0 : m_pImpl->m_pObjectContainer->SetPersistentEntries(m_pImpl->m_xStorage);
1583 : try
1584 : {
1585 0 : uno::Reference<embed::XTransactedObject> xTransact(_xStorageToSaveTo,uno::UNO_QUERY);
1586 0 : if ( xTransact.is() )
1587 0 : xTransact->commit();
1588 : }
1589 0 : catch (const uno::Exception&)
1590 : {
1591 : OSL_FAIL("Exception Caught: Could not commit report storage!");
1592 0 : throw io::IOException();
1593 : }
1594 :
1595 0 : if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
1596 0 : setModified(sal_False);
1597 : }
1598 0 : if ( xStatusIndicator.is() )
1599 0 : xStatusIndicator->end();
1600 0 : }
1601 :
1602 0 : void SAL_CALL OReportDefinition::switchToStorage( const uno::Reference< embed::XStorage >& _xStorage ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1603 : {
1604 0 : if ( !_xStorage.is() )
1605 0 : throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
1606 : {
1607 0 : ::osl::MutexGuard aGuard(m_aMutex);
1608 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1609 0 : m_pImpl->m_xStorage = _xStorage;
1610 0 : lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
1611 0 : m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
1612 : }
1613 : // notify our container listeners
1614 0 : m_pImpl->m_aStorageChangeListeners.forEach<document::XStorageChangeListener>(
1615 0 : ::boost::bind(&document::XStorageChangeListener::notifyStorageChange,_1,boost::cref(static_cast<OWeakObject*>(this)),boost::cref(_xStorage)));
1616 0 : }
1617 :
1618 0 : uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentStorage( ) throw (io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1619 : {
1620 0 : ::osl::MutexGuard aGuard(m_aMutex);
1621 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1622 0 : return m_pImpl->m_xStorage;
1623 : }
1624 :
1625 0 : void SAL_CALL OReportDefinition::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException, std::exception)
1626 : {
1627 0 : ::osl::MutexGuard aGuard(m_aMutex);
1628 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1629 0 : if ( xListener.is() )
1630 0 : m_pImpl->m_aStorageChangeListeners.addInterface(xListener);
1631 0 : }
1632 :
1633 0 : void SAL_CALL OReportDefinition::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException, std::exception)
1634 : {
1635 0 : ::osl::MutexGuard aGuard(m_aMutex);
1636 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1637 0 : m_pImpl->m_aStorageChangeListeners.removeInterface(xListener);
1638 0 : }
1639 :
1640 0 : sal_Bool OReportDefinition::WriteThroughComponent(
1641 : const uno::Reference<lang::XComponent> & xComponent,
1642 : const sal_Char* pStreamName,
1643 : const sal_Char* pServiceName,
1644 : const uno::Sequence<uno::Any> & rArguments,
1645 : const uno::Sequence<beans::PropertyValue> & rMediaDesc,
1646 : const uno::Reference<embed::XStorage>& _xStorageToSaveTo)
1647 : {
1648 : OSL_ENSURE( NULL != pStreamName, "Need stream name!" );
1649 : OSL_ENSURE( NULL != pServiceName, "Need service name!" );
1650 : try
1651 : {
1652 0 : uno::Reference<embed::XStorage> xMyStorage = _xStorageToSaveTo;
1653 : // open stream
1654 0 : OUString sStreamName = OUString::createFromAscii( pStreamName );
1655 0 : uno::Reference<io::XStream> xStream = xMyStorage->openStreamElement( sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
1656 0 : if ( !xStream.is() )
1657 0 : return sal_False;
1658 0 : uno::Reference<io::XOutputStream> xOutputStream = xStream->getOutputStream();
1659 : OSL_ENSURE(xOutputStream.is(), "Can't create output stream in package!");
1660 0 : if ( ! xOutputStream.is() )
1661 0 : return sal_False;
1662 :
1663 0 : uno::Reference<beans::XPropertySet> xStreamProp(xOutputStream,uno::UNO_QUERY);
1664 : OSL_ENSURE(xStreamProp.is(),"No valid preoperty set for the output stream!");
1665 :
1666 0 : uno::Reference<io::XSeekable> xSeek(xStreamProp,uno::UNO_QUERY);
1667 0 : if ( xSeek.is() )
1668 : {
1669 : OSL_TRACE("Length of stream %i",(int)xSeek->getPosition());
1670 0 : xSeek->seek(0);
1671 : }
1672 :
1673 0 : OUString aPropName("MediaType");
1674 0 : OUString aMime("text/xml");
1675 0 : uno::Any aAny;
1676 0 : aAny <<= aMime;
1677 0 : xStreamProp->setPropertyValue( aPropName, aAny );
1678 :
1679 : // encrypt all streams
1680 0 : xStreamProp->setPropertyValue( "UseCommonStoragePasswordEncryption",
1681 0 : uno::makeAny( (sal_Bool)sal_True ) );
1682 :
1683 : // set buffer and create outputstream
1684 :
1685 : // write the stuff
1686 : sal_Bool bRet = WriteThroughComponent(
1687 : xOutputStream, xComponent,
1688 0 : pServiceName, rArguments, rMediaDesc );
1689 : // finally, commit stream.
1690 0 : return bRet;
1691 : }
1692 0 : catch (const uno::Exception&)
1693 : {
1694 0 : throw;
1695 : }
1696 : }
1697 :
1698 0 : sal_Bool OReportDefinition::WriteThroughComponent(
1699 : const uno::Reference<io::XOutputStream> & xOutputStream,
1700 : const uno::Reference<lang::XComponent> & xComponent,
1701 : const sal_Char* pServiceName,
1702 : const uno::Sequence<uno::Any> & rArguments,
1703 : const uno::Sequence<beans::PropertyValue> & rMediaDesc)
1704 : {
1705 : OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" );
1706 : OSL_ENSURE( xComponent.is(), "Need component!" );
1707 : OSL_ENSURE( NULL != pServiceName, "Need component name!" );
1708 :
1709 : // get component
1710 : uno::Reference< xml::sax::XWriter > xSaxWriter(
1711 0 : xml::sax::Writer::create(m_aProps->m_xContext) );
1712 :
1713 : // connect XML writer to output stream
1714 0 : xSaxWriter->setOutputStream( xOutputStream );
1715 :
1716 : // prepare arguments (prepend doc handler to given arguments)
1717 0 : uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() );
1718 0 : aArgs[0] <<= xSaxWriter;
1719 0 : for(sal_Int32 i = 0; i < rArguments.getLength(); i++)
1720 0 : aArgs[i+1] = rArguments[i];
1721 :
1722 : // get filter component
1723 : uno::Reference< document::XExporter > xExporter(
1724 0 : m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
1725 0 : OUString::createFromAscii(pServiceName), aArgs,m_aProps->m_xContext), uno::UNO_QUERY);
1726 : OSL_ENSURE( xExporter.is(),
1727 : "can't instantiate export filter component" );
1728 0 : if( !xExporter.is() )
1729 0 : return sal_False;
1730 :
1731 : // connect model and filter
1732 0 : xExporter->setSourceDocument( xComponent );
1733 :
1734 : // filter!
1735 0 : uno::Reference<document::XFilter> xFilter( xExporter, uno::UNO_QUERY );
1736 0 : return xFilter->filter( rMediaDesc );
1737 : }
1738 :
1739 : // XLoadable
1740 0 : void SAL_CALL OReportDefinition::initNew( ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1741 : {
1742 0 : setPageHeaderOn( sal_True );
1743 0 : setPageFooterOn( sal_True );
1744 0 : }
1745 :
1746 0 : void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue >& _rArguments ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1747 : {
1748 0 : ::osl::MutexGuard aGuard(m_aMutex);
1749 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1750 :
1751 : // TODO: this code is pretty similar to what happens in ODatabaseModelImpl::getOrCreateRootStorage,
1752 : // perhaps we can share code here.
1753 :
1754 0 : ::comphelper::NamedValueCollection aArguments( _rArguments );
1755 :
1756 : // the source for the to-be-created storage: either an URL, or a stream
1757 0 : uno::Reference< io::XInputStream > xStream;
1758 0 : OUString sURL;
1759 :
1760 0 : if ( aArguments.has( "Stream" ) )
1761 : {
1762 0 : aArguments.get_ensureType( "Stream", xStream );
1763 0 : aArguments.remove( "Stream" );
1764 : }
1765 0 : else if ( aArguments.has( "InputStream" ) )
1766 : {
1767 0 : aArguments.get_ensureType( "InputStream", xStream );
1768 0 : aArguments.remove( "InputStream" );
1769 : }
1770 :
1771 0 : if ( aArguments.has( "FileName" ) )
1772 : {
1773 0 : aArguments.get_ensureType( "FileName", sURL );
1774 0 : aArguments.remove( "FileName" );
1775 : }
1776 0 : else if ( aArguments.has( "URL" ) )
1777 : {
1778 0 : aArguments.get_ensureType( "URL", sURL );
1779 0 : aArguments.remove( "URL" );
1780 : }
1781 :
1782 0 : uno::Any aStorageSource;
1783 0 : if ( xStream.is() )
1784 0 : aStorageSource <<= aStorageSource;
1785 0 : else if ( !sURL.isEmpty() )
1786 0 : aStorageSource <<= sURL;
1787 : else
1788 : throw lang::IllegalArgumentException(
1789 : OUString( "No input source (URL or InputStream) found." ),
1790 : // TODO: resource
1791 : *this,
1792 : 1
1793 0 : );
1794 :
1795 0 : uno::Reference< lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create( m_aProps->m_xContext ) );
1796 :
1797 : // open read-write per default, unless told otherwise in the MediaDescriptor
1798 0 : uno::Reference< embed::XStorage > xDocumentStorage;
1799 : const sal_Int32 nOpenModes[2] = {
1800 : embed::ElementModes::READWRITE,
1801 : embed::ElementModes::READ
1802 0 : };
1803 0 : size_t nFirstOpenMode = 0;
1804 0 : if ( aArguments.has( "ReadOnly" ) )
1805 : {
1806 0 : sal_Bool bReadOnly = sal_False;
1807 0 : aArguments.get_ensureType( "ReadOnly", bReadOnly );
1808 0 : nFirstOpenMode = bReadOnly ? 1 : 0;
1809 : }
1810 0 : const size_t nLastOpenMode = sizeof( nOpenModes ) / sizeof( nOpenModes[0] ) - 1;
1811 0 : for ( size_t i=nFirstOpenMode; i <= nLastOpenMode; ++i )
1812 : {
1813 0 : uno::Sequence< uno::Any > aStorageCreationArgs(2);
1814 0 : aStorageCreationArgs[0] = aStorageSource;
1815 0 : aStorageCreationArgs[1] <<= nOpenModes[i];
1816 :
1817 : try
1818 : {
1819 0 : xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), uno::UNO_QUERY_THROW );
1820 : }
1821 0 : catch (const uno::Exception&)
1822 : {
1823 0 : if ( i == nLastOpenMode )
1824 : throw lang::WrappedTargetException(
1825 : OUString( "An error occurred while creating the document storage." ),
1826 : // TODO: resource
1827 : *this,
1828 : ::cppu::getCaughtException()
1829 0 : );
1830 : }
1831 0 : }
1832 :
1833 0 : if ( !xDocumentStorage.is() )
1834 : {
1835 0 : throw uno::RuntimeException();
1836 : }
1837 :
1838 0 : impl_loadFromStorage_nolck_throw( xDocumentStorage, aArguments.getPropertyValues() );
1839 : // TODO: do we need to take ownership of the storage? In opposite to loadFromStorage, we created the storage
1840 : // ourself here, and perhaps this means we're also responsible for it ...?
1841 0 : }
1842 :
1843 : // XVisualObject
1844 0 : void SAL_CALL OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException, std::exception)
1845 : {
1846 0 : ::osl::MutexGuard aGuard(m_aMutex);
1847 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1848 : bool bChanged =
1849 0 : (m_pImpl->m_aVisualAreaSize.Width != _aSize.Width ||
1850 0 : m_pImpl->m_aVisualAreaSize.Height != _aSize.Height);
1851 0 : m_pImpl->m_aVisualAreaSize = _aSize;
1852 0 : if( bChanged )
1853 0 : setModified( sal_True );
1854 0 : m_pImpl->m_nAspect = _nAspect;
1855 0 : }
1856 :
1857 0 : awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException, std::exception)
1858 : {
1859 0 : ::osl::MutexGuard aGuard(m_aMutex);
1860 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1861 0 : return m_pImpl->m_aVisualAreaSize;
1862 : }
1863 :
1864 0 : embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException, std::exception)
1865 : {
1866 0 : ::osl::MutexGuard aGuard(m_aMutex);
1867 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1868 0 : embed::VisualRepresentation aResult;
1869 0 : OUString sImageName("report");
1870 0 : OUString sMimeType;
1871 0 : uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType);
1872 0 : if ( xStream.is() )
1873 : {
1874 0 : uno::Sequence<sal_Int8> aSeq;
1875 0 : xStream->readBytes(aSeq,xStream->available());
1876 0 : xStream->closeInput();
1877 0 : aResult.Data <<= aSeq;
1878 0 : aResult.Flavor.MimeType = sMimeType;
1879 0 : aResult.Flavor.DataType = ::getCppuType( &aSeq );
1880 : }
1881 :
1882 0 : return aResult;
1883 : }
1884 :
1885 0 : ::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException, std::exception)
1886 : {
1887 0 : return embed::EmbedMapUnits::ONE_100TH_MM;
1888 : }
1889 :
1890 : // XModifiable
1891 0 : sal_Bool SAL_CALL OReportDefinition::disableSetModified( ) throw (uno::RuntimeException, std::exception)
1892 : {
1893 0 : ::osl::MutexGuard aGuard( m_aMutex );
1894 0 : ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1895 :
1896 0 : const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
1897 0 : m_pImpl->m_bSetModifiedEnabled = sal_False;
1898 0 : return bWasEnabled;
1899 : }
1900 :
1901 0 : sal_Bool SAL_CALL OReportDefinition::enableSetModified( ) throw (uno::RuntimeException, std::exception)
1902 : {
1903 0 : ::osl::MutexGuard aGuard( m_aMutex );
1904 0 : ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1905 :
1906 0 : const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
1907 0 : m_pImpl->m_bSetModifiedEnabled = sal_True;
1908 0 : return bWasEnabled;
1909 : }
1910 :
1911 0 : sal_Bool SAL_CALL OReportDefinition::isSetModifiedEnabled( ) throw (uno::RuntimeException, std::exception)
1912 : {
1913 0 : ::osl::MutexGuard aGuard( m_aMutex );
1914 0 : ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1915 :
1916 0 : return m_pImpl->m_bSetModifiedEnabled;
1917 : }
1918 :
1919 : // XModifiable
1920 0 : sal_Bool SAL_CALL OReportDefinition::isModified( ) throw (uno::RuntimeException, std::exception)
1921 : {
1922 0 : ::osl::MutexGuard aGuard(m_aMutex);
1923 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1924 0 : return m_pImpl->m_bModified;
1925 : }
1926 :
1927 0 : void SAL_CALL OReportDefinition::setModified( sal_Bool _bModified ) throw (beans::PropertyVetoException, uno::RuntimeException, std::exception)
1928 : {
1929 0 : ::osl::ResettableMutexGuard aGuard(m_aMutex);
1930 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1931 :
1932 0 : if ( !m_pImpl->m_bSetModifiedEnabled )
1933 0 : return;
1934 :
1935 0 : if ( m_pImpl->m_pReportModel->IsReadOnly() && _bModified )
1936 0 : throw beans::PropertyVetoException();
1937 0 : if ( m_pImpl->m_bModified != _bModified )
1938 : {
1939 0 : m_pImpl->m_bModified = _bModified;
1940 0 : if ( ( m_pImpl->m_pReportModel->IsChanged() ? 1 : 0 ) != _bModified )
1941 0 : m_pImpl->m_pReportModel->SetChanged(_bModified);
1942 :
1943 0 : lang::EventObject aEvent(*this);
1944 0 : aGuard.clear();
1945 0 : m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent);
1946 0 : notifyEvent(OUString("OnModifyChanged"));
1947 0 : }
1948 : }
1949 :
1950 : // XModifyBroadcaster
1951 0 : void SAL_CALL OReportDefinition::addModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1952 : {
1953 0 : ::osl::MutexGuard aGuard(m_aMutex);
1954 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1955 0 : if ( _xListener.is() )
1956 0 : m_pImpl->m_aModifyListeners.addInterface(_xListener);
1957 0 : }
1958 :
1959 0 : void SAL_CALL OReportDefinition::removeModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1960 : {
1961 0 : ::osl::MutexGuard aGuard(m_aMutex);
1962 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1963 0 : m_pImpl->m_aModifyListeners.removeInterface(_xListener);
1964 0 : }
1965 :
1966 0 : void OReportDefinition::notifyEvent(const OUString& _sEventName)
1967 : {
1968 : try
1969 : {
1970 0 : ::osl::ResettableMutexGuard aGuard(m_aMutex);
1971 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1972 0 : document::EventObject aEvt(*this, _sEventName);
1973 0 : aGuard.clear();
1974 0 : m_pImpl->m_aDocEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt);
1975 : }
1976 0 : catch (const uno::Exception&)
1977 : {
1978 : }
1979 0 : }
1980 :
1981 : // document::XEventBroadcaster
1982 0 : void SAL_CALL OReportDefinition::addEventListener(const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1983 : {
1984 0 : ::osl::MutexGuard aGuard(m_aMutex);
1985 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1986 0 : if ( _xListener.is() )
1987 0 : m_pImpl->m_aDocEventListeners.addInterface(_xListener);
1988 0 : }
1989 :
1990 0 : void SAL_CALL OReportDefinition::removeEventListener( const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1991 : {
1992 0 : ::osl::MutexGuard aGuard(m_aMutex);
1993 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1994 0 : m_pImpl->m_aDocEventListeners.removeInterface(_xListener);
1995 0 : }
1996 :
1997 : // document::XEventListener
1998 0 : void SAL_CALL OReportDefinition::notifyEvent( const document::EventObject& aEvent ) throw (uno::RuntimeException)
1999 : {
2000 : // used only to forward external events (e.g. for doc creation) from the frame loader
2001 : // to the global event broadcaster and all other interested doc event listener.
2002 0 : notifyEvent(aEvent.EventName);
2003 0 : }
2004 :
2005 : // document::XViewDataSupplier
2006 0 : uno::Reference< container::XIndexAccess > SAL_CALL OReportDefinition::getViewData( ) throw (uno::RuntimeException, std::exception)
2007 : {
2008 0 : ::osl::MutexGuard aGuard(m_aMutex);
2009 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2010 0 : if ( !m_pImpl->m_xViewData.is() )
2011 : {
2012 0 : m_pImpl->m_xViewData.set( document::IndexedPropertyValues::create(m_aProps->m_xContext), uno::UNO_QUERY);
2013 0 : uno::Reference< container::XIndexContainer > xContainer(m_pImpl->m_xViewData,uno::UNO_QUERY);
2014 0 : ::std::vector< uno::Reference< frame::XController> >::iterator aIter = m_pImpl->m_aControllers.begin();
2015 0 : ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = m_pImpl->m_aControllers.end();
2016 0 : for (;aIter != aEnd ; ++aIter)
2017 : {
2018 0 : if ( aIter->is() )
2019 : {
2020 : try
2021 : {
2022 0 : xContainer->insertByIndex(xContainer->getCount(),(*aIter)->getViewData());
2023 : }
2024 0 : catch (const uno::Exception&)
2025 : {
2026 : }
2027 : }
2028 0 : }
2029 :
2030 : }
2031 0 : return m_pImpl->m_xViewData;
2032 : }
2033 :
2034 0 : void SAL_CALL OReportDefinition::setViewData( const uno::Reference< container::XIndexAccess >& Data ) throw (uno::RuntimeException, std::exception)
2035 : {
2036 0 : ::osl::MutexGuard aGuard(m_aMutex);
2037 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2038 0 : m_pImpl->m_xViewData = Data;
2039 0 : }
2040 :
2041 0 : uno::Reference< report::XFunctions > SAL_CALL OReportDefinition::getFunctions() throw (uno::RuntimeException, std::exception)
2042 : {
2043 0 : ::osl::MutexGuard aGuard(m_aMutex);
2044 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2045 0 : return m_pImpl->m_xFunctions;
2046 : }
2047 :
2048 0 : uno::Reference< ui::XUIConfigurationManager > SAL_CALL OReportDefinition::getUIConfigurationManager( ) throw (uno::RuntimeException, std::exception)
2049 : {
2050 0 : return uno::Reference< ui::XUIConfigurationManager >( getUIConfigurationManager2(), uno::UNO_QUERY_THROW );
2051 : }
2052 :
2053 0 : uno::Reference< ui::XUIConfigurationManager2 > OReportDefinition::getUIConfigurationManager2( ) throw (uno::RuntimeException)
2054 : {
2055 0 : ::osl::MutexGuard aGuard(m_aMutex);
2056 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2057 :
2058 0 : if ( !m_pImpl->m_xUIConfigurationManager.is() )
2059 : {
2060 0 : m_pImpl->m_xUIConfigurationManager = ui::UIConfigurationManager::create(m_aProps->m_xContext);
2061 :
2062 0 : uno::Reference< embed::XStorage > xConfigStorage;
2063 : // initialize ui configuration manager with document substorage
2064 0 : m_pImpl->m_xUIConfigurationManager->setStorage( xConfigStorage );
2065 : }
2066 :
2067 0 : return m_pImpl->m_xUIConfigurationManager;
2068 : }
2069 :
2070 0 : uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode ) throw (uno::RuntimeException, std::exception)
2071 : {
2072 0 : ::osl::MutexGuard aGuard(m_aMutex);
2073 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2074 0 : return m_pImpl->m_xStorage->openStorageElement(aStorageName, nMode);
2075 : }
2076 :
2077 0 : uno::Sequence< OUString > SAL_CALL OReportDefinition::getDocumentSubStoragesNames( ) throw (io::IOException, uno::RuntimeException, std::exception)
2078 : {
2079 0 : ::osl::MutexGuard aGuard(m_aMutex);
2080 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2081 0 : uno::Reference<container::XNameAccess> xNameAccess(m_pImpl->m_xStorage,uno::UNO_QUERY);
2082 0 : return xNameAccess.is() ? xNameAccess->getElementNames() : uno::Sequence< OUString >();
2083 : }
2084 :
2085 0 : OUString SAL_CALL OReportDefinition::getMimeType() throw (uno::RuntimeException, std::exception)
2086 : {
2087 0 : ::osl::MutexGuard aGuard(m_aMutex);
2088 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2089 0 : return m_pImpl->m_sMimeType;
2090 : }
2091 :
2092 0 : void SAL_CALL OReportDefinition::setMimeType( const OUString& _mimetype ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
2093 : {
2094 0 : ::osl::MutexGuard aGuard(m_aMutex);
2095 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2096 0 : uno::Sequence< OUString > aList = getAvailableMimeTypes();
2097 0 : const OUString* pEnd = aList.getConstArray()+aList.getLength();
2098 0 : if ( ::std::find(aList.getConstArray(),pEnd,_mimetype) == pEnd )
2099 : throwIllegallArgumentException(OUString("getAvailableMimeTypes()")
2100 : ,*this
2101 : ,1
2102 0 : ,m_aProps->m_xContext);
2103 0 : set(PROPERTY_MIMETYPE,_mimetype,m_pImpl->m_sMimeType);
2104 0 : }
2105 :
2106 0 : uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException, std::exception)
2107 : {
2108 0 : uno::Sequence< OUString > s_aList(2);
2109 0 : s_aList[0] = MIMETYPE_OASIS_OPENDOCUMENT_TEXT;
2110 0 : s_aList[1] = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET;
2111 0 : return s_aList;
2112 : }
2113 :
2114 : // com::sun::star::XUnoTunnel
2115 0 : sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception)
2116 : {
2117 0 : sal_Int64 nRet = 0;
2118 0 : if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
2119 0 : nRet = reinterpret_cast<sal_Int64>(this);
2120 : else
2121 : {
2122 0 : uno::Reference< lang::XUnoTunnel> xUnoTunnel(m_pImpl->m_xNumberFormatsSupplier,uno::UNO_QUERY);
2123 0 : if ( xUnoTunnel.is() )
2124 0 : nRet = xUnoTunnel->getSomething(rId);
2125 : }
2126 0 : if ( !nRet )
2127 : {
2128 0 : uno::Reference< lang::XUnoTunnel> xTunnel;
2129 0 : ::comphelper::query_aggregation(m_aProps->m_xProxy,xTunnel);
2130 0 : if ( xTunnel.is() )
2131 0 : nRet = xTunnel->getSomething(rId);
2132 : }
2133 :
2134 0 : return nRet;
2135 : }
2136 :
2137 0 : uno::Sequence< sal_Int8 > SAL_CALL OReportDefinition::getImplementationId( ) throw (uno::RuntimeException, std::exception)
2138 : {
2139 0 : return css::uno::Sequence<sal_Int8>();
2140 : }
2141 :
2142 0 : uno::Sequence< sal_Int8 > OReportDefinition::getUnoTunnelImplementationId()
2143 : {
2144 : static ::cppu::OImplementationId * pId = 0;
2145 0 : if (! pId)
2146 : {
2147 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
2148 0 : if (! pId)
2149 : {
2150 0 : static ::cppu::OImplementationId aId;
2151 0 : pId = &aId;
2152 0 : }
2153 : }
2154 0 : return pId->getImplementationId();
2155 : }
2156 :
2157 0 : uno::Reference< uno::XComponentContext > OReportDefinition::getContext()
2158 : {
2159 0 : ::osl::MutexGuard aGuard(m_aMutex);
2160 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2161 0 : return m_aProps->m_xContext;
2162 : }
2163 :
2164 0 : ::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel() const
2165 : {
2166 0 : return m_pImpl->m_pReportModel;
2167 : }
2168 :
2169 0 : ::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition)
2170 : {
2171 0 : ::boost::shared_ptr<rptui::OReportModel> pReportModel;
2172 0 : uno::Reference< lang::XUnoTunnel > xUT( _xReportDefinition, uno::UNO_QUERY );
2173 0 : if( xUT.is() )
2174 0 : pReportModel = reinterpret_cast<OReportDefinition*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( OReportDefinition::getUnoTunnelImplementationId())))->getSdrModel();
2175 0 : return pReportModel;
2176 : }
2177 :
2178 0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs)
2179 : throw( uno::Exception, uno::RuntimeException, std::exception )
2180 : {
2181 0 : ::osl::MutexGuard aGuard(m_aMutex);
2182 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2183 :
2184 0 : uno::Reference< uno::XInterface > xRet;
2185 0 : if ( aServiceSpecifier.startsWith( "com.sun.star.document.ImportEmbeddedObjectResolver") )
2186 : {
2187 0 : uno::Reference< embed::XStorage > xStorage;
2188 0 : const uno::Any* pIter = _aArgs.getConstArray();
2189 0 : const uno::Any* pEnd = pIter + _aArgs.getLength();
2190 0 : for(;pIter != pEnd ;++pIter)
2191 : {
2192 0 : beans::NamedValue aValue;
2193 0 : *pIter >>= aValue;
2194 0 : if ( aValue.Name == "Storage" )
2195 0 : aValue.Value >>= xStorage;
2196 0 : }
2197 0 : m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage);
2198 0 : xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
2199 : }
2200 0 : return xRet;
2201 : }
2202 :
2203 0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( const OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException, std::exception)
2204 : {
2205 0 : ::osl::MutexGuard aGuard(m_aMutex);
2206 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2207 0 : uno::Reference< drawing::XShape > xShape;
2208 0 : if ( aServiceSpecifier.startsWith( "com.sun.star.report." ) )
2209 : {
2210 0 : if ( aServiceSpecifier == SERVICE_SHAPE )
2211 0 : xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.CustomShape"),uno::UNO_QUERY_THROW);
2212 0 : else if ( aServiceSpecifier == SERVICE_FORMATTEDFIELD
2213 0 : || aServiceSpecifier == SERVICE_FIXEDTEXT
2214 0 : || aServiceSpecifier == SERVICE_FIXEDLINE
2215 0 : || aServiceSpecifier == SERVICE_IMAGECONTROL )
2216 0 : xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.ControlShape"),uno::UNO_QUERY_THROW);
2217 : else
2218 0 : xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.OLE2Shape"),uno::UNO_QUERY_THROW);
2219 : }
2220 0 : else if ( aServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
2221 : {
2222 0 : xShape.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier,m_aProps->m_xContext),uno::UNO_QUERY);
2223 : }
2224 0 : else if ( aServiceSpecifier == "com.sun.star.style.PageStyle" ||
2225 0 : aServiceSpecifier == "com.sun.star.style.FrameStyle" ||
2226 0 : aServiceSpecifier == "com.sun.star.style.GraphicStyle"
2227 : )
2228 : {
2229 0 : uno::Reference< style::XStyle> xStyle = new OStyle();
2230 0 : xStyle->setName("Default");
2231 0 : uno::Reference<beans::XPropertySet> xProp(xStyle,uno::UNO_QUERY);
2232 0 : OUString sTray;
2233 0 : xProp->getPropertyValue("PrinterPaperTray")>>= sTray;
2234 :
2235 0 : return xStyle.get();
2236 : }
2237 0 : else if ( aServiceSpecifier == "com.sun.star.document.Settings" )
2238 : {
2239 0 : uno::Reference<beans::XPropertySet> xProp = new OStyle();
2240 :
2241 0 : return xProp.get();
2242 : }
2243 0 : else if ( aServiceSpecifier == "com.sun.star.drawing.Defaults" )
2244 : {
2245 0 : uno::Reference<beans::XPropertySet> xProp = new OStyle();
2246 0 : return xProp.get();
2247 : }
2248 0 : else if ( aServiceSpecifier == "com.sun.star.drawing.GradientTable" )
2249 : {
2250 0 : if ( !m_pImpl->m_xGradientTable.is() )
2251 0 : m_pImpl->m_xGradientTable.set(SvxUnoGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2252 0 : return m_pImpl->m_xGradientTable;
2253 : }
2254 0 : else if ( aServiceSpecifier == "com.sun.star.drawing.HatchTable" )
2255 : {
2256 0 : if ( !m_pImpl->m_xHatchTable.is() )
2257 0 : m_pImpl->m_xHatchTable.set(SvxUnoHatchTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2258 0 : return m_pImpl->m_xHatchTable;
2259 : }
2260 0 : else if ( aServiceSpecifier == "com.sun.star.drawing.BitmapTable" )
2261 : {
2262 0 : if ( !m_pImpl->m_xBitmapTable.is() )
2263 0 : m_pImpl->m_xBitmapTable.set(SvxUnoBitmapTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2264 0 : return m_pImpl->m_xBitmapTable;
2265 : }
2266 0 : else if ( aServiceSpecifier == "com.sun.star.drawing.TransparencyGradientTable" )
2267 : {
2268 0 : if ( !m_pImpl->m_xTransparencyGradientTable.is() )
2269 0 : m_pImpl->m_xTransparencyGradientTable.set(SvxUnoTransGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2270 0 : return m_pImpl->m_xTransparencyGradientTable;
2271 : }
2272 0 : else if ( aServiceSpecifier == "com.sun.star.drawing.DashTable" )
2273 : {
2274 0 : if ( !m_pImpl->m_xDashTable.is() )
2275 0 : m_pImpl->m_xDashTable.set(SvxUnoDashTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2276 0 : return m_pImpl->m_xDashTable;
2277 : }
2278 0 : else if( aServiceSpecifier == "com.sun.star.drawing.MarkerTable" )
2279 : {
2280 0 : if( !m_pImpl->m_xMarkerTable.is() )
2281 0 : m_pImpl->m_xMarkerTable.set(SvxUnoMarkerTable_createInstance( m_pImpl->m_pReportModel.get() ),uno::UNO_QUERY);
2282 0 : return m_pImpl->m_xMarkerTable;
2283 : }
2284 0 : else if ( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
2285 0 : return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
2286 0 : else if ( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
2287 0 : return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE ));
2288 0 : else if ( aServiceSpecifier == "com.sun.star.document.ImportGraphicObjectResolver" )
2289 : {
2290 0 : SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE);
2291 0 : uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper));
2292 0 : pGraphicHelper->release();
2293 0 : return xRet;
2294 : }
2295 0 : else if ( aServiceSpecifier == "com.sun.star.document.ExportGraphicObjectResolver" )
2296 : {
2297 0 : SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE);
2298 0 : uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper));
2299 0 : pGraphicHelper->release();
2300 0 : return xRet;
2301 : }
2302 0 : else if ( aServiceSpecifier == "com.sun.star.chart2.data.DataProvider" )
2303 : {
2304 0 : uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection ));
2305 0 : xDataProvider->setRowLimit(10);
2306 0 : uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY);
2307 0 : if ( xChild.is() )
2308 0 : xChild->setParent(*this);
2309 0 : return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY);
2310 : }
2311 0 : else if ( aServiceSpecifier == "com.sun.star.xml.NamespaceMap" )
2312 : {
2313 0 : if ( !m_pImpl->m_xXMLNamespaceMap.is() )
2314 0 : m_pImpl->m_xXMLNamespaceMap = comphelper::NameContainer_createInstance( ::getCppuType( (const OUString*) 0 ) ).get();
2315 0 : return m_pImpl->m_xXMLNamespaceMap;
2316 : }
2317 : else
2318 0 : xShape.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ),uno::UNO_QUERY_THROW);
2319 :
2320 0 : return m_pImpl->m_pReportModel->createShape(aServiceSpecifier,xShape);
2321 : }
2322 :
2323 0 : uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableServiceNames(void) throw( uno::RuntimeException, std::exception )
2324 : {
2325 : static const OUString aSvxComponentServiceNameList[] =
2326 : {
2327 : OUString("com.sun.star.form.component.FixedText"),
2328 : OUString("com.sun.star.form.component.DatabaseImageControl"),
2329 : OUString("com.sun.star.style.PageStyle"),
2330 : OUString("com.sun.star.style.GraphicStyle"),
2331 : OUString("com.sun.star.style.FrameStyle"),
2332 : OUString("com.sun.star.drawing.Defaults"),
2333 : OUString("com.sun.star.document.ImportEmbeddedObjectResolver"),
2334 : OUString("com.sun.star.document.ExportEmbeddedObjectResolver"),
2335 : OUString("com.sun.star.document.ImportGraphicObjectResolver"),
2336 : OUString("com.sun.star.document.ExportGraphicObjectResolver"),
2337 : OUString("com.sun.star.chart2.data.DataProvider"),
2338 : OUString("com.sun.star.xml.NamespaceMap"),
2339 : OUString("com.sun.star.document.Settings"),
2340 : OUString("com.sun.star.drawing.GradientTable"),
2341 : OUString("com.sun.star.drawing.HatchTable"),
2342 : OUString("com.sun.star.drawing.BitmapTable"),
2343 : OUString("com.sun.star.drawing.TransparencyGradientTable"),
2344 : OUString("com.sun.star.drawing.DashTable"),
2345 : OUString("com.sun.star.drawing.MarkerTable")
2346 0 : };
2347 :
2348 : static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
2349 :
2350 0 : uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
2351 0 : OUString* pStrings = aSeq.getArray();
2352 0 : for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
2353 0 : pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
2354 :
2355 0 : uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
2356 0 : return concatServiceNames( aParentSeq, aSeq );
2357 : }
2358 :
2359 : // XShape
2360 0 : awt::Point SAL_CALL OReportDefinition::getPosition( ) throw (uno::RuntimeException, std::exception)
2361 : {
2362 0 : ::osl::MutexGuard aGuard(m_aMutex);
2363 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2364 0 : if ( m_aProps->m_xShape.is() )
2365 0 : return m_aProps->m_xShape->getPosition();
2366 0 : return awt::Point(m_aProps->m_nPosX,m_aProps->m_nPosY);
2367 : }
2368 :
2369 0 : void SAL_CALL OReportDefinition::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException, std::exception)
2370 : {
2371 0 : ::osl::MutexGuard aGuard(m_aMutex);
2372 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2373 0 : if ( m_aProps->m_xShape.is() )
2374 0 : m_aProps->m_xShape->setPosition(aPosition);
2375 0 : set(PROPERTY_POSITIONX,aPosition.X,m_aProps->m_nPosX);
2376 0 : set(PROPERTY_POSITIONY,aPosition.Y,m_aProps->m_nPosY);
2377 0 : }
2378 :
2379 0 : awt::Size SAL_CALL OReportDefinition::getSize( ) throw (uno::RuntimeException, std::exception)
2380 : {
2381 0 : ::osl::MutexGuard aGuard(m_aMutex);
2382 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2383 0 : if ( m_aProps->m_xShape.is() )
2384 0 : return m_aProps->m_xShape->getSize();
2385 0 : return awt::Size(m_aProps->m_nWidth,m_aProps->m_nHeight);
2386 : }
2387 :
2388 0 : void SAL_CALL OReportDefinition::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException, std::exception)
2389 : {
2390 0 : ::osl::MutexGuard aGuard(m_aMutex);
2391 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2392 0 : if ( m_aProps->m_xShape.is() )
2393 0 : m_aProps->m_xShape->setSize(aSize);
2394 0 : set(PROPERTY_WIDTH,aSize.Width,m_aProps->m_nWidth);
2395 0 : set(PROPERTY_HEIGHT,aSize.Height,m_aProps->m_nHeight);
2396 0 : }
2397 :
2398 :
2399 : // XShapeDescriptor
2400 0 : OUString SAL_CALL OReportDefinition::getShapeType( ) throw (uno::RuntimeException, std::exception)
2401 : {
2402 0 : ::osl::MutexGuard aGuard(m_aMutex);
2403 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2404 0 : if ( m_aProps->m_xShape.is() )
2405 0 : return m_aProps->m_xShape->getShapeType();
2406 0 : return OUString("com.sun.star.drawing.OLE2Shape");
2407 : }
2408 :
2409 : typedef ::cppu::WeakImplHelper2< container::XNameContainer,
2410 : container::XIndexAccess
2411 : > TStylesBASE;
2412 : class OStylesHelper : public ::cppu::BaseMutex, public TStylesBASE
2413 : {
2414 : typedef ::std::map< OUString, uno::Any , ::comphelper::UStringMixLess> TStyleElements;
2415 : TStyleElements m_aElements;
2416 : ::std::vector<TStyleElements::iterator> m_aElementsPos;
2417 : uno::Type m_aType;
2418 :
2419 : OStylesHelper(const OStylesHelper&);
2420 : void operator =(const OStylesHelper&);
2421 : protected:
2422 0 : virtual ~OStylesHelper(){}
2423 : public:
2424 0 : OStylesHelper(const uno::Type _aType = ::getCppuType(static_cast< uno::Reference< container::XElementAccess >* >(NULL)));
2425 :
2426 : // XNameContainer
2427 : virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
2428 : virtual void SAL_CALL removeByName( const OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException, std::exception) SAL_OVERRIDE;
2429 :
2430 : // XNameReplace
2431 : virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
2432 :
2433 : // container::XElementAccess
2434 : virtual uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2435 : virtual sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2436 : // container::XIndexAccess
2437 : virtual sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2438 : virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
2439 :
2440 : // container::XNameAccess
2441 : virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
2442 : virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2443 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2444 : };
2445 :
2446 0 : OStylesHelper::OStylesHelper(const uno::Type _aType)
2447 : : cppu::BaseMutex()
2448 0 : ,m_aType(_aType)
2449 : {
2450 0 : }
2451 : ;
2452 :
2453 : // container::XElementAccess
2454 0 : uno::Type SAL_CALL OStylesHelper::getElementType( ) throw(uno::RuntimeException, std::exception)
2455 : {
2456 0 : return m_aType;
2457 : }
2458 :
2459 0 : sal_Bool SAL_CALL OStylesHelper::hasElements( ) throw(uno::RuntimeException, std::exception)
2460 : {
2461 0 : ::osl::MutexGuard aGuard(m_aMutex);
2462 0 : return !m_aElementsPos.empty();
2463 : }
2464 :
2465 : // container::XIndexAccess
2466 0 : sal_Int32 SAL_CALL OStylesHelper::getCount( ) throw(uno::RuntimeException, std::exception)
2467 : {
2468 0 : ::osl::MutexGuard aGuard(m_aMutex);
2469 0 : return m_aElementsPos.size();
2470 : }
2471 :
2472 0 : uno::Any SAL_CALL OStylesHelper::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
2473 : {
2474 0 : ::osl::MutexGuard aGuard(m_aMutex);
2475 0 : if ( Index < 0 || Index >= static_cast<sal_Int32>(m_aElementsPos.size()) )
2476 0 : throw lang::IndexOutOfBoundsException();
2477 0 : return uno::makeAny(m_aElementsPos[Index]->second);
2478 : }
2479 :
2480 : // container::XNameAccess
2481 0 : uno::Any SAL_CALL OStylesHelper::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
2482 : {
2483 0 : ::osl::MutexGuard aGuard(m_aMutex);
2484 0 : TStyleElements::iterator aFind = m_aElements.find(aName);
2485 0 : if ( aFind == m_aElements.end() )
2486 0 : throw container::NoSuchElementException();
2487 0 : return uno::makeAny(aFind->second);
2488 : }
2489 :
2490 0 : uno::Sequence< OUString > SAL_CALL OStylesHelper::getElementNames( ) throw(uno::RuntimeException, std::exception)
2491 : {
2492 0 : ::osl::MutexGuard aGuard(m_aMutex);
2493 0 : uno::Sequence< OUString > aNameList(m_aElementsPos.size());
2494 :
2495 0 : OUString* pStringArray = aNameList.getArray();
2496 0 : ::std::vector<TStyleElements::iterator>::const_iterator aEnd = m_aElementsPos.end();
2497 0 : for(::std::vector<TStyleElements::iterator>::const_iterator aIter = m_aElementsPos.begin(); aIter != aEnd;++aIter,++pStringArray)
2498 0 : *pStringArray = (*aIter)->first;
2499 :
2500 0 : return aNameList;
2501 : }
2502 :
2503 0 : sal_Bool SAL_CALL OStylesHelper::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception)
2504 : {
2505 0 : ::osl::MutexGuard aGuard(m_aMutex);
2506 0 : return m_aElements.find(aName) != m_aElements.end();
2507 : }
2508 :
2509 : // XNameContainer
2510 0 : void SAL_CALL OStylesHelper::insertByName( const OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException, std::exception)
2511 : {
2512 0 : ::osl::MutexGuard aGuard(m_aMutex);
2513 0 : if ( m_aElements.find(aName) != m_aElements.end() )
2514 0 : throw container::ElementExistException();
2515 :
2516 0 : if ( !aElement.isExtractableTo(m_aType) )
2517 0 : throw lang::IllegalArgumentException();
2518 :
2519 0 : m_aElementsPos.push_back(m_aElements.insert(TStyleElements::value_type(aName,aElement)).first);
2520 0 : }
2521 :
2522 0 : void SAL_CALL OStylesHelper::removeByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException, std::exception)
2523 : {
2524 0 : ::osl::MutexGuard aGuard(m_aMutex);
2525 0 : TStyleElements::iterator aFind = m_aElements.find(aName);
2526 0 : if ( aFind != m_aElements.end() )
2527 0 : throw container::NoSuchElementException();
2528 0 : m_aElementsPos.erase(::std::find(m_aElementsPos.begin(),m_aElementsPos.end(),aFind));
2529 0 : m_aElements.erase(aFind);
2530 0 : }
2531 :
2532 : // XNameReplace
2533 0 : void SAL_CALL OStylesHelper::replaceByName( const OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException, std::exception)
2534 : {
2535 0 : ::osl::MutexGuard aGuard(m_aMutex);
2536 0 : TStyleElements::iterator aFind = m_aElements.find(aName);
2537 0 : if ( aFind == m_aElements.end() )
2538 0 : throw container::NoSuchElementException();
2539 0 : if ( !aElement.isExtractableTo(m_aType) )
2540 0 : throw lang::IllegalArgumentException();
2541 0 : aFind->second = aElement;
2542 0 : }
2543 :
2544 0 : uno::Reference< container::XNameAccess > SAL_CALL OReportDefinition::getStyleFamilies( ) throw (uno::RuntimeException, std::exception)
2545 : {
2546 0 : ::osl::MutexGuard aGuard(m_aMutex);
2547 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2548 0 : if ( !m_pImpl->m_xStyles.is() )
2549 : {
2550 0 : m_pImpl->m_xStyles = new OStylesHelper();
2551 0 : uno::Reference< container::XNameContainer> xStyles(m_pImpl->m_xStyles,uno::UNO_QUERY);
2552 :
2553 0 : uno::Reference< container::XNameContainer> xPageStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL)));
2554 0 : xStyles->insertByName(OUString("PageStyles"),uno::makeAny(xPageStyles));
2555 0 : uno::Reference< style::XStyle> xPageStyle(createInstance("com.sun.star.style.PageStyle"),uno::UNO_QUERY);
2556 0 : xPageStyles->insertByName(xPageStyle->getName(),uno::makeAny(xPageStyle));
2557 :
2558 0 : uno::Reference< container::XNameContainer> xFrameStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL)));
2559 0 : xStyles->insertByName(OUString("FrameStyles"),uno::makeAny(xFrameStyles));
2560 0 : uno::Reference< style::XStyle> xFrameStyle(createInstance("com.sun.star.style.FrameStyle"),uno::UNO_QUERY);
2561 0 : xFrameStyles->insertByName(xFrameStyle->getName(),uno::makeAny(xFrameStyle));
2562 :
2563 0 : uno::Reference< container::XNameContainer> xGraphicStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL)));
2564 0 : xStyles->insertByName(OUString("graphics"),uno::makeAny(xGraphicStyles));
2565 0 : uno::Reference< style::XStyle> xGraphicStyle(createInstance("com.sun.star.style.GraphicStyle"),uno::UNO_QUERY);
2566 0 : xGraphicStyles->insertByName(xGraphicStyle->getName(),uno::makeAny(xGraphicStyle));
2567 : }
2568 0 : return m_pImpl->m_xStyles;
2569 : }
2570 0 : OUString SAL_CALL OReportDefinition::getIdentifier( ) throw (uno::RuntimeException, std::exception)
2571 : {
2572 0 : ::osl::MutexGuard aGuard(m_aMutex);
2573 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2574 0 : return m_pImpl->m_sIdentifier;
2575 : }
2576 :
2577 0 : void SAL_CALL OReportDefinition::setIdentifier( const OUString& Identifier ) throw (uno::RuntimeException, std::exception)
2578 : {
2579 0 : ::osl::MutexGuard aGuard(m_aMutex);
2580 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2581 0 : m_pImpl->m_sIdentifier = Identifier;
2582 0 : }
2583 :
2584 : // XNumberFormatsSupplier
2585 0 : uno::Reference< beans::XPropertySet > SAL_CALL OReportDefinition::getNumberFormatSettings( ) throw (uno::RuntimeException, std::exception)
2586 : {
2587 0 : ::osl::MutexGuard aGuard(m_aMutex);
2588 0 : if ( m_pImpl->m_xNumberFormatsSupplier.is() )
2589 0 : return m_pImpl->m_xNumberFormatsSupplier->getNumberFormatSettings();
2590 0 : return uno::Reference< beans::XPropertySet >();
2591 : }
2592 :
2593 0 : uno::Reference< util::XNumberFormats > SAL_CALL OReportDefinition::getNumberFormats( ) throw (uno::RuntimeException, std::exception)
2594 : {
2595 0 : ::osl::MutexGuard aGuard(m_aMutex);
2596 0 : if ( m_pImpl->m_xNumberFormatsSupplier.is() )
2597 0 : return m_pImpl->m_xNumberFormatsSupplier->getNumberFormats();
2598 0 : return uno::Reference< util::XNumberFormats >();
2599 : }
2600 :
2601 0 : ::comphelper::EmbeddedObjectContainer& OReportDefinition::getEmbeddedObjectContainer() const
2602 : {
2603 0 : return *m_pImpl->m_pObjectContainer;
2604 : }
2605 :
2606 0 : uno::Reference< embed::XStorage > OReportDefinition::getStorage() const
2607 : {
2608 0 : return m_pImpl->m_xStorage;
2609 : }
2610 :
2611 0 : uno::Reference< task::XInteractionHandler > OReportDefinition::getInteractionHandler() const
2612 : {
2613 : uno::Reference< task::XInteractionHandler > xRet(
2614 0 : task::InteractionHandler::createWithParent(m_aProps->m_xContext, 0), uno::UNO_QUERY_THROW);
2615 0 : return xRet;
2616 : }
2617 :
2618 0 : uno::Reference< sdbc::XConnection > SAL_CALL OReportDefinition::getActiveConnection() throw (uno::RuntimeException, std::exception)
2619 : {
2620 0 : ::osl::MutexGuard aGuard(m_aMutex);
2621 0 : return m_pImpl->m_xActiveConnection;
2622 : }
2623 :
2624 0 : void SAL_CALL OReportDefinition::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
2625 : {
2626 0 : if ( !_activeconnection.is() )
2627 0 : throw lang::IllegalArgumentException();
2628 0 : set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_pImpl->m_xActiveConnection);
2629 0 : }
2630 :
2631 0 : OUString SAL_CALL OReportDefinition::getDataSourceName() throw (uno::RuntimeException, std::exception)
2632 : {
2633 0 : osl::MutexGuard g(m_aMutex);
2634 0 : return m_pImpl->m_sDataSourceName;
2635 : }
2636 :
2637 0 : void SAL_CALL OReportDefinition::setDataSourceName(const OUString& the_value) throw (uno::RuntimeException, std::exception)
2638 : {
2639 0 : set(PROPERTY_DATASOURCENAME,the_value,m_pImpl->m_sDataSourceName);
2640 0 : }
2641 :
2642 0 : bool OReportDefinition::isEnableSetModified() const
2643 : {
2644 0 : return true;
2645 : }
2646 :
2647 0 : uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw()
2648 : {
2649 0 : SolarMutexGuard aSolarGuard;
2650 :
2651 0 : ::osl::MutexGuard aGuard(m_aMutex);
2652 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2653 :
2654 0 : if ( ! m_pImpl->m_xTitleHelper.is ())
2655 : {
2656 0 : uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_aProps->m_xContext);
2657 0 : uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
2658 :
2659 0 : ::framework::TitleHelper* pHelper = new ::framework::TitleHelper( m_aProps->m_xContext );
2660 0 : m_pImpl->m_xTitleHelper = uno::Reference< frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
2661 0 : pHelper->setOwner (xThis );
2662 0 : pHelper->connectWithUntitledNumbers (uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW));
2663 : }
2664 :
2665 0 : return m_pImpl->m_xTitleHelper;
2666 : }
2667 :
2668 0 : uno::Reference< frame::XUntitledNumbers > OReportDefinition::impl_getUntitledHelper_throw()
2669 : {
2670 0 : SolarMutexGuard aSolarGuard;
2671 :
2672 0 : ::osl::MutexGuard aGuard(m_aMutex);
2673 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2674 :
2675 0 : if ( ! m_pImpl->m_xNumberedControllers.is ())
2676 : {
2677 0 : uno::Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
2678 0 : ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection();
2679 0 : m_pImpl->m_xNumberedControllers = uno::Reference< frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
2680 :
2681 0 : pHelper->setOwner (xThis);
2682 0 : pHelper->setUntitledPrefix (OUString(" : "));
2683 : }
2684 :
2685 0 : return m_pImpl->m_xNumberedControllers;
2686 : }
2687 :
2688 : // css.frame.XTitle
2689 0 : OUString SAL_CALL OReportDefinition::getTitle()
2690 : throw (uno::RuntimeException, std::exception)
2691 : {
2692 : // SYNCHRONIZED ->
2693 0 : SolarMutexGuard aSolarGuard;
2694 :
2695 0 : ::osl::MutexGuard aGuard(m_aMutex);
2696 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2697 :
2698 0 : return impl_getTitleHelper_throw()->getTitle ();
2699 : }
2700 :
2701 : // css.frame.XTitle
2702 0 : void SAL_CALL OReportDefinition::setTitle( const OUString& sTitle )
2703 : throw (uno::RuntimeException, std::exception)
2704 : {
2705 : // SYNCHRONIZED ->
2706 0 : SolarMutexGuard aSolarGuard;
2707 :
2708 0 : ::osl::MutexGuard aGuard(m_aMutex);
2709 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2710 :
2711 0 : impl_getTitleHelper_throw()->setTitle (sTitle);
2712 0 : }
2713 :
2714 : // css.frame.XTitleChangeBroadcaster
2715 0 : void SAL_CALL OReportDefinition::addTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
2716 : throw (uno::RuntimeException, std::exception)
2717 : {
2718 : // SYNCHRONIZED ->
2719 0 : SolarMutexGuard aSolarGuard;
2720 :
2721 0 : ::osl::MutexGuard aGuard(m_aMutex);
2722 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2723 :
2724 0 : uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
2725 0 : if (xBroadcaster.is ())
2726 0 : xBroadcaster->addTitleChangeListener (xListener);
2727 0 : }
2728 :
2729 : // css.frame.XTitleChangeBroadcaster
2730 0 : void SAL_CALL OReportDefinition::removeTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
2731 : throw (uno::RuntimeException, std::exception)
2732 : {
2733 : // SYNCHRONIZED ->
2734 0 : SolarMutexGuard aSolarGuard;
2735 :
2736 0 : ::osl::MutexGuard aGuard(m_aMutex);
2737 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2738 :
2739 0 : uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
2740 0 : if (xBroadcaster.is ())
2741 0 : xBroadcaster->removeTitleChangeListener (xListener);
2742 0 : }
2743 :
2744 : // css.frame.XUntitledNumbers
2745 0 : ::sal_Int32 SAL_CALL OReportDefinition::leaseNumber( const uno::Reference< uno::XInterface >& xComponent )
2746 : throw (lang::IllegalArgumentException,
2747 : uno::RuntimeException, std::exception )
2748 : {
2749 : // object already disposed?
2750 0 : SolarMutexGuard aSolarGuard;
2751 0 : ::osl::MutexGuard aGuard(m_aMutex);
2752 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2753 :
2754 0 : return impl_getUntitledHelper_throw()->leaseNumber (xComponent);
2755 : }
2756 :
2757 : // css.frame.XUntitledNumbers
2758 0 : void SAL_CALL OReportDefinition::releaseNumber( ::sal_Int32 nNumber )
2759 : throw (lang::IllegalArgumentException,
2760 : uno::RuntimeException, std::exception )
2761 : {
2762 : // object already disposed?
2763 0 : SolarMutexGuard aSolarGuard;
2764 0 : ::osl::MutexGuard aGuard(m_aMutex);
2765 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2766 :
2767 0 : impl_getUntitledHelper_throw()->releaseNumber (nNumber);
2768 0 : }
2769 :
2770 : // css.frame.XUntitledNumbers
2771 0 : void SAL_CALL OReportDefinition::releaseNumberForComponent( const uno::Reference< uno::XInterface >& xComponent )
2772 : throw (lang::IllegalArgumentException,
2773 : uno::RuntimeException, std::exception )
2774 : {
2775 : // object already disposed?
2776 0 : SolarMutexGuard aSolarGuard;
2777 0 : ::osl::MutexGuard aGuard(m_aMutex);
2778 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2779 :
2780 0 : impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent);
2781 0 : }
2782 :
2783 : // css.frame.XUntitledNumbers
2784 0 : OUString SAL_CALL OReportDefinition::getUntitledPrefix()
2785 : throw (uno::RuntimeException, std::exception)
2786 : {
2787 : // object already disposed?
2788 0 : SolarMutexGuard aSolarGuard;
2789 0 : ::osl::MutexGuard aGuard(m_aMutex);
2790 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2791 :
2792 0 : return impl_getUntitledHelper_throw()->getUntitledPrefix ();
2793 : }
2794 :
2795 0 : uno::Reference< document::XDocumentProperties > SAL_CALL OReportDefinition::getDocumentProperties( ) throw (uno::RuntimeException, std::exception)
2796 : {
2797 0 : ::osl::MutexGuard aGuard(m_aMutex);
2798 0 : ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2799 0 : if ( !m_pImpl->m_xDocumentProperties.is() )
2800 : {
2801 0 : m_pImpl->m_xDocumentProperties.set(document::DocumentProperties::create(m_aProps->m_xContext));
2802 : }
2803 0 : return m_pImpl->m_xDocumentProperties;
2804 : }
2805 :
2806 0 : uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const
2807 : {
2808 0 : return m_aProps->m_xContext;
2809 : }
2810 :
2811 0 : uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor ) throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException, std::exception)
2812 : {
2813 0 : uno::Any aResult;
2814 0 : if( isDataFlavorSupported( aFlavor ) )
2815 : {
2816 : try
2817 : {
2818 0 : aResult <<= getPreferredVisualRepresentation(0).Data;
2819 : }
2820 0 : catch (const uno::Exception &)
2821 : {
2822 : DBG_UNHANDLED_EXCEPTION();
2823 : }
2824 : }
2825 : else
2826 : {
2827 0 : throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this ));
2828 : }
2829 :
2830 0 : return aResult;
2831 : }
2832 :
2833 0 : uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors( ) throw (uno::RuntimeException, std::exception)
2834 : {
2835 0 : uno::Sequence< datatransfer::DataFlavor > aRet(1);
2836 :
2837 0 : aRet[0] = datatransfer::DataFlavor( OUString("image/png"),
2838 : OUString("PNG"),
2839 0 : ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
2840 :
2841 0 : return aRet;
2842 : }
2843 :
2844 0 : sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor ) throw (uno::RuntimeException, std::exception)
2845 : {
2846 0 : return aFlavor.MimeType == "image/png";
2847 : }
2848 :
2849 :
2850 0 : uno::Reference< document::XUndoManager > SAL_CALL OReportDefinition::getUndoManager( ) throw (uno::RuntimeException, std::exception)
2851 : {
2852 0 : ::osl::MutexGuard aGuard( m_aMutex );
2853 0 : return m_pImpl->m_pUndoManager.get();
2854 : }
2855 :
2856 0 : }// namespace reportdesign
2857 :
2858 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|