1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ReportDefinition.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "ReportDefinition.hxx"
31 #include <com/sun/star/beans/PropertyAttribute.hpp>
32 #include <com/sun/star/report/GroupKeepTogether.hpp>
33 #include <com/sun/star/report/ReportPrintOption.hpp>
34 #include <com/sun/star/report/XFunction.hpp>
35 #include <com/sun/star/sdb/CommandType.hpp>
36 #include <com/sun/star/table/BorderLine.hpp>
37 #include <com/sun/star/table/ShadowFormat.hpp>
38 #include <com/sun/star/style/PageStyleLayout.hpp>
39 #include <com/sun/star/style/GraphicLocation.hpp>
40 #include <com/sun/star/xml/AttributeData.hpp>
41 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
42 #include <comphelper/namecontainer.hxx>
43 #include <comphelper/broadcasthelper.hxx>
44 #include <comphelper/sequence.hxx>
45 #include <comphelper/storagehelper.hxx>
46 #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
47 #include <vcl/svapp.hxx>
48 #include <vos/mutex.hxx>
49 #include <comphelper/uno3.hxx>
50 #include <comphelper/propertystatecontainer.hxx>
51 #include <comphelper/namedvaluecollection.hxx>
52 #include <comphelper/proparrhlp.hxx>
53 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
54 #include <com/sun/star/document/EventObject.hpp>
55 #include <com/sun/star/document/XEventListener.hpp>
56 #include <com/sun/star/style/XStyle.hpp>
57 #include <comphelper/documentconstants.hxx>
58 #include <com/sun/star/embed/XTransactedObject.hpp>
59 #include <com/sun/star/embed/ElementModes.hpp>
60 #include <com/sun/star/embed/EmbedMapUnits.hpp>
61 #include <com/sun/star/embed/EntryInitModes.hpp>
62 #include <com/sun/star/io/XActiveDataSource.hpp>
63 #include <com/sun/star/embed/ElementModes.hpp>
64 #include <com/sun/star/io/XSeekable.hpp>
65 #include <com/sun/star/embed/XEmbedPersist.hpp>
66 #include <com/sun/star/task/XStatusIndicator.hpp>
67 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
68 #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
69 #include <com/sun/star/document/XExporter.hpp>
70 #include <com/sun/star/document/XImporter.hpp>
71 #include <com/sun/star/document/XFilter.hpp>
72 #include <com/sun/star/task/ErrorCodeIOException.hpp>
73 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
74 #ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC
75 #include "corestrings.hrc"
78 #include "Section.hxx"
79 #include "FixedLine.hxx"
80 #ifndef REPORTDESIGN_CORE_RESOURCE_HRC_
81 #include "core_resource.hrc"
83 #include "core_resource.hxx"
85 #include <tools/debug.hxx>
86 #include <tools/diagnose_ex.h>
87 #include <connectivity/CommonTools.hxx>
88 #include <comphelper/numberedcollection.hxx>
89 #include <framework/titlehelper.hxx>
90 #include <comphelper/property.hxx>
91 #include <comphelper/propertysetinfo.hxx>
92 #include <comphelper/genericpropertyset.hxx>
93 #include <comphelper/mediadescriptor.hxx>
94 #include <comphelper/namecontainer.hxx>
95 #include <connectivity/dbtools.hxx>
96 #include <com/sun/star/task/XStatusIndicator.hpp>
97 #include "Functions.hxx"
98 #include <boost/mem_fn.hpp>
99 #include <boost/bind.hpp>
100 #include <boost/utility.hpp>
101 #include <svtools/saveopt.hxx>
102 #include "RptModel.hxx"
103 #include "UndoEnv.hxx"
104 #include "FormattedField.hxx"
105 #include "FixedText.hxx"
106 #include "ImageControl.hxx"
108 #include "ReportHelperImpl.hxx"
109 #include <svtools/itempool.hxx>
111 #include <svx/paperinf.hxx>
112 #include <svx/svdlayer.hxx>
113 #include <svx/xmleohlp.hxx>
114 #include <svx/xmlgrhlp.hxx>
115 #include <svx/unofill.hxx>
116 #include <cppuhelper/interfacecontainer.h>
117 #include <cppuhelper/exc_hlp.hxx>
118 #include "ReportComponent.hxx"
119 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
120 #include <com/sun/star/style/NumberingType.hpp>
122 #define MAP_LEN(x) x, sizeof(x) - 1
123 #define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
125 #define SC_UNO_PAGE_GRAPHICFILT "BackGraphicFilter"
126 #define SC_UNO_PAGE_LEFTBORDER "LeftBorder"
127 #define SC_UNO_PAGE_RIGHTBORDER "RightBorder"
128 #define SC_UNO_PAGE_BOTTBORDER "BottomBorder"
129 #define SC_UNO_PAGE_TOPBORDER "TopBorder"
130 #define SC_UNO_PAGE_LEFTBRDDIST "LeftBorderDistance"
131 #define SC_UNO_PAGE_RIGHTBRDDIST "RightBorderDistance"
132 #define SC_UNO_PAGE_BOTTBRDDIST "BottomBorderDistance"
133 #define SC_UNO_PAGE_TOPBRDDIST "TopBorderDistance"
134 #define SC_UNO_PAGE_BORDERDIST "BorderDistance"
135 #define SC_UNO_PAGE_SHADOWFORM "ShadowFormat"
136 #define SC_UNO_PAGE_PAPERTRAY "PrinterPaperTray"
137 #define SC_UNO_PAGE_SCALEVAL "PageScale"
138 #define SC_UNO_PAGE_SCALETOPAG "ScaleToPages"
139 #define SC_UNO_PAGE_SCALETOX "ScaleToPagesX"
140 #define SC_UNO_PAGE_SCALETOY "ScaleToPagesY"
141 #define SC_UNO_PAGE_FIRSTPAGE "FirstPageNumber"
142 #define SC_UNO_PAGE_LEFTHDRCONT "LeftPageHeaderContent"
143 #define SC_UNO_PAGE_LEFTFTRCONT "LeftPageFooterContent"
144 #define SC_UNO_PAGE_RIGHTHDRCON "RightPageHeaderContent"
145 #define SC_UNO_PAGE_RIGHTFTRCON "RightPageFooterContent"
146 #define SC_UNO_PAGE_PRINTFORMUL "PrintFormulas"
147 #define SC_UNO_PAGE_PRINTZERO "PrintZeroValues"
148 #define SC_UNO_PAGE_HDRBACKCOL "HeaderBackColor"
149 #define SC_UNO_PAGE_HDRBACKTRAN "HeaderBackTransparent"
150 #define SC_UNO_PAGE_HDRGRFFILT "HeaderBackGraphicFilter"
151 #define SC_UNO_PAGE_HDRGRFLOC "HeaderBackGraphicLocation"
152 #define SC_UNO_PAGE_HDRGRFURL "HeaderBackGraphicURL"
153 #define SC_UNO_PAGE_HDRLEFTBOR "HeaderLeftBorder"
154 #define SC_UNO_PAGE_HDRRIGHTBOR "HeaderRightBorder"
155 #define SC_UNO_PAGE_HDRBOTTBOR "HeaderBottomBorder"
156 #define SC_UNO_PAGE_HDRTOPBOR "HeaderTopBorder"
157 #define SC_UNO_PAGE_HDRLEFTBDIS "HeaderLeftBorderDistance"
158 #define SC_UNO_PAGE_HDRRIGHTBDIS "HeaderRightBorderDistance"
159 #define SC_UNO_PAGE_HDRBOTTBDIS "HeaderBottomBorderDistance"
160 #define SC_UNO_PAGE_HDRTOPBDIS "HeaderTopBorderDistance"
161 #define SC_UNO_PAGE_HDRBRDDIST "HeaderBorderDistance"
162 #define SC_UNO_PAGE_HDRSHADOW "HeaderShadowFormat"
163 #define SC_UNO_PAGE_HDRLEFTMAR "HeaderLeftMargin"
164 #define SC_UNO_PAGE_HDRRIGHTMAR "HeaderRightMargin"
165 #define SC_UNO_PAGE_HDRBODYDIST "HeaderBodyDistance"
166 #define SC_UNO_PAGE_HDRHEIGHT "HeaderHeight"
167 #define SC_UNO_PAGE_HDRON "HeaderIsOn"
168 #define SC_UNO_PAGE_HDRDYNAMIC "HeaderIsDynamicHeight"
169 #define SC_UNO_PAGE_HDRSHARED "HeaderIsShared"
170 #define SC_UNO_PAGE_FTRBACKCOL "FooterBackColor"
171 #define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent"
172 #define SC_UNO_PAGE_FTRGRFFILT "FooterBackGraphicFilter"
173 #define SC_UNO_PAGE_FTRGRFLOC "FooterBackGraphicLocation"
174 #define SC_UNO_PAGE_FTRGRFURL "FooterBackGraphicURL"
175 #define SC_UNO_PAGE_FTRLEFTBOR "FooterLeftBorder"
176 #define SC_UNO_PAGE_FTRRIGHTBOR "FooterRightBorder"
177 #define SC_UNO_PAGE_FTRBOTTBOR "FooterBottomBorder"
178 #define SC_UNO_PAGE_FTRTOPBOR "FooterTopBorder"
179 #define SC_UNO_PAGE_FTRLEFTBDIS "FooterLeftBorderDistance"
180 #define SC_UNO_PAGE_FTRRIGHTBDIS "FooterRightBorderDistance"
181 #define SC_UNO_PAGE_FTRBOTTBDIS "FooterBottomBorderDistance"
182 #define SC_UNO_PAGE_FTRTOPBDIS "FooterTopBorderDistance"
183 #define SC_UNO_PAGE_FTRBRDDIST "FooterBorderDistance"
184 #define SC_UNO_PAGE_FTRSHADOW "FooterShadowFormat"
185 #define SC_UNO_PAGE_FTRLEFTMAR "FooterLeftMargin"
186 #define SC_UNO_PAGE_FTRRIGHTMAR "FooterRightMargin"
187 #define SC_UNO_PAGE_FTRBODYDIST "FooterBodyDistance"
188 #define SC_UNO_PAGE_FTRHEIGHT "FooterHeight"
189 #define SC_UNO_PAGE_FTRON "FooterIsOn"
190 #define SC_UNO_PAGE_FTRDYNAMIC "FooterIsDynamicHeight"
191 #define SC_UNO_PAGE_FTRSHARED "FooterIsShared"
193 // =============================================================================
194 namespace reportdesign
196 // =============================================================================
197 using namespace com::sun::star
;
198 using namespace comphelper
;
199 using namespace rptui
;
200 // -----------------------------------------------------------------------------
202 // -----------------------------------------------------------------------------
203 void lcl_setModelReadOnly(const uno::Reference
< embed::XStorage
>& _xStorage
,::boost::shared_ptr
<rptui::OReportModel
>& _rModel
)
205 uno::Reference
<beans::XPropertySet
> xProp(_xStorage
,uno::UNO_QUERY
);
206 sal_Int32 nOpenMode
= embed::ElementModes::READ
;
208 xProp
->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nOpenMode
;
210 _rModel
->SetReadOnly((nOpenMode
& embed::ElementModes::WRITE
) != embed::ElementModes::WRITE
);
212 void lcl_stripLoadArguments( ::comphelper::MediaDescriptor
& _rDescriptor
, uno::Sequence
< beans::PropertyValue
>& _rArgs
)
214 _rDescriptor
.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ) );
215 _rDescriptor
.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ) );
216 _rDescriptor
.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) );
217 _rDescriptor
>> _rArgs
;
219 // -----------------------------------------------------------------------------
220 void lcl_extractAndStartStatusIndicator( const ::comphelper::MediaDescriptor
& _rDescriptor
, uno::Reference
< task::XStatusIndicator
>& _rxStatusIndicator
,
221 uno::Sequence
< uno::Any
>& _rCallArgs
)
225 _rxStatusIndicator
= _rDescriptor
.getUnpackedValueOrDefault( _rDescriptor
.PROP_STATUSINDICATOR(), _rxStatusIndicator
);
226 if ( _rxStatusIndicator
.is() )
228 _rxStatusIndicator
->start( ::rtl::OUString(), (sal_Int32
)1000000 );
230 sal_Int32 nLength
= _rCallArgs
.getLength();
231 _rCallArgs
.realloc( nLength
+ 1 );
232 _rCallArgs
[ nLength
] <<= _rxStatusIndicator
;
235 catch( const uno::Exception
& )
237 OSL_ENSURE( sal_False
, "lcl_extractAndStartStatusIndicator: caught an exception!" );
238 // DBG_UNHANDLED_EXCEPTION();
241 // -----------------------------------------------------------------------------
242 typedef ::comphelper::OPropertyStateContainer OStyle_PBASE
;
244 typedef ::comphelper::OPropertyArrayUsageHelper
< OStyle
246 typedef ::cppu::WeakImplHelper2
< style::XStyle
, beans::XMultiPropertyStates
> TStyleBASE
;
248 class OStyle
: public ::comphelper::OMutexAndBroadcastHelper
251 ,public OStyle_PABASE
256 void getPropertyDefaultByHandle( sal_Int32 _nHandle
, uno::Any
& _rDefault
) const;
262 DECLARE_XINTERFACE( )
265 com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(com::sun::star::uno::RuntimeException
);
266 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
267 ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
270 ::sal_Bool SAL_CALL
isUserDefined( ) throw (uno::RuntimeException
);
271 ::sal_Bool SAL_CALL
isInUse( ) throw (uno::RuntimeException
);
272 ::rtl::OUString SAL_CALL
getParentStyle( ) throw (uno::RuntimeException
);
273 void SAL_CALL
setParentStyle( const ::rtl::OUString
& aParentStyle
) throw (container::NoSuchElementException
, uno::RuntimeException
);
275 ::rtl::OUString SAL_CALL
getName( ) throw (uno::RuntimeException
);
276 void SAL_CALL
setName( const ::rtl::OUString
& aName
) throw (uno::RuntimeException
);
278 // XMultiPropertyState
279 uno::Sequence
< beans::PropertyState
> SAL_CALL
getPropertyStates( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, uno::RuntimeException
)
281 return OStyle_PBASE::getPropertyStates(aPropertyNames
);
283 void SAL_CALL
setAllPropertiesToDefault( ) throw (uno::RuntimeException
);
284 void SAL_CALL
setPropertiesToDefault( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, uno::RuntimeException
);
285 uno::Sequence
< uno::Any
> SAL_CALL
getPropertyDefaults( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
);
287 // -----------------------------------------------------------------------------
289 :OStyle_PBASE(m_aBHelper
)
290 ,m_aSize(21000,29700)
292 const ::Size aDefaultSize
= SvxPaperInfo::GetPaperSize(SvxPaperInfo::GetDefaultSvxPaper(Application::GetSettings().GetLanguage()),MAP_100TH_MM
);
293 m_aSize
.Height
= aDefaultSize
.Height();
294 m_aSize
.Width
= aDefaultSize
.Width();
296 const style::GraphicLocation eGraphicLocation
= style::GraphicLocation_NONE
;
297 const sal_Bool bFalse
= sal_False
;
298 const sal_Bool bTrue
= sal_True
;
299 const sal_Int32 nMargin
= 2000;
300 //const sal_Int32 nColor = COL_WHITE;
301 const sal_Int32 nTransparent
= COL_TRANSPARENT
;
302 const sal_Int32 nZero
= 0;
303 const sal_Int16 n16Zero
= 0;
304 const sal_Int16 nNummeringType
= style::NumberingType::ARABIC
;
305 const ::rtl::OUString
sName(RTL_CONSTASCII_USTRINGPARAM("Default"));
306 const ::rtl::OUString sEmpty
;
307 const table::BorderLine
eBorderLine(0,0,0,0);
308 const table::ShadowFormat
eShadowFormat(table::ShadowLocation_NONE
,0,0,0);
309 const style::PageStyleLayout ePageStyleLayout
= style::PageStyleLayout_ALL
;
310 const sal_Int32 nBound
= beans::PropertyAttribute::BOUND
;
311 const sal_Int32 nMayBeVoid
= beans::PropertyAttribute::MAYBEVOID
;
314 registerPropertyNoMember( PROPERTY_NAME
, ++i
,nBound
,::getCppuType( static_cast< ::rtl::OUString
*>(NULL
) ), &sName
);
316 registerPropertyNoMember(PROPERTY_BACKCOLOR
, ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nTransparent
);
317 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICFILT), ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
319 registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION
, ++i
,nBound
,::getCppuType((const style::GraphicLocation
*)0) ,&eGraphicLocation
);
320 //registerPropertyNoMember(PROPERTY_BACKGRAPHICURL, ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
321 registerPropertyNoMember(PROPERTY_BACKTRANSPARENT
, ++i
,nBound
,::getBooleanCppuType() ,&bTrue
);
322 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_BACKCOLOR), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
323 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
324 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
325 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
326 registerPropertyNoMember(PROPERTY_BOTTOMMARGIN
, ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nMargin
);
327 registerPropertyNoMember(MAP_CHAR_LEN("DisplayName"), ++i
,nBound
,::getCppuType((rtl::OUString
*)0) ,&sEmpty
);
328 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FIRSTPAGE), ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
330 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nTransparent
);
331 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT
), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
332 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC
), ++i
,nBound
,::getCppuType((const style::GraphicLocation
*)0) ,&eGraphicLocation
);
333 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL
), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
334 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN
), ++i
,nBound
,::getBooleanCppuType() ,&bTrue
);
335 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
336 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
337 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
338 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
339 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
340 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC), ++i,nBound,::getBooleanCppuType() ,&bFalse);
341 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
342 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC
), ++i
,nBound
,::getBooleanCppuType() ,&bFalse
);
343 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRON
), ++i
,nBound
,::getBooleanCppuType() ,&bFalse
);
344 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED
), ++i
,nBound
,::getBooleanCppuType() ,&bFalse
);
345 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
346 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
347 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
348 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON), ++i,nBound,::getBooleanCppuType() ,&bFalse);
349 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
350 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS
),++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
351 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
352 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW
), ++i
,nBound
,::getCppuType((const table::ShadowFormat
*)0) ,&eShadowFormat
);
353 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED), ++i,nBound,::getBooleanCppuType() ,&bFalse);
354 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
355 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
357 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nTransparent
);
358 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
359 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const style::GraphicLocation
*)0) ,&eGraphicLocation
);
360 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
361 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bTrue
);
362 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
363 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
364 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
365 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
366 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
367 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC), ++i,nBound,::getBooleanCppuType() ,&bFalse);
368 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
369 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bFalse
);
370 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRON
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bFalse
);
371 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bFalse
);
372 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
373 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
374 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
375 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON), ++i,nBound,::getBooleanCppuType() ,&bFalse);
376 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
377 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS
),++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
378 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
379 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::ShadowFormat
*)0) ,&eShadowFormat
);
380 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED), ++i,nBound,::getBooleanCppuType() ,&bFalse);
381 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
382 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
384 registerProperty(PROPERTY_HEIGHT
, ++i
,nBound
,&m_aSize
.Height
, ::getCppuType((const sal_Int32
*)0) );
385 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_BACKTRANS), ++i,nBound, ::getBooleanCppuType() ,&bFalse);
386 registerPropertyNoMember(PROPERTY_ISLANDSCAPE
, ++i
,nBound
, ::getBooleanCppuType() ,&bFalse
);
387 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER
), ++i
,nBound
, ::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
388 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST
), ++i
,nBound
, ::getCppuType((const sal_Int32
*)0) ,&nZero
);
389 registerPropertyNoMember(PROPERTY_LEFTMARGIN
, ++i
,beans::PropertyAttribute::BOUND
, ::getCppuType((const sal_Int32
*)0) ,&nMargin
);
390 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTFTRCONT), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
391 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTHDRCONT), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
392 registerPropertyNoMember(PROPERTY_NUMBERINGTYPE
, ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&nNummeringType
);
393 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
394 registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT
, ++i
,nBound
,::getCppuType((const style::PageStyleLayout
*)0) ,&ePageStyleLayout
);
395 const ::rtl::OUString
sPaperTray(RTL_CONSTASCII_USTRINGPARAM("[From printer settings]"));
396 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY
), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0) ,&sPaperTray
);
397 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
398 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST
),++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
399 registerPropertyNoMember(PROPERTY_RIGHTMARGIN
, ++i
,beans::PropertyAttribute::BOUND
,::getCppuType((const sal_Int32
*)0) ,&nMargin
);
400 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTFTRCON), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
401 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTHDRCON), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
402 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
403 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
404 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
405 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM
), ++i
,nBound
,::getCppuType((const table::ShadowFormat
*)0) ,&eShadowFormat
);
406 registerProperty(PROPERTY_PAPERSIZE
, ++i
,beans::PropertyAttribute::BOUND
,&m_aSize
,::getCppuType((const awt::Size
*)0) );
407 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
408 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
409 registerPropertyNoMember(PROPERTY_TOPMARGIN
, ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nMargin
);
410 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),++i,nBound,::getBooleanCppuType() ,&bFalse);
411 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),++i,nBound,::getBooleanCppuType() ,&bFalse);
412 uno::Reference
< container::XNameContainer
> xAttribs
= ::comphelper::NameContainer_createInstance(::getCppuType(static_cast< xml::AttributeData
* >(NULL
)));
413 registerPropertyNoMember(MAP_CHAR_LEN("UserDefinedAttributes"), ++i
,nBound
,::getCppuType((uno::Reference
<container::XNameContainer
>*)0) ,&xAttribs
);
414 registerProperty(PROPERTY_WIDTH
, ++i
,nBound
,&m_aSize
.Width
,::getCppuType((const sal_Int32
*)0) );
415 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNONAME_WRITING), ++i,nBound,:.getCppuType((sal_Int16*)0) ,&n16Zero);
416 registerPropertyNoMember(MAP_CHAR_LEN("PrinterName"), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0),&sEmpty
);
417 uno::Sequence
<sal_Int8
> aSe
;
418 registerPropertyNoMember(MAP_CHAR_LEN("PrinterSetup"), ++i
,nBound
,::getCppuType((const uno::Sequence
<sal_Int8
>*)0),&aSe
);
422 // -----------------------------------------------------------------------------
423 IMPLEMENT_FORWARD_XINTERFACE2(OStyle
,TStyleBASE
,OStyle_PBASE
)
424 // -----------------------------------------------------------------------------
425 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
OStyle::getPropertySetInfo() throw(uno::RuntimeException
)
427 return createPropertySetInfo( getInfoHelper() );
429 // -----------------------------------------------------------------------------
430 void OStyle::getPropertyDefaultByHandle( sal_Int32
/*_nHandle*/, uno::Any
& /*_rDefault*/ ) const
433 //-------------------------------------------------------------------------
434 ::cppu::IPropertyArrayHelper
& OStyle::getInfoHelper()
436 return *const_cast<OStyle
*>(this)->getArrayHelper();
438 //--------------------------------------------------------------------
439 ::cppu::IPropertyArrayHelper
* OStyle::createArrayHelper( ) const
441 uno::Sequence
< beans::Property
> aProps
;
442 describeProperties(aProps
);
443 return new ::cppu::OPropertyArrayHelper(aProps
);
445 // -----------------------------------------------------------------------------
447 ::sal_Bool SAL_CALL
OStyle::isUserDefined( ) throw (uno::RuntimeException
)
451 // -----------------------------------------------------------------------------
452 ::sal_Bool SAL_CALL
OStyle::isInUse( ) throw (uno::RuntimeException
)
456 // -----------------------------------------------------------------------------
457 ::rtl::OUString SAL_CALL
OStyle::getParentStyle( ) throw (uno::RuntimeException
)
459 return ::rtl::OUString();
461 // -----------------------------------------------------------------------------
462 void SAL_CALL
OStyle::setParentStyle( const ::rtl::OUString
& /*aParentStyle*/ ) throw (container::NoSuchElementException
, uno::RuntimeException
)
465 // -----------------------------------------------------------------------------
467 ::rtl::OUString SAL_CALL
OStyle::getName( ) throw (uno::RuntimeException
)
469 ::rtl::OUString sName
;
470 getPropertyValue(PROPERTY_NAME
) >>= sName
;
473 // -----------------------------------------------------------------------------
474 void SAL_CALL
OStyle::setName( const ::rtl::OUString
& aName
) throw (uno::RuntimeException
)
476 setPropertyValue(PROPERTY_NAME
,uno::makeAny(aName
));
478 // -----------------------------------------------------------------------------
479 void SAL_CALL
OStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException
)
482 // -----------------------------------------------------------------------------
483 void SAL_CALL
OStyle::setPropertiesToDefault( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, uno::RuntimeException
)
485 const ::rtl::OUString
* pIter
= aPropertyNames
.getConstArray();
486 const ::rtl::OUString
* pEnd
= pIter
+ aPropertyNames
.getLength();
487 for(;pIter
!= pEnd
;++pIter
)
488 setPropertyToDefault(*pIter
);
490 // -----------------------------------------------------------------------------
491 uno::Sequence
< uno::Any
> SAL_CALL
OStyle::getPropertyDefaults( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
493 uno::Sequence
< uno::Any
> aRet(aPropertyNames
.getLength());
494 const ::rtl::OUString
* pIter
= aPropertyNames
.getConstArray();
495 const ::rtl::OUString
* pEnd
= pIter
+ aPropertyNames
.getLength();
496 for(sal_Int32 i
= 0;pIter
!= pEnd
;++pIter
,++i
)
497 aRet
[i
] = getPropertyDefault(*pIter
);
500 // -----------------------------------------------------------------------------
501 struct OReportDefinitionImpl
503 uno::WeakReference
< uno::XInterface
> m_xParent
;
504 ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners
;
505 ::cppu::OInterfaceContainerHelper m_aCloseListener
;
506 ::cppu::OInterfaceContainerHelper m_aModifyListeners
;
507 ::cppu::OInterfaceContainerHelper m_aDocEventListeners
;
508 ::std::vector
< uno::Reference
< frame::XController
> > m_aControllers
;
509 uno::Sequence
< beans::PropertyValue
> m_aArgs
;
511 uno::Reference
< report::XGroups
> m_xGroups
;
512 uno::Reference
< report::XSection
> m_xReportHeader
;
513 uno::Reference
< report::XSection
> m_xReportFooter
;
514 uno::Reference
< report::XSection
> m_xPageHeader
;
515 uno::Reference
< report::XSection
> m_xPageFooter
;
516 uno::Reference
< report::XSection
> m_xDetail
;
517 uno::Reference
< embed::XStorage
> m_xStorage
;
518 uno::Reference
< frame::XController
> m_xCurrentController
;
519 uno::Reference
< container::XIndexAccess
> m_xViewData
;
520 uno::Reference
< container::XNameAccess
> m_xStyles
;
521 uno::Reference
< container::XNameAccess
> m_xXMLNamespaceMap
;
522 uno::Reference
< container::XNameAccess
> m_xGradientTable
;
523 uno::Reference
< container::XNameAccess
> m_xHatchTable
;
524 uno::Reference
< container::XNameAccess
> m_xBitmapTable
;
525 uno::Reference
< container::XNameAccess
> m_xTransparencyGradientTable
;
526 uno::Reference
< container::XNameAccess
> m_xDashTable
;
527 uno::Reference
< container::XNameAccess
> m_xMarkerTable
;
528 uno::Reference
< report::XFunctions
> m_xFunctions
;
529 uno::Reference
< ui::XUIConfigurationManager
> m_xUIConfigurationManager
;
530 uno::Reference
< util::XNumberFormatsSupplier
> m_xNumberFormatsSupplier
;
531 uno::Reference
< sdbc::XConnection
> m_xActiveConnection
;
532 uno::Reference
< frame::XTitle
> m_xTitleHelper
;
533 uno::Reference
< frame::XUntitledNumbers
> m_xNumberedControllers
;
534 uno::Reference
< document::XDocumentProperties
> m_xDocumentProperties
;
536 ::boost::shared_ptr
< ::comphelper::EmbeddedObjectContainer
>
538 ::boost::shared_ptr
<rptui::OReportModel
> m_pReportModel
;
539 ::rtl::OUString m_sCaption
;
540 ::rtl::OUString m_sCommand
;
541 ::rtl::OUString m_sFilter
;
542 ::rtl::OUString m_sMimeType
;
543 ::rtl::OUString m_sIdentifier
;
544 ::rtl::OUString m_sDataSourceName
;
545 awt::Size m_aVisualAreaSize
;
546 ::sal_Int64 m_nAspect
;
547 ::sal_Int16 m_nGroupKeepTogether
;
548 ::sal_Int16 m_nPageHeaderOption
;
549 ::sal_Int16 m_nPageFooterOption
;
550 ::sal_Int32 m_nCommandType
;
551 sal_Bool m_bControllersLocked
;
552 sal_Bool m_bModified
;
553 sal_Bool m_bEscapeProcessing
;
554 OReportDefinitionImpl(::osl::Mutex
& _aMutex
)
555 :m_aStorageChangeListeners(_aMutex
)
556 ,m_aCloseListener(_aMutex
)
557 ,m_aModifyListeners(_aMutex
)
558 ,m_aDocEventListeners(_aMutex
)
559 ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT
)
560 ,m_sIdentifier(SERVICE_REPORTDEFINITION
)
561 ,m_nGroupKeepTogether(0)
562 ,m_nPageHeaderOption(0)
563 ,m_nPageFooterOption(0)
564 ,m_nCommandType(sdb::CommandType::TABLE
)
565 ,m_bControllersLocked(sal_False
)
566 ,m_bModified(sal_False
)
567 ,m_bEscapeProcessing(sal_True
)
570 OReportDefinitionImpl(::osl::Mutex
& _aMutex
,const OReportDefinitionImpl
& _aCopy
)
571 :m_aStorageChangeListeners(_aMutex
)
572 ,m_aCloseListener(_aMutex
)
573 ,m_aModifyListeners(_aMutex
)
574 ,m_aDocEventListeners(_aMutex
)
575 ,m_sMimeType(_aCopy
.m_sMimeType
)
576 ,m_sIdentifier(_aCopy
.m_sIdentifier
)
577 ,m_nGroupKeepTogether(_aCopy
.m_nGroupKeepTogether
)
578 ,m_nPageHeaderOption(_aCopy
.m_nPageHeaderOption
)
579 ,m_nPageFooterOption(_aCopy
.m_nPageFooterOption
)
580 ,m_nCommandType(_aCopy
.m_nCommandType
)
581 ,m_bControllersLocked(_aCopy
.m_bControllersLocked
)
582 ,m_bModified(_aCopy
.m_bModified
)
583 ,m_bEscapeProcessing(_aCopy
.m_bEscapeProcessing
)
585 ~OReportDefinitionImpl();
587 OReportDefinitionImpl::~OReportDefinitionImpl()
591 DBG_NAME( rpt_OReportDefinition
)
592 // -----------------------------------------------------------------------------
593 OReportDefinition::OReportDefinition(uno::Reference
< uno::XComponentContext
> const & _xContext
)
594 : ReportDefinitionBase(m_aMutex
)
595 ,ReportDefinitionPropertySet(_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< ::rtl::OUString
>())
596 ,m_aProps(new OReportComponentProperties(_xContext
))
597 ,m_pImpl(new OReportDefinitionImpl(m_aMutex
))
599 DBG_CTOR( rpt_OReportDefinition
,NULL
);
600 m_aProps
->m_sName
= RPT_RESSTRING(RID_STR_REPORT
,m_aProps
->m_xContext
->getServiceManager());
601 osl_incrementInterlockedCount(&m_refCount
);
604 m_pImpl
->m_xGroups
= new OGroups(this,m_aProps
->m_xContext
);
605 m_pImpl
->m_xDetail
= new OSection(this,m_aProps
->m_xContext
);
606 m_pImpl
->m_xDetail
->setName(RPT_RESSTRING(RID_STR_DETAIL
,m_aProps
->m_xContext
->getServiceManager()));
608 osl_decrementInterlockedCount( &m_refCount
);
610 // -----------------------------------------------------------------------------
611 OReportDefinition::OReportDefinition(uno::Reference
< uno::XComponentContext
> const & _xContext
612 ,const uno::Reference
< lang::XMultiServiceFactory
>& _xFactory
613 ,uno::Reference
< drawing::XShape
>& _xShape
)
614 : ReportDefinitionBase(m_aMutex
)
615 ,ReportDefinitionPropertySet(_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< ::rtl::OUString
>())
616 ,m_aProps(new OReportComponentProperties(_xContext
))
617 ,m_pImpl(new OReportDefinitionImpl(m_aMutex
))
619 m_aProps
->m_sName
= RPT_RESSTRING(RID_STR_REPORT
,m_aProps
->m_xContext
->getServiceManager());
620 m_aProps
->m_xFactory
= _xFactory
;
621 osl_incrementInterlockedCount(&m_refCount
);
623 m_aProps
->setShape(_xShape
,this,m_refCount
);
625 m_pImpl
->m_xGroups
= new OGroups(this,m_aProps
->m_xContext
);
626 m_pImpl
->m_xDetail
= new OSection(this,m_aProps
->m_xContext
);
627 m_pImpl
->m_xDetail
->setName(RPT_RESSTRING(RID_STR_DETAIL
,m_aProps
->m_xContext
->getServiceManager()));
629 osl_decrementInterlockedCount( &m_refCount
);
631 // -----------------------------------------------------------------------------
632 OReportDefinition::OReportDefinition(const OReportDefinition
& _rCopy
)
634 ,ReportDefinitionBase(m_aMutex
)
635 ,ReportDefinitionPropertySet(_rCopy
.m_aProps
->m_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< ::rtl::OUString
>())
636 ,comphelper::IEmbeddedHelper()
637 ,m_aProps(new OReportComponentProperties(*_rCopy
.m_aProps
))
638 ,m_pImpl(new OReportDefinitionImpl(m_aMutex
,*_rCopy
.m_pImpl
))
640 DBG_CTOR( rpt_OReportDefinition
,NULL
);
641 osl_incrementInterlockedCount(&m_refCount
);
644 OGroups
* pGroups
= new OGroups(this,m_aProps
->m_xContext
);
645 m_pImpl
->m_xGroups
= pGroups
;
646 pGroups
->copyGroups(_rCopy
.m_pImpl
->m_xGroups
);
647 m_pImpl
->m_xDetail
= new OSection(this,m_aProps
->m_xContext
);
648 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xDetail
,m_pImpl
->m_xDetail
);
650 setPageHeaderOn(_rCopy
.m_pImpl
->m_xPageHeader
.is());
651 setPageFooterOn(_rCopy
.m_pImpl
->m_xPageFooter
.is());
652 setReportHeaderOn(_rCopy
.m_pImpl
->m_xReportHeader
.is());
653 setReportFooterOn(_rCopy
.m_pImpl
->m_xReportFooter
.is());
654 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xPageHeader
,m_pImpl
->m_xPageHeader
);
655 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xPageFooter
,m_pImpl
->m_xPageFooter
);
656 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xReportHeader
,m_pImpl
->m_xReportHeader
);
657 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xReportFooter
,m_pImpl
->m_xReportFooter
);
659 osl_decrementInterlockedCount( &m_refCount
);
661 // -----------------------------------------------------------------------------
662 OReportDefinition::~OReportDefinition()
664 DBG_DTOR( rpt_OReportDefinition
,NULL
);
665 if ( !ReportDefinitionBase::rBHelper
.bInDispose
&& !ReportDefinitionBase::rBHelper
.bDisposed
)
671 // -----------------------------------------------------------------------------
672 IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition
, ReportDefinitionBase
)
673 //IMPLEMENT_FORWARD_XINTERFACE2(OReportDefinition,ReportDefinitionBase,ReportDefinitionPropertySet)
674 void OReportDefinition::init()
678 m_pImpl
->m_pReportModel
.reset(new OReportModel(this));
679 m_pImpl
->m_pReportModel
->GetItemPool().FreezeIdRanges();
680 m_pImpl
->m_pReportModel
->SetScaleUnit( MAP_100TH_MM
);
681 SdrLayerAdmin
& rAdmin
= m_pImpl
->m_pReportModel
->GetLayerAdmin();
682 rAdmin
.NewStandardLayer();
683 rAdmin
.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ) );
684 m_pImpl
->m_xFunctions
= new OFunctions(this,m_aProps
->m_xContext
);
685 if ( !m_pImpl
->m_xStorage
.is() )
686 m_pImpl
->m_xStorage
= ::comphelper::OStorageHelper::GetTemporaryStorage();
688 uno::Reference
<beans::XPropertySet
> xStorProps(m_pImpl
->m_xStorage
,uno::UNO_QUERY
);
689 if ( xStorProps
.is())
691 ::rtl::OUString sMediaType
;
692 xStorProps
->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType"))) >>= sMediaType
;
693 if ( !sMediaType
.getLength() )
694 xStorProps
->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT
));
696 m_pImpl
->m_pObjectContainer
.reset( new comphelper::EmbeddedObjectContainer(m_pImpl
->m_xStorage
, static_cast<cppu::OWeakObject
*>(this) ) );
698 catch(uno::Exception
)
700 OSL_ENSURE(0,"Error!");
703 // -----------------------------------------------------------------------------
704 void SAL_CALL
OReportDefinition::dispose() throw(uno::RuntimeException
)
706 ReportDefinitionPropertySet::dispose();
707 cppu::WeakComponentImplHelperBase::dispose();
709 // -----------------------------------------------------------------------------
710 void SAL_CALL
OReportDefinition::disposing()
712 m_pImpl
->m_aControllers
.clear();
713 uno::Reference
< frame::XModel
> xHoldAlive( this );
715 notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnUnload")));
717 lang::EventObject
aDisposeEvent( static_cast< ::cppu::OWeakObject
* >( this ) );
718 m_pImpl
->m_aModifyListeners
.disposeAndClear( aDisposeEvent
);
719 m_pImpl
->m_aCloseListener
.disposeAndClear( aDisposeEvent
);
720 m_pImpl
->m_aDocEventListeners
.disposeAndClear( aDisposeEvent
);
721 m_pImpl
->m_aStorageChangeListeners
.disposeAndClear( aDisposeEvent
);
723 ::comphelper::disposeComponent(m_pImpl
->m_xGroups
);
724 m_pImpl
->m_xReportHeader
.clear();
725 m_pImpl
->m_xReportFooter
.clear();
726 m_pImpl
->m_xPageHeader
.clear();
727 m_pImpl
->m_xPageFooter
.clear();
728 m_pImpl
->m_xDetail
.clear();
729 //::comphelper::disposeComponent(m_pImpl->m_xReportHeader);
730 //::comphelper::disposeComponent(m_pImpl->m_xReportFooter);
731 //::comphelper::disposeComponent(m_pImpl->m_xPageHeader);
732 //::comphelper::disposeComponent(m_pImpl->m_xPageFooter);
733 //::comphelper::disposeComponent(m_pImpl->m_xDetail);
734 ::comphelper::disposeComponent(m_pImpl
->m_xFunctions
);
736 //::comphelper::disposeComponent(m_pImpl->m_xStorage);
737 // don't dispose, this currently is the task of either the ref count going to
738 // 0, or of the embedded object (if we're embedded, which is the only possible
740 // #i78366# / 2007-06-18 / frank.schoenheit@sun.com
741 m_pImpl
->m_xStorage
.clear();
742 m_pImpl
->m_xViewData
.clear();
743 m_pImpl
->m_xCurrentController
.clear();
744 m_pImpl
->m_xNumberFormatsSupplier
.clear();
745 m_pImpl
->m_xStyles
.clear();
746 m_pImpl
->m_xXMLNamespaceMap
.clear();
747 m_pImpl
->m_xGradientTable
.clear();
748 m_pImpl
->m_xHatchTable
.clear();
749 m_pImpl
->m_xBitmapTable
.clear();
750 m_pImpl
->m_xTransparencyGradientTable
.clear();
751 m_pImpl
->m_xDashTable
.clear();
752 m_pImpl
->m_xMarkerTable
.clear();
753 m_pImpl
->m_xUIConfigurationManager
.clear();
754 m_pImpl
->m_pReportModel
.reset();
755 m_pImpl
->m_pObjectContainer
.reset();
756 m_pImpl
->m_aArgs
.realloc(0);
757 m_pImpl
->m_xTitleHelper
.clear();
758 m_pImpl
->m_xNumberedControllers
.clear();
761 // -----------------------------------------------------------------------------
762 ::rtl::OUString
OReportDefinition::getImplementationName_Static( ) throw(uno::RuntimeException
)
764 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportDefinition"));
767 //--------------------------------------------------------------------------
768 ::rtl::OUString SAL_CALL
OReportDefinition::getImplementationName( ) throw(uno::RuntimeException
)
770 return getImplementationName_Static();
772 //--------------------------------------------------------------------------
773 uno::Sequence
< ::rtl::OUString
> OReportDefinition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException
)
775 uno::Sequence
< ::rtl::OUString
> aServices(1);
776 aServices
.getArray()[0] = SERVICE_REPORTDEFINITION
;
780 // --------------------------------------------------------------------------------
781 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getSupportedServiceNames( ) throw(uno::RuntimeException
)
783 // first collect the services which are supported by our aggregate
784 uno::Sequence
< ::rtl::OUString
> aSupported
;
785 if ( m_aProps
->m_xServiceInfo
.is() )
786 aSupported
= m_aProps
->m_xServiceInfo
->getSupportedServiceNames();
788 // append our own service, if necessary
789 if ( 0 == ::comphelper::findValue( aSupported
, SERVICE_REPORTDEFINITION
, sal_True
).getLength() )
791 sal_Int32 nLen
= aSupported
.getLength();
792 aSupported
.realloc( nLen
+ 1 );
793 aSupported
[ nLen
] = SERVICE_REPORTDEFINITION
;
800 // --------------------------------------------------------------------------------
801 sal_Bool SAL_CALL
OReportDefinition::supportsService( const ::rtl::OUString
& _rServiceName
) throw(uno::RuntimeException
)
803 return ::comphelper::findValue( getSupportedServiceNames(), _rServiceName
, sal_True
).getLength() != 0;
806 // --------------------------------------------------------------------------------
807 uno::Any SAL_CALL
OReportDefinition::queryInterface( const uno::Type
& _rType
) throw (uno::RuntimeException
)
809 uno::Any aReturn
= ReportDefinitionBase::queryInterface(_rType
);
810 if ( !aReturn
.hasValue() )
811 aReturn
= ReportDefinitionPropertySet::queryInterface(_rType
);
813 return aReturn
.hasValue() ? aReturn
: (m_aProps
->m_xProxy
.is() ? m_aProps
->m_xProxy
->queryAggregation(_rType
) : aReturn
);
815 // --------------------------------------------------------------------------------
816 uno::Sequence
< uno::Type
> SAL_CALL
OReportDefinition::getTypes( ) throw (uno::RuntimeException
)
818 if ( m_aProps
->m_xTypeProvider
.is() )
819 return ::comphelper::concatSequences(
820 ReportDefinitionBase::getTypes(),
821 m_aProps
->m_xTypeProvider
->getTypes()
823 return ReportDefinitionBase::getTypes();
825 //------------------------------------------------------------------------------
826 uno::Reference
< uno::XInterface
> OReportDefinition::create(uno::Reference
< uno::XComponentContext
> const & xContext
)
828 return *(new OReportDefinition(xContext
));
831 // -----------------------------------------------------------------------------
833 ::rtl::OUString SAL_CALL
OReportDefinition::getCaption() throw (uno::RuntimeException
)
835 ::osl::MutexGuard
aGuard(m_aMutex
);
836 return m_pImpl
->m_sCaption
;
838 // -----------------------------------------------------------------------------
839 void SAL_CALL
OReportDefinition::setCaption( const ::rtl::OUString
& _caption
) throw (uno::RuntimeException
)
841 set(PROPERTY_CAPTION
,_caption
,m_pImpl
->m_sCaption
);
843 // -----------------------------------------------------------------------------
844 ::sal_Int16 SAL_CALL
OReportDefinition::getGroupKeepTogether() throw (uno::RuntimeException
)
846 ::osl::MutexGuard
aGuard(m_aMutex
);
847 return m_pImpl
->m_nGroupKeepTogether
;
849 // -----------------------------------------------------------------------------
850 void SAL_CALL
OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether
) throw (uno::RuntimeException
)
852 if ( _groupkeeptogether
< report::GroupKeepTogether::PER_PAGE
|| _groupkeeptogether
> report::GroupKeepTogether::PER_COLUMN
)
853 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::GroupKeepTogether"))
856 ,m_aProps
->m_xContext
);
857 set(PROPERTY_GROUPKEEPTOGETHER
,_groupkeeptogether
,m_pImpl
->m_nGroupKeepTogether
);
859 // -----------------------------------------------------------------------------
860 ::sal_Int16 SAL_CALL
OReportDefinition::getPageHeaderOption() throw (uno::RuntimeException
)
862 ::osl::MutexGuard
aGuard(m_aMutex
);
863 return m_pImpl
->m_nPageHeaderOption
;
865 // -----------------------------------------------------------------------------
866 void SAL_CALL
OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption
) throw (uno::RuntimeException
)
868 if ( _pageheaderoption
< report::ReportPrintOption::ALL_PAGES
|| _pageheaderoption
> report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER
)
869 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption"))
872 ,m_aProps
->m_xContext
);
873 set(PROPERTY_PAGEHEADEROPTION
,_pageheaderoption
,m_pImpl
->m_nPageHeaderOption
);
875 // -----------------------------------------------------------------------------
876 ::sal_Int16 SAL_CALL
OReportDefinition::getPageFooterOption() throw (uno::RuntimeException
)
878 ::osl::MutexGuard
aGuard(m_aMutex
);
879 return m_pImpl
->m_nPageFooterOption
;
881 // -----------------------------------------------------------------------------
882 void SAL_CALL
OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption
) throw (uno::RuntimeException
)
884 if ( _pagefooteroption
< report::ReportPrintOption::ALL_PAGES
|| _pagefooteroption
> report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER
)
885 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption"))
888 ,m_aProps
->m_xContext
);
889 set(PROPERTY_PAGEFOOTEROPTION
,_pagefooteroption
,m_pImpl
->m_nPageFooterOption
);
891 // -----------------------------------------------------------------------------
892 ::rtl::OUString SAL_CALL
OReportDefinition::getCommand() throw (uno::RuntimeException
)
894 ::osl::MutexGuard
aGuard(m_aMutex
);
895 return m_pImpl
->m_sCommand
;
897 // -----------------------------------------------------------------------------
898 void SAL_CALL
OReportDefinition::setCommand( const ::rtl::OUString
& _command
) throw (uno::RuntimeException
)
900 set(PROPERTY_COMMAND
,_command
,m_pImpl
->m_sCommand
);
902 // -----------------------------------------------------------------------------
903 ::sal_Int32 SAL_CALL
OReportDefinition::getCommandType() throw (uno::RuntimeException
)
905 ::osl::MutexGuard
aGuard(m_aMutex
);
906 return m_pImpl
->m_nCommandType
;
908 // -----------------------------------------------------------------------------
909 void SAL_CALL
OReportDefinition::setCommandType( ::sal_Int32 _commandtype
) throw (uno::RuntimeException
)
911 if ( _commandtype
< sdb::CommandType::TABLE
|| _commandtype
> sdb::CommandType::COMMAND
)
912 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::sdb::CommandType"))
915 ,m_aProps
->m_xContext
);
916 set(PROPERTY_COMMANDTYPE
,_commandtype
,m_pImpl
->m_nCommandType
);
918 // -----------------------------------------------------------------------------
919 ::rtl::OUString SAL_CALL
OReportDefinition::getFilter() throw (uno::RuntimeException
)
921 ::osl::MutexGuard
aGuard(m_aMutex
);
922 return m_pImpl
->m_sFilter
;
924 // -----------------------------------------------------------------------------
925 void SAL_CALL
OReportDefinition::setFilter( const ::rtl::OUString
& _filter
) throw (uno::RuntimeException
)
927 set(PROPERTY_FILTER
,_filter
,m_pImpl
->m_sFilter
);
929 // -----------------------------------------------------------------------------
930 ::sal_Bool SAL_CALL
OReportDefinition::getEscapeProcessing() throw (uno::RuntimeException
)
932 ::osl::MutexGuard
aGuard(m_aMutex
);
933 return m_pImpl
->m_bEscapeProcessing
;
935 // -----------------------------------------------------------------------------
936 void SAL_CALL
OReportDefinition::setEscapeProcessing( ::sal_Bool _escapeprocessing
) throw (uno::RuntimeException
)
938 set(PROPERTY_ESCAPEPROCESSING
,_escapeprocessing
,m_pImpl
->m_bEscapeProcessing
);
940 // -----------------------------------------------------------------------------
941 ::sal_Bool SAL_CALL
OReportDefinition::getReportHeaderOn() throw (uno::RuntimeException
)
943 ::osl::MutexGuard
aGuard(m_aMutex
);
944 return m_pImpl
->m_xReportHeader
.is();
946 // -----------------------------------------------------------------------------
947 void SAL_CALL
OReportDefinition::setReportHeaderOn( ::sal_Bool _reportheaderon
) throw (uno::RuntimeException
)
949 if ( _reportheaderon
!= m_pImpl
->m_xReportHeader
.is() )
951 setSection(PROPERTY_REPORTHEADERON
,_reportheaderon
,RPT_RESSTRING(RID_STR_REPORT_HEADER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xReportHeader
);
954 // -----------------------------------------------------------------------------
955 ::sal_Bool SAL_CALL
OReportDefinition::getReportFooterOn() throw (uno::RuntimeException
)
957 ::osl::MutexGuard
aGuard(m_aMutex
);
958 return m_pImpl
->m_xReportFooter
.is();
960 // -----------------------------------------------------------------------------
961 void SAL_CALL
OReportDefinition::setReportFooterOn( ::sal_Bool _reportfooteron
) throw (uno::RuntimeException
)
963 if ( _reportfooteron
!= m_pImpl
->m_xReportFooter
.is() )
965 setSection(PROPERTY_REPORTFOOTERON
,_reportfooteron
,RPT_RESSTRING(RID_STR_REPORT_FOOTER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xReportFooter
);
968 // -----------------------------------------------------------------------------
969 ::sal_Bool SAL_CALL
OReportDefinition::getPageHeaderOn() throw (uno::RuntimeException
)
971 ::osl::MutexGuard
aGuard(m_aMutex
);
972 return m_pImpl
->m_xPageHeader
.is();
974 // -----------------------------------------------------------------------------
975 void SAL_CALL
OReportDefinition::setPageHeaderOn( ::sal_Bool _pageheaderon
) throw (uno::RuntimeException
)
977 if ( _pageheaderon
!= m_pImpl
->m_xPageHeader
.is() )
979 setSection(PROPERTY_PAGEHEADERON
,_pageheaderon
,RPT_RESSTRING(RID_STR_PAGE_HEADER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xPageHeader
);
982 // -----------------------------------------------------------------------------
983 ::sal_Bool SAL_CALL
OReportDefinition::getPageFooterOn() throw (uno::RuntimeException
)
985 ::osl::MutexGuard
aGuard(m_aMutex
);
986 return m_pImpl
->m_xPageFooter
.is();
988 // -----------------------------------------------------------------------------
989 void SAL_CALL
OReportDefinition::setPageFooterOn( ::sal_Bool _pagefooteron
) throw (uno::RuntimeException
)
991 if ( _pagefooteron
!= m_pImpl
->m_xPageFooter
.is() )
993 setSection(PROPERTY_PAGEFOOTERON
,_pagefooteron
,RPT_RESSTRING(RID_STR_PAGE_FOOTER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xPageFooter
);
996 // -----------------------------------------------------------------------------
997 uno::Reference
< report::XGroups
> SAL_CALL
OReportDefinition::getGroups() throw (uno::RuntimeException
)
999 ::osl::MutexGuard
aGuard(m_aMutex
);
1000 return m_pImpl
->m_xGroups
;
1002 // -----------------------------------------------------------------------------
1003 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getReportHeader() throw (container::NoSuchElementException
, uno::RuntimeException
)
1005 ::osl::MutexGuard
aGuard(m_aMutex
);
1006 if ( !m_pImpl
->m_xReportHeader
.is() )
1007 throw container::NoSuchElementException();
1008 return m_pImpl
->m_xReportHeader
;
1010 // -----------------------------------------------------------------------------
1011 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getPageHeader() throw (container::NoSuchElementException
, uno::RuntimeException
)
1013 ::osl::MutexGuard
aGuard(m_aMutex
);
1014 if ( !m_pImpl
->m_xPageHeader
.is() )
1015 throw container::NoSuchElementException();
1016 return m_pImpl
->m_xPageHeader
;
1018 // -----------------------------------------------------------------------------
1019 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getDetail() throw (uno::RuntimeException
)
1021 ::osl::MutexGuard
aGuard(m_aMutex
);
1022 return m_pImpl
->m_xDetail
;
1024 // -----------------------------------------------------------------------------
1025 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getPageFooter() throw (container::NoSuchElementException
, uno::RuntimeException
)
1027 ::osl::MutexGuard
aGuard(m_aMutex
);
1028 if ( !m_pImpl
->m_xPageFooter
.is() )
1029 throw container::NoSuchElementException();
1030 return m_pImpl
->m_xPageFooter
;
1032 // -----------------------------------------------------------------------------
1033 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getReportFooter() throw (container::NoSuchElementException
, uno::RuntimeException
)
1035 ::osl::MutexGuard
aGuard(m_aMutex
);
1036 if ( !m_pImpl
->m_xReportFooter
.is() )
1037 throw container::NoSuchElementException();
1038 return m_pImpl
->m_xReportFooter
;
1040 //------------------------------------------------------------------------------
1041 uno::Reference
< document::XEventBroadcaster
> SAL_CALL
OReportDefinition::getEventBroadcaster( ) throw (lang::DisposedException
, uno::Exception
, uno::RuntimeException
)
1043 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1046 //------------------------------------------------------------------------------
1048 REPORTCOMPONENT_MASTERDETAIL(OReportDefinition
,*m_aProps
)
1049 REPORTCOMPONENT_IMPL(OReportDefinition
,*m_aProps
)
1050 REPORTCOMPONENT_IMPL2(OReportDefinition
,*m_aProps
)
1052 // -----------------------------------------------------------------------------
1053 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
OReportDefinition::getPropertySetInfo( ) throw(uno::RuntimeException
)
1055 return ReportDefinitionPropertySet::getPropertySetInfo();
1057 // -----------------------------------------------------------------------------
1058 void SAL_CALL
OReportDefinition::setPropertyValue( const ::rtl::OUString
& aPropertyName
, const uno::Any
& aValue
) throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1060 ReportDefinitionPropertySet::setPropertyValue( aPropertyName
, aValue
);
1062 // -----------------------------------------------------------------------------
1063 uno::Any SAL_CALL
OReportDefinition::getPropertyValue( const ::rtl::OUString
& PropertyName
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1065 return ReportDefinitionPropertySet::getPropertyValue( PropertyName
);
1067 // -----------------------------------------------------------------------------
1068 void SAL_CALL
OReportDefinition::addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& xListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1070 ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName
, xListener
);
1072 // -----------------------------------------------------------------------------
1073 void SAL_CALL
OReportDefinition::removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1075 ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName
, aListener
);
1077 // -----------------------------------------------------------------------------
1078 void SAL_CALL
OReportDefinition::addVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1080 ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName
, aListener
);
1082 // -----------------------------------------------------------------------------
1083 void SAL_CALL
OReportDefinition::removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1085 ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName
, aListener
);
1087 // -----------------------------------------------------------------------------
1089 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::getParent( ) throw (uno::RuntimeException
)
1091 ::osl::MutexGuard
aGuard(m_aMutex
);
1092 uno::Reference
< container::XChild
> xChild
;
1093 comphelper::query_aggregation(m_aProps
->m_xProxy
,xChild
);
1095 return xChild
->getParent();
1096 return m_pImpl
->m_xParent
;
1098 // -----------------------------------------------------------------------------
1099 void SAL_CALL
OReportDefinition::setParent( const uno::Reference
< uno::XInterface
>& Parent
) throw (lang::NoSupportException
, uno::RuntimeException
)
1101 ::osl::MutexGuard
aGuard(m_aMutex
);
1102 m_aProps
->m_xParent
= uno::Reference
< container::XChild
>(Parent
,uno::UNO_QUERY
);
1103 m_pImpl
->m_xParent
= Parent
;
1104 uno::Reference
< container::XChild
> xChild
;
1105 comphelper::query_aggregation(m_aProps
->m_xProxy
,xChild
);
1107 xChild
->setParent(Parent
);
1109 // -----------------------------------------------------------------------------
1111 uno::Reference
< util::XCloneable
> SAL_CALL
OReportDefinition::createClone( ) throw (uno::RuntimeException
)
1113 OSL_ENSURE(0,"Not yet implemented correctly");
1114 uno::Reference
< report::XReportComponent
> xSource
= this;
1115 uno::Reference
< report::XReportDefinition
> xSet(cloneObject(xSource
,m_aProps
->m_xFactory
,SERVICE_REPORTDEFINITION
),uno::UNO_QUERY_THROW
);
1118 // -----------------------------------------------------------------------------
1119 void OReportDefinition::setSection( const ::rtl::OUString
& _sProperty
1120 ,const sal_Bool
& _bOn
1121 ,const ::rtl::OUString
& _sName
1122 ,uno::Reference
< report::XSection
>& _member
)
1126 ::osl::MutexGuard
aGuard(m_aMutex
);
1127 prepareSet(_sProperty
, uno::makeAny(_member
), uno::makeAny(_bOn
), &l
);
1128 lcl_createSectionIfNeeded(_bOn
,this,_member
,_sProperty
== PROPERTY_PAGEHEADERON
|| _sProperty
== PROPERTY_PAGEFOOTERON
);
1130 _member
->setName(_sName
);
1134 // -----------------------------------------------------------------------------
1135 // XCloseBroadcaster
1136 void SAL_CALL
OReportDefinition::addCloseListener( const uno::Reference
< util::XCloseListener
>& _xListener
) throw (uno::RuntimeException
)
1138 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1139 if ( _xListener
.is() )
1140 m_pImpl
->m_aCloseListener
.addInterface(_xListener
);
1142 // -----------------------------------------------------------------------------
1143 void SAL_CALL
OReportDefinition::removeCloseListener( const uno::Reference
< util::XCloseListener
>& _xListener
) throw (uno::RuntimeException
)
1145 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1146 m_pImpl
->m_aCloseListener
.removeInterface(_xListener
);
1148 // -----------------------------------------------------------------------------
1150 void SAL_CALL
OReportDefinition::close( ::sal_Bool _bDeliverOwnership
) throw (util::CloseVetoException
, uno::RuntimeException
)
1152 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
1154 ::osl::ResettableMutexGuard
aGuard(m_aMutex
);
1155 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1156 // notify our container listeners
1157 lang::EventObject
aEvt( static_cast< ::cppu::OWeakObject
* >( this ) );
1159 m_pImpl
->m_aCloseListener
.forEach
<util::XCloseListener
>(
1160 ::boost::bind(&util::XCloseListener::queryClosing
,_1
,boost::cref(aEvt
),boost::cref(_bDeliverOwnership
)));
1164 ::std::vector
< uno::Reference
< frame::XController
> > aCopy
= m_pImpl
->m_aControllers
;
1165 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aIter
= aCopy
.begin();
1166 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aEnd
= aCopy
.end();
1167 for (;aIter
!= aEnd
; ++aIter
)
1173 uno::Reference
< util::XCloseable
> xFrame( (*aIter
)->getFrame(), uno::UNO_QUERY
);
1175 xFrame
->close( _bDeliverOwnership
);
1177 catch( const util::CloseVetoException
& ) { throw; }
1178 catch( const uno::Exception
& )
1180 OSL_ENSURE( sal_False
, "ODatabaseDocument::impl_closeControllerFrames: caught an unexpected exception!" );
1186 m_pImpl
->m_aCloseListener
.notifyEach(&util::XCloseListener::notifyClosing
,aEvt
);
1191 // -----------------------------------------------------------------------------
1193 ::sal_Bool SAL_CALL
OReportDefinition::attachResource( const ::rtl::OUString
& /*_rURL*/, const uno::Sequence
< beans::PropertyValue
>& _aArguments
) throw (uno::RuntimeException
)
1195 // LLA: we had a deadlock problem in our context, so we get the SolarMutex earlier.
1196 ::vos::OClearableGuard
aSolarGuard( Application::GetSolarMutex() );
1198 ::osl::MutexGuard
aGuard(m_aMutex
);
1199 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1200 ::comphelper::MediaDescriptor
aDescriptor( _aArguments
);
1201 fillArgs(aDescriptor
);
1204 // -----------------------------------------------------------------------------
1205 void OReportDefinition::fillArgs(::comphelper::MediaDescriptor
& _aDescriptor
)
1207 uno::Sequence
<beans::PropertyValue
> aComponentData
;
1208 aComponentData
= _aDescriptor
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComponentData")),aComponentData
);
1209 if ( aComponentData
.getLength() && (!m_pImpl
->m_xActiveConnection
.is() || !m_pImpl
->m_xNumberFormatsSupplier
.is()) )
1211 ::comphelper::SequenceAsHashMap
aComponentDataMap( aComponentData
);
1212 m_pImpl
->m_xActiveConnection
= aComponentDataMap
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),m_pImpl
->m_xActiveConnection
);
1213 m_pImpl
->m_xNumberFormatsSupplier
= dbtools::getNumberFormats(m_pImpl
->m_xActiveConnection
);
1215 if ( !m_pImpl
->m_xNumberFormatsSupplier
.is() )
1217 m_pImpl
->m_xNumberFormatsSupplier
.set(
1218 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
1219 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier")) ,m_aProps
->m_xContext
),
1220 uno::UNO_QUERY_THROW
1223 lcl_stripLoadArguments( _aDescriptor
, m_pImpl
->m_aArgs
);
1224 ::rtl::OUString sCaption
;
1225 sCaption
= _aDescriptor
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")),sCaption
);
1226 setCaption(sCaption
);
1228 // -----------------------------------------------------------------------------
1229 ::rtl::OUString SAL_CALL
OReportDefinition::getURL( ) throw (uno::RuntimeException
)
1231 return ::rtl::OUString();
1233 // -----------------------------------------------------------------------------
1234 uno::Sequence
< beans::PropertyValue
> SAL_CALL
OReportDefinition::getArgs( ) throw (uno::RuntimeException
)
1236 ::osl::MutexGuard
aGuard(m_aMutex
);
1237 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1238 return m_pImpl
->m_aArgs
;
1240 // -----------------------------------------------------------------------------
1241 void SAL_CALL
OReportDefinition::connectController( const uno::Reference
< frame::XController
>& _xController
) throw (uno::RuntimeException
)
1243 ::osl::MutexGuard
aGuard(m_aMutex
);
1244 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1245 m_pImpl
->m_aControllers
.push_back(_xController
);
1247 if ( _xController
.is() && m_pImpl
->m_xViewData
.is() && ( nCount
= m_pImpl
->m_xViewData
->getCount()) != 0)
1249 _xController
->restoreViewData(m_pImpl
->m_xViewData
->getByIndex(nCount
- 1));
1252 // -----------------------------------------------------------------------------
1253 void SAL_CALL
OReportDefinition::disconnectController( const uno::Reference
< frame::XController
>& _xController
) throw (uno::RuntimeException
)
1255 ::osl::MutexGuard
aGuard(m_aMutex
);
1256 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1257 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aFind
= ::std::find(m_pImpl
->m_aControllers
.begin(),m_pImpl
->m_aControllers
.end(),_xController
);
1258 if ( aFind
!= m_pImpl
->m_aControllers
.end() )
1259 m_pImpl
->m_aControllers
.erase(aFind
);
1260 if ( m_pImpl
->m_xCurrentController
== _xController
)
1261 m_pImpl
->m_xCurrentController
.clear();
1263 // -----------------------------------------------------------------------------
1264 void SAL_CALL
OReportDefinition::lockControllers( ) throw (uno::RuntimeException
)
1266 ::osl::MutexGuard
aGuard(m_aMutex
);
1267 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1268 m_pImpl
->m_bControllersLocked
= sal_True
;
1270 // -----------------------------------------------------------------------------
1271 void SAL_CALL
OReportDefinition::unlockControllers( ) throw (uno::RuntimeException
)
1273 ::osl::MutexGuard
aGuard(m_aMutex
);
1274 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1275 m_pImpl
->m_bControllersLocked
= sal_False
;
1277 // -----------------------------------------------------------------------------
1278 ::sal_Bool SAL_CALL
OReportDefinition::hasControllersLocked( ) throw (uno::RuntimeException
)
1280 ::osl::MutexGuard
aGuard(m_aMutex
);
1281 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1282 return m_pImpl
->m_bControllersLocked
;
1284 // -----------------------------------------------------------------------------
1285 uno::Reference
< frame::XController
> SAL_CALL
OReportDefinition::getCurrentController( ) throw (uno::RuntimeException
)
1287 ::osl::MutexGuard
aGuard(m_aMutex
);
1288 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1289 return m_pImpl
->m_xCurrentController
;
1291 // -----------------------------------------------------------------------------
1292 void SAL_CALL
OReportDefinition::setCurrentController( const uno::Reference
< frame::XController
>& _xController
) throw (container::NoSuchElementException
, uno::RuntimeException
)
1294 ::osl::MutexGuard
aGuard(m_aMutex
);
1295 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1296 if ( ::std::find(m_pImpl
->m_aControllers
.begin(),m_pImpl
->m_aControllers
.end(),_xController
) == m_pImpl
->m_aControllers
.end() )
1297 throw container::NoSuchElementException();
1298 m_pImpl
->m_xCurrentController
= _xController
;
1300 // -----------------------------------------------------------------------------
1301 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::getCurrentSelection( ) throw (uno::RuntimeException
)
1303 return uno::Reference
< uno::XInterface
>();
1305 // -----------------------------------------------------------------------------
1307 void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference
< embed::XStorage
>& _xStorageToLoadFrom
,
1308 const uno::Sequence
< beans::PropertyValue
>& _aMediaDescriptor
)
1310 // ::osl::MutexGuard aGuard(m_aMutex);
1311 // ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1314 m_pImpl
->m_xStorage
= _xStorageToLoadFrom
;
1316 ::comphelper::MediaDescriptor
aDescriptor( _aMediaDescriptor
);
1317 fillArgs(aDescriptor
);
1318 aDescriptor
.createItemIfMissing(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(_xStorageToLoadFrom
));
1320 uno::Sequence
< uno::Any
> aDelegatorArguments(_aMediaDescriptor
.getLength());
1321 uno::Any
* pIter
= aDelegatorArguments
.getArray();
1322 uno::Any
* pEnd
= pIter
+ aDelegatorArguments
.getLength();
1323 for(sal_Int32 i
= 0;pIter
!= pEnd
;++pIter
,++i
)
1325 *pIter
<<= _aMediaDescriptor
[i
];
1327 sal_Int32 nPos
= aDelegatorArguments
.getLength();
1328 aDelegatorArguments
.realloc(nPos
+1);
1329 beans::PropertyValue aPropVal
;
1330 aPropVal
.Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage"));
1331 aPropVal
.Value
<<= _xStorageToLoadFrom
;
1332 aDelegatorArguments
[nPos
] <<= aPropVal
;
1334 rptui::OXUndoEnvironment
& rEnv
= m_pImpl
->m_pReportModel
->GetUndoEnv();
1335 rptui::OXUndoEnvironment::OUndoEnvLock
aLock(rEnv
);
1337 uno::Reference
< document::XFilter
> xFilter(
1338 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportFilter")),aDelegatorArguments
,m_aProps
->m_xContext
),
1339 uno::UNO_QUERY_THROW
);
1341 uno::Reference
< document::XImporter
> xImporter(xFilter
,uno::UNO_QUERY_THROW
);
1342 uno::Reference
<XComponent
> xComponent(static_cast<OWeakObject
*>(this),uno::UNO_QUERY
);
1343 xImporter
->setTargetDocument(xComponent
);
1345 ::comphelper::MediaDescriptor aTemp
;
1346 aTemp
<< aDelegatorArguments
;
1347 xFilter
->filter(aTemp
.getAsConstPropertyValueList());
1349 lcl_setModelReadOnly(m_pImpl
->m_xStorage
,m_pImpl
->m_pReportModel
);
1350 m_pImpl
->m_pObjectContainer
->SwitchPersistence(m_pImpl
->m_xStorage
);
1353 // XStorageBasedDocument
1354 // -----------------------------------------------------------------------------
1355 void SAL_CALL
OReportDefinition::loadFromStorage( const uno::Reference
< embed::XStorage
>& _xStorageToLoadFrom
1356 , const uno::Sequence
< beans::PropertyValue
>& _aMediaDescriptor
) throw (lang::IllegalArgumentException
, frame::DoubleInitializationException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1358 ::osl::MutexGuard
aGuard(m_aMutex
);
1359 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1361 impl_loadFromStorage_nolck_throw( _xStorageToLoadFrom
, _aMediaDescriptor
);
1364 // -----------------------------------------------------------------------------
1365 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
)
1367 if ( !_xStorageToSaveTo
.is() )
1368 throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL
,m_aProps
->m_xContext
->getServiceManager()),*this,1);
1370 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
1371 ::osl::MutexGuard
aGuard(m_aMutex
);
1372 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1373 // create XStatusIndicator
1374 uno::Reference
<task::XStatusIndicator
> xStatusIndicator
;
1375 uno::Sequence
< uno::Any
> aDelegatorArguments
;
1376 ::comphelper::MediaDescriptor
aDescriptor( _aMediaDescriptor
);
1377 lcl_extractAndStartStatusIndicator( aDescriptor
, xStatusIndicator
, aDelegatorArguments
);
1380 uno::Sequence
< beans::PropertyValue
> aProps
;
1382 // export sub streams for package, else full stream into a file
1383 sal_Bool bWarn
= sal_False
, bErr
= sal_False
;
1384 ::rtl::OUString sWarnFile
, sErrFile
;
1386 uno::Reference
< beans::XPropertySet
> xProp(_xStorageToSaveTo
,uno::UNO_QUERY
);
1389 static const ::rtl::OUString
sPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
1390 ::rtl::OUString sOldMediaType
;
1391 xProp
->getPropertyValue(sPropName
) >>= sOldMediaType
;
1392 if ( !xProp
->getPropertyValue(sPropName
).hasValue() || !sOldMediaType
.getLength() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT
!= sOldMediaType
)
1393 xProp
->setPropertyValue( sPropName
, uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT
) );
1396 /** property map for export info set */
1397 comphelper::PropertyMapEntry aExportInfoMap
[] =
1399 { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool
*)0), beans::PropertyAttribute::MAYBEVOID
, 0},
1400 { MAP_LEN( "StreamName"), 0,&::getCppuType( (::rtl::OUString
*)0 ),beans::PropertyAttribute::MAYBEVOID
, 0 },
1401 { NULL
, 0, 0, NULL
, 0, 0 }
1403 uno::Reference
< beans::XPropertySet
> xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap
) ) );
1405 SvtSaveOptions aSaveOpt
;
1406 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")), uno::makeAny(aSaveOpt
.IsPrettyPrinting()));
1407 sal_Int32 nArgsLen
= aDelegatorArguments
.getLength();
1408 aDelegatorArguments
.realloc(nArgsLen
+1);
1409 aDelegatorArguments
[nArgsLen
++] <<= xInfoSet
;
1411 uno::Reference
< document::XEmbeddedObjectResolver
> xObjectResolver
;
1412 uno::Reference
< document::XGraphicObjectResolver
> xGrfResolver
;
1413 SvXMLGraphicHelper
* pGraphicHelper
= SvXMLGraphicHelper::Create(_xStorageToSaveTo
,GRAPHICHELPER_MODE_WRITE
);
1414 xGrfResolver
= pGraphicHelper
;
1415 pGraphicHelper
->release();
1416 SvXMLEmbeddedObjectHelper
* pEmbeddedObjectHelper
= SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo
,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE
);
1417 xObjectResolver
= pEmbeddedObjectHelper
;
1418 pEmbeddedObjectHelper
->release();
1420 aDelegatorArguments
.realloc(nArgsLen
+2);
1421 aDelegatorArguments
[nArgsLen
++] <<= xGrfResolver
;
1422 aDelegatorArguments
[nArgsLen
++] <<= xObjectResolver
;
1424 uno::Reference
<XComponent
> xCom(static_cast<OWeakObject
*>(this),uno::UNO_QUERY
);
1427 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml"))));
1428 if( !WriteThroughComponent(
1429 xCom
, "settings.xml",
1430 "com.sun.star.comp.report.XMLSettingsExporter",
1431 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1436 sWarnFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml"));
1443 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml"))));
1444 if( !WriteThroughComponent(
1446 "com.sun.star.comp.report.XMLMetaExporter",
1447 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1452 sWarnFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml"));
1459 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml"))));
1460 if( !WriteThroughComponent(
1462 "com.sun.star.comp.report.XMLStylesExporter",
1463 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1468 sWarnFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml"));
1475 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml"))));
1476 if( !WriteThroughComponent(
1477 xCom
, "content.xml",
1478 "com.sun.star.comp.report.ExportFilter",
1479 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1482 sErrFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml"));
1488 sal_Bool bPersist
= sal_False
;
1489 if ( _xStorageToSaveTo
== m_pImpl
->m_xStorage
)
1490 bPersist
= m_pImpl
->m_pObjectContainer
->StoreChildren(sal_True
,sal_False
);
1492 bPersist
= m_pImpl
->m_pObjectContainer
->StoreAsChildren(sal_True
,sal_True
,_xStorageToSaveTo
);
1495 m_pImpl
->m_pObjectContainer
->SetPersistentEntries(m_pImpl
->m_xStorage
);
1498 uno::Reference
<embed::XTransactedObject
> xTransact(_xStorageToSaveTo
,uno::UNO_QUERY
);
1499 if ( xTransact
.is() )
1500 xTransact
->commit();
1502 catch(uno::Exception
)
1504 OSL_ENSURE(0,"Exception Caught: Could not commit report storage!");
1505 throw io::IOException();
1508 if ( _xStorageToSaveTo
== m_pImpl
->m_xStorage
)
1509 setModified(sal_False
);
1511 if ( xStatusIndicator
.is() )
1512 xStatusIndicator
->end();
1514 // -----------------------------------------------------------------------------
1515 void SAL_CALL
OReportDefinition::switchToStorage( const uno::Reference
< embed::XStorage
>& _xStorage
) throw (lang::IllegalArgumentException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1517 if ( !_xStorage
.is() )
1518 throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL
,m_aProps
->m_xContext
->getServiceManager()),*this,1);
1520 ::osl::MutexGuard
aGuard(m_aMutex
);
1521 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1522 m_pImpl
->m_xStorage
= _xStorage
;
1523 lcl_setModelReadOnly(m_pImpl
->m_xStorage
,m_pImpl
->m_pReportModel
);
1524 m_pImpl
->m_pObjectContainer
->SwitchPersistence(m_pImpl
->m_xStorage
);
1526 // notify our container listeners
1527 m_pImpl
->m_aStorageChangeListeners
.forEach
<document::XStorageChangeListener
>(
1528 ::boost::bind(&document::XStorageChangeListener::notifyStorageChange
,_1
,boost::cref(static_cast<OWeakObject
*>(this)),boost::cref(_xStorage
)));
1530 // -----------------------------------------------------------------------------
1531 uno::Reference
< embed::XStorage
> SAL_CALL
OReportDefinition::getDocumentStorage( ) throw (io::IOException
, uno::Exception
, uno::RuntimeException
)
1533 ::osl::MutexGuard
aGuard(m_aMutex
);
1534 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1535 return m_pImpl
->m_xStorage
;
1537 // -----------------------------------------------------------------------------
1538 void SAL_CALL
OReportDefinition::addStorageChangeListener( const uno::Reference
< document::XStorageChangeListener
>& xListener
) throw (uno::RuntimeException
)
1540 ::osl::MutexGuard
aGuard(m_aMutex
);
1541 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1542 if ( xListener
.is() )
1543 m_pImpl
->m_aStorageChangeListeners
.addInterface(xListener
);
1545 // -----------------------------------------------------------------------------
1546 void SAL_CALL
OReportDefinition::removeStorageChangeListener( const uno::Reference
< document::XStorageChangeListener
>& xListener
) throw (uno::RuntimeException
)
1548 ::osl::MutexGuard
aGuard(m_aMutex
);
1549 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1550 m_pImpl
->m_aStorageChangeListeners
.removeInterface(xListener
);
1552 // -----------------------------------------------------------------------------
1553 sal_Bool
OReportDefinition::WriteThroughComponent(
1554 const uno::Reference
<lang::XComponent
> & xComponent
,
1555 const sal_Char
* pStreamName
,
1556 const sal_Char
* pServiceName
,
1557 const uno::Sequence
<uno::Any
> & rArguments
,
1558 const uno::Sequence
<beans::PropertyValue
> & rMediaDesc
,
1559 sal_Bool bPlainStream
1560 ,const uno::Reference
<embed::XStorage
>& _xStorageToSaveTo
)
1562 OSL_ENSURE( NULL
!= pStreamName
, "Need stream name!" );
1563 OSL_ENSURE( NULL
!= pServiceName
, "Need service name!" );
1566 uno::Reference
<embed::XStorage
> xMyStorage
= _xStorageToSaveTo
;
1568 ::rtl::OUString sStreamName
= ::rtl::OUString::createFromAscii( pStreamName
);
1569 uno::Reference
<io::XStream
> xStream
= xMyStorage
->openStreamElement( sStreamName
,embed::ElementModes::READWRITE
| embed::ElementModes::TRUNCATE
);
1570 if ( !xStream
.is() )
1572 uno::Reference
<io::XOutputStream
> xOutputStream
= xStream
->getOutputStream();
1573 OSL_ENSURE(xOutputStream
.is(), "Can't create output stream in package!");
1574 if ( ! xOutputStream
.is() )
1577 uno::Reference
<beans::XPropertySet
> xStreamProp(xOutputStream
,uno::UNO_QUERY
);
1578 OSL_ENSURE(xStreamProp
.is(),"No valid preoperty set for the output stream!");
1580 uno::Reference
<io::XSeekable
> xSeek(xStreamProp
,uno::UNO_QUERY
);
1583 OSL_TRACE("Length of stream %i",(int)xSeek
->getPosition());
1587 ::rtl::OUString
aPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
1588 ::rtl::OUString
aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
1591 xStreamProp
->setPropertyValue( aPropName
, aAny
);
1596 xStreamProp
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Compressed") ), aAny
);
1600 xStreamProp
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ), uno::makeAny(sal_True
) );
1604 // set buffer and create outputstream
1607 sal_Bool bRet
= WriteThroughComponent(
1608 xOutputStream
, xComponent
,
1609 pServiceName
, rArguments
, rMediaDesc
);
1610 // finally, commit stream.
1613 catch(const uno::Exception
& e
)
1615 (void)e
; // helper to know what e contains
1619 // -----------------------------------------------------------------------------
1620 sal_Bool
OReportDefinition::WriteThroughComponent(
1621 const uno::Reference
<io::XOutputStream
> & xOutputStream
,
1622 const uno::Reference
<lang::XComponent
> & xComponent
,
1623 const sal_Char
* pServiceName
,
1624 const uno::Sequence
<uno::Any
> & rArguments
,
1625 const uno::Sequence
<beans::PropertyValue
> & rMediaDesc
)
1627 OSL_ENSURE( xOutputStream
.is(), "I really need an output stream!" );
1628 OSL_ENSURE( xComponent
.is(), "Need component!" );
1629 OSL_ENSURE( NULL
!= pServiceName
, "Need component name!" );
1632 uno::Reference
< io::XActiveDataSource
> xSaxWriter(
1633 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")),m_aProps
->m_xContext
),
1635 OSL_ENSURE( xSaxWriter
.is(), "can't instantiate XML com.sun.star.xml.sax.Writer" );
1636 if(!xSaxWriter
.is())
1639 // connect XML writer to output stream
1640 xSaxWriter
->setOutputStream( xOutputStream
);
1642 // prepare arguments (prepend doc handler to given arguments)
1643 uno::Reference
<xml::sax::XDocumentHandler
> xDocHandler( xSaxWriter
,uno::UNO_QUERY
);
1644 uno::Sequence
<uno::Any
> aArgs( 1 + rArguments
.getLength() );
1645 aArgs
[0] <<= xDocHandler
;
1646 for(sal_Int32 i
= 0; i
< rArguments
.getLength(); i
++)
1647 aArgs
[i
+1] = rArguments
[i
];
1649 // get filter component
1650 uno::Reference
< document::XExporter
> xExporter(
1651 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext(
1652 ::rtl::OUString::createFromAscii(pServiceName
), aArgs
,m_aProps
->m_xContext
), uno::UNO_QUERY
);
1653 OSL_ENSURE( xExporter
.is(),
1654 "can't instantiate export filter component" );
1655 if( !xExporter
.is() )
1658 // connect model and filter
1659 xExporter
->setSourceDocument( xComponent
);
1662 uno::Reference
<document::XFilter
> xFilter( xExporter
, uno::UNO_QUERY
);
1663 return xFilter
->filter( rMediaDesc
);
1665 // -----------------------------------------------------------------------------
1667 void SAL_CALL
OReportDefinition::initNew( ) throw (frame::DoubleInitializationException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1669 setPageHeaderOn( sal_True
);
1670 setPageFooterOn( sal_True
);
1672 // -----------------------------------------------------------------------------
1673 void SAL_CALL
OReportDefinition::load( const uno::Sequence
< beans::PropertyValue
>& _rArguments
) throw (frame::DoubleInitializationException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1675 ::osl::MutexGuard
aGuard(m_aMutex
);
1676 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1678 // TODO: this code is pretty similar to what happens in ODatabaseModelImpl::getOrCreateRootStorage,
1679 // perhaps we can share code here.
1681 ::comphelper::NamedValueCollection
aArguments( _rArguments
);
1683 // the source for the to-be-created storage: either an URL, or a stream
1684 uno::Reference
< io::XInputStream
> xStream
;
1685 ::rtl::OUString sURL
;
1687 if ( aArguments
.has( "Stream" ) )
1689 aArguments
.get_ensureType( "Stream", xStream
);
1690 aArguments
.remove( "Stream" );
1692 else if ( aArguments
.has( "InputStream" ) )
1694 aArguments
.get_ensureType( "InputStream", xStream
);
1695 aArguments
.remove( "InputStream" );
1698 if ( aArguments
.has( "FileName" ) )
1700 aArguments
.get_ensureType( "FileName", sURL
);
1701 aArguments
.remove( "FileName" );
1703 else if ( aArguments
.has( "URL" ) )
1705 aArguments
.get_ensureType( "URL", sURL
);
1706 aArguments
.remove( "URL" );
1709 uno::Any aStorageSource
;
1711 aStorageSource
<<= aStorageSource
;
1712 else if ( sURL
.getLength() )
1713 aStorageSource
<<= sURL
;
1715 // TODO: error message
1716 throw lang::IllegalArgumentException(
1717 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source (URL or InputStream) found." ) ),
1723 uno::Reference
< lang::XSingleServiceFactory
> xStorageFactory(
1724 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
1725 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" ) ),
1726 m_aProps
->m_xContext
),
1727 uno::UNO_QUERY_THROW
1730 // open read-write per default, unless told otherwise in the MediaDescriptor
1731 uno::Reference
< embed::XStorage
> xDocumentStorage
;
1732 const sal_Int32 nOpenModes
[2] = {
1733 embed::ElementModes::READWRITE
,
1734 embed::ElementModes::READ
1736 size_t nFirstOpenMode
= 0;
1737 if ( aArguments
.has( "ReadOnly" ) )
1739 sal_Bool bReadOnly
= sal_False
;
1740 aArguments
.get_ensureType( "ReadOnly", bReadOnly
);
1741 nFirstOpenMode
= bReadOnly
? 1 : 0;
1743 const size_t nLastOpenMode
= sizeof( nOpenModes
) / sizeof( nOpenModes
[0] ) - 1;
1744 for ( size_t i
=nFirstOpenMode
; i
<= nLastOpenMode
; ++i
)
1746 uno::Sequence
< uno::Any
> aStorageCreationArgs(2);
1747 aStorageCreationArgs
[0] = aStorageSource
;
1748 aStorageCreationArgs
[1] <<= nOpenModes
[i
];
1752 xDocumentStorage
.set( xStorageFactory
->createInstanceWithArguments( aStorageCreationArgs
), uno::UNO_QUERY_THROW
);
1754 catch( const uno::Exception
& )
1756 if ( i
== nLastOpenMode
)
1757 throw lang::WrappedTargetException(
1758 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An error occured while creating the document storage." ) ),
1761 ::cppu::getCaughtException()
1766 if ( !xDocumentStorage
.is() )
1768 throw uno::RuntimeException();
1771 impl_loadFromStorage_nolck_throw( xDocumentStorage
, aArguments
.getPropertyValues() );
1772 // TODO: do we need to take ownership of the storage? In opposite to loadFromStorage, we created the storage
1773 // ourself here, and perhaps this means we're also responsible for it ...?
1775 // -----------------------------------------------------------------------------
1777 void SAL_CALL
OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect
, const awt::Size
& _aSize
) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
)
1779 ::osl::MutexGuard
aGuard(m_aMutex
);
1780 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1781 m_pImpl
->m_aVisualAreaSize
= _aSize
;
1782 m_pImpl
->m_nAspect
= _nAspect
;
1784 // -----------------------------------------------------------------------------
1785 awt::Size SAL_CALL
OReportDefinition::getVisualAreaSize( ::sal_Int64
/*nAspect*/ ) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
)
1787 ::osl::MutexGuard
aGuard(m_aMutex
);
1788 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1789 return m_pImpl
->m_aVisualAreaSize
;
1791 // -----------------------------------------------------------------------------
1792 embed::VisualRepresentation SAL_CALL
OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64
/*nAspect*/ ) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
)
1794 ::osl::MutexGuard
aGuard(m_aMutex
);
1795 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1796 embed::VisualRepresentation aVisualRepresentation
;
1797 return aVisualRepresentation
;
1799 // -----------------------------------------------------------------------------
1800 ::sal_Int32 SAL_CALL
OReportDefinition::getMapUnit( ::sal_Int64
/*nAspect*/ ) throw (uno::Exception
, uno::RuntimeException
)
1802 return embed::EmbedMapUnits::ONE_100TH_MM
;
1804 // -----------------------------------------------------------------------------
1806 ::sal_Bool SAL_CALL
OReportDefinition::isModified( ) throw (uno::RuntimeException
)
1808 ::osl::MutexGuard
aGuard(m_aMutex
);
1809 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1810 return m_pImpl
->m_bModified
;
1812 // -----------------------------------------------------------------------------
1813 void SAL_CALL
OReportDefinition::setModified( ::sal_Bool _bModified
) throw (beans::PropertyVetoException
, uno::RuntimeException
)
1815 ::osl::ResettableMutexGuard
aGuard(m_aMutex
);
1816 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1817 if ( m_pImpl
->m_pReportModel
->IsReadOnly() && _bModified
)
1818 throw beans::PropertyVetoException();
1819 if ( m_pImpl
->m_bModified
!= _bModified
)
1821 m_pImpl
->m_bModified
= _bModified
;
1822 lang::EventObject
aEvent(*this);
1824 m_pImpl
->m_aModifyListeners
.notifyEach(&util::XModifyListener::modified
,aEvent
);
1825 notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnModifyChanged")));
1828 // -----------------------------------------------------------------------------
1829 // XModifyBroadcaster
1830 void SAL_CALL
OReportDefinition::addModifyListener( const uno::Reference
< util::XModifyListener
>& _xListener
) throw (uno::RuntimeException
)
1832 ::osl::MutexGuard
aGuard(m_aMutex
);
1833 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1834 if ( _xListener
.is() )
1835 m_pImpl
->m_aModifyListeners
.addInterface(_xListener
);
1837 // -----------------------------------------------------------------------------
1838 void SAL_CALL
OReportDefinition::removeModifyListener( const uno::Reference
< util::XModifyListener
>& _xListener
) throw (uno::RuntimeException
)
1840 ::osl::MutexGuard
aGuard(m_aMutex
);
1841 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1842 m_pImpl
->m_aModifyListeners
.removeInterface(_xListener
);
1844 // -----------------------------------------------------------------------------
1845 void OReportDefinition::notifyEvent(const ::rtl::OUString
& _sEventName
)
1849 ::osl::ResettableMutexGuard
aGuard(m_aMutex
);
1850 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1851 document::EventObject
aEvt(*this, _sEventName
);
1853 m_pImpl
->m_aDocEventListeners
.notifyEach(&document::XEventListener::notifyEvent
,aEvt
);
1855 catch(uno::Exception
&)
1859 // -----------------------------------------------------------------------------
1860 // document::XEventBroadcaster
1861 void SAL_CALL
OReportDefinition::addEventListener(const uno::Reference
< document::XEventListener
>& _xListener
) throw (uno::RuntimeException
)
1863 ::osl::MutexGuard
aGuard(m_aMutex
);
1864 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1865 if ( _xListener
.is() )
1866 m_pImpl
->m_aDocEventListeners
.addInterface(_xListener
);
1868 // -----------------------------------------------------------------------------
1869 void SAL_CALL
OReportDefinition::removeEventListener( const uno::Reference
< document::XEventListener
>& _xListener
) throw (uno::RuntimeException
)
1871 ::osl::MutexGuard
aGuard(m_aMutex
);
1872 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1873 m_pImpl
->m_aDocEventListeners
.removeInterface(_xListener
);
1875 // -----------------------------------------------------------------------------
1876 // document::XEventListener
1877 void SAL_CALL
OReportDefinition::notifyEvent( const document::EventObject
& aEvent
) throw (uno::RuntimeException
)
1879 // used only to forward external events (e.g. for doc creation) from the frame loader
1880 // to the global event broadcaster and all other interested doc event listener.
1881 notifyEvent(aEvent
.EventName
);
1883 // -----------------------------------------------------------------------------
1884 // document::XViewDataSupplier
1885 uno::Reference
< container::XIndexAccess
> SAL_CALL
OReportDefinition::getViewData( ) throw (uno::RuntimeException
)
1887 ::osl::MutexGuard
aGuard(m_aMutex
);
1888 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1889 if ( !m_pImpl
->m_xViewData
.is() )
1891 m_pImpl
->m_xViewData
.set(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
1892 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")),m_aProps
->m_xContext
),uno::UNO_QUERY
);
1893 //uno::Sequence< beans::PropertyValue > aProps;
1894 //m_pImpl->m_xViewData->insertByIndex(m_pImpl->m_xViewData->getCount(),uno::makeAny(aProps));
1895 uno::Reference
< container::XIndexContainer
> xContainer(m_pImpl
->m_xViewData
,uno::UNO_QUERY
);
1896 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aIter
= m_pImpl
->m_aControllers
.begin();
1897 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aEnd
= m_pImpl
->m_aControllers
.end();
1898 for (;aIter
!= aEnd
; ++aIter
)
1904 xContainer
->insertByIndex(xContainer
->getCount(),(*aIter
)->getViewData());
1906 catch(uno::Exception
&)
1909 } // if ( aIter->is() )
1913 return m_pImpl
->m_xViewData
;
1915 // -----------------------------------------------------------------------------
1916 void SAL_CALL
OReportDefinition::setViewData( const uno::Reference
< container::XIndexAccess
>& Data
) throw (uno::RuntimeException
)
1918 ::osl::MutexGuard
aGuard(m_aMutex
);
1919 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1920 m_pImpl
->m_xViewData
= Data
;
1922 // -----------------------------------------------------------------------------
1923 uno::Reference
< report::XFunctions
> SAL_CALL
OReportDefinition::getFunctions() throw (uno::RuntimeException
)
1925 ::osl::MutexGuard
aGuard(m_aMutex
);
1926 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1927 return m_pImpl
->m_xFunctions
;
1929 // -----------------------------------------------------------------------------
1930 uno::Reference
< ui::XUIConfigurationManager
> SAL_CALL
OReportDefinition::getUIConfigurationManager( ) throw (uno::RuntimeException
)
1932 ::osl::MutexGuard
aGuard(m_aMutex
);
1933 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1935 if ( !m_pImpl
->m_xUIConfigurationManager
.is() )
1937 m_pImpl
->m_xUIConfigurationManager
.set(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager")),m_aProps
->m_xContext
),
1940 uno::Reference
< ui::XUIConfigurationStorage
> xUIConfigStorage( m_pImpl
->m_xUIConfigurationManager
, uno::UNO_QUERY
);
1941 if ( xUIConfigStorage
.is() )
1943 uno::Reference
< embed::XStorage
> xConfigStorage
;
1944 // initialize ui configuration manager with document substorage
1945 xUIConfigStorage
->setStorage( xConfigStorage
);
1949 return m_pImpl
->m_xUIConfigurationManager
;
1951 // -----------------------------------------------------------------------------
1952 uno::Reference
< embed::XStorage
> SAL_CALL
OReportDefinition::getDocumentSubStorage( const ::rtl::OUString
& aStorageName
, sal_Int32 nMode
) throw (uno::RuntimeException
)
1954 ::osl::MutexGuard
aGuard(m_aMutex
);
1955 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1956 return m_pImpl
->m_xStorage
->openStorageElement(aStorageName
, nMode
);
1958 // -----------------------------------------------------------------------------
1959 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getDocumentSubStoragesNames( ) throw (io::IOException
, uno::RuntimeException
)
1961 ::osl::MutexGuard
aGuard(m_aMutex
);
1962 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1963 uno::Reference
<container::XNameAccess
> xNameAccess(m_pImpl
->m_xStorage
,uno::UNO_QUERY
);
1964 return xNameAccess
.is() ? xNameAccess
->getElementNames() : uno::Sequence
< ::rtl::OUString
>();
1966 // -----------------------------------------------------------------------------
1967 ::rtl::OUString SAL_CALL
OReportDefinition::getMimeType() throw (uno::RuntimeException
)
1969 ::osl::MutexGuard
aGuard(m_aMutex
);
1970 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1971 return m_pImpl
->m_sMimeType
;
1973 // -----------------------------------------------------------------------------
1974 void SAL_CALL
OReportDefinition::setMimeType( const ::rtl::OUString
& _mimetype
) throw (lang::IllegalArgumentException
, uno::RuntimeException
)
1976 ::osl::MutexGuard
aGuard(m_aMutex
);
1977 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1978 uno::Sequence
< ::rtl::OUString
> aList
= getAvailableMimeTypes();
1979 const ::rtl::OUString
* pEnd
= aList
.getConstArray()+aList
.getLength();
1980 if ( ::std::find(aList
.getConstArray(),pEnd
,_mimetype
) == pEnd
)
1981 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getAvailableMimeTypes()"))
1984 ,m_aProps
->m_xContext
);
1985 set(PROPERTY_MIMETYPE
,_mimetype
,m_pImpl
->m_sMimeType
);
1987 // -----------------------------------------------------------------------------
1988 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getAvailableMimeTypes( ) throw (lang::DisposedException
, uno::Exception
, uno::RuntimeException
)
1990 static uno::Sequence
< ::rtl::OUString
> s_aList
;
1991 if ( !s_aList
.hasElements() )
1994 s_aList
[0] = MIMETYPE_OASIS_OPENDOCUMENT_TEXT
;
1995 s_aList
[1] = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET
;
2000 // -----------------------------------------------------------------------------
2001 // com::sun::star::XUnoTunnel
2002 sal_Int64 SAL_CALL
OReportDefinition::getSomething( const uno::Sequence
< sal_Int8
>& rId
) throw(uno::RuntimeException
)
2005 if (rId
.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId
.getConstArray(), 16 ) )
2006 nRet
= reinterpret_cast<sal_Int64
>(this);
2009 uno::Reference
< lang::XUnoTunnel
> xUnoTunnel(m_pImpl
->m_xNumberFormatsSupplier
,uno::UNO_QUERY
);
2010 if ( xUnoTunnel
.is() )
2011 nRet
= xUnoTunnel
->getSomething(rId
);
2015 uno::Reference
< lang::XUnoTunnel
> xTunnel
;
2016 ::comphelper::query_aggregation(m_aProps
->m_xProxy
,xTunnel
);
2018 nRet
= xTunnel
->getSomething(rId
);
2023 // -----------------------------------------------------------------------------
2024 uno::Sequence
< sal_Int8
> SAL_CALL
OReportDefinition::getImplementationId( ) throw (uno::RuntimeException
)
2026 return OReportDefinition::getUnoTunnelImplementationId();
2028 //--------------------------------------------------------------------------
2029 uno::Sequence
< sal_Int8
> OReportDefinition::getUnoTunnelImplementationId()
2031 static ::cppu::OImplementationId
* pId
= 0;
2034 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
2037 static ::cppu::OImplementationId aId
;
2041 return pId
->getImplementationId();
2043 // -----------------------------------------------------------------------------
2044 uno::Reference
< uno::XComponentContext
> OReportDefinition::getContext()
2046 ::osl::MutexGuard
aGuard(m_aMutex
);
2047 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2048 return m_aProps
->m_xContext
;
2050 // -----------------------------------------------------------------------------
2051 ::boost::shared_ptr
<rptui::OReportModel
> OReportDefinition::getSdrModel() const
2053 return m_pImpl
->m_pReportModel
;
2055 // -----------------------------------------------------------------------------
2056 ::boost::shared_ptr
<rptui::OReportModel
> OReportDefinition::getSdrModel(const uno::Reference
< report::XReportDefinition
>& _xReportDefinition
)
2058 ::boost::shared_ptr
<rptui::OReportModel
> pReportModel
;
2059 uno::Reference
< lang::XUnoTunnel
> xUT( _xReportDefinition
, uno::UNO_QUERY
);
2061 pReportModel
= reinterpret_cast<OReportDefinition
*>(sal::static_int_cast
<sal_uIntPtr
>(xUT
->getSomething( OReportDefinition::getUnoTunnelImplementationId())))->getSdrModel();
2062 return pReportModel
;
2064 // -----------------------------------------------------------------------------
2065 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::createInstanceWithArguments( const ::rtl::OUString
& aServiceSpecifier
, const uno::Sequence
< uno::Any
>& _aArgs
)
2066 throw( uno::Exception
, uno::RuntimeException
)
2068 ::osl::MutexGuard
aGuard(m_aMutex
);
2069 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2071 uno::Reference
< uno::XInterface
> xRet
;
2072 if ( aServiceSpecifier
.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"))) == 0 )
2074 uno::Reference
< embed::XStorage
> xStorage
;
2075 const uno::Any
* pIter
= _aArgs
.getConstArray();
2076 const uno::Any
* pEnd
= pIter
+ _aArgs
.getLength();
2077 for(;pIter
!= pEnd
;++pIter
)
2079 beans::NamedValue aValue
;
2081 if( aValue
.Name
.equalsAscii( "Storage" ) )
2082 aValue
.Value
>>= xStorage
;
2083 } // for(;pIter != pEnd ;++pIter)
2084 m_pImpl
->m_pObjectContainer
->SwitchPersistence(xStorage
);
2085 xRet
= static_cast< ::cppu::OWeakObject
* >(SvXMLEmbeddedObjectHelper::Create( xStorage
,*this, EMBEDDEDOBJECTHELPER_MODE_READ
));
2089 // -----------------------------------------------------------------------------
2090 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::createInstance( const ::rtl::OUString
& aServiceSpecifier
) throw(uno::Exception
, uno::RuntimeException
)
2092 ::osl::MutexGuard
aGuard(m_aMutex
);
2093 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2094 uno::Reference
< drawing::XShape
> xShape
;
2095 if ( aServiceSpecifier
.indexOf( ::rtl::OUString::createFromAscii("com.sun.star.report.") ) == 0 )
2097 if ( aServiceSpecifier
== SERVICE_SHAPE
)
2098 xShape
.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")) ),uno::UNO_QUERY_THROW
);
2099 else if ( aServiceSpecifier
== SERVICE_FORMATTEDFIELD
2100 || aServiceSpecifier
== SERVICE_FIXEDTEXT
2101 || aServiceSpecifier
== SERVICE_FIXEDLINE
2102 || aServiceSpecifier
== SERVICE_IMAGECONTROL
)
2103 xShape
.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape")) ),uno::UNO_QUERY_THROW
);
2105 xShape
.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ),uno::UNO_QUERY_THROW
);
2107 else if ( aServiceSpecifier
.indexOf( ::rtl::OUString::createFromAscii("com.sun.star.form.component.") ) == 0 )
2109 xShape
.set(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(aServiceSpecifier
,m_aProps
->m_xContext
),uno::UNO_QUERY
);
2111 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.PageStyle") ) == 0 ||
2112 aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.FrameStyle") ) == 0 ||
2113 aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.GraphicStyle") ) == 0
2116 uno::Reference
< style::XStyle
> xStyle
= new OStyle();
2117 xStyle
->setName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default")));
2118 uno::Reference
<beans::XPropertySet
> xProp(xStyle
,uno::UNO_QUERY
);
2119 ::rtl::OUString sTray
;
2120 xProp
->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrinterPaperTray")))>>= sTray
;
2122 return xStyle
.get();
2124 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) == 0 )
2126 uno::Reference
<beans::XPropertySet
> xProp
= new OStyle();
2130 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) == 0 )
2132 uno::Reference
<beans::XPropertySet
> xProp
= new OStyle();
2135 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) == 0 )
2137 if ( !m_pImpl
->m_xGradientTable
.is() )
2138 m_pImpl
->m_xGradientTable
.set(SvxUnoGradientTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2139 //comphelper::NameContainer_createInstance( ::getCppuType( (const awt::Gradient*) 0 ) ).get();
2140 return m_pImpl
->m_xGradientTable
;
2142 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) == 0 )
2144 if ( !m_pImpl
->m_xHatchTable
.is() )
2145 m_pImpl
->m_xHatchTable
.set(SvxUnoHatchTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2146 //comphelper::NameContainer_createInstance( ::getCppuType( (const drawing::Hatch*) 0 ) ).get();
2147 return m_pImpl
->m_xHatchTable
;
2149 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) == 0 )
2151 if ( !m_pImpl
->m_xBitmapTable
.is() )
2152 m_pImpl
->m_xBitmapTable
.set(SvxUnoBitmapTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2153 //comphelper::NameContainer_createInstance( ::getCppuType( (const ::rtl::OUString*) 0 ) ).get();
2154 return m_pImpl
->m_xBitmapTable
;
2156 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) == 0 )
2158 if ( !m_pImpl
->m_xTransparencyGradientTable
.is() )
2159 m_pImpl
->m_xTransparencyGradientTable
.set(SvxUnoTransGradientTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2160 //comphelper::NameContainer_createInstance( ::getCppuType( (const awt::Gradient*) 0 ) ).get();
2161 return m_pImpl
->m_xTransparencyGradientTable
;
2163 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) == 0 )
2165 if ( !m_pImpl
->m_xDashTable
.is() )
2166 m_pImpl
->m_xDashTable
.set(SvxUnoDashTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2167 //comphelper::NameContainer_createInstance( ::getCppuType( (const drawing::LineDash*) 0 ) ).get();
2168 return m_pImpl
->m_xDashTable
;
2170 else if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
2172 if( !m_pImpl
->m_xMarkerTable
.is() )
2173 m_pImpl
->m_xMarkerTable
.set(SvxUnoMarkerTable_createInstance( m_pImpl
->m_pReportModel
.get() ),uno::UNO_QUERY
);
2174 return m_pImpl
->m_xMarkerTable
;
2176 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")) == 0 )
2177 return static_cast< ::cppu::OWeakObject
* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl
->m_xStorage
,*this, EMBEDDEDOBJECTHELPER_MODE_READ
));
2178 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")) == 0 )
2179 return static_cast< ::cppu::OWeakObject
* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl
->m_xStorage
,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE
));
2180 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")) == 0 )
2182 SvXMLGraphicHelper
* pGraphicHelper
= SvXMLGraphicHelper::Create(m_pImpl
->m_xStorage
,GRAPHICHELPER_MODE_WRITE
);
2183 uno::Reference
< uno::XInterface
> xRet(static_cast< ::cppu::OWeakObject
* >(pGraphicHelper
));
2184 pGraphicHelper
->release();
2187 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")) == 0 )
2189 SvXMLGraphicHelper
* pGraphicHelper
= SvXMLGraphicHelper::Create(m_pImpl
->m_xStorage
,GRAPHICHELPER_MODE_WRITE
);
2190 uno::Reference
< uno::XInterface
> xRet(static_cast< ::cppu::OWeakObject
* >(pGraphicHelper
));
2191 pGraphicHelper
->release();
2194 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.data.DataProvider")) == 0 )
2196 uno::Reference
<chart2::data::XDatabaseDataProvider
> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps
->m_xContext
, m_pImpl
->m_xActiveConnection
));
2197 xDataProvider
->setRowLimit(10);
2198 return uno::Reference
< uno::XInterface
>(xDataProvider
,uno::UNO_QUERY
);
2200 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap")) == 0 )
2202 if ( !m_pImpl
->m_xXMLNamespaceMap
.is() )
2203 m_pImpl
->m_xXMLNamespaceMap
= comphelper::NameContainer_createInstance( ::getCppuType( (const ::rtl::OUString
*) 0 ) ).get();
2204 return m_pImpl
->m_xXMLNamespaceMap
;
2207 xShape
.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier
),uno::UNO_QUERY_THROW
);
2209 return m_pImpl
->m_pReportModel
->createShape(aServiceSpecifier
,xShape
);
2211 //-----------------------------------------------------------------------------
2212 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getAvailableServiceNames(void) throw( uno::RuntimeException
)
2214 static const ::rtl::OUString aSvxComponentServiceNameList
[] =
2216 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText")),
2217 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl")),
2218 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle")),
2219 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle")),
2220 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle")),
2221 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults")),
2222 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),
2223 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")),
2224 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")),
2225 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")),
2226 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider")),
2227 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap")),
2228 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings")),
2229 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")),
2230 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")),
2231 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")),
2232 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")),
2233 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")),
2234 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable"))
2237 static const sal_uInt16 nSvxComponentServiceNameListCount
= sizeof(aSvxComponentServiceNameList
) / sizeof ( aSvxComponentServiceNameList
[0] );
2239 uno::Sequence
< ::rtl::OUString
> aSeq( nSvxComponentServiceNameListCount
);
2240 ::rtl::OUString
* pStrings
= aSeq
.getArray();
2241 for( sal_uInt16 nIdx
= 0; nIdx
< nSvxComponentServiceNameListCount
; nIdx
++ )
2242 pStrings
[nIdx
] = aSvxComponentServiceNameList
[nIdx
];
2244 uno::Sequence
< ::rtl::OUString
> aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
2245 return concatServiceNames( aParentSeq
, aSeq
);
2247 // -----------------------------------------------------------------------------
2249 awt::Point SAL_CALL
OReportDefinition::getPosition( ) throw (uno::RuntimeException
)
2251 ::osl::MutexGuard
aGuard(m_aMutex
);
2252 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2253 if ( m_aProps
->m_xShape
.is() )
2254 return m_aProps
->m_xShape
->getPosition();
2255 return awt::Point(m_aProps
->m_nPosX
,m_aProps
->m_nPosY
);
2257 // -----------------------------------------------------------------------------
2258 void SAL_CALL
OReportDefinition::setPosition( const awt::Point
& aPosition
) throw (uno::RuntimeException
)
2260 ::osl::MutexGuard
aGuard(m_aMutex
);
2261 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2262 if ( m_aProps
->m_xShape
.is() )
2263 m_aProps
->m_xShape
->setPosition(aPosition
);
2264 set(PROPERTY_POSITIONX
,aPosition
.X
,m_aProps
->m_nPosX
);
2265 set(PROPERTY_POSITIONY
,aPosition
.Y
,m_aProps
->m_nPosY
);
2267 // -----------------------------------------------------------------------------
2268 awt::Size SAL_CALL
OReportDefinition::getSize( ) throw (uno::RuntimeException
)
2270 ::osl::MutexGuard
aGuard(m_aMutex
);
2271 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2272 if ( m_aProps
->m_xShape
.is() )
2273 return m_aProps
->m_xShape
->getSize();
2274 return awt::Size(m_aProps
->m_nWidth
,m_aProps
->m_nHeight
);
2276 // -----------------------------------------------------------------------------
2277 void SAL_CALL
OReportDefinition::setSize( const awt::Size
& aSize
) throw (beans::PropertyVetoException
, uno::RuntimeException
)
2279 ::osl::MutexGuard
aGuard(m_aMutex
);
2280 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2281 if ( m_aProps
->m_xShape
.is() )
2282 m_aProps
->m_xShape
->setSize(aSize
);
2283 set(PROPERTY_WIDTH
,aSize
.Width
,m_aProps
->m_nWidth
);
2284 set(PROPERTY_HEIGHT
,aSize
.Height
,m_aProps
->m_nHeight
);
2286 // -----------------------------------------------------------------------------
2289 ::rtl::OUString SAL_CALL
OReportDefinition::getShapeType( ) throw (uno::RuntimeException
)
2291 ::osl::MutexGuard
aGuard(m_aMutex
);
2292 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2293 if ( m_aProps
->m_xShape
.is() )
2294 return m_aProps
->m_xShape
->getShapeType();
2295 return ::rtl::OUString();
2297 // -----------------------------------------------------------------------------
2298 typedef ::cppu::WeakImplHelper2
< container::XNameContainer
,
2299 container::XIndexAccess
2301 class OStylesHelper
: public ::cppu::BaseMutex
, public TStylesBASE
2303 typedef ::std::map
< ::rtl::OUString
, uno::Any
, ::comphelper::UStringMixLess
> TStyleElements
;
2304 TStyleElements m_aElements
;
2305 ::std::vector
<TStyleElements::iterator
> m_aElementsPos
;
2308 OStylesHelper(const OStylesHelper
&);
2309 void operator =(const OStylesHelper
&);
2311 // TODO: VirtualFunctionFinder: This is virtual function!
2313 virtual ~OStylesHelper(){}
2315 OStylesHelper(const uno::Type _aType
= ::getCppuType(static_cast< uno::Reference
< container::XElementAccess
>* >(NULL
)));
2318 // TODO: VirtualFunctionFinder: This is virtual function!
2320 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::ElementExistException
,lang::WrappedTargetException
, uno::RuntimeException
);
2321 // TODO: VirtualFunctionFinder: This is virtual function!
2323 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& Name
) throw(container::NoSuchElementException
, lang::WrappedTargetException
,uno::RuntimeException
);
2326 // TODO: VirtualFunctionFinder: This is virtual function!
2328 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::NoSuchElementException
,lang::WrappedTargetException
, uno::RuntimeException
);
2330 // container::XElementAccess
2331 uno::Type SAL_CALL
getElementType( ) throw(uno::RuntimeException
);
2332 sal_Bool SAL_CALL
hasElements( ) throw(uno::RuntimeException
);
2333 // container::XIndexAccess
2334 sal_Int32 SAL_CALL
getCount( ) throw(uno::RuntimeException
);
2335 uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
);
2337 // container::XNameAccess
2338 uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
);
2339 uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw(uno::RuntimeException
);
2340 sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw(uno::RuntimeException
);
2343 OStylesHelper::OStylesHelper(const uno::Type _aType
)
2348 // -----------------------------------------------------------------------------;
2349 // container::XElementAccess
2350 uno::Type SAL_CALL
OStylesHelper::getElementType( ) throw(uno::RuntimeException
)
2354 // -----------------------------------------------------------------------------
2355 sal_Bool SAL_CALL
OStylesHelper::hasElements( ) throw(uno::RuntimeException
)
2357 ::osl::MutexGuard
aGuard(m_aMutex
);
2358 return !m_aElementsPos
.empty();
2360 // -----------------------------------------------------------------------------
2361 // container::XIndexAccess
2362 sal_Int32 SAL_CALL
OStylesHelper::getCount( ) throw(uno::RuntimeException
)
2364 ::osl::MutexGuard
aGuard(m_aMutex
);
2365 return m_aElementsPos
.size();
2367 // -----------------------------------------------------------------------------
2368 uno::Any SAL_CALL
OStylesHelper::getByIndex( sal_Int32 Index
) throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
2370 ::osl::MutexGuard
aGuard(m_aMutex
);
2371 if ( Index
< 0 || Index
>= static_cast<sal_Int32
>(m_aElementsPos
.size()) )
2372 throw lang::IndexOutOfBoundsException();
2373 return uno::makeAny(m_aElementsPos
[Index
]->second
);
2375 // -----------------------------------------------------------------------------
2376 // container::XNameAccess
2377 uno::Any SAL_CALL
OStylesHelper::getByName( const ::rtl::OUString
& aName
) throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
2379 ::osl::MutexGuard
aGuard(m_aMutex
);
2380 TStyleElements::iterator aFind
= m_aElements
.find(aName
);
2381 if ( aFind
== m_aElements
.end() )
2382 throw container::NoSuchElementException();
2383 return uno::makeAny(aFind
->second
);
2385 // -----------------------------------------------------------------------------
2386 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OStylesHelper::getElementNames( ) throw(uno::RuntimeException
)
2388 ::osl::MutexGuard
aGuard(m_aMutex
);
2389 uno::Sequence
< ::rtl::OUString
> aNameList(m_aElementsPos
.size());
2391 ::rtl::OUString
* pStringArray
= aNameList
.getArray();
2392 ::std::vector
<TStyleElements::iterator
>::const_iterator aEnd
= m_aElementsPos
.end();
2393 for(::std::vector
<TStyleElements::iterator
>::const_iterator aIter
= m_aElementsPos
.begin(); aIter
!= aEnd
;++aIter
,++pStringArray
)
2394 *pStringArray
= (*aIter
)->first
;
2398 // -----------------------------------------------------------------------------
2399 sal_Bool SAL_CALL
OStylesHelper::hasByName( const ::rtl::OUString
& aName
) throw(uno::RuntimeException
)
2401 ::osl::MutexGuard
aGuard(m_aMutex
);
2402 return m_aElements
.find(aName
) != m_aElements
.end();
2404 // TODO: VirtualFunctionFinder: This is virtual function!
2406 // -----------------------------------------------------------------------------
2408 void SAL_CALL
OStylesHelper::insertByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::ElementExistException
,lang::WrappedTargetException
, uno::RuntimeException
)
2410 ::osl::MutexGuard
aGuard(m_aMutex
);
2411 if ( m_aElements
.find(aName
) != m_aElements
.end() )
2412 throw container::ElementExistException();
2414 if ( !aElement
.isExtractableTo(m_aType
) )
2415 throw lang::IllegalArgumentException();
2417 m_aElementsPos
.push_back(m_aElements
.insert(TStyleElements::value_type(aName
,aElement
)).first
);
2418 // TODO: VirtualFunctionFinder: This is virtual function!
2421 // -----------------------------------------------------------------------------
2422 void SAL_CALL
OStylesHelper::removeByName( const ::rtl::OUString
& aName
) throw(container::NoSuchElementException
, lang::WrappedTargetException
,uno::RuntimeException
)
2424 ::osl::MutexGuard
aGuard(m_aMutex
);
2425 TStyleElements::iterator aFind
= m_aElements
.find(aName
);
2426 if ( aFind
!= m_aElements
.end() )
2427 throw container::NoSuchElementException();
2428 m_aElementsPos
.erase(::std::find(m_aElementsPos
.begin(),m_aElementsPos
.end(),aFind
));
2429 m_aElements
.erase(aFind
);
2431 // TODO: VirtualFunctionFinder: This is virtual function!
2433 // -----------------------------------------------------------------------------
2435 void SAL_CALL
OStylesHelper::replaceByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::NoSuchElementException
,lang::WrappedTargetException
, uno::RuntimeException
)
2437 ::osl::MutexGuard
aGuard(m_aMutex
);
2438 TStyleElements::iterator aFind
= m_aElements
.find(aName
);
2439 if ( aFind
!= m_aElements
.end() )
2440 throw container::NoSuchElementException();
2441 if ( !aElement
.isExtractableTo(m_aType
) )
2442 throw lang::IllegalArgumentException();
2443 aFind
->second
= aElement
;
2445 // -----------------------------------------------------------------------------
2446 uno::Reference
< container::XNameAccess
> SAL_CALL
OReportDefinition::getStyleFamilies( ) throw (uno::RuntimeException
)
2448 ::osl::MutexGuard
aGuard(m_aMutex
);
2449 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2450 if ( !m_pImpl
->m_xStyles
.is() )
2452 m_pImpl
->m_xStyles
= new OStylesHelper();
2453 uno::Reference
< container::XNameContainer
> xStyles(m_pImpl
->m_xStyles
,uno::UNO_QUERY
);
2455 uno::Reference
< container::XNameContainer
> xPageStyles
= new OStylesHelper(::getCppuType(static_cast< uno::Reference
<style::XStyle
>* >(NULL
)));
2456 xStyles
->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles")),uno::makeAny(xPageStyles
));
2457 uno::Reference
< style::XStyle
> xPageStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle"))),uno::UNO_QUERY
);
2458 xPageStyles
->insertByName(xPageStyle
->getName(),uno::makeAny(xPageStyle
));
2460 uno::Reference
< container::XNameContainer
> xFrameStyles
= new OStylesHelper(::getCppuType(static_cast< uno::Reference
<style::XStyle
>* >(NULL
)));
2461 xStyles
->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameStyles")),uno::makeAny(xFrameStyles
));
2462 uno::Reference
< style::XStyle
> xFrameStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle"))),uno::UNO_QUERY
);
2463 xFrameStyles
->insertByName(xFrameStyle
->getName(),uno::makeAny(xFrameStyle
));
2465 uno::Reference
< container::XNameContainer
> xGraphicStyles
= new OStylesHelper(::getCppuType(static_cast< uno::Reference
<style::XStyle
>* >(NULL
)));
2466 xStyles
->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")),uno::makeAny(xGraphicStyles
));
2467 uno::Reference
< style::XStyle
> xGraphicStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle"))),uno::UNO_QUERY
);
2468 xGraphicStyles
->insertByName(xGraphicStyle
->getName(),uno::makeAny(xGraphicStyle
));
2470 return m_pImpl
->m_xStyles
;
2472 ::rtl::OUString SAL_CALL
OReportDefinition::getIdentifier( ) throw (uno::RuntimeException
)
2474 ::osl::MutexGuard
aGuard(m_aMutex
);
2475 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2476 return m_pImpl
->m_sIdentifier
;
2478 // -----------------------------------------------------------------------------
2479 void SAL_CALL
OReportDefinition::setIdentifier( const ::rtl::OUString
& Identifier
) throw (uno::RuntimeException
)
2481 ::osl::MutexGuard
aGuard(m_aMutex
);
2482 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2483 m_pImpl
->m_sIdentifier
= Identifier
;
2485 // -----------------------------------------------------------------------------
2486 // XNumberFormatsSupplier
2487 uno::Reference
< beans::XPropertySet
> SAL_CALL
OReportDefinition::getNumberFormatSettings( ) throw (uno::RuntimeException
)
2489 ::osl::MutexGuard
aGuard(m_aMutex
);
2490 if ( m_pImpl
->m_xNumberFormatsSupplier
.is() )
2491 return m_pImpl
->m_xNumberFormatsSupplier
->getNumberFormatSettings();
2492 return uno::Reference
< beans::XPropertySet
>();
2494 // -----------------------------------------------------------------------------
2495 uno::Reference
< util::XNumberFormats
> SAL_CALL
OReportDefinition::getNumberFormats( ) throw (uno::RuntimeException
)
2497 ::osl::MutexGuard
aGuard(m_aMutex
);
2498 if ( m_pImpl
->m_xNumberFormatsSupplier
.is() )
2499 return m_pImpl
->m_xNumberFormatsSupplier
->getNumberFormats();
2500 return uno::Reference
< util::XNumberFormats
>();
2502 // -----------------------------------------------------------------------------
2503 ::comphelper::EmbeddedObjectContainer
& OReportDefinition::getEmbeddedObjectContainer() const
2505 return *m_pImpl
->m_pObjectContainer
;
2507 // -----------------------------------------------------------------------------
2508 uno::Reference
< embed::XStorage
> OReportDefinition::getStorage() const
2510 return m_pImpl
->m_xStorage
;
2512 // -----------------------------------------------------------------------------
2513 uno::Reference
< task::XInteractionHandler
> OReportDefinition::getInteractionHandler() const
2515 uno::Reference
< task::XInteractionHandler
> xRet( m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2516 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler")) ,m_aProps
->m_xContext
),uno::UNO_QUERY
);
2519 // -----------------------------------------------------------------------------
2520 uno::Reference
< sdbc::XConnection
> SAL_CALL
OReportDefinition::getActiveConnection() throw (uno::RuntimeException
)
2522 ::osl::MutexGuard
aGuard(m_aMutex
);
2523 return m_pImpl
->m_xActiveConnection
;
2525 // -----------------------------------------------------------------------------
2526 void SAL_CALL
OReportDefinition::setActiveConnection( const uno::Reference
< sdbc::XConnection
>& _activeconnection
) throw (lang::IllegalArgumentException
, uno::RuntimeException
)
2528 if ( !_activeconnection
.is() )
2529 throw lang::IllegalArgumentException();
2530 set(PROPERTY_ACTIVECONNECTION
,_activeconnection
,m_pImpl
->m_xActiveConnection
);
2532 // -----------------------------------------------------------------------------
2533 ::rtl::OUString SAL_CALL
OReportDefinition::getDataSourceName() throw (uno::RuntimeException
)
2535 osl::MutexGuard
g(m_aMutex
);
2536 return m_pImpl
->m_sDataSourceName
;
2538 // -----------------------------------------------------------------------------
2539 void SAL_CALL
OReportDefinition::setDataSourceName(const ::rtl::OUString
& the_value
) throw (uno::RuntimeException
)
2541 set(PROPERTY_DATASOURCENAME
,the_value
,m_pImpl
->m_sDataSourceName
);
2543 // -----------------------------------------------------------------------------
2544 bool OReportDefinition::isEnableSetModified() const
2548 uno::Reference
< frame::XTitle
> OReportDefinition::impl_getTitleHelper_throw()
2550 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2552 ::osl::MutexGuard
aGuard(m_aMutex
);
2553 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2555 if ( ! m_pImpl
->m_xTitleHelper
.is ())
2557 uno::Reference
< frame::XUntitledNumbers
> xDesktop(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2558 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop")) ,m_aProps
->m_xContext
),uno::UNO_QUERY_THROW
);
2559 uno::Reference
< frame::XModel
> xThis (static_cast< frame::XModel
* >(this), uno::UNO_QUERY_THROW
);
2561 ::framework::TitleHelper
* pHelper
= new ::framework::TitleHelper(uno::Reference
< lang::XMultiServiceFactory
>(m_aProps
->m_xContext
->getServiceManager(),uno::UNO_QUERY
));
2562 m_pImpl
->m_xTitleHelper
= uno::Reference
< frame::XTitle
>(static_cast< ::cppu::OWeakObject
* >(pHelper
), uno::UNO_QUERY_THROW
);
2563 pHelper
->setOwner (xThis
);
2564 pHelper
->connectWithUntitledNumbers (xDesktop
);
2567 return m_pImpl
->m_xTitleHelper
;
2569 // -----------------------------------------------------------------------------
2570 uno::Reference
< frame::XUntitledNumbers
> OReportDefinition::impl_getUntitledHelper_throw()
2572 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2574 ::osl::MutexGuard
aGuard(m_aMutex
);
2575 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2577 if ( ! m_pImpl
->m_xNumberedControllers
.is ())
2579 uno::Reference
< frame::XModel
> xThis (static_cast< frame::XModel
* >(this), uno::UNO_QUERY_THROW
);
2580 ::comphelper::NumberedCollection
* pHelper
= new ::comphelper::NumberedCollection();
2581 m_pImpl
->m_xNumberedControllers
= uno::Reference
< frame::XUntitledNumbers
>(static_cast< ::cppu::OWeakObject
* >(pHelper
), uno::UNO_QUERY_THROW
);
2583 pHelper
->setOwner (xThis
);
2584 pHelper
->setUntitledPrefix (::rtl::OUString::createFromAscii(" : "));
2587 return m_pImpl
->m_xNumberedControllers
;
2589 // -----------------------------------------------------------------------------
2591 ::rtl::OUString SAL_CALL
OReportDefinition::getTitle()
2592 throw (uno::RuntimeException
)
2595 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2597 ::osl::MutexGuard
aGuard(m_aMutex
);
2598 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2600 return impl_getTitleHelper_throw()->getTitle ();
2602 // -----------------------------------------------------------------------------
2604 void SAL_CALL
OReportDefinition::setTitle( const ::rtl::OUString
& sTitle
)
2605 throw (uno::RuntimeException
)
2608 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2610 ::osl::MutexGuard
aGuard(m_aMutex
);
2611 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2613 impl_getTitleHelper_throw()->setTitle (sTitle
);
2615 // -----------------------------------------------------------------------------
2616 // css.frame.XTitleChangeBroadcaster
2617 void SAL_CALL
OReportDefinition::addTitleChangeListener( const uno::Reference
< frame::XTitleChangeListener
>& xListener
)
2618 throw (uno::RuntimeException
)
2621 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2623 ::osl::MutexGuard
aGuard(m_aMutex
);
2624 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2626 uno::Reference
< frame::XTitleChangeBroadcaster
> xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY
);
2627 if (xBroadcaster
.is ())
2628 xBroadcaster
->addTitleChangeListener (xListener
);
2630 // -----------------------------------------------------------------------------
2631 // css.frame.XTitleChangeBroadcaster
2632 void SAL_CALL
OReportDefinition::removeTitleChangeListener( const uno::Reference
< frame::XTitleChangeListener
>& xListener
)
2633 throw (uno::RuntimeException
)
2636 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2638 ::osl::MutexGuard
aGuard(m_aMutex
);
2639 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2641 uno::Reference
< frame::XTitleChangeBroadcaster
> xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY
);
2642 if (xBroadcaster
.is ())
2643 xBroadcaster
->removeTitleChangeListener (xListener
);
2645 // -----------------------------------------------------------------------------
2646 // css.frame.XUntitledNumbers
2647 ::sal_Int32 SAL_CALL
OReportDefinition::leaseNumber( const uno::Reference
< uno::XInterface
>& xComponent
)
2648 throw (lang::IllegalArgumentException
,
2649 uno::RuntimeException
)
2651 // object already disposed?
2652 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2653 ::osl::MutexGuard
aGuard(m_aMutex
);
2654 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2656 return impl_getUntitledHelper_throw()->leaseNumber (xComponent
);
2658 // -----------------------------------------------------------------------------
2659 // css.frame.XUntitledNumbers
2660 void SAL_CALL
OReportDefinition::releaseNumber( ::sal_Int32 nNumber
)
2661 throw (lang::IllegalArgumentException
,
2662 uno::RuntimeException
)
2664 // object already disposed?
2665 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2666 ::osl::MutexGuard
aGuard(m_aMutex
);
2667 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2669 impl_getUntitledHelper_throw()->releaseNumber (nNumber
);
2671 // -----------------------------------------------------------------------------
2672 // css.frame.XUntitledNumbers
2673 void SAL_CALL
OReportDefinition::releaseNumberForComponent( const uno::Reference
< uno::XInterface
>& xComponent
)
2674 throw (lang::IllegalArgumentException
,
2675 uno::RuntimeException
)
2677 // object already disposed?
2678 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2679 ::osl::MutexGuard
aGuard(m_aMutex
);
2680 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2682 impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent
);
2684 // -----------------------------------------------------------------------------
2685 // css.frame.XUntitledNumbers
2686 ::rtl::OUString SAL_CALL
OReportDefinition::getUntitledPrefix()
2687 throw (uno::RuntimeException
)
2689 // object already disposed?
2690 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2691 ::osl::MutexGuard
aGuard(m_aMutex
);
2692 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2694 return impl_getUntitledHelper_throw()->getUntitledPrefix ();
2696 // -----------------------------------------------------------------------------
2697 uno::Reference
< document::XDocumentProperties
> SAL_CALL
OReportDefinition::getDocumentProperties( ) throw (uno::RuntimeException
)
2699 ::osl::MutexGuard
aGuard(m_aMutex
);
2700 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2701 if ( !m_pImpl
->m_xDocumentProperties
.is() )
2703 uno::Reference
< lang::XInitialization
> xDocProps(
2704 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2705 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentProperties")) ,m_aProps
->m_xContext
),
2706 uno::UNO_QUERY_THROW
);
2707 m_pImpl
->m_xDocumentProperties
.set(xDocProps
, uno::UNO_QUERY_THROW
);
2709 return m_pImpl
->m_xDocumentProperties
;
2711 // -----------------------------------------------------------------------------
2712 uno::Reference
< uno::XComponentContext
> OReportDefinition::getContext() const
2714 return m_aProps
->m_xContext
;
2716 // =============================================================================
2717 }// namespace reportdesign
2718 // =============================================================================