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