LibreOffice Module reportdesign (master) 1
ReportController.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 <ReportController.hxx>
21#include <ReportDefinition.hxx>
22#include <CondFormat.hxx>
23#include <UITools.hxx>
24#include <AddField.hxx>
26#include <DateTime.hxx>
27
30#include <rptui_slotid.hrc>
31#include <reportformula.hxx>
32
38#include <comphelper/types.hxx>
39
41#include <com/sun/star/style/XStyle.hpp>
42#include <com/sun/star/style/ParagraphAdjust.hpp>
43#include <com/sun/star/util/NumberFormatter.hpp>
44#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
45#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
46#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
47#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
48#include <com/sun/star/frame/FrameSearchFlag.hpp>
49#include <com/sun/star/container/XChild.hpp>
50#include <com/sun/star/report/XImageControl.hpp>
51#include <com/sun/star/report/XFixedLine.hpp>
52#include <com/sun/star/report/Function.hpp>
53#include <com/sun/star/awt/FontDescriptor.hpp>
54#include <com/sun/star/sdb/XParametersSupplier.hpp>
55#include <com/sun/star/sdb/CommandType.hpp>
56#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
57#include <com/sun/star/embed/EmbedMapUnits.hpp>
58#include <com/sun/star/awt/FontWeight.hpp>
59#include <com/sun/star/awt/FontUnderline.hpp>
60#include <com/sun/star/awt/FontSlant.hpp>
61#include <com/sun/star/frame/Desktop.hpp>
62#include <com/sun/star/frame/status/FontHeight.hpp>
63#include <com/sun/star/report/ReportEngine.hpp>
64#include <com/sun/star/report/XFormattedField.hpp>
65#include <com/sun/star/sdb/SQLContext.hpp>
66#include <com/sun/star/beans/PropertyAttribute.hpp>
67#include <com/sun/star/document/XUndoManagerSupplier.hpp>
68
69#include <vcl/svapp.hxx>
70
71#include <i18nutil/paper.hxx>
72#include <svx/fmview.hxx>
73#include <editeng/memberids.h>
74#include <svx/svxids.hrc>
75#include <svx/svdobj.hxx>
76#include <svx/unomid.hxx>
78#include <svx/xfillit0.hxx>
79#include <svx/xflclit.hxx>
80#include <svx/xflgrit.hxx>
81#include <svx/xflhtit.hxx>
82#include <svx/xbtmpit.hxx>
83#include <svx/xflftrit.hxx>
84#include <svx/xsflclit.hxx>
85#include <svx/xflbckit.hxx>
86#include <svx/xflbmpit.hxx>
87#include <svx/xflbmsli.hxx>
88#include <svx/xflbmsxy.hxx>
89#include <svx/xflbmtit.hxx>
90#include <svx/xflboxy.hxx>
91#include <svx/xflbstit.hxx>
92#include <svx/xflbtoxy.hxx>
93#include <svx/xfltrit.hxx>
94#include <svx/xgrscit.hxx>
95#include <editeng/svxenum.hxx>
96#include <svx/pageitem.hxx>
97#include <editeng/lrspitem.hxx>
98#include <editeng/ulspitem.hxx>
99#include <editeng/sizeitem.hxx>
100#include <sfx2/zoomitem.hxx>
101#include <svx/zoomslideritem.hxx>
102#include <editeng/brushitem.hxx>
103#include <svx/flagsdef.hxx>
104#include <svx/svdpagv.hxx>
105#include <svx/svxdlg.hxx>
106
107#include <core_resource.hxx>
108#include <DesignView.hxx>
109#include <RptObject.hxx>
110#include <RptUndo.hxx>
111#include <strings.hxx>
112#include <RptDef.hxx>
113#include <ReportSection.hxx>
114#include <SectionView.hxx>
115#include <UndoActions.hxx>
116#include <dlgpage.hxx>
117#include <strings.hrc>
118
119#include <svl/itempool.hxx>
120#include <svl/itemset.hxx>
122#include <unotools/syslocale.hxx>
125
126#include <osl/mutex.hxx>
127#include <PropertyForward.hxx>
128#include <SectionWindow.hxx>
129
131#include <GroupsSorting.hxx>
132#include <PageNumber.hxx>
133#include <UndoEnv.hxx>
134
135#include <memory>
136#include <string_view>
137
138#include <cppuhelper/exc_hlp.hxx>
140
142
143#define MAX_ROWS_FOR_PREVIEW 20
144
145#define RPTUI_ID_LRSPACE TypedWhichId<SvxLRSpaceItem>(XATTR_FILL_FIRST - 8)
146#define RPTUI_ID_ULSPACE TypedWhichId<SvxULSpaceItem>(XATTR_FILL_FIRST - 7)
147#define RPTUI_ID_PAGE TypedWhichId<SvxPageItem>(XATTR_FILL_FIRST - 6)
148#define RPTUI_ID_SIZE TypedWhichId<SvxSizeItem>(XATTR_FILL_FIRST - 5)
149#define RPTUI_ID_PAGE_MODE TypedWhichId<SfxUInt16Item>(XATTR_FILL_FIRST - 4)
150#define RPTUI_ID_START TypedWhichId<SfxUInt16Item>(XATTR_FILL_FIRST - 3)
151#define RPTUI_ID_END TypedWhichId<SfxUInt16Item>(XATTR_FILL_FIRST - 2)
152#define RPTUI_ID_BRUSH TypedWhichId<SvxBrushItem>(XATTR_FILL_FIRST - 1)
155#define RPTUI_ID_METRIC TypedWhichId<SfxUInt16Item>(XATTR_FILL_LAST)
156
157static_assert((RPTUI_ID_METRIC - RPTUI_ID_LRSPACE) == 28, "Item ids are not contiguous");
158
159using namespace ::com::sun::star;
160using namespace uno;
161using namespace io;
162using namespace beans;
163using namespace frame;
164using namespace util;
165using namespace lang;
166using namespace container;
167using namespace sdbcx;
168using namespace sdbc;
169using namespace sdb;
170using namespace ui;
171using namespace ui::dialogs;
172using namespace ::dbtools;
173using namespace ::rptui;
174using namespace ::dbaui;
175using namespace ::comphelper;
176using namespace ::cppu;
177
178
179namespace
180{
181 void lcl_setFontWPU_nothrow(const uno::Reference< report::XReportControlFormat>& _xReportControlFormat,const sal_Int32 _nId)
182 {
183 if ( !_xReportControlFormat.is() )
184 return;
185
186 try
187 {
188 awt::FontDescriptor aFontDescriptor = _xReportControlFormat->getFontDescriptor();
189 switch(_nId)
190 {
191 case SID_ATTR_CHAR_WEIGHT:
192 aFontDescriptor.Weight = (awt::FontWeight::NORMAL + awt::FontWeight::BOLD) - aFontDescriptor.Weight;
193 break;
194 case SID_ATTR_CHAR_POSTURE:
195 aFontDescriptor.Slant = static_cast<awt::FontSlant>(static_cast<sal_Int16>(awt::FontSlant_ITALIC) - static_cast<sal_Int16>(aFontDescriptor.Slant));
196 break;
197 case SID_ATTR_CHAR_UNDERLINE:
198 aFontDescriptor.Underline = awt::FontUnderline::SINGLE - aFontDescriptor.Underline;
199 break;
200 default:
201 OSL_FAIL("Illegal value in default!");
202 break;
203 }
204
205 _xReportControlFormat->setFontDescriptor(aFontDescriptor);
206 }
207 catch(const beans::UnknownPropertyException&)
208 {
209 }
210 }
211}
212
213
214static void lcl_getReportControlFormat(const Sequence< PropertyValue >& aArgs,
215 ODesignView* _pView,
216 uno::Reference< awt::XWindow>& _xWindow,
217 ::std::vector< uno::Reference< uno::XInterface > >& _rControlsFormats)
218{
219 uno::Reference< report::XReportControlFormat> xReportControlFormat;
220 if ( aArgs.hasElements() )
221 {
222 SequenceAsHashMap aMap(aArgs);
223 xReportControlFormat = aMap.getUnpackedValueOrDefault(REPORTCONTROLFORMAT,uno::Reference< report::XReportControlFormat>());
224 _xWindow = aMap.getUnpackedValueOrDefault(CURRENT_WINDOW,uno::Reference< awt::XWindow>());
225 }
226
227 if ( !xReportControlFormat.is() )
228 {
229 _pView->fillControlModelSelection(_rControlsFormats);
230 }
231 else
232 {
233 uno::Reference<uno::XInterface> xInterface(xReportControlFormat);
234 _rControlsFormats.push_back(xInterface);
235 }
236
237 if ( !_xWindow.is() )
238 _xWindow = VCLUnoHelper::GetInterface(_pView);
239}
240
241OUString SAL_CALL OReportController::getImplementationName()
242{
243 return "com.sun.star.report.comp.ReportDesign";
244}
245
246Sequence< OUString> SAL_CALL OReportController::getSupportedServiceNames()
247{
248 return { "com.sun.star.sdb.ReportDesign" };
249}
250
251#define PROPERTY_ID_ZOOMVALUE 1
252
253
254OReportController::OReportController(Reference< XComponentContext > const & xContext)
255 :OReportController_BASE(xContext)
256 ,OPropertyStateContainer(OGenericUnoController_Base::rBHelper)
257 ,m_aSelectionListeners( getMutex() )
258 ,m_sMode("normal")
259 ,m_nSplitPos(-1)
260 ,m_nPageNum(-1)
261 ,m_nSelectionCount(0)
262 ,m_nAspect(0)
263 ,m_nZoomValue(100)
264 ,m_eZoomType(SvxZoomType::PERCENT)
265 ,m_bShowRuler(true)
266 ,m_bGridVisible(true)
267 ,m_bGridUse(true)
268 ,m_bShowProperties(true)
269 ,m_bHelplinesMove(true)
270 ,m_bChartEnabled(false)
271 ,m_bChartEnabledAsked(false)
272 ,m_bInGeneratePreview(false)
273{
274 // new Observer
275 m_pReportControllerObserver = new OXReportControllerObserver(*this);
276 registerProperty("ZoomValue", PROPERTY_ID_ZOOMVALUE,
277 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::TRANSIENT,
278 &m_nZoomValue, ::cppu::UnoType<sal_Int16>::get());
279
280}
281
282OReportController::~OReportController()
283{
284}
285
288
289void OReportController::disposing()
290{
291
292 if ( m_pClipboardNotifier.is() )
293 {
294 m_pClipboardNotifier->ClearCallbackLink();
295 m_pClipboardNotifier->RemoveListener( getView() );
296 m_pClipboardNotifier.clear();
297 }
298 if ( m_xGroupsFloater )
299 {
300 SvtViewOptions aDlgOpt(EViewType::Window, m_xGroupsFloater->get_help_id());
301 aDlgOpt.SetWindowState(m_xGroupsFloater->getDialog()->get_window_state(vcl::WindowDataMask::All));
302 if (m_xGroupsFloater->getDialog()->get_visible())
303 m_xGroupsFloater->response(RET_CANCEL);
304 m_xGroupsFloater.reset();
305 }
306
307 try
308 {
309 m_xHoldAlive.clear();
310 m_xColumns.clear();
311 ::comphelper::disposeComponent( m_xRowSet );
312 ::comphelper::disposeComponent( m_xRowSetMediator );
313 ::comphelper::disposeComponent( m_xFormatter );
314 }
315 catch(const uno::Exception&)
316 {
317 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while disposing row sets.");
318 }
319 m_xRowSet.clear();
320 m_xRowSetMediator.clear();
321
322 if ( m_xReportDefinition.is() )
323 {
324 try
325 {
326 OSectionWindow* pSectionWindow = nullptr;
327 if ( getDesignView() )
328 pSectionWindow = getDesignView()->getMarkedSection();
329 if ( pSectionWindow )
330 pSectionWindow->getReportSection().deactivateOle();
331 clearUndoManager();
332 if ( m_aReportModel )
333 listen(false);
334 m_pReportControllerObserver->Clear();
335 m_pReportControllerObserver.clear();
336 }
337 catch(const uno::Exception&)
338 {
339 DBG_UNHANDLED_EXCEPTION("reportdesign");
340 }
341 }
342
343 {
344 EventObject aDisposingEvent( *this );
345 m_aSelectionListeners.disposeAndClear( aDisposingEvent );
346 }
347
348 OReportController_BASE::disposing();
349
350
351 try
352 {
353 m_xReportDefinition.clear();
354 m_aReportModel.reset();
355 m_xFrameLoader.clear();
356 m_xReportEngine.clear();
357 }
358 catch(const uno::Exception&)
359 {
360 }
361 if ( getDesignView() )
362 EndListening( *getDesignView() );
363 clearView();
364}
365
366FeatureState OReportController::GetState(sal_uInt16 _nId) const
367{
368 FeatureState aReturn;
369 // (disabled automatically)
370 aReturn.bEnabled = false;
371 // check this first
372 if ( !getView() )
373 return aReturn;
374
375 switch (_nId)
376 {
377 case SID_RPT_TEXTDOCUMENT:
378 aReturn.bEnabled = isEditable();
379 aReturn.bChecked = (m_xReportDefinition.is() && m_xReportDefinition->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII);
380 break;
381 case SID_RPT_SPREADSHEET:
382 aReturn.bEnabled = isEditable();
383 aReturn.bChecked = (m_xReportDefinition.is() && m_xReportDefinition->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII);
384 break;
385 case SID_REPORTHEADER_WITHOUT_UNDO:
386 case SID_REPORTFOOTER_WITHOUT_UNDO:
387 case SID_REPORTHEADERFOOTER:
388 {
389 aReturn.bEnabled = isEditable();
390 OUString sText = RptResId((m_xReportDefinition.is() && m_xReportDefinition->getReportHeaderOn()) ? RID_STR_REPORTHEADERFOOTER_DELETE : RID_STR_REPORTHEADERFOOTER_INSERT);
391 aReturn.sTitle = sText;
392 }
393 break;
394 case SID_PAGEHEADER_WITHOUT_UNDO:
395 case SID_PAGEFOOTER_WITHOUT_UNDO:
396 case SID_PAGEHEADERFOOTER:
397 {
398 aReturn.bEnabled = isEditable();
399 OUString sText = RptResId((m_xReportDefinition.is() && m_xReportDefinition->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE : RID_STR_PAGEHEADERFOOTER_INSERT);
400 aReturn.sTitle = sText;
401 }
402 break;
403 case SID_GROUP_APPEND:
404 case SID_GROUP_REMOVE:
405 case SID_GROUPHEADER_WITHOUT_UNDO:
406 case SID_GROUPHEADER:
407 case SID_GROUPFOOTER_WITHOUT_UNDO:
408 case SID_GROUPFOOTER:
409 aReturn.bEnabled = isEditable();
410 break;
411 case SID_ADD_CONTROL_PAIR:
412 aReturn.bEnabled = isEditable();
413 break;
414 case SID_REDO:
415 case SID_UNDO:
416 {
417 size_t ( SfxUndoManager::*retrieveCount )( bool const ) const =
419
420 SfxUndoManager& rUndoManager( getUndoManager() );
421 aReturn.bEnabled = ( rUndoManager.*retrieveCount )( SfxUndoManager::TopLevel ) > 0;
422 if ( aReturn.bEnabled )
423 {
424 // TODO: add "Undo/Redo: prefix"
425 OUString ( SfxUndoManager::*retrieveComment )( size_t, bool const ) const =
427 aReturn.sTitle = (rUndoManager.*retrieveComment)( 0, SfxUndoManager::TopLevel );
428 }
429 }
430 break;
431 case SID_GETUNDOSTRINGS:
432 case SID_GETREDOSTRINGS:
433 {
434 size_t ( SfxUndoManager::*retrieveCount )( bool const ) const =
436
437 OUString ( SfxUndoManager::*retrieveComment )( size_t, bool const ) const =
439
440 SfxUndoManager& rUndoManager( getUndoManager() );
441 size_t nCount(( rUndoManager.*retrieveCount )( SfxUndoManager::TopLevel ));
443 auto aSeqRange = asNonConstRange(aSeq);
444 for (size_t n = 0; n < nCount; ++n)
445 aSeqRange[n] = (rUndoManager.*retrieveComment)( n, SfxUndoManager::TopLevel );
446 aReturn.aValue <<= aSeq;
447 aReturn.bEnabled = true;
448 }
449 break;
450 case SID_OBJECT_RESIZING:
451 case SID_OBJECT_SMALLESTWIDTH:
452 case SID_OBJECT_SMALLESTHEIGHT:
453 case SID_OBJECT_GREATESTWIDTH:
454 case SID_OBJECT_GREATESTHEIGHT:
455 aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();
456 if ( aReturn.bEnabled )
457 aReturn.bEnabled = m_nSelectionCount > 1;
458 break;
459
460 case SID_DISTRIBUTE_HLEFT:
461 case SID_DISTRIBUTE_HCENTER:
462 case SID_DISTRIBUTE_HDISTANCE:
463 case SID_DISTRIBUTE_HRIGHT:
464 case SID_DISTRIBUTE_VTOP:
465 case SID_DISTRIBUTE_VCENTER:
466 case SID_DISTRIBUTE_VDISTANCE:
467 case SID_DISTRIBUTE_VBOTTOM:
468 aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();
469 if ( aReturn.bEnabled )
470 {
471 OSectionView* pSectionView = getCurrentSectionView();
472 aReturn.bEnabled = pSectionView && pSectionView->GetMarkedObjectCount() > 2;
473 }
474 break;
475 case SID_ARRANGEMENU:
476 case SID_FRAME_DOWN:
477 case SID_FRAME_UP:
478 case SID_FRAME_TO_TOP:
479 case SID_FRAME_TO_BOTTOM:
480 case SID_OBJECT_HEAVEN:
481 case SID_OBJECT_HELL:
482 aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();
483 if ( aReturn.bEnabled )
484 {
485 OSectionView* pSectionView = getCurrentSectionView();
486 aReturn.bEnabled = pSectionView && pSectionView->OnlyShapesMarked();
487 if ( aReturn.bEnabled )
488 {
489 if ( SID_OBJECT_HEAVEN == _nId )
490 aReturn.bEnabled = pSectionView->GetLayerIdOfMarkedObjects() != RPT_LAYER_FRONT;
491 else if ( SID_OBJECT_HELL == _nId )
492 aReturn.bEnabled = pSectionView->GetLayerIdOfMarkedObjects() != RPT_LAYER_BACK;
493 }
494 }
495 break;
496
497 case SID_SECTION_SHRINK:
498 case SID_SECTION_SHRINK_TOP:
499 case SID_SECTION_SHRINK_BOTTOM:
500 {
501 sal_Int32 nCount = 0;
502 uno::Reference<report::XSection> xSection = getDesignView()->getCurrentSection();
503 if ( xSection.is() )
504 {
505 nCount = xSection->getCount();
506 }
507 aReturn.bEnabled = isEditable() && nCount > 0;
508 }
509 break;
510 case SID_OBJECT_ALIGN:
511 case SID_OBJECT_ALIGN_LEFT:
512 case SID_OBJECT_ALIGN_CENTER:
513 case SID_OBJECT_ALIGN_RIGHT:
514 case SID_OBJECT_ALIGN_UP:
515 case SID_OBJECT_ALIGN_MIDDLE:
516 case SID_OBJECT_ALIGN_DOWN:
517 case SID_SECTION_ALIGN:
518 case SID_SECTION_ALIGN_LEFT:
519 case SID_SECTION_ALIGN_CENTER:
520 case SID_SECTION_ALIGN_RIGHT:
521 case SID_SECTION_ALIGN_UP:
522 case SID_SECTION_ALIGN_MIDDLE:
523 case SID_SECTION_ALIGN_DOWN:
524 aReturn.bEnabled = isEditable() && getDesignView()->HasSelection();
525 break;
526 case SID_CUT:
527 aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent();
528 break;
529 case SID_COPY:
530 aReturn.bEnabled = getDesignView()->HasSelection() && !getDesignView()->isHandleEvent();
531 break;
532 case SID_PASTE:
533 aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent() && getDesignView()->IsPasteAllowed();
534 break;
535 case SID_SELECTALL:
536 aReturn.bEnabled = !getDesignView()->isHandleEvent();
537 break;
538 case SID_SELECTALL_IN_SECTION:
539 aReturn.bEnabled = !getDesignView()->isHandleEvent();
540 if ( aReturn.bEnabled )
541 aReturn.bEnabled = getCurrentSectionView() != nullptr;
542 break;
543 case SID_ESCAPE:
544 aReturn.bEnabled = getDesignView()->GetMode() == DlgEdMode::Insert;
545 break;
546 case SID_TERMINATE_INPLACEACTIVATION:
547 aReturn.bEnabled = true;
548 break;
549 case SID_SELECT_ALL_EDITS:
550 case SID_SELECT_ALL_LABELS:
551 aReturn.bEnabled = true;
552 break;
553 case SID_RPT_NEW_FUNCTION:
554 aReturn.bEnabled = isEditable();
555 break;
556 case SID_COLLAPSE_SECTION:
557 case SID_EXPAND_SECTION:
558 case SID_NEXT_MARK:
559 case SID_PREV_MARK:
560 aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent();
561 break;
562 case SID_SELECT:
563 case SID_SELECT_REPORT:
564 aReturn.bEnabled = true;
565 break;
566 case SID_EXECUTE_REPORT:
567 aReturn.bEnabled = isConnected() && m_xReportDefinition.is();
568 break;
569 case SID_DELETE:
570 aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent();
571 if ( aReturn.bEnabled )
572 {
573 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
574 if ( pSectionWindow )
575 aReturn.bEnabled = !pSectionWindow->getReportSection().isUiActive();
576 }
577 {
578 OUString sText = RptResId(RID_STR_DELETE);
579 aReturn.sTitle = sText;
580 }
581 break;
582 case SID_GRID_VISIBLE:
583 aReturn.bEnabled = isEditable();
584 aReturn.bChecked = m_bGridVisible;
585 break;
586 case SID_GRID_USE:
587 aReturn.bEnabled = isEditable();
588 aReturn.bChecked = m_bGridUse;
589 break;
590 case SID_HELPLINES_MOVE:
591 aReturn.bEnabled = isEditable();
592 aReturn.bChecked = m_bHelplinesMove;
593 break;
594 case SID_RULER:
595 aReturn.bEnabled = isEditable();
596 aReturn.bChecked = m_bShowRuler;
597 break;
598 case SID_OBJECT_SELECT:
599 aReturn.bEnabled = true;
600 aReturn.bChecked = getDesignView()->GetMode() == DlgEdMode::Select;
601 break;
602 case SID_INSERT_DIAGRAM:
603 aReturn.bEnabled = isEditable();
604 aReturn.bInvisible = !m_bChartEnabled;
605 aReturn.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::OLE2;
606 break;
607 case SID_FM_FIXEDTEXT:
608 aReturn.bEnabled = isEditable();
609 aReturn.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignFixedText;
610 break;
611 case SID_INSERT_HFIXEDLINE:
612 aReturn.bEnabled = isEditable();
613 aReturn.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignHorizontalFixedLine;
614 break;
615 case SID_INSERT_VFIXEDLINE:
616 aReturn.bEnabled = isEditable();
617 aReturn.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignVerticalFixedLine;
618 break;
619 case SID_FM_EDIT:
620 aReturn.bEnabled = isEditable();
621 aReturn.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignFormattedField;
622 break;
623 case SID_FM_IMAGECONTROL:
624 aReturn.bEnabled = isEditable();
625 aReturn.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignImageControl;
626 break;
627 case SID_DRAWTBX_CS_BASIC:
628 case SID_DRAWTBX_CS_BASIC1:
629 case SID_DRAWTBX_CS_BASIC2:
630 case SID_DRAWTBX_CS_BASIC3:
631 case SID_DRAWTBX_CS_BASIC4:
632 case SID_DRAWTBX_CS_BASIC5:
633 case SID_DRAWTBX_CS_BASIC6:
634 case SID_DRAWTBX_CS_BASIC7:
635 case SID_DRAWTBX_CS_BASIC8:
636 case SID_DRAWTBX_CS_BASIC9:
637 case SID_DRAWTBX_CS_BASIC10:
638 case SID_DRAWTBX_CS_BASIC11:
639 case SID_DRAWTBX_CS_BASIC12:
640 case SID_DRAWTBX_CS_BASIC13:
641 case SID_DRAWTBX_CS_BASIC14:
642 case SID_DRAWTBX_CS_BASIC15:
643 case SID_DRAWTBX_CS_BASIC16:
644 case SID_DRAWTBX_CS_BASIC17:
645 case SID_DRAWTBX_CS_BASIC18:
646 case SID_DRAWTBX_CS_BASIC19:
647 case SID_DRAWTBX_CS_BASIC20:
648 case SID_DRAWTBX_CS_BASIC21:
649 case SID_DRAWTBX_CS_BASIC22:
650 impl_fillCustomShapeState_nothrow("diamond",aReturn);
651 break;
652 case SID_DRAWTBX_CS_SYMBOL:
653 case SID_DRAWTBX_CS_SYMBOL1:
654 case SID_DRAWTBX_CS_SYMBOL2:
655 case SID_DRAWTBX_CS_SYMBOL3:
656 case SID_DRAWTBX_CS_SYMBOL4:
657 case SID_DRAWTBX_CS_SYMBOL5:
658 case SID_DRAWTBX_CS_SYMBOL6:
659 case SID_DRAWTBX_CS_SYMBOL7:
660 case SID_DRAWTBX_CS_SYMBOL8:
661 case SID_DRAWTBX_CS_SYMBOL9:
662 case SID_DRAWTBX_CS_SYMBOL10:
663 case SID_DRAWTBX_CS_SYMBOL11:
664 case SID_DRAWTBX_CS_SYMBOL12:
665 case SID_DRAWTBX_CS_SYMBOL13:
666 case SID_DRAWTBX_CS_SYMBOL14:
667 case SID_DRAWTBX_CS_SYMBOL15:
668 case SID_DRAWTBX_CS_SYMBOL16:
669 case SID_DRAWTBX_CS_SYMBOL17:
670 case SID_DRAWTBX_CS_SYMBOL18:
671 impl_fillCustomShapeState_nothrow("smiley",aReturn);
672 break;
673 case SID_DRAWTBX_CS_ARROW:
674 case SID_DRAWTBX_CS_ARROW1:
675 case SID_DRAWTBX_CS_ARROW2:
676 case SID_DRAWTBX_CS_ARROW3:
677 case SID_DRAWTBX_CS_ARROW4:
678 case SID_DRAWTBX_CS_ARROW5:
679 case SID_DRAWTBX_CS_ARROW6:
680 case SID_DRAWTBX_CS_ARROW7:
681 case SID_DRAWTBX_CS_ARROW8:
682 case SID_DRAWTBX_CS_ARROW9:
683 case SID_DRAWTBX_CS_ARROW10:
684 case SID_DRAWTBX_CS_ARROW11:
685 case SID_DRAWTBX_CS_ARROW12:
686 case SID_DRAWTBX_CS_ARROW13:
687 case SID_DRAWTBX_CS_ARROW14:
688 case SID_DRAWTBX_CS_ARROW15:
689 case SID_DRAWTBX_CS_ARROW16:
690 case SID_DRAWTBX_CS_ARROW17:
691 case SID_DRAWTBX_CS_ARROW18:
692 case SID_DRAWTBX_CS_ARROW19:
693 case SID_DRAWTBX_CS_ARROW20:
694 case SID_DRAWTBX_CS_ARROW21:
695 case SID_DRAWTBX_CS_ARROW22:
696 case SID_DRAWTBX_CS_ARROW23:
697 case SID_DRAWTBX_CS_ARROW24:
698 case SID_DRAWTBX_CS_ARROW25:
699 case SID_DRAWTBX_CS_ARROW26:
700 impl_fillCustomShapeState_nothrow("left-right-arrow",aReturn);
701 break;
702 case SID_DRAWTBX_CS_STAR:
703 case SID_DRAWTBX_CS_STAR1:
704 case SID_DRAWTBX_CS_STAR2:
705 case SID_DRAWTBX_CS_STAR3:
706 case SID_DRAWTBX_CS_STAR4:
707 case SID_DRAWTBX_CS_STAR5:
708 case SID_DRAWTBX_CS_STAR6:
709 case SID_DRAWTBX_CS_STAR7:
710 case SID_DRAWTBX_CS_STAR8:
711 case SID_DRAWTBX_CS_STAR9:
712 case SID_DRAWTBX_CS_STAR10:
713 case SID_DRAWTBX_CS_STAR11:
714 case SID_DRAWTBX_CS_STAR12:
715 impl_fillCustomShapeState_nothrow("star5",aReturn);
716 break;
717 case SID_DRAWTBX_CS_FLOWCHART:
718 case SID_DRAWTBX_CS_FLOWCHART1:
719 case SID_DRAWTBX_CS_FLOWCHART2:
720 case SID_DRAWTBX_CS_FLOWCHART3:
721 case SID_DRAWTBX_CS_FLOWCHART4:
722 case SID_DRAWTBX_CS_FLOWCHART5:
723 case SID_DRAWTBX_CS_FLOWCHART6:
724 case SID_DRAWTBX_CS_FLOWCHART7:
725 case SID_DRAWTBX_CS_FLOWCHART8:
726 case SID_DRAWTBX_CS_FLOWCHART9:
727 case SID_DRAWTBX_CS_FLOWCHART10:
728 case SID_DRAWTBX_CS_FLOWCHART11:
729 case SID_DRAWTBX_CS_FLOWCHART12:
730 case SID_DRAWTBX_CS_FLOWCHART13:
731 case SID_DRAWTBX_CS_FLOWCHART14:
732 case SID_DRAWTBX_CS_FLOWCHART15:
733 case SID_DRAWTBX_CS_FLOWCHART16:
734 case SID_DRAWTBX_CS_FLOWCHART17:
735 case SID_DRAWTBX_CS_FLOWCHART18:
736 case SID_DRAWTBX_CS_FLOWCHART19:
737 case SID_DRAWTBX_CS_FLOWCHART20:
738 case SID_DRAWTBX_CS_FLOWCHART21:
739 case SID_DRAWTBX_CS_FLOWCHART22:
740 case SID_DRAWTBX_CS_FLOWCHART23:
741 case SID_DRAWTBX_CS_FLOWCHART24:
742 case SID_DRAWTBX_CS_FLOWCHART25:
743 case SID_DRAWTBX_CS_FLOWCHART26:
744 case SID_DRAWTBX_CS_FLOWCHART27:
745 case SID_DRAWTBX_CS_FLOWCHART28:
746 impl_fillCustomShapeState_nothrow("flowchart-internal-storage",aReturn);
747 break;
748 case SID_DRAWTBX_CS_CALLOUT:
749 case SID_DRAWTBX_CS_CALLOUT1:
750 case SID_DRAWTBX_CS_CALLOUT2:
751 case SID_DRAWTBX_CS_CALLOUT3:
752 case SID_DRAWTBX_CS_CALLOUT4:
753 case SID_DRAWTBX_CS_CALLOUT5:
754 case SID_DRAWTBX_CS_CALLOUT6:
755 case SID_DRAWTBX_CS_CALLOUT7:
756 impl_fillCustomShapeState_nothrow("round-rectangular-callout",aReturn);
757 break;
758 case SID_RPT_SHOWREPORTEXPLORER:
759 aReturn.bEnabled = m_xReportDefinition.is();
760 aReturn.bChecked = getDesignView() && getDesignView()->isReportExplorerVisible();
761 break;
762 case SID_FM_ADD_FIELD:
763 aReturn.bEnabled = isConnected() && isEditable() && m_xReportDefinition.is()
764 && !m_xReportDefinition->getCommand().isEmpty();
765 aReturn.bChecked = getDesignView() && getDesignView()->isAddFieldVisible();
766 break;
767 case SID_SHOW_PROPERTYBROWSER:
768 aReturn.bEnabled = true;
769 aReturn.bChecked = m_bShowProperties;
770 break;
771 case SID_PROPERTYBROWSER_LAST_PAGE:
772 aReturn.bEnabled = true;
773 aReturn.aValue <<= m_sLastActivePage;
774 break;
775 case SID_SPLIT_POSITION:
776 aReturn.bEnabled = true;
777 aReturn.aValue <<= getSplitPos();
778 break;
779 case SID_SAVEDOC:
780 case SID_SAVEASDOC:
781 case SID_SAVEACOPY:
782 aReturn.bEnabled = isConnected() && isEditable();
783 break;
784 case SID_EDITDOC:
785 aReturn.bChecked = isEditable();
786 break;
787 case SID_PAGEDIALOG:
788 aReturn.bEnabled = isEditable();
789 break;
790 case SID_BACKGROUND_COLOR:
791 impl_fillState_nothrow(PROPERTY_CONTROLBACKGROUND,aReturn);
792 break;
793 case SID_ATTR_CHAR_COLOR_BACKGROUND:
794 aReturn.bEnabled = isEditable();
795 {
796 uno::Reference<report::XSection> xSection = getDesignView()->getCurrentSection();
797 if ( xSection.is() )
798 try
799 {
800 aReturn.aValue <<= xSection->getBackColor();
801 const uno::Reference< report::XReportControlModel> xControlModel(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
802 aReturn.bEnabled = !xControlModel.is();
803 }
804 catch(const beans::UnknownPropertyException&)
805 {
806 }
807 else
808 aReturn.bEnabled = false;
809 }
810 break;
811 case SID_SORTINGANDGROUPING:
812 aReturn.bEnabled = true;
813 aReturn.bChecked = m_xGroupsFloater && m_xGroupsFloater->getDialog()->get_visible();
814 break;
815 case SID_ATTR_CHAR_WEIGHT:
816 case SID_ATTR_CHAR_POSTURE:
817 case SID_ATTR_CHAR_UNDERLINE:
818 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR,aReturn);
819 if ( aReturn.bEnabled )
820 {
821 awt::FontDescriptor aFontDescriptor;
822 aReturn.aValue >>= aFontDescriptor;
823 aReturn.aValue.clear();
824
825 switch(_nId)
826 {
827 case SID_ATTR_CHAR_WEIGHT:
828 aReturn.bChecked = awt::FontWeight::BOLD == aFontDescriptor.Weight;
829 break;
830 case SID_ATTR_CHAR_POSTURE:
831 aReturn.bChecked = awt::FontSlant_ITALIC == aFontDescriptor.Slant;
832 break;
833 case SID_ATTR_CHAR_UNDERLINE:
834 aReturn.bChecked = awt::FontUnderline::SINGLE == aFontDescriptor.Underline;
835 break;
836 default:
837 ;
838 }
839 }
840 break;
841 case SID_ATTR_CHAR_COLOR:
842 case SID_ATTR_CHAR_COLOR2:
843 impl_fillState_nothrow(PROPERTY_CHARCOLOR,aReturn);
844 break;
845 case SID_ATTR_CHAR_FONT:
846 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR,aReturn);
847 break;
848 case SID_ATTR_CHAR_FONTHEIGHT:
849 impl_fillState_nothrow(PROPERTY_CHARHEIGHT,aReturn);
850 if ( aReturn.aValue.hasValue() )
851 {
852 frame::status::FontHeight aFontHeight;
853 aReturn.aValue >>= aFontHeight.Height;
854 aReturn.aValue <<= aFontHeight; // another type is needed here, so
855 }
856 break;
857 case SID_ATTR_PARA_ADJUST_LEFT:
858 case SID_ATTR_PARA_ADJUST_CENTER:
859 case SID_ATTR_PARA_ADJUST_RIGHT:
860 case SID_ATTR_PARA_ADJUST_BLOCK:
861 impl_fillState_nothrow(PROPERTY_PARAADJUST,aReturn);
862 if ( aReturn.bEnabled )
863 {
864 ::sal_Int16 nParaAdjust = 0;
865 if ( aReturn.aValue >>= nParaAdjust )
866 {
867 switch(static_cast<style::ParagraphAdjust>(nParaAdjust))
868 {
869 case style::ParagraphAdjust_LEFT:
870 aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_LEFT;
871 break;
872 case style::ParagraphAdjust_RIGHT:
873 aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_RIGHT;
874 break;
875 case style::ParagraphAdjust_BLOCK:
876 case style::ParagraphAdjust_STRETCH:
877 aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_BLOCK;
878 break;
879 case style::ParagraphAdjust_CENTER:
880 aReturn.bChecked = _nId == SID_ATTR_PARA_ADJUST_CENTER;
881 break;
882 default: break;
883 }
884 }
885 aReturn.aValue.clear();
886 }
887 break;
888
889 case SID_INSERT_GRAPHIC:
890 aReturn.bEnabled = m_xReportDefinition.is() && isEditable() && getDesignView()->getCurrentSection().is();
891 break;
892 case SID_CHAR_DLG:
893 case SID_SETCONTROLDEFAULTS:
894 aReturn.bEnabled = m_xReportDefinition.is() && isEditable();
895 if ( aReturn.bEnabled )
896 {
897 ::std::vector< uno::Reference< uno::XInterface > > aSelection;
898 getDesignView()->fillControlModelSelection(aSelection);
899 aReturn.bEnabled = !aSelection.empty()
900 && std::all_of(aSelection.begin(), aSelection.end(), [](const uno::Reference<uno::XInterface>& rxInterface) {
901 return !uno::Reference<report::XFixedLine>(rxInterface, uno::UNO_QUERY).is()
902 && !uno::Reference<report::XImageControl>(rxInterface, uno::UNO_QUERY).is()
903 && uno::Reference<report::XReportControlFormat>(rxInterface, uno::UNO_QUERY).is(); });
904 }
905 break;
906 case SID_CONDITIONALFORMATTING:
907 {
908 const uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
909 aReturn.bEnabled = xFormattedField.is();
910 }
911 break;
912 case SID_INSERT_FLD_PGNUMBER:
913 case SID_DATETIME:
914 aReturn.bEnabled = m_xReportDefinition.is() && isEditable() && getDesignView()->getCurrentSection().is();
915 break;
916 case SID_EXPORTDOC:
917 case SID_EXPORTDOCASPDF:
918 aReturn.bEnabled = m_xReportDefinition.is();
919 break;
920 case SID_PRINTPREVIEW:
921 aReturn.bEnabled = false;
922 break;
923 case SID_ATTR_ZOOM:
924 aReturn.bEnabled = true;
925 {
926 SvxZoomItem aZoom(m_eZoomType,m_nZoomValue);
927 aZoom.SetValueSet(SvxZoomEnableFlags::N50|SvxZoomEnableFlags::N75|SvxZoomEnableFlags::N100|SvxZoomEnableFlags::N200);
928 aZoom.QueryValue(aReturn.aValue);
929 }
930 break;
931 case SID_ATTR_ZOOMSLIDER:
932 aReturn.bEnabled = true;
933 {
934 SvxZoomSliderItem aZoomSlider(m_nZoomValue,20,400);
935 aZoomSlider.AddSnappingPoint(50);
936 aZoomSlider.AddSnappingPoint(75);
937 aZoomSlider.AddSnappingPoint(100);
938 aZoomSlider.AddSnappingPoint(200);
939 aZoomSlider.QueryValue(aReturn.aValue);
940 }
941 break;
942 default:
943 aReturn = OReportController_BASE::GetState(_nId);
944 }
945 return aReturn;
946}
947
948
949namespace
950{
956 util::Color lcl_extractBackgroundColor( const Sequence< PropertyValue >& _rDispatchArgs )
957 {
958 util::Color aColor( COL_TRANSPARENT );
959 if ( _rDispatchArgs.getLength() == 1 )
960 {
961 OSL_VERIFY( _rDispatchArgs[0].Value >>= aColor );
962 }
963 else
964 {
965 SequenceAsHashMap aMap( _rDispatchArgs );
966 aColor = aMap.getUnpackedValueOrDefault( PROPERTY_FONTCOLOR, aColor );
967 }
968 return aColor;
969 }
970}
971
972
973void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
974{
975 SolarMutexGuard aSolarGuard;
976 ::osl::MutexGuard aGuard( getMutex() );
977
978 bool bForceBroadcast = false;
979 switch(_nId)
980 {
981 case SID_RPT_TEXTDOCUMENT:
982 if ( m_xReportDefinition.is() )
983 m_xReportDefinition->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII );
984 break;
985 case SID_RPT_SPREADSHEET:
986 if (m_xReportDefinition.is() )
987 m_xReportDefinition->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII );
988 break;
989 case SID_REPORTHEADER_WITHOUT_UNDO:
990 case SID_REPORTFOOTER_WITHOUT_UNDO:
991 case SID_REPORTHEADERFOOTER:
992 switchReportSection(_nId);
993 break;
994 case SID_PAGEHEADER_WITHOUT_UNDO:
995 case SID_PAGEFOOTER_WITHOUT_UNDO:
996 case SID_PAGEHEADERFOOTER:
997 switchPageSection(_nId);
998 break;
999 case SID_GROUP_APPEND:
1000 case SID_GROUP_REMOVE:
1001 modifyGroup(_nId == SID_GROUP_APPEND,aArgs);
1002 break;
1003 case SID_GROUPHEADER_WITHOUT_UNDO:
1004 case SID_GROUPHEADER:
1005 createGroupSection(SID_GROUPHEADER == _nId,true,aArgs);
1006 break;
1007 case SID_GROUPFOOTER_WITHOUT_UNDO:
1008 case SID_GROUPFOOTER:
1009 createGroupSection(SID_GROUPFOOTER == _nId,false,aArgs);
1010 break;
1011 case SID_ADD_CONTROL_PAIR:
1012 addPairControls(aArgs);
1013 break;
1014 case SID_REDO:
1015 case SID_UNDO:
1016 {
1017 const OXUndoEnvironment::OUndoMode aLock( m_aReportModel->GetUndoEnv() );
1018 bool ( SfxUndoManager::*doXDo )() =
1019 ( _nId == SID_UNDO ) ? &SfxUndoManager::Undo : &SfxUndoManager::Redo;
1020 SfxUndoManager& rUndoManager( getUndoManager() );
1021
1022 sal_Int16 nCount(1);
1023 if (aArgs.hasElements() && aArgs[0].Name != "KeyModifier")
1024 aArgs[0].Value >>= nCount;
1025 while (nCount--)
1026 (rUndoManager.*doXDo)();
1027 InvalidateAll();
1028 if (m_xGroupsFloater && m_xGroupsFloater->getDialog()->get_visible())
1029 m_xGroupsFloater->UpdateData();
1030 }
1031 break;
1032 case SID_CUT:
1033 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION,::std::mem_fn(&ODesignView::Cut));
1034 break;
1035 case SID_COPY:
1036 getDesignView()->Copy();
1037 break;
1038 case SID_PASTE:
1039 executeMethodWithUndo(RID_STR_UNDO_PASTE,::std::mem_fn(&ODesignView::Paste));
1040 break;
1041
1042 case SID_FRAME_TO_TOP:
1043 case SID_FRAME_DOWN:
1044 case SID_FRAME_UP:
1045 case SID_FRAME_TO_BOTTOM:
1046 case SID_OBJECT_HEAVEN:
1047 case SID_OBJECT_HELL:
1048 changeZOrder(_nId);
1049 break;
1050 case SID_DISTRIBUTE_HLEFT:
1051 case SID_DISTRIBUTE_HCENTER:
1052 case SID_DISTRIBUTE_HDISTANCE:
1053 case SID_DISTRIBUTE_HRIGHT:
1054 case SID_DISTRIBUTE_VTOP:
1055 case SID_DISTRIBUTE_VCENTER:
1056 case SID_DISTRIBUTE_VDISTANCE:
1057 case SID_DISTRIBUTE_VBOTTOM:
1058 {
1059 OSectionView* pSectionView = getCurrentSectionView();
1060 if ( pSectionView )
1061 pSectionView->DistributeMarkedObjects(_nId);
1062 }
1063 break;
1064 case SID_OBJECT_SMALLESTWIDTH:
1065 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::WIDTH_SMALLEST);
1066 break;
1067 case SID_OBJECT_SMALLESTHEIGHT:
1068 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::HEIGHT_SMALLEST);
1069 break;
1070 case SID_OBJECT_GREATESTWIDTH:
1071 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::WIDTH_GREATEST);
1072 break;
1073 case SID_OBJECT_GREATESTHEIGHT:
1074 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::HEIGHT_GREATEST);
1075 break;
1076 case SID_SECTION_ALIGN_LEFT:
1077 case SID_OBJECT_ALIGN_LEFT:
1078 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::LEFT,SID_SECTION_ALIGN_LEFT == _nId);
1079 break;
1080 case SID_SECTION_ALIGN_CENTER:
1081 case SID_OBJECT_ALIGN_CENTER:
1082 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::CENTER_HORIZONTAL,SID_SECTION_ALIGN_CENTER == _nId);
1083 break;
1084 case SID_SECTION_ALIGN_RIGHT:
1085 case SID_OBJECT_ALIGN_RIGHT:
1086 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::RIGHT,SID_SECTION_ALIGN_RIGHT == _nId);
1087 break;
1088 case SID_SECTION_ALIGN_UP:
1089 case SID_OBJECT_ALIGN_UP:
1090 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::TOP,SID_SECTION_ALIGN_UP == _nId);
1091 break;
1092 case SID_SECTION_ALIGN_MIDDLE:
1093 case SID_OBJECT_ALIGN_MIDDLE:
1094 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::CENTER_VERTICAL,SID_SECTION_ALIGN_MIDDLE == _nId);
1095 break;
1096 case SID_SECTION_ALIGN_DOWN:
1097 case SID_OBJECT_ALIGN_DOWN:
1098 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT,ControlModification::BOTTOM,SID_SECTION_ALIGN_DOWN == _nId);
1099 break;
1100
1101 case SID_SECTION_SHRINK_BOTTOM:
1102 case SID_SECTION_SHRINK_TOP:
1103 case SID_SECTION_SHRINK:
1104 {
1105 uno::Reference<report::XSection> xSection = getDesignView()->getCurrentSection();
1106 shrinkSection(RID_STR_UNDO_SHRINK, xSection, _nId);
1107 }
1108 break;
1109
1110 case SID_SELECTALL:
1111 getDesignView()->SelectAll(SdrObjKind::NONE);
1112 break;
1113 case SID_SELECTALL_IN_SECTION:
1114 {
1115 OSectionView* pSectionView = getCurrentSectionView();
1116 if ( pSectionView )
1117 pSectionView->MarkAll();
1118 }
1119 break;
1120 case SID_ESCAPE:
1121 getDesignView()->SetMode(DlgEdMode::Select);
1122 InvalidateFeature( SID_OBJECT_SELECT );
1123 break;
1124 case SID_SELECT_ALL_EDITS:
1125 getDesignView()->SelectAll(SdrObjKind::ReportDesignFormattedField);
1126 break;
1127 case SID_SELECT_ALL_LABELS:
1128 getDesignView()->SelectAll(SdrObjKind::ReportDesignFixedText);
1129 break;
1130 case SID_TERMINATE_INPLACEACTIVATION:
1131 {
1132 OSectionWindow* pSection = getDesignView()->getMarkedSection();
1133 if ( pSection )
1134 pSection->getReportSection().deactivateOle();
1135 }
1136 break;
1137 case SID_SELECT:
1138 if ( aArgs.getLength() == 1 )
1139 select(aArgs[0].Value);
1140 break;
1141 case SID_SELECT_REPORT:
1142 select(uno::Any(m_xReportDefinition));
1143 break;
1144 case SID_EXECUTE_REPORT:
1145 getView()->PostUserEvent(LINK(this, OReportController,OnExecuteReport));
1146 break;
1147 case SID_RPT_NEW_FUNCTION:
1148 createNewFunction(aArgs[0].Value);
1149 break;
1150 case SID_COLLAPSE_SECTION:
1151 collapseSection(true);
1152 break;
1153 case SID_EXPAND_SECTION:
1154 collapseSection(false);
1155 break;
1156 case SID_NEXT_MARK:
1157 markSection(true);
1158 break;
1159 case SID_PREV_MARK:
1160 markSection(false);
1161 break;
1162 case SID_DELETE:
1163 if ( aArgs.getLength() == 1 )
1164 {
1165 uno::Reference< report::XFunction> xFunction;
1166 aArgs[0].Value >>= xFunction;
1167 if ( xFunction.is() )
1168 {
1169 uno::Reference< report::XFunctions> xFunctions(xFunction->getParent(),uno::UNO_QUERY_THROW);
1170 sal_Int32 nIndex = getPositionInIndexAccess(xFunctions, xFunction);
1171 const OUString sUndoAction = RptResId(RID_STR_UNDO_REMOVE_FUNCTION);
1172 UndoContext aUndoContext( getUndoManager(), sUndoAction );
1173 xFunctions->removeByIndex(nIndex);
1174 select(uno::Any(xFunctions->getParent()));
1175 InvalidateFeature( SID_UNDO );
1176 }
1177 }
1178 else
1179 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION,::std::mem_fn(&ODesignView::Delete));
1180 break;
1181 case SID_GRID_USE:
1182 m_bGridUse = !m_bGridUse;
1183 getDesignView()->setGridSnap(m_bGridUse);
1184 break;
1185 case SID_HELPLINES_MOVE:
1186 m_bHelplinesMove = !m_bHelplinesMove;
1187 getDesignView()->setDragStripes(m_bHelplinesMove);
1188 break;
1189 case SID_GRID_VISIBLE:
1190 m_bGridVisible = !m_bGridVisible;
1191 getDesignView()->toggleGrid(m_bGridVisible);
1192 break;
1193 case SID_RULER:
1194 m_bShowRuler = !m_bShowRuler;
1195 getDesignView()->showRuler(m_bShowRuler);
1196 break;
1197 case SID_OBJECT_SELECT:
1198 getDesignView()->SetMode(DlgEdMode::Select);
1199 InvalidateAll();
1200 break;
1201 case SID_INSERT_DIAGRAM:
1202 getDesignView()->SetMode( DlgEdMode::Insert );
1203 getDesignView()->SetInsertObj( SdrObjKind::OLE2);
1204 createDefaultControl(aArgs);
1205 InvalidateAll();
1206 break;
1207 case SID_FM_FIXEDTEXT:
1208 getDesignView()->SetMode( DlgEdMode::Insert );
1209 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignFixedText );
1210 createDefaultControl(aArgs);
1211 InvalidateAll();
1212 break;
1213 case SID_INSERT_HFIXEDLINE:
1214 getDesignView()->SetMode( DlgEdMode::Insert );
1215 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignHorizontalFixedLine );
1216 createDefaultControl(aArgs);
1217 InvalidateAll();
1218 break;
1219 case SID_INSERT_VFIXEDLINE:
1220 getDesignView()->SetMode( DlgEdMode::Insert );
1221 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignVerticalFixedLine );
1222 createDefaultControl(aArgs);
1223 InvalidateAll();
1224 break;
1225 case SID_FM_EDIT:
1226 getDesignView()->SetMode( DlgEdMode::Insert );
1227 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignFormattedField );
1228 createDefaultControl(aArgs);
1229 InvalidateAll();
1230 break;
1231 case SID_FM_IMAGECONTROL:
1232 getDesignView()->SetMode( DlgEdMode::Insert );
1233 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignImageControl );
1234 createDefaultControl(aArgs);
1235 InvalidateAll();
1236 break;
1237 case SID_DRAWTBX_CS_BASIC:
1238 case SID_DRAWTBX_CS_BASIC1:
1239 case SID_DRAWTBX_CS_BASIC2:
1240 case SID_DRAWTBX_CS_BASIC3:
1241 case SID_DRAWTBX_CS_BASIC4:
1242 case SID_DRAWTBX_CS_BASIC5:
1243 case SID_DRAWTBX_CS_BASIC6:
1244 case SID_DRAWTBX_CS_BASIC7:
1245 case SID_DRAWTBX_CS_BASIC8:
1246 case SID_DRAWTBX_CS_BASIC9:
1247 case SID_DRAWTBX_CS_BASIC10:
1248 case SID_DRAWTBX_CS_BASIC11:
1249 case SID_DRAWTBX_CS_BASIC12:
1250 case SID_DRAWTBX_CS_BASIC13:
1251 case SID_DRAWTBX_CS_BASIC14:
1252 case SID_DRAWTBX_CS_BASIC15:
1253 case SID_DRAWTBX_CS_BASIC16:
1254 case SID_DRAWTBX_CS_BASIC17:
1255 case SID_DRAWTBX_CS_BASIC18:
1256 case SID_DRAWTBX_CS_BASIC19:
1257 case SID_DRAWTBX_CS_BASIC20:
1258 case SID_DRAWTBX_CS_BASIC21:
1259 case SID_DRAWTBX_CS_BASIC22:
1260 case SID_DRAWTBX_CS_SYMBOL1:
1261 case SID_DRAWTBX_CS_SYMBOL2:
1262 case SID_DRAWTBX_CS_SYMBOL3:
1263 case SID_DRAWTBX_CS_SYMBOL4:
1264 case SID_DRAWTBX_CS_SYMBOL5:
1265 case SID_DRAWTBX_CS_SYMBOL6:
1266 case SID_DRAWTBX_CS_SYMBOL7:
1267 case SID_DRAWTBX_CS_SYMBOL8:
1268 case SID_DRAWTBX_CS_SYMBOL9:
1269 case SID_DRAWTBX_CS_SYMBOL10:
1270 case SID_DRAWTBX_CS_SYMBOL11:
1271 case SID_DRAWTBX_CS_SYMBOL12:
1272 case SID_DRAWTBX_CS_SYMBOL13:
1273 case SID_DRAWTBX_CS_SYMBOL14:
1274 case SID_DRAWTBX_CS_SYMBOL15:
1275 case SID_DRAWTBX_CS_SYMBOL16:
1276 case SID_DRAWTBX_CS_SYMBOL17:
1277 case SID_DRAWTBX_CS_SYMBOL18:
1278 case SID_DRAWTBX_CS_ARROW1:
1279 case SID_DRAWTBX_CS_ARROW2:
1280 case SID_DRAWTBX_CS_ARROW3:
1281 case SID_DRAWTBX_CS_ARROW4:
1282 case SID_DRAWTBX_CS_ARROW5:
1283 case SID_DRAWTBX_CS_ARROW6:
1284 case SID_DRAWTBX_CS_ARROW7:
1285 case SID_DRAWTBX_CS_ARROW8:
1286 case SID_DRAWTBX_CS_ARROW9:
1287 case SID_DRAWTBX_CS_ARROW10:
1288 case SID_DRAWTBX_CS_ARROW11:
1289 case SID_DRAWTBX_CS_ARROW12:
1290 case SID_DRAWTBX_CS_ARROW13:
1291 case SID_DRAWTBX_CS_ARROW14:
1292 case SID_DRAWTBX_CS_ARROW15:
1293 case SID_DRAWTBX_CS_ARROW16:
1294 case SID_DRAWTBX_CS_ARROW17:
1295 case SID_DRAWTBX_CS_ARROW18:
1296 case SID_DRAWTBX_CS_ARROW19:
1297 case SID_DRAWTBX_CS_ARROW20:
1298 case SID_DRAWTBX_CS_ARROW21:
1299 case SID_DRAWTBX_CS_ARROW22:
1300 case SID_DRAWTBX_CS_ARROW23:
1301 case SID_DRAWTBX_CS_ARROW24:
1302 case SID_DRAWTBX_CS_ARROW25:
1303 case SID_DRAWTBX_CS_ARROW26:
1304 case SID_DRAWTBX_CS_STAR1:
1305 case SID_DRAWTBX_CS_STAR2:
1306 case SID_DRAWTBX_CS_STAR3:
1307 case SID_DRAWTBX_CS_STAR4:
1308 case SID_DRAWTBX_CS_STAR5:
1309 case SID_DRAWTBX_CS_STAR6:
1310 case SID_DRAWTBX_CS_STAR7:
1311 case SID_DRAWTBX_CS_STAR8:
1312 case SID_DRAWTBX_CS_STAR9:
1313 case SID_DRAWTBX_CS_STAR10:
1314 case SID_DRAWTBX_CS_STAR11:
1315 case SID_DRAWTBX_CS_STAR12:
1316 case SID_DRAWTBX_CS_FLOWCHART1:
1317 case SID_DRAWTBX_CS_FLOWCHART2:
1318 case SID_DRAWTBX_CS_FLOWCHART3:
1319 case SID_DRAWTBX_CS_FLOWCHART4:
1320 case SID_DRAWTBX_CS_FLOWCHART5:
1321 case SID_DRAWTBX_CS_FLOWCHART6:
1322 case SID_DRAWTBX_CS_FLOWCHART7:
1323 case SID_DRAWTBX_CS_FLOWCHART8:
1324 case SID_DRAWTBX_CS_FLOWCHART9:
1325 case SID_DRAWTBX_CS_FLOWCHART10:
1326 case SID_DRAWTBX_CS_FLOWCHART11:
1327 case SID_DRAWTBX_CS_FLOWCHART12:
1328 case SID_DRAWTBX_CS_FLOWCHART13:
1329 case SID_DRAWTBX_CS_FLOWCHART14:
1330 case SID_DRAWTBX_CS_FLOWCHART15:
1331 case SID_DRAWTBX_CS_FLOWCHART16:
1332 case SID_DRAWTBX_CS_FLOWCHART17:
1333 case SID_DRAWTBX_CS_FLOWCHART18:
1334 case SID_DRAWTBX_CS_FLOWCHART19:
1335 case SID_DRAWTBX_CS_FLOWCHART20:
1336 case SID_DRAWTBX_CS_FLOWCHART21:
1337 case SID_DRAWTBX_CS_FLOWCHART22:
1338 case SID_DRAWTBX_CS_FLOWCHART23:
1339 case SID_DRAWTBX_CS_FLOWCHART24:
1340 case SID_DRAWTBX_CS_FLOWCHART25:
1341 case SID_DRAWTBX_CS_FLOWCHART26:
1342 case SID_DRAWTBX_CS_FLOWCHART27:
1343 case SID_DRAWTBX_CS_FLOWCHART28:
1344 case SID_DRAWTBX_CS_CALLOUT1:
1345 case SID_DRAWTBX_CS_CALLOUT2:
1346 case SID_DRAWTBX_CS_CALLOUT3:
1347 case SID_DRAWTBX_CS_CALLOUT4:
1348 case SID_DRAWTBX_CS_CALLOUT5:
1349 case SID_DRAWTBX_CS_CALLOUT6:
1350 case SID_DRAWTBX_CS_CALLOUT7:
1351 case SID_DRAWTBX_CS_SYMBOL:
1352 case SID_DRAWTBX_CS_ARROW:
1353 case SID_DRAWTBX_CS_FLOWCHART:
1354 case SID_DRAWTBX_CS_CALLOUT:
1355 case SID_DRAWTBX_CS_STAR:
1356 getDesignView()->SetMode( DlgEdMode::Insert );
1357 {
1358 URL aUrl = getURLForId(_nId);
1359 sal_Int32 nIndex = 1;
1360 std::u16string_view sType = o3tl::getToken(aUrl.Complete, 0,'.',nIndex);
1361 if ( nIndex == -1 || sType.empty() )
1362 {
1363 switch(_nId)
1364 {
1365 case SID_DRAWTBX_CS_SYMBOL:
1366 sType = u"smiley";
1367 break;
1368 case SID_DRAWTBX_CS_ARROW:
1369 sType = u"left-right-arrow";
1370 break;
1371 case SID_DRAWTBX_CS_FLOWCHART:
1372 sType = u"flowchart-internal-storage";
1373 break;
1374 case SID_DRAWTBX_CS_CALLOUT:
1375 sType = u"round-rectangular-callout";
1376 break;
1377 case SID_DRAWTBX_CS_STAR:
1378 sType = u"star5";
1379 break;
1380 default:
1381 sType = u"diamond";
1382 }
1383 }
1384 else
1385 sType = o3tl::getToken(aUrl.Complete, 0,'.',nIndex);
1386
1387 getDesignView()->SetInsertObj( SdrObjKind::CustomShape, OUString(sType));
1388 createDefaultControl(aArgs);
1389 }
1390 InvalidateAll();
1391 break;
1392 case SID_RPT_SHOWREPORTEXPLORER:
1393 if ( isUiVisible() )
1394 getDesignView()->toggleReportExplorer();
1395 break;
1396 case SID_FM_ADD_FIELD:
1397 if ( isUiVisible() )
1398 getDesignView()->toggleAddField();
1399 break;
1400 case SID_SHOW_PROPERTYBROWSER:
1401 if ( m_bShowProperties )
1402 m_sLastActivePage = getDesignView()->getCurrentPage();
1403 else
1404 getDesignView()->setCurrentPage(m_sLastActivePage);
1405
1406 if ( isUiVisible() )
1407 {
1408 m_bShowProperties = !m_bShowProperties;
1409 if ( aArgs.getLength() == 1 )
1410 aArgs[0].Value >>= m_bShowProperties;
1411
1412 getDesignView()->togglePropertyBrowser(m_bShowProperties);
1413 }
1414 break;
1415 case SID_PROPERTYBROWSER_LAST_PAGE: // nothing to do
1416 m_sLastActivePage = getDesignView()->getCurrentPage();
1417 break;
1418 case SID_SPLIT_POSITION:
1419 getDesignView()->Resize();
1420 break;
1421 case SID_PAGEDIALOG:
1422 case SID_ATTR_CHAR_COLOR_BACKGROUND:
1423 {
1424 uno::Reference<report::XSection> xSection;
1425 if (aArgs.getLength() == 1 )
1426 aArgs[0].Value >>= xSection;
1427 else if (_nId == SID_ATTR_CHAR_COLOR_BACKGROUND)
1428 xSection.set(getDesignView()->getMarkedSection()->getReportSection().getSection());
1429 openPageDialog(xSection);
1430 bForceBroadcast = true;
1431 }
1432 break;
1433 case SID_SORTINGANDGROUPING:
1434 openSortingAndGroupingDialog();
1435 break;
1436 case SID_BACKGROUND_COLOR:
1437 {
1438 const util::Color aColor( lcl_extractBackgroundColor( aArgs ) );
1439 if ( !impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CONTROLBACKGROUND,uno::Any(aColor),aArgs) )
1440 {
1441 uno::Reference< report::XSection > xSection = getDesignView()->getCurrentSection();
1442 if ( xSection.is() )
1443 {
1444 xSection->setBackColor( aColor );
1445 }
1446 }
1447 bForceBroadcast = true;
1448 }
1449 break;
1450 case SID_ATTR_CHAR_WEIGHT:
1451 case SID_ATTR_CHAR_POSTURE:
1452 case SID_ATTR_CHAR_UNDERLINE:
1453 {
1454 uno::Reference< awt::XWindow> xWindow;
1455 ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats;
1456 lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats );
1457
1458 const OUString sUndoAction(RptResId(RID_STR_UNDO_CHANGEFONT));
1459 UndoContext aUndoContext( getUndoManager(), sUndoAction );
1460
1461 for (const auto& rxControlFormat : aControlsFormats)
1462 {
1463 uno::Reference< report::XReportControlFormat> xReportControlFormat(rxControlFormat,uno::UNO_QUERY);
1464 lcl_setFontWPU_nothrow(xReportControlFormat,_nId);
1465 }
1466 }
1467 break;
1468 case SID_ATTR_CHAR_COLOR:
1469 case SID_ATTR_CHAR_COLOR2:
1470 case SID_ATTR_CHAR_COLOR_EXT:
1471 {
1472 const util::Color aColor( lcl_extractBackgroundColor( aArgs ) );
1473 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARCOLOR,uno::Any(aColor),aArgs);
1474 bForceBroadcast = true;
1475 }
1476 break;
1477 case SID_ATTR_CHAR_FONT:
1478 if ( aArgs.getLength() == 1 )
1479 {
1480 awt::FontDescriptor aFont;
1481 if ( aArgs[0].Value >>= aFont )
1482 {
1483 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARFONTNAME,uno::Any(aFont.Name),aArgs);
1484 }
1485 }
1486 break;
1487 case SID_ATTR_CHAR_FONTHEIGHT:
1488 if ( aArgs.getLength() == 1 )
1489 {
1490 float fSelVal = 0.0;
1491 if ( aArgs[0].Value >>= fSelVal )
1492 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARHEIGHT,aArgs[0].Value,aArgs);
1493 }
1494 break;
1495 case SID_ATTR_PARA_ADJUST_LEFT:
1496 case SID_ATTR_PARA_ADJUST_CENTER:
1497 case SID_ATTR_PARA_ADJUST_RIGHT:
1498 case SID_ATTR_PARA_ADJUST_BLOCK:
1499 {
1500 style::ParagraphAdjust eParagraphAdjust = style::ParagraphAdjust_LEFT;
1501 switch(_nId)
1502 {
1503 case SID_ATTR_PARA_ADJUST_LEFT:
1504 eParagraphAdjust = style::ParagraphAdjust_LEFT;
1505 break;
1506 case SID_ATTR_PARA_ADJUST_CENTER:
1507 eParagraphAdjust = style::ParagraphAdjust_CENTER;
1508 break;
1509 case SID_ATTR_PARA_ADJUST_RIGHT:
1510 eParagraphAdjust = style::ParagraphAdjust_RIGHT;
1511 break;
1512 case SID_ATTR_PARA_ADJUST_BLOCK:
1513 eParagraphAdjust = style::ParagraphAdjust_BLOCK;
1514 break;
1515 }
1516 impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::Any(static_cast<sal_Int16>(eParagraphAdjust)),aArgs);
1517
1518 InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT);
1519 InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER);
1520 InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT);
1521 InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK);
1522 }
1523 break;
1524 case SID_CHAR_DLG:
1525 {
1526 uno::Sequence< beans::NamedValue > aSettings;
1527 uno::Reference< awt::XWindow> xWindow;
1528 ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats;
1529 lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats );
1530
1531 if ( !aControlsFormats.empty() )
1532 {
1533 const OUString sUndoAction( RptResId( RID_STR_UNDO_CHANGEFONT ) );
1534 UndoContext aUndoContext( getUndoManager(), sUndoAction );
1535
1536 for (const auto& rxControlFormat : aControlsFormats)
1537 {
1538 uno::Reference< report::XReportControlFormat > xFormat( rxControlFormat, uno::UNO_QUERY );
1539 if ( !xFormat.is() )
1540 continue;
1541
1542 if ( !aSettings.hasElements() )
1543 {
1544 ::rptui::openCharDialog( xFormat, xWindow, aSettings );
1545 if ( !aSettings.hasElements() )
1546 break;
1547 }
1548
1549 applyCharacterSettings( xFormat, aSettings );
1550 }
1551
1552 InvalidateAll();
1553 }
1554 }
1555 break;
1556 case SID_INSERT_GRAPHIC:
1557 insertGraphic();
1558 break;
1559 case SID_SETCONTROLDEFAULTS:
1560 break;
1561 case SID_CONDITIONALFORMATTING:
1562 {
1563 uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
1564 if ( xFormattedField.is() )
1565 {
1566 ConditionalFormattingDialog aDlg(getFrameWeld(), xFormattedField, *this);
1567 aDlg.run();
1568 }
1569 }
1570 break;
1571 case SID_DATETIME:
1572 if ( m_xReportDefinition.is() )
1573 {
1574 if ( !aArgs.hasElements() )
1575 {
1576 ODateTimeDialog aDlg(getFrameWeld(), getDesignView()->getCurrentSection(), this);
1577 aDlg.run();
1578 }
1579 else
1580 createDateTime(aArgs);
1581 }
1582 break;
1583 case SID_INSERT_FLD_PGNUMBER:
1584 if ( m_xReportDefinition.is() )
1585 {
1586 if ( !aArgs.hasElements() )
1587 {
1588 OPageNumberDialog aDlg(getFrameWeld(), m_xReportDefinition, this);
1589 aDlg.run();
1590 }
1591 else
1592 createPageNumber(aArgs);
1593 }
1594 break;
1595 case SID_EXPORTDOC:
1596 case SID_EXPORTDOCASPDF:
1597 case SID_PRINTPREVIEW:
1598 break;
1599 case SID_EDITDOC:
1600 if(isEditable())
1601 { // the state should be changed to not editable
1602 setModified(false); // and we are not modified yet
1603 }
1604 setEditable(!isEditable());
1605 InvalidateAll();
1606 return;
1607 case SID_GROUP:
1608 break;
1609 case SID_ATTR_ZOOM:
1610 if ( !aArgs.hasElements() )
1611 {
1612 openZoomDialog();
1613 }
1614 else if ( aArgs.getLength() == 1 && aArgs[0].Name == "Zoom" )
1615 {
1616 SvxZoomItem aZoomItem;
1617 aZoomItem.PutValue(aArgs[0].Value, 0);
1618 m_nZoomValue = aZoomItem.GetValue();
1619 m_eZoomType = aZoomItem.GetType();
1620 impl_zoom_nothrow();
1621 }
1622 break;
1623 case SID_ATTR_ZOOMSLIDER:
1624 if ( aArgs.getLength() == 1 && aArgs[0].Name == "ZoomSlider" )
1625 {
1626 SvxZoomSliderItem aZoomSlider;
1627 aZoomSlider.PutValue(aArgs[0].Value, 0);
1628 m_nZoomValue = aZoomSlider.GetValue();
1629 m_eZoomType = SvxZoomType::PERCENT;
1630 impl_zoom_nothrow();
1631 }
1632 break;
1633 default:
1634 OReportController_BASE::Execute(_nId,aArgs);
1635 }
1636 InvalidateFeature(_nId,Reference< XStatusListener >(),bForceBroadcast);
1637}
1638
1639void OReportController::impl_initialize( )
1640{
1641 OReportController_BASE::impl_initialize();
1642
1643 const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
1644
1645 rArguments.get_ensureType( PROPERTY_REPORTNAME, m_sName );
1646 if ( m_sName.isEmpty() )
1647 rArguments.get_ensureType( "DocumentTitle", m_sName );
1648
1649 try
1650 {
1651 if ( m_xReportDefinition.is() )
1652 {
1653 getView()->initialize(); // show the windows and fill with our information
1654
1655 m_aReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition);
1656 if ( !m_aReportModel )
1657 throw RuntimeException();
1658 m_aReportModel->attachController( *this );
1659
1660 clearUndoManager();
1661 UndoSuppressor aSuppressUndo( getUndoManager() );
1662
1663 setMode(::comphelper::NamedValueCollection::getOrDefault(getModel()->getArgs(), u"Mode", OUString("normal")));
1664
1665 listen(true);
1666 setEditable( !m_aReportModel->IsReadOnly() );
1667 m_xFormatter.set(util::NumberFormatter::create(m_xContext), UNO_QUERY_THROW);
1668 m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY));
1669
1670 utl::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() );
1671 OUString sHierarchicalDocumentName = aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString());
1672
1673 if ( sHierarchicalDocumentName.isEmpty() && getConnection().is() )
1674 {
1675 uno::Reference<sdbcx::XTablesSupplier> xTablesSup(getConnection(),uno::UNO_QUERY_THROW);
1676 uno::Reference<container::XNameAccess> xTables = xTablesSup->getTables();
1677 const uno::Sequence< OUString > aNames( xTables->getElementNames() );
1678
1679 if ( aNames.hasElements() )
1680 {
1681 m_xReportDefinition->setCommand(aNames[0]);
1682 m_xReportDefinition->setCommandType(sdb::CommandType::TABLE);
1683 }
1684 }
1685
1686 m_aVisualAreaSize = m_xReportDefinition->getVisualAreaSize(0);
1687
1688 }
1689
1690 // check if chart is supported by the engine
1691 checkChartEnabled();
1692 // restore the view data
1693 getDesignView()->toggleGrid(m_bGridVisible);
1694 getDesignView()->showRuler(m_bShowRuler);
1695 getDesignView()->togglePropertyBrowser(m_bShowProperties);
1696 getDesignView()->setCurrentPage(m_sLastActivePage);
1697 getDesignView()->unmarkAllObjects();
1698
1699 if ( m_nPageNum != -1 )
1700 {
1701 if ( m_nPageNum < m_aReportModel->GetPageCount() )
1702 {
1703 const OReportPage* pPage = dynamic_cast<OReportPage*>(m_aReportModel->GetPage(static_cast<sal_uInt16>(m_nPageNum)));
1704 if ( pPage )
1705 {
1706 executeUnChecked(SID_SELECT,{ comphelper::makePropertyValue("", pPage->getSection() ) });
1707 }
1708 }
1709 else
1710 m_nPageNum = -1;
1711 }
1712 getDesignView()->collapseSections(m_aCollapsedSections);
1713 impl_zoom_nothrow();
1714 getDesignView()->Resize();
1715 getDesignView()->Invalidate();
1716 InvalidateAll();
1717
1718 if ( m_bShowProperties && m_nPageNum == -1 )
1719 {
1720 m_sLastActivePage = "Data";
1721 getDesignView()->setCurrentPage(m_sLastActivePage);
1722 executeUnChecked(SID_SELECT_REPORT,{});
1723 }
1724
1725 setModified(false); // and we are not modified yet
1726 }
1727 catch(const SQLException&)
1728 {
1729 DBG_UNHANDLED_EXCEPTION("reportdesign");
1730 }
1731}
1732
1733IMPL_LINK( OReportController, OnCreateHdl, OAddFieldWindow& ,_rAddFieldDlg, void)
1734{
1735 weld::WaitObject aObj(getFrameWeld());
1736 uno::Sequence< beans::PropertyValue > aArgs = _rAddFieldDlg.getSelectedFieldDescriptors();
1737 // we use this way to create undo actions
1738 if ( aArgs.hasElements() )
1739 {
1740 executeChecked(SID_ADD_CONTROL_PAIR,aArgs);
1741 }
1742}
1743
1744bool OReportController::Construct(vcl::Window* pParent)
1745{
1746 VclPtrInstance<ODesignView> pMyOwnView( pParent, m_xContext, *this );
1747 StartListening( *pMyOwnView );
1748 setView( pMyOwnView );
1749
1750 // now that we have a view we can create the clipboard listener
1752 m_aSystemClipboard.StartClipboardListening( );
1753 m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, OReportController, OnClipboardChanged ) );
1754 m_pClipboardNotifier->AddListener( getView() );
1755
1756 OReportController_BASE::Construct(pParent);
1757 return true;
1758}
1759
1760sal_Bool SAL_CALL OReportController::suspend(sal_Bool /*_bSuspend*/)
1761{
1762 if ( getBroadcastHelper().bInDispose || getBroadcastHelper().bDisposed )
1763 return true;
1764
1765 SolarMutexGuard aSolarGuard;
1766 ::osl::MutexGuard aGuard( getMutex() );
1767
1768 if ( getView() && getView()->IsInModalMode() )
1769 return false;
1770
1771 // this suspend will be handled in the DBAccess interceptor implementation
1772 return true;
1773}
1774
1775void OReportController::describeSupportedFeatures()
1776{
1777 DBSubComponentController::describeSupportedFeatures();
1778
1779 implDescribeSupportedFeature( ".uno:TextDocument", SID_RPT_TEXTDOCUMENT, CommandGroup::APPLICATION );
1780 implDescribeSupportedFeature( ".uno:Spreadsheet", SID_RPT_SPREADSHEET, CommandGroup::APPLICATION );
1781
1782 implDescribeSupportedFeature( ".uno:Redo", SID_REDO, CommandGroup::EDIT );
1783 implDescribeSupportedFeature( ".uno:Undo", SID_UNDO, CommandGroup::EDIT );
1784 implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
1785 implDescribeSupportedFeature( ".uno:SelectAllInSection", SID_SELECTALL_IN_SECTION, CommandGroup::EDIT );
1786 implDescribeSupportedFeature( ".uno:Delete", SID_DELETE, CommandGroup::EDIT );
1787 implDescribeSupportedFeature( ".uno:SelectReport", SID_SELECT_REPORT, CommandGroup::EDIT );
1788 implDescribeSupportedFeature( ".uno:ExecuteReport", SID_EXECUTE_REPORT, CommandGroup::EDIT );
1789
1790 implDescribeSupportedFeature( ".uno:GridVisible", SID_GRID_VISIBLE, CommandGroup::VIEW );
1791 implDescribeSupportedFeature( ".uno:GridUse", SID_GRID_USE, CommandGroup::VIEW );
1792 implDescribeSupportedFeature( ".uno:HelplinesMove", SID_HELPLINES_MOVE, CommandGroup::VIEW );
1793 implDescribeSupportedFeature( ".uno:ShowRuler", SID_RULER, CommandGroup::VIEW );
1794 implDescribeSupportedFeature( ".uno:AddField", SID_FM_ADD_FIELD, CommandGroup::VIEW );
1795 implDescribeSupportedFeature( ".uno:ReportNavigator", SID_RPT_SHOWREPORTEXPLORER, CommandGroup::VIEW );
1796 implDescribeSupportedFeature( ".uno:ControlProperties", SID_SHOW_PROPERTYBROWSER, CommandGroup::VIEW );
1797 implDescribeSupportedFeature( ".uno:DbSortingAndGrouping", SID_SORTINGANDGROUPING, CommandGroup::VIEW );
1798 implDescribeSupportedFeature( ".uno:PageHeaderFooter", SID_PAGEHEADERFOOTER, CommandGroup::VIEW );
1799 implDescribeSupportedFeature( ".uno:ReportHeaderFooter", SID_REPORTHEADERFOOTER, CommandGroup::VIEW );
1800 implDescribeSupportedFeature( ".uno:ZoomSlider", SID_ATTR_ZOOMSLIDER );
1801 implDescribeSupportedFeature( ".uno:Zoom", SID_ATTR_ZOOM, CommandGroup::VIEW );
1802
1803 implDescribeSupportedFeature( ".uno:ConditionalFormatting", SID_CONDITIONALFORMATTING, CommandGroup::FORMAT );
1804 implDescribeSupportedFeature( ".uno:PageDialog", SID_PAGEDIALOG, CommandGroup::FORMAT );
1805 implDescribeSupportedFeature( ".uno:ResetAttributes", SID_SETCONTROLDEFAULTS, CommandGroup::FORMAT );
1806
1807 implDescribeSupportedFeature( ".uno:Bold", SID_ATTR_CHAR_WEIGHT, CommandGroup::FORMAT );
1808 implDescribeSupportedFeature( ".uno:Italic", SID_ATTR_CHAR_POSTURE, CommandGroup::FORMAT );
1809 implDescribeSupportedFeature( ".uno:Underline", SID_ATTR_CHAR_UNDERLINE, CommandGroup::FORMAT );
1810 implDescribeSupportedFeature( ".uno:DBBackgroundColor", SID_ATTR_CHAR_COLOR_BACKGROUND, CommandGroup::FORMAT );
1811 implDescribeSupportedFeature( ".uno:BackgroundColor", SID_BACKGROUND_COLOR, CommandGroup::FORMAT );
1812 implDescribeSupportedFeature( ".uno:CharColorExt", SID_ATTR_CHAR_COLOR_EXT);
1813 implDescribeSupportedFeature( ".uno:Color", SID_ATTR_CHAR_COLOR);
1814 implDescribeSupportedFeature( ".uno:FontColor", SID_ATTR_CHAR_COLOR2, CommandGroup::FORMAT );
1815 implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG, CommandGroup::FORMAT );
1816 implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT, CommandGroup::FORMAT );
1817 implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER, CommandGroup::FORMAT );
1818 implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT, CommandGroup::FORMAT );
1819 implDescribeSupportedFeature( ".uno:JustifyPara", SID_ATTR_PARA_ADJUST_BLOCK, CommandGroup::FORMAT );
1820
1821 implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT, CommandGroup::FORMAT );
1822 implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT, CommandGroup::FORMAT );
1823
1824 implDescribeSupportedFeature( ".uno:ArrangeMenu", SID_ARRANGEMENU, CommandGroup::FORMAT );
1825 implDescribeSupportedFeature( ".uno:BringToFront", SID_FRAME_TO_TOP, CommandGroup::FORMAT );
1826 implDescribeSupportedFeature( ".uno:ObjectBackOne", SID_FRAME_DOWN, CommandGroup::FORMAT );
1827 implDescribeSupportedFeature( ".uno:ObjectForwardOne", SID_FRAME_UP, CommandGroup::FORMAT );
1828 implDescribeSupportedFeature( ".uno:SendToBack", SID_FRAME_TO_BOTTOM, CommandGroup::FORMAT );
1829 implDescribeSupportedFeature( ".uno:SetObjectToForeground", SID_OBJECT_HEAVEN, CommandGroup::FORMAT );
1830 implDescribeSupportedFeature( ".uno:SetObjectToBackground", SID_OBJECT_HELL, CommandGroup::FORMAT );
1831
1832 implDescribeSupportedFeature( ".uno:ObjectAlign", SID_OBJECT_ALIGN, CommandGroup::FORMAT );
1833 implDescribeSupportedFeature( ".uno:ObjectAlignLeft", SID_OBJECT_ALIGN_LEFT, CommandGroup::FORMAT );
1834 implDescribeSupportedFeature( ".uno:AlignCenter", SID_OBJECT_ALIGN_CENTER, CommandGroup::FORMAT );
1835 implDescribeSupportedFeature( ".uno:ObjectAlignRight", SID_OBJECT_ALIGN_RIGHT, CommandGroup::FORMAT );
1836 implDescribeSupportedFeature( ".uno:AlignUp", SID_OBJECT_ALIGN_UP, CommandGroup::FORMAT );
1837 implDescribeSupportedFeature( ".uno:AlignMiddle", SID_OBJECT_ALIGN_MIDDLE, CommandGroup::FORMAT );
1838 implDescribeSupportedFeature( ".uno:AlignDown", SID_OBJECT_ALIGN_DOWN, CommandGroup::FORMAT );
1839
1840 implDescribeSupportedFeature( ".uno:SectionAlign", SID_SECTION_ALIGN );
1841 implDescribeSupportedFeature( ".uno:SectionAlignLeft", SID_SECTION_ALIGN_LEFT, CommandGroup::FORMAT );
1842 implDescribeSupportedFeature( ".uno:SectionAlignCenter", SID_SECTION_ALIGN_CENTER, CommandGroup::FORMAT );
1843 implDescribeSupportedFeature( ".uno:SectionAlignRight", SID_SECTION_ALIGN_RIGHT, CommandGroup::FORMAT );
1844 implDescribeSupportedFeature( ".uno:SectionAlignTop", SID_SECTION_ALIGN_UP, CommandGroup::FORMAT );
1845 implDescribeSupportedFeature( ".uno:SectionAlignMiddle", SID_SECTION_ALIGN_MIDDLE, CommandGroup::FORMAT );
1846 implDescribeSupportedFeature( ".uno:SectionAlignBottom", SID_SECTION_ALIGN_DOWN, CommandGroup::FORMAT );
1847 implDescribeSupportedFeature( ".uno:SectionShrink", SID_SECTION_SHRINK, CommandGroup::FORMAT );
1848 implDescribeSupportedFeature( ".uno:SectionShrinkTop", SID_SECTION_SHRINK_TOP, CommandGroup::FORMAT );
1849 implDescribeSupportedFeature( ".uno:SectionShrinkBottom", SID_SECTION_SHRINK_BOTTOM, CommandGroup::FORMAT );
1850
1851 implDescribeSupportedFeature( ".uno:ObjectResize", SID_OBJECT_RESIZING, CommandGroup::FORMAT );
1852 implDescribeSupportedFeature( ".uno:SmallestWidth", SID_OBJECT_SMALLESTWIDTH, CommandGroup::FORMAT );
1853 implDescribeSupportedFeature( ".uno:SmallestHeight", SID_OBJECT_SMALLESTHEIGHT, CommandGroup::FORMAT );
1854 implDescribeSupportedFeature( ".uno:GreatestWidth", SID_OBJECT_GREATESTWIDTH, CommandGroup::FORMAT );
1855 implDescribeSupportedFeature( ".uno:GreatestHeight", SID_OBJECT_GREATESTHEIGHT, CommandGroup::FORMAT );
1856
1857 implDescribeSupportedFeature( ".uno:DistributeSelection", SID_DISTRIBUTE_DLG, CommandGroup::FORMAT );
1858 implDescribeSupportedFeature( ".uno:DistributeHorzLeft", SID_DISTRIBUTE_HLEFT, CommandGroup::FORMAT );
1859 implDescribeSupportedFeature( ".uno:DistributeHorzCenter", SID_DISTRIBUTE_HCENTER, CommandGroup::FORMAT );
1860 implDescribeSupportedFeature( ".uno:DistributeHorzDistance", SID_DISTRIBUTE_HDISTANCE, CommandGroup::FORMAT );
1861 implDescribeSupportedFeature( ".uno:DistributeHorzRight", SID_DISTRIBUTE_HRIGHT, CommandGroup::FORMAT );
1862 implDescribeSupportedFeature( ".uno:DistributeVertTop", SID_DISTRIBUTE_VTOP, CommandGroup::FORMAT );
1863 implDescribeSupportedFeature( ".uno:DistributeVertCenter", SID_DISTRIBUTE_VCENTER, CommandGroup::FORMAT );
1864 implDescribeSupportedFeature( ".uno:DistributeVertDistance", SID_DISTRIBUTE_VDISTANCE, CommandGroup::FORMAT );
1865 implDescribeSupportedFeature( ".uno:DistributeVertBottom", SID_DISTRIBUTE_VBOTTOM, CommandGroup::FORMAT );
1866
1867 implDescribeSupportedFeature( ".uno:ExportTo", SID_EXPORTDOC, CommandGroup::APPLICATION );
1868 implDescribeSupportedFeature( ".uno:ExportToPDF", SID_EXPORTDOCASPDF, CommandGroup::APPLICATION );
1869 implDescribeSupportedFeature( ".uno:PrintPreview", SID_PRINTPREVIEW, CommandGroup::APPLICATION );
1870
1871 implDescribeSupportedFeature( ".uno:NewDoc", SID_NEWDOC, CommandGroup::DOCUMENT );
1872 implDescribeSupportedFeature( ".uno:Save", SID_SAVEDOC, CommandGroup::DOCUMENT );
1873 implDescribeSupportedFeature( ".uno:SaveAs", SID_SAVEASDOC, CommandGroup::DOCUMENT );
1874 implDescribeSupportedFeature( ".uno:SaveACopy", SID_SAVEACOPY, CommandGroup::DOCUMENT );
1875
1876 implDescribeSupportedFeature( ".uno:InsertPageNumberField", SID_INSERT_FLD_PGNUMBER, CommandGroup::INSERT );
1877 implDescribeSupportedFeature( ".uno:InsertDateTimeField", SID_DATETIME, CommandGroup::INSERT );
1878 implDescribeSupportedFeature( ".uno:InsertObjectChart", SID_INSERT_DIAGRAM, CommandGroup::INSERT );
1879 implDescribeSupportedFeature( ".uno:InsertGraphic", SID_INSERT_GRAPHIC, CommandGroup::INSERT );
1880 // controls
1881 implDescribeSupportedFeature( ".uno:SelectObject", SID_OBJECT_SELECT, CommandGroup::INSERT );
1882 implDescribeSupportedFeature( ".uno:Label", SID_FM_FIXEDTEXT, CommandGroup::INSERT );
1883 implDescribeSupportedFeature( ".uno:Edit", SID_FM_EDIT, CommandGroup::INSERT );
1884 implDescribeSupportedFeature( ".uno:ImageControl", SID_FM_IMAGECONTROL, CommandGroup::INSERT );
1885 implDescribeSupportedFeature( ".uno:HFixedLine", SID_INSERT_HFIXEDLINE, CommandGroup::INSERT );
1886 implDescribeSupportedFeature( ".uno:VFixedLine", SID_INSERT_VFIXEDLINE, CommandGroup::INSERT );
1887
1888 // shapes
1889 implDescribeSupportedFeature( ".uno:BasicShapes", SID_DRAWTBX_CS_BASIC, CommandGroup::INSERT );
1890 implDescribeSupportedFeature( ".uno:BasicShapes.rectangle", SID_DRAWTBX_CS_BASIC1, CommandGroup::INSERT );
1891 implDescribeSupportedFeature( ".uno:BasicShapes.round-rectangle",SID_DRAWTBX_CS_BASIC2, CommandGroup::INSERT );
1892 implDescribeSupportedFeature( ".uno:BasicShapes.quadrat", SID_DRAWTBX_CS_BASIC3, CommandGroup::INSERT );
1893 implDescribeSupportedFeature( ".uno:BasicShapes.round-quadrat", SID_DRAWTBX_CS_BASIC4, CommandGroup::INSERT );
1894 implDescribeSupportedFeature( ".uno:BasicShapes.circle", SID_DRAWTBX_CS_BASIC5, CommandGroup::INSERT );
1895 implDescribeSupportedFeature( ".uno:BasicShapes.ellipse", SID_DRAWTBX_CS_BASIC6, CommandGroup::INSERT );
1896 implDescribeSupportedFeature( ".uno:BasicShapes.circle-pie", SID_DRAWTBX_CS_BASIC7, CommandGroup::INSERT );
1897 implDescribeSupportedFeature( ".uno:BasicShapes.isosceles-triangle",SID_DRAWTBX_CS_BASIC8, CommandGroup::INSERT );
1898 implDescribeSupportedFeature( ".uno:BasicShapes.right-triangle",SID_DRAWTBX_CS_BASIC9, CommandGroup::INSERT );
1899 implDescribeSupportedFeature( ".uno:BasicShapes.trapezoid", SID_DRAWTBX_CS_BASIC10, CommandGroup::INSERT );
1900 implDescribeSupportedFeature( ".uno:BasicShapes.diamond", SID_DRAWTBX_CS_BASIC11, CommandGroup::INSERT );
1901 implDescribeSupportedFeature( ".uno:BasicShapes.parallelogram", SID_DRAWTBX_CS_BASIC12, CommandGroup::INSERT );
1902 implDescribeSupportedFeature( ".uno:BasicShapes.pentagon", SID_DRAWTBX_CS_BASIC13, CommandGroup::INSERT );
1903 implDescribeSupportedFeature( ".uno:BasicShapes.hexagon", SID_DRAWTBX_CS_BASIC14, CommandGroup::INSERT );
1904 implDescribeSupportedFeature( ".uno:BasicShapes.octagon", SID_DRAWTBX_CS_BASIC15, CommandGroup::INSERT );
1905 implDescribeSupportedFeature( ".uno:BasicShapes.cross", SID_DRAWTBX_CS_BASIC16, CommandGroup::INSERT );
1906 implDescribeSupportedFeature( ".uno:BasicShapes.ring", SID_DRAWTBX_CS_BASIC17, CommandGroup::INSERT );
1907 implDescribeSupportedFeature( ".uno:BasicShapes.block-arc", SID_DRAWTBX_CS_BASIC18, CommandGroup::INSERT );
1908 implDescribeSupportedFeature( ".uno:BasicShapes.can", SID_DRAWTBX_CS_BASIC19, CommandGroup::INSERT );
1909 implDescribeSupportedFeature( ".uno:BasicShapes.cube", SID_DRAWTBX_CS_BASIC20, CommandGroup::INSERT );
1910 implDescribeSupportedFeature( ".uno:BasicShapes.paper", SID_DRAWTBX_CS_BASIC21, CommandGroup::INSERT );
1911 implDescribeSupportedFeature( ".uno:BasicShapes.frame", SID_DRAWTBX_CS_BASIC22, CommandGroup::INSERT );
1912
1913 implDescribeSupportedFeature( ".uno:SymbolShapes", SID_DRAWTBX_CS_SYMBOL, CommandGroup::INSERT );
1914
1915 implDescribeSupportedFeature( ".uno:SymbolShapes.smiley" , SID_DRAWTBX_CS_SYMBOL1, CommandGroup::INSERT );
1916 implDescribeSupportedFeature( ".uno:SymbolShapes.sun" , SID_DRAWTBX_CS_SYMBOL2, CommandGroup::INSERT );
1917 implDescribeSupportedFeature( ".uno:SymbolShapes.moon" , SID_DRAWTBX_CS_SYMBOL3, CommandGroup::INSERT );
1918 implDescribeSupportedFeature( ".uno:SymbolShapes.lightning" , SID_DRAWTBX_CS_SYMBOL4, CommandGroup::INSERT );
1919 implDescribeSupportedFeature( ".uno:SymbolShapes.heart" , SID_DRAWTBX_CS_SYMBOL5, CommandGroup::INSERT );
1920 implDescribeSupportedFeature( ".uno:SymbolShapes.flower" , SID_DRAWTBX_CS_SYMBOL6, CommandGroup::INSERT );
1921 implDescribeSupportedFeature( ".uno:SymbolShapes.cloud" , SID_DRAWTBX_CS_SYMBOL7, CommandGroup::INSERT );
1922 implDescribeSupportedFeature( ".uno:SymbolShapes.forbidden" , SID_DRAWTBX_CS_SYMBOL8, CommandGroup::INSERT );
1923 implDescribeSupportedFeature( ".uno:SymbolShapes.puzzle" , SID_DRAWTBX_CS_SYMBOL9, CommandGroup::INSERT );
1924 implDescribeSupportedFeature( ".uno:SymbolShapes.bracket-pair" ,SID_DRAWTBX_CS_SYMBOL10, CommandGroup::INSERT );
1925 implDescribeSupportedFeature( ".uno:SymbolShapes.left-bracket" ,SID_DRAWTBX_CS_SYMBOL11, CommandGroup::INSERT );
1926 implDescribeSupportedFeature( ".uno:SymbolShapes.right-bracket",SID_DRAWTBX_CS_SYMBOL12, CommandGroup::INSERT );
1927 implDescribeSupportedFeature( ".uno:SymbolShapes.brace-pair" , SID_DRAWTBX_CS_SYMBOL13, CommandGroup::INSERT );
1928 implDescribeSupportedFeature( ".uno:SymbolShapes.left-brace" , SID_DRAWTBX_CS_SYMBOL14, CommandGroup::INSERT );
1929 implDescribeSupportedFeature( ".uno:SymbolShapes.right-brace" , SID_DRAWTBX_CS_SYMBOL15, CommandGroup::INSERT );
1930 implDescribeSupportedFeature( ".uno:SymbolShapes.quad-bevel" , SID_DRAWTBX_CS_SYMBOL16, CommandGroup::INSERT );
1931 implDescribeSupportedFeature( ".uno:SymbolShapes.octagon-bevel",SID_DRAWTBX_CS_SYMBOL17, CommandGroup::INSERT );
1932 implDescribeSupportedFeature( ".uno:SymbolShapes.diamond-bevel",SID_DRAWTBX_CS_SYMBOL18, CommandGroup::INSERT );
1933
1934 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow" , SID_DRAWTBX_CS_ARROW1, CommandGroup::INSERT );
1935 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow" , SID_DRAWTBX_CS_ARROW2, CommandGroup::INSERT );
1936 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow" , SID_DRAWTBX_CS_ARROW3, CommandGroup::INSERT );
1937 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow" , SID_DRAWTBX_CS_ARROW4, CommandGroup::INSERT );
1938 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow" , SID_DRAWTBX_CS_ARROW5, CommandGroup::INSERT );
1939 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow" , SID_DRAWTBX_CS_ARROW6, CommandGroup::INSERT );
1940 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow" , SID_DRAWTBX_CS_ARROW7, CommandGroup::INSERT );
1941 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-down-arrow" , SID_DRAWTBX_CS_ARROW8, CommandGroup::INSERT );
1942 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow" , SID_DRAWTBX_CS_ARROW9, CommandGroup::INSERT );
1943 implDescribeSupportedFeature( ".uno:ArrowShapes.corner-right-arrow" , SID_DRAWTBX_CS_ARROW10, CommandGroup::INSERT );
1944 implDescribeSupportedFeature( ".uno:ArrowShapes.split-arrow" , SID_DRAWTBX_CS_ARROW11, CommandGroup::INSERT );
1945 implDescribeSupportedFeature( ".uno:ArrowShapes.striped-right-arrow" , SID_DRAWTBX_CS_ARROW12, CommandGroup::INSERT );
1946 implDescribeSupportedFeature( ".uno:ArrowShapes.notched-right-arrow" , SID_DRAWTBX_CS_ARROW13, CommandGroup::INSERT );
1947 implDescribeSupportedFeature( ".uno:ArrowShapes.pentagon-right" , SID_DRAWTBX_CS_ARROW14, CommandGroup::INSERT );
1948 implDescribeSupportedFeature( ".uno:ArrowShapes.chevron" , SID_DRAWTBX_CS_ARROW15, CommandGroup::INSERT );
1949 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow-callout" , SID_DRAWTBX_CS_ARROW16, CommandGroup::INSERT );
1950 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow-callout" , SID_DRAWTBX_CS_ARROW17, CommandGroup::INSERT );
1951 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow-callout" , SID_DRAWTBX_CS_ARROW18, CommandGroup::INSERT );
1952 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow-callout" , SID_DRAWTBX_CS_ARROW19, CommandGroup::INSERT );
1953 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow-callout",SID_DRAWTBX_CS_ARROW20, CommandGroup::INSERT );
1954 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow-callout" ,SID_DRAWTBX_CS_ARROW21, CommandGroup::INSERT );
1955 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow-callout",SID_DRAWTBX_CS_ARROW22, CommandGroup::INSERT );
1956 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow-callout" , SID_DRAWTBX_CS_ARROW23, CommandGroup::INSERT );
1957 implDescribeSupportedFeature( ".uno:ArrowShapes.circular-arrow" , SID_DRAWTBX_CS_ARROW24, CommandGroup::INSERT );
1958 implDescribeSupportedFeature( ".uno:ArrowShapes.split-round-arrow" , SID_DRAWTBX_CS_ARROW25, CommandGroup::INSERT );
1959 implDescribeSupportedFeature( ".uno:ArrowShapes.s-sharped-arrow" , SID_DRAWTBX_CS_ARROW26, CommandGroup::INSERT );
1960
1961 implDescribeSupportedFeature( ".uno:StarShapes.bang" , SID_DRAWTBX_CS_STAR1, CommandGroup::INSERT );
1962 implDescribeSupportedFeature( ".uno:StarShapes.star4" , SID_DRAWTBX_CS_STAR2, CommandGroup::INSERT );
1963 implDescribeSupportedFeature( ".uno:StarShapes.star5" , SID_DRAWTBX_CS_STAR3, CommandGroup::INSERT );
1964 implDescribeSupportedFeature( ".uno:StarShapes.star6" , SID_DRAWTBX_CS_STAR4, CommandGroup::INSERT );
1965 implDescribeSupportedFeature( ".uno:StarShapes.star8" , SID_DRAWTBX_CS_STAR5, CommandGroup::INSERT );
1966 implDescribeSupportedFeature( ".uno:StarShapes.star12" , SID_DRAWTBX_CS_STAR6, CommandGroup::INSERT );
1967 implDescribeSupportedFeature( ".uno:StarShapes.star24" , SID_DRAWTBX_CS_STAR7, CommandGroup::INSERT );
1968 implDescribeSupportedFeature( ".uno:StarShapes.concave-star6" , SID_DRAWTBX_CS_STAR8, CommandGroup::INSERT );
1969 implDescribeSupportedFeature( ".uno:StarShapes.vertical-scroll" , SID_DRAWTBX_CS_STAR9, CommandGroup::INSERT );
1970 implDescribeSupportedFeature( ".uno:StarShapes.horizontal-scroll" , SID_DRAWTBX_CS_STAR10, CommandGroup::INSERT );
1971 implDescribeSupportedFeature( ".uno:StarShapes.signet" , SID_DRAWTBX_CS_STAR11, CommandGroup::INSERT );
1972 implDescribeSupportedFeature( ".uno:StarShapes.doorplate" , SID_DRAWTBX_CS_STAR12, CommandGroup::INSERT );
1973
1974 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-process" , SID_DRAWTBX_CS_FLOWCHART1, CommandGroup::INSERT );
1975 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-alternate-process" , SID_DRAWTBX_CS_FLOWCHART2, CommandGroup::INSERT );
1976 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-decision" , SID_DRAWTBX_CS_FLOWCHART3, CommandGroup::INSERT );
1977 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-data" , SID_DRAWTBX_CS_FLOWCHART4, CommandGroup::INSERT );
1978 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-predefined-process" , SID_DRAWTBX_CS_FLOWCHART5, CommandGroup::INSERT );
1979 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-internal-storage" , SID_DRAWTBX_CS_FLOWCHART6, CommandGroup::INSERT );
1980 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-document" , SID_DRAWTBX_CS_FLOWCHART7, CommandGroup::INSERT );
1981 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-multidocument" , SID_DRAWTBX_CS_FLOWCHART8, CommandGroup::INSERT );
1982 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-terminator" , SID_DRAWTBX_CS_FLOWCHART9, CommandGroup::INSERT );
1983 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-preparation" , SID_DRAWTBX_CS_FLOWCHART10, CommandGroup::INSERT );
1984 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-input" , SID_DRAWTBX_CS_FLOWCHART11, CommandGroup::INSERT );
1985 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-operation" , SID_DRAWTBX_CS_FLOWCHART12, CommandGroup::INSERT );
1986 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-connector" , SID_DRAWTBX_CS_FLOWCHART13, CommandGroup::INSERT );
1987 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-off-page-connector" , SID_DRAWTBX_CS_FLOWCHART14, CommandGroup::INSERT );
1988 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-card" , SID_DRAWTBX_CS_FLOWCHART15, CommandGroup::INSERT );
1989 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-punched-tape" , SID_DRAWTBX_CS_FLOWCHART16, CommandGroup::INSERT );
1990 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-summing-junction" , SID_DRAWTBX_CS_FLOWCHART17, CommandGroup::INSERT );
1991 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-or" , SID_DRAWTBX_CS_FLOWCHART18, CommandGroup::INSERT );
1992 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-collate" , SID_DRAWTBX_CS_FLOWCHART19, CommandGroup::INSERT );
1993 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sort" , SID_DRAWTBX_CS_FLOWCHART20, CommandGroup::INSERT );
1994 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-extract" , SID_DRAWTBX_CS_FLOWCHART21, CommandGroup::INSERT );
1995 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-merge" , SID_DRAWTBX_CS_FLOWCHART22, CommandGroup::INSERT );
1996 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-stored-data" , SID_DRAWTBX_CS_FLOWCHART23, CommandGroup::INSERT );
1997 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-delay" , SID_DRAWTBX_CS_FLOWCHART24, CommandGroup::INSERT );
1998 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sequential-access" , SID_DRAWTBX_CS_FLOWCHART25, CommandGroup::INSERT );
1999 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-magnetic-disk" , SID_DRAWTBX_CS_FLOWCHART26, CommandGroup::INSERT );
2000 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-direct-access-storage",SID_DRAWTBX_CS_FLOWCHART27, CommandGroup::INSERT );
2001 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-display" , SID_DRAWTBX_CS_FLOWCHART28, CommandGroup::INSERT );
2002
2003 implDescribeSupportedFeature( ".uno:CalloutShapes.rectangular-callout" , SID_DRAWTBX_CS_CALLOUT1, CommandGroup::INSERT );
2004 implDescribeSupportedFeature( ".uno:CalloutShapes.round-rectangular-callout" , SID_DRAWTBX_CS_CALLOUT2, CommandGroup::INSERT );
2005 implDescribeSupportedFeature( ".uno:CalloutShapes.round-callout" , SID_DRAWTBX_CS_CALLOUT3, CommandGroup::INSERT );
2006 implDescribeSupportedFeature( ".uno:CalloutShapes.cloud-callout" , SID_DRAWTBX_CS_CALLOUT4, CommandGroup::INSERT );
2007 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-1" , SID_DRAWTBX_CS_CALLOUT5, CommandGroup::INSERT );
2008 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-2" , SID_DRAWTBX_CS_CALLOUT6, CommandGroup::INSERT );
2009 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-3" , SID_DRAWTBX_CS_CALLOUT7, CommandGroup::INSERT );
2010
2011 implDescribeSupportedFeature( ".uno:ArrowShapes", SID_DRAWTBX_CS_ARROW, CommandGroup::INSERT );
2012
2013 implDescribeSupportedFeature( ".uno:FlowChartShapes", SID_DRAWTBX_CS_FLOWCHART, CommandGroup::INSERT );
2014 implDescribeSupportedFeature( ".uno:CalloutShapes", SID_DRAWTBX_CS_CALLOUT, CommandGroup::INSERT );
2015 implDescribeSupportedFeature( ".uno:StarShapes", SID_DRAWTBX_CS_STAR, CommandGroup::INSERT );
2016
2017
2018 // keys
2019 implDescribeSupportedFeature( ".uno:Escape", SID_ESCAPE);
2020
2021 // internal one
2022 implDescribeSupportedFeature( ".uno:RPT_RPTHEADER_UNDO", SID_REPORTHEADER_WITHOUT_UNDO);
2023 implDescribeSupportedFeature( ".uno:RPT_RPTFOOTER_UNDO", SID_REPORTFOOTER_WITHOUT_UNDO);
2024 implDescribeSupportedFeature( ".uno:RPT_PGHEADER_UNDO", SID_PAGEHEADER_WITHOUT_UNDO);
2025 implDescribeSupportedFeature( ".uno:RPT_PGFOOTER_UNDO", SID_PAGEFOOTER_WITHOUT_UNDO);
2026 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER", SID_GROUPHEADER);
2027 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER_WITHOUT_UNDO", SID_GROUPHEADER_WITHOUT_UNDO);
2028 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER", SID_GROUPFOOTER);
2029 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER_WITHOUT_UNDO", SID_GROUPFOOTER_WITHOUT_UNDO);
2030 implDescribeSupportedFeature( ".uno:SID_GROUP_REMOVE", SID_GROUP_REMOVE);
2031 implDescribeSupportedFeature( ".uno:SID_GROUP_APPEND", SID_GROUP_APPEND);
2032 implDescribeSupportedFeature( ".uno:SID_ADD_CONTROL_PAIR", SID_ADD_CONTROL_PAIR);
2033 implDescribeSupportedFeature( ".uno:SplitPosition", SID_SPLIT_POSITION);
2034 implDescribeSupportedFeature( ".uno:LastPropertyBrowserPage", SID_PROPERTYBROWSER_LAST_PAGE);
2035 implDescribeSupportedFeature( ".uno:Select", SID_SELECT);
2036 implDescribeSupportedFeature( ".uno:InsertFunction", SID_RPT_NEW_FUNCTION);
2037 implDescribeSupportedFeature( ".uno:NextMark", SID_NEXT_MARK);
2038 implDescribeSupportedFeature( ".uno:PrevMark", SID_PREV_MARK);
2039 implDescribeSupportedFeature( ".uno:TerminateInplaceActivation", SID_TERMINATE_INPLACEACTIVATION);
2040 implDescribeSupportedFeature( ".uno:SelectAllLabels", SID_SELECT_ALL_LABELS);
2041 implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS);
2042 implDescribeSupportedFeature( ".uno:CollapseSection", SID_COLLAPSE_SECTION);
2043 implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION);
2044 implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS);
2045 implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS);
2046}
2047
2048void OReportController::impl_onModifyChanged()
2049{
2050 try
2051 {
2052 if ( m_xReportDefinition.is() )
2053 m_xReportDefinition->setModified( impl_isModified() );
2054 DBSubComponentController::impl_onModifyChanged();
2055 }
2056 catch(const uno::Exception&)
2057 {
2058 DBG_UNHANDLED_EXCEPTION("reportdesign");
2059 }
2060}
2061
2062void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _xLayoutManager)
2063{
2064 if ( !_xLayoutManager.is() )
2065 return;
2066
2067 static const std::u16string_view s_sMenu[] = {
2068 u"private:resource/statusbar/statusbar"
2069 ,u"private:resource/toolbar/reportcontrols"
2070 ,u"private:resource/toolbar/drawbar"
2071 ,u"private:resource/toolbar/Formatting"
2072 ,u"private:resource/toolbar/alignmentbar"
2073 ,u"private:resource/toolbar/sectionalignmentbar"
2074 ,u"private:resource/toolbar/resizebar"
2075 ,u"private:resource/toolbar/sectionshrinkbar"
2076 };
2077 for (const auto & i : s_sMenu)
2078 {
2079 _xLayoutManager->createElement( OUString(i) );
2080 _xLayoutManager->requestElement( OUString(i) );
2081 }
2082}
2083
2084void OReportController::notifyGroupSections(const ContainerEvent& _rEvent,bool _bShow)
2085{
2086 uno::Reference< report::XGroup> xGroup(_rEvent.Element,uno::UNO_QUERY);
2087 if ( !xGroup.is() )
2088 return;
2089
2090 SolarMutexGuard aSolarGuard;
2091 ::osl::MutexGuard aGuard( getMutex() );
2092 sal_Int32 nGroupPos = 0;
2093 _rEvent.Accessor >>= nGroupPos;
2094
2095 if ( _bShow )
2096 {
2097 xGroup->addPropertyChangeListener(PROPERTY_HEADERON, static_cast<XPropertyChangeListener*>(this));
2098 xGroup->addPropertyChangeListener(PROPERTY_FOOTERON, static_cast<XPropertyChangeListener*>(this));
2099 }
2100 else
2101 {
2102 xGroup->removePropertyChangeListener(PROPERTY_HEADERON, static_cast<XPropertyChangeListener*>(this));
2103 xGroup->removePropertyChangeListener(PROPERTY_FOOTERON, static_cast<XPropertyChangeListener*>(this));
2104 }
2105
2106 if ( xGroup->getHeaderOn() )
2107 {
2108 groupChange(xGroup,PROPERTY_HEADERON,nGroupPos,_bShow);
2109 if (_bShow)
2110 {
2111 m_pReportControllerObserver->AddSection(xGroup->getHeader());
2112 }
2113 else
2114 {
2115 m_pReportControllerObserver->RemoveSection(xGroup->getHeader());
2116 }
2117 }
2118 if ( xGroup->getFooterOn() )
2119 {
2120 groupChange(xGroup,PROPERTY_FOOTERON,nGroupPos,_bShow);
2121 if (_bShow)
2122 {
2123 m_pReportControllerObserver->AddSection(xGroup->getFooter());
2124 }
2125 else
2126 {
2127 m_pReportControllerObserver->RemoveSection(xGroup->getFooter());
2128 }
2129 }
2130}
2131
2132// ::container::XContainerListener
2133void SAL_CALL OReportController::elementInserted( const ContainerEvent& _rEvent )
2134{
2135 notifyGroupSections(_rEvent,true);
2136}
2137
2138void SAL_CALL OReportController::elementRemoved( const ContainerEvent& _rEvent )
2139{
2140 notifyGroupSections(_rEvent,false);
2141}
2142
2143void SAL_CALL OReportController::elementReplaced( const ContainerEvent& /*_rEvent*/ )
2144{
2145 SolarMutexGuard aSolarGuard;
2146 ::osl::MutexGuard aGuard( getMutex() );
2147 OSL_FAIL("Not yet implemented!");
2148}
2149
2150void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEvent& evt )
2151{
2152 SolarMutexGuard aSolarGuard;
2153 ::osl::MutexGuard aGuard( getMutex() );
2154 try
2155 {
2156 bool bShow = false;
2157 evt.NewValue >>= bShow;
2158 if ( evt.Source == m_xReportDefinition )
2159 {
2160 if ( evt.PropertyName == PROPERTY_REPORTHEADERON )
2161 {
2162 const sal_uInt16 nPosition = m_xReportDefinition->getPageHeaderOn() ? 1 : 0;
2163 if ( bShow )
2164 {
2165 getDesignView()->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER,nPosition);
2166 m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportHeader());
2167 }
2168 else
2169 {
2170 getDesignView()->removeSection(nPosition);
2171 }
2172 }
2173 else if ( evt.PropertyName == PROPERTY_REPORTFOOTERON )
2174 {
2175 sal_uInt16 nPosition = getDesignView()->getSectionCount();
2176 if ( m_xReportDefinition->getPageFooterOn() )
2177 --nPosition;
2178 if ( bShow )
2179 {
2180 getDesignView()->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER,nPosition);
2181 m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportFooter());
2182 }
2183 else
2184 {
2185 getDesignView()->removeSection(nPosition - 1);
2186 }
2187 }
2188 else if ( evt.PropertyName == PROPERTY_PAGEHEADERON )
2189 {
2190 if ( bShow )
2191 {
2192 getDesignView()->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER,0);
2193 m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageHeader());
2194 }
2195 else
2196 {
2197 getDesignView()->removeSection(sal_uInt16(0));
2198 }
2199 }
2200 else if ( evt.PropertyName == PROPERTY_PAGEFOOTERON )
2201 {
2202 if ( bShow )
2203 {
2204 getDesignView()->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER);
2205 m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageFooter());
2206 }
2207 else
2208 {
2209 getDesignView()->removeSection(getDesignView()->getSectionCount() - 1);
2210 }
2211 }
2212 else if ( evt.PropertyName == PROPERTY_COMMAND
2213 || evt.PropertyName == PROPERTY_COMMANDTYPE
2214 || evt.PropertyName == PROPERTY_ESCAPEPROCESSING
2215 || evt.PropertyName == PROPERTY_FILTER
2216 )
2217 {
2218 m_xColumns.clear();
2219 m_xHoldAlive.clear();
2220 InvalidateFeature(SID_FM_ADD_FIELD);
2221 if ( !getDesignView()->isAddFieldVisible() && isUiVisible() )
2222 getDesignView()->toggleAddField();
2223 }
2225 /*else if ( evt.PropertyName.equals( PROPERTY_CAPTION ) )
2226 updateTitle();*/
2227 }
2228 else
2229 {
2230 uno::Reference< report::XGroup> xGroup(evt.Source,uno::UNO_QUERY);
2231 if ( xGroup.is() )
2232 {
2233 sal_Int32 nGroupPos = getGroupPosition(xGroup);
2234
2235 groupChange(xGroup,evt.PropertyName,nGroupPos,bShow);
2236 }
2237 }
2238 }
2239 catch(const uno::Exception&)
2240 {
2241 DBG_UNHANDLED_EXCEPTION("reportdesign");
2242 }
2243}
2244
2245
2246void SAL_CALL OReportController::disposing( const lang::EventObject& Source )
2247{
2248 // simply disambiguate
2249 OReportController_BASE::disposing(Source);
2250}
2251
2252
2253static sal_uInt16 lcl_getNonVisibleGroupsBefore( const uno::Reference< report::XGroups>& _xGroups
2254 ,sal_Int32 _nGroupPos
2255 ,::std::function<bool(OGroupHelper *)> const & _pGroupMemberFunction)
2256{
2257 uno::Reference< report::XGroup> xGroup;
2258 sal_uInt16 nNonVisibleGroups = 0;
2259 sal_Int32 nCount = _xGroups->getCount();
2260 for( sal_Int32 i = 0; i < _nGroupPos && i < nCount; ++i)
2261 {
2262 xGroup.set(_xGroups->getByIndex(i),uno::UNO_QUERY);
2263 OSL_ENSURE(xGroup.is(),"Group is NULL! -> GPF");
2264 OGroupHelper aGroupHelper(xGroup);
2265 if ( !_pGroupMemberFunction(&aGroupHelper) )
2266 ++nNonVisibleGroups;
2267 }
2268 return nNonVisibleGroups;
2269}
2270
2271void OReportController::groupChange( const uno::Reference< report::XGroup>& _xGroup,std::u16string_view _sPropName,sal_Int32 _nGroupPos,bool _bShow)
2272{
2273 ::std::function<bool(OGroupHelper *)> pMemFun = ::std::mem_fn(&OGroupHelper::getHeaderOn);
2274 ::std::function<uno::Reference<report::XSection>(OGroupHelper *)> pMemFunSection = ::std::mem_fn(&OGroupHelper::getHeader);
2275 OUString sColor(DBGROUPHEADER);
2276 sal_uInt16 nPosition = 0;
2277 bool bHandle = false;
2278 if ( _sPropName == PROPERTY_HEADERON )
2279 {
2280 nPosition = m_xReportDefinition->getPageHeaderOn() ? (m_xReportDefinition->getReportHeaderOn() ? 2 : 1) : (m_xReportDefinition->getReportHeaderOn() ? 1 : 0);
2281 nPosition += (static_cast<sal_uInt16>(_nGroupPos) - lcl_getNonVisibleGroupsBefore(m_xReportDefinition->getGroups(),_nGroupPos,pMemFun));
2282 bHandle = true;
2283 }
2284 else if ( _sPropName == PROPERTY_FOOTERON )
2285 {
2286 pMemFun = ::std::mem_fn(&OGroupHelper::getFooterOn);
2287 pMemFunSection = ::std::mem_fn(&OGroupHelper::getFooter);
2288 nPosition = getDesignView()->getSectionCount();
2289
2290 if ( m_xReportDefinition->getPageFooterOn() )
2291 --nPosition;
2292 if ( m_xReportDefinition->getReportFooterOn() )
2293 --nPosition;
2295 nPosition -= (static_cast<sal_uInt16>(_nGroupPos) - lcl_getNonVisibleGroupsBefore(m_xReportDefinition->getGroups(),_nGroupPos,pMemFun));
2296 if ( !_bShow )
2297 --nPosition;
2298 bHandle = true;
2299 }
2300 if ( bHandle )
2301 {
2302 if ( _bShow )
2303 {
2304 OGroupHelper aGroupHelper(_xGroup);
2305 getDesignView()->addSection(pMemFunSection(&aGroupHelper),sColor,nPosition);
2306 }
2307 else
2308 {
2309 getDesignView()->removeSection(nPosition);
2310 }
2311 }
2312}
2313
2314IMPL_LINK_NOARG(OReportController, OnClipboardChanged, TransferableDataHelper*, void)
2315{
2316 OnInvalidateClipboard();
2317}
2318
2319void OReportController::OnInvalidateClipboard()
2320{
2321 InvalidateFeature(SID_CUT);
2322 InvalidateFeature(SID_COPY);
2323 InvalidateFeature(SID_PASTE);
2324}
2325
2326void OReportController::openPageDialog(const uno::Reference<report::XSection>& _xSection)
2327{
2328 if ( !m_xReportDefinition.is() )
2329 return;
2330
2331 // UNO->ItemSet
2332 static SfxItemInfo aItemInfos[] =
2333 {
2334 { SID_ATTR_LRSPACE, true },
2335 { SID_ATTR_ULSPACE, true },
2336 { SID_ATTR_PAGE, true },
2337 { SID_ATTR_PAGE_SIZE, true },
2338 { SID_ENUM_PAGE_MODE, true },
2339 { SID_PAPER_START, true },
2340 { SID_PAPER_END, true },
2341 { SID_ATTR_BRUSH, true },
2342 { 0, true }, // XATTR_FILLSTYLE
2343 { 0, true }, // XATTR_FILLCOLOR
2344 { 0, true }, // XATTR_FILLGRADIENT
2345 { 0, true }, // XATTR_FILLHATCH
2346 { 0, true }, // XATTR_FILLBITMAP
2347 { 0, true }, // XATTR_FILLTRANSPARENCE
2348 { 0, true }, // XATTR_GRADIENTSTEPCOUNT
2349 { 0, true }, // XATTR_FILLBMP_TILE
2350 { 0, true }, // XATTR_FILLBMP_POS
2351 { 0, true }, // XATTR_FILLBMP_SIZEX
2352 { 0, true }, // XATTR_FILLBMP_SIZEY
2353 { 0, true }, // XATTR_FILLFLOATTRANSPARENCE
2354 { 0, true }, // XATTR_SECONDARYFILLCOLOR
2355 { 0, true }, // XATTR_FILLBMP_SIZELOG
2356 { 0, true }, // XATTR_FILLBMP_TILEOFFSETX
2357 { 0, true }, // XATTR_FILLBMP_TILEOFFSETY
2358 { 0, true }, // XATTR_FILLBMP_STRETCH
2359 { 0, true }, // XATTR_FILLBMP_POSOFFSETX
2360 { 0, true }, // XATTR_FILLBMP_POSOFFSETY
2361 { 0, true }, // XATTR_FILLBACKGROUND
2362 { SID_ATTR_METRIC, true }
2363 };
2364
2366 FieldUnit eUserMetric = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
2367 static const WhichRangesContainer pRanges(svl::Items<
2369 SID_ATTR_METRIC,SID_ATTR_METRIC
2370 >);
2372
2373 const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
2374 const ::Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
2375 // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults
2376 const basegfx::BGradient aNullGrad;
2377 const XHatch aNullHatch(aNullLineCol);
2378
2379 std::vector<SfxPoolItem*> pDefaults
2380 {
2389 new XFillStyleItem,
2390 new XFillColorItem("", aNullFillCol),
2391 new XFillGradientItem(aNullGrad),
2392 new XFillHatchItem(aNullHatch),
2393 new XFillBitmapItem(Graphic()),
2396 new XFillBmpTileItem,
2397 new XFillBmpPosItem,
2400 new XFillFloatTransparenceItem(aNullGrad, false),
2401 new XSecondaryFillColorItem("", aNullFillCol),
2409 new SfxUInt16Item(RPTUI_ID_METRIC,static_cast<sal_uInt16>(eUserMetric))
2410 };
2411
2412 pPool->SetDefaults(&pDefaults);
2413
2414
2415 pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
2416 pPool->FreezeIdRanges(); // the same
2417
2418 try
2419 {
2420 SfxItemSet aDescriptor(*pPool, pRanges);
2421 // fill it
2422 if ( _xSection.is() )
2423 aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, _xSection->getBackColor()),RPTUI_ID_BRUSH));
2424 else
2425 {
2426 aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
2427 aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
2428 ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,RPTUI_ID_LRSPACE));
2429 aDescriptor.Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
2430 ,static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE));
2431 aDescriptor.Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<sal_uInt16>(eUserMetric)));
2432
2433 uno::Reference< style::XStyle> xPageStyle(getUsedStyle(m_xReportDefinition));
2434 if ( xPageStyle.is() )
2435 {
2436 SvxPageItem aPageItem(RPTUI_ID_PAGE);
2437 aPageItem.SetDescName(xPageStyle->getName());
2438 uno::Reference<beans::XPropertySet> xProp(xPageStyle,uno::UNO_QUERY_THROW);
2439 aPageItem.PutValue(xProp->getPropertyValue(PROPERTY_PAGESTYLELAYOUT),MID_PAGE_LAYOUT);
2440 aPageItem.SetLandscape(getStyleProperty<bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE));
2441 aPageItem.SetNumType(static_cast<SvxNumType>(getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE)));
2442 aDescriptor.Put(aPageItem);
2443 aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
2444 }
2445 }
2446
2447 { // want the dialog to be destroyed before our set
2448 ORptPageDialog aDlg(
2449 getFrameWeld(), &aDescriptor,_xSection.is()
2450 ? OUString("BackgroundDialog")
2451 : OUString("PageDialog"));
2452 if (aDlg.run() == RET_OK)
2453 {
2454
2455 // ItemSet->UNO
2456 // UNO-properties
2457 const SfxItemSet* pSet = aDlg.GetOutputItemSet();
2458 if ( _xSection.is() )
2459 {
2460 if ( const SvxBrushItem* pBrushItem = pSet->GetItemIfSet( RPTUI_ID_BRUSH ))
2461 _xSection->setBackColor(sal_Int32(pBrushItem->GetColor()));
2462 }
2463 else
2464 {
2465 uno::Reference< beans::XPropertySet> xProp(getUsedStyle(m_xReportDefinition),uno::UNO_QUERY_THROW);
2466 const OUString sUndoAction(RptResId(RID_STR_UNDO_CHANGEPAGE));
2467 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2468 if ( const SvxSizeItem* pSizeItem = pSet->GetItemIfSet( RPTUI_ID_SIZE ))
2469 {
2470 uno::Any aValue;
2471 pSizeItem->QueryValue(aValue);
2472 xProp->setPropertyValue(PROPERTY_PAPERSIZE,aValue);
2473 resetZoomType();
2474 }
2475
2476 if ( const SvxLRSpaceItem* pSpaceItem = pSet->GetItemIfSet( RPTUI_ID_LRSPACE ))
2477 {
2478 Any aValue;
2479 pSpaceItem->QueryValue(aValue,MID_L_MARGIN);
2480 xProp->setPropertyValue(PROPERTY_LEFTMARGIN,aValue);
2481 pSpaceItem->QueryValue(aValue,MID_R_MARGIN);
2482 xProp->setPropertyValue(PROPERTY_RIGHTMARGIN,aValue);
2483 }
2484 if ( const SvxULSpaceItem* pSpaceItem = pSet->GetItemIfSet( RPTUI_ID_ULSPACE ))
2485 {
2486 xProp->setPropertyValue(PROPERTY_TOPMARGIN,uno::Any(pSpaceItem->GetUpper()));
2487 xProp->setPropertyValue(PROPERTY_BOTTOMMARGIN,uno::Any(pSpaceItem->GetLower()));
2488 }
2489 if ( const SvxPageItem* pPageItem = pSet->GetItemIfSet( RPTUI_ID_PAGE ))
2490 {
2491 xProp->setPropertyValue(PROPERTY_ISLANDSCAPE,uno::Any(pPageItem->IsLandscape()));
2492 xProp->setPropertyValue(PROPERTY_NUMBERINGTYPE,uno::Any(static_cast<sal_Int16>(pPageItem->GetNumType())));
2493 uno::Any aValue;
2494 pPageItem->QueryValue(aValue,MID_PAGE_LAYOUT);
2495 xProp->setPropertyValue(PROPERTY_PAGESTYLELAYOUT,aValue);
2496 resetZoomType();
2497 }
2498 if ( const SvxBrushItem* pBrushItem = pSet->GetItemIfSet( RPTUI_ID_BRUSH ))
2499 {
2500 ::Color aBackColor = pBrushItem->GetColor();
2501 xProp->setPropertyValue(PROPERTY_BACKTRANSPARENT,uno::Any(aBackColor == COL_TRANSPARENT));
2502 xProp->setPropertyValue(PROPERTY_BACKCOLOR,uno::Any(aBackColor));
2503 }
2504 }
2505 }
2506 }
2507 }
2508 catch(const Exception&)
2509 {
2510 DBG_UNHANDLED_EXCEPTION("reportdesign");
2511 }
2512 pPool.clear();
2513
2514 for (SfxPoolItem* pDefault : pDefaults)
2515 delete pDefault;
2516
2517}
2518
2519
2520sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel)
2521{
2522 ::osl::MutexGuard aGuard( getMutex() );
2523
2524 uno::Reference< report::XReportDefinition > xReportDefinition( xModel, UNO_QUERY );
2525 if ( !xReportDefinition.is() )
2526 return false;
2527
2528 uno::Reference< document::XUndoManagerSupplier > xTestSuppUndo( xModel, UNO_QUERY );
2529 if ( !xTestSuppUndo.is() )
2530 return false;
2531
2532 m_xReportDefinition = xReportDefinition;
2533 return true;
2534}
2535
2536
2537void OReportController::openSortingAndGroupingDialog()
2538{
2539 if ( !m_xReportDefinition.is() )
2540 return;
2541 if (!m_xGroupsFloater)
2542 {
2543 m_xGroupsFloater = std::make_shared<OGroupsSortingDialog>(getFrameWeld(), !isEditable(), this);
2544 SvtViewOptions aDlgOpt(EViewType::Window, m_xGroupsFloater->get_help_id());
2545 if ( aDlgOpt.Exists() )
2546 m_xGroupsFloater->getDialog()->set_window_state(aDlgOpt.GetWindowState());
2547 }
2548 if (isUiVisible())
2549 {
2550 if (!m_xGroupsFloater->getDialog()->get_visible())
2551 weld::DialogController::runAsync(m_xGroupsFloater, [this](sal_Int32 /*nResult*/) { m_xGroupsFloater.reset(); });
2552 else
2553 m_xGroupsFloater->response(RET_CANCEL);
2554 }
2555}
2556
2557sal_Int32 OReportController::getGroupPosition(const uno::Reference< report::XGroup >& _xGroup)
2558{
2559 return rptui::getPositionInIndexAccess(m_xReportDefinition->getGroups(),_xGroup);
2560}
2561
2562
2563void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHint)
2564{
2565 const DlgEdHint* pDlgEdHint = dynamic_cast<const DlgEdHint*>(&_rHint);
2566 if (!(pDlgEdHint && pDlgEdHint->GetKind() == RPTUI_HINT_SELECTIONCHANGED))
2567 return;
2568
2569 const sal_Int32 nSelectionCount = getDesignView()->getMarkedObjectCount();
2570 if ( m_nSelectionCount != nSelectionCount )
2571 {
2572 m_nSelectionCount = nSelectionCount;
2573 InvalidateAll();
2574 }
2575 lang::EventObject aEvent(*this);
2576 m_aSelectionListeners.forEach(
2577 [&aEvent] (uno::Reference<view::XSelectionChangeListener> const& xListener) {
2578 return xListener->selectionChanged(aEvent);
2579 });
2580}
2581
2582void OReportController::executeMethodWithUndo(TranslateId pUndoStrId,const ::std::function<void(ODesignView *)>& _pMemfun)
2583{
2584 const OUString sUndoAction = RptResId(pUndoStrId);
2585 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2586 _pMemfun( getDesignView() );
2587 InvalidateFeature( SID_UNDO );
2588}
2589
2590void OReportController::alignControlsWithUndo(TranslateId pUndoStrId, ControlModification _nControlModification, bool _bAlignAtSection)
2591{
2592 const OUString sUndoAction = RptResId(pUndoStrId);
2593 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2594 getDesignView()->alignMarkedObjects(_nControlModification,_bAlignAtSection);
2595 InvalidateFeature( SID_UNDO );
2596}
2597
2598void OReportController::shrinkSectionBottom(const uno::Reference<report::XSection>& _xSection)
2599{
2600 const sal_Int32 nElements = _xSection->getCount();
2601 if (nElements == 0)
2602 {
2603 // there are no elements
2604 return;
2605 }
2606 const sal_Int32 nSectionHeight = _xSection->getHeight();
2607 sal_Int32 nMaxPositionY = 0;
2608 uno::Reference< report::XReportComponent> xReportComponent;
2609
2610 // for every component get its Y-position and compare it to the current Y-position
2611 for (int i=0;i<nElements;i++)
2612 {
2613 xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
2614 const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
2615 const sal_Int32 nReportComponentHeight = xReportComponent->getHeight();
2616 const sal_Int32 nReportComponentPositionYAndHeight = nReportComponentPositionY + nReportComponentHeight;
2617 nMaxPositionY = std::max(nReportComponentPositionYAndHeight, nMaxPositionY);
2618 }
2619 // now we know the minimal Y-Position and maximal Y-Position
2620
2621 if (nMaxPositionY > (nSectionHeight - 7) ) // Magic Number, we use a little bit less heights for right positioning
2622 {
2623 // the lowest position is already 0
2624 return;
2625 }
2626 _xSection->setHeight(nMaxPositionY);
2627}
2628
2629void OReportController::shrinkSectionTop(const uno::Reference<report::XSection>& _xSection)
2630{
2631 const sal_Int32 nElements = _xSection->getCount();
2632 if (nElements == 0)
2633 {
2634 // there are no elements
2635 return;
2636 }
2637
2638 const sal_Int32 nSectionHeight = _xSection->getHeight();
2639 sal_Int32 nMinPositionY = nSectionHeight;
2640 uno::Reference< report::XReportComponent> xReportComponent;
2641
2642 // for every component get its Y-position and compare it to the current Y-position
2643 for (int i=0;i<nElements;i++)
2644 {
2645 xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
2646 const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
2647 nMinPositionY = std::min(nReportComponentPositionY, nMinPositionY);
2648 }
2649 // now we know the minimal Y-Position and maximal Y-Position
2650 if (nMinPositionY == 0)
2651 {
2652 // the lowest position is already 0
2653 return;
2654 }
2655 for (int i=0;i<nElements;i++)
2656 {
2657 xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
2658 const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
2659 const sal_Int32 nNewPositionY = nReportComponentPositionY - nMinPositionY;
2660 xReportComponent->setPositionY(nNewPositionY);
2661 }
2662 const sal_Int32 nNewSectionHeight = nSectionHeight - nMinPositionY;
2663 _xSection->setHeight(nNewSectionHeight);
2664}
2665
2666void OReportController::shrinkSection(TranslateId pUndoStrId, const uno::Reference<report::XSection>& _xSection, sal_Int32 _nSid)
2667{
2668 if ( _xSection.is() )
2669 {
2670 const OUString sUndoAction = RptResId(pUndoStrId);
2671 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2672
2673 if (_nSid == SID_SECTION_SHRINK)
2674 {
2675 shrinkSectionTop(_xSection);
2676 shrinkSectionBottom(_xSection);
2677 }
2678 else if (_nSid == SID_SECTION_SHRINK_TOP)
2679 {
2680 shrinkSectionTop(_xSection);
2681 }
2682 else if (_nSid == SID_SECTION_SHRINK_BOTTOM)
2683 {
2684 shrinkSectionBottom(_xSection);
2685 }
2686 }
2687
2688 InvalidateFeature( SID_UNDO );
2689}
2690
2691
2692uno::Any SAL_CALL OReportController::getViewData()
2693{
2694 ::osl::MutexGuard aGuard( getMutex() );
2695
2696 const sal_Int32 nCommandIDs[] =
2697 {
2698 SID_GRID_VISIBLE,
2699 SID_GRID_USE,
2700 SID_HELPLINES_MOVE,
2701 SID_RULER,
2702 SID_SHOW_PROPERTYBROWSER,
2703 SID_PROPERTYBROWSER_LAST_PAGE,
2704 SID_SPLIT_POSITION
2705 };
2706
2707 ::comphelper::NamedValueCollection aCommandProperties;
2708 for (sal_Int32 nCommandID : nCommandIDs)
2709 {
2710 const FeatureState aFeatureState = GetState( nCommandID );
2711
2712 OUString sCommandURL( getURLForId( nCommandID ).Main );
2713 OSL_ENSURE( sCommandURL.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" );
2714 sCommandURL = sCommandURL.copy( 5 );
2715
2716 Any aCommandState;
2717 if ( !!aFeatureState.bChecked )
2718 aCommandState <<= *aFeatureState.bChecked;
2719 else if ( aFeatureState.aValue.hasValue() )
2720 aCommandState = aFeatureState.aValue;
2721
2722 aCommandProperties.put( sCommandURL, aCommandState );
2723 }
2724
2726 aViewData.put( "CommandProperties", aCommandProperties.getPropertyValues() );
2727
2728 if ( getDesignView() )
2729 {
2730 ::std::vector<sal_uInt16> aCollapsedPositions;
2731 getDesignView()->fillCollapsedSections(aCollapsedPositions);
2732 if ( !aCollapsedPositions.empty() )
2733 {
2734 uno::Sequence<beans::PropertyValue> aCollapsedSections(aCollapsedPositions.size());
2735 beans::PropertyValue* pCollapsedIter = aCollapsedSections.getArray();
2736 sal_Int32 i = 1;
2737 for (const auto& rPos : aCollapsedPositions)
2738 {
2739 pCollapsedIter->Name = PROPERTY_SECTION + OUString::number(i);
2740 pCollapsedIter->Value <<= static_cast<sal_Int32>(rPos);
2741 ++pCollapsedIter;
2742 ++i;
2743 }
2744
2745 aViewData.put( "CollapsedSections", aCollapsedSections );
2746 }
2747
2748 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
2749 if ( pSectionWindow )
2750 {
2751 aViewData.put( "MarkedSection", static_cast<sal_Int32>(pSectionWindow->getReportSection().getPage()->GetPageNum()) );
2752 }
2753 }
2754
2755 aViewData.put( "ZoomFactor", m_nZoomValue );
2756 return uno::Any( aViewData.getPropertyValues() );
2757}
2758
2759void SAL_CALL OReportController::restoreViewData(const uno::Any& i_data)
2760{
2761 ::osl::MutexGuard aGuard( getMutex() );
2762
2763 try
2764 {
2765 const ::comphelper::NamedValueCollection aViewData( i_data );
2766
2767 m_aCollapsedSections = aViewData.getOrDefault( "CollapsedSections", m_aCollapsedSections );
2768 m_nPageNum = aViewData.getOrDefault( "MarkedSection", m_nPageNum );
2769 m_nZoomValue = aViewData.getOrDefault( "ZoomFactor", m_nZoomValue );
2770 // TODO: setting those 3 members is not enough - in theory, restoreViewData can be called when the
2771 // view is fully alive, so we need to reflect those 3 values in the view.
2772 // (At the moment, the method is called only during construction phase)
2773
2774
2775 ::comphelper::NamedValueCollection aCommandProperties( aViewData.get( "CommandProperties" ) );
2776 const ::std::vector< OUString > aCommandNames( aCommandProperties.getNames() );
2777
2778 for ( const auto& rCommandName : aCommandNames )
2779 {
2780 const Any& rCommandValue = aCommandProperties.get( rCommandName );
2781 if ( !rCommandValue.hasValue() )
2782 continue;
2783
2784 if ( getView() )
2785 {
2786 util::URL aCommand;
2787 aCommand.Complete = ".uno:" + rCommandName;
2788
2789 executeUnChecked( aCommand, { comphelper::makePropertyValue("Value", rCommandValue) } );
2790 }
2791 else
2792 {
2793 if ( rCommandName == "ShowRuler" )
2794 OSL_VERIFY( rCommandValue >>= m_bShowRuler );
2795 else if ( rCommandName == "HelplinesMove" )
2796 OSL_VERIFY( rCommandValue >>= m_bHelplinesMove );
2797 else if ( rCommandName == "GridVisible" )
2798 OSL_VERIFY( rCommandValue >>= m_bGridVisible );
2799 else if ( rCommandName == "GridUse" )
2800 OSL_VERIFY( rCommandValue >>= m_bGridUse );
2801 else if ( rCommandName == "ControlProperties" )
2802 OSL_VERIFY( rCommandValue >>= m_bShowProperties );
2803 else if ( rCommandName == "LastPropertyBrowserPage" )
2804 OSL_VERIFY( rCommandValue >>= m_sLastActivePage );
2805 else if ( rCommandName == "SplitPosition" )
2806 OSL_VERIFY( rCommandValue >>= m_nSplitPos );
2807 }
2808 }
2809 }
2810 catch(const IllegalArgumentException&)
2811 {
2812 DBG_UNHANDLED_EXCEPTION("reportdesign");
2813 }
2814}
2815
2816Reference<XFrame> OReportController::getXFrame()
2817{
2818 if ( !m_xFrameLoader.is() )
2819 {
2820 m_xFrameLoader.set( frame::Desktop::create(m_xContext) );
2821 }
2822 const sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
2823 Reference<XFrame> xFrame = m_xFrameLoader->findFrame("_blank",nFrameSearchFlag);
2824 return xFrame;
2825}
2826
2827
2828uno::Reference<frame::XModel> OReportController::executeReport()
2829{
2830 OSL_ENSURE(m_xReportDefinition.is(),"Where is my report?");
2831
2832 uno::Reference<frame::XModel> xModel;
2833 if ( m_xReportDefinition.is() )
2834 {
2835 TranslateId pErrorId = RID_ERR_NO_COMMAND;
2836 bool bEnabled = !m_xReportDefinition->getCommand().isEmpty();
2837 if ( bEnabled )
2838 {
2839 bEnabled = false;
2840 const sal_uInt16 nCount = m_aReportModel->GetPageCount();
2841 sal_uInt16 i = 0;
2842 for (; i < nCount && !bEnabled ; ++i)
2843 {
2844 const SdrPage* pPage = m_aReportModel->GetPage(i);
2845 bEnabled = pPage->GetObjCount() != 0;
2846 }
2847 if ( !bEnabled )
2848 pErrorId = RID_ERR_NO_OBJECTS;
2849 }
2850
2852 if ( !bEnabled )
2853 {
2854 sdb::SQLContext aFirstMessage;
2855 OUString sInfo = RptResId( pErrorId );
2856 aFirstMessage.Message = sInfo;
2857 aInfo = aFirstMessage;
2858 if ( isEditable() )
2859 {
2860 sal_uInt16 nCommand = 0;
2861 if (pErrorId != RID_ERR_NO_COMMAND)
2862 {
2863 if ( !m_bShowProperties )
2864 executeUnChecked(SID_SHOW_PROPERTYBROWSER, {});
2865
2866 m_sLastActivePage = "Data";
2867 getDesignView()->setCurrentPage(m_sLastActivePage);
2868 nCommand = SID_SELECT_REPORT;
2869 }
2870 else if ( getDesignView() && !getDesignView()->isAddFieldVisible() )
2871 {
2872 nCommand = SID_FM_ADD_FIELD;
2873 }
2874 if ( nCommand )
2875 {
2876 executeUnChecked(nCommand, {});
2877 }
2878 }
2879 }
2880 else
2881 {
2882 m_bInGeneratePreview = true;
2883 try
2884 {
2885 weld::WaitObject aWait(getFrameWeld()); // cursor
2886 if ( !m_xReportEngine.is() )
2887 m_xReportEngine.set( report::ReportEngine::create(m_xContext) );
2888 m_xReportEngine->setReportDefinition(m_xReportDefinition);
2889 m_xReportEngine->setActiveConnection(getConnection());
2890 Reference<XFrame> xFrame = getXFrame();
2891 xModel = m_xReportEngine->createDocumentAlive(xFrame);
2892 }
2893 catch(const sdbc::SQLException&)
2894 { // SQLExceptions and derived exceptions must not be translated
2895 aInfo = ::cppu::getCaughtException();
2896 }
2897 catch(const uno::Exception& e)
2898 {
2899 uno::Any aCaughtException( ::cppu::getCaughtException() );
2900
2901 // our first message says: we caught an exception
2902 sdb::SQLContext aFirstMessage;
2903 OUString sInfo(RptResId(RID_STR_CAUGHT_FOREIGN_EXCEPTION));
2904 sInfo = sInfo.replaceAll("$type$", aCaughtException.getValueTypeName());
2905 aFirstMessage.Message = sInfo;
2906
2907 // our second message: the message of the exception we caught
2908 sdbc::SQLException aSecondMessage;
2909 aSecondMessage.Message = e.Message;
2910 aSecondMessage.Context = e.Context;
2911
2912 // maybe our third message: the message which is wrapped in the exception we caught
2913 sdbc::SQLException aThirdMessage;
2914 lang::WrappedTargetException aWrapped;
2915 if ( aCaughtException >>= aWrapped )
2916 {
2917 aThirdMessage.Message = aWrapped.Message;
2918 aThirdMessage.Context = aWrapped.Context;
2919 }
2920
2921 if ( !aThirdMessage.Message.isEmpty() )
2922 aSecondMessage.NextException <<= aThirdMessage;
2923 aFirstMessage.NextException <<= aSecondMessage;
2924
2925 aInfo = aFirstMessage;
2926 }
2927 if (aInfo.isValid())
2928 {
2929 const OUString suSQLContext = RptResId( RID_STR_COULD_NOT_CREATE_REPORT );
2930 aInfo.prepend(suSQLContext);
2931 }
2932 m_bInGeneratePreview = false;
2933 }
2934
2935 if (aInfo.isValid())
2936 {
2937 showError(aInfo);
2938 }
2939 }
2940 return xModel;
2941}
2942
2943uno::Reference< frame::XModel > SAL_CALL OReportController::getModel()
2944{
2945 return m_xReportDefinition;
2946}
2947
2948uno::Reference< sdbc::XRowSet > const & OReportController::getRowSet()
2949{
2950 OSL_PRECOND( m_xReportDefinition.is(), "OReportController::getRowSet: no report definition?!" );
2951
2952 if ( m_xRowSet.is() || !m_xReportDefinition.is() )
2953 return m_xRowSet;
2954
2955 try
2956 {
2957 uno::Reference< sdbc::XRowSet > xRowSet(
2958 getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", getORB()),
2959 uno::UNO_QUERY );
2960 uno::Reference< beans::XPropertySet> xRowSetProp( xRowSet, uno::UNO_QUERY_THROW );
2961
2962 xRowSetProp->setPropertyValue( PROPERTY_ACTIVECONNECTION, uno::Any( getConnection() ) );
2963 xRowSetProp->setPropertyValue( PROPERTY_APPLYFILTER, uno::Any( true ) );
2964
2965 auto aNoConverter = std::make_shared<AnyConverter>();
2966 TPropertyNamePair aPropertyMediation;
2967 aPropertyMediation.emplace( PROPERTY_COMMAND, TPropertyConverter(PROPERTY_COMMAND,aNoConverter) );
2968 aPropertyMediation.emplace( PROPERTY_COMMANDTYPE, TPropertyConverter(PROPERTY_COMMANDTYPE,aNoConverter) );
2969 aPropertyMediation.emplace( PROPERTY_ESCAPEPROCESSING, TPropertyConverter(PROPERTY_ESCAPEPROCESSING,aNoConverter) );
2970 aPropertyMediation.emplace( PROPERTY_FILTER, TPropertyConverter(PROPERTY_FILTER,aNoConverter) );
2971
2972 m_xRowSetMediator = new OPropertyMediator( m_xReportDefinition, xRowSetProp, std::move(aPropertyMediation) );
2973 m_xRowSet = xRowSet;
2974 }
2975 catch(const uno::Exception&)
2976 {
2977 DBG_UNHANDLED_EXCEPTION("reportdesign");
2978 }
2979
2980 return m_xRowSet;
2981}
2982
2983void OReportController::insertGraphic()
2984{
2985 const OUString sTitle(RptResId(RID_STR_IMPORT_GRAPHIC));
2986 // build some arguments for the upcoming dialog
2987 try
2988 {
2989 uno::Reference< report::XSection> xSection = getDesignView()->getCurrentSection();
2990 ::sfx2::FileDialogHelper aDialog(ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, getFrameWeld());
2992 aDialog.SetTitle( sTitle );
2993
2994 uno::Reference< ui::dialogs::XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY_THROW);
2995 xController->setValue(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, css::uno::Any(true));
2996 xController->enableControl(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, false/*sal_True*/);
2997 xController->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, css::uno::Any(true) );
2998
2999 if ( ERRCODE_NONE == aDialog.Execute() )
3000 {
3001 bool bLink = true;
3002 xController->getValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bLink;
3003 uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
3004 { PROPERTY_IMAGEURL, Any(aDialog.GetPath()) },
3005 { PROPERTY_PRESERVEIRI, Any(bLink) }
3006 }));
3007 createControl(aArgs,xSection,OUString(),SdrObjKind::ReportDesignImageControl);
3008 }
3009 }
3010 catch(const Exception&)
3011 {
3012 DBG_UNHANDLED_EXCEPTION("reportdesign");
3013 }
3014}
3015
3016
3017sal_Bool SAL_CALL OReportController::select( const Any& aSelection )
3018{
3019 ::osl::MutexGuard aGuard( getMutex() );
3020 if ( !getDesignView() )
3021 return true;
3022
3023 getDesignView()->unmarkAllObjects();
3024 getDesignView()->SetMode(DlgEdMode::Select);
3025
3026 uno::Sequence< uno::Reference<report::XReportComponent> > aElements;
3027 if ( aSelection >>= aElements )
3028 {
3029 if ( aElements.hasElements() )
3030 getDesignView()->showProperties(uno::Reference<uno::XInterface>(aElements[0],uno::UNO_QUERY));
3031 getDesignView()->setMarked(aElements, true);
3032 }
3033 else
3034 {
3035 uno::Reference<uno::XInterface> xObject(aSelection,uno::UNO_QUERY);
3036 uno::Reference<report::XReportComponent> xProp(xObject,uno::UNO_QUERY);
3037 if ( xProp.is() )
3038 {
3039 getDesignView()->showProperties(xObject);
3040 aElements = { xProp };
3041 getDesignView()->setMarked(aElements, true);
3042 }
3043 else
3044 {
3045 uno::Reference<report::XSection> xSection(aSelection,uno::UNO_QUERY);
3046 if ( !xSection.is() && xObject.is() )
3047 getDesignView()->showProperties(xObject);
3048 getDesignView()->setMarked(xSection,xSection.is());
3049 }
3050 }
3051 InvalidateAll();
3052 return true;
3053}
3054
3055Any SAL_CALL OReportController::getSelection( )
3056{
3057 ::osl::MutexGuard aGuard( getMutex() );
3058 Any aRet;
3059 if ( getDesignView() )
3060 {
3061 aRet = getDesignView()->getCurrentlyShownProperty();
3062 if ( !aRet.hasValue() )
3063 aRet <<= getDesignView()->getCurrentSection();
3064 }
3065 return aRet;
3066}
3067
3068void SAL_CALL OReportController::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& Listener )
3069{
3070 m_aSelectionListeners.addInterface( Listener );
3071}
3072
3073void SAL_CALL OReportController::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& Listener )
3074{
3075 m_aSelectionListeners.removeInterface( Listener );
3076}
3077
3078void OReportController::createNewFunction(const uno::Any& _aValue)
3079{
3080 uno::Reference< container::XIndexContainer> xFunctions(_aValue,uno::UNO_QUERY_THROW);
3081 const OUString sNewName = RptResId(RID_STR_FUNCTION);
3082 uno::Reference< report::XFunction> xFunction(report::Function::create(m_xContext));
3083 xFunction->setName(sNewName);
3084 // the call below will also create an undo action -> listener
3085 xFunctions->insertByIndex(xFunctions->getCount(),uno::Any(xFunction));
3086}
3087
3088IMPL_LINK_NOARG( OReportController, OnExecuteReport, void*, void )
3089{
3090 executeReport();
3091}
3092
3093void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,const uno::Reference< report::XSection>& _xSection,const OUString& _sFunction,SdrObjKind _nObjectId)
3094{
3095 SequenceAsHashMap aMap(_aArgs);
3096 getDesignView()->setMarked(_xSection, true);
3097 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
3098 if ( !pSectionWindow )
3099 return;
3100
3101 OSL_ENSURE(pSectionWindow->getReportSection().getSection() == _xSection,"Invalid section after marking the correct one.");
3102
3103 sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
3104 const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
3105 const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - nRightMargin;
3106 awt::Point aPos = aMap.getUnpackedValueOrDefault(PROPERTY_POSITION,awt::Point(nLeftMargin,0));
3107 if ( aPos.X < nLeftMargin )
3108 aPos.X = nLeftMargin;
3109
3110 rtl::Reference<SdrObject> pNewControl;
3111 uno::Reference< report::XReportComponent> xShapeProp;
3112 if ( _nObjectId == SdrObjKind::CustomShape )
3113 {
3114 pNewControl = SdrObjFactory::MakeNewObject(
3115 *m_aReportModel,
3116 SdrInventor::ReportDesign,
3117 _nObjectId);
3118 xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY);
3119 OUString sCustomShapeType = getDesignView()->GetInsertObjString();
3120 if ( sCustomShapeType.isEmpty() )
3121 sCustomShapeType = "diamond";
3122 OReportSection::createDefault(sCustomShapeType,pNewControl.get());
3123 pNewControl->SetLogicRect(tools::Rectangle(3000,500,6000,3500)); // switch height and width
3124 }
3125 else if ( _nObjectId == SdrObjKind::OLE2 || SdrObjKind::ReportDesignSubReport == _nObjectId )
3126 {
3127 pNewControl = SdrObjFactory::MakeNewObject(
3128 *m_aReportModel,
3129 SdrInventor::ReportDesign,
3130 _nObjectId);
3131
3132 pNewControl->SetLogicRect(tools::Rectangle(3000,500,8000,5500)); // switch height and width
3133 xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY_THROW);
3134 OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pNewControl.get());
3135 if ( pObj && !pObj->IsEmpty() )
3136 {
3137 pObj->initializeChart(getModel());
3138 }
3139 }
3140 else
3141 {
3144
3146 getDesignView()->GetOutDev(),
3148 0,
3149 nullptr,
3150 nullptr,
3151 _nObjectId,
3152 SdrInventor::ReportDesign,
3153 SdrObjKind::ReportDesignFixedText,
3154
3155 // tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
3156 // m_aReportModel seems pretty safe, it's done in other places, initialized
3157 // in impl_initialize and throws a RuntimeException if not existing.
3158 *m_aReportModel,
3159
3160 pLabel,
3161 pControl);
3162
3163 pLabel.clear();
3164
3165 pNewControl = pControl;
3166 OUnoObject* pObj = dynamic_cast<OUnoObject*>(pNewControl.get());
3167 assert(pObj);
3168 if(pObj)
3169 {
3170 uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
3171 xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
3172 uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
3173 uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
3174
3175 const OUString sProps[] = { OUString(PROPERTY_NAME)
3176 ,OUString(PROPERTY_FONTDESCRIPTOR)
3179 ,OUString(PROPERTY_ORIENTATION)
3180 ,OUString(PROPERTY_BORDER)
3181 ,OUString(PROPERTY_FORMATSSUPPLIER)
3182 ,OUString(PROPERTY_BACKGROUNDCOLOR)
3183 };
3184 for(const auto & sProp : sProps)
3185 {
3186 if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
3187 xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
3188 }
3189
3190 if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
3191 xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
3192
3193
3194 if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() )
3195 {
3196 ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
3197 xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::Any( aFunctionFormula.getCompleteFormula() ) );
3198 }
3199
3200 sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
3201 if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
3202 xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::Any( nFormatKey ) );
3203
3204 OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,OUString());
3205 if ( !sUrl.isEmpty() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
3206 xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::Any( sUrl ) );
3207
3208 pObj->CreateMediator(true);
3209
3210 if ( _nObjectId == SdrObjKind::ReportDesignFixedText ) // special case for fixed text
3211 xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::Any(OUnoObject::GetDefaultName(pObj)));
3212 else if ( _nObjectId == SdrObjKind::ReportDesignVerticalFixedLine )
3213 {
3214 awt::Size aOlSize = xShapeProp->getSize();
3215 xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
3216 }
3217 }
3218 }
3219
3220 const sal_Int32 nShapeWidth = aMap.getUnpackedValueOrDefault(PROPERTY_WIDTH,xShapeProp->getWidth());
3221 if ( nShapeWidth != xShapeProp->getWidth() )
3222 xShapeProp->setWidth( nShapeWidth );
3223
3224 const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
3225 if ( bChangedPos )
3226 aPos.X = nPaperWidth - nShapeWidth;
3227 xShapeProp->setPosition(aPos);
3228
3229 correctOverlapping(pNewControl.get(),pSectionWindow->getReportSection());
3230}
3231
3232void OReportController::createDateTime(const Sequence< PropertyValue >& _aArgs)
3233{
3234 getDesignView()->unmarkAllObjects();
3235
3236 const OUString sUndoAction(RptResId(RID_STR_UNDO_INSERT_CONTROL));
3237 UndoContext aUndoContext( getUndoManager(), sUndoAction );
3238
3239 SequenceAsHashMap aMap(_aArgs);
3240 aMap.createItemIfMissing(PROPERTY_FORMATKEY,aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE,sal_Int32(0)));
3241
3242 uno::Reference< report::XSection> xSection = aMap.getUnpackedValueOrDefault(PROPERTY_SECTION,uno::Reference< report::XSection>());
3243 OUString sFunction;
3244
3245 bool bDate = aMap.getUnpackedValueOrDefault(PROPERTY_DATE_STATE, false);
3246 if ( bDate )
3247 {
3248 sFunction = "TODAY()";
3249 createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
3250 }
3251 bool bTime = aMap.getUnpackedValueOrDefault(PROPERTY_TIME_STATE, false);
3252 if ( bTime )
3253 {
3254 sFunction = "TIMEVALUE(NOW())";
3255 aMap[PROPERTY_FORMATKEY] <<= aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME,sal_Int32(0));
3256 createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
3257 }
3258}
3259
3260void OReportController::createPageNumber(const Sequence< PropertyValue >& _aArgs)
3261{
3262 getDesignView()->unmarkAllObjects();
3263
3264 const OUString sUndoAction(RptResId(RID_STR_UNDO_INSERT_CONTROL));
3265 UndoContext aUndoContext( getUndoManager(), sUndoAction );
3266
3267 if ( !m_xReportDefinition->getPageHeaderOn() )
3268 {
3269 uno::Sequence< beans::PropertyValue > aArgs;
3270 executeChecked(SID_PAGEHEADERFOOTER,aArgs);
3271 }
3272
3273 SequenceAsHashMap aMap(_aArgs);
3274 bool bStateOfPage = aMap.getUnpackedValueOrDefault(PROPERTY_STATE, false);
3275
3276 OUString sFunction( RptResId(STR_RPT_PN_PAGE) );
3277 sFunction = sFunction.replaceFirst("#PAGENUMBER#", "PageNumber()");
3278
3279 if ( bStateOfPage )
3280 {
3281 sFunction += RptResId(STR_RPT_PN_PAGE_OF);
3282 sFunction = sFunction.replaceFirst("#PAGECOUNT#", "PageCount()");
3283 }
3284
3285 bool bInPageHeader = aMap.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON, true);
3286 createControl(_aArgs,bInPageHeader ? m_xReportDefinition->getPageHeader() : m_xReportDefinition->getPageFooter(),sFunction);
3287}
3288
3289
3290void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
3291{
3292 getDesignView()->unmarkAllObjects();
3293
3294 // the FormatKey determines which field is required
3295 OSectionWindow* pSectionWindow[2];
3296 pSectionWindow[0] = getDesignView()->getMarkedSection();
3297
3298 if ( !pSectionWindow[0] )
3299 {
3300 select(uno::Any(m_xReportDefinition->getDetail()));
3301 pSectionWindow[0] = getDesignView()->getMarkedSection();
3302 if ( !pSectionWindow[0] )
3303 return;
3304 }
3305
3306 uno::Reference<report::XSection> xCurrentSection = getDesignView()->getCurrentSection();
3307 UndoContext aUndoContext(getUndoManager(), RptResId(RID_STR_UNDO_INSERT_CONTROL));
3308
3309 try
3310 {
3311 bool bHandleOnlyOne = false;
3312 for(const PropertyValue& rArg : aArgs)
3313 {
3314 if (bHandleOnlyOne)
3315 break;
3317 if ( !(rArg.Value >>= aValue) )
3318 { // the sequence has only one element which already contains the descriptor
3319 bHandleOnlyOne = true;
3320 aValue = aArgs;
3321 }
3322 svx::ODataAccessDescriptor aDescriptor(aValue);
3323 SequenceAsHashMap aMap(aValue);
3324 uno::Reference<report::XSection> xSection = aMap.getUnpackedValueOrDefault("Section",xCurrentSection);
3325 uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
3326
3327 getDesignView()->setMarked(xSection, true);
3328 pSectionWindow[0] = getDesignView()->getMarkedSection();
3329
3330 sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
3331 awt::Point aPos = aMap.getUnpackedValueOrDefault(PROPERTY_POSITION,awt::Point(nLeftMargin,0));
3332 if ( aPos.X < nLeftMargin )
3333 aPos.X = nLeftMargin;
3334
3335 // LLA: new feature, add the Label in dependency of the given DND_ACTION one section up, normal or one section down
3336 sal_Int8 nDNDAction = aMap.getUnpackedValueOrDefault("DNDAction", sal_Int8(0));
3337 pSectionWindow[1] = pSectionWindow[0];
3338 bool bLabelAboveTextField = nDNDAction == DND_ACTION_COPY;
3339 if ( bLabelAboveTextField || nDNDAction == DND_ACTION_LINK )
3340 {
3341 // Add the Label one Section up
3342 pSectionWindow[1] = getDesignView()->getMarkedSection(bLabelAboveTextField ? PREVIOUS : POST);
3343 if (!pSectionWindow[1])
3344 {
3345 // maybe out of bounds
3346 pSectionWindow[1] = pSectionWindow[0];
3347 }
3348 }
3349 // clear all selections
3350 getDesignView()->unmarkAllObjects();
3351
3352 uno::Reference< beans::XPropertySet > xField( aDescriptor[ svx::DataAccessDescriptorProperty::ColumnObject ], uno::UNO_QUERY );
3353 uno::Reference< lang::XComponent > xHoldAlive;
3354 if ( !xField.is() )
3355 {
3356 OUString sCommand;
3357 OUString sColumnName;
3358 sal_Int32 nCommandType( -1 );
3359 OSL_VERIFY( aDescriptor[ svx::DataAccessDescriptorProperty::Command ] >>= sCommand );
3360 OSL_VERIFY( aDescriptor[ svx::DataAccessDescriptorProperty::ColumnName ] >>= sColumnName );
3361 OSL_VERIFY( aDescriptor[ svx::DataAccessDescriptorProperty::CommandType ] >>= nCommandType );
3362
3363 uno::Reference< container::XNameAccess > xColumns;
3364 uno::Reference< sdbc::XConnection > xConnection( getConnection() );
3365 if ( !sCommand.isEmpty() && nCommandType != -1 && !sColumnName.isEmpty() && xConnection.is() )
3366 {
3367 if ( xReportDefinition->getCommand().isEmpty() )
3368 {
3369 xReportDefinition->setCommand(sCommand);
3370 xReportDefinition->setCommandType(nCommandType);
3371 }
3372
3373 xColumns = dbtools::getFieldsByCommandDescriptor(xConnection,nCommandType,sCommand,xHoldAlive);
3374 if ( xColumns.is() && xColumns->hasByName(sColumnName) )
3375 xField.set( xColumns->getByName( sColumnName ), uno::UNO_QUERY );
3376 }
3377
3378 if ( !xField.is() )
3379 {
3380 #if OSL_DEBUG_LEVEL > 0
3381 try
3382 {
3383 uno::Reference< beans::XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
3384 OUString sRowSetCommand;
3385 sal_Int32 nRowSetCommandType( -1 );
3386 OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sRowSetCommand );
3387 OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nRowSetCommandType );
3388 OSL_ENSURE( ( sRowSetCommand == sCommand ) && ( nCommandType == nRowSetCommandType ),
3389 "OReportController::addPairControls: this only works for a data source which equals our current settings!" );
3390 // if this asserts, then either our row set and our report definition are not in sync, or somebody
3391 // requested the creation of a control/pair for another data source than what our report
3392 // definition is bound to - which is not supported for the parameters case, since we
3393 // can retrieve parameters from the RowSet only.
3394 }
3395 catch(const Exception&)
3396 {
3397 DBG_UNHANDLED_EXCEPTION("reportdesign");
3398 }
3399 #endif
3400
3401 // no column name - perhaps a parameter name?
3402 uno::Reference< sdb::XParametersSupplier > xSuppParam( getRowSet(), uno::UNO_QUERY_THROW );
3403 uno::Reference< container::XIndexAccess > xParams( xSuppParam->getParameters(), uno::UNO_SET_THROW );
3404 sal_Int32 nParamCount( xParams->getCount() );
3405 for ( sal_Int32 i=0; i<nParamCount; ++i)
3406 {
3407 uno::Reference< beans::XPropertySet > xParamCol( xParams->getByIndex(i), uno::UNO_QUERY_THROW );
3408 OUString sParamName;
3409 OSL_VERIFY( xParamCol->getPropertyValue("Name") >>= sParamName );
3410 if ( sParamName == sColumnName )
3411 {
3412 xField = xParamCol;
3413 break;
3414 }
3415 }
3416 }
3417 }
3418 if ( !xField.is() )
3419 continue;
3420
3421 SdrObjKind nOBJID = SdrObjKind::NONE;
3422 sal_Int32 nDataType = sdbc::DataType::BINARY;
3423 xField->getPropertyValue(PROPERTY_TYPE) >>= nDataType;
3424 switch ( nDataType )
3425 {
3426 case sdbc::DataType::BINARY:
3427 case sdbc::DataType::VARBINARY:
3428 case sdbc::DataType::LONGVARBINARY:
3429 nOBJID = SdrObjKind::ReportDesignImageControl;
3430 break;
3431 default:
3432 nOBJID = SdrObjKind::ReportDesignFormattedField;
3433 break;
3434 }
3435
3436 if ( nOBJID == SdrObjKind::NONE )
3437 continue;
3438
3439 Reference< util::XNumberFormatsSupplier > xSupplier = getReportNumberFormatter()->getNumberFormatsSupplier();
3440 if ( !xSupplier.is() )
3441 continue;
3442
3443 Reference< XNumberFormats > xNumberFormats(xSupplier->getNumberFormats());
3444 rtl::Reference<SdrUnoObj> pControl[2];
3445 const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
3446 const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - nRightMargin;
3447 OSectionView* pSectionViews[2];
3448 pSectionViews[0] = &pSectionWindow[1]->getReportSection().getSectionView();
3449 pSectionViews[1] = &pSectionWindow[0]->getReportSection().getSectionView();
3450
3451 // find this in svx
3453 getDesignView()->GetOutDev(),
3455 0,
3456 xField,
3457 xNumberFormats,
3458 nOBJID,
3459 SdrInventor::ReportDesign,
3460 SdrObjKind::ReportDesignFixedText,
3461
3462 // tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
3463 // m_aReportModel seems pretty safe, it's done in other places, initialized
3464 // in impl_initialize and throws a RuntimeException if not existing.
3465 *m_aReportModel,
3466
3467 pControl[0],
3468 pControl[1]);
3469
3470 if ( pControl[0] && pControl[1] )
3471 {
3472 SdrPageView* pPgViews[2];
3473 pPgViews[0] = pSectionViews[0]->GetSdrPageView();
3474 pPgViews[1] = pSectionViews[1]->GetSdrPageView();
3475 if ( pPgViews[0] && pPgViews[1] )
3476 {
3477 OUString sDefaultName;
3478 size_t i = 0;
3480 for(i = 0; i < SAL_N_ELEMENTS(pControl); ++i)
3481 {
3482 pObjs[i] = dynamic_cast<OUnoObject*>(pControl[i].get());
3483 assert(pObjs[i]);
3484 uno::Reference<beans::XPropertySet> xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY_THROW);
3485 uno::Reference< report::XReportComponent> xShapeProp(pObjs[i]->getUnoShape(),uno::UNO_QUERY_THROW);
3486 xUnoProp->setPropertyValue(PROPERTY_NAME,xShapeProp->getPropertyValue(PROPERTY_NAME));
3487
3488 uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
3489 uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
3490 const OUString sProps[] = { OUString(PROPERTY_FONTDESCRIPTOR)
3493 ,OUString(PROPERTY_BORDER)
3494 ,OUString(PROPERTY_BACKGROUNDCOLOR)
3495 };
3496 for(const auto & sProp : sProps)
3497 {
3498 if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
3499 xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
3500 }
3501 if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
3502 {
3503 OUString sName;
3504 xUnoProp->getPropertyValue(PROPERTY_DATAFIELD) >>= sName;
3505 sDefaultName = sName;
3506 xUnoProp->setPropertyValue(PROPERTY_NAME,uno::Any(sDefaultName));
3507
3508 ReportFormula aFormula( ReportFormula::Field, sName );
3509 xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::Any( aFormula.getCompleteFormula() ) );
3510 }
3511
3512 if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
3513 xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
3514
3515 pObjs[i]->CreateMediator(true);
3516
3517 const sal_Int32 nShapeWidth = xShapeProp->getWidth();
3518 const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
3519 if ( bChangedPos )
3520 aPos.X = nPaperWidth - nShapeWidth;
3521 xShapeProp->setPosition(aPos);
3522 if ( bChangedPos )
3523 aPos.Y += xShapeProp->getHeight();
3524 aPos.X += nShapeWidth;
3525 }
3526 OUString sLabel;
3527 if ( xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
3528 xField->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
3529
3530 if (pSectionViews[0] != pSectionViews[1] &&
3531 nOBJID == SdrObjKind::ReportDesignFormattedField) // we want this nice feature only at FORMATTEDFIELD
3532 {
3533 uno::Reference< report::XReportComponent> xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY_THROW);
3534 uno::Reference< report::XReportComponent> xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY_THROW);
3535 if ( !sLabel.isEmpty() )
3536 xShapePropTextField->setName(sLabel);
3537 awt::Point aPosLabel = xShapePropLabel->getPosition();
3538 awt::Point aPosTextField = xShapePropTextField->getPosition();
3539 aPosTextField.X = aPosLabel.X;
3540 xShapePropTextField->setPosition(aPosTextField);
3541 if (bLabelAboveTextField)
3542 {
3543 // move the label down near the splitter
3544 const uno::Reference<report::XSection> xLabelSection = pSectionWindow[1]->getReportSection().getSection();
3545 aPosLabel.Y = xLabelSection->getHeight() - xShapePropLabel->getHeight();
3546 }
3547 else
3548 {
3549 // move the label up to the splitter
3550 aPosLabel.Y = 0;
3551 }
3552 xShapePropLabel->setPosition(aPosLabel);
3553 }
3554 rtl::Reference<OUnoObject> pObj = dynamic_cast<OUnoObject*>(pControl[0].get());
3555 assert(pObj);
3556 uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW);
3557 xShapeProp->setName(xShapeProp->getName() + sDefaultName );
3558
3559 for(i = 0; i < SAL_N_ELEMENTS(pControl); ++i) // insert controls
3560 {
3561 correctOverlapping(pControl[i].get(), pSectionWindow[1-i]->getReportSection());
3562 }
3563
3564 if (!bLabelAboveTextField )
3565 {
3566 if ( pSectionViews[0] == pSectionViews[1] )
3567 {
3569 tools::Rectangle aTextfield = getRectangleFromControl(pControl[1].get());
3570
3571 // create a Union of the given Label and Textfield
3572 tools::Rectangle aLabelAndTextfield( aLabel );
3573 aLabelAndTextfield.Union(aTextfield);
3574
3575 // check if there exists other fields and if yes, move down
3576 bool bOverlapping = true;
3577 bool bHasToMove = false;
3578 while ( bOverlapping )
3579 {
3580 const SdrObject* pOverlappedObj = isOver(aLabelAndTextfield, *pSectionWindow[0]->getReportSection().getPage(), *pSectionViews[0], true, pControl, 2);
3581 bOverlapping = pOverlappedObj != nullptr;
3582 if ( bOverlapping )
3583 {
3584 const tools::Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
3585 aLabelAndTextfield.Move(0,aLogicRect.Top() + aLogicRect.getOpenHeight() - aLabelAndTextfield.Top());
3586 bHasToMove = true;
3587 }
3588 }
3589
3590 if (bHasToMove)
3591 {
3592 // There was a move down, we need to move the Label and the Textfield down
3593 aLabel.Move(0, aLabelAndTextfield.Top() - aLabel.Top());
3594 aTextfield.Move(0, aLabelAndTextfield.Top() - aTextfield.Top());
3595
3596 uno::Reference< report::XReportComponent> xLabel(pControl[0]->getUnoShape(),uno::UNO_QUERY_THROW);
3597 xLabel->setPositionY(aLabel.Top());
3598
3599 uno::Reference< report::XReportComponent> xTextfield(pControl[1]->getUnoShape(),uno::UNO_QUERY_THROW);
3600 xTextfield->setPositionY(aTextfield.Top());
3601 }
3602 }
3603 }
3604 }
3605 }
3606 }
3607 }
3608 catch(const Exception&)
3609 {
3610 DBG_UNHANDLED_EXCEPTION("reportdesign");
3611 }
3612}
3613
3614
3615OSectionView* OReportController::getCurrentSectionView() const
3616{
3617 OSectionView* pSectionView = nullptr;
3618 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
3619 if ( pSectionWindow )
3620 pSectionView = &pSectionWindow->getReportSection().getSectionView();
3621 return pSectionView;
3622}
3623
3624void OReportController::changeZOrder(sal_Int32 _nId)
3625{
3626 OSectionView* pSectionView = getCurrentSectionView();
3627 if ( !pSectionView )
3628 return;
3629
3630 switch(_nId)
3631 {
3632 case SID_FRAME_TO_BOTTOM:
3633 pSectionView->PutMarkedToBtm();
3634 break;
3635 case SID_FRAME_TO_TOP:
3636 pSectionView->PutMarkedToTop();
3637 break;
3638 case SID_FRAME_DOWN:
3639 pSectionView->MovMarkedToBtm();
3640 break;
3641 case SID_FRAME_UP:
3642 pSectionView->MovMarkedToTop();
3643 break;
3644
3645 case SID_OBJECT_HEAVEN:
3646 pSectionView->SetMarkedToLayer( RPT_LAYER_FRONT );
3647 break;
3648 case SID_OBJECT_HELL:
3649 pSectionView->SetMarkedToLayer( RPT_LAYER_BACK );
3650 break;
3651 }
3652}
3653
3654void OReportController::listen(const bool _bAdd)
3655{
3656 const OUString aProps [] = { OUString(PROPERTY_REPORTHEADERON),OUString(PROPERTY_REPORTFOOTERON)
3657 ,OUString(PROPERTY_PAGEHEADERON),OUString(PROPERTY_PAGEFOOTERON)
3658 ,OUString(PROPERTY_COMMAND), OUString(PROPERTY_COMMANDTYPE),OUString(PROPERTY_CAPTION)
3659 };
3660
3661 void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const OUString&, const uno::Reference< XPropertyChangeListener >& ) =
3662 _bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener;
3663
3664 for (const auto & aProp : aProps)
3665 (m_xReportDefinition.get()->*pPropertyListenerAction)( aProp, static_cast< XPropertyChangeListener* >( this ) );
3666
3667 OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
3668 uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv;
3669 const uno::Sequence< beans::Property> aSeq = m_xReportDefinition->getPropertySetInfo()->getProperties();
3670 const OUString* pPropsBegin = &aProps[0];
3671 const OUString* pPropsEnd = pPropsBegin + SAL_N_ELEMENTS(aProps) - 3;
3672 for(const beans::Property& rProp : aSeq)
3673 {
3674 if ( ::std::find(pPropsBegin,pPropsEnd,rProp.Name) == pPropsEnd )
3675 (m_xReportDefinition.get()->*pPropertyListenerAction)( rProp.Name, xUndo );
3676 }
3677
3678 // Add Listeners to UndoEnvironment
3679 void (OXUndoEnvironment::*pElementUndoFunction)( const uno::Reference< uno::XInterface >& ) =
3680 _bAdd ? &OXUndoEnvironment::AddElement : &OXUndoEnvironment::RemoveElement;
3681
3682 (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getStyleFamilies() );
3683 (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getFunctions() );
3684
3685 // Add Listeners to ReportControllerObserver
3686 OXReportControllerObserver& rObserver = *m_pReportControllerObserver;
3687
3688 if ( m_xReportDefinition->getPageHeaderOn() && _bAdd )
3689 {
3690 getDesignView()->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER);
3691 rObserver.AddSection(m_xReportDefinition->getPageHeader());
3692 }
3693 if ( m_xReportDefinition->getReportHeaderOn() && _bAdd )
3694 {
3695 getDesignView()->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER);
3696 rObserver.AddSection(m_xReportDefinition->getReportHeader());
3697 }
3698
3699 uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups();
3700 const sal_Int32 nCount = xGroups->getCount();
3701 _bAdd ? xGroups->addContainerListener(&rUndoEnv) : xGroups->removeContainerListener(&rUndoEnv);
3702 _bAdd ? xGroups->addContainerListener(&rObserver) : xGroups->removeContainerListener(&rObserver);
3703
3704 for (sal_Int32 i=0;i<nCount ; ++i)
3705 {
3706 uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY);
3707 (xGroup.get()->*pPropertyListenerAction)( OUString(PROPERTY_HEADERON), static_cast< XPropertyChangeListener* >( this ) );
3708 (xGroup.get()->*pPropertyListenerAction)( OUString(PROPERTY_FOOTERON), static_cast< XPropertyChangeListener* >( this ) );
3709
3710 (rUndoEnv.*pElementUndoFunction)( xGroup );
3711 (rUndoEnv.*pElementUndoFunction)( xGroup->getFunctions() );
3712 if ( xGroup->getHeaderOn() && _bAdd )
3713 {
3714 getDesignView()->addSection(xGroup->getHeader(),DBGROUPHEADER);
3715 rObserver.AddSection(xGroup->getHeader());
3716 }
3717 }
3718
3719 if ( _bAdd )
3720 {
3721 getDesignView()->addSection(m_xReportDefinition->getDetail(),DBDETAIL);
3722 rObserver.AddSection(m_xReportDefinition->getDetail());
3723
3724 for (sal_Int32 i=nCount;i > 0 ; --i)
3725 {
3726 uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i-1),uno::UNO_QUERY);
3727 if ( xGroup->getFooterOn() )
3728 {
3729 getDesignView()->addSection(xGroup->getFooter(),DBGROUPFOOTER);
3730 rObserver.AddSection(xGroup->getFooter());
3731 }
3732 }
3733 if ( m_xReportDefinition->getReportFooterOn() )
3734 {
3735 getDesignView()->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER);
3736 rObserver.AddSection(m_xReportDefinition->getReportFooter());
3737 }
3738 if ( m_xReportDefinition->getPageFooterOn())
3739 {
3740 getDesignView()->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER);
3741 rObserver.AddSection(m_xReportDefinition->getPageFooter());
3742 }
3743
3744 xGroups->addContainerListener(static_cast<XContainerListener*>(this));
3745 m_xReportDefinition->addModifyListener(static_cast<XModifyListener*>(this));
3746 }
3747 else /* ! _bAdd */
3748 {
3749 rObserver.RemoveSection(m_xReportDefinition->getDetail());
3750 xGroups->removeContainerListener(static_cast<XContainerListener*>(this));
3751 m_xReportDefinition->removeModifyListener(static_cast<XModifyListener*>(this));
3752 m_aReportModel->detachController();
3753 }
3754}
3755
3756void OReportController::switchReportSection(const sal_Int16 _nId)
3757{
3758 OSL_ENSURE(_nId == SID_REPORTHEADER_WITHOUT_UNDO || _nId == SID_REPORTFOOTER_WITHOUT_UNDO || _nId == SID_REPORTHEADERFOOTER ,"Illegal id given!");
3759
3760 if ( !m_xReportDefinition.is() )
3761 return;
3762
3763 const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
3764 const bool bSwitchOn = !m_xReportDefinition->getReportHeaderOn();
3765
3766 std::unique_ptr< UndoContext > pUndoContext;
3767 if ( SID_REPORTHEADERFOOTER == _nId )
3768 {
3769 const OUString sUndoAction(RptResId(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER));
3770 pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) );
3771
3772 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel,SID_REPORTHEADER_WITHOUT_UNDO
3773 ,::std::mem_fn(&OReportHelper::getReportHeader)
3774 ,m_xReportDefinition
3775 ,bSwitchOn ? Inserted : Removed
3776 ));
3777
3778 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel,SID_REPORTFOOTER_WITHOUT_UNDO
3779 ,::std::mem_fn(&OReportHelper::getReportFooter)
3780 ,m_xReportDefinition
3781 ,bSwitchOn ? Inserted : Removed
3782 ));
3783 }
3784
3785 switch( _nId )
3786 {
3787 case SID_REPORTHEADER_WITHOUT_UNDO:
3788 m_xReportDefinition->setReportHeaderOn( bSwitchOn );
3789 break;
3790 case SID_REPORTFOOTER_WITHOUT_UNDO:
3791 m_xReportDefinition->setReportFooterOn( !m_xReportDefinition->getReportFooterOn() );
3792 break;
3793 case SID_REPORTHEADERFOOTER:
3794 m_xReportDefinition->setReportHeaderOn( bSwitchOn );
3795 m_xReportDefinition->setReportFooterOn( bSwitchOn );
3796 break;
3797 }
3798
3799 if ( SID_REPORTHEADERFOOTER == _nId )
3800 pUndoContext.reset();
3801 getView()->Resize();
3802}
3803
3804void OReportController::switchPageSection(const sal_Int16 _nId)
3805{
3806 OSL_ENSURE(_nId == SID_PAGEHEADERFOOTER || _nId == SID_PAGEHEADER_WITHOUT_UNDO || _nId == SID_PAGEFOOTER_WITHOUT_UNDO ,"Illegal id given!");
3807 if ( !m_xReportDefinition.is() )
3808 return;
3809
3810 const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
3811 const bool bSwitchOn = !m_xReportDefinition->getPageHeaderOn();
3812
3813 std::unique_ptr< UndoContext > pUndoContext;
3814 if ( SID_PAGEHEADERFOOTER == _nId )
3815 {
3816 const OUString sUndoAction(RptResId(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER));
3817 pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) );
3818
3819 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel
3820 ,SID_PAGEHEADER_WITHOUT_UNDO
3821 ,::std::mem_fn(&OReportHelper::getPageHeader)
3822 ,m_xReportDefinition
3823 ,bSwitchOn ? Inserted : Removed
3824 ));
3825
3826 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel
3827 ,SID_PAGEFOOTER_WITHOUT_UNDO
3828 ,::std::mem_fn(&OReportHelper::getPageFooter)
3829 ,m_xReportDefinition
3830 ,bSwitchOn ? Inserted : Removed
3831 ));
3832 }
3833 switch( _nId )
3834 {
3835 case SID_PAGEHEADER_WITHOUT_UNDO:
3836 m_xReportDefinition->setPageHeaderOn( bSwitchOn );
3837 break;
3838 case SID_PAGEFOOTER_WITHOUT_UNDO:
3839 m_xReportDefinition->setPageFooterOn( !m_xReportDefinition->getPageFooterOn() );
3840 break;
3841 case SID_PAGEHEADERFOOTER:
3842 m_xReportDefinition->setPageHeaderOn( bSwitchOn );
3843 m_xReportDefinition->setPageFooterOn( bSwitchOn );
3844 break;
3845 }
3846 if ( SID_PAGEHEADERFOOTER == _nId )
3847 pUndoContext.reset();
3848 getView()->Resize();
3849}
3850
3851void OReportController::modifyGroup(const bool _bAppend, const Sequence< PropertyValue >& _aArgs)
3852{
3853 if ( !m_xReportDefinition.is() )
3854 return;
3855
3856 try
3857 {
3858 const SequenceAsHashMap aMap( _aArgs );
3859 uno::Reference< report::XGroup > xGroup = aMap.getUnpackedValueOrDefault( PROPERTY_GROUP, uno::Reference< report::XGroup >() );
3860 if ( !xGroup.is() )
3861 return;
3862
3863 OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
3864 uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups();
3865 if ( _bAppend )
3866 {
3867 const sal_Int32 nPos = aMap.getUnpackedValueOrDefault( PROPERTY_POSITIONY, xGroups->getCount() );
3868 xGroups->insertByIndex( nPos, uno::Any( xGroup ) );
3869 rUndoEnv.AddElement( xGroup->getFunctions() );
3870 }
3871
3872 addUndoAction( std::make_unique<OGroupUndo>(
3873 *m_aReportModel,
3874 _bAppend ? RID_STR_UNDO_APPEND_GROUP : RID_STR_UNDO_REMOVE_GROUP,
3875 _bAppend ? Inserted : Removed,
3876 xGroup,
3877 m_xReportDefinition
3878 ) );
3879
3880 if ( !_bAppend )
3881 {
3882 rUndoEnv.RemoveElement( xGroup->getFunctions() );
3883 const sal_Int32 nPos = getGroupPosition( xGroup );
3884 const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
3885 xGroups->removeByIndex( nPos );
3886 }
3887 }
3888 catch(const Exception&)
3889 {
3890 DBG_UNHANDLED_EXCEPTION("reportdesign");
3891 }
3892}
3893
3894
3895void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader, const Sequence< PropertyValue >& _aArgs)
3896{
3897 if ( !m_xReportDefinition.is() )
3898 return;
3899
3900 const SequenceAsHashMap aMap(_aArgs);
3901 const bool bSwitchOn = aMap.getUnpackedValueOrDefault(_bHeader ? OUString(PROPERTY_HEADERON) : OUString(PROPERTY_FOOTERON), false);
3902 uno::Reference< report::XGroup> xGroup = aMap.getUnpackedValueOrDefault(PROPERTY_GROUP,uno::Reference< report::XGroup>());
3903 if ( !xGroup.is() )
3904 return;
3905
3906 const OXUndoEnvironment::OUndoEnvLock aLock(m_aReportModel->GetUndoEnv());
3907 if ( _bUndo )
3908 addUndoAction(std::make_unique<OGroupSectionUndo>(*m_aReportModel
3909 ,_bHeader ? SID_GROUPHEADER_WITHOUT_UNDO : SID_GROUPFOOTER_WITHOUT_UNDO
3910 ,_bHeader ? ::std::mem_fn(&OGroupHelper::getHeader) : ::std::mem_fn(&OGroupHelper::getFooter)
3911 ,xGroup
3912 ,bSwitchOn ? Inserted : Removed
3913 , ( _bHeader ?
3914 (bSwitchOn ? RID_STR_UNDO_ADD_GROUP_HEADER : RID_STR_UNDO_REMOVE_GROUP_HEADER)
3915 :(bSwitchOn ? RID_STR_UNDO_ADD_GROUP_FOOTER : RID_STR_UNDO_REMOVE_GROUP_FOOTER)
3916 )
3917 ));
3918
3919 if ( _bHeader )
3920 xGroup->setHeaderOn( bSwitchOn );
3921 else
3922 xGroup->setFooterOn( bSwitchOn );
3923}
3924
3925void OReportController::collapseSection(const bool _bCollapse)
3926{
3927 OSectionWindow *pSection = getDesignView()->getMarkedSection();
3928 if ( pSection )
3929 {
3930 pSection->setCollapsed(_bCollapse);
3931 }
3932}
3933
3934void OReportController::markSection(const bool _bNext)
3935{
3936 OSectionWindow *pSection = getDesignView()->getMarkedSection();
3937 if ( pSection )
3938 {
3939 OSectionWindow *pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
3940 if ( pPrevSection != pSection && pPrevSection )
3941 select(uno::Any(pPrevSection->getReportSection().getSection()));
3942 else
3943 select(uno::Any(m_xReportDefinition));
3944 }
3945 else
3946 {
3947 getDesignView()->markSection(_bNext ? 0 : getDesignView()->getSectionCount() - 1);
3948 pSection = getDesignView()->getMarkedSection();
3949 if ( pSection )
3950 select(uno::Any(pSection->getReportSection().getSection()));
3951 }
3952}
3953
3954void OReportController::createDefaultControl(const uno::Sequence< beans::PropertyValue>& _aArgs)
3955{
3956 uno::Reference< report::XSection > xSection = getDesignView()->getCurrentSection();
3957 if ( !xSection.is() )
3958 xSection = m_xReportDefinition->getDetail();
3959
3960 if ( !xSection.is() )
3961 return;
3962
3963 const beans::PropertyValue* pIter = _aArgs.getConstArray();
3964 const beans::PropertyValue* pEnd = pIter + _aArgs.getLength();
3965 const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter, pEnd,
3966 [] (const beans::PropertyValue& x) -> bool {
3967 return x.Name == "KeyModifier";
3968 });
3969 sal_Int16 nKeyModifier = 0;
3970 if ( pKeyModifier == pEnd || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) )
3971 {
3972 Sequence< PropertyValue > aCreateArgs;
3973 getDesignView()->unmarkAllObjects();
3974 createControl(aCreateArgs,xSection,OUString(),getDesignView()->GetInsertObj());
3975 }
3976}
3977
3978
3979void OReportController::checkChartEnabled()
3980{
3981 if ( m_bChartEnabledAsked )
3982 return;
3983
3984 m_bChartEnabledAsked = true;
3985
3986 try
3987 {
3988 ::utl::OConfigurationTreeRoot aConfiguration(
3989 ::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext, "/org.openoffice.Office.ReportDesign" ) );
3990
3991 bool bChartEnabled = false;
3992 static constexpr OUStringLiteral sPropertyName( u"UserData/Chart" );
3993 if ( aConfiguration.hasByHierarchicalName(sPropertyName) )
3994 aConfiguration.getNodeValue( sPropertyName ) >>= bChartEnabled;
3995 m_bChartEnabled = bChartEnabled;
3996 }
3997 catch(const Exception&)
3998 {
3999 }
4000}
4001
4002
4003// css.frame.XTitle
4004OUString SAL_CALL OReportController::getTitle()
4005{
4006 SolarMutexGuard aSolarGuard;
4007 ::osl::MutexGuard aGuard( getMutex() );
4008
4009 uno::Reference< frame::XTitle> xTitle(m_xReportDefinition,uno::UNO_QUERY_THROW);
4010
4011 return xTitle->getTitle ();
4012}
4013
4014void OReportController::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const
4015{
4016 _rDefault <<= sal_Int16(100);
4017}
4018
4019// comphelper::OPropertyArrayUsageHelper
4020::cppu::IPropertyArrayHelper* OReportController::createArrayHelper( ) const
4021{
4022 Sequence< Property > aProps;
4023 describeProperties(aProps);
4024 return new ::cppu::OPropertyArrayHelper(aProps);
4025}
4026
4027
4028// cppu::OPropertySetHelper
4029::cppu::IPropertyArrayHelper& SAL_CALL OReportController::getInfoHelper()
4030{
4032}
4033
4034void SAL_CALL OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle,const Any& _aValue)
4035{
4036 if ( _nHandle == PROPERTY_ID_ZOOMVALUE )
4037 {
4038 _aValue >>= m_nZoomValue;
4039 impl_zoom_nothrow();
4040 }
4041}
4042void SAL_CALL OReportController::setMode( const OUString& aMode )
4043{
4044 ::osl::MutexGuard aGuard( getMutex() );
4045 m_sMode = aMode;
4046}
4047OUString SAL_CALL OReportController::getMode( )
4048{
4049 ::osl::MutexGuard aGuard( getMutex() );
4050 return m_sMode;
4051}
4052css::uno::Sequence< OUString > SAL_CALL OReportController::getSupportedModes( )
4053{
4054 return uno::Sequence< OUString> { OUString("remote"), OUString("normal") };
4055}
4056sal_Bool SAL_CALL OReportController::supportsMode( const OUString& aMode )
4057{
4058 uno::Sequence< OUString> aModes = getSupportedModes();
4059 return comphelper::findValue(aModes, aMode) != -1;
4060}
4061
4062bool OReportController::isUiVisible() const
4063{
4064 return m_sMode != "remote";
4065}
4066
4067void OReportController::impl_fillState_nothrow(const OUString& _sProperty,dbaui::FeatureState& _rState) const
4068{
4069 _rState.bEnabled = isEditable();
4070 if ( !_rState.bEnabled )
4071 return;
4072
4073 ::std::vector< uno::Reference< uno::XInterface > > aSelection;
4074 getDesignView()->fillControlModelSelection(aSelection);
4075 _rState.bEnabled = !aSelection.empty();
4076 if ( !_rState.bEnabled )
4077 return;
4078
4079 uno::Any aTemp;
4080 ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aSelection.begin();
4081 for(; aIter != aSelection.end() && _rState.bEnabled ;++aIter)
4082 {
4083 uno::Reference< beans::XPropertySet> xProp(*aIter,uno::UNO_QUERY);
4084 try
4085 {
4086 uno::Any aTemp2 = xProp->getPropertyValue(_sProperty);
4087 if ( aIter == aSelection.begin() )
4088 {
4089 aTemp = aTemp2;
4090 }
4091 else if ( aTemp != aTemp2 )
4092 break;
4093 }
4094 catch(const beans::UnknownPropertyException&)
4095 {
4096 _rState.bEnabled = false;
4097 }
4098 }
4099 if ( aIter == aSelection.end() )
4100 _rState.aValue = aTemp;
4101}
4102
4103void OReportController::impl_zoom_nothrow()
4104{
4105 Fraction aZoom(m_nZoomValue,100);
4106 setZoomFactor( aZoom, *getDesignView() );
4107 getDesignView()->zoom(aZoom);
4108 InvalidateFeature(SID_ATTR_ZOOM,Reference< XStatusListener >(), true);
4109 InvalidateFeature(SID_ATTR_ZOOMSLIDER,Reference< XStatusListener >(), true);
4110}
4111
4112bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand,const uno::Reference< report::XReportControlFormat>& _xReportControlFormat)
4113{
4114 bool bRet = false;
4115 if ( _xReportControlFormat.is() && !uno::Reference< report::XFixedLine>(_xReportControlFormat,uno::UNO_QUERY).is() ) // this command is really often called so we need a short cut here
4116 {
4117 try
4118 {
4119 const awt::FontDescriptor aFontDescriptor = _xReportControlFormat->getFontDescriptor();
4120
4121 switch(_nCommand)
4122 {
4123 case SID_ATTR_CHAR_WEIGHT:
4124 bRet = awt::FontWeight::BOLD == aFontDescriptor.Weight;
4125 break;
4126 case SID_ATTR_CHAR_POSTURE:
4127 bRet = awt::FontSlant_ITALIC == aFontDescriptor.Slant;
4128 break;
4129 case SID_ATTR_CHAR_UNDERLINE:
4130 bRet = awt::FontUnderline::SINGLE == aFontDescriptor.Underline;
4131 break;
4132 default:
4133 ;
4134 }
4135 }
4136 catch(const uno::Exception&)
4137 {
4138 }
4139 }
4140 return bRet;
4141}
4142
4143bool OReportController::impl_setPropertyAtControls_throw(TranslateId pUndoResId,const OUString& _sProperty,const uno::Any& _aValue,const Sequence< PropertyValue >& _aArgs)
4144{
4145 ::std::vector< uno::Reference< uno::XInterface > > aSelection;
4146 uno::Reference< awt::XWindow> xWindow;
4147 lcl_getReportControlFormat( _aArgs, getDesignView(), xWindow, aSelection );
4148
4149 const OUString sUndoAction = RptResId( pUndoResId );
4150 UndoContext aUndoContext( getUndoManager(), sUndoAction );
4151
4152 for (const auto& rxInterface : aSelection)
4153 {
4154 const uno::Reference< beans::XPropertySet > xControlModel(rxInterface,uno::UNO_QUERY);
4155 if ( xControlModel.is() )
4156 // tdf#117795: some elements may have not some property
4157 // eg class "OFixedLine" doesn't have property "CharFontName"
4158 // so in this case, instead of crashing when selecting all and changing font
4159 // just display a warning
4160 try
4161 {
4162 xControlModel->setPropertyValue(_sProperty,_aValue);
4163 }
4164 catch(const UnknownPropertyException&)
4165 {
4166 TOOLS_WARN_EXCEPTION("reportdesign", "");
4167 }
4168 }
4169
4170 return !aSelection.empty();
4171}
4172
4173void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType,dbaui::FeatureState& _rState) const
4174{
4175 _rState.bEnabled = isEditable();
4176 _rState.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::CustomShape && getDesignView()->GetInsertObjString().equalsAscii(_pCustomShapeType);
4177}
4178
4179
4180OSectionWindow* OReportController::getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const
4181{
4182 if ( getDesignView() )
4183 {
4184 return getDesignView()->getSectionWindow(_xSection);
4185 }
4186
4187 // throw NullPointerException?
4188 return nullptr;
4189}
4190
4191
4192void OReportController::openZoomDialog()
4193{
4195
4196 static SfxItemInfo aItemInfos[] =
4197 {
4198 { SID_ATTR_ZOOM, true }
4199 };
4200 std::vector<SfxPoolItem*> pDefaults
4201 {
4202 new SvxZoomItem()
4203 };
4204 rtl::Reference<SfxItemPool> pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) );
4205 pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
4206 pPool->FreezeIdRanges(); // the same
4207 try
4208 {
4210 // fill it
4211 SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
4212 aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH);
4213 aDescriptor.Put(aZoomItem);
4214
4215 ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, aDescriptor));
4216 pDlg->SetLimits( 20, 400 );
4217 bool bCancel = ( RET_CANCEL == pDlg->Execute() );
4218
4219 if ( !bCancel )
4220 {
4221 const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM );
4222 m_eZoomType = rZoomItem.GetType();
4223 m_nZoomValue = rZoomItem.GetValue();
4224 if ( m_eZoomType != SvxZoomType::PERCENT )
4225 m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType );
4226
4227 impl_zoom_nothrow();
4228 }
4229 }
4230 catch(const uno::Exception&)
4231 {
4232 DBG_UNHANDLED_EXCEPTION("reportdesign");
4233 }
4234 pPool.clear();
4235
4236 for (SfxPoolItem* pDefault : pDefaults)
4237 delete pDefault;
4238}
4239
4240
4241// XVisualObject
4242void SAL_CALL OReportController::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize )
4243{
4244 ::osl::MutexGuard aGuard( getMutex() );
4245 bool bChanged =
4246 (m_aVisualAreaSize.Width != _aSize.Width ||
4247 m_aVisualAreaSize.Height != _aSize.Height);
4248 m_aVisualAreaSize = _aSize;
4249 if( bChanged )
4250 setModified( true );
4251 m_nAspect = _nAspect;
4252}
4253
4254awt::Size SAL_CALL OReportController::getVisualAreaSize( ::sal_Int64 /*nAspect*/ )
4255{
4256 ::osl::MutexGuard aGuard( getMutex() );
4257 return m_aVisualAreaSize;
4258}
4259
4260embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect )
4261{
4262 SolarMutexGuard aSolarGuard;
4263 ::osl::MutexGuard aGuard( getMutex() );
4264 embed::VisualRepresentation aResult;
4265 if ( !m_bInGeneratePreview )
4266 {
4267 m_bInGeneratePreview = true;
4268 try
4269 {
4270 if ( !m_xReportEngine.is() )
4271 m_xReportEngine.set( report::ReportEngine::create(m_xContext) );
4272 const sal_Int32 nOldMaxRows = m_xReportEngine->getMaxRows();
4273 m_xReportEngine->setMaxRows(MAX_ROWS_FOR_PREVIEW);
4274 m_xReportEngine->setReportDefinition(m_xReportDefinition);
4275 m_xReportEngine->setActiveConnection(getConnection());
4276 try
4277 {
4278 Reference<embed::XVisualObject> xTransfer(m_xReportEngine->createDocumentModel(),UNO_QUERY);
4279 if ( xTransfer.is() )
4280 {
4281 xTransfer->setVisualAreaSize(m_nAspect,m_aVisualAreaSize);
4282 aResult = xTransfer->getPreferredVisualRepresentation( _nAspect );
4283 }
4284 }
4285 catch(const uno::Exception&)
4286 {
4287 }
4288 m_xReportEngine->setMaxRows(nOldMaxRows);
4289 }
4290 catch(const uno::Exception&)
4291 {
4292 }
4293 m_bInGeneratePreview = false;
4294 }
4295 return aResult;
4296}
4297
4298::sal_Int32 SAL_CALL OReportController::getMapUnit( ::sal_Int64 /*nAspect*/ )
4299{
4300 return embed::EmbedMapUnits::ONE_100TH_MM;
4301}
4302
4303uno::Reference< container::XNameAccess > const & OReportController::getColumns() const
4304{
4305 if ( !m_xColumns.is() && m_xReportDefinition.is() && !m_xReportDefinition->getCommand().isEmpty() )
4306 {
4307 m_xColumns = dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition->getCommandType(),m_xReportDefinition->getCommand(),m_xHoldAlive);
4308 }
4309 return m_xColumns;
4310}
4311
4312OUString OReportController::getColumnLabel_throw(const OUString& i_sColumnName) const
4313{
4314 OUString sLabel;
4315 uno::Reference< container::XNameAccess > xColumns = getColumns();
4316 if ( xColumns.is() && xColumns->hasByName(i_sColumnName) )
4317 {
4318 uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(i_sColumnName),uno::UNO_QUERY_THROW);
4319 if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
4320 xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
4321 }
4322 return sLabel;
4323}
4324
4325
4326SfxUndoManager& OReportController::getUndoManager() const
4327{
4329 // this is expected to be called during UI actions, so the SM is assumed to be locked
4330
4331 std::shared_ptr< OReportModel > pReportModel( getSdrModel() );
4332 ENSURE_OR_THROW( !!pReportModel, "no access to our model" );
4333
4334 SfxUndoManager* pUndoManager( pReportModel->GetSdrUndoManager() );
4335 ENSURE_OR_THROW( pUndoManager != nullptr, "no access to our model's UndoManager" );
4336
4337 return *pUndoManager;
4338}
4339
4340
4341void OReportController::clearUndoManager() const
4342{
4343 getUndoManager().Clear();
4344}
4345
4346
4347void OReportController::addUndoAction( std::unique_ptr<SfxUndoAction> i_pAction )
4348{
4349 getUndoManager().AddUndoAction( std::move(i_pAction) );
4350
4351 InvalidateFeature( SID_UNDO );
4352 InvalidateFeature( SID_REDO );
4353}
4354
4355extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
4357 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
4358{
4359 return cppu::acquire(new OReportController(context));
4360}
4361
4362
4363/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nDataType
OptionalString sType
Reference< XComponentContext > m_xContext
#define RPTUI_ID_BRUSH
#define RPTUI_ID_METRIC
Note that we deliberately overlap an existing item id, so that we can have contiguous item ids for th...
#define RPTUI_ID_END
#define RPTUI_ID_PAGE
#define RPTUI_ID_SIZE
static void lcl_getReportControlFormat(const Sequence< PropertyValue > &aArgs, ODesignView *_pView, uno::Reference< awt::XWindow > &_xWindow, ::std::vector< uno::Reference< uno::XInterface > > &_rControlsFormats)
#define RPTUI_ID_PAGE_MODE
#define RPTUI_ID_LRSPACE
static sal_uInt16 lcl_getNonVisibleGroupsBefore(const uno::Reference< report::XGroups > &_xGroups, sal_Int32 _nGroupPos,::std::function< bool(OGroupHelper *)> const &_pGroupMemberFunction)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_OReportController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
#define PROPERTY_ID_ZOOMVALUE
#define MAX_ROWS_FOR_PREVIEW
#define RPTUI_ID_ULSPACE
#define RPTUI_ID_START
IMPL_LINK_NOARG(OReportController, OnClipboardChanged, TransferableDataHelper *, void)
IMPL_LINK(OReportController, OnCreateHdl, OAddFieldWindow &, _rAddFieldDlg, void)
constexpr OUStringLiteral sHierarchicalDocumentName
AnyEventRef aEvent
static void createControlLabelPair(OutputDevice const *_pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM, const css::uno::Reference< css::beans::XPropertySet > &_rxField, const css::uno::Reference< css::util::XNumberFormats > &_rxNumberFormats, SdrObjKind _nControlObjectID, SdrInventor _nInventor, SdrObjKind _nLabelObjectID, SdrModel &_rModel, rtl::Reference< SdrUnoObj > &_rpLabel, rtl::Reference< SdrUnoObj > &_rpControl)
MeasurementSystem getMeasurementSystemEnum() const
void PutMarkedToTop()
void MovMarkedToTop()
void MovMarkedToBtm()
void PutMarkedToBtm()
void DistributeMarkedObjects(sal_uInt16 SlotID)
size_t GetMarkedObjectCount() const
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
size_t GetObjCount() const
virtual const tools::Rectangle & GetLogicRect() const
bool IsEmpty() const
sal_uInt16 GetPageNum() const
SdrPageView * GetSdrPageView() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
void MarkAll()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
virtual bool Undo()
virtual void Clear()
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
static bool const TopLevel
virtual bool Redo()
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
const LocaleDataWrapper & GetLocaleData() const
OUString GetWindowState() const
bool Exists() const
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
static SvxAbstractDialogFactory * Create()
void SetNumType(SvxNumType eNum)
void SetLandscape(bool bL)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
void SetDescName(const OUString &rStr)
void SetValueSet(SvxZoomEnableFlags nValues)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
SvxZoomType GetType() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
void AddSnappingPoint(sal_Int32 nNew)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
const css::uno::Any & get(const OUString &_rValueName) const
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
css::uno::Sequence< css::beans::PropertyValue > getPropertyValues() const
::std::vector< OUString > getNames() const
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
::cppu::IPropertyArrayHelper * getArrayHelper()
void prepend(const OUString &_rErrorMessage)
static std::shared_ptr< rptui::OReportModel > getSdrModel(const css::uno::Reference< css::report::XReportDefinition > &_xReportDefinition)
virtual short run() override
Definition: CondFormat.cxx:355
DlgEdHintKind GetKind() const
Definition: RptObject.hxx:56
virtual short run() override
Definition: DateTime.cxx:91
Helper class to allow std::mem_fun for SAL_CALL.
Definition: UndoActions.hxx:49
void initializeChart(const css::uno::Reference< css::frame::XModel > &_xModel)
Definition: RptObject.cxx:1166
virtual short run() override
Definition: PageNumber.cxx:53
This class ensures the communication between two XPropertySet instances.
const css::uno::Reference< css::report::XSection > & getSection() const
Definition: RptPage.hxx:82
void deactivateOle()
deactivate the current active ole object if any
OReportPage * getPage() const
const css::uno::Reference< css::report::XSection > & getSection() const
OSectionView & getSectionView() const
bool isUiActive() const
returns true when an ole object is currently active
bool OnlyShapesMarked() const
void SetMarkedToLayer(SdrLayerID nLayerNo)
SdrLayerID GetLayerIdOfMarkedObjects() const
OReportSection & getReportSection()
void setCollapsed(bool _bCollapsed)
virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override
Definition: RptObject.cxx:895
void CreateMediator(bool _bReverse=false)
creates the m_xMediator when it doesn't already exist.
Definition: RptObject.cxx:833
void AddSection(const css::uno::Reference< css::report::XSection > &_xSection)
void RemoveSection(const css::uno::Reference< css::report::XSection > &_xSection)
Create an object ob OUndoEnvLock locks the undo possibility As long as in the OUndoEnvLock scope,...
Definition: UndoEnv.hxx:64
This is near the same as OUndoEnvLock but it is also possible to ask for the current mode.
Definition: UndoEnv.hxx:76
void RemoveElement(const css::uno::Reference< css::uno::XInterface > &Element)
Definition: UndoEnv.cxx:594
void AddElement(const css::uno::Reference< css::uno::XInterface > &Element)
Definition: UndoEnv.cxx:580
const OUString & getCompleteFormula() const
returns the complete formula represented by the object
OUString GetPath() const
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker() const
void SetTitle(const OUString &rNewTitle)
void SetContext(Context _eNewContext)
constexpr tools::Long Top() const
tools::Long getOpenHeight() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
tools::Rectangle & Union(const tools::Rectangle &rRect)
css::uno::Any getNodeValue(const OUString &_rPath) const noexcept
bool hasByHierarchicalName(const OUString &_rName) const noexcept
static OConfigurationTreeRoot createWithComponentContext(const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
ColorTransparency
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr OUStringLiteral sColor
inline ::Size VCLSize(const css::awt::Size &rAWTSize)
sal_Int32 nElements
OUString RptResId(TranslateId aId)
int nCount
Reference< XComponentLoader > m_xFrameLoader
#define DBG_TESTSOLARMUTEX()
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ENSURE_OR_THROW(c, m)
#define DBG_UNHANDLED_EXCEPTION(...)
SfxItemInfo const aItemInfos[]
constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII
constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII
OUString m_sName
float u
float x
#define ERRCODE_NONE
SVX_PAGE_MODE_STANDARD
FieldUnit
Reference< XColumn > xColumn
OUString sName
sal_Int32 nIndex
sal_Int64 n
constexpr sal_uInt16 KEY_MOD1
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
MeasurementSystem
#define SAL_N_ELEMENTS(arr)
#define MID_R_MARGIN
#define MID_L_MARGIN
tools::Long const nRightMargin
tools::Long const nLeftMargin
@ Exception
class SAL_NO_VTABLE XPropertySet
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
::cppu::WeakComponentImplHelper< css::frame::XDispatch, css::frame::XDispatchProviderInterceptor, css::util::XModifyListener, css::frame::XFrameActionListener, css::lang::XInitialization, css::lang::XServiceInfo, css::frame::XDispatchInformationProvider, css::frame::XController2, css::frame::XTitle, css::frame::XTitleChangeBroadcaster, css::awt::XUserInputInterception > OGenericUnoController_Base
Reference< XNameAccess > getFieldsByCommandDescriptor(const Reference< XConnection > &_rxConnection, const sal_Int32 _nCommandType, const OUString &_rCommand, Reference< XComponent > &_rxKeepFieldsAlive, SQLExceptionInfo *_pErrorInfo)
Reference< XConnection > getConnection(const Reference< XRowSet > &_rxRowSet)
void showError(const SQLExceptionInfo &_rInfo, const Reference< XWindow > &_xParent, const Reference< XComponentContext > &_rxContext)
::osl::Mutex & getMutex()
Value
int i
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
SwView * getView(const uno::Reference< frame::XModel > &xModel)
@ Inserted
Definition: UndoActions.hxx:42
tools::Rectangle getRectangleFromControl(SdrObject *pControl)
returns a Rectangle of a given SdrObject
Definition: UITools.cxx:960
@ RPTUI_HINT_SELECTIONCHANGED
Definition: RptObject.hxx:41
uno::Reference< style::XStyle > getUsedStyle(const uno::Reference< report::XReportDefinition > &_xReport)
Definition: RptObject.cxx:1199
ControlModification
Definition: RptDef.hxx:49
void correctOverlapping(SdrObject *pControl, OReportSection const &_aReportSection, bool _bInsert=true)
ensures that no control overlaps the given one.
Definition: UITools.cxx:977
std::map< OUString, TPropertyConverter > TPropertyNamePair
Definition: RptDef.hxx:73
SdrObject * isOver(const tools::Rectangle &_rRect, SdrPage const &_rPage, SdrView const &_rView, bool _bAllObjects=false, SdrObject const *_pIgnore=nullptr, sal_Int16 _nIgnoreType=0)
checks whether the given rectangle overlapps another OUnoObject object in that view.
Definition: UITools.cxx:846
constexpr SdrLayerID RPT_LAYER_FRONT(0)
::dbaui::DBSubComponentController OReportController_BASE
void setZoomFactor(const Fraction &_aZoom, vcl::Window &_rWindow)
sets the map mode at the window
Definition: UITools.cxx:999
constexpr SdrLayerID RPT_LAYER_BACK(1)
void applyCharacterSettings(const css::uno::Reference< css::report::XReportControlFormat > &_rxReportControlFormat, const css::uno::Sequence< css::beans::NamedValue > &_rSettings)
applies the character settings previously obtained via openCharDialog
sal_Int32 getPositionInIndexAccess(const css::uno::Reference< css::container::XIndexAccess > &_xCollection, const css::uno::Reference< T > &_xSearch)
returns the position of the object inside the index container
Definition: UITools.hxx:52
::std::pair< OUString, std::shared_ptr< AnyConverter > > TPropertyConverter
Definition: RptDef.hxx:72
bool openCharDialog(const css::uno::Reference< css::report::XReportControlFormat > &_xReportControlFormat, const css::uno::Reference< css::awt::XWindow > &_xWindow, css::uno::Sequence< css::beans::NamedValue > &_out_rNewValues)
opens the common character font dialog
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
static constexpr auto Items
void GetState(const SdrMarkView *pSdrView, SfxItemSet &rSet)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
HashMap_OWString_Interface aMap
PAPER_A4
PAPER_E
constexpr OUStringLiteral PROPERTY_REPORTHEADERON
Definition: strings.hxx:67
constexpr OUStringLiteral PROPERTY_LABEL
Definition: strings.hxx:89
constexpr OUStringLiteral PROPERTY_NAME
Definition: strings.hxx:36
constexpr OUStringLiteral PROPERTY_POSITION
Definition: strings.hxx:257
constexpr OUStringLiteral PROPERTY_PAGEFOOTERON
Definition: strings.hxx:70
constexpr OUStringLiteral PROPERTY_GROUP
Definition: strings.hxx:48
constexpr OUStringLiteral PROPERTY_FONTDESCRIPTOR
Definition: strings.hxx:80
constexpr OUStringLiteral REPORTCONTROLFORMAT
Definition: strings.hxx:252
constexpr OUStringLiteral PROPERTY_PAGEHEADERON
Definition: strings.hxx:69
constexpr OUStringLiteral PROPERTY_TYPE
Definition: strings.hxx:211
constexpr OUStringLiteral PROPERTY_RIGHTMARGIN
Definition: strings.hxx:103
constexpr OUStringLiteral PROPERTY_ORIENTATION
Definition: strings.hxx:61
constexpr OUStringLiteral PROPERTY_DATAFIELD
Definition: strings.hxx:78
constexpr OUStringLiteral PROPERTY_CHARCOLOR
Definition: strings.hxx:85
constexpr OUStringLiteral PROPERTY_REPORTFOOTERON
Definition: strings.hxx:68
constexpr OUStringLiteral PROPERTY_HEADERON
Definition: strings.hxx:71
constexpr OUStringLiteral PROPERTY_BACKGROUNDCOLOR
Definition: strings.hxx:194
constexpr OUStringLiteral DBPAGEFOOTER
Definition: strings.hxx:248
constexpr OUStringLiteral PROPERTY_NUMBERINGTYPE
Definition: strings.hxx:207
constexpr OUStringLiteral PROPERTY_CONTROLBORDER
Definition: strings.hxx:96
constexpr OUStringLiteral PROPERTY_FONTDESCRIPTORASIAN
Definition: strings.hxx:81
constexpr OUStringLiteral DBDETAIL
Definition: strings.hxx:251
constexpr OUStringLiteral PROPERTY_COMMAND
Definition: strings.hxx:59
constexpr OUStringLiteral PROPERTY_STATE
Definition: strings.hxx:112
constexpr OUStringLiteral PROPERTY_CHARHEIGHT
Definition: strings.hxx:141
constexpr OUStringLiteral PROPERTY_DATE_STATE
Definition: strings.hxx:114
constexpr OUStringLiteral PROPERTY_TOPMARGIN
Definition: strings.hxx:104
constexpr OUStringLiteral PROPERTY_APPLYFILTER
Definition: strings.hxx:240
constexpr OUStringLiteral PROPERTY_ACTIVECONNECTION
Definition: strings.hxx:187
constexpr OUStringLiteral PROPERTY_BACKTRANSPARENT
Definition: strings.hxx:39
constexpr OUStringLiteral DBGROUPHEADER
Definition: strings.hxx:249
constexpr OUStringLiteral PROPERTY_POSITIONY
Definition: strings.hxx:75
constexpr OUStringLiteral PROPERTY_FOOTERON
Definition: strings.hxx:72
constexpr OUStringLiteral PROPERTY_FORMATKEYDATE
Definition: strings.hxx:258
constexpr OUStringLiteral PROPERTY_FORMATKEYTIME
Definition: strings.hxx:259
constexpr OUStringLiteral PROPERTY_FONTCOLOR
Definition: strings.hxx:254
constexpr OUStringLiteral PROPERTY_SECTION
Definition: strings.hxx:182
constexpr OUStringLiteral PROPERTY_WIDTH
Definition: strings.hxx:73
constexpr OUStringLiteral DBREPORTFOOTER
Definition: strings.hxx:246
constexpr OUStringLiteral PROPERTY_LEFTMARGIN
Definition: strings.hxx:102
constexpr OUStringLiteral PROPERTY_FORMATKEY
Definition: strings.hxx:93
constexpr OUStringLiteral PROPERTY_ISLANDSCAPE
Definition: strings.hxx:209
constexpr OUStringLiteral PROPERTY_COMMANDTYPE
Definition: strings.hxx:66
constexpr OUStringLiteral PROPERTY_FILTER
Definition: strings.hxx:183
constexpr OUStringLiteral PROPERTY_PAGESTYLELAYOUT
Definition: strings.hxx:208
constexpr OUStringLiteral PROPERTY_IMAGEURL
Definition: strings.hxx:87
constexpr OUStringLiteral PROPERTY_PARAADJUST
Definition: strings.hxx:79
constexpr OUStringLiteral PROPERTY_ESCAPEPROCESSING
Definition: strings.hxx:184
constexpr OUStringLiteral PROPERTY_REPORTNAME
Definition: strings.hxx:243
constexpr OUStringLiteral PROPERTY_BACKCOLOR
Definition: strings.hxx:38
constexpr OUStringLiteral CURRENT_WINDOW
Definition: strings.hxx:253
constexpr OUStringLiteral PROPERTY_TIME_STATE
Definition: strings.hxx:113
constexpr OUStringLiteral DBREPORTHEADER
Definition: strings.hxx:245
constexpr OUStringLiteral PROPERTY_FORMATSSUPPLIER
Definition: strings.hxx:95
constexpr OUStringLiteral DBGROUPFOOTER
Definition: strings.hxx:250
constexpr OUStringLiteral PROPERTY_BOTTOMMARGIN
Definition: strings.hxx:105
constexpr OUStringLiteral PROPERTY_PAPERSIZE
Definition: strings.hxx:62
constexpr OUStringLiteral PROPERTY_BORDER
Definition: strings.hxx:98
constexpr OUStringLiteral PROPERTY_FONTDESCRIPTORCOMPLEX
Definition: strings.hxx:82
constexpr OUStringLiteral PROPERTY_PRESERVEIRI
Definition: strings.hxx:213
constexpr OUStringLiteral PROPERTY_CHARFONTNAME
Definition: strings.hxx:136
constexpr OUStringLiteral DBPAGEHEADER
Definition: strings.hxx:247
constexpr OUStringLiteral PROPERTY_CONTROLBACKGROUND
Definition: strings.hxx:40
constexpr OUStringLiteral PROPERTY_CAPTION
Definition: strings.hxx:58
std::optional< bool > bChecked
css::uno::Any aValue
bool hasValue()
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
SdrObjKind
SvxNumType
OUString aCommand
#define DND_ACTION_COPY
#define DND_ACTION_LINK
unsigned char sal_Bool
signed char sal_Int8
OUString aLabel
#define MID_PAGE_LAYOUT
constexpr OUStringLiteral PERCENT(u"Percent")
RET_OK
RET_CANCEL
#define COL_DEFAULT_SHAPE_FILLING
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)
#define COL_DEFAULT_SHAPE_STROKE
SvxZoomType