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