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