bump product version to 5.0.4.1
[LibreOffice.git] / reportdesign / source / core / api / ReportDefinition.cxx
blob42b0baf010a3787047f3b06e1ebb7879b5ded07d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <vector>
24 #include "ReportDefinition.hxx"
26 #include "FixedLine.hxx"
27 #include "FixedText.hxx"
28 #include "FormattedField.hxx"
29 #include "Functions.hxx"
30 #include "Groups.hxx"
31 #include "ImageControl.hxx"
32 #include "ReportComponent.hxx"
33 #include "ReportHelperImpl.hxx"
34 #include "RptDef.hxx"
35 #include "RptModel.hxx"
36 #include "Section.hxx"
37 #include "Shape.hxx"
38 #include "Tools.hxx"
39 #include "UndoEnv.hxx"
40 #include "core_resource.hrc"
41 #include "core_resource.hxx"
42 #include "corestrings.hrc"
44 #include <com/sun/star/beans/PropertyAttribute.hpp>
45 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
46 #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
47 #include <com/sun/star/document/DocumentProperties.hpp>
48 #include <com/sun/star/document/IndexedPropertyValues.hpp>
49 #include <com/sun/star/document/EventObject.hpp>
50 #include <com/sun/star/document/XEventListener.hpp>
51 #include <com/sun/star/document/XExporter.hpp>
52 #include <com/sun/star/document/XFilter.hpp>
53 #include <com/sun/star/document/XImporter.hpp>
54 #include <com/sun/star/embed/Aspects.hpp>
55 #include <com/sun/star/embed/ElementModes.hpp>
56 #include <com/sun/star/embed/EmbedMapUnits.hpp>
57 #include <com/sun/star/embed/EntryInitModes.hpp>
58 #include <com/sun/star/embed/XEmbedPersist.hpp>
59 #include <com/sun/star/embed/XTransactedObject.hpp>
60 #include <com/sun/star/embed/StorageFactory.hpp>
61 #include <com/sun/star/frame/Desktop.hpp>
62 #include <com/sun/star/frame/FrameSearchFlag.hpp>
63 #include <com/sun/star/frame/XComponentLoader.hpp>
64 #include <com/sun/star/io/XActiveDataSource.hpp>
65 #include <com/sun/star/io/XSeekable.hpp>
66 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
67 #include <com/sun/star/report/GroupKeepTogether.hpp>
68 #include <com/sun/star/report/ReportPrintOption.hpp>
69 #include <com/sun/star/report/XFunction.hpp>
70 #include <com/sun/star/sdb/CommandType.hpp>
71 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
72 #include <com/sun/star/style/GraphicLocation.hpp>
73 #include <com/sun/star/style/NumberingType.hpp>
74 #include <com/sun/star/style/PageStyleLayout.hpp>
75 #include <com/sun/star/style/XStyle.hpp>
76 #include <com/sun/star/table/BorderLine2.hpp>
77 #include <com/sun/star/table/ShadowFormat.hpp>
78 #include <com/sun/star/task/InteractionHandler.hpp>
79 #include <com/sun/star/task/XStatusIndicator.hpp>
80 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
81 #include <com/sun/star/ui/UIConfigurationManager.hpp>
82 #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
83 #include <com/sun/star/util/NumberFormatsSupplier.hpp>
84 #include <com/sun/star/xml/AttributeData.hpp>
85 #include <com/sun/star/xml/sax/Writer.hpp>
87 #include <comphelper/broadcasthelper.hxx>
88 #include <comphelper/documentconstants.hxx>
89 #include <comphelper/genericpropertyset.hxx>
90 #include <unotools/mediadescriptor.hxx>
91 #include <comphelper/mimeconfighelper.hxx>
92 #include <comphelper/namecontainer.hxx>
93 #include <comphelper/namedvaluecollection.hxx>
94 #include <comphelper/numberedcollection.hxx>
95 #include <comphelper/proparrhlp.hxx>
96 #include <comphelper/property.hxx>
97 #include <comphelper/propertysetinfo.hxx>
98 #include <comphelper/propertystatecontainer.hxx>
99 #include <comphelper/seqstream.hxx>
100 #include <comphelper/sequence.hxx>
101 #include <comphelper/storagehelper.hxx>
102 #include <comphelper/uno3.hxx>
103 #include <connectivity/CommonTools.hxx>
104 #include <connectivity/dbconversion.hxx>
105 #include <connectivity/dbtools.hxx>
106 #include <cppuhelper/exc_hlp.hxx>
107 #include <cppuhelper/interfacecontainer.h>
108 #include <cppuhelper/supportsservice.hxx>
109 #include <dbaccess/dbaundomanager.hxx>
110 #include <editeng/paperinf.hxx>
111 #include <framework/titlehelper.hxx>
112 #include <svl/itempool.hxx>
113 #include <svl/undo.hxx>
114 #include <svx/svdlayer.hxx>
115 #include <svx/unofill.hxx>
116 #include <svx/xmleohlp.hxx>
117 #include <svx/xmlgrhlp.hxx>
118 #include <tools/debug.hxx>
119 #include <tools/diagnose_ex.h>
120 #include <unotools/moduleoptions.hxx>
121 #include <unotools/saveopt.hxx>
122 #include <unotools/streamwrap.hxx>
123 #include <vcl/svapp.hxx>
124 #include <vcl/virdev.hxx>
126 #include <boost/bind.hpp>
127 #include <boost/mem_fn.hpp>
128 #include <boost/noncopyable.hpp>
129 #include <boost/utility.hpp>
131 // page styles
132 #define SC_UNO_PAGE_LEFTBORDER "LeftBorder"
133 #define SC_UNO_PAGE_RIGHTBORDER "RightBorder"
134 #define SC_UNO_PAGE_BOTTBORDER "BottomBorder"
135 #define SC_UNO_PAGE_TOPBORDER "TopBorder"
136 #define SC_UNO_PAGE_LEFTBRDDIST "LeftBorderDistance"
137 #define SC_UNO_PAGE_RIGHTBRDDIST "RightBorderDistance"
138 #define SC_UNO_PAGE_BOTTBRDDIST "BottomBorderDistance"
139 #define SC_UNO_PAGE_TOPBRDDIST "TopBorderDistance"
140 #define SC_UNO_PAGE_BORDERDIST "BorderDistance"
141 #define SC_UNO_PAGE_SHADOWFORM "ShadowFormat"
142 #define SC_UNO_PAGE_PAPERTRAY "PrinterPaperTray"
143 #define SC_UNO_PAGE_SCALEVAL "PageScale"
144 #define SC_UNO_PAGE_SCALETOPAG "ScaleToPages"
145 #define SC_UNO_PAGE_SCALETOX "ScaleToPagesX"
146 #define SC_UNO_PAGE_SCALETOY "ScaleToPagesY"
147 #define SC_UNO_PAGE_HDRBACKCOL "HeaderBackColor"
148 #define SC_UNO_PAGE_HDRBACKTRAN "HeaderBackTransparent"
149 #define SC_UNO_PAGE_HDRGRFFILT "HeaderBackGraphicFilter"
150 #define SC_UNO_PAGE_HDRGRFLOC "HeaderBackGraphicLocation"
151 #define SC_UNO_PAGE_HDRGRFURL "HeaderBackGraphicURL"
152 #define SC_UNO_PAGE_HDRLEFTBOR "HeaderLeftBorder"
153 #define SC_UNO_PAGE_HDRRIGHTBOR "HeaderRightBorder"
154 #define SC_UNO_PAGE_HDRBOTTBOR "HeaderBottomBorder"
155 #define SC_UNO_PAGE_HDRTOPBOR "HeaderTopBorder"
156 #define SC_UNO_PAGE_HDRLEFTBDIS "HeaderLeftBorderDistance"
157 #define SC_UNO_PAGE_HDRRIGHTBDIS "HeaderRightBorderDistance"
158 #define SC_UNO_PAGE_HDRBOTTBDIS "HeaderBottomBorderDistance"
159 #define SC_UNO_PAGE_HDRTOPBDIS "HeaderTopBorderDistance"
160 #define SC_UNO_PAGE_HDRBRDDIST "HeaderBorderDistance"
161 #define SC_UNO_PAGE_HDRSHADOW "HeaderShadowFormat"
162 #define SC_UNO_PAGE_HDRLEFTMAR "HeaderLeftMargin"
163 #define SC_UNO_PAGE_HDRRIGHTMAR "HeaderRightMargin"
164 #define SC_UNO_PAGE_HDRBODYDIST "HeaderBodyDistance"
165 #define SC_UNO_PAGE_HDRHEIGHT "HeaderHeight"
166 #define SC_UNO_PAGE_HDRON "HeaderIsOn"
167 #define SC_UNO_PAGE_HDRDYNAMIC "HeaderIsDynamicHeight"
168 #define SC_UNO_PAGE_HDRSHARED "HeaderIsShared"
169 #define SC_UNO_PAGE_FTRBACKCOL "FooterBackColor"
170 #define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent"
171 #define SC_UNO_PAGE_FTRGRFFILT "FooterBackGraphicFilter"
172 #define SC_UNO_PAGE_FTRGRFLOC "FooterBackGraphicLocation"
173 #define SC_UNO_PAGE_FTRGRFURL "FooterBackGraphicURL"
174 #define SC_UNO_PAGE_FTRLEFTBOR "FooterLeftBorder"
175 #define SC_UNO_PAGE_FTRRIGHTBOR "FooterRightBorder"
176 #define SC_UNO_PAGE_FTRBOTTBOR "FooterBottomBorder"
177 #define SC_UNO_PAGE_FTRTOPBOR "FooterTopBorder"
178 #define SC_UNO_PAGE_FTRLEFTBDIS "FooterLeftBorderDistance"
179 #define SC_UNO_PAGE_FTRRIGHTBDIS "FooterRightBorderDistance"
180 #define SC_UNO_PAGE_FTRBOTTBDIS "FooterBottomBorderDistance"
181 #define SC_UNO_PAGE_FTRTOPBDIS "FooterTopBorderDistance"
182 #define SC_UNO_PAGE_FTRBRDDIST "FooterBorderDistance"
183 #define SC_UNO_PAGE_FTRSHADOW "FooterShadowFormat"
184 #define SC_UNO_PAGE_FTRLEFTMAR "FooterLeftMargin"
185 #define SC_UNO_PAGE_FTRRIGHTMAR "FooterRightMargin"
186 #define SC_UNO_PAGE_FTRBODYDIST "FooterBodyDistance"
187 #define SC_UNO_PAGE_FTRHEIGHT "FooterHeight"
188 #define SC_UNO_PAGE_FTRON "FooterIsOn"
189 #define SC_UNO_PAGE_FTRDYNAMIC "FooterIsDynamicHeight"
190 #define SC_UNO_PAGE_FTRSHARED "FooterIsShared"
192 namespace reportdesign
194 using namespace com::sun::star;
195 using namespace comphelper;
196 using namespace rptui;
198 void lcl_setModelReadOnly(const uno::Reference< embed::XStorage >& _xStorage,::boost::shared_ptr<rptui::OReportModel>& _rModel)
200 uno::Reference<beans::XPropertySet> xProp(_xStorage,uno::UNO_QUERY);
201 sal_Int32 nOpenMode = embed::ElementModes::READ;
202 if ( xProp.is() )
203 xProp->getPropertyValue("OpenMode") >>= nOpenMode;
205 _rModel->SetReadOnly((nOpenMode & embed::ElementModes::WRITE) != embed::ElementModes::WRITE);
207 void lcl_stripLoadArguments( utl::MediaDescriptor& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs )
209 _rDescriptor.erase( OUString( "StatusIndicator" ) );
210 _rDescriptor.erase( OUString( "InteractionHandler" ) );
211 _rDescriptor.erase( OUString( "Model" ) );
212 _rDescriptor >> _rArgs;
215 void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator,
216 uno::Sequence< uno::Any >& _rCallArgs )
220 _rxStatusIndicator = _rDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR(), _rxStatusIndicator );
221 if ( _rxStatusIndicator.is() )
223 _rxStatusIndicator->start( OUString(), (sal_Int32)1000000 );
225 sal_Int32 nLength = _rCallArgs.getLength();
226 _rCallArgs.realloc( nLength + 1 );
227 _rCallArgs[ nLength ] <<= _rxStatusIndicator;
230 catch (const uno::Exception&)
232 OSL_FAIL( "lcl_extractAndStartStatusIndicator: caught an exception!" );
236 typedef ::comphelper::OPropertyStateContainer OStyle_PBASE;
237 class OStyle;
238 typedef ::comphelper::OPropertyArrayUsageHelper < OStyle
239 > OStyle_PABASE;
240 typedef ::cppu::WeakImplHelper2< style::XStyle, beans::XMultiPropertyStates> TStyleBASE;
242 class OStyle : public ::comphelper::OMutexAndBroadcastHelper
243 ,public TStyleBASE
244 ,public OStyle_PBASE
245 ,public OStyle_PABASE
247 awt::Size m_aSize;
249 protected:
250 void getPropertyDefaultByHandle( sal_Int32 _nHandle, uno::Any& _rDefault ) const SAL_OVERRIDE;
251 virtual ~OStyle(){}
252 public:
253 OStyle();
256 DECLARE_XINTERFACE( )
258 // XPropertySet
259 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
261 ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
263 // XStyle
264 sal_Bool SAL_CALL isUserDefined( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
265 sal_Bool SAL_CALL isInUse( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
266 OUString SAL_CALL getParentStyle( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
267 void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw (container::NoSuchElementException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
269 // XNamed
270 OUString SAL_CALL getName( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
271 void SAL_CALL setName( const OUString& aName ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
273 // XMultiPropertyState
274 uno::Sequence< beans::PropertyState > SAL_CALL getPropertyStates( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) SAL_OVERRIDE
276 return OStyle_PBASE::getPropertyStates(aPropertyNames);
278 void SAL_CALL setAllPropertiesToDefault( ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
279 void SAL_CALL setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
280 uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
283 OStyle::OStyle()
284 :OStyle_PBASE(m_aBHelper)
285 ,m_aSize(21000,29700)
287 const ::Size aDefaultSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM );
288 m_aSize.Height = aDefaultSize.Height();
289 m_aSize.Width = aDefaultSize.Width();
291 const style::GraphicLocation eGraphicLocation = style::GraphicLocation_NONE;
292 const sal_Bool bFalse = sal_False;
293 const sal_Bool bTrue = sal_True;
294 const sal_Int32 nMargin = 2000;
295 //const sal_Int32 nColor = COL_WHITE;
296 const sal_Int32 nTransparent = COL_TRANSPARENT;
297 const sal_Int32 nZero = 0;
298 const sal_Int16 n16Zero = 0;
299 const sal_Int16 nNummeringType = style::NumberingType::ARABIC;
300 const OUString sName("Default");
301 const OUString sEmpty;
302 const table::BorderLine2 eBorderLine(0,0,0,0,0,0);
303 const table::ShadowFormat eShadowFormat(table::ShadowLocation_NONE,0,0,0);
304 const style::PageStyleLayout ePageStyleLayout = style::PageStyleLayout_ALL;
305 const sal_Int32 nBound = beans::PropertyAttribute::BOUND;
306 const sal_Int32 nMayBeVoid = beans::PropertyAttribute::MAYBEVOID;
308 sal_Int32 i = 0;
309 registerPropertyNoMember( PROPERTY_NAME, ++i, nBound, cppu::UnoType<OUString>::get(), &sName );
311 registerPropertyNoMember(PROPERTY_BACKCOLOR, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nTransparent);
313 registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION, ++i,nBound, cppu::UnoType<style::GraphicLocation>::get(), &eGraphicLocation);
314 registerPropertyNoMember(PROPERTY_BACKTRANSPARENT, ++i,nBound,cppu::UnoType<bool>::get() ,&bTrue);
315 registerPropertyNoMember(SC_UNO_PAGE_BORDERDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
316 registerPropertyNoMember(SC_UNO_PAGE_BOTTBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
317 registerPropertyNoMember(SC_UNO_PAGE_BOTTBRDDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
318 registerPropertyNoMember(PROPERTY_BOTTOMMARGIN, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nMargin);
319 registerPropertyNoMember("DisplayName", ++i,nBound, cppu::UnoType<OUString>::get(), &sEmpty);
320 registerPropertyNoMember(SC_UNO_PAGE_FTRBACKCOL, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nTransparent);
321 registerPropertyNoMember(SC_UNO_PAGE_FTRGRFFILT, ++i,nBound, cppu::UnoType<OUString>::get(), &sEmpty);
322 registerPropertyNoMember(SC_UNO_PAGE_FTRGRFLOC, ++i,nBound, cppu::UnoType<style::GraphicLocation>::get(), &eGraphicLocation);
323 registerPropertyNoMember(SC_UNO_PAGE_FTRGRFURL, ++i,nBound, cppu::UnoType<OUString>::get(), &sEmpty);
324 registerPropertyNoMember(SC_UNO_PAGE_FTRBACKTRAN, ++i,nBound,cppu::UnoType<bool>::get() ,&bTrue);
325 registerPropertyNoMember(SC_UNO_PAGE_FTRBODYDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
326 registerPropertyNoMember(SC_UNO_PAGE_FTRBRDDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
327 registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
328 registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBDIS, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
329 registerPropertyNoMember(SC_UNO_PAGE_FTRHEIGHT, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
330 registerPropertyNoMember(SC_UNO_PAGE_FTRDYNAMIC, ++i,nBound,cppu::UnoType<bool>::get() ,&bFalse);
331 registerPropertyNoMember(SC_UNO_PAGE_FTRON, ++i,nBound,cppu::UnoType<bool>::get() ,&bFalse);
332 registerPropertyNoMember(SC_UNO_PAGE_FTRSHARED, ++i,nBound,cppu::UnoType<bool>::get() ,&bFalse);
333 registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
334 registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBDIS, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
335 registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTMAR, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
336 registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
337 registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBDIS,++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
338 registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTMAR, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
339 registerPropertyNoMember(SC_UNO_PAGE_FTRSHADOW, ++i,nBound, cppu::UnoType<table::ShadowFormat>::get(), &eShadowFormat);
340 registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
341 registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBDIS, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
343 registerPropertyNoMember(SC_UNO_PAGE_HDRBACKCOL, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nTransparent);
344 registerPropertyNoMember(SC_UNO_PAGE_HDRGRFFILT, ++i,nBound|nMayBeVoid, cppu::UnoType<OUString>::get(), &sEmpty);
345 registerPropertyNoMember(SC_UNO_PAGE_HDRGRFLOC, ++i,nBound|nMayBeVoid, cppu::UnoType<style::GraphicLocation>::get(), &eGraphicLocation);
346 registerPropertyNoMember(SC_UNO_PAGE_HDRGRFURL, ++i,nBound|nMayBeVoid, cppu::UnoType<OUString>::get(), &sEmpty);
347 registerPropertyNoMember(SC_UNO_PAGE_HDRBACKTRAN, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get() ,&bTrue);
348 registerPropertyNoMember(SC_UNO_PAGE_HDRBODYDIST, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
349 registerPropertyNoMember(SC_UNO_PAGE_HDRBRDDIST, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
350 registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
351 registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
352 registerPropertyNoMember(SC_UNO_PAGE_HDRHEIGHT, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
353 registerPropertyNoMember(SC_UNO_PAGE_HDRDYNAMIC, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get() ,&bFalse);
354 registerPropertyNoMember(SC_UNO_PAGE_HDRON, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get() ,&bFalse);
355 registerPropertyNoMember(SC_UNO_PAGE_HDRSHARED, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get() ,&bFalse);
356 registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
357 registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
358 registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTMAR, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
359 registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
360 registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBDIS,++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
361 registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTMAR, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
362 registerPropertyNoMember(SC_UNO_PAGE_HDRSHADOW, ++i,nBound|nMayBeVoid, cppu::UnoType<table::ShadowFormat>::get(), &eShadowFormat);
363 registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
364 registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), &nZero);
366 registerProperty(PROPERTY_HEIGHT, ++i,nBound,&m_aSize.Height, ::cppu::UnoType<sal_Int32>::get() );
367 registerPropertyNoMember(PROPERTY_ISLANDSCAPE, ++i,nBound, cppu::UnoType<bool>::get() ,&bFalse);
368 registerPropertyNoMember(SC_UNO_PAGE_LEFTBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
369 registerPropertyNoMember(SC_UNO_PAGE_LEFTBRDDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
370 registerPropertyNoMember(PROPERTY_LEFTMARGIN, ++i,beans::PropertyAttribute::BOUND, ::cppu::UnoType<sal_Int32>::get(), &nMargin);
371 registerPropertyNoMember(PROPERTY_NUMBERINGTYPE, ++i,nBound, cppu::UnoType<sal_Int16>::get(), &nNummeringType);
372 registerPropertyNoMember(SC_UNO_PAGE_SCALEVAL, ++i,nBound, cppu::UnoType<sal_Int16>::get(), &n16Zero);
373 registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT, ++i,nBound, cppu::UnoType<style::PageStyleLayout>::get(), &ePageStyleLayout);
374 const OUString sPaperTray("[From printer settings]");
375 registerPropertyNoMember(SC_UNO_PAGE_PAPERTRAY, ++i,nBound, cppu::UnoType<OUString>::get(), &sPaperTray);
376 registerPropertyNoMember(SC_UNO_PAGE_RIGHTBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
377 registerPropertyNoMember(SC_UNO_PAGE_RIGHTBRDDIST,++i,nBound, cppu::UnoType<sal_Int32>::get(), &nZero);
378 registerPropertyNoMember(PROPERTY_RIGHTMARGIN, ++i,beans::PropertyAttribute::BOUND,::cppu::UnoType<sal_Int32>::get(), &nMargin);
379 registerPropertyNoMember(SC_UNO_PAGE_SCALETOPAG, ++i,nBound, cppu::UnoType<sal_Int16>::get(), &n16Zero);
380 registerPropertyNoMember(SC_UNO_PAGE_SCALETOX, ++i,nBound, cppu::UnoType<sal_Int16>::get(), &n16Zero);
381 registerPropertyNoMember(SC_UNO_PAGE_SCALETOY, ++i,nBound, cppu::UnoType<sal_Int16>::get(), &n16Zero);
382 registerPropertyNoMember(SC_UNO_PAGE_SHADOWFORM, ++i,nBound, cppu::UnoType<table::ShadowFormat>::get(), &eShadowFormat);
383 registerProperty(PROPERTY_PAPERSIZE, ++i,beans::PropertyAttribute::BOUND,&m_aSize, cppu::UnoType<awt::Size>::get() );
384 registerPropertyNoMember(SC_UNO_PAGE_TOPBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), &eBorderLine);
385 registerPropertyNoMember(SC_UNO_PAGE_TOPBRDDIST, ++i,nBound,::cppu::UnoType<sal_Int32>::get(), &nZero);
386 registerPropertyNoMember(PROPERTY_TOPMARGIN, ++i,nBound,::cppu::UnoType<sal_Int32>::get(), &nMargin);
387 uno::Reference< container::XNameContainer> xAttribs = ::comphelper::NameContainer_createInstance(cppu::UnoType<xml::AttributeData>::get());
388 registerPropertyNoMember("UserDefinedAttributes", ++i,nBound, cppu::UnoType<container::XNameContainer>::get(), &xAttribs);
389 registerProperty(PROPERTY_WIDTH, ++i,nBound,&m_aSize.Width, cppu::UnoType<sal_Int32>::get() );
390 registerPropertyNoMember("PrinterName", ++i,nBound, cppu::UnoType<OUString>::get(), &sEmpty);
391 uno::Sequence<sal_Int8> aSe;
392 registerPropertyNoMember("PrinterSetup", ++i,nBound,cppu::UnoType<uno::Sequence<sal_Int8>>::get(),&aSe);
397 IMPLEMENT_FORWARD_XINTERFACE2(OStyle,TStyleBASE,OStyle_PBASE)
399 uno::Reference< beans::XPropertySetInfo> SAL_CALL OStyle::getPropertySetInfo() throw(uno::RuntimeException, std::exception)
401 return createPropertySetInfo( getInfoHelper() );
404 void OStyle::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, uno::Any& /*_rDefault*/ ) const
408 ::cppu::IPropertyArrayHelper& OStyle::getInfoHelper()
410 return *getArrayHelper();
413 ::cppu::IPropertyArrayHelper* OStyle::createArrayHelper( ) const
415 uno::Sequence< beans::Property > aProps;
416 describeProperties(aProps);
417 return new ::cppu::OPropertyArrayHelper(aProps);
420 // XStyle
421 sal_Bool SAL_CALL OStyle::isUserDefined( ) throw (uno::RuntimeException, std::exception)
423 return sal_False;
426 sal_Bool SAL_CALL OStyle::isInUse( ) throw (uno::RuntimeException, std::exception)
428 return sal_True;
431 OUString SAL_CALL OStyle::getParentStyle( ) throw (uno::RuntimeException, std::exception)
433 return OUString();
436 void SAL_CALL OStyle::setParentStyle( const OUString& /*aParentStyle*/ ) throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
440 // XNamed
441 OUString SAL_CALL OStyle::getName( ) throw (uno::RuntimeException, std::exception)
443 OUString sName;
444 getPropertyValue(PROPERTY_NAME) >>= sName;
445 return sName;
448 void SAL_CALL OStyle::setName( const OUString& aName ) throw (uno::RuntimeException, std::exception)
450 setPropertyValue(PROPERTY_NAME,uno::makeAny(aName));
453 void SAL_CALL OStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException, std::exception)
457 void SAL_CALL OStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
459 const OUString* pIter = aPropertyNames.getConstArray();
460 const OUString* pEnd = pIter + aPropertyNames.getLength();
461 for(;pIter != pEnd;++pIter)
462 setPropertyToDefault(*pIter);
465 uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
467 uno::Sequence< uno::Any > aRet(aPropertyNames.getLength());
468 const OUString* pIter = aPropertyNames.getConstArray();
469 const OUString* pEnd = pIter + aPropertyNames.getLength();
470 for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
471 aRet[i] = getPropertyDefault(*pIter);
472 return aRet;
475 struct OReportDefinitionImpl
477 uno::WeakReference< uno::XInterface > m_xParent;
478 ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners;
479 ::cppu::OInterfaceContainerHelper m_aCloseListener;
480 ::cppu::OInterfaceContainerHelper m_aModifyListeners;
481 ::cppu::OInterfaceContainerHelper m_aDocEventListeners;
482 ::std::vector< uno::Reference< frame::XController> > m_aControllers;
483 uno::Sequence< beans::PropertyValue > m_aArgs;
485 uno::Reference< report::XGroups > m_xGroups;
486 uno::Reference< report::XSection> m_xReportHeader;
487 uno::Reference< report::XSection> m_xReportFooter;
488 uno::Reference< report::XSection> m_xPageHeader;
489 uno::Reference< report::XSection> m_xPageFooter;
490 uno::Reference< report::XSection> m_xDetail;
491 uno::Reference< embed::XStorage > m_xStorage;
492 uno::Reference< frame::XController > m_xCurrentController;
493 uno::Reference< container::XIndexAccess > m_xViewData;
494 uno::Reference< container::XNameAccess > m_xStyles;
495 uno::Reference< container::XNameAccess> m_xXMLNamespaceMap;
496 uno::Reference< container::XNameAccess> m_xGradientTable;
497 uno::Reference< container::XNameAccess> m_xHatchTable;
498 uno::Reference< container::XNameAccess> m_xBitmapTable;
499 uno::Reference< container::XNameAccess> m_xTransparencyGradientTable;
500 uno::Reference< container::XNameAccess> m_xDashTable;
501 uno::Reference< container::XNameAccess> m_xMarkerTable;
502 uno::Reference< report::XFunctions > m_xFunctions;
503 uno::Reference< ui::XUIConfigurationManager2> m_xUIConfigurationManager;
504 uno::Reference< util::XNumberFormatsSupplier> m_xNumberFormatsSupplier;
505 uno::Reference< sdbc::XConnection> m_xActiveConnection;
506 uno::Reference< frame::XTitle > m_xTitleHelper;
507 uno::Reference< frame::XUntitledNumbers > m_xNumberedControllers;
508 uno::Reference< document::XDocumentProperties > m_xDocumentProperties;
510 ::boost::shared_ptr< ::comphelper::EmbeddedObjectContainer>
511 m_pObjectContainer;
512 ::boost::shared_ptr<rptui::OReportModel> m_pReportModel;
513 ::rtl::Reference< ::dbaui::UndoManager > m_pUndoManager;
514 OUString m_sCaption;
515 OUString m_sCommand;
516 OUString m_sFilter;
517 OUString m_sMimeType;
518 OUString m_sIdentifier;
519 OUString m_sDataSourceName;
520 awt::Size m_aVisualAreaSize;
521 ::sal_Int64 m_nAspect;
522 ::sal_Int16 m_nGroupKeepTogether;
523 ::sal_Int16 m_nPageHeaderOption;
524 ::sal_Int16 m_nPageFooterOption;
525 ::sal_Int32 m_nCommandType;
526 bool m_bControllersLocked;
527 bool m_bModified;
528 bool m_bEscapeProcessing;
529 bool m_bSetModifiedEnabled;
531 OReportDefinitionImpl(::osl::Mutex& _aMutex)
532 :m_aStorageChangeListeners(_aMutex)
533 ,m_aCloseListener(_aMutex)
534 ,m_aModifyListeners(_aMutex)
535 ,m_aDocEventListeners(_aMutex)
536 ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII)
537 ,m_sIdentifier(SERVICE_REPORTDEFINITION)
538 // default visual area is 8 x 7 cm
539 ,m_aVisualAreaSize( 8000, 7000 )
540 ,m_nAspect(embed::Aspects::MSOLE_CONTENT)
541 ,m_nGroupKeepTogether(0)
542 ,m_nPageHeaderOption(0)
543 ,m_nPageFooterOption(0)
544 ,m_nCommandType(sdb::CommandType::TABLE)
545 ,m_bControllersLocked(false)
546 ,m_bModified(false)
547 ,m_bEscapeProcessing(true)
548 ,m_bSetModifiedEnabled( true )
551 ~OReportDefinitionImpl();
554 OReportDefinitionImpl::~OReportDefinitionImpl()
558 OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext)
559 : ReportDefinitionBase(m_aMutex)
560 ,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >())
561 ,m_aProps(new OReportComponentProperties(_xContext))
562 ,m_pImpl(new OReportDefinitionImpl(m_aMutex))
564 m_aProps->m_sName = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager());
565 osl_atomic_increment(&m_refCount);
567 init();
568 m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
569 m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
570 m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
572 osl_atomic_decrement( &m_refCount );
575 OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext
576 ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
577 ,uno::Reference< drawing::XShape >& _xShape)
578 : ReportDefinitionBase(m_aMutex)
579 ,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >())
580 ,m_aProps(new OReportComponentProperties(_xContext))
581 ,m_pImpl(new OReportDefinitionImpl(m_aMutex))
583 m_aProps->m_sName = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager());
584 m_aProps->m_xFactory = _xFactory;
585 osl_atomic_increment(&m_refCount);
587 m_aProps->setShape(_xShape,this,m_refCount);
588 init();
589 m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
590 m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
591 m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
593 osl_atomic_decrement( &m_refCount );
596 OReportDefinition::~OReportDefinition()
598 if ( !ReportDefinitionBase::rBHelper.bInDispose && !ReportDefinitionBase::rBHelper.bDisposed )
600 acquire();
601 dispose();
605 IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition, ReportDefinitionBase )
606 void OReportDefinition::init()
610 m_pImpl->m_pReportModel.reset(new OReportModel(this));
611 m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges();
612 m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM );
613 SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin();
614 rAdmin.NewStandardLayer(RPT_LAYER_FRONT);
615 rAdmin.NewLayer(OUString("back"), RPT_LAYER_BACK);
616 rAdmin.NewLayer(OUString("HiddenLayer"), RPT_LAYER_HIDDEN);
618 m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex );
619 m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() );
621 m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext);
622 if ( !m_pImpl->m_xStorage.is() )
623 m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
625 uno::Reference<beans::XPropertySet> xStorProps(m_pImpl->m_xStorage,uno::UNO_QUERY);
626 if ( xStorProps.is())
628 OUString sMediaType;
629 xStorProps->getPropertyValue("MediaType") >>= sMediaType;
630 if ( sMediaType.isEmpty() )
631 xStorProps->setPropertyValue("MediaType",uno::makeAny<OUString>(MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII));
633 m_pImpl->m_pObjectContainer.reset( new comphelper::EmbeddedObjectContainer(m_pImpl->m_xStorage , static_cast<cppu::OWeakObject*>(this) ) );
635 catch (const uno::Exception&)
637 DBG_UNHANDLED_EXCEPTION();
641 void SAL_CALL OReportDefinition::dispose() throw(uno::RuntimeException, std::exception)
643 ReportDefinitionPropertySet::dispose();
644 cppu::WeakComponentImplHelperBase::dispose();
647 void SAL_CALL OReportDefinition::disposing()
649 notifyEvent(OUString("OnUnload"));
651 uno::Reference< frame::XModel > xHoldAlive( this );
653 lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
654 m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent );
655 m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent );
656 m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent );
657 m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent );
659 // SYNCHRONIZED --->
661 SolarMutexGuard aSolarGuard;
662 ::osl::ResettableMutexGuard aGuard(m_aMutex);
664 m_pImpl->m_aControllers.clear();
666 ::comphelper::disposeComponent(m_pImpl->m_xGroups);
667 m_pImpl->m_xReportHeader.clear();
668 m_pImpl->m_xReportFooter.clear();
669 m_pImpl->m_xPageHeader.clear();
670 m_pImpl->m_xPageFooter.clear();
671 m_pImpl->m_xDetail.clear();
672 ::comphelper::disposeComponent(m_pImpl->m_xFunctions);
674 //::comphelper::disposeComponent(m_pImpl->m_xStorage);
675 // don't dispose, this currently is the task of either the ref count going to
676 // 0, or of the embedded object (if we're embedded, which is the only possible
677 // case so far)
678 // #i78366#
679 m_pImpl->m_xStorage.clear();
680 m_pImpl->m_xViewData.clear();
681 m_pImpl->m_xCurrentController.clear();
682 m_pImpl->m_xNumberFormatsSupplier.clear();
683 m_pImpl->m_xStyles.clear();
684 m_pImpl->m_xXMLNamespaceMap.clear();
685 m_pImpl->m_xGradientTable.clear();
686 m_pImpl->m_xHatchTable.clear();
687 m_pImpl->m_xBitmapTable.clear();
688 m_pImpl->m_xTransparencyGradientTable.clear();
689 m_pImpl->m_xDashTable.clear();
690 m_pImpl->m_xMarkerTable.clear();
691 m_pImpl->m_xUIConfigurationManager.clear();
692 m_pImpl->m_pReportModel.reset();
693 m_pImpl->m_pObjectContainer.reset();
694 m_pImpl->m_aArgs.realloc(0);
695 m_pImpl->m_xTitleHelper.clear();
696 m_pImpl->m_xNumberedControllers.clear();
698 // <--- SYNCHRONIZED
702 OUString OReportDefinition::getImplementationName_Static( ) throw(uno::RuntimeException)
704 return OUString("com.sun.star.comp.report.OReportDefinition");
707 OUString SAL_CALL OReportDefinition::getImplementationName( ) throw(uno::RuntimeException, std::exception)
709 return getImplementationName_Static();
712 uno::Sequence< OUString > OReportDefinition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException)
714 uno::Sequence< OUString > aServices(1);
715 aServices.getArray()[0] = SERVICE_REPORTDEFINITION;
717 return aServices;
720 uno::Sequence< OUString > SAL_CALL OReportDefinition::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception)
722 // first collect the services which are supported by our aggregate
723 uno::Sequence< OUString > aSupported;
724 if ( m_aProps->m_xServiceInfo.is() )
725 aSupported = m_aProps->m_xServiceInfo->getSupportedServiceNames();
727 // append our own service, if necessary
728 if ( 0 == ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION, true ).getLength() )
730 sal_Int32 nLen = aSupported.getLength();
731 aSupported.realloc( nLen + 1 );
732 aSupported[ nLen ] = SERVICE_REPORTDEFINITION;
735 // outta here
736 return aSupported;
739 sal_Bool SAL_CALL OReportDefinition::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
741 return cppu::supportsService(this, _rServiceName);
744 uno::Any SAL_CALL OReportDefinition::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException, std::exception)
746 uno::Any aReturn = ReportDefinitionBase::queryInterface(_rType);
747 if ( !aReturn.hasValue() )
748 aReturn = ReportDefinitionPropertySet::queryInterface(_rType);
750 return aReturn.hasValue() ? aReturn : (m_aProps->m_xProxy.is() ? m_aProps->m_xProxy->queryAggregation(_rType) : aReturn);
752 uno::Sequence< uno::Type > SAL_CALL OReportDefinition::getTypes( ) throw (uno::RuntimeException, std::exception)
754 if ( m_aProps->m_xTypeProvider.is() )
755 return ::comphelper::concatSequences(
756 ReportDefinitionBase::getTypes(),
757 m_aProps->m_xTypeProvider->getTypes()
759 return ReportDefinitionBase::getTypes();
762 uno::Reference< uno::XInterface > OReportDefinition::create(uno::Reference< uno::XComponentContext > const & xContext)
764 return *(new OReportDefinition(xContext));
767 // XReportDefinition
768 OUString SAL_CALL OReportDefinition::getCaption() throw (uno::RuntimeException, std::exception)
770 ::osl::MutexGuard aGuard(m_aMutex);
771 return m_pImpl->m_sCaption;
774 void SAL_CALL OReportDefinition::setCaption( const OUString& _caption ) throw (uno::RuntimeException, std::exception)
776 set(PROPERTY_CAPTION,_caption,m_pImpl->m_sCaption);
779 ::sal_Int16 SAL_CALL OReportDefinition::getGroupKeepTogether() throw (uno::RuntimeException, std::exception)
781 ::osl::MutexGuard aGuard(m_aMutex);
782 return m_pImpl->m_nGroupKeepTogether;
785 void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether ) throw (uno::RuntimeException, std::exception)
787 if ( _groupkeeptogether < report::GroupKeepTogether::PER_PAGE || _groupkeeptogether > report::GroupKeepTogether::PER_COLUMN )
788 throwIllegallArgumentException("com::sun::star::report::GroupKeepTogether"
789 ,*this
791 ,m_aProps->m_xContext);
792 set(PROPERTY_GROUPKEEPTOGETHER,_groupkeeptogether,m_pImpl->m_nGroupKeepTogether);
795 ::sal_Int16 SAL_CALL OReportDefinition::getPageHeaderOption() throw (uno::RuntimeException, std::exception)
797 ::osl::MutexGuard aGuard(m_aMutex);
798 return m_pImpl->m_nPageHeaderOption;
801 void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption ) throw (uno::RuntimeException, std::exception)
803 if ( _pageheaderoption < report::ReportPrintOption::ALL_PAGES || _pageheaderoption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
804 throwIllegallArgumentException("com::sun::star::report::ReportPrintOption"
805 ,*this
807 ,m_aProps->m_xContext);
808 set(PROPERTY_PAGEHEADEROPTION,_pageheaderoption,m_pImpl->m_nPageHeaderOption);
811 ::sal_Int16 SAL_CALL OReportDefinition::getPageFooterOption() throw (uno::RuntimeException, std::exception)
813 ::osl::MutexGuard aGuard(m_aMutex);
814 return m_pImpl->m_nPageFooterOption;
817 void SAL_CALL OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption ) throw (uno::RuntimeException, std::exception)
819 if ( _pagefooteroption < report::ReportPrintOption::ALL_PAGES || _pagefooteroption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
820 throwIllegallArgumentException("com::sun::star::report::ReportPrintOption"
821 ,*this
823 ,m_aProps->m_xContext);
824 set(PROPERTY_PAGEFOOTEROPTION,_pagefooteroption,m_pImpl->m_nPageFooterOption);
827 OUString SAL_CALL OReportDefinition::getCommand() throw (uno::RuntimeException, std::exception)
829 ::osl::MutexGuard aGuard(m_aMutex);
830 return m_pImpl->m_sCommand;
833 void SAL_CALL OReportDefinition::setCommand( const OUString& _command ) throw (uno::RuntimeException, std::exception)
835 set(PROPERTY_COMMAND,_command,m_pImpl->m_sCommand);
838 ::sal_Int32 SAL_CALL OReportDefinition::getCommandType() throw (uno::RuntimeException, std::exception)
840 ::osl::MutexGuard aGuard(m_aMutex);
841 return m_pImpl->m_nCommandType;
844 void SAL_CALL OReportDefinition::setCommandType( ::sal_Int32 _commandtype ) throw (uno::RuntimeException, std::exception)
846 if ( _commandtype < sdb::CommandType::TABLE || _commandtype > sdb::CommandType::COMMAND )
847 throwIllegallArgumentException("com::sun::star::sdb::CommandType"
848 ,*this
850 ,m_aProps->m_xContext);
851 set(PROPERTY_COMMANDTYPE,_commandtype,m_pImpl->m_nCommandType);
854 OUString SAL_CALL OReportDefinition::getFilter() throw (uno::RuntimeException, std::exception)
856 ::osl::MutexGuard aGuard(m_aMutex);
857 return m_pImpl->m_sFilter;
860 void SAL_CALL OReportDefinition::setFilter( const OUString& _filter ) throw (uno::RuntimeException, std::exception)
862 set(PROPERTY_FILTER,_filter,m_pImpl->m_sFilter);
865 sal_Bool SAL_CALL OReportDefinition::getEscapeProcessing() throw (uno::RuntimeException, std::exception)
867 ::osl::MutexGuard aGuard(m_aMutex);
868 return m_pImpl->m_bEscapeProcessing;
871 void SAL_CALL OReportDefinition::setEscapeProcessing( sal_Bool _escapeprocessing ) throw (uno::RuntimeException, std::exception)
873 set(PROPERTY_ESCAPEPROCESSING,_escapeprocessing,m_pImpl->m_bEscapeProcessing);
876 sal_Bool SAL_CALL OReportDefinition::getReportHeaderOn() throw (uno::RuntimeException, std::exception)
878 ::osl::MutexGuard aGuard(m_aMutex);
879 return m_pImpl->m_xReportHeader.is();
882 void SAL_CALL OReportDefinition::setReportHeaderOn( sal_Bool _reportheaderon ) throw (uno::RuntimeException, std::exception)
884 if ( bool(_reportheaderon) != m_pImpl->m_xReportHeader.is() )
886 setSection(PROPERTY_REPORTHEADERON,_reportheaderon,RPT_RESSTRING(RID_STR_REPORT_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportHeader);
890 sal_Bool SAL_CALL OReportDefinition::getReportFooterOn() throw (uno::RuntimeException, std::exception)
892 ::osl::MutexGuard aGuard(m_aMutex);
893 return m_pImpl->m_xReportFooter.is();
896 void SAL_CALL OReportDefinition::setReportFooterOn( sal_Bool _reportfooteron ) throw (uno::RuntimeException, std::exception)
898 if ( bool(_reportfooteron) != m_pImpl->m_xReportFooter.is() )
900 setSection(PROPERTY_REPORTFOOTERON,_reportfooteron,RPT_RESSTRING(RID_STR_REPORT_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportFooter);
904 sal_Bool SAL_CALL OReportDefinition::getPageHeaderOn() throw (uno::RuntimeException, std::exception)
906 ::osl::MutexGuard aGuard(m_aMutex);
907 return m_pImpl->m_xPageHeader.is();
910 void SAL_CALL OReportDefinition::setPageHeaderOn( sal_Bool _pageheaderon ) throw (uno::RuntimeException, std::exception)
912 if ( bool(_pageheaderon) != m_pImpl->m_xPageHeader.is() )
914 setSection(PROPERTY_PAGEHEADERON,_pageheaderon,RPT_RESSTRING(RID_STR_PAGE_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageHeader);
918 sal_Bool SAL_CALL OReportDefinition::getPageFooterOn() throw (uno::RuntimeException, std::exception)
920 ::osl::MutexGuard aGuard(m_aMutex);
921 return m_pImpl->m_xPageFooter.is();
924 void SAL_CALL OReportDefinition::setPageFooterOn( sal_Bool _pagefooteron ) throw (uno::RuntimeException, std::exception)
926 if ( bool(_pagefooteron) != m_pImpl->m_xPageFooter.is() )
928 setSection(PROPERTY_PAGEFOOTERON,_pagefooteron,RPT_RESSTRING(RID_STR_PAGE_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageFooter);
932 uno::Reference< report::XGroups > SAL_CALL OReportDefinition::getGroups() throw (uno::RuntimeException, std::exception)
934 ::osl::MutexGuard aGuard(m_aMutex);
935 return m_pImpl->m_xGroups;
938 uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportHeader() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
940 ::osl::MutexGuard aGuard(m_aMutex);
941 if ( !m_pImpl->m_xReportHeader.is() )
942 throw container::NoSuchElementException();
943 return m_pImpl->m_xReportHeader;
946 uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageHeader() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
948 ::osl::MutexGuard aGuard(m_aMutex);
949 if ( !m_pImpl->m_xPageHeader.is() )
950 throw container::NoSuchElementException();
951 return m_pImpl->m_xPageHeader;
954 uno::Reference< report::XSection > SAL_CALL OReportDefinition::getDetail() throw (uno::RuntimeException, std::exception)
956 ::osl::MutexGuard aGuard(m_aMutex);
957 return m_pImpl->m_xDetail;
960 uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageFooter() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
962 ::osl::MutexGuard aGuard(m_aMutex);
963 if ( !m_pImpl->m_xPageFooter.is() )
964 throw container::NoSuchElementException();
965 return m_pImpl->m_xPageFooter;
968 uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportFooter() throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
970 ::osl::MutexGuard aGuard(m_aMutex);
971 if ( !m_pImpl->m_xReportFooter.is() )
972 throw container::NoSuchElementException();
973 return m_pImpl->m_xReportFooter;
976 uno::Reference< document::XEventBroadcaster > SAL_CALL OReportDefinition::getEventBroadcaster( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException, std::exception)
978 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
979 return this;
982 // XReportComponent
983 REPORTCOMPONENT_MASTERDETAIL(OReportDefinition,*m_aProps)
984 REPORTCOMPONENT_IMPL(OReportDefinition,*m_aProps)
985 REPORTCOMPONENT_IMPL2(OReportDefinition,*m_aProps)
987 uno::Reference< beans::XPropertySetInfo > SAL_CALL OReportDefinition::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
989 return ReportDefinitionPropertySet::getPropertySetInfo();
992 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)
994 ReportDefinitionPropertySet::setPropertyValue( aPropertyName, aValue );
997 uno::Any SAL_CALL OReportDefinition::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
999 return ReportDefinitionPropertySet::getPropertyValue( PropertyName);
1002 void SAL_CALL OReportDefinition::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1004 ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
1007 void SAL_CALL OReportDefinition::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1009 ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
1012 void SAL_CALL OReportDefinition::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1014 ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName, aListener );
1017 void SAL_CALL OReportDefinition::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1019 ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
1022 // XChild
1023 uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getParent( ) throw (uno::RuntimeException, std::exception)
1025 ::osl::MutexGuard aGuard(m_aMutex);
1026 uno::Reference< container::XChild > xChild;
1027 comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
1028 if ( xChild.is() )
1029 return xChild->getParent();
1030 return m_pImpl->m_xParent;
1033 void SAL_CALL OReportDefinition::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
1035 ::osl::MutexGuard aGuard(m_aMutex);
1036 m_aProps->m_xParent = uno::Reference< container::XChild >(Parent,uno::UNO_QUERY);
1037 m_pImpl->m_xParent = Parent;
1038 uno::Reference< container::XChild > xChild;
1039 comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
1040 if ( xChild.is() )
1041 xChild->setParent(Parent);
1044 // XCloneable
1045 uno::Reference< util::XCloneable > SAL_CALL OReportDefinition::createClone( ) throw (uno::RuntimeException, std::exception)
1047 OSL_FAIL("Not yet implemented correctly");
1048 uno::Reference< report::XReportComponent> xSource = this;
1049 uno::Reference< report::XReportDefinition> xSet(cloneObject(xSource,m_aProps->m_xFactory,SERVICE_REPORTDEFINITION),uno::UNO_QUERY_THROW);
1050 return xSet.get();
1053 void OReportDefinition::setSection( const OUString& _sProperty
1054 ,const bool& _bOn
1055 ,const OUString& _sName
1056 ,uno::Reference< report::XSection>& _member)
1058 BoundListeners l;
1060 ::osl::MutexGuard aGuard(m_aMutex);
1061 prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l);
1062 lcl_createSectionIfNeeded(_bOn ,this,_member,_sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON);
1063 if ( _member.is() )
1064 _member->setName(_sName);
1066 l.notify();
1069 // XCloseBroadcaster
1070 void SAL_CALL OReportDefinition::addCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1072 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1073 if ( _xListener.is() )
1074 m_pImpl->m_aCloseListener.addInterface(_xListener);
1077 void SAL_CALL OReportDefinition::removeCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1079 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1080 m_pImpl->m_aCloseListener.removeInterface(_xListener);
1083 // XCloseable
1084 void SAL_CALL OReportDefinition::close( sal_Bool _bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException, std::exception)
1086 SolarMutexGuard aSolarGuard;
1088 ::osl::ResettableMutexGuard aGuard(m_aMutex);
1089 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1090 // notify our container listeners
1091 lang::EventObject aEvt( static_cast< ::cppu::OWeakObject* >( this ) );
1092 aGuard.clear();
1093 m_pImpl->m_aCloseListener.forEach<util::XCloseListener>(
1094 ::boost::bind(&util::XCloseListener::queryClosing,_1,boost::cref(aEvt),boost::cref(_bDeliverOwnership)));
1095 aGuard.reset();
1098 ::std::vector< uno::Reference< frame::XController> > aCopy = m_pImpl->m_aControllers;
1099 ::std::vector< uno::Reference< frame::XController> >::iterator aIter = aCopy.begin();
1100 ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = aCopy.end();
1101 for (;aIter != aEnd ; ++aIter)
1103 if ( aIter->is() )
1107 uno::Reference< util::XCloseable> xFrame( (*aIter)->getFrame(), uno::UNO_QUERY );
1108 if ( xFrame.is() )
1109 xFrame->close( _bDeliverOwnership );
1111 catch (const util::CloseVetoException&) { throw; }
1112 catch (const uno::Exception&)
1114 OSL_FAIL( "ODatabaseDocument::impl_closeControllerFrames: caught an unexpected exception!" );
1119 aGuard.clear();
1120 m_pImpl->m_aCloseListener.notifyEach(&util::XCloseListener::notifyClosing,aEvt);
1121 aGuard.reset();
1123 dispose();
1126 // XModel
1127 sal_Bool SAL_CALL OReportDefinition::attachResource( const OUString& /*_rURL*/, const uno::Sequence< beans::PropertyValue >& _aArguments ) throw (uno::RuntimeException, std::exception)
1129 // LLA: we had a deadlock problem in our context, so we get the SolarMutex earlier.
1130 SolarMutexGuard aSolarGuard;
1132 ::osl::MutexGuard aGuard(m_aMutex);
1133 ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1134 utl::MediaDescriptor aDescriptor( _aArguments );
1136 m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false );
1139 fillArgs(aDescriptor);
1140 m_pImpl->m_pReportModel->SetModified(false);
1142 catch (...)
1144 m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
1145 throw;
1147 m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
1148 return sal_True;
1151 void OReportDefinition::fillArgs(utl::MediaDescriptor& _aDescriptor)
1153 uno::Sequence<beans::PropertyValue> aComponentData;
1154 aComponentData = _aDescriptor.getUnpackedValueOrDefault("ComponentData",aComponentData);
1155 if ( aComponentData.getLength() && (!m_pImpl->m_xActiveConnection.is() || !m_pImpl->m_xNumberFormatsSupplier.is()) )
1157 ::comphelper::SequenceAsHashMap aComponentDataMap( aComponentData );
1158 m_pImpl->m_xActiveConnection = aComponentDataMap.getUnpackedValueOrDefault("ActiveConnection",m_pImpl->m_xActiveConnection);
1159 m_pImpl->m_xNumberFormatsSupplier = dbtools::getNumberFormats(m_pImpl->m_xActiveConnection);
1161 if ( !m_pImpl->m_xNumberFormatsSupplier.is() )
1163 m_pImpl->m_xNumberFormatsSupplier.set( util::NumberFormatsSupplier::createWithDefaultLocale( m_aProps->m_xContext ) );
1165 lcl_stripLoadArguments( _aDescriptor, m_pImpl->m_aArgs );
1166 OUString sCaption;
1167 sCaption = _aDescriptor.getUnpackedValueOrDefault("DocumentTitle",sCaption);
1168 setCaption(sCaption);
1171 OUString SAL_CALL OReportDefinition::getURL( ) throw (uno::RuntimeException, std::exception)
1173 return OUString();
1176 uno::Sequence< beans::PropertyValue > SAL_CALL OReportDefinition::getArgs( ) throw (uno::RuntimeException, std::exception)
1178 ::osl::MutexGuard aGuard(m_aMutex);
1179 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1180 return m_pImpl->m_aArgs;
1183 void SAL_CALL OReportDefinition::connectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException, std::exception)
1185 ::osl::MutexGuard aGuard(m_aMutex);
1186 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1187 m_pImpl->m_aControllers.push_back(_xController);
1188 sal_Int32 nCount;
1189 if ( _xController.is() && m_pImpl->m_xViewData.is() && ( nCount = m_pImpl->m_xViewData->getCount()) != 0)
1191 _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1));
1195 void SAL_CALL OReportDefinition::disconnectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException, std::exception)
1197 ::osl::MutexGuard aGuard(m_aMutex);
1198 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1199 ::std::vector< uno::Reference< frame::XController> >::iterator aFind = ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController);
1200 if ( aFind != m_pImpl->m_aControllers.end() )
1201 m_pImpl->m_aControllers.erase(aFind);
1202 if ( m_pImpl->m_xCurrentController == _xController )
1203 m_pImpl->m_xCurrentController.clear();
1206 void SAL_CALL OReportDefinition::lockControllers( ) throw (uno::RuntimeException, std::exception)
1208 ::osl::MutexGuard aGuard(m_aMutex);
1209 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1210 m_pImpl->m_bControllersLocked = true;
1213 void SAL_CALL OReportDefinition::unlockControllers( ) throw (uno::RuntimeException, std::exception)
1215 ::osl::MutexGuard aGuard(m_aMutex);
1216 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1217 m_pImpl->m_bControllersLocked = false;
1220 sal_Bool SAL_CALL OReportDefinition::hasControllersLocked( ) throw (uno::RuntimeException, std::exception)
1222 ::osl::MutexGuard aGuard(m_aMutex);
1223 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1224 return m_pImpl->m_bControllersLocked;
1227 uno::Reference< frame::XController > SAL_CALL OReportDefinition::getCurrentController( ) throw (uno::RuntimeException, std::exception)
1229 ::osl::MutexGuard aGuard(m_aMutex);
1230 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1231 return m_pImpl->m_xCurrentController;
1234 void SAL_CALL OReportDefinition::setCurrentController( const uno::Reference< frame::XController >& _xController ) throw (container::NoSuchElementException, uno::RuntimeException, std::exception)
1236 ::osl::MutexGuard aGuard(m_aMutex);
1237 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1238 if ( ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController) == m_pImpl->m_aControllers.end() )
1239 throw container::NoSuchElementException();
1240 m_pImpl->m_xCurrentController = _xController;
1243 uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getCurrentSelection( ) throw (uno::RuntimeException, std::exception)
1245 return uno::Reference< uno::XInterface >();
1248 void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom,
1249 const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor )
1251 m_pImpl->m_xStorage = _xStorageToLoadFrom;
1253 utl::MediaDescriptor aDescriptor( _aMediaDescriptor );
1254 fillArgs(aDescriptor);
1255 aDescriptor.createItemIfMissing(OUString("Storage"),uno::makeAny(_xStorageToLoadFrom));
1257 uno::Sequence< uno::Any > aDelegatorArguments(_aMediaDescriptor.getLength());
1258 uno::Any* pIter = aDelegatorArguments.getArray();
1259 uno::Any* pEnd = pIter + aDelegatorArguments.getLength();
1260 for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
1262 *pIter <<= _aMediaDescriptor[i];
1264 sal_Int32 nPos = aDelegatorArguments.getLength();
1265 aDelegatorArguments.realloc(nPos+1);
1266 beans::PropertyValue aPropVal;
1267 aPropVal.Name = "Storage";
1268 aPropVal.Value <<= _xStorageToLoadFrom;
1269 aDelegatorArguments[nPos] <<= aPropVal;
1271 rptui::OXUndoEnvironment& rEnv = m_pImpl->m_pReportModel->GetUndoEnv();
1272 rptui::OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
1274 uno::Reference< document::XFilter > xFilter(
1275 m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(OUString("com.sun.star.comp.report.OReportFilter"),aDelegatorArguments,m_aProps->m_xContext),
1276 uno::UNO_QUERY_THROW );
1278 uno::Reference< document::XImporter> xImporter(xFilter,uno::UNO_QUERY_THROW);
1279 uno::Reference<XComponent> xComponent(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
1280 xImporter->setTargetDocument(xComponent);
1282 utl::MediaDescriptor aTemp;
1283 aTemp << aDelegatorArguments;
1284 xFilter->filter(aTemp.getAsConstPropertyValueList());
1286 lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
1287 m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
1291 // XStorageBasedDocument
1292 void SAL_CALL OReportDefinition::loadFromStorage( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom
1293 , const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor ) throw (lang::IllegalArgumentException, frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1295 ::osl::MutexGuard aGuard(m_aMutex);
1296 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1298 impl_loadFromStorage_nolck_throw( _xStorageToLoadFrom, _aMediaDescriptor );
1301 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)
1303 if ( !_xStorageToSaveTo.is() )
1304 throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
1306 SolarMutexGuard aSolarGuard;
1307 ::osl::MutexGuard aGuard(m_aMutex);
1308 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1309 // create XStatusIndicator
1310 uno::Reference<task::XStatusIndicator> xStatusIndicator;
1311 uno::Sequence< uno::Any > aDelegatorArguments;
1312 utl::MediaDescriptor aDescriptor( _aMediaDescriptor );
1313 lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, aDelegatorArguments );
1315 // properties
1316 uno::Sequence < beans::PropertyValue > aProps;
1318 // export sub streams for package, else full stream into a file
1319 bool bWarn = false, bErr = false;
1320 OUString sWarnFile, sErrFile;
1322 uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY);
1323 if ( xProp.is() )
1325 static const char sPropName[] = "MediaType";
1326 OUString sOldMediaType;
1327 xProp->getPropertyValue(sPropName) >>= sOldMediaType;
1328 if ( !xProp->getPropertyValue(sPropName).hasValue() || sOldMediaType.isEmpty() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII != sOldMediaType )
1329 xProp->setPropertyValue( sPropName, uno::makeAny<OUString>(MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII) );
1332 /** property map for export info set */
1333 comphelper::PropertyMapEntry const aExportInfoMap[] =
1335 { OUString("UsePrettyPrinting") , 0, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
1336 { OUString("StreamName") , 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
1337 { OUString("StreamRelPath") , 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
1338 { OUString("BaseURI") , 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
1339 { OUString(), 0, css::uno::Type(), 0, 0 }
1341 uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
1343 SvtSaveOptions aSaveOpt;
1344 xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(aSaveOpt.IsPrettyPrinting()));
1345 if ( aSaveOpt.IsSaveRelFSys() )
1347 const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL(),OUString()) );
1348 xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sVal));
1350 const OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString()) );
1351 xInfoSet->setPropertyValue("StreamRelPath", uno::makeAny(sHierarchicalDocumentName));
1354 sal_Int32 nArgsLen = aDelegatorArguments.getLength();
1355 aDelegatorArguments.realloc(nArgsLen+1);
1356 aDelegatorArguments[nArgsLen++] <<= xInfoSet;
1358 uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
1359 uno::Reference< document::XGraphicObjectResolver > xGrfResolver;
1360 SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(_xStorageToSaveTo,GRAPHICHELPER_MODE_WRITE);
1361 xGrfResolver = pGraphicHelper;
1362 pGraphicHelper->release();
1363 SvXMLEmbeddedObjectHelper* pEmbeddedObjectHelper = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE );
1364 xObjectResolver = pEmbeddedObjectHelper;
1365 pEmbeddedObjectHelper->release();
1367 aDelegatorArguments.realloc(nArgsLen+2);
1368 aDelegatorArguments[nArgsLen++] <<= xGrfResolver;
1369 aDelegatorArguments[nArgsLen++] <<= xObjectResolver;
1371 uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
1372 if( !bErr )
1374 xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
1375 if( !WriteThroughComponent(
1376 xCom, "settings.xml",
1377 "com.sun.star.comp.report.XMLSettingsExporter",
1378 aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1380 if( !bWarn )
1382 bWarn = true;
1383 sWarnFile = "settings.xml";
1388 if( !bErr )
1390 xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("meta.xml")));
1391 if( !WriteThroughComponent(
1392 xCom, "meta.xml",
1393 "com.sun.star.comp.report.XMLMetaExporter",
1394 aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1396 if( !bWarn )
1398 bWarn = true;
1399 sWarnFile = "meta.xml";
1404 if( !bErr )
1406 xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("styles.xml")));
1407 if( !WriteThroughComponent(
1408 xCom, "styles.xml",
1409 "com.sun.star.comp.report.XMLStylesExporter",
1410 aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1412 if( !bWarn )
1414 bWarn = true;
1415 sWarnFile = "styles.xml";
1420 if ( !bErr )
1422 xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
1423 if( !WriteThroughComponent(
1424 xCom, "content.xml",
1425 "com.sun.star.comp.report.ExportFilter",
1426 aDelegatorArguments, aProps, _xStorageToSaveTo ) )
1428 bErr = true;
1429 sErrFile = "content.xml";
1433 uno::Any aImage;
1434 uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY);
1435 if ( xCurrentController.is() )
1437 xCurrentController->setVisualAreaSize(m_pImpl->m_nAspect,m_pImpl->m_aVisualAreaSize);
1438 aImage = xCurrentController->getPreferredVisualRepresentation( m_pImpl->m_nAspect ).Data;
1440 if ( aImage.hasValue() )
1442 OUString sObject1("report");
1443 OUString sPng("image/png");
1445 uno::Sequence<sal_Int8> aSeq;
1446 aImage >>= aSeq;
1447 uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq );
1448 m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng);
1451 if ( !bErr )
1453 bool bPersist = false;
1454 if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
1455 bPersist = m_pImpl->m_pObjectContainer->StoreChildren(true,false);
1456 else
1457 bPersist = m_pImpl->m_pObjectContainer->StoreAsChildren(true,true,_xStorageToSaveTo);
1459 if( bPersist )
1460 m_pImpl->m_pObjectContainer->SetPersistentEntries(m_pImpl->m_xStorage);
1463 uno::Reference<embed::XTransactedObject> xTransact(_xStorageToSaveTo,uno::UNO_QUERY);
1464 if ( xTransact.is() )
1465 xTransact->commit();
1467 catch (const uno::Exception&)
1469 OSL_FAIL("Exception Caught: Could not commit report storage!");
1470 throw io::IOException();
1473 if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
1474 setModified(sal_False);
1476 if ( xStatusIndicator.is() )
1477 xStatusIndicator->end();
1480 void SAL_CALL OReportDefinition::switchToStorage( const uno::Reference< embed::XStorage >& _xStorage ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1482 if ( !_xStorage.is() )
1483 throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
1485 ::osl::MutexGuard aGuard(m_aMutex);
1486 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1487 m_pImpl->m_xStorage = _xStorage;
1488 lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
1489 m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
1491 // notify our container listeners
1492 m_pImpl->m_aStorageChangeListeners.forEach<document::XStorageChangeListener>(
1493 ::boost::bind(&document::XStorageChangeListener::notifyStorageChange,_1,static_cast<OWeakObject*>(this),boost::cref(_xStorage)));
1496 uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentStorage( ) throw (io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1498 ::osl::MutexGuard aGuard(m_aMutex);
1499 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1500 return m_pImpl->m_xStorage;
1503 void SAL_CALL OReportDefinition::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException, std::exception)
1505 ::osl::MutexGuard aGuard(m_aMutex);
1506 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1507 if ( xListener.is() )
1508 m_pImpl->m_aStorageChangeListeners.addInterface(xListener);
1511 void SAL_CALL OReportDefinition::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException, std::exception)
1513 ::osl::MutexGuard aGuard(m_aMutex);
1514 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1515 m_pImpl->m_aStorageChangeListeners.removeInterface(xListener);
1518 bool OReportDefinition::WriteThroughComponent(
1519 const uno::Reference<lang::XComponent> & xComponent,
1520 const sal_Char* pStreamName,
1521 const sal_Char* pServiceName,
1522 const uno::Sequence<uno::Any> & rArguments,
1523 const uno::Sequence<beans::PropertyValue> & rMediaDesc,
1524 const uno::Reference<embed::XStorage>& _xStorageToSaveTo)
1526 OSL_ENSURE( NULL != pStreamName, "Need stream name!" );
1527 OSL_ENSURE( NULL != pServiceName, "Need service name!" );
1530 uno::Reference<embed::XStorage> xMyStorage = _xStorageToSaveTo;
1531 // open stream
1532 OUString sStreamName = OUString::createFromAscii( pStreamName );
1533 uno::Reference<io::XStream> xStream = xMyStorage->openStreamElement( sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
1534 if ( !xStream.is() )
1535 return false;
1536 uno::Reference<io::XOutputStream> xOutputStream = xStream->getOutputStream();
1537 OSL_ENSURE(xOutputStream.is(), "Can't create output stream in package!");
1538 if ( ! xOutputStream.is() )
1539 return false;
1541 uno::Reference<beans::XPropertySet> xStreamProp(xOutputStream,uno::UNO_QUERY);
1542 OSL_ENSURE(xStreamProp.is(),"No valid preoperty set for the output stream!");
1544 uno::Reference<io::XSeekable> xSeek(xStreamProp,uno::UNO_QUERY);
1545 if ( xSeek.is() )
1547 OSL_TRACE("Length of stream %i",(int)xSeek->getPosition());
1548 xSeek->seek(0);
1551 OUString aPropName("MediaType");
1552 OUString aMime("text/xml");
1553 uno::Any aAny;
1554 aAny <<= aMime;
1555 xStreamProp->setPropertyValue( aPropName, aAny );
1557 // encrypt all streams
1558 xStreamProp->setPropertyValue( "UseCommonStoragePasswordEncryption",
1559 uno::makeAny( true ) );
1561 // set buffer and create outputstream
1563 // write the stuff
1564 bool bRet = WriteThroughComponent(
1565 xOutputStream, xComponent,
1566 pServiceName, rArguments, rMediaDesc );
1567 // finally, commit stream.
1568 return bRet;
1570 catch (const uno::Exception&)
1572 throw;
1576 bool OReportDefinition::WriteThroughComponent(
1577 const uno::Reference<io::XOutputStream> & xOutputStream,
1578 const uno::Reference<lang::XComponent> & xComponent,
1579 const sal_Char* pServiceName,
1580 const uno::Sequence<uno::Any> & rArguments,
1581 const uno::Sequence<beans::PropertyValue> & rMediaDesc)
1583 OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" );
1584 OSL_ENSURE( xComponent.is(), "Need component!" );
1585 OSL_ENSURE( NULL != pServiceName, "Need component name!" );
1587 // get component
1588 uno::Reference< xml::sax::XWriter > xSaxWriter(
1589 xml::sax::Writer::create(m_aProps->m_xContext) );
1591 // connect XML writer to output stream
1592 xSaxWriter->setOutputStream( xOutputStream );
1594 // prepare arguments (prepend doc handler to given arguments)
1595 uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() );
1596 aArgs[0] <<= xSaxWriter;
1597 for(sal_Int32 i = 0; i < rArguments.getLength(); i++)
1598 aArgs[i+1] = rArguments[i];
1600 // get filter component
1601 uno::Reference< document::XExporter > xExporter(
1602 m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
1603 OUString::createFromAscii(pServiceName), aArgs,m_aProps->m_xContext), uno::UNO_QUERY);
1604 OSL_ENSURE( xExporter.is(),
1605 "can't instantiate export filter component" );
1606 if( !xExporter.is() )
1607 return false;
1609 // connect model and filter
1610 xExporter->setSourceDocument( xComponent );
1612 // filter!
1613 uno::Reference<document::XFilter> xFilter( xExporter, uno::UNO_QUERY );
1614 return xFilter->filter( rMediaDesc );
1617 // XLoadable
1618 void SAL_CALL OReportDefinition::initNew( ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1620 setPageHeaderOn( sal_True );
1621 setPageFooterOn( sal_True );
1624 void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue >& _rArguments ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
1626 ::osl::MutexGuard aGuard(m_aMutex);
1627 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1629 // TODO: this code is pretty similar to what happens in ODatabaseModelImpl::getOrCreateRootStorage,
1630 // perhaps we can share code here.
1632 ::comphelper::NamedValueCollection aArguments( _rArguments );
1634 // the source for the to-be-created storage: either an URL, or a stream
1635 uno::Reference< io::XInputStream > xStream;
1636 OUString sURL;
1638 if ( aArguments.has( "Stream" ) )
1640 aArguments.get_ensureType( "Stream", xStream );
1641 aArguments.remove( "Stream" );
1643 else if ( aArguments.has( "InputStream" ) )
1645 aArguments.get_ensureType( "InputStream", xStream );
1646 aArguments.remove( "InputStream" );
1649 if ( aArguments.has( "FileName" ) )
1651 aArguments.get_ensureType( "FileName", sURL );
1652 aArguments.remove( "FileName" );
1654 else if ( aArguments.has( "URL" ) )
1656 aArguments.get_ensureType( "URL", sURL );
1657 aArguments.remove( "URL" );
1660 uno::Any aStorageSource;
1661 if ( xStream.is() )
1662 aStorageSource <<= aStorageSource;
1663 else if ( !sURL.isEmpty() )
1664 aStorageSource <<= sURL;
1665 else
1666 throw lang::IllegalArgumentException(
1667 OUString( "No input source (URL or InputStream) found." ),
1668 // TODO: resource
1669 *this,
1673 uno::Reference< lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create( m_aProps->m_xContext ) );
1675 // open read-write per default, unless told otherwise in the MediaDescriptor
1676 uno::Reference< embed::XStorage > xDocumentStorage;
1677 const sal_Int32 nOpenModes[2] = {
1678 embed::ElementModes::READWRITE,
1679 embed::ElementModes::READ
1681 size_t nFirstOpenMode = 0;
1682 if ( aArguments.has( "ReadOnly" ) )
1684 bool bReadOnly = false;
1685 aArguments.get_ensureType( "ReadOnly", bReadOnly );
1686 nFirstOpenMode = bReadOnly ? 1 : 0;
1688 const size_t nLastOpenMode = sizeof( nOpenModes ) / sizeof( nOpenModes[0] ) - 1;
1689 for ( size_t i=nFirstOpenMode; i <= nLastOpenMode; ++i )
1691 uno::Sequence< uno::Any > aStorageCreationArgs(2);
1692 aStorageCreationArgs[0] = aStorageSource;
1693 aStorageCreationArgs[1] <<= nOpenModes[i];
1697 xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), uno::UNO_QUERY_THROW );
1699 catch (const uno::Exception&)
1701 if ( i == nLastOpenMode )
1702 throw lang::WrappedTargetException(
1703 OUString( "An error occurred while creating the document storage." ),
1704 // TODO: resource
1705 *this,
1706 ::cppu::getCaughtException()
1711 if ( !xDocumentStorage.is() )
1713 throw uno::RuntimeException();
1716 impl_loadFromStorage_nolck_throw( xDocumentStorage, aArguments.getPropertyValues() );
1717 // TODO: do we need to take ownership of the storage? In opposite to loadFromStorage, we created the storage
1718 // ourself here, and perhaps this means we're also responsible for it ...?
1721 // XVisualObject
1722 void SAL_CALL OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException, std::exception)
1724 ::osl::MutexGuard aGuard(m_aMutex);
1725 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1726 bool bChanged =
1727 (m_pImpl->m_aVisualAreaSize.Width != _aSize.Width ||
1728 m_pImpl->m_aVisualAreaSize.Height != _aSize.Height);
1729 m_pImpl->m_aVisualAreaSize = _aSize;
1730 if( bChanged )
1731 setModified( sal_True );
1732 m_pImpl->m_nAspect = _nAspect;
1735 awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException, std::exception)
1737 ::osl::MutexGuard aGuard(m_aMutex);
1738 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1739 return m_pImpl->m_aVisualAreaSize;
1742 embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException, std::exception)
1744 ::osl::MutexGuard aGuard(m_aMutex);
1745 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1746 embed::VisualRepresentation aResult;
1747 OUString sImageName("report");
1748 OUString sMimeType;
1749 uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType);
1750 if ( xStream.is() )
1752 uno::Sequence<sal_Int8> aSeq;
1753 xStream->readBytes(aSeq,xStream->available());
1754 xStream->closeInput();
1755 aResult.Data <<= aSeq;
1756 aResult.Flavor.MimeType = sMimeType;
1757 aResult.Flavor.DataType = cppu::UnoType<decltype(aSeq)>::get();
1760 return aResult;
1763 ::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException, std::exception)
1765 return embed::EmbedMapUnits::ONE_100TH_MM;
1768 // XModifiable
1769 sal_Bool SAL_CALL OReportDefinition::disableSetModified( ) throw (uno::RuntimeException, std::exception)
1771 ::osl::MutexGuard aGuard( m_aMutex );
1772 ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1774 const bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
1775 m_pImpl->m_bSetModifiedEnabled = false;
1776 return bWasEnabled;
1779 sal_Bool SAL_CALL OReportDefinition::enableSetModified( ) throw (uno::RuntimeException, std::exception)
1781 ::osl::MutexGuard aGuard( m_aMutex );
1782 ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1784 const bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
1785 m_pImpl->m_bSetModifiedEnabled = true;
1786 return bWasEnabled;
1789 sal_Bool SAL_CALL OReportDefinition::isSetModifiedEnabled( ) throw (uno::RuntimeException, std::exception)
1791 ::osl::MutexGuard aGuard( m_aMutex );
1792 ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
1794 return m_pImpl->m_bSetModifiedEnabled;
1797 // XModifiable
1798 sal_Bool SAL_CALL OReportDefinition::isModified( ) throw (uno::RuntimeException, std::exception)
1800 ::osl::MutexGuard aGuard(m_aMutex);
1801 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1802 return m_pImpl->m_bModified;
1805 void SAL_CALL OReportDefinition::setModified( sal_Bool _bModified ) throw (beans::PropertyVetoException, uno::RuntimeException, std::exception)
1807 ::osl::ResettableMutexGuard aGuard(m_aMutex);
1808 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1810 if ( !m_pImpl->m_bSetModifiedEnabled )
1811 return;
1813 if ( m_pImpl->m_pReportModel->IsReadOnly() && _bModified )
1814 throw beans::PropertyVetoException();
1815 if ( m_pImpl->m_bModified != bool(_bModified) )
1817 m_pImpl->m_bModified = _bModified;
1818 if ( m_pImpl->m_pReportModel->IsChanged() != bool(_bModified) )
1819 m_pImpl->m_pReportModel->SetChanged(_bModified);
1821 lang::EventObject aEvent(*this);
1822 aGuard.clear();
1823 m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent);
1824 notifyEvent(OUString("OnModifyChanged"));
1828 // XModifyBroadcaster
1829 void SAL_CALL OReportDefinition::addModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1831 ::osl::MutexGuard aGuard(m_aMutex);
1832 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1833 if ( _xListener.is() )
1834 m_pImpl->m_aModifyListeners.addInterface(_xListener);
1837 void SAL_CALL OReportDefinition::removeModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1839 ::osl::MutexGuard aGuard(m_aMutex);
1840 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1841 m_pImpl->m_aModifyListeners.removeInterface(_xListener);
1844 void OReportDefinition::notifyEvent(const OUString& _sEventName)
1848 ::osl::ResettableMutexGuard aGuard(m_aMutex);
1849 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1850 document::EventObject aEvt(*this, _sEventName);
1851 aGuard.clear();
1852 m_pImpl->m_aDocEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt);
1854 catch (const uno::Exception&)
1859 // document::XEventBroadcaster
1860 void SAL_CALL OReportDefinition::addEventListener(const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1862 ::osl::MutexGuard aGuard(m_aMutex);
1863 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1864 if ( _xListener.is() )
1865 m_pImpl->m_aDocEventListeners.addInterface(_xListener);
1868 void SAL_CALL OReportDefinition::removeEventListener( const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException, std::exception)
1870 ::osl::MutexGuard aGuard(m_aMutex);
1871 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1872 m_pImpl->m_aDocEventListeners.removeInterface(_xListener);
1875 // document::XEventListener
1876 void SAL_CALL OReportDefinition::notifyEvent( const document::EventObject& aEvent ) throw (uno::RuntimeException)
1878 // used only to forward external events (e.g. for doc creation) from the frame loader
1879 // to the global event broadcaster and all other interested doc event listener.
1880 notifyEvent(aEvent.EventName);
1883 // document::XViewDataSupplier
1884 uno::Reference< container::XIndexAccess > SAL_CALL OReportDefinition::getViewData( ) throw (uno::RuntimeException, std::exception)
1886 ::osl::MutexGuard aGuard(m_aMutex);
1887 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1888 if ( !m_pImpl->m_xViewData.is() )
1890 m_pImpl->m_xViewData.set( document::IndexedPropertyValues::create(m_aProps->m_xContext), uno::UNO_QUERY);
1891 uno::Reference< container::XIndexContainer > xContainer(m_pImpl->m_xViewData,uno::UNO_QUERY);
1892 ::std::vector< uno::Reference< frame::XController> >::iterator aIter = m_pImpl->m_aControllers.begin();
1893 ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = m_pImpl->m_aControllers.end();
1894 for (;aIter != aEnd ; ++aIter)
1896 if ( aIter->is() )
1900 xContainer->insertByIndex(xContainer->getCount(),(*aIter)->getViewData());
1902 catch (const uno::Exception&)
1909 return m_pImpl->m_xViewData;
1912 void SAL_CALL OReportDefinition::setViewData( const uno::Reference< container::XIndexAccess >& Data ) throw (uno::RuntimeException, std::exception)
1914 ::osl::MutexGuard aGuard(m_aMutex);
1915 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1916 m_pImpl->m_xViewData = Data;
1919 uno::Reference< report::XFunctions > SAL_CALL OReportDefinition::getFunctions() throw (uno::RuntimeException, std::exception)
1921 ::osl::MutexGuard aGuard(m_aMutex);
1922 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1923 return m_pImpl->m_xFunctions;
1926 uno::Reference< ui::XUIConfigurationManager > SAL_CALL OReportDefinition::getUIConfigurationManager( ) throw (uno::RuntimeException, std::exception)
1928 return uno::Reference< ui::XUIConfigurationManager >( getUIConfigurationManager2(), uno::UNO_QUERY_THROW );
1931 uno::Reference< ui::XUIConfigurationManager2 > OReportDefinition::getUIConfigurationManager2( ) throw (uno::RuntimeException)
1933 ::osl::MutexGuard aGuard(m_aMutex);
1934 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1936 if ( !m_pImpl->m_xUIConfigurationManager.is() )
1938 m_pImpl->m_xUIConfigurationManager = ui::UIConfigurationManager::create(m_aProps->m_xContext);
1940 uno::Reference< embed::XStorage > xConfigStorage;
1941 // initialize ui configuration manager with document substorage
1942 m_pImpl->m_xUIConfigurationManager->setStorage( xConfigStorage );
1945 return m_pImpl->m_xUIConfigurationManager;
1948 uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode ) throw (uno::RuntimeException, std::exception)
1950 ::osl::MutexGuard aGuard(m_aMutex);
1951 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1952 return m_pImpl->m_xStorage->openStorageElement(aStorageName, nMode);
1955 uno::Sequence< OUString > SAL_CALL OReportDefinition::getDocumentSubStoragesNames( ) throw (io::IOException, uno::RuntimeException, std::exception)
1957 ::osl::MutexGuard aGuard(m_aMutex);
1958 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1959 uno::Reference<container::XNameAccess> xNameAccess(m_pImpl->m_xStorage,uno::UNO_QUERY);
1960 return xNameAccess.is() ? xNameAccess->getElementNames() : uno::Sequence< OUString >();
1963 OUString SAL_CALL OReportDefinition::getMimeType() throw (uno::RuntimeException, std::exception)
1965 ::osl::MutexGuard aGuard(m_aMutex);
1966 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1967 return m_pImpl->m_sMimeType;
1970 void SAL_CALL OReportDefinition::setMimeType( const OUString& _mimetype ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
1972 ::osl::MutexGuard aGuard(m_aMutex);
1973 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1974 uno::Sequence< OUString > aList = getAvailableMimeTypes();
1975 const OUString* pEnd = aList.getConstArray()+aList.getLength();
1976 if ( ::std::find(aList.getConstArray(),pEnd,_mimetype) == pEnd )
1977 throwIllegallArgumentException("getAvailableMimeTypes()"
1978 ,*this
1980 ,m_aProps->m_xContext);
1981 set(PROPERTY_MIMETYPE,_mimetype,m_pImpl->m_sMimeType);
1984 uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException, std::exception)
1986 uno::Sequence< OUString > s_aList(2);
1987 s_aList[0] = MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII;
1988 s_aList[1] = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII;
1989 return s_aList;
1992 // com::sun::star::XUnoTunnel
1993 sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception)
1995 sal_Int64 nRet = 0;
1996 if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
1997 nRet = reinterpret_cast<sal_Int64>(this);
1998 else
2000 uno::Reference< lang::XUnoTunnel> xUnoTunnel(m_pImpl->m_xNumberFormatsSupplier,uno::UNO_QUERY);
2001 if ( xUnoTunnel.is() )
2002 nRet = xUnoTunnel->getSomething(rId);
2004 if ( !nRet )
2006 uno::Reference< lang::XUnoTunnel> xTunnel;
2007 ::comphelper::query_aggregation(m_aProps->m_xProxy,xTunnel);
2008 if ( xTunnel.is() )
2009 nRet = xTunnel->getSomething(rId);
2012 return nRet;
2015 uno::Sequence< sal_Int8 > SAL_CALL OReportDefinition::getImplementationId( ) throw (uno::RuntimeException, std::exception)
2017 return css::uno::Sequence<sal_Int8>();
2020 uno::Sequence< sal_Int8 > OReportDefinition::getUnoTunnelImplementationId()
2022 static ::cppu::OImplementationId * pId = 0;
2023 if (! pId)
2025 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
2026 if (! pId)
2028 static ::cppu::OImplementationId aId;
2029 pId = &aId;
2032 return pId->getImplementationId();
2035 uno::Reference< uno::XComponentContext > OReportDefinition::getContext()
2037 ::osl::MutexGuard aGuard(m_aMutex);
2038 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2039 return m_aProps->m_xContext;
2042 ::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel() const
2044 return m_pImpl->m_pReportModel;
2047 ::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition)
2049 ::boost::shared_ptr<rptui::OReportModel> pReportModel;
2050 uno::Reference< lang::XUnoTunnel > xUT( _xReportDefinition, uno::UNO_QUERY );
2051 if( xUT.is() )
2052 pReportModel = reinterpret_cast<OReportDefinition*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( OReportDefinition::getUnoTunnelImplementationId())))->getSdrModel();
2053 return pReportModel;
2056 uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs)
2057 throw( uno::Exception, uno::RuntimeException, std::exception )
2059 ::osl::MutexGuard aGuard(m_aMutex);
2060 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2062 uno::Reference< uno::XInterface > xRet;
2063 if ( aServiceSpecifier.startsWith( "com.sun.star.document.ImportEmbeddedObjectResolver") )
2065 uno::Reference< embed::XStorage > xStorage;
2066 const uno::Any* pIter = _aArgs.getConstArray();
2067 const uno::Any* pEnd = pIter + _aArgs.getLength();
2068 for(;pIter != pEnd ;++pIter)
2070 beans::NamedValue aValue;
2071 *pIter >>= aValue;
2072 if ( aValue.Name == "Storage" )
2073 aValue.Value >>= xStorage;
2075 m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage);
2076 xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
2078 return xRet;
2081 uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( const OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException, std::exception)
2083 ::osl::MutexGuard aGuard(m_aMutex);
2084 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2085 uno::Reference< drawing::XShape > xShape;
2086 if ( aServiceSpecifier.startsWith( "com.sun.star.report." ) )
2088 if ( aServiceSpecifier == SERVICE_SHAPE )
2089 xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.CustomShape"),uno::UNO_QUERY_THROW);
2090 else if ( aServiceSpecifier == SERVICE_FORMATTEDFIELD
2091 || aServiceSpecifier == SERVICE_FIXEDTEXT
2092 || aServiceSpecifier == SERVICE_FIXEDLINE
2093 || aServiceSpecifier == SERVICE_IMAGECONTROL )
2094 xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.ControlShape"),uno::UNO_QUERY_THROW);
2095 else
2096 xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.OLE2Shape"),uno::UNO_QUERY_THROW);
2098 else if ( aServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
2100 xShape.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier,m_aProps->m_xContext),uno::UNO_QUERY);
2102 else if ( aServiceSpecifier == "com.sun.star.style.PageStyle" ||
2103 aServiceSpecifier == "com.sun.star.style.FrameStyle" ||
2104 aServiceSpecifier == "com.sun.star.style.GraphicStyle"
2107 uno::Reference< style::XStyle> xStyle = new OStyle();
2108 xStyle->setName("Default");
2109 uno::Reference<beans::XPropertySet> xProp(xStyle,uno::UNO_QUERY);
2110 OUString sTray;
2111 xProp->getPropertyValue("PrinterPaperTray")>>= sTray;
2113 return xStyle.get();
2115 else if ( aServiceSpecifier == "com.sun.star.document.Settings" )
2117 uno::Reference<beans::XPropertySet> xProp = new OStyle();
2119 return xProp.get();
2121 else if ( aServiceSpecifier == "com.sun.star.drawing.Defaults" )
2123 uno::Reference<beans::XPropertySet> xProp = new OStyle();
2124 return xProp.get();
2126 else if ( aServiceSpecifier == "com.sun.star.drawing.GradientTable" )
2128 if ( !m_pImpl->m_xGradientTable.is() )
2129 m_pImpl->m_xGradientTable.set(SvxUnoGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2130 return m_pImpl->m_xGradientTable;
2132 else if ( aServiceSpecifier == "com.sun.star.drawing.HatchTable" )
2134 if ( !m_pImpl->m_xHatchTable.is() )
2135 m_pImpl->m_xHatchTable.set(SvxUnoHatchTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2136 return m_pImpl->m_xHatchTable;
2138 else if ( aServiceSpecifier == "com.sun.star.drawing.BitmapTable" )
2140 if ( !m_pImpl->m_xBitmapTable.is() )
2141 m_pImpl->m_xBitmapTable.set(SvxUnoBitmapTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2142 return m_pImpl->m_xBitmapTable;
2144 else if ( aServiceSpecifier == "com.sun.star.drawing.TransparencyGradientTable" )
2146 if ( !m_pImpl->m_xTransparencyGradientTable.is() )
2147 m_pImpl->m_xTransparencyGradientTable.set(SvxUnoTransGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2148 return m_pImpl->m_xTransparencyGradientTable;
2150 else if ( aServiceSpecifier == "com.sun.star.drawing.DashTable" )
2152 if ( !m_pImpl->m_xDashTable.is() )
2153 m_pImpl->m_xDashTable.set(SvxUnoDashTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
2154 return m_pImpl->m_xDashTable;
2156 else if( aServiceSpecifier == "com.sun.star.drawing.MarkerTable" )
2158 if( !m_pImpl->m_xMarkerTable.is() )
2159 m_pImpl->m_xMarkerTable.set(SvxUnoMarkerTable_createInstance( m_pImpl->m_pReportModel.get() ),uno::UNO_QUERY);
2160 return m_pImpl->m_xMarkerTable;
2162 else if ( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
2163 return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
2164 else if ( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
2165 return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE ));
2166 else if ( aServiceSpecifier == "com.sun.star.document.ImportGraphicObjectResolver" )
2168 SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE);
2169 uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper));
2170 pGraphicHelper->release();
2171 return xRet;
2173 else if ( aServiceSpecifier == "com.sun.star.document.ExportGraphicObjectResolver" )
2175 SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE);
2176 uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper));
2177 pGraphicHelper->release();
2178 return xRet;
2180 else if ( aServiceSpecifier == "com.sun.star.chart2.data.DataProvider" )
2182 uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection ));
2183 xDataProvider->setRowLimit(10);
2184 uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY);
2185 if ( xChild.is() )
2186 xChild->setParent(*this);
2187 return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY);
2189 else if ( aServiceSpecifier == "com.sun.star.xml.NamespaceMap" )
2191 if ( !m_pImpl->m_xXMLNamespaceMap.is() )
2192 m_pImpl->m_xXMLNamespaceMap = comphelper::NameContainer_createInstance( cppu::UnoType<OUString>::get() ).get();
2193 return m_pImpl->m_xXMLNamespaceMap;
2195 else
2196 xShape.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ),uno::UNO_QUERY_THROW);
2198 return m_pImpl->m_pReportModel->createShape(aServiceSpecifier,xShape);
2201 uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableServiceNames() throw( uno::RuntimeException, std::exception )
2203 static const OUString aSvxComponentServiceNameList[] =
2205 OUString("com.sun.star.form.component.FixedText"),
2206 OUString("com.sun.star.form.component.DatabaseImageControl"),
2207 OUString("com.sun.star.style.PageStyle"),
2208 OUString("com.sun.star.style.GraphicStyle"),
2209 OUString("com.sun.star.style.FrameStyle"),
2210 OUString("com.sun.star.drawing.Defaults"),
2211 OUString("com.sun.star.document.ImportEmbeddedObjectResolver"),
2212 OUString("com.sun.star.document.ExportEmbeddedObjectResolver"),
2213 OUString("com.sun.star.document.ImportGraphicObjectResolver"),
2214 OUString("com.sun.star.document.ExportGraphicObjectResolver"),
2215 OUString("com.sun.star.chart2.data.DataProvider"),
2216 OUString("com.sun.star.xml.NamespaceMap"),
2217 OUString("com.sun.star.document.Settings"),
2218 OUString("com.sun.star.drawing.GradientTable"),
2219 OUString("com.sun.star.drawing.HatchTable"),
2220 OUString("com.sun.star.drawing.BitmapTable"),
2221 OUString("com.sun.star.drawing.TransparencyGradientTable"),
2222 OUString("com.sun.star.drawing.DashTable"),
2223 OUString("com.sun.star.drawing.MarkerTable")
2226 static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
2228 uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
2229 OUString* pStrings = aSeq.getArray();
2230 for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
2231 pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
2233 uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
2234 return concatServiceNames( aParentSeq, aSeq );
2237 // XShape
2238 awt::Point SAL_CALL OReportDefinition::getPosition( ) throw (uno::RuntimeException, std::exception)
2240 ::osl::MutexGuard aGuard(m_aMutex);
2241 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2242 if ( m_aProps->m_xShape.is() )
2243 return m_aProps->m_xShape->getPosition();
2244 return awt::Point(m_aProps->m_nPosX,m_aProps->m_nPosY);
2247 void SAL_CALL OReportDefinition::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException, std::exception)
2249 ::osl::MutexGuard aGuard(m_aMutex);
2250 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2251 if ( m_aProps->m_xShape.is() )
2252 m_aProps->m_xShape->setPosition(aPosition);
2253 set(PROPERTY_POSITIONX,aPosition.X,m_aProps->m_nPosX);
2254 set(PROPERTY_POSITIONY,aPosition.Y,m_aProps->m_nPosY);
2257 awt::Size SAL_CALL OReportDefinition::getSize( ) throw (uno::RuntimeException, std::exception)
2259 ::osl::MutexGuard aGuard(m_aMutex);
2260 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2261 if ( m_aProps->m_xShape.is() )
2262 return m_aProps->m_xShape->getSize();
2263 return awt::Size(m_aProps->m_nWidth,m_aProps->m_nHeight);
2266 void SAL_CALL OReportDefinition::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException, std::exception)
2268 ::osl::MutexGuard aGuard(m_aMutex);
2269 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2270 if ( m_aProps->m_xShape.is() )
2271 m_aProps->m_xShape->setSize(aSize);
2272 set(PROPERTY_WIDTH,aSize.Width,m_aProps->m_nWidth);
2273 set(PROPERTY_HEIGHT,aSize.Height,m_aProps->m_nHeight);
2277 // XShapeDescriptor
2278 OUString SAL_CALL OReportDefinition::getShapeType( ) throw (uno::RuntimeException, std::exception)
2280 ::osl::MutexGuard aGuard(m_aMutex);
2281 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2282 if ( m_aProps->m_xShape.is() )
2283 return m_aProps->m_xShape->getShapeType();
2284 return OUString("com.sun.star.drawing.OLE2Shape");
2287 typedef ::cppu::WeakImplHelper2< container::XNameContainer,
2288 container::XIndexAccess
2289 > TStylesBASE;
2290 class OStylesHelper:
2291 public cppu::BaseMutex, public TStylesBASE, private boost::noncopyable
2293 typedef ::std::map< OUString, uno::Any , ::comphelper::UStringMixLess> TStyleElements;
2294 TStyleElements m_aElements;
2295 ::std::vector<TStyleElements::iterator> m_aElementsPos;
2296 uno::Type m_aType;
2298 protected:
2299 virtual ~OStylesHelper(){}
2300 public:
2301 OStylesHelper(const uno::Type& rType = cppu::UnoType<container::XElementAccess>::get());
2303 // XNameContainer
2304 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;
2305 virtual void SAL_CALL removeByName( const OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException, std::exception) SAL_OVERRIDE;
2307 // XNameReplace
2308 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;
2310 // container::XElementAccess
2311 virtual uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2312 virtual sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2313 // container::XIndexAccess
2314 virtual sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2315 virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
2317 // container::XNameAccess
2318 virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE;
2319 virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2320 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception) SAL_OVERRIDE;
2323 OStylesHelper::OStylesHelper(const uno::Type& rType)
2324 : cppu::BaseMutex()
2325 , m_aType(rType)
2330 // container::XElementAccess
2331 uno::Type SAL_CALL OStylesHelper::getElementType( ) throw(uno::RuntimeException, std::exception)
2333 return m_aType;
2336 sal_Bool SAL_CALL OStylesHelper::hasElements( ) throw(uno::RuntimeException, std::exception)
2338 ::osl::MutexGuard aGuard(m_aMutex);
2339 return !m_aElementsPos.empty();
2342 // container::XIndexAccess
2343 sal_Int32 SAL_CALL OStylesHelper::getCount( ) throw(uno::RuntimeException, std::exception)
2345 ::osl::MutexGuard aGuard(m_aMutex);
2346 return m_aElementsPos.size();
2349 uno::Any SAL_CALL OStylesHelper::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
2351 ::osl::MutexGuard aGuard(m_aMutex);
2352 if ( Index < 0 || Index >= static_cast<sal_Int32>(m_aElementsPos.size()) )
2353 throw lang::IndexOutOfBoundsException();
2354 return m_aElementsPos[Index]->second;
2357 // container::XNameAccess
2358 uno::Any SAL_CALL OStylesHelper::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
2360 ::osl::MutexGuard aGuard(m_aMutex);
2361 TStyleElements::iterator aFind = m_aElements.find(aName);
2362 if ( aFind == m_aElements.end() )
2363 throw container::NoSuchElementException();
2364 return aFind->second;
2367 uno::Sequence< OUString > SAL_CALL OStylesHelper::getElementNames( ) throw(uno::RuntimeException, std::exception)
2369 ::osl::MutexGuard aGuard(m_aMutex);
2370 uno::Sequence< OUString > aNameList(m_aElementsPos.size());
2372 OUString* pStringArray = aNameList.getArray();
2373 ::std::vector<TStyleElements::iterator>::const_iterator aEnd = m_aElementsPos.end();
2374 for(::std::vector<TStyleElements::iterator>::const_iterator aIter = m_aElementsPos.begin(); aIter != aEnd;++aIter,++pStringArray)
2375 *pStringArray = (*aIter)->first;
2377 return aNameList;
2380 sal_Bool SAL_CALL OStylesHelper::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception)
2382 ::osl::MutexGuard aGuard(m_aMutex);
2383 return m_aElements.find(aName) != m_aElements.end();
2386 // XNameContainer
2387 void SAL_CALL OStylesHelper::insertByName( const OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException, std::exception)
2389 ::osl::MutexGuard aGuard(m_aMutex);
2390 if ( m_aElements.find(aName) != m_aElements.end() )
2391 throw container::ElementExistException();
2393 if ( !aElement.isExtractableTo(m_aType) )
2394 throw lang::IllegalArgumentException();
2396 m_aElementsPos.push_back(m_aElements.insert(TStyleElements::value_type(aName,aElement)).first);
2399 void SAL_CALL OStylesHelper::removeByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException, std::exception)
2401 ::osl::MutexGuard aGuard(m_aMutex);
2402 TStyleElements::iterator aFind = m_aElements.find(aName);
2403 if ( aFind != m_aElements.end() )
2404 throw container::NoSuchElementException();
2405 m_aElementsPos.erase(::std::find(m_aElementsPos.begin(),m_aElementsPos.end(),aFind));
2406 m_aElements.erase(aFind);
2409 // XNameReplace
2410 void SAL_CALL OStylesHelper::replaceByName( const OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException, std::exception)
2412 ::osl::MutexGuard aGuard(m_aMutex);
2413 TStyleElements::iterator aFind = m_aElements.find(aName);
2414 if ( aFind == m_aElements.end() )
2415 throw container::NoSuchElementException();
2416 if ( !aElement.isExtractableTo(m_aType) )
2417 throw lang::IllegalArgumentException();
2418 aFind->second = aElement;
2421 uno::Reference< container::XNameAccess > SAL_CALL OReportDefinition::getStyleFamilies( ) throw (uno::RuntimeException, std::exception)
2423 ::osl::MutexGuard aGuard(m_aMutex);
2424 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2425 if ( !m_pImpl->m_xStyles.is() )
2427 m_pImpl->m_xStyles = new OStylesHelper();
2428 uno::Reference< container::XNameContainer> xStyles(m_pImpl->m_xStyles,uno::UNO_QUERY);
2430 uno::Reference< container::XNameContainer> xPageStyles = new OStylesHelper(cppu::UnoType<style::XStyle>::get());
2431 xStyles->insertByName(OUString("PageStyles"),uno::makeAny(xPageStyles));
2432 uno::Reference< style::XStyle> xPageStyle(createInstance("com.sun.star.style.PageStyle"),uno::UNO_QUERY);
2433 xPageStyles->insertByName(xPageStyle->getName(),uno::makeAny(xPageStyle));
2435 uno::Reference< container::XNameContainer> xFrameStyles = new OStylesHelper(cppu::UnoType<style::XStyle>::get());
2436 xStyles->insertByName(OUString("FrameStyles"),uno::makeAny(xFrameStyles));
2437 uno::Reference< style::XStyle> xFrameStyle(createInstance("com.sun.star.style.FrameStyle"),uno::UNO_QUERY);
2438 xFrameStyles->insertByName(xFrameStyle->getName(),uno::makeAny(xFrameStyle));
2440 uno::Reference< container::XNameContainer> xGraphicStyles = new OStylesHelper(cppu::UnoType<style::XStyle>::get());
2441 xStyles->insertByName(OUString("graphics"),uno::makeAny(xGraphicStyles));
2442 uno::Reference< style::XStyle> xGraphicStyle(createInstance("com.sun.star.style.GraphicStyle"),uno::UNO_QUERY);
2443 xGraphicStyles->insertByName(xGraphicStyle->getName(),uno::makeAny(xGraphicStyle));
2445 return m_pImpl->m_xStyles;
2447 OUString SAL_CALL OReportDefinition::getIdentifier( ) throw (uno::RuntimeException, std::exception)
2449 ::osl::MutexGuard aGuard(m_aMutex);
2450 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2451 return m_pImpl->m_sIdentifier;
2454 void SAL_CALL OReportDefinition::setIdentifier( const OUString& Identifier ) throw (uno::RuntimeException, std::exception)
2456 ::osl::MutexGuard aGuard(m_aMutex);
2457 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2458 m_pImpl->m_sIdentifier = Identifier;
2461 // XNumberFormatsSupplier
2462 uno::Reference< beans::XPropertySet > SAL_CALL OReportDefinition::getNumberFormatSettings( ) throw (uno::RuntimeException, std::exception)
2464 ::osl::MutexGuard aGuard(m_aMutex);
2465 if ( m_pImpl->m_xNumberFormatsSupplier.is() )
2466 return m_pImpl->m_xNumberFormatsSupplier->getNumberFormatSettings();
2467 return uno::Reference< beans::XPropertySet >();
2470 uno::Reference< util::XNumberFormats > SAL_CALL OReportDefinition::getNumberFormats( ) throw (uno::RuntimeException, std::exception)
2472 ::osl::MutexGuard aGuard(m_aMutex);
2473 if ( m_pImpl->m_xNumberFormatsSupplier.is() )
2474 return m_pImpl->m_xNumberFormatsSupplier->getNumberFormats();
2475 return uno::Reference< util::XNumberFormats >();
2478 ::comphelper::EmbeddedObjectContainer& OReportDefinition::getEmbeddedObjectContainer() const
2480 return *m_pImpl->m_pObjectContainer;
2483 uno::Reference< embed::XStorage > OReportDefinition::getStorage() const
2485 return m_pImpl->m_xStorage;
2488 uno::Reference< task::XInteractionHandler > OReportDefinition::getInteractionHandler() const
2490 uno::Reference< task::XInteractionHandler > xRet(
2491 task::InteractionHandler::createWithParent(m_aProps->m_xContext, 0), uno::UNO_QUERY_THROW);
2492 return xRet;
2495 uno::Reference< sdbc::XConnection > SAL_CALL OReportDefinition::getActiveConnection() throw (uno::RuntimeException, std::exception)
2497 ::osl::MutexGuard aGuard(m_aMutex);
2498 return m_pImpl->m_xActiveConnection;
2501 void SAL_CALL OReportDefinition::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection ) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
2503 if ( !_activeconnection.is() )
2504 throw lang::IllegalArgumentException();
2505 set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_pImpl->m_xActiveConnection);
2508 OUString SAL_CALL OReportDefinition::getDataSourceName() throw (uno::RuntimeException, std::exception)
2510 osl::MutexGuard g(m_aMutex);
2511 return m_pImpl->m_sDataSourceName;
2514 void SAL_CALL OReportDefinition::setDataSourceName(const OUString& the_value) throw (uno::RuntimeException, std::exception)
2516 set(PROPERTY_DATASOURCENAME,the_value,m_pImpl->m_sDataSourceName);
2519 bool OReportDefinition::isEnableSetModified() const
2521 return true;
2524 uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw()
2526 SolarMutexGuard aSolarGuard;
2528 ::osl::MutexGuard aGuard(m_aMutex);
2529 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2531 if ( ! m_pImpl->m_xTitleHelper.is ())
2533 uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_aProps->m_xContext);
2534 uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
2536 ::framework::TitleHelper* pHelper = new ::framework::TitleHelper( m_aProps->m_xContext );
2537 m_pImpl->m_xTitleHelper = uno::Reference< frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
2538 pHelper->setOwner (xThis );
2539 pHelper->connectWithUntitledNumbers (uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW));
2542 return m_pImpl->m_xTitleHelper;
2545 uno::Reference< frame::XUntitledNumbers > OReportDefinition::impl_getUntitledHelper_throw()
2547 SolarMutexGuard aSolarGuard;
2549 ::osl::MutexGuard aGuard(m_aMutex);
2550 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2552 if ( ! m_pImpl->m_xNumberedControllers.is ())
2554 uno::Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
2555 ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection();
2556 m_pImpl->m_xNumberedControllers = uno::Reference< frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
2558 pHelper->setOwner (xThis);
2559 pHelper->setUntitledPrefix (OUString(" : "));
2562 return m_pImpl->m_xNumberedControllers;
2565 // css.frame.XTitle
2566 OUString SAL_CALL OReportDefinition::getTitle()
2567 throw (uno::RuntimeException, std::exception)
2569 // SYNCHRONIZED ->
2570 SolarMutexGuard aSolarGuard;
2572 ::osl::MutexGuard aGuard(m_aMutex);
2573 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2575 return impl_getTitleHelper_throw()->getTitle ();
2578 // css.frame.XTitle
2579 void SAL_CALL OReportDefinition::setTitle( const OUString& sTitle )
2580 throw (uno::RuntimeException, std::exception)
2582 // SYNCHRONIZED ->
2583 SolarMutexGuard aSolarGuard;
2585 ::osl::MutexGuard aGuard(m_aMutex);
2586 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2588 impl_getTitleHelper_throw()->setTitle (sTitle);
2591 // css.frame.XTitleChangeBroadcaster
2592 void SAL_CALL OReportDefinition::addTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
2593 throw (uno::RuntimeException, std::exception)
2595 // SYNCHRONIZED ->
2596 SolarMutexGuard aSolarGuard;
2598 ::osl::MutexGuard aGuard(m_aMutex);
2599 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2601 uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
2602 if (xBroadcaster.is ())
2603 xBroadcaster->addTitleChangeListener (xListener);
2606 // css.frame.XTitleChangeBroadcaster
2607 void SAL_CALL OReportDefinition::removeTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
2608 throw (uno::RuntimeException, std::exception)
2610 // SYNCHRONIZED ->
2611 SolarMutexGuard aSolarGuard;
2613 ::osl::MutexGuard aGuard(m_aMutex);
2614 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2616 uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
2617 if (xBroadcaster.is ())
2618 xBroadcaster->removeTitleChangeListener (xListener);
2621 // css.frame.XUntitledNumbers
2622 ::sal_Int32 SAL_CALL OReportDefinition::leaseNumber( const uno::Reference< uno::XInterface >& xComponent )
2623 throw (lang::IllegalArgumentException,
2624 uno::RuntimeException, std::exception )
2626 // object already disposed?
2627 SolarMutexGuard aSolarGuard;
2628 ::osl::MutexGuard aGuard(m_aMutex);
2629 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2631 return impl_getUntitledHelper_throw()->leaseNumber (xComponent);
2634 // css.frame.XUntitledNumbers
2635 void SAL_CALL OReportDefinition::releaseNumber( ::sal_Int32 nNumber )
2636 throw (lang::IllegalArgumentException,
2637 uno::RuntimeException, std::exception )
2639 // object already disposed?
2640 SolarMutexGuard aSolarGuard;
2641 ::osl::MutexGuard aGuard(m_aMutex);
2642 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2644 impl_getUntitledHelper_throw()->releaseNumber (nNumber);
2647 // css.frame.XUntitledNumbers
2648 void SAL_CALL OReportDefinition::releaseNumberForComponent( const uno::Reference< uno::XInterface >& xComponent )
2649 throw (lang::IllegalArgumentException,
2650 uno::RuntimeException, std::exception )
2652 // object already disposed?
2653 SolarMutexGuard aSolarGuard;
2654 ::osl::MutexGuard aGuard(m_aMutex);
2655 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2657 impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent);
2660 // css.frame.XUntitledNumbers
2661 OUString SAL_CALL OReportDefinition::getUntitledPrefix()
2662 throw (uno::RuntimeException, std::exception)
2664 // object already disposed?
2665 SolarMutexGuard aSolarGuard;
2666 ::osl::MutexGuard aGuard(m_aMutex);
2667 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2669 return impl_getUntitledHelper_throw()->getUntitledPrefix ();
2672 uno::Reference< document::XDocumentProperties > SAL_CALL OReportDefinition::getDocumentProperties( ) throw (uno::RuntimeException, std::exception)
2674 ::osl::MutexGuard aGuard(m_aMutex);
2675 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
2676 if ( !m_pImpl->m_xDocumentProperties.is() )
2678 m_pImpl->m_xDocumentProperties.set(document::DocumentProperties::create(m_aProps->m_xContext));
2680 return m_pImpl->m_xDocumentProperties;
2683 uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const
2685 return m_aProps->m_xContext;
2688 uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor ) throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException, std::exception)
2690 uno::Any aResult;
2691 if( isDataFlavorSupported( aFlavor ) )
2695 aResult <<= getPreferredVisualRepresentation(0).Data;
2697 catch (const uno::Exception &)
2699 DBG_UNHANDLED_EXCEPTION();
2702 else
2704 throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this ));
2707 return aResult;
2710 uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors( ) throw (uno::RuntimeException, std::exception)
2712 uno::Sequence< datatransfer::DataFlavor > aRet(1);
2714 aRet[0] = datatransfer::DataFlavor( OUString("image/png"),
2715 OUString("PNG"),
2716 cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
2718 return aRet;
2721 sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor ) throw (uno::RuntimeException, std::exception)
2723 return aFlavor.MimeType == "image/png";
2727 uno::Reference< document::XUndoManager > SAL_CALL OReportDefinition::getUndoManager( ) throw (uno::RuntimeException, std::exception)
2729 ::osl::MutexGuard aGuard( m_aMutex );
2730 return m_pImpl->m_pUndoManager.get();
2733 }// namespace reportdesign
2735 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */