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 SequenceAsHashMap aMap(aArgs);
1473 const util::Color aColor = aMap.getUnpackedValueOrDefault(PROPERTY_FONTCOLOR,util::Color());
1474 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARCOLOR,uno::Any(aColor),aArgs);
1475 bForceBroadcast = true;
1476 }
1477 break;
1478 case SID_ATTR_CHAR_FONT:
1479 if ( aArgs.getLength() == 1 )
1480 {
1481 awt::FontDescriptor aFont;
1482 if ( aArgs[0].Value >>= aFont )
1483 {
1484 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARFONTNAME,uno::Any(aFont.Name),aArgs);
1485 }
1486 }
1487 break;
1488 case SID_ATTR_CHAR_FONTHEIGHT:
1489 if ( aArgs.getLength() == 1 )
1490 {
1491 float fSelVal = 0.0;
1492 if ( aArgs[0].Value >>= fSelVal )
1493 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT,PROPERTY_CHARHEIGHT,aArgs[0].Value,aArgs);
1494 }
1495 break;
1496 case SID_ATTR_PARA_ADJUST_LEFT:
1497 case SID_ATTR_PARA_ADJUST_CENTER:
1498 case SID_ATTR_PARA_ADJUST_RIGHT:
1499 case SID_ATTR_PARA_ADJUST_BLOCK:
1500 {
1501 style::ParagraphAdjust eParagraphAdjust = style::ParagraphAdjust_LEFT;
1502 switch(_nId)
1503 {
1504 case SID_ATTR_PARA_ADJUST_LEFT:
1505 eParagraphAdjust = style::ParagraphAdjust_LEFT;
1506 break;
1507 case SID_ATTR_PARA_ADJUST_CENTER:
1508 eParagraphAdjust = style::ParagraphAdjust_CENTER;
1509 break;
1510 case SID_ATTR_PARA_ADJUST_RIGHT:
1511 eParagraphAdjust = style::ParagraphAdjust_RIGHT;
1512 break;
1513 case SID_ATTR_PARA_ADJUST_BLOCK:
1514 eParagraphAdjust = style::ParagraphAdjust_BLOCK;
1515 break;
1516 }
1517 impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT,PROPERTY_PARAADJUST,uno::Any(static_cast<sal_Int16>(eParagraphAdjust)),aArgs);
1518
1519 InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT);
1520 InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER);
1521 InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT);
1522 InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK);
1523 }
1524 break;
1525 case SID_CHAR_DLG:
1526 {
1527 uno::Sequence< beans::NamedValue > aSettings;
1528 uno::Reference< awt::XWindow> xWindow;
1529 ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats;
1530 lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats );
1531
1532 if ( !aControlsFormats.empty() )
1533 {
1534 const OUString sUndoAction( RptResId( RID_STR_UNDO_CHANGEFONT ) );
1535 UndoContext aUndoContext( getUndoManager(), sUndoAction );
1536
1537 for (const auto& rxControlFormat : aControlsFormats)
1538 {
1539 uno::Reference< report::XReportControlFormat > xFormat( rxControlFormat, uno::UNO_QUERY );
1540 if ( !xFormat.is() )
1541 continue;
1542
1543 if ( !aSettings.hasElements() )
1544 {
1545 ::rptui::openCharDialog( xFormat, xWindow, aSettings );
1546 if ( !aSettings.hasElements() )
1547 break;
1548 }
1549
1550 applyCharacterSettings( xFormat, aSettings );
1551 }
1552
1553 InvalidateAll();
1554 }
1555 }
1556 break;
1557 case SID_INSERT_GRAPHIC:
1558 insertGraphic();
1559 break;
1560 case SID_SETCONTROLDEFAULTS:
1561 break;
1562 case SID_CONDITIONALFORMATTING:
1563 {
1564 uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
1565 if ( xFormattedField.is() )
1566 {
1567 ConditionalFormattingDialog aDlg(getFrameWeld(), xFormattedField, *this);
1568 aDlg.run();
1569 }
1570 }
1571 break;
1572 case SID_DATETIME:
1573 if ( m_xReportDefinition.is() )
1574 {
1575 if ( !aArgs.hasElements() )
1576 {
1577 ODateTimeDialog aDlg(getFrameWeld(), getDesignView()->getCurrentSection(), this);
1578 aDlg.run();
1579 }
1580 else
1581 createDateTime(aArgs);
1582 }
1583 break;
1584 case SID_INSERT_FLD_PGNUMBER:
1585 if ( m_xReportDefinition.is() )
1586 {
1587 if ( !aArgs.hasElements() )
1588 {
1589 OPageNumberDialog aDlg(getFrameWeld(), m_xReportDefinition, this);
1590 aDlg.run();
1591 }
1592 else
1593 createPageNumber(aArgs);
1594 }
1595 break;
1596 case SID_EXPORTDOC:
1597 case SID_EXPORTDOCASPDF:
1598 case SID_PRINTPREVIEW:
1599 break;
1600 case SID_EDITDOC:
1601 if(isEditable())
1602 { // the state should be changed to not editable
1603 setModified(false); // and we are not modified yet
1604 }
1605 setEditable(!isEditable());
1606 InvalidateAll();
1607 return;
1608 case SID_GROUP:
1609 break;
1610 case SID_ATTR_ZOOM:
1611 if ( !aArgs.hasElements() )
1612 {
1613 openZoomDialog();
1614 }
1615 else if ( aArgs.getLength() == 1 && aArgs[0].Name == "Zoom" )
1616 {
1617 SvxZoomItem aZoomItem;
1618 aZoomItem.PutValue(aArgs[0].Value, 0);
1619 m_nZoomValue = aZoomItem.GetValue();
1620 m_eZoomType = aZoomItem.GetType();
1621 impl_zoom_nothrow();
1622 }
1623 break;
1624 case SID_ATTR_ZOOMSLIDER:
1625 if ( aArgs.getLength() == 1 && aArgs[0].Name == "ZoomSlider" )
1626 {
1627 SvxZoomSliderItem aZoomSlider;
1628 aZoomSlider.PutValue(aArgs[0].Value, 0);
1629 m_nZoomValue = aZoomSlider.GetValue();
1630 m_eZoomType = SvxZoomType::PERCENT;
1631 impl_zoom_nothrow();
1632 }
1633 break;
1634 default:
1635 OReportController_BASE::Execute(_nId,aArgs);
1636 }
1637 InvalidateFeature(_nId,Reference< XStatusListener >(),bForceBroadcast);
1638}
1639
1640void OReportController::impl_initialize( )
1641{
1642 OReportController_BASE::impl_initialize();
1643
1644 const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
1645
1646 rArguments.get_ensureType( PROPERTY_REPORTNAME, m_sName );
1647 if ( m_sName.isEmpty() )
1648 rArguments.get_ensureType( "DocumentTitle", m_sName );
1649
1650 try
1651 {
1652 if ( m_xReportDefinition.is() )
1653 {
1654 getView()->initialize(); // show the windows and fill with our information
1655
1656 m_aReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition);
1657 if ( !m_aReportModel )
1658 throw RuntimeException();
1659 m_aReportModel->attachController( *this );
1660
1661 clearUndoManager();
1662 UndoSuppressor aSuppressUndo( getUndoManager() );
1663
1664 setMode(::comphelper::NamedValueCollection::getOrDefault(getModel()->getArgs(), u"Mode", OUString("normal")));
1665
1666 listen(true);
1667 setEditable( !m_aReportModel->IsReadOnly() );
1668 m_xFormatter.set(util::NumberFormatter::create(m_xContext), UNO_QUERY_THROW);
1669 m_xFormatter->attachNumberFormatsSupplier(Reference< XNumberFormatsSupplier>(m_xReportDefinition,uno::UNO_QUERY));
1670
1671 utl::MediaDescriptor aDescriptor( m_xReportDefinition->getArgs() );
1672 OUString sHierarchicalDocumentName = aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString());
1673
1674 if ( sHierarchicalDocumentName.isEmpty() && getConnection().is() )
1675 {
1676 uno::Reference<sdbcx::XTablesSupplier> xTablesSup(getConnection(),uno::UNO_QUERY_THROW);
1677 uno::Reference<container::XNameAccess> xTables = xTablesSup->getTables();
1678 const uno::Sequence< OUString > aNames( xTables->getElementNames() );
1679
1680 if ( aNames.hasElements() )
1681 {
1682 m_xReportDefinition->setCommand(aNames[0]);
1683 m_xReportDefinition->setCommandType(sdb::CommandType::TABLE);
1684 }
1685 }
1686
1687 m_aVisualAreaSize = m_xReportDefinition->getVisualAreaSize(0);
1688
1689 }
1690
1691 // check if chart is supported by the engine
1692 checkChartEnabled();
1693 // restore the view data
1694 getDesignView()->toggleGrid(m_bGridVisible);
1695 getDesignView()->showRuler(m_bShowRuler);
1696 getDesignView()->togglePropertyBrowser(m_bShowProperties);
1697 getDesignView()->setCurrentPage(m_sLastActivePage);
1698 getDesignView()->unmarkAllObjects();
1699
1700 if ( m_nPageNum != -1 )
1701 {
1702 if ( m_nPageNum < m_aReportModel->GetPageCount() )
1703 {
1704 const OReportPage* pPage = dynamic_cast<OReportPage*>(m_aReportModel->GetPage(static_cast<sal_uInt16>(m_nPageNum)));
1705 if ( pPage )
1706 {
1707 executeUnChecked(SID_SELECT,{ comphelper::makePropertyValue("", pPage->getSection() ) });
1708 }
1709 }
1710 else
1711 m_nPageNum = -1;
1712 }
1713 getDesignView()->collapseSections(m_aCollapsedSections);
1714 impl_zoom_nothrow();
1715 getDesignView()->Resize();
1716 getDesignView()->Invalidate();
1717 InvalidateAll();
1718
1719 if ( m_bShowProperties && m_nPageNum == -1 )
1720 {
1721 m_sLastActivePage = "Data";
1722 getDesignView()->setCurrentPage(m_sLastActivePage);
1723 executeUnChecked(SID_SELECT_REPORT,{});
1724 }
1725
1726 setModified(false); // and we are not modified yet
1727 }
1728 catch(const SQLException&)
1729 {
1730 DBG_UNHANDLED_EXCEPTION("reportdesign");
1731 }
1732}
1733
1734IMPL_LINK( OReportController, OnCreateHdl, OAddFieldWindow& ,_rAddFieldDlg, void)
1735{
1736 weld::WaitObject aObj(getFrameWeld());
1737 uno::Sequence< beans::PropertyValue > aArgs = _rAddFieldDlg.getSelectedFieldDescriptors();
1738 // we use this way to create undo actions
1739 if ( aArgs.hasElements() )
1740 {
1741 executeChecked(SID_ADD_CONTROL_PAIR,aArgs);
1742 }
1743}
1744
1745bool OReportController::Construct(vcl::Window* pParent)
1746{
1747 VclPtrInstance<ODesignView> pMyOwnView( pParent, m_xContext, *this );
1748 StartListening( *pMyOwnView );
1749 setView( pMyOwnView );
1750
1751 // now that we have a view we can create the clipboard listener
1753 m_aSystemClipboard.StartClipboardListening( );
1754 m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, OReportController, OnClipboardChanged ) );
1755 m_pClipboardNotifier->AddListener( getView() );
1756
1757 OReportController_BASE::Construct(pParent);
1758 return true;
1759}
1760
1761sal_Bool SAL_CALL OReportController::suspend(sal_Bool /*_bSuspend*/)
1762{
1763 if ( getBroadcastHelper().bInDispose || getBroadcastHelper().bDisposed )
1764 return true;
1765
1766 SolarMutexGuard aSolarGuard;
1767 ::osl::MutexGuard aGuard( getMutex() );
1768
1769 if ( getView() && getView()->IsInModalMode() )
1770 return false;
1771
1772 // this suspend will be handled in the DBAccess interceptor implementation
1773 return true;
1774}
1775
1776void OReportController::describeSupportedFeatures()
1777{
1778 DBSubComponentController::describeSupportedFeatures();
1779
1780 implDescribeSupportedFeature( ".uno:TextDocument", SID_RPT_TEXTDOCUMENT, CommandGroup::APPLICATION );
1781 implDescribeSupportedFeature( ".uno:Spreadsheet", SID_RPT_SPREADSHEET, CommandGroup::APPLICATION );
1782
1783 implDescribeSupportedFeature( ".uno:Redo", SID_REDO, CommandGroup::EDIT );
1784 implDescribeSupportedFeature( ".uno:Undo", SID_UNDO, CommandGroup::EDIT );
1785 implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
1786 implDescribeSupportedFeature( ".uno:SelectAllInSection", SID_SELECTALL_IN_SECTION, CommandGroup::EDIT );
1787 implDescribeSupportedFeature( ".uno:Delete", SID_DELETE, CommandGroup::EDIT );
1788 implDescribeSupportedFeature( ".uno:SelectReport", SID_SELECT_REPORT, CommandGroup::EDIT );
1789 implDescribeSupportedFeature( ".uno:ExecuteReport", SID_EXECUTE_REPORT, CommandGroup::EDIT );
1790
1791 implDescribeSupportedFeature( ".uno:GridVisible", SID_GRID_VISIBLE, CommandGroup::VIEW );
1792 implDescribeSupportedFeature( ".uno:GridUse", SID_GRID_USE, CommandGroup::VIEW );
1793 implDescribeSupportedFeature( ".uno:HelplinesMove", SID_HELPLINES_MOVE, CommandGroup::VIEW );
1794 implDescribeSupportedFeature( ".uno:ShowRuler", SID_RULER, CommandGroup::VIEW );
1795 implDescribeSupportedFeature( ".uno:AddField", SID_FM_ADD_FIELD, CommandGroup::VIEW );
1796 implDescribeSupportedFeature( ".uno:ReportNavigator", SID_RPT_SHOWREPORTEXPLORER, CommandGroup::VIEW );
1797 implDescribeSupportedFeature( ".uno:ControlProperties", SID_SHOW_PROPERTYBROWSER, CommandGroup::VIEW );
1798 implDescribeSupportedFeature( ".uno:DbSortingAndGrouping", SID_SORTINGANDGROUPING, CommandGroup::VIEW );
1799 implDescribeSupportedFeature( ".uno:PageHeaderFooter", SID_PAGEHEADERFOOTER, CommandGroup::VIEW );
1800 implDescribeSupportedFeature( ".uno:ReportHeaderFooter", SID_REPORTHEADERFOOTER, CommandGroup::VIEW );
1801 implDescribeSupportedFeature( ".uno:ZoomSlider", SID_ATTR_ZOOMSLIDER );
1802 implDescribeSupportedFeature( ".uno:Zoom", SID_ATTR_ZOOM, CommandGroup::VIEW );
1803
1804 implDescribeSupportedFeature( ".uno:ConditionalFormatting", SID_CONDITIONALFORMATTING, CommandGroup::FORMAT );
1805 implDescribeSupportedFeature( ".uno:PageDialog", SID_PAGEDIALOG, CommandGroup::FORMAT );
1806 implDescribeSupportedFeature( ".uno:ResetAttributes", SID_SETCONTROLDEFAULTS, CommandGroup::FORMAT );
1807
1808 implDescribeSupportedFeature( ".uno:Bold", SID_ATTR_CHAR_WEIGHT, CommandGroup::FORMAT );
1809 implDescribeSupportedFeature( ".uno:Italic", SID_ATTR_CHAR_POSTURE, CommandGroup::FORMAT );
1810 implDescribeSupportedFeature( ".uno:Underline", SID_ATTR_CHAR_UNDERLINE, CommandGroup::FORMAT );
1811 implDescribeSupportedFeature( ".uno:DBBackgroundColor", SID_ATTR_CHAR_COLOR_BACKGROUND, CommandGroup::FORMAT );
1812 implDescribeSupportedFeature( ".uno:BackgroundColor", SID_BACKGROUND_COLOR, CommandGroup::FORMAT );
1813 implDescribeSupportedFeature( ".uno:CharColorExt", SID_ATTR_CHAR_COLOR_EXT);
1814 implDescribeSupportedFeature( ".uno:Color", SID_ATTR_CHAR_COLOR);
1815 implDescribeSupportedFeature( ".uno:FontColor", SID_ATTR_CHAR_COLOR2, CommandGroup::FORMAT );
1816 implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG, CommandGroup::FORMAT );
1817 implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT, CommandGroup::FORMAT );
1818 implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER, CommandGroup::FORMAT );
1819 implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT, CommandGroup::FORMAT );
1820 implDescribeSupportedFeature( ".uno:JustifyPara", SID_ATTR_PARA_ADJUST_BLOCK, CommandGroup::FORMAT );
1821
1822 implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT, CommandGroup::FORMAT );
1823 implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT, CommandGroup::FORMAT );
1824
1825 implDescribeSupportedFeature( ".uno:ArrangeMenu", SID_ARRANGEMENU, CommandGroup::FORMAT );
1826 implDescribeSupportedFeature( ".uno:BringToFront", SID_FRAME_TO_TOP, CommandGroup::FORMAT );
1827 implDescribeSupportedFeature( ".uno:ObjectBackOne", SID_FRAME_DOWN, CommandGroup::FORMAT );
1828 implDescribeSupportedFeature( ".uno:ObjectForwardOne", SID_FRAME_UP, CommandGroup::FORMAT );
1829 implDescribeSupportedFeature( ".uno:SendToBack", SID_FRAME_TO_BOTTOM, CommandGroup::FORMAT );
1830 implDescribeSupportedFeature( ".uno:SetObjectToForeground", SID_OBJECT_HEAVEN, CommandGroup::FORMAT );
1831 implDescribeSupportedFeature( ".uno:SetObjectToBackground", SID_OBJECT_HELL, CommandGroup::FORMAT );
1832
1833 implDescribeSupportedFeature( ".uno:ObjectAlign", SID_OBJECT_ALIGN, CommandGroup::FORMAT );
1834 implDescribeSupportedFeature( ".uno:ObjectAlignLeft", SID_OBJECT_ALIGN_LEFT, CommandGroup::FORMAT );
1835 implDescribeSupportedFeature( ".uno:AlignCenter", SID_OBJECT_ALIGN_CENTER, CommandGroup::FORMAT );
1836 implDescribeSupportedFeature( ".uno:ObjectAlignRight", SID_OBJECT_ALIGN_RIGHT, CommandGroup::FORMAT );
1837 implDescribeSupportedFeature( ".uno:AlignUp", SID_OBJECT_ALIGN_UP, CommandGroup::FORMAT );
1838 implDescribeSupportedFeature( ".uno:AlignMiddle", SID_OBJECT_ALIGN_MIDDLE, CommandGroup::FORMAT );
1839 implDescribeSupportedFeature( ".uno:AlignDown", SID_OBJECT_ALIGN_DOWN, CommandGroup::FORMAT );
1840
1841 implDescribeSupportedFeature( ".uno:SectionAlign", SID_SECTION_ALIGN );
1842 implDescribeSupportedFeature( ".uno:SectionAlignLeft", SID_SECTION_ALIGN_LEFT, CommandGroup::FORMAT );
1843 implDescribeSupportedFeature( ".uno:SectionAlignCenter", SID_SECTION_ALIGN_CENTER, CommandGroup::FORMAT );
1844 implDescribeSupportedFeature( ".uno:SectionAlignRight", SID_SECTION_ALIGN_RIGHT, CommandGroup::FORMAT );
1845 implDescribeSupportedFeature( ".uno:SectionAlignTop", SID_SECTION_ALIGN_UP, CommandGroup::FORMAT );
1846 implDescribeSupportedFeature( ".uno:SectionAlignMiddle", SID_SECTION_ALIGN_MIDDLE, CommandGroup::FORMAT );
1847 implDescribeSupportedFeature( ".uno:SectionAlignBottom", SID_SECTION_ALIGN_DOWN, CommandGroup::FORMAT );
1848 implDescribeSupportedFeature( ".uno:SectionShrink", SID_SECTION_SHRINK, CommandGroup::FORMAT );
1849 implDescribeSupportedFeature( ".uno:SectionShrinkTop", SID_SECTION_SHRINK_TOP, CommandGroup::FORMAT );
1850 implDescribeSupportedFeature( ".uno:SectionShrinkBottom", SID_SECTION_SHRINK_BOTTOM, CommandGroup::FORMAT );
1851
1852 implDescribeSupportedFeature( ".uno:ObjectResize", SID_OBJECT_RESIZING, CommandGroup::FORMAT );
1853 implDescribeSupportedFeature( ".uno:SmallestWidth", SID_OBJECT_SMALLESTWIDTH, CommandGroup::FORMAT );
1854 implDescribeSupportedFeature( ".uno:SmallestHeight", SID_OBJECT_SMALLESTHEIGHT, CommandGroup::FORMAT );
1855 implDescribeSupportedFeature( ".uno:GreatestWidth", SID_OBJECT_GREATESTWIDTH, CommandGroup::FORMAT );
1856 implDescribeSupportedFeature( ".uno:GreatestHeight", SID_OBJECT_GREATESTHEIGHT, CommandGroup::FORMAT );
1857
1858 implDescribeSupportedFeature( ".uno:DistributeSelection", SID_DISTRIBUTE_DLG, CommandGroup::FORMAT );
1859 implDescribeSupportedFeature( ".uno:DistributeHorzLeft", SID_DISTRIBUTE_HLEFT, CommandGroup::FORMAT );
1860 implDescribeSupportedFeature( ".uno:DistributeHorzCenter", SID_DISTRIBUTE_HCENTER, CommandGroup::FORMAT );
1861 implDescribeSupportedFeature( ".uno:DistributeHorzDistance", SID_DISTRIBUTE_HDISTANCE, CommandGroup::FORMAT );
1862 implDescribeSupportedFeature( ".uno:DistributeHorzRight", SID_DISTRIBUTE_HRIGHT, CommandGroup::FORMAT );
1863 implDescribeSupportedFeature( ".uno:DistributeVertTop", SID_DISTRIBUTE_VTOP, CommandGroup::FORMAT );
1864 implDescribeSupportedFeature( ".uno:DistributeVertCenter", SID_DISTRIBUTE_VCENTER, CommandGroup::FORMAT );
1865 implDescribeSupportedFeature( ".uno:DistributeVertDistance", SID_DISTRIBUTE_VDISTANCE, CommandGroup::FORMAT );
1866 implDescribeSupportedFeature( ".uno:DistributeVertBottom", SID_DISTRIBUTE_VBOTTOM, CommandGroup::FORMAT );
1867
1868 implDescribeSupportedFeature( ".uno:ExportTo", SID_EXPORTDOC, CommandGroup::APPLICATION );
1869 implDescribeSupportedFeature( ".uno:ExportToPDF", SID_EXPORTDOCASPDF, CommandGroup::APPLICATION );
1870 implDescribeSupportedFeature( ".uno:PrintPreview", SID_PRINTPREVIEW, CommandGroup::APPLICATION );
1871
1872 implDescribeSupportedFeature( ".uno:NewDoc", SID_NEWDOC, CommandGroup::DOCUMENT );
1873 implDescribeSupportedFeature( ".uno:Save", SID_SAVEDOC, CommandGroup::DOCUMENT );
1874 implDescribeSupportedFeature( ".uno:SaveAs", SID_SAVEASDOC, CommandGroup::DOCUMENT );
1875 implDescribeSupportedFeature( ".uno:SaveACopy", SID_SAVEACOPY, CommandGroup::DOCUMENT );
1876
1877 implDescribeSupportedFeature( ".uno:InsertPageNumberField", SID_INSERT_FLD_PGNUMBER, CommandGroup::INSERT );
1878 implDescribeSupportedFeature( ".uno:InsertDateTimeField", SID_DATETIME, CommandGroup::INSERT );
1879 implDescribeSupportedFeature( ".uno:InsertObjectChart", SID_INSERT_DIAGRAM, CommandGroup::INSERT );
1880 implDescribeSupportedFeature( ".uno:InsertGraphic", SID_INSERT_GRAPHIC, CommandGroup::INSERT );
1881 // controls
1882 implDescribeSupportedFeature( ".uno:SelectObject", SID_OBJECT_SELECT, CommandGroup::INSERT );
1883 implDescribeSupportedFeature( ".uno:Label", SID_FM_FIXEDTEXT, CommandGroup::INSERT );
1884 implDescribeSupportedFeature( ".uno:Edit", SID_FM_EDIT, CommandGroup::INSERT );
1885 implDescribeSupportedFeature( ".uno:ImageControl", SID_FM_IMAGECONTROL, CommandGroup::INSERT );
1886 implDescribeSupportedFeature( ".uno:HFixedLine", SID_INSERT_HFIXEDLINE, CommandGroup::INSERT );
1887 implDescribeSupportedFeature( ".uno:VFixedLine", SID_INSERT_VFIXEDLINE, CommandGroup::INSERT );
1888
1889 // shapes
1890 implDescribeSupportedFeature( ".uno:BasicShapes", SID_DRAWTBX_CS_BASIC, CommandGroup::INSERT );
1891 implDescribeSupportedFeature( ".uno:BasicShapes.rectangle", SID_DRAWTBX_CS_BASIC1, CommandGroup::INSERT );
1892 implDescribeSupportedFeature( ".uno:BasicShapes.round-rectangle",SID_DRAWTBX_CS_BASIC2, CommandGroup::INSERT );
1893 implDescribeSupportedFeature( ".uno:BasicShapes.quadrat", SID_DRAWTBX_CS_BASIC3, CommandGroup::INSERT );
1894 implDescribeSupportedFeature( ".uno:BasicShapes.round-quadrat", SID_DRAWTBX_CS_BASIC4, CommandGroup::INSERT );
1895 implDescribeSupportedFeature( ".uno:BasicShapes.circle", SID_DRAWTBX_CS_BASIC5, CommandGroup::INSERT );
1896 implDescribeSupportedFeature( ".uno:BasicShapes.ellipse", SID_DRAWTBX_CS_BASIC6, CommandGroup::INSERT );
1897 implDescribeSupportedFeature( ".uno:BasicShapes.circle-pie", SID_DRAWTBX_CS_BASIC7, CommandGroup::INSERT );
1898 implDescribeSupportedFeature( ".uno:BasicShapes.isosceles-triangle",SID_DRAWTBX_CS_BASIC8, CommandGroup::INSERT );
1899 implDescribeSupportedFeature( ".uno:BasicShapes.right-triangle",SID_DRAWTBX_CS_BASIC9, CommandGroup::INSERT );
1900 implDescribeSupportedFeature( ".uno:BasicShapes.trapezoid", SID_DRAWTBX_CS_BASIC10, CommandGroup::INSERT );
1901 implDescribeSupportedFeature( ".uno:BasicShapes.diamond", SID_DRAWTBX_CS_BASIC11, CommandGroup::INSERT );
1902 implDescribeSupportedFeature( ".uno:BasicShapes.parallelogram", SID_DRAWTBX_CS_BASIC12, CommandGroup::INSERT );
1903 implDescribeSupportedFeature( ".uno:BasicShapes.pentagon", SID_DRAWTBX_CS_BASIC13, CommandGroup::INSERT );
1904 implDescribeSupportedFeature( ".uno:BasicShapes.hexagon", SID_DRAWTBX_CS_BASIC14, CommandGroup::INSERT );
1905 implDescribeSupportedFeature( ".uno:BasicShapes.octagon", SID_DRAWTBX_CS_BASIC15, CommandGroup::INSERT );
1906 implDescribeSupportedFeature( ".uno:BasicShapes.cross", SID_DRAWTBX_CS_BASIC16, CommandGroup::INSERT );
1907 implDescribeSupportedFeature( ".uno:BasicShapes.ring", SID_DRAWTBX_CS_BASIC17, CommandGroup::INSERT );
1908 implDescribeSupportedFeature( ".uno:BasicShapes.block-arc", SID_DRAWTBX_CS_BASIC18, CommandGroup::INSERT );
1909 implDescribeSupportedFeature( ".uno:BasicShapes.can", SID_DRAWTBX_CS_BASIC19, CommandGroup::INSERT );
1910 implDescribeSupportedFeature( ".uno:BasicShapes.cube", SID_DRAWTBX_CS_BASIC20, CommandGroup::INSERT );
1911 implDescribeSupportedFeature( ".uno:BasicShapes.paper", SID_DRAWTBX_CS_BASIC21, CommandGroup::INSERT );
1912 implDescribeSupportedFeature( ".uno:BasicShapes.frame", SID_DRAWTBX_CS_BASIC22, CommandGroup::INSERT );
1913
1914 implDescribeSupportedFeature( ".uno:SymbolShapes", SID_DRAWTBX_CS_SYMBOL, CommandGroup::INSERT );
1915
1916 implDescribeSupportedFeature( ".uno:SymbolShapes.smiley" , SID_DRAWTBX_CS_SYMBOL1, CommandGroup::INSERT );
1917 implDescribeSupportedFeature( ".uno:SymbolShapes.sun" , SID_DRAWTBX_CS_SYMBOL2, CommandGroup::INSERT );
1918 implDescribeSupportedFeature( ".uno:SymbolShapes.moon" , SID_DRAWTBX_CS_SYMBOL3, CommandGroup::INSERT );
1919 implDescribeSupportedFeature( ".uno:SymbolShapes.lightning" , SID_DRAWTBX_CS_SYMBOL4, CommandGroup::INSERT );
1920 implDescribeSupportedFeature( ".uno:SymbolShapes.heart" , SID_DRAWTBX_CS_SYMBOL5, CommandGroup::INSERT );
1921 implDescribeSupportedFeature( ".uno:SymbolShapes.flower" , SID_DRAWTBX_CS_SYMBOL6, CommandGroup::INSERT );
1922 implDescribeSupportedFeature( ".uno:SymbolShapes.cloud" , SID_DRAWTBX_CS_SYMBOL7, CommandGroup::INSERT );
1923 implDescribeSupportedFeature( ".uno:SymbolShapes.forbidden" , SID_DRAWTBX_CS_SYMBOL8, CommandGroup::INSERT );
1924 implDescribeSupportedFeature( ".uno:SymbolShapes.puzzle" , SID_DRAWTBX_CS_SYMBOL9, CommandGroup::INSERT );
1925 implDescribeSupportedFeature( ".uno:SymbolShapes.bracket-pair" ,SID_DRAWTBX_CS_SYMBOL10, CommandGroup::INSERT );
1926 implDescribeSupportedFeature( ".uno:SymbolShapes.left-bracket" ,SID_DRAWTBX_CS_SYMBOL11, CommandGroup::INSERT );
1927 implDescribeSupportedFeature( ".uno:SymbolShapes.right-bracket",SID_DRAWTBX_CS_SYMBOL12, CommandGroup::INSERT );
1928 implDescribeSupportedFeature( ".uno:SymbolShapes.brace-pair" , SID_DRAWTBX_CS_SYMBOL13, CommandGroup::INSERT );
1929 implDescribeSupportedFeature( ".uno:SymbolShapes.left-brace" , SID_DRAWTBX_CS_SYMBOL14, CommandGroup::INSERT );
1930 implDescribeSupportedFeature( ".uno:SymbolShapes.right-brace" , SID_DRAWTBX_CS_SYMBOL15, CommandGroup::INSERT );
1931 implDescribeSupportedFeature( ".uno:SymbolShapes.quad-bevel" , SID_DRAWTBX_CS_SYMBOL16, CommandGroup::INSERT );
1932 implDescribeSupportedFeature( ".uno:SymbolShapes.octagon-bevel",SID_DRAWTBX_CS_SYMBOL17, CommandGroup::INSERT );
1933 implDescribeSupportedFeature( ".uno:SymbolShapes.diamond-bevel",SID_DRAWTBX_CS_SYMBOL18, CommandGroup::INSERT );
1934
1935 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow" , SID_DRAWTBX_CS_ARROW1, CommandGroup::INSERT );
1936 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow" , SID_DRAWTBX_CS_ARROW2, CommandGroup::INSERT );
1937 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow" , SID_DRAWTBX_CS_ARROW3, CommandGroup::INSERT );
1938 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow" , SID_DRAWTBX_CS_ARROW4, CommandGroup::INSERT );
1939 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow" , SID_DRAWTBX_CS_ARROW5, CommandGroup::INSERT );
1940 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow" , SID_DRAWTBX_CS_ARROW6, CommandGroup::INSERT );
1941 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow" , SID_DRAWTBX_CS_ARROW7, CommandGroup::INSERT );
1942 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-down-arrow" , SID_DRAWTBX_CS_ARROW8, CommandGroup::INSERT );
1943 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow" , SID_DRAWTBX_CS_ARROW9, CommandGroup::INSERT );
1944 implDescribeSupportedFeature( ".uno:ArrowShapes.corner-right-arrow" , SID_DRAWTBX_CS_ARROW10, CommandGroup::INSERT );
1945 implDescribeSupportedFeature( ".uno:ArrowShapes.split-arrow" , SID_DRAWTBX_CS_ARROW11, CommandGroup::INSERT );
1946 implDescribeSupportedFeature( ".uno:ArrowShapes.striped-right-arrow" , SID_DRAWTBX_CS_ARROW12, CommandGroup::INSERT );
1947 implDescribeSupportedFeature( ".uno:ArrowShapes.notched-right-arrow" , SID_DRAWTBX_CS_ARROW13, CommandGroup::INSERT );
1948 implDescribeSupportedFeature( ".uno:ArrowShapes.pentagon-right" , SID_DRAWTBX_CS_ARROW14, CommandGroup::INSERT );
1949 implDescribeSupportedFeature( ".uno:ArrowShapes.chevron" , SID_DRAWTBX_CS_ARROW15, CommandGroup::INSERT );
1950 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow-callout" , SID_DRAWTBX_CS_ARROW16, CommandGroup::INSERT );
1951 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow-callout" , SID_DRAWTBX_CS_ARROW17, CommandGroup::INSERT );
1952 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow-callout" , SID_DRAWTBX_CS_ARROW18, CommandGroup::INSERT );
1953 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow-callout" , SID_DRAWTBX_CS_ARROW19, CommandGroup::INSERT );
1954 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow-callout",SID_DRAWTBX_CS_ARROW20, CommandGroup::INSERT );
1955 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow-callout" ,SID_DRAWTBX_CS_ARROW21, CommandGroup::INSERT );
1956 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow-callout",SID_DRAWTBX_CS_ARROW22, CommandGroup::INSERT );
1957 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow-callout" , SID_DRAWTBX_CS_ARROW23, CommandGroup::INSERT );
1958 implDescribeSupportedFeature( ".uno:ArrowShapes.circular-arrow" , SID_DRAWTBX_CS_ARROW24, CommandGroup::INSERT );
1959 implDescribeSupportedFeature( ".uno:ArrowShapes.split-round-arrow" , SID_DRAWTBX_CS_ARROW25, CommandGroup::INSERT );
1960 implDescribeSupportedFeature( ".uno:ArrowShapes.s-sharped-arrow" , SID_DRAWTBX_CS_ARROW26, CommandGroup::INSERT );
1961
1962 implDescribeSupportedFeature( ".uno:StarShapes.bang" , SID_DRAWTBX_CS_STAR1, CommandGroup::INSERT );
1963 implDescribeSupportedFeature( ".uno:StarShapes.star4" , SID_DRAWTBX_CS_STAR2, CommandGroup::INSERT );
1964 implDescribeSupportedFeature( ".uno:StarShapes.star5" , SID_DRAWTBX_CS_STAR3, CommandGroup::INSERT );
1965 implDescribeSupportedFeature( ".uno:StarShapes.star6" , SID_DRAWTBX_CS_STAR4, CommandGroup::INSERT );
1966 implDescribeSupportedFeature( ".uno:StarShapes.star8" , SID_DRAWTBX_CS_STAR5, CommandGroup::INSERT );
1967 implDescribeSupportedFeature( ".uno:StarShapes.star12" , SID_DRAWTBX_CS_STAR6, CommandGroup::INSERT );
1968 implDescribeSupportedFeature( ".uno:StarShapes.star24" , SID_DRAWTBX_CS_STAR7, CommandGroup::INSERT );
1969 implDescribeSupportedFeature( ".uno:StarShapes.concave-star6" , SID_DRAWTBX_CS_STAR8, CommandGroup::INSERT );
1970 implDescribeSupportedFeature( ".uno:StarShapes.vertical-scroll" , SID_DRAWTBX_CS_STAR9, CommandGroup::INSERT );
1971 implDescribeSupportedFeature( ".uno:StarShapes.horizontal-scroll" , SID_DRAWTBX_CS_STAR10, CommandGroup::INSERT );
1972 implDescribeSupportedFeature( ".uno:StarShapes.signet" , SID_DRAWTBX_CS_STAR11, CommandGroup::INSERT );
1973 implDescribeSupportedFeature( ".uno:StarShapes.doorplate" , SID_DRAWTBX_CS_STAR12, CommandGroup::INSERT );
1974
1975 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-process" , SID_DRAWTBX_CS_FLOWCHART1, CommandGroup::INSERT );
1976 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-alternate-process" , SID_DRAWTBX_CS_FLOWCHART2, CommandGroup::INSERT );
1977 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-decision" , SID_DRAWTBX_CS_FLOWCHART3, CommandGroup::INSERT );
1978 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-data" , SID_DRAWTBX_CS_FLOWCHART4, CommandGroup::INSERT );
1979 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-predefined-process" , SID_DRAWTBX_CS_FLOWCHART5, CommandGroup::INSERT );
1980 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-internal-storage" , SID_DRAWTBX_CS_FLOWCHART6, CommandGroup::INSERT );
1981 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-document" , SID_DRAWTBX_CS_FLOWCHART7, CommandGroup::INSERT );
1982 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-multidocument" , SID_DRAWTBX_CS_FLOWCHART8, CommandGroup::INSERT );
1983 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-terminator" , SID_DRAWTBX_CS_FLOWCHART9, CommandGroup::INSERT );
1984 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-preparation" , SID_DRAWTBX_CS_FLOWCHART10, CommandGroup::INSERT );
1985 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-input" , SID_DRAWTBX_CS_FLOWCHART11, CommandGroup::INSERT );
1986 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-operation" , SID_DRAWTBX_CS_FLOWCHART12, CommandGroup::INSERT );
1987 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-connector" , SID_DRAWTBX_CS_FLOWCHART13, CommandGroup::INSERT );
1988 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-off-page-connector" , SID_DRAWTBX_CS_FLOWCHART14, CommandGroup::INSERT );
1989 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-card" , SID_DRAWTBX_CS_FLOWCHART15, CommandGroup::INSERT );
1990 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-punched-tape" , SID_DRAWTBX_CS_FLOWCHART16, CommandGroup::INSERT );
1991 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-summing-junction" , SID_DRAWTBX_CS_FLOWCHART17, CommandGroup::INSERT );
1992 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-or" , SID_DRAWTBX_CS_FLOWCHART18, CommandGroup::INSERT );
1993 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-collate" , SID_DRAWTBX_CS_FLOWCHART19, CommandGroup::INSERT );
1994 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sort" , SID_DRAWTBX_CS_FLOWCHART20, CommandGroup::INSERT );
1995 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-extract" , SID_DRAWTBX_CS_FLOWCHART21, CommandGroup::INSERT );
1996 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-merge" , SID_DRAWTBX_CS_FLOWCHART22, CommandGroup::INSERT );
1997 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-stored-data" , SID_DRAWTBX_CS_FLOWCHART23, CommandGroup::INSERT );
1998 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-delay" , SID_DRAWTBX_CS_FLOWCHART24, CommandGroup::INSERT );
1999 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sequential-access" , SID_DRAWTBX_CS_FLOWCHART25, CommandGroup::INSERT );
2000 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-magnetic-disk" , SID_DRAWTBX_CS_FLOWCHART26, CommandGroup::INSERT );
2001 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-direct-access-storage",SID_DRAWTBX_CS_FLOWCHART27, CommandGroup::INSERT );
2002 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-display" , SID_DRAWTBX_CS_FLOWCHART28, CommandGroup::INSERT );
2003
2004 implDescribeSupportedFeature( ".uno:CalloutShapes.rectangular-callout" , SID_DRAWTBX_CS_CALLOUT1, CommandGroup::INSERT );
2005 implDescribeSupportedFeature( ".uno:CalloutShapes.round-rectangular-callout" , SID_DRAWTBX_CS_CALLOUT2, CommandGroup::INSERT );
2006 implDescribeSupportedFeature( ".uno:CalloutShapes.round-callout" , SID_DRAWTBX_CS_CALLOUT3, CommandGroup::INSERT );
2007 implDescribeSupportedFeature( ".uno:CalloutShapes.cloud-callout" , SID_DRAWTBX_CS_CALLOUT4, CommandGroup::INSERT );
2008 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-1" , SID_DRAWTBX_CS_CALLOUT5, CommandGroup::INSERT );
2009 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-2" , SID_DRAWTBX_CS_CALLOUT6, CommandGroup::INSERT );
2010 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-3" , SID_DRAWTBX_CS_CALLOUT7, CommandGroup::INSERT );
2011
2012 implDescribeSupportedFeature( ".uno:ArrowShapes", SID_DRAWTBX_CS_ARROW, CommandGroup::INSERT );
2013
2014 implDescribeSupportedFeature( ".uno:FlowChartShapes", SID_DRAWTBX_CS_FLOWCHART, CommandGroup::INSERT );
2015 implDescribeSupportedFeature( ".uno:CalloutShapes", SID_DRAWTBX_CS_CALLOUT, CommandGroup::INSERT );
2016 implDescribeSupportedFeature( ".uno:StarShapes", SID_DRAWTBX_CS_STAR, CommandGroup::INSERT );
2017
2018
2019 // keys
2020 implDescribeSupportedFeature( ".uno:Escape", SID_ESCAPE);
2021
2022 // internal one
2023 implDescribeSupportedFeature( ".uno:RPT_RPTHEADER_UNDO", SID_REPORTHEADER_WITHOUT_UNDO);
2024 implDescribeSupportedFeature( ".uno:RPT_RPTFOOTER_UNDO", SID_REPORTFOOTER_WITHOUT_UNDO);
2025 implDescribeSupportedFeature( ".uno:RPT_PGHEADER_UNDO", SID_PAGEHEADER_WITHOUT_UNDO);
2026 implDescribeSupportedFeature( ".uno:RPT_PGFOOTER_UNDO", SID_PAGEFOOTER_WITHOUT_UNDO);
2027 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER", SID_GROUPHEADER);
2028 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER_WITHOUT_UNDO", SID_GROUPHEADER_WITHOUT_UNDO);
2029 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER", SID_GROUPFOOTER);
2030 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER_WITHOUT_UNDO", SID_GROUPFOOTER_WITHOUT_UNDO);
2031 implDescribeSupportedFeature( ".uno:SID_GROUP_REMOVE", SID_GROUP_REMOVE);
2032 implDescribeSupportedFeature( ".uno:SID_GROUP_APPEND", SID_GROUP_APPEND);
2033 implDescribeSupportedFeature( ".uno:SID_ADD_CONTROL_PAIR", SID_ADD_CONTROL_PAIR);
2034 implDescribeSupportedFeature( ".uno:SplitPosition", SID_SPLIT_POSITION);
2035 implDescribeSupportedFeature( ".uno:LastPropertyBrowserPage", SID_PROPERTYBROWSER_LAST_PAGE);
2036 implDescribeSupportedFeature( ".uno:Select", SID_SELECT);
2037 implDescribeSupportedFeature( ".uno:InsertFunction", SID_RPT_NEW_FUNCTION);
2038 implDescribeSupportedFeature( ".uno:NextMark", SID_NEXT_MARK);
2039 implDescribeSupportedFeature( ".uno:PrevMark", SID_PREV_MARK);
2040 implDescribeSupportedFeature( ".uno:TerminateInplaceActivation", SID_TERMINATE_INPLACEACTIVATION);
2041 implDescribeSupportedFeature( ".uno:SelectAllLabels", SID_SELECT_ALL_LABELS);
2042 implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS);
2043 implDescribeSupportedFeature( ".uno:CollapseSection", SID_COLLAPSE_SECTION);
2044 implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION);
2045 implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS);
2046 implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS);
2047}
2048
2049void OReportController::impl_onModifyChanged()
2050{
2051 try
2052 {
2053 if ( m_xReportDefinition.is() )
2054 m_xReportDefinition->setModified( impl_isModified() );
2055 DBSubComponentController::impl_onModifyChanged();
2056 }
2057 catch(const uno::Exception&)
2058 {
2059 DBG_UNHANDLED_EXCEPTION("reportdesign");
2060 }
2061}
2062
2063void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _xLayoutManager)
2064{
2065 if ( !_xLayoutManager.is() )
2066 return;
2067
2068 static const std::u16string_view s_sMenu[] = {
2069 u"private:resource/statusbar/statusbar"
2070 ,u"private:resource/toolbar/reportcontrols"
2071 ,u"private:resource/toolbar/drawbar"
2072 ,u"private:resource/toolbar/Formatting"
2073 ,u"private:resource/toolbar/alignmentbar"
2074 ,u"private:resource/toolbar/sectionalignmentbar"
2075 ,u"private:resource/toolbar/resizebar"
2076 ,u"private:resource/toolbar/sectionshrinkbar"
2077 };
2078 for (const auto & i : s_sMenu)
2079 {
2080 _xLayoutManager->createElement( OUString(i) );
2081 _xLayoutManager->requestElement( OUString(i) );
2082 }
2083}
2084
2085void OReportController::notifyGroupSections(const ContainerEvent& _rEvent,bool _bShow)
2086{
2087 uno::Reference< report::XGroup> xGroup(_rEvent.Element,uno::UNO_QUERY);
2088 if ( !xGroup.is() )
2089 return;
2090
2091 SolarMutexGuard aSolarGuard;
2092 ::osl::MutexGuard aGuard( getMutex() );
2093 sal_Int32 nGroupPos = 0;
2094 _rEvent.Accessor >>= nGroupPos;
2095
2096 if ( _bShow )
2097 {
2098 xGroup->addPropertyChangeListener(PROPERTY_HEADERON, static_cast<XPropertyChangeListener*>(this));
2099 xGroup->addPropertyChangeListener(PROPERTY_FOOTERON, static_cast<XPropertyChangeListener*>(this));
2100 }
2101 else
2102 {
2103 xGroup->removePropertyChangeListener(PROPERTY_HEADERON, static_cast<XPropertyChangeListener*>(this));
2104 xGroup->removePropertyChangeListener(PROPERTY_FOOTERON, static_cast<XPropertyChangeListener*>(this));
2105 }
2106
2107 if ( xGroup->getHeaderOn() )
2108 {
2109 groupChange(xGroup,PROPERTY_HEADERON,nGroupPos,_bShow);
2110 if (_bShow)
2111 {
2112 m_pReportControllerObserver->AddSection(xGroup->getHeader());
2113 }
2114 else
2115 {
2116 m_pReportControllerObserver->RemoveSection(xGroup->getHeader());
2117 }
2118 }
2119 if ( xGroup->getFooterOn() )
2120 {
2121 groupChange(xGroup,PROPERTY_FOOTERON,nGroupPos,_bShow);
2122 if (_bShow)
2123 {
2124 m_pReportControllerObserver->AddSection(xGroup->getFooter());
2125 }
2126 else
2127 {
2128 m_pReportControllerObserver->RemoveSection(xGroup->getFooter());
2129 }
2130 }
2131}
2132
2133// ::container::XContainerListener
2134void SAL_CALL OReportController::elementInserted( const ContainerEvent& _rEvent )
2135{
2136 notifyGroupSections(_rEvent,true);
2137}
2138
2139void SAL_CALL OReportController::elementRemoved( const ContainerEvent& _rEvent )
2140{
2141 notifyGroupSections(_rEvent,false);
2142}
2143
2144void SAL_CALL OReportController::elementReplaced( const ContainerEvent& /*_rEvent*/ )
2145{
2146 SolarMutexGuard aSolarGuard;
2147 ::osl::MutexGuard aGuard( getMutex() );
2148 OSL_FAIL("Not yet implemented!");
2149}
2150
2151void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEvent& evt )
2152{
2153 SolarMutexGuard aSolarGuard;
2154 ::osl::MutexGuard aGuard( getMutex() );
2155 try
2156 {
2157 bool bShow = false;
2158 evt.NewValue >>= bShow;
2159 if ( evt.Source == m_xReportDefinition )
2160 {
2161 if ( evt.PropertyName == PROPERTY_REPORTHEADERON )
2162 {
2163 const sal_uInt16 nPosition = m_xReportDefinition->getPageHeaderOn() ? 1 : 0;
2164 if ( bShow )
2165 {
2166 getDesignView()->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER,nPosition);
2167 m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportHeader());
2168 }
2169 else
2170 {
2171 getDesignView()->removeSection(nPosition);
2172 }
2173 }
2174 else if ( evt.PropertyName == PROPERTY_REPORTFOOTERON )
2175 {
2176 sal_uInt16 nPosition = getDesignView()->getSectionCount();
2177 if ( m_xReportDefinition->getPageFooterOn() )
2178 --nPosition;
2179 if ( bShow )
2180 {
2181 getDesignView()->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER,nPosition);
2182 m_pReportControllerObserver->AddSection(m_xReportDefinition->getReportFooter());
2183 }
2184 else
2185 {
2186 getDesignView()->removeSection(nPosition - 1);
2187 }
2188 }
2189 else if ( evt.PropertyName == PROPERTY_PAGEHEADERON )
2190 {
2191 if ( bShow )
2192 {
2193 getDesignView()->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER,0);
2194 m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageHeader());
2195 }
2196 else
2197 {
2198 getDesignView()->removeSection(sal_uInt16(0));
2199 }
2200 }
2201 else if ( evt.PropertyName == PROPERTY_PAGEFOOTERON )
2202 {
2203 if ( bShow )
2204 {
2205 getDesignView()->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER);
2206 m_pReportControllerObserver->AddSection(m_xReportDefinition->getPageFooter());
2207 }
2208 else
2209 {
2210 getDesignView()->removeSection(getDesignView()->getSectionCount() - 1);
2211 }
2212 }
2213 else if ( evt.PropertyName == PROPERTY_COMMAND
2214 || evt.PropertyName == PROPERTY_COMMANDTYPE
2215 || evt.PropertyName == PROPERTY_ESCAPEPROCESSING
2216 || evt.PropertyName == PROPERTY_FILTER
2217 )
2218 {
2219 m_xColumns.clear();
2220 m_xHoldAlive.clear();
2221 InvalidateFeature(SID_FM_ADD_FIELD);
2222 if ( !getDesignView()->isAddFieldVisible() && isUiVisible() )
2223 getDesignView()->toggleAddField();
2224 }
2226 /*else if ( evt.PropertyName.equals( PROPERTY_CAPTION ) )
2227 updateTitle();*/
2228 }
2229 else
2230 {
2231 uno::Reference< report::XGroup> xGroup(evt.Source,uno::UNO_QUERY);
2232 if ( xGroup.is() )
2233 {
2234 sal_Int32 nGroupPos = getGroupPosition(xGroup);
2235
2236 groupChange(xGroup,evt.PropertyName,nGroupPos,bShow);
2237 }
2238 }
2239 }
2240 catch(const uno::Exception&)
2241 {
2242 DBG_UNHANDLED_EXCEPTION("reportdesign");
2243 }
2244}
2245
2246
2247void SAL_CALL OReportController::disposing( const lang::EventObject& Source )
2248{
2249 // simply disambiguate
2250 OReportController_BASE::disposing(Source);
2251}
2252
2253
2254static sal_uInt16 lcl_getNonVisibleGroupsBefore( const uno::Reference< report::XGroups>& _xGroups
2255 ,sal_Int32 _nGroupPos
2256 ,::std::function<bool(OGroupHelper *)> const & _pGroupMemberFunction)
2257{
2258 uno::Reference< report::XGroup> xGroup;
2259 sal_uInt16 nNonVisibleGroups = 0;
2260 sal_Int32 nCount = _xGroups->getCount();
2261 for( sal_Int32 i = 0; i < _nGroupPos && i < nCount; ++i)
2262 {
2263 xGroup.set(_xGroups->getByIndex(i),uno::UNO_QUERY);
2264 OSL_ENSURE(xGroup.is(),"Group is NULL! -> GPF");
2265 OGroupHelper aGroupHelper(xGroup);
2266 if ( !_pGroupMemberFunction(&aGroupHelper) )
2267 ++nNonVisibleGroups;
2268 }
2269 return nNonVisibleGroups;
2270}
2271
2272void OReportController::groupChange( const uno::Reference< report::XGroup>& _xGroup,std::u16string_view _sPropName,sal_Int32 _nGroupPos,bool _bShow)
2273{
2274 ::std::function<bool(OGroupHelper *)> pMemFun = ::std::mem_fn(&OGroupHelper::getHeaderOn);
2275 ::std::function<uno::Reference<report::XSection>(OGroupHelper *)> pMemFunSection = ::std::mem_fn(&OGroupHelper::getHeader);
2276 OUString sColor(DBGROUPHEADER);
2277 sal_uInt16 nPosition = 0;
2278 bool bHandle = false;
2279 if ( _sPropName == PROPERTY_HEADERON )
2280 {
2281 nPosition = m_xReportDefinition->getPageHeaderOn() ? (m_xReportDefinition->getReportHeaderOn() ? 2 : 1) : (m_xReportDefinition->getReportHeaderOn() ? 1 : 0);
2282 nPosition += (static_cast<sal_uInt16>(_nGroupPos) - lcl_getNonVisibleGroupsBefore(m_xReportDefinition->getGroups(),_nGroupPos,pMemFun));
2283 bHandle = true;
2284 }
2285 else if ( _sPropName == PROPERTY_FOOTERON )
2286 {
2287 pMemFun = ::std::mem_fn(&OGroupHelper::getFooterOn);
2288 pMemFunSection = ::std::mem_fn(&OGroupHelper::getFooter);
2289 nPosition = getDesignView()->getSectionCount();
2290
2291 if ( m_xReportDefinition->getPageFooterOn() )
2292 --nPosition;
2293 if ( m_xReportDefinition->getReportFooterOn() )
2294 --nPosition;
2296 nPosition -= (static_cast<sal_uInt16>(_nGroupPos) - lcl_getNonVisibleGroupsBefore(m_xReportDefinition->getGroups(),_nGroupPos,pMemFun));
2297 if ( !_bShow )
2298 --nPosition;
2299 bHandle = true;
2300 }
2301 if ( bHandle )
2302 {
2303 if ( _bShow )
2304 {
2305 OGroupHelper aGroupHelper(_xGroup);
2306 getDesignView()->addSection(pMemFunSection(&aGroupHelper),sColor,nPosition);
2307 }
2308 else
2309 {
2310 getDesignView()->removeSection(nPosition);
2311 }
2312 }
2313}
2314
2315IMPL_LINK_NOARG(OReportController, OnClipboardChanged, TransferableDataHelper*, void)
2316{
2317 OnInvalidateClipboard();
2318}
2319
2320void OReportController::OnInvalidateClipboard()
2321{
2322 InvalidateFeature(SID_CUT);
2323 InvalidateFeature(SID_COPY);
2324 InvalidateFeature(SID_PASTE);
2325}
2326
2327void OReportController::openPageDialog(const uno::Reference<report::XSection>& _xSection)
2328{
2329 if ( !m_xReportDefinition.is() )
2330 return;
2331
2332 // UNO->ItemSet
2333 static SfxItemInfo aItemInfos[] =
2334 {
2335 { SID_ATTR_LRSPACE, true },
2336 { SID_ATTR_ULSPACE, true },
2337 { SID_ATTR_PAGE, true },
2338 { SID_ATTR_PAGE_SIZE, true },
2339 { SID_ENUM_PAGE_MODE, true },
2340 { SID_PAPER_START, true },
2341 { SID_PAPER_END, true },
2342 { SID_ATTR_BRUSH, true },
2343 { 0, true }, // XATTR_FILLSTYLE
2344 { 0, true }, // XATTR_FILLCOLOR
2345 { 0, true }, // XATTR_FILLGRADIENT
2346 { 0, true }, // XATTR_FILLHATCH
2347 { 0, true }, // XATTR_FILLBITMAP
2348 { 0, true }, // XATTR_FILLTRANSPARENCE
2349 { 0, true }, // XATTR_GRADIENTSTEPCOUNT
2350 { 0, true }, // XATTR_FILLBMP_TILE
2351 { 0, true }, // XATTR_FILLBMP_POS
2352 { 0, true }, // XATTR_FILLBMP_SIZEX
2353 { 0, true }, // XATTR_FILLBMP_SIZEY
2354 { 0, true }, // XATTR_FILLFLOATTRANSPARENCE
2355 { 0, true }, // XATTR_SECONDARYFILLCOLOR
2356 { 0, true }, // XATTR_FILLBMP_SIZELOG
2357 { 0, true }, // XATTR_FILLBMP_TILEOFFSETX
2358 { 0, true }, // XATTR_FILLBMP_TILEOFFSETY
2359 { 0, true }, // XATTR_FILLBMP_STRETCH
2360 { 0, true }, // XATTR_FILLBMP_POSOFFSETX
2361 { 0, true }, // XATTR_FILLBMP_POSOFFSETY
2362 { 0, true }, // XATTR_FILLBACKGROUND
2363 { SID_ATTR_METRIC, true }
2364 };
2365
2367 FieldUnit eUserMetric = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
2368 static const WhichRangesContainer pRanges(svl::Items<
2370 SID_ATTR_METRIC,SID_ATTR_METRIC
2371 >);
2373
2374 const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
2375 const ::Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
2376 // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults
2377 const basegfx::BGradient aNullGrad;
2378 const XHatch aNullHatch(aNullLineCol);
2379
2380 std::vector<SfxPoolItem*> pDefaults
2381 {
2390 new XFillStyleItem,
2391 new XFillColorItem("", aNullFillCol),
2392 new XFillGradientItem(aNullGrad),
2393 new XFillHatchItem(aNullHatch),
2394 new XFillBitmapItem(Graphic()),
2397 new XFillBmpTileItem,
2398 new XFillBmpPosItem,
2401 new XFillFloatTransparenceItem(aNullGrad, false),
2402 new XSecondaryFillColorItem("", aNullFillCol),
2410 new SfxUInt16Item(RPTUI_ID_METRIC,static_cast<sal_uInt16>(eUserMetric))
2411 };
2412
2413 pPool->SetDefaults(&pDefaults);
2414
2415
2416 pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
2417 pPool->FreezeIdRanges(); // the same
2418
2419 try
2420 {
2421 SfxItemSet aDescriptor(*pPool, pRanges);
2422 // fill it
2423 if ( _xSection.is() )
2424 aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, _xSection->getBackColor()),RPTUI_ID_BRUSH));
2425 else
2426 {
2427 aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
2428 aDescriptor.Put(SvxLRSpaceItem(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN)
2429 ,getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN),0,RPTUI_ID_LRSPACE));
2430 aDescriptor.Put(SvxULSpaceItem(static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_TOPMARGIN))
2431 ,static_cast<sal_uInt16>(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BOTTOMMARGIN)),RPTUI_ID_ULSPACE));
2432 aDescriptor.Put(SfxUInt16Item(SID_ATTR_METRIC,static_cast<sal_uInt16>(eUserMetric)));
2433
2434 uno::Reference< style::XStyle> xPageStyle(getUsedStyle(m_xReportDefinition));
2435 if ( xPageStyle.is() )
2436 {
2437 SvxPageItem aPageItem(RPTUI_ID_PAGE);
2438 aPageItem.SetDescName(xPageStyle->getName());
2439 uno::Reference<beans::XPropertySet> xProp(xPageStyle,uno::UNO_QUERY_THROW);
2440 aPageItem.PutValue(xProp->getPropertyValue(PROPERTY_PAGESTYLELAYOUT),MID_PAGE_LAYOUT);
2441 aPageItem.SetLandscape(getStyleProperty<bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE));
2442 aPageItem.SetNumType(static_cast<SvxNumType>(getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE)));
2443 aDescriptor.Put(aPageItem);
2444 aDescriptor.Put(SvxBrushItem(::Color(ColorTransparency, getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
2445 }
2446 }
2447
2448 { // want the dialog to be destroyed before our set
2449 ORptPageDialog aDlg(
2450 getFrameWeld(), &aDescriptor,_xSection.is()
2451 ? OUString("BackgroundDialog")
2452 : OUString("PageDialog"));
2453 if (aDlg.run() == RET_OK)
2454 {
2455
2456 // ItemSet->UNO
2457 // UNO-properties
2458 const SfxItemSet* pSet = aDlg.GetOutputItemSet();
2459 if ( _xSection.is() )
2460 {
2461 if ( const SvxBrushItem* pBrushItem = pSet->GetItemIfSet( RPTUI_ID_BRUSH ))
2462 _xSection->setBackColor(sal_Int32(pBrushItem->GetColor()));
2463 }
2464 else
2465 {
2466 uno::Reference< beans::XPropertySet> xProp(getUsedStyle(m_xReportDefinition),uno::UNO_QUERY_THROW);
2467 const OUString sUndoAction(RptResId(RID_STR_UNDO_CHANGEPAGE));
2468 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2469 if ( const SvxSizeItem* pSizeItem = pSet->GetItemIfSet( RPTUI_ID_SIZE ))
2470 {
2471 uno::Any aValue;
2472 pSizeItem->QueryValue(aValue);
2473 xProp->setPropertyValue(PROPERTY_PAPERSIZE,aValue);
2474 resetZoomType();
2475 }
2476
2477 if ( const SvxLRSpaceItem* pSpaceItem = pSet->GetItemIfSet( RPTUI_ID_LRSPACE ))
2478 {
2479 Any aValue;
2480 pSpaceItem->QueryValue(aValue,MID_L_MARGIN);
2481 xProp->setPropertyValue(PROPERTY_LEFTMARGIN,aValue);
2482 pSpaceItem->QueryValue(aValue,MID_R_MARGIN);
2483 xProp->setPropertyValue(PROPERTY_RIGHTMARGIN,aValue);
2484 }
2485 if ( const SvxULSpaceItem* pSpaceItem = pSet->GetItemIfSet( RPTUI_ID_ULSPACE ))
2486 {
2487 xProp->setPropertyValue(PROPERTY_TOPMARGIN,uno::Any(pSpaceItem->GetUpper()));
2488 xProp->setPropertyValue(PROPERTY_BOTTOMMARGIN,uno::Any(pSpaceItem->GetLower()));
2489 }
2490 if ( const SvxPageItem* pPageItem = pSet->GetItemIfSet( RPTUI_ID_PAGE ))
2491 {
2492 xProp->setPropertyValue(PROPERTY_ISLANDSCAPE,uno::Any(pPageItem->IsLandscape()));
2493 xProp->setPropertyValue(PROPERTY_NUMBERINGTYPE,uno::Any(static_cast<sal_Int16>(pPageItem->GetNumType())));
2494 uno::Any aValue;
2495 pPageItem->QueryValue(aValue,MID_PAGE_LAYOUT);
2496 xProp->setPropertyValue(PROPERTY_PAGESTYLELAYOUT,aValue);
2497 resetZoomType();
2498 }
2499 if ( const SvxBrushItem* pBrushItem = pSet->GetItemIfSet( RPTUI_ID_BRUSH ))
2500 {
2501 ::Color aBackColor = pBrushItem->GetColor();
2502 xProp->setPropertyValue(PROPERTY_BACKTRANSPARENT,uno::Any(aBackColor == COL_TRANSPARENT));
2503 xProp->setPropertyValue(PROPERTY_BACKCOLOR,uno::Any(aBackColor));
2504 }
2505 }
2506 }
2507 }
2508 }
2509 catch(const Exception&)
2510 {
2511 DBG_UNHANDLED_EXCEPTION("reportdesign");
2512 }
2513 pPool.clear();
2514
2515 for (SfxPoolItem* pDefault : pDefaults)
2516 delete pDefault;
2517
2518}
2519
2520
2521sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel)
2522{
2523 ::osl::MutexGuard aGuard( getMutex() );
2524
2525 uno::Reference< report::XReportDefinition > xReportDefinition( xModel, UNO_QUERY );
2526 if ( !xReportDefinition.is() )
2527 return false;
2528
2529 uno::Reference< document::XUndoManagerSupplier > xTestSuppUndo( xModel, UNO_QUERY );
2530 if ( !xTestSuppUndo.is() )
2531 return false;
2532
2533 m_xReportDefinition = xReportDefinition;
2534 return true;
2535}
2536
2537
2538void OReportController::openSortingAndGroupingDialog()
2539{
2540 if ( !m_xReportDefinition.is() )
2541 return;
2542 if (!m_xGroupsFloater)
2543 {
2544 m_xGroupsFloater = std::make_shared<OGroupsSortingDialog>(getFrameWeld(), !isEditable(), this);
2545 SvtViewOptions aDlgOpt(EViewType::Window, m_xGroupsFloater->get_help_id());
2546 if ( aDlgOpt.Exists() )
2547 m_xGroupsFloater->getDialog()->set_window_state(aDlgOpt.GetWindowState());
2548 }
2549 if (isUiVisible())
2550 {
2551 if (!m_xGroupsFloater->getDialog()->get_visible())
2552 weld::DialogController::runAsync(m_xGroupsFloater, [this](sal_Int32 /*nResult*/) { m_xGroupsFloater.reset(); });
2553 else
2554 m_xGroupsFloater->response(RET_CANCEL);
2555 }
2556}
2557
2558sal_Int32 OReportController::getGroupPosition(const uno::Reference< report::XGroup >& _xGroup)
2559{
2560 return rptui::getPositionInIndexAccess(m_xReportDefinition->getGroups(),_xGroup);
2561}
2562
2563
2564void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHint)
2565{
2566 const DlgEdHint* pDlgEdHint = dynamic_cast<const DlgEdHint*>(&_rHint);
2567 if (!(pDlgEdHint && pDlgEdHint->GetKind() == RPTUI_HINT_SELECTIONCHANGED))
2568 return;
2569
2570 const sal_Int32 nSelectionCount = getDesignView()->getMarkedObjectCount();
2571 if ( m_nSelectionCount != nSelectionCount )
2572 {
2573 m_nSelectionCount = nSelectionCount;
2574 InvalidateAll();
2575 }
2576 lang::EventObject aEvent(*this);
2577 m_aSelectionListeners.forEach(
2578 [&aEvent] (uno::Reference<view::XSelectionChangeListener> const& xListener) {
2579 return xListener->selectionChanged(aEvent);
2580 });
2581}
2582
2583void OReportController::executeMethodWithUndo(TranslateId pUndoStrId,const ::std::function<void(ODesignView *)>& _pMemfun)
2584{
2585 const OUString sUndoAction = RptResId(pUndoStrId);
2586 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2587 _pMemfun( getDesignView() );
2588 InvalidateFeature( SID_UNDO );
2589}
2590
2591void OReportController::alignControlsWithUndo(TranslateId pUndoStrId, ControlModification _nControlModification, bool _bAlignAtSection)
2592{
2593 const OUString sUndoAction = RptResId(pUndoStrId);
2594 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2595 getDesignView()->alignMarkedObjects(_nControlModification,_bAlignAtSection);
2596 InvalidateFeature( SID_UNDO );
2597}
2598
2599void OReportController::shrinkSectionBottom(const uno::Reference<report::XSection>& _xSection)
2600{
2601 const sal_Int32 nElements = _xSection->getCount();
2602 if (nElements == 0)
2603 {
2604 // there are no elements
2605 return;
2606 }
2607 const sal_Int32 nSectionHeight = _xSection->getHeight();
2608 sal_Int32 nMaxPositionY = 0;
2609 uno::Reference< report::XReportComponent> xReportComponent;
2610
2611 // for every component get its Y-position and compare it to the current Y-position
2612 for (int i=0;i<nElements;i++)
2613 {
2614 xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
2615 const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
2616 const sal_Int32 nReportComponentHeight = xReportComponent->getHeight();
2617 const sal_Int32 nReportComponentPositionYAndHeight = nReportComponentPositionY + nReportComponentHeight;
2618 nMaxPositionY = std::max(nReportComponentPositionYAndHeight, nMaxPositionY);
2619 }
2620 // now we know the minimal Y-Position and maximal Y-Position
2621
2622 if (nMaxPositionY > (nSectionHeight - 7) ) // Magic Number, we use a little bit less heights for right positioning
2623 {
2624 // the lowest position is already 0
2625 return;
2626 }
2627 _xSection->setHeight(nMaxPositionY);
2628}
2629
2630void OReportController::shrinkSectionTop(const uno::Reference<report::XSection>& _xSection)
2631{
2632 const sal_Int32 nElements = _xSection->getCount();
2633 if (nElements == 0)
2634 {
2635 // there are no elements
2636 return;
2637 }
2638
2639 const sal_Int32 nSectionHeight = _xSection->getHeight();
2640 sal_Int32 nMinPositionY = nSectionHeight;
2641 uno::Reference< report::XReportComponent> xReportComponent;
2642
2643 // for every component get its Y-position and compare it to the current Y-position
2644 for (int i=0;i<nElements;i++)
2645 {
2646 xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
2647 const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
2648 nMinPositionY = std::min(nReportComponentPositionY, nMinPositionY);
2649 }
2650 // now we know the minimal Y-Position and maximal Y-Position
2651 if (nMinPositionY == 0)
2652 {
2653 // the lowest position is already 0
2654 return;
2655 }
2656 for (int i=0;i<nElements;i++)
2657 {
2658 xReportComponent.set(_xSection->getByIndex(i), uno::UNO_QUERY);
2659 const sal_Int32 nReportComponentPositionY = xReportComponent->getPositionY();
2660 const sal_Int32 nNewPositionY = nReportComponentPositionY - nMinPositionY;
2661 xReportComponent->setPositionY(nNewPositionY);
2662 }
2663 const sal_Int32 nNewSectionHeight = nSectionHeight - nMinPositionY;
2664 _xSection->setHeight(nNewSectionHeight);
2665}
2666
2667void OReportController::shrinkSection(TranslateId pUndoStrId, const uno::Reference<report::XSection>& _xSection, sal_Int32 _nSid)
2668{
2669 if ( _xSection.is() )
2670 {
2671 const OUString sUndoAction = RptResId(pUndoStrId);
2672 UndoContext aUndoContext( getUndoManager(), sUndoAction );
2673
2674 if (_nSid == SID_SECTION_SHRINK)
2675 {
2676 shrinkSectionTop(_xSection);
2677 shrinkSectionBottom(_xSection);
2678 }
2679 else if (_nSid == SID_SECTION_SHRINK_TOP)
2680 {
2681 shrinkSectionTop(_xSection);
2682 }
2683 else if (_nSid == SID_SECTION_SHRINK_BOTTOM)
2684 {
2685 shrinkSectionBottom(_xSection);
2686 }
2687 }
2688
2689 InvalidateFeature( SID_UNDO );
2690}
2691
2692
2693uno::Any SAL_CALL OReportController::getViewData()
2694{
2695 ::osl::MutexGuard aGuard( getMutex() );
2696
2697 const sal_Int32 nCommandIDs[] =
2698 {
2699 SID_GRID_VISIBLE,
2700 SID_GRID_USE,
2701 SID_HELPLINES_MOVE,
2702 SID_RULER,
2703 SID_SHOW_PROPERTYBROWSER,
2704 SID_PROPERTYBROWSER_LAST_PAGE,
2705 SID_SPLIT_POSITION
2706 };
2707
2708 ::comphelper::NamedValueCollection aCommandProperties;
2709 for (sal_Int32 nCommandID : nCommandIDs)
2710 {
2711 const FeatureState aFeatureState = GetState( nCommandID );
2712
2713 OUString sCommandURL( getURLForId( nCommandID ).Main );
2714 OSL_ENSURE( sCommandURL.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" );
2715 sCommandURL = sCommandURL.copy( 5 );
2716
2717 Any aCommandState;
2718 if ( !!aFeatureState.bChecked )
2719 aCommandState <<= *aFeatureState.bChecked;
2720 else if ( aFeatureState.aValue.hasValue() )
2721 aCommandState = aFeatureState.aValue;
2722
2723 aCommandProperties.put( sCommandURL, aCommandState );
2724 }
2725
2727 aViewData.put( "CommandProperties", aCommandProperties.getPropertyValues() );
2728
2729 if ( getDesignView() )
2730 {
2731 ::std::vector<sal_uInt16> aCollapsedPositions;
2732 getDesignView()->fillCollapsedSections(aCollapsedPositions);
2733 if ( !aCollapsedPositions.empty() )
2734 {
2735 uno::Sequence<beans::PropertyValue> aCollapsedSections(aCollapsedPositions.size());
2736 beans::PropertyValue* pCollapsedIter = aCollapsedSections.getArray();
2737 sal_Int32 i = 1;
2738 for (const auto& rPos : aCollapsedPositions)
2739 {
2740 pCollapsedIter->Name = PROPERTY_SECTION + OUString::number(i);
2741 pCollapsedIter->Value <<= static_cast<sal_Int32>(rPos);
2742 ++pCollapsedIter;
2743 ++i;
2744 }
2745
2746 aViewData.put( "CollapsedSections", aCollapsedSections );
2747 }
2748
2749 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
2750 if ( pSectionWindow )
2751 {
2752 aViewData.put( "MarkedSection", static_cast<sal_Int32>(pSectionWindow->getReportSection().getPage()->GetPageNum()) );
2753 }
2754 }
2755
2756 aViewData.put( "ZoomFactor", m_nZoomValue );
2757 return uno::Any( aViewData.getPropertyValues() );
2758}
2759
2760void SAL_CALL OReportController::restoreViewData(const uno::Any& i_data)
2761{
2762 ::osl::MutexGuard aGuard( getMutex() );
2763
2764 try
2765 {
2766 const ::comphelper::NamedValueCollection aViewData( i_data );
2767
2768 m_aCollapsedSections = aViewData.getOrDefault( "CollapsedSections", m_aCollapsedSections );
2769 m_nPageNum = aViewData.getOrDefault( "MarkedSection", m_nPageNum );
2770 m_nZoomValue = aViewData.getOrDefault( "ZoomFactor", m_nZoomValue );
2771 // TODO: setting those 3 members is not enough - in theory, restoreViewData can be called when the
2772 // view is fully alive, so we need to reflect those 3 values in the view.
2773 // (At the moment, the method is called only during construction phase)
2774
2775
2776 ::comphelper::NamedValueCollection aCommandProperties( aViewData.get( "CommandProperties" ) );
2777 const ::std::vector< OUString > aCommandNames( aCommandProperties.getNames() );
2778
2779 for ( const auto& rCommandName : aCommandNames )
2780 {
2781 const Any& rCommandValue = aCommandProperties.get( rCommandName );
2782 if ( !rCommandValue.hasValue() )
2783 continue;
2784
2785 if ( getView() )
2786 {
2787 util::URL aCommand;
2788 aCommand.Complete = ".uno:" + rCommandName;
2789
2790 executeUnChecked( aCommand, { comphelper::makePropertyValue("Value", rCommandValue) } );
2791 }
2792 else
2793 {
2794 if ( rCommandName == "ShowRuler" )
2795 OSL_VERIFY( rCommandValue >>= m_bShowRuler );
2796 else if ( rCommandName == "HelplinesMove" )
2797 OSL_VERIFY( rCommandValue >>= m_bHelplinesMove );
2798 else if ( rCommandName == "GridVisible" )
2799 OSL_VERIFY( rCommandValue >>= m_bGridVisible );
2800 else if ( rCommandName == "GridUse" )
2801 OSL_VERIFY( rCommandValue >>= m_bGridUse );
2802 else if ( rCommandName == "ControlProperties" )
2803 OSL_VERIFY( rCommandValue >>= m_bShowProperties );
2804 else if ( rCommandName == "LastPropertyBrowserPage" )
2805 OSL_VERIFY( rCommandValue >>= m_sLastActivePage );
2806 else if ( rCommandName == "SplitPosition" )
2807 OSL_VERIFY( rCommandValue >>= m_nSplitPos );
2808 }
2809 }
2810 }
2811 catch(const IllegalArgumentException&)
2812 {
2813 DBG_UNHANDLED_EXCEPTION("reportdesign");
2814 }
2815}
2816
2817Reference<XFrame> OReportController::getXFrame()
2818{
2819 if ( !m_xFrameLoader.is() )
2820 {
2821 m_xFrameLoader.set( frame::Desktop::create(m_xContext) );
2822 }
2823 const sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
2824 Reference<XFrame> xFrame = m_xFrameLoader->findFrame("_blank",nFrameSearchFlag);
2825 return xFrame;
2826}
2827
2828
2829uno::Reference<frame::XModel> OReportController::executeReport()
2830{
2831 OSL_ENSURE(m_xReportDefinition.is(),"Where is my report?");
2832
2833 uno::Reference<frame::XModel> xModel;
2834 if ( m_xReportDefinition.is() )
2835 {
2836 TranslateId pErrorId = RID_ERR_NO_COMMAND;
2837 bool bEnabled = !m_xReportDefinition->getCommand().isEmpty();
2838 if ( bEnabled )
2839 {
2840 bEnabled = false;
2841 const sal_uInt16 nCount = m_aReportModel->GetPageCount();
2842 sal_uInt16 i = 0;
2843 for (; i < nCount && !bEnabled ; ++i)
2844 {
2845 const SdrPage* pPage = m_aReportModel->GetPage(i);
2846 bEnabled = pPage->GetObjCount() != 0;
2847 }
2848 if ( !bEnabled )
2849 pErrorId = RID_ERR_NO_OBJECTS;
2850 }
2851
2853 if ( !bEnabled )
2854 {
2855 sdb::SQLContext aFirstMessage;
2856 OUString sInfo = RptResId( pErrorId );
2857 aFirstMessage.Message = sInfo;
2858 aInfo = aFirstMessage;
2859 if ( isEditable() )
2860 {
2861 sal_uInt16 nCommand = 0;
2862 if (pErrorId != RID_ERR_NO_COMMAND)
2863 {
2864 if ( !m_bShowProperties )
2865 executeUnChecked(SID_SHOW_PROPERTYBROWSER, {});
2866
2867 m_sLastActivePage = "Data";
2868 getDesignView()->setCurrentPage(m_sLastActivePage);
2869 nCommand = SID_SELECT_REPORT;
2870 }
2871 else if ( getDesignView() && !getDesignView()->isAddFieldVisible() )
2872 {
2873 nCommand = SID_FM_ADD_FIELD;
2874 }
2875 if ( nCommand )
2876 {
2877 executeUnChecked(nCommand, {});
2878 }
2879 }
2880 }
2881 else
2882 {
2883 m_bInGeneratePreview = true;
2884 try
2885 {
2886 weld::WaitObject aWait(getFrameWeld()); // cursor
2887 if ( !m_xReportEngine.is() )
2888 m_xReportEngine.set( report::ReportEngine::create(m_xContext) );
2889 m_xReportEngine->setReportDefinition(m_xReportDefinition);
2890 m_xReportEngine->setActiveConnection(getConnection());
2891 Reference<XFrame> xFrame = getXFrame();
2892 xModel = m_xReportEngine->createDocumentAlive(xFrame);
2893 }
2894 catch(const sdbc::SQLException&)
2895 { // SQLExceptions and derived exceptions must not be translated
2896 aInfo = ::cppu::getCaughtException();
2897 }
2898 catch(const uno::Exception& e)
2899 {
2900 uno::Any aCaughtException( ::cppu::getCaughtException() );
2901
2902 // our first message says: we caught an exception
2903 sdb::SQLContext aFirstMessage;
2904 OUString sInfo(RptResId(RID_STR_CAUGHT_FOREIGN_EXCEPTION));
2905 sInfo = sInfo.replaceAll("$type$", aCaughtException.getValueTypeName());
2906 aFirstMessage.Message = sInfo;
2907
2908 // our second message: the message of the exception we caught
2909 sdbc::SQLException aSecondMessage;
2910 aSecondMessage.Message = e.Message;
2911 aSecondMessage.Context = e.Context;
2912
2913 // maybe our third message: the message which is wrapped in the exception we caught
2914 sdbc::SQLException aThirdMessage;
2915 lang::WrappedTargetException aWrapped;
2916 if ( aCaughtException >>= aWrapped )
2917 {
2918 aThirdMessage.Message = aWrapped.Message;
2919 aThirdMessage.Context = aWrapped.Context;
2920 }
2921
2922 if ( !aThirdMessage.Message.isEmpty() )
2923 aSecondMessage.NextException <<= aThirdMessage;
2924 aFirstMessage.NextException <<= aSecondMessage;
2925
2926 aInfo = aFirstMessage;
2927 }
2928 if (aInfo.isValid())
2929 {
2930 const OUString suSQLContext = RptResId( RID_STR_COULD_NOT_CREATE_REPORT );
2931 aInfo.prepend(suSQLContext);
2932 }
2933 m_bInGeneratePreview = false;
2934 }
2935
2936 if (aInfo.isValid())
2937 {
2938 showError(aInfo);
2939 }
2940 }
2941 return xModel;
2942}
2943
2944uno::Reference< frame::XModel > SAL_CALL OReportController::getModel()
2945{
2946 return m_xReportDefinition;
2947}
2948
2949uno::Reference< sdbc::XRowSet > const & OReportController::getRowSet()
2950{
2951 OSL_PRECOND( m_xReportDefinition.is(), "OReportController::getRowSet: no report definition?!" );
2952
2953 if ( m_xRowSet.is() || !m_xReportDefinition.is() )
2954 return m_xRowSet;
2955
2956 try
2957 {
2958 uno::Reference< sdbc::XRowSet > xRowSet(
2959 getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", getORB()),
2960 uno::UNO_QUERY );
2961 uno::Reference< beans::XPropertySet> xRowSetProp( xRowSet, uno::UNO_QUERY_THROW );
2962
2963 xRowSetProp->setPropertyValue( PROPERTY_ACTIVECONNECTION, uno::Any( getConnection() ) );
2964 xRowSetProp->setPropertyValue( PROPERTY_APPLYFILTER, uno::Any( true ) );
2965
2966 auto aNoConverter = std::make_shared<AnyConverter>();
2967 TPropertyNamePair aPropertyMediation;
2968 aPropertyMediation.emplace( PROPERTY_COMMAND, TPropertyConverter(PROPERTY_COMMAND,aNoConverter) );
2969 aPropertyMediation.emplace( PROPERTY_COMMANDTYPE, TPropertyConverter(PROPERTY_COMMANDTYPE,aNoConverter) );
2970 aPropertyMediation.emplace( PROPERTY_ESCAPEPROCESSING, TPropertyConverter(PROPERTY_ESCAPEPROCESSING,aNoConverter) );
2971 aPropertyMediation.emplace( PROPERTY_FILTER, TPropertyConverter(PROPERTY_FILTER,aNoConverter) );
2972
2973 m_xRowSetMediator = new OPropertyMediator( m_xReportDefinition, xRowSetProp, std::move(aPropertyMediation) );
2974 m_xRowSet = xRowSet;
2975 }
2976 catch(const uno::Exception&)
2977 {
2978 DBG_UNHANDLED_EXCEPTION("reportdesign");
2979 }
2980
2981 return m_xRowSet;
2982}
2983
2984void OReportController::insertGraphic()
2985{
2986 const OUString sTitle(RptResId(RID_STR_IMPORT_GRAPHIC));
2987 // build some arguments for the upcoming dialog
2988 try
2989 {
2990 uno::Reference< report::XSection> xSection = getDesignView()->getCurrentSection();
2991 ::sfx2::FileDialogHelper aDialog(ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, getFrameWeld());
2993 aDialog.SetTitle( sTitle );
2994
2995 uno::Reference< ui::dialogs::XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY_THROW);
2996 xController->setValue(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, css::uno::Any(true));
2997 xController->enableControl(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, false/*sal_True*/);
2998 xController->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, css::uno::Any(true) );
2999
3000 if ( ERRCODE_NONE == aDialog.Execute() )
3001 {
3002 bool bLink = true;
3003 xController->getValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bLink;
3004 uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
3005 { PROPERTY_IMAGEURL, Any(aDialog.GetPath()) },
3006 { PROPERTY_PRESERVEIRI, Any(bLink) }
3007 }));
3008 createControl(aArgs,xSection,OUString(),SdrObjKind::ReportDesignImageControl);
3009 }
3010 }
3011 catch(const Exception&)
3012 {
3013 DBG_UNHANDLED_EXCEPTION("reportdesign");
3014 }
3015}
3016
3017
3018sal_Bool SAL_CALL OReportController::select( const Any& aSelection )
3019{
3020 ::osl::MutexGuard aGuard( getMutex() );
3021 if ( !getDesignView() )
3022 return true;
3023
3024 getDesignView()->unmarkAllObjects();
3025 getDesignView()->SetMode(DlgEdMode::Select);
3026
3027 uno::Sequence< uno::Reference<report::XReportComponent> > aElements;
3028 if ( aSelection >>= aElements )
3029 {
3030 if ( aElements.hasElements() )
3031 getDesignView()->showProperties(uno::Reference<uno::XInterface>(aElements[0],uno::UNO_QUERY));
3032 getDesignView()->setMarked(aElements, true);
3033 }
3034 else
3035 {
3036 uno::Reference<uno::XInterface> xObject(aSelection,uno::UNO_QUERY);
3037 uno::Reference<report::XReportComponent> xProp(xObject,uno::UNO_QUERY);
3038 if ( xProp.is() )
3039 {
3040 getDesignView()->showProperties(xObject);
3041 aElements = { xProp };
3042 getDesignView()->setMarked(aElements, true);
3043 }
3044 else
3045 {
3046 uno::Reference<report::XSection> xSection(aSelection,uno::UNO_QUERY);
3047 if ( !xSection.is() && xObject.is() )
3048 getDesignView()->showProperties(xObject);
3049 getDesignView()->setMarked(xSection,xSection.is());
3050 }
3051 }
3052 InvalidateAll();
3053 return true;
3054}
3055
3056Any SAL_CALL OReportController::getSelection( )
3057{
3058 ::osl::MutexGuard aGuard( getMutex() );
3059 Any aRet;
3060 if ( getDesignView() )
3061 {
3062 aRet = getDesignView()->getCurrentlyShownProperty();
3063 if ( !aRet.hasValue() )
3064 aRet <<= getDesignView()->getCurrentSection();
3065 }
3066 return aRet;
3067}
3068
3069void SAL_CALL OReportController::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& Listener )
3070{
3071 m_aSelectionListeners.addInterface( Listener );
3072}
3073
3074void SAL_CALL OReportController::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& Listener )
3075{
3076 m_aSelectionListeners.removeInterface( Listener );
3077}
3078
3079void OReportController::createNewFunction(const uno::Any& _aValue)
3080{
3081 uno::Reference< container::XIndexContainer> xFunctions(_aValue,uno::UNO_QUERY_THROW);
3082 const OUString sNewName = RptResId(RID_STR_FUNCTION);
3083 uno::Reference< report::XFunction> xFunction(report::Function::create(m_xContext));
3084 xFunction->setName(sNewName);
3085 // the call below will also create an undo action -> listener
3086 xFunctions->insertByIndex(xFunctions->getCount(),uno::Any(xFunction));
3087}
3088
3089IMPL_LINK_NOARG( OReportController, OnExecuteReport, void*, void )
3090{
3091 executeReport();
3092}
3093
3094void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,const uno::Reference< report::XSection>& _xSection,const OUString& _sFunction,SdrObjKind _nObjectId)
3095{
3096 SequenceAsHashMap aMap(_aArgs);
3097 getDesignView()->setMarked(_xSection, true);
3098 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
3099 if ( !pSectionWindow )
3100 return;
3101
3102 OSL_ENSURE(pSectionWindow->getReportSection().getSection() == _xSection,"Invalid section after marking the correct one.");
3103
3104 sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
3105 const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
3106 const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - nRightMargin;
3107 awt::Point aPos = aMap.getUnpackedValueOrDefault(PROPERTY_POSITION,awt::Point(nLeftMargin,0));
3108 if ( aPos.X < nLeftMargin )
3109 aPos.X = nLeftMargin;
3110
3111 rtl::Reference<SdrObject> pNewControl;
3112 uno::Reference< report::XReportComponent> xShapeProp;
3113 if ( _nObjectId == SdrObjKind::CustomShape )
3114 {
3115 pNewControl = SdrObjFactory::MakeNewObject(
3116 *m_aReportModel,
3117 SdrInventor::ReportDesign,
3118 _nObjectId);
3119 xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY);
3120 OUString sCustomShapeType = getDesignView()->GetInsertObjString();
3121 if ( sCustomShapeType.isEmpty() )
3122 sCustomShapeType = "diamond";
3123 OReportSection::createDefault(sCustomShapeType,pNewControl.get());
3124 pNewControl->SetLogicRect(tools::Rectangle(3000,500,6000,3500)); // switch height and width
3125 }
3126 else if ( _nObjectId == SdrObjKind::OLE2 || SdrObjKind::ReportDesignSubReport == _nObjectId )
3127 {
3128 pNewControl = SdrObjFactory::MakeNewObject(
3129 *m_aReportModel,
3130 SdrInventor::ReportDesign,
3131 _nObjectId);
3132
3133 pNewControl->SetLogicRect(tools::Rectangle(3000,500,8000,5500)); // switch height and width
3134 xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY_THROW);
3135 OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pNewControl.get());
3136 if ( pObj && !pObj->IsEmpty() )
3137 {
3138 pObj->initializeChart(getModel());
3139 }
3140 }
3141 else
3142 {
3145
3147 getDesignView()->GetOutDev(),
3149 0,
3150 nullptr,
3151 nullptr,
3152 _nObjectId,
3153 SdrInventor::ReportDesign,
3154 SdrObjKind::ReportDesignFixedText,
3155
3156 // tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
3157 // m_aReportModel seems pretty safe, it's done in other places, initialized
3158 // in impl_initialize and throws a RuntimeException if not existing.
3159 *m_aReportModel,
3160
3161 pLabel,
3162 pControl);
3163
3164 pLabel.clear();
3165
3166 pNewControl = pControl;
3167 OUnoObject* pObj = dynamic_cast<OUnoObject*>(pNewControl.get());
3168 assert(pObj);
3169 if(pObj)
3170 {
3171 uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
3172 xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
3173 uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
3174 uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
3175
3176 const OUString sProps[] = { OUString(PROPERTY_NAME)
3177 ,OUString(PROPERTY_FONTDESCRIPTOR)
3180 ,OUString(PROPERTY_ORIENTATION)
3181 ,OUString(PROPERTY_BORDER)
3182 ,OUString(PROPERTY_FORMATSSUPPLIER)
3183 ,OUString(PROPERTY_BACKGROUNDCOLOR)
3184 };
3185 for(const auto & sProp : sProps)
3186 {
3187 if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
3188 xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
3189 }
3190
3191 if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
3192 xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
3193
3194
3195 if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() )
3196 {
3197 ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
3198 xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::Any( aFunctionFormula.getCompleteFormula() ) );
3199 }
3200
3201 sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
3202 if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
3203 xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::Any( nFormatKey ) );
3204
3205 OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,OUString());
3206 if ( !sUrl.isEmpty() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
3207 xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::Any( sUrl ) );
3208
3209 pObj->CreateMediator(true);
3210
3211 if ( _nObjectId == SdrObjKind::ReportDesignFixedText ) // special case for fixed text
3212 xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::Any(OUnoObject::GetDefaultName(pObj)));
3213 else if ( _nObjectId == SdrObjKind::ReportDesignVerticalFixedLine )
3214 {
3215 awt::Size aOlSize = xShapeProp->getSize();
3216 xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
3217 }
3218 }
3219 }
3220
3221 const sal_Int32 nShapeWidth = aMap.getUnpackedValueOrDefault(PROPERTY_WIDTH,xShapeProp->getWidth());
3222 if ( nShapeWidth != xShapeProp->getWidth() )
3223 xShapeProp->setWidth( nShapeWidth );
3224
3225 const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
3226 if ( bChangedPos )
3227 aPos.X = nPaperWidth - nShapeWidth;
3228 xShapeProp->setPosition(aPos);
3229
3230 correctOverlapping(pNewControl.get(),pSectionWindow->getReportSection());
3231}
3232
3233void OReportController::createDateTime(const Sequence< PropertyValue >& _aArgs)
3234{
3235 getDesignView()->unmarkAllObjects();
3236
3237 const OUString sUndoAction(RptResId(RID_STR_UNDO_INSERT_CONTROL));
3238 UndoContext aUndoContext( getUndoManager(), sUndoAction );
3239
3240 SequenceAsHashMap aMap(_aArgs);
3241 aMap.createItemIfMissing(PROPERTY_FORMATKEY,aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE,sal_Int32(0)));
3242
3243 uno::Reference< report::XSection> xSection = aMap.getUnpackedValueOrDefault(PROPERTY_SECTION,uno::Reference< report::XSection>());
3244 OUString sFunction;
3245
3246 bool bDate = aMap.getUnpackedValueOrDefault(PROPERTY_DATE_STATE, false);
3247 if ( bDate )
3248 {
3249 sFunction = "TODAY()";
3250 createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
3251 }
3252 bool bTime = aMap.getUnpackedValueOrDefault(PROPERTY_TIME_STATE, false);
3253 if ( bTime )
3254 {
3255 sFunction = "TIMEVALUE(NOW())";
3256 aMap[PROPERTY_FORMATKEY] <<= aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME,sal_Int32(0));
3257 createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
3258 }
3259}
3260
3261void OReportController::createPageNumber(const Sequence< PropertyValue >& _aArgs)
3262{
3263 getDesignView()->unmarkAllObjects();
3264
3265 const OUString sUndoAction(RptResId(RID_STR_UNDO_INSERT_CONTROL));
3266 UndoContext aUndoContext( getUndoManager(), sUndoAction );
3267
3268 if ( !m_xReportDefinition->getPageHeaderOn() )
3269 {
3270 uno::Sequence< beans::PropertyValue > aArgs;
3271 executeChecked(SID_PAGEHEADERFOOTER,aArgs);
3272 }
3273
3274 SequenceAsHashMap aMap(_aArgs);
3275 bool bStateOfPage = aMap.getUnpackedValueOrDefault(PROPERTY_STATE, false);
3276
3277 OUString sFunction( RptResId(STR_RPT_PN_PAGE) );
3278 sFunction = sFunction.replaceFirst("#PAGENUMBER#", "PageNumber()");
3279
3280 if ( bStateOfPage )
3281 {
3282 sFunction += RptResId(STR_RPT_PN_PAGE_OF);
3283 sFunction = sFunction.replaceFirst("#PAGECOUNT#", "PageCount()");
3284 }
3285
3286 bool bInPageHeader = aMap.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON, true);
3287 createControl(_aArgs,bInPageHeader ? m_xReportDefinition->getPageHeader() : m_xReportDefinition->getPageFooter(),sFunction);
3288}
3289
3290
3291void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
3292{
3293 getDesignView()->unmarkAllObjects();
3294
3295 // the FormatKey determines which field is required
3296 OSectionWindow* pSectionWindow[2];
3297 pSectionWindow[0] = getDesignView()->getMarkedSection();
3298
3299 if ( !pSectionWindow[0] )
3300 {
3301 select(uno::Any(m_xReportDefinition->getDetail()));
3302 pSectionWindow[0] = getDesignView()->getMarkedSection();
3303 if ( !pSectionWindow[0] )
3304 return;
3305 }
3306
3307 uno::Reference<report::XSection> xCurrentSection = getDesignView()->getCurrentSection();
3308 UndoContext aUndoContext(getUndoManager(), RptResId(RID_STR_UNDO_INSERT_CONTROL));
3309
3310 try
3311 {
3312 bool bHandleOnlyOne = false;
3313 for(const PropertyValue& rArg : aArgs)
3314 {
3315 if (bHandleOnlyOne)
3316 break;
3318 if ( !(rArg.Value >>= aValue) )
3319 { // the sequence has only one element which already contains the descriptor
3320 bHandleOnlyOne = true;
3321 aValue = aArgs;
3322 }
3323 svx::ODataAccessDescriptor aDescriptor(aValue);
3324 SequenceAsHashMap aMap(aValue);
3325 uno::Reference<report::XSection> xSection = aMap.getUnpackedValueOrDefault("Section",xCurrentSection);
3326 uno::Reference<report::XReportDefinition> xReportDefinition = xSection->getReportDefinition();
3327
3328 getDesignView()->setMarked(xSection, true);
3329 pSectionWindow[0] = getDesignView()->getMarkedSection();
3330
3331 sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_LEFTMARGIN);
3332 awt::Point aPos = aMap.getUnpackedValueOrDefault(PROPERTY_POSITION,awt::Point(nLeftMargin,0));
3333 if ( aPos.X < nLeftMargin )
3334 aPos.X = nLeftMargin;
3335
3336 // LLA: new feature, add the Label in dependency of the given DND_ACTION one section up, normal or one section down
3337 sal_Int8 nDNDAction = aMap.getUnpackedValueOrDefault("DNDAction", sal_Int8(0));
3338 pSectionWindow[1] = pSectionWindow[0];
3339 bool bLabelAboveTextField = nDNDAction == DND_ACTION_COPY;
3340 if ( bLabelAboveTextField || nDNDAction == DND_ACTION_LINK )
3341 {
3342 // Add the Label one Section up
3343 pSectionWindow[1] = getDesignView()->getMarkedSection(bLabelAboveTextField ? PREVIOUS : POST);
3344 if (!pSectionWindow[1])
3345 {
3346 // maybe out of bounds
3347 pSectionWindow[1] = pSectionWindow[0];
3348 }
3349 }
3350 // clear all selections
3351 getDesignView()->unmarkAllObjects();
3352
3353 uno::Reference< beans::XPropertySet > xField( aDescriptor[ svx::DataAccessDescriptorProperty::ColumnObject ], uno::UNO_QUERY );
3354 uno::Reference< lang::XComponent > xHoldAlive;
3355 if ( !xField.is() )
3356 {
3357 OUString sCommand;
3358 OUString sColumnName;
3359 sal_Int32 nCommandType( -1 );
3360 OSL_VERIFY( aDescriptor[ svx::DataAccessDescriptorProperty::Command ] >>= sCommand );
3361 OSL_VERIFY( aDescriptor[ svx::DataAccessDescriptorProperty::ColumnName ] >>= sColumnName );
3362 OSL_VERIFY( aDescriptor[ svx::DataAccessDescriptorProperty::CommandType ] >>= nCommandType );
3363
3364 uno::Reference< container::XNameAccess > xColumns;
3365 uno::Reference< sdbc::XConnection > xConnection( getConnection() );
3366 if ( !sCommand.isEmpty() && nCommandType != -1 && !sColumnName.isEmpty() && xConnection.is() )
3367 {
3368 if ( xReportDefinition->getCommand().isEmpty() )
3369 {
3370 xReportDefinition->setCommand(sCommand);
3371 xReportDefinition->setCommandType(nCommandType);
3372 }
3373
3374 xColumns = dbtools::getFieldsByCommandDescriptor(xConnection,nCommandType,sCommand,xHoldAlive);
3375 if ( xColumns.is() && xColumns->hasByName(sColumnName) )
3376 xField.set( xColumns->getByName( sColumnName ), uno::UNO_QUERY );
3377 }
3378
3379 if ( !xField.is() )
3380 {
3381 #if OSL_DEBUG_LEVEL > 0
3382 try
3383 {
3384 uno::Reference< beans::XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW );
3385 OUString sRowSetCommand;
3386 sal_Int32 nRowSetCommandType( -1 );
3387 OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sRowSetCommand );
3388 OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nRowSetCommandType );
3389 OSL_ENSURE( ( sRowSetCommand == sCommand ) && ( nCommandType == nRowSetCommandType ),
3390 "OReportController::addPairControls: this only works for a data source which equals our current settings!" );
3391 // if this asserts, then either our row set and our report definition are not in sync, or somebody
3392 // requested the creation of a control/pair for another data source than what our report
3393 // definition is bound to - which is not supported for the parameters case, since we
3394 // can retrieve parameters from the RowSet only.
3395 }
3396 catch(const Exception&)
3397 {
3398 DBG_UNHANDLED_EXCEPTION("reportdesign");
3399 }
3400 #endif
3401
3402 // no column name - perhaps a parameter name?
3403 uno::Reference< sdb::XParametersSupplier > xSuppParam( getRowSet(), uno::UNO_QUERY_THROW );
3404 uno::Reference< container::XIndexAccess > xParams( xSuppParam->getParameters(), uno::UNO_SET_THROW );
3405 sal_Int32 nParamCount( xParams->getCount() );
3406 for ( sal_Int32 i=0; i<nParamCount; ++i)
3407 {
3408 uno::Reference< beans::XPropertySet > xParamCol( xParams->getByIndex(i), uno::UNO_QUERY_THROW );
3409 OUString sParamName;
3410 OSL_VERIFY( xParamCol->getPropertyValue("Name") >>= sParamName );
3411 if ( sParamName == sColumnName )
3412 {
3413 xField = xParamCol;
3414 break;
3415 }
3416 }
3417 }
3418 }
3419 if ( !xField.is() )
3420 continue;
3421
3422 SdrObjKind nOBJID = SdrObjKind::NONE;
3423 sal_Int32 nDataType = sdbc::DataType::BINARY;
3424 xField->getPropertyValue(PROPERTY_TYPE) >>= nDataType;
3425 switch ( nDataType )
3426 {
3427 case sdbc::DataType::BINARY:
3428 case sdbc::DataType::VARBINARY:
3429 case sdbc::DataType::LONGVARBINARY:
3430 nOBJID = SdrObjKind::ReportDesignImageControl;
3431 break;
3432 default:
3433 nOBJID = SdrObjKind::ReportDesignFormattedField;
3434 break;
3435 }
3436
3437 if ( nOBJID == SdrObjKind::NONE )
3438 continue;
3439
3440 Reference< util::XNumberFormatsSupplier > xSupplier = getReportNumberFormatter()->getNumberFormatsSupplier();
3441 if ( !xSupplier.is() )
3442 continue;
3443
3444 Reference< XNumberFormats > xNumberFormats(xSupplier->getNumberFormats());
3445 rtl::Reference<SdrUnoObj> pControl[2];
3446 const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_RIGHTMARGIN);
3447 const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE).Width - nRightMargin;
3448 OSectionView* pSectionViews[2];
3449 pSectionViews[0] = &pSectionWindow[1]->getReportSection().getSectionView();
3450 pSectionViews[1] = &pSectionWindow[0]->getReportSection().getSectionView();
3451
3452 // find this in svx
3454 getDesignView()->GetOutDev(),
3456 0,
3457 xField,
3458 xNumberFormats,
3459 nOBJID,
3460 SdrInventor::ReportDesign,
3461 SdrObjKind::ReportDesignFixedText,
3462
3463 // tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
3464 // m_aReportModel seems pretty safe, it's done in other places, initialized
3465 // in impl_initialize and throws a RuntimeException if not existing.
3466 *m_aReportModel,
3467
3468 pControl[0],
3469 pControl[1]);
3470
3471 if ( pControl[0] && pControl[1] )
3472 {
3473 SdrPageView* pPgViews[2];
3474 pPgViews[0] = pSectionViews[0]->GetSdrPageView();
3475 pPgViews[1] = pSectionViews[1]->GetSdrPageView();
3476 if ( pPgViews[0] && pPgViews[1] )
3477 {
3478 OUString sDefaultName;
3479 size_t i = 0;
3481 for(i = 0; i < SAL_N_ELEMENTS(pControl); ++i)
3482 {
3483 pObjs[i] = dynamic_cast<OUnoObject*>(pControl[i].get());
3484 assert(pObjs[i]);
3485 uno::Reference<beans::XPropertySet> xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY_THROW);
3486 uno::Reference< report::XReportComponent> xShapeProp(pObjs[i]->getUnoShape(),uno::UNO_QUERY_THROW);
3487 xUnoProp->setPropertyValue(PROPERTY_NAME,xShapeProp->getPropertyValue(PROPERTY_NAME));
3488
3489 uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
3490 uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
3491 const OUString sProps[] = { OUString(PROPERTY_FONTDESCRIPTOR)
3494 ,OUString(PROPERTY_BORDER)
3495 ,OUString(PROPERTY_BACKGROUNDCOLOR)
3496 };
3497 for(const auto & sProp : sProps)
3498 {
3499 if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
3500 xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
3501 }
3502 if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
3503 {
3504 OUString sName;
3505 xUnoProp->getPropertyValue(PROPERTY_DATAFIELD) >>= sName;
3506 sDefaultName = sName;
3507 xUnoProp->setPropertyValue(PROPERTY_NAME,uno::Any(sDefaultName));
3508
3509 ReportFormula aFormula( ReportFormula::Field, sName );
3510 xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::Any( aFormula.getCompleteFormula() ) );
3511 }
3512
3513 if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
3514 xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
3515
3516 pObjs[i]->CreateMediator(true);
3517
3518 const sal_Int32 nShapeWidth = xShapeProp->getWidth();
3519 const bool bChangedPos = (aPos.X + nShapeWidth) > nPaperWidth;
3520 if ( bChangedPos )
3521 aPos.X = nPaperWidth - nShapeWidth;
3522 xShapeProp->setPosition(aPos);
3523 if ( bChangedPos )
3524 aPos.Y += xShapeProp->getHeight();
3525 aPos.X += nShapeWidth;
3526 }
3527 OUString sLabel;
3528 if ( xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
3529 xField->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
3530
3531 if (pSectionViews[0] != pSectionViews[1] &&
3532 nOBJID == SdrObjKind::ReportDesignFormattedField) // we want this nice feature only at FORMATTEDFIELD
3533 {
3534 uno::Reference< report::XReportComponent> xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY_THROW);
3535 uno::Reference< report::XReportComponent> xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY_THROW);
3536 if ( !sLabel.isEmpty() )
3537 xShapePropTextField->setName(sLabel);
3538 awt::Point aPosLabel = xShapePropLabel->getPosition();
3539 awt::Point aPosTextField = xShapePropTextField->getPosition();
3540 aPosTextField.X = aPosLabel.X;
3541 xShapePropTextField->setPosition(aPosTextField);
3542 if (bLabelAboveTextField)
3543 {
3544 // move the label down near the splitter
3545 const uno::Reference<report::XSection> xLabelSection = pSectionWindow[1]->getReportSection().getSection();
3546 aPosLabel.Y = xLabelSection->getHeight() - xShapePropLabel->getHeight();
3547 }
3548 else
3549 {
3550 // move the label up to the splitter
3551 aPosLabel.Y = 0;
3552 }
3553 xShapePropLabel->setPosition(aPosLabel);
3554 }
3555 rtl::Reference<OUnoObject> pObj = dynamic_cast<OUnoObject*>(pControl[0].get());
3556 assert(pObj);
3557 uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW);
3558 xShapeProp->setName(xShapeProp->getName() + sDefaultName );
3559
3560 for(i = 0; i < SAL_N_ELEMENTS(pControl); ++i) // insert controls
3561 {
3562 correctOverlapping(pControl[i].get(), pSectionWindow[1-i]->getReportSection());
3563 }
3564
3565 if (!bLabelAboveTextField )
3566 {
3567 if ( pSectionViews[0] == pSectionViews[1] )
3568 {
3570 tools::Rectangle aTextfield = getRectangleFromControl(pControl[1].get());
3571
3572 // create a Union of the given Label and Textfield
3573 tools::Rectangle aLabelAndTextfield( aLabel );
3574 aLabelAndTextfield.Union(aTextfield);
3575
3576 // check if there exists other fields and if yes, move down
3577 bool bOverlapping = true;
3578 bool bHasToMove = false;
3579 while ( bOverlapping )
3580 {
3581 const SdrObject* pOverlappedObj = isOver(aLabelAndTextfield, *pSectionWindow[0]->getReportSection().getPage(), *pSectionViews[0], true, pControl, 2);
3582 bOverlapping = pOverlappedObj != nullptr;
3583 if ( bOverlapping )
3584 {
3585 const tools::Rectangle& aLogicRect = pOverlappedObj->GetLogicRect();
3586 aLabelAndTextfield.Move(0,aLogicRect.Top() + aLogicRect.getOpenHeight() - aLabelAndTextfield.Top());
3587 bHasToMove = true;
3588 }
3589 }
3590
3591 if (bHasToMove)
3592 {
3593 // There was a move down, we need to move the Label and the Textfield down
3594 aLabel.Move(0, aLabelAndTextfield.Top() - aLabel.Top());
3595 aTextfield.Move(0, aLabelAndTextfield.Top() - aTextfield.Top());
3596
3597 uno::Reference< report::XReportComponent> xLabel(pControl[0]->getUnoShape(),uno::UNO_QUERY_THROW);
3598 xLabel->setPositionY(aLabel.Top());
3599
3600 uno::Reference< report::XReportComponent> xTextfield(pControl[1]->getUnoShape(),uno::UNO_QUERY_THROW);
3601 xTextfield->setPositionY(aTextfield.Top());
3602 }
3603 }
3604 }
3605 }
3606 }
3607 }
3608 }
3609 catch(const Exception&)
3610 {
3611 DBG_UNHANDLED_EXCEPTION("reportdesign");
3612 }
3613}
3614
3615
3616OSectionView* OReportController::getCurrentSectionView() const
3617{
3618 OSectionView* pSectionView = nullptr;
3619 OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection();
3620 if ( pSectionWindow )
3621 pSectionView = &pSectionWindow->getReportSection().getSectionView();
3622 return pSectionView;
3623}
3624
3625void OReportController::changeZOrder(sal_Int32 _nId)
3626{
3627 OSectionView* pSectionView = getCurrentSectionView();
3628 if ( !pSectionView )
3629 return;
3630
3631 switch(_nId)
3632 {
3633 case SID_FRAME_TO_BOTTOM:
3634 pSectionView->PutMarkedToBtm();
3635 break;
3636 case SID_FRAME_TO_TOP:
3637 pSectionView->PutMarkedToTop();
3638 break;
3639 case SID_FRAME_DOWN:
3640 pSectionView->MovMarkedToBtm();
3641 break;
3642 case SID_FRAME_UP:
3643 pSectionView->MovMarkedToTop();
3644 break;
3645
3646 case SID_OBJECT_HEAVEN:
3647 pSectionView->SetMarkedToLayer( RPT_LAYER_FRONT );
3648 break;
3649 case SID_OBJECT_HELL:
3650 pSectionView->SetMarkedToLayer( RPT_LAYER_BACK );
3651 break;
3652 }
3653}
3654
3655void OReportController::listen(const bool _bAdd)
3656{
3657 const OUString aProps [] = { OUString(PROPERTY_REPORTHEADERON),OUString(PROPERTY_REPORTFOOTERON)
3658 ,OUString(PROPERTY_PAGEHEADERON),OUString(PROPERTY_PAGEFOOTERON)
3659 ,OUString(PROPERTY_COMMAND), OUString(PROPERTY_COMMANDTYPE),OUString(PROPERTY_CAPTION)
3660 };
3661
3662 void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const OUString&, const uno::Reference< XPropertyChangeListener >& ) =
3663 _bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener;
3664
3665 for (const auto & aProp : aProps)
3666 (m_xReportDefinition.get()->*pPropertyListenerAction)( aProp, static_cast< XPropertyChangeListener* >( this ) );
3667
3668 OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
3669 uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv;
3670 const uno::Sequence< beans::Property> aSeq = m_xReportDefinition->getPropertySetInfo()->getProperties();
3671 const OUString* pPropsBegin = &aProps[0];
3672 const OUString* pPropsEnd = pPropsBegin + SAL_N_ELEMENTS(aProps) - 3;
3673 for(const beans::Property& rProp : aSeq)
3674 {
3675 if ( ::std::find(pPropsBegin,pPropsEnd,rProp.Name) == pPropsEnd )
3676 (m_xReportDefinition.get()->*pPropertyListenerAction)( rProp.Name, xUndo );
3677 }
3678
3679 // Add Listeners to UndoEnvironment
3680 void (OXUndoEnvironment::*pElementUndoFunction)( const uno::Reference< uno::XInterface >& ) =
3681 _bAdd ? &OXUndoEnvironment::AddElement : &OXUndoEnvironment::RemoveElement;
3682
3683 (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getStyleFamilies() );
3684 (rUndoEnv.*pElementUndoFunction)( m_xReportDefinition->getFunctions() );
3685
3686 // Add Listeners to ReportControllerObserver
3687 OXReportControllerObserver& rObserver = *m_pReportControllerObserver;
3688
3689 if ( m_xReportDefinition->getPageHeaderOn() && _bAdd )
3690 {
3691 getDesignView()->addSection(m_xReportDefinition->getPageHeader(),DBPAGEHEADER);
3692 rObserver.AddSection(m_xReportDefinition->getPageHeader());
3693 }
3694 if ( m_xReportDefinition->getReportHeaderOn() && _bAdd )
3695 {
3696 getDesignView()->addSection(m_xReportDefinition->getReportHeader(),DBREPORTHEADER);
3697 rObserver.AddSection(m_xReportDefinition->getReportHeader());
3698 }
3699
3700 uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups();
3701 const sal_Int32 nCount = xGroups->getCount();
3702 _bAdd ? xGroups->addContainerListener(&rUndoEnv) : xGroups->removeContainerListener(&rUndoEnv);
3703 _bAdd ? xGroups->addContainerListener(&rObserver) : xGroups->removeContainerListener(&rObserver);
3704
3705 for (sal_Int32 i=0;i<nCount ; ++i)
3706 {
3707 uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY);
3708 (xGroup.get()->*pPropertyListenerAction)( OUString(PROPERTY_HEADERON), static_cast< XPropertyChangeListener* >( this ) );
3709 (xGroup.get()->*pPropertyListenerAction)( OUString(PROPERTY_FOOTERON), static_cast< XPropertyChangeListener* >( this ) );
3710
3711 (rUndoEnv.*pElementUndoFunction)( xGroup );
3712 (rUndoEnv.*pElementUndoFunction)( xGroup->getFunctions() );
3713 if ( xGroup->getHeaderOn() && _bAdd )
3714 {
3715 getDesignView()->addSection(xGroup->getHeader(),DBGROUPHEADER);
3716 rObserver.AddSection(xGroup->getHeader());
3717 }
3718 }
3719
3720 if ( _bAdd )
3721 {
3722 getDesignView()->addSection(m_xReportDefinition->getDetail(),DBDETAIL);
3723 rObserver.AddSection(m_xReportDefinition->getDetail());
3724
3725 for (sal_Int32 i=nCount;i > 0 ; --i)
3726 {
3727 uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i-1),uno::UNO_QUERY);
3728 if ( xGroup->getFooterOn() )
3729 {
3730 getDesignView()->addSection(xGroup->getFooter(),DBGROUPFOOTER);
3731 rObserver.AddSection(xGroup->getFooter());
3732 }
3733 }
3734 if ( m_xReportDefinition->getReportFooterOn() )
3735 {
3736 getDesignView()->addSection(m_xReportDefinition->getReportFooter(),DBREPORTFOOTER);
3737 rObserver.AddSection(m_xReportDefinition->getReportFooter());
3738 }
3739 if ( m_xReportDefinition->getPageFooterOn())
3740 {
3741 getDesignView()->addSection(m_xReportDefinition->getPageFooter(),DBPAGEFOOTER);
3742 rObserver.AddSection(m_xReportDefinition->getPageFooter());
3743 }
3744
3745 xGroups->addContainerListener(static_cast<XContainerListener*>(this));
3746 m_xReportDefinition->addModifyListener(static_cast<XModifyListener*>(this));
3747 }
3748 else /* ! _bAdd */
3749 {
3750 rObserver.RemoveSection(m_xReportDefinition->getDetail());
3751 xGroups->removeContainerListener(static_cast<XContainerListener*>(this));
3752 m_xReportDefinition->removeModifyListener(static_cast<XModifyListener*>(this));
3753 m_aReportModel->detachController();
3754 }
3755}
3756
3757void OReportController::switchReportSection(const sal_Int16 _nId)
3758{
3759 OSL_ENSURE(_nId == SID_REPORTHEADER_WITHOUT_UNDO || _nId == SID_REPORTFOOTER_WITHOUT_UNDO || _nId == SID_REPORTHEADERFOOTER ,"Illegal id given!");
3760
3761 if ( !m_xReportDefinition.is() )
3762 return;
3763
3764 const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
3765 const bool bSwitchOn = !m_xReportDefinition->getReportHeaderOn();
3766
3767 std::unique_ptr< UndoContext > pUndoContext;
3768 if ( SID_REPORTHEADERFOOTER == _nId )
3769 {
3770 const OUString sUndoAction(RptResId(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER));
3771 pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) );
3772
3773 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel,SID_REPORTHEADER_WITHOUT_UNDO
3774 ,::std::mem_fn(&OReportHelper::getReportHeader)
3775 ,m_xReportDefinition
3776 ,bSwitchOn ? Inserted : Removed
3777 ));
3778
3779 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel,SID_REPORTFOOTER_WITHOUT_UNDO
3780 ,::std::mem_fn(&OReportHelper::getReportFooter)
3781 ,m_xReportDefinition
3782 ,bSwitchOn ? Inserted : Removed
3783 ));
3784 }
3785
3786 switch( _nId )
3787 {
3788 case SID_REPORTHEADER_WITHOUT_UNDO:
3789 m_xReportDefinition->setReportHeaderOn( bSwitchOn );
3790 break;
3791 case SID_REPORTFOOTER_WITHOUT_UNDO:
3792 m_xReportDefinition->setReportFooterOn( !m_xReportDefinition->getReportFooterOn() );
3793 break;
3794 case SID_REPORTHEADERFOOTER:
3795 m_xReportDefinition->setReportHeaderOn( bSwitchOn );
3796 m_xReportDefinition->setReportFooterOn( bSwitchOn );
3797 break;
3798 }
3799
3800 if ( SID_REPORTHEADERFOOTER == _nId )
3801 pUndoContext.reset();
3802 getView()->Resize();
3803}
3804
3805void OReportController::switchPageSection(const sal_Int16 _nId)
3806{
3807 OSL_ENSURE(_nId == SID_PAGEHEADERFOOTER || _nId == SID_PAGEHEADER_WITHOUT_UNDO || _nId == SID_PAGEFOOTER_WITHOUT_UNDO ,"Illegal id given!");
3808 if ( !m_xReportDefinition.is() )
3809 return;
3810
3811 const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
3812 const bool bSwitchOn = !m_xReportDefinition->getPageHeaderOn();
3813
3814 std::unique_ptr< UndoContext > pUndoContext;
3815 if ( SID_PAGEHEADERFOOTER == _nId )
3816 {
3817 const OUString sUndoAction(RptResId(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER));
3818 pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) );
3819
3820 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel
3821 ,SID_PAGEHEADER_WITHOUT_UNDO
3822 ,::std::mem_fn(&OReportHelper::getPageHeader)
3823 ,m_xReportDefinition
3824 ,bSwitchOn ? Inserted : Removed
3825 ));
3826
3827 addUndoAction(std::make_unique<OReportSectionUndo>(*m_aReportModel
3828 ,SID_PAGEFOOTER_WITHOUT_UNDO
3829 ,::std::mem_fn(&OReportHelper::getPageFooter)
3830 ,m_xReportDefinition
3831 ,bSwitchOn ? Inserted : Removed
3832 ));
3833 }
3834 switch( _nId )
3835 {
3836 case SID_PAGEHEADER_WITHOUT_UNDO:
3837 m_xReportDefinition->setPageHeaderOn( bSwitchOn );
3838 break;
3839 case SID_PAGEFOOTER_WITHOUT_UNDO:
3840 m_xReportDefinition->setPageFooterOn( !m_xReportDefinition->getPageFooterOn() );
3841 break;
3842 case SID_PAGEHEADERFOOTER:
3843 m_xReportDefinition->setPageHeaderOn( bSwitchOn );
3844 m_xReportDefinition->setPageFooterOn( bSwitchOn );
3845 break;
3846 }
3847 if ( SID_PAGEHEADERFOOTER == _nId )
3848 pUndoContext.reset();
3849 getView()->Resize();
3850}
3851
3852void OReportController::modifyGroup(const bool _bAppend, const Sequence< PropertyValue >& _aArgs)
3853{
3854 if ( !m_xReportDefinition.is() )
3855 return;
3856
3857 try
3858 {
3859 const SequenceAsHashMap aMap( _aArgs );
3860 uno::Reference< report::XGroup > xGroup = aMap.getUnpackedValueOrDefault( PROPERTY_GROUP, uno::Reference< report::XGroup >() );
3861 if ( !xGroup.is() )
3862 return;
3863
3864 OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
3865 uno::Reference< report::XGroups > xGroups = m_xReportDefinition->getGroups();
3866 if ( _bAppend )
3867 {
3868 const sal_Int32 nPos = aMap.getUnpackedValueOrDefault( PROPERTY_POSITIONY, xGroups->getCount() );
3869 xGroups->insertByIndex( nPos, uno::Any( xGroup ) );
3870 rUndoEnv.AddElement( xGroup->getFunctions() );
3871 }
3872
3873 addUndoAction( std::make_unique<OGroupUndo>(
3874 *m_aReportModel,
3875 _bAppend ? RID_STR_UNDO_APPEND_GROUP : RID_STR_UNDO_REMOVE_GROUP,
3876 _bAppend ? Inserted : Removed,
3877 xGroup,
3878 m_xReportDefinition
3879 ) );
3880
3881 if ( !_bAppend )
3882 {
3883 rUndoEnv.RemoveElement( xGroup->getFunctions() );
3884 const sal_Int32 nPos = getGroupPosition( xGroup );
3885 const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() );
3886 xGroups->removeByIndex( nPos );
3887 }
3888 }
3889 catch(const Exception&)
3890 {
3891 DBG_UNHANDLED_EXCEPTION("reportdesign");
3892 }
3893}
3894
3895
3896void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader, const Sequence< PropertyValue >& _aArgs)
3897{
3898 if ( !m_xReportDefinition.is() )
3899 return;
3900
3901 const SequenceAsHashMap aMap(_aArgs);
3902 const bool bSwitchOn = aMap.getUnpackedValueOrDefault(_bHeader ? OUString(PROPERTY_HEADERON) : OUString(PROPERTY_FOOTERON), false);
3903 uno::Reference< report::XGroup> xGroup = aMap.getUnpackedValueOrDefault(PROPERTY_GROUP,uno::Reference< report::XGroup>());
3904 if ( !xGroup.is() )
3905 return;
3906
3907 const OXUndoEnvironment::OUndoEnvLock aLock(m_aReportModel->GetUndoEnv());
3908 if ( _bUndo )
3909 addUndoAction(std::make_unique<OGroupSectionUndo>(*m_aReportModel
3910 ,_bHeader ? SID_GROUPHEADER_WITHOUT_UNDO : SID_GROUPFOOTER_WITHOUT_UNDO
3911 ,_bHeader ? ::std::mem_fn(&OGroupHelper::getHeader) : ::std::mem_fn(&OGroupHelper::getFooter)
3912 ,xGroup
3913 ,bSwitchOn ? Inserted : Removed
3914 , ( _bHeader ?
3915 (bSwitchOn ? RID_STR_UNDO_ADD_GROUP_HEADER : RID_STR_UNDO_REMOVE_GROUP_HEADER)
3916 :(bSwitchOn ? RID_STR_UNDO_ADD_GROUP_FOOTER : RID_STR_UNDO_REMOVE_GROUP_FOOTER)
3917 )
3918 ));
3919
3920 if ( _bHeader )
3921 xGroup->setHeaderOn( bSwitchOn );
3922 else
3923 xGroup->setFooterOn( bSwitchOn );
3924}
3925
3926void OReportController::collapseSection(const bool _bCollapse)
3927{
3928 OSectionWindow *pSection = getDesignView()->getMarkedSection();
3929 if ( pSection )
3930 {
3931 pSection->setCollapsed(_bCollapse);
3932 }
3933}
3934
3935void OReportController::markSection(const bool _bNext)
3936{
3937 OSectionWindow *pSection = getDesignView()->getMarkedSection();
3938 if ( pSection )
3939 {
3940 OSectionWindow *pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS);
3941 if ( pPrevSection != pSection && pPrevSection )
3942 select(uno::Any(pPrevSection->getReportSection().getSection()));
3943 else
3944 select(uno::Any(m_xReportDefinition));
3945 }
3946 else
3947 {
3948 getDesignView()->markSection(_bNext ? 0 : getDesignView()->getSectionCount() - 1);
3949 pSection = getDesignView()->getMarkedSection();
3950 if ( pSection )
3951 select(uno::Any(pSection->getReportSection().getSection()));
3952 }
3953}
3954
3955void OReportController::createDefaultControl(const uno::Sequence< beans::PropertyValue>& _aArgs)
3956{
3957 uno::Reference< report::XSection > xSection = getDesignView()->getCurrentSection();
3958 if ( !xSection.is() )
3959 xSection = m_xReportDefinition->getDetail();
3960
3961 if ( !xSection.is() )
3962 return;
3963
3964 const beans::PropertyValue* pIter = _aArgs.getConstArray();
3965 const beans::PropertyValue* pEnd = pIter + _aArgs.getLength();
3966 const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter, pEnd,
3967 [] (const beans::PropertyValue& x) -> bool {
3968 return x.Name == "KeyModifier";
3969 });
3970 sal_Int16 nKeyModifier = 0;
3971 if ( pKeyModifier == pEnd || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) )
3972 {
3973 Sequence< PropertyValue > aCreateArgs;
3974 getDesignView()->unmarkAllObjects();
3975 createControl(aCreateArgs,xSection,OUString(),getDesignView()->GetInsertObj());
3976 }
3977}
3978
3979
3980void OReportController::checkChartEnabled()
3981{
3982 if ( m_bChartEnabledAsked )
3983 return;
3984
3985 m_bChartEnabledAsked = true;
3986
3987 try
3988 {
3989 ::utl::OConfigurationTreeRoot aConfiguration(
3990 ::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext, "/org.openoffice.Office.ReportDesign" ) );
3991
3992 bool bChartEnabled = false;
3993 static const OUStringLiteral sPropertyName( u"UserData/Chart" );
3994 if ( aConfiguration.hasByHierarchicalName(sPropertyName) )
3995 aConfiguration.getNodeValue( sPropertyName ) >>= bChartEnabled;
3996 m_bChartEnabled = bChartEnabled;
3997 }
3998 catch(const Exception&)
3999 {
4000 }
4001}
4002
4003
4004// css.frame.XTitle
4005OUString SAL_CALL OReportController::getTitle()
4006{
4007 SolarMutexGuard aSolarGuard;
4008 ::osl::MutexGuard aGuard( getMutex() );
4009
4010 uno::Reference< frame::XTitle> xTitle(m_xReportDefinition,uno::UNO_QUERY_THROW);
4011
4012 return xTitle->getTitle ();
4013}
4014
4015void OReportController::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const
4016{
4017 _rDefault <<= sal_Int16(100);
4018}
4019
4020// comphelper::OPropertyArrayUsageHelper
4021::cppu::IPropertyArrayHelper* OReportController::createArrayHelper( ) const
4022{
4023 Sequence< Property > aProps;
4024 describeProperties(aProps);
4025 return new ::cppu::OPropertyArrayHelper(aProps);
4026}
4027
4028
4029// cppu::OPropertySetHelper
4030::cppu::IPropertyArrayHelper& SAL_CALL OReportController::getInfoHelper()
4031{
4033}
4034
4035void SAL_CALL OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle,const Any& _aValue)
4036{
4037 if ( _nHandle == PROPERTY_ID_ZOOMVALUE )
4038 {
4039 _aValue >>= m_nZoomValue;
4040 impl_zoom_nothrow();
4041 }
4042}
4043void SAL_CALL OReportController::setMode( const OUString& aMode )
4044{
4045 ::osl::MutexGuard aGuard( getMutex() );
4046 m_sMode = aMode;
4047}
4048OUString SAL_CALL OReportController::getMode( )
4049{
4050 ::osl::MutexGuard aGuard( getMutex() );
4051 return m_sMode;
4052}
4053css::uno::Sequence< OUString > SAL_CALL OReportController::getSupportedModes( )
4054{
4055 return uno::Sequence< OUString> { OUString("remote"), OUString("normal") };
4056}
4057sal_Bool SAL_CALL OReportController::supportsMode( const OUString& aMode )
4058{
4059 uno::Sequence< OUString> aModes = getSupportedModes();
4060 return comphelper::findValue(aModes, aMode) != -1;
4061}
4062
4063bool OReportController::isUiVisible() const
4064{
4065 return m_sMode != "remote";
4066}
4067
4068void OReportController::impl_fillState_nothrow(const OUString& _sProperty,dbaui::FeatureState& _rState) const
4069{
4070 _rState.bEnabled = isEditable();
4071 if ( !_rState.bEnabled )
4072 return;
4073
4074 ::std::vector< uno::Reference< uno::XInterface > > aSelection;
4075 getDesignView()->fillControlModelSelection(aSelection);
4076 _rState.bEnabled = !aSelection.empty();
4077 if ( !_rState.bEnabled )
4078 return;
4079
4080 uno::Any aTemp;
4081 ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aSelection.begin();
4082 for(; aIter != aSelection.end() && _rState.bEnabled ;++aIter)
4083 {
4084 uno::Reference< beans::XPropertySet> xProp(*aIter,uno::UNO_QUERY);
4085 try
4086 {
4087 uno::Any aTemp2 = xProp->getPropertyValue(_sProperty);
4088 if ( aIter == aSelection.begin() )
4089 {
4090 aTemp = aTemp2;
4091 }
4092 else if ( aTemp != aTemp2 )
4093 break;
4094 }
4095 catch(const beans::UnknownPropertyException&)
4096 {
4097 _rState.bEnabled = false;
4098 }
4099 }
4100 if ( aIter == aSelection.end() )
4101 _rState.aValue = aTemp;
4102}
4103
4104void OReportController::impl_zoom_nothrow()
4105{
4106 Fraction aZoom(m_nZoomValue,100);
4107 setZoomFactor( aZoom, *getDesignView() );
4108 getDesignView()->zoom(aZoom);
4109 InvalidateFeature(SID_ATTR_ZOOM,Reference< XStatusListener >(), true);
4110 InvalidateFeature(SID_ATTR_ZOOMSLIDER,Reference< XStatusListener >(), true);
4111}
4112
4113bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand,const uno::Reference< report::XReportControlFormat>& _xReportControlFormat)
4114{
4115 bool bRet = false;
4116 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
4117 {
4118 try
4119 {
4120 const awt::FontDescriptor aFontDescriptor = _xReportControlFormat->getFontDescriptor();
4121
4122 switch(_nCommand)
4123 {
4124 case SID_ATTR_CHAR_WEIGHT:
4125 bRet = awt::FontWeight::BOLD == aFontDescriptor.Weight;
4126 break;
4127 case SID_ATTR_CHAR_POSTURE:
4128 bRet = awt::FontSlant_ITALIC == aFontDescriptor.Slant;
4129 break;
4130 case SID_ATTR_CHAR_UNDERLINE:
4131 bRet = awt::FontUnderline::SINGLE == aFontDescriptor.Underline;
4132 break;
4133 default:
4134 ;
4135 }
4136 }
4137 catch(const uno::Exception&)
4138 {
4139 }
4140 }
4141 return bRet;
4142}
4143
4144bool OReportController::impl_setPropertyAtControls_throw(TranslateId pUndoResId,const OUString& _sProperty,const uno::Any& _aValue,const Sequence< PropertyValue >& _aArgs)
4145{
4146 ::std::vector< uno::Reference< uno::XInterface > > aSelection;
4147 uno::Reference< awt::XWindow> xWindow;
4148 lcl_getReportControlFormat( _aArgs, getDesignView(), xWindow, aSelection );
4149
4150 const OUString sUndoAction = RptResId( pUndoResId );
4151 UndoContext aUndoContext( getUndoManager(), sUndoAction );
4152
4153 for (const auto& rxInterface : aSelection)
4154 {
4155 const uno::Reference< beans::XPropertySet > xControlModel(rxInterface,uno::UNO_QUERY);
4156 if ( xControlModel.is() )
4157 // tdf#117795: some elements may have not some property
4158 // eg class "OFixedLine" doesn't have property "CharFontName"
4159 // so in this case, instead of crashing when selecting all and changing font
4160 // just display a warning
4161 try
4162 {
4163 xControlModel->setPropertyValue(_sProperty,_aValue);
4164 }
4165 catch(const UnknownPropertyException&)
4166 {
4167 TOOLS_WARN_EXCEPTION("reportdesign", "");
4168 }
4169 }
4170
4171 return !aSelection.empty();
4172}
4173
4174void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType,dbaui::FeatureState& _rState) const
4175{
4176 _rState.bEnabled = isEditable();
4177 _rState.bChecked = getDesignView()->GetInsertObj() == SdrObjKind::CustomShape && getDesignView()->GetInsertObjString().equalsAscii(_pCustomShapeType);
4178}
4179
4180
4181OSectionWindow* OReportController::getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const
4182{
4183 if ( getDesignView() )
4184 {
4185 return getDesignView()->getSectionWindow(_xSection);
4186 }
4187
4188 // throw NullPointerException?
4189 return nullptr;
4190}
4191
4192
4193void OReportController::openZoomDialog()
4194{
4196
4197 static SfxItemInfo aItemInfos[] =
4198 {
4199 { SID_ATTR_ZOOM, true }
4200 };
4201 std::vector<SfxPoolItem*> pDefaults
4202 {
4203 new SvxZoomItem()
4204 };
4205 rtl::Reference<SfxItemPool> pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) );
4206 pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
4207 pPool->FreezeIdRanges(); // the same
4208 try
4209 {
4211 // fill it
4212 SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
4213 aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH);
4214 aDescriptor.Put(aZoomItem);
4215
4216 ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, aDescriptor));
4217 pDlg->SetLimits( 20, 400 );
4218 bool bCancel = ( RET_CANCEL == pDlg->Execute() );
4219
4220 if ( !bCancel )
4221 {
4222 const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM );
4223 m_eZoomType = rZoomItem.GetType();
4224 m_nZoomValue = rZoomItem.GetValue();
4225 if ( m_eZoomType != SvxZoomType::PERCENT )
4226 m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType );
4227
4228 impl_zoom_nothrow();
4229 }
4230 }
4231 catch(const uno::Exception&)
4232 {
4233 DBG_UNHANDLED_EXCEPTION("reportdesign");
4234 }
4235 pPool.clear();
4236
4237 for (SfxPoolItem* pDefault : pDefaults)
4238 delete pDefault;
4239}
4240
4241
4242// XVisualObject
4243void SAL_CALL OReportController::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize )
4244{
4245 ::osl::MutexGuard aGuard( getMutex() );
4246 bool bChanged =
4247 (m_aVisualAreaSize.Width != _aSize.Width ||
4248 m_aVisualAreaSize.Height != _aSize.Height);
4249 m_aVisualAreaSize = _aSize;
4250 if( bChanged )
4251 setModified( true );
4252 m_nAspect = _nAspect;
4253}
4254
4255awt::Size SAL_CALL OReportController::getVisualAreaSize( ::sal_Int64 /*nAspect*/ )
4256{
4257 ::osl::MutexGuard aGuard( getMutex() );
4258 return m_aVisualAreaSize;
4259}
4260
4261embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect )
4262{
4263 SolarMutexGuard aSolarGuard;
4264 ::osl::MutexGuard aGuard( getMutex() );
4265 embed::VisualRepresentation aResult;
4266 if ( !m_bInGeneratePreview )
4267 {
4268 m_bInGeneratePreview = true;
4269 try
4270 {
4271 if ( !m_xReportEngine.is() )
4272 m_xReportEngine.set( report::ReportEngine::create(m_xContext) );
4273 const sal_Int32 nOldMaxRows = m_xReportEngine->getMaxRows();
4274 m_xReportEngine->setMaxRows(MAX_ROWS_FOR_PREVIEW);
4275 m_xReportEngine->setReportDefinition(m_xReportDefinition);
4276 m_xReportEngine->setActiveConnection(getConnection());
4277 try
4278 {
4279 Reference<embed::XVisualObject> xTransfer(m_xReportEngine->createDocumentModel(),UNO_QUERY);
4280 if ( xTransfer.is() )
4281 {
4282 xTransfer->setVisualAreaSize(m_nAspect,m_aVisualAreaSize);
4283 aResult = xTransfer->getPreferredVisualRepresentation( _nAspect );
4284 }
4285 }
4286 catch(const uno::Exception&)
4287 {
4288 }
4289 m_xReportEngine->setMaxRows(nOldMaxRows);
4290 }
4291 catch(const uno::Exception&)
4292 {
4293 }
4294 m_bInGeneratePreview = false;
4295 }
4296 return aResult;
4297}
4298
4299::sal_Int32 SAL_CALL OReportController::getMapUnit( ::sal_Int64 /*nAspect*/ )
4300{
4301 return embed::EmbedMapUnits::ONE_100TH_MM;
4302}
4303
4304uno::Reference< container::XNameAccess > const & OReportController::getColumns() const
4305{
4306 if ( !m_xColumns.is() && m_xReportDefinition.is() && !m_xReportDefinition->getCommand().isEmpty() )
4307 {
4308 m_xColumns = dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition->getCommandType(),m_xReportDefinition->getCommand(),m_xHoldAlive);
4309 }
4310 return m_xColumns;
4311}
4312
4313OUString OReportController::getColumnLabel_throw(const OUString& i_sColumnName) const
4314{
4315 OUString sLabel;
4316 uno::Reference< container::XNameAccess > xColumns = getColumns();
4317 if ( xColumns.is() && xColumns->hasByName(i_sColumnName) )
4318 {
4319 uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(i_sColumnName),uno::UNO_QUERY_THROW);
4320 if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
4321 xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
4322 }
4323 return sLabel;
4324}
4325
4326
4327SfxUndoManager& OReportController::getUndoManager() const
4328{
4330 // this is expected to be called during UI actions, so the SM is assumed to be locked
4331
4332 std::shared_ptr< OReportModel > pReportModel( getSdrModel() );
4333 ENSURE_OR_THROW( !!pReportModel, "no access to our model" );
4334
4335 SfxUndoManager* pUndoManager( pReportModel->GetSdrUndoManager() );
4336 ENSURE_OR_THROW( pUndoManager != nullptr, "no access to our model's UndoManager" );
4337
4338 return *pUndoManager;
4339}
4340
4341
4342void OReportController::clearUndoManager() const
4343{
4344 getUndoManager().Clear();
4345}
4346
4347
4348void OReportController::addUndoAction( std::unique_ptr<SfxUndoAction> i_pAction )
4349{
4350 getUndoManager().AddUndoAction( std::move(i_pAction) );
4351
4352 InvalidateFeature( SID_UNDO );
4353 InvalidateFeature( SID_REDO );
4354}
4355
4356extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
4358 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
4359{
4360 return cppu::acquire(new OReportController(context));
4361}
4362
4363
4364/* 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)
const 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
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
const char * sName
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