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 <tools/diagnose_ex.h>
30 #include "rptui_slotid.hrc"
31 #include "reportformula.hxx"
33 #include <comphelper/documentconstants.hxx>
34 #include <unotools/mediadescriptor.hxx>
35 #include <comphelper/processfactory.hxx>
36 #include <comphelper/property.hxx>
37 #include <comphelper/sequenceashashmap.hxx>
38 #include <comphelper/types.hxx>
40 #include <connectivity/dbtools.hxx>
41 #include <com/sun/star/view/PaperFormat.hpp>
42 #include <com/sun/star/style/GraphicLocation.hpp>
43 #include <com/sun/star/style/XStyle.hpp>
44 #include <com/sun/star/style/PageStyleLayout.hpp>
45 #include <com/sun/star/style/ParagraphAdjust.hpp>
46 #include <com/sun/star/util/NumberFormatter.hpp>
47 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
48 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
49 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
50 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
51 #include <com/sun/star/frame/FrameSearchFlag.hpp>
52 #include <com/sun/star/datatransfer/XTransferable.hpp>
53 #include <com/sun/star/container/XChild.hpp>
54 #include <com/sun/star/container/XNameContainer.hpp>
55 #include <com/sun/star/report/XImageControl.hpp>
56 #include <com/sun/star/report/XFixedLine.hpp>
57 #include <com/sun/star/report/Function.hpp>
58 #include <com/sun/star/report/XShape.hpp>
59 #include <com/sun/star/awt/FontDescriptor.hpp>
60 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
61 #include <com/sun/star/sdb/XParametersSupplier.hpp>
62 #include <com/sun/star/sdb/CommandType.hpp>
63 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
64 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
65 #include <com/sun/star/embed/ElementModes.hpp>
66 #include <com/sun/star/embed/EmbedMapUnits.hpp>
67 #include <comphelper/streamsection.hxx>
68 #include <com/sun/star/awt/FontWeight.hpp>
69 #include <com/sun/star/awt/FontUnderline.hpp>
70 #include <com/sun/star/awt/TextAlign.hpp>
71 #include <com/sun/star/awt/FontSlant.hpp>
72 #include <com/sun/star/frame/Desktop.hpp>
73 #include <com/sun/star/frame/status/FontHeight.hpp>
74 #include <com/sun/star/report/ReportEngine.hpp>
75 #include <com/sun/star/report/XFormattedField.hpp>
76 #include <com/sun/star/sdb/SQLContext.hpp>
77 #include <com/sun/star/sdbc/SQLWarning.hpp>
78 #include <com/sun/star/beans/PropertyAttribute.hpp>
79 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
81 #include <vcl/svapp.hxx>
82 #include <vcl/msgbox.hxx>
83 #include <vcl/waitobj.hxx>
85 #include <svx/fmview.hxx>
86 #include <editeng/paperinf.hxx>
87 #include <editeng/memberids.hrc>
88 #include <svx/svxids.hrc>
89 #include <svx/svdobj.hxx>
90 #include <svx/dataaccessdescriptor.hxx>
91 #include <svx/xfillit.hxx>
92 #include <svx/xflbckit.hxx>
93 #include <svx/xflbmpit.hxx>
94 #include <svx/xflbmsli.hxx>
95 #include <svx/xflbmsxy.hxx>
96 #include <svx/xflbmtit.hxx>
97 #include <svx/xflboxy.hxx>
98 #include <svx/xflbstit.hxx>
99 #include <svx/xflbtoxy.hxx>
100 #include <svx/xfltrit.hxx>
101 #include <svx/xgrscit.hxx>
102 #include <editeng/svxenum.hxx>
103 #include <svx/pageitem.hxx>
104 #include <editeng/lrspitem.hxx>
105 #include <editeng/ulspitem.hxx>
106 #include <editeng/sizeitem.hxx>
107 #include <sfx2/zoomitem.hxx>
108 #include <svx/zoomslideritem.hxx>
109 #include <editeng/brushitem.hxx>
110 #include <svx/flagsdef.hxx>
111 #include <svx/svdpagv.hxx>
112 #include <svx/svxdlg.hxx>
113 #include <svx/zoom_def.hxx>
114 #include <svx/dialogs.hrc>
116 #include "DesignView.hxx"
117 #include "ModuleHelper.hxx"
118 #include "RptObject.hxx"
119 #include "RptUndo.hxx"
120 #include "uistrings.hrc"
121 #include "RptDef.hxx"
122 #include "ReportSection.hxx"
123 #include "SectionView.hxx"
124 #include "UndoActions.hxx"
125 #include "dlgpage.hxx"
126 #include "RptResId.hrc"
128 #include <svl/itempool.hxx>
129 #include <svl/itemset.hxx>
130 #include <svl/aeitem.hxx>
131 #include <svtools/cliplistener.hxx>
132 #include <unotools/syslocale.hxx>
133 #include <unotools/viewoptions.hxx>
135 #include <osl/mutex.hxx>
136 #include "PropertyForward.hxx"
137 #include "SectionWindow.hxx"
139 #include <toolkit/helper/convert.hxx>
140 #include "GroupsSorting.hxx"
141 #include "PageNumber.hxx"
142 #include "UndoEnv.hxx"
144 #include <boost/mem_fn.hpp>
145 #include <boost/bind.hpp>
146 #include <boost/utility.hpp>
147 #include <boost/scoped_ptr.hpp>
149 #include <cppuhelper/exc_hlp.hxx>
150 #include <unotools/confignode.hxx>
151 #include <helpids.hrc>
153 #include <ReportControllerObserver.hxx>
155 #define MAX_ROWS_FOR_PREVIEW 20
157 #define RPTUI_ID_LRSPACE XATTR_FILL_FIRST - 8
158 #define RPTUI_ID_ULSPACE XATTR_FILL_FIRST - 7
159 #define RPTUI_ID_PAGE XATTR_FILL_FIRST - 6
160 #define RPTUI_ID_SIZE XATTR_FILL_FIRST - 5
161 #define RPTUI_ID_PAGE_MODE XATTR_FILL_FIRST - 4
162 #define RPTUI_ID_START XATTR_FILL_FIRST - 3
163 #define RPTUI_ID_END XATTR_FILL_FIRST - 2
164 #define RPTUI_ID_BRUSH XATTR_FILL_FIRST - 1
165 #define RPTUI_ID_METRIC XATTR_FILL_LAST + 1
167 using namespace ::com::sun::star
;
170 using namespace beans
;
171 using namespace frame
;
172 using namespace util
;
173 using namespace lang
;
174 using namespace container
;
175 using namespace sdbcx
;
176 using namespace sdbc
;
179 using namespace ui::dialogs
;
180 using namespace ::dbtools
;
181 using namespace ::rptui
;
182 using namespace ::dbaui
;
183 using namespace ::comphelper
;
184 using namespace ::cppu
;
189 // comparing two PropertyValue instances
190 struct PropertyValueCompare
: public ::std::binary_function
< beans::PropertyValue
, OUString
, bool >
192 bool operator() (const beans::PropertyValue
& x
, const OUString
& y
) const
194 return x
.Name
.equals(y
);
198 void lcl_setFontWPU_nothrow(const uno::Reference
< report::XReportControlFormat
>& _xReportControlFormat
,const sal_Int32 _nId
)
200 if ( _xReportControlFormat
.is() )
204 awt::FontDescriptor aFontDescriptor
= _xReportControlFormat
->getFontDescriptor();
207 case SID_ATTR_CHAR_WEIGHT
:
208 aFontDescriptor
.Weight
= (awt::FontWeight::NORMAL
+ awt::FontWeight::BOLD
) - aFontDescriptor
.Weight
;
210 case SID_ATTR_CHAR_POSTURE
:
211 aFontDescriptor
.Slant
= static_cast<awt::FontSlant
>(static_cast<sal_Int16
>(awt::FontSlant_ITALIC
) - static_cast<sal_Int16
>(aFontDescriptor
.Slant
));
213 case SID_ATTR_CHAR_UNDERLINE
:
214 aFontDescriptor
.Underline
= awt::FontUnderline::SINGLE
- aFontDescriptor
.Underline
;
217 OSL_FAIL("Illegal value in default!");
221 _xReportControlFormat
->setFontDescriptor(aFontDescriptor
);
223 catch(const beans::UnknownPropertyException
&)
231 static void lcl_getReportControlFormat(const Sequence
< PropertyValue
>& aArgs
,
233 uno::Reference
< awt::XWindow
>& _xWindow
,
234 ::std::vector
< uno::Reference
< uno::XInterface
> >& _rControlsFormats
)
236 uno::Reference
< report::XReportControlFormat
> xReportControlFormat
;
237 if ( aArgs
.getLength() )
239 SequenceAsHashMap
aMap(aArgs
);
240 xReportControlFormat
= aMap
.getUnpackedValueOrDefault(REPORTCONTROLFORMAT
,uno::Reference
< report::XReportControlFormat
>());
241 _xWindow
= aMap
.getUnpackedValueOrDefault(CURRENT_WINDOW
,uno::Reference
< awt::XWindow
>());
244 if ( !xReportControlFormat
.is() )
246 _pView
->fillControlModelSelection(_rControlsFormats
);
250 uno::Reference
<uno::XInterface
> xInterface(xReportControlFormat
);
251 _rControlsFormats
.push_back(xInterface
);
254 if ( !_xWindow
.is() )
255 _xWindow
= VCLUnoHelper::GetInterface(_pView
);
258 OUString SAL_CALL
OReportController::getImplementationName() throw( RuntimeException
, std::exception
)
260 return getImplementationName_Static();
264 OUString
OReportController::getImplementationName_Static() throw( RuntimeException
)
266 return OUString("com.sun.star.report.comp.ReportDesign");
269 Sequence
< OUString
> OReportController::getSupportedServiceNames_Static() throw( RuntimeException
)
271 Sequence
< OUString
> aSupported(1);
272 aSupported
[0] = "com.sun.star.sdb.ReportDesign";
276 Sequence
< OUString
> SAL_CALL
OReportController::getSupportedServiceNames() throw(RuntimeException
, std::exception
)
278 return getSupportedServiceNames_Static();
281 Reference
< XInterface
> OReportController::create(Reference
< XComponentContext
> const & xContext
)
283 return *(new OReportController(xContext
));
286 #define PROPERTY_ID_ZOOMVALUE 1
289 OReportController::OReportController(Reference
< XComponentContext
> const & xContext
)
290 :OReportController_BASE(xContext
)
291 ,OPropertyStateContainer(OGenericUnoController_Base::rBHelper
)
292 ,m_aSelectionListeners( getMutex() )
293 ,m_pClipbordNotifier(NULL
)
294 ,m_pGroupsFloater(NULL
)
298 ,m_nSelectionCount(0)
301 ,m_eZoomType(SvxZoomType::PERCENT
)
303 ,m_bGridVisible(true)
305 ,m_bShowProperties(true)
306 ,m_bGroupFloaterWasVisible(false)
307 ,m_bHelplinesMove(true)
308 ,m_bChartEnabled(false)
309 ,m_bChartEnabledAsked(false)
310 ,m_bInGeneratePreview(false)
313 m_pReportControllerObserver
= new OXReportControllerObserver(*this);
314 m_pReportControllerObserver
->acquire();
315 registerProperty(OUString("ZoomValue"), PROPERTY_ID_ZOOMVALUE
,
316 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::TRANSIENT
,
317 &m_nZoomValue
, ::cppu::UnoType
<sal_Int16
>::get());
321 OReportController::~OReportController()
325 IMPLEMENT_FORWARD_XTYPEPROVIDER2(OReportController
,OReportController_BASE
,OReportController_Listener
)
326 IMPLEMENT_FORWARD_XINTERFACE2(OReportController
,OReportController_BASE
,OReportController_Listener
)
328 void OReportController::disposing()
331 if ( m_pClipbordNotifier
)
333 m_pClipbordNotifier
->ClearCallbackLink();
334 m_pClipbordNotifier
->AddRemoveListener( getView(), false );
335 m_pClipbordNotifier
->release();
336 m_pClipbordNotifier
= NULL
;
338 if ( m_pGroupsFloater
)
340 SvtViewOptions
aDlgOpt(E_WINDOW
, OStringToOUString(m_pGroupsFloater
->GetHelpId(), RTL_TEXTENCODING_UTF8
));
341 aDlgOpt
.SetWindowState(OStringToOUString(m_pGroupsFloater
->GetWindowState(WINDOWSTATE_MASK_ALL
), RTL_TEXTENCODING_ASCII_US
));
342 m_pGroupsFloater
.disposeAndClear();
347 m_xHoldAlive
.clear();
349 ::comphelper::disposeComponent( m_xRowSet
);
350 ::comphelper::disposeComponent( m_xRowSetMediator
);
351 ::comphelper::disposeComponent( m_xFormatter
);
353 catch(const uno::Exception
&)
355 OSL_FAIL("Exception caught while disposing row sets.");
358 m_xRowSetMediator
.clear();
360 if ( m_xReportDefinition
.is() )
364 OSectionWindow
* pSectionWindow
= NULL
;
365 if ( getDesignView() )
366 pSectionWindow
= getDesignView()->getMarkedSection();
367 if ( pSectionWindow
)
368 pSectionWindow
->getReportSection().deactivateOle();
370 if ( m_aReportModel
)
372 m_pReportControllerObserver
->Clear();
373 m_pReportControllerObserver
->release();
375 catch(const uno::Exception
&)
377 DBG_UNHANDLED_EXCEPTION();
382 EventObject
aDisposingEvent( *this );
383 m_aSelectionListeners
.disposeAndClear( aDisposingEvent
);
386 OReportController_BASE::disposing();
391 m_xReportDefinition
.clear();
392 m_aReportModel
.reset();
393 m_xFrameLoader
.clear();
394 m_xReportEngine
.clear();
396 catch(const uno::Exception
&)
399 if ( getDesignView() )
400 EndListening( *getDesignView() );
404 FeatureState
OReportController::GetState(sal_uInt16 _nId
) const
406 FeatureState aReturn
;
407 // (disabled automatically)
408 aReturn
.bEnabled
= false;
415 case SID_RPT_TEXTDOCUMENT
:
416 aReturn
.bEnabled
= isEditable();
417 aReturn
.bChecked
= (m_xReportDefinition
.is() && m_xReportDefinition
->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII
);
419 case SID_RPT_SPREADSHEET
:
420 aReturn
.bEnabled
= isEditable();
421 aReturn
.bChecked
= (m_xReportDefinition
.is() && m_xReportDefinition
->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII
);
423 case SID_REPORTHEADER_WITHOUT_UNDO
:
424 case SID_REPORTFOOTER_WITHOUT_UNDO
:
425 case SID_REPORTHEADERFOOTER
:
427 aReturn
.bEnabled
= isEditable();
428 OUString sText
= ModuleRes((m_xReportDefinition
.is() && m_xReportDefinition
->getReportHeaderOn()) ? RID_STR_REPORTHEADERFOOTER_DELETE
: RID_STR_REPORTHEADERFOOTER_INSERT
);
429 aReturn
.sTitle
= sText
;
432 case SID_PAGEHEADER_WITHOUT_UNDO
:
433 case SID_PAGEFOOTER_WITHOUT_UNDO
:
434 case SID_PAGEHEADERFOOTER
:
436 aReturn
.bEnabled
= isEditable();
437 OUString sText
= ModuleRes((m_xReportDefinition
.is() && m_xReportDefinition
->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE
: RID_STR_PAGEHEADERFOOTER_INSERT
);
438 aReturn
.sTitle
= sText
;
441 case SID_GROUP_APPEND
:
442 case SID_GROUP_REMOVE
:
443 case SID_GROUPHEADER_WITHOUT_UNDO
:
444 case SID_GROUPHEADER
:
445 case SID_GROUPFOOTER_WITHOUT_UNDO
:
446 case SID_GROUPFOOTER
:
447 aReturn
.bEnabled
= isEditable();
449 case SID_ADD_CONTROL_PAIR
:
450 aReturn
.bEnabled
= isEditable();
455 size_t ( SfxUndoManager::*retrieveCount
)( bool const ) const =
456 ( _nId
== SID_UNDO
) ? &SfxUndoManager::GetUndoActionCount
: &SfxUndoManager::GetRedoActionCount
;
458 SfxUndoManager
& rUndoManager( getUndoManager() );
459 aReturn
.bEnabled
= ( rUndoManager
.*retrieveCount
)( ::svl::IUndoManager::TopLevel
) > 0;
460 if ( aReturn
.bEnabled
)
462 // TODO: add "Undo/Redo: prefix"
463 OUString ( SfxUndoManager::*retrieveComment
)( size_t, bool const ) const =
464 ( _nId
== SID_UNDO
) ? &SfxUndoManager::GetUndoActionComment
: &SfxUndoManager::GetRedoActionComment
;
465 aReturn
.sTitle
= (rUndoManager
.*retrieveComment
)( 0, ::svl::IUndoManager::TopLevel
);
469 case SID_OBJECT_RESIZING
:
470 case SID_OBJECT_SMALLESTWIDTH
:
471 case SID_OBJECT_SMALLESTHEIGHT
:
472 case SID_OBJECT_GREATESTWIDTH
:
473 case SID_OBJECT_GREATESTHEIGHT
:
474 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
475 if ( aReturn
.bEnabled
)
476 aReturn
.bEnabled
= m_nSelectionCount
> 1;
479 case SID_DISTRIBUTION
:
480 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
481 if ( aReturn
.bEnabled
)
483 OSectionView
* pSectionView
= getCurrentSectionView();
484 aReturn
.bEnabled
= pSectionView
&& pSectionView
->GetMarkedObjectCount() > 2;
487 case SID_ARRANGEMENU
:
490 case SID_FRAME_TO_TOP
:
491 case SID_FRAME_TO_BOTTOM
:
492 case SID_OBJECT_HEAVEN
:
493 case SID_OBJECT_HELL
:
494 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
495 if ( aReturn
.bEnabled
)
497 OSectionView
* pSectionView
= getCurrentSectionView();
498 aReturn
.bEnabled
= pSectionView
&& pSectionView
->OnlyShapesMarked();
499 if ( aReturn
.bEnabled
)
501 if ( SID_OBJECT_HEAVEN
== _nId
)
502 aReturn
.bEnabled
= pSectionView
->GetLayerIdOfMarkedObjects() != RPT_LAYER_FRONT
;
503 else if ( SID_OBJECT_HELL
== _nId
)
504 aReturn
.bEnabled
= pSectionView
->GetLayerIdOfMarkedObjects() != RPT_LAYER_BACK
;
509 case SID_SECTION_SHRINK
:
510 case SID_SECTION_SHRINK_TOP
:
511 case SID_SECTION_SHRINK_BOTTOM
:
513 sal_Int32 nCount
= 0;
514 uno::Reference
<report::XSection
> xSection
= getDesignView()->getCurrentSection();
517 nCount
= xSection
->getCount();
519 aReturn
.bEnabled
= isEditable() && nCount
> 0;
522 case SID_OBJECT_ALIGN
:
523 case SID_OBJECT_ALIGN_LEFT
:
524 case SID_OBJECT_ALIGN_CENTER
:
525 case SID_OBJECT_ALIGN_RIGHT
:
526 case SID_OBJECT_ALIGN_UP
:
527 case SID_OBJECT_ALIGN_MIDDLE
:
528 case SID_OBJECT_ALIGN_DOWN
:
529 case SID_SECTION_ALIGN
:
530 case SID_SECTION_ALIGN_LEFT
:
531 case SID_SECTION_ALIGN_CENTER
:
532 case SID_SECTION_ALIGN_RIGHT
:
533 case SID_SECTION_ALIGN_UP
:
534 case SID_SECTION_ALIGN_MIDDLE
:
535 case SID_SECTION_ALIGN_DOWN
:
536 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection();
539 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId
);
542 aReturn
.bEnabled
= getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId
);
545 aReturn
.bEnabled
= isEditable() && !getDesignView()->isHandleEvent(_nId
) && getDesignView()->IsPasteAllowed();
548 aReturn
.bEnabled
= !getDesignView()->isHandleEvent(_nId
);
550 case SID_SELECTALL_IN_SECTION
:
551 aReturn
.bEnabled
= !getDesignView()->isHandleEvent(_nId
);
552 if ( aReturn
.bEnabled
)
553 aReturn
.bEnabled
= getCurrentSectionView() != NULL
;
556 aReturn
.bEnabled
= getDesignView()->GetMode() == RPTUI_INSERT
;
558 case SID_TERMINATE_INPLACEACTIVATION
:
559 aReturn
.bEnabled
= true;
561 case SID_SELECT_ALL_EDITS
:
562 case SID_SELECT_ALL_LABELS
:
563 aReturn
.bEnabled
= true;
565 case SID_RPT_NEW_FUNCTION
:
566 aReturn
.bEnabled
= isEditable();
568 case SID_COLLAPSE_SECTION
:
569 case SID_EXPAND_SECTION
:
572 aReturn
.bEnabled
= isEditable() && !getDesignView()->isHandleEvent(_nId
);
575 case SID_SELECT_REPORT
:
576 aReturn
.bEnabled
= true;
578 case SID_EXECUTE_REPORT
:
579 aReturn
.bEnabled
= isConnected() && m_xReportDefinition
.is();
582 aReturn
.bEnabled
= isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId
);
583 if ( aReturn
.bEnabled
)
585 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
586 if ( pSectionWindow
)
587 aReturn
.bEnabled
= !pSectionWindow
->getReportSection().isUiActive();
590 OUString sText
= ModuleRes(RID_STR_DELETE
);
591 aReturn
.sTitle
= sText
;
594 case SID_GRID_VISIBLE
:
595 aReturn
.bEnabled
= isEditable();
596 aReturn
.bChecked
= m_bGridVisible
;
599 aReturn
.bEnabled
= isEditable();
600 aReturn
.bChecked
= m_bGridUse
;
602 case SID_HELPLINES_MOVE
:
603 aReturn
.bEnabled
= isEditable();
604 aReturn
.bChecked
= m_bHelplinesMove
;
607 aReturn
.bEnabled
= isEditable();
608 aReturn
.bChecked
= m_bShowRuler
;
610 case SID_OBJECT_SELECT
:
611 aReturn
.bEnabled
= true;
612 aReturn
.bChecked
= getDesignView()->GetMode() == RPTUI_SELECT
;
614 case SID_INSERT_DIAGRAM
:
615 aReturn
.bEnabled
= isEditable();
616 aReturn
.bInvisible
= optional
< bool >(!m_bChartEnabled
);
617 aReturn
.bChecked
= getDesignView()->GetInsertObj() == OBJ_OLE2
;
619 case SID_FM_FIXEDTEXT
:
620 aReturn
.bEnabled
= isEditable();
621 aReturn
.bChecked
= getDesignView()->GetInsertObj() == OBJ_DLG_FIXEDTEXT
;
623 case SID_INSERT_HFIXEDLINE
:
624 aReturn
.bEnabled
= isEditable();
625 aReturn
.bChecked
= getDesignView()->GetInsertObj() == OBJ_DLG_HFIXEDLINE
;
627 case SID_INSERT_VFIXEDLINE
:
628 aReturn
.bEnabled
= isEditable();
629 aReturn
.bChecked
= getDesignView()->GetInsertObj() == OBJ_DLG_VFIXEDLINE
;
632 aReturn
.bEnabled
= isEditable();
633 aReturn
.bChecked
= getDesignView()->GetInsertObj() == OBJ_DLG_FORMATTEDFIELD
;
635 case SID_FM_IMAGECONTROL
:
636 aReturn
.bEnabled
= isEditable();
637 aReturn
.bChecked
= getDesignView()->GetInsertObj() == OBJ_DLG_IMAGECONTROL
;
639 case SID_DRAWTBX_CS_BASIC
:
640 case SID_DRAWTBX_CS_BASIC1
:
641 case SID_DRAWTBX_CS_BASIC2
:
642 case SID_DRAWTBX_CS_BASIC3
:
643 case SID_DRAWTBX_CS_BASIC4
:
644 case SID_DRAWTBX_CS_BASIC5
:
645 case SID_DRAWTBX_CS_BASIC6
:
646 case SID_DRAWTBX_CS_BASIC7
:
647 case SID_DRAWTBX_CS_BASIC8
:
648 case SID_DRAWTBX_CS_BASIC9
:
649 case SID_DRAWTBX_CS_BASIC10
:
650 case SID_DRAWTBX_CS_BASIC11
:
651 case SID_DRAWTBX_CS_BASIC12
:
652 case SID_DRAWTBX_CS_BASIC13
:
653 case SID_DRAWTBX_CS_BASIC14
:
654 case SID_DRAWTBX_CS_BASIC15
:
655 case SID_DRAWTBX_CS_BASIC16
:
656 case SID_DRAWTBX_CS_BASIC17
:
657 case SID_DRAWTBX_CS_BASIC18
:
658 case SID_DRAWTBX_CS_BASIC19
:
659 case SID_DRAWTBX_CS_BASIC20
:
660 case SID_DRAWTBX_CS_BASIC21
:
661 case SID_DRAWTBX_CS_BASIC22
:
662 impl_fillCustomShapeState_nothrow("diamond",aReturn
);
664 case SID_DRAWTBX_CS_SYMBOL
:
665 case SID_DRAWTBX_CS_SYMBOL1
:
666 case SID_DRAWTBX_CS_SYMBOL2
:
667 case SID_DRAWTBX_CS_SYMBOL3
:
668 case SID_DRAWTBX_CS_SYMBOL4
:
669 case SID_DRAWTBX_CS_SYMBOL5
:
670 case SID_DRAWTBX_CS_SYMBOL6
:
671 case SID_DRAWTBX_CS_SYMBOL7
:
672 case SID_DRAWTBX_CS_SYMBOL8
:
673 case SID_DRAWTBX_CS_SYMBOL9
:
674 case SID_DRAWTBX_CS_SYMBOL10
:
675 case SID_DRAWTBX_CS_SYMBOL11
:
676 case SID_DRAWTBX_CS_SYMBOL12
:
677 case SID_DRAWTBX_CS_SYMBOL13
:
678 case SID_DRAWTBX_CS_SYMBOL14
:
679 case SID_DRAWTBX_CS_SYMBOL15
:
680 case SID_DRAWTBX_CS_SYMBOL16
:
681 case SID_DRAWTBX_CS_SYMBOL17
:
682 case SID_DRAWTBX_CS_SYMBOL18
:
683 impl_fillCustomShapeState_nothrow("smiley",aReturn
);
685 case SID_DRAWTBX_CS_ARROW
:
686 case SID_DRAWTBX_CS_ARROW1
:
687 case SID_DRAWTBX_CS_ARROW2
:
688 case SID_DRAWTBX_CS_ARROW3
:
689 case SID_DRAWTBX_CS_ARROW4
:
690 case SID_DRAWTBX_CS_ARROW5
:
691 case SID_DRAWTBX_CS_ARROW6
:
692 case SID_DRAWTBX_CS_ARROW7
:
693 case SID_DRAWTBX_CS_ARROW8
:
694 case SID_DRAWTBX_CS_ARROW9
:
695 case SID_DRAWTBX_CS_ARROW10
:
696 case SID_DRAWTBX_CS_ARROW11
:
697 case SID_DRAWTBX_CS_ARROW12
:
698 case SID_DRAWTBX_CS_ARROW13
:
699 case SID_DRAWTBX_CS_ARROW14
:
700 case SID_DRAWTBX_CS_ARROW15
:
701 case SID_DRAWTBX_CS_ARROW16
:
702 case SID_DRAWTBX_CS_ARROW17
:
703 case SID_DRAWTBX_CS_ARROW18
:
704 case SID_DRAWTBX_CS_ARROW19
:
705 case SID_DRAWTBX_CS_ARROW20
:
706 case SID_DRAWTBX_CS_ARROW21
:
707 case SID_DRAWTBX_CS_ARROW22
:
708 case SID_DRAWTBX_CS_ARROW23
:
709 case SID_DRAWTBX_CS_ARROW24
:
710 case SID_DRAWTBX_CS_ARROW25
:
711 case SID_DRAWTBX_CS_ARROW26
:
712 impl_fillCustomShapeState_nothrow("left-right-arrow",aReturn
);
714 case SID_DRAWTBX_CS_STAR
:
715 case SID_DRAWTBX_CS_STAR1
:
716 case SID_DRAWTBX_CS_STAR2
:
717 case SID_DRAWTBX_CS_STAR3
:
718 case SID_DRAWTBX_CS_STAR4
:
719 case SID_DRAWTBX_CS_STAR5
:
720 case SID_DRAWTBX_CS_STAR6
:
721 case SID_DRAWTBX_CS_STAR7
:
722 case SID_DRAWTBX_CS_STAR8
:
723 case SID_DRAWTBX_CS_STAR9
:
724 case SID_DRAWTBX_CS_STAR10
:
725 case SID_DRAWTBX_CS_STAR11
:
726 case SID_DRAWTBX_CS_STAR12
:
727 impl_fillCustomShapeState_nothrow("star5",aReturn
);
729 case SID_DRAWTBX_CS_FLOWCHART
:
730 case SID_DRAWTBX_CS_FLOWCHART1
:
731 case SID_DRAWTBX_CS_FLOWCHART2
:
732 case SID_DRAWTBX_CS_FLOWCHART3
:
733 case SID_DRAWTBX_CS_FLOWCHART4
:
734 case SID_DRAWTBX_CS_FLOWCHART5
:
735 case SID_DRAWTBX_CS_FLOWCHART6
:
736 case SID_DRAWTBX_CS_FLOWCHART7
:
737 case SID_DRAWTBX_CS_FLOWCHART8
:
738 case SID_DRAWTBX_CS_FLOWCHART9
:
739 case SID_DRAWTBX_CS_FLOWCHART10
:
740 case SID_DRAWTBX_CS_FLOWCHART11
:
741 case SID_DRAWTBX_CS_FLOWCHART12
:
742 case SID_DRAWTBX_CS_FLOWCHART13
:
743 case SID_DRAWTBX_CS_FLOWCHART14
:
744 case SID_DRAWTBX_CS_FLOWCHART15
:
745 case SID_DRAWTBX_CS_FLOWCHART16
:
746 case SID_DRAWTBX_CS_FLOWCHART17
:
747 case SID_DRAWTBX_CS_FLOWCHART18
:
748 case SID_DRAWTBX_CS_FLOWCHART19
:
749 case SID_DRAWTBX_CS_FLOWCHART20
:
750 case SID_DRAWTBX_CS_FLOWCHART21
:
751 case SID_DRAWTBX_CS_FLOWCHART22
:
752 case SID_DRAWTBX_CS_FLOWCHART23
:
753 case SID_DRAWTBX_CS_FLOWCHART24
:
754 case SID_DRAWTBX_CS_FLOWCHART25
:
755 case SID_DRAWTBX_CS_FLOWCHART26
:
756 case SID_DRAWTBX_CS_FLOWCHART27
:
757 case SID_DRAWTBX_CS_FLOWCHART28
:
758 impl_fillCustomShapeState_nothrow("flowchart-internal-storage",aReturn
);
760 case SID_DRAWTBX_CS_CALLOUT
:
761 case SID_DRAWTBX_CS_CALLOUT1
:
762 case SID_DRAWTBX_CS_CALLOUT2
:
763 case SID_DRAWTBX_CS_CALLOUT3
:
764 case SID_DRAWTBX_CS_CALLOUT4
:
765 case SID_DRAWTBX_CS_CALLOUT5
:
766 case SID_DRAWTBX_CS_CALLOUT6
:
767 case SID_DRAWTBX_CS_CALLOUT7
:
768 impl_fillCustomShapeState_nothrow("round-rectangular-callout",aReturn
);
770 case SID_RPT_SHOWREPORTEXPLORER
:
771 aReturn
.bEnabled
= m_xReportDefinition
.is();
772 aReturn
.bChecked
= getDesignView() && getDesignView()->isReportExplorerVisible();
774 case SID_FM_ADD_FIELD
:
775 aReturn
.bEnabled
= isConnected() && isEditable() && m_xReportDefinition
.is()
776 && !m_xReportDefinition
->getCommand().isEmpty();
777 aReturn
.bChecked
= getDesignView() && getDesignView()->isAddFieldVisible();
779 case SID_SHOW_PROPERTYBROWSER
:
780 aReturn
.bEnabled
= true;
781 aReturn
.bChecked
= m_bShowProperties
;
783 case SID_PROPERTYBROWSER_LAST_PAGE
:
784 aReturn
.bEnabled
= true;
785 aReturn
.aValue
<<= m_sLastActivePage
;
787 case SID_SPLIT_POSITION
:
788 aReturn
.bEnabled
= true;
789 aReturn
.aValue
<<= getSplitPos();
792 aReturn
.bEnabled
= impl_isModified() && isEditable();
795 aReturn
.bEnabled
= isConnected() && isEditable();
798 aReturn
.bEnabled
= isConnected() && isEditable();
801 aReturn
.bChecked
= isEditable();
804 aReturn
.bEnabled
= isEditable();
806 case SID_BACKGROUND_COLOR
:
807 impl_fillState_nothrow(PROPERTY_CONTROLBACKGROUND
,aReturn
);
809 case SID_ATTR_CHAR_COLOR_BACKGROUND
:
810 aReturn
.bEnabled
= isEditable();
812 uno::Reference
<report::XSection
> xSection
= getDesignView()->getCurrentSection();
816 aReturn
.aValue
<<= xSection
->getBackColor();
817 const uno::Reference
< report::XReportControlModel
> xControlModel(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY
);
818 aReturn
.bEnabled
= !xControlModel
.is();
820 catch(const beans::UnknownPropertyException
&)
824 aReturn
.bEnabled
= false;
827 case SID_SORTINGANDGROUPING
:
828 aReturn
.bEnabled
= true;
829 aReturn
.bChecked
= m_pGroupsFloater
&& m_pGroupsFloater
->IsVisible();
831 case SID_ATTR_CHAR_WEIGHT
:
832 case SID_ATTR_CHAR_POSTURE
:
833 case SID_ATTR_CHAR_UNDERLINE
:
834 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR
,aReturn
);
835 if ( aReturn
.bEnabled
)
837 awt::FontDescriptor aFontDescriptor
;
838 aReturn
.aValue
>>= aFontDescriptor
;
839 aReturn
.aValue
.clear();
843 case SID_ATTR_CHAR_WEIGHT
:
844 aReturn
.bChecked
= awt::FontWeight::BOLD
== aFontDescriptor
.Weight
;
846 case SID_ATTR_CHAR_POSTURE
:
847 aReturn
.bChecked
= awt::FontSlant_ITALIC
== aFontDescriptor
.Slant
;
849 case SID_ATTR_CHAR_UNDERLINE
:
850 aReturn
.bChecked
= awt::FontUnderline::SINGLE
== aFontDescriptor
.Underline
;
857 case SID_ATTR_CHAR_COLOR
:
858 case SID_ATTR_CHAR_COLOR2
:
859 impl_fillState_nothrow(PROPERTY_CHARCOLOR
,aReturn
);
861 case SID_ATTR_CHAR_FONT
:
862 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR
,aReturn
);
864 case SID_ATTR_CHAR_FONTHEIGHT
:
865 impl_fillState_nothrow(PROPERTY_CHARHEIGHT
,aReturn
);
866 if ( aReturn
.aValue
.hasValue() )
868 frame::status::FontHeight aFontHeight
;
869 aReturn
.aValue
>>= aFontHeight
.Height
;
870 aReturn
.aValue
<<= aFontHeight
; // another type is needed here, so
873 case SID_ATTR_PARA_ADJUST_LEFT
:
874 case SID_ATTR_PARA_ADJUST_CENTER
:
875 case SID_ATTR_PARA_ADJUST_RIGHT
:
876 case SID_ATTR_PARA_ADJUST_BLOCK
:
877 impl_fillState_nothrow(PROPERTY_PARAADJUST
,aReturn
);
878 if ( aReturn
.bEnabled
)
880 ::sal_Int16 nParaAdjust
= 0;
881 if ( aReturn
.aValue
>>= nParaAdjust
)
885 case style::ParagraphAdjust_LEFT
:
886 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_LEFT
;
888 case style::ParagraphAdjust_RIGHT
:
889 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_RIGHT
;
891 case style::ParagraphAdjust_BLOCK
:
892 case style::ParagraphAdjust_STRETCH
:
893 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_BLOCK
;
895 case style::ParagraphAdjust_CENTER
:
896 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_CENTER
;
900 aReturn
.aValue
.clear();
904 case SID_INSERT_GRAPHIC
:
905 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable() && getDesignView()->getCurrentSection().is();
908 case SID_SETCONTROLDEFAULTS
:
909 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable();
910 if ( aReturn
.bEnabled
)
912 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
913 getDesignView()->fillControlModelSelection(aSelection
);
914 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
915 for(; aIter
!= aSelection
.end()
916 && !uno::Reference
< report::XFixedLine
>(*aIter
,uno::UNO_QUERY
).is()
917 && !uno::Reference
< report::XImageControl
>(*aIter
,uno::UNO_QUERY
).is()
918 && uno::Reference
< report::XReportControlFormat
>(*aIter
,uno::UNO_QUERY
).is() ;++aIter
)
920 aReturn
.bEnabled
= !aSelection
.empty() && aIter
== aSelection
.end();
923 case SID_CONDITIONALFORMATTING
:
925 const uno::Reference
< report::XFormattedField
> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY
);
926 aReturn
.bEnabled
= xFormattedField
.is();
929 case SID_INSERT_FLD_PGNUMBER
:
931 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable() && getDesignView()->getCurrentSection().is();
934 case SID_EXPORTDOCASPDF
:
935 aReturn
.bEnabled
= m_xReportDefinition
.is();
937 case SID_PRINTPREVIEW
:
938 aReturn
.bEnabled
= false;
941 aReturn
.bEnabled
= true;
943 SvxZoomItem
aZoom(m_eZoomType
,m_nZoomValue
);
944 aZoom
.SetValueSet(SvxZoomEnableFlags::N50
|SvxZoomEnableFlags::N75
|SvxZoomEnableFlags::N100
|SvxZoomEnableFlags::N200
);
945 aZoom
.QueryValue(aReturn
.aValue
);
948 case SID_ATTR_ZOOMSLIDER
:
949 aReturn
.bEnabled
= true;
951 SvxZoomSliderItem
aZoomSlider(m_nZoomValue
,20,400);
952 aZoomSlider
.AddSnappingPoint(50);
953 aZoomSlider
.AddSnappingPoint(75);
954 aZoomSlider
.AddSnappingPoint(100);
955 aZoomSlider
.AddSnappingPoint(200);
956 aZoomSlider
.QueryValue(aReturn
.aValue
);
960 aReturn
= OReportController_BASE::GetState(_nId
);
968 /** extracts a background color from a dispatched SID_BACKGROUND_COLOR call
970 The dispatch might originate from either the toolbar, or the conditional
971 formatting dialog. In both cases, argument formats are different.
973 util::Color
lcl_extractBackgroundColor( const Sequence
< PropertyValue
>& _rDispatchArgs
)
975 util::Color
aColor( COL_TRANSPARENT
);
976 if ( _rDispatchArgs
.getLength() == 1 )
978 OSL_VERIFY( _rDispatchArgs
[0].Value
>>= aColor
);
982 SequenceAsHashMap
aMap( _rDispatchArgs
);
983 aColor
= aMap
.getUnpackedValueOrDefault( PROPERTY_FONTCOLOR
, aColor
);
990 void OReportController::Execute(sal_uInt16 _nId
, const Sequence
< PropertyValue
>& aArgs
)
992 SolarMutexGuard aSolarGuard
;
993 ::osl::MutexGuard
aGuard( getMutex() );
995 bool bForceBroadcast
= false;
998 case SID_RPT_TEXTDOCUMENT
:
999 if ( m_xReportDefinition
.is() )
1000 m_xReportDefinition
->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII
);
1002 case SID_RPT_SPREADSHEET
:
1003 if (m_xReportDefinition
.is() )
1004 m_xReportDefinition
->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII
);
1006 case SID_REPORTHEADER_WITHOUT_UNDO
:
1007 case SID_REPORTFOOTER_WITHOUT_UNDO
:
1008 case SID_REPORTHEADERFOOTER
:
1009 switchReportSection(_nId
);
1011 case SID_PAGEHEADER_WITHOUT_UNDO
:
1012 case SID_PAGEFOOTER_WITHOUT_UNDO
:
1013 case SID_PAGEHEADERFOOTER
:
1014 switchPageSection(_nId
);
1016 case SID_GROUP_APPEND
:
1017 case SID_GROUP_REMOVE
:
1018 modifyGroup(_nId
== SID_GROUP_APPEND
,aArgs
);
1020 case SID_GROUPHEADER_WITHOUT_UNDO
:
1021 case SID_GROUPHEADER
:
1022 createGroupSection(SID_GROUPHEADER
== _nId
,true,aArgs
);
1024 case SID_GROUPFOOTER_WITHOUT_UNDO
:
1025 case SID_GROUPFOOTER
:
1026 createGroupSection(SID_GROUPFOOTER
== _nId
,false,aArgs
);
1028 case SID_ADD_CONTROL_PAIR
:
1029 addPairControls(aArgs
);
1034 const OXUndoEnvironment::OUndoMode
aLock( m_aReportModel
->GetUndoEnv() );
1035 bool ( SfxUndoManager::*doXDo
)() =
1036 ( _nId
== SID_UNDO
) ? &SfxUndoManager::Undo
: &SfxUndoManager::Redo
;
1038 SfxUndoManager
& rUndoManager( getUndoManager() );
1039 (rUndoManager
.*doXDo
)();
1045 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION
,::std::mem_fun(&ODesignView::Cut
));
1048 getDesignView()->Copy();
1051 executeMethodWithUndo(RID_STR_UNDO_PASTE
,::std::mem_fun(&ODesignView::Paste
));
1054 case SID_FRAME_TO_TOP
:
1055 case SID_FRAME_DOWN
:
1057 case SID_FRAME_TO_BOTTOM
:
1058 case SID_OBJECT_HEAVEN
:
1059 case SID_OBJECT_HELL
:
1062 case SID_DISTRIBUTION
:
1064 OSectionView
* pSectionView
= getCurrentSectionView();
1066 pSectionView
->DistributeMarkedObjects();
1069 case SID_OBJECT_SMALLESTWIDTH
:
1070 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::WIDTH_SMALLEST
);
1072 case SID_OBJECT_SMALLESTHEIGHT
:
1073 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::HEIGHT_SMALLEST
);
1075 case SID_OBJECT_GREATESTWIDTH
:
1076 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::WIDTH_GREATEST
);
1078 case SID_OBJECT_GREATESTHEIGHT
:
1079 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::HEIGHT_GREATEST
);
1081 case SID_SECTION_ALIGN_LEFT
:
1082 case SID_OBJECT_ALIGN_LEFT
:
1083 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::LEFT
,SID_SECTION_ALIGN_LEFT
== _nId
);
1085 case SID_SECTION_ALIGN_CENTER
:
1086 case SID_OBJECT_ALIGN_CENTER
:
1087 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::CENTER_HORIZONTAL
,SID_SECTION_ALIGN_CENTER
== _nId
);
1089 case SID_SECTION_ALIGN_RIGHT
:
1090 case SID_OBJECT_ALIGN_RIGHT
:
1091 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::RIGHT
,SID_SECTION_ALIGN_RIGHT
== _nId
);
1093 case SID_SECTION_ALIGN_UP
:
1094 case SID_OBJECT_ALIGN_UP
:
1095 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::TOP
,SID_SECTION_ALIGN_UP
== _nId
);
1097 case SID_SECTION_ALIGN_MIDDLE
:
1098 case SID_OBJECT_ALIGN_MIDDLE
:
1099 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::CENTER_VERTICAL
,SID_SECTION_ALIGN_MIDDLE
== _nId
);
1101 case SID_SECTION_ALIGN_DOWN
:
1102 case SID_OBJECT_ALIGN_DOWN
:
1103 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::BOTTOM
,SID_SECTION_ALIGN_DOWN
== _nId
);
1106 case SID_SECTION_SHRINK_BOTTOM
:
1107 case SID_SECTION_SHRINK_TOP
:
1108 case SID_SECTION_SHRINK
:
1110 uno::Reference
<report::XSection
> xSection
= getDesignView()->getCurrentSection();
1111 shrinkSection(RID_STR_UNDO_SHRINK
, xSection
, _nId
);
1116 getDesignView()->SelectAll(OBJ_NONE
);
1118 case SID_SELECTALL_IN_SECTION
:
1120 OSectionView
* pSectionView
= getCurrentSectionView();
1122 pSectionView
->MarkAll();
1126 getDesignView()->SetMode(RPTUI_SELECT
);
1127 InvalidateFeature( SID_OBJECT_SELECT
);
1129 case SID_SELECT_ALL_EDITS
:
1130 getDesignView()->SelectAll(OBJ_DLG_FORMATTEDFIELD
);
1132 case SID_SELECT_ALL_LABELS
:
1133 getDesignView()->SelectAll(OBJ_DLG_FIXEDTEXT
);
1135 case SID_TERMINATE_INPLACEACTIVATION
:
1137 OSectionWindow
* pSection
= getDesignView()->getMarkedSection();
1139 pSection
->getReportSection().deactivateOle();
1143 if ( aArgs
.getLength() == 1 )
1144 select(aArgs
[0].Value
);
1146 case SID_SELECT_REPORT
:
1147 select(uno::makeAny(m_xReportDefinition
));
1149 case SID_EXECUTE_REPORT
:
1150 getView()->PostUserEvent(LINK(this, OReportController
,OnExecuteReport
));
1152 case SID_RPT_NEW_FUNCTION
:
1153 createNewFunction(aArgs
[0].Value
);
1155 case SID_COLLAPSE_SECTION
:
1156 collapseSection(true);
1158 case SID_EXPAND_SECTION
:
1159 collapseSection(false);
1168 if ( aArgs
.getLength() == 1 )
1170 uno::Reference
< report::XFunction
> xFunction
;
1171 aArgs
[0].Value
>>= xFunction
;
1172 if ( xFunction
.is() )
1174 uno::Reference
< report::XFunctions
> xFunctions(xFunction
->getParent(),uno::UNO_QUERY_THROW
);
1175 sal_Int32 nIndex
= getPositionInIndexAccess(xFunctions
.get(),xFunction
);
1176 const OUString sUndoAction
= ModuleRes(RID_STR_UNDO_REMOVE_FUNCTION
);
1177 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
1178 xFunctions
->removeByIndex(nIndex
);
1179 select(uno::makeAny(xFunctions
->getParent()));
1180 InvalidateFeature( SID_SAVEDOC
);
1181 InvalidateFeature( SID_UNDO
);
1185 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION
,::std::mem_fun(&ODesignView::Delete
));
1188 getDesignView()->setGridSnap(m_bGridUse
= !m_bGridUse
);
1190 case SID_HELPLINES_MOVE
:
1191 getDesignView()->setDragStripes(m_bHelplinesMove
= !m_bHelplinesMove
);
1193 case SID_GRID_VISIBLE
:
1194 getDesignView()->toggleGrid(m_bGridVisible
= !m_bGridVisible
);
1197 getDesignView()->showRuler(m_bShowRuler
= !m_bShowRuler
);
1199 case SID_OBJECT_SELECT
:
1200 getDesignView()->SetMode(RPTUI_SELECT
);
1203 case SID_INSERT_DIAGRAM
:
1204 getDesignView()->SetMode( RPTUI_INSERT
);
1205 getDesignView()->SetInsertObj( OBJ_OLE2
);
1206 createDefaultControl(aArgs
);
1209 case SID_FM_FIXEDTEXT
:
1210 getDesignView()->SetMode( RPTUI_INSERT
);
1211 getDesignView()->SetInsertObj( OBJ_DLG_FIXEDTEXT
);
1212 createDefaultControl(aArgs
);
1215 case SID_INSERT_HFIXEDLINE
:
1216 getDesignView()->SetMode( RPTUI_INSERT
);
1217 getDesignView()->SetInsertObj( OBJ_DLG_HFIXEDLINE
);
1218 createDefaultControl(aArgs
);
1221 case SID_INSERT_VFIXEDLINE
:
1222 getDesignView()->SetMode( RPTUI_INSERT
);
1223 getDesignView()->SetInsertObj( OBJ_DLG_VFIXEDLINE
);
1224 createDefaultControl(aArgs
);
1228 getDesignView()->SetMode( RPTUI_INSERT
);
1229 getDesignView()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD
);
1230 createDefaultControl(aArgs
);
1233 case SID_FM_IMAGECONTROL
:
1234 getDesignView()->SetMode( RPTUI_INSERT
);
1235 getDesignView()->SetInsertObj( OBJ_DLG_IMAGECONTROL
);
1236 createDefaultControl(aArgs
);
1239 case SID_DRAWTBX_CS_BASIC
:
1240 case SID_DRAWTBX_CS_BASIC1
:
1241 case SID_DRAWTBX_CS_BASIC2
:
1242 case SID_DRAWTBX_CS_BASIC3
:
1243 case SID_DRAWTBX_CS_BASIC4
:
1244 case SID_DRAWTBX_CS_BASIC5
:
1245 case SID_DRAWTBX_CS_BASIC6
:
1246 case SID_DRAWTBX_CS_BASIC7
:
1247 case SID_DRAWTBX_CS_BASIC8
:
1248 case SID_DRAWTBX_CS_BASIC9
:
1249 case SID_DRAWTBX_CS_BASIC10
:
1250 case SID_DRAWTBX_CS_BASIC11
:
1251 case SID_DRAWTBX_CS_BASIC12
:
1252 case SID_DRAWTBX_CS_BASIC13
:
1253 case SID_DRAWTBX_CS_BASIC14
:
1254 case SID_DRAWTBX_CS_BASIC15
:
1255 case SID_DRAWTBX_CS_BASIC16
:
1256 case SID_DRAWTBX_CS_BASIC17
:
1257 case SID_DRAWTBX_CS_BASIC18
:
1258 case SID_DRAWTBX_CS_BASIC19
:
1259 case SID_DRAWTBX_CS_BASIC20
:
1260 case SID_DRAWTBX_CS_BASIC21
:
1261 case SID_DRAWTBX_CS_BASIC22
:
1262 case SID_DRAWTBX_CS_SYMBOL1
:
1263 case SID_DRAWTBX_CS_SYMBOL2
:
1264 case SID_DRAWTBX_CS_SYMBOL3
:
1265 case SID_DRAWTBX_CS_SYMBOL4
:
1266 case SID_DRAWTBX_CS_SYMBOL5
:
1267 case SID_DRAWTBX_CS_SYMBOL6
:
1268 case SID_DRAWTBX_CS_SYMBOL7
:
1269 case SID_DRAWTBX_CS_SYMBOL8
:
1270 case SID_DRAWTBX_CS_SYMBOL9
:
1271 case SID_DRAWTBX_CS_SYMBOL10
:
1272 case SID_DRAWTBX_CS_SYMBOL11
:
1273 case SID_DRAWTBX_CS_SYMBOL12
:
1274 case SID_DRAWTBX_CS_SYMBOL13
:
1275 case SID_DRAWTBX_CS_SYMBOL14
:
1276 case SID_DRAWTBX_CS_SYMBOL15
:
1277 case SID_DRAWTBX_CS_SYMBOL16
:
1278 case SID_DRAWTBX_CS_SYMBOL17
:
1279 case SID_DRAWTBX_CS_SYMBOL18
:
1280 case SID_DRAWTBX_CS_ARROW1
:
1281 case SID_DRAWTBX_CS_ARROW2
:
1282 case SID_DRAWTBX_CS_ARROW3
:
1283 case SID_DRAWTBX_CS_ARROW4
:
1284 case SID_DRAWTBX_CS_ARROW5
:
1285 case SID_DRAWTBX_CS_ARROW6
:
1286 case SID_DRAWTBX_CS_ARROW7
:
1287 case SID_DRAWTBX_CS_ARROW8
:
1288 case SID_DRAWTBX_CS_ARROW9
:
1289 case SID_DRAWTBX_CS_ARROW10
:
1290 case SID_DRAWTBX_CS_ARROW11
:
1291 case SID_DRAWTBX_CS_ARROW12
:
1292 case SID_DRAWTBX_CS_ARROW13
:
1293 case SID_DRAWTBX_CS_ARROW14
:
1294 case SID_DRAWTBX_CS_ARROW15
:
1295 case SID_DRAWTBX_CS_ARROW16
:
1296 case SID_DRAWTBX_CS_ARROW17
:
1297 case SID_DRAWTBX_CS_ARROW18
:
1298 case SID_DRAWTBX_CS_ARROW19
:
1299 case SID_DRAWTBX_CS_ARROW20
:
1300 case SID_DRAWTBX_CS_ARROW21
:
1301 case SID_DRAWTBX_CS_ARROW22
:
1302 case SID_DRAWTBX_CS_ARROW23
:
1303 case SID_DRAWTBX_CS_ARROW24
:
1304 case SID_DRAWTBX_CS_ARROW25
:
1305 case SID_DRAWTBX_CS_ARROW26
:
1306 case SID_DRAWTBX_CS_STAR1
:
1307 case SID_DRAWTBX_CS_STAR2
:
1308 case SID_DRAWTBX_CS_STAR3
:
1309 case SID_DRAWTBX_CS_STAR4
:
1310 case SID_DRAWTBX_CS_STAR5
:
1311 case SID_DRAWTBX_CS_STAR6
:
1312 case SID_DRAWTBX_CS_STAR7
:
1313 case SID_DRAWTBX_CS_STAR8
:
1314 case SID_DRAWTBX_CS_STAR9
:
1315 case SID_DRAWTBX_CS_STAR10
:
1316 case SID_DRAWTBX_CS_STAR11
:
1317 case SID_DRAWTBX_CS_STAR12
:
1318 case SID_DRAWTBX_CS_FLOWCHART1
:
1319 case SID_DRAWTBX_CS_FLOWCHART2
:
1320 case SID_DRAWTBX_CS_FLOWCHART3
:
1321 case SID_DRAWTBX_CS_FLOWCHART4
:
1322 case SID_DRAWTBX_CS_FLOWCHART5
:
1323 case SID_DRAWTBX_CS_FLOWCHART6
:
1324 case SID_DRAWTBX_CS_FLOWCHART7
:
1325 case SID_DRAWTBX_CS_FLOWCHART8
:
1326 case SID_DRAWTBX_CS_FLOWCHART9
:
1327 case SID_DRAWTBX_CS_FLOWCHART10
:
1328 case SID_DRAWTBX_CS_FLOWCHART11
:
1329 case SID_DRAWTBX_CS_FLOWCHART12
:
1330 case SID_DRAWTBX_CS_FLOWCHART13
:
1331 case SID_DRAWTBX_CS_FLOWCHART14
:
1332 case SID_DRAWTBX_CS_FLOWCHART15
:
1333 case SID_DRAWTBX_CS_FLOWCHART16
:
1334 case SID_DRAWTBX_CS_FLOWCHART17
:
1335 case SID_DRAWTBX_CS_FLOWCHART18
:
1336 case SID_DRAWTBX_CS_FLOWCHART19
:
1337 case SID_DRAWTBX_CS_FLOWCHART20
:
1338 case SID_DRAWTBX_CS_FLOWCHART21
:
1339 case SID_DRAWTBX_CS_FLOWCHART22
:
1340 case SID_DRAWTBX_CS_FLOWCHART23
:
1341 case SID_DRAWTBX_CS_FLOWCHART24
:
1342 case SID_DRAWTBX_CS_FLOWCHART25
:
1343 case SID_DRAWTBX_CS_FLOWCHART26
:
1344 case SID_DRAWTBX_CS_FLOWCHART27
:
1345 case SID_DRAWTBX_CS_FLOWCHART28
:
1346 case SID_DRAWTBX_CS_CALLOUT1
:
1347 case SID_DRAWTBX_CS_CALLOUT2
:
1348 case SID_DRAWTBX_CS_CALLOUT3
:
1349 case SID_DRAWTBX_CS_CALLOUT4
:
1350 case SID_DRAWTBX_CS_CALLOUT5
:
1351 case SID_DRAWTBX_CS_CALLOUT6
:
1352 case SID_DRAWTBX_CS_CALLOUT7
:
1353 case SID_DRAWTBX_CS_SYMBOL
:
1354 case SID_DRAWTBX_CS_ARROW
:
1355 case SID_DRAWTBX_CS_FLOWCHART
:
1356 case SID_DRAWTBX_CS_CALLOUT
:
1357 case SID_DRAWTBX_CS_STAR
:
1358 getDesignView()->SetMode( RPTUI_INSERT
);
1360 URL aUrl
= getURLForId(_nId
);
1361 sal_Int32 nIndex
= 1;
1362 OUString sType
= aUrl
.Complete
.getToken(0,'.',nIndex
);
1363 if ( nIndex
== -1 || sType
.isEmpty() )
1367 case SID_DRAWTBX_CS_SYMBOL
:
1370 case SID_DRAWTBX_CS_ARROW
:
1371 sType
= "left-right-arrow";
1373 case SID_DRAWTBX_CS_FLOWCHART
:
1374 sType
= "flowchart-internal-storage";
1376 case SID_DRAWTBX_CS_CALLOUT
:
1377 sType
= "round-rectangular-callout";
1379 case SID_DRAWTBX_CS_STAR
:
1387 sType
= aUrl
.Complete
.getToken(0,'.',nIndex
);
1389 getDesignView()->SetInsertObj( OBJ_CUSTOMSHAPE
,sType
);
1390 createDefaultControl(aArgs
);
1394 case SID_RPT_SHOWREPORTEXPLORER
:
1395 if ( isUiVisible() )
1396 getDesignView()->toggleReportExplorer();
1398 case SID_FM_ADD_FIELD
:
1399 if ( isUiVisible() )
1400 getDesignView()->toggleAddField();
1402 case SID_SHOW_PROPERTYBROWSER
:
1403 if ( m_bShowProperties
)
1404 m_sLastActivePage
= getDesignView()->getCurrentPage();
1406 getDesignView()->setCurrentPage(m_sLastActivePage
);
1408 if ( isUiVisible() )
1410 m_bShowProperties
= !m_bShowProperties
;
1411 if ( aArgs
.getLength() == 1 )
1412 aArgs
[0].Value
>>= m_bShowProperties
;
1414 getDesignView()->togglePropertyBrowser(m_bShowProperties
);
1417 case SID_PROPERTYBROWSER_LAST_PAGE
: // nothing to do
1418 m_sLastActivePage
= getDesignView()->getCurrentPage();
1420 case SID_SPLIT_POSITION
:
1421 getDesignView()->Resize();
1423 case SID_PAGEDIALOG
:
1424 case SID_ATTR_CHAR_COLOR_BACKGROUND
:
1426 uno::Reference
<report::XSection
> xSection
;
1427 if (aArgs
.getLength() == 1 )
1428 aArgs
[0].Value
>>= xSection
;
1429 openPageDialog(xSection
);
1430 bForceBroadcast
= true;
1433 case SID_SORTINGANDGROUPING
:
1434 openSortingAndGroupingDialog();
1435 m_bGroupFloaterWasVisible
= m_pGroupsFloater
&& m_pGroupsFloater
->IsVisible();
1437 case SID_BACKGROUND_COLOR
:
1439 const util::Color
aColor( lcl_extractBackgroundColor( aArgs
) );
1440 if ( !impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CONTROLBACKGROUND
,uno::makeAny(aColor
),aArgs
) )
1442 uno::Reference
< report::XSection
> xSection
= getDesignView()->getCurrentSection();
1443 if ( xSection
.is() )
1445 xSection
->setBackColor( aColor
);
1448 bForceBroadcast
= true;
1451 case SID_ATTR_CHAR_WEIGHT
:
1452 case SID_ATTR_CHAR_POSTURE
:
1453 case SID_ATTR_CHAR_UNDERLINE
:
1455 uno::Reference
< awt::XWindow
> xWindow
;
1456 ::std::vector
< uno::Reference
< uno::XInterface
> > aControlsFormats
;
1457 lcl_getReportControlFormat( aArgs
, getDesignView(), xWindow
, aControlsFormats
);
1459 const OUString
sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT
));
1460 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
1462 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aControlsFormats
.begin();
1463 for(; aIter
!= aControlsFormats
.end();++aIter
)
1465 uno::Reference
< report::XReportControlFormat
> xReportControlFormat(*aIter
,uno::UNO_QUERY
);
1466 lcl_setFontWPU_nothrow(xReportControlFormat
,_nId
);
1470 case SID_ATTR_CHAR_COLOR
:
1471 case SID_ATTR_CHAR_COLOR2
:
1472 case SID_ATTR_CHAR_COLOR_EXT
:
1474 const SequenceAsHashMap
aMap(aArgs
);
1475 const util::Color aColor
= aMap
.getUnpackedValueOrDefault(PROPERTY_FONTCOLOR
,util::Color());
1476 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARCOLOR
,uno::makeAny(aColor
),aArgs
);
1477 bForceBroadcast
= true;
1480 case SID_ATTR_CHAR_FONT
:
1481 if ( aArgs
.getLength() == 1 )
1483 awt::FontDescriptor aFont
;
1484 if ( aArgs
[0].Value
>>= aFont
)
1486 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARFONTNAME
,uno::makeAny(aFont
.Name
),aArgs
);
1490 case SID_ATTR_CHAR_FONTHEIGHT
:
1491 if ( aArgs
.getLength() == 1 )
1493 float fSelVal
= 0.0;
1494 if ( aArgs
[0].Value
>>= fSelVal
)
1495 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARHEIGHT
,aArgs
[0].Value
,aArgs
);
1498 case SID_ATTR_PARA_ADJUST_LEFT
:
1499 case SID_ATTR_PARA_ADJUST_CENTER
:
1500 case SID_ATTR_PARA_ADJUST_RIGHT
:
1501 case SID_ATTR_PARA_ADJUST_BLOCK
:
1503 sal_Int16 eParagraphAdjust
= style::ParagraphAdjust_LEFT
;
1506 case SID_ATTR_PARA_ADJUST_LEFT
:
1507 eParagraphAdjust
= style::ParagraphAdjust_LEFT
;
1509 case SID_ATTR_PARA_ADJUST_CENTER
:
1510 eParagraphAdjust
= style::ParagraphAdjust_CENTER
;
1512 case SID_ATTR_PARA_ADJUST_RIGHT
:
1513 eParagraphAdjust
= style::ParagraphAdjust_RIGHT
;
1515 case SID_ATTR_PARA_ADJUST_BLOCK
:
1516 eParagraphAdjust
= style::ParagraphAdjust_BLOCK
;
1519 impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT
,PROPERTY_PARAADJUST
,uno::makeAny(eParagraphAdjust
),aArgs
);
1521 InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT
);
1522 InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER
);
1523 InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT
);
1524 InvalidateFeature(SID_ATTR_PARA_ADJUST_BLOCK
);
1529 uno::Sequence
< beans::NamedValue
> aSettings
;
1530 uno::Reference
< awt::XWindow
> xWindow
;
1531 ::std::vector
< uno::Reference
< uno::XInterface
> > aControlsFormats
;
1532 lcl_getReportControlFormat( aArgs
, getDesignView(), xWindow
, aControlsFormats
);
1534 if ( !aControlsFormats
.empty() )
1536 const OUString
sUndoAction( ModuleRes( RID_STR_UNDO_CHANGEFONT
) );
1537 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
1539 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aControlsFormats
.begin();
1540 for(; aIter
!= aControlsFormats
.end();++aIter
)
1542 uno::Reference
< report::XReportControlFormat
> xFormat( *aIter
, uno::UNO_QUERY
);
1543 if ( !xFormat
.is() )
1546 if ( aSettings
.getLength() == 0 )
1548 ::rptui::openCharDialog( xFormat
, xWindow
, aSettings
);
1549 if ( aSettings
.getLength() == 0 )
1553 applyCharacterSettings( xFormat
, aSettings
);
1560 case SID_INSERT_GRAPHIC
:
1563 case SID_SETCONTROLDEFAULTS
:
1565 case SID_CONDITIONALFORMATTING
:
1567 uno::Reference
< report::XFormattedField
> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY
);
1568 if ( xFormattedField
.is() )
1570 ScopedVclPtrInstance
< ConditionalFormattingDialog
> aDlg( getView(), xFormattedField
.get(), *this );
1576 if ( m_xReportDefinition
.is() )
1578 if ( !aArgs
.getLength() )
1580 ScopedVclPtrInstance
< ODateTimeDialog
> aDlg(getView(),getDesignView()->getCurrentSection(),this);
1584 createDateTime(aArgs
);
1587 case SID_INSERT_FLD_PGNUMBER
:
1588 if ( m_xReportDefinition
.is() )
1590 if ( !aArgs
.getLength() )
1592 ScopedVclPtrInstance
< OPageNumberDialog
> aDlg(getView(),m_xReportDefinition
,this);
1596 createPageNumber(aArgs
);
1600 case SID_EXPORTDOCASPDF
:
1602 case SID_PRINTPREVIEW
:
1603 if ( m_xReportDefinition
.is() )
1609 { // the state should be changed to not editable
1610 setModified(sal_False
); // and we are not modified yet
1612 setEditable(!isEditable());
1618 if ( aArgs
.getLength() == 0 )
1622 else if ( aArgs
.getLength() == 1 && aArgs
[0].Name
== "Zoom" )
1624 SvxZoomItem aZoomItem
;
1625 aZoomItem
.PutValue(aArgs
[0].Value
);
1626 m_nZoomValue
= aZoomItem
.GetValue();
1627 m_eZoomType
= aZoomItem
.GetType();
1628 impl_zoom_nothrow();
1631 case SID_ATTR_ZOOMSLIDER
:
1632 if ( aArgs
.getLength() == 1 && aArgs
[0].Name
== "ZoomSlider" )
1634 SvxZoomSliderItem aZoomSlider
;
1635 aZoomSlider
.PutValue(aArgs
[0].Value
);
1636 m_nZoomValue
= aZoomSlider
.GetValue();
1637 m_eZoomType
= SvxZoomType::PERCENT
;
1638 impl_zoom_nothrow();
1642 OReportController_BASE::Execute(_nId
,aArgs
);
1644 InvalidateFeature(_nId
,Reference
< XStatusListener
>(),bForceBroadcast
);
1647 void OReportController::impl_initialize( )
1649 OReportController_BASE::impl_initialize();
1651 const ::comphelper::NamedValueCollection
& rArguments( getInitParams() );
1653 rArguments
.get_ensureType( OUString(PROPERTY_REPORTNAME
), m_sName
);
1654 if ( m_sName
.isEmpty() )
1655 rArguments
.get_ensureType( "DocumentTitle", m_sName
);
1659 if ( m_xReportDefinition
.is() )
1661 getView()->initialize(); // show the windows and fill with our information
1663 m_aReportModel
= reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition
);
1664 if ( !m_aReportModel
)
1665 throw RuntimeException();
1666 m_aReportModel
->attachController( *this );
1669 UndoSuppressor
aSuppressUndo( getUndoManager() );
1671 ::comphelper::NamedValueCollection
aArgs(getModel()->getArgs());
1672 setMode(aArgs
.getOrDefault("Mode", OUString("normal")));
1675 setEditable( !m_aReportModel
->IsReadOnly() );
1676 m_xFormatter
.set(util::NumberFormatter::create(m_xContext
), UNO_QUERY_THROW
);
1677 m_xFormatter
->attachNumberFormatsSupplier(Reference
< XNumberFormatsSupplier
>(m_xReportDefinition
,uno::UNO_QUERY
));
1679 utl::MediaDescriptor
aDescriptor( m_xReportDefinition
->getArgs() );
1680 OUString sHierarchicalDocumentName
;
1681 sHierarchicalDocumentName
= aDescriptor
.getUnpackedValueOrDefault("HierarchicalDocumentName",sHierarchicalDocumentName
);
1683 if ( sHierarchicalDocumentName
.isEmpty() && getConnection().is() )
1685 uno::Reference
<sdbcx::XTablesSupplier
> xTablesSup(getConnection(),uno::UNO_QUERY_THROW
);
1686 uno::Reference
<container::XNameAccess
> xTables
= xTablesSup
->getTables();
1687 const uno::Sequence
< OUString
> aNames( xTables
->getElementNames() );
1689 if ( aNames
.hasElements() )
1691 m_xReportDefinition
->setCommand(aNames
[0]);
1692 m_xReportDefinition
->setCommandType(sdb::CommandType::TABLE
);
1696 m_aVisualAreaSize
= m_xReportDefinition
->getVisualAreaSize(0);
1700 // check if chart is supported by the engine
1701 checkChartEnabled();
1702 // restore the view data
1703 getDesignView()->toggleGrid(m_bGridVisible
);
1704 getDesignView()->showRuler(m_bShowRuler
);
1705 getDesignView()->togglePropertyBrowser(m_bShowProperties
);
1706 getDesignView()->setCurrentPage(m_sLastActivePage
);
1707 getDesignView()->unmarkAllObjects(NULL
);
1709 if ( m_nPageNum
!= -1 )
1711 if ( m_nPageNum
< m_aReportModel
->GetPageCount() )
1713 const OReportPage
* pPage
= dynamic_cast<OReportPage
*>(m_aReportModel
->GetPage(static_cast<sal_uInt16
>(m_nPageNum
)));
1716 uno::Sequence
< beans::PropertyValue
> aArgs(1);
1717 aArgs
[0].Value
<<= pPage
->getSection();
1718 executeUnChecked(SID_SELECT
,aArgs
);
1724 getDesignView()->collapseSections(m_aCollapsedSections
);
1725 impl_zoom_nothrow();
1726 getDesignView()->Resize();
1727 getDesignView()->Invalidate();
1730 if ( m_bShowProperties
&& m_nPageNum
== -1 )
1732 m_sLastActivePage
= "Data";
1733 getDesignView()->setCurrentPage(m_sLastActivePage
);
1734 uno::Sequence
< beans::PropertyValue
> aArgs
;
1735 executeUnChecked(SID_SELECT_REPORT
,aArgs
);
1738 setModified(sal_False
); // and we are not modified yet
1740 // open the global help agent
1741 // we need a Frame but at this time there is no frame, therefore we send a UserEvent
1742 getView()->PostUserEvent(LINK(this, OReportController
, OnOpenHelpAgent
));
1744 catch(const SQLException
&)
1746 DBG_UNHANDLED_EXCEPTION();
1750 IMPL_LINK_NOARG( OReportController
, OnOpenHelpAgent
)
1756 IMPL_LINK( OReportController
, OnCreateHdl
, OAddFieldWindow
* ,_pAddFieldDlg
)
1758 WaitObject
aObj( getDesignView() );
1759 uno::Sequence
< beans::PropertyValue
> aArgs
= _pAddFieldDlg
->getSelectedFieldDescriptors();
1760 // we use this way to create undo actions
1761 if ( aArgs
.getLength() )
1763 executeChecked(SID_ADD_CONTROL_PAIR
,aArgs
);
1769 void OReportController::doOpenHelpAgent()
1771 if (getFrame().is())
1773 OUString
suURL("vnd.sun.star.help://shared/text/shared/explorer/database/rep_main.xhp?UseDB=no&DbPAR=swriter");
1774 openHelpAgent(suURL
);
1778 // as long as we don't get a Frame, we send the user event again.
1779 getView()->PostUserEvent(LINK(this, OReportController
, OnOpenHelpAgent
));
1783 bool OReportController::Construct(vcl::Window
* pParent
)
1785 VclPtrInstance
<ODesignView
> pMyOwnView( pParent
, m_xContext
, *this );
1786 StartListening( *pMyOwnView
);
1787 setView( pMyOwnView
);
1789 // now that we have a view we can create the clipboard listener
1790 m_aSystemClipboard
= TransferableDataHelper::CreateFromSystemClipboard( getView() );
1791 m_aSystemClipboard
.StartClipboardListening( );
1792 m_pClipbordNotifier
= new TransferableClipboardListener( LINK( this, OReportController
, OnClipboardChanged
) );
1793 m_pClipbordNotifier
->acquire();
1794 m_pClipbordNotifier
->AddRemoveListener( getView(), true );
1796 OReportController_BASE::Construct(pParent
);
1800 sal_Bool SAL_CALL
OReportController::suspend(sal_Bool
/*_bSuspend*/) throw( RuntimeException
, std::exception
)
1802 if ( getBroadcastHelper().bInDispose
|| getBroadcastHelper().bDisposed
)
1805 SolarMutexGuard aSolarGuard
;
1806 ::osl::MutexGuard
aGuard( getMutex() );
1808 if ( getView() && getView()->IsInModalMode() )
1811 // this suspend will be handled in the DBAccess interceptor implementation
1815 void OReportController::describeSupportedFeatures()
1817 DBSubComponentController::describeSupportedFeatures();
1819 implDescribeSupportedFeature( ".uno:TextDocument", SID_RPT_TEXTDOCUMENT
, CommandGroup::APPLICATION
);
1820 implDescribeSupportedFeature( ".uno:Spreadsheet", SID_RPT_SPREADSHEET
, CommandGroup::APPLICATION
);
1822 implDescribeSupportedFeature( ".uno:Redo", SID_REDO
, CommandGroup::EDIT
);
1823 implDescribeSupportedFeature( ".uno:Undo", SID_UNDO
, CommandGroup::EDIT
);
1824 implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL
, CommandGroup::EDIT
);
1825 implDescribeSupportedFeature( ".uno:SelectAllInSection", SID_SELECTALL_IN_SECTION
, CommandGroup::EDIT
);
1826 implDescribeSupportedFeature( ".uno:Delete", SID_DELETE
, CommandGroup::EDIT
);
1827 implDescribeSupportedFeature( ".uno:SelectReport", SID_SELECT_REPORT
, CommandGroup::EDIT
);
1828 implDescribeSupportedFeature( ".uno:ExecuteReport", SID_EXECUTE_REPORT
, CommandGroup::EDIT
);
1830 implDescribeSupportedFeature( ".uno:GridVisible", SID_GRID_VISIBLE
, CommandGroup::VIEW
);
1831 implDescribeSupportedFeature( ".uno:GridUse", SID_GRID_USE
, CommandGroup::VIEW
);
1832 implDescribeSupportedFeature( ".uno:HelplinesMove", SID_HELPLINES_MOVE
, CommandGroup::VIEW
);
1833 implDescribeSupportedFeature( ".uno:ShowRuler", SID_RULER
, CommandGroup::VIEW
);
1834 implDescribeSupportedFeature( ".uno:AddField", SID_FM_ADD_FIELD
, CommandGroup::VIEW
);
1835 implDescribeSupportedFeature( ".uno:ReportNavigator", SID_RPT_SHOWREPORTEXPLORER
, CommandGroup::VIEW
);
1836 implDescribeSupportedFeature( ".uno:ControlProperties", SID_SHOW_PROPERTYBROWSER
, CommandGroup::VIEW
);
1837 implDescribeSupportedFeature( ".uno:DbSortingAndGrouping", SID_SORTINGANDGROUPING
, CommandGroup::VIEW
);
1838 implDescribeSupportedFeature( ".uno:PageHeaderFooter", SID_PAGEHEADERFOOTER
, CommandGroup::VIEW
);
1839 implDescribeSupportedFeature( ".uno:ReportHeaderFooter", SID_REPORTHEADERFOOTER
, CommandGroup::VIEW
);
1840 implDescribeSupportedFeature( ".uno:ZoomSlider", SID_ATTR_ZOOMSLIDER
, CommandGroup::VIEW
);
1841 implDescribeSupportedFeature( ".uno:Zoom", SID_ATTR_ZOOM
, CommandGroup::VIEW
);
1843 implDescribeSupportedFeature( ".uno:ConditionalFormatting", SID_CONDITIONALFORMATTING
, CommandGroup::FORMAT
);
1844 implDescribeSupportedFeature( ".uno:PageDialog", SID_PAGEDIALOG
, CommandGroup::FORMAT
);
1845 implDescribeSupportedFeature( ".uno:ResetAttributes", SID_SETCONTROLDEFAULTS
, CommandGroup::FORMAT
);
1847 implDescribeSupportedFeature( ".uno:Bold", SID_ATTR_CHAR_WEIGHT
, CommandGroup::FORMAT
);
1848 implDescribeSupportedFeature( ".uno:Italic", SID_ATTR_CHAR_POSTURE
, CommandGroup::FORMAT
);
1849 implDescribeSupportedFeature( ".uno:Underline", SID_ATTR_CHAR_UNDERLINE
, CommandGroup::FORMAT
);
1850 implDescribeSupportedFeature( ".uno:BackColor", SID_ATTR_CHAR_COLOR_BACKGROUND
, CommandGroup::FORMAT
);
1851 implDescribeSupportedFeature( ".uno:BackgroundColor", SID_BACKGROUND_COLOR
, CommandGroup::FORMAT
);
1852 implDescribeSupportedFeature( ".uno:CharColorExt", SID_ATTR_CHAR_COLOR_EXT
);
1853 implDescribeSupportedFeature( ".uno:Color", SID_ATTR_CHAR_COLOR
);
1854 implDescribeSupportedFeature( ".uno:FontColor", SID_ATTR_CHAR_COLOR2
, CommandGroup::FORMAT
);
1855 implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG
, CommandGroup::FORMAT
);
1856 implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT
, CommandGroup::FORMAT
);
1857 implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER
, CommandGroup::FORMAT
);
1858 implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT
, CommandGroup::FORMAT
);
1859 implDescribeSupportedFeature( ".uno:JustifyPara", SID_ATTR_PARA_ADJUST_BLOCK
, CommandGroup::FORMAT
);
1861 implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT
, CommandGroup::FORMAT
);
1862 implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT
, CommandGroup::FORMAT
);
1864 implDescribeSupportedFeature( ".uno:ArrangeMenu", SID_ARRANGEMENU
, CommandGroup::FORMAT
);
1865 implDescribeSupportedFeature( ".uno:BringToFront", SID_FRAME_TO_TOP
, CommandGroup::FORMAT
);
1866 implDescribeSupportedFeature( ".uno:ObjectBackOne", SID_FRAME_DOWN
, CommandGroup::FORMAT
);
1867 implDescribeSupportedFeature( ".uno:ObjectForwardOne", SID_FRAME_UP
, CommandGroup::FORMAT
);
1868 implDescribeSupportedFeature( ".uno:SendToBack", SID_FRAME_TO_BOTTOM
, CommandGroup::FORMAT
);
1869 implDescribeSupportedFeature( ".uno:SetObjectToForeground", SID_OBJECT_HEAVEN
, CommandGroup::FORMAT
);
1870 implDescribeSupportedFeature( ".uno:SetObjectToBackground", SID_OBJECT_HELL
, CommandGroup::FORMAT
);
1872 implDescribeSupportedFeature( ".uno:ObjectAlign", SID_OBJECT_ALIGN
, CommandGroup::FORMAT
);
1873 implDescribeSupportedFeature( ".uno:ObjectAlignLeft", SID_OBJECT_ALIGN_LEFT
, CommandGroup::FORMAT
);
1874 implDescribeSupportedFeature( ".uno:AlignCenter", SID_OBJECT_ALIGN_CENTER
, CommandGroup::FORMAT
);
1875 implDescribeSupportedFeature( ".uno:ObjectAlignRight", SID_OBJECT_ALIGN_RIGHT
, CommandGroup::FORMAT
);
1876 implDescribeSupportedFeature( ".uno:AlignUp", SID_OBJECT_ALIGN_UP
, CommandGroup::FORMAT
);
1877 implDescribeSupportedFeature( ".uno:AlignMiddle", SID_OBJECT_ALIGN_MIDDLE
, CommandGroup::FORMAT
);
1878 implDescribeSupportedFeature( ".uno:AlignDown", SID_OBJECT_ALIGN_DOWN
, CommandGroup::FORMAT
);
1880 implDescribeSupportedFeature( ".uno:SectionAlign", SID_SECTION_ALIGN
, CommandGroup::FORMAT
);
1881 implDescribeSupportedFeature( ".uno:SectionAlignLeft", SID_SECTION_ALIGN_LEFT
, CommandGroup::FORMAT
);
1882 implDescribeSupportedFeature( ".uno:SectionAlignCenter", SID_SECTION_ALIGN_CENTER
, CommandGroup::FORMAT
);
1883 implDescribeSupportedFeature( ".uno:SectionAlignRight", SID_SECTION_ALIGN_RIGHT
, CommandGroup::FORMAT
);
1884 implDescribeSupportedFeature( ".uno:SectionAlignTop", SID_SECTION_ALIGN_UP
, CommandGroup::FORMAT
);
1885 implDescribeSupportedFeature( ".uno:SectionAlignMiddle", SID_SECTION_ALIGN_MIDDLE
, CommandGroup::FORMAT
);
1886 implDescribeSupportedFeature( ".uno:SectionAlignBottom", SID_SECTION_ALIGN_DOWN
, CommandGroup::FORMAT
);
1887 implDescribeSupportedFeature( ".uno:SectionShrink", SID_SECTION_SHRINK
, CommandGroup::FORMAT
);
1888 implDescribeSupportedFeature( ".uno:SectionShrinkTop", SID_SECTION_SHRINK_TOP
, CommandGroup::FORMAT
);
1889 implDescribeSupportedFeature( ".uno:SectionShrinkBottom", SID_SECTION_SHRINK_BOTTOM
, CommandGroup::FORMAT
);
1891 implDescribeSupportedFeature( ".uno:ObjectResize", SID_OBJECT_RESIZING
, CommandGroup::FORMAT
);
1892 implDescribeSupportedFeature( ".uno:SmallestWidth", SID_OBJECT_SMALLESTWIDTH
, CommandGroup::FORMAT
);
1893 implDescribeSupportedFeature( ".uno:SmallestHeight", SID_OBJECT_SMALLESTHEIGHT
, CommandGroup::FORMAT
);
1894 implDescribeSupportedFeature( ".uno:GreatestWidth", SID_OBJECT_GREATESTWIDTH
, CommandGroup::FORMAT
);
1895 implDescribeSupportedFeature( ".uno:GreatestHeight", SID_OBJECT_GREATESTHEIGHT
, CommandGroup::FORMAT
);
1896 implDescribeSupportedFeature( ".uno:Distribution", SID_DISTRIBUTION
, CommandGroup::FORMAT
);
1898 implDescribeSupportedFeature( ".uno:HelpMenu", SID_HELPMENU
, CommandGroup::APPLICATION
);
1899 implDescribeSupportedFeature( ".uno:ExportTo", SID_EXPORTDOC
, CommandGroup::APPLICATION
);
1900 implDescribeSupportedFeature( ".uno:ExportToPDF", SID_EXPORTDOCASPDF
, CommandGroup::APPLICATION
);
1901 implDescribeSupportedFeature( ".uno:PrintPreview", SID_PRINTPREVIEW
, CommandGroup::APPLICATION
);
1903 implDescribeSupportedFeature( ".uno:NewDoc", SID_NEWDOC
, CommandGroup::DOCUMENT
);
1904 implDescribeSupportedFeature( ".uno:Save", SID_SAVEDOC
, CommandGroup::DOCUMENT
);
1905 implDescribeSupportedFeature( ".uno:SaveAs", SID_SAVEASDOC
, CommandGroup::DOCUMENT
);
1906 implDescribeSupportedFeature( ".uno:SaveACopy", SID_SAVEACOPY
, CommandGroup::DOCUMENT
);
1908 implDescribeSupportedFeature( ".uno:InsertPageNumberField", SID_INSERT_FLD_PGNUMBER
, CommandGroup::INSERT
);
1909 implDescribeSupportedFeature( ".uno:InsertDateTimeField", SID_DATETIME
, CommandGroup::INSERT
);
1910 implDescribeSupportedFeature( ".uno:InsertObjectChart", SID_INSERT_DIAGRAM
, CommandGroup::INSERT
);
1911 implDescribeSupportedFeature( ".uno:InsertGraphic", SID_INSERT_GRAPHIC
, CommandGroup::INSERT
);
1913 implDescribeSupportedFeature( ".uno:SelectObject", SID_OBJECT_SELECT
, CommandGroup::INSERT
);
1914 implDescribeSupportedFeature( ".uno:Label", SID_FM_FIXEDTEXT
, CommandGroup::INSERT
);
1915 implDescribeSupportedFeature( ".uno:Edit", SID_FM_EDIT
, CommandGroup::INSERT
);
1916 implDescribeSupportedFeature( ".uno:ImageControl", SID_FM_IMAGECONTROL
, CommandGroup::INSERT
);
1917 implDescribeSupportedFeature( ".uno:HFixedLine", SID_INSERT_HFIXEDLINE
, CommandGroup::INSERT
);
1918 implDescribeSupportedFeature( ".uno:VFixedLine", SID_INSERT_VFIXEDLINE
, CommandGroup::INSERT
);
1921 implDescribeSupportedFeature( ".uno:BasicShapes", SID_DRAWTBX_CS_BASIC
, CommandGroup::INSERT
);
1922 implDescribeSupportedFeature( ".uno:BasicShapes.rectangle", SID_DRAWTBX_CS_BASIC1
, CommandGroup::INSERT
);
1923 implDescribeSupportedFeature( ".uno:BasicShapes.round-rectangle",SID_DRAWTBX_CS_BASIC2
, CommandGroup::INSERT
);
1924 implDescribeSupportedFeature( ".uno:BasicShapes.quadrat", SID_DRAWTBX_CS_BASIC3
, CommandGroup::INSERT
);
1925 implDescribeSupportedFeature( ".uno:BasicShapes.round-quadrat", SID_DRAWTBX_CS_BASIC4
, CommandGroup::INSERT
);
1926 implDescribeSupportedFeature( ".uno:BasicShapes.circle", SID_DRAWTBX_CS_BASIC5
, CommandGroup::INSERT
);
1927 implDescribeSupportedFeature( ".uno:BasicShapes.ellipse", SID_DRAWTBX_CS_BASIC6
, CommandGroup::INSERT
);
1928 implDescribeSupportedFeature( ".uno:BasicShapes.circle-pie", SID_DRAWTBX_CS_BASIC7
, CommandGroup::INSERT
);
1929 implDescribeSupportedFeature( ".uno:BasicShapes.isosceles-triangle",SID_DRAWTBX_CS_BASIC8
, CommandGroup::INSERT
);
1930 implDescribeSupportedFeature( ".uno:BasicShapes.right-triangle",SID_DRAWTBX_CS_BASIC9
, CommandGroup::INSERT
);
1931 implDescribeSupportedFeature( ".uno:BasicShapes.trapezoid", SID_DRAWTBX_CS_BASIC10
, CommandGroup::INSERT
);
1932 implDescribeSupportedFeature( ".uno:BasicShapes.diamond", SID_DRAWTBX_CS_BASIC11
, CommandGroup::INSERT
);
1933 implDescribeSupportedFeature( ".uno:BasicShapes.parallelogram", SID_DRAWTBX_CS_BASIC12
, CommandGroup::INSERT
);
1934 implDescribeSupportedFeature( ".uno:BasicShapes.pentagon", SID_DRAWTBX_CS_BASIC13
, CommandGroup::INSERT
);
1935 implDescribeSupportedFeature( ".uno:BasicShapes.hexagon", SID_DRAWTBX_CS_BASIC14
, CommandGroup::INSERT
);
1936 implDescribeSupportedFeature( ".uno:BasicShapes.octagon", SID_DRAWTBX_CS_BASIC15
, CommandGroup::INSERT
);
1937 implDescribeSupportedFeature( ".uno:BasicShapes.cross", SID_DRAWTBX_CS_BASIC16
, CommandGroup::INSERT
);
1938 implDescribeSupportedFeature( ".uno:BasicShapes.ring", SID_DRAWTBX_CS_BASIC17
, CommandGroup::INSERT
);
1939 implDescribeSupportedFeature( ".uno:BasicShapes.block-arc", SID_DRAWTBX_CS_BASIC18
, CommandGroup::INSERT
);
1940 implDescribeSupportedFeature( ".uno:BasicShapes.can", SID_DRAWTBX_CS_BASIC19
, CommandGroup::INSERT
);
1941 implDescribeSupportedFeature( ".uno:BasicShapes.cube", SID_DRAWTBX_CS_BASIC20
, CommandGroup::INSERT
);
1942 implDescribeSupportedFeature( ".uno:BasicShapes.paper", SID_DRAWTBX_CS_BASIC21
, CommandGroup::INSERT
);
1943 implDescribeSupportedFeature( ".uno:BasicShapes.frame", SID_DRAWTBX_CS_BASIC22
, CommandGroup::INSERT
);
1945 implDescribeSupportedFeature( ".uno:SymbolShapes", SID_DRAWTBX_CS_SYMBOL
, CommandGroup::INSERT
);
1947 implDescribeSupportedFeature( ".uno:SymbolShapes.smiley" , SID_DRAWTBX_CS_SYMBOL1
, CommandGroup::INSERT
);
1948 implDescribeSupportedFeature( ".uno:SymbolShapes.sun" , SID_DRAWTBX_CS_SYMBOL2
, CommandGroup::INSERT
);
1949 implDescribeSupportedFeature( ".uno:SymbolShapes.moon" , SID_DRAWTBX_CS_SYMBOL3
, CommandGroup::INSERT
);
1950 implDescribeSupportedFeature( ".uno:SymbolShapes.lightning" , SID_DRAWTBX_CS_SYMBOL4
, CommandGroup::INSERT
);
1951 implDescribeSupportedFeature( ".uno:SymbolShapes.heart" , SID_DRAWTBX_CS_SYMBOL5
, CommandGroup::INSERT
);
1952 implDescribeSupportedFeature( ".uno:SymbolShapes.flower" , SID_DRAWTBX_CS_SYMBOL6
, CommandGroup::INSERT
);
1953 implDescribeSupportedFeature( ".uno:SymbolShapes.cloud" , SID_DRAWTBX_CS_SYMBOL7
, CommandGroup::INSERT
);
1954 implDescribeSupportedFeature( ".uno:SymbolShapes.forbidden" , SID_DRAWTBX_CS_SYMBOL8
, CommandGroup::INSERT
);
1955 implDescribeSupportedFeature( ".uno:SymbolShapes.puzzle" , SID_DRAWTBX_CS_SYMBOL9
, CommandGroup::INSERT
);
1956 implDescribeSupportedFeature( ".uno:SymbolShapes.bracket-pair" ,SID_DRAWTBX_CS_SYMBOL10
, CommandGroup::INSERT
);
1957 implDescribeSupportedFeature( ".uno:SymbolShapes.left-bracket" ,SID_DRAWTBX_CS_SYMBOL11
, CommandGroup::INSERT
);
1958 implDescribeSupportedFeature( ".uno:SymbolShapes.right-bracket",SID_DRAWTBX_CS_SYMBOL12
, CommandGroup::INSERT
);
1959 implDescribeSupportedFeature( ".uno:SymbolShapes.brace-pair" , SID_DRAWTBX_CS_SYMBOL13
, CommandGroup::INSERT
);
1960 implDescribeSupportedFeature( ".uno:SymbolShapes.left-brace" , SID_DRAWTBX_CS_SYMBOL14
, CommandGroup::INSERT
);
1961 implDescribeSupportedFeature( ".uno:SymbolShapes.right-brace" , SID_DRAWTBX_CS_SYMBOL15
, CommandGroup::INSERT
);
1962 implDescribeSupportedFeature( ".uno:SymbolShapes.quad-bevel" , SID_DRAWTBX_CS_SYMBOL16
, CommandGroup::INSERT
);
1963 implDescribeSupportedFeature( ".uno:SymbolShapes.octagon-bevel",SID_DRAWTBX_CS_SYMBOL17
, CommandGroup::INSERT
);
1964 implDescribeSupportedFeature( ".uno:SymbolShapes.diamond-bevel",SID_DRAWTBX_CS_SYMBOL18
, CommandGroup::INSERT
);
1966 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow" , SID_DRAWTBX_CS_ARROW1
, CommandGroup::INSERT
);
1967 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow" , SID_DRAWTBX_CS_ARROW2
, CommandGroup::INSERT
);
1968 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow" , SID_DRAWTBX_CS_ARROW3
, CommandGroup::INSERT
);
1969 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow" , SID_DRAWTBX_CS_ARROW4
, CommandGroup::INSERT
);
1970 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow" , SID_DRAWTBX_CS_ARROW5
, CommandGroup::INSERT
);
1971 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow" , SID_DRAWTBX_CS_ARROW6
, CommandGroup::INSERT
);
1972 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow" , SID_DRAWTBX_CS_ARROW7
, CommandGroup::INSERT
);
1973 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-down-arrow" , SID_DRAWTBX_CS_ARROW8
, CommandGroup::INSERT
);
1974 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow" , SID_DRAWTBX_CS_ARROW9
, CommandGroup::INSERT
);
1975 implDescribeSupportedFeature( ".uno:ArrowShapes.corner-right-arrow" , SID_DRAWTBX_CS_ARROW10
, CommandGroup::INSERT
);
1976 implDescribeSupportedFeature( ".uno:ArrowShapes.split-arrow" , SID_DRAWTBX_CS_ARROW11
, CommandGroup::INSERT
);
1977 implDescribeSupportedFeature( ".uno:ArrowShapes.striped-right-arrow" , SID_DRAWTBX_CS_ARROW12
, CommandGroup::INSERT
);
1978 implDescribeSupportedFeature( ".uno:ArrowShapes.notched-right-arrow" , SID_DRAWTBX_CS_ARROW13
, CommandGroup::INSERT
);
1979 implDescribeSupportedFeature( ".uno:ArrowShapes.pentagon-right" , SID_DRAWTBX_CS_ARROW14
, CommandGroup::INSERT
);
1980 implDescribeSupportedFeature( ".uno:ArrowShapes.chevron" , SID_DRAWTBX_CS_ARROW15
, CommandGroup::INSERT
);
1981 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow-callout" , SID_DRAWTBX_CS_ARROW16
, CommandGroup::INSERT
);
1982 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow-callout" , SID_DRAWTBX_CS_ARROW17
, CommandGroup::INSERT
);
1983 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow-callout" , SID_DRAWTBX_CS_ARROW18
, CommandGroup::INSERT
);
1984 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow-callout" , SID_DRAWTBX_CS_ARROW19
, CommandGroup::INSERT
);
1985 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow-callout",SID_DRAWTBX_CS_ARROW20
, CommandGroup::INSERT
);
1986 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow-callout" ,SID_DRAWTBX_CS_ARROW21
, CommandGroup::INSERT
);
1987 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow-callout",SID_DRAWTBX_CS_ARROW22
, CommandGroup::INSERT
);
1988 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow-callout" , SID_DRAWTBX_CS_ARROW23
, CommandGroup::INSERT
);
1989 implDescribeSupportedFeature( ".uno:ArrowShapes.circular-arrow" , SID_DRAWTBX_CS_ARROW24
, CommandGroup::INSERT
);
1990 implDescribeSupportedFeature( ".uno:ArrowShapes.split-round-arrow" , SID_DRAWTBX_CS_ARROW25
, CommandGroup::INSERT
);
1991 implDescribeSupportedFeature( ".uno:ArrowShapes.s-sharped-arrow" , SID_DRAWTBX_CS_ARROW26
, CommandGroup::INSERT
);
1993 implDescribeSupportedFeature( ".uno:StarShapes.bang" , SID_DRAWTBX_CS_STAR1
, CommandGroup::INSERT
);
1994 implDescribeSupportedFeature( ".uno:StarShapes.star4" , SID_DRAWTBX_CS_STAR2
, CommandGroup::INSERT
);
1995 implDescribeSupportedFeature( ".uno:StarShapes.star5" , SID_DRAWTBX_CS_STAR3
, CommandGroup::INSERT
);
1996 implDescribeSupportedFeature( ".uno:StarShapes.star6" , SID_DRAWTBX_CS_STAR4
, CommandGroup::INSERT
);
1997 implDescribeSupportedFeature( ".uno:StarShapes.star8" , SID_DRAWTBX_CS_STAR5
, CommandGroup::INSERT
);
1998 implDescribeSupportedFeature( ".uno:StarShapes.star12" , SID_DRAWTBX_CS_STAR6
, CommandGroup::INSERT
);
1999 implDescribeSupportedFeature( ".uno:StarShapes.star24" , SID_DRAWTBX_CS_STAR7
, CommandGroup::INSERT
);
2000 implDescribeSupportedFeature( ".uno:StarShapes.concave-star6" , SID_DRAWTBX_CS_STAR8
, CommandGroup::INSERT
);
2001 implDescribeSupportedFeature( ".uno:StarShapes.vertical-scroll" , SID_DRAWTBX_CS_STAR9
, CommandGroup::INSERT
);
2002 implDescribeSupportedFeature( ".uno:StarShapes.horizontal-scroll" , SID_DRAWTBX_CS_STAR10
, CommandGroup::INSERT
);
2003 implDescribeSupportedFeature( ".uno:StarShapes.signet" , SID_DRAWTBX_CS_STAR11
, CommandGroup::INSERT
);
2004 implDescribeSupportedFeature( ".uno:StarShapes.doorplate" , SID_DRAWTBX_CS_STAR12
, CommandGroup::INSERT
);
2006 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-process" , SID_DRAWTBX_CS_FLOWCHART1
, CommandGroup::INSERT
);
2007 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-alternate-process" , SID_DRAWTBX_CS_FLOWCHART2
, CommandGroup::INSERT
);
2008 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-decision" , SID_DRAWTBX_CS_FLOWCHART3
, CommandGroup::INSERT
);
2009 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-data" , SID_DRAWTBX_CS_FLOWCHART4
, CommandGroup::INSERT
);
2010 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-predefined-process" , SID_DRAWTBX_CS_FLOWCHART5
, CommandGroup::INSERT
);
2011 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-internal-storage" , SID_DRAWTBX_CS_FLOWCHART6
, CommandGroup::INSERT
);
2012 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-document" , SID_DRAWTBX_CS_FLOWCHART7
, CommandGroup::INSERT
);
2013 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-multidocument" , SID_DRAWTBX_CS_FLOWCHART8
, CommandGroup::INSERT
);
2014 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-terminator" , SID_DRAWTBX_CS_FLOWCHART9
, CommandGroup::INSERT
);
2015 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-preparation" , SID_DRAWTBX_CS_FLOWCHART10
, CommandGroup::INSERT
);
2016 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-input" , SID_DRAWTBX_CS_FLOWCHART11
, CommandGroup::INSERT
);
2017 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-operation" , SID_DRAWTBX_CS_FLOWCHART12
, CommandGroup::INSERT
);
2018 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-connector" , SID_DRAWTBX_CS_FLOWCHART13
, CommandGroup::INSERT
);
2019 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-off-page-connector" , SID_DRAWTBX_CS_FLOWCHART14
, CommandGroup::INSERT
);
2020 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-card" , SID_DRAWTBX_CS_FLOWCHART15
, CommandGroup::INSERT
);
2021 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-punched-tape" , SID_DRAWTBX_CS_FLOWCHART16
, CommandGroup::INSERT
);
2022 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-summing-junction" , SID_DRAWTBX_CS_FLOWCHART17
, CommandGroup::INSERT
);
2023 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-or" , SID_DRAWTBX_CS_FLOWCHART18
, CommandGroup::INSERT
);
2024 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-collate" , SID_DRAWTBX_CS_FLOWCHART19
, CommandGroup::INSERT
);
2025 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sort" , SID_DRAWTBX_CS_FLOWCHART20
, CommandGroup::INSERT
);
2026 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-extract" , SID_DRAWTBX_CS_FLOWCHART21
, CommandGroup::INSERT
);
2027 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-merge" , SID_DRAWTBX_CS_FLOWCHART22
, CommandGroup::INSERT
);
2028 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-stored-data" , SID_DRAWTBX_CS_FLOWCHART23
, CommandGroup::INSERT
);
2029 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-delay" , SID_DRAWTBX_CS_FLOWCHART24
, CommandGroup::INSERT
);
2030 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sequential-access" , SID_DRAWTBX_CS_FLOWCHART25
, CommandGroup::INSERT
);
2031 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-magnetic-disk" , SID_DRAWTBX_CS_FLOWCHART26
, CommandGroup::INSERT
);
2032 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-direct-access-storage",SID_DRAWTBX_CS_FLOWCHART27
, CommandGroup::INSERT
);
2033 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-display" , SID_DRAWTBX_CS_FLOWCHART28
, CommandGroup::INSERT
);
2035 implDescribeSupportedFeature( ".uno:CalloutShapes.rectangular-callout" , SID_DRAWTBX_CS_CALLOUT1
, CommandGroup::INSERT
);
2036 implDescribeSupportedFeature( ".uno:CalloutShapes.round-rectangular-callout" , SID_DRAWTBX_CS_CALLOUT2
, CommandGroup::INSERT
);
2037 implDescribeSupportedFeature( ".uno:CalloutShapes.round-callout" , SID_DRAWTBX_CS_CALLOUT3
, CommandGroup::INSERT
);
2038 implDescribeSupportedFeature( ".uno:CalloutShapes.cloud-callout" , SID_DRAWTBX_CS_CALLOUT4
, CommandGroup::INSERT
);
2039 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-1" , SID_DRAWTBX_CS_CALLOUT5
, CommandGroup::INSERT
);
2040 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-2" , SID_DRAWTBX_CS_CALLOUT6
, CommandGroup::INSERT
);
2041 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-3" , SID_DRAWTBX_CS_CALLOUT7
, CommandGroup::INSERT
);
2043 implDescribeSupportedFeature( ".uno:ArrowShapes", SID_DRAWTBX_CS_ARROW
, CommandGroup::INSERT
);
2045 implDescribeSupportedFeature( ".uno:FlowChartShapes", SID_DRAWTBX_CS_FLOWCHART
, CommandGroup::INSERT
);
2046 implDescribeSupportedFeature( ".uno:CalloutShapes", SID_DRAWTBX_CS_CALLOUT
, CommandGroup::INSERT
);
2047 implDescribeSupportedFeature( ".uno:StarShapes", SID_DRAWTBX_CS_STAR
, CommandGroup::INSERT
);
2051 implDescribeSupportedFeature( ".uno:Escape", SID_ESCAPE
, CommandGroup::CONTROLS
);
2054 implDescribeSupportedFeature( ".uno:RPT_RPTHEADER_UNDO", SID_REPORTHEADER_WITHOUT_UNDO
);
2055 implDescribeSupportedFeature( ".uno:RPT_RPTFOOTER_UNDO", SID_REPORTFOOTER_WITHOUT_UNDO
);
2056 implDescribeSupportedFeature( ".uno:RPT_PGHEADER_UNDO", SID_PAGEHEADER_WITHOUT_UNDO
);
2057 implDescribeSupportedFeature( ".uno:RPT_PGFOOTER_UNDO", SID_PAGEFOOTER_WITHOUT_UNDO
);
2058 implDescribeSupportedFeature( ".uno:DBBackgroundColor", SID_ATTR_CHAR_COLOR_BACKGROUND
);
2059 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER", SID_GROUPHEADER
);
2060 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER_WITHOUT_UNDO", SID_GROUPHEADER_WITHOUT_UNDO
);
2061 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER", SID_GROUPFOOTER
);
2062 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER_WITHOUT_UNDO", SID_GROUPFOOTER_WITHOUT_UNDO
);
2063 implDescribeSupportedFeature( ".uno:SID_GROUP_REMOVE", SID_GROUP_REMOVE
);
2064 implDescribeSupportedFeature( ".uno:SID_GROUP_APPEND", SID_GROUP_APPEND
);
2065 implDescribeSupportedFeature( ".uno:SID_ADD_CONTROL_PAIR", SID_ADD_CONTROL_PAIR
);
2066 implDescribeSupportedFeature( ".uno:SplitPosition", SID_SPLIT_POSITION
);
2067 implDescribeSupportedFeature( ".uno:LastPropertyBrowserPage", SID_PROPERTYBROWSER_LAST_PAGE
);
2068 implDescribeSupportedFeature( ".uno:Select", SID_SELECT
);
2069 implDescribeSupportedFeature( ".uno:InsertFunction", SID_RPT_NEW_FUNCTION
);
2070 implDescribeSupportedFeature( ".uno:NextMark", SID_NEXT_MARK
);
2071 implDescribeSupportedFeature( ".uno:PrevMark", SID_PREV_MARK
);
2072 implDescribeSupportedFeature( ".uno:TerminateInplaceActivation", SID_TERMINATE_INPLACEACTIVATION
);
2073 implDescribeSupportedFeature( ".uno:SelectAllLabels", SID_SELECT_ALL_LABELS
);
2074 implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS
);
2075 implDescribeSupportedFeature( ".uno:CollapseSection", SID_COLLAPSE_SECTION
);
2076 implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION
);
2079 void OReportController::impl_onModifyChanged()
2083 if ( m_xReportDefinition
.is() )
2084 m_xReportDefinition
->setModified( impl_isModified() );
2085 DBSubComponentController::impl_onModifyChanged();
2087 catch(const uno::Exception
&)
2089 DBG_UNHANDLED_EXCEPTION();
2093 void OReportController::onLoadedMenu(const Reference
< frame::XLayoutManager
>& _xLayoutManager
)
2095 if ( _xLayoutManager
.is() )
2097 static const OUString s_sMenu
[] = {
2098 OUString("private:resource/statusbar/statusbar")
2099 ,OUString("private:resource/toolbar/reportcontrols")
2100 ,OUString("private:resource/toolbar/drawbar")
2101 ,OUString("private:resource/toolbar/Formatting")
2102 ,OUString("private:resource/toolbar/alignmentbar")
2103 ,OUString("private:resource/toolbar/sectionalignmentbar")
2104 ,OUString("private:resource/toolbar/resizebar")
2105 ,OUString("private:resource/toolbar/sectionshrinkbar")
2107 for (size_t i
= 0; i
< sizeof(s_sMenu
)/sizeof(s_sMenu
[0]); ++i
)
2109 _xLayoutManager
->createElement( s_sMenu
[i
] );
2110 _xLayoutManager
->requestElement( s_sMenu
[i
] );
2115 void OReportController::notifyGroupSections(const ContainerEvent
& _rEvent
,bool _bShow
)
2117 uno::Reference
< report::XGroup
> xGroup(_rEvent
.Element
,uno::UNO_QUERY
);
2120 SolarMutexGuard aSolarGuard
;
2121 ::osl::MutexGuard
aGuard( getMutex() );
2122 sal_Int32 nGroupPos
= 0;
2123 _rEvent
.Accessor
>>= nGroupPos
;
2127 xGroup
->addPropertyChangeListener(PROPERTY_HEADERON
, static_cast<XPropertyChangeListener
*>(this));
2128 xGroup
->addPropertyChangeListener(PROPERTY_FOOTERON
, static_cast<XPropertyChangeListener
*>(this));
2132 xGroup
->removePropertyChangeListener(PROPERTY_HEADERON
, static_cast<XPropertyChangeListener
*>(this));
2133 xGroup
->removePropertyChangeListener(PROPERTY_FOOTERON
, static_cast<XPropertyChangeListener
*>(this));
2136 if ( xGroup
->getHeaderOn() )
2138 groupChange(xGroup
,PROPERTY_HEADERON
,nGroupPos
,_bShow
);
2141 m_pReportControllerObserver
->AddSection(xGroup
->getHeader());
2145 m_pReportControllerObserver
->RemoveSection(xGroup
->getHeader());
2148 if ( xGroup
->getFooterOn() )
2150 groupChange(xGroup
,PROPERTY_FOOTERON
,nGroupPos
,_bShow
);
2153 m_pReportControllerObserver
->AddSection(xGroup
->getFooter());
2157 m_pReportControllerObserver
->RemoveSection(xGroup
->getFooter());
2163 // ::container::XContainerListener
2164 void SAL_CALL
OReportController::elementInserted( const ContainerEvent
& _rEvent
) throw(RuntimeException
, std::exception
)
2166 notifyGroupSections(_rEvent
,true);
2169 void SAL_CALL
OReportController::elementRemoved( const ContainerEvent
& _rEvent
) throw(RuntimeException
, std::exception
)
2171 notifyGroupSections(_rEvent
,false);
2174 void SAL_CALL
OReportController::elementReplaced( const ContainerEvent
& /*_rEvent*/ ) throw(RuntimeException
, std::exception
)
2176 SolarMutexGuard aSolarGuard
;
2177 ::osl::MutexGuard
aGuard( getMutex() );
2178 OSL_FAIL("Not yet implemented!");
2181 void SAL_CALL
OReportController::propertyChange( const beans::PropertyChangeEvent
& evt
) throw (RuntimeException
, std::exception
)
2183 SolarMutexGuard aSolarGuard
;
2184 ::osl::MutexGuard
aGuard( getMutex() );
2188 evt
.NewValue
>>= bShow
;
2189 if ( evt
.Source
== m_xReportDefinition
)
2191 if ( evt
.PropertyName
== PROPERTY_REPORTHEADERON
)
2193 const sal_uInt16 nPosition
= m_xReportDefinition
->getPageHeaderOn() ? 1 : 0;
2196 getDesignView()->addSection(m_xReportDefinition
->getReportHeader(),DBREPORTHEADER
,nPosition
);
2197 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getReportHeader());
2201 getDesignView()->removeSection(nPosition
);
2204 else if ( evt
.PropertyName
== PROPERTY_REPORTFOOTERON
)
2206 sal_uInt16 nPosition
= getDesignView()->getSectionCount();
2207 if ( m_xReportDefinition
->getPageFooterOn() )
2211 getDesignView()->addSection(m_xReportDefinition
->getReportFooter(),DBREPORTFOOTER
,nPosition
);
2212 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getReportFooter());
2216 getDesignView()->removeSection(nPosition
- 1);
2219 else if ( evt
.PropertyName
== PROPERTY_PAGEHEADERON
)
2223 getDesignView()->addSection(m_xReportDefinition
->getPageHeader(),DBPAGEHEADER
,0);
2224 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getPageHeader());
2228 getDesignView()->removeSection(sal_uInt16(0));
2231 else if ( evt
.PropertyName
== PROPERTY_PAGEFOOTERON
)
2235 getDesignView()->addSection(m_xReportDefinition
->getPageFooter(),DBPAGEFOOTER
);
2236 m_pReportControllerObserver
->AddSection(m_xReportDefinition
->getPageFooter());
2240 getDesignView()->removeSection(getDesignView()->getSectionCount() - 1);
2243 else if ( evt
.PropertyName
== PROPERTY_COMMAND
2244 || evt
.PropertyName
== PROPERTY_COMMANDTYPE
2245 || evt
.PropertyName
== PROPERTY_ESCAPEPROCESSING
2246 || evt
.PropertyName
== PROPERTY_FILTER
2250 m_xHoldAlive
.clear();
2251 InvalidateFeature(SID_FM_ADD_FIELD
);
2252 if ( !getDesignView()->isAddFieldVisible() && isUiVisible() )
2253 getDesignView()->toggleAddField();
2255 /// TODO: check what we need to notify here TitleHelper
2256 /*else if ( evt.PropertyName.equals( PROPERTY_CAPTION ) )
2261 uno::Reference
< report::XGroup
> xGroup(evt
.Source
,uno::UNO_QUERY
);
2264 sal_Int32 nGroupPos
= getGroupPosition(xGroup
);
2266 groupChange(xGroup
,evt
.PropertyName
,nGroupPos
,bShow
);
2270 catch(const uno::Exception
&)
2272 DBG_UNHANDLED_EXCEPTION();
2277 void SAL_CALL
OReportController::disposing( const lang::EventObject
& Source
) throw(uno::RuntimeException
, std::exception
)
2279 // simply disambiguate
2280 OReportController_BASE::disposing(Source
);
2284 static sal_uInt16
lcl_getNonVisbleGroupsBefore( const uno::Reference
< report::XGroups
>& _xGroups
2285 ,sal_Int32 _nGroupPos
2286 ,::std::mem_fun_t
<bool,OGroupHelper
>&_pGroupMemberFunction
)
2288 uno::Reference
< report::XGroup
> xGroup
;
2289 sal_uInt16 nNonVisibleGroups
= 0;
2290 sal_Int32 nCount
= _xGroups
->getCount();
2291 for( sal_Int32 i
= 0; i
< _nGroupPos
&& i
< nCount
; ++i
)
2293 xGroup
.set(_xGroups
->getByIndex(i
),uno::UNO_QUERY
);
2294 OSL_ENSURE(xGroup
.is(),"Group is NULL! -> GPF");
2295 OGroupHelper
aGroupHelper(xGroup
);
2296 if ( !_pGroupMemberFunction(&aGroupHelper
) )
2297 ++nNonVisibleGroups
;
2299 return nNonVisibleGroups
;
2302 void OReportController::groupChange( const uno::Reference
< report::XGroup
>& _xGroup
,const OUString
& _sPropName
,sal_Int32 _nGroupPos
,bool _bShow
)
2304 ::std::mem_fun_t
<bool,OGroupHelper
> pMemFun
= ::std::mem_fun(&OGroupHelper::getHeaderOn
);
2305 ::std::mem_fun_t
<uno::Reference
<report::XSection
> , OGroupHelper
> pMemFunSection
= ::std::mem_fun(&OGroupHelper::getHeader
);
2306 OUString
sColor(DBGROUPHEADER
);
2307 sal_uInt16 nPosition
= 0;
2308 bool bHandle
= false;
2309 if ( _sPropName
== PROPERTY_HEADERON
)
2311 nPosition
= m_xReportDefinition
->getPageHeaderOn() ? (m_xReportDefinition
->getReportHeaderOn() ? 2 : 1) : (m_xReportDefinition
->getReportHeaderOn() ? 1 : 0);
2312 nPosition
+= (static_cast<sal_uInt16
>(_nGroupPos
) - lcl_getNonVisbleGroupsBefore(m_xReportDefinition
->getGroups(),_nGroupPos
,pMemFun
));
2315 else if ( _sPropName
== PROPERTY_FOOTERON
)
2317 pMemFun
= ::std::mem_fun(&OGroupHelper::getFooterOn
);
2318 pMemFunSection
= ::std::mem_fun(&OGroupHelper::getFooter
);
2319 nPosition
= getDesignView()->getSectionCount();
2321 if ( m_xReportDefinition
->getPageFooterOn() )
2323 if ( m_xReportDefinition
->getReportFooterOn() )
2325 sColor
= DBGROUPFOOTER
;
2326 nPosition
-= (static_cast<sal_uInt16
>(_nGroupPos
) - lcl_getNonVisbleGroupsBefore(m_xReportDefinition
->getGroups(),_nGroupPos
,pMemFun
));
2335 OGroupHelper
aGroupHelper(_xGroup
);
2336 getDesignView()->addSection(pMemFunSection(&aGroupHelper
),sColor
,nPosition
);
2340 getDesignView()->removeSection(nPosition
);
2345 IMPL_LINK_NOARG(OReportController
, OnClipboardChanged
)
2347 OnInvalidateClipboard();
2351 void OReportController::OnInvalidateClipboard()
2353 InvalidateFeature(SID_CUT
);
2354 InvalidateFeature(SID_COPY
);
2355 InvalidateFeature(SID_PASTE
);
2358 void OReportController::openPageDialog(const uno::Reference
<report::XSection
>& _xSection
)
2360 if ( !m_xReportDefinition
.is() )
2364 static SfxItemInfo aItemInfos
[] =
2366 { SID_ATTR_LRSPACE
, SfxItemPoolFlags::POOLABLE
},
2367 { SID_ATTR_ULSPACE
, SfxItemPoolFlags::POOLABLE
},
2368 { SID_ATTR_PAGE
, SfxItemPoolFlags::POOLABLE
},
2369 { SID_ATTR_PAGE_SIZE
, SfxItemPoolFlags::POOLABLE
},
2370 { SID_ENUM_PAGE_MODE
, SfxItemPoolFlags::POOLABLE
},
2371 { SID_PAPER_START
, SfxItemPoolFlags::POOLABLE
},
2372 { SID_PAPER_END
, SfxItemPoolFlags::POOLABLE
},
2373 { SID_ATTR_BRUSH
, SfxItemPoolFlags::POOLABLE
},
2374 { XATTR_FILLSTYLE
, SfxItemPoolFlags::POOLABLE
},
2375 { XATTR_FILLCOLOR
, SfxItemPoolFlags::POOLABLE
},
2376 { XATTR_FILLGRADIENT
, SfxItemPoolFlags::POOLABLE
},
2377 { XATTR_FILLHATCH
, SfxItemPoolFlags::POOLABLE
},
2378 { XATTR_FILLBITMAP
, SfxItemPoolFlags::POOLABLE
},
2379 { XATTR_FILLTRANSPARENCE
, SfxItemPoolFlags::POOLABLE
},
2380 { XATTR_GRADIENTSTEPCOUNT
, SfxItemPoolFlags::POOLABLE
},
2381 { XATTR_FILLBMP_TILE
, SfxItemPoolFlags::POOLABLE
},
2382 { XATTR_FILLBMP_POS
, SfxItemPoolFlags::POOLABLE
},
2383 { XATTR_FILLBMP_SIZEX
, SfxItemPoolFlags::POOLABLE
},
2384 { XATTR_FILLBMP_SIZEY
, SfxItemPoolFlags::POOLABLE
},
2385 { XATTR_FILLBMP_SIZELOG
, SfxItemPoolFlags::POOLABLE
},
2386 { XATTR_FILLBMP_TILEOFFSETX
, SfxItemPoolFlags::POOLABLE
},
2387 { XATTR_FILLBMP_TILEOFFSETY
, SfxItemPoolFlags::POOLABLE
},
2388 { XATTR_FILLBMP_STRETCH
, SfxItemPoolFlags::POOLABLE
},
2389 { XATTR_FILLBMP_POSOFFSETX
, SfxItemPoolFlags::POOLABLE
},
2390 { XATTR_FILLBMP_POSOFFSETY
, SfxItemPoolFlags::POOLABLE
},
2391 { XATTR_FILLFLOATTRANSPARENCE
, SfxItemPoolFlags::POOLABLE
},
2392 { XATTR_SECONDARYFILLCOLOR
, SfxItemPoolFlags::POOLABLE
},
2393 { XATTR_FILLBACKGROUND
, SfxItemPoolFlags::POOLABLE
},
2394 { SID_ATTR_METRIC
, SfxItemPoolFlags::POOLABLE
}
2397 MeasurementSystem eSystem
= SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
2398 FieldUnit eUserMetric
= MEASURE_METRIC
== eSystem
? FUNIT_CM
: FUNIT_INCH
;
2399 static const sal_uInt16 pRanges
[] =
2401 RPTUI_ID_LRSPACE
, XATTR_FILL_LAST
,
2402 SID_ATTR_METRIC
,SID_ATTR_METRIC
,
2405 SfxItemPool
* pPool( new SfxItemPool(OUString("ReportPageProperties"), RPTUI_ID_LRSPACE
, RPTUI_ID_METRIC
, aItemInfos
) );
2407 const Graphic aNullGraphic
;
2408 const ::Color
aNullLineCol(COL_DEFAULT_SHAPE_STROKE
); // #i121448# Use defined default color
2409 const ::Color
aNullFillCol(COL_DEFAULT_SHAPE_FILLING
); // #i121448# Use defined default color
2410 const XDash aNullDash
;
2411 const XGradient
aNullGrad(RGB_Color(COL_BLACK
), RGB_Color(COL_WHITE
));
2412 const XHatch
aNullHatch(aNullLineCol
);
2414 SfxPoolItem
* pDefaults
[] =
2416 new SvxLRSpaceItem(RPTUI_ID_LRSPACE
),
2417 new SvxULSpaceItem(RPTUI_ID_ULSPACE
),
2418 new SvxPageItem(RPTUI_ID_PAGE
),
2419 new SvxSizeItem(RPTUI_ID_SIZE
),
2420 new SfxAllEnumItem(RPTUI_ID_PAGE_MODE
,SVX_PAGE_MODE_STANDARD
),
2421 new SfxAllEnumItem(RPTUI_ID_START
,PAPER_A4
),
2422 new SfxAllEnumItem(RPTUI_ID_END
,PAPER_E
),
2423 new SvxBrushItem(RPTUI_ID_BRUSH
),
2425 new XFillColorItem("", aNullFillCol
),
2426 new XFillGradientItem(aNullGrad
),
2427 new XFillHatchItem(pPool
, aNullHatch
),
2428 new XFillBitmapItem(pPool
, aNullGraphic
),
2429 new XFillTransparenceItem
,
2430 new XGradientStepCountItem
,
2431 new XFillBmpTileItem
,
2432 new XFillBmpPosItem
,
2433 new XFillBmpSizeXItem
,
2434 new XFillBmpSizeYItem
,
2435 new XFillBmpSizeLogItem
,
2436 new XFillBmpTileOffsetXItem
,
2437 new XFillBmpTileOffsetYItem
,
2438 new XFillBmpStretchItem
,
2439 new XFillBmpPosOffsetXItem
,
2440 new XFillBmpPosOffsetYItem
,
2441 new XFillFloatTransparenceItem(pPool
, aNullGrad
, false),
2442 new XSecondaryFillColorItem("", aNullFillCol
),
2443 new XFillBackgroundItem
,
2444 new SfxUInt16Item(RPTUI_ID_METRIC
,static_cast<sal_uInt16
>(eUserMetric
))
2447 pPool
->SetDefaults(pDefaults
);
2450 pPool
->SetDefaultMetric( SFX_MAPUNIT_100TH_MM
); // ripped, don't understand why
2451 pPool
->FreezeIdRanges(); // the same
2455 ::std::unique_ptr
<SfxItemSet
> pDescriptor(new SfxItemSet(*pPool
, pRanges
));
2457 if ( _xSection
.is() )
2458 pDescriptor
->Put(SvxBrushItem(::Color(_xSection
->getBackColor()),RPTUI_ID_BRUSH
));
2461 pDescriptor
->Put(SvxSizeItem(RPTUI_ID_SIZE
,VCLSize(getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
))));
2462 pDescriptor
->Put(SvxLRSpaceItem(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
)
2463 ,getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
),0,0,RPTUI_ID_LRSPACE
));
2464 pDescriptor
->Put(SvxULSpaceItem(static_cast<sal_uInt16
>(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_TOPMARGIN
))
2465 ,static_cast<sal_uInt16
>(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_BOTTOMMARGIN
)),RPTUI_ID_ULSPACE
));
2466 pDescriptor
->Put(SfxUInt16Item(SID_ATTR_METRIC
,static_cast<sal_uInt16
>(eUserMetric
)));
2468 uno::Reference
< style::XStyle
> xPageStyle(getUsedStyle(m_xReportDefinition
));
2469 if ( xPageStyle
.is() )
2471 SvxPageItem
aPageItem(RPTUI_ID_PAGE
);
2472 aPageItem
.SetDescName(xPageStyle
->getName());
2473 uno::Reference
<beans::XPropertySet
> xProp(xPageStyle
,uno::UNO_QUERY_THROW
);
2474 aPageItem
.PutValue(xProp
->getPropertyValue(PROPERTY_PAGESTYLELAYOUT
),MID_PAGE_LAYOUT
);
2475 aPageItem
.SetLandscape(getStyleProperty
<sal_Bool
>(m_xReportDefinition
,PROPERTY_ISLANDSCAPE
));
2476 aPageItem
.SetNumType((SvxNumType
)getStyleProperty
<sal_Int16
>(m_xReportDefinition
,PROPERTY_NUMBERINGTYPE
));
2477 pDescriptor
->Put(aPageItem
);
2478 pDescriptor
->Put(SvxBrushItem(::Color(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_BACKCOLOR
)),RPTUI_ID_BRUSH
));
2482 { // want the dialog to be destroyed before our set
2483 ScopedVclPtrInstance
<ORptPageDialog
> aDlg(
2484 getView(), pDescriptor
.get(),_xSection
.is()
2485 ? OUString("BackgroundDialog")
2486 : OUString("PageDialog"));
2487 if (RET_OK
== aDlg
->Execute())
2492 const SfxItemSet
* pSet
= aDlg
->GetOutputItemSet();
2493 if ( _xSection
.is() )
2495 const SfxPoolItem
* pItem
;
2496 if ( SfxItemState::SET
== pSet
->GetItemState( RPTUI_ID_BRUSH
,true,&pItem
))
2497 _xSection
->setBackColor(static_cast<const SvxBrushItem
*>(pItem
)->GetColor().GetColor());
2501 uno::Reference
< beans::XPropertySet
> xProp(getUsedStyle(m_xReportDefinition
),uno::UNO_QUERY_THROW
);
2502 const OUString
sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEPAGE
));
2503 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2504 const SfxPoolItem
* pItem
= NULL
;
2505 if ( SfxItemState::SET
== pSet
->GetItemState( RPTUI_ID_SIZE
,true,&pItem
))
2508 static_cast<const SvxSizeItem
*>(pItem
)->QueryValue(aValue
,MID_SIZE_SIZE
);
2509 xProp
->setPropertyValue(PROPERTY_PAPERSIZE
,aValue
);
2513 if ( SfxItemState::SET
== pSet
->GetItemState( RPTUI_ID_LRSPACE
,true,&pItem
))
2516 static_cast<const SvxLRSpaceItem
*>(pItem
)->QueryValue(aValue
,MID_L_MARGIN
);
2517 xProp
->setPropertyValue(PROPERTY_LEFTMARGIN
,aValue
);
2518 static_cast<const SvxLRSpaceItem
*>(pItem
)->QueryValue(aValue
,MID_R_MARGIN
);
2519 xProp
->setPropertyValue(PROPERTY_RIGHTMARGIN
,aValue
);
2521 if ( SfxItemState::SET
== pSet
->GetItemState( RPTUI_ID_ULSPACE
,true,&pItem
))
2523 xProp
->setPropertyValue(PROPERTY_TOPMARGIN
,uno::makeAny(static_cast<const SvxULSpaceItem
*>(pItem
)->GetUpper()));
2524 xProp
->setPropertyValue(PROPERTY_BOTTOMMARGIN
,uno::makeAny(static_cast<const SvxULSpaceItem
*>(pItem
)->GetLower()));
2526 if ( SfxItemState::SET
== pSet
->GetItemState( RPTUI_ID_PAGE
,true,&pItem
))
2528 const SvxPageItem
* pPageItem
= static_cast<const SvxPageItem
*>(pItem
);
2529 xProp
->setPropertyValue(PROPERTY_ISLANDSCAPE
,uno::makeAny(pPageItem
->IsLandscape()));
2530 xProp
->setPropertyValue(PROPERTY_NUMBERINGTYPE
,uno::makeAny(static_cast<sal_Int16
>(pPageItem
->GetNumType())));
2532 pPageItem
->QueryValue(aValue
,MID_PAGE_LAYOUT
);
2533 xProp
->setPropertyValue(PROPERTY_PAGESTYLELAYOUT
,aValue
);
2536 if ( SfxItemState::SET
== pSet
->GetItemState( RPTUI_ID_BRUSH
,true,&pItem
))
2538 ::Color aBackColor
= static_cast<const SvxBrushItem
*>(pItem
)->GetColor();
2539 xProp
->setPropertyValue(PROPERTY_BACKTRANSPARENT
,uno::makeAny(aBackColor
== COL_TRANSPARENT
));
2540 xProp
->setPropertyValue(PROPERTY_BACKCOLOR
,uno::makeAny(aBackColor
.GetColor()));
2546 catch(const Exception
&)
2548 DBG_UNHANDLED_EXCEPTION();
2550 SfxItemPool::Free(pPool
);
2552 for (sal_uInt16 i
=0; i
<sizeof(pDefaults
)/sizeof(pDefaults
[0]); ++i
)
2553 delete pDefaults
[i
];
2558 sal_Bool SAL_CALL
OReportController::attachModel(const uno::Reference
< frame::XModel
> & xModel
) throw( uno::RuntimeException
, std::exception
)
2560 ::osl::MutexGuard
aGuard( getMutex() );
2562 uno::Reference
< report::XReportDefinition
> xReportDefinition( xModel
, UNO_QUERY
);
2563 if ( !xReportDefinition
.is() )
2566 uno::Reference
< document::XUndoManagerSupplier
> xTestSuppUndo( xModel
, UNO_QUERY
);
2567 if ( !xTestSuppUndo
.is() )
2570 m_xReportDefinition
= xReportDefinition
;
2575 void OReportController::openSortingAndGroupingDialog()
2577 if ( !m_xReportDefinition
.is() )
2579 if ( !m_pGroupsFloater
)
2581 m_pGroupsFloater
= VclPtr
<OGroupsSortingDialog
>::Create(getView(),!isEditable(),this);
2582 SvtViewOptions
aDlgOpt(E_WINDOW
, OStringToOUString(m_pGroupsFloater
->GetHelpId(), RTL_TEXTENCODING_UTF8
));
2583 if ( aDlgOpt
.Exists() )
2584 m_pGroupsFloater
->SetWindowState(OUStringToOString(aDlgOpt
.GetWindowState(), RTL_TEXTENCODING_ASCII_US
));
2585 m_pGroupsFloater
->AddEventListener(LINK(this,OReportController
,EventLstHdl
));
2587 else if ( isUiVisible() )
2588 m_pGroupsFloater
->Show(!m_pGroupsFloater
->IsVisible());
2591 sal_Int32
OReportController::getGroupPosition(const uno::Reference
< report::XGroup
>& _xGroup
)
2593 return rptui::getPositionInIndexAccess(m_xReportDefinition
->getGroups().get(),_xGroup
);
2597 IMPL_LINK( OReportController
, EventLstHdl
, VclWindowEvent
*, _pEvent
)
2599 if ( _pEvent
&& _pEvent
->GetId() == VCLEVENT_WINDOW_CLOSE
)
2601 InvalidateFeature(SID_SORTINGANDGROUPING
);
2602 InvalidateFeature(SID_FM_ADD_FIELD
);
2603 InvalidateFeature(SID_RPT_SHOWREPORTEXPLORER
);
2608 void OReportController::Notify(SfxBroadcaster
& /* _rBc */, SfxHint
const & _rHint
)
2610 const DlgEdHint
* pDlgEdHint
= dynamic_cast<const DlgEdHint
*>(&_rHint
);
2611 if (pDlgEdHint
&& pDlgEdHint
->GetKind() == RPTUI_HINT_SELECTIONCHANGED
)
2613 const sal_Int32 nSelectionCount
= getDesignView()->getMarkedObjectCount();
2614 if ( m_nSelectionCount
!= nSelectionCount
)
2616 m_nSelectionCount
= nSelectionCount
;
2619 lang::EventObject
aEvent(*this);
2620 m_aSelectionListeners
.forEach
<view::XSelectionChangeListener
>(
2621 ::boost::bind(&view::XSelectionChangeListener::selectionChanged
,_1
,boost::cref(aEvent
)));
2626 void OReportController::executeMethodWithUndo(sal_uInt16 _nUndoStrId
,const ::std::mem_fun_t
<void,ODesignView
>& _pMemfun
)
2628 const OUString sUndoAction
= ModuleRes(_nUndoStrId
);
2629 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2630 _pMemfun( getDesignView() );
2631 InvalidateFeature( SID_SAVEDOC
);
2632 InvalidateFeature( SID_UNDO
);
2635 void OReportController::alignControlsWithUndo(sal_uInt16 _nUndoStrId
,sal_Int32 _nControlModification
,bool _bAlignAtSection
)
2637 const OUString sUndoAction
= ModuleRes(_nUndoStrId
);
2638 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2639 getDesignView()->alignMarkedObjects(_nControlModification
,_bAlignAtSection
);
2640 InvalidateFeature( SID_SAVEDOC
);
2641 InvalidateFeature( SID_UNDO
);
2644 void OReportController::shrinkSectionBottom(uno::Reference
<report::XSection
> _xSection
)
2646 const sal_Int32 nElements
= _xSection
->getCount();
2649 // there are no elements
2652 const sal_Int32 nSectionHeight
= _xSection
->getHeight();
2653 sal_Int32 nMaxPositionY
= 0;
2654 uno::Reference
< report::XReportComponent
> xReportComponent
;
2656 // for every component get its Y-position and compare it to the current Y-position
2657 for (int i
=0;i
<nElements
;i
++)
2659 xReportComponent
.set(_xSection
->getByIndex(i
), uno::UNO_QUERY
);
2660 const sal_Int32 nReportComponentPositionY
= xReportComponent
->getPositionY();
2661 const sal_Int32 nReportComponentHeight
= xReportComponent
->getHeight();
2662 const sal_Int32 nReportComponentPositionYAndHeight
= nReportComponentPositionY
+ nReportComponentHeight
;
2663 nMaxPositionY
= std::max(nReportComponentPositionYAndHeight
, nMaxPositionY
);
2665 // now we know the minimal Y-Position and maximal Y-Position
2667 if (nMaxPositionY
> (nSectionHeight
- 7) ) // Magic Number, we use a little bit less heights for right positioning
2669 // the lowest position is already 0
2672 _xSection
->setHeight(nMaxPositionY
);
2675 void OReportController::shrinkSectionTop(uno::Reference
<report::XSection
> _xSection
)
2677 const sal_Int32 nElements
= _xSection
->getCount();
2680 // there are no elements
2684 const sal_Int32 nSectionHeight
= _xSection
->getHeight();
2685 sal_Int32 nMinPositionY
= nSectionHeight
;
2686 uno::Reference
< report::XReportComponent
> xReportComponent
;
2688 // for every component get its Y-position and compare it to the current Y-position
2689 for (int i
=0;i
<nElements
;i
++)
2691 xReportComponent
.set(_xSection
->getByIndex(i
), uno::UNO_QUERY
);
2692 const sal_Int32 nReportComponentPositionY
= xReportComponent
->getPositionY();
2693 nMinPositionY
= std::min(nReportComponentPositionY
, nMinPositionY
);
2695 // now we know the minimal Y-Position and maximal Y-Position
2696 if (nMinPositionY
== 0)
2698 // the lowest position is already 0
2701 for (int i
=0;i
<nElements
;i
++)
2703 xReportComponent
.set(_xSection
->getByIndex(i
), uno::UNO_QUERY
);
2704 const sal_Int32 nReportComponentPositionY
= xReportComponent
->getPositionY();
2705 const sal_Int32 nNewPositionY
= nReportComponentPositionY
- nMinPositionY
;
2706 xReportComponent
->setPositionY(nNewPositionY
);
2708 const sal_Int32 nNewSectionHeight
= nSectionHeight
- nMinPositionY
;
2709 _xSection
->setHeight(nNewSectionHeight
);
2712 void OReportController::shrinkSection(sal_uInt16 _nUndoStrId
, uno::Reference
<report::XSection
> _xSection
, sal_Int32 _nSid
)
2714 if ( _xSection
.is() )
2716 const OUString sUndoAction
= ModuleRes(_nUndoStrId
);
2717 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
2719 if (_nSid
== SID_SECTION_SHRINK
)
2721 shrinkSectionTop(_xSection
);
2722 shrinkSectionBottom(_xSection
);
2724 else if (_nSid
== SID_SECTION_SHRINK_TOP
)
2726 shrinkSectionTop(_xSection
);
2728 else if (_nSid
== SID_SECTION_SHRINK_BOTTOM
)
2730 shrinkSectionBottom(_xSection
);
2734 InvalidateFeature( SID_SAVEDOC
);
2735 InvalidateFeature( SID_UNDO
);
2739 uno::Any SAL_CALL
OReportController::getViewData() throw( uno::RuntimeException
, std::exception
)
2741 ::osl::MutexGuard
aGuard( getMutex() );
2743 sal_Int32 nCommandIDs
[] =
2749 SID_SHOW_PROPERTYBROWSER
,
2750 SID_PROPERTYBROWSER_LAST_PAGE
,
2754 ::comphelper::NamedValueCollection aCommandProperties
;
2755 for ( size_t i
=0; i
< sizeof (nCommandIDs
) / sizeof (nCommandIDs
[0]); ++i
)
2757 const FeatureState aFeatureState
= GetState( nCommandIDs
[i
] );
2759 OUString
sCommandURL( getURLForId( nCommandIDs
[i
] ).Main
);
2760 OSL_ENSURE( sCommandURL
.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" );
2761 sCommandURL
= sCommandURL
.copy( 5 );
2764 if ( !!aFeatureState
.bChecked
)
2765 aCommandState
<<= (*aFeatureState
.bChecked
) ? sal_True
: sal_False
;
2766 else if ( aFeatureState
.aValue
.hasValue() )
2767 aCommandState
= aFeatureState
.aValue
;
2769 aCommandProperties
.put( sCommandURL
, aCommandState
);
2772 ::comphelper::NamedValueCollection aViewData
;
2773 aViewData
.put( "CommandProperties", aCommandProperties
.getPropertyValues() );
2775 if ( getDesignView() )
2777 ::std::vector
<sal_uInt16
> aCollapsedPositions
;
2778 getDesignView()->fillCollapsedSections(aCollapsedPositions
);
2779 if ( !aCollapsedPositions
.empty() )
2781 uno::Sequence
<beans::PropertyValue
> aCollapsedSections(aCollapsedPositions
.size());
2782 beans::PropertyValue
* pCollapsedIter
= aCollapsedSections
.getArray();
2783 ::std::vector
<sal_uInt16
>::iterator aIter
= aCollapsedPositions
.begin();
2784 ::std::vector
<sal_uInt16
>::iterator aEnd
= aCollapsedPositions
.end();
2785 for (sal_Int32 i
= 1; aIter
!= aEnd
; ++aIter
,++pCollapsedIter
,++i
)
2787 pCollapsedIter
->Name
= PROPERTY_SECTION
+ OUString::number(i
);
2788 pCollapsedIter
->Value
<<= static_cast<sal_Int32
>(*aIter
);
2791 aViewData
.put( "CollapsedSections", aCollapsedSections
);
2794 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
2795 if ( pSectionWindow
)
2797 aViewData
.put( "MarkedSection", (sal_Int32
)pSectionWindow
->getReportSection().getPage()->GetPageNum() );
2801 aViewData
.put( "ZoomFactor", m_nZoomValue
);
2802 return uno::makeAny( aViewData
.getPropertyValues() );
2805 void SAL_CALL
OReportController::restoreViewData(const uno::Any
& i_data
) throw( uno::RuntimeException
, std::exception
)
2807 ::osl::MutexGuard
aGuard( getMutex() );
2811 const ::comphelper::NamedValueCollection
aViewData( i_data
);
2813 m_aCollapsedSections
= aViewData
.getOrDefault( "CollapsedSections", m_aCollapsedSections
);
2814 m_nPageNum
= aViewData
.getOrDefault( "MarkedSection", m_nPageNum
);
2815 m_nZoomValue
= aViewData
.getOrDefault( "ZoomFactor", m_nZoomValue
);
2816 // TODO: setting those 3 members is not enough - in theory, restoreViewData can be called when the
2817 // view is fully alive, so we need to reflect those 3 values in the view.
2818 // (At the moment, the method is called only during construction phase)
2821 ::comphelper::NamedValueCollection
aCommandProperties( aViewData
.get( "CommandProperties" ) );
2822 const ::std::vector
< OUString
> aCommandNames( aCommandProperties
.getNames() );
2824 for ( ::std::vector
< OUString
>::const_iterator commandName
= aCommandNames
.begin();
2825 commandName
!= aCommandNames
.end();
2829 const Any
& rCommandValue
= aCommandProperties
.get( *commandName
);
2830 if ( !rCommandValue
.hasValue() )
2836 aCommand
.Complete
= ".uno:" + *commandName
;
2838 Sequence
< PropertyValue
> aCommandArgs(1);
2839 aCommandArgs
[0].Name
= "Value";
2840 aCommandArgs
[0].Value
= rCommandValue
;
2842 executeUnChecked( aCommand
, aCommandArgs
);
2846 if ( *commandName
== "ShowRuler" )
2847 OSL_VERIFY( rCommandValue
>>= m_bShowRuler
);
2848 else if ( *commandName
== "HelplinesMove" )
2849 OSL_VERIFY( rCommandValue
>>= m_bHelplinesMove
);
2850 else if ( *commandName
== "GridVisible" )
2851 OSL_VERIFY( rCommandValue
>>= m_bGridVisible
);
2852 else if ( *commandName
== "GridUse" )
2853 OSL_VERIFY( rCommandValue
>>= m_bGridUse
);
2854 else if ( *commandName
== "ControlProperties" )
2855 OSL_VERIFY( rCommandValue
>>= m_bShowProperties
);
2856 else if ( *commandName
== "LastPropertyBrowserPage" )
2857 OSL_VERIFY( rCommandValue
>>= m_sLastActivePage
);
2858 else if ( *commandName
== "SplitPosition" )
2859 OSL_VERIFY( rCommandValue
>>= m_nSplitPos
);
2863 catch(const IllegalArgumentException
&)
2865 DBG_UNHANDLED_EXCEPTION();
2869 void OReportController::updateFloater()
2871 if ( m_pGroupsFloater
&& m_pGroupsFloater
->IsVisible() )
2872 m_pGroupsFloater
->UpdateData();
2876 Reference
<XFrame
> OReportController::getXFrame()
2878 if ( !m_xFrameLoader
.is() )
2880 m_xFrameLoader
.set( frame::Desktop::create(m_xContext
) );
2882 const sal_Int32 nFrameSearchFlag
= frame::FrameSearchFlag::TASKS
| frame::FrameSearchFlag::CREATE
;
2883 const OUString
sTarget("_blank");
2884 Reference
<XFrame
> xFrame
= m_xFrameLoader
->findFrame(sTarget
,nFrameSearchFlag
);
2889 uno::Reference
<frame::XModel
> OReportController::executeReport()
2891 OSL_ENSURE(m_xReportDefinition
.is(),"Where is my report?");
2893 uno::Reference
<frame::XModel
> xModel
;
2894 if ( m_xReportDefinition
.is() )
2896 sal_uInt16 nErrorId
= RID_ERR_NO_COMMAND
;
2897 bool bEnabled
= !m_xReportDefinition
->getCommand().isEmpty();
2901 const sal_uInt16 nCount
= m_aReportModel
->GetPageCount();
2903 for (; i
< nCount
&& !bEnabled
; ++i
)
2905 const SdrPage
* pPage
= m_aReportModel
->GetPage(i
);
2906 bEnabled
= pPage
->GetObjCount() != 0;
2909 nErrorId
= RID_ERR_NO_OBJECTS
;
2912 dbtools::SQLExceptionInfo aInfo
;
2915 sdb::SQLContext aFirstMessage
;
2916 OUString sInfo
= ModuleRes( nErrorId
);
2917 aFirstMessage
.Message
= sInfo
;
2918 aInfo
= aFirstMessage
;
2921 sal_uInt16 nCommand
= 0;
2922 if ( nErrorId
== RID_ERR_NO_COMMAND
)
2924 if ( !m_bShowProperties
)
2925 executeUnChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
2927 m_sLastActivePage
= "Data";
2928 getDesignView()->setCurrentPage(m_sLastActivePage
);
2929 nCommand
= SID_SELECT_REPORT
;
2931 else if ( getDesignView() && !getDesignView()->isAddFieldVisible() )
2933 nCommand
= SID_FM_ADD_FIELD
;
2937 uno::Sequence
< beans::PropertyValue
> aArgs
;
2938 executeUnChecked(nCommand
,aArgs
);
2944 m_bInGeneratePreview
= true;
2947 WaitObject
aWait(getView()); // cursor
2948 if ( !m_xReportEngine
.is() )
2949 m_xReportEngine
.set( report::ReportEngine::create(m_xContext
) );
2950 m_xReportEngine
->setReportDefinition(m_xReportDefinition
);
2951 m_xReportEngine
->setActiveConnection(getConnection());
2952 Reference
<XFrame
> xFrame
= getXFrame();
2953 xModel
= m_xReportEngine
->createDocumentAlive(xFrame
);
2955 catch(const sdbc::SQLException
&)
2956 { // SQLExceptions and derived exceptions must not be translated
2957 aInfo
= ::cppu::getCaughtException();
2959 catch(const uno::Exception
& e
)
2961 uno::Any
aCaughtException( ::cppu::getCaughtException() );
2963 // our first message says: we caught an exception
2964 sdb::SQLContext aFirstMessage
;
2965 OUString
sInfo(ModuleRes(RID_STR_CAUGHT_FOREIGN_EXCEPTION
).toString());
2966 sInfo
= sInfo
.replaceAll("$type$", aCaughtException
.getValueTypeName());
2967 aFirstMessage
.Message
= sInfo
;
2969 // our second message: the message of the exception we caught
2970 sdbc::SQLException aSecondMessage
;
2971 aSecondMessage
.Message
= e
.Message
;
2972 aSecondMessage
.Context
= e
.Context
;
2974 // maybe our third message: the message which is wrapped in the exception we caught
2975 sdbc::SQLException aThirdMessage
;
2976 lang::WrappedTargetException aWrapped
;
2977 if ( aCaughtException
>>= aWrapped
)
2979 aThirdMessage
.Message
= aWrapped
.Message
;
2980 aThirdMessage
.Context
= aWrapped
.Context
;
2983 if ( !aThirdMessage
.Message
.isEmpty() )
2984 aSecondMessage
.NextException
<<= aThirdMessage
;
2985 aFirstMessage
.NextException
<<= aSecondMessage
;
2987 aInfo
= aFirstMessage
;
2989 if (aInfo
.isValid())
2991 const OUString suSQLContext
= ModuleRes( RID_STR_COULD_NOT_CREATE_REPORT
);
2992 aInfo
.prepend(suSQLContext
);
2994 m_bInGeneratePreview
= false;
2997 if (aInfo
.isValid())
3005 uno::Reference
< frame::XModel
> SAL_CALL
OReportController::getModel() throw( uno::RuntimeException
, std::exception
)
3007 return m_xReportDefinition
.get();
3010 uno::Reference
< sdbc::XRowSet
> OReportController::getRowSet()
3012 OSL_PRECOND( m_xReportDefinition
.is(), "OReportController::getRowSet: no report definition?!" );
3014 if ( m_xRowSet
.is() || !m_xReportDefinition
.is() )
3019 uno::Reference
< sdbc::XRowSet
> xRowSet(
3020 getORB()->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", getORB()),
3022 uno::Reference
< beans::XPropertySet
> xRowSetProp( xRowSet
, uno::UNO_QUERY_THROW
);
3024 xRowSetProp
->setPropertyValue( PROPERTY_ACTIVECONNECTION
, uno::makeAny( getConnection() ) );
3025 xRowSetProp
->setPropertyValue( PROPERTY_APPLYFILTER
, uno::makeAny( sal_True
) );
3027 ::boost::shared_ptr
<AnyConverter
> aNoConverter(new AnyConverter());
3028 TPropertyNamePair aPropertyMediation
;
3029 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND
, TPropertyConverter(PROPERTY_COMMAND
,aNoConverter
) ) );
3030 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE
, TPropertyConverter(PROPERTY_COMMANDTYPE
,aNoConverter
) ) );
3031 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING
, TPropertyConverter(PROPERTY_ESCAPEPROCESSING
,aNoConverter
) ) );
3032 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_FILTER
, TPropertyConverter(PROPERTY_FILTER
,aNoConverter
) ) );
3034 m_xRowSetMediator
= new OPropertyMediator( m_xReportDefinition
.get(), xRowSetProp
, aPropertyMediation
);
3035 m_xRowSet
= xRowSet
;
3037 catch(const uno::Exception
&)
3039 DBG_UNHANDLED_EXCEPTION();
3045 void OReportController::insertGraphic()
3047 const OUString
sTitle(ModuleRes(RID_STR_IMPORT_GRAPHIC
));
3048 // build some arguments for the upcoming dialog
3051 uno::Reference
< report::XSection
> xSection
= getDesignView()->getCurrentSection();
3052 ::sfx2::FileDialogHelper
aDialog( ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW
, SFXWB_GRAPHIC
);
3053 aDialog
.SetTitle( sTitle
);
3055 uno::Reference
< ui::dialogs::XFilePickerControlAccess
> xController(aDialog
.GetFilePicker(), UNO_QUERY_THROW
);
3056 xController
->setValue(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW
, 0, css::uno::Any(true));
3057 xController
->enableControl(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, sal_False
/*sal_True*/);
3058 xController
->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0, css::uno::Any(true) );
3060 if ( ERRCODE_NONE
== aDialog
.Execute() )
3063 xController
->getValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0) >>= bLink
;
3064 uno::Sequence
<beans::PropertyValue
> aArgs(2);
3065 aArgs
[0].Name
= PROPERTY_IMAGEURL
;
3066 aArgs
[0].Value
<<= OUString(aDialog
.GetPath());
3067 aArgs
[1].Name
= PROPERTY_PRESERVEIRI
;
3068 aArgs
[1].Value
<<= bLink
;
3069 createControl(aArgs
,xSection
,OUString(),OBJ_DLG_IMAGECONTROL
);
3072 catch(const Exception
&)
3074 DBG_UNHANDLED_EXCEPTION();
3079 sal_Bool SAL_CALL
OReportController::select( const Any
& aSelection
) throw (IllegalArgumentException
, RuntimeException
, std::exception
)
3081 ::osl::MutexGuard
aGuard( getMutex() );
3083 if ( getDesignView() )
3085 getDesignView()->unmarkAllObjects(NULL
);
3086 getDesignView()->SetMode(RPTUI_SELECT
);
3088 uno::Sequence
< uno::Reference
<report::XReportComponent
> > aElements
;
3089 if ( aSelection
>>= aElements
)
3091 if ( aElements
.getLength() > 0 )
3092 getDesignView()->showProperties(uno::Reference
<uno::XInterface
>(aElements
[0],uno::UNO_QUERY
));
3093 getDesignView()->setMarked(aElements
, true);
3097 uno::Reference
<uno::XInterface
> xObject(aSelection
,uno::UNO_QUERY
);
3098 uno::Reference
<report::XReportComponent
> xProp(xObject
,uno::UNO_QUERY
);
3101 getDesignView()->showProperties(xObject
);
3102 aElements
.realloc(1);
3103 aElements
[0] = xProp
;
3104 getDesignView()->setMarked(aElements
, true);
3108 uno::Reference
<report::XSection
> xSection(aSelection
,uno::UNO_QUERY
);
3109 if ( !xSection
.is() && xObject
.is() )
3110 getDesignView()->showProperties(xObject
);
3111 getDesignView()->setMarked(xSection
,xSection
.is());
3119 Any SAL_CALL
OReportController::getSelection( ) throw (RuntimeException
, std::exception
)
3121 ::osl::MutexGuard
aGuard( getMutex() );
3123 if ( getDesignView() )
3125 aRet
= getDesignView()->getCurrentlyShownProperty();
3126 if ( !aRet
.hasValue() )
3127 aRet
<<= getDesignView()->getCurrentSection();
3132 void SAL_CALL
OReportController::addSelectionChangeListener( const Reference
< view::XSelectionChangeListener
>& _Listener
) throw (RuntimeException
, std::exception
)
3134 m_aSelectionListeners
.addInterface( _Listener
);
3137 void SAL_CALL
OReportController::removeSelectionChangeListener( const Reference
< view::XSelectionChangeListener
>& _Listener
) throw (RuntimeException
, std::exception
)
3139 m_aSelectionListeners
.removeInterface( _Listener
);
3142 void OReportController::createNewFunction(const uno::Any
& _aValue
)
3144 uno::Reference
< container::XIndexContainer
> xFunctions(_aValue
,uno::UNO_QUERY_THROW
);
3145 const OUString sNewName
= ModuleRes(RID_STR_FUNCTION
);
3146 uno::Reference
< report::XFunction
> xFunction(report::Function::create(m_xContext
));
3147 xFunction
->setName(sNewName
);
3148 // the call below will also create an undo action -> listener
3149 xFunctions
->insertByIndex(xFunctions
->getCount(),uno::makeAny(xFunction
));
3152 IMPL_LINK_NOARG( OReportController
, OnExecuteReport
)
3158 void OReportController::createControl(const Sequence
< PropertyValue
>& _aArgs
,const uno::Reference
< report::XSection
>& _xSection
,const OUString
& _sFunction
,sal_uInt16 _nObjectId
)
3160 SequenceAsHashMap
aMap(_aArgs
);
3161 getDesignView()->setMarked(_xSection
, true);
3162 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
3163 if ( !pSectionWindow
)
3166 OSL_ENSURE(pSectionWindow
->getReportSection().getSection() == _xSection
,"Invalid section after marking the corrct one.");
3168 sal_Int32 nLeftMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
);
3169 const sal_Int32 nRightMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
);
3170 const sal_Int32 nPaperWidth
= getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
).Width
- nRightMargin
;
3171 awt::Point aPos
= aMap
.getUnpackedValueOrDefault(PROPERTY_POSITION
,awt::Point(nLeftMargin
,0));
3172 if ( aPos
.X
< nLeftMargin
)
3173 aPos
.X
= nLeftMargin
;
3175 SdrObject
* pNewControl
= NULL
;
3176 uno::Reference
< report::XReportComponent
> xShapeProp
;
3177 if ( _nObjectId
== OBJ_CUSTOMSHAPE
)
3179 pNewControl
= SdrObjFactory::MakeNewObject( ReportInventor
, _nObjectId
, pSectionWindow
->getReportSection().getPage(),m_aReportModel
.get() );
3180 xShapeProp
.set(pNewControl
->getUnoShape(),uno::UNO_QUERY
);
3181 OUString sCustomShapeType
= getDesignView()->GetInsertObjString();
3182 if ( sCustomShapeType
.isEmpty() )
3183 sCustomShapeType
= "diamond";
3184 OReportSection::createDefault(sCustomShapeType
,pNewControl
);
3185 pNewControl
->SetLogicRect(Rectangle(3000,500,6000,3500)); // switch height and width
3187 else if ( _nObjectId
== OBJ_OLE2
|| OBJ_DLG_SUBREPORT
== _nObjectId
)
3189 pNewControl
= SdrObjFactory::MakeNewObject( ReportInventor
, _nObjectId
, pSectionWindow
->getReportSection().getPage(),m_aReportModel
.get() );
3191 pNewControl
->SetLogicRect(Rectangle(3000,500,8000,5500)); // switch height and width
3192 xShapeProp
.set(pNewControl
->getUnoShape(),uno::UNO_QUERY_THROW
);
3193 OOle2Obj
* pObj
= dynamic_cast<OOle2Obj
*>(pNewControl
);
3194 if ( pObj
&& !pObj
->IsEmpty() )
3196 pObj
->initializeChart(getModel());
3201 SdrUnoObj
* pLabel( NULL
);
3202 SdrUnoObj
* pControl( NULL
);
3203 FmFormView::createControlLabelPair( getDesignView()
3205 ,NULL
,NULL
,_nObjectId
,OUString(),ReportInventor
,OBJ_DLG_FIXEDTEXT
,
3206 NULL
,pSectionWindow
->getReportSection().getPage(),m_aReportModel
.get(),
3210 pNewControl
= pControl
;
3211 OUnoObject
* pObj
= dynamic_cast<OUnoObject
*>(pControl
);
3215 uno::Reference
<beans::XPropertySet
> xUnoProp(pObj
->GetUnoControlModel(),uno::UNO_QUERY
);
3216 xShapeProp
.set(pObj
->getUnoShape(),uno::UNO_QUERY
);
3217 uno::Reference
<beans::XPropertySetInfo
> xShapeInfo
= xShapeProp
->getPropertySetInfo();
3218 uno::Reference
<beans::XPropertySetInfo
> xInfo
= xUnoProp
->getPropertySetInfo();
3220 const OUString sProps
[] = { OUString(PROPERTY_NAME
)
3221 ,OUString(PROPERTY_FONTDESCRIPTOR
)
3222 ,OUString(PROPERTY_FONTDESCRIPTORASIAN
)
3223 ,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX
)
3224 ,OUString(PROPERTY_ORIENTATION
)
3225 ,OUString(PROPERTY_BORDER
)
3226 ,OUString(PROPERTY_FORMATSSUPPLIER
)
3227 ,OUString(PROPERTY_BACKGROUNDCOLOR
)
3229 for(size_t i
= 0; i
< sizeof (sProps
) / sizeof (sProps
[0]); ++i
)
3231 if ( xInfo
->hasPropertyByName(sProps
[i
]) && xShapeInfo
->hasPropertyByName(sProps
[i
]) )
3232 xUnoProp
->setPropertyValue(sProps
[i
],xShapeProp
->getPropertyValue(sProps
[i
]));
3235 if ( xInfo
->hasPropertyByName(PROPERTY_BORDER
) && xShapeInfo
->hasPropertyByName(PROPERTY_CONTROLBORDER
) )
3236 xUnoProp
->setPropertyValue(PROPERTY_BORDER
,xShapeProp
->getPropertyValue(PROPERTY_CONTROLBORDER
));
3239 if ( xInfo
->hasPropertyByName(PROPERTY_DATAFIELD
) && !_sFunction
.isEmpty() )
3241 ReportFormula
aFunctionFormula( ReportFormula::Expression
, _sFunction
);
3242 xUnoProp
->setPropertyValue( PROPERTY_DATAFIELD
, uno::makeAny( aFunctionFormula
.getCompleteFormula() ) );
3245 sal_Int32 nFormatKey
= aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEY
,sal_Int32(0));
3246 if ( nFormatKey
&& xInfo
->hasPropertyByName(PROPERTY_FORMATKEY
) )
3247 xUnoProp
->setPropertyValue( PROPERTY_FORMATKEY
, uno::makeAny( nFormatKey
) );
3249 OUString sUrl
= aMap
.getUnpackedValueOrDefault(PROPERTY_IMAGEURL
,OUString());
3250 if ( !sUrl
.isEmpty() && xInfo
->hasPropertyByName(PROPERTY_IMAGEURL
) )
3251 xUnoProp
->setPropertyValue( PROPERTY_IMAGEURL
, uno::makeAny( sUrl
) );
3253 pObj
->CreateMediator(true);
3255 if ( _nObjectId
== OBJ_DLG_FIXEDTEXT
) // special case for fixed text
3256 xUnoProp
->setPropertyValue(PROPERTY_LABEL
,uno::makeAny(OUnoObject::GetDefaultName(pObj
)));
3257 else if ( _nObjectId
== OBJ_DLG_VFIXEDLINE
)
3259 awt::Size aOlSize
= xShapeProp
->getSize();
3260 xShapeProp
->setSize(awt::Size(aOlSize
.Height
,aOlSize
.Width
)); // switch height and width
3265 const sal_Int32 nShapeWidth
= aMap
.getUnpackedValueOrDefault(PROPERTY_WIDTH
,xShapeProp
->getWidth());
3266 if ( nShapeWidth
!= xShapeProp
->getWidth() )
3267 xShapeProp
->setWidth( nShapeWidth
);
3269 const bool bChangedPos
= (aPos
.X
+ nShapeWidth
) > nPaperWidth
;
3271 aPos
.X
= nPaperWidth
- nShapeWidth
;
3272 xShapeProp
->setPosition(aPos
);
3274 correctOverlapping(pNewControl
,pSectionWindow
->getReportSection());
3277 void OReportController::createDateTime(const Sequence
< PropertyValue
>& _aArgs
)
3279 getDesignView()->unmarkAllObjects(NULL
);
3281 const OUString
sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL
));
3282 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
3284 SequenceAsHashMap
aMap(_aArgs
);
3285 aMap
.createItemIfMissing(PROPERTY_FORMATKEY
,aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE
,sal_Int32(0)));
3287 uno::Reference
< report::XSection
> xSection
= aMap
.getUnpackedValueOrDefault(PROPERTY_SECTION
,uno::Reference
< report::XSection
>());
3290 bool bDate
= aMap
.getUnpackedValueOrDefault(PROPERTY_DATE_STATE
, false);
3293 sFunction
= "TODAY()";
3294 createControl(aMap
.getAsConstPropertyValueList(),xSection
,sFunction
);
3296 bool bTime
= aMap
.getUnpackedValueOrDefault(PROPERTY_TIME_STATE
, false);
3299 sFunction
= "TIMEVALUE(NOW())";
3300 aMap
[PROPERTY_FORMATKEY
] <<= aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME
,sal_Int32(0));
3301 createControl(aMap
.getAsConstPropertyValueList(),xSection
,sFunction
);
3305 void OReportController::createPageNumber(const Sequence
< PropertyValue
>& _aArgs
)
3307 getDesignView()->unmarkAllObjects(NULL
);
3309 const OUString
sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL
));
3310 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
3312 if ( !m_xReportDefinition
->getPageHeaderOn() )
3314 uno::Sequence
< beans::PropertyValue
> aArgs
;
3315 executeChecked(SID_PAGEHEADERFOOTER
,aArgs
);
3318 SequenceAsHashMap
aMap(_aArgs
);
3319 bool bStateOfPage
= aMap
.getUnpackedValueOrDefault(PROPERTY_STATE
, false);
3321 OUString
sFunction( ModuleRes(STR_RPT_PN_PAGE
).toString() );
3322 sFunction
= sFunction
.replaceFirst("#PAGENUMBER#", "PageNumber()");
3326 sFunction
+= ModuleRes(STR_RPT_PN_PAGE_OF
).toString();
3327 sFunction
= sFunction
.replaceFirst("#PAGECOUNT#", "PageCount()");
3330 bool bInPageHeader
= aMap
.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON
, true);
3331 createControl(_aArgs
,bInPageHeader
? m_xReportDefinition
->getPageHeader() : m_xReportDefinition
->getPageFooter(),sFunction
);
3335 void OReportController::addPairControls(const Sequence
< PropertyValue
>& aArgs
)
3337 getDesignView()->unmarkAllObjects(NULL
);
3339 // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird
3340 OSectionWindow
* pSectionWindow
[2];
3341 pSectionWindow
[0] = getDesignView()->getMarkedSection();
3343 if ( !pSectionWindow
[0] )
3345 select(uno::makeAny(m_xReportDefinition
->getDetail()));
3346 pSectionWindow
[0] = getDesignView()->getMarkedSection();
3347 if ( !pSectionWindow
[0] )
3351 uno::Reference
<report::XSection
> xCurrentSection
= getDesignView()->getCurrentSection();
3352 UndoContext
aUndoContext( getUndoManager(), OUString( ModuleRes( RID_STR_UNDO_INSERT_CONTROL
) ) );
3356 bool bHandleOnlyOne
= false;
3357 const PropertyValue
* pIter
= aArgs
.getConstArray();
3358 const PropertyValue
* pEnd
= pIter
+ aArgs
.getLength();
3359 for(;pIter
!= pEnd
&& !bHandleOnlyOne
;++pIter
)
3361 Sequence
< PropertyValue
> aValue
;
3362 if ( !(pIter
->Value
>>= aValue
) )
3363 { // the sequence has only one element which already contains the descriptor
3364 bHandleOnlyOne
= true;
3367 svx::ODataAccessDescriptor
aDescriptor(aValue
);
3368 SequenceAsHashMap
aMap(aValue
);
3369 uno::Reference
<report::XSection
> xSection
= aMap
.getUnpackedValueOrDefault("Section",xCurrentSection
);
3370 uno::Reference
<report::XReportDefinition
> xReportDefinition
= xSection
->getReportDefinition();
3372 getDesignView()->setMarked(xSection
, true);
3373 pSectionWindow
[0] = getDesignView()->getMarkedSection();
3375 sal_Int32 nLeftMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
);
3376 awt::Point aPos
= aMap
.getUnpackedValueOrDefault(PROPERTY_POSITION
,awt::Point(nLeftMargin
,0));
3377 if ( aPos
.X
< nLeftMargin
)
3378 aPos
.X
= nLeftMargin
;
3380 // LLA: new feature, add the Label in dependency of the given DND_ACTION one section up, normal or one section down
3381 sal_Int8 nDNDAction
= aMap
.getUnpackedValueOrDefault("DNDAction", sal_Int8(0));
3382 pSectionWindow
[1] = pSectionWindow
[0];
3383 bool bLabelAboveTextField
= nDNDAction
== DND_ACTION_COPY
;
3384 if ( bLabelAboveTextField
|| nDNDAction
== DND_ACTION_LINK
)
3386 // Add the Label one Section up
3387 pSectionWindow
[1] = getDesignView()->getMarkedSection(bLabelAboveTextField
? PREVIOUS
: POST
);
3388 if (!pSectionWindow
[1])
3390 // maybe out of bounds
3391 pSectionWindow
[1] = pSectionWindow
[0];
3394 // clear all selections
3395 getDesignView()->unmarkAllObjects(NULL
);
3397 uno::Reference
< beans::XPropertySet
> xField( aDescriptor
[ svx::daColumnObject
], uno::UNO_QUERY
);
3398 uno::Reference
< lang::XComponent
> xHoldAlive
;
3402 OUString sColumnName
;
3403 sal_Int32
nCommandType( -1 );
3404 OSL_VERIFY( aDescriptor
[ svx::daCommand
] >>= sCommand
);
3405 OSL_VERIFY( aDescriptor
[ svx::daColumnName
] >>= sColumnName
);
3406 OSL_VERIFY( aDescriptor
[ svx::daCommandType
] >>= nCommandType
);
3408 uno::Reference
< container::XNameAccess
> xColumns
;
3409 uno::Reference
< sdbc::XConnection
> xConnection( getConnection() );
3410 if ( !sCommand
.isEmpty() && nCommandType
!= -1 && !sColumnName
.isEmpty() && xConnection
.is() )
3412 if ( xReportDefinition
->getCommand().isEmpty() )
3414 xReportDefinition
->setCommand(sCommand
);
3415 xReportDefinition
->setCommandType(nCommandType
);
3418 xColumns
= dbtools::getFieldsByCommandDescriptor(xConnection
,nCommandType
,sCommand
,xHoldAlive
);
3419 if ( xColumns
.is() && xColumns
->hasByName(sColumnName
) )
3420 xField
.set( xColumns
->getByName( sColumnName
), uno::UNO_QUERY
);
3425 #if OSL_DEBUG_LEVEL > 0
3428 uno::Reference
< beans::XPropertySet
> xRowSetProps( getRowSet(), UNO_QUERY_THROW
);
3429 OUString sRowSetCommand
;
3430 sal_Int32
nRowSetCommandType( -1 );
3431 OSL_VERIFY( xRowSetProps
->getPropertyValue( PROPERTY_COMMAND
) >>= sRowSetCommand
);
3432 OSL_VERIFY( xRowSetProps
->getPropertyValue( PROPERTY_COMMANDTYPE
) >>= nRowSetCommandType
);
3433 OSL_ENSURE( ( sRowSetCommand
== sCommand
) && ( nCommandType
== nRowSetCommandType
),
3434 "OReportController::addPairControls: this only works for a data source which equals our current settings!" );
3435 // if this asserts, then either our row set and our report definition are not in sync, or somebody
3436 // requested the creation of a control/pair for another data source than what our report
3437 // definition is bound to - which is not supported for the parameters case, since we
3438 // can retrieve parameters from the RowSet only.
3440 catch(const Exception
&)
3442 DBG_UNHANDLED_EXCEPTION();
3446 // no column name - perhaps a parameter name?
3447 uno::Reference
< sdb::XParametersSupplier
> xSuppParam( getRowSet(), uno::UNO_QUERY_THROW
);
3448 uno::Reference
< container::XIndexAccess
> xParams( xSuppParam
->getParameters(), uno::UNO_QUERY_THROW
);
3449 sal_Int32
nParamCount( xParams
->getCount() );
3450 for ( sal_Int32 i
=0; i
<nParamCount
; ++i
)
3452 uno::Reference
< beans::XPropertySet
> xParamCol( xParams
->getByIndex(i
), uno::UNO_QUERY_THROW
);
3453 OUString sParamName
;
3454 OSL_VERIFY( xParamCol
->getPropertyValue("Name") >>= sParamName
);
3455 if ( sParamName
== sColumnName
)
3466 sal_uInt16 nOBJID
= 0;
3467 sal_Int32 nDataType
= sdbc::DataType::BINARY
;
3468 xField
->getPropertyValue(PROPERTY_TYPE
) >>= nDataType
;
3469 switch ( nDataType
)
3471 case sdbc::DataType::BINARY
:
3472 case sdbc::DataType::VARBINARY
:
3473 case sdbc::DataType::LONGVARBINARY
:
3474 nOBJID
= OBJ_DLG_IMAGECONTROL
;
3477 nOBJID
= OBJ_DLG_FORMATTEDFIELD
;
3484 Reference
< util::XNumberFormatsSupplier
> xSupplier
= getReportNumberFormatter()->getNumberFormatsSupplier();
3485 if ( !xSupplier
.is() )
3488 Reference
< XNumberFormats
> xNumberFormats(xSupplier
->getNumberFormats());
3489 SdrUnoObj
* pControl
[2];
3492 const sal_Int32 nRightMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
);
3493 const sal_Int32 nPaperWidth
= getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
).Width
- nRightMargin
;
3494 OSectionView
* pSectionViews
[2];
3495 pSectionViews
[0] = &pSectionWindow
[1]->getReportSection().getSectionView();
3496 pSectionViews
[1] = &pSectionWindow
[0]->getReportSection().getSectionView();
3498 FmFormView::createControlLabelPair( getDesignView()
3500 ,xField
,xNumberFormats
,nOBJID
,OUString(),ReportInventor
,OBJ_DLG_FIXEDTEXT
,
3501 pSectionWindow
[1]->getReportSection().getPage(),pSectionWindow
[0]->getReportSection().getPage(),m_aReportModel
.get(),
3502 pControl
[0],pControl
[1]);
3503 if ( pControl
[0] && pControl
[1] )
3505 SdrPageView
* pPgViews
[2];
3506 pPgViews
[0] = pSectionViews
[0]->GetSdrPageView();
3507 pPgViews
[1] = pSectionViews
[1]->GetSdrPageView();
3508 if ( pPgViews
[0] && pPgViews
[1] )
3510 OUString sDefaultName
;
3512 OUnoObject
* pObjs
[2];
3513 for(i
= 0; i
< sizeof(pControl
)/sizeof(pControl
[0]);++i
)
3515 pObjs
[i
] = dynamic_cast<OUnoObject
*>(pControl
[i
]);
3516 uno::Reference
<beans::XPropertySet
> xUnoProp(pObjs
[i
]->GetUnoControlModel(),uno::UNO_QUERY_THROW
);
3517 uno::Reference
< report::XReportComponent
> xShapeProp(pObjs
[i
]->getUnoShape(),uno::UNO_QUERY_THROW
);
3518 xUnoProp
->setPropertyValue(PROPERTY_NAME
,xShapeProp
->getPropertyValue(PROPERTY_NAME
));
3520 uno::Reference
<beans::XPropertySetInfo
> xShapeInfo
= xShapeProp
->getPropertySetInfo();
3521 uno::Reference
<beans::XPropertySetInfo
> xInfo
= xUnoProp
->getPropertySetInfo();
3522 const OUString sProps
[] = { OUString(PROPERTY_FONTDESCRIPTOR
)
3523 ,OUString(PROPERTY_FONTDESCRIPTORASIAN
)
3524 ,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX
)
3525 ,OUString(PROPERTY_BORDER
)
3526 ,OUString(PROPERTY_BACKGROUNDCOLOR
)
3528 for(size_t k
= 0; k
< sizeof(sProps
)/sizeof(sProps
[0]);++k
)
3530 if ( xInfo
->hasPropertyByName(sProps
[k
]) && xShapeInfo
->hasPropertyByName(sProps
[k
]) )
3531 xUnoProp
->setPropertyValue(sProps
[k
],xShapeProp
->getPropertyValue(sProps
[k
]));
3533 if ( xInfo
->hasPropertyByName(PROPERTY_DATAFIELD
) )
3536 xUnoProp
->getPropertyValue(PROPERTY_DATAFIELD
) >>= sName
;
3537 sDefaultName
= sName
;
3538 xUnoProp
->setPropertyValue(PROPERTY_NAME
,uno::makeAny(sDefaultName
));
3540 ReportFormula
aFormula( ReportFormula::Field
, sName
);
3541 xUnoProp
->setPropertyValue( PROPERTY_DATAFIELD
, uno::makeAny( aFormula
.getCompleteFormula() ) );
3544 if ( xInfo
->hasPropertyByName(PROPERTY_BORDER
) && xShapeInfo
->hasPropertyByName(PROPERTY_CONTROLBORDER
) )
3545 xUnoProp
->setPropertyValue(PROPERTY_BORDER
,xShapeProp
->getPropertyValue(PROPERTY_CONTROLBORDER
));
3547 pObjs
[i
]->CreateMediator(true);
3549 const sal_Int32 nShapeWidth
= xShapeProp
->getWidth();
3550 const bool bChangedPos
= (aPos
.X
+ nShapeWidth
) > nPaperWidth
;
3552 aPos
.X
= nPaperWidth
- nShapeWidth
;
3553 xShapeProp
->setPosition(aPos
);
3555 aPos
.Y
+= xShapeProp
->getHeight();
3556 aPos
.X
+= nShapeWidth
;
3559 if ( xField
->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL
) )
3560 xField
->getPropertyValue(PROPERTY_LABEL
) >>= sLabel
;
3562 if (pSectionViews
[0] != pSectionViews
[1] &&
3563 nOBJID
== OBJ_DLG_FORMATTEDFIELD
) // we want this nice feature only at FORMATTEDFIELD
3565 uno::Reference
< report::XReportComponent
> xShapePropLabel(pObjs
[0]->getUnoShape(),uno::UNO_QUERY_THROW
);
3566 uno::Reference
< report::XReportComponent
> xShapePropTextField(pObjs
[1]->getUnoShape(),uno::UNO_QUERY_THROW
);
3567 if ( !sLabel
.isEmpty() )
3568 xShapePropTextField
->setName(sLabel
);
3569 awt::Point aPosLabel
= xShapePropLabel
->getPosition();
3570 awt::Point aPosTextField
= xShapePropTextField
->getPosition();
3571 aPosTextField
.X
= aPosLabel
.X
;
3572 xShapePropTextField
->setPosition(aPosTextField
);
3573 if (bLabelAboveTextField
)
3575 // move the label down near the splitter
3576 const uno::Reference
<report::XSection
> xLabelSection
= pSectionWindow
[1]->getReportSection().getSection();
3577 aPosLabel
.Y
= xLabelSection
->getHeight() - xShapePropLabel
->getHeight();
3581 // move the label up to the splitter
3584 xShapePropLabel
->setPosition(aPosLabel
);
3586 OUnoObject
* pObj
= dynamic_cast<OUnoObject
*>(pControl
[0]);
3587 uno::Reference
< report::XFixedText
> xShapeProp(pObj
->getUnoShape(),uno::UNO_QUERY_THROW
);
3588 xShapeProp
->setName(xShapeProp
->getName() + sDefaultName
);
3590 for(i
= 0; i
< sizeof(pControl
)/sizeof(pControl
[0]);++i
) // insert controls
3592 correctOverlapping(pControl
[i
],pSectionWindow
[1-i
]->getReportSection());
3595 if (!bLabelAboveTextField
)
3597 if ( pSectionViews
[0] == pSectionViews
[1] )
3599 Rectangle aLabel
= getRectangleFromControl(pControl
[0]);
3600 Rectangle aTextfield
= getRectangleFromControl(pControl
[1]);
3602 // create a Union of the given Label and Textfield
3603 Rectangle
aLabelAndTextfield( aLabel
);
3604 aLabelAndTextfield
.Union(aTextfield
);
3606 // check if there exists other fields and if yes, move down
3607 bool bOverlapping
= true;
3608 bool bHasToMove
= false;
3609 while ( bOverlapping
)
3611 const SdrObject
* pOverlappedObj
= isOver(aLabelAndTextfield
, *pSectionWindow
[0]->getReportSection().getPage(), *pSectionViews
[0], true, pControl
, 2);
3612 bOverlapping
= pOverlappedObj
!= NULL
;
3615 const Rectangle
& aLogicRect
= pOverlappedObj
->GetLogicRect();
3616 aLabelAndTextfield
.Move(0,aLogicRect
.Top() + aLogicRect
.getHeight() - aLabelAndTextfield
.Top());
3623 // There was a move down, we need to move the Label and the Textfield down
3624 aLabel
.Move(0, aLabelAndTextfield
.Top() - aLabel
.Top());
3625 aTextfield
.Move(0, aLabelAndTextfield
.Top() - aTextfield
.Top());
3627 uno::Reference
< report::XReportComponent
> xLabel(pControl
[0]->getUnoShape(),uno::UNO_QUERY_THROW
);
3628 xLabel
->setPositionY(aLabel
.Top());
3630 uno::Reference
< report::XReportComponent
> xTextfield(pControl
[1]->getUnoShape(),uno::UNO_QUERY_THROW
);
3631 xTextfield
->setPositionY(aTextfield
.Top());
3639 for(size_t i
= 0; i
< sizeof(pControl
)/sizeof(pControl
[0]);++i
)
3644 catch(const Exception
&)
3646 DBG_UNHANDLED_EXCEPTION();
3651 OSectionView
* OReportController::getCurrentSectionView() const
3653 OSectionView
* pSectionView
= NULL
;
3654 OSectionWindow
* pSectionWindow
= getDesignView()->getMarkedSection();
3655 if ( pSectionWindow
)
3656 pSectionView
= &pSectionWindow
->getReportSection().getSectionView();
3657 return pSectionView
;
3660 void OReportController::changeZOrder(sal_Int32 _nId
)
3662 OSectionView
* pSectionView
= getCurrentSectionView();
3667 case SID_FRAME_TO_BOTTOM
:
3668 pSectionView
->PutMarkedToBtm();
3670 case SID_FRAME_TO_TOP
:
3671 pSectionView
->PutMarkedToTop();
3673 case SID_FRAME_DOWN
:
3674 pSectionView
->MovMarkedToBtm();
3677 pSectionView
->MovMarkedToTop();
3680 case SID_OBJECT_HEAVEN
:
3681 pSectionView
->SetMarkedToLayer( RPT_LAYER_FRONT
);
3683 case SID_OBJECT_HELL
:
3684 pSectionView
->SetMarkedToLayer( RPT_LAYER_BACK
);
3690 void OReportController::listen(const bool _bAdd
)
3692 const OUString aProps
[] = { OUString(PROPERTY_REPORTHEADERON
),OUString(PROPERTY_REPORTFOOTERON
)
3693 ,OUString(PROPERTY_PAGEHEADERON
),OUString(PROPERTY_PAGEFOOTERON
)
3694 ,OUString(PROPERTY_COMMAND
), OUString(PROPERTY_COMMANDTYPE
),OUString(PROPERTY_CAPTION
)
3697 void (SAL_CALL
XPropertySet::*pPropertyListenerAction
)( const OUString
&, const uno::Reference
< XPropertyChangeListener
>& ) =
3698 _bAdd
? &XPropertySet::addPropertyChangeListener
: &XPropertySet::removePropertyChangeListener
;
3700 for (size_t i
= 0; i
< sizeof(aProps
)/sizeof(aProps
[0]); ++i
)
3701 (m_xReportDefinition
.get()->*pPropertyListenerAction
)( aProps
[i
], static_cast< XPropertyChangeListener
* >( this ) );
3703 OXUndoEnvironment
& rUndoEnv
= m_aReportModel
->GetUndoEnv();
3704 uno::Reference
< XPropertyChangeListener
> xUndo
= &rUndoEnv
;
3705 uno::Sequence
< beans::Property
> aSeq
= m_xReportDefinition
->getPropertySetInfo()->getProperties();
3706 const beans::Property
* pIter
= aSeq
.getConstArray();
3707 const beans::Property
* pEnd
= pIter
+ aSeq
.getLength();
3708 const OUString
* pPropsBegin
= &aProps
[0];
3709 const OUString
* pPropsEnd
= pPropsBegin
+ (sizeof(aProps
)/sizeof(aProps
[0])) - 3;
3710 for(;pIter
!= pEnd
;++pIter
)
3712 if ( ::std::find(pPropsBegin
,pPropsEnd
,pIter
->Name
) == pPropsEnd
)
3713 (m_xReportDefinition
.get()->*pPropertyListenerAction
)( pIter
->Name
, xUndo
);
3716 // Add Listeners to UndoEnvironment
3717 void (OXUndoEnvironment::*pElementUndoFunction
)( const uno::Reference
< uno::XInterface
>& ) =
3718 _bAdd
? &OXUndoEnvironment::AddElement
: &OXUndoEnvironment::RemoveElement
;
3720 (rUndoEnv
.*pElementUndoFunction
)( m_xReportDefinition
->getStyleFamilies() );
3721 (rUndoEnv
.*pElementUndoFunction
)( m_xReportDefinition
->getFunctions() );
3723 // Add Listeners to ReportControllerObserver
3724 OXReportControllerObserver
& rObserver
= *m_pReportControllerObserver
;
3726 if ( m_xReportDefinition
->getPageHeaderOn() && _bAdd
)
3728 getDesignView()->addSection(m_xReportDefinition
->getPageHeader(),DBPAGEHEADER
);
3729 rObserver
.AddSection(m_xReportDefinition
->getPageHeader());
3731 if ( m_xReportDefinition
->getReportHeaderOn() && _bAdd
)
3733 getDesignView()->addSection(m_xReportDefinition
->getReportHeader(),DBREPORTHEADER
);
3734 rObserver
.AddSection(m_xReportDefinition
->getReportHeader());
3737 uno::Reference
< report::XGroups
> xGroups
= m_xReportDefinition
->getGroups();
3738 const sal_Int32 nCount
= xGroups
->getCount();
3739 _bAdd
? xGroups
->addContainerListener(&rUndoEnv
) : xGroups
->removeContainerListener(&rUndoEnv
);
3740 _bAdd
? xGroups
->addContainerListener(&rObserver
) : xGroups
->removeContainerListener(&rObserver
);
3742 for (sal_Int32 i
=0;i
<nCount
; ++i
)
3744 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
3745 (xGroup
.get()->*pPropertyListenerAction
)( OUString(PROPERTY_HEADERON
), static_cast< XPropertyChangeListener
* >( this ) );
3746 (xGroup
.get()->*pPropertyListenerAction
)( OUString(PROPERTY_FOOTERON
), static_cast< XPropertyChangeListener
* >( this ) );
3748 (rUndoEnv
.*pElementUndoFunction
)( xGroup
);
3749 (rUndoEnv
.*pElementUndoFunction
)( xGroup
->getFunctions() );
3750 if ( xGroup
->getHeaderOn() && _bAdd
)
3752 getDesignView()->addSection(xGroup
->getHeader(),DBGROUPHEADER
);
3753 rObserver
.AddSection(xGroup
->getHeader());
3759 getDesignView()->addSection(m_xReportDefinition
->getDetail(),DBDETAIL
);
3760 rObserver
.AddSection(m_xReportDefinition
->getDetail());
3762 for (sal_Int32 i
=nCount
;i
> 0 ; --i
)
3764 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
-1),uno::UNO_QUERY
);
3765 if ( xGroup
->getFooterOn() )
3767 getDesignView()->addSection(xGroup
->getFooter(),DBGROUPFOOTER
);
3768 rObserver
.AddSection(xGroup
->getFooter());
3771 if ( m_xReportDefinition
->getReportFooterOn() )
3773 getDesignView()->addSection(m_xReportDefinition
->getReportFooter(),DBREPORTFOOTER
);
3774 rObserver
.AddSection(m_xReportDefinition
->getReportFooter());
3776 if ( m_xReportDefinition
->getPageFooterOn())
3778 getDesignView()->addSection(m_xReportDefinition
->getPageFooter(),DBPAGEFOOTER
);
3779 rObserver
.AddSection(m_xReportDefinition
->getPageFooter());
3782 xGroups
->addContainerListener(static_cast<XContainerListener
*>(this));
3783 m_xReportDefinition
->addModifyListener(static_cast<XModifyListener
*>(this));
3787 rObserver
.RemoveSection(m_xReportDefinition
->getDetail());
3788 xGroups
->removeContainerListener(static_cast<XContainerListener
*>(this));
3789 m_xReportDefinition
->removeModifyListener(static_cast<XModifyListener
*>(this));
3790 m_aReportModel
->detachController();
3794 void OReportController::switchReportSection(const sal_Int16 _nId
)
3796 OSL_ENSURE(_nId
== SID_REPORTHEADER_WITHOUT_UNDO
|| _nId
== SID_REPORTFOOTER_WITHOUT_UNDO
|| _nId
== SID_REPORTHEADERFOOTER
,"Illegal id given!");
3798 if ( m_xReportDefinition
.is() )
3800 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3801 const bool bSwitchOn
= !m_xReportDefinition
->getReportHeaderOn();
3803 ::boost::scoped_ptr
< UndoContext
> pUndoContext
;
3804 if ( SID_REPORTHEADERFOOTER
== _nId
)
3806 const OUString
sUndoAction(ModuleRes(bSwitchOn
? RID_STR_UNDO_ADD_REPORTHEADERFOOTER
: RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
));
3807 pUndoContext
.reset( new UndoContext( getUndoManager(), sUndoAction
) );
3809 addUndoAction(new OReportSectionUndo(*(m_aReportModel
),SID_REPORTHEADER_WITHOUT_UNDO
3810 ,::std::mem_fun(&OReportHelper::getReportHeader
)
3811 ,m_xReportDefinition
3812 ,bSwitchOn
? Inserted
: Removed
3816 addUndoAction(new OReportSectionUndo(*(m_aReportModel
),SID_REPORTFOOTER_WITHOUT_UNDO
3817 ,::std::mem_fun(&OReportHelper::getReportFooter
)
3818 ,m_xReportDefinition
3819 ,bSwitchOn
? Inserted
: Removed
3826 case SID_REPORTHEADER_WITHOUT_UNDO
:
3827 m_xReportDefinition
->setReportHeaderOn( bSwitchOn
);
3829 case SID_REPORTFOOTER_WITHOUT_UNDO
:
3830 m_xReportDefinition
->setReportFooterOn( !m_xReportDefinition
->getReportFooterOn() );
3832 case SID_REPORTHEADERFOOTER
:
3833 m_xReportDefinition
->setReportHeaderOn( bSwitchOn
);
3834 m_xReportDefinition
->setReportFooterOn( bSwitchOn
);
3838 if ( SID_REPORTHEADERFOOTER
== _nId
)
3839 pUndoContext
.reset();
3840 getView()->Resize();
3844 void OReportController::switchPageSection(const sal_Int16 _nId
)
3846 OSL_ENSURE(_nId
== SID_PAGEHEADERFOOTER
|| _nId
== SID_PAGEHEADER_WITHOUT_UNDO
|| _nId
== SID_PAGEFOOTER_WITHOUT_UNDO
,"Illegal id given!");
3847 if ( m_xReportDefinition
.is() )
3849 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3850 const bool bSwitchOn
= !m_xReportDefinition
->getPageHeaderOn();
3852 ::boost::scoped_ptr
< UndoContext
> pUndoContext
;
3853 if ( SID_PAGEHEADERFOOTER
== _nId
)
3855 const OUString
sUndoAction(ModuleRes(bSwitchOn
? RID_STR_UNDO_ADD_REPORTHEADERFOOTER
: RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
));
3856 pUndoContext
.reset( new UndoContext( getUndoManager(), sUndoAction
) );
3858 addUndoAction(new OReportSectionUndo(*m_aReportModel
3859 ,SID_PAGEHEADER_WITHOUT_UNDO
3860 ,::std::mem_fun(&OReportHelper::getPageHeader
)
3861 ,m_xReportDefinition
3862 ,bSwitchOn
? Inserted
: Removed
3866 addUndoAction(new OReportSectionUndo(*m_aReportModel
3867 ,SID_PAGEFOOTER_WITHOUT_UNDO
3868 ,::std::mem_fun(&OReportHelper::getPageFooter
)
3869 ,m_xReportDefinition
3870 ,bSwitchOn
? Inserted
: Removed
3876 case SID_PAGEHEADER_WITHOUT_UNDO
:
3877 m_xReportDefinition
->setPageHeaderOn( bSwitchOn
);
3879 case SID_PAGEFOOTER_WITHOUT_UNDO
:
3880 m_xReportDefinition
->setPageFooterOn( !m_xReportDefinition
->getPageFooterOn() );
3882 case SID_PAGEHEADERFOOTER
:
3883 m_xReportDefinition
->setPageHeaderOn( bSwitchOn
);
3884 m_xReportDefinition
->setPageFooterOn( bSwitchOn
);
3887 if ( SID_PAGEHEADERFOOTER
== _nId
)
3888 pUndoContext
.reset();
3889 getView()->Resize();
3893 void OReportController::modifyGroup(const bool _bAppend
, const Sequence
< PropertyValue
>& _aArgs
)
3895 if ( !m_xReportDefinition
.is() )
3900 const SequenceAsHashMap
aMap( _aArgs
);
3901 uno::Reference
< report::XGroup
> xGroup
= aMap
.getUnpackedValueOrDefault( PROPERTY_GROUP
, uno::Reference
< report::XGroup
>() );
3905 OXUndoEnvironment
& rUndoEnv
= m_aReportModel
->GetUndoEnv();
3906 uno::Reference
< report::XGroups
> xGroups
= m_xReportDefinition
->getGroups();
3909 const sal_Int32 nPos
= aMap
.getUnpackedValueOrDefault( PROPERTY_POSITIONY
, xGroups
->getCount() );
3910 xGroups
->insertByIndex( nPos
, uno::makeAny( xGroup
) );
3911 rUndoEnv
.AddElement( xGroup
->getFunctions() );
3914 addUndoAction( new OGroupUndo(
3916 _bAppend
? RID_STR_UNDO_APPEND_GROUP
: RID_STR_UNDO_REMOVE_GROUP
,
3917 _bAppend
? Inserted
: Removed
,
3924 rUndoEnv
.RemoveElement( xGroup
->getFunctions() );
3925 const sal_Int32 nPos
= getGroupPosition( xGroup
);
3926 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3927 xGroups
->removeByIndex( nPos
);
3930 catch(const Exception
&)
3932 DBG_UNHANDLED_EXCEPTION();
3937 void OReportController::createGroupSection(const bool _bUndo
,const bool _bHeader
, const Sequence
< PropertyValue
>& _aArgs
)
3939 if ( m_xReportDefinition
.is() )
3941 const SequenceAsHashMap
aMap(_aArgs
);
3942 const bool bSwitchOn
= aMap
.getUnpackedValueOrDefault(_bHeader
? OUString(PROPERTY_HEADERON
) : OUString(PROPERTY_FOOTERON
), false);
3943 uno::Reference
< report::XGroup
> xGroup
= aMap
.getUnpackedValueOrDefault(PROPERTY_GROUP
,uno::Reference
< report::XGroup
>());
3946 const OXUndoEnvironment::OUndoEnvLock
aLock(m_aReportModel
->GetUndoEnv());
3948 addUndoAction(new OGroupSectionUndo(*m_aReportModel
3949 ,_bHeader
? SID_GROUPHEADER_WITHOUT_UNDO
: SID_GROUPFOOTER_WITHOUT_UNDO
3950 ,_bHeader
? ::std::mem_fun(&OGroupHelper::getHeader
) : ::std::mem_fun(&OGroupHelper::getFooter
)
3952 ,bSwitchOn
? Inserted
: Removed
3954 (bSwitchOn
? RID_STR_UNDO_ADD_GROUP_HEADER
: RID_STR_UNDO_REMOVE_GROUP_HEADER
)
3955 :(bSwitchOn
? RID_STR_UNDO_ADD_GROUP_FOOTER
: RID_STR_UNDO_REMOVE_GROUP_FOOTER
)
3960 xGroup
->setHeaderOn( bSwitchOn
);
3962 xGroup
->setFooterOn( bSwitchOn
);
3967 void OReportController::collapseSection(const bool _bCollapse
)
3969 OSectionWindow
*pSection
= getDesignView()->getMarkedSection();
3972 pSection
->setCollapsed(_bCollapse
);
3976 void OReportController::markSection(const bool _bNext
)
3978 OSectionWindow
*pSection
= getDesignView()->getMarkedSection();
3981 OSectionWindow
*pPrevSection
= getDesignView()->getMarkedSection(_bNext
? POST
: PREVIOUS
);
3982 if ( pPrevSection
!= pSection
&& pPrevSection
)
3983 select(uno::makeAny(pPrevSection
->getReportSection().getSection()));
3985 select(uno::makeAny(m_xReportDefinition
));
3989 getDesignView()->markSection(_bNext
? 0 : getDesignView()->getSectionCount() - 1);
3990 pSection
= getDesignView()->getMarkedSection();
3992 select(uno::makeAny(pSection
->getReportSection().getSection()));
3996 void OReportController::createDefaultControl(const uno::Sequence
< beans::PropertyValue
>& _aArgs
)
3998 uno::Reference
< report::XSection
> xSection
= getDesignView()->getCurrentSection();
3999 if ( !xSection
.is() )
4000 xSection
= m_xReportDefinition
->getDetail();
4002 if ( xSection
.is() )
4004 const OUString
sKeyModifier("KeyModifier");
4005 const beans::PropertyValue
* pIter
= _aArgs
.getConstArray();
4006 const beans::PropertyValue
* pEnd
= pIter
+ _aArgs
.getLength();
4007 const beans::PropertyValue
* pKeyModifier
= ::std::find_if(pIter
,pEnd
,::std::bind2nd(PropertyValueCompare(),boost::cref(sKeyModifier
)));
4008 sal_Int16 nKeyModifier
= 0;
4009 if ( pKeyModifier
== pEnd
|| ((pKeyModifier
->Value
>>= nKeyModifier
) && nKeyModifier
== KEY_MOD1
) )
4011 Sequence
< PropertyValue
> aCreateArgs
;
4012 getDesignView()->unmarkAllObjects(NULL
);
4013 createControl(aCreateArgs
,xSection
,OUString(),getDesignView()->GetInsertObj());
4019 void OReportController::checkChartEnabled()
4021 if ( !m_bChartEnabledAsked
)
4023 m_bChartEnabledAsked
= true;
4024 const OUString
sConfigName( "/org.openoffice.Office.ReportDesign" );
4025 const OUString
sPropertyName( "UserData/Chart" );
4029 ::utl::OConfigurationTreeRoot
aConfiguration(
4030 ::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext
, sConfigName
) );
4032 bool bChartEnabled
= false;
4033 if ( aConfiguration
.hasByHierarchicalName(sPropertyName
) )
4034 aConfiguration
.getNodeValue( sPropertyName
) >>= bChartEnabled
;
4035 m_bChartEnabled
= bChartEnabled
;
4037 catch(const Exception
&)
4045 OUString SAL_CALL
OReportController::getTitle()
4046 throw (uno::RuntimeException
, std::exception
)
4048 SolarMutexGuard aSolarGuard
;
4049 ::osl::MutexGuard
aGuard( getMutex() );
4051 uno::Reference
< frame::XTitle
> xTitle(m_xReportDefinition
,uno::UNO_QUERY_THROW
);
4053 return xTitle
->getTitle ();
4056 void OReportController::getPropertyDefaultByHandle( sal_Int32
/*_nHandle*/, Any
& _rDefault
) const
4058 _rDefault
<<= sal_Int16(100);
4061 // comphelper::OPropertyArrayUsageHelper
4062 ::cppu::IPropertyArrayHelper
* OReportController::createArrayHelper( ) const
4064 Sequence
< Property
> aProps
;
4065 describeProperties(aProps
);
4066 return new ::cppu::OPropertyArrayHelper(aProps
);
4070 // cppu::OPropertySetHelper
4071 ::cppu::IPropertyArrayHelper
& SAL_CALL
OReportController::getInfoHelper()
4073 typedef ::comphelper::OPropertyArrayUsageHelper
<OReportController_BASE
> OReportController_PROP
;
4074 return *OReportController_PROP::getArrayHelper();
4077 void SAL_CALL
OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle
,const Any
& _aValue
) throw (Exception
, std::exception
)
4079 if ( _nHandle
== PROPERTY_ID_ZOOMVALUE
)
4081 _aValue
>>= m_nZoomValue
;
4082 impl_zoom_nothrow();
4085 void SAL_CALL
OReportController::setMode( const OUString
& aMode
) throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
, std::exception
)
4087 ::osl::MutexGuard
aGuard( getMutex() );
4090 OUString SAL_CALL
OReportController::getMode( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
4092 ::osl::MutexGuard
aGuard( getMutex() );
4095 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
OReportController::getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
4097 static const OUString s_sModes
[] = { OUString("remote"),
4098 OUString("normal") };
4099 return uno::Sequence
< OUString
> (&s_sModes
[0],sizeof(s_sModes
)/sizeof(s_sModes
[0]));
4101 sal_Bool SAL_CALL
OReportController::supportsMode( const OUString
& aMode
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
4103 uno::Sequence
< OUString
> aModes
= getSupportedModes();
4104 const OUString
* pIter
= aModes
.getConstArray();
4105 const OUString
* pEnd
= pIter
+ aModes
.getLength();
4106 for(;pIter
!= pEnd
;++pIter
)
4108 if ( pIter
->equals(aMode
) )
4111 return pIter
!= pEnd
;
4114 bool OReportController::isUiVisible() const
4116 return m_sMode
!= "remote";
4119 void OReportController::impl_fillState_nothrow(const OUString
& _sProperty
,dbaui::FeatureState
& _rState
) const
4121 _rState
.bEnabled
= isEditable();
4122 if ( _rState
.bEnabled
)
4124 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
4125 getDesignView()->fillControlModelSelection(aSelection
);
4126 _rState
.bEnabled
= !aSelection
.empty();
4127 if ( _rState
.bEnabled
)
4130 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
4131 for(; aIter
!= aSelection
.end() && _rState
.bEnabled
;++aIter
)
4133 uno::Reference
< beans::XPropertySet
> xProp(*aIter
,uno::UNO_QUERY
);
4136 uno::Any aTemp2
= xProp
->getPropertyValue(_sProperty
);
4137 if ( aIter
== aSelection
.begin() )
4141 else if ( !comphelper::compare(aTemp
,aTemp2
) )
4144 catch(const beans::UnknownPropertyException
&)
4146 _rState
.bEnabled
= false;
4149 if ( aIter
== aSelection
.end() )
4150 _rState
.aValue
= aTemp
;
4155 void OReportController::impl_zoom_nothrow()
4157 Fraction
aZoom(m_nZoomValue
,100);
4158 setZoomFactor( aZoom
,*getDesignView() );
4159 getDesignView()->zoom(aZoom
);
4160 InvalidateFeature(SID_ATTR_ZOOM
,Reference
< XStatusListener
>(), true);
4161 InvalidateFeature(SID_ATTR_ZOOMSLIDER
,Reference
< XStatusListener
>(), true);
4164 bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand
,const uno::Reference
< report::XReportControlFormat
>& _xReportControlFormat
)
4167 if ( _xReportControlFormat
.is() && !uno::Reference
< report::XFixedLine
>(_xReportControlFormat
,uno::UNO_QUERY
).is() ) // this command is really often called so we nedd a short cut here
4171 const awt::FontDescriptor aFontDescriptor
= _xReportControlFormat
->getFontDescriptor();
4175 case SID_ATTR_CHAR_WEIGHT
:
4176 bRet
= awt::FontWeight::BOLD
== aFontDescriptor
.Weight
;
4178 case SID_ATTR_CHAR_POSTURE
:
4179 bRet
= awt::FontSlant_ITALIC
== aFontDescriptor
.Slant
;
4181 case SID_ATTR_CHAR_UNDERLINE
:
4182 bRet
= awt::FontUnderline::SINGLE
== aFontDescriptor
.Underline
;
4188 catch(const uno::Exception
&)
4195 bool OReportController::impl_setPropertyAtControls_throw(const sal_uInt16 _nUndoResId
,const OUString
& _sProperty
,const uno::Any
& _aValue
,const Sequence
< PropertyValue
>& _aArgs
)
4197 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
4198 uno::Reference
< awt::XWindow
> xWindow
;
4199 lcl_getReportControlFormat( _aArgs
, getDesignView(), xWindow
, aSelection
);
4200 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
4202 const OUString sUndoAction
= ModuleRes( _nUndoResId
);
4203 UndoContext
aUndoContext( getUndoManager(), sUndoAction
);
4205 for(; aIter
!= aSelection
.end();++aIter
)
4207 const uno::Reference
< beans::XPropertySet
> xControlModel(*aIter
,uno::UNO_QUERY
);
4208 if ( xControlModel
.is() )
4209 xControlModel
->setPropertyValue(_sProperty
,_aValue
);
4212 return !aSelection
.empty();
4215 void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType
,dbaui::FeatureState
& _rState
) const
4217 _rState
.bEnabled
= isEditable();
4218 _rState
.bChecked
= getDesignView()->GetInsertObj() == OBJ_CUSTOMSHAPE
&& getDesignView()->GetInsertObjString().equalsAscii(_pCustomShapeType
);
4222 OSectionWindow
* OReportController::getSectionWindow(const ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
>& _xSection
) const
4224 if ( getDesignView() )
4226 return getDesignView()->getSectionWindow(_xSection
);
4229 // throw NullPointerException?
4235 void OReportController::openZoomDialog()
4237 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
4240 static SfxItemInfo aItemInfos
[] =
4242 { SID_ATTR_ZOOM
, SfxItemPoolFlags::POOLABLE
}
4244 SfxPoolItem
* pDefaults
[] =
4248 static const sal_uInt16 pRanges
[] =
4250 SID_ATTR_ZOOM
,SID_ATTR_ZOOM
,
4253 SfxItemPool
* pPool( new SfxItemPool(OUString("ZoomProperties"), SID_ATTR_ZOOM
,SID_ATTR_ZOOM
, aItemInfos
, pDefaults
) );
4254 pPool
->SetDefaultMetric( SFX_MAPUNIT_100TH_MM
); // ripped, don't understand why
4255 pPool
->FreezeIdRanges(); // the same
4258 ::std::unique_ptr
<SfxItemSet
> pDescriptor(new SfxItemSet(*pPool
, pRanges
));
4260 SvxZoomItem
aZoomItem( m_eZoomType
, m_nZoomValue
, SID_ATTR_ZOOM
);
4261 aZoomItem
.SetValueSet(SvxZoomEnableFlags::N100
|SvxZoomEnableFlags::WHOLEPAGE
|SvxZoomEnableFlags::PAGEWIDTH
);
4262 pDescriptor
->Put(aZoomItem
);
4264 ::std::unique_ptr
<AbstractSvxZoomDialog
> pDlg( pFact
->CreateSvxZoomDialog(NULL
, *pDescriptor
.get()) );
4265 pDlg
->SetLimits( 20, 400 );
4266 bool bCancel
= ( RET_CANCEL
== pDlg
->Execute() );
4270 const SvxZoomItem
& rZoomItem
= static_cast<const SvxZoomItem
&>(pDlg
->GetOutputItemSet()->Get( SID_ATTR_ZOOM
));
4271 m_eZoomType
= rZoomItem
.GetType();
4272 m_nZoomValue
= rZoomItem
.GetValue();
4273 if ( m_eZoomType
!= SvxZoomType::PERCENT
)
4274 m_nZoomValue
= getDesignView()->getZoomFactor( m_eZoomType
);
4276 impl_zoom_nothrow();
4279 catch(const uno::Exception
&)
4281 DBG_UNHANDLED_EXCEPTION();
4283 SfxItemPool::Free(pPool
);
4285 for (sal_uInt16 i
=0; i
<sizeof(pDefaults
)/sizeof(pDefaults
[0]); ++i
)
4286 delete pDefaults
[i
];
4292 void SAL_CALL
OReportController::setVisualAreaSize( ::sal_Int64 _nAspect
, const awt::Size
& _aSize
) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
, std::exception
)
4294 ::osl::MutexGuard
aGuard( getMutex() );
4296 (m_aVisualAreaSize
.Width
!= _aSize
.Width
||
4297 m_aVisualAreaSize
.Height
!= _aSize
.Height
);
4298 m_aVisualAreaSize
= _aSize
;
4300 setModified( sal_True
);
4301 m_nAspect
= _nAspect
;
4304 awt::Size SAL_CALL
OReportController::getVisualAreaSize( ::sal_Int64
/*nAspect*/ ) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
, std::exception
)
4306 ::osl::MutexGuard
aGuard( getMutex() );
4307 return m_aVisualAreaSize
;
4310 embed::VisualRepresentation SAL_CALL
OReportController::getPreferredVisualRepresentation( ::sal_Int64 _nAspect
) throw (lang::IllegalArgumentException
, embed::WrongStateException
, uno::Exception
, uno::RuntimeException
, std::exception
)
4312 SolarMutexGuard aSolarGuard
;
4313 ::osl::MutexGuard
aGuard( getMutex() );
4314 embed::VisualRepresentation aResult
;
4315 if ( !m_bInGeneratePreview
)
4317 m_bInGeneratePreview
= true;
4320 if ( !m_xReportEngine
.is() )
4321 m_xReportEngine
.set( report::ReportEngine::create(m_xContext
) );
4322 const sal_Int32 nOldMaxRows
= m_xReportEngine
->getMaxRows();
4323 m_xReportEngine
->setMaxRows(MAX_ROWS_FOR_PREVIEW
);
4324 m_xReportEngine
->setReportDefinition(m_xReportDefinition
);
4325 m_xReportEngine
->setActiveConnection(getConnection());
4328 Reference
<embed::XVisualObject
> xTransfer(m_xReportEngine
->createDocumentModel(),UNO_QUERY
);
4329 if ( xTransfer
.is() )
4331 xTransfer
->setVisualAreaSize(m_nAspect
,m_aVisualAreaSize
);
4332 aResult
= xTransfer
->getPreferredVisualRepresentation( _nAspect
);
4335 catch(const uno::Exception
&)
4338 m_xReportEngine
->setMaxRows(nOldMaxRows
);
4340 catch(const uno::Exception
&)
4343 m_bInGeneratePreview
= false;
4348 ::sal_Int32 SAL_CALL
OReportController::getMapUnit( ::sal_Int64
/*nAspect*/ ) throw (uno::Exception
, uno::RuntimeException
, std::exception
)
4350 return embed::EmbedMapUnits::ONE_100TH_MM
;
4353 uno::Reference
< container::XNameAccess
> OReportController::getColumns() const
4355 if ( !m_xColumns
.is() && m_xReportDefinition
.is() && !m_xReportDefinition
->getCommand().isEmpty() )
4357 m_xColumns
= dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition
->getCommandType(),m_xReportDefinition
->getCommand(),m_xHoldAlive
);
4362 OUString
OReportController::getColumnLabel_throw(const OUString
& i_sColumnName
) const
4365 uno::Reference
< container::XNameAccess
> xColumns
= getColumns();
4366 if ( xColumns
.is() && xColumns
->hasByName(i_sColumnName
) )
4368 uno::Reference
< beans::XPropertySet
> xColumn(xColumns
->getByName(i_sColumnName
),uno::UNO_QUERY_THROW
);
4369 if ( xColumn
->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL
) )
4370 xColumn
->getPropertyValue(PROPERTY_LABEL
) >>= sLabel
;
4376 SfxUndoManager
& OReportController::getUndoManager() const
4378 DBG_TESTSOLARMUTEX();
4379 // this is expected to be called during UI actions, so the SM is assumed to be locked
4381 ::boost::shared_ptr
< OReportModel
> pReportModel( getSdrModel() );
4382 ENSURE_OR_THROW( !!pReportModel
, "no access to our model" );
4384 SfxUndoManager
* pUndoManager( pReportModel
->GetSdrUndoManager() );
4385 ENSURE_OR_THROW( pUndoManager
!= NULL
, "no access to our model's UndoManager" );
4387 return *pUndoManager
;
4391 void OReportController::clearUndoManager() const
4393 getUndoManager().Clear();
4397 void OReportController::addUndoAction( SfxUndoAction
* i_pAction
)
4399 getUndoManager().AddUndoAction( i_pAction
);
4401 InvalidateFeature( SID_UNDO
);
4402 InvalidateFeature( SID_REDO
);
4404 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */