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