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/broadcasthelper.hxx>
43 #include <comphelper/documentconstants.hxx>
44 #include <comphelper/genericpropertyset.hxx>
45 #include <comphelper/mediadescriptor.hxx>
46 #include <comphelper/mimeconfighelper.hxx>
47 #include <comphelper/namecontainer.hxx>
48 #include <comphelper/namedvaluecollection.hxx>
49 #include <comphelper/numberedcollection.hxx>
50 #include <comphelper/propertystatecontainer.hxx>
51 #include <comphelper/proparrhlp.hxx>
52 #include <comphelper/property.hxx>
53 #include <comphelper/propertysetinfo.hxx>
54 #include <comphelper/sequence.hxx>
55 #include <comphelper/seqstream.hxx>
56 #include <comphelper/storagehelper.hxx>
57 #include <comphelper/uno3.hxx>
58 #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
59 #include <vcl/svapp.hxx>
60 #include <vcl/virdev.hxx>
61 #include <vos/mutex.hxx>
62 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
63 #include <com/sun/star/document/EventObject.hpp>
64 #include <com/sun/star/document/XEventListener.hpp>
65 #include <com/sun/star/style/XStyle.hpp>
66 #include <com/sun/star/embed/XTransactedObject.hpp>
67 #include <com/sun/star/embed/ElementModes.hpp>
68 #include <com/sun/star/embed/EmbedMapUnits.hpp>
69 #include <com/sun/star/embed/EntryInitModes.hpp>
70 #include <com/sun/star/embed/Aspects.hpp>
71 #include <com/sun/star/io/XActiveDataSource.hpp>
72 #include <com/sun/star/embed/ElementModes.hpp>
73 #include <com/sun/star/io/XSeekable.hpp>
74 #include <com/sun/star/embed/XEmbedPersist.hpp>
75 #include <com/sun/star/task/XStatusIndicator.hpp>
76 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
77 #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
78 #include <com/sun/star/document/XExporter.hpp>
79 #include <com/sun/star/document/XImporter.hpp>
80 #include <com/sun/star/document/XFilter.hpp>
81 #include <com/sun/star/task/ErrorCodeIOException.hpp>
82 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
83 #include <com/sun/star/frame/XComponentLoader.hpp>
84 #include <com/sun/star/frame/FrameSearchFlag.hpp>
85 #include "corestrings.hrc"
88 #include "Section.hxx"
89 #include "FixedLine.hxx"
90 #include "core_resource.hrc"
91 #include "core_resource.hxx"
93 #include <tools/debug.hxx>
94 #include <tools/diagnose_ex.h>
95 #include <unotools/streamwrap.hxx>
96 #include <connectivity/CommonTools.hxx>
97 #include <connectivity/dbconversion.hxx>
98 #include <framework/titlehelper.hxx>
99 #include <connectivity/dbtools.hxx>
100 #include <com/sun/star/task/XStatusIndicator.hpp>
101 #include "Functions.hxx"
102 #include <boost/mem_fn.hpp>
103 #include <boost/bind.hpp>
104 #include <boost/utility.hpp>
105 #include <svtools/saveopt.hxx>
106 #include "RptModel.hxx"
107 #include "UndoEnv.hxx"
108 #include "FormattedField.hxx"
109 #include "FixedText.hxx"
110 #include "ImageControl.hxx"
112 #include "ReportHelperImpl.hxx"
113 #include <svtools/itempool.hxx>
114 #include <svtools/moduleoptions.hxx>
115 #include <osl/thread.hxx>
117 #include <svx/paperinf.hxx>
118 #include <svx/svdlayer.hxx>
119 #include <svx/xmleohlp.hxx>
120 #include <svx/xmlgrhlp.hxx>
121 #include <svx/unofill.hxx>
122 #include <cppuhelper/interfacecontainer.h>
123 #include <cppuhelper/exc_hlp.hxx>
124 #include "ReportComponent.hxx"
125 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
126 #include <com/sun/star/style/NumberingType.hpp>
128 #define MAP_LEN(x) x, sizeof(x) - 1
129 #define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
131 #define SC_UNO_PAGE_GRAPHICFILT "BackGraphicFilter"
132 #define SC_UNO_PAGE_LEFTBORDER "LeftBorder"
133 #define SC_UNO_PAGE_RIGHTBORDER "RightBorder"
134 #define SC_UNO_PAGE_BOTTBORDER "BottomBorder"
135 #define SC_UNO_PAGE_TOPBORDER "TopBorder"
136 #define SC_UNO_PAGE_LEFTBRDDIST "LeftBorderDistance"
137 #define SC_UNO_PAGE_RIGHTBRDDIST "RightBorderDistance"
138 #define SC_UNO_PAGE_BOTTBRDDIST "BottomBorderDistance"
139 #define SC_UNO_PAGE_TOPBRDDIST "TopBorderDistance"
140 #define SC_UNO_PAGE_BORDERDIST "BorderDistance"
141 #define SC_UNO_PAGE_SHADOWFORM "ShadowFormat"
142 #define SC_UNO_PAGE_PAPERTRAY "PrinterPaperTray"
143 #define SC_UNO_PAGE_SCALEVAL "PageScale"
144 #define SC_UNO_PAGE_SCALETOPAG "ScaleToPages"
145 #define SC_UNO_PAGE_SCALETOX "ScaleToPagesX"
146 #define SC_UNO_PAGE_SCALETOY "ScaleToPagesY"
147 #define SC_UNO_PAGE_FIRSTPAGE "FirstPageNumber"
148 #define SC_UNO_PAGE_LEFTHDRCONT "LeftPageHeaderContent"
149 #define SC_UNO_PAGE_LEFTFTRCONT "LeftPageFooterContent"
150 #define SC_UNO_PAGE_RIGHTHDRCON "RightPageHeaderContent"
151 #define SC_UNO_PAGE_RIGHTFTRCON "RightPageFooterContent"
152 #define SC_UNO_PAGE_PRINTFORMUL "PrintFormulas"
153 #define SC_UNO_PAGE_PRINTZERO "PrintZeroValues"
154 #define SC_UNO_PAGE_HDRBACKCOL "HeaderBackColor"
155 #define SC_UNO_PAGE_HDRBACKTRAN "HeaderBackTransparent"
156 #define SC_UNO_PAGE_HDRGRFFILT "HeaderBackGraphicFilter"
157 #define SC_UNO_PAGE_HDRGRFLOC "HeaderBackGraphicLocation"
158 #define SC_UNO_PAGE_HDRGRFURL "HeaderBackGraphicURL"
159 #define SC_UNO_PAGE_HDRLEFTBOR "HeaderLeftBorder"
160 #define SC_UNO_PAGE_HDRRIGHTBOR "HeaderRightBorder"
161 #define SC_UNO_PAGE_HDRBOTTBOR "HeaderBottomBorder"
162 #define SC_UNO_PAGE_HDRTOPBOR "HeaderTopBorder"
163 #define SC_UNO_PAGE_HDRLEFTBDIS "HeaderLeftBorderDistance"
164 #define SC_UNO_PAGE_HDRRIGHTBDIS "HeaderRightBorderDistance"
165 #define SC_UNO_PAGE_HDRBOTTBDIS "HeaderBottomBorderDistance"
166 #define SC_UNO_PAGE_HDRTOPBDIS "HeaderTopBorderDistance"
167 #define SC_UNO_PAGE_HDRBRDDIST "HeaderBorderDistance"
168 #define SC_UNO_PAGE_HDRSHADOW "HeaderShadowFormat"
169 #define SC_UNO_PAGE_HDRLEFTMAR "HeaderLeftMargin"
170 #define SC_UNO_PAGE_HDRRIGHTMAR "HeaderRightMargin"
171 #define SC_UNO_PAGE_HDRBODYDIST "HeaderBodyDistance"
172 #define SC_UNO_PAGE_HDRHEIGHT "HeaderHeight"
173 #define SC_UNO_PAGE_HDRON "HeaderIsOn"
174 #define SC_UNO_PAGE_HDRDYNAMIC "HeaderIsDynamicHeight"
175 #define SC_UNO_PAGE_HDRSHARED "HeaderIsShared"
176 #define SC_UNO_PAGE_FTRBACKCOL "FooterBackColor"
177 #define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent"
178 #define SC_UNO_PAGE_FTRGRFFILT "FooterBackGraphicFilter"
179 #define SC_UNO_PAGE_FTRGRFLOC "FooterBackGraphicLocation"
180 #define SC_UNO_PAGE_FTRGRFURL "FooterBackGraphicURL"
181 #define SC_UNO_PAGE_FTRLEFTBOR "FooterLeftBorder"
182 #define SC_UNO_PAGE_FTRRIGHTBOR "FooterRightBorder"
183 #define SC_UNO_PAGE_FTRBOTTBOR "FooterBottomBorder"
184 #define SC_UNO_PAGE_FTRTOPBOR "FooterTopBorder"
185 #define SC_UNO_PAGE_FTRLEFTBDIS "FooterLeftBorderDistance"
186 #define SC_UNO_PAGE_FTRRIGHTBDIS "FooterRightBorderDistance"
187 #define SC_UNO_PAGE_FTRBOTTBDIS "FooterBottomBorderDistance"
188 #define SC_UNO_PAGE_FTRTOPBDIS "FooterTopBorderDistance"
189 #define SC_UNO_PAGE_FTRBRDDIST "FooterBorderDistance"
190 #define SC_UNO_PAGE_FTRSHADOW "FooterShadowFormat"
191 #define SC_UNO_PAGE_FTRLEFTMAR "FooterLeftMargin"
192 #define SC_UNO_PAGE_FTRRIGHTMAR "FooterRightMargin"
193 #define SC_UNO_PAGE_FTRBODYDIST "FooterBodyDistance"
194 #define SC_UNO_PAGE_FTRHEIGHT "FooterHeight"
195 #define SC_UNO_PAGE_FTRON "FooterIsOn"
196 #define SC_UNO_PAGE_FTRDYNAMIC "FooterIsDynamicHeight"
197 #define SC_UNO_PAGE_FTRSHARED "FooterIsShared"
199 // =============================================================================
200 namespace reportdesign
202 // =============================================================================
203 using namespace com::sun::star
;
204 using namespace comphelper
;
205 using namespace rptui
;
206 // -----------------------------------------------------------------------------
208 // -----------------------------------------------------------------------------
209 void lcl_setModelReadOnly(const uno::Reference
< embed::XStorage
>& _xStorage
,::boost::shared_ptr
<rptui::OReportModel
>& _rModel
)
211 uno::Reference
<beans::XPropertySet
> xProp(_xStorage
,uno::UNO_QUERY
);
212 sal_Int32 nOpenMode
= embed::ElementModes::READ
;
214 xProp
->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nOpenMode
;
216 _rModel
->SetReadOnly((nOpenMode
& embed::ElementModes::WRITE
) != embed::ElementModes::WRITE
);
218 void lcl_stripLoadArguments( ::comphelper::MediaDescriptor
& _rDescriptor
, uno::Sequence
< beans::PropertyValue
>& _rArgs
)
220 _rDescriptor
.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ) );
221 _rDescriptor
.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ) );
222 _rDescriptor
.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) );
223 _rDescriptor
>> _rArgs
;
225 // -----------------------------------------------------------------------------
226 void lcl_extractAndStartStatusIndicator( const ::comphelper::MediaDescriptor
& _rDescriptor
, uno::Reference
< task::XStatusIndicator
>& _rxStatusIndicator
,
227 uno::Sequence
< uno::Any
>& _rCallArgs
)
231 _rxStatusIndicator
= _rDescriptor
.getUnpackedValueOrDefault( _rDescriptor
.PROP_STATUSINDICATOR(), _rxStatusIndicator
);
232 if ( _rxStatusIndicator
.is() )
234 _rxStatusIndicator
->start( ::rtl::OUString(), (sal_Int32
)1000000 );
236 sal_Int32 nLength
= _rCallArgs
.getLength();
237 _rCallArgs
.realloc( nLength
+ 1 );
238 _rCallArgs
[ nLength
] <<= _rxStatusIndicator
;
241 catch( const uno::Exception
& )
243 OSL_ENSURE( sal_False
, "lcl_extractAndStartStatusIndicator: caught an exception!" );
244 // DBG_UNHANDLED_EXCEPTION();
247 // -----------------------------------------------------------------------------
248 typedef ::comphelper::OPropertyStateContainer OStyle_PBASE
;
250 typedef ::comphelper::OPropertyArrayUsageHelper
< OStyle
252 typedef ::cppu::WeakImplHelper2
< style::XStyle
, beans::XMultiPropertyStates
> TStyleBASE
;
254 class OStyle
: public ::comphelper::OMutexAndBroadcastHelper
257 ,public OStyle_PABASE
262 void getPropertyDefaultByHandle( sal_Int32 _nHandle
, uno::Any
& _rDefault
) const;
268 DECLARE_XINTERFACE( )
271 com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(com::sun::star::uno::RuntimeException
);
272 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
273 ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
276 ::sal_Bool SAL_CALL
isUserDefined( ) throw (uno::RuntimeException
);
277 ::sal_Bool SAL_CALL
isInUse( ) throw (uno::RuntimeException
);
278 ::rtl::OUString SAL_CALL
getParentStyle( ) throw (uno::RuntimeException
);
279 void SAL_CALL
setParentStyle( const ::rtl::OUString
& aParentStyle
) throw (container::NoSuchElementException
, uno::RuntimeException
);
281 ::rtl::OUString SAL_CALL
getName( ) throw (uno::RuntimeException
);
282 void SAL_CALL
setName( const ::rtl::OUString
& aName
) throw (uno::RuntimeException
);
284 // XMultiPropertyState
285 uno::Sequence
< beans::PropertyState
> SAL_CALL
getPropertyStates( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, uno::RuntimeException
)
287 return OStyle_PBASE::getPropertyStates(aPropertyNames
);
289 void SAL_CALL
setAllPropertiesToDefault( ) throw (uno::RuntimeException
);
290 void SAL_CALL
setPropertiesToDefault( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, uno::RuntimeException
);
291 uno::Sequence
< uno::Any
> SAL_CALL
getPropertyDefaults( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
);
293 // -----------------------------------------------------------------------------
295 :OStyle_PBASE(m_aBHelper
)
296 ,m_aSize(21000,29700)
298 const ::Size aDefaultSize
= SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM
);
299 m_aSize
.Height
= aDefaultSize
.Height();
300 m_aSize
.Width
= aDefaultSize
.Width();
302 const style::GraphicLocation eGraphicLocation
= style::GraphicLocation_NONE
;
303 const sal_Bool bFalse
= sal_False
;
304 const sal_Bool bTrue
= sal_True
;
305 const sal_Int32 nMargin
= 2000;
306 //const sal_Int32 nColor = COL_WHITE;
307 const sal_Int32 nTransparent
= COL_TRANSPARENT
;
308 const sal_Int32 nZero
= 0;
309 const sal_Int16 n16Zero
= 0;
310 const sal_Int16 nNummeringType
= style::NumberingType::ARABIC
;
311 const ::rtl::OUString
sName(RTL_CONSTASCII_USTRINGPARAM("Default"));
312 const ::rtl::OUString sEmpty
;
313 const table::BorderLine
eBorderLine(0,0,0,0);
314 const table::ShadowFormat
eShadowFormat(table::ShadowLocation_NONE
,0,0,0);
315 const style::PageStyleLayout ePageStyleLayout
= style::PageStyleLayout_ALL
;
316 const sal_Int32 nBound
= beans::PropertyAttribute::BOUND
;
317 const sal_Int32 nMayBeVoid
= beans::PropertyAttribute::MAYBEVOID
;
320 registerPropertyNoMember( PROPERTY_NAME
, ++i
,nBound
,::getCppuType( static_cast< ::rtl::OUString
*>(NULL
) ), &sName
);
322 registerPropertyNoMember(PROPERTY_BACKCOLOR
, ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nTransparent
);
323 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICFILT), ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
325 registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION
, ++i
,nBound
,::getCppuType((const style::GraphicLocation
*)0) ,&eGraphicLocation
);
326 //registerPropertyNoMember(PROPERTY_BACKGRAPHICURL, ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
327 registerPropertyNoMember(PROPERTY_BACKTRANSPARENT
, ++i
,nBound
,::getBooleanCppuType() ,&bTrue
);
328 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_BACKCOLOR), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
329 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
330 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
331 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
332 registerPropertyNoMember(PROPERTY_BOTTOMMARGIN
, ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nMargin
);
333 registerPropertyNoMember(MAP_CHAR_LEN("DisplayName"), ++i
,nBound
,::getCppuType((rtl::OUString
*)0) ,&sEmpty
);
334 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FIRSTPAGE), ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
336 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nTransparent
);
337 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT
), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
338 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC
), ++i
,nBound
,::getCppuType((const style::GraphicLocation
*)0) ,&eGraphicLocation
);
339 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL
), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
340 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN
), ++i
,nBound
,::getBooleanCppuType() ,&bTrue
);
341 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
342 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
343 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
344 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
345 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
346 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC), ++i,nBound,::getBooleanCppuType() ,&bFalse);
347 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
348 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC
), ++i
,nBound
,::getBooleanCppuType() ,&bFalse
);
349 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRON
), ++i
,nBound
,::getBooleanCppuType() ,&bFalse
);
350 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED
), ++i
,nBound
,::getBooleanCppuType() ,&bFalse
);
351 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
352 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
353 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
354 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON), ++i,nBound,::getBooleanCppuType() ,&bFalse);
355 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
356 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS
),++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
357 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
358 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW
), ++i
,nBound
,::getCppuType((const table::ShadowFormat
*)0) ,&eShadowFormat
);
359 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED), ++i,nBound,::getBooleanCppuType() ,&bFalse);
360 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
361 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
363 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nTransparent
);
364 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
365 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const style::GraphicLocation
*)0) ,&eGraphicLocation
);
366 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const ::rtl::OUString
*)0) ,&sEmpty
);
367 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bTrue
);
368 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
369 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
370 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
371 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
372 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
373 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC), ++i,nBound,::getBooleanCppuType() ,&bFalse);
374 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
375 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bFalse
);
376 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRON
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bFalse
);
377 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED
), ++i
,nBound
|nMayBeVoid
,::getBooleanCppuType() ,&bFalse
);
378 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
379 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
380 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
381 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON), ++i,nBound,::getBooleanCppuType() ,&bFalse);
382 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
383 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS
),++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
384 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
385 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::ShadowFormat
*)0) ,&eShadowFormat
);
386 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED), ++i,nBound,::getBooleanCppuType() ,&bFalse);
387 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
388 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS
), ++i
,nBound
|nMayBeVoid
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
390 registerProperty(PROPERTY_HEIGHT
, ++i
,nBound
,&m_aSize
.Height
, ::getCppuType((const sal_Int32
*)0) );
391 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_BACKTRANS), ++i,nBound, ::getBooleanCppuType() ,&bFalse);
392 registerPropertyNoMember(PROPERTY_ISLANDSCAPE
, ++i
,nBound
, ::getBooleanCppuType() ,&bFalse
);
393 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER
), ++i
,nBound
, ::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
394 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST
), ++i
,nBound
, ::getCppuType((const sal_Int32
*)0) ,&nZero
);
395 registerPropertyNoMember(PROPERTY_LEFTMARGIN
, ++i
,beans::PropertyAttribute::BOUND
, ::getCppuType((const sal_Int32
*)0) ,&nMargin
);
396 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTFTRCONT), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
397 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTHDRCONT), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
398 registerPropertyNoMember(PROPERTY_NUMBERINGTYPE
, ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&nNummeringType
);
399 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
400 registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT
, ++i
,nBound
,::getCppuType((const style::PageStyleLayout
*)0) ,&ePageStyleLayout
);
401 const ::rtl::OUString
sPaperTray(RTL_CONSTASCII_USTRINGPARAM("[From printer settings]"));
402 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY
), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0) ,&sPaperTray
);
403 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
404 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST
),++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
405 registerPropertyNoMember(PROPERTY_RIGHTMARGIN
, ++i
,beans::PropertyAttribute::BOUND
,::getCppuType((const sal_Int32
*)0) ,&nMargin
);
406 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTFTRCON), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
407 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTHDRCON), ++i,nBound,::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0) ,NULL);
408 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
409 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
410 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY
), ++i
,nBound
,::getCppuType((const sal_Int16
*)0) ,&n16Zero
);
411 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM
), ++i
,nBound
,::getCppuType((const table::ShadowFormat
*)0) ,&eShadowFormat
);
412 registerProperty(PROPERTY_PAPERSIZE
, ++i
,beans::PropertyAttribute::BOUND
,&m_aSize
,::getCppuType((const awt::Size
*)0) );
413 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER
), ++i
,nBound
,::getCppuType((const table::BorderLine
*)0) ,&eBorderLine
);
414 registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST
), ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nZero
);
415 registerPropertyNoMember(PROPERTY_TOPMARGIN
, ++i
,nBound
,::getCppuType((const sal_Int32
*)0) ,&nMargin
);
416 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),++i,nBound,::getBooleanCppuType() ,&bFalse);
417 //registerPropertyNoMember(MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),++i,nBound,::getBooleanCppuType() ,&bFalse);
418 uno::Reference
< container::XNameContainer
> xAttribs
= ::comphelper::NameContainer_createInstance(::getCppuType(static_cast< xml::AttributeData
* >(NULL
)));
419 registerPropertyNoMember(MAP_CHAR_LEN("UserDefinedAttributes"), ++i
,nBound
,::getCppuType((uno::Reference
<container::XNameContainer
>*)0) ,&xAttribs
);
420 registerProperty(PROPERTY_WIDTH
, ++i
,nBound
,&m_aSize
.Width
,::getCppuType((const sal_Int32
*)0) );
421 //registerPropertyNoMember(MAP_CHAR_LEN(SC_UNONAME_WRITING), ++i,nBound,:.getCppuType((sal_Int16*)0) ,&n16Zero);
422 registerPropertyNoMember(MAP_CHAR_LEN("PrinterName"), ++i
,nBound
,::getCppuType((const ::rtl::OUString
*)0),&sEmpty
);
423 uno::Sequence
<sal_Int8
> aSe
;
424 registerPropertyNoMember(MAP_CHAR_LEN("PrinterSetup"), ++i
,nBound
,::getCppuType((const uno::Sequence
<sal_Int8
>*)0),&aSe
);
428 // -----------------------------------------------------------------------------
429 IMPLEMENT_FORWARD_XINTERFACE2(OStyle
,TStyleBASE
,OStyle_PBASE
)
430 // -----------------------------------------------------------------------------
431 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
OStyle::getPropertySetInfo() throw(uno::RuntimeException
)
433 return createPropertySetInfo( getInfoHelper() );
435 // -----------------------------------------------------------------------------
436 void OStyle::getPropertyDefaultByHandle( sal_Int32
/*_nHandle*/, uno::Any
& /*_rDefault*/ ) const
439 //-------------------------------------------------------------------------
440 ::cppu::IPropertyArrayHelper
& OStyle::getInfoHelper()
442 return *const_cast<OStyle
*>(this)->getArrayHelper();
444 //--------------------------------------------------------------------
445 ::cppu::IPropertyArrayHelper
* OStyle::createArrayHelper( ) const
447 uno::Sequence
< beans::Property
> aProps
;
448 describeProperties(aProps
);
449 return new ::cppu::OPropertyArrayHelper(aProps
);
451 // -----------------------------------------------------------------------------
453 ::sal_Bool SAL_CALL
OStyle::isUserDefined( ) throw (uno::RuntimeException
)
457 // -----------------------------------------------------------------------------
458 ::sal_Bool SAL_CALL
OStyle::isInUse( ) throw (uno::RuntimeException
)
462 // -----------------------------------------------------------------------------
463 ::rtl::OUString SAL_CALL
OStyle::getParentStyle( ) throw (uno::RuntimeException
)
465 return ::rtl::OUString();
467 // -----------------------------------------------------------------------------
468 void SAL_CALL
OStyle::setParentStyle( const ::rtl::OUString
& /*aParentStyle*/ ) throw (container::NoSuchElementException
, uno::RuntimeException
)
471 // -----------------------------------------------------------------------------
473 ::rtl::OUString SAL_CALL
OStyle::getName( ) throw (uno::RuntimeException
)
475 ::rtl::OUString sName
;
476 getPropertyValue(PROPERTY_NAME
) >>= sName
;
479 // -----------------------------------------------------------------------------
480 void SAL_CALL
OStyle::setName( const ::rtl::OUString
& aName
) throw (uno::RuntimeException
)
482 setPropertyValue(PROPERTY_NAME
,uno::makeAny(aName
));
484 // -----------------------------------------------------------------------------
485 void SAL_CALL
OStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException
)
488 // -----------------------------------------------------------------------------
489 void SAL_CALL
OStyle::setPropertiesToDefault( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, uno::RuntimeException
)
491 const ::rtl::OUString
* pIter
= aPropertyNames
.getConstArray();
492 const ::rtl::OUString
* pEnd
= pIter
+ aPropertyNames
.getLength();
493 for(;pIter
!= pEnd
;++pIter
)
494 setPropertyToDefault(*pIter
);
496 // -----------------------------------------------------------------------------
497 uno::Sequence
< uno::Any
> SAL_CALL
OStyle::getPropertyDefaults( const uno::Sequence
< ::rtl::OUString
>& aPropertyNames
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
499 uno::Sequence
< uno::Any
> aRet(aPropertyNames
.getLength());
500 const ::rtl::OUString
* pIter
= aPropertyNames
.getConstArray();
501 const ::rtl::OUString
* pEnd
= pIter
+ aPropertyNames
.getLength();
502 for(sal_Int32 i
= 0;pIter
!= pEnd
;++pIter
,++i
)
503 aRet
[i
] = getPropertyDefault(*pIter
);
508 class FactoryLoader
: public ::osl::Thread
510 ::rtl::OUString m_sMimeType
;
511 uno::Reference
< uno::XComponentContext
> m_xContext
;
513 FactoryLoader(const ::rtl::OUString
& _sMimeType
,uno::Reference
< uno::XComponentContext
> const & _xContext
)
514 :m_sMimeType(_sMimeType
)
515 ,m_xContext(_xContext
)
519 virtual ~FactoryLoader(){}
521 /// Working method which should be overridden.
522 virtual void SAL_CALL
run();
523 virtual void SAL_CALL
onTerminated();
526 void SAL_CALL
FactoryLoader::run()
530 uno::Reference
<frame::XComponentLoader
> xFrameLoad( m_xContext
->getServiceManager()->createInstanceWithContext(
531 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))
534 ::rtl::OUString
sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
535 sal_Int32 nFrameSearchFlag
= frame::FrameSearchFlag::TASKS
| frame::FrameSearchFlag::CREATE
;
536 uno::Reference
< frame::XFrame
> xFrame
= uno::Reference
< frame::XFrame
>(xFrameLoad
,uno::UNO_QUERY
)->findFrame(sTarget
,nFrameSearchFlag
);
537 xFrameLoad
.set( xFrame
,uno::UNO_QUERY
);
539 if ( xFrameLoad
.is() )
541 uno::Sequence
< beans::PropertyValue
> aArgs( 3);
543 aArgs
[nLen
].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate"));
544 aArgs
[nLen
++].Value
<<= sal_False
;
546 aArgs
[nLen
].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
547 aArgs
[nLen
++].Value
<<= sal_True
;
549 aArgs
[nLen
].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
550 aArgs
[nLen
++].Value
<<= sal_True
;
552 uno::Reference
< lang::XMultiServiceFactory
> xFac(m_xContext
->getServiceManager(),uno::UNO_QUERY
);
553 ::comphelper::MimeConfigurationHelper
aHelper(xFac
);
554 SvtModuleOptions aModuleOptions
;
555 uno::Reference
< frame::XModel
> xModel(xFrameLoad
->loadComponentFromURL(
556 aModuleOptions
.GetFactoryEmptyDocumentURL( aModuleOptions
.ClassifyFactoryByServiceName( aHelper
.GetDocServiceNameFromMediaType(m_sMimeType
) )),
557 ::rtl::OUString(), // empty frame name
561 ::comphelper::disposeComponent(xModel
);
564 catch(uno::Exception
& ex
)
570 void SAL_CALL
FactoryLoader::onTerminated()
575 // -----------------------------------------------------------------------------
576 struct OReportDefinitionImpl
578 uno::WeakReference
< uno::XInterface
> m_xParent
;
579 ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners
;
580 ::cppu::OInterfaceContainerHelper m_aCloseListener
;
581 ::cppu::OInterfaceContainerHelper m_aModifyListeners
;
582 ::cppu::OInterfaceContainerHelper m_aDocEventListeners
;
583 ::std::vector
< uno::Reference
< frame::XController
> > m_aControllers
;
584 uno::Sequence
< beans::PropertyValue
> m_aArgs
;
586 uno::Reference
< report::XGroups
> m_xGroups
;
587 uno::Reference
< report::XSection
> m_xReportHeader
;
588 uno::Reference
< report::XSection
> m_xReportFooter
;
589 uno::Reference
< report::XSection
> m_xPageHeader
;
590 uno::Reference
< report::XSection
> m_xPageFooter
;
591 uno::Reference
< report::XSection
> m_xDetail
;
592 uno::Reference
< embed::XStorage
> m_xStorage
;
593 uno::Reference
< frame::XController
> m_xCurrentController
;
594 uno::Reference
< container::XIndexAccess
> m_xViewData
;
595 uno::Reference
< container::XNameAccess
> m_xStyles
;
596 uno::Reference
< container::XNameAccess
> m_xXMLNamespaceMap
;
597 uno::Reference
< container::XNameAccess
> m_xGradientTable
;
598 uno::Reference
< container::XNameAccess
> m_xHatchTable
;
599 uno::Reference
< container::XNameAccess
> m_xBitmapTable
;
600 uno::Reference
< container::XNameAccess
> m_xTransparencyGradientTable
;
601 uno::Reference
< container::XNameAccess
> m_xDashTable
;
602 uno::Reference
< container::XNameAccess
> m_xMarkerTable
;
603 uno::Reference
< report::XFunctions
> m_xFunctions
;
604 uno::Reference
< ui::XUIConfigurationManager
> m_xUIConfigurationManager
;
605 uno::Reference
< util::XNumberFormatsSupplier
> m_xNumberFormatsSupplier
;
606 uno::Reference
< sdbc::XConnection
> m_xActiveConnection
;
607 uno::Reference
< frame::XTitle
> m_xTitleHelper
;
608 uno::Reference
< frame::XUntitledNumbers
> m_xNumberedControllers
;
609 uno::Reference
< document::XDocumentProperties
> m_xDocumentProperties
;
611 ::boost::shared_ptr
< ::comphelper::EmbeddedObjectContainer
>
613 ::boost::shared_ptr
<rptui::OReportModel
> m_pReportModel
;
614 ::rtl::OUString m_sCaption
;
615 ::rtl::OUString m_sCommand
;
616 ::rtl::OUString m_sFilter
;
617 ::rtl::OUString m_sMimeType
;
618 ::rtl::OUString m_sIdentifier
;
619 ::rtl::OUString m_sDataSourceName
;
620 awt::Size m_aVisualAreaSize
;
621 ::sal_Int64 m_nAspect
;
622 ::sal_Int16 m_nGroupKeepTogether
;
623 ::sal_Int16 m_nPageHeaderOption
;
624 ::sal_Int16 m_nPageFooterOption
;
625 ::sal_Int32 m_nCommandType
;
626 sal_Bool m_bControllersLocked
;
627 sal_Bool m_bModified
;
628 sal_Bool m_bEscapeProcessing
;
629 OReportDefinitionImpl(::osl::Mutex
& _aMutex
)
630 :m_aStorageChangeListeners(_aMutex
)
631 ,m_aCloseListener(_aMutex
)
632 ,m_aModifyListeners(_aMutex
)
633 ,m_aDocEventListeners(_aMutex
)
634 ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT
)
635 ,m_sIdentifier(SERVICE_REPORTDEFINITION
)
636 // default visual area is 8 x 7 cm
637 ,m_aVisualAreaSize( 8000, 7000 )
638 ,m_nAspect(embed::Aspects::MSOLE_CONTENT
)
639 ,m_nGroupKeepTogether(0)
640 ,m_nPageHeaderOption(0)
641 ,m_nPageFooterOption(0)
642 ,m_nCommandType(sdb::CommandType::TABLE
)
643 ,m_bControllersLocked(sal_False
)
644 ,m_bModified(sal_False
)
645 ,m_bEscapeProcessing(sal_True
)
648 OReportDefinitionImpl(::osl::Mutex
& _aMutex
,const OReportDefinitionImpl
& _aCopy
)
649 :m_aStorageChangeListeners(_aMutex
)
650 ,m_aCloseListener(_aMutex
)
651 ,m_aModifyListeners(_aMutex
)
652 ,m_aDocEventListeners(_aMutex
)
653 ,m_sMimeType(_aCopy
.m_sMimeType
)
654 ,m_sIdentifier(_aCopy
.m_sIdentifier
)
655 ,m_nGroupKeepTogether(_aCopy
.m_nGroupKeepTogether
)
656 ,m_nPageHeaderOption(_aCopy
.m_nPageHeaderOption
)
657 ,m_nPageFooterOption(_aCopy
.m_nPageFooterOption
)
658 ,m_nCommandType(_aCopy
.m_nCommandType
)
659 ,m_bControllersLocked(_aCopy
.m_bControllersLocked
)
660 ,m_bModified(_aCopy
.m_bModified
)
661 ,m_bEscapeProcessing(_aCopy
.m_bEscapeProcessing
)
663 ~OReportDefinitionImpl();
665 OReportDefinitionImpl::~OReportDefinitionImpl()
669 DBG_NAME( rpt_OReportDefinition
)
670 // -----------------------------------------------------------------------------
671 OReportDefinition::OReportDefinition(uno::Reference
< uno::XComponentContext
> const & _xContext
)
672 : ReportDefinitionBase(m_aMutex
)
673 ,ReportDefinitionPropertySet(_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< ::rtl::OUString
>())
674 ,m_aProps(new OReportComponentProperties(_xContext
))
675 ,m_pImpl(new OReportDefinitionImpl(m_aMutex
))
677 DBG_CTOR( rpt_OReportDefinition
,NULL
);
678 m_aProps
->m_sName
= RPT_RESSTRING(RID_STR_REPORT
,m_aProps
->m_xContext
->getServiceManager());
679 osl_incrementInterlockedCount(&m_refCount
);
682 m_pImpl
->m_xGroups
= new OGroups(this,m_aProps
->m_xContext
);
683 m_pImpl
->m_xDetail
= new OSection(this,m_aProps
->m_xContext
);
684 m_pImpl
->m_xDetail
->setName(RPT_RESSTRING(RID_STR_DETAIL
,m_aProps
->m_xContext
->getServiceManager()));
686 osl_decrementInterlockedCount( &m_refCount
);
688 // -----------------------------------------------------------------------------
689 OReportDefinition::OReportDefinition(uno::Reference
< uno::XComponentContext
> const & _xContext
690 ,const uno::Reference
< lang::XMultiServiceFactory
>& _xFactory
691 ,uno::Reference
< drawing::XShape
>& _xShape
)
692 : ReportDefinitionBase(m_aMutex
)
693 ,ReportDefinitionPropertySet(_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< ::rtl::OUString
>())
694 ,m_aProps(new OReportComponentProperties(_xContext
))
695 ,m_pImpl(new OReportDefinitionImpl(m_aMutex
))
697 m_aProps
->m_sName
= RPT_RESSTRING(RID_STR_REPORT
,m_aProps
->m_xContext
->getServiceManager());
698 m_aProps
->m_xFactory
= _xFactory
;
699 osl_incrementInterlockedCount(&m_refCount
);
701 m_aProps
->setShape(_xShape
,this,m_refCount
);
703 m_pImpl
->m_xGroups
= new OGroups(this,m_aProps
->m_xContext
);
704 m_pImpl
->m_xDetail
= new OSection(this,m_aProps
->m_xContext
);
705 m_pImpl
->m_xDetail
->setName(RPT_RESSTRING(RID_STR_DETAIL
,m_aProps
->m_xContext
->getServiceManager()));
707 osl_decrementInterlockedCount( &m_refCount
);
709 // -----------------------------------------------------------------------------
710 OReportDefinition::OReportDefinition(const OReportDefinition
& _rCopy
)
712 ,ReportDefinitionBase(m_aMutex
)
713 ,ReportDefinitionPropertySet(_rCopy
.m_aProps
->m_xContext
,static_cast< Implements
>(IMPLEMENTS_PROPERTY_SET
),uno::Sequence
< ::rtl::OUString
>())
714 ,comphelper::IEmbeddedHelper()
715 ,m_aProps(new OReportComponentProperties(*_rCopy
.m_aProps
))
716 ,m_pImpl(new OReportDefinitionImpl(m_aMutex
,*_rCopy
.m_pImpl
))
718 DBG_CTOR( rpt_OReportDefinition
,NULL
);
719 osl_incrementInterlockedCount(&m_refCount
);
722 OGroups
* pGroups
= new OGroups(this,m_aProps
->m_xContext
);
723 m_pImpl
->m_xGroups
= pGroups
;
724 pGroups
->copyGroups(_rCopy
.m_pImpl
->m_xGroups
);
725 m_pImpl
->m_xDetail
= new OSection(this,m_aProps
->m_xContext
);
726 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xDetail
,m_pImpl
->m_xDetail
);
728 setPageHeaderOn(_rCopy
.m_pImpl
->m_xPageHeader
.is());
729 setPageFooterOn(_rCopy
.m_pImpl
->m_xPageFooter
.is());
730 setReportHeaderOn(_rCopy
.m_pImpl
->m_xReportHeader
.is());
731 setReportFooterOn(_rCopy
.m_pImpl
->m_xReportFooter
.is());
732 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xPageHeader
,m_pImpl
->m_xPageHeader
);
733 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xPageFooter
,m_pImpl
->m_xPageFooter
);
734 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xReportHeader
,m_pImpl
->m_xReportHeader
);
735 OSection::lcl_copySection(_rCopy
.m_pImpl
->m_xReportFooter
,m_pImpl
->m_xReportFooter
);
737 osl_decrementInterlockedCount( &m_refCount
);
739 // -----------------------------------------------------------------------------
740 OReportDefinition::~OReportDefinition()
742 DBG_DTOR( rpt_OReportDefinition
,NULL
);
743 if ( !ReportDefinitionBase::rBHelper
.bInDispose
&& !ReportDefinitionBase::rBHelper
.bDisposed
)
749 // -----------------------------------------------------------------------------
750 IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition
, ReportDefinitionBase
)
751 //IMPLEMENT_FORWARD_XINTERFACE2(OReportDefinition,ReportDefinitionBase,ReportDefinitionPropertySet)
752 void OReportDefinition::init()
756 static bool s_bFirstTime
= sal_True
;
759 s_bFirstTime
= false;
760 const uno::Sequence
< ::rtl::OUString
> aMimeTypes
= getAvailableMimeTypes();
761 const ::rtl::OUString
* pIter
= aMimeTypes
.getConstArray();
762 const ::rtl::OUString
* pEnd
= pIter
+ aMimeTypes
.getLength();
763 for ( ; pIter
!= pEnd
; ++pIter
)
765 FactoryLoader
* pCreatorThread
= new FactoryLoader(*pIter
,m_aProps
->m_xContext
);
766 pCreatorThread
->createSuspended();
767 pCreatorThread
->setPriority(osl_Thread_PriorityBelowNormal
);
768 pCreatorThread
->resume();
769 } // for ( ; pIter != pEnd; ++pIter )
772 m_pImpl
->m_pReportModel
.reset(new OReportModel(this));
773 m_pImpl
->m_pReportModel
->GetItemPool().FreezeIdRanges();
774 m_pImpl
->m_pReportModel
->SetScaleUnit( MAP_100TH_MM
);
775 SdrLayerAdmin
& rAdmin
= m_pImpl
->m_pReportModel
->GetLayerAdmin();
776 rAdmin
.NewStandardLayer(RPT_LAYER_FRONT
);
777 rAdmin
.NewLayer(UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "back" ) ), RPT_LAYER_BACK
);
778 rAdmin
.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ), RPT_LAYER_HIDDEN
);
780 m_pImpl
->m_xFunctions
= new OFunctions(this,m_aProps
->m_xContext
);
781 if ( !m_pImpl
->m_xStorage
.is() )
782 m_pImpl
->m_xStorage
= ::comphelper::OStorageHelper::GetTemporaryStorage();
784 uno::Reference
<beans::XPropertySet
> xStorProps(m_pImpl
->m_xStorage
,uno::UNO_QUERY
);
785 if ( xStorProps
.is())
787 ::rtl::OUString sMediaType
;
788 xStorProps
->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType"))) >>= sMediaType
;
789 if ( !sMediaType
.getLength() )
790 xStorProps
->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT
));
792 m_pImpl
->m_pObjectContainer
.reset( new comphelper::EmbeddedObjectContainer(m_pImpl
->m_xStorage
, static_cast<cppu::OWeakObject
*>(this) ) );
794 catch(uno::Exception
)
796 OSL_ENSURE(0,"Error!");
799 // -----------------------------------------------------------------------------
800 void SAL_CALL
OReportDefinition::dispose() throw(uno::RuntimeException
)
802 ReportDefinitionPropertySet::dispose();
803 cppu::WeakComponentImplHelperBase::dispose();
805 // -----------------------------------------------------------------------------
806 void SAL_CALL
OReportDefinition::disposing()
808 m_pImpl
->m_aControllers
.clear();
809 uno::Reference
< frame::XModel
> xHoldAlive( this );
811 notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnUnload")));
813 lang::EventObject
aDisposeEvent( static_cast< ::cppu::OWeakObject
* >( this ) );
814 m_pImpl
->m_aModifyListeners
.disposeAndClear( aDisposeEvent
);
815 m_pImpl
->m_aCloseListener
.disposeAndClear( aDisposeEvent
);
816 m_pImpl
->m_aDocEventListeners
.disposeAndClear( aDisposeEvent
);
817 m_pImpl
->m_aStorageChangeListeners
.disposeAndClear( aDisposeEvent
);
819 ::comphelper::disposeComponent(m_pImpl
->m_xGroups
);
820 m_pImpl
->m_xReportHeader
.clear();
821 m_pImpl
->m_xReportFooter
.clear();
822 m_pImpl
->m_xPageHeader
.clear();
823 m_pImpl
->m_xPageFooter
.clear();
824 m_pImpl
->m_xDetail
.clear();
825 //::comphelper::disposeComponent(m_pImpl->m_xReportHeader);
826 //::comphelper::disposeComponent(m_pImpl->m_xReportFooter);
827 //::comphelper::disposeComponent(m_pImpl->m_xPageHeader);
828 //::comphelper::disposeComponent(m_pImpl->m_xPageFooter);
829 //::comphelper::disposeComponent(m_pImpl->m_xDetail);
830 ::comphelper::disposeComponent(m_pImpl
->m_xFunctions
);
832 //::comphelper::disposeComponent(m_pImpl->m_xStorage);
833 // don't dispose, this currently is the task of either the ref count going to
834 // 0, or of the embedded object (if we're embedded, which is the only possible
836 // #i78366# / 2007-06-18 / frank.schoenheit@sun.com
837 m_pImpl
->m_xStorage
.clear();
838 m_pImpl
->m_xViewData
.clear();
839 m_pImpl
->m_xCurrentController
.clear();
840 m_pImpl
->m_xNumberFormatsSupplier
.clear();
841 m_pImpl
->m_xStyles
.clear();
842 m_pImpl
->m_xXMLNamespaceMap
.clear();
843 m_pImpl
->m_xGradientTable
.clear();
844 m_pImpl
->m_xHatchTable
.clear();
845 m_pImpl
->m_xBitmapTable
.clear();
846 m_pImpl
->m_xTransparencyGradientTable
.clear();
847 m_pImpl
->m_xDashTable
.clear();
848 m_pImpl
->m_xMarkerTable
.clear();
849 m_pImpl
->m_xUIConfigurationManager
.clear();
850 m_pImpl
->m_pReportModel
.reset();
851 m_pImpl
->m_pObjectContainer
.reset();
852 m_pImpl
->m_aArgs
.realloc(0);
853 m_pImpl
->m_xTitleHelper
.clear();
854 m_pImpl
->m_xNumberedControllers
.clear();
857 // -----------------------------------------------------------------------------
858 ::rtl::OUString
OReportDefinition::getImplementationName_Static( ) throw(uno::RuntimeException
)
860 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportDefinition"));
863 //--------------------------------------------------------------------------
864 ::rtl::OUString SAL_CALL
OReportDefinition::getImplementationName( ) throw(uno::RuntimeException
)
866 return getImplementationName_Static();
868 //--------------------------------------------------------------------------
869 uno::Sequence
< ::rtl::OUString
> OReportDefinition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException
)
871 uno::Sequence
< ::rtl::OUString
> aServices(1);
872 aServices
.getArray()[0] = SERVICE_REPORTDEFINITION
;
876 // --------------------------------------------------------------------------------
877 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getSupportedServiceNames( ) throw(uno::RuntimeException
)
879 // first collect the services which are supported by our aggregate
880 uno::Sequence
< ::rtl::OUString
> aSupported
;
881 if ( m_aProps
->m_xServiceInfo
.is() )
882 aSupported
= m_aProps
->m_xServiceInfo
->getSupportedServiceNames();
884 // append our own service, if necessary
885 if ( 0 == ::comphelper::findValue( aSupported
, SERVICE_REPORTDEFINITION
, sal_True
).getLength() )
887 sal_Int32 nLen
= aSupported
.getLength();
888 aSupported
.realloc( nLen
+ 1 );
889 aSupported
[ nLen
] = SERVICE_REPORTDEFINITION
;
896 // --------------------------------------------------------------------------------
897 sal_Bool SAL_CALL
OReportDefinition::supportsService( const ::rtl::OUString
& _rServiceName
) throw(uno::RuntimeException
)
899 return ::comphelper::findValue( getSupportedServiceNames(), _rServiceName
, sal_True
).getLength() != 0;
902 // --------------------------------------------------------------------------------
903 uno::Any SAL_CALL
OReportDefinition::queryInterface( const uno::Type
& _rType
) throw (uno::RuntimeException
)
905 uno::Any aReturn
= ReportDefinitionBase::queryInterface(_rType
);
906 if ( !aReturn
.hasValue() )
907 aReturn
= ReportDefinitionPropertySet::queryInterface(_rType
);
909 return aReturn
.hasValue() ? aReturn
: (m_aProps
->m_xProxy
.is() ? m_aProps
->m_xProxy
->queryAggregation(_rType
) : aReturn
);
911 // --------------------------------------------------------------------------------
912 uno::Sequence
< uno::Type
> SAL_CALL
OReportDefinition::getTypes( ) throw (uno::RuntimeException
)
914 if ( m_aProps
->m_xTypeProvider
.is() )
915 return ::comphelper::concatSequences(
916 ReportDefinitionBase::getTypes(),
917 m_aProps
->m_xTypeProvider
->getTypes()
919 return ReportDefinitionBase::getTypes();
921 //------------------------------------------------------------------------------
922 uno::Reference
< uno::XInterface
> OReportDefinition::create(uno::Reference
< uno::XComponentContext
> const & xContext
)
924 return *(new OReportDefinition(xContext
));
927 // -----------------------------------------------------------------------------
929 ::rtl::OUString SAL_CALL
OReportDefinition::getCaption() throw (uno::RuntimeException
)
931 ::osl::MutexGuard
aGuard(m_aMutex
);
932 return m_pImpl
->m_sCaption
;
934 // -----------------------------------------------------------------------------
935 void SAL_CALL
OReportDefinition::setCaption( const ::rtl::OUString
& _caption
) throw (uno::RuntimeException
)
937 set(PROPERTY_CAPTION
,_caption
,m_pImpl
->m_sCaption
);
939 // -----------------------------------------------------------------------------
940 ::sal_Int16 SAL_CALL
OReportDefinition::getGroupKeepTogether() throw (uno::RuntimeException
)
942 ::osl::MutexGuard
aGuard(m_aMutex
);
943 return m_pImpl
->m_nGroupKeepTogether
;
945 // -----------------------------------------------------------------------------
946 void SAL_CALL
OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether
) throw (uno::RuntimeException
)
948 if ( _groupkeeptogether
< report::GroupKeepTogether::PER_PAGE
|| _groupkeeptogether
> report::GroupKeepTogether::PER_COLUMN
)
949 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::GroupKeepTogether"))
952 ,m_aProps
->m_xContext
);
953 set(PROPERTY_GROUPKEEPTOGETHER
,_groupkeeptogether
,m_pImpl
->m_nGroupKeepTogether
);
955 // -----------------------------------------------------------------------------
956 ::sal_Int16 SAL_CALL
OReportDefinition::getPageHeaderOption() throw (uno::RuntimeException
)
958 ::osl::MutexGuard
aGuard(m_aMutex
);
959 return m_pImpl
->m_nPageHeaderOption
;
961 // -----------------------------------------------------------------------------
962 void SAL_CALL
OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption
) throw (uno::RuntimeException
)
964 if ( _pageheaderoption
< report::ReportPrintOption::ALL_PAGES
|| _pageheaderoption
> report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER
)
965 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption"))
968 ,m_aProps
->m_xContext
);
969 set(PROPERTY_PAGEHEADEROPTION
,_pageheaderoption
,m_pImpl
->m_nPageHeaderOption
);
971 // -----------------------------------------------------------------------------
972 ::sal_Int16 SAL_CALL
OReportDefinition::getPageFooterOption() throw (uno::RuntimeException
)
974 ::osl::MutexGuard
aGuard(m_aMutex
);
975 return m_pImpl
->m_nPageFooterOption
;
977 // -----------------------------------------------------------------------------
978 void SAL_CALL
OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption
) throw (uno::RuntimeException
)
980 if ( _pagefooteroption
< report::ReportPrintOption::ALL_PAGES
|| _pagefooteroption
> report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER
)
981 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption"))
984 ,m_aProps
->m_xContext
);
985 set(PROPERTY_PAGEFOOTEROPTION
,_pagefooteroption
,m_pImpl
->m_nPageFooterOption
);
987 // -----------------------------------------------------------------------------
988 ::rtl::OUString SAL_CALL
OReportDefinition::getCommand() throw (uno::RuntimeException
)
990 ::osl::MutexGuard
aGuard(m_aMutex
);
991 return m_pImpl
->m_sCommand
;
993 // -----------------------------------------------------------------------------
994 void SAL_CALL
OReportDefinition::setCommand( const ::rtl::OUString
& _command
) throw (uno::RuntimeException
)
996 set(PROPERTY_COMMAND
,_command
,m_pImpl
->m_sCommand
);
998 // -----------------------------------------------------------------------------
999 ::sal_Int32 SAL_CALL
OReportDefinition::getCommandType() throw (uno::RuntimeException
)
1001 ::osl::MutexGuard
aGuard(m_aMutex
);
1002 return m_pImpl
->m_nCommandType
;
1004 // -----------------------------------------------------------------------------
1005 void SAL_CALL
OReportDefinition::setCommandType( ::sal_Int32 _commandtype
) throw (uno::RuntimeException
)
1007 if ( _commandtype
< sdb::CommandType::TABLE
|| _commandtype
> sdb::CommandType::COMMAND
)
1008 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::sdb::CommandType"))
1011 ,m_aProps
->m_xContext
);
1012 set(PROPERTY_COMMANDTYPE
,_commandtype
,m_pImpl
->m_nCommandType
);
1014 // -----------------------------------------------------------------------------
1015 ::rtl::OUString SAL_CALL
OReportDefinition::getFilter() throw (uno::RuntimeException
)
1017 ::osl::MutexGuard
aGuard(m_aMutex
);
1018 return m_pImpl
->m_sFilter
;
1020 // -----------------------------------------------------------------------------
1021 void SAL_CALL
OReportDefinition::setFilter( const ::rtl::OUString
& _filter
) throw (uno::RuntimeException
)
1023 set(PROPERTY_FILTER
,_filter
,m_pImpl
->m_sFilter
);
1025 // -----------------------------------------------------------------------------
1026 ::sal_Bool SAL_CALL
OReportDefinition::getEscapeProcessing() throw (uno::RuntimeException
)
1028 ::osl::MutexGuard
aGuard(m_aMutex
);
1029 return m_pImpl
->m_bEscapeProcessing
;
1031 // -----------------------------------------------------------------------------
1032 void SAL_CALL
OReportDefinition::setEscapeProcessing( ::sal_Bool _escapeprocessing
) throw (uno::RuntimeException
)
1034 set(PROPERTY_ESCAPEPROCESSING
,_escapeprocessing
,m_pImpl
->m_bEscapeProcessing
);
1036 // -----------------------------------------------------------------------------
1037 ::sal_Bool SAL_CALL
OReportDefinition::getReportHeaderOn() throw (uno::RuntimeException
)
1039 ::osl::MutexGuard
aGuard(m_aMutex
);
1040 return m_pImpl
->m_xReportHeader
.is();
1042 // -----------------------------------------------------------------------------
1043 void SAL_CALL
OReportDefinition::setReportHeaderOn( ::sal_Bool _reportheaderon
) throw (uno::RuntimeException
)
1045 if ( _reportheaderon
!= m_pImpl
->m_xReportHeader
.is() )
1047 setSection(PROPERTY_REPORTHEADERON
,_reportheaderon
,RPT_RESSTRING(RID_STR_REPORT_HEADER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xReportHeader
);
1050 // -----------------------------------------------------------------------------
1051 ::sal_Bool SAL_CALL
OReportDefinition::getReportFooterOn() throw (uno::RuntimeException
)
1053 ::osl::MutexGuard
aGuard(m_aMutex
);
1054 return m_pImpl
->m_xReportFooter
.is();
1056 // -----------------------------------------------------------------------------
1057 void SAL_CALL
OReportDefinition::setReportFooterOn( ::sal_Bool _reportfooteron
) throw (uno::RuntimeException
)
1059 if ( _reportfooteron
!= m_pImpl
->m_xReportFooter
.is() )
1061 setSection(PROPERTY_REPORTFOOTERON
,_reportfooteron
,RPT_RESSTRING(RID_STR_REPORT_FOOTER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xReportFooter
);
1064 // -----------------------------------------------------------------------------
1065 ::sal_Bool SAL_CALL
OReportDefinition::getPageHeaderOn() throw (uno::RuntimeException
)
1067 ::osl::MutexGuard
aGuard(m_aMutex
);
1068 return m_pImpl
->m_xPageHeader
.is();
1070 // -----------------------------------------------------------------------------
1071 void SAL_CALL
OReportDefinition::setPageHeaderOn( ::sal_Bool _pageheaderon
) throw (uno::RuntimeException
)
1073 if ( _pageheaderon
!= m_pImpl
->m_xPageHeader
.is() )
1075 setSection(PROPERTY_PAGEHEADERON
,_pageheaderon
,RPT_RESSTRING(RID_STR_PAGE_HEADER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xPageHeader
);
1078 // -----------------------------------------------------------------------------
1079 ::sal_Bool SAL_CALL
OReportDefinition::getPageFooterOn() throw (uno::RuntimeException
)
1081 ::osl::MutexGuard
aGuard(m_aMutex
);
1082 return m_pImpl
->m_xPageFooter
.is();
1084 // -----------------------------------------------------------------------------
1085 void SAL_CALL
OReportDefinition::setPageFooterOn( ::sal_Bool _pagefooteron
) throw (uno::RuntimeException
)
1087 if ( _pagefooteron
!= m_pImpl
->m_xPageFooter
.is() )
1089 setSection(PROPERTY_PAGEFOOTERON
,_pagefooteron
,RPT_RESSTRING(RID_STR_PAGE_FOOTER
,m_aProps
->m_xContext
->getServiceManager()),m_pImpl
->m_xPageFooter
);
1092 // -----------------------------------------------------------------------------
1093 uno::Reference
< report::XGroups
> SAL_CALL
OReportDefinition::getGroups() throw (uno::RuntimeException
)
1095 ::osl::MutexGuard
aGuard(m_aMutex
);
1096 return m_pImpl
->m_xGroups
;
1098 // -----------------------------------------------------------------------------
1099 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getReportHeader() throw (container::NoSuchElementException
, uno::RuntimeException
)
1101 ::osl::MutexGuard
aGuard(m_aMutex
);
1102 if ( !m_pImpl
->m_xReportHeader
.is() )
1103 throw container::NoSuchElementException();
1104 return m_pImpl
->m_xReportHeader
;
1106 // -----------------------------------------------------------------------------
1107 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getPageHeader() throw (container::NoSuchElementException
, uno::RuntimeException
)
1109 ::osl::MutexGuard
aGuard(m_aMutex
);
1110 if ( !m_pImpl
->m_xPageHeader
.is() )
1111 throw container::NoSuchElementException();
1112 return m_pImpl
->m_xPageHeader
;
1114 // -----------------------------------------------------------------------------
1115 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getDetail() throw (uno::RuntimeException
)
1117 ::osl::MutexGuard
aGuard(m_aMutex
);
1118 return m_pImpl
->m_xDetail
;
1120 // -----------------------------------------------------------------------------
1121 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getPageFooter() throw (container::NoSuchElementException
, uno::RuntimeException
)
1123 ::osl::MutexGuard
aGuard(m_aMutex
);
1124 if ( !m_pImpl
->m_xPageFooter
.is() )
1125 throw container::NoSuchElementException();
1126 return m_pImpl
->m_xPageFooter
;
1128 // -----------------------------------------------------------------------------
1129 uno::Reference
< report::XSection
> SAL_CALL
OReportDefinition::getReportFooter() throw (container::NoSuchElementException
, uno::RuntimeException
)
1131 ::osl::MutexGuard
aGuard(m_aMutex
);
1132 if ( !m_pImpl
->m_xReportFooter
.is() )
1133 throw container::NoSuchElementException();
1134 return m_pImpl
->m_xReportFooter
;
1136 //------------------------------------------------------------------------------
1137 uno::Reference
< document::XEventBroadcaster
> SAL_CALL
OReportDefinition::getEventBroadcaster( ) throw (lang::DisposedException
, uno::Exception
, uno::RuntimeException
)
1139 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1142 //------------------------------------------------------------------------------
1144 REPORTCOMPONENT_MASTERDETAIL(OReportDefinition
,*m_aProps
)
1145 REPORTCOMPONENT_IMPL(OReportDefinition
,*m_aProps
)
1146 REPORTCOMPONENT_IMPL2(OReportDefinition
,*m_aProps
)
1148 // -----------------------------------------------------------------------------
1149 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
OReportDefinition::getPropertySetInfo( ) throw(uno::RuntimeException
)
1151 return ReportDefinitionPropertySet::getPropertySetInfo();
1153 // -----------------------------------------------------------------------------
1154 void SAL_CALL
OReportDefinition::setPropertyValue( const ::rtl::OUString
& aPropertyName
, const uno::Any
& aValue
) throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1156 ReportDefinitionPropertySet::setPropertyValue( aPropertyName
, aValue
);
1158 // -----------------------------------------------------------------------------
1159 uno::Any SAL_CALL
OReportDefinition::getPropertyValue( const ::rtl::OUString
& PropertyName
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1161 return ReportDefinitionPropertySet::getPropertyValue( PropertyName
);
1163 // -----------------------------------------------------------------------------
1164 void SAL_CALL
OReportDefinition::addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& xListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1166 ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName
, xListener
);
1168 // -----------------------------------------------------------------------------
1169 void SAL_CALL
OReportDefinition::removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1171 ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName
, aListener
);
1173 // -----------------------------------------------------------------------------
1174 void SAL_CALL
OReportDefinition::addVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1176 ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName
, aListener
);
1178 // -----------------------------------------------------------------------------
1179 void SAL_CALL
OReportDefinition::removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
, const uno::Reference
< beans::XVetoableChangeListener
>& aListener
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1181 ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName
, aListener
);
1183 // -----------------------------------------------------------------------------
1185 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::getParent( ) throw (uno::RuntimeException
)
1187 ::osl::MutexGuard
aGuard(m_aMutex
);
1188 uno::Reference
< container::XChild
> xChild
;
1189 comphelper::query_aggregation(m_aProps
->m_xProxy
,xChild
);
1191 return xChild
->getParent();
1192 return m_pImpl
->m_xParent
;
1194 // -----------------------------------------------------------------------------
1195 void SAL_CALL
OReportDefinition::setParent( const uno::Reference
< uno::XInterface
>& Parent
) throw (lang::NoSupportException
, uno::RuntimeException
)
1197 ::osl::MutexGuard
aGuard(m_aMutex
);
1198 m_aProps
->m_xParent
= uno::Reference
< container::XChild
>(Parent
,uno::UNO_QUERY
);
1199 m_pImpl
->m_xParent
= Parent
;
1200 uno::Reference
< container::XChild
> xChild
;
1201 comphelper::query_aggregation(m_aProps
->m_xProxy
,xChild
);
1203 xChild
->setParent(Parent
);
1205 // -----------------------------------------------------------------------------
1207 uno::Reference
< util::XCloneable
> SAL_CALL
OReportDefinition::createClone( ) throw (uno::RuntimeException
)
1209 OSL_ENSURE(0,"Not yet implemented correctly");
1210 uno::Reference
< report::XReportComponent
> xSource
= this;
1211 uno::Reference
< report::XReportDefinition
> xSet(cloneObject(xSource
,m_aProps
->m_xFactory
,SERVICE_REPORTDEFINITION
),uno::UNO_QUERY_THROW
);
1214 // -----------------------------------------------------------------------------
1215 void OReportDefinition::setSection( const ::rtl::OUString
& _sProperty
1216 ,const sal_Bool
& _bOn
1217 ,const ::rtl::OUString
& _sName
1218 ,uno::Reference
< report::XSection
>& _member
)
1222 ::osl::MutexGuard
aGuard(m_aMutex
);
1223 prepareSet(_sProperty
, uno::makeAny(_member
), uno::makeAny(_bOn
), &l
);
1224 lcl_createSectionIfNeeded(_bOn
,this,_member
,_sProperty
== PROPERTY_PAGEHEADERON
|| _sProperty
== PROPERTY_PAGEFOOTERON
);
1226 _member
->setName(_sName
);
1230 // -----------------------------------------------------------------------------
1231 // XCloseBroadcaster
1232 void SAL_CALL
OReportDefinition::addCloseListener( const uno::Reference
< util::XCloseListener
>& _xListener
) throw (uno::RuntimeException
)
1234 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1235 if ( _xListener
.is() )
1236 m_pImpl
->m_aCloseListener
.addInterface(_xListener
);
1238 // -----------------------------------------------------------------------------
1239 void SAL_CALL
OReportDefinition::removeCloseListener( const uno::Reference
< util::XCloseListener
>& _xListener
) throw (uno::RuntimeException
)
1241 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1242 m_pImpl
->m_aCloseListener
.removeInterface(_xListener
);
1244 // -----------------------------------------------------------------------------
1246 void SAL_CALL
OReportDefinition::close( ::sal_Bool _bDeliverOwnership
) throw (util::CloseVetoException
, uno::RuntimeException
)
1248 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
1250 ::osl::ResettableMutexGuard
aGuard(m_aMutex
);
1251 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1252 // notify our container listeners
1253 lang::EventObject
aEvt( static_cast< ::cppu::OWeakObject
* >( this ) );
1255 m_pImpl
->m_aCloseListener
.forEach
<util::XCloseListener
>(
1256 ::boost::bind(&util::XCloseListener::queryClosing
,_1
,boost::cref(aEvt
),boost::cref(_bDeliverOwnership
)));
1260 ::std::vector
< uno::Reference
< frame::XController
> > aCopy
= m_pImpl
->m_aControllers
;
1261 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aIter
= aCopy
.begin();
1262 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aEnd
= aCopy
.end();
1263 for (;aIter
!= aEnd
; ++aIter
)
1269 uno::Reference
< util::XCloseable
> xFrame( (*aIter
)->getFrame(), uno::UNO_QUERY
);
1271 xFrame
->close( _bDeliverOwnership
);
1273 catch( const util::CloseVetoException
& ) { throw; }
1274 catch( const uno::Exception
& )
1276 OSL_ENSURE( sal_False
, "ODatabaseDocument::impl_closeControllerFrames: caught an unexpected exception!" );
1282 m_pImpl
->m_aCloseListener
.notifyEach(&util::XCloseListener::notifyClosing
,aEvt
);
1287 // -----------------------------------------------------------------------------
1289 ::sal_Bool SAL_CALL
OReportDefinition::attachResource( const ::rtl::OUString
& /*_rURL*/, const uno::Sequence
< beans::PropertyValue
>& _aArguments
) throw (uno::RuntimeException
)
1291 // LLA: we had a deadlock problem in our context, so we get the SolarMutex earlier.
1292 ::vos::OClearableGuard
aSolarGuard( Application::GetSolarMutex() );
1294 ::osl::MutexGuard
aGuard(m_aMutex
);
1295 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1296 ::comphelper::MediaDescriptor
aDescriptor( _aArguments
);
1297 fillArgs(aDescriptor
);
1300 // -----------------------------------------------------------------------------
1301 void OReportDefinition::fillArgs(::comphelper::MediaDescriptor
& _aDescriptor
)
1303 uno::Sequence
<beans::PropertyValue
> aComponentData
;
1304 aComponentData
= _aDescriptor
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComponentData")),aComponentData
);
1305 if ( aComponentData
.getLength() && (!m_pImpl
->m_xActiveConnection
.is() || !m_pImpl
->m_xNumberFormatsSupplier
.is()) )
1307 ::comphelper::SequenceAsHashMap
aComponentDataMap( aComponentData
);
1308 m_pImpl
->m_xActiveConnection
= aComponentDataMap
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),m_pImpl
->m_xActiveConnection
);
1309 m_pImpl
->m_xNumberFormatsSupplier
= dbtools::getNumberFormats(m_pImpl
->m_xActiveConnection
);
1311 if ( !m_pImpl
->m_xNumberFormatsSupplier
.is() )
1313 m_pImpl
->m_xNumberFormatsSupplier
.set(
1314 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
1315 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier")) ,m_aProps
->m_xContext
),
1316 uno::UNO_QUERY_THROW
1319 lcl_stripLoadArguments( _aDescriptor
, m_pImpl
->m_aArgs
);
1320 ::rtl::OUString sCaption
;
1321 sCaption
= _aDescriptor
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")),sCaption
);
1322 setCaption(sCaption
);
1324 // -----------------------------------------------------------------------------
1325 ::rtl::OUString SAL_CALL
OReportDefinition::getURL( ) throw (uno::RuntimeException
)
1327 return ::rtl::OUString();
1329 // -----------------------------------------------------------------------------
1330 uno::Sequence
< beans::PropertyValue
> SAL_CALL
OReportDefinition::getArgs( ) throw (uno::RuntimeException
)
1332 ::osl::MutexGuard
aGuard(m_aMutex
);
1333 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1334 return m_pImpl
->m_aArgs
;
1336 // -----------------------------------------------------------------------------
1337 void SAL_CALL
OReportDefinition::connectController( const uno::Reference
< frame::XController
>& _xController
) throw (uno::RuntimeException
)
1339 ::osl::MutexGuard
aGuard(m_aMutex
);
1340 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1341 m_pImpl
->m_aControllers
.push_back(_xController
);
1343 if ( _xController
.is() && m_pImpl
->m_xViewData
.is() && ( nCount
= m_pImpl
->m_xViewData
->getCount()) != 0)
1345 _xController
->restoreViewData(m_pImpl
->m_xViewData
->getByIndex(nCount
- 1));
1348 // -----------------------------------------------------------------------------
1349 void SAL_CALL
OReportDefinition::disconnectController( const uno::Reference
< frame::XController
>& _xController
) throw (uno::RuntimeException
)
1351 ::osl::MutexGuard
aGuard(m_aMutex
);
1352 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1353 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aFind
= ::std::find(m_pImpl
->m_aControllers
.begin(),m_pImpl
->m_aControllers
.end(),_xController
);
1354 if ( aFind
!= m_pImpl
->m_aControllers
.end() )
1355 m_pImpl
->m_aControllers
.erase(aFind
);
1356 if ( m_pImpl
->m_xCurrentController
== _xController
)
1357 m_pImpl
->m_xCurrentController
.clear();
1359 // -----------------------------------------------------------------------------
1360 void SAL_CALL
OReportDefinition::lockControllers( ) throw (uno::RuntimeException
)
1362 ::osl::MutexGuard
aGuard(m_aMutex
);
1363 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1364 m_pImpl
->m_bControllersLocked
= sal_True
;
1366 // -----------------------------------------------------------------------------
1367 void SAL_CALL
OReportDefinition::unlockControllers( ) throw (uno::RuntimeException
)
1369 ::osl::MutexGuard
aGuard(m_aMutex
);
1370 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1371 m_pImpl
->m_bControllersLocked
= sal_False
;
1373 // -----------------------------------------------------------------------------
1374 ::sal_Bool SAL_CALL
OReportDefinition::hasControllersLocked( ) throw (uno::RuntimeException
)
1376 ::osl::MutexGuard
aGuard(m_aMutex
);
1377 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1378 return m_pImpl
->m_bControllersLocked
;
1380 // -----------------------------------------------------------------------------
1381 uno::Reference
< frame::XController
> SAL_CALL
OReportDefinition::getCurrentController( ) throw (uno::RuntimeException
)
1383 ::osl::MutexGuard
aGuard(m_aMutex
);
1384 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1385 return m_pImpl
->m_xCurrentController
;
1387 // -----------------------------------------------------------------------------
1388 void SAL_CALL
OReportDefinition::setCurrentController( const uno::Reference
< frame::XController
>& _xController
) throw (container::NoSuchElementException
, uno::RuntimeException
)
1390 ::osl::MutexGuard
aGuard(m_aMutex
);
1391 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1392 if ( ::std::find(m_pImpl
->m_aControllers
.begin(),m_pImpl
->m_aControllers
.end(),_xController
) == m_pImpl
->m_aControllers
.end() )
1393 throw container::NoSuchElementException();
1394 m_pImpl
->m_xCurrentController
= _xController
;
1396 // -----------------------------------------------------------------------------
1397 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::getCurrentSelection( ) throw (uno::RuntimeException
)
1399 return uno::Reference
< uno::XInterface
>();
1401 // -----------------------------------------------------------------------------
1403 void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference
< embed::XStorage
>& _xStorageToLoadFrom
,
1404 const uno::Sequence
< beans::PropertyValue
>& _aMediaDescriptor
)
1406 // ::osl::MutexGuard aGuard(m_aMutex);
1407 // ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
1410 m_pImpl
->m_xStorage
= _xStorageToLoadFrom
;
1412 ::comphelper::MediaDescriptor
aDescriptor( _aMediaDescriptor
);
1413 fillArgs(aDescriptor
);
1414 aDescriptor
.createItemIfMissing(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(_xStorageToLoadFrom
));
1416 uno::Sequence
< uno::Any
> aDelegatorArguments(_aMediaDescriptor
.getLength());
1417 uno::Any
* pIter
= aDelegatorArguments
.getArray();
1418 uno::Any
* pEnd
= pIter
+ aDelegatorArguments
.getLength();
1419 for(sal_Int32 i
= 0;pIter
!= pEnd
;++pIter
,++i
)
1421 *pIter
<<= _aMediaDescriptor
[i
];
1423 sal_Int32 nPos
= aDelegatorArguments
.getLength();
1424 aDelegatorArguments
.realloc(nPos
+1);
1425 beans::PropertyValue aPropVal
;
1426 aPropVal
.Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage"));
1427 aPropVal
.Value
<<= _xStorageToLoadFrom
;
1428 aDelegatorArguments
[nPos
] <<= aPropVal
;
1430 rptui::OXUndoEnvironment
& rEnv
= m_pImpl
->m_pReportModel
->GetUndoEnv();
1431 rptui::OXUndoEnvironment::OUndoEnvLock
aLock(rEnv
);
1433 uno::Reference
< document::XFilter
> xFilter(
1434 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportFilter")),aDelegatorArguments
,m_aProps
->m_xContext
),
1435 uno::UNO_QUERY_THROW
);
1437 uno::Reference
< document::XImporter
> xImporter(xFilter
,uno::UNO_QUERY_THROW
);
1438 uno::Reference
<XComponent
> xComponent(static_cast<OWeakObject
*>(this),uno::UNO_QUERY
);
1439 xImporter
->setTargetDocument(xComponent
);
1441 ::comphelper::MediaDescriptor aTemp
;
1442 aTemp
<< aDelegatorArguments
;
1443 xFilter
->filter(aTemp
.getAsConstPropertyValueList());
1445 lcl_setModelReadOnly(m_pImpl
->m_xStorage
,m_pImpl
->m_pReportModel
);
1446 m_pImpl
->m_pObjectContainer
->SwitchPersistence(m_pImpl
->m_xStorage
);
1449 // XStorageBasedDocument
1450 // -----------------------------------------------------------------------------
1451 void SAL_CALL
OReportDefinition::loadFromStorage( const uno::Reference
< embed::XStorage
>& _xStorageToLoadFrom
1452 , const uno::Sequence
< beans::PropertyValue
>& _aMediaDescriptor
) throw (lang::IllegalArgumentException
, frame::DoubleInitializationException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1454 ::osl::MutexGuard
aGuard(m_aMutex
);
1455 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1457 impl_loadFromStorage_nolck_throw( _xStorageToLoadFrom
, _aMediaDescriptor
);
1460 // -----------------------------------------------------------------------------
1461 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
)
1463 if ( !_xStorageToSaveTo
.is() )
1464 throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL
,m_aProps
->m_xContext
->getServiceManager()),*this,1);
1466 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
1467 ::osl::MutexGuard
aGuard(m_aMutex
);
1468 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1469 // create XStatusIndicator
1470 uno::Reference
<task::XStatusIndicator
> xStatusIndicator
;
1471 uno::Sequence
< uno::Any
> aDelegatorArguments
;
1472 ::comphelper::MediaDescriptor
aDescriptor( _aMediaDescriptor
);
1473 lcl_extractAndStartStatusIndicator( aDescriptor
, xStatusIndicator
, aDelegatorArguments
);
1476 uno::Sequence
< beans::PropertyValue
> aProps
;
1478 // export sub streams for package, else full stream into a file
1479 sal_Bool bWarn
= sal_False
, bErr
= sal_False
;
1480 ::rtl::OUString sWarnFile
, sErrFile
;
1482 uno::Reference
< beans::XPropertySet
> xProp(_xStorageToSaveTo
,uno::UNO_QUERY
);
1485 static const ::rtl::OUString
sPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
1486 ::rtl::OUString sOldMediaType
;
1487 xProp
->getPropertyValue(sPropName
) >>= sOldMediaType
;
1488 if ( !xProp
->getPropertyValue(sPropName
).hasValue() || !sOldMediaType
.getLength() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT
!= sOldMediaType
)
1489 xProp
->setPropertyValue( sPropName
, uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT
) );
1492 /** property map for export info set */
1493 comphelper::PropertyMapEntry aExportInfoMap
[] =
1495 { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool
*)0), beans::PropertyAttribute::MAYBEVOID
, 0 },
1496 { MAP_LEN( "StreamName") , 0,&::getCppuType( (::rtl::OUString
*)0 ), beans::PropertyAttribute::MAYBEVOID
, 0 },
1497 { MAP_LEN( "StreamRelPath") , 0,&::getCppuType( (::rtl::OUString
*)0 ), beans::PropertyAttribute::MAYBEVOID
, 0 },
1498 { MAP_LEN( "BaseURI") , 0,&::getCppuType( (::rtl::OUString
*)0 ), beans::PropertyAttribute::MAYBEVOID
, 0 },
1499 { NULL
, 0, 0, NULL
, 0, 0 }
1501 uno::Reference
< beans::XPropertySet
> xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap
) ) );
1503 SvtSaveOptions aSaveOpt
;
1504 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")), uno::makeAny(aSaveOpt
.IsPrettyPrinting()));
1505 if ( aSaveOpt
.IsSaveRelFSys() )
1507 const ::rtl::OUString
sVal( aDescriptor
.getUnpackedValueOrDefault(aDescriptor
.PROP_DOCUMENTBASEURL(),::rtl::OUString()) );
1508 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(sVal
));
1509 } // if ( aSaveOpt.IsSaveRelFSys() )
1510 const ::rtl::OUString
sHierarchicalDocumentName( aDescriptor
.getUnpackedValueOrDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),::rtl::OUString()) );
1511 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")), uno::makeAny(sHierarchicalDocumentName
));
1514 sal_Int32 nArgsLen
= aDelegatorArguments
.getLength();
1515 aDelegatorArguments
.realloc(nArgsLen
+1);
1516 aDelegatorArguments
[nArgsLen
++] <<= xInfoSet
;
1518 uno::Reference
< document::XEmbeddedObjectResolver
> xObjectResolver
;
1519 uno::Reference
< document::XGraphicObjectResolver
> xGrfResolver
;
1520 SvXMLGraphicHelper
* pGraphicHelper
= SvXMLGraphicHelper::Create(_xStorageToSaveTo
,GRAPHICHELPER_MODE_WRITE
);
1521 xGrfResolver
= pGraphicHelper
;
1522 pGraphicHelper
->release();
1523 SvXMLEmbeddedObjectHelper
* pEmbeddedObjectHelper
= SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo
,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE
);
1524 xObjectResolver
= pEmbeddedObjectHelper
;
1525 pEmbeddedObjectHelper
->release();
1527 aDelegatorArguments
.realloc(nArgsLen
+2);
1528 aDelegatorArguments
[nArgsLen
++] <<= xGrfResolver
;
1529 aDelegatorArguments
[nArgsLen
++] <<= xObjectResolver
;
1531 uno::Reference
<XComponent
> xCom(static_cast<OWeakObject
*>(this),uno::UNO_QUERY
);
1534 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml"))));
1535 if( !WriteThroughComponent(
1536 xCom
, "settings.xml",
1537 "com.sun.star.comp.report.XMLSettingsExporter",
1538 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1543 sWarnFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml"));
1550 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml"))));
1551 if( !WriteThroughComponent(
1553 "com.sun.star.comp.report.XMLMetaExporter",
1554 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1559 sWarnFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml"));
1566 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml"))));
1567 if( !WriteThroughComponent(
1569 "com.sun.star.comp.report.XMLStylesExporter",
1570 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1575 sWarnFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml"));
1582 xInfoSet
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml"))));
1583 if( !WriteThroughComponent(
1584 xCom
, "content.xml",
1585 "com.sun.star.comp.report.ExportFilter",
1586 aDelegatorArguments
, aProps
, sal_True
,_xStorageToSaveTo
) )
1589 sErrFile
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml"));
1594 uno::Reference
< embed::XVisualObject
> xCurrentController(getCurrentController(),uno::UNO_QUERY
);
1595 if ( xCurrentController
.is() )
1597 xCurrentController
->setVisualAreaSize(m_pImpl
->m_nAspect
,m_pImpl
->m_aVisualAreaSize
);
1598 aImage
= xCurrentController
->getPreferredVisualRepresentation( m_pImpl
->m_nAspect
).Data
;
1600 if ( aImage
.hasValue() )
1602 ::rtl::OUString
sObject1(RTL_CONSTASCII_USTRINGPARAM("report"));
1603 ::rtl::OUString
sPng(RTL_CONSTASCII_USTRINGPARAM("image/png"));
1605 uno::Sequence
<sal_Int8
> aSeq
;
1607 uno::Reference
<io::XInputStream
> xStream
= new ::comphelper::SequenceInputStream( aSeq
);
1608 m_pImpl
->m_pObjectContainer
->InsertGraphicStreamDirectly(xStream
,sObject1
,sPng
);
1613 sal_Bool bPersist
= sal_False
;
1614 if ( _xStorageToSaveTo
== m_pImpl
->m_xStorage
)
1615 bPersist
= m_pImpl
->m_pObjectContainer
->StoreChildren(sal_True
,sal_False
);
1617 bPersist
= m_pImpl
->m_pObjectContainer
->StoreAsChildren(sal_True
,sal_True
,_xStorageToSaveTo
);
1620 m_pImpl
->m_pObjectContainer
->SetPersistentEntries(m_pImpl
->m_xStorage
);
1623 uno::Reference
<embed::XTransactedObject
> xTransact(_xStorageToSaveTo
,uno::UNO_QUERY
);
1624 if ( xTransact
.is() )
1625 xTransact
->commit();
1627 catch(uno::Exception
)
1629 OSL_ENSURE(0,"Exception Caught: Could not commit report storage!");
1630 throw io::IOException();
1633 if ( _xStorageToSaveTo
== m_pImpl
->m_xStorage
)
1634 setModified(sal_False
);
1636 if ( xStatusIndicator
.is() )
1637 xStatusIndicator
->end();
1639 // -----------------------------------------------------------------------------
1640 void SAL_CALL
OReportDefinition::switchToStorage( const uno::Reference
< embed::XStorage
>& _xStorage
) throw (lang::IllegalArgumentException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1642 if ( !_xStorage
.is() )
1643 throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL
,m_aProps
->m_xContext
->getServiceManager()),*this,1);
1645 ::osl::MutexGuard
aGuard(m_aMutex
);
1646 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1647 m_pImpl
->m_xStorage
= _xStorage
;
1648 lcl_setModelReadOnly(m_pImpl
->m_xStorage
,m_pImpl
->m_pReportModel
);
1649 m_pImpl
->m_pObjectContainer
->SwitchPersistence(m_pImpl
->m_xStorage
);
1651 // notify our container listeners
1652 m_pImpl
->m_aStorageChangeListeners
.forEach
<document::XStorageChangeListener
>(
1653 ::boost::bind(&document::XStorageChangeListener::notifyStorageChange
,_1
,boost::cref(static_cast<OWeakObject
*>(this)),boost::cref(_xStorage
)));
1655 // -----------------------------------------------------------------------------
1656 uno::Reference
< embed::XStorage
> SAL_CALL
OReportDefinition::getDocumentStorage( ) throw (io::IOException
, uno::Exception
, uno::RuntimeException
)
1658 ::osl::MutexGuard
aGuard(m_aMutex
);
1659 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1660 return m_pImpl
->m_xStorage
;
1662 // -----------------------------------------------------------------------------
1663 void SAL_CALL
OReportDefinition::addStorageChangeListener( const uno::Reference
< document::XStorageChangeListener
>& xListener
) throw (uno::RuntimeException
)
1665 ::osl::MutexGuard
aGuard(m_aMutex
);
1666 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1667 if ( xListener
.is() )
1668 m_pImpl
->m_aStorageChangeListeners
.addInterface(xListener
);
1670 // -----------------------------------------------------------------------------
1671 void SAL_CALL
OReportDefinition::removeStorageChangeListener( const uno::Reference
< document::XStorageChangeListener
>& xListener
) throw (uno::RuntimeException
)
1673 ::osl::MutexGuard
aGuard(m_aMutex
);
1674 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1675 m_pImpl
->m_aStorageChangeListeners
.removeInterface(xListener
);
1677 // -----------------------------------------------------------------------------
1678 sal_Bool
OReportDefinition::WriteThroughComponent(
1679 const uno::Reference
<lang::XComponent
> & xComponent
,
1680 const sal_Char
* pStreamName
,
1681 const sal_Char
* pServiceName
,
1682 const uno::Sequence
<uno::Any
> & rArguments
,
1683 const uno::Sequence
<beans::PropertyValue
> & rMediaDesc
,
1684 sal_Bool bPlainStream
1685 ,const uno::Reference
<embed::XStorage
>& _xStorageToSaveTo
)
1687 OSL_ENSURE( NULL
!= pStreamName
, "Need stream name!" );
1688 OSL_ENSURE( NULL
!= pServiceName
, "Need service name!" );
1691 uno::Reference
<embed::XStorage
> xMyStorage
= _xStorageToSaveTo
;
1693 ::rtl::OUString sStreamName
= ::rtl::OUString::createFromAscii( pStreamName
);
1694 uno::Reference
<io::XStream
> xStream
= xMyStorage
->openStreamElement( sStreamName
,embed::ElementModes::READWRITE
| embed::ElementModes::TRUNCATE
);
1695 if ( !xStream
.is() )
1697 uno::Reference
<io::XOutputStream
> xOutputStream
= xStream
->getOutputStream();
1698 OSL_ENSURE(xOutputStream
.is(), "Can't create output stream in package!");
1699 if ( ! xOutputStream
.is() )
1702 uno::Reference
<beans::XPropertySet
> xStreamProp(xOutputStream
,uno::UNO_QUERY
);
1703 OSL_ENSURE(xStreamProp
.is(),"No valid preoperty set for the output stream!");
1705 uno::Reference
<io::XSeekable
> xSeek(xStreamProp
,uno::UNO_QUERY
);
1708 OSL_TRACE("Length of stream %i",(int)xSeek
->getPosition());
1712 ::rtl::OUString
aPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
1713 ::rtl::OUString
aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
1716 xStreamProp
->setPropertyValue( aPropName
, aAny
);
1721 xStreamProp
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Compressed") ), aAny
);
1725 xStreamProp
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ), uno::makeAny(sal_True
) );
1729 // set buffer and create outputstream
1732 sal_Bool bRet
= WriteThroughComponent(
1733 xOutputStream
, xComponent
,
1734 pServiceName
, rArguments
, rMediaDesc
);
1735 // finally, commit stream.
1738 catch(const uno::Exception
& e
)
1740 (void)e
; // helper to know what e contains
1744 // -----------------------------------------------------------------------------
1745 sal_Bool
OReportDefinition::WriteThroughComponent(
1746 const uno::Reference
<io::XOutputStream
> & xOutputStream
,
1747 const uno::Reference
<lang::XComponent
> & xComponent
,
1748 const sal_Char
* pServiceName
,
1749 const uno::Sequence
<uno::Any
> & rArguments
,
1750 const uno::Sequence
<beans::PropertyValue
> & rMediaDesc
)
1752 OSL_ENSURE( xOutputStream
.is(), "I really need an output stream!" );
1753 OSL_ENSURE( xComponent
.is(), "Need component!" );
1754 OSL_ENSURE( NULL
!= pServiceName
, "Need component name!" );
1757 uno::Reference
< io::XActiveDataSource
> xSaxWriter(
1758 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")),m_aProps
->m_xContext
),
1760 OSL_ENSURE( xSaxWriter
.is(), "can't instantiate XML com.sun.star.xml.sax.Writer" );
1761 if(!xSaxWriter
.is())
1764 // connect XML writer to output stream
1765 xSaxWriter
->setOutputStream( xOutputStream
);
1767 // prepare arguments (prepend doc handler to given arguments)
1768 uno::Reference
<xml::sax::XDocumentHandler
> xDocHandler( xSaxWriter
,uno::UNO_QUERY
);
1769 uno::Sequence
<uno::Any
> aArgs( 1 + rArguments
.getLength() );
1770 aArgs
[0] <<= xDocHandler
;
1771 for(sal_Int32 i
= 0; i
< rArguments
.getLength(); i
++)
1772 aArgs
[i
+1] = rArguments
[i
];
1774 // get filter component
1775 uno::Reference
< document::XExporter
> xExporter(
1776 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext(
1777 ::rtl::OUString::createFromAscii(pServiceName
), aArgs
,m_aProps
->m_xContext
), uno::UNO_QUERY
);
1778 OSL_ENSURE( xExporter
.is(),
1779 "can't instantiate export filter component" );
1780 if( !xExporter
.is() )
1783 // connect model and filter
1784 xExporter
->setSourceDocument( xComponent
);
1787 uno::Reference
<document::XFilter
> xFilter( xExporter
, uno::UNO_QUERY
);
1788 return xFilter
->filter( rMediaDesc
);
1790 // -----------------------------------------------------------------------------
1792 void SAL_CALL
OReportDefinition::initNew( ) throw (frame::DoubleInitializationException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1794 setPageHeaderOn( sal_True
);
1795 setPageFooterOn( sal_True
);
1797 // -----------------------------------------------------------------------------
1798 void SAL_CALL
OReportDefinition::load( const uno::Sequence
< beans::PropertyValue
>& _rArguments
) throw (frame::DoubleInitializationException
, io::IOException
, uno::Exception
, uno::RuntimeException
)
1800 ::osl::MutexGuard
aGuard(m_aMutex
);
1801 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1803 // TODO: this code is pretty similar to what happens in ODatabaseModelImpl::getOrCreateRootStorage,
1804 // perhaps we can share code here.
1806 ::comphelper::NamedValueCollection
aArguments( _rArguments
);
1808 // the source for the to-be-created storage: either an URL, or a stream
1809 uno::Reference
< io::XInputStream
> xStream
;
1810 ::rtl::OUString sURL
;
1812 if ( aArguments
.has( "Stream" ) )
1814 aArguments
.get_ensureType( "Stream", xStream
);
1815 aArguments
.remove( "Stream" );
1817 else if ( aArguments
.has( "InputStream" ) )
1819 aArguments
.get_ensureType( "InputStream", xStream
);
1820 aArguments
.remove( "InputStream" );
1823 if ( aArguments
.has( "FileName" ) )
1825 aArguments
.get_ensureType( "FileName", sURL
);
1826 aArguments
.remove( "FileName" );
1828 else if ( aArguments
.has( "URL" ) )
1830 aArguments
.get_ensureType( "URL", sURL
);
1831 aArguments
.remove( "URL" );
1834 uno::Any aStorageSource
;
1836 aStorageSource
<<= aStorageSource
;
1837 else if ( sURL
.getLength() )
1838 aStorageSource
<<= sURL
;
1840 // TODO: error message
1841 throw lang::IllegalArgumentException(
1842 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source (URL or InputStream) found." ) ),
1848 uno::Reference
< lang::XSingleServiceFactory
> xStorageFactory(
1849 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
1850 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" ) ),
1851 m_aProps
->m_xContext
),
1852 uno::UNO_QUERY_THROW
1855 // open read-write per default, unless told otherwise in the MediaDescriptor
1856 uno::Reference
< embed::XStorage
> xDocumentStorage
;
1857 const sal_Int32 nOpenModes
[2] = {
1858 embed::ElementModes::READWRITE
,
1859 embed::ElementModes::READ
1861 size_t nFirstOpenMode
= 0;
1862 if ( aArguments
.has( "ReadOnly" ) )
1864 sal_Bool bReadOnly
= sal_False
;
1865 aArguments
.get_ensureType( "ReadOnly", bReadOnly
);
1866 nFirstOpenMode
= bReadOnly
? 1 : 0;
1868 const size_t nLastOpenMode
= sizeof( nOpenModes
) / sizeof( nOpenModes
[0] ) - 1;
1869 for ( size_t i
=nFirstOpenMode
; i
<= nLastOpenMode
; ++i
)
1871 uno::Sequence
< uno::Any
> aStorageCreationArgs(2);
1872 aStorageCreationArgs
[0] = aStorageSource
;
1873 aStorageCreationArgs
[1] <<= nOpenModes
[i
];
1877 xDocumentStorage
.set( xStorageFactory
->createInstanceWithArguments( aStorageCreationArgs
), uno::UNO_QUERY_THROW
);
1879 catch( const uno::Exception
& )
1881 if ( i
== nLastOpenMode
)
1882 throw lang::WrappedTargetException(
1883 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An error occured while creating the document storage." ) ),
1886 ::cppu::getCaughtException()
1891 if ( !xDocumentStorage
.is() )
1893 throw uno::RuntimeException();
1896 impl_loadFromStorage_nolck_throw( xDocumentStorage
, aArguments
.getPropertyValues() );
1897 // TODO: do we need to take ownership of the storage? In opposite to loadFromStorage, we created the storage
1898 // ourself here, and perhaps this means we're also responsible for it ...?
1900 // -----------------------------------------------------------------------------
1902 void SAL_CALL
OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect
, const awt::Size
& _aSize
) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
)
1904 ::osl::MutexGuard
aGuard(m_aMutex
);
1905 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1906 //if( nAspect == embed::Aspects::MSOLE_CONTENT )
1909 (m_pImpl
->m_aVisualAreaSize
.Width
!= _aSize
.Width
||
1910 m_pImpl
->m_aVisualAreaSize
.Height
!= _aSize
.Height
);
1911 m_pImpl
->m_aVisualAreaSize
= _aSize
;
1913 setModified( sal_True
);
1915 m_pImpl
->m_nAspect
= _nAspect
;
1917 // -----------------------------------------------------------------------------
1918 awt::Size SAL_CALL
OReportDefinition::getVisualAreaSize( ::sal_Int64
/*_nAspect*/ ) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
)
1920 ::osl::MutexGuard
aGuard(m_aMutex
);
1921 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1922 return m_pImpl
->m_aVisualAreaSize
;
1924 // -----------------------------------------------------------------------------
1925 embed::VisualRepresentation SAL_CALL
OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64
/*_nAspect*/ ) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
)
1927 ::osl::MutexGuard
aGuard(m_aMutex
);
1928 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1929 embed::VisualRepresentation aResult
;
1930 ::rtl::OUString
sImageName(RTL_CONSTASCII_USTRINGPARAM("report"));
1931 ::rtl::OUString sMimeType
;
1932 uno::Reference
<io::XInputStream
> xStream
= m_pImpl
->m_pObjectContainer
->GetGraphicStream(sImageName
,&sMimeType
);
1935 uno::Sequence
<sal_Int8
> aSeq
;
1936 xStream
->readBytes(aSeq
,xStream
->available());
1937 xStream
->closeInput();
1938 aResult
.Data
<<= aSeq
;
1939 aResult
.Flavor
.MimeType
= sMimeType
;
1940 aResult
.Flavor
.DataType
= ::getCppuType( &aSeq
);
1945 // -----------------------------------------------------------------------------
1946 ::sal_Int32 SAL_CALL
OReportDefinition::getMapUnit( ::sal_Int64
/*nAspect*/ ) throw (uno::Exception
, uno::RuntimeException
)
1948 return embed::EmbedMapUnits::ONE_100TH_MM
;
1950 // -----------------------------------------------------------------------------
1952 ::sal_Bool SAL_CALL
OReportDefinition::isModified( ) throw (uno::RuntimeException
)
1954 ::osl::MutexGuard
aGuard(m_aMutex
);
1955 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1956 return m_pImpl
->m_bModified
;
1958 // -----------------------------------------------------------------------------
1959 void SAL_CALL
OReportDefinition::setModified( ::sal_Bool _bModified
) throw (beans::PropertyVetoException
, uno::RuntimeException
)
1961 ::osl::ResettableMutexGuard
aGuard(m_aMutex
);
1962 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1963 if ( m_pImpl
->m_pReportModel
->IsReadOnly() && _bModified
)
1964 throw beans::PropertyVetoException();
1965 if ( m_pImpl
->m_bModified
!= _bModified
)
1967 m_pImpl
->m_bModified
= _bModified
;
1968 if ( m_pImpl
->m_pReportModel
->IsChanged() != _bModified
)
1969 m_pImpl
->m_pReportModel
->SetChanged(_bModified
);
1971 lang::EventObject
aEvent(*this);
1973 m_pImpl
->m_aModifyListeners
.notifyEach(&util::XModifyListener::modified
,aEvent
);
1974 notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnModifyChanged")));
1977 // -----------------------------------------------------------------------------
1978 // XModifyBroadcaster
1979 void SAL_CALL
OReportDefinition::addModifyListener( const uno::Reference
< util::XModifyListener
>& _xListener
) throw (uno::RuntimeException
)
1981 ::osl::MutexGuard
aGuard(m_aMutex
);
1982 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1983 if ( _xListener
.is() )
1984 m_pImpl
->m_aModifyListeners
.addInterface(_xListener
);
1986 // -----------------------------------------------------------------------------
1987 void SAL_CALL
OReportDefinition::removeModifyListener( const uno::Reference
< util::XModifyListener
>& _xListener
) throw (uno::RuntimeException
)
1989 ::osl::MutexGuard
aGuard(m_aMutex
);
1990 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
1991 m_pImpl
->m_aModifyListeners
.removeInterface(_xListener
);
1993 // -----------------------------------------------------------------------------
1994 void OReportDefinition::notifyEvent(const ::rtl::OUString
& _sEventName
)
1998 ::osl::ResettableMutexGuard
aGuard(m_aMutex
);
1999 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2000 document::EventObject
aEvt(*this, _sEventName
);
2002 m_pImpl
->m_aDocEventListeners
.notifyEach(&document::XEventListener::notifyEvent
,aEvt
);
2004 catch(uno::Exception
&)
2008 // -----------------------------------------------------------------------------
2009 // document::XEventBroadcaster
2010 void SAL_CALL
OReportDefinition::addEventListener(const uno::Reference
< document::XEventListener
>& _xListener
) throw (uno::RuntimeException
)
2012 ::osl::MutexGuard
aGuard(m_aMutex
);
2013 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2014 if ( _xListener
.is() )
2015 m_pImpl
->m_aDocEventListeners
.addInterface(_xListener
);
2017 // -----------------------------------------------------------------------------
2018 void SAL_CALL
OReportDefinition::removeEventListener( const uno::Reference
< document::XEventListener
>& _xListener
) throw (uno::RuntimeException
)
2020 ::osl::MutexGuard
aGuard(m_aMutex
);
2021 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2022 m_pImpl
->m_aDocEventListeners
.removeInterface(_xListener
);
2024 // -----------------------------------------------------------------------------
2025 // document::XEventListener
2026 void SAL_CALL
OReportDefinition::notifyEvent( const document::EventObject
& aEvent
) throw (uno::RuntimeException
)
2028 // used only to forward external events (e.g. for doc creation) from the frame loader
2029 // to the global event broadcaster and all other interested doc event listener.
2030 notifyEvent(aEvent
.EventName
);
2032 // -----------------------------------------------------------------------------
2033 // document::XViewDataSupplier
2034 uno::Reference
< container::XIndexAccess
> SAL_CALL
OReportDefinition::getViewData( ) throw (uno::RuntimeException
)
2036 ::osl::MutexGuard
aGuard(m_aMutex
);
2037 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2038 if ( !m_pImpl
->m_xViewData
.is() )
2040 m_pImpl
->m_xViewData
.set(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2041 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")),m_aProps
->m_xContext
),uno::UNO_QUERY
);
2042 //uno::Sequence< beans::PropertyValue > aProps;
2043 //m_pImpl->m_xViewData->insertByIndex(m_pImpl->m_xViewData->getCount(),uno::makeAny(aProps));
2044 uno::Reference
< container::XIndexContainer
> xContainer(m_pImpl
->m_xViewData
,uno::UNO_QUERY
);
2045 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aIter
= m_pImpl
->m_aControllers
.begin();
2046 ::std::vector
< uno::Reference
< frame::XController
> >::iterator aEnd
= m_pImpl
->m_aControllers
.end();
2047 for (;aIter
!= aEnd
; ++aIter
)
2053 xContainer
->insertByIndex(xContainer
->getCount(),(*aIter
)->getViewData());
2055 catch(uno::Exception
&)
2058 } // if ( aIter->is() )
2062 return m_pImpl
->m_xViewData
;
2064 // -----------------------------------------------------------------------------
2065 void SAL_CALL
OReportDefinition::setViewData( const uno::Reference
< container::XIndexAccess
>& Data
) throw (uno::RuntimeException
)
2067 ::osl::MutexGuard
aGuard(m_aMutex
);
2068 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2069 m_pImpl
->m_xViewData
= Data
;
2071 // -----------------------------------------------------------------------------
2072 uno::Reference
< report::XFunctions
> SAL_CALL
OReportDefinition::getFunctions() throw (uno::RuntimeException
)
2074 ::osl::MutexGuard
aGuard(m_aMutex
);
2075 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2076 return m_pImpl
->m_xFunctions
;
2078 // -----------------------------------------------------------------------------
2079 uno::Reference
< ui::XUIConfigurationManager
> SAL_CALL
OReportDefinition::getUIConfigurationManager( ) throw (uno::RuntimeException
)
2081 ::osl::MutexGuard
aGuard(m_aMutex
);
2082 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2084 if ( !m_pImpl
->m_xUIConfigurationManager
.is() )
2086 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
),
2089 uno::Reference
< ui::XUIConfigurationStorage
> xUIConfigStorage( m_pImpl
->m_xUIConfigurationManager
, uno::UNO_QUERY
);
2090 if ( xUIConfigStorage
.is() )
2092 uno::Reference
< embed::XStorage
> xConfigStorage
;
2093 // initialize ui configuration manager with document substorage
2094 xUIConfigStorage
->setStorage( xConfigStorage
);
2098 return m_pImpl
->m_xUIConfigurationManager
;
2100 // -----------------------------------------------------------------------------
2101 uno::Reference
< embed::XStorage
> SAL_CALL
OReportDefinition::getDocumentSubStorage( const ::rtl::OUString
& aStorageName
, sal_Int32 nMode
) throw (uno::RuntimeException
)
2103 ::osl::MutexGuard
aGuard(m_aMutex
);
2104 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2105 return m_pImpl
->m_xStorage
->openStorageElement(aStorageName
, nMode
);
2107 // -----------------------------------------------------------------------------
2108 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getDocumentSubStoragesNames( ) throw (io::IOException
, uno::RuntimeException
)
2110 ::osl::MutexGuard
aGuard(m_aMutex
);
2111 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2112 uno::Reference
<container::XNameAccess
> xNameAccess(m_pImpl
->m_xStorage
,uno::UNO_QUERY
);
2113 return xNameAccess
.is() ? xNameAccess
->getElementNames() : uno::Sequence
< ::rtl::OUString
>();
2115 // -----------------------------------------------------------------------------
2116 ::rtl::OUString SAL_CALL
OReportDefinition::getMimeType() throw (uno::RuntimeException
)
2118 ::osl::MutexGuard
aGuard(m_aMutex
);
2119 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2120 return m_pImpl
->m_sMimeType
;
2122 // -----------------------------------------------------------------------------
2123 void SAL_CALL
OReportDefinition::setMimeType( const ::rtl::OUString
& _mimetype
) throw (lang::IllegalArgumentException
, uno::RuntimeException
)
2125 ::osl::MutexGuard
aGuard(m_aMutex
);
2126 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2127 uno::Sequence
< ::rtl::OUString
> aList
= getAvailableMimeTypes();
2128 const ::rtl::OUString
* pEnd
= aList
.getConstArray()+aList
.getLength();
2129 if ( ::std::find(aList
.getConstArray(),pEnd
,_mimetype
) == pEnd
)
2130 throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getAvailableMimeTypes()"))
2133 ,m_aProps
->m_xContext
);
2134 set(PROPERTY_MIMETYPE
,_mimetype
,m_pImpl
->m_sMimeType
);
2136 // -----------------------------------------------------------------------------
2137 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getAvailableMimeTypes( ) throw (lang::DisposedException
, uno::Exception
, uno::RuntimeException
)
2139 static uno::Sequence
< ::rtl::OUString
> s_aList
;
2140 if ( !s_aList
.hasElements() )
2143 s_aList
[0] = MIMETYPE_OASIS_OPENDOCUMENT_TEXT
;
2144 s_aList
[1] = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET
;
2149 // -----------------------------------------------------------------------------
2150 // com::sun::star::XUnoTunnel
2151 sal_Int64 SAL_CALL
OReportDefinition::getSomething( const uno::Sequence
< sal_Int8
>& rId
) throw(uno::RuntimeException
)
2154 if (rId
.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId
.getConstArray(), 16 ) )
2155 nRet
= reinterpret_cast<sal_Int64
>(this);
2158 uno::Reference
< lang::XUnoTunnel
> xUnoTunnel(m_pImpl
->m_xNumberFormatsSupplier
,uno::UNO_QUERY
);
2159 if ( xUnoTunnel
.is() )
2160 nRet
= xUnoTunnel
->getSomething(rId
);
2164 uno::Reference
< lang::XUnoTunnel
> xTunnel
;
2165 ::comphelper::query_aggregation(m_aProps
->m_xProxy
,xTunnel
);
2167 nRet
= xTunnel
->getSomething(rId
);
2172 // -----------------------------------------------------------------------------
2173 uno::Sequence
< sal_Int8
> SAL_CALL
OReportDefinition::getImplementationId( ) throw (uno::RuntimeException
)
2175 return OReportDefinition::getUnoTunnelImplementationId();
2177 //--------------------------------------------------------------------------
2178 uno::Sequence
< sal_Int8
> OReportDefinition::getUnoTunnelImplementationId()
2180 static ::cppu::OImplementationId
* pId
= 0;
2183 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
2186 static ::cppu::OImplementationId aId
;
2190 return pId
->getImplementationId();
2192 // -----------------------------------------------------------------------------
2193 uno::Reference
< uno::XComponentContext
> OReportDefinition::getContext()
2195 ::osl::MutexGuard
aGuard(m_aMutex
);
2196 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2197 return m_aProps
->m_xContext
;
2199 // -----------------------------------------------------------------------------
2200 ::boost::shared_ptr
<rptui::OReportModel
> OReportDefinition::getSdrModel() const
2202 return m_pImpl
->m_pReportModel
;
2204 // -----------------------------------------------------------------------------
2205 ::boost::shared_ptr
<rptui::OReportModel
> OReportDefinition::getSdrModel(const uno::Reference
< report::XReportDefinition
>& _xReportDefinition
)
2207 ::boost::shared_ptr
<rptui::OReportModel
> pReportModel
;
2208 uno::Reference
< lang::XUnoTunnel
> xUT( _xReportDefinition
, uno::UNO_QUERY
);
2210 pReportModel
= reinterpret_cast<OReportDefinition
*>(sal::static_int_cast
<sal_uIntPtr
>(xUT
->getSomething( OReportDefinition::getUnoTunnelImplementationId())))->getSdrModel();
2211 return pReportModel
;
2213 // -----------------------------------------------------------------------------
2214 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::createInstanceWithArguments( const ::rtl::OUString
& aServiceSpecifier
, const uno::Sequence
< uno::Any
>& _aArgs
)
2215 throw( uno::Exception
, uno::RuntimeException
)
2217 ::osl::MutexGuard
aGuard(m_aMutex
);
2218 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2220 uno::Reference
< uno::XInterface
> xRet
;
2221 if ( aServiceSpecifier
.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"))) == 0 )
2223 uno::Reference
< embed::XStorage
> xStorage
;
2224 const uno::Any
* pIter
= _aArgs
.getConstArray();
2225 const uno::Any
* pEnd
= pIter
+ _aArgs
.getLength();
2226 for(;pIter
!= pEnd
;++pIter
)
2228 beans::NamedValue aValue
;
2230 if( aValue
.Name
.equalsAscii( "Storage" ) )
2231 aValue
.Value
>>= xStorage
;
2232 } // for(;pIter != pEnd ;++pIter)
2233 m_pImpl
->m_pObjectContainer
->SwitchPersistence(xStorage
);
2234 xRet
= static_cast< ::cppu::OWeakObject
* >(SvXMLEmbeddedObjectHelper::Create( xStorage
,*this, EMBEDDEDOBJECTHELPER_MODE_READ
));
2238 // -----------------------------------------------------------------------------
2239 uno::Reference
< uno::XInterface
> SAL_CALL
OReportDefinition::createInstance( const ::rtl::OUString
& aServiceSpecifier
) throw(uno::Exception
, uno::RuntimeException
)
2241 ::osl::MutexGuard
aGuard(m_aMutex
);
2242 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2243 uno::Reference
< drawing::XShape
> xShape
;
2244 if ( aServiceSpecifier
.indexOf( ::rtl::OUString::createFromAscii("com.sun.star.report.") ) == 0 )
2246 if ( aServiceSpecifier
== SERVICE_SHAPE
)
2247 xShape
.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")) ),uno::UNO_QUERY_THROW
);
2248 else if ( aServiceSpecifier
== SERVICE_FORMATTEDFIELD
2249 || aServiceSpecifier
== SERVICE_FIXEDTEXT
2250 || aServiceSpecifier
== SERVICE_FIXEDLINE
2251 || aServiceSpecifier
== SERVICE_IMAGECONTROL
)
2252 xShape
.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape")) ),uno::UNO_QUERY_THROW
);
2254 xShape
.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ),uno::UNO_QUERY_THROW
);
2256 else if ( aServiceSpecifier
.indexOf( ::rtl::OUString::createFromAscii("com.sun.star.form.component.") ) == 0 )
2258 xShape
.set(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(aServiceSpecifier
,m_aProps
->m_xContext
),uno::UNO_QUERY
);
2260 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.PageStyle") ) == 0 ||
2261 aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.FrameStyle") ) == 0 ||
2262 aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.GraphicStyle") ) == 0
2265 uno::Reference
< style::XStyle
> xStyle
= new OStyle();
2266 xStyle
->setName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default")));
2267 uno::Reference
<beans::XPropertySet
> xProp(xStyle
,uno::UNO_QUERY
);
2268 ::rtl::OUString sTray
;
2269 xProp
->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrinterPaperTray")))>>= sTray
;
2271 return xStyle
.get();
2273 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) == 0 )
2275 uno::Reference
<beans::XPropertySet
> xProp
= new OStyle();
2279 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) == 0 )
2281 uno::Reference
<beans::XPropertySet
> xProp
= new OStyle();
2284 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) == 0 )
2286 if ( !m_pImpl
->m_xGradientTable
.is() )
2287 m_pImpl
->m_xGradientTable
.set(SvxUnoGradientTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2288 //comphelper::NameContainer_createInstance( ::getCppuType( (const awt::Gradient*) 0 ) ).get();
2289 return m_pImpl
->m_xGradientTable
;
2291 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) == 0 )
2293 if ( !m_pImpl
->m_xHatchTable
.is() )
2294 m_pImpl
->m_xHatchTable
.set(SvxUnoHatchTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2295 //comphelper::NameContainer_createInstance( ::getCppuType( (const drawing::Hatch*) 0 ) ).get();
2296 return m_pImpl
->m_xHatchTable
;
2298 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) == 0 )
2300 if ( !m_pImpl
->m_xBitmapTable
.is() )
2301 m_pImpl
->m_xBitmapTable
.set(SvxUnoBitmapTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2302 //comphelper::NameContainer_createInstance( ::getCppuType( (const ::rtl::OUString*) 0 ) ).get();
2303 return m_pImpl
->m_xBitmapTable
;
2305 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) == 0 )
2307 if ( !m_pImpl
->m_xTransparencyGradientTable
.is() )
2308 m_pImpl
->m_xTransparencyGradientTable
.set(SvxUnoTransGradientTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2309 //comphelper::NameContainer_createInstance( ::getCppuType( (const awt::Gradient*) 0 ) ).get();
2310 return m_pImpl
->m_xTransparencyGradientTable
;
2312 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) == 0 )
2314 if ( !m_pImpl
->m_xDashTable
.is() )
2315 m_pImpl
->m_xDashTable
.set(SvxUnoDashTable_createInstance(m_pImpl
->m_pReportModel
.get()),uno::UNO_QUERY
);
2316 //comphelper::NameContainer_createInstance( ::getCppuType( (const drawing::LineDash*) 0 ) ).get();
2317 return m_pImpl
->m_xDashTable
;
2319 else if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
2321 if( !m_pImpl
->m_xMarkerTable
.is() )
2322 m_pImpl
->m_xMarkerTable
.set(SvxUnoMarkerTable_createInstance( m_pImpl
->m_pReportModel
.get() ),uno::UNO_QUERY
);
2323 return m_pImpl
->m_xMarkerTable
;
2325 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")) == 0 )
2326 return static_cast< ::cppu::OWeakObject
* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl
->m_xStorage
,*this, EMBEDDEDOBJECTHELPER_MODE_READ
));
2327 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")) == 0 )
2328 return static_cast< ::cppu::OWeakObject
* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl
->m_xStorage
,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE
));
2329 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")) == 0 )
2331 SvXMLGraphicHelper
* pGraphicHelper
= SvXMLGraphicHelper::Create(m_pImpl
->m_xStorage
,GRAPHICHELPER_MODE_WRITE
);
2332 uno::Reference
< uno::XInterface
> xRet(static_cast< ::cppu::OWeakObject
* >(pGraphicHelper
));
2333 pGraphicHelper
->release();
2336 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")) == 0 )
2338 SvXMLGraphicHelper
* pGraphicHelper
= SvXMLGraphicHelper::Create(m_pImpl
->m_xStorage
,GRAPHICHELPER_MODE_WRITE
);
2339 uno::Reference
< uno::XInterface
> xRet(static_cast< ::cppu::OWeakObject
* >(pGraphicHelper
));
2340 pGraphicHelper
->release();
2343 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.data.DataProvider")) == 0 )
2345 uno::Reference
<chart2::data::XDatabaseDataProvider
> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps
->m_xContext
, m_pImpl
->m_xActiveConnection
));
2346 xDataProvider
->setRowLimit(10);
2347 uno::Reference
< container::XChild
> xChild(xDataProvider
,uno::UNO_QUERY
);
2349 xChild
->setParent(*this);
2350 return uno::Reference
< uno::XInterface
>(xDataProvider
,uno::UNO_QUERY
);
2352 else if ( aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap")) == 0 )
2354 if ( !m_pImpl
->m_xXMLNamespaceMap
.is() )
2355 m_pImpl
->m_xXMLNamespaceMap
= comphelper::NameContainer_createInstance( ::getCppuType( (const ::rtl::OUString
*) 0 ) ).get();
2356 return m_pImpl
->m_xXMLNamespaceMap
;
2359 xShape
.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier
),uno::UNO_QUERY_THROW
);
2361 return m_pImpl
->m_pReportModel
->createShape(aServiceSpecifier
,xShape
);
2363 //-----------------------------------------------------------------------------
2364 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportDefinition::getAvailableServiceNames(void) throw( uno::RuntimeException
)
2366 static const ::rtl::OUString aSvxComponentServiceNameList
[] =
2368 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText")),
2369 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl")),
2370 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle")),
2371 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle")),
2372 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle")),
2373 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults")),
2374 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),
2375 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")),
2376 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")),
2377 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")),
2378 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider")),
2379 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap")),
2380 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings")),
2381 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")),
2382 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")),
2383 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")),
2384 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")),
2385 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")),
2386 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable"))
2389 static const sal_uInt16 nSvxComponentServiceNameListCount
= sizeof(aSvxComponentServiceNameList
) / sizeof ( aSvxComponentServiceNameList
[0] );
2391 uno::Sequence
< ::rtl::OUString
> aSeq( nSvxComponentServiceNameListCount
);
2392 ::rtl::OUString
* pStrings
= aSeq
.getArray();
2393 for( sal_uInt16 nIdx
= 0; nIdx
< nSvxComponentServiceNameListCount
; nIdx
++ )
2394 pStrings
[nIdx
] = aSvxComponentServiceNameList
[nIdx
];
2396 uno::Sequence
< ::rtl::OUString
> aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
2397 return concatServiceNames( aParentSeq
, aSeq
);
2399 // -----------------------------------------------------------------------------
2401 awt::Point SAL_CALL
OReportDefinition::getPosition( ) throw (uno::RuntimeException
)
2403 ::osl::MutexGuard
aGuard(m_aMutex
);
2404 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2405 if ( m_aProps
->m_xShape
.is() )
2406 return m_aProps
->m_xShape
->getPosition();
2407 return awt::Point(m_aProps
->m_nPosX
,m_aProps
->m_nPosY
);
2409 // -----------------------------------------------------------------------------
2410 void SAL_CALL
OReportDefinition::setPosition( const awt::Point
& aPosition
) throw (uno::RuntimeException
)
2412 ::osl::MutexGuard
aGuard(m_aMutex
);
2413 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2414 if ( m_aProps
->m_xShape
.is() )
2415 m_aProps
->m_xShape
->setPosition(aPosition
);
2416 set(PROPERTY_POSITIONX
,aPosition
.X
,m_aProps
->m_nPosX
);
2417 set(PROPERTY_POSITIONY
,aPosition
.Y
,m_aProps
->m_nPosY
);
2419 // -----------------------------------------------------------------------------
2420 awt::Size SAL_CALL
OReportDefinition::getSize( ) throw (uno::RuntimeException
)
2422 ::osl::MutexGuard
aGuard(m_aMutex
);
2423 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2424 if ( m_aProps
->m_xShape
.is() )
2425 return m_aProps
->m_xShape
->getSize();
2426 return awt::Size(m_aProps
->m_nWidth
,m_aProps
->m_nHeight
);
2428 // -----------------------------------------------------------------------------
2429 void SAL_CALL
OReportDefinition::setSize( const awt::Size
& aSize
) throw (beans::PropertyVetoException
, uno::RuntimeException
)
2431 ::osl::MutexGuard
aGuard(m_aMutex
);
2432 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2433 if ( m_aProps
->m_xShape
.is() )
2434 m_aProps
->m_xShape
->setSize(aSize
);
2435 set(PROPERTY_WIDTH
,aSize
.Width
,m_aProps
->m_nWidth
);
2436 set(PROPERTY_HEIGHT
,aSize
.Height
,m_aProps
->m_nHeight
);
2438 // -----------------------------------------------------------------------------
2441 ::rtl::OUString SAL_CALL
OReportDefinition::getShapeType( ) throw (uno::RuntimeException
)
2443 ::osl::MutexGuard
aGuard(m_aMutex
);
2444 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2445 if ( m_aProps
->m_xShape
.is() )
2446 return m_aProps
->m_xShape
->getShapeType();
2447 return ::rtl::OUString();
2449 // -----------------------------------------------------------------------------
2450 typedef ::cppu::WeakImplHelper2
< container::XNameContainer
,
2451 container::XIndexAccess
2453 class OStylesHelper
: public ::cppu::BaseMutex
, public TStylesBASE
2455 typedef ::std::map
< ::rtl::OUString
, uno::Any
, ::comphelper::UStringMixLess
> TStyleElements
;
2456 TStyleElements m_aElements
;
2457 ::std::vector
<TStyleElements::iterator
> m_aElementsPos
;
2460 OStylesHelper(const OStylesHelper
&);
2461 void operator =(const OStylesHelper
&);
2463 virtual ~OStylesHelper(){}
2465 OStylesHelper(const uno::Type _aType
= ::getCppuType(static_cast< uno::Reference
< container::XElementAccess
>* >(NULL
)));
2468 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::ElementExistException
,lang::WrappedTargetException
, uno::RuntimeException
);
2469 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& Name
) throw(container::NoSuchElementException
, lang::WrappedTargetException
,uno::RuntimeException
);
2472 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::NoSuchElementException
,lang::WrappedTargetException
, uno::RuntimeException
);
2474 // container::XElementAccess
2475 virtual uno::Type SAL_CALL
getElementType( ) throw(uno::RuntimeException
);
2476 virtual sal_Bool SAL_CALL
hasElements( ) throw(uno::RuntimeException
);
2477 // container::XIndexAccess
2478 virtual sal_Int32 SAL_CALL
getCount( ) throw(uno::RuntimeException
);
2479 virtual uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
);
2481 // container::XNameAccess
2482 virtual uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
);
2483 virtual uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw(uno::RuntimeException
);
2484 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw(uno::RuntimeException
);
2487 OStylesHelper::OStylesHelper(const uno::Type _aType
)
2492 // -----------------------------------------------------------------------------;
2493 // container::XElementAccess
2494 uno::Type SAL_CALL
OStylesHelper::getElementType( ) throw(uno::RuntimeException
)
2498 // -----------------------------------------------------------------------------
2499 sal_Bool SAL_CALL
OStylesHelper::hasElements( ) throw(uno::RuntimeException
)
2501 ::osl::MutexGuard
aGuard(m_aMutex
);
2502 return !m_aElementsPos
.empty();
2504 // -----------------------------------------------------------------------------
2505 // container::XIndexAccess
2506 sal_Int32 SAL_CALL
OStylesHelper::getCount( ) throw(uno::RuntimeException
)
2508 ::osl::MutexGuard
aGuard(m_aMutex
);
2509 return m_aElementsPos
.size();
2511 // -----------------------------------------------------------------------------
2512 uno::Any SAL_CALL
OStylesHelper::getByIndex( sal_Int32 Index
) throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
2514 ::osl::MutexGuard
aGuard(m_aMutex
);
2515 if ( Index
< 0 || Index
>= static_cast<sal_Int32
>(m_aElementsPos
.size()) )
2516 throw lang::IndexOutOfBoundsException();
2517 return uno::makeAny(m_aElementsPos
[Index
]->second
);
2519 // -----------------------------------------------------------------------------
2520 // container::XNameAccess
2521 uno::Any SAL_CALL
OStylesHelper::getByName( const ::rtl::OUString
& aName
) throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
2523 ::osl::MutexGuard
aGuard(m_aMutex
);
2524 TStyleElements::iterator aFind
= m_aElements
.find(aName
);
2525 if ( aFind
== m_aElements
.end() )
2526 throw container::NoSuchElementException();
2527 return uno::makeAny(aFind
->second
);
2529 // -----------------------------------------------------------------------------
2530 uno::Sequence
< ::rtl::OUString
> SAL_CALL
OStylesHelper::getElementNames( ) throw(uno::RuntimeException
)
2532 ::osl::MutexGuard
aGuard(m_aMutex
);
2533 uno::Sequence
< ::rtl::OUString
> aNameList(m_aElementsPos
.size());
2535 ::rtl::OUString
* pStringArray
= aNameList
.getArray();
2536 ::std::vector
<TStyleElements::iterator
>::const_iterator aEnd
= m_aElementsPos
.end();
2537 for(::std::vector
<TStyleElements::iterator
>::const_iterator aIter
= m_aElementsPos
.begin(); aIter
!= aEnd
;++aIter
,++pStringArray
)
2538 *pStringArray
= (*aIter
)->first
;
2542 // -----------------------------------------------------------------------------
2543 sal_Bool SAL_CALL
OStylesHelper::hasByName( const ::rtl::OUString
& aName
) throw(uno::RuntimeException
)
2545 ::osl::MutexGuard
aGuard(m_aMutex
);
2546 return m_aElements
.find(aName
) != m_aElements
.end();
2548 // -----------------------------------------------------------------------------
2550 void SAL_CALL
OStylesHelper::insertByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::ElementExistException
,lang::WrappedTargetException
, uno::RuntimeException
)
2552 ::osl::MutexGuard
aGuard(m_aMutex
);
2553 if ( m_aElements
.find(aName
) != m_aElements
.end() )
2554 throw container::ElementExistException();
2556 if ( !aElement
.isExtractableTo(m_aType
) )
2557 throw lang::IllegalArgumentException();
2559 m_aElementsPos
.push_back(m_aElements
.insert(TStyleElements::value_type(aName
,aElement
)).first
);
2561 // -----------------------------------------------------------------------------
2562 void SAL_CALL
OStylesHelper::removeByName( const ::rtl::OUString
& aName
) throw(container::NoSuchElementException
, lang::WrappedTargetException
,uno::RuntimeException
)
2564 ::osl::MutexGuard
aGuard(m_aMutex
);
2565 TStyleElements::iterator aFind
= m_aElements
.find(aName
);
2566 if ( aFind
!= m_aElements
.end() )
2567 throw container::NoSuchElementException();
2568 m_aElementsPos
.erase(::std::find(m_aElementsPos
.begin(),m_aElementsPos
.end(),aFind
));
2569 m_aElements
.erase(aFind
);
2571 // -----------------------------------------------------------------------------
2573 void SAL_CALL
OStylesHelper::replaceByName( const ::rtl::OUString
& aName
, const uno::Any
& aElement
) throw(lang::IllegalArgumentException
, container::NoSuchElementException
,lang::WrappedTargetException
, uno::RuntimeException
)
2575 ::osl::MutexGuard
aGuard(m_aMutex
);
2576 TStyleElements::iterator aFind
= m_aElements
.find(aName
);
2577 if ( aFind
!= m_aElements
.end() )
2578 throw container::NoSuchElementException();
2579 if ( !aElement
.isExtractableTo(m_aType
) )
2580 throw lang::IllegalArgumentException();
2581 aFind
->second
= aElement
;
2583 // -----------------------------------------------------------------------------
2584 uno::Reference
< container::XNameAccess
> SAL_CALL
OReportDefinition::getStyleFamilies( ) throw (uno::RuntimeException
)
2586 ::osl::MutexGuard
aGuard(m_aMutex
);
2587 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2588 if ( !m_pImpl
->m_xStyles
.is() )
2590 m_pImpl
->m_xStyles
= new OStylesHelper();
2591 uno::Reference
< container::XNameContainer
> xStyles(m_pImpl
->m_xStyles
,uno::UNO_QUERY
);
2593 uno::Reference
< container::XNameContainer
> xPageStyles
= new OStylesHelper(::getCppuType(static_cast< uno::Reference
<style::XStyle
>* >(NULL
)));
2594 xStyles
->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles")),uno::makeAny(xPageStyles
));
2595 uno::Reference
< style::XStyle
> xPageStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle"))),uno::UNO_QUERY
);
2596 xPageStyles
->insertByName(xPageStyle
->getName(),uno::makeAny(xPageStyle
));
2598 uno::Reference
< container::XNameContainer
> xFrameStyles
= new OStylesHelper(::getCppuType(static_cast< uno::Reference
<style::XStyle
>* >(NULL
)));
2599 xStyles
->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameStyles")),uno::makeAny(xFrameStyles
));
2600 uno::Reference
< style::XStyle
> xFrameStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle"))),uno::UNO_QUERY
);
2601 xFrameStyles
->insertByName(xFrameStyle
->getName(),uno::makeAny(xFrameStyle
));
2603 uno::Reference
< container::XNameContainer
> xGraphicStyles
= new OStylesHelper(::getCppuType(static_cast< uno::Reference
<style::XStyle
>* >(NULL
)));
2604 xStyles
->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")),uno::makeAny(xGraphicStyles
));
2605 uno::Reference
< style::XStyle
> xGraphicStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle"))),uno::UNO_QUERY
);
2606 xGraphicStyles
->insertByName(xGraphicStyle
->getName(),uno::makeAny(xGraphicStyle
));
2608 return m_pImpl
->m_xStyles
;
2610 ::rtl::OUString SAL_CALL
OReportDefinition::getIdentifier( ) throw (uno::RuntimeException
)
2612 ::osl::MutexGuard
aGuard(m_aMutex
);
2613 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2614 return m_pImpl
->m_sIdentifier
;
2616 // -----------------------------------------------------------------------------
2617 void SAL_CALL
OReportDefinition::setIdentifier( const ::rtl::OUString
& Identifier
) throw (uno::RuntimeException
)
2619 ::osl::MutexGuard
aGuard(m_aMutex
);
2620 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2621 m_pImpl
->m_sIdentifier
= Identifier
;
2623 // -----------------------------------------------------------------------------
2624 // XNumberFormatsSupplier
2625 uno::Reference
< beans::XPropertySet
> SAL_CALL
OReportDefinition::getNumberFormatSettings( ) throw (uno::RuntimeException
)
2627 ::osl::MutexGuard
aGuard(m_aMutex
);
2628 if ( m_pImpl
->m_xNumberFormatsSupplier
.is() )
2629 return m_pImpl
->m_xNumberFormatsSupplier
->getNumberFormatSettings();
2630 return uno::Reference
< beans::XPropertySet
>();
2632 // -----------------------------------------------------------------------------
2633 uno::Reference
< util::XNumberFormats
> SAL_CALL
OReportDefinition::getNumberFormats( ) throw (uno::RuntimeException
)
2635 ::osl::MutexGuard
aGuard(m_aMutex
);
2636 if ( m_pImpl
->m_xNumberFormatsSupplier
.is() )
2637 return m_pImpl
->m_xNumberFormatsSupplier
->getNumberFormats();
2638 return uno::Reference
< util::XNumberFormats
>();
2640 // -----------------------------------------------------------------------------
2641 ::comphelper::EmbeddedObjectContainer
& OReportDefinition::getEmbeddedObjectContainer() const
2643 return *m_pImpl
->m_pObjectContainer
;
2645 // -----------------------------------------------------------------------------
2646 uno::Reference
< embed::XStorage
> OReportDefinition::getStorage() const
2648 return m_pImpl
->m_xStorage
;
2650 // -----------------------------------------------------------------------------
2651 uno::Reference
< task::XInteractionHandler
> OReportDefinition::getInteractionHandler() const
2653 uno::Reference
< task::XInteractionHandler
> xRet( m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2654 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler")) ,m_aProps
->m_xContext
),uno::UNO_QUERY
);
2657 // -----------------------------------------------------------------------------
2658 uno::Reference
< sdbc::XConnection
> SAL_CALL
OReportDefinition::getActiveConnection() throw (uno::RuntimeException
)
2660 ::osl::MutexGuard
aGuard(m_aMutex
);
2661 return m_pImpl
->m_xActiveConnection
;
2663 // -----------------------------------------------------------------------------
2664 void SAL_CALL
OReportDefinition::setActiveConnection( const uno::Reference
< sdbc::XConnection
>& _activeconnection
) throw (lang::IllegalArgumentException
, uno::RuntimeException
)
2666 if ( !_activeconnection
.is() )
2667 throw lang::IllegalArgumentException();
2668 set(PROPERTY_ACTIVECONNECTION
,_activeconnection
,m_pImpl
->m_xActiveConnection
);
2670 // -----------------------------------------------------------------------------
2671 ::rtl::OUString SAL_CALL
OReportDefinition::getDataSourceName() throw (uno::RuntimeException
)
2673 osl::MutexGuard
g(m_aMutex
);
2674 return m_pImpl
->m_sDataSourceName
;
2676 // -----------------------------------------------------------------------------
2677 void SAL_CALL
OReportDefinition::setDataSourceName(const ::rtl::OUString
& the_value
) throw (uno::RuntimeException
)
2679 set(PROPERTY_DATASOURCENAME
,the_value
,m_pImpl
->m_sDataSourceName
);
2681 // -----------------------------------------------------------------------------
2682 bool OReportDefinition::isEnableSetModified() const
2686 uno::Reference
< frame::XTitle
> OReportDefinition::impl_getTitleHelper_throw()
2688 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2690 ::osl::MutexGuard
aGuard(m_aMutex
);
2691 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2693 if ( ! m_pImpl
->m_xTitleHelper
.is ())
2695 uno::Reference
< frame::XUntitledNumbers
> xDesktop(m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2696 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop")) ,m_aProps
->m_xContext
),uno::UNO_QUERY_THROW
);
2697 uno::Reference
< frame::XModel
> xThis (static_cast< frame::XModel
* >(this), uno::UNO_QUERY_THROW
);
2699 ::framework::TitleHelper
* pHelper
= new ::framework::TitleHelper(uno::Reference
< lang::XMultiServiceFactory
>(m_aProps
->m_xContext
->getServiceManager(),uno::UNO_QUERY
));
2700 m_pImpl
->m_xTitleHelper
= uno::Reference
< frame::XTitle
>(static_cast< ::cppu::OWeakObject
* >(pHelper
), uno::UNO_QUERY_THROW
);
2701 pHelper
->setOwner (xThis
);
2702 pHelper
->connectWithUntitledNumbers (xDesktop
);
2705 return m_pImpl
->m_xTitleHelper
;
2707 // -----------------------------------------------------------------------------
2708 uno::Reference
< frame::XUntitledNumbers
> OReportDefinition::impl_getUntitledHelper_throw()
2710 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2712 ::osl::MutexGuard
aGuard(m_aMutex
);
2713 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2715 if ( ! m_pImpl
->m_xNumberedControllers
.is ())
2717 uno::Reference
< frame::XModel
> xThis (static_cast< frame::XModel
* >(this), uno::UNO_QUERY_THROW
);
2718 ::comphelper::NumberedCollection
* pHelper
= new ::comphelper::NumberedCollection();
2719 m_pImpl
->m_xNumberedControllers
= uno::Reference
< frame::XUntitledNumbers
>(static_cast< ::cppu::OWeakObject
* >(pHelper
), uno::UNO_QUERY_THROW
);
2721 pHelper
->setOwner (xThis
);
2722 pHelper
->setUntitledPrefix (::rtl::OUString::createFromAscii(" : "));
2725 return m_pImpl
->m_xNumberedControllers
;
2727 // -----------------------------------------------------------------------------
2729 ::rtl::OUString SAL_CALL
OReportDefinition::getTitle()
2730 throw (uno::RuntimeException
)
2733 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2735 ::osl::MutexGuard
aGuard(m_aMutex
);
2736 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2738 return impl_getTitleHelper_throw()->getTitle ();
2740 // -----------------------------------------------------------------------------
2742 void SAL_CALL
OReportDefinition::setTitle( const ::rtl::OUString
& sTitle
)
2743 throw (uno::RuntimeException
)
2746 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2748 ::osl::MutexGuard
aGuard(m_aMutex
);
2749 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2751 impl_getTitleHelper_throw()->setTitle (sTitle
);
2753 // -----------------------------------------------------------------------------
2754 // css.frame.XTitleChangeBroadcaster
2755 void SAL_CALL
OReportDefinition::addTitleChangeListener( const uno::Reference
< frame::XTitleChangeListener
>& xListener
)
2756 throw (uno::RuntimeException
)
2759 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2761 ::osl::MutexGuard
aGuard(m_aMutex
);
2762 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2764 uno::Reference
< frame::XTitleChangeBroadcaster
> xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY
);
2765 if (xBroadcaster
.is ())
2766 xBroadcaster
->addTitleChangeListener (xListener
);
2768 // -----------------------------------------------------------------------------
2769 // css.frame.XTitleChangeBroadcaster
2770 void SAL_CALL
OReportDefinition::removeTitleChangeListener( const uno::Reference
< frame::XTitleChangeListener
>& xListener
)
2771 throw (uno::RuntimeException
)
2774 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2776 ::osl::MutexGuard
aGuard(m_aMutex
);
2777 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2779 uno::Reference
< frame::XTitleChangeBroadcaster
> xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY
);
2780 if (xBroadcaster
.is ())
2781 xBroadcaster
->removeTitleChangeListener (xListener
);
2783 // -----------------------------------------------------------------------------
2784 // css.frame.XUntitledNumbers
2785 ::sal_Int32 SAL_CALL
OReportDefinition::leaseNumber( const uno::Reference
< uno::XInterface
>& xComponent
)
2786 throw (lang::IllegalArgumentException
,
2787 uno::RuntimeException
)
2789 // object already disposed?
2790 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2791 ::osl::MutexGuard
aGuard(m_aMutex
);
2792 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2794 return impl_getUntitledHelper_throw()->leaseNumber (xComponent
);
2796 // -----------------------------------------------------------------------------
2797 // css.frame.XUntitledNumbers
2798 void SAL_CALL
OReportDefinition::releaseNumber( ::sal_Int32 nNumber
)
2799 throw (lang::IllegalArgumentException
,
2800 uno::RuntimeException
)
2802 // object already disposed?
2803 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2804 ::osl::MutexGuard
aGuard(m_aMutex
);
2805 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2807 impl_getUntitledHelper_throw()->releaseNumber (nNumber
);
2809 // -----------------------------------------------------------------------------
2810 // css.frame.XUntitledNumbers
2811 void SAL_CALL
OReportDefinition::releaseNumberForComponent( const uno::Reference
< uno::XInterface
>& xComponent
)
2812 throw (lang::IllegalArgumentException
,
2813 uno::RuntimeException
)
2815 // object already disposed?
2816 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2817 ::osl::MutexGuard
aGuard(m_aMutex
);
2818 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2820 impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent
);
2822 // -----------------------------------------------------------------------------
2823 // css.frame.XUntitledNumbers
2824 ::rtl::OUString SAL_CALL
OReportDefinition::getUntitledPrefix()
2825 throw (uno::RuntimeException
)
2827 // object already disposed?
2828 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2829 ::osl::MutexGuard
aGuard(m_aMutex
);
2830 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2832 return impl_getUntitledHelper_throw()->getUntitledPrefix ();
2834 // -----------------------------------------------------------------------------
2835 uno::Reference
< document::XDocumentProperties
> SAL_CALL
OReportDefinition::getDocumentProperties( ) throw (uno::RuntimeException
)
2837 ::osl::MutexGuard
aGuard(m_aMutex
);
2838 ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper
.bDisposed
);
2839 if ( !m_pImpl
->m_xDocumentProperties
.is() )
2841 uno::Reference
< lang::XInitialization
> xDocProps(
2842 m_aProps
->m_xContext
->getServiceManager()->createInstanceWithContext(
2843 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentProperties")) ,m_aProps
->m_xContext
),
2844 uno::UNO_QUERY_THROW
);
2845 m_pImpl
->m_xDocumentProperties
.set(xDocProps
, uno::UNO_QUERY_THROW
);
2847 return m_pImpl
->m_xDocumentProperties
;
2849 // -----------------------------------------------------------------------------
2850 uno::Reference
< uno::XComponentContext
> OReportDefinition::getContext() const
2852 return m_aProps
->m_xContext
;
2854 // -----------------------------------------------------------------------------
2855 uno::Any SAL_CALL
OReportDefinition::getTransferData( const datatransfer::DataFlavor
& aFlavor
) throw (datatransfer::UnsupportedFlavorException
, io::IOException
, uno::RuntimeException
)
2858 if( isDataFlavorSupported( aFlavor
) )
2862 aResult
<<= getPreferredVisualRepresentation(0).Data
;
2864 catch( uno::Exception
& ex
)
2866 DBG_UNHANDLED_EXCEPTION();
2872 throw datatransfer::UnsupportedFlavorException(aFlavor
.MimeType
, static_cast< ::cppu::OWeakObject
* >( this ));
2877 // -----------------------------------------------------------------------------
2878 uno::Sequence
< datatransfer::DataFlavor
> SAL_CALL
OReportDefinition::getTransferDataFlavors( ) throw (uno::RuntimeException
)
2880 uno::Sequence
< datatransfer::DataFlavor
> aRet(1);
2882 aRet
[0] = datatransfer::DataFlavor( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")),
2883 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PNG")),
2884 ::getCppuType( (const uno::Sequence
< sal_Int8
>*) NULL
) );
2888 // -----------------------------------------------------------------------------
2889 ::sal_Bool SAL_CALL
OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor
& aFlavor
) throw (uno::RuntimeException
)
2891 return aFlavor
.MimeType
.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")));
2893 // -----------------------------------------------------------------------------
2894 // -----------------------------------------------------------------------------
2895 // =============================================================================
2896 }// namespace reportdesign
2897 // =============================================================================