1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <ReportController.hxx>
21 #include <ReportDefinition.hxx>
22 #include <CondFormat.hxx>
23 #include <UITools.hxx>
24 #include <AddField.hxx>
25 #include <toolkit/helper/vclunohelper.hxx>
26 #include <DateTime.hxx>
28 #include <sfx2/filedlghelper.hxx>
29 #include <comphelper/diagnose_ex.hxx>
30 #include <rptui_slotid.hrc>
31 #include <reportformula.hxx>
33 #include <comphelper/documentconstants.hxx>
34 #include <unotools/mediadescriptor.hxx>
35 #include <comphelper/propertysequence.hxx>
36 #include <comphelper/propertyvalue.hxx>
37 #include <comphelper/sequenceashashmap.hxx>
38 #include <comphelper/types.hxx>
40 #include <connectivity/dbtools.hxx>
41 #include <com/sun/star/style/XStyle.hpp>
42 #include <com/sun/star/style/ParagraphAdjust.hpp>
43 #include <com/sun/star/util/NumberFormatter.hpp>
44 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
45 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
46 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
47 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
48 #include <com/sun/star/frame/FrameSearchFlag.hpp>
49 #include <com/sun/star/container/XChild.hpp>
50 #include <com/sun/star/report/XImageControl.hpp>
51 #include <com/sun/star/report/XFixedLine.hpp>
52 #include <com/sun/star/report/Function.hpp>
53 #include <com/sun/star/awt/FontDescriptor.hpp>
54 #include <com/sun/star/sdb/XParametersSupplier.hpp>
55 #include <com/sun/star/sdb/CommandType.hpp>
56 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
57 #include <com/sun/star/embed/EmbedMapUnits.hpp>
58 #include <com/sun/star/awt/FontWeight.hpp>
59 #include <com/sun/star/awt/FontUnderline.hpp>
60 #include <com/sun/star/awt/FontSlant.hpp>
61 #include <com/sun/star/frame/Desktop.hpp>
62 #include <com/sun/star/frame/status/FontHeight.hpp>
63 #include <com/sun/star/report/ReportEngine.hpp>
64 #include <com/sun/star/report/XFormattedField.hpp>
65 #include <com/sun/star/sdb/SQLContext.hpp>
66 #include <com/sun/star/beans/PropertyAttribute.hpp>
67 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
69 #include <vcl/svapp.hxx>
70 #include <vcl/unohelp.hxx>
72 #include <i18nutil/paper.hxx>
73 #include <svx/fmview.hxx>
74 #include <editeng/memberids.h>
75 #include <svx/svxids.hrc>
76 #include <svx/svdobj.hxx>
77 #include <svx/unomid.hxx>
78 #include <svx/dataaccessdescriptor.hxx>
79 #include <svx/xfillit0.hxx>
80 #include <svx/xflclit.hxx>
81 #include <svx/xflgrit.hxx>
82 #include <svx/xflhtit.hxx>
83 #include <svx/xbtmpit.hxx>
84 #include <svx/xflftrit.hxx>
85 #include <svx/xsflclit.hxx>
86 #include <svx/xflbckit.hxx>
87 #include <svx/xflbmpit.hxx>
88 #include <svx/xflbmsli.hxx>
89 #include <svx/xflbmsxy.hxx>
90 #include <svx/xflbmtit.hxx>
91 #include <svx/xflboxy.hxx>
92 #include <svx/xflbstit.hxx>
93 #include <svx/xflbtoxy.hxx>
94 #include <svx/xfltrit.hxx>
95 #include <svx/xgrscit.hxx>
96 #include <editeng/svxenum.hxx>
97 #include <svx/pageitem.hxx>
98 #include <editeng/lrspitem.hxx>
99 #include <editeng/ulspitem.hxx>
100 #include <editeng/sizeitem.hxx>
101 #include <sfx2/zoomitem.hxx>
102 #include <svx/zoomslideritem.hxx>
103 #include <editeng/brushitem.hxx>
104 #include <svx/flagsdef.hxx>
105 #include <svx/svdpagv.hxx>
106 #include <svx/svxdlg.hxx>
108 #include <core_resource.hxx>
109 #include <DesignView.hxx>
110 #include <RptObject.hxx>
111 #include <RptUndo.hxx>
112 #include <strings.hxx>
113 #include <RptDef.hxx>
114 #include <ReportSection.hxx>
115 #include <SectionView.hxx>
116 #include <UndoActions.hxx>
117 #include <dlgpage.hxx>
118 #include <strings.hrc>
120 #include <svl/itempool.hxx>
121 #include <svl/itemset.hxx>
122 #include <svtools/cliplistener.hxx>
123 #include <unotools/syslocale.hxx>
124 #include <unotools/viewoptions.hxx>
125 #include <unotools/localedatawrapper.hxx>
127 #include <osl/mutex.hxx>
128 #include <PropertyForward.hxx>
129 #include <SectionWindow.hxx>
131 #include <GroupsSorting.hxx>
132 #include <PageNumber.hxx>
133 #include <UndoEnv.hxx>
136 #include <string_view>
138 #include <cppuhelper/exc_hlp.hxx>
139 #include <unotools/confignode.hxx>
141 #include <ReportControllerObserver.hxx>
143 #define MAX_ROWS_FOR_PREVIEW 20
145 #define RPTUI_ID_LRSPACE TypedWhichId<SvxLRSpaceItem>(XATTR_FILL_FIRST - 8)
146 #define RPTUI_ID_ULSPACE TypedWhichId<SvxULSpaceItem>(XATTR_FILL_FIRST - 7)
147 #define RPTUI_ID_PAGE TypedWhichId<SvxPageItem>(XATTR_FILL_FIRST - 6)
148 #define RPTUI_ID_SIZE TypedWhichId<SvxSizeItem>(XATTR_FILL_FIRST - 5)
149 #define RPTUI_ID_PAGE_MODE TypedWhichId<SfxUInt16Item>(XATTR_FILL_FIRST - 4)
150 #define RPTUI_ID_START TypedWhichId<SfxUInt16Item>(XATTR_FILL_FIRST - 3)
151 #define RPTUI_ID_END TypedWhichId<SfxUInt16Item>(XATTR_FILL_FIRST - 2)
152 #define RPTUI_ID_BRUSH TypedWhichId<SvxBrushItem>(XATTR_FILL_FIRST - 1)
153 /// Note that we deliberately overlap an existing item id, so that we can have contiguous item ids for
154 /// the static defaults.
155 #define RPTUI_ID_METRIC TypedWhichId<SfxUInt16Item>(XATTR_FILL_LAST)
157 static_assert((RPTUI_ID_METRIC
- RPTUI_ID_LRSPACE
) == 28, "Item ids are not contiguous");
159 using namespace ::com::sun::star
;
161 using namespace beans
;
162 using namespace frame
;
163 using namespace util
;
164 using namespace lang
;
165 using namespace container
;
166 using namespace sdbcx
;
167 using namespace sdbc
;
170 using namespace ui::dialogs
;
171 using namespace ::dbtools
;
172 using namespace ::rptui
;
173 using namespace ::dbaui
;
174 using namespace ::comphelper
;
175 using namespace ::cppu
;
180 void lcl_setFontWPU_nothrow(const uno::Reference
< report::XReportControlFormat
>& _xReportControlFormat
,const sal_Int32 _nId
)
182 if ( !_xReportControlFormat
.is() )
187 awt::FontDescriptor aFontDescriptor
= _xReportControlFormat
->getFontDescriptor();
190 case SID_ATTR_CHAR_WEIGHT
:
191 aFontDescriptor
.Weight
= (awt::FontWeight::NORMAL
+ awt::FontWeight::BOLD
) - aFontDescriptor
.Weight
;
193 case SID_ATTR_CHAR_POSTURE
:
194 aFontDescriptor
.Slant
= static_cast<awt::FontSlant
>(static_cast<sal_Int16
>(awt::FontSlant_ITALIC
) - static_cast<sal_Int16
>(aFontDescriptor
.Slant
));
196 case SID_ATTR_CHAR_UNDERLINE
:
197 aFontDescriptor
.Underline
= awt::FontUnderline::SINGLE
- aFontDescriptor
.Underline
;
200 OSL_FAIL("Illegal value in default!");
204 _xReportControlFormat
->setFontDescriptor(aFontDescriptor
);
206 catch(const beans::UnknownPropertyException
&)
213 static void lcl_getReportControlFormat(const Sequence
< PropertyValue
>& aArgs
,
215 uno::Reference
< awt::XWindow
>& _xWindow
,
216 ::std::vector
< uno::Reference
< uno::XInterface
> >& _rControlsFormats
)
218 uno::Reference
< report::XReportControlFormat
> xReportControlFormat
;
219 if ( aArgs
.hasElements() )
221 SequenceAsHashMap
aMap(aArgs
);
222 xReportControlFormat
= aMap
.getUnpackedValueOrDefault(REPORTCONTROLFORMAT
,uno::Reference
< report::XReportControlFormat
>());
223 _xWindow
= aMap
.getUnpackedValueOrDefault(CURRENT_WINDOW
,uno::Reference
< awt::XWindow
>());
226 if ( !xReportControlFormat
.is() )
228 _pView
->fillControlModelSelection(_rControlsFormats
);
232 _rControlsFormats
.push_back(xReportControlFormat
);
235 if ( !_xWindow
.is() )
236 _xWindow
= VCLUnoHelper::GetInterface(_pView
);
239 OUString SAL_CALL
OReportController::getImplementationName()
241 return u
"com.sun.star.report.comp.ReportDesign"_ustr
;
244 Sequence
< OUString
> SAL_CALL
OReportController::getSupportedServiceNames()
246 return { u
"com.sun.star.sdb.ReportDesign"_ustr
};
249 #define PROPERTY_ID_ZOOMVALUE 1
252 OReportController::OReportController(Reference
< XComponentContext
> const & xContext
)
253 :OReportController_BASE(xContext
)
254 ,OPropertyStateContainer(OGenericUnoController_Base::rBHelper
)
255 ,m_aSelectionListeners( getMutex() )
256 ,m_sMode(u
"normal"_ustr
)
259 ,m_nSelectionCount(0)
262 ,m_eZoomType(SvxZoomType::PERCENT
)
264 ,m_bGridVisible(true)
266 ,m_bShowProperties(true)
267 ,m_bHelplinesMove(true)
268 ,m_bChartEnabled(false)
269 ,m_bChartEnabledAsked(false)
270 ,m_bInGeneratePreview(false)
273 m_pReportControllerObserver
= new OXReportControllerObserver(*this);
274 registerProperty(u
"ZoomValue"_ustr
, PROPERTY_ID_ZOOMVALUE
,
275 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::TRANSIENT
,
276 &m_nZoomValue
, ::cppu::UnoType
<sal_Int16
>::get());
280 OReportController::~OReportController()
284 IMPLEMENT_FORWARD_XTYPEPROVIDER2(OReportController
,OReportController_BASE
,OReportController_Listener
)
285 IMPLEMENT_FORWARD_XINTERFACE2(OReportController
,OReportController_BASE
,OReportController_Listener
)
287 void OReportController::disposing()
290 if ( m_pClipboardNotifier
.is() )
292 m_pClipboardNotifier
->ClearCallbackLink();
293 m_pClipboardNotifier
->RemoveListener( getView() );
294 m_pClipboardNotifier
.clear();
296 if ( m_xGroupsFloater
)
298 SvtViewOptions
aDlgOpt(EViewType::Window
, m_xGroupsFloater
->get_help_id());
299 aDlgOpt
.SetWindowState(m_xGroupsFloater
->getDialog()->get_window_state(vcl::WindowDataMask::All
));
300 if (m_xGroupsFloater
->getDialog()->get_visible())
301 m_xGroupsFloater
->response(RET_CANCEL
);
302 m_xGroupsFloater
.reset();
307 m_xHoldAlive
.clear();
309 ::comphelper::disposeComponent( m_xRowSet
);
310 ::comphelper::disposeComponent( m_xRowSetMediator
);
311 ::comphelper::disposeComponent( m_xFormatter
);
313 catch(const uno::Exception
&)
315 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while disposing row sets.");
318 m_xRowSetMediator
.clear();
320 if ( m_xReportDefinition
.is() )
324 OSectionWindow
* pSectionWindow
= nullptr;
325 if ( getDesignView() )
326 pSectionWindow
= getDesignView()->getMarkedSection();
327 if ( pSectionWindow
)
328 pSectionWindow
->getReportSection().deactivateOle();
330 if ( m_aReportModel
)
332 m_pReportControllerObserver
->Clear();
333 m_pReportControllerObserver
.clear();
335 catch(const uno::Exception
&)
337 DBG_UNHANDLED_EXCEPTION("reportdesign");
342 EventObject
aDisposingEvent( *this );
343 m_aSelectionListeners
.disposeAndClear( aDisposingEvent
);
346 OReportController_BASE::disposing();
351 m_xReportDefinition
.clear();
352 m_aReportModel
.reset();
353 m_xFrameLoader
.clear();
354 m_xReportEngine
.clear();
356 catch(const uno::Exception
&)
359 if ( getDesignView() )
360 EndListening( *getDesignView() );
364 FeatureState
OReportController::GetState(sal_uInt16 _nId
) const
366 FeatureState aReturn
;
367 // (disabled automatically)
368 aReturn
.bEnabled
= false;
375 case SID_RPT_TEXTDOCUMENT
:
376 aReturn
.bEnabled
= isEditable();
377 aReturn
.bChecked
= (m_xReportDefinition
.is() && m_xReportDefinition
->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII
);
379 case SID_RPT_SPREADSHEET
:
380 aReturn
.bEnabled
= isEditable();
381 aReturn
.bChecked
= (m_xReportDefinition
.is() && m_xReportDefinition
->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII
);
383 case SID_REPORTHEADER_WITHOUT_UNDO
:
384 case SID_REPORTFOOTER_WITHOUT_UNDO
:
385 case SID_REPORTHEADERFOOTER
:
387 aReturn
.bEnabled
= isEditable();
388 OUString sText
= RptResId((m_xReportDefinition
.is() && m_xReportDefinition
->getReportHeaderOn()) ? RID_STR_REPORTHEADERFOOTER_DELETE
: RID_STR_REPORTHEADERFOOTER_INSERT
);
389 aReturn
.sTitle
= sText
;
392 case SID_PAGEHEADER_WITHOUT_UNDO
:
393 case SID_PAGEFOOTER_WITHOUT_UNDO
:
394 case SID_PAGEHEADERFOOTER
:
396 aReturn
.bEnabled
= isEditable();
397 OUString sText
= RptResId((m_xReportDefinition
.is() && m_xReportDefinition
->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE
: RID_STR_PAGEHEADERFOOTER_INSERT
);
398 aReturn
.sTitle
= sText
;
401 case SID_GROUP_APPEND
:
402 case SID_GROUP_REMOVE
:
403 case SID_GROUPHEADER_WITHOUT_UNDO
:
404 case SID_GROUPHEADER
:
405 case SID_GROUPFOOTER_WITHOUT_UNDO
:
406 case SID_GROUPFOOTER
:
407 aReturn
.bEnabled
= isEditable();
409 case SID_ADD_CONTROL_PAIR
:
410 aReturn
.bEnabled
= isEditable();
415 size_t ( SfxUndoManager::*retrieveCount
)( bool const ) const =
416 ( _nId
== SID_UNDO
) ? &SfxUndoManager::GetUndoActionCount
: &SfxUndoManager::GetRedoActionCount
;
418 SfxUndoManager
& rUndoManager( getUndoManager() );
419 aReturn
.bEnabled
= ( rUndoManager
.*retrieveCount
)( SfxUndoManager::TopLevel
) > 0;
420 if ( aReturn
.bEnabled
)
422 // TODO: add "Undo/Redo: prefix"
423 OUString ( SfxUndoManager::*retrieveComment
)( size_t, bool const ) const =
424 ( _nId
== SID_UNDO
) ? &SfxUndoManager::GetUndoActionComment
: &SfxUndoManager::GetRedoActionComment
;
425 aReturn
.sTitle
= (rUndoManager
.*retrieveComment
)( 0, SfxUndoManager::TopLevel
);
429 case SID_GETUNDOSTRINGS
:
430 case SID_GETREDOSTRINGS
:
432 size_t ( SfxUndoManager::*retrieveCount
)( bool const ) const =
433 ( _nId
== SID_GETUNDOSTRINGS
) ? &SfxUndoManager::GetUndoActionCount
: &SfxUndoManager::GetRedoActionCount
;
435 OUString ( SfxUndoManager::*retrieveComment
)( size_t, bool const ) const =
436 ( _nId
== SID_GETUNDOSTRINGS
) ? &SfxUndoManager::GetUndoActionComment
: &SfxUndoManager::GetRedoActionComment
;
438 SfxUndoManager
& rUndoManager( getUndoManager() );
439 size_t nCount(( rUndoManager
.*retrieveCount
)( SfxUndoManager::TopLevel
));
440 Sequence
<OUString
> aSeq(nCount
);
441 auto aSeqRange
= asNonConstRange(aSeq
);
442 for (size_t n
= 0; n
< nCount
; ++n
)
443 aSeqRange
[n
] = (rUndoManager
.*retrieveComment
)( n
, SfxUndoManager::TopLevel
);
444 aReturn
.aValue
<<= aSeq
;
445 aReturn
.bEnabled
= true;
448 case SID_OBJECT_RESIZING
:
449 case SID_OBJECT_SMALLESTWIDTH
:
450 case SID_OBJECT_SMALLESTHEIGHT
:
451 case SID_OBJECT_GREATESTWIDTH
:
452 case SID_OBJECT_GREATESTHEIGHT
:
453 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
454 if ( aReturn
.bEnabled
)
455 aReturn
.bEnabled
= m_nSelectionCount
> 1;
458 case SID_DISTRIBUTE_HLEFT
:
459 case SID_DISTRIBUTE_HCENTER
:
460 case SID_DISTRIBUTE_HDISTANCE
:
461 case SID_DISTRIBUTE_HRIGHT
:
462 case SID_DISTRIBUTE_VTOP
:
463 case SID_DISTRIBUTE_VCENTER
:
464 case SID_DISTRIBUTE_VDISTANCE
:
465 case SID_DISTRIBUTE_VBOTTOM
:
466 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
467 if ( aReturn
.bEnabled
)
469 OSectionView
* pSectionView
= getCurrentSectionView();
470 aReturn
.bEnabled
= pSectionView
&& pSectionView
->GetMarkedObjectList().GetMarkCount() > 2;
473 case SID_ARRANGEMENU
:
476 case SID_FRAME_TO_TOP
:
477 case SID_FRAME_TO_BOTTOM
:
478 case SID_OBJECT_HEAVEN
:
479 case SID_OBJECT_HELL
:
480 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
481 if ( aReturn
.bEnabled
)
483 OSectionView
* pSectionView
= getCurrentSectionView();
484 aReturn
.bEnabled
= pSectionView
&& pSectionView
->OnlyShapesMarked();
485 if ( aReturn
.bEnabled
)
487 if ( SID_OBJECT_HEAVEN
== _nId
)
488 aReturn
.bEnabled
= pSectionView
->GetLayerIdOfMarkedObjects() != RPT_LAYER_FRONT
;
489 else if ( SID_OBJECT_HELL
== _nId
)
490 aReturn
.bEnabled
= pSectionView
->GetLayerIdOfMarkedObjects() != RPT_LAYER_BACK
;
495 case SID_SECTION_SHRINK
:
496 case SID_SECTION_SHRINK_TOP
:
497 case SID_SECTION_SHRINK_BOTTOM
:
499 sal_Int32 nCount
= 0;
500 uno::Reference
<report::XSection
> xSection
= getDesignView()->getCurrentSection();
503 nCount
= xSection
->getCount();
505 aReturn
.bEnabled
= isEditable() && nCount
> 0;
508 case SID_OBJECT_ALIGN
:
509 case SID_OBJECT_ALIGN_LEFT
:
510 case SID_OBJECT_ALIGN_CENTER
:
511 case SID_OBJECT_ALIGN_RIGHT
:
512 case SID_OBJECT_ALIGN_UP
:
513 case SID_OBJECT_ALIGN_MIDDLE
:
514 case SID_OBJECT_ALIGN_DOWN
:
515 case SID_SECTION_ALIGN
:
516 case SID_SECTION_ALIGN_LEFT
:
517 case SID_SECTION_ALIGN_CENTER
:
518 case SID_SECTION_ALIGN_RIGHT
:
519 case SID_SECTION_ALIGN_UP
:
520 case SID_SECTION_ALIGN_MIDDLE
:
521 case SID_SECTION_ALIGN_DOWN
:
522 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
525 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent();
528 aReturn
.bEnabled
= getDesignView()->HasSelection() && !getDesignView()->isHandleEvent();
531 aReturn
.bEnabled
= isEditable() && !getDesignView()->isHandleEvent() && getDesignView()->IsPasteAllowed();
534 aReturn
.bEnabled
= !getDesignView()->isHandleEvent();
536 case SID_SELECTALL_IN_SECTION
:
537 aReturn
.bEnabled
= !getDesignView()->isHandleEvent();
538 if ( aReturn
.bEnabled
)
539 aReturn
.bEnabled
= getCurrentSectionView() != nullptr;
542 aReturn
.bEnabled
= getDesignView()->GetMode() == DlgEdMode::Insert
;
544 case SID_TERMINATE_INPLACEACTIVATION
:
545 aReturn
.bEnabled
= true;
547 case SID_SELECT_ALL_EDITS
:
548 case SID_SELECT_ALL_LABELS
:
549 aReturn
.bEnabled
= true;
551 case SID_RPT_NEW_FUNCTION
:
552 aReturn
.bEnabled
= isEditable();
554 case SID_COLLAPSE_SECTION
:
555 case SID_EXPAND_SECTION
:
558 aReturn
.bEnabled
= isEditable() && !getDesignView()->isHandleEvent();
561 case SID_SELECT_REPORT
:
562 aReturn
.bEnabled
= true;
564 case SID_EXECUTE_REPORT
:
565 aReturn
.bEnabled
= isConnected() && m_xReportDefinition
.is();
568 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent();
569 if ( aReturn
.bEnabled
)
571 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
572 if ( pSectionWindow
)
573 aReturn
.bEnabled
= !pSectionWindow
->getReportSection().isUiActive();
576 OUString sText
= RptResId(RID_STR_DELETE
);
577 aReturn
.sTitle
= sText
;
580 case SID_GRID_VISIBLE
:
581 aReturn
.bEnabled
= isEditable();
582 aReturn
.bChecked
= m_bGridVisible
;
585 aReturn
.bEnabled
= isEditable();
586 aReturn
.bChecked
= m_bGridUse
;
588 case SID_HELPLINES_MOVE
:
589 aReturn
.bEnabled
= isEditable();
590 aReturn
.bChecked
= m_bHelplinesMove
;
593 aReturn
.bEnabled
= isEditable();
594 aReturn
.bChecked
= m_bShowRuler
;
596 case SID_OBJECT_SELECT
:
597 aReturn
.bEnabled
= true;
598 aReturn
.bChecked
= getDesignView()->GetMode() == DlgEdMode::Select
;
600 case SID_INSERT_DIAGRAM
:
601 aReturn
.bEnabled
= isEditable();
602 aReturn
.bInvisible
= !m_bChartEnabled
;
603 aReturn
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::OLE2
;
605 case SID_FM_FIXEDTEXT
:
606 aReturn
.bEnabled
= isEditable();
607 aReturn
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignFixedText
;
609 case SID_INSERT_HFIXEDLINE
:
610 aReturn
.bEnabled
= isEditable();
611 aReturn
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignHorizontalFixedLine
;
613 case SID_INSERT_VFIXEDLINE
:
614 aReturn
.bEnabled
= isEditable();
615 aReturn
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignVerticalFixedLine
;
618 aReturn
.bEnabled
= isEditable();
619 aReturn
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignFormattedField
;
621 case SID_FM_IMAGECONTROL
:
622 aReturn
.bEnabled
= isEditable();
623 aReturn
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::ReportDesignImageControl
;
625 case SID_DRAWTBX_CS_BASIC
:
626 case SID_DRAWTBX_CS_BASIC1
:
627 case SID_DRAWTBX_CS_BASIC2
:
628 case SID_DRAWTBX_CS_BASIC3
:
629 case SID_DRAWTBX_CS_BASIC4
:
630 case SID_DRAWTBX_CS_BASIC5
:
631 case SID_DRAWTBX_CS_BASIC6
:
632 case SID_DRAWTBX_CS_BASIC7
:
633 case SID_DRAWTBX_CS_BASIC8
:
634 case SID_DRAWTBX_CS_BASIC9
:
635 case SID_DRAWTBX_CS_BASIC10
:
636 case SID_DRAWTBX_CS_BASIC11
:
637 case SID_DRAWTBX_CS_BASIC12
:
638 case SID_DRAWTBX_CS_BASIC13
:
639 case SID_DRAWTBX_CS_BASIC14
:
640 case SID_DRAWTBX_CS_BASIC15
:
641 case SID_DRAWTBX_CS_BASIC16
:
642 case SID_DRAWTBX_CS_BASIC17
:
643 case SID_DRAWTBX_CS_BASIC18
:
644 case SID_DRAWTBX_CS_BASIC19
:
645 case SID_DRAWTBX_CS_BASIC20
:
646 case SID_DRAWTBX_CS_BASIC21
:
647 case SID_DRAWTBX_CS_BASIC22
:
648 impl_fillCustomShapeState_nothrow("diamond",aReturn
);
650 case SID_DRAWTBX_CS_SYMBOL
:
651 case SID_DRAWTBX_CS_SYMBOL1
:
652 case SID_DRAWTBX_CS_SYMBOL2
:
653 case SID_DRAWTBX_CS_SYMBOL3
:
654 case SID_DRAWTBX_CS_SYMBOL4
:
655 case SID_DRAWTBX_CS_SYMBOL5
:
656 case SID_DRAWTBX_CS_SYMBOL6
:
657 case SID_DRAWTBX_CS_SYMBOL7
:
658 case SID_DRAWTBX_CS_SYMBOL8
:
659 case SID_DRAWTBX_CS_SYMBOL9
:
660 case SID_DRAWTBX_CS_SYMBOL10
:
661 case SID_DRAWTBX_CS_SYMBOL11
:
662 case SID_DRAWTBX_CS_SYMBOL12
:
663 case SID_DRAWTBX_CS_SYMBOL13
:
664 case SID_DRAWTBX_CS_SYMBOL14
:
665 case SID_DRAWTBX_CS_SYMBOL15
:
666 case SID_DRAWTBX_CS_SYMBOL16
:
667 case SID_DRAWTBX_CS_SYMBOL17
:
668 case SID_DRAWTBX_CS_SYMBOL18
:
669 impl_fillCustomShapeState_nothrow("smiley",aReturn
);
671 case SID_DRAWTBX_CS_ARROW
:
672 case SID_DRAWTBX_CS_ARROW1
:
673 case SID_DRAWTBX_CS_ARROW2
:
674 case SID_DRAWTBX_CS_ARROW3
:
675 case SID_DRAWTBX_CS_ARROW4
:
676 case SID_DRAWTBX_CS_ARROW5
:
677 case SID_DRAWTBX_CS_ARROW6
:
678 case SID_DRAWTBX_CS_ARROW7
:
679 case SID_DRAWTBX_CS_ARROW8
:
680 case SID_DRAWTBX_CS_ARROW9
:
681 case SID_DRAWTBX_CS_ARROW10
:
682 case SID_DRAWTBX_CS_ARROW11
:
683 case SID_DRAWTBX_CS_ARROW12
:
684 case SID_DRAWTBX_CS_ARROW13
:
685 case SID_DRAWTBX_CS_ARROW14
:
686 case SID_DRAWTBX_CS_ARROW15
:
687 case SID_DRAWTBX_CS_ARROW16
:
688 case SID_DRAWTBX_CS_ARROW17
:
689 case SID_DRAWTBX_CS_ARROW18
:
690 case SID_DRAWTBX_CS_ARROW19
:
691 case SID_DRAWTBX_CS_ARROW20
:
692 case SID_DRAWTBX_CS_ARROW21
:
693 case SID_DRAWTBX_CS_ARROW22
:
694 case SID_DRAWTBX_CS_ARROW23
:
695 case SID_DRAWTBX_CS_ARROW24
:
696 case SID_DRAWTBX_CS_ARROW25
:
697 case SID_DRAWTBX_CS_ARROW26
:
698 impl_fillCustomShapeState_nothrow("left-right-arrow",aReturn
);
700 case SID_DRAWTBX_CS_STAR
:
701 case SID_DRAWTBX_CS_STAR1
:
702 case SID_DRAWTBX_CS_STAR2
:
703 case SID_DRAWTBX_CS_STAR3
:
704 case SID_DRAWTBX_CS_STAR4
:
705 case SID_DRAWTBX_CS_STAR5
:
706 case SID_DRAWTBX_CS_STAR6
:
707 case SID_DRAWTBX_CS_STAR7
:
708 case SID_DRAWTBX_CS_STAR8
:
709 case SID_DRAWTBX_CS_STAR9
:
710 case SID_DRAWTBX_CS_STAR10
:
711 case SID_DRAWTBX_CS_STAR11
:
712 case SID_DRAWTBX_CS_STAR12
:
713 impl_fillCustomShapeState_nothrow("star5",aReturn
);
715 case SID_DRAWTBX_CS_FLOWCHART
:
716 case SID_DRAWTBX_CS_FLOWCHART1
:
717 case SID_DRAWTBX_CS_FLOWCHART2
:
718 case SID_DRAWTBX_CS_FLOWCHART3
:
719 case SID_DRAWTBX_CS_FLOWCHART4
:
720 case SID_DRAWTBX_CS_FLOWCHART5
:
721 case SID_DRAWTBX_CS_FLOWCHART6
:
722 case SID_DRAWTBX_CS_FLOWCHART7
:
723 case SID_DRAWTBX_CS_FLOWCHART8
:
724 case SID_DRAWTBX_CS_FLOWCHART9
:
725 case SID_DRAWTBX_CS_FLOWCHART10
:
726 case SID_DRAWTBX_CS_FLOWCHART11
:
727 case SID_DRAWTBX_CS_FLOWCHART12
:
728 case SID_DRAWTBX_CS_FLOWCHART13
:
729 case SID_DRAWTBX_CS_FLOWCHART14
:
730 case SID_DRAWTBX_CS_FLOWCHART15
:
731 case SID_DRAWTBX_CS_FLOWCHART16
:
732 case SID_DRAWTBX_CS_FLOWCHART17
:
733 case SID_DRAWTBX_CS_FLOWCHART18
:
734 case SID_DRAWTBX_CS_FLOWCHART19
:
735 case SID_DRAWTBX_CS_FLOWCHART20
:
736 case SID_DRAWTBX_CS_FLOWCHART21
:
737 case SID_DRAWTBX_CS_FLOWCHART22
:
738 case SID_DRAWTBX_CS_FLOWCHART23
:
739 case SID_DRAWTBX_CS_FLOWCHART24
:
740 case SID_DRAWTBX_CS_FLOWCHART25
:
741 case SID_DRAWTBX_CS_FLOWCHART26
:
742 case SID_DRAWTBX_CS_FLOWCHART27
:
743 case SID_DRAWTBX_CS_FLOWCHART28
:
744 impl_fillCustomShapeState_nothrow("flowchart-internal-storage",aReturn
);
746 case SID_DRAWTBX_CS_CALLOUT
:
747 case SID_DRAWTBX_CS_CALLOUT1
:
748 case SID_DRAWTBX_CS_CALLOUT2
:
749 case SID_DRAWTBX_CS_CALLOUT3
:
750 case SID_DRAWTBX_CS_CALLOUT4
:
751 case SID_DRAWTBX_CS_CALLOUT5
:
752 case SID_DRAWTBX_CS_CALLOUT6
:
753 case SID_DRAWTBX_CS_CALLOUT7
:
754 impl_fillCustomShapeState_nothrow("round-rectangular-callout",aReturn
);
756 case SID_RPT_SHOWREPORTEXPLORER
:
757 aReturn
.bEnabled
= m_xReportDefinition
.is();
758 aReturn
.bChecked
= getDesignView() && getDesignView()->isReportExplorerVisible();
760 case SID_FM_ADD_FIELD
:
761 aReturn
.bEnabled
= isConnected() && isEditable() && m_xReportDefinition
.is()
762 && !m_xReportDefinition
->getCommand().isEmpty();
763 aReturn
.bChecked
= getDesignView() && getDesignView()->isAddFieldVisible();
765 case SID_SHOW_PROPERTYBROWSER
:
766 aReturn
.bEnabled
= true;
767 aReturn
.bChecked
= m_bShowProperties
;
769 case SID_PROPERTYBROWSER_LAST_PAGE
:
770 aReturn
.bEnabled
= true;
771 aReturn
.aValue
<<= m_sLastActivePage
;
773 case SID_SPLIT_POSITION
:
774 aReturn
.bEnabled
= true;
775 aReturn
.aValue
<<= getSplitPos();
780 aReturn
.bEnabled
= isConnected() && isEditable();
783 aReturn
.bChecked
= isEditable();
786 aReturn
.bEnabled
= isEditable();
788 case SID_BACKGROUND_COLOR
:
789 impl_fillState_nothrow(PROPERTY_CONTROLBACKGROUND
,aReturn
);
791 case SID_ATTR_CHAR_COLOR_BACKGROUND
:
792 aReturn
.bEnabled
= isEditable();
794 uno::Reference
<report::XSection
> xSection
= getDesignView()->getCurrentSection();
798 aReturn
.aValue
<<= xSection
->getBackColor();
799 const uno::Reference
< report::XReportControlModel
> xControlModel(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY
);
800 aReturn
.bEnabled
= !xControlModel
.is();
802 catch(const beans::UnknownPropertyException
&)
806 aReturn
.bEnabled
= false;
809 case SID_SORTINGANDGROUPING
:
810 aReturn
.bEnabled
= true;
811 aReturn
.bChecked
= m_xGroupsFloater
&& m_xGroupsFloater
->getDialog()->get_visible();
813 case SID_ATTR_CHAR_WEIGHT
:
814 case SID_ATTR_CHAR_POSTURE
:
815 case SID_ATTR_CHAR_UNDERLINE
:
816 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR
,aReturn
);
817 if ( aReturn
.bEnabled
)
819 awt::FontDescriptor aFontDescriptor
;
820 aReturn
.aValue
>>= aFontDescriptor
;
821 aReturn
.aValue
.clear();
825 case SID_ATTR_CHAR_WEIGHT
:
826 aReturn
.bChecked
= awt::FontWeight::BOLD
== aFontDescriptor
.Weight
;
828 case SID_ATTR_CHAR_POSTURE
:
829 aReturn
.bChecked
= awt::FontSlant_ITALIC
== aFontDescriptor
.Slant
;
831 case SID_ATTR_CHAR_UNDERLINE
:
832 aReturn
.bChecked
= awt::FontUnderline::SINGLE
== aFontDescriptor
.Underline
;
839 case SID_ATTR_CHAR_COLOR
:
840 case SID_ATTR_CHAR_COLOR2
:
841 impl_fillState_nothrow(PROPERTY_CHARCOLOR
,aReturn
);
843 case SID_ATTR_CHAR_FONT
:
844 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR
,aReturn
);
846 case SID_ATTR_CHAR_FONTHEIGHT
:
847 impl_fillState_nothrow(PROPERTY_CHARHEIGHT
,aReturn
);
848 if ( aReturn
.aValue
.hasValue() )
850 frame::status::FontHeight aFontHeight
;
851 aReturn
.aValue
>>= aFontHeight
.Height
;
852 aReturn
.aValue
<<= aFontHeight
; // another type is needed here, so
855 case SID_ATTR_PARA_ADJUST_LEFT
:
856 case SID_ATTR_PARA_ADJUST_CENTER
:
857 case SID_ATTR_PARA_ADJUST_RIGHT
:
858 case SID_ATTR_PARA_ADJUST_BLOCK
:
859 impl_fillState_nothrow(PROPERTY_PARAADJUST
,aReturn
);
860 if ( aReturn
.bEnabled
)
862 ::sal_Int16 nParaAdjust
= 0;
863 if ( aReturn
.aValue
>>= nParaAdjust
)
865 switch(static_cast<style::ParagraphAdjust
>(nParaAdjust
))
867 case style::ParagraphAdjust_LEFT
:
868 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_LEFT
;
870 case style::ParagraphAdjust_RIGHT
:
871 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_RIGHT
;
873 case style::ParagraphAdjust_BLOCK
:
874 case style::ParagraphAdjust_STRETCH
:
875 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_BLOCK
;
877 case style::ParagraphAdjust_CENTER
:
878 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_CENTER
;
883 aReturn
.aValue
.clear();
887 case SID_INSERT_GRAPHIC
:
888 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable() && getDesignView()->getCurrentSection().is();
891 case SID_SETCONTROLDEFAULTS
:
892 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable();
893 if ( aReturn
.bEnabled
)
895 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
896 getDesignView()->fillControlModelSelection(aSelection
);
897 aReturn
.bEnabled
= !aSelection
.empty()
898 && std::all_of(aSelection
.begin(), aSelection
.end(), [](const uno::Reference
<uno::XInterface
>& rxInterface
) {
899 return !uno::Reference
<report::XFixedLine
>(rxInterface
, uno::UNO_QUERY
).is()
900 && !uno::Reference
<report::XImageControl
>(rxInterface
, uno::UNO_QUERY
).is()
901 && uno::Reference
<report::XReportControlFormat
>(rxInterface
, uno::UNO_QUERY
).is(); });
904 case SID_CONDITIONALFORMATTING
:
906 const uno::Reference
< report::XFormattedField
> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY
);
907 aReturn
.bEnabled
= xFormattedField
.is();
910 case SID_INSERT_FLD_PGNUMBER
:
912 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable() && getDesignView()->getCurrentSection().is();
915 case SID_EXPORTDOCASPDF
:
916 aReturn
.bEnabled
= m_xReportDefinition
.is();
918 case SID_PRINTPREVIEW
:
919 aReturn
.bEnabled
= false;
922 aReturn
.bEnabled
= true;
924 SvxZoomItem
aZoom(m_eZoomType
,m_nZoomValue
);
925 aZoom
.SetValueSet(SvxZoomEnableFlags::N50
|SvxZoomEnableFlags::N75
|SvxZoomEnableFlags::N100
|SvxZoomEnableFlags::N200
);
926 aZoom
.QueryValue(aReturn
.aValue
);
929 case SID_ATTR_ZOOMSLIDER
:
930 aReturn
.bEnabled
= true;
932 SvxZoomSliderItem
aZoomSlider(m_nZoomValue
,20,400);
933 aZoomSlider
.AddSnappingPoint(50);
934 aZoomSlider
.AddSnappingPoint(75);
935 aZoomSlider
.AddSnappingPoint(100);
936 aZoomSlider
.AddSnappingPoint(200);
937 aZoomSlider
.QueryValue(aReturn
.aValue
);
941 aReturn
= OReportController_BASE::GetState(_nId
);
949 /** extracts a background color from a dispatched SID_BACKGROUND_COLOR call
951 The dispatch might originate from either the toolbar, or the conditional
952 formatting dialog. In both cases, argument formats are different.
954 util::Color
lcl_extractBackgroundColor( const Sequence
< PropertyValue
>& _rDispatchArgs
)
956 util::Color
aColor( COL_TRANSPARENT
);
957 if ( _rDispatchArgs
.getLength() == 1 )
959 OSL_VERIFY( _rDispatchArgs
[0].Value
>>= aColor
);
963 SequenceAsHashMap
aMap( _rDispatchArgs
);
964 aColor
= aMap
.getUnpackedValueOrDefault( PROPERTY_FONTCOLOR
, aColor
);
971 void OReportController::Execute(sal_uInt16 _nId
, const Sequence
< PropertyValue
>& aArgs
)
973 SolarMutexGuard aSolarGuard
;
974 ::osl::MutexGuard
aGuard( getMutex() );
976 bool bForceBroadcast
= false;
979 case SID_RPT_TEXTDOCUMENT
:
980 if ( m_xReportDefinition
.is() )
981 m_xReportDefinition
->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII
);
983 case SID_RPT_SPREADSHEET
:
984 if (m_xReportDefinition
.is() )
985 m_xReportDefinition
->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII
);
987 case SID_REPORTHEADER_WITHOUT_UNDO
:
988 case SID_REPORTFOOTER_WITHOUT_UNDO
:
989 case SID_REPORTHEADERFOOTER
:
990 switchReportSection(_nId
);
992 case SID_PAGEHEADER_WITHOUT_UNDO
:
993 case SID_PAGEFOOTER_WITHOUT_UNDO
:
994 case SID_PAGEHEADERFOOTER
:
995 switchPageSection(_nId
);
997 case SID_GROUP_APPEND
:
998 case SID_GROUP_REMOVE
:
999 modifyGroup(_nId
== SID_GROUP_APPEND
,aArgs
);
1001 case SID_GROUPHEADER_WITHOUT_UNDO
:
1002 case SID_GROUPHEADER
:
1003 createGroupSection(SID_GROUPHEADER
== _nId
,true,aArgs
);
1005 case SID_GROUPFOOTER_WITHOUT_UNDO
:
1006 case SID_GROUPFOOTER
:
1007 createGroupSection(SID_GROUPFOOTER
== _nId
,false,aArgs
);
1009 case SID_ADD_CONTROL_PAIR
:
1010 addPairControls(aArgs
);
1015 const OXUndoEnvironment::OUndoMode
aLock( m_aReportModel
->GetUndoEnv() );
1016 bool ( SfxUndoManager::*doXDo
)() =
1017 ( _nId
== SID_UNDO
) ? &SfxUndoManager::Undo
: &SfxUndoManager::Redo
;
1018 SfxUndoManager
& rUndoManager( getUndoManager() );
1020 sal_Int16
nCount(1);
1021 if (aArgs
.hasElements() && aArgs
[0].Name
!= "KeyModifier")
1022 aArgs
[0].Value
>>= nCount
;
1024 (rUndoManager
.*doXDo
)();
1026 if (m_xGroupsFloater
&& m_xGroupsFloater
->getDialog()->get_visible())
1027 m_xGroupsFloater
->UpdateData();
1031 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION
,::std::mem_fn(&ODesignView::Cut
));
1034 getDesignView()->Copy();
1037 executeMethodWithUndo(RID_STR_UNDO_PASTE
,::std::mem_fn(&ODesignView::Paste
));
1040 case SID_FRAME_TO_TOP
:
1041 case SID_FRAME_DOWN
:
1043 case SID_FRAME_TO_BOTTOM
:
1044 case SID_OBJECT_HEAVEN
:
1045 case SID_OBJECT_HELL
:
1048 case SID_DISTRIBUTE_HLEFT
:
1049 case SID_DISTRIBUTE_HCENTER
:
1050 case SID_DISTRIBUTE_HDISTANCE
:
1051 case SID_DISTRIBUTE_HRIGHT
:
1052 case SID_DISTRIBUTE_VTOP
:
1053 case SID_DISTRIBUTE_VCENTER
:
1054 case SID_DISTRIBUTE_VDISTANCE
:
1055 case SID_DISTRIBUTE_VBOTTOM
:
1057 OSectionView
* pSectionView
= getCurrentSectionView();
1059 pSectionView
->DistributeMarkedObjects(_nId
);
1062 case SID_OBJECT_SMALLESTWIDTH
:
1063 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::WIDTH_SMALLEST
);
1065 case SID_OBJECT_SMALLESTHEIGHT
:
1066 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::HEIGHT_SMALLEST
);
1068 case SID_OBJECT_GREATESTWIDTH
:
1069 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::WIDTH_GREATEST
);
1071 case SID_OBJECT_GREATESTHEIGHT
:
1072 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::HEIGHT_GREATEST
);
1074 case SID_SECTION_ALIGN_LEFT
:
1075 case SID_OBJECT_ALIGN_LEFT
:
1076 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::LEFT
,SID_SECTION_ALIGN_LEFT
== _nId
);
1078 case SID_SECTION_ALIGN_CENTER
:
1079 case SID_OBJECT_ALIGN_CENTER
:
1080 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::CENTER_HORIZONTAL
,SID_SECTION_ALIGN_CENTER
== _nId
);
1082 case SID_SECTION_ALIGN_RIGHT
:
1083 case SID_OBJECT_ALIGN_RIGHT
:
1084 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::RIGHT
,SID_SECTION_ALIGN_RIGHT
== _nId
);
1086 case SID_SECTION_ALIGN_UP
:
1087 case SID_OBJECT_ALIGN_UP
:
1088 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::TOP
,SID_SECTION_ALIGN_UP
== _nId
);
1090 case SID_SECTION_ALIGN_MIDDLE
:
1091 case SID_OBJECT_ALIGN_MIDDLE
:
1092 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::CENTER_VERTICAL
,SID_SECTION_ALIGN_MIDDLE
== _nId
);
1094 case SID_SECTION_ALIGN_DOWN
:
1095 case SID_OBJECT_ALIGN_DOWN
:
1096 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::BOTTOM
,SID_SECTION_ALIGN_DOWN
== _nId
);
1099 case SID_SECTION_SHRINK_BOTTOM
:
1100 case SID_SECTION_SHRINK_TOP
:
1101 case SID_SECTION_SHRINK
:
1103 uno::Reference
<report::XSection
> xSection
= getDesignView()->getCurrentSection();
1104 shrinkSection(RID_STR_UNDO_SHRINK
, xSection
, _nId
);
1109 getDesignView()->SelectAll(SdrObjKind::NONE
);
1111 case SID_SELECTALL_IN_SECTION
:
1113 OSectionView
* pSectionView
= getCurrentSectionView();
1115 pSectionView
->MarkAll();
1119 getDesignView()->SetMode(DlgEdMode::Select
);
1120 InvalidateFeature( SID_OBJECT_SELECT
);
1122 case SID_SELECT_ALL_EDITS
:
1123 getDesignView()->SelectAll(SdrObjKind::ReportDesignFormattedField
);
1125 case SID_SELECT_ALL_LABELS
:
1126 getDesignView()->SelectAll(SdrObjKind::ReportDesignFixedText
);
1128 case SID_TERMINATE_INPLACEACTIVATION
:
1130 OSectionWindow
* pSection
= getDesignView()->getMarkedSection();
1132 pSection
->getReportSection().deactivateOle();
1136 if ( aArgs
.getLength() == 1 )
1137 select(aArgs
[0].Value
);
1139 case SID_SELECT_REPORT
:
1140 select(uno::Any(m_xReportDefinition
));
1142 case SID_EXECUTE_REPORT
:
1143 getView()->PostUserEvent(LINK(this, OReportController
,OnExecuteReport
));
1145 case SID_RPT_NEW_FUNCTION
:
1146 createNewFunction(aArgs
[0].Value
);
1148 case SID_COLLAPSE_SECTION
:
1149 collapseSection(true);
1151 case SID_EXPAND_SECTION
:
1152 collapseSection(false);
1161 if ( aArgs
.getLength() == 1 )
1163 uno::Reference
< report::XFunction
> xFunction
;
1164 aArgs
[0].Value
>>= xFunction
;
1165 if ( xFunction
.is() )
1167 uno::Reference
< report::XFunctions
> xFunctions(xFunction
->getParent(),uno::UNO_QUERY_THROW
);
1168 sal_Int32 nIndex
= getPositionInIndexAccess(xFunctions
, xFunction
);
1169 const OUString sUndoAction
= RptResId(RID_STR_UNDO_REMOVE_FUNCTION
);
1170 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
1171 xFunctions
->removeByIndex(nIndex
);
1172 select(uno::Any(xFunctions
->getParent()));
1173 InvalidateFeature( SID_UNDO
);
1177 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION
,::std::mem_fn(&ODesignView::Delete
));
1180 m_bGridUse
= !m_bGridUse
;
1181 getDesignView()->setGridSnap(m_bGridUse
);
1183 case SID_HELPLINES_MOVE
:
1184 m_bHelplinesMove
= !m_bHelplinesMove
;
1185 getDesignView()->setDragStripes(m_bHelplinesMove
);
1187 case SID_GRID_VISIBLE
:
1188 m_bGridVisible
= !m_bGridVisible
;
1189 getDesignView()->toggleGrid(m_bGridVisible
);
1192 m_bShowRuler
= !m_bShowRuler
;
1193 getDesignView()->showRuler(m_bShowRuler
);
1195 case SID_OBJECT_SELECT
:
1196 getDesignView()->SetMode(DlgEdMode::Select
);
1199 case SID_INSERT_DIAGRAM
:
1200 getDesignView()->SetMode( DlgEdMode::Insert
);
1201 getDesignView()->SetInsertObj( SdrObjKind::OLE2
);
1202 createDefaultControl(aArgs
);
1205 case SID_FM_FIXEDTEXT
:
1206 getDesignView()->SetMode( DlgEdMode::Insert
);
1207 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignFixedText
);
1208 createDefaultControl(aArgs
);
1211 case SID_INSERT_HFIXEDLINE
:
1212 getDesignView()->SetMode( DlgEdMode::Insert
);
1213 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignHorizontalFixedLine
);
1214 createDefaultControl(aArgs
);
1217 case SID_INSERT_VFIXEDLINE
:
1218 getDesignView()->SetMode( DlgEdMode::Insert
);
1219 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignVerticalFixedLine
);
1220 createDefaultControl(aArgs
);
1224 getDesignView()->SetMode( DlgEdMode::Insert
);
1225 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignFormattedField
);
1226 createDefaultControl(aArgs
);
1229 case SID_FM_IMAGECONTROL
:
1230 getDesignView()->SetMode( DlgEdMode::Insert
);
1231 getDesignView()->SetInsertObj( SdrObjKind::ReportDesignImageControl
);
1232 createDefaultControl(aArgs
);
1235 case SID_DRAWTBX_CS_BASIC
:
1236 case SID_DRAWTBX_CS_BASIC1
:
1237 case SID_DRAWTBX_CS_BASIC2
:
1238 case SID_DRAWTBX_CS_BASIC3
:
1239 case SID_DRAWTBX_CS_BASIC4
:
1240 case SID_DRAWTBX_CS_BASIC5
:
1241 case SID_DRAWTBX_CS_BASIC6
:
1242 case SID_DRAWTBX_CS_BASIC7
:
1243 case SID_DRAWTBX_CS_BASIC8
:
1244 case SID_DRAWTBX_CS_BASIC9
:
1245 case SID_DRAWTBX_CS_BASIC10
:
1246 case SID_DRAWTBX_CS_BASIC11
:
1247 case SID_DRAWTBX_CS_BASIC12
:
1248 case SID_DRAWTBX_CS_BASIC13
:
1249 case SID_DRAWTBX_CS_BASIC14
:
1250 case SID_DRAWTBX_CS_BASIC15
:
1251 case SID_DRAWTBX_CS_BASIC16
:
1252 case SID_DRAWTBX_CS_BASIC17
:
1253 case SID_DRAWTBX_CS_BASIC18
:
1254 case SID_DRAWTBX_CS_BASIC19
:
1255 case SID_DRAWTBX_CS_BASIC20
:
1256 case SID_DRAWTBX_CS_BASIC21
:
1257 case SID_DRAWTBX_CS_BASIC22
:
1258 case SID_DRAWTBX_CS_SYMBOL1
:
1259 case SID_DRAWTBX_CS_SYMBOL2
:
1260 case SID_DRAWTBX_CS_SYMBOL3
:
1261 case SID_DRAWTBX_CS_SYMBOL4
:
1262 case SID_DRAWTBX_CS_SYMBOL5
:
1263 case SID_DRAWTBX_CS_SYMBOL6
:
1264 case SID_DRAWTBX_CS_SYMBOL7
:
1265 case SID_DRAWTBX_CS_SYMBOL8
:
1266 case SID_DRAWTBX_CS_SYMBOL9
:
1267 case SID_DRAWTBX_CS_SYMBOL10
:
1268 case SID_DRAWTBX_CS_SYMBOL11
:
1269 case SID_DRAWTBX_CS_SYMBOL12
:
1270 case SID_DRAWTBX_CS_SYMBOL13
:
1271 case SID_DRAWTBX_CS_SYMBOL14
:
1272 case SID_DRAWTBX_CS_SYMBOL15
:
1273 case SID_DRAWTBX_CS_SYMBOL16
:
1274 case SID_DRAWTBX_CS_SYMBOL17
:
1275 case SID_DRAWTBX_CS_SYMBOL18
:
1276 case SID_DRAWTBX_CS_ARROW1
:
1277 case SID_DRAWTBX_CS_ARROW2
:
1278 case SID_DRAWTBX_CS_ARROW3
:
1279 case SID_DRAWTBX_CS_ARROW4
:
1280 case SID_DRAWTBX_CS_ARROW5
:
1281 case SID_DRAWTBX_CS_ARROW6
:
1282 case SID_DRAWTBX_CS_ARROW7
:
1283 case SID_DRAWTBX_CS_ARROW8
:
1284 case SID_DRAWTBX_CS_ARROW9
:
1285 case SID_DRAWTBX_CS_ARROW10
:
1286 case SID_DRAWTBX_CS_ARROW11
:
1287 case SID_DRAWTBX_CS_ARROW12
:
1288 case SID_DRAWTBX_CS_ARROW13
:
1289 case SID_DRAWTBX_CS_ARROW14
:
1290 case SID_DRAWTBX_CS_ARROW15
:
1291 case SID_DRAWTBX_CS_ARROW16
:
1292 case SID_DRAWTBX_CS_ARROW17
:
1293 case SID_DRAWTBX_CS_ARROW18
:
1294 case SID_DRAWTBX_CS_ARROW19
:
1295 case SID_DRAWTBX_CS_ARROW20
:
1296 case SID_DRAWTBX_CS_ARROW21
:
1297 case SID_DRAWTBX_CS_ARROW22
:
1298 case SID_DRAWTBX_CS_ARROW23
:
1299 case SID_DRAWTBX_CS_ARROW24
:
1300 case SID_DRAWTBX_CS_ARROW25
:
1301 case SID_DRAWTBX_CS_ARROW26
:
1302 case SID_DRAWTBX_CS_STAR1
:
1303 case SID_DRAWTBX_CS_STAR2
:
1304 case SID_DRAWTBX_CS_STAR3
:
1305 case SID_DRAWTBX_CS_STAR4
:
1306 case SID_DRAWTBX_CS_STAR5
:
1307 case SID_DRAWTBX_CS_STAR6
:
1308 case SID_DRAWTBX_CS_STAR7
:
1309 case SID_DRAWTBX_CS_STAR8
:
1310 case SID_DRAWTBX_CS_STAR9
:
1311 case SID_DRAWTBX_CS_STAR10
:
1312 case SID_DRAWTBX_CS_STAR11
:
1313 case SID_DRAWTBX_CS_STAR12
:
1314 case SID_DRAWTBX_CS_FLOWCHART1
:
1315 case SID_DRAWTBX_CS_FLOWCHART2
:
1316 case SID_DRAWTBX_CS_FLOWCHART3
:
1317 case SID_DRAWTBX_CS_FLOWCHART4
:
1318 case SID_DRAWTBX_CS_FLOWCHART5
:
1319 case SID_DRAWTBX_CS_FLOWCHART6
:
1320 case SID_DRAWTBX_CS_FLOWCHART7
:
1321 case SID_DRAWTBX_CS_FLOWCHART8
:
1322 case SID_DRAWTBX_CS_FLOWCHART9
:
1323 case SID_DRAWTBX_CS_FLOWCHART10
:
1324 case SID_DRAWTBX_CS_FLOWCHART11
:
1325 case SID_DRAWTBX_CS_FLOWCHART12
:
1326 case SID_DRAWTBX_CS_FLOWCHART13
:
1327 case SID_DRAWTBX_CS_FLOWCHART14
:
1328 case SID_DRAWTBX_CS_FLOWCHART15
:
1329 case SID_DRAWTBX_CS_FLOWCHART16
:
1330 case SID_DRAWTBX_CS_FLOWCHART17
:
1331 case SID_DRAWTBX_CS_FLOWCHART18
:
1332 case SID_DRAWTBX_CS_FLOWCHART19
:
1333 case SID_DRAWTBX_CS_FLOWCHART20
:
1334 case SID_DRAWTBX_CS_FLOWCHART21
:
1335 case SID_DRAWTBX_CS_FLOWCHART22
:
1336 case SID_DRAWTBX_CS_FLOWCHART23
:
1337 case SID_DRAWTBX_CS_FLOWCHART24
:
1338 case SID_DRAWTBX_CS_FLOWCHART25
:
1339 case SID_DRAWTBX_CS_FLOWCHART26
:
1340 case SID_DRAWTBX_CS_FLOWCHART27
:
1341 case SID_DRAWTBX_CS_FLOWCHART28
:
1342 case SID_DRAWTBX_CS_CALLOUT1
:
1343 case SID_DRAWTBX_CS_CALLOUT2
:
1344 case SID_DRAWTBX_CS_CALLOUT3
:
1345 case SID_DRAWTBX_CS_CALLOUT4
:
1346 case SID_DRAWTBX_CS_CALLOUT5
:
1347 case SID_DRAWTBX_CS_CALLOUT6
:
1348 case SID_DRAWTBX_CS_CALLOUT7
:
1349 case SID_DRAWTBX_CS_SYMBOL
:
1350 case SID_DRAWTBX_CS_ARROW
:
1351 case SID_DRAWTBX_CS_FLOWCHART
:
1352 case SID_DRAWTBX_CS_CALLOUT
:
1353 case SID_DRAWTBX_CS_STAR
:
1354 getDesignView()->SetMode( DlgEdMode::Insert
);
1356 URL aUrl
= getURLForId(_nId
);
1357 sal_Int32 nIndex
= 1;
1358 std::u16string_view sType
= o3tl::getToken(aUrl
.Complete
, 0,'.',nIndex
);
1359 if ( nIndex
== -1 || sType
.empty() )
1363 case SID_DRAWTBX_CS_SYMBOL
:
1366 case SID_DRAWTBX_CS_ARROW
:
1367 sType
= u
"left-right-arrow";
1369 case SID_DRAWTBX_CS_FLOWCHART
:
1370 sType
= u
"flowchart-internal-storage";
1372 case SID_DRAWTBX_CS_CALLOUT
:
1373 sType
= u
"round-rectangular-callout";
1375 case SID_DRAWTBX_CS_STAR
:
1383 sType
= o3tl::getToken(aUrl
.Complete
, 0,'.',nIndex
);
1385 getDesignView()->SetInsertObj( SdrObjKind::CustomShape
, OUString(sType
));
1386 createDefaultControl(aArgs
);
1390 case SID_RPT_SHOWREPORTEXPLORER
:
1391 if ( isUiVisible() )
1392 getDesignView()->toggleReportExplorer();
1394 case SID_FM_ADD_FIELD
:
1395 if ( isUiVisible() )
1396 getDesignView()->toggleAddField();
1398 case SID_SHOW_PROPERTYBROWSER
:
1399 if ( m_bShowProperties
)
1400 m_sLastActivePage
= getDesignView()->getCurrentPage();
1402 getDesignView()->setCurrentPage(m_sLastActivePage
);
1404 if ( isUiVisible() )
1406 m_bShowProperties
= !m_bShowProperties
;
1407 if ( aArgs
.getLength() == 1 )
1408 aArgs
[0].Value
>>= m_bShowProperties
;
1410 getDesignView()->togglePropertyBrowser(m_bShowProperties
);
1413 case SID_PROPERTYBROWSER_LAST_PAGE
: // nothing to do
1414 m_sLastActivePage
= getDesignView()->getCurrentPage();
1416 case SID_SPLIT_POSITION
:
1417 getDesignView()->Resize();
1419 case SID_PAGEDIALOG
:
1420 case SID_ATTR_CHAR_COLOR_BACKGROUND
:
1422 uno::Reference
<report::XSection
> xSection
;
1423 if (aArgs
.getLength() == 1 )
1424 aArgs
[0].Value
>>= xSection
;
1425 else if (_nId
== SID_ATTR_CHAR_COLOR_BACKGROUND
)
1426 xSection
.set(getDesignView()->getMarkedSection()->getReportSection().getSection());
1427 openPageDialog(xSection
);
1428 bForceBroadcast
= true;
1431 case SID_SORTINGANDGROUPING
:
1432 openSortingAndGroupingDialog();
1434 case SID_BACKGROUND_COLOR
:
1436 const util::Color
aColor( lcl_extractBackgroundColor( aArgs
) );
1437 if ( !impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CONTROLBACKGROUND
,uno::Any(aColor
),aArgs
) )
1439 uno::Reference
< report::XSection
> xSection
= getDesignView()->getCurrentSection();
1440 if ( xSection
.is() )
1442 xSection
->setBackColor( aColor
);
1445 bForceBroadcast
= true;
1448 case SID_ATTR_CHAR_WEIGHT
:
1449 case SID_ATTR_CHAR_POSTURE
:
1450 case SID_ATTR_CHAR_UNDERLINE
:
1452 uno::Reference
< awt::XWindow
> xWindow
;
1453 ::std::vector
< uno::Reference
< uno::XInterface
> > aControlsFormats
;
1454 lcl_getReportControlFormat( aArgs
, getDesignView(), xWindow
, aControlsFormats
);
1456 const OUString
sUndoAction(RptResId(RID_STR_UNDO_CHANGEFONT
));
1457 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
1459 for (const auto& rxControlFormat
: aControlsFormats
)
1461 uno::Reference
< report::XReportControlFormat
> xReportControlFormat(rxControlFormat
,uno::UNO_QUERY
);
1462 lcl_setFontWPU_nothrow(xReportControlFormat
,_nId
);
1466 case SID_ATTR_CHAR_COLOR
:
1467 case SID_ATTR_CHAR_COLOR2
:
1468 case SID_ATTR_CHAR_COLOR_EXT
:
1470 const util::Color
aColor( lcl_extractBackgroundColor( aArgs
) );
1471 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARCOLOR
,uno::Any(aColor
),aArgs
);
1472 bForceBroadcast
= true;
1475 case SID_ATTR_CHAR_FONT
:
1476 if ( aArgs
.getLength() == 1 )
1478 awt::FontDescriptor aFont
;
1479 if ( aArgs
[0].Value
>>= aFont
)
1481 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARFONTNAME
,uno::Any(aFont
.Name
),aArgs
);
1485 case SID_ATTR_CHAR_FONTHEIGHT
:
1486 if ( aArgs
.getLength() == 1 )
1488 float fSelVal
= 0.0;
1489 if ( aArgs
[0].Value
>>= fSelVal
)
1490 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARHEIGHT
,aArgs
[0].Value
,aArgs
);
1493 case SID_ATTR_PARA_ADJUST_LEFT
:
1494 case SID_ATTR_PARA_ADJUST_CENTER
:
1495 case SID_ATTR_PARA_ADJUST_RIGHT
:
1496 case SID_ATTR_PARA_ADJUST_BLOCK
:
1498 style::ParagraphAdjust eParagraphAdjust
= style::ParagraphAdjust_LEFT
;
1501 case SID_ATTR_PARA_ADJUST_LEFT
:
1502 eParagraphAdjust
= style::ParagraphAdjust_LEFT
;
1504 case SID_ATTR_PARA_ADJUST_CENTER
:
1505 eParagraphAdjust
= style::ParagraphAdjust_CENTER
;
1507 case SID_ATTR_PARA_ADJUST_RIGHT
:
1508 eParagraphAdjust
= style::ParagraphAdjust_RIGHT
;
1510 case SID_ATTR_PARA_ADJUST_BLOCK
:
1511 eParagraphAdjust
= style::ParagraphAdjust_BLOCK
;
1514 impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT
,PROPERTY_PARAADJUST
,uno::Any(static_cast<sal_Int16
>(eParagraphAdjust
)),aArgs
);
1516 InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT
);
1517 InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER
);
1518 InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT
);
1519 InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK
);
1524 uno::Sequence
< beans::NamedValue
> aSettings
;
1525 uno::Reference
< awt::XWindow
> xWindow
;
1526 ::std::vector
< uno::Reference
< uno::XInterface
> > aControlsFormats
;
1527 lcl_getReportControlFormat( aArgs
, getDesignView(), xWindow
, aControlsFormats
);
1529 if ( !aControlsFormats
.empty() )
1531 const OUString
sUndoAction( RptResId( RID_STR_UNDO_CHANGEFONT
) );
1532 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
1534 for (const auto& rxControlFormat
: aControlsFormats
)
1536 uno::Reference
< report::XReportControlFormat
> xFormat( rxControlFormat
, uno::UNO_QUERY
);
1537 if ( !xFormat
.is() )
1540 if ( !aSettings
.hasElements() )
1542 ::rptui::openCharDialog( xFormat
, xWindow
, aSettings
);
1543 if ( !aSettings
.hasElements() )
1547 applyCharacterSettings( xFormat
, aSettings
);
1554 case SID_INSERT_GRAPHIC
:
1557 case SID_SETCONTROLDEFAULTS
:
1559 case SID_CONDITIONALFORMATTING
:
1561 uno::Reference
< report::XFormattedField
> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY
);
1562 if ( xFormattedField
.is() )
1564 ConditionalFormattingDialog
aDlg(getFrameWeld(), xFormattedField
, *this);
1570 if ( m_xReportDefinition
.is() )
1572 if ( !aArgs
.hasElements() )
1574 ODateTimeDialog
aDlg(getFrameWeld(), getDesignView()->getCurrentSection(), this);
1578 createDateTime(aArgs
);
1581 case SID_INSERT_FLD_PGNUMBER
:
1582 if ( m_xReportDefinition
.is() )
1584 if ( !aArgs
.hasElements() )
1586 OPageNumberDialog
aDlg(getFrameWeld(), m_xReportDefinition
, this);
1590 createPageNumber(aArgs
);
1594 case SID_EXPORTDOCASPDF
:
1595 case SID_PRINTPREVIEW
:
1599 { // the state should be changed to not editable
1600 setModified(false); // and we are not modified yet
1602 setEditable(!isEditable());
1608 if ( !aArgs
.hasElements() )
1612 else if ( aArgs
.getLength() == 1 && aArgs
[0].Name
== "Zoom" )
1614 SvxZoomItem aZoomItem
;
1615 aZoomItem
.PutValue(aArgs
[0].Value
, 0);
1616 m_nZoomValue
= aZoomItem
.GetValue();
1617 m_eZoomType
= aZoomItem
.GetType();
1618 impl_zoom_nothrow();
1621 case SID_ATTR_ZOOMSLIDER
:
1622 if ( aArgs
.getLength() == 1 && aArgs
[0].Name
== "ZoomSlider" )
1624 SvxZoomSliderItem aZoomSlider
;
1625 aZoomSlider
.PutValue(aArgs
[0].Value
, 0);
1626 m_nZoomValue
= aZoomSlider
.GetValue();
1627 m_eZoomType
= SvxZoomType::PERCENT
;
1628 impl_zoom_nothrow();
1632 OReportController_BASE::Execute(_nId
,aArgs
);
1634 InvalidateFeature(_nId
,Reference
< XStatusListener
>(),bForceBroadcast
);
1637 void OReportController::impl_initialize( const ::comphelper::NamedValueCollection
& rArguments
)
1639 OReportController_BASE::impl_initialize(rArguments
);
1641 rArguments
.get_ensureType( PROPERTY_REPORTNAME
, m_sName
);
1642 if ( m_sName
.isEmpty() )
1643 rArguments
.get_ensureType( u
"DocumentTitle"_ustr
, m_sName
);
1647 if ( m_xReportDefinition
.is() )
1649 getView()->initialize(); // show the windows and fill with our information
1651 m_aReportModel
= reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition
);
1652 if ( !m_aReportModel
)
1653 throw RuntimeException();
1654 m_aReportModel
->attachController( *this );
1657 UndoSuppressor
aSuppressUndo( getUndoManager() );
1659 setMode(::comphelper::NamedValueCollection::getOrDefault(getModel()->getArgs(), u
"Mode", u
"normal"_ustr
));
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
));
1666 utl::MediaDescriptor
aDescriptor( m_xReportDefinition
->getArgs() );
1667 OUString sHierarchicalDocumentName
= aDescriptor
.getUnpackedValueOrDefault(u
"HierarchicalDocumentName"_ustr
,OUString());
1669 if ( sHierarchicalDocumentName
.isEmpty() && getConnection().is() )
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() );
1675 if ( aNames
.hasElements() )
1677 m_xReportDefinition
->setCommand(aNames
[0]);
1678 m_xReportDefinition
->setCommandType(sdb::CommandType::TABLE
);
1682 m_aVisualAreaSize
= m_xReportDefinition
->getVisualAreaSize(0);
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();
1695 if ( m_nPageNum
!= -1 )
1697 if ( m_nPageNum
< m_aReportModel
->GetPageCount() )
1699 const OReportPage
* pPage
= dynamic_cast<OReportPage
*>(m_aReportModel
->GetPage(static_cast<sal_uInt16
>(m_nPageNum
)));
1702 executeUnChecked(SID_SELECT
,{ comphelper::makePropertyValue(u
""_ustr
, pPage
->getSection() ) });
1708 getDesignView()->collapseSections(m_aCollapsedSections
);
1709 impl_zoom_nothrow();
1710 getDesignView()->Resize();
1711 getDesignView()->Invalidate();
1714 if ( m_bShowProperties
&& m_nPageNum
== -1 )
1716 m_sLastActivePage
= "Data";
1717 getDesignView()->setCurrentPage(m_sLastActivePage
);
1718 executeUnChecked(SID_SELECT_REPORT
,{});
1721 setModified(false); // and we are not modified yet
1723 catch(const SQLException
&)
1725 DBG_UNHANDLED_EXCEPTION("reportdesign");
1729 IMPL_LINK( OReportController
, OnCreateHdl
, OAddFieldWindow
& ,_rAddFieldDlg
, void)
1731 weld::WaitObject
aObj(getFrameWeld());
1732 uno::Sequence
< beans::PropertyValue
> aArgs
= _rAddFieldDlg
.getSelectedFieldDescriptors();
1733 // we use this way to create undo actions
1734 if ( aArgs
.hasElements() )
1736 executeChecked(SID_ADD_CONTROL_PAIR
,aArgs
);
1740 bool OReportController::Construct(vcl::Window
* pParent
)
1742 VclPtrInstance
<ODesignView
> pMyOwnView( pParent
, m_xContext
, *this );
1743 StartListening( *pMyOwnView
);
1744 setView( pMyOwnView
);
1746 // now that we have a view we can create the clipboard listener
1747 m_aSystemClipboard
= TransferableDataHelper::CreateFromSystemClipboard( getView() );
1748 m_aSystemClipboard
.StartClipboardListening( );
1749 m_pClipboardNotifier
= new TransferableClipboardListener( LINK( this, OReportController
, OnClipboardChanged
) );
1750 m_pClipboardNotifier
->AddListener( getView() );
1752 OReportController_BASE::Construct(pParent
);
1756 sal_Bool SAL_CALL
OReportController::suspend(sal_Bool
/*_bSuspend*/)
1758 if ( getBroadcastHelper().bInDispose
|| getBroadcastHelper().bDisposed
)
1761 SolarMutexGuard aSolarGuard
;
1762 ::osl::MutexGuard
aGuard( getMutex() );
1764 if ( getView() && getView()->IsInModalMode() )
1767 // this suspend will be handled in the DBAccess interceptor implementation
1771 void OReportController::describeSupportedFeatures()
1773 DBSubComponentController::describeSupportedFeatures();
1775 implDescribeSupportedFeature( u
".uno:TextDocument"_ustr
, SID_RPT_TEXTDOCUMENT
, CommandGroup::APPLICATION
);
1776 implDescribeSupportedFeature( u
".uno:Spreadsheet"_ustr
, SID_RPT_SPREADSHEET
, CommandGroup::APPLICATION
);
1778 implDescribeSupportedFeature( u
".uno:Redo"_ustr
, SID_REDO
, CommandGroup::EDIT
);
1779 implDescribeSupportedFeature( u
".uno:Undo"_ustr
, SID_UNDO
, CommandGroup::EDIT
);
1780 implDescribeSupportedFeature( u
".uno:SelectAll"_ustr
, SID_SELECTALL
, CommandGroup::EDIT
);
1781 implDescribeSupportedFeature( u
".uno:SelectAllInSection"_ustr
, SID_SELECTALL_IN_SECTION
, CommandGroup::EDIT
);
1782 implDescribeSupportedFeature( u
".uno:Delete"_ustr
, SID_DELETE
, CommandGroup::EDIT
);
1783 implDescribeSupportedFeature( u
".uno:SelectReport"_ustr
, SID_SELECT_REPORT
, CommandGroup::EDIT
);
1784 implDescribeSupportedFeature( u
".uno:ExecuteReport"_ustr
, SID_EXECUTE_REPORT
, CommandGroup::EDIT
);
1786 implDescribeSupportedFeature( u
".uno:GridVisible"_ustr
, SID_GRID_VISIBLE
, CommandGroup::VIEW
);
1787 implDescribeSupportedFeature( u
".uno:GridUse"_ustr
, SID_GRID_USE
, CommandGroup::VIEW
);
1788 implDescribeSupportedFeature( u
".uno:HelplinesMove"_ustr
, SID_HELPLINES_MOVE
, CommandGroup::VIEW
);
1789 implDescribeSupportedFeature( u
".uno:ShowRuler"_ustr
, SID_RULER
, CommandGroup::VIEW
);
1790 implDescribeSupportedFeature( u
".uno:AddField"_ustr
, SID_FM_ADD_FIELD
, CommandGroup::VIEW
);
1791 implDescribeSupportedFeature( u
".uno:ReportNavigator"_ustr
, SID_RPT_SHOWREPORTEXPLORER
, CommandGroup::VIEW
);
1792 implDescribeSupportedFeature( u
".uno:ControlProperties"_ustr
, SID_SHOW_PROPERTYBROWSER
, CommandGroup::VIEW
);
1793 implDescribeSupportedFeature( u
".uno:DbSortingAndGrouping"_ustr
, SID_SORTINGANDGROUPING
, CommandGroup::VIEW
);
1794 implDescribeSupportedFeature( u
".uno:PageHeaderFooter"_ustr
, SID_PAGEHEADERFOOTER
, CommandGroup::VIEW
);
1795 implDescribeSupportedFeature( u
".uno:ReportHeaderFooter"_ustr
, SID_REPORTHEADERFOOTER
, CommandGroup::VIEW
);
1796 implDescribeSupportedFeature( u
".uno:ZoomSlider"_ustr
, SID_ATTR_ZOOMSLIDER
);
1797 implDescribeSupportedFeature( u
".uno:Zoom"_ustr
, SID_ATTR_ZOOM
, CommandGroup::VIEW
);
1799 implDescribeSupportedFeature( u
".uno:ConditionalFormatting"_ustr
, SID_CONDITIONALFORMATTING
, CommandGroup::FORMAT
);
1800 implDescribeSupportedFeature( u
".uno:PageDialog"_ustr
, SID_PAGEDIALOG
, CommandGroup::FORMAT
);
1801 implDescribeSupportedFeature( u
".uno:ResetAttributes"_ustr
, SID_SETCONTROLDEFAULTS
, CommandGroup::FORMAT
);
1803 implDescribeSupportedFeature( u
".uno:Bold"_ustr
, SID_ATTR_CHAR_WEIGHT
, CommandGroup::FORMAT
);
1804 implDescribeSupportedFeature( u
".uno:Italic"_ustr
, SID_ATTR_CHAR_POSTURE
, CommandGroup::FORMAT
);
1805 implDescribeSupportedFeature( u
".uno:Underline"_ustr
, SID_ATTR_CHAR_UNDERLINE
, CommandGroup::FORMAT
);
1806 implDescribeSupportedFeature( u
".uno:DBBackgroundColor"_ustr
, SID_ATTR_CHAR_COLOR_BACKGROUND
, CommandGroup::FORMAT
);
1807 implDescribeSupportedFeature( u
".uno:BackgroundColor"_ustr
, SID_BACKGROUND_COLOR
, CommandGroup::FORMAT
);
1808 implDescribeSupportedFeature( u
".uno:CharColorExt"_ustr
, SID_ATTR_CHAR_COLOR_EXT
);
1809 implDescribeSupportedFeature( u
".uno:Color"_ustr
, SID_ATTR_CHAR_COLOR
);
1810 implDescribeSupportedFeature( u
".uno:FontColor"_ustr
, SID_ATTR_CHAR_COLOR2
, CommandGroup::FORMAT
);
1811 implDescribeSupportedFeature( u
".uno:FontDialog"_ustr
, SID_CHAR_DLG
, CommandGroup::FORMAT
);
1812 implDescribeSupportedFeature( u
".uno:LeftPara"_ustr
, SID_ATTR_PARA_ADJUST_LEFT
, CommandGroup::FORMAT
);
1813 implDescribeSupportedFeature( u
".uno:CenterPara"_ustr
, SID_ATTR_PARA_ADJUST_CENTER
, CommandGroup::FORMAT
);
1814 implDescribeSupportedFeature( u
".uno:RightPara"_ustr
, SID_ATTR_PARA_ADJUST_RIGHT
, CommandGroup::FORMAT
);
1815 implDescribeSupportedFeature( u
".uno:JustifyPara"_ustr
, SID_ATTR_PARA_ADJUST_BLOCK
, CommandGroup::FORMAT
);
1817 implDescribeSupportedFeature( u
".uno:FontHeight"_ustr
, SID_ATTR_CHAR_FONTHEIGHT
, CommandGroup::FORMAT
);
1818 implDescribeSupportedFeature( u
".uno:CharFontName"_ustr
, SID_ATTR_CHAR_FONT
, CommandGroup::FORMAT
);
1820 implDescribeSupportedFeature( u
".uno:ArrangeMenu"_ustr
, SID_ARRANGEMENU
, CommandGroup::FORMAT
);
1821 implDescribeSupportedFeature( u
".uno:BringToFront"_ustr
, SID_FRAME_TO_TOP
, CommandGroup::FORMAT
);
1822 implDescribeSupportedFeature( u
".uno:ObjectBackOne"_ustr
, SID_FRAME_DOWN
, CommandGroup::FORMAT
);
1823 implDescribeSupportedFeature( u
".uno:ObjectForwardOne"_ustr
, SID_FRAME_UP
, CommandGroup::FORMAT
);
1824 implDescribeSupportedFeature( u
".uno:SendToBack"_ustr
, SID_FRAME_TO_BOTTOM
, CommandGroup::FORMAT
);
1825 implDescribeSupportedFeature( u
".uno:SetObjectToForeground"_ustr
, SID_OBJECT_HEAVEN
, CommandGroup::FORMAT
);
1826 implDescribeSupportedFeature( u
".uno:SetObjectToBackground"_ustr
, SID_OBJECT_HELL
, CommandGroup::FORMAT
);
1828 implDescribeSupportedFeature( u
".uno:ObjectAlign"_ustr
, SID_OBJECT_ALIGN
, CommandGroup::FORMAT
);
1829 implDescribeSupportedFeature( u
".uno:ObjectAlignLeft"_ustr
, SID_OBJECT_ALIGN_LEFT
, CommandGroup::FORMAT
);
1830 implDescribeSupportedFeature( u
".uno:AlignCenter"_ustr
, SID_OBJECT_ALIGN_CENTER
, CommandGroup::FORMAT
);
1831 implDescribeSupportedFeature( u
".uno:ObjectAlignRight"_ustr
, SID_OBJECT_ALIGN_RIGHT
, CommandGroup::FORMAT
);
1832 implDescribeSupportedFeature( u
".uno:AlignUp"_ustr
, SID_OBJECT_ALIGN_UP
, CommandGroup::FORMAT
);
1833 implDescribeSupportedFeature( u
".uno:AlignMiddle"_ustr
, SID_OBJECT_ALIGN_MIDDLE
, CommandGroup::FORMAT
);
1834 implDescribeSupportedFeature( u
".uno:AlignDown"_ustr
, SID_OBJECT_ALIGN_DOWN
, CommandGroup::FORMAT
);
1836 implDescribeSupportedFeature( u
".uno:SectionAlign"_ustr
, SID_SECTION_ALIGN
);
1837 implDescribeSupportedFeature( u
".uno:SectionAlignLeft"_ustr
, SID_SECTION_ALIGN_LEFT
, CommandGroup::FORMAT
);
1838 implDescribeSupportedFeature( u
".uno:SectionAlignCenter"_ustr
, SID_SECTION_ALIGN_CENTER
, CommandGroup::FORMAT
);
1839 implDescribeSupportedFeature( u
".uno:SectionAlignRight"_ustr
, SID_SECTION_ALIGN_RIGHT
, CommandGroup::FORMAT
);
1840 implDescribeSupportedFeature( u
".uno:SectionAlignTop"_ustr
, SID_SECTION_ALIGN_UP
, CommandGroup::FORMAT
);
1841 implDescribeSupportedFeature( u
".uno:SectionAlignMiddle"_ustr
, SID_SECTION_ALIGN_MIDDLE
, CommandGroup::FORMAT
);
1842 implDescribeSupportedFeature( u
".uno:SectionAlignBottom"_ustr
, SID_SECTION_ALIGN_DOWN
, CommandGroup::FORMAT
);
1843 implDescribeSupportedFeature( u
".uno:SectionShrink"_ustr
, SID_SECTION_SHRINK
, CommandGroup::FORMAT
);
1844 implDescribeSupportedFeature( u
".uno:SectionShrinkTop"_ustr
, SID_SECTION_SHRINK_TOP
, CommandGroup::FORMAT
);
1845 implDescribeSupportedFeature( u
".uno:SectionShrinkBottom"_ustr
, SID_SECTION_SHRINK_BOTTOM
, CommandGroup::FORMAT
);
1847 implDescribeSupportedFeature( u
".uno:ObjectResize"_ustr
, SID_OBJECT_RESIZING
, CommandGroup::FORMAT
);
1848 implDescribeSupportedFeature( u
".uno:SmallestWidth"_ustr
, SID_OBJECT_SMALLESTWIDTH
, CommandGroup::FORMAT
);
1849 implDescribeSupportedFeature( u
".uno:SmallestHeight"_ustr
, SID_OBJECT_SMALLESTHEIGHT
, CommandGroup::FORMAT
);
1850 implDescribeSupportedFeature( u
".uno:GreatestWidth"_ustr
, SID_OBJECT_GREATESTWIDTH
, CommandGroup::FORMAT
);
1851 implDescribeSupportedFeature( u
".uno:GreatestHeight"_ustr
, SID_OBJECT_GREATESTHEIGHT
, CommandGroup::FORMAT
);
1853 implDescribeSupportedFeature( u
".uno:DistributeSelection"_ustr
, SID_DISTRIBUTE_DLG
, CommandGroup::FORMAT
);
1854 implDescribeSupportedFeature( u
".uno:DistributeHorzLeft"_ustr
, SID_DISTRIBUTE_HLEFT
, CommandGroup::FORMAT
);
1855 implDescribeSupportedFeature( u
".uno:DistributeHorzCenter"_ustr
, SID_DISTRIBUTE_HCENTER
, CommandGroup::FORMAT
);
1856 implDescribeSupportedFeature( u
".uno:DistributeHorzDistance"_ustr
, SID_DISTRIBUTE_HDISTANCE
, CommandGroup::FORMAT
);
1857 implDescribeSupportedFeature( u
".uno:DistributeHorzRight"_ustr
, SID_DISTRIBUTE_HRIGHT
, CommandGroup::FORMAT
);
1858 implDescribeSupportedFeature( u
".uno:DistributeVertTop"_ustr
, SID_DISTRIBUTE_VTOP
, CommandGroup::FORMAT
);
1859 implDescribeSupportedFeature( u
".uno:DistributeVertCenter"_ustr
, SID_DISTRIBUTE_VCENTER
, CommandGroup::FORMAT
);
1860 implDescribeSupportedFeature( u
".uno:DistributeVertDistance"_ustr
, SID_DISTRIBUTE_VDISTANCE
, CommandGroup::FORMAT
);
1861 implDescribeSupportedFeature( u
".uno:DistributeVertBottom"_ustr
, SID_DISTRIBUTE_VBOTTOM
, CommandGroup::FORMAT
);
1863 implDescribeSupportedFeature( u
".uno:ExportTo"_ustr
, SID_EXPORTDOC
, CommandGroup::APPLICATION
);
1864 implDescribeSupportedFeature( u
".uno:ExportToPDF"_ustr
, SID_EXPORTDOCASPDF
, CommandGroup::APPLICATION
);
1865 implDescribeSupportedFeature( u
".uno:PrintPreview"_ustr
, SID_PRINTPREVIEW
, CommandGroup::APPLICATION
);
1867 implDescribeSupportedFeature( u
".uno:NewDoc"_ustr
, SID_NEWDOC
, CommandGroup::DOCUMENT
);
1868 implDescribeSupportedFeature( u
".uno:Save"_ustr
, SID_SAVEDOC
, CommandGroup::DOCUMENT
);
1869 implDescribeSupportedFeature( u
".uno:SaveAs"_ustr
, SID_SAVEASDOC
, CommandGroup::DOCUMENT
);
1870 implDescribeSupportedFeature( u
".uno:SaveACopy"_ustr
, SID_SAVEACOPY
, CommandGroup::DOCUMENT
);
1872 implDescribeSupportedFeature( u
".uno:InsertPageNumberField"_ustr
, SID_INSERT_FLD_PGNUMBER
, CommandGroup::INSERT
);
1873 implDescribeSupportedFeature( u
".uno:InsertDateTimeField"_ustr
, SID_DATETIME
, CommandGroup::INSERT
);
1874 implDescribeSupportedFeature( u
".uno:InsertObjectChart"_ustr
, SID_INSERT_DIAGRAM
, CommandGroup::INSERT
);
1875 implDescribeSupportedFeature( u
".uno:InsertGraphic"_ustr
, SID_INSERT_GRAPHIC
, CommandGroup::INSERT
);
1877 implDescribeSupportedFeature( u
".uno:SelectObject"_ustr
, SID_OBJECT_SELECT
, CommandGroup::INSERT
);
1878 implDescribeSupportedFeature( u
".uno:Label"_ustr
, SID_FM_FIXEDTEXT
, CommandGroup::INSERT
);
1879 implDescribeSupportedFeature( u
".uno:Edit"_ustr
, SID_FM_EDIT
, CommandGroup::INSERT
);
1880 implDescribeSupportedFeature( u
".uno:ImageControl"_ustr
, SID_FM_IMAGECONTROL
, CommandGroup::INSERT
);
1881 implDescribeSupportedFeature( u
".uno:HFixedLine"_ustr
, SID_INSERT_HFIXEDLINE
, CommandGroup::INSERT
);
1882 implDescribeSupportedFeature( u
".uno:VFixedLine"_ustr
, SID_INSERT_VFIXEDLINE
, CommandGroup::INSERT
);
1885 implDescribeSupportedFeature( u
".uno:BasicShapes"_ustr
, SID_DRAWTBX_CS_BASIC
, CommandGroup::INSERT
);
1886 implDescribeSupportedFeature( u
".uno:BasicShapes.rectangle"_ustr
, SID_DRAWTBX_CS_BASIC1
, CommandGroup::INSERT
);
1887 implDescribeSupportedFeature( u
".uno:BasicShapes.round-rectangle"_ustr
,SID_DRAWTBX_CS_BASIC2
, CommandGroup::INSERT
);
1888 implDescribeSupportedFeature( u
".uno:BasicShapes.quadrat"_ustr
, SID_DRAWTBX_CS_BASIC3
, CommandGroup::INSERT
);
1889 implDescribeSupportedFeature( u
".uno:BasicShapes.round-quadrat"_ustr
, SID_DRAWTBX_CS_BASIC4
, CommandGroup::INSERT
);
1890 implDescribeSupportedFeature( u
".uno:BasicShapes.circle"_ustr
, SID_DRAWTBX_CS_BASIC5
, CommandGroup::INSERT
);
1891 implDescribeSupportedFeature( u
".uno:BasicShapes.ellipse"_ustr
, SID_DRAWTBX_CS_BASIC6
, CommandGroup::INSERT
);
1892 implDescribeSupportedFeature( u
".uno:BasicShapes.circle-pie"_ustr
, SID_DRAWTBX_CS_BASIC7
, CommandGroup::INSERT
);
1893 implDescribeSupportedFeature( u
".uno:BasicShapes.isosceles-triangle"_ustr
,SID_DRAWTBX_CS_BASIC8
, CommandGroup::INSERT
);
1894 implDescribeSupportedFeature( u
".uno:BasicShapes.right-triangle"_ustr
,SID_DRAWTBX_CS_BASIC9
, CommandGroup::INSERT
);
1895 implDescribeSupportedFeature( u
".uno:BasicShapes.trapezoid"_ustr
, SID_DRAWTBX_CS_BASIC10
, CommandGroup::INSERT
);
1896 implDescribeSupportedFeature( u
".uno:BasicShapes.diamond"_ustr
, SID_DRAWTBX_CS_BASIC11
, CommandGroup::INSERT
);
1897 implDescribeSupportedFeature( u
".uno:BasicShapes.parallelogram"_ustr
, SID_DRAWTBX_CS_BASIC12
, CommandGroup::INSERT
);
1898 implDescribeSupportedFeature( u
".uno:BasicShapes.pentagon"_ustr
, SID_DRAWTBX_CS_BASIC13
, CommandGroup::INSERT
);
1899 implDescribeSupportedFeature( u
".uno:BasicShapes.hexagon"_ustr
, SID_DRAWTBX_CS_BASIC14
, CommandGroup::INSERT
);
1900 implDescribeSupportedFeature( u
".uno:BasicShapes.octagon"_ustr
, SID_DRAWTBX_CS_BASIC15
, CommandGroup::INSERT
);
1901 implDescribeSupportedFeature( u
".uno:BasicShapes.cross"_ustr
, SID_DRAWTBX_CS_BASIC16
, CommandGroup::INSERT
);
1902 implDescribeSupportedFeature( u
".uno:BasicShapes.ring"_ustr
, SID_DRAWTBX_CS_BASIC17
, CommandGroup::INSERT
);
1903 implDescribeSupportedFeature( u
".uno:BasicShapes.block-arc"_ustr
, SID_DRAWTBX_CS_BASIC18
, CommandGroup::INSERT
);
1904 implDescribeSupportedFeature( u
".uno:BasicShapes.can"_ustr
, SID_DRAWTBX_CS_BASIC19
, CommandGroup::INSERT
);
1905 implDescribeSupportedFeature( u
".uno:BasicShapes.cube"_ustr
, SID_DRAWTBX_CS_BASIC20
, CommandGroup::INSERT
);
1906 implDescribeSupportedFeature( u
".uno:BasicShapes.paper"_ustr
, SID_DRAWTBX_CS_BASIC21
, CommandGroup::INSERT
);
1907 implDescribeSupportedFeature( u
".uno:BasicShapes.frame"_ustr
, SID_DRAWTBX_CS_BASIC22
, CommandGroup::INSERT
);
1909 implDescribeSupportedFeature( u
".uno:SymbolShapes"_ustr
, SID_DRAWTBX_CS_SYMBOL
, CommandGroup::INSERT
);
1911 implDescribeSupportedFeature( u
".uno:SymbolShapes.smiley"_ustr
, SID_DRAWTBX_CS_SYMBOL1
, CommandGroup::INSERT
);
1912 implDescribeSupportedFeature( u
".uno:SymbolShapes.sun"_ustr
, SID_DRAWTBX_CS_SYMBOL2
, CommandGroup::INSERT
);
1913 implDescribeSupportedFeature( u
".uno:SymbolShapes.moon"_ustr
, SID_DRAWTBX_CS_SYMBOL3
, CommandGroup::INSERT
);
1914 implDescribeSupportedFeature( u
".uno:SymbolShapes.lightning"_ustr
, SID_DRAWTBX_CS_SYMBOL4
, CommandGroup::INSERT
);
1915 implDescribeSupportedFeature( u
".uno:SymbolShapes.heart"_ustr
, SID_DRAWTBX_CS_SYMBOL5
, CommandGroup::INSERT
);
1916 implDescribeSupportedFeature( u
".uno:SymbolShapes.flower"_ustr
, SID_DRAWTBX_CS_SYMBOL6
, CommandGroup::INSERT
);
1917 implDescribeSupportedFeature( u
".uno:SymbolShapes.cloud"_ustr
, SID_DRAWTBX_CS_SYMBOL7
, CommandGroup::INSERT
);
1918 implDescribeSupportedFeature( u
".uno:SymbolShapes.forbidden"_ustr
, SID_DRAWTBX_CS_SYMBOL8
, CommandGroup::INSERT
);
1919 implDescribeSupportedFeature( u
".uno:SymbolShapes.puzzle"_ustr
, SID_DRAWTBX_CS_SYMBOL9
, CommandGroup::INSERT
);
1920 implDescribeSupportedFeature( u
".uno:SymbolShapes.bracket-pair"_ustr
,SID_DRAWTBX_CS_SYMBOL10
, CommandGroup::INSERT
);
1921 implDescribeSupportedFeature( u
".uno:SymbolShapes.left-bracket"_ustr
,SID_DRAWTBX_CS_SYMBOL11
, CommandGroup::INSERT
);
1922 implDescribeSupportedFeature( u
".uno:SymbolShapes.right-bracket"_ustr
,SID_DRAWTBX_CS_SYMBOL12
, CommandGroup::INSERT
);
1923 implDescribeSupportedFeature( u
".uno:SymbolShapes.brace-pair"_ustr
, SID_DRAWTBX_CS_SYMBOL13
, CommandGroup::INSERT
);
1924 implDescribeSupportedFeature( u
".uno:SymbolShapes.left-brace"_ustr
, SID_DRAWTBX_CS_SYMBOL14
, CommandGroup::INSERT
);
1925 implDescribeSupportedFeature( u
".uno:SymbolShapes.right-brace"_ustr
, SID_DRAWTBX_CS_SYMBOL15
, CommandGroup::INSERT
);
1926 implDescribeSupportedFeature( u
".uno:SymbolShapes.quad-bevel"_ustr
, SID_DRAWTBX_CS_SYMBOL16
, CommandGroup::INSERT
);
1927 implDescribeSupportedFeature( u
".uno:SymbolShapes.octagon-bevel"_ustr
,SID_DRAWTBX_CS_SYMBOL17
, CommandGroup::INSERT
);
1928 implDescribeSupportedFeature( u
".uno:SymbolShapes.diamond-bevel"_ustr
,SID_DRAWTBX_CS_SYMBOL18
, CommandGroup::INSERT
);
1930 implDescribeSupportedFeature( u
".uno:ArrowShapes.left-arrow"_ustr
, SID_DRAWTBX_CS_ARROW1
, CommandGroup::INSERT
);
1931 implDescribeSupportedFeature( u
".uno:ArrowShapes.right-arrow"_ustr
, SID_DRAWTBX_CS_ARROW2
, CommandGroup::INSERT
);
1932 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-arrow"_ustr
, SID_DRAWTBX_CS_ARROW3
, CommandGroup::INSERT
);
1933 implDescribeSupportedFeature( u
".uno:ArrowShapes.down-arrow"_ustr
, SID_DRAWTBX_CS_ARROW4
, CommandGroup::INSERT
);
1934 implDescribeSupportedFeature( u
".uno:ArrowShapes.left-right-arrow"_ustr
, SID_DRAWTBX_CS_ARROW5
, CommandGroup::INSERT
);
1935 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-down-arrow"_ustr
, SID_DRAWTBX_CS_ARROW6
, CommandGroup::INSERT
);
1936 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-right-arrow"_ustr
, SID_DRAWTBX_CS_ARROW7
, CommandGroup::INSERT
);
1937 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-right-down-arrow"_ustr
, SID_DRAWTBX_CS_ARROW8
, CommandGroup::INSERT
);
1938 implDescribeSupportedFeature( u
".uno:ArrowShapes.quad-arrow"_ustr
, SID_DRAWTBX_CS_ARROW9
, CommandGroup::INSERT
);
1939 implDescribeSupportedFeature( u
".uno:ArrowShapes.corner-right-arrow"_ustr
, SID_DRAWTBX_CS_ARROW10
, CommandGroup::INSERT
);
1940 implDescribeSupportedFeature( u
".uno:ArrowShapes.split-arrow"_ustr
, SID_DRAWTBX_CS_ARROW11
, CommandGroup::INSERT
);
1941 implDescribeSupportedFeature( u
".uno:ArrowShapes.striped-right-arrow"_ustr
, SID_DRAWTBX_CS_ARROW12
, CommandGroup::INSERT
);
1942 implDescribeSupportedFeature( u
".uno:ArrowShapes.notched-right-arrow"_ustr
, SID_DRAWTBX_CS_ARROW13
, CommandGroup::INSERT
);
1943 implDescribeSupportedFeature( u
".uno:ArrowShapes.pentagon-right"_ustr
, SID_DRAWTBX_CS_ARROW14
, CommandGroup::INSERT
);
1944 implDescribeSupportedFeature( u
".uno:ArrowShapes.chevron"_ustr
, SID_DRAWTBX_CS_ARROW15
, CommandGroup::INSERT
);
1945 implDescribeSupportedFeature( u
".uno:ArrowShapes.right-arrow-callout"_ustr
, SID_DRAWTBX_CS_ARROW16
, CommandGroup::INSERT
);
1946 implDescribeSupportedFeature( u
".uno:ArrowShapes.left-arrow-callout"_ustr
, SID_DRAWTBX_CS_ARROW17
, CommandGroup::INSERT
);
1947 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-arrow-callout"_ustr
, SID_DRAWTBX_CS_ARROW18
, CommandGroup::INSERT
);
1948 implDescribeSupportedFeature( u
".uno:ArrowShapes.down-arrow-callout"_ustr
, SID_DRAWTBX_CS_ARROW19
, CommandGroup::INSERT
);
1949 implDescribeSupportedFeature( u
".uno:ArrowShapes.left-right-arrow-callout"_ustr
,SID_DRAWTBX_CS_ARROW20
, CommandGroup::INSERT
);
1950 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-down-arrow-callout"_ustr
,SID_DRAWTBX_CS_ARROW21
, CommandGroup::INSERT
);
1951 implDescribeSupportedFeature( u
".uno:ArrowShapes.up-right-arrow-callout"_ustr
,SID_DRAWTBX_CS_ARROW22
, CommandGroup::INSERT
);
1952 implDescribeSupportedFeature( u
".uno:ArrowShapes.quad-arrow-callout"_ustr
, SID_DRAWTBX_CS_ARROW23
, CommandGroup::INSERT
);
1953 implDescribeSupportedFeature( u
".uno:ArrowShapes.circular-arrow"_ustr
, SID_DRAWTBX_CS_ARROW24
, CommandGroup::INSERT
);
1954 implDescribeSupportedFeature( u
".uno:ArrowShapes.split-round-arrow"_ustr
, SID_DRAWTBX_CS_ARROW25
, CommandGroup::INSERT
);
1955 implDescribeSupportedFeature( u
".uno:ArrowShapes.s-sharped-arrow"_ustr
, SID_DRAWTBX_CS_ARROW26
, CommandGroup::INSERT
);
1957 implDescribeSupportedFeature( u
".uno:StarShapes.bang"_ustr
, SID_DRAWTBX_CS_STAR1
, CommandGroup::INSERT
);
1958 implDescribeSupportedFeature( u
".uno:StarShapes.star4"_ustr
, SID_DRAWTBX_CS_STAR2
, CommandGroup::INSERT
);
1959 implDescribeSupportedFeature( u
".uno:StarShapes.star5"_ustr
, SID_DRAWTBX_CS_STAR3
, CommandGroup::INSERT
);
1960 implDescribeSupportedFeature( u
".uno:StarShapes.star6"_ustr
, SID_DRAWTBX_CS_STAR4
, CommandGroup::INSERT
);
1961 implDescribeSupportedFeature( u
".uno:StarShapes.star8"_ustr
, SID_DRAWTBX_CS_STAR5
, CommandGroup::INSERT
);
1962 implDescribeSupportedFeature( u
".uno:StarShapes.star12"_ustr
, SID_DRAWTBX_CS_STAR6
, CommandGroup::INSERT
);
1963 implDescribeSupportedFeature( u
".uno:StarShapes.star24"_ustr
, SID_DRAWTBX_CS_STAR7
, CommandGroup::INSERT
);
1964 implDescribeSupportedFeature( u
".uno:StarShapes.concave-star6"_ustr
, SID_DRAWTBX_CS_STAR8
, CommandGroup::INSERT
);
1965 implDescribeSupportedFeature( u
".uno:StarShapes.vertical-scroll"_ustr
, SID_DRAWTBX_CS_STAR9
, CommandGroup::INSERT
);
1966 implDescribeSupportedFeature( u
".uno:StarShapes.horizontal-scroll"_ustr
, SID_DRAWTBX_CS_STAR10
, CommandGroup::INSERT
);
1967 implDescribeSupportedFeature( u
".uno:StarShapes.signet"_ustr
, SID_DRAWTBX_CS_STAR11
, CommandGroup::INSERT
);
1968 implDescribeSupportedFeature( u
".uno:StarShapes.doorplate"_ustr
, SID_DRAWTBX_CS_STAR12
, CommandGroup::INSERT
);
1970 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-process"_ustr
, SID_DRAWTBX_CS_FLOWCHART1
, CommandGroup::INSERT
);
1971 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-alternate-process"_ustr
, SID_DRAWTBX_CS_FLOWCHART2
, CommandGroup::INSERT
);
1972 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-decision"_ustr
, SID_DRAWTBX_CS_FLOWCHART3
, CommandGroup::INSERT
);
1973 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-data"_ustr
, SID_DRAWTBX_CS_FLOWCHART4
, CommandGroup::INSERT
);
1974 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-predefined-process"_ustr
, SID_DRAWTBX_CS_FLOWCHART5
, CommandGroup::INSERT
);
1975 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-internal-storage"_ustr
, SID_DRAWTBX_CS_FLOWCHART6
, CommandGroup::INSERT
);
1976 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-document"_ustr
, SID_DRAWTBX_CS_FLOWCHART7
, CommandGroup::INSERT
);
1977 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-multidocument"_ustr
, SID_DRAWTBX_CS_FLOWCHART8
, CommandGroup::INSERT
);
1978 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-terminator"_ustr
, SID_DRAWTBX_CS_FLOWCHART9
, CommandGroup::INSERT
);
1979 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-preparation"_ustr
, SID_DRAWTBX_CS_FLOWCHART10
, CommandGroup::INSERT
);
1980 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-manual-input"_ustr
, SID_DRAWTBX_CS_FLOWCHART11
, CommandGroup::INSERT
);
1981 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-manual-operation"_ustr
, SID_DRAWTBX_CS_FLOWCHART12
, CommandGroup::INSERT
);
1982 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-connector"_ustr
, SID_DRAWTBX_CS_FLOWCHART13
, CommandGroup::INSERT
);
1983 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-off-page-connector"_ustr
, SID_DRAWTBX_CS_FLOWCHART14
, CommandGroup::INSERT
);
1984 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-card"_ustr
, SID_DRAWTBX_CS_FLOWCHART15
, CommandGroup::INSERT
);
1985 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-punched-tape"_ustr
, SID_DRAWTBX_CS_FLOWCHART16
, CommandGroup::INSERT
);
1986 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-summing-junction"_ustr
, SID_DRAWTBX_CS_FLOWCHART17
, CommandGroup::INSERT
);
1987 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-or"_ustr
, SID_DRAWTBX_CS_FLOWCHART18
, CommandGroup::INSERT
);
1988 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-collate"_ustr
, SID_DRAWTBX_CS_FLOWCHART19
, CommandGroup::INSERT
);
1989 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-sort"_ustr
, SID_DRAWTBX_CS_FLOWCHART20
, CommandGroup::INSERT
);
1990 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-extract"_ustr
, SID_DRAWTBX_CS_FLOWCHART21
, CommandGroup::INSERT
);
1991 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-merge"_ustr
, SID_DRAWTBX_CS_FLOWCHART22
, CommandGroup::INSERT
);
1992 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-stored-data"_ustr
, SID_DRAWTBX_CS_FLOWCHART23
, CommandGroup::INSERT
);
1993 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-delay"_ustr
, SID_DRAWTBX_CS_FLOWCHART24
, CommandGroup::INSERT
);
1994 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-sequential-access"_ustr
, SID_DRAWTBX_CS_FLOWCHART25
, CommandGroup::INSERT
);
1995 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-magnetic-disk"_ustr
, SID_DRAWTBX_CS_FLOWCHART26
, CommandGroup::INSERT
);
1996 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-direct-access-storage"_ustr
,SID_DRAWTBX_CS_FLOWCHART27
, CommandGroup::INSERT
);
1997 implDescribeSupportedFeature( u
".uno:FlowChartShapes.flowchart-display"_ustr
, SID_DRAWTBX_CS_FLOWCHART28
, CommandGroup::INSERT
);
1999 implDescribeSupportedFeature( u
".uno:CalloutShapes.rectangular-callout"_ustr
, SID_DRAWTBX_CS_CALLOUT1
, CommandGroup::INSERT
);
2000 implDescribeSupportedFeature( u
".uno:CalloutShapes.round-rectangular-callout"_ustr
, SID_DRAWTBX_CS_CALLOUT2
, CommandGroup::INSERT
);
2001 implDescribeSupportedFeature( u
".uno:CalloutShapes.round-callout"_ustr
, SID_DRAWTBX_CS_CALLOUT3
, CommandGroup::INSERT
);
2002 implDescribeSupportedFeature( u
".uno:CalloutShapes.cloud-callout"_ustr
, SID_DRAWTBX_CS_CALLOUT4
, CommandGroup::INSERT
);
2003 implDescribeSupportedFeature( u
".uno:CalloutShapes.line-callout-1"_ustr
, SID_DRAWTBX_CS_CALLOUT5
, CommandGroup::INSERT
);
2004 implDescribeSupportedFeature( u
".uno:CalloutShapes.line-callout-2"_ustr
, SID_DRAWTBX_CS_CALLOUT6
, CommandGroup::INSERT
);
2005 implDescribeSupportedFeature( u
".uno:CalloutShapes.line-callout-3"_ustr
, SID_DRAWTBX_CS_CALLOUT7
, CommandGroup::INSERT
);
2007 implDescribeSupportedFeature( u
".uno:ArrowShapes"_ustr
, SID_DRAWTBX_CS_ARROW
, CommandGroup::INSERT
);
2009 implDescribeSupportedFeature( u
".uno:FlowChartShapes"_ustr
, SID_DRAWTBX_CS_FLOWCHART
, CommandGroup::INSERT
);
2010 implDescribeSupportedFeature( u
".uno:CalloutShapes"_ustr
, SID_DRAWTBX_CS_CALLOUT
, CommandGroup::INSERT
);
2011 implDescribeSupportedFeature( u
".uno:StarShapes"_ustr
, SID_DRAWTBX_CS_STAR
, CommandGroup::INSERT
);
2015 implDescribeSupportedFeature( u
".uno:Escape"_ustr
, SID_ESCAPE
);
2018 implDescribeSupportedFeature( u
".uno:RPT_RPTHEADER_UNDO"_ustr
, SID_REPORTHEADER_WITHOUT_UNDO
);
2019 implDescribeSupportedFeature( u
".uno:RPT_RPTFOOTER_UNDO"_ustr
, SID_REPORTFOOTER_WITHOUT_UNDO
);
2020 implDescribeSupportedFeature( u
".uno:RPT_PGHEADER_UNDO"_ustr
, SID_PAGEHEADER_WITHOUT_UNDO
);
2021 implDescribeSupportedFeature( u
".uno:RPT_PGFOOTER_UNDO"_ustr
, SID_PAGEFOOTER_WITHOUT_UNDO
);
2022 implDescribeSupportedFeature( u
".uno:SID_GROUPHEADER"_ustr
, SID_GROUPHEADER
);
2023 implDescribeSupportedFeature( u
".uno:SID_GROUPHEADER_WITHOUT_UNDO"_ustr
, SID_GROUPHEADER_WITHOUT_UNDO
);
2024 implDescribeSupportedFeature( u
".uno:SID_GROUPFOOTER"_ustr
, SID_GROUPFOOTER
);
2025 implDescribeSupportedFeature( u
".uno:SID_GROUPFOOTER_WITHOUT_UNDO"_ustr
, SID_GROUPFOOTER_WITHOUT_UNDO
);
2026 implDescribeSupportedFeature( u
".uno:SID_GROUP_REMOVE"_ustr
, SID_GROUP_REMOVE
);
2027 implDescribeSupportedFeature( u
".uno:SID_GROUP_APPEND"_ustr
, SID_GROUP_APPEND
);
2028 implDescribeSupportedFeature( u
".uno:SID_ADD_CONTROL_PAIR"_ustr
, SID_ADD_CONTROL_PAIR
);
2029 implDescribeSupportedFeature( u
".uno:SplitPosition"_ustr
, SID_SPLIT_POSITION
);
2030 implDescribeSupportedFeature( u
".uno:LastPropertyBrowserPage"_ustr
, SID_PROPERTYBROWSER_LAST_PAGE
);
2031 implDescribeSupportedFeature( u
".uno:Select"_ustr
, SID_SELECT
);
2032 implDescribeSupportedFeature( u
".uno:InsertFunction"_ustr
, SID_RPT_NEW_FUNCTION
);
2033 implDescribeSupportedFeature( u
".uno:NextMark"_ustr
, SID_NEXT_MARK
);
2034 implDescribeSupportedFeature( u
".uno:PrevMark"_ustr
, SID_PREV_MARK
);
2035 implDescribeSupportedFeature( u
".uno:TerminateInplaceActivation"_ustr
, SID_TERMINATE_INPLACEACTIVATION
);
2036 implDescribeSupportedFeature( u
".uno:SelectAllLabels"_ustr
, SID_SELECT_ALL_LABELS
);
2037 implDescribeSupportedFeature( u
".uno:SelectAllEdits"_ustr
, SID_SELECT_ALL_EDITS
);
2038 implDescribeSupportedFeature( u
".uno:CollapseSection"_ustr
, SID_COLLAPSE_SECTION
);
2039 implDescribeSupportedFeature( u
".uno:ExpandSection"_ustr
, SID_EXPAND_SECTION
);
2040 implDescribeSupportedFeature( u
".uno:GetUndoStrings"_ustr
, SID_GETUNDOSTRINGS
);
2041 implDescribeSupportedFeature( u
".uno:GetRedoStrings"_ustr
, SID_GETREDOSTRINGS
);
2044 void OReportController::impl_onModifyChanged()
2048 if ( m_xReportDefinition
.is() )
2049 m_xReportDefinition
->setModified( impl_isModified() );
2050 DBSubComponentController::impl_onModifyChanged();
2052 catch(const uno::Exception
&)
2054 DBG_UNHANDLED_EXCEPTION("reportdesign");
2058 void OReportController::onLoadedMenu(const Reference
< frame::XLayoutManager
>& _xLayoutManager
)
2060 if ( !_xLayoutManager
.is() )
2063 static const std::u16string_view s_sMenu
[] = {
2064 u
"private:resource/statusbar/statusbar"
2065 ,u
"private:resource/toolbar/reportcontrols"
2066 ,u
"private:resource/toolbar/drawbar"
2067 ,u
"private:resource/toolbar/Formatting"
2068 ,u
"private:resource/toolbar/alignmentbar"
2069 ,u
"private:resource/toolbar/sectionalignmentbar"
2070 ,u
"private:resource/toolbar/resizebar"
2071 ,u
"private:resource/toolbar/sectionshrinkbar"
2073 for (const auto & i
: s_sMenu
)
2075 _xLayoutManager
->createElement( OUString(i
) );
2076 _xLayoutManager
->requestElement( OUString(i
) );
2080 void OReportController::notifyGroupSections(const ContainerEvent
& _rEvent
,bool _bShow
)
2082 uno::Reference
< report::XGroup
> xGroup(_rEvent
.Element
,uno::UNO_QUERY
);
2086 SolarMutexGuard aSolarGuard
;
2087 ::osl::MutexGuard
aGuard( getMutex() );
2088 sal_Int32 nGroupPos
= 0;
2089 _rEvent
.Accessor
>>= nGroupPos
;
2093 xGroup
->addPropertyChangeListener(PROPERTY_HEADERON
, static_cast<XPropertyChangeListener
*>(this));
2094 xGroup
->addPropertyChangeListener(PROPERTY_FOOTERON
, static_cast<XPropertyChangeListener
*>(this));
2098 xGroup
->removePropertyChangeListener(PROPERTY_HEADERON
, static_cast<XPropertyChangeListener
*>(this));
2099 xGroup
->removePropertyChangeListener(PROPERTY_FOOTERON
, static_cast<XPropertyChangeListener
*>(this));
2102 if ( xGroup
->getHeaderOn() )
2104 groupChange(xGroup
,PROPERTY_HEADERON
,nGroupPos
,_bShow
);
2107 m_pReportControllerObserver
->AddSection(xGroup
->getHeader());
2111 m_pReportControllerObserver
->RemoveSection(xGroup
->getHeader());
2114 if ( xGroup
->getFooterOn() )
2116 groupChange(xGroup
,PROPERTY_FOOTERON
,nGroupPos
,_bShow
);
2119 m_pReportControllerObserver
->AddSection(xGroup
->getFooter());
2123 m_pReportControllerObserver
->RemoveSection(xGroup
->getFooter());
2128 // ::container::XContainerListener
2129 void SAL_CALL
OReportController::elementInserted( const ContainerEvent
& _rEvent
)
2131 notifyGroupSections(_rEvent
,true);
2134 void SAL_CALL
OReportController::elementRemoved( const ContainerEvent
& _rEvent
)
2136 notifyGroupSections(_rEvent
,false);
2139 void SAL_CALL
OReportController::elementReplaced( const ContainerEvent
& /*_rEvent*/ )
2141 SolarMutexGuard aSolarGuard
;
2142 ::osl::MutexGuard
aGuard( getMutex() );
2143 OSL_FAIL("Not yet implemented!");
2146 void SAL_CALL
OReportController::propertyChange( const beans::PropertyChangeEvent
& evt
)
2148 SolarMutexGuard aSolarGuard
;
2149 ::osl::MutexGuard
aGuard( getMutex() );
2153 evt
.NewValue
>>= bShow
;
2154 if ( evt
.Source
== m_xReportDefinition
)
2156 if ( evt
.PropertyName
== PROPERTY_REPORTHEADERON
)
2158 const sal_uInt16 nPosition
= m_xReportDefinition
->getPageHeaderOn() ? 1 : 0;
2161 getDesignView()->addSection(m_xReportDefinition
->getReportHeader(),DBREPORTHEADER
,nPosition
);
2162 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getReportHeader());
2166 getDesignView()->removeSection(nPosition
);
2169 else if ( evt
.PropertyName
== PROPERTY_REPORTFOOTERON
)
2171 sal_uInt16 nPosition
= getDesignView()->getSectionCount();
2172 if ( m_xReportDefinition
->getPageFooterOn() )
2176 getDesignView()->addSection(m_xReportDefinition
->getReportFooter(),DBREPORTFOOTER
,nPosition
);
2177 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getReportFooter());
2181 getDesignView()->removeSection(nPosition
- 1);
2184 else if ( evt
.PropertyName
== PROPERTY_PAGEHEADERON
)
2188 getDesignView()->addSection(m_xReportDefinition
->getPageHeader(),DBPAGEHEADER
,0);
2189 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getPageHeader());
2193 getDesignView()->removeSection(sal_uInt16(0));
2196 else if ( evt
.PropertyName
== PROPERTY_PAGEFOOTERON
)
2200 getDesignView()->addSection(m_xReportDefinition
->getPageFooter(),DBPAGEFOOTER
);
2201 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getPageFooter());
2205 getDesignView()->removeSection(getDesignView()->getSectionCount() - 1);
2208 else if ( evt
.PropertyName
== PROPERTY_COMMAND
2209 || evt
.PropertyName
== PROPERTY_COMMANDTYPE
2210 || evt
.PropertyName
== PROPERTY_ESCAPEPROCESSING
2211 || evt
.PropertyName
== PROPERTY_FILTER
2215 m_xHoldAlive
.clear();
2216 InvalidateFeature(SID_FM_ADD_FIELD
);
2218 /// TODO: check what we need to notify here TitleHelper
2219 /*else if ( evt.PropertyName.equals( PROPERTY_CAPTION ) )
2224 uno::Reference
< report::XGroup
> xGroup(evt
.Source
,uno::UNO_QUERY
);
2227 sal_Int32 nGroupPos
= getGroupPosition(xGroup
);
2229 groupChange(xGroup
,evt
.PropertyName
,nGroupPos
,bShow
);
2233 catch(const uno::Exception
&)
2235 DBG_UNHANDLED_EXCEPTION("reportdesign");
2240 void SAL_CALL
OReportController::disposing( const lang::EventObject
& Source
)
2242 // simply disambiguate
2243 OReportController_BASE::disposing(Source
);
2247 static sal_uInt16
lcl_getNonVisibleGroupsBefore( const uno::Reference
< report::XGroups
>& _xGroups
2248 ,sal_Int32 _nGroupPos
2249 ,::std::function
<bool(OGroupHelper
*)> const & _pGroupMemberFunction
)
2251 uno::Reference
< report::XGroup
> xGroup
;
2252 sal_uInt16 nNonVisibleGroups
= 0;
2253 sal_Int32 nCount
= _xGroups
->getCount();
2254 for( sal_Int32 i
= 0; i
< _nGroupPos
&& i
< nCount
; ++i
)
2256 xGroup
.set(_xGroups
->getByIndex(i
),uno::UNO_QUERY
);
2257 OSL_ENSURE(xGroup
.is(),"Group is NULL! -> GPF");
2258 OGroupHelper
aGroupHelper(xGroup
);
2259 if ( !_pGroupMemberFunction(&aGroupHelper
) )
2260 ++nNonVisibleGroups
;
2262 return nNonVisibleGroups
;
2265 void OReportController::groupChange( const uno::Reference
< report::XGroup
>& _xGroup
,std::u16string_view _sPropName
,sal_Int32 _nGroupPos
,bool _bShow
)
2267 ::std::function
<bool(OGroupHelper
*)> pMemFun
= ::std::mem_fn(&OGroupHelper::getHeaderOn
);
2268 ::std::function
<uno::Reference
<report::XSection
>(OGroupHelper
*)> pMemFunSection
= ::std::mem_fn(&OGroupHelper::getHeader
);
2269 OUString
sColor(DBGROUPHEADER
);
2270 sal_uInt16 nPosition
= 0;
2271 bool bHandle
= false;
2272 if ( _sPropName
== PROPERTY_HEADERON
)
2274 nPosition
= m_xReportDefinition
->getPageHeaderOn() ? (m_xReportDefinition
->getReportHeaderOn() ? 2 : 1) : (m_xReportDefinition
->getReportHeaderOn() ? 1 : 0);
2275 nPosition
+= (static_cast<sal_uInt16
>(_nGroupPos
) - lcl_getNonVisibleGroupsBefore(m_xReportDefinition
->getGroups(),_nGroupPos
,pMemFun
));
2278 else if ( _sPropName
== PROPERTY_FOOTERON
)
2280 pMemFun
= ::std::mem_fn(&OGroupHelper::getFooterOn
);
2281 pMemFunSection
= ::std::mem_fn(&OGroupHelper::getFooter
);
2282 nPosition
= getDesignView()->getSectionCount();
2284 if ( m_xReportDefinition
->getPageFooterOn() )
2286 if ( m_xReportDefinition
->getReportFooterOn() )
2288 sColor
= DBGROUPFOOTER
;
2289 nPosition
-= (static_cast<sal_uInt16
>(_nGroupPos
) - lcl_getNonVisibleGroupsBefore(m_xReportDefinition
->getGroups(),_nGroupPos
,pMemFun
));
2298 OGroupHelper
aGroupHelper(_xGroup
);
2299 getDesignView()->addSection(pMemFunSection(&aGroupHelper
),sColor
,nPosition
);
2303 getDesignView()->removeSection(nPosition
);
2308 IMPL_LINK_NOARG(OReportController
, OnClipboardChanged
, TransferableDataHelper
*, void)
2310 OnInvalidateClipboard();
2313 void OReportController::OnInvalidateClipboard()
2315 InvalidateFeature(SID_CUT
);
2316 InvalidateFeature(SID_COPY
);
2317 InvalidateFeature(SID_PASTE
);
2320 static ItemInfoPackage
& getItemInfoPackageOpenPageDlg()
2322 class ItemInfoPackageOpenPageDlg
: public ItemInfoPackage
2324 typedef std::array
<ItemInfoStatic
, RPTUI_ID_METRIC
- RPTUI_ID_LRSPACE
+ 1> ItemInfoArrayOpenPageDlg
;
2325 ItemInfoArrayOpenPageDlg maItemInfos
{{
2326 // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
2327 { RPTUI_ID_LRSPACE
, new SvxLRSpaceItem(RPTUI_ID_LRSPACE
), SID_ATTR_LRSPACE
, SFX_ITEMINFOFLAG_NONE
},
2328 { RPTUI_ID_ULSPACE
, new SvxULSpaceItem(RPTUI_ID_ULSPACE
), SID_ATTR_ULSPACE
, SFX_ITEMINFOFLAG_NONE
},
2329 { RPTUI_ID_PAGE
, new SvxPageItem(RPTUI_ID_PAGE
), SID_ATTR_PAGE
, SFX_ITEMINFOFLAG_NONE
},
2330 { RPTUI_ID_SIZE
, new SvxSizeItem(RPTUI_ID_SIZE
), SID_ATTR_PAGE_SIZE
, SFX_ITEMINFOFLAG_NONE
},
2331 { RPTUI_ID_PAGE_MODE
, new SfxUInt16Item(RPTUI_ID_PAGE_MODE
,SVX_PAGE_MODE_STANDARD
), SID_ENUM_PAGE_MODE
, SFX_ITEMINFOFLAG_NONE
},
2332 { RPTUI_ID_START
, new SfxUInt16Item(RPTUI_ID_START
,PAPER_A4
), SID_PAPER_START
, SFX_ITEMINFOFLAG_NONE
},
2333 { RPTUI_ID_END
, new SfxUInt16Item(RPTUI_ID_END
,PAPER_E
), SID_PAPER_END
, SFX_ITEMINFOFLAG_NONE
},
2334 { RPTUI_ID_BRUSH
, new SvxBrushItem(RPTUI_ID_BRUSH
), SID_ATTR_BRUSH
, SFX_ITEMINFOFLAG_NONE
},
2335 { XATTR_FILLSTYLE
, new XFillStyleItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2336 { XATTR_FILLCOLOR
, new XFillColorItem(u
""_ustr
, COL_DEFAULT_SHAPE_FILLING
), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE
},
2337 { XATTR_FILLGRADIENT
, new XFillGradientItem(basegfx::BGradient()), 0, SFX_ITEMINFOFLAG_NONE
},
2338 { XATTR_FILLHATCH
, new XFillHatchItem(XHatch(COL_DEFAULT_SHAPE_STROKE
)), 0, SFX_ITEMINFOFLAG_NONE
},
2339 { XATTR_FILLBITMAP
, nullptr, 0, SFX_ITEMINFOFLAG_NONE
},
2340 { XATTR_FILLTRANSPARENCE
, new XFillTransparenceItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2341 { XATTR_GRADIENTSTEPCOUNT
, new XGradientStepCountItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2342 { XATTR_FILLBMP_TILE
, new XFillBmpTileItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2343 { XATTR_FILLBMP_POS
, new XFillBmpPosItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2344 { XATTR_FILLBMP_SIZEX
, new XFillBmpSizeXItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2345 { XATTR_FILLBMP_SIZEY
, new XFillBmpSizeYItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2346 { XATTR_FILLFLOATTRANSPARENCE
, new XFillFloatTransparenceItem(basegfx::BGradient(), false), 0, SFX_ITEMINFOFLAG_NONE
},
2347 { XATTR_SECONDARYFILLCOLOR
, new XSecondaryFillColorItem(u
""_ustr
, COL_DEFAULT_SHAPE_FILLING
), 0, SFX_ITEMINFOFLAG_NONE
},
2348 { XATTR_FILLBMP_SIZELOG
, new XFillBmpSizeLogItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2349 { XATTR_FILLBMP_TILEOFFSETX
, new XFillBmpTileOffsetXItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2350 { XATTR_FILLBMP_TILEOFFSETY
, new XFillBmpTileOffsetYItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2351 { XATTR_FILLBMP_STRETCH
, new XFillBmpStretchItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2352 { XATTR_FILLBMP_POSOFFSETX
, new XFillBmpPosOffsetXItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2353 { XATTR_FILLBMP_POSOFFSETY
, new XFillBmpPosOffsetYItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2354 { XATTR_FILLBACKGROUND
, new XFillBackgroundItem
, 0, SFX_ITEMINFOFLAG_NONE
},
2355 { RPTUI_ID_METRIC
, nullptr, SID_ATTR_METRIC
, SFX_ITEMINFOFLAG_NONE
},
2358 virtual const ItemInfoStatic
& getItemInfoStatic(size_t nIndex
) const override
{ return maItemInfos
[nIndex
]; }
2361 ItemInfoPackageOpenPageDlg()
2363 const MeasurementSystem
eSystem(SvtSysLocale().GetLocaleData().getMeasurementSystemEnum());
2364 const FieldUnit
eUserMetric(MeasurementSystem::Metric
== eSystem
? FieldUnit::CM
: FieldUnit::INCH
);
2365 setItemAtItemInfoStatic(
2366 new SfxUInt16Item(RPTUI_ID_METRIC
,static_cast<sal_uInt16
>(eUserMetric
)),
2367 maItemInfos
[RPTUI_ID_METRIC
- RPTUI_ID_LRSPACE
]);
2370 virtual size_t size() const override
{ return maItemInfos
.size(); }
2371 virtual const ItemInfo
& getItemInfo(size_t nIndex
, SfxItemPool
& /*rPool*/) override
2373 const ItemInfo
& rRetval(maItemInfos
[nIndex
]);
2375 // return immediately if we have the static entry and Item
2376 if (nullptr != rRetval
.getItem())
2379 if (XATTR_FILLBITMAP
== rRetval
.getWhich())
2380 return *new ItemInfoDynamic(rRetval
, new XFillBitmapItem(Graphic()));
2382 // return in any case
2387 static std::unique_ptr
<ItemInfoPackageOpenPageDlg
> g_aItemInfoPackageOpenPageDlg
;
2388 if (!g_aItemInfoPackageOpenPageDlg
)
2389 g_aItemInfoPackageOpenPageDlg
.reset(new ItemInfoPackageOpenPageDlg
);
2390 return *g_aItemInfoPackageOpenPageDlg
;
2393 void OReportController::openPageDialog(const uno::Reference
<report::XSection
>& _xSection
)
2395 if ( !m_xReportDefinition
.is() )
2399 MeasurementSystem eSystem
= SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
2400 FieldUnit eUserMetric
= MeasurementSystem::Metric
== eSystem
? FieldUnit::CM
: FieldUnit::INCH
;
2401 rtl::Reference
<SfxItemPool
> pPool(new SfxItemPool(u
"ReportPageProperties"_ustr
));
2402 pPool
->registerItemInfoPackage(getItemInfoPackageOpenPageDlg());
2403 pPool
->SetDefaultMetric( MapUnit::Map100thMM
); // ripped, don't understand why
2407 static const WhichRangesContainer
pRanges(svl::Items
<
2408 RPTUI_ID_LRSPACE
, XATTR_FILL_LAST
,
2409 SID_ATTR_METRIC
,SID_ATTR_METRIC
2411 SfxItemSet
aDescriptor(*pPool
, pRanges
);
2413 if ( _xSection
.is() )
2414 aDescriptor
.Put(SvxBrushItem(::Color(ColorTransparency
, _xSection
->getBackColor()),RPTUI_ID_BRUSH
));
2417 aDescriptor
.Put(SvxSizeItem(RPTUI_ID_SIZE
,
2418 vcl::unohelper::ConvertToVCLSize(getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
))));
2419 aDescriptor
.Put(SvxLRSpaceItem(SvxIndentValue::twips(getStyleProperty
<sal_Int32
>(
2420 m_xReportDefinition
, PROPERTY_LEFTMARGIN
)),
2421 SvxIndentValue::twips(getStyleProperty
<sal_Int32
>(
2422 m_xReportDefinition
, PROPERTY_RIGHTMARGIN
)),
2423 SvxIndentValue::zero(), RPTUI_ID_LRSPACE
));
2424 aDescriptor
.Put(SvxULSpaceItem(static_cast<sal_uInt16
>(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_TOPMARGIN
))
2425 ,static_cast<sal_uInt16
>(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_BOTTOMMARGIN
)),RPTUI_ID_ULSPACE
));
2426 aDescriptor
.Put(SfxUInt16Item(SID_ATTR_METRIC
,static_cast<sal_uInt16
>(eUserMetric
)));
2428 uno::Reference
< style::XStyle
> xPageStyle(getUsedStyle(m_xReportDefinition
));
2429 if ( xPageStyle
.is() )
2431 SvxPageItem
aPageItem(RPTUI_ID_PAGE
);
2432 aPageItem
.SetDescName(xPageStyle
->getName());
2433 uno::Reference
<beans::XPropertySet
> xProp(xPageStyle
,uno::UNO_QUERY_THROW
);
2434 aPageItem
.PutValue(xProp
->getPropertyValue(PROPERTY_PAGESTYLELAYOUT
),MID_PAGE_LAYOUT
);
2435 aPageItem
.SetLandscape(getStyleProperty
<bool>(m_xReportDefinition
,PROPERTY_ISLANDSCAPE
));
2436 aPageItem
.SetNumType(static_cast<SvxNumType
>(getStyleProperty
<sal_Int16
>(m_xReportDefinition
,PROPERTY_NUMBERINGTYPE
)));
2437 aDescriptor
.Put(aPageItem
);
2438 aDescriptor
.Put(SvxBrushItem(::Color(ColorTransparency
, getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_BACKCOLOR
)),RPTUI_ID_BRUSH
));
2442 { // want the dialog to be destroyed before our set
2443 ORptPageDialog
aDlg(
2444 getFrameWeld(), &aDescriptor
,_xSection
.is()
2445 ? u
"BackgroundDialog"_ustr
2446 : u
"PageDialog"_ustr
);
2447 if (aDlg
.run() == RET_OK
)
2452 const SfxItemSet
* pSet
= aDlg
.GetOutputItemSet();
2453 if ( _xSection
.is() )
2455 if ( const SvxBrushItem
* pBrushItem
= pSet
->GetItemIfSet( RPTUI_ID_BRUSH
))
2456 _xSection
->setBackColor(sal_Int32(pBrushItem
->GetColor()));
2460 uno::Reference
< beans::XPropertySet
> xProp(getUsedStyle(m_xReportDefinition
),uno::UNO_QUERY_THROW
);
2461 const OUString
sUndoAction(RptResId(RID_STR_UNDO_CHANGEPAGE
));
2462 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2463 if ( const SvxSizeItem
* pSizeItem
= pSet
->GetItemIfSet( RPTUI_ID_SIZE
))
2466 pSizeItem
->QueryValue(aValue
);
2467 xProp
->setPropertyValue(PROPERTY_PAPERSIZE
,aValue
);
2471 if ( const SvxLRSpaceItem
* pSpaceItem
= pSet
->GetItemIfSet( RPTUI_ID_LRSPACE
))
2474 pSpaceItem
->QueryValue(aValue
,MID_L_MARGIN
);
2475 xProp
->setPropertyValue(PROPERTY_LEFTMARGIN
,aValue
);
2476 pSpaceItem
->QueryValue(aValue
,MID_R_MARGIN
);
2477 xProp
->setPropertyValue(PROPERTY_RIGHTMARGIN
,aValue
);
2479 if ( const SvxULSpaceItem
* pSpaceItem
= pSet
->GetItemIfSet( RPTUI_ID_ULSPACE
))
2481 xProp
->setPropertyValue(PROPERTY_TOPMARGIN
,uno::Any(pSpaceItem
->GetUpper()));
2482 xProp
->setPropertyValue(PROPERTY_BOTTOMMARGIN
,uno::Any(pSpaceItem
->GetLower()));
2484 if ( const SvxPageItem
* pPageItem
= pSet
->GetItemIfSet( RPTUI_ID_PAGE
))
2486 xProp
->setPropertyValue(PROPERTY_ISLANDSCAPE
,uno::Any(pPageItem
->IsLandscape()));
2487 xProp
->setPropertyValue(PROPERTY_NUMBERINGTYPE
,uno::Any(static_cast<sal_Int16
>(pPageItem
->GetNumType())));
2489 pPageItem
->QueryValue(aValue
,MID_PAGE_LAYOUT
);
2490 xProp
->setPropertyValue(PROPERTY_PAGESTYLELAYOUT
,aValue
);
2493 if ( const SvxBrushItem
* pBrushItem
= pSet
->GetItemIfSet( RPTUI_ID_BRUSH
))
2495 ::Color aBackColor
= pBrushItem
->GetColor();
2496 xProp
->setPropertyValue(PROPERTY_BACKTRANSPARENT
,uno::Any(aBackColor
== COL_TRANSPARENT
));
2497 xProp
->setPropertyValue(PROPERTY_BACKCOLOR
,uno::Any(aBackColor
));
2503 catch(const Exception
&)
2505 DBG_UNHANDLED_EXCEPTION("reportdesign");
2511 sal_Bool SAL_CALL
OReportController::attachModel(const uno::Reference
< frame::XModel
> & xModel
)
2513 ::osl::MutexGuard
aGuard( getMutex() );
2515 uno::Reference
< report::XReportDefinition
> xReportDefinition( xModel
, UNO_QUERY
);
2516 if ( !xReportDefinition
.is() )
2519 uno::Reference
< document::XUndoManagerSupplier
> xTestSuppUndo( xModel
, UNO_QUERY
);
2520 if ( !xTestSuppUndo
.is() )
2523 m_xReportDefinition
= std::move(xReportDefinition
);
2528 void OReportController::openSortingAndGroupingDialog()
2530 if ( !m_xReportDefinition
.is() )
2532 if (!m_xGroupsFloater
)
2534 m_xGroupsFloater
= std::make_shared
<OGroupsSortingDialog
>(getFrameWeld(), !isEditable(), this);
2535 SvtViewOptions
aDlgOpt(EViewType::Window
, m_xGroupsFloater
->get_help_id());
2536 if ( aDlgOpt
.Exists() )
2537 m_xGroupsFloater
->getDialog()->set_window_state(aDlgOpt
.GetWindowState());
2541 if (!m_xGroupsFloater
->getDialog()->get_visible())
2542 weld::DialogController::runAsync(m_xGroupsFloater
, [this](sal_Int32
/*nResult*/) { m_xGroupsFloater
.reset(); });
2544 m_xGroupsFloater
->response(RET_CANCEL
);
2548 sal_Int32
OReportController::getGroupPosition(const uno::Reference
< report::XGroup
>& _xGroup
)
2550 return rptui::getPositionInIndexAccess(m_xReportDefinition
->getGroups(),_xGroup
);
2554 void OReportController::Notify(SfxBroadcaster
& /* _rBc */, SfxHint
const & _rHint
)
2556 if (_rHint
.GetId() != SfxHintId::ReportDesignDlgEd
)
2558 const DlgEdHint
* pDlgEdHint
= static_cast<const DlgEdHint
*>(&_rHint
);
2559 if (pDlgEdHint
->GetKind() != RPTUI_HINT_SELECTIONCHANGED
)
2562 const sal_Int32 nSelectionCount
= getDesignView()->getMarkedObjectCount();
2563 if ( m_nSelectionCount
!= nSelectionCount
)
2565 m_nSelectionCount
= nSelectionCount
;
2568 lang::EventObject
aEvent(*this);
2569 m_aSelectionListeners
.forEach(
2570 [&aEvent
] (uno::Reference
<view::XSelectionChangeListener
> const& xListener
) {
2571 return xListener
->selectionChanged(aEvent
);
2575 void OReportController::executeMethodWithUndo(TranslateId pUndoStrId
,const ::std::function
<void(ODesignView
*)>& _pMemfun
)
2577 const OUString sUndoAction
= RptResId(pUndoStrId
);
2578 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2579 _pMemfun( getDesignView() );
2580 InvalidateFeature( SID_UNDO
);
2583 void OReportController::alignControlsWithUndo(TranslateId pUndoStrId
, ControlModification _nControlModification
, bool _bAlignAtSection
)
2585 const OUString sUndoAction
= RptResId(pUndoStrId
);
2586 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2587 getDesignView()->alignMarkedObjects(_nControlModification
,_bAlignAtSection
);
2588 InvalidateFeature( SID_UNDO
);
2591 void OReportController::shrinkSectionBottom(const uno::Reference
<report::XSection
>& _xSection
)
2593 const sal_Int32 nElements
= _xSection
->getCount();
2596 // there are no elements
2599 const sal_Int32 nSectionHeight
= _xSection
->getHeight();
2600 sal_Int32 nMaxPositionY
= 0;
2601 uno::Reference
< report::XReportComponent
> xReportComponent
;
2603 // for every component get its Y-position and compare it to the current Y-position
2604 for (int i
=0;i
<nElements
;i
++)
2606 xReportComponent
.set(_xSection
->getByIndex(i
), uno::UNO_QUERY
);
2607 const sal_Int32 nReportComponentPositionY
= xReportComponent
->getPositionY();
2608 const sal_Int32 nReportComponentHeight
= xReportComponent
->getHeight();
2609 const sal_Int32 nReportComponentPositionYAndHeight
= nReportComponentPositionY
+ nReportComponentHeight
;
2610 nMaxPositionY
= std::max(nReportComponentPositionYAndHeight
, nMaxPositionY
);
2612 // now we know the minimal Y-Position and maximal Y-Position
2614 if (nMaxPositionY
> (nSectionHeight
- 7) ) // Magic Number, we use a little bit less heights for right positioning
2616 // the lowest position is already 0
2619 _xSection
->setHeight(nMaxPositionY
);
2622 void OReportController::shrinkSectionTop(const uno::Reference
<report::XSection
>& _xSection
)
2624 const sal_Int32 nElements
= _xSection
->getCount();
2627 // there are no elements
2631 const sal_Int32 nSectionHeight
= _xSection
->getHeight();
2632 sal_Int32 nMinPositionY
= nSectionHeight
;
2633 uno::Reference
< report::XReportComponent
> xReportComponent
;
2635 // for every component get its Y-position and compare it to the current Y-position
2636 for (int i
=0;i
<nElements
;i
++)
2638 xReportComponent
.set(_xSection
->getByIndex(i
), uno::UNO_QUERY
);
2639 const sal_Int32 nReportComponentPositionY
= xReportComponent
->getPositionY();
2640 nMinPositionY
= std::min(nReportComponentPositionY
, nMinPositionY
);
2642 // now we know the minimal Y-Position and maximal Y-Position
2643 if (nMinPositionY
== 0)
2645 // the lowest position is already 0
2648 for (int i
=0;i
<nElements
;i
++)
2650 xReportComponent
.set(_xSection
->getByIndex(i
), uno::UNO_QUERY
);
2651 const sal_Int32 nReportComponentPositionY
= xReportComponent
->getPositionY();
2652 const sal_Int32 nNewPositionY
= nReportComponentPositionY
- nMinPositionY
;
2653 xReportComponent
->setPositionY(nNewPositionY
);
2655 const sal_Int32 nNewSectionHeight
= nSectionHeight
- nMinPositionY
;
2656 _xSection
->setHeight(nNewSectionHeight
);
2659 void OReportController::shrinkSection(TranslateId pUndoStrId
, const uno::Reference
<report::XSection
>& _xSection
, sal_Int32 _nSid
)
2661 if ( _xSection
.is() )
2663 const OUString sUndoAction
= RptResId(pUndoStrId
);
2664 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2666 if (_nSid
== SID_SECTION_SHRINK
)
2668 shrinkSectionTop(_xSection
);
2669 shrinkSectionBottom(_xSection
);
2671 else if (_nSid
== SID_SECTION_SHRINK_TOP
)
2673 shrinkSectionTop(_xSection
);
2675 else if (_nSid
== SID_SECTION_SHRINK_BOTTOM
)
2677 shrinkSectionBottom(_xSection
);
2681 InvalidateFeature( SID_UNDO
);
2685 uno::Any SAL_CALL
OReportController::getViewData()
2687 ::osl::MutexGuard
aGuard( getMutex() );
2689 const sal_Int32 nCommandIDs
[] =
2695 SID_SHOW_PROPERTYBROWSER
,
2696 SID_PROPERTYBROWSER_LAST_PAGE
,
2700 ::comphelper::NamedValueCollection aCommandProperties
;
2701 for (sal_Int32 nCommandID
: nCommandIDs
)
2703 const FeatureState aFeatureState
= GetState( nCommandID
);
2705 OUString
sCommandURL( getURLForId( nCommandID
).Main
);
2706 OSL_ENSURE( sCommandURL
.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" );
2707 sCommandURL
= sCommandURL
.copy( 5 );
2710 if ( aFeatureState
.bChecked
.has_value() )
2711 aCommandState
<<= *aFeatureState
.bChecked
;
2712 else if ( aFeatureState
.aValue
.hasValue() )
2713 aCommandState
= aFeatureState
.aValue
;
2715 aCommandProperties
.put( sCommandURL
, aCommandState
);
2718 ::comphelper::NamedValueCollection aViewData
;
2719 aViewData
.put( u
"CommandProperties"_ustr
, aCommandProperties
.getPropertyValues() );
2721 if ( getDesignView() )
2723 ::std::vector
<sal_uInt16
> aCollapsedPositions
;
2724 getDesignView()->fillCollapsedSections(aCollapsedPositions
);
2725 if ( !aCollapsedPositions
.empty() )
2727 uno::Sequence
<beans::PropertyValue
> aCollapsedSections(aCollapsedPositions
.size());
2728 beans::PropertyValue
* pCollapsedIter
= aCollapsedSections
.getArray();
2730 for (const auto& rPos
: aCollapsedPositions
)
2732 pCollapsedIter
->Name
= PROPERTY_SECTION
+ OUString::number(i
);
2733 pCollapsedIter
->Value
<<= static_cast<sal_Int32
>(rPos
);
2738 aViewData
.put( u
"CollapsedSections"_ustr
, aCollapsedSections
);
2741 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
2742 if ( pSectionWindow
)
2744 aViewData
.put( u
"MarkedSection"_ustr
, static_cast<sal_Int32
>(pSectionWindow
->getReportSection().getPage()->GetPageNum()) );
2748 aViewData
.put( u
"ZoomFactor"_ustr
, m_nZoomValue
);
2749 return uno::Any( aViewData
.getPropertyValues() );
2752 void SAL_CALL
OReportController::restoreViewData(const uno::Any
& i_data
)
2754 ::osl::MutexGuard
aGuard( getMutex() );
2758 const ::comphelper::NamedValueCollection
aViewData( i_data
);
2760 m_aCollapsedSections
= aViewData
.getOrDefault( u
"CollapsedSections"_ustr
, m_aCollapsedSections
);
2761 m_nPageNum
= aViewData
.getOrDefault( u
"MarkedSection"_ustr
, m_nPageNum
);
2762 m_nZoomValue
= aViewData
.getOrDefault( u
"ZoomFactor"_ustr
, m_nZoomValue
);
2763 // TODO: setting those 3 members is not enough - in theory, restoreViewData can be called when the
2764 // view is fully alive, so we need to reflect those 3 values in the view.
2765 // (At the moment, the method is called only during construction phase)
2768 ::comphelper::NamedValueCollection
aCommandProperties( aViewData
.get( u
"CommandProperties"_ustr
) );
2769 const ::std::vector
< OUString
> aCommandNames( aCommandProperties
.getNames() );
2771 for ( const auto& rCommandName
: aCommandNames
)
2773 const Any
& rCommandValue
= aCommandProperties
.get( rCommandName
);
2774 if ( !rCommandValue
.hasValue() )
2780 aCommand
.Complete
= ".uno:" + rCommandName
;
2782 executeUnChecked( aCommand
, { comphelper::makePropertyValue(u
"Value"_ustr
, rCommandValue
) } );
2786 if ( rCommandName
== "ShowRuler" )
2787 OSL_VERIFY( rCommandValue
>>= m_bShowRuler
);
2788 else if ( rCommandName
== "HelplinesMove" )
2789 OSL_VERIFY( rCommandValue
>>= m_bHelplinesMove
);
2790 else if ( rCommandName
== "GridVisible" )
2791 OSL_VERIFY( rCommandValue
>>= m_bGridVisible
);
2792 else if ( rCommandName
== "GridUse" )
2793 OSL_VERIFY( rCommandValue
>>= m_bGridUse
);
2794 else if ( rCommandName
== "ControlProperties" )
2795 OSL_VERIFY( rCommandValue
>>= m_bShowProperties
);
2796 else if ( rCommandName
== "LastPropertyBrowserPage" )
2797 OSL_VERIFY( rCommandValue
>>= m_sLastActivePage
);
2798 else if ( rCommandName
== "SplitPosition" )
2799 OSL_VERIFY( rCommandValue
>>= m_nSplitPos
);
2803 catch(const IllegalArgumentException
&)
2805 DBG_UNHANDLED_EXCEPTION("reportdesign");
2809 Reference
<XFrame
> OReportController::getXFrame()
2811 if ( !m_xFrameLoader
.is() )
2813 m_xFrameLoader
.set( frame::Desktop::create(m_xContext
) );
2815 const sal_Int32 nFrameSearchFlag
= frame::FrameSearchFlag::TASKS
| frame::FrameSearchFlag::CREATE
;
2816 Reference
<XFrame
> xFrame
= m_xFrameLoader
->findFrame(u
"_blank"_ustr
,nFrameSearchFlag
);
2821 uno::Reference
<frame::XModel
> OReportController::executeReport()
2823 OSL_ENSURE(m_xReportDefinition
.is(),"Where is my report?");
2825 uno::Reference
<frame::XModel
> xModel
;
2826 if ( m_xReportDefinition
.is() )
2828 TranslateId pErrorId
= RID_ERR_NO_COMMAND
;
2829 bool bEnabled
= !m_xReportDefinition
->getCommand().isEmpty();
2833 const sal_uInt16 nCount
= m_aReportModel
->GetPageCount();
2835 for (; i
< nCount
&& !bEnabled
; ++i
)
2837 const SdrPage
* pPage
= m_aReportModel
->GetPage(i
);
2838 bEnabled
= pPage
->GetObjCount() != 0;
2841 pErrorId
= RID_ERR_NO_OBJECTS
;
2844 dbtools::SQLExceptionInfo aInfo
;
2847 sdb::SQLContext
aFirstMessage(RptResId(pErrorId
), {}, {}, 0, {}, {});
2848 aInfo
= aFirstMessage
;
2851 sal_uInt16 nCommand
= 0;
2852 if (pErrorId
!= RID_ERR_NO_COMMAND
)
2854 if ( !m_bShowProperties
)
2855 executeUnChecked(SID_SHOW_PROPERTYBROWSER
, {});
2857 m_sLastActivePage
= "Data";
2858 getDesignView()->setCurrentPage(m_sLastActivePage
);
2859 nCommand
= SID_SELECT_REPORT
;
2861 else if ( getDesignView() && !getDesignView()->isAddFieldVisible() )
2863 nCommand
= SID_FM_ADD_FIELD
;
2867 executeUnChecked(nCommand
, {});
2873 m_bInGeneratePreview
= true;
2876 weld::WaitObject
aWait(getFrameWeld()); // cursor
2877 if ( !m_xReportEngine
.is() )
2878 m_xReportEngine
.set( report::ReportEngine::create(m_xContext
) );
2879 m_xReportEngine
->setReportDefinition(m_xReportDefinition
);
2880 m_xReportEngine
->setActiveConnection(getConnection());
2881 Reference
<XFrame
> xFrame
= getXFrame();
2882 xModel
= m_xReportEngine
->createDocumentAlive(xFrame
);
2884 catch(const sdbc::SQLException
&)
2885 { // SQLExceptions and derived exceptions must not be translated
2886 aInfo
= ::cppu::getCaughtException();
2888 catch(const uno::Exception
& e
)
2890 uno::Any
aCaughtException( ::cppu::getCaughtException() );
2892 // maybe our third message: the message which is wrapped in the exception we caught
2893 css::uno::Any aOptThirdMessage
;
2894 if (lang::WrappedTargetException aWrapped
; aCaughtException
>>= aWrapped
)
2896 sdbc::SQLException aThirdMessage
;
2897 aThirdMessage
.Message
= aWrapped
.Message
;
2898 aThirdMessage
.Context
= aWrapped
.Context
;
2899 if ( !aThirdMessage
.Message
.isEmpty() )
2900 aOptThirdMessage
<<= aThirdMessage
;
2904 // our second message: the message of the exception we caught
2905 sdbc::SQLException
aSecondMessage(e
.Message
, e
.Context
, {}, 0, aOptThirdMessage
);
2907 // our first message says: we caught an exception
2908 OUString
sInfo(RptResId(RID_STR_CAUGHT_FOREIGN_EXCEPTION
));
2909 sInfo
= sInfo
.replaceAll("$type$", aCaughtException
.getValueTypeName());
2910 sdb::SQLContext
aFirstMessage(sInfo
, {}, {}, 0, css::uno::Any(aSecondMessage
), {});
2912 aInfo
= aFirstMessage
;
2914 if (aInfo
.isValid())
2916 const OUString suSQLContext
= RptResId( RID_STR_COULD_NOT_CREATE_REPORT
);
2917 aInfo
.prepend(suSQLContext
);
2919 m_bInGeneratePreview
= false;
2922 if (aInfo
.isValid())
2930 uno::Reference
< frame::XModel
> SAL_CALL
OReportController::getModel()
2932 return m_xReportDefinition
;
2935 uno::Reference
< sdbc::XRowSet
> const & OReportController::getRowSet()
2937 OSL_PRECOND( m_xReportDefinition
.is(), "OReportController::getRowSet: no report definition?!" );
2939 if ( m_xRowSet
.is() || !m_xReportDefinition
.is() )
2944 uno::Reference
< sdbc::XRowSet
> xRowSet(
2945 getORB()->getServiceManager()->createInstanceWithContext(u
"com.sun.star.sdb.RowSet"_ustr
, getORB()),
2947 uno::Reference
< beans::XPropertySet
> xRowSetProp( xRowSet
, uno::UNO_QUERY_THROW
);
2949 xRowSetProp
->setPropertyValue( PROPERTY_ACTIVECONNECTION
, uno::Any( getConnection() ) );
2950 xRowSetProp
->setPropertyValue( PROPERTY_APPLYFILTER
, uno::Any( true ) );
2952 auto aNoConverter
= std::make_shared
<AnyConverter
>();
2953 TPropertyNamePair aPropertyMediation
;
2954 aPropertyMediation
.emplace( PROPERTY_COMMAND
, TPropertyConverter(PROPERTY_COMMAND
,aNoConverter
) );
2955 aPropertyMediation
.emplace( PROPERTY_COMMANDTYPE
, TPropertyConverter(PROPERTY_COMMANDTYPE
,aNoConverter
) );
2956 aPropertyMediation
.emplace( PROPERTY_ESCAPEPROCESSING
, TPropertyConverter(PROPERTY_ESCAPEPROCESSING
,aNoConverter
) );
2957 aPropertyMediation
.emplace( PROPERTY_FILTER
, TPropertyConverter(PROPERTY_FILTER
,aNoConverter
) );
2959 m_xRowSetMediator
= new OPropertyMediator( m_xReportDefinition
, xRowSetProp
, std::move(aPropertyMediation
) );
2960 m_xRowSet
= std::move(xRowSet
);
2962 catch(const uno::Exception
&)
2964 DBG_UNHANDLED_EXCEPTION("reportdesign");
2970 void OReportController::insertGraphic()
2972 const OUString
sTitle(RptResId(RID_STR_IMPORT_GRAPHIC
));
2973 // build some arguments for the upcoming dialog
2976 uno::Reference
< report::XSection
> xSection
= getDesignView()->getCurrentSection();
2977 ::sfx2::FileDialogHelper
aDialog(ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW
, FileDialogFlags::Graphic
, getFrameWeld());
2978 aDialog
.SetContext(sfx2::FileDialogHelper::ReportInsertImage
);
2979 aDialog
.SetTitle( sTitle
);
2981 uno::Reference
< ui::dialogs::XFilePickerControlAccess
> xController(aDialog
.GetFilePicker(), UNO_QUERY_THROW
);
2982 xController
->setValue(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW
, 0, css::uno::Any(true));
2983 xController
->enableControl(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, false/*sal_True*/);
2984 xController
->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0, css::uno::Any(true) );
2986 if ( ERRCODE_NONE
== aDialog
.Execute() )
2989 xController
->getValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0) >>= bLink
;
2990 uno::Sequence
<beans::PropertyValue
> aArgs( comphelper::InitPropertySequence({
2991 { PROPERTY_IMAGEURL
, Any(aDialog
.GetPath()) },
2992 { PROPERTY_PRESERVEIRI
, Any(bLink
) }
2994 createControl(aArgs
,xSection
,OUString(),SdrObjKind::ReportDesignImageControl
);
2997 catch(const Exception
&)
2999 DBG_UNHANDLED_EXCEPTION("reportdesign");
3004 sal_Bool SAL_CALL
OReportController::select( const Any
& aSelection
)
3006 ::osl::MutexGuard
aGuard( getMutex() );
3007 if ( !getDesignView() )
3010 getDesignView()->unmarkAllObjects();
3011 getDesignView()->SetMode(DlgEdMode::Select
);
3013 uno::Sequence
< uno::Reference
<report::XReportComponent
> > aElements
;
3014 if ( aSelection
>>= aElements
)
3016 if ( aElements
.hasElements() )
3017 getDesignView()->showProperties(uno::Reference
<uno::XInterface
>(aElements
[0],uno::UNO_QUERY
));
3018 getDesignView()->setMarked(aElements
, true);
3022 uno::Reference
<uno::XInterface
> xObject(aSelection
,uno::UNO_QUERY
);
3023 uno::Reference
<report::XReportComponent
> xProp(xObject
,uno::UNO_QUERY
);
3026 getDesignView()->showProperties(xObject
);
3027 aElements
= { xProp
};
3028 getDesignView()->setMarked(aElements
, true);
3032 uno::Reference
<report::XSection
> xSection(aSelection
,uno::UNO_QUERY
);
3033 if ( !xSection
.is() && xObject
.is() )
3034 getDesignView()->showProperties(xObject
);
3035 getDesignView()->setMarked(xSection
,xSection
.is());
3042 Any SAL_CALL
OReportController::getSelection( )
3044 ::osl::MutexGuard
aGuard( getMutex() );
3046 if ( getDesignView() )
3048 aRet
= getDesignView()->getCurrentlyShownProperty();
3049 if ( !aRet
.hasValue() )
3050 aRet
<<= getDesignView()->getCurrentSection();
3055 void SAL_CALL
OReportController::addSelectionChangeListener( const Reference
< view::XSelectionChangeListener
>& Listener
)
3057 m_aSelectionListeners
.addInterface( Listener
);
3060 void SAL_CALL
OReportController::removeSelectionChangeListener( const Reference
< view::XSelectionChangeListener
>& Listener
)
3062 m_aSelectionListeners
.removeInterface( Listener
);
3065 void OReportController::createNewFunction(const uno::Any
& _aValue
)
3067 uno::Reference
< container::XIndexContainer
> xFunctions(_aValue
,uno::UNO_QUERY_THROW
);
3068 const OUString sNewName
= RptResId(RID_STR_FUNCTION
);
3069 uno::Reference
< report::XFunction
> xFunction(report::Function::create(m_xContext
));
3070 xFunction
->setName(sNewName
);
3071 // the call below will also create an undo action -> listener
3072 xFunctions
->insertByIndex(xFunctions
->getCount(),uno::Any(xFunction
));
3075 IMPL_LINK_NOARG( OReportController
, OnExecuteReport
, void*, void )
3080 void OReportController::createControl(const Sequence
< PropertyValue
>& _aArgs
,const uno::Reference
< report::XSection
>& _xSection
,const OUString
& _sFunction
,SdrObjKind _nObjectId
)
3082 SequenceAsHashMap
aMap(_aArgs
);
3083 getDesignView()->setMarked(_xSection
, true);
3084 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
3085 if ( !pSectionWindow
)
3088 OSL_ENSURE(pSectionWindow
->getReportSection().getSection() == _xSection
,"Invalid section after marking the correct one.");
3090 sal_Int32 nLeftMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
);
3091 const sal_Int32 nRightMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
);
3092 const sal_Int32 nPaperWidth
= getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
).Width
- nRightMargin
;
3093 awt::Point aPos
= aMap
.getUnpackedValueOrDefault(PROPERTY_POSITION
,awt::Point(nLeftMargin
,0));
3094 if ( aPos
.X
< nLeftMargin
)
3095 aPos
.X
= nLeftMargin
;
3097 rtl::Reference
<SdrObject
> pNewControl
;
3098 uno::Reference
< report::XReportComponent
> xShapeProp
;
3099 if ( _nObjectId
== SdrObjKind::CustomShape
)
3101 pNewControl
= SdrObjFactory::MakeNewObject(
3103 SdrInventor::ReportDesign
,
3105 xShapeProp
.set(pNewControl
->getUnoShape(),uno::UNO_QUERY
);
3106 OUString sCustomShapeType
= getDesignView()->GetInsertObjString();
3107 if ( sCustomShapeType
.isEmpty() )
3108 sCustomShapeType
= "diamond";
3109 OReportSection::createDefault(sCustomShapeType
,pNewControl
.get());
3110 pNewControl
->SetLogicRect(tools::Rectangle(3000,500,6000,3500)); // switch height and width
3112 else if ( _nObjectId
== SdrObjKind::OLE2
|| SdrObjKind::ReportDesignSubReport
== _nObjectId
)
3114 pNewControl
= SdrObjFactory::MakeNewObject(
3116 SdrInventor::ReportDesign
,
3119 pNewControl
->SetLogicRect(tools::Rectangle(3000,500,8000,5500)); // switch height and width
3120 xShapeProp
.set(pNewControl
->getUnoShape(),uno::UNO_QUERY_THROW
);
3121 OOle2Obj
* pObj
= dynamic_cast<OOle2Obj
*>(pNewControl
.get());
3122 if ( pObj
&& !pObj
->IsEmpty() )
3124 pObj
->initializeChart(getModel());
3129 rtl::Reference
<SdrUnoObj
> pLabel
;
3130 rtl::Reference
<SdrUnoObj
> pControl
;
3132 FmFormView::createControlLabelPair(
3133 getDesignView()->GetOutDev(),
3139 SdrInventor::ReportDesign
,
3140 SdrObjKind::ReportDesignFixedText
,
3142 // tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
3143 // m_aReportModel seems pretty safe, it's done in other places, initialized
3144 // in impl_initialize and throws a RuntimeException if not existing.
3152 pNewControl
= pControl
;
3153 OUnoObject
* pObj
= dynamic_cast<OUnoObject
*>(pNewControl
.get());
3157 uno::Reference
<beans::XPropertySet
> xUnoProp(pObj
->GetUnoControlModel(),uno::UNO_QUERY
);
3158 xShapeProp
.set(pObj
->getUnoShape(),uno::UNO_QUERY
);
3159 uno::Reference
<beans::XPropertySetInfo
> xShapeInfo
= xShapeProp
->getPropertySetInfo();
3160 uno::Reference
<beans::XPropertySetInfo
> xInfo
= xUnoProp
->getPropertySetInfo();
3162 const OUString sProps
[] = { PROPERTY_NAME
3163 ,PROPERTY_FONTDESCRIPTOR
3164 ,PROPERTY_FONTDESCRIPTORASIAN
3165 ,PROPERTY_FONTDESCRIPTORCOMPLEX
3166 ,PROPERTY_ORIENTATION
3168 ,PROPERTY_FORMATSSUPPLIER
3169 ,PROPERTY_BACKGROUNDCOLOR
3171 for(const auto & sProp
: sProps
)
3173 if ( xInfo
->hasPropertyByName(sProp
) && xShapeInfo
->hasPropertyByName(sProp
) )
3174 xUnoProp
->setPropertyValue(sProp
,xShapeProp
->getPropertyValue(sProp
));
3177 if ( xInfo
->hasPropertyByName(PROPERTY_BORDER
) && xShapeInfo
->hasPropertyByName(PROPERTY_CONTROLBORDER
) )
3178 xUnoProp
->setPropertyValue(PROPERTY_BORDER
,xShapeProp
->getPropertyValue(PROPERTY_CONTROLBORDER
));
3181 if ( xInfo
->hasPropertyByName(PROPERTY_DATAFIELD
) && !_sFunction
.isEmpty() )
3183 ReportFormula
aFunctionFormula( ReportFormula::Expression
, _sFunction
);
3184 xUnoProp
->setPropertyValue( PROPERTY_DATAFIELD
, uno::Any( aFunctionFormula
.getCompleteFormula() ) );
3187 sal_Int32 nFormatKey
= aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEY
,sal_Int32(0));
3188 if ( nFormatKey
&& xInfo
->hasPropertyByName(PROPERTY_FORMATKEY
) )
3189 xUnoProp
->setPropertyValue( PROPERTY_FORMATKEY
, uno::Any( nFormatKey
) );
3191 OUString sUrl
= aMap
.getUnpackedValueOrDefault(PROPERTY_IMAGEURL
,OUString());
3192 if ( !sUrl
.isEmpty() && xInfo
->hasPropertyByName(PROPERTY_IMAGEURL
) )
3193 xUnoProp
->setPropertyValue( PROPERTY_IMAGEURL
, uno::Any( sUrl
) );
3195 pObj
->CreateMediator(true);
3197 if ( _nObjectId
== SdrObjKind::ReportDesignFixedText
) // special case for fixed text
3198 xUnoProp
->setPropertyValue(PROPERTY_LABEL
,uno::Any(OUnoObject::GetDefaultName(pObj
)));
3199 else if ( _nObjectId
== SdrObjKind::ReportDesignVerticalFixedLine
)
3201 awt::Size aOlSize
= xShapeProp
->getSize();
3202 xShapeProp
->setSize(awt::Size(aOlSize
.Height
,aOlSize
.Width
)); // switch height and width
3207 const sal_Int32 nShapeWidth
= aMap
.getUnpackedValueOrDefault(PROPERTY_WIDTH
,xShapeProp
->getWidth());
3208 if ( nShapeWidth
!= xShapeProp
->getWidth() )
3209 xShapeProp
->setWidth( nShapeWidth
);
3211 const bool bChangedPos
= (aPos
.X
+ nShapeWidth
) > nPaperWidth
;
3213 aPos
.X
= nPaperWidth
- nShapeWidth
;
3214 xShapeProp
->setPosition(aPos
);
3216 correctOverlapping(pNewControl
.get(),pSectionWindow
->getReportSection());
3219 void OReportController::createDateTime(const Sequence
< PropertyValue
>& _aArgs
)
3221 getDesignView()->unmarkAllObjects();
3223 const OUString
sUndoAction(RptResId(RID_STR_UNDO_INSERT_CONTROL
));
3224 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
3226 SequenceAsHashMap
aMap(_aArgs
);
3227 aMap
.createItemIfMissing(PROPERTY_FORMATKEY
,aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE
,sal_Int32(0)));
3229 uno::Reference
< report::XSection
> xSection
= aMap
.getUnpackedValueOrDefault(PROPERTY_SECTION
,uno::Reference
< report::XSection
>());
3232 bool bDate
= aMap
.getUnpackedValueOrDefault(PROPERTY_DATE_STATE
, false);
3235 sFunction
= "TODAY()";
3236 createControl(aMap
.getAsConstPropertyValueList(),xSection
,sFunction
);
3238 bool bTime
= aMap
.getUnpackedValueOrDefault(PROPERTY_TIME_STATE
, false);
3241 sFunction
= "TIMEVALUE(NOW())";
3242 aMap
[PROPERTY_FORMATKEY
] <<= aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME
,sal_Int32(0));
3243 createControl(aMap
.getAsConstPropertyValueList(),xSection
,sFunction
);
3247 void OReportController::createPageNumber(const Sequence
< PropertyValue
>& _aArgs
)
3249 getDesignView()->unmarkAllObjects();
3251 const OUString
sUndoAction(RptResId(RID_STR_UNDO_INSERT_CONTROL
));
3252 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
3254 if ( !m_xReportDefinition
->getPageHeaderOn() )
3256 uno::Sequence
< beans::PropertyValue
> aArgs
;
3257 executeChecked(SID_PAGEHEADERFOOTER
,aArgs
);
3260 SequenceAsHashMap
aMap(_aArgs
);
3261 bool bStateOfPage
= aMap
.getUnpackedValueOrDefault(PROPERTY_STATE
, false);
3263 OUString
sFunction( RptResId(STR_RPT_PN_PAGE
) );
3264 sFunction
= sFunction
.replaceFirst("#PAGENUMBER#", "PageNumber()");
3268 sFunction
+= RptResId(STR_RPT_PN_PAGE_OF
);
3269 sFunction
= sFunction
.replaceFirst("#PAGECOUNT#", "PageCount()");
3272 bool bInPageHeader
= aMap
.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON
, true);
3273 createControl(_aArgs
,bInPageHeader
? m_xReportDefinition
->getPageHeader() : m_xReportDefinition
->getPageFooter(),sFunction
);
3277 void OReportController::addPairControls(const Sequence
< PropertyValue
>& aArgs
)
3279 getDesignView()->unmarkAllObjects();
3281 // the FormatKey determines which field is required
3282 OSectionWindow
* pSectionWindow
[2];
3283 pSectionWindow
[0] = getDesignView()->getMarkedSection();
3285 if ( !pSectionWindow
[0] )
3287 select(uno::Any(m_xReportDefinition
->getDetail()));
3288 pSectionWindow
[0] = getDesignView()->getMarkedSection();
3289 if ( !pSectionWindow
[0] )
3293 uno::Reference
<report::XSection
> xCurrentSection
= getDesignView()->getCurrentSection();
3294 UndoContext
aUndoContext(getUndoManager(), RptResId(RID_STR_UNDO_INSERT_CONTROL
));
3298 bool bHandleOnlyOne
= false;
3299 for(const PropertyValue
& rArg
: aArgs
)
3303 Sequence
< PropertyValue
> aValue
;
3304 if ( !(rArg
.Value
>>= aValue
) )
3305 { // the sequence has only one element which already contains the descriptor
3306 bHandleOnlyOne
= true;
3309 svx::ODataAccessDescriptor
aDescriptor(aValue
);
3310 SequenceAsHashMap
aMap(aValue
);
3311 uno::Reference
<report::XSection
> xSection
= aMap
.getUnpackedValueOrDefault(u
"Section"_ustr
,xCurrentSection
);
3312 uno::Reference
<report::XReportDefinition
> xReportDefinition
= xSection
->getReportDefinition();
3314 getDesignView()->setMarked(xSection
, true);
3315 pSectionWindow
[0] = getDesignView()->getMarkedSection();
3317 sal_Int32 nLeftMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
);
3318 awt::Point aPos
= aMap
.getUnpackedValueOrDefault(PROPERTY_POSITION
,awt::Point(nLeftMargin
,0));
3319 if ( aPos
.X
< nLeftMargin
)
3320 aPos
.X
= nLeftMargin
;
3322 // LLA: new feature, add the Label in dependency of the given DND_ACTION one section up, normal or one section down
3323 sal_Int8 nDNDAction
= aMap
.getUnpackedValueOrDefault(u
"DNDAction"_ustr
, sal_Int8(0));
3324 pSectionWindow
[1] = pSectionWindow
[0];
3325 bool bLabelAboveTextField
= nDNDAction
== DND_ACTION_COPY
;
3326 if ( bLabelAboveTextField
|| nDNDAction
== DND_ACTION_LINK
)
3328 // Add the Label one Section up
3329 pSectionWindow
[1] = getDesignView()->getMarkedSection(bLabelAboveTextField
? PREVIOUS
: POST
);
3330 if (!pSectionWindow
[1])
3332 // maybe out of bounds
3333 pSectionWindow
[1] = pSectionWindow
[0];
3336 // clear all selections
3337 getDesignView()->unmarkAllObjects();
3339 uno::Reference
< beans::XPropertySet
> xField( aDescriptor
[ svx::DataAccessDescriptorProperty::ColumnObject
], uno::UNO_QUERY
);
3340 uno::Reference
< lang::XComponent
> xHoldAlive
;
3344 OUString sColumnName
;
3345 sal_Int32
nCommandType( -1 );
3346 OSL_VERIFY( aDescriptor
[ svx::DataAccessDescriptorProperty::Command
] >>= sCommand
);
3347 OSL_VERIFY( aDescriptor
[ svx::DataAccessDescriptorProperty::ColumnName
] >>= sColumnName
);
3348 OSL_VERIFY( aDescriptor
[ svx::DataAccessDescriptorProperty::CommandType
] >>= nCommandType
);
3350 uno::Reference
< container::XNameAccess
> xColumns
;
3351 uno::Reference
< sdbc::XConnection
> xConnection( getConnection() );
3352 if ( !sCommand
.isEmpty() && nCommandType
!= -1 && !sColumnName
.isEmpty() && xConnection
.is() )
3354 if ( xReportDefinition
->getCommand().isEmpty() )
3356 xReportDefinition
->setCommand(sCommand
);
3357 xReportDefinition
->setCommandType(nCommandType
);
3360 xColumns
= dbtools::getFieldsByCommandDescriptor(xConnection
,nCommandType
,sCommand
,xHoldAlive
);
3361 if ( xColumns
.is() && xColumns
->hasByName(sColumnName
) )
3362 xField
.set( xColumns
->getByName( sColumnName
), uno::UNO_QUERY
);
3367 #if OSL_DEBUG_LEVEL > 0
3370 uno::Reference
< beans::XPropertySet
> xRowSetProps( getRowSet(), UNO_QUERY_THROW
);
3371 OUString sRowSetCommand
;
3372 sal_Int32
nRowSetCommandType( -1 );
3373 OSL_VERIFY( xRowSetProps
->getPropertyValue( PROPERTY_COMMAND
) >>= sRowSetCommand
);
3374 OSL_VERIFY( xRowSetProps
->getPropertyValue( PROPERTY_COMMANDTYPE
) >>= nRowSetCommandType
);
3375 OSL_ENSURE( ( sRowSetCommand
== sCommand
) && ( nCommandType
== nRowSetCommandType
),
3376 "OReportController::addPairControls: this only works for a data source which equals our current settings!" );
3377 // if this asserts, then either our row set and our report definition are not in sync, or somebody
3378 // requested the creation of a control/pair for another data source than what our report
3379 // definition is bound to - which is not supported for the parameters case, since we
3380 // can retrieve parameters from the RowSet only.
3382 catch(const Exception
&)
3384 DBG_UNHANDLED_EXCEPTION("reportdesign");
3388 // no column name - perhaps a parameter name?
3389 uno::Reference
< sdb::XParametersSupplier
> xSuppParam( getRowSet(), uno::UNO_QUERY_THROW
);
3390 uno::Reference
< container::XIndexAccess
> xParams( xSuppParam
->getParameters(), uno::UNO_SET_THROW
);
3391 sal_Int32
nParamCount( xParams
->getCount() );
3392 for ( sal_Int32 i
=0; i
<nParamCount
; ++i
)
3394 uno::Reference
< beans::XPropertySet
> xParamCol( xParams
->getByIndex(i
), uno::UNO_QUERY_THROW
);
3395 OUString sParamName
;
3396 OSL_VERIFY( xParamCol
->getPropertyValue(u
"Name"_ustr
) >>= sParamName
);
3397 if ( sParamName
== sColumnName
)
3399 xField
= std::move(xParamCol
);
3408 SdrObjKind nOBJID
= SdrObjKind::NONE
;
3409 sal_Int32 nDataType
= sdbc::DataType::BINARY
;
3410 xField
->getPropertyValue(PROPERTY_TYPE
) >>= nDataType
;
3411 switch ( nDataType
)
3413 case sdbc::DataType::BINARY
:
3414 case sdbc::DataType::VARBINARY
:
3415 case sdbc::DataType::LONGVARBINARY
:
3416 nOBJID
= SdrObjKind::ReportDesignImageControl
;
3419 nOBJID
= SdrObjKind::ReportDesignFormattedField
;
3423 if ( nOBJID
== SdrObjKind::NONE
)
3426 Reference
< util::XNumberFormatsSupplier
> xSupplier
= getReportNumberFormatter()->getNumberFormatsSupplier();
3427 if ( !xSupplier
.is() )
3430 Reference
< XNumberFormats
> xNumberFormats(xSupplier
->getNumberFormats());
3431 rtl::Reference
<SdrUnoObj
> pControl
[2];
3432 const sal_Int32 nRightMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
);
3433 const sal_Int32 nPaperWidth
= getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
).Width
- nRightMargin
;
3434 OSectionView
* pSectionViews
[2];
3435 pSectionViews
[0] = &pSectionWindow
[1]->getReportSection().getSectionView();
3436 pSectionViews
[1] = &pSectionWindow
[0]->getReportSection().getSectionView();
3439 FmFormView::createControlLabelPair(
3440 getDesignView()->GetOutDev(),
3446 SdrInventor::ReportDesign
,
3447 SdrObjKind::ReportDesignFixedText
,
3449 // tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
3450 // m_aReportModel seems pretty safe, it's done in other places, initialized
3451 // in impl_initialize and throws a RuntimeException if not existing.
3457 if ( pControl
[0] && pControl
[1] )
3459 SdrPageView
* pPgViews
[2];
3460 pPgViews
[0] = pSectionViews
[0]->GetSdrPageView();
3461 pPgViews
[1] = pSectionViews
[1]->GetSdrPageView();
3462 if ( pPgViews
[0] && pPgViews
[1] )
3464 OUString sDefaultName
;
3466 rtl::Reference
<OUnoObject
> pObjs
[2];
3467 for(i
= 0; i
< SAL_N_ELEMENTS(pControl
); ++i
)
3469 pObjs
[i
] = dynamic_cast<OUnoObject
*>(pControl
[i
].get());
3471 uno::Reference
<beans::XPropertySet
> xUnoProp(pObjs
[i
]->GetUnoControlModel(),uno::UNO_QUERY_THROW
);
3472 uno::Reference
< report::XReportComponent
> xShapeProp(pObjs
[i
]->getUnoShape(),uno::UNO_QUERY_THROW
);
3473 xUnoProp
->setPropertyValue(PROPERTY_NAME
,xShapeProp
->getPropertyValue(PROPERTY_NAME
));
3475 uno::Reference
<beans::XPropertySetInfo
> xShapeInfo
= xShapeProp
->getPropertySetInfo();
3476 uno::Reference
<beans::XPropertySetInfo
> xInfo
= xUnoProp
->getPropertySetInfo();
3477 const OUString sProps
[] = { PROPERTY_FONTDESCRIPTOR
3478 ,PROPERTY_FONTDESCRIPTORASIAN
3479 ,PROPERTY_FONTDESCRIPTORCOMPLEX
3481 ,PROPERTY_BACKGROUNDCOLOR
3483 for(const auto & sProp
: sProps
)
3485 if ( xInfo
->hasPropertyByName(sProp
) && xShapeInfo
->hasPropertyByName(sProp
) )
3486 xUnoProp
->setPropertyValue(sProp
,xShapeProp
->getPropertyValue(sProp
));
3488 if ( xInfo
->hasPropertyByName(PROPERTY_DATAFIELD
) )
3491 xUnoProp
->getPropertyValue(PROPERTY_DATAFIELD
) >>= sName
;
3492 sDefaultName
= sName
;
3493 xUnoProp
->setPropertyValue(PROPERTY_NAME
,uno::Any(sDefaultName
));
3495 ReportFormula
aFormula( ReportFormula::Field
, sName
);
3496 xUnoProp
->setPropertyValue( PROPERTY_DATAFIELD
, uno::Any( aFormula
.getCompleteFormula() ) );
3499 if ( xInfo
->hasPropertyByName(PROPERTY_BORDER
) && xShapeInfo
->hasPropertyByName(PROPERTY_CONTROLBORDER
) )
3500 xUnoProp
->setPropertyValue(PROPERTY_BORDER
,xShapeProp
->getPropertyValue(PROPERTY_CONTROLBORDER
));
3502 pObjs
[i
]->CreateMediator(true);
3504 const sal_Int32 nShapeWidth
= xShapeProp
->getWidth();
3505 const bool bChangedPos
= (aPos
.X
+ nShapeWidth
) > nPaperWidth
;
3507 aPos
.X
= nPaperWidth
- nShapeWidth
;
3508 xShapeProp
->setPosition(aPos
);
3510 aPos
.Y
+= xShapeProp
->getHeight();
3511 aPos
.X
+= nShapeWidth
;
3514 if ( xField
->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL
) )
3515 xField
->getPropertyValue(PROPERTY_LABEL
) >>= sLabel
;
3517 if (pSectionViews
[0] != pSectionViews
[1] &&
3518 nOBJID
== SdrObjKind::ReportDesignFormattedField
) // we want this nice feature only at FORMATTEDFIELD
3520 uno::Reference
< report::XReportComponent
> xShapePropLabel(pObjs
[0]->getUnoShape(),uno::UNO_QUERY_THROW
);
3521 uno::Reference
< report::XReportComponent
> xShapePropTextField(pObjs
[1]->getUnoShape(),uno::UNO_QUERY_THROW
);
3522 if ( !sLabel
.isEmpty() )
3523 xShapePropTextField
->setName(sLabel
);
3524 awt::Point aPosLabel
= xShapePropLabel
->getPosition();
3525 awt::Point aPosTextField
= xShapePropTextField
->getPosition();
3526 aPosTextField
.X
= aPosLabel
.X
;
3527 xShapePropTextField
->setPosition(aPosTextField
);
3528 if (bLabelAboveTextField
)
3530 // move the label down near the splitter
3531 const uno::Reference
<report::XSection
> xLabelSection
= pSectionWindow
[1]->getReportSection().getSection();
3532 aPosLabel
.Y
= xLabelSection
->getHeight() - xShapePropLabel
->getHeight();
3536 // move the label up to the splitter
3539 xShapePropLabel
->setPosition(aPosLabel
);
3541 rtl::Reference
<OUnoObject
> pObj
= dynamic_cast<OUnoObject
*>(pControl
[0].get());
3543 uno::Reference
< report::XFixedText
> xShapeProp(pObj
->getUnoShape(),uno::UNO_QUERY_THROW
);
3544 xShapeProp
->setName(xShapeProp
->getName() + sDefaultName
);
3546 for(i
= 0; i
< SAL_N_ELEMENTS(pControl
); ++i
) // insert controls
3548 correctOverlapping(pControl
[i
].get(), pSectionWindow
[1-i
]->getReportSection());
3551 if (!bLabelAboveTextField
)
3553 if ( pSectionViews
[0] == pSectionViews
[1] )
3555 tools::Rectangle aLabel
= getRectangleFromControl(pControl
[0].get());
3556 tools::Rectangle aTextfield
= getRectangleFromControl(pControl
[1].get());
3558 // create a Union of the given Label and Textfield
3559 tools::Rectangle
aLabelAndTextfield( aLabel
);
3560 aLabelAndTextfield
.Union(aTextfield
);
3562 // check if there exists other fields and if yes, move down
3563 bool bOverlapping
= true;
3564 bool bHasToMove
= false;
3565 while ( bOverlapping
)
3567 const SdrObject
* pOverlappedObj
= isOver(aLabelAndTextfield
, *pSectionWindow
[0]->getReportSection().getPage(), *pSectionViews
[0], true, pControl
, 2);
3568 bOverlapping
= pOverlappedObj
!= nullptr;
3571 const tools::Rectangle
& aLogicRect
= pOverlappedObj
->GetLogicRect();
3572 aLabelAndTextfield
.Move(0,aLogicRect
.Top() + aLogicRect
.getOpenHeight() - aLabelAndTextfield
.Top());
3579 // There was a move down, we need to move the Label and the Textfield down
3580 aLabel
.Move(0, aLabelAndTextfield
.Top() - aLabel
.Top());
3581 aTextfield
.Move(0, aLabelAndTextfield
.Top() - aTextfield
.Top());
3583 uno::Reference
< report::XReportComponent
> xLabel(pControl
[0]->getUnoShape(),uno::UNO_QUERY_THROW
);
3584 xLabel
->setPositionY(aLabel
.Top());
3586 uno::Reference
< report::XReportComponent
> xTextfield(pControl
[1]->getUnoShape(),uno::UNO_QUERY_THROW
);
3587 xTextfield
->setPositionY(aTextfield
.Top());
3595 catch(const Exception
&)
3597 DBG_UNHANDLED_EXCEPTION("reportdesign");
3602 OSectionView
* OReportController::getCurrentSectionView() const
3604 OSectionView
* pSectionView
= nullptr;
3605 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
3606 if ( pSectionWindow
)
3607 pSectionView
= &pSectionWindow
->getReportSection().getSectionView();
3608 return pSectionView
;
3611 void OReportController::changeZOrder(sal_Int32 _nId
)
3613 OSectionView
* pSectionView
= getCurrentSectionView();
3614 if ( !pSectionView
)
3619 case SID_FRAME_TO_BOTTOM
:
3620 pSectionView
->PutMarkedToBtm();
3622 case SID_FRAME_TO_TOP
:
3623 pSectionView
->PutMarkedToTop();
3625 case SID_FRAME_DOWN
:
3626 pSectionView
->MovMarkedToBtm();
3629 pSectionView
->MovMarkedToTop();
3632 case SID_OBJECT_HEAVEN
:
3633 pSectionView
->SetMarkedToLayer( RPT_LAYER_FRONT
);
3635 case SID_OBJECT_HELL
:
3636 pSectionView
->SetMarkedToLayer( RPT_LAYER_BACK
);
3641 void OReportController::listen(const bool _bAdd
)
3643 const OUString aProps
[] = { PROPERTY_REPORTHEADERON
,PROPERTY_REPORTFOOTERON
3644 ,PROPERTY_PAGEHEADERON
,PROPERTY_PAGEFOOTERON
3645 ,PROPERTY_COMMAND
, PROPERTY_COMMANDTYPE
,PROPERTY_CAPTION
3648 void (SAL_CALL
XPropertySet::*pPropertyListenerAction
)( const OUString
&, const uno::Reference
< XPropertyChangeListener
>& ) =
3649 _bAdd
? &XPropertySet::addPropertyChangeListener
: &XPropertySet::removePropertyChangeListener
;
3651 for (const auto & aProp
: aProps
)
3652 (m_xReportDefinition
.get()->*pPropertyListenerAction
)( aProp
, static_cast< XPropertyChangeListener
* >( this ) );
3654 OXUndoEnvironment
& rUndoEnv
= m_aReportModel
->GetUndoEnv();
3655 uno::Reference
< XPropertyChangeListener
> xUndo
= &rUndoEnv
;
3656 const uno::Sequence
< beans::Property
> aSeq
= m_xReportDefinition
->getPropertySetInfo()->getProperties();
3657 const OUString
* pPropsBegin
= &aProps
[0];
3658 const OUString
* pPropsEnd
= pPropsBegin
+ SAL_N_ELEMENTS(aProps
) - 3;
3659 for(const beans::Property
& rProp
: aSeq
)
3661 if ( ::std::find(pPropsBegin
,pPropsEnd
,rProp
.Name
) == pPropsEnd
)
3662 (m_xReportDefinition
.get()->*pPropertyListenerAction
)( rProp
.Name
, xUndo
);
3665 // Add Listeners to UndoEnvironment
3666 void (OXUndoEnvironment::*pElementUndoFunction
)( const uno::Reference
< uno::XInterface
>& ) =
3667 _bAdd
? &OXUndoEnvironment::AddElement
: &OXUndoEnvironment::RemoveElement
;
3669 (rUndoEnv
.*pElementUndoFunction
)( m_xReportDefinition
->getStyleFamilies() );
3670 (rUndoEnv
.*pElementUndoFunction
)( m_xReportDefinition
->getFunctions() );
3672 // Add Listeners to ReportControllerObserver
3673 OXReportControllerObserver
& rObserver
= *m_pReportControllerObserver
;
3675 if ( m_xReportDefinition
->getPageHeaderOn() && _bAdd
)
3677 getDesignView()->addSection(m_xReportDefinition
->getPageHeader(),DBPAGEHEADER
);
3678 rObserver
.AddSection(m_xReportDefinition
->getPageHeader());
3680 if ( m_xReportDefinition
->getReportHeaderOn() && _bAdd
)
3682 getDesignView()->addSection(m_xReportDefinition
->getReportHeader(),DBREPORTHEADER
);
3683 rObserver
.AddSection(m_xReportDefinition
->getReportHeader());
3686 uno::Reference
< report::XGroups
> xGroups
= m_xReportDefinition
->getGroups();
3687 const sal_Int32 nCount
= xGroups
->getCount();
3688 _bAdd
? xGroups
->addContainerListener(&rUndoEnv
) : xGroups
->removeContainerListener(&rUndoEnv
);
3689 _bAdd
? xGroups
->addContainerListener(&rObserver
) : xGroups
->removeContainerListener(&rObserver
);
3691 for (sal_Int32 i
=0;i
<nCount
; ++i
)
3693 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
3694 (xGroup
.get()->*pPropertyListenerAction
)( PROPERTY_HEADERON
, static_cast< XPropertyChangeListener
* >( this ) );
3695 (xGroup
.get()->*pPropertyListenerAction
)( PROPERTY_FOOTERON
, static_cast< XPropertyChangeListener
* >( this ) );
3697 (rUndoEnv
.*pElementUndoFunction
)( xGroup
);
3698 (rUndoEnv
.*pElementUndoFunction
)( xGroup
->getFunctions() );
3699 if ( xGroup
->getHeaderOn() && _bAdd
)
3701 getDesignView()->addSection(xGroup
->getHeader(),DBGROUPHEADER
);
3702 rObserver
.AddSection(xGroup
->getHeader());
3708 getDesignView()->addSection(m_xReportDefinition
->getDetail(),DBDETAIL
);
3709 rObserver
.AddSection(m_xReportDefinition
->getDetail());
3711 for (sal_Int32 i
=nCount
;i
> 0 ; --i
)
3713 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
-1),uno::UNO_QUERY
);
3714 if ( xGroup
->getFooterOn() )
3716 getDesignView()->addSection(xGroup
->getFooter(),DBGROUPFOOTER
);
3717 rObserver
.AddSection(xGroup
->getFooter());
3720 if ( m_xReportDefinition
->getReportFooterOn() )
3722 getDesignView()->addSection(m_xReportDefinition
->getReportFooter(),DBREPORTFOOTER
);
3723 rObserver
.AddSection(m_xReportDefinition
->getReportFooter());
3725 if ( m_xReportDefinition
->getPageFooterOn())
3727 getDesignView()->addSection(m_xReportDefinition
->getPageFooter(),DBPAGEFOOTER
);
3728 rObserver
.AddSection(m_xReportDefinition
->getPageFooter());
3731 xGroups
->addContainerListener(static_cast<XContainerListener
*>(this));
3732 m_xReportDefinition
->addModifyListener(static_cast<XModifyListener
*>(this));
3736 rObserver
.RemoveSection(m_xReportDefinition
->getDetail());
3737 xGroups
->removeContainerListener(static_cast<XContainerListener
*>(this));
3738 m_xReportDefinition
->removeModifyListener(static_cast<XModifyListener
*>(this));
3739 m_aReportModel
->detachController();
3743 void OReportController::switchReportSection(const sal_Int16 _nId
)
3745 OSL_ENSURE(_nId
== SID_REPORTHEADER_WITHOUT_UNDO
|| _nId
== SID_REPORTFOOTER_WITHOUT_UNDO
|| _nId
== SID_REPORTHEADERFOOTER
,"Illegal id given!");
3747 if ( !m_xReportDefinition
.is() )
3750 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3751 const bool bSwitchOn
= !m_xReportDefinition
->getReportHeaderOn();
3753 std::unique_ptr
< UndoContext
> pUndoContext
;
3754 if ( SID_REPORTHEADERFOOTER
== _nId
)
3756 const OUString
sUndoAction(RptResId(bSwitchOn
? RID_STR_UNDO_ADD_REPORTHEADERFOOTER
: RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
));
3757 pUndoContext
.reset( new UndoContext( getUndoManager(), sUndoAction
) );
3759 addUndoAction(std::make_unique
<OReportSectionUndo
>(*m_aReportModel
,SID_REPORTHEADER_WITHOUT_UNDO
3760 ,::std::mem_fn(&OReportHelper::getReportHeader
)
3761 ,m_xReportDefinition
3762 ,bSwitchOn
? Inserted
: Removed
3765 addUndoAction(std::make_unique
<OReportSectionUndo
>(*m_aReportModel
,SID_REPORTFOOTER_WITHOUT_UNDO
3766 ,::std::mem_fn(&OReportHelper::getReportFooter
)
3767 ,m_xReportDefinition
3768 ,bSwitchOn
? Inserted
: Removed
3774 case SID_REPORTHEADER_WITHOUT_UNDO
:
3775 m_xReportDefinition
->setReportHeaderOn( bSwitchOn
);
3777 case SID_REPORTFOOTER_WITHOUT_UNDO
:
3778 m_xReportDefinition
->setReportFooterOn( !m_xReportDefinition
->getReportFooterOn() );
3780 case SID_REPORTHEADERFOOTER
:
3781 m_xReportDefinition
->setReportHeaderOn( bSwitchOn
);
3782 m_xReportDefinition
->setReportFooterOn( bSwitchOn
);
3786 if ( SID_REPORTHEADERFOOTER
== _nId
)
3787 pUndoContext
.reset();
3788 getView()->Resize();
3791 void OReportController::switchPageSection(const sal_Int16 _nId
)
3793 OSL_ENSURE(_nId
== SID_PAGEHEADERFOOTER
|| _nId
== SID_PAGEHEADER_WITHOUT_UNDO
|| _nId
== SID_PAGEFOOTER_WITHOUT_UNDO
,"Illegal id given!");
3794 if ( !m_xReportDefinition
.is() )
3797 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3798 const bool bSwitchOn
= !m_xReportDefinition
->getPageHeaderOn();
3800 std::unique_ptr
< UndoContext
> pUndoContext
;
3801 if ( SID_PAGEHEADERFOOTER
== _nId
)
3803 const OUString
sUndoAction(RptResId(bSwitchOn
? RID_STR_UNDO_ADD_REPORTHEADERFOOTER
: RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
));
3804 pUndoContext
.reset( new UndoContext( getUndoManager(), sUndoAction
) );
3806 addUndoAction(std::make_unique
<OReportSectionUndo
>(*m_aReportModel
3807 ,SID_PAGEHEADER_WITHOUT_UNDO
3808 ,::std::mem_fn(&OReportHelper::getPageHeader
)
3809 ,m_xReportDefinition
3810 ,bSwitchOn
? Inserted
: Removed
3813 addUndoAction(std::make_unique
<OReportSectionUndo
>(*m_aReportModel
3814 ,SID_PAGEFOOTER_WITHOUT_UNDO
3815 ,::std::mem_fn(&OReportHelper::getPageFooter
)
3816 ,m_xReportDefinition
3817 ,bSwitchOn
? Inserted
: Removed
3822 case SID_PAGEHEADER_WITHOUT_UNDO
:
3823 m_xReportDefinition
->setPageHeaderOn( bSwitchOn
);
3825 case SID_PAGEFOOTER_WITHOUT_UNDO
:
3826 m_xReportDefinition
->setPageFooterOn( !m_xReportDefinition
->getPageFooterOn() );
3828 case SID_PAGEHEADERFOOTER
:
3829 m_xReportDefinition
->setPageHeaderOn( bSwitchOn
);
3830 m_xReportDefinition
->setPageFooterOn( bSwitchOn
);
3833 if ( SID_PAGEHEADERFOOTER
== _nId
)
3834 pUndoContext
.reset();
3835 getView()->Resize();
3838 void OReportController::modifyGroup(const bool _bAppend
, const Sequence
< PropertyValue
>& _aArgs
)
3840 if ( !m_xReportDefinition
.is() )
3845 const SequenceAsHashMap
aMap( _aArgs
);
3846 uno::Reference
< report::XGroup
> xGroup
= aMap
.getUnpackedValueOrDefault( PROPERTY_GROUP
, uno::Reference
< report::XGroup
>() );
3850 OXUndoEnvironment
& rUndoEnv
= m_aReportModel
->GetUndoEnv();
3851 uno::Reference
< report::XGroups
> xGroups
= m_xReportDefinition
->getGroups();
3854 const sal_Int32 nPos
= aMap
.getUnpackedValueOrDefault( PROPERTY_POSITIONY
, xGroups
->getCount() );
3855 xGroups
->insertByIndex( nPos
, uno::Any( xGroup
) );
3856 rUndoEnv
.AddElement( xGroup
->getFunctions() );
3859 addUndoAction( std::make_unique
<OGroupUndo
>(
3861 _bAppend
? RID_STR_UNDO_APPEND_GROUP
: RID_STR_UNDO_REMOVE_GROUP
,
3862 _bAppend
? Inserted
: Removed
,
3869 rUndoEnv
.RemoveElement( xGroup
->getFunctions() );
3870 const sal_Int32 nPos
= getGroupPosition( xGroup
);
3871 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3872 xGroups
->removeByIndex( nPos
);
3875 catch(const Exception
&)
3877 DBG_UNHANDLED_EXCEPTION("reportdesign");
3882 void OReportController::createGroupSection(const bool _bUndo
,const bool _bHeader
, const Sequence
< PropertyValue
>& _aArgs
)
3884 if ( !m_xReportDefinition
.is() )
3887 const SequenceAsHashMap
aMap(_aArgs
);
3888 const bool bSwitchOn
= aMap
.getUnpackedValueOrDefault(_bHeader
? PROPERTY_HEADERON
: PROPERTY_FOOTERON
, false);
3889 uno::Reference
< report::XGroup
> xGroup
= aMap
.getUnpackedValueOrDefault(PROPERTY_GROUP
,uno::Reference
< report::XGroup
>());
3893 const OXUndoEnvironment::OUndoEnvLock
aLock(m_aReportModel
->GetUndoEnv());
3895 addUndoAction(std::make_unique
<OGroupSectionUndo
>(*m_aReportModel
3896 ,_bHeader
? SID_GROUPHEADER_WITHOUT_UNDO
: SID_GROUPFOOTER_WITHOUT_UNDO
3897 ,_bHeader
? ::std::mem_fn(&OGroupHelper::getHeader
) : ::std::mem_fn(&OGroupHelper::getFooter
)
3899 ,bSwitchOn
? Inserted
: Removed
3901 (bSwitchOn
? RID_STR_UNDO_ADD_GROUP_HEADER
: RID_STR_UNDO_REMOVE_GROUP_HEADER
)
3902 :(bSwitchOn
? RID_STR_UNDO_ADD_GROUP_FOOTER
: RID_STR_UNDO_REMOVE_GROUP_FOOTER
)
3907 xGroup
->setHeaderOn( bSwitchOn
);
3909 xGroup
->setFooterOn( bSwitchOn
);
3912 void OReportController::collapseSection(const bool _bCollapse
)
3914 OSectionWindow
*pSection
= getDesignView()->getMarkedSection();
3917 pSection
->setCollapsed(_bCollapse
);
3921 void OReportController::markSection(const bool _bNext
)
3923 OSectionWindow
*pSection
= getDesignView()->getMarkedSection();
3926 OSectionWindow
*pPrevSection
= getDesignView()->getMarkedSection(_bNext
? POST
: PREVIOUS
);
3927 if ( pPrevSection
!= pSection
&& pPrevSection
)
3928 select(uno::Any(pPrevSection
->getReportSection().getSection()));
3930 select(uno::Any(m_xReportDefinition
));
3934 getDesignView()->markSection(_bNext
? 0 : getDesignView()->getSectionCount() - 1);
3935 pSection
= getDesignView()->getMarkedSection();
3937 select(uno::Any(pSection
->getReportSection().getSection()));
3941 void OReportController::createDefaultControl(const uno::Sequence
< beans::PropertyValue
>& _aArgs
)
3943 uno::Reference
< report::XSection
> xSection
= getDesignView()->getCurrentSection();
3944 if ( !xSection
.is() )
3945 xSection
= m_xReportDefinition
->getDetail();
3947 if ( !xSection
.is() )
3950 const beans::PropertyValue
* pIter
= _aArgs
.getConstArray();
3951 const beans::PropertyValue
* pEnd
= pIter
+ _aArgs
.getLength();
3952 const beans::PropertyValue
* pKeyModifier
= ::std::find_if(pIter
, pEnd
,
3953 [] (const beans::PropertyValue
& x
) -> bool {
3954 return x
.Name
== "KeyModifier";
3956 sal_Int16 nKeyModifier
= 0;
3957 if ( pKeyModifier
== pEnd
|| ((pKeyModifier
->Value
>>= nKeyModifier
) && nKeyModifier
== KEY_MOD1
) )
3959 Sequence
< PropertyValue
> aCreateArgs
;
3960 getDesignView()->unmarkAllObjects();
3961 createControl(aCreateArgs
,xSection
,OUString(),getDesignView()->GetInsertObj());
3966 void OReportController::checkChartEnabled()
3968 if ( m_bChartEnabledAsked
)
3971 m_bChartEnabledAsked
= true;
3975 ::utl::OConfigurationTreeRoot
aConfiguration(
3976 ::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext
, u
"/org.openoffice.Office.ReportDesign"_ustr
) );
3978 bool bChartEnabled
= false;
3979 static constexpr OUString
sPropertyName( u
"UserData/Chart"_ustr
);
3980 if ( aConfiguration
.hasByHierarchicalName(sPropertyName
) )
3981 aConfiguration
.getNodeValue( sPropertyName
) >>= bChartEnabled
;
3982 m_bChartEnabled
= bChartEnabled
;
3984 catch(const Exception
&)
3991 OUString SAL_CALL
OReportController::getTitle()
3993 SolarMutexGuard aSolarGuard
;
3994 ::osl::MutexGuard
aGuard( getMutex() );
3996 uno::Reference
< frame::XTitle
> xTitle(m_xReportDefinition
,uno::UNO_QUERY_THROW
);
3998 return xTitle
->getTitle ();
4001 void OReportController::getPropertyDefaultByHandle( sal_Int32
/*_nHandle*/, Any
& _rDefault
) const
4003 _rDefault
<<= sal_Int16(100);
4006 // comphelper::OPropertyArrayUsageHelper
4007 ::cppu::IPropertyArrayHelper
* OReportController::createArrayHelper( ) const
4009 Sequence
< Property
> aProps
;
4010 describeProperties(aProps
);
4011 return new ::cppu::OPropertyArrayHelper(aProps
);
4015 // cppu::OPropertySetHelper
4016 ::cppu::IPropertyArrayHelper
& SAL_CALL
OReportController::getInfoHelper()
4018 return *::comphelper::OPropertyArrayUsageHelper
<OReportController_BASE
>::getArrayHelper();
4021 void SAL_CALL
OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle
,const Any
& _aValue
)
4023 if ( _nHandle
== PROPERTY_ID_ZOOMVALUE
)
4025 _aValue
>>= m_nZoomValue
;
4026 impl_zoom_nothrow();
4029 void SAL_CALL
OReportController::setMode( const OUString
& aMode
)
4031 ::osl::MutexGuard
aGuard( getMutex() );
4034 OUString SAL_CALL
OReportController::getMode( )
4036 ::osl::MutexGuard
aGuard( getMutex() );
4039 css::uno::Sequence
< OUString
> SAL_CALL
OReportController::getSupportedModes( )
4041 return uno::Sequence
< OUString
> { u
"remote"_ustr
, u
"normal"_ustr
};
4043 sal_Bool SAL_CALL
OReportController::supportsMode( const OUString
& aMode
)
4045 uno::Sequence
< OUString
> aModes
= getSupportedModes();
4046 return comphelper::findValue(aModes
, aMode
) != -1;
4049 bool OReportController::isUiVisible() const
4051 return m_sMode
!= "remote";
4054 void OReportController::impl_fillState_nothrow(const OUString
& _sProperty
,dbaui::FeatureState
& _rState
) const
4056 _rState
.bEnabled
= isEditable();
4057 if ( !_rState
.bEnabled
)
4060 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
4061 getDesignView()->fillControlModelSelection(aSelection
);
4062 _rState
.bEnabled
= !aSelection
.empty();
4063 if ( !_rState
.bEnabled
)
4067 ::std::vector
< uno::Reference
< uno::XInterface
> >::const_iterator aIter
= aSelection
.begin();
4068 for(; aIter
!= aSelection
.end() && _rState
.bEnabled
;++aIter
)
4070 uno::Reference
< beans::XPropertySet
> xProp(*aIter
,uno::UNO_QUERY
);
4073 uno::Any aTemp2
= xProp
->getPropertyValue(_sProperty
);
4074 if ( aIter
== aSelection
.begin() )
4076 aTemp
= std::move(aTemp2
);
4078 else if ( aTemp
!= aTemp2
)
4081 catch(const beans::UnknownPropertyException
&)
4083 _rState
.bEnabled
= false;
4086 if ( aIter
== aSelection
.end() )
4087 _rState
.aValue
= std::move(aTemp
);
4090 void OReportController::impl_zoom_nothrow()
4092 Fraction
aZoom(m_nZoomValue
,100);
4093 setZoomFactor( aZoom
, *getDesignView() );
4094 getDesignView()->zoom(aZoom
);
4095 InvalidateFeature(SID_ATTR_ZOOM
,Reference
< XStatusListener
>(), true);
4096 InvalidateFeature(SID_ATTR_ZOOMSLIDER
,Reference
< XStatusListener
>(), true);
4099 bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand
,const uno::Reference
< report::XReportControlFormat
>& _xReportControlFormat
)
4102 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
4106 const awt::FontDescriptor aFontDescriptor
= _xReportControlFormat
->getFontDescriptor();
4110 case SID_ATTR_CHAR_WEIGHT
:
4111 bRet
= awt::FontWeight::BOLD
== aFontDescriptor
.Weight
;
4113 case SID_ATTR_CHAR_POSTURE
:
4114 bRet
= awt::FontSlant_ITALIC
== aFontDescriptor
.Slant
;
4116 case SID_ATTR_CHAR_UNDERLINE
:
4117 bRet
= awt::FontUnderline::SINGLE
== aFontDescriptor
.Underline
;
4123 catch(const uno::Exception
&)
4130 bool OReportController::impl_setPropertyAtControls_throw(TranslateId pUndoResId
,const OUString
& _sProperty
,const uno::Any
& _aValue
,const Sequence
< PropertyValue
>& _aArgs
)
4132 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
4133 uno::Reference
< awt::XWindow
> xWindow
;
4134 lcl_getReportControlFormat( _aArgs
, getDesignView(), xWindow
, aSelection
);
4136 const OUString sUndoAction
= RptResId( pUndoResId
);
4137 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
4139 for (const auto& rxInterface
: aSelection
)
4141 const uno::Reference
< beans::XPropertySet
> xControlModel(rxInterface
,uno::UNO_QUERY
);
4142 if ( xControlModel
.is() )
4143 // tdf#117795: some elements may have not some property
4144 // eg class "OFixedLine" doesn't have property "CharFontName"
4145 // so in this case, instead of crashing when selecting all and changing font
4146 // just display a warning
4149 xControlModel
->setPropertyValue(_sProperty
,_aValue
);
4151 catch(const UnknownPropertyException
&)
4153 TOOLS_WARN_EXCEPTION("reportdesign", "");
4157 return !aSelection
.empty();
4160 void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType
,dbaui::FeatureState
& _rState
) const
4162 _rState
.bEnabled
= isEditable();
4163 _rState
.bChecked
= getDesignView()->GetInsertObj() == SdrObjKind::CustomShape
&& getDesignView()->GetInsertObjString().equalsAscii(_pCustomShapeType
);
4167 OSectionWindow
* OReportController::getSectionWindow(const css::uno::Reference
< css::report::XSection
>& _xSection
) const
4169 if ( getDesignView() )
4171 return getDesignView()->getSectionWindow(_xSection
);
4174 // throw NullPointerException?
4178 static ItemInfoPackage
& getItemInfoPackageOpenZoomDlg()
4180 class ItemInfoPackageOpenZoomDlg
: public ItemInfoPackage
4182 typedef std::array
<ItemInfoStatic
, 1> ItemInfoArrayOpenZoomDlg
;
4183 ItemInfoArrayOpenZoomDlg maItemInfos
{{
4184 // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
4185 { SID_ATTR_ZOOM
, new SvxZoomItem
, 0, SFX_ITEMINFOFLAG_NONE
}
4188 virtual const ItemInfoStatic
& getItemInfoStatic(size_t nIndex
) const override
{ return maItemInfos
[nIndex
]; }
4191 virtual size_t size() const override
{ return maItemInfos
.size(); }
4192 virtual const ItemInfo
& getItemInfo(size_t nIndex
, SfxItemPool
& /*rPool*/) override
{ return maItemInfos
[nIndex
]; }
4195 static std::unique_ptr
<ItemInfoPackageOpenZoomDlg
> g_aItemInfoPackageOpenZoomDlg
;
4196 if (!g_aItemInfoPackageOpenZoomDlg
)
4197 g_aItemInfoPackageOpenZoomDlg
.reset(new ItemInfoPackageOpenZoomDlg
);
4198 return *g_aItemInfoPackageOpenZoomDlg
;
4201 void OReportController::openZoomDialog()
4203 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
4204 rtl::Reference
<SfxItemPool
> pPool(new SfxItemPool(u
"ZoomProperties"_ustr
));
4205 pPool
->registerItemInfoPackage(getItemInfoPackageOpenZoomDlg());
4206 pPool
->SetDefaultMetric( MapUnit::Map100thMM
); // ripped, don't understand why
4210 SfxItemSetFixed
<SID_ATTR_ZOOM
,SID_ATTR_ZOOM
> aDescriptor(*pPool
);
4212 SvxZoomItem
aZoomItem( m_eZoomType
, m_nZoomValue
, SID_ATTR_ZOOM
);
4213 aZoomItem
.SetValueSet(SvxZoomEnableFlags::N100
|SvxZoomEnableFlags::WHOLEPAGE
|SvxZoomEnableFlags::PAGEWIDTH
);
4214 aDescriptor
.Put(aZoomItem
);
4216 ScopedVclPtr
<AbstractSvxZoomDialog
> pDlg(pFact
->CreateSvxZoomDialog(nullptr, aDescriptor
));
4217 pDlg
->SetLimits( 20, 400 );
4218 bool bCancel
= ( RET_CANCEL
== pDlg
->Execute() );
4222 const SvxZoomItem
& rZoomItem
= pDlg
->GetOutputItemSet()->Get( SID_ATTR_ZOOM
);
4223 m_eZoomType
= rZoomItem
.GetType();
4224 m_nZoomValue
= rZoomItem
.GetValue();
4225 if ( m_eZoomType
!= SvxZoomType::PERCENT
)
4226 m_nZoomValue
= getDesignView()->getZoomFactor( m_eZoomType
);
4228 impl_zoom_nothrow();
4231 catch(const uno::Exception
&)
4233 DBG_UNHANDLED_EXCEPTION("reportdesign");
4240 void SAL_CALL
OReportController::setVisualAreaSize( ::sal_Int64 _nAspect
, const awt::Size
& _aSize
)
4242 ::osl::MutexGuard
aGuard( getMutex() );
4244 (m_aVisualAreaSize
.Width
!= _aSize
.Width
||
4245 m_aVisualAreaSize
.Height
!= _aSize
.Height
);
4246 m_aVisualAreaSize
= _aSize
;
4248 setModified( true );
4249 m_nAspect
= _nAspect
;
4252 awt::Size SAL_CALL
OReportController::getVisualAreaSize( ::sal_Int64
/*nAspect*/ )
4254 ::osl::MutexGuard
aGuard( getMutex() );
4255 return m_aVisualAreaSize
;
4258 embed::VisualRepresentation SAL_CALL
OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect
)
4260 SolarMutexGuard aSolarGuard
;
4261 ::osl::MutexGuard
aGuard( getMutex() );
4262 embed::VisualRepresentation aResult
;
4263 if ( !m_bInGeneratePreview
)
4265 m_bInGeneratePreview
= true;
4268 if ( !m_xReportEngine
.is() )
4269 m_xReportEngine
.set( report::ReportEngine::create(m_xContext
) );
4270 const sal_Int32 nOldMaxRows
= m_xReportEngine
->getMaxRows();
4271 m_xReportEngine
->setMaxRows(MAX_ROWS_FOR_PREVIEW
);
4272 m_xReportEngine
->setReportDefinition(m_xReportDefinition
);
4273 m_xReportEngine
->setActiveConnection(getConnection());
4276 Reference
<embed::XVisualObject
> xTransfer(m_xReportEngine
->createDocumentModel(),UNO_QUERY
);
4277 if ( xTransfer
.is() )
4279 xTransfer
->setVisualAreaSize(m_nAspect
,m_aVisualAreaSize
);
4280 aResult
= xTransfer
->getPreferredVisualRepresentation( _nAspect
);
4283 catch(const uno::Exception
&)
4286 m_xReportEngine
->setMaxRows(nOldMaxRows
);
4288 catch(const uno::Exception
&)
4291 m_bInGeneratePreview
= false;
4296 ::sal_Int32 SAL_CALL
OReportController::getMapUnit( ::sal_Int64
/*nAspect*/ )
4298 return embed::EmbedMapUnits::ONE_100TH_MM
;
4301 uno::Reference
< container::XNameAccess
> const & OReportController::getColumns() const
4303 if ( !m_xColumns
.is() && m_xReportDefinition
.is() && !m_xReportDefinition
->getCommand().isEmpty() )
4305 m_xColumns
= dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition
->getCommandType(),m_xReportDefinition
->getCommand(),m_xHoldAlive
);
4310 OUString
OReportController::getColumnLabel_throw(const OUString
& i_sColumnName
) const
4313 uno::Reference
< container::XNameAccess
> xColumns
= getColumns();
4314 if ( xColumns
.is() && xColumns
->hasByName(i_sColumnName
) )
4316 uno::Reference
< beans::XPropertySet
> xColumn(xColumns
->getByName(i_sColumnName
),uno::UNO_QUERY_THROW
);
4317 if ( xColumn
->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL
) )
4318 xColumn
->getPropertyValue(PROPERTY_LABEL
) >>= sLabel
;
4324 SfxUndoManager
& OReportController::getUndoManager() const
4326 DBG_TESTSOLARMUTEX();
4327 // this is expected to be called during UI actions, so the SM is assumed to be locked
4329 std::shared_ptr
< OReportModel
> pReportModel( getSdrModel() );
4330 ENSURE_OR_THROW( !!pReportModel
, "no access to our model" );
4332 SfxUndoManager
* pUndoManager( pReportModel
->GetSdrUndoManager() );
4333 ENSURE_OR_THROW( pUndoManager
!= nullptr, "no access to our model's UndoManager" );
4335 return *pUndoManager
;
4339 void OReportController::clearUndoManager() const
4341 getUndoManager().Clear();
4345 void OReportController::addUndoAction( std::unique_ptr
<SfxUndoAction
> i_pAction
)
4347 getUndoManager().AddUndoAction( std::move(i_pAction
) );
4349 InvalidateFeature( SID_UNDO
);
4350 InvalidateFeature( SID_REDO
);
4353 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
4354 reportdesign_OReportController_get_implementation(
4355 css::uno::XComponentContext
* context
, css::uno::Sequence
<css::uno::Any
> const&)
4357 return cppu::acquire(new OReportController(context
));
4361 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */