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