1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ReportController.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "precompiled_reportdesign.hxx"
32 #define RPTUI_ID_LRSPACE 1
33 #define RPTUI_ID_ULSPACE 2
34 #define RPTUI_ID_PAGE 3
35 #define RPTUI_ID_SIZE 4
36 #define RPTUI_ID_PAGE_MODE 5
37 #define RPTUI_ID_START 6
38 #define RPTUI_ID_END 7
39 #define RPTUI_ID_BRUSH 8
40 #define RPTUI_ID_METRIC 9
42 #define ITEMID_LRSPACE RPTUI_ID_LRSPACE
43 #define ITEMID_ULSPACE RPTUI_ID_ULSPACE
44 #define ITEMID_SIZE RPTUI_ID_SIZE
45 #define ITEMID_PAGE RPTUI_ID_PAGE
46 #define ITEMID_BRUSH RPTUI_ID_BRUSH
49 #include "ReportController.hxx"
50 #include "ReportDefinition.hxx"
51 #include "CondFormat.hxx"
52 #include "UITools.hxx"
53 #include "AddField.hxx"
54 #include <toolkit/helper/vclunohelper.hxx>
55 #include "DateTime.hxx"
56 #include <svtools/syslocale.hxx>
57 #include <vcl/svapp.hxx>
58 #include <sfx2/filedlghelper.hxx>
59 #include <tools/string.hxx>
60 #include <tools/diagnose_ex.h>
61 #include "rptui_slotid.hrc"
62 #include "reportformula.hxx"
64 #include <comphelper/documentconstants.hxx>
65 #include <comphelper/property.hxx>
66 #include <comphelper/sequenceashashmap.hxx>
67 #include <comphelper/types.hxx>
69 #include <connectivity/dbtools.hxx>
70 #include <com/sun/star/view/PaperFormat.hpp>
71 #include <com/sun/star/style/GraphicLocation.hpp>
72 #include <com/sun/star/style/XStyle.hpp>
73 #include <com/sun/star/style/PageStyleLayout.hpp>
74 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
75 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
76 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
77 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
78 #include <com/sun/star/frame/FrameSearchFlag.hpp>
79 #include <com/sun/star/container/XChild.hpp>
80 #include <com/sun/star/container/XNameContainer.hpp>
81 #include <com/sun/star/report/XImageControl.hpp>
82 #include <com/sun/star/report/XFixedLine.hpp>
83 #include <com/sun/star/report/Function.hpp>
84 #include <com/sun/star/report/XShape.hpp>
85 #include <com/sun/star/awt/FontDescriptor.hpp>
86 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
87 #include <com/sun/star/sdb/XParametersSupplier.hpp>
88 #include <com/sun/star/sdb/CommandType.hpp>
89 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
90 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
91 #include <com/sun/star/embed/ElementModes.hpp>
92 #include <comphelper/streamsection.hxx>
93 #include <com/sun/star/awt/FontWeight.hpp>
94 #include <com/sun/star/awt/FontUnderline.hpp>
95 #include <com/sun/star/awt/TextAlign.hpp>
96 #include <com/sun/star/awt/FontSlant.hpp>
97 #include <com/sun/star/frame/status/FontHeight.hpp>
98 #include <com/sun/star/report/XFormattedField.hpp>
99 #include <com/sun/star/sdb/SQLContext.hpp>
100 #include <com/sun/star/sdbc/SQLWarning.hpp>
101 #include <com/sun/star/beans/PropertyAttribute.hpp>
103 #include <vcl/msgbox.hxx>
104 #include <vcl/waitobj.hxx>
106 #include <svx/fmview.hxx>
107 #include <svx/paperinf.hxx>
108 #include <svx/svxids.hrc>
109 #include <svx/svdobj.hxx>
110 #include <svx/dataaccessdescriptor.hxx>
111 #include <svx/svxenum.hxx>
112 #include <svx/pageitem.hxx>
113 #include <svx/lrspitem.hxx>
114 #include <svx/ulspitem.hxx>
115 #include <svx/sizeitem.hxx>
116 #include <svx/zoomitem.hxx>
117 #include <svx/zoomslideritem.hxx>
118 #include <svx/brshitem.hxx>
119 #include <svx/flagsdef.hxx> //CHINA001
120 #include <svx/svdpagv.hxx>
121 #include <svx/svxdlg.hxx>
122 #include <svx/zoom_def.hxx>
123 #include <svx/dialogs.hrc>
125 #include "DesignView.hxx"
126 #include "ModuleHelper.hxx"
127 #include "RptObject.hxx"
129 #include "uistrings.hrc"
130 #include "RptDef.hxx"
131 #include "ReportSection.hxx"
132 #include "SectionView.hxx"
133 #include "UndoActions.hxx"
134 #include "dlgpage.hxx"
135 #include "RptResId.hrc"
137 #include <svtools/itempool.hxx>
138 #include <svtools/itemset.hxx>
139 #include <svtools/aeitem.hxx> //CHINA001
140 #include <svtools/cliplistener.hxx>
142 #include <vos/mutex.hxx>
143 #include "PropertyForward.hxx"
144 #include "SectionWindow.hxx"
146 #include <toolkit/helper/convert.hxx>
147 #include "GroupsSorting.hxx"
148 #include "PageNumber.hxx"
149 #include <toolkit/helper/vclunohelper.hxx>
150 #include "UndoEnv.hxx"
151 #include "InsertFunctions.hxx"
153 #include <boost/mem_fn.hpp>
154 #include <boost/bind.hpp>
155 #include <boost/utility.hpp>
157 #include <cppuhelper/exc_hlp.hxx>
158 #include <unotools/confignode.hxx>
159 #include <helpids.hrc>
161 using namespace ::com::sun::star
;
164 using namespace beans
;
165 using namespace frame
;
166 using namespace util
;
167 using namespace lang
;
168 using namespace container
;
169 using namespace sdbcx
;
170 using namespace sdbc
;
173 using namespace ui::dialogs
;
174 using namespace util
;
175 using namespace ::dbtools
;
176 using namespace ::rptui
;
177 using namespace ::dbaui
;
178 using namespace ::comphelper
;
179 using namespace ::cppu
;
181 // -----------------------------------------------------------------------------
184 // comparing two PropertyValue instances
185 struct PropertyValueCompare
: public ::std::binary_function
< beans::PropertyValue
, ::rtl::OUString
, bool >
187 bool operator() (const beans::PropertyValue
& x
, const ::rtl::OUString
& y
) const
189 return x
.Name
.equals(y
);// ? true : false;
191 bool operator() (const ::rtl::OUString
& x
,const beans::PropertyValue
& y
) const
193 return x
.equals(y
.Name
);// ? true : false;
197 void lcl_setFontWPU_nothrow(const uno::Reference
< report::XReportControlFormat
>& _xReportControlFormat
,const sal_Int32 _nId
)
199 if ( _xReportControlFormat
.is() )
203 awt::FontDescriptor aFontDescriptor
= _xReportControlFormat
->getFontDescriptor();
206 case SID_ATTR_CHAR_WEIGHT
:
207 aFontDescriptor
.Weight
= (awt::FontWeight::NORMAL
+ awt::FontWeight::BOLD
) - aFontDescriptor
.Weight
;
209 case SID_ATTR_CHAR_POSTURE
:
210 aFontDescriptor
.Slant
= static_cast<awt::FontSlant
>(static_cast<sal_Int16
>(awt::FontSlant_ITALIC
) - static_cast<sal_Int16
>(aFontDescriptor
.Slant
));
212 case SID_ATTR_CHAR_UNDERLINE
:
213 aFontDescriptor
.Underline
= awt::FontUnderline::SINGLE
- aFontDescriptor
.Underline
;
216 OSL_ENSURE(0,"Illegal value in default!");
220 _xReportControlFormat
->setFontDescriptor(aFontDescriptor
);
222 catch(beans::UnknownPropertyException
&)
225 } // if ( xReportControlFormat.is() )
229 // -----------------------------------------------------------------------------
230 void lcl_getReportControlFormat(const Sequence
< PropertyValue
>& aArgs
,
232 uno::Reference
< awt::XWindow
>& _xWindow
,
233 ::std::vector
< uno::Reference
< uno::XInterface
> >& _rControlsFormats
)
235 uno::Reference
< report::XReportControlFormat
> xReportControlFormat
;
236 if ( aArgs
.getLength() )
238 SequenceAsHashMap
aMap(aArgs
);
239 xReportControlFormat
= aMap
.getUnpackedValueOrDefault(REPORTCONTROLFORMAT
,uno::Reference
< report::XReportControlFormat
>());
240 _xWindow
= aMap
.getUnpackedValueOrDefault(CURRENT_WINDOW
,uno::Reference
< awt::XWindow
>());
241 } // if ( aArgs.getLength() )
242 if ( !xReportControlFormat
.is() )
244 _pView
->fillControlModelSelection(_rControlsFormats
);
245 //xReportControlFormat.set( _pView->getCurrentControlModel(),uno::UNO_QUERY);
246 } // if ( !xReportControlFormat.is() )
248 _rControlsFormats
.push_back(xReportControlFormat
);
250 if ( !_xWindow
.is() )
251 _xWindow
= VCLUnoHelper::GetInterface(_pView
);
253 // -----------------------------------------------------------------------------
254 ::rtl::OUString SAL_CALL
OReportController::getImplementationName() throw( RuntimeException
)
256 return getImplementationName_Static();
259 //------------------------------------------------------------------------------
260 ::rtl::OUString
OReportController::getImplementationName_Static() throw( RuntimeException
)
262 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.comp.ReportDesign"));
264 //------------------------------------------------------------------------------
265 Sequence
< ::rtl::OUString
> OReportController::getSupportedServiceNames_Static(void) throw( RuntimeException
)
267 Sequence
< ::rtl::OUString
> aSupported(1);
268 aSupported
.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ReportDesign"));
271 //-------------------------------------------------------------------------
272 Sequence
< ::rtl::OUString
> SAL_CALL
OReportController::getSupportedServiceNames() throw(RuntimeException
)
274 return getSupportedServiceNames_Static();
276 // -------------------------------------------------------------------------
277 Reference
< XInterface
> OReportController::create(Reference
< XComponentContext
> const & xContext
)
279 return *(new OReportController(xContext
));
282 #define PROPERTY_ID_ZOOMVALUE 1
284 DBG_NAME( rpt_OReportController
)
285 // -----------------------------------------------------------------------------
286 OReportController::OReportController(Reference
< XComponentContext
> const & xContext
)
287 : OReportController_BASE(Reference
< XMultiServiceFactory
>(xContext
->getServiceManager(),UNO_QUERY
))
288 ,OPropertyStateContainer(OGenericUnoController_Base::rBHelper
)
289 ,m_aSelectionListeners( getMutex() )
291 ,m_pClipbordNotifier(NULL
)
292 ,m_pGroupsFloater(NULL
)
293 ,m_xContext(xContext
)
296 ,m_nSelectionCount(0)
298 ,m_eZoomType(SVX_ZOOM_PERCENT
)
299 ,m_bShowRuler(sal_True
)
300 ,m_bGridVisible(sal_True
)
301 ,m_bGridUse(sal_True
)
302 ,m_bShowProperties(sal_True
)
303 ,m_bGroupFloaterWasVisible(sal_False
)
304 ,m_bHelplinesMove(sal_True
)
305 ,m_bChartEnabled(false)
306 ,m_bChartEnabledAsked(false)
308 m_sMode
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal"));
309 DBG_CTOR( rpt_OReportController
,NULL
);
310 registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZoomValue")),PROPERTY_ID_ZOOMVALUE
,beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::TRANSIENT
,&m_nZoomValue
,::getCppuType(reinterpret_cast< sal_Int16
*>(NULL
)));
312 // -----------------------------------------------------------------------------
313 OReportController::~OReportController()
315 DBG_DTOR( rpt_OReportController
,NULL
);
317 // -----------------------------------------------------------------------------
318 IMPLEMENT_FORWARD_XTYPEPROVIDER2(OReportController
,OReportController_BASE
,OReportController_Listener
)
319 IMPLEMENT_FORWARD_XINTERFACE2(OReportController
,OReportController_BASE
,OReportController_Listener
)
320 // -----------------------------------------------------------------------------
321 void OReportController::disposing()
323 if ( getView() && m_pClipbordNotifier
)
325 m_pClipbordNotifier
->ClearCallbackLink();
326 m_pClipbordNotifier
->AddRemoveListener( getView(), sal_False
);
327 m_pClipbordNotifier
->release();
328 m_pClipbordNotifier
= NULL
;
331 ::std::auto_ptr
<FloatingWindow
> aTemp(m_pGroupsFloater
);
332 m_pGroupsFloater
= NULL
;
337 ::comphelper::disposeComponent( m_xRowSet
);
338 ::comphelper::disposeComponent( m_xRowSetMediator
);
339 ::comphelper::disposeComponent( m_xFormatter
);
341 catch(uno::Exception
&)
343 OSL_ENSURE(0,"Exception caught while disposing row sets.");
346 m_xRowSetMediator
.clear();
348 if ( m_xReportDefinition
.is() )
352 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= m_pMyOwnView
->getMarkedSection();
353 if ( pSectionWindow
)
354 pSectionWindow
->getReportSection().deactivateOle();
355 getUndoMgr()->Clear(); // clear all undo redo things
358 catch(uno::Exception
&)
364 EventObject
aDisposingEvent( *this );
365 m_aSelectionListeners
.disposeAndClear( aDisposingEvent
);
368 OReportController_BASE::disposing();
374 m_xReportDefinition
.clear();
375 m_aReportModel
.reset();
376 m_xFrameLoader
.clear();
377 m_xReportEngine
.clear();
379 catch(uno::Exception
&)
383 EndListening(*(m_pMyOwnView
));
387 // -----------------------------------------------------------------------------
388 FeatureState
OReportController::GetState(sal_uInt16 _nId
) const
390 FeatureState aReturn
;
391 // (disabled automatically)
392 aReturn
.bEnabled
= sal_False
;
399 case SID_RPT_TEXTDOCUMENT
:
400 aReturn
.bEnabled
= isEditable();
401 aReturn
.bChecked
= (m_xReportDefinition
.is() && m_xReportDefinition
->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_TEXT
);
403 case SID_RPT_SPREADSHEET
:
404 aReturn
.bEnabled
= isEditable();
405 aReturn
.bChecked
= (m_xReportDefinition
.is() && m_xReportDefinition
->getMimeType() == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET
);
407 case SID_REPORTHEADER_WITHOUT_UNDO
:
408 case SID_REPORTFOOTER_WITHOUT_UNDO
:
409 case SID_REPORTHEADERFOOTER
:
411 aReturn
.bEnabled
= isEditable();
412 ::rtl::OUString sText
= String(ModuleRes((m_xReportDefinition
.is() && m_xReportDefinition
->getReportHeaderOn()) ? RID_STR_REPORTHEADERFOOTER_DELETE
: RID_STR_REPORTHEADERFOOTER_INSERT
));
413 aReturn
.sTitle
= sText
;
416 case SID_PAGEHEADER_WITHOUT_UNDO
:
417 case SID_PAGEFOOTER_WITHOUT_UNDO
:
418 case SID_PAGEHEADERFOOTER
:
420 aReturn
.bEnabled
= isEditable();
421 ::rtl::OUString sText
= String(ModuleRes((m_xReportDefinition
.is() && m_xReportDefinition
->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE
: RID_STR_PAGEHEADERFOOTER_INSERT
));
422 aReturn
.sTitle
= sText
;
425 case SID_GROUP_APPEND
:
426 case SID_GROUP_REMOVE
:
427 case SID_GROUPHEADER_WITHOUT_UNDO
:
428 case SID_GROUPHEADER
:
429 case SID_GROUPFOOTER_WITHOUT_UNDO
:
430 case SID_GROUPFOOTER
:
431 aReturn
.bEnabled
= isEditable();
433 case SID_ADD_CONTROL_PAIR
:
434 aReturn
.bEnabled
= isEditable();
438 aReturn
= OReportController_BASE::GetState(_nId
);
439 aReturn
.bEnabled
= aReturn
.bEnabled
;
441 case SID_OBJECT_RESIZING
:
442 case SID_OBJECT_SMALLESTWIDTH
:
443 case SID_OBJECT_SMALLESTHEIGHT
:
444 case SID_OBJECT_GREATESTWIDTH
:
445 case SID_OBJECT_GREATESTHEIGHT
:
446 aReturn
.bEnabled
= isEditable() && m_pMyOwnView
->HasSelection();// && m_pMyOwnView->isAlignPossible();
447 if ( aReturn
.bEnabled
)
448 aReturn
.bEnabled
= m_nSelectionCount
> 1;
451 case SID_DISTRIBUTION
:
452 aReturn
.bEnabled
= isEditable() && m_pMyOwnView
->HasSelection();
453 if ( aReturn
.bEnabled
)
455 OSectionView
* pSectionView
= getCurrentSectionView();
456 aReturn
.bEnabled
= pSectionView
&& pSectionView
->GetMarkedObjectCount() > 2;
461 aReturn
.bEnabled
= sal_False
;
463 case SID_ARRANGEMENU
:
464 case SID_FRAME_TO_TOP
:
465 case SID_FRAME_TO_BOTTOM
:
466 case SID_OBJECT_HEAVEN
:
467 case SID_OBJECT_HELL
:
468 aReturn
.bEnabled
= isEditable() && m_pMyOwnView
->HasSelection();
469 if ( aReturn
.bEnabled
)
471 uno::Reference
< report::XShape
> xShape(m_pMyOwnView
->getCurrentControlModel(),uno::UNO_QUERY
);
472 aReturn
.bEnabled
= xShape
.is();
473 if ( aReturn
.bEnabled
)
475 OSectionView
* pSectionView
= getCurrentSectionView();
480 case SID_OBJECT_HEAVEN
:
481 aReturn
.bEnabled
= pSectionView
->IsToTopPossible();
483 case SID_OBJECT_HELL
:
484 aReturn
.bEnabled
= pSectionView
->IsToBtmPossible();
494 case SID_OBJECT_ALIGN
:
495 case SID_OBJECT_ALIGN_LEFT
:
496 case SID_OBJECT_ALIGN_CENTER
:
497 case SID_OBJECT_ALIGN_RIGHT
:
498 case SID_OBJECT_ALIGN_UP
:
499 case SID_OBJECT_ALIGN_MIDDLE
:
500 case SID_OBJECT_ALIGN_DOWN
:
501 case SID_SECTION_ALIGN
:
502 case SID_SECTION_ALIGN_LEFT
:
503 case SID_SECTION_ALIGN_CENTER
:
504 case SID_SECTION_ALIGN_RIGHT
:
505 case SID_SECTION_ALIGN_UP
:
506 case SID_SECTION_ALIGN_MIDDLE
:
507 case SID_SECTION_ALIGN_DOWN
:
508 aReturn
.bEnabled
= isEditable() && m_pMyOwnView
->HasSelection();// && m_pMyOwnView->isAlignPossible();
511 aReturn
.bEnabled
= isEditable() && m_pMyOwnView
->HasSelection() && !m_pMyOwnView
->isHandleEvent(_nId
);
514 aReturn
.bEnabled
= m_pMyOwnView
->HasSelection() && !m_pMyOwnView
->isHandleEvent(_nId
);
517 aReturn
.bEnabled
= isEditable() && !m_pMyOwnView
->isHandleEvent(_nId
) && m_pMyOwnView
->IsPasteAllowed();
520 aReturn
.bEnabled
= !m_pMyOwnView
->isHandleEvent(_nId
);
522 case SID_SELECTALL_IN_SECTION
:
523 aReturn
.bEnabled
= !m_pMyOwnView
->isHandleEvent(_nId
);
524 if ( aReturn
.bEnabled
)
525 aReturn
.bEnabled
= getCurrentSectionView() != NULL
;
528 aReturn
.bEnabled
= m_pMyOwnView
->GetMode() == RPTUI_INSERT
;
530 case SID_TERMINATE_INPLACEACTIVATION
:
531 aReturn
.bEnabled
= sal_True
;
533 case SID_SELECT_ALL_EDITS
:
534 case SID_SELECT_ALL_LABELS
:
535 aReturn
.bEnabled
= sal_True
;
537 case SID_RPT_NEW_FUNCTION
:
538 aReturn
.bEnabled
= isEditable();
542 aReturn
.bEnabled
= isEditable();
545 case SID_SELECT_REPORT
:
546 aReturn
.bEnabled
= sal_True
;
548 case SID_EXECUTE_REPORT
:
549 aReturn
.bEnabled
= isConnected() && m_xReportDefinition
.is();
552 aReturn
.bEnabled
= isEditable() && m_pMyOwnView
->HasSelection() && !m_pMyOwnView
->isHandleEvent(_nId
);
553 if ( aReturn
.bEnabled
)
555 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= m_pMyOwnView
->getMarkedSection();
556 if ( pSectionWindow
)
557 aReturn
.bEnabled
= !pSectionWindow
->getReportSection().isUiActive();
560 ::rtl::OUString sText
= String(ModuleRes(RID_STR_DELETE
));
561 aReturn
.sTitle
= sText
;
564 case SID_GRID_VISIBLE
:
565 aReturn
.bEnabled
= isEditable();
566 aReturn
.bChecked
= m_bGridVisible
;
569 aReturn
.bEnabled
= isEditable();
570 aReturn
.bChecked
= m_bGridUse
;
572 case SID_HELPLINES_MOVE
:
573 aReturn
.bEnabled
= isEditable();
574 aReturn
.bChecked
= m_bHelplinesMove
;
577 aReturn
.bEnabled
= isEditable();
578 aReturn
.bChecked
= m_bShowRuler
;
580 case SID_OBJECT_SELECT
:
581 aReturn
.bEnabled
= sal_True
;
582 aReturn
.bChecked
= m_pMyOwnView
->GetMode() == RPTUI_SELECT
;
584 case SID_INSERT_DIAGRAM
:
585 aReturn
.bEnabled
= isEditable();
586 aReturn
.bInvisible
= optional
< bool >(!m_bChartEnabled
);
587 aReturn
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_OLE2
;
589 case SID_FM_FIXEDTEXT
:
590 aReturn
.bEnabled
= isEditable();
591 aReturn
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_DLG_FIXEDTEXT
;
593 case SID_INSERT_HFIXEDLINE
:
594 aReturn
.bEnabled
= isEditable();
595 aReturn
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_DLG_HFIXEDLINE
;
597 case SID_INSERT_VFIXEDLINE
:
598 aReturn
.bEnabled
= isEditable();
599 aReturn
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_DLG_VFIXEDLINE
;
602 aReturn
.bEnabled
= isEditable();
603 aReturn
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_DLG_FORMATTEDFIELD
;
605 case SID_FM_IMAGECONTROL
:
606 aReturn
.bEnabled
= isEditable();
607 aReturn
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_DLG_IMAGECONTROL
;
609 case SID_DRAWTBX_CS_BASIC
:
610 case SID_DRAWTBX_CS_BASIC1
:
611 case SID_DRAWTBX_CS_BASIC2
:
612 case SID_DRAWTBX_CS_BASIC3
:
613 case SID_DRAWTBX_CS_BASIC4
:
614 case SID_DRAWTBX_CS_BASIC5
:
615 case SID_DRAWTBX_CS_BASIC6
:
616 case SID_DRAWTBX_CS_BASIC7
:
617 case SID_DRAWTBX_CS_BASIC8
:
618 case SID_DRAWTBX_CS_BASIC9
:
619 case SID_DRAWTBX_CS_BASIC10
:
620 case SID_DRAWTBX_CS_BASIC11
:
621 case SID_DRAWTBX_CS_BASIC12
:
622 case SID_DRAWTBX_CS_BASIC13
:
623 case SID_DRAWTBX_CS_BASIC14
:
624 case SID_DRAWTBX_CS_BASIC15
:
625 case SID_DRAWTBX_CS_BASIC16
:
626 case SID_DRAWTBX_CS_BASIC17
:
627 case SID_DRAWTBX_CS_BASIC18
:
628 case SID_DRAWTBX_CS_BASIC19
:
629 case SID_DRAWTBX_CS_BASIC20
:
630 case SID_DRAWTBX_CS_BASIC21
:
631 case SID_DRAWTBX_CS_BASIC22
:
632 impl_fillCustomShapeState_nothrow("diamond",aReturn
);
634 case SID_DRAWTBX_CS_SYMBOL
:
635 case SID_DRAWTBX_CS_SYMBOL1
:
636 case SID_DRAWTBX_CS_SYMBOL2
:
637 case SID_DRAWTBX_CS_SYMBOL3
:
638 case SID_DRAWTBX_CS_SYMBOL4
:
639 case SID_DRAWTBX_CS_SYMBOL5
:
640 case SID_DRAWTBX_CS_SYMBOL6
:
641 case SID_DRAWTBX_CS_SYMBOL7
:
642 case SID_DRAWTBX_CS_SYMBOL8
:
643 case SID_DRAWTBX_CS_SYMBOL9
:
644 case SID_DRAWTBX_CS_SYMBOL10
:
645 case SID_DRAWTBX_CS_SYMBOL11
:
646 case SID_DRAWTBX_CS_SYMBOL12
:
647 case SID_DRAWTBX_CS_SYMBOL13
:
648 case SID_DRAWTBX_CS_SYMBOL14
:
649 case SID_DRAWTBX_CS_SYMBOL15
:
650 case SID_DRAWTBX_CS_SYMBOL16
:
651 case SID_DRAWTBX_CS_SYMBOL17
:
652 case SID_DRAWTBX_CS_SYMBOL18
:
653 impl_fillCustomShapeState_nothrow("smiley",aReturn
);
655 case SID_DRAWTBX_CS_ARROW
:
656 case SID_DRAWTBX_CS_ARROW1
:
657 case SID_DRAWTBX_CS_ARROW2
:
658 case SID_DRAWTBX_CS_ARROW3
:
659 case SID_DRAWTBX_CS_ARROW4
:
660 case SID_DRAWTBX_CS_ARROW5
:
661 case SID_DRAWTBX_CS_ARROW6
:
662 case SID_DRAWTBX_CS_ARROW7
:
663 case SID_DRAWTBX_CS_ARROW8
:
664 case SID_DRAWTBX_CS_ARROW9
:
665 case SID_DRAWTBX_CS_ARROW10
:
666 case SID_DRAWTBX_CS_ARROW11
:
667 case SID_DRAWTBX_CS_ARROW12
:
668 case SID_DRAWTBX_CS_ARROW13
:
669 case SID_DRAWTBX_CS_ARROW14
:
670 case SID_DRAWTBX_CS_ARROW15
:
671 case SID_DRAWTBX_CS_ARROW16
:
672 case SID_DRAWTBX_CS_ARROW17
:
673 case SID_DRAWTBX_CS_ARROW18
:
674 case SID_DRAWTBX_CS_ARROW19
:
675 case SID_DRAWTBX_CS_ARROW20
:
676 case SID_DRAWTBX_CS_ARROW21
:
677 case SID_DRAWTBX_CS_ARROW22
:
678 case SID_DRAWTBX_CS_ARROW23
:
679 case SID_DRAWTBX_CS_ARROW24
:
680 case SID_DRAWTBX_CS_ARROW25
:
681 case SID_DRAWTBX_CS_ARROW26
:
682 impl_fillCustomShapeState_nothrow("left-right-arrow",aReturn
);
684 case SID_DRAWTBX_CS_STAR
:
685 case SID_DRAWTBX_CS_STAR1
:
686 case SID_DRAWTBX_CS_STAR2
:
687 case SID_DRAWTBX_CS_STAR3
:
688 case SID_DRAWTBX_CS_STAR4
:
689 case SID_DRAWTBX_CS_STAR5
:
690 case SID_DRAWTBX_CS_STAR6
:
691 case SID_DRAWTBX_CS_STAR7
:
692 case SID_DRAWTBX_CS_STAR8
:
693 case SID_DRAWTBX_CS_STAR9
:
694 case SID_DRAWTBX_CS_STAR10
:
695 case SID_DRAWTBX_CS_STAR11
:
696 case SID_DRAWTBX_CS_STAR12
:
697 impl_fillCustomShapeState_nothrow("star5",aReturn
);
699 case SID_DRAWTBX_CS_FLOWCHART
:
700 case SID_DRAWTBX_CS_FLOWCHART1
:
701 case SID_DRAWTBX_CS_FLOWCHART2
:
702 case SID_DRAWTBX_CS_FLOWCHART3
:
703 case SID_DRAWTBX_CS_FLOWCHART4
:
704 case SID_DRAWTBX_CS_FLOWCHART5
:
705 case SID_DRAWTBX_CS_FLOWCHART6
:
706 case SID_DRAWTBX_CS_FLOWCHART7
:
707 case SID_DRAWTBX_CS_FLOWCHART8
:
708 case SID_DRAWTBX_CS_FLOWCHART9
:
709 case SID_DRAWTBX_CS_FLOWCHART10
:
710 case SID_DRAWTBX_CS_FLOWCHART11
:
711 case SID_DRAWTBX_CS_FLOWCHART12
:
712 case SID_DRAWTBX_CS_FLOWCHART13
:
713 case SID_DRAWTBX_CS_FLOWCHART14
:
714 case SID_DRAWTBX_CS_FLOWCHART15
:
715 case SID_DRAWTBX_CS_FLOWCHART16
:
716 case SID_DRAWTBX_CS_FLOWCHART17
:
717 case SID_DRAWTBX_CS_FLOWCHART18
:
718 case SID_DRAWTBX_CS_FLOWCHART19
:
719 case SID_DRAWTBX_CS_FLOWCHART20
:
720 case SID_DRAWTBX_CS_FLOWCHART21
:
721 case SID_DRAWTBX_CS_FLOWCHART22
:
722 case SID_DRAWTBX_CS_FLOWCHART23
:
723 case SID_DRAWTBX_CS_FLOWCHART24
:
724 case SID_DRAWTBX_CS_FLOWCHART25
:
725 case SID_DRAWTBX_CS_FLOWCHART26
:
726 case SID_DRAWTBX_CS_FLOWCHART27
:
727 case SID_DRAWTBX_CS_FLOWCHART28
:
728 impl_fillCustomShapeState_nothrow("flowchart-internal-storage",aReturn
);
730 case SID_DRAWTBX_CS_CALLOUT
:
731 case SID_DRAWTBX_CS_CALLOUT1
:
732 case SID_DRAWTBX_CS_CALLOUT2
:
733 case SID_DRAWTBX_CS_CALLOUT3
:
734 case SID_DRAWTBX_CS_CALLOUT4
:
735 case SID_DRAWTBX_CS_CALLOUT5
:
736 case SID_DRAWTBX_CS_CALLOUT6
:
737 case SID_DRAWTBX_CS_CALLOUT7
:
738 impl_fillCustomShapeState_nothrow("round-rectangular-callout",aReturn
);
740 case SID_RPT_SHOWREPORTEXPLORER
:
741 aReturn
.bEnabled
= m_xReportDefinition
.is();
742 aReturn
.bChecked
= m_pMyOwnView
&& m_pMyOwnView
->isReportExplorerVisible();
744 case SID_FM_ADD_FIELD
:
745 aReturn
.bEnabled
= isConnected() && isEditable() && m_xReportDefinition
.is()
746 && m_xReportDefinition
->getCommand().getLength();
747 aReturn
.bChecked
= m_pMyOwnView
&& m_pMyOwnView
->isAddFieldVisible();
749 case SID_SHOW_PROPERTYBROWSER
:
750 aReturn
.bEnabled
= sal_True
;
751 aReturn
.bChecked
= m_bShowProperties
;
753 case SID_PROPERTYBROWSER_LAST_PAGE
:
754 aReturn
.bEnabled
= sal_True
;
755 aReturn
.aValue
<<= m_sLastActivePage
;
757 case SID_SPLIT_POSITION
:
758 aReturn
.bEnabled
= sal_True
;
759 aReturn
.aValue
<<= getSplitPos();
762 aReturn
.bEnabled
= isModified() && isEditable();
765 aReturn
.bEnabled
= isConnected() && isEditable();
768 aReturn
.bChecked
= isEditable();
771 aReturn
.bEnabled
= isEditable();
773 case SID_BACKGROUND_COLOR
:
774 impl_fillState_nothrow(PROPERTY_CONTROLBACKGROUND
,aReturn
);
776 case SID_ATTR_CHAR_COLOR_BACKGROUND
:
777 aReturn
.bEnabled
= isEditable();
779 uno::Reference
<report::XSection
> xSection
= m_pMyOwnView
->getCurrentSection();
783 aReturn
.aValue
<<= xSection
->getBackColor();
784 const uno::Reference
< report::XReportControlModel
> xControlModel(m_pMyOwnView
->getCurrentControlModel(),uno::UNO_QUERY
);
785 aReturn
.bEnabled
= !xControlModel
.is();
787 catch(beans::UnknownPropertyException
&)
791 aReturn
.bEnabled
= sal_False
;
794 case SID_SORTINGANDGROUPING
:
795 aReturn
.bEnabled
= sal_True
;
796 aReturn
.bChecked
= m_pGroupsFloater
&& m_pGroupsFloater
->IsVisible();
798 case SID_ATTR_CHAR_WEIGHT
:
799 case SID_ATTR_CHAR_POSTURE
:
800 case SID_ATTR_CHAR_UNDERLINE
:
801 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR
,aReturn
);
802 if ( aReturn
.bEnabled
)
804 awt::FontDescriptor aFontDescriptor
;
805 aReturn
.aValue
>>= aFontDescriptor
;
806 aReturn
.aValue
.clear();
810 case SID_ATTR_CHAR_WEIGHT
:
811 aReturn
.bChecked
= awt::FontWeight::BOLD
== aFontDescriptor
.Weight
;
813 case SID_ATTR_CHAR_POSTURE
:
814 aReturn
.bChecked
= awt::FontSlant_ITALIC
== aFontDescriptor
.Slant
;
816 case SID_ATTR_CHAR_UNDERLINE
:
817 aReturn
.bChecked
= awt::FontUnderline::SINGLE
== aFontDescriptor
.Underline
;
821 } // switch(_nCommand)
824 case SID_ATTR_CHAR_COLOR
:
825 case SID_ATTR_CHAR_COLOR2
:
826 impl_fillState_nothrow(PROPERTY_CHARCOLOR
,aReturn
);
828 case SID_ATTR_CHAR_FONT
:
829 impl_fillState_nothrow(PROPERTY_FONTDESCRIPTOR
,aReturn
);
831 case SID_ATTR_CHAR_FONTHEIGHT
:
832 impl_fillState_nothrow(PROPERTY_CHARHEIGHT
,aReturn
);
833 if ( aReturn
.aValue
.hasValue() )
835 frame::status::FontHeight aFontHeight
;
836 aReturn
.aValue
>>= aFontHeight
.Height
;
837 aReturn
.aValue
<<= aFontHeight
; // another type is needed here, so
840 case SID_ATTR_PARA_ADJUST_LEFT
:
841 case SID_ATTR_PARA_ADJUST_CENTER
:
842 case SID_ATTR_PARA_ADJUST_RIGHT
:
843 impl_fillState_nothrow(PROPERTY_PARAADJUST
,aReturn
);
844 if ( aReturn
.bEnabled
)
846 ::sal_Int16 nParaAdjust
= 0;
847 if ( aReturn
.aValue
>>= nParaAdjust
)
851 case awt::TextAlign::LEFT
:
852 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_LEFT
;
854 case awt::TextAlign::CENTER
:
855 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_CENTER
;
857 case awt::TextAlign::RIGHT
:
858 aReturn
.bChecked
= _nId
== SID_ATTR_PARA_ADJUST_RIGHT
;
861 } // if ( aReturn.aValue >>= nParaAdjust )
862 aReturn
.aValue
.clear();
866 case SID_INSERT_GRAPHIC
:
867 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable() && m_pMyOwnView
->getCurrentSection().is();
870 case SID_SETCONTROLDEFAULTS
:
871 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable();// && m_pMyOwnView->getCurrentControlModel().is();
872 if ( aReturn
.bEnabled
)
874 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
875 m_pMyOwnView
->fillControlModelSelection(aSelection
);
876 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
877 for(; aIter
!= aSelection
.end()
878 && !uno::Reference
< report::XFixedLine
>(*aIter
,uno::UNO_QUERY
).is()
879 && !uno::Reference
< report::XImageControl
>(*aIter
,uno::UNO_QUERY
).is()
880 && uno::Reference
< report::XReportControlFormat
>(*aIter
,uno::UNO_QUERY
).is() ;++aIter
)
882 aReturn
.bEnabled
= !aSelection
.empty() && aIter
== aSelection
.end();
885 case SID_CONDITIONALFORMATTING
:
887 const uno::Reference
< report::XFormattedField
> xFormattedField(m_pMyOwnView
->getCurrentControlModel(),uno::UNO_QUERY
);
888 aReturn
.bEnabled
= xFormattedField
.is();
891 case SID_INSERT_FLD_PGNUMBER
:
893 aReturn
.bEnabled
= m_xReportDefinition
.is() && isEditable() && m_pMyOwnView
->getCurrentSection().is();
896 case SID_EXPORTDOCASPDF
:
897 aReturn
.bEnabled
= m_xReportDefinition
.is();
899 case SID_PRINTPREVIEW
:
900 aReturn
.bEnabled
= sal_False
;
903 aReturn
.bEnabled
= sal_True
;
905 SvxZoomItem
aZoom(m_eZoomType
,m_nZoomValue
);
906 aZoom
.SetValueSet(SVX_ZOOM_ENABLE_50
|SVX_ZOOM_ENABLE_75
|SVX_ZOOM_ENABLE_100
|SVX_ZOOM_ENABLE_200
);
907 aZoom
.QueryValue(aReturn
.aValue
);
908 //aReturn.sTitle = ::rtl::OUString::valueOf((sal_Int32)m_nZoomValue);
911 case SID_ATTR_ZOOMSLIDER
:
912 aReturn
.bEnabled
= sal_True
;
914 SvxZoomSliderItem
aZoomSlider(m_nZoomValue
,20,400);
915 aZoomSlider
.AddSnappingPoint(50);
916 aZoomSlider
.AddSnappingPoint(75);
917 aZoomSlider
.AddSnappingPoint(100);
918 aZoomSlider
.AddSnappingPoint(200);
919 aZoomSlider
.QueryValue(aReturn
.aValue
);
920 //aReturn.sTitle = ::rtl::OUString::valueOf((sal_Int32)m_nZoomValue);
924 aReturn
= OReportController_BASE::GetState(_nId
);
929 // -----------------------------------------------------------------------------
932 /** extracts a background color from a dispatched SID_BACKGROUND_COLOR call
934 The dispatch might originate from either the toolbar, or the conditional
935 formatting dialog. In both cases, argument formats are different.
937 util::Color
lcl_extractBackgroundColor( const Sequence
< PropertyValue
>& _rDispatchArgs
)
939 util::Color
aColor( COL_TRANSPARENT
);
940 if ( _rDispatchArgs
.getLength() == 1 )
942 OSL_VERIFY( _rDispatchArgs
[0].Value
>>= aColor
);
946 SequenceAsHashMap
aMap( _rDispatchArgs
);
947 aColor
= aMap
.getUnpackedValueOrDefault( PROPERTY_FONTCOLOR
, aColor
);
953 // -----------------------------------------------------------------------------
954 void OReportController::Execute(sal_uInt16 _nId
, const Sequence
< PropertyValue
>& aArgs
)
956 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
957 ::osl::MutexGuard
aGuard( getMutex() );
963 OSL_ENSURE(aArgs
.getLength() == 1,"Invalid length!");
964 aArgs
[0].Value
>>= m_bShowRuler
;
966 case SID_HELPLINES_MOVE
:
967 OSL_ENSURE(aArgs
.getLength() == 1,"Invalid length!");
968 aArgs
[0].Value
>>= m_bHelplinesMove
;
970 case SID_GRID_VISIBLE
:
971 OSL_ENSURE(aArgs
.getLength() == 1,"Invalid length!");
972 aArgs
[0].Value
>>= m_bGridVisible
;
974 case SID_SHOW_PROPERTYBROWSER
:
975 OSL_ENSURE(aArgs
.getLength() == 1,"Invalid length!");
976 aArgs
[0].Value
>>= m_bShowProperties
;
978 case SID_PROPERTYBROWSER_LAST_PAGE
:
979 OSL_ENSURE(aArgs
.getLength() == 1,"Invalid length!");
980 aArgs
[0].Value
>>= m_sLastActivePage
;
982 case SID_SPLIT_POSITION
:
983 OSL_ENSURE(aArgs
.getLength() == 1,"Invalid length!");
984 aArgs
[0].Value
>>= m_nSplitPos
;
987 return; // return without execution
989 sal_Bool bForceBroadcast
= sal_False
;
992 case SID_RPT_TEXTDOCUMENT
:
993 if ( m_xReportDefinition
.is() )
994 m_xReportDefinition
->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_TEXT
);
996 case SID_RPT_SPREADSHEET
:
997 if (m_xReportDefinition
.is() )
998 m_xReportDefinition
->setMimeType( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET
);
1000 case SID_REPORTHEADER_WITHOUT_UNDO
:
1001 case SID_REPORTFOOTER_WITHOUT_UNDO
:
1002 case SID_REPORTHEADERFOOTER
:
1003 switchReportSection(_nId
);
1005 case SID_PAGEHEADER_WITHOUT_UNDO
:
1006 case SID_PAGEFOOTER_WITHOUT_UNDO
:
1007 case SID_PAGEHEADERFOOTER
:
1008 switchPageSection(_nId
);
1010 case SID_GROUP_APPEND
:
1011 case SID_GROUP_REMOVE
:
1012 modifyGroup(_nId
== SID_GROUP_APPEND
,aArgs
);
1014 case SID_GROUPHEADER_WITHOUT_UNDO
:
1015 case SID_GROUPHEADER
:
1016 createGroupSection(SID_GROUPHEADER
== _nId
,true,aArgs
);
1018 case SID_GROUPFOOTER_WITHOUT_UNDO
:
1019 case SID_GROUPFOOTER
:
1020 createGroupSection(SID_GROUPFOOTER
== _nId
,false,aArgs
);
1022 case SID_ADD_CONTROL_PAIR
:
1023 addPairControls(aArgs
);
1028 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
1029 OReportController_BASE::Execute( _nId
, aArgs
);
1035 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION
,::std::mem_fun(&ODesignView::Cut
));
1038 m_pMyOwnView
->Copy();
1041 executeMethodWithUndo(RID_STR_UNDO_PASTE
,::std::mem_fun(&ODesignView::Paste
));
1044 case SID_FRAME_TO_TOP
:
1045 case SID_FRAME_DOWN
:
1047 case SID_FRAME_TO_BOTTOM
:
1048 case SID_OBJECT_HEAVEN
:
1049 case SID_OBJECT_HELL
:
1052 case SID_DISTRIBUTION
:
1054 OSectionView
* pSectionView
= getCurrentSectionView();
1056 pSectionView
->DistributeMarkedObjects();
1059 case SID_OBJECT_SMALLESTWIDTH
:
1060 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::WIDTH_SMALLEST
);
1062 case SID_OBJECT_SMALLESTHEIGHT
:
1063 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::HEIGHT_SMALLEST
);
1065 case SID_OBJECT_GREATESTWIDTH
:
1066 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::WIDTH_GREATEST
);
1068 case SID_OBJECT_GREATESTHEIGHT
:
1069 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::HEIGHT_GREATEST
);
1071 case SID_SECTION_ALIGN_LEFT
:
1072 case SID_OBJECT_ALIGN_LEFT
:
1073 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::LEFT
,SID_SECTION_ALIGN_LEFT
== _nId
);
1075 case SID_SECTION_ALIGN_CENTER
:
1076 case SID_OBJECT_ALIGN_CENTER
:
1077 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::CENTER_HORIZONTAL
,SID_SECTION_ALIGN_CENTER
== _nId
);
1079 case SID_SECTION_ALIGN_RIGHT
:
1080 case SID_OBJECT_ALIGN_RIGHT
:
1081 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::RIGHT
,SID_SECTION_ALIGN_RIGHT
== _nId
);
1083 case SID_SECTION_ALIGN_UP
:
1084 case SID_OBJECT_ALIGN_UP
:
1085 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::TOP
,SID_SECTION_ALIGN_UP
== _nId
);
1087 case SID_SECTION_ALIGN_MIDDLE
:
1088 case SID_OBJECT_ALIGN_MIDDLE
:
1089 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::CENTER_VERTICAL
,SID_SECTION_ALIGN_MIDDLE
== _nId
);
1091 case SID_SECTION_ALIGN_DOWN
:
1092 case SID_OBJECT_ALIGN_DOWN
:
1093 alignControlsWithUndo(RID_STR_UNDO_ALIGNMENT
,ControlModification::BOTTOM
,SID_SECTION_ALIGN_DOWN
== _nId
);
1096 m_pMyOwnView
->SelectAll(OBJ_NONE
);
1098 case SID_SELECTALL_IN_SECTION
:
1100 OSectionView
* pSectionView
= getCurrentSectionView();
1102 pSectionView
->MarkAll();
1106 m_pMyOwnView
->SetMode(RPTUI_SELECT
);
1107 InvalidateFeature( SID_OBJECT_SELECT
);
1109 case SID_SELECT_ALL_EDITS
:
1110 m_pMyOwnView
->SelectAll(OBJ_DLG_FORMATTEDFIELD
);
1112 case SID_SELECT_ALL_LABELS
:
1113 m_pMyOwnView
->SelectAll(OBJ_DLG_FIXEDTEXT
);
1115 case SID_TERMINATE_INPLACEACTIVATION
:
1117 ::boost::shared_ptr
<OSectionWindow
> pSection
= m_pMyOwnView
->getMarkedSection();
1119 pSection
->getReportSection().deactivateOle();
1123 if ( aArgs
.getLength() == 1 )
1124 select(aArgs
[0].Value
);
1126 case SID_SELECT_REPORT
:
1127 select(uno::makeAny(m_xReportDefinition
));
1129 case SID_EXECUTE_REPORT
:
1130 /*m_nExecuteReportEvent = */getView()->PostUserEvent(LINK(this, OReportController
,OnExecuteReport
));
1132 case SID_RPT_NEW_FUNCTION
:
1133 createNewFunction(aArgs
[0].Value
);
1142 if ( aArgs
.getLength() == 1 )
1144 uno::Reference
< report::XFunction
> xFunction
;
1145 aArgs
[0].Value
>>= xFunction
;
1146 if ( xFunction
.is() )
1148 uno::Reference
< report::XFunctions
> xFunctions(xFunction
->getParent(),uno::UNO_QUERY_THROW
);
1149 sal_Int32 nIndex
= getPositionInIndexAccess(xFunctions
.get(),xFunction
);
1150 const String sUndoAction
= String((ModuleRes(RID_STR_UNDO_REMOVE_FUNCTION
)));
1151 UndoManagerListAction
aListAction(m_aUndoManager
,sUndoAction
);
1152 xFunctions
->removeByIndex(nIndex
);
1153 select(uno::makeAny(xFunctions
->getParent()));
1154 InvalidateFeature( SID_SAVEDOC
);
1155 InvalidateFeature( SID_UNDO
);
1159 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION
,::std::mem_fun(&ODesignView::Delete
));
1162 m_pMyOwnView
->setGridSnap(m_bGridUse
= !m_bGridUse
);
1164 case SID_HELPLINES_MOVE
:
1165 m_pMyOwnView
->setDragStripes(m_bHelplinesMove
= !m_bHelplinesMove
);
1167 case SID_GRID_VISIBLE
:
1168 m_pMyOwnView
->toggleGrid(m_bGridVisible
= !m_bGridVisible
);
1171 m_pMyOwnView
->showRuler(m_bShowRuler
= !m_bShowRuler
);
1173 case SID_OBJECT_SELECT
:
1174 m_pMyOwnView
->SetMode(RPTUI_SELECT
);
1177 case SID_INSERT_DIAGRAM
:
1179 OSectionView* pView = getCurrentSectionView();
1182 Reference< awt::XWindow> xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent());
1183 InsertChart(m_xContext,m_xReportDefinition.get(),xWindow,pView,getSdrModel().get());
1186 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1187 m_pMyOwnView
->SetInsertObj( OBJ_OLE2
);
1188 createDefaultControl(aArgs
);
1191 case SID_FM_FIXEDTEXT
:
1192 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1193 m_pMyOwnView
->SetInsertObj( OBJ_DLG_FIXEDTEXT
);
1194 createDefaultControl(aArgs
);
1197 case SID_INSERT_HFIXEDLINE
:
1198 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1199 m_pMyOwnView
->SetInsertObj( OBJ_DLG_HFIXEDLINE
);
1200 createDefaultControl(aArgs
);
1203 case SID_INSERT_VFIXEDLINE
:
1204 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1205 m_pMyOwnView
->SetInsertObj( OBJ_DLG_VFIXEDLINE
);
1206 createDefaultControl(aArgs
);
1210 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1211 m_pMyOwnView
->SetInsertObj( OBJ_DLG_FORMATTEDFIELD
);
1212 createDefaultControl(aArgs
);
1215 case SID_FM_IMAGECONTROL
:
1216 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1217 m_pMyOwnView
->SetInsertObj( OBJ_DLG_IMAGECONTROL
);
1218 createDefaultControl(aArgs
);
1221 case SID_DRAWTBX_CS_BASIC
:
1222 case SID_DRAWTBX_CS_BASIC1
:
1223 case SID_DRAWTBX_CS_BASIC2
:
1224 case SID_DRAWTBX_CS_BASIC3
:
1225 case SID_DRAWTBX_CS_BASIC4
:
1226 case SID_DRAWTBX_CS_BASIC5
:
1227 case SID_DRAWTBX_CS_BASIC6
:
1228 case SID_DRAWTBX_CS_BASIC7
:
1229 case SID_DRAWTBX_CS_BASIC8
:
1230 case SID_DRAWTBX_CS_BASIC9
:
1231 case SID_DRAWTBX_CS_BASIC10
:
1232 case SID_DRAWTBX_CS_BASIC11
:
1233 case SID_DRAWTBX_CS_BASIC12
:
1234 case SID_DRAWTBX_CS_BASIC13
:
1235 case SID_DRAWTBX_CS_BASIC14
:
1236 case SID_DRAWTBX_CS_BASIC15
:
1237 case SID_DRAWTBX_CS_BASIC16
:
1238 case SID_DRAWTBX_CS_BASIC17
:
1239 case SID_DRAWTBX_CS_BASIC18
:
1240 case SID_DRAWTBX_CS_BASIC19
:
1241 case SID_DRAWTBX_CS_BASIC20
:
1242 case SID_DRAWTBX_CS_BASIC21
:
1243 case SID_DRAWTBX_CS_BASIC22
:
1244 case SID_DRAWTBX_CS_SYMBOL1
:
1245 case SID_DRAWTBX_CS_SYMBOL2
:
1246 case SID_DRAWTBX_CS_SYMBOL3
:
1247 case SID_DRAWTBX_CS_SYMBOL4
:
1248 case SID_DRAWTBX_CS_SYMBOL5
:
1249 case SID_DRAWTBX_CS_SYMBOL6
:
1250 case SID_DRAWTBX_CS_SYMBOL7
:
1251 case SID_DRAWTBX_CS_SYMBOL8
:
1252 case SID_DRAWTBX_CS_SYMBOL9
:
1253 case SID_DRAWTBX_CS_SYMBOL10
:
1254 case SID_DRAWTBX_CS_SYMBOL11
:
1255 case SID_DRAWTBX_CS_SYMBOL12
:
1256 case SID_DRAWTBX_CS_SYMBOL13
:
1257 case SID_DRAWTBX_CS_SYMBOL14
:
1258 case SID_DRAWTBX_CS_SYMBOL15
:
1259 case SID_DRAWTBX_CS_SYMBOL16
:
1260 case SID_DRAWTBX_CS_SYMBOL17
:
1261 case SID_DRAWTBX_CS_SYMBOL18
:
1262 case SID_DRAWTBX_CS_ARROW1
:
1263 case SID_DRAWTBX_CS_ARROW2
:
1264 case SID_DRAWTBX_CS_ARROW3
:
1265 case SID_DRAWTBX_CS_ARROW4
:
1266 case SID_DRAWTBX_CS_ARROW5
:
1267 case SID_DRAWTBX_CS_ARROW6
:
1268 case SID_DRAWTBX_CS_ARROW7
:
1269 case SID_DRAWTBX_CS_ARROW8
:
1270 case SID_DRAWTBX_CS_ARROW9
:
1271 case SID_DRAWTBX_CS_ARROW10
:
1272 case SID_DRAWTBX_CS_ARROW11
:
1273 case SID_DRAWTBX_CS_ARROW12
:
1274 case SID_DRAWTBX_CS_ARROW13
:
1275 case SID_DRAWTBX_CS_ARROW14
:
1276 case SID_DRAWTBX_CS_ARROW15
:
1277 case SID_DRAWTBX_CS_ARROW16
:
1278 case SID_DRAWTBX_CS_ARROW17
:
1279 case SID_DRAWTBX_CS_ARROW18
:
1280 case SID_DRAWTBX_CS_ARROW19
:
1281 case SID_DRAWTBX_CS_ARROW20
:
1282 case SID_DRAWTBX_CS_ARROW21
:
1283 case SID_DRAWTBX_CS_ARROW22
:
1284 case SID_DRAWTBX_CS_ARROW23
:
1285 case SID_DRAWTBX_CS_ARROW24
:
1286 case SID_DRAWTBX_CS_ARROW25
:
1287 case SID_DRAWTBX_CS_ARROW26
:
1288 case SID_DRAWTBX_CS_STAR1
:
1289 case SID_DRAWTBX_CS_STAR2
:
1290 case SID_DRAWTBX_CS_STAR3
:
1291 case SID_DRAWTBX_CS_STAR4
:
1292 case SID_DRAWTBX_CS_STAR5
:
1293 case SID_DRAWTBX_CS_STAR6
:
1294 case SID_DRAWTBX_CS_STAR7
:
1295 case SID_DRAWTBX_CS_STAR8
:
1296 case SID_DRAWTBX_CS_STAR9
:
1297 case SID_DRAWTBX_CS_STAR10
:
1298 case SID_DRAWTBX_CS_STAR11
:
1299 case SID_DRAWTBX_CS_STAR12
:
1300 case SID_DRAWTBX_CS_FLOWCHART1
:
1301 case SID_DRAWTBX_CS_FLOWCHART2
:
1302 case SID_DRAWTBX_CS_FLOWCHART3
:
1303 case SID_DRAWTBX_CS_FLOWCHART4
:
1304 case SID_DRAWTBX_CS_FLOWCHART5
:
1305 case SID_DRAWTBX_CS_FLOWCHART6
:
1306 case SID_DRAWTBX_CS_FLOWCHART7
:
1307 case SID_DRAWTBX_CS_FLOWCHART8
:
1308 case SID_DRAWTBX_CS_FLOWCHART9
:
1309 case SID_DRAWTBX_CS_FLOWCHART10
:
1310 case SID_DRAWTBX_CS_FLOWCHART11
:
1311 case SID_DRAWTBX_CS_FLOWCHART12
:
1312 case SID_DRAWTBX_CS_FLOWCHART13
:
1313 case SID_DRAWTBX_CS_FLOWCHART14
:
1314 case SID_DRAWTBX_CS_FLOWCHART15
:
1315 case SID_DRAWTBX_CS_FLOWCHART16
:
1316 case SID_DRAWTBX_CS_FLOWCHART17
:
1317 case SID_DRAWTBX_CS_FLOWCHART18
:
1318 case SID_DRAWTBX_CS_FLOWCHART19
:
1319 case SID_DRAWTBX_CS_FLOWCHART20
:
1320 case SID_DRAWTBX_CS_FLOWCHART21
:
1321 case SID_DRAWTBX_CS_FLOWCHART22
:
1322 case SID_DRAWTBX_CS_FLOWCHART23
:
1323 case SID_DRAWTBX_CS_FLOWCHART24
:
1324 case SID_DRAWTBX_CS_FLOWCHART25
:
1325 case SID_DRAWTBX_CS_FLOWCHART26
:
1326 case SID_DRAWTBX_CS_FLOWCHART27
:
1327 case SID_DRAWTBX_CS_FLOWCHART28
:
1328 case SID_DRAWTBX_CS_CALLOUT1
:
1329 case SID_DRAWTBX_CS_CALLOUT2
:
1330 case SID_DRAWTBX_CS_CALLOUT3
:
1331 case SID_DRAWTBX_CS_CALLOUT4
:
1332 case SID_DRAWTBX_CS_CALLOUT5
:
1333 case SID_DRAWTBX_CS_CALLOUT6
:
1334 case SID_DRAWTBX_CS_CALLOUT7
:
1335 case SID_DRAWTBX_CS_SYMBOL
:
1336 case SID_DRAWTBX_CS_ARROW
:
1337 case SID_DRAWTBX_CS_FLOWCHART
:
1338 case SID_DRAWTBX_CS_CALLOUT
:
1339 case SID_DRAWTBX_CS_STAR
:
1340 m_pMyOwnView
->SetMode( RPTUI_INSERT
);
1342 URL aUrl
= getURLForId(_nId
);
1343 sal_Int32 nIndex
= 1;
1344 ::rtl::OUString sType
= aUrl
.Complete
.getToken(0,'.',nIndex
);
1345 if ( nIndex
== -1 || !sType
.getLength() )
1349 case SID_DRAWTBX_CS_SYMBOL
:
1350 sType
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("smiley"));
1352 case SID_DRAWTBX_CS_ARROW
:
1353 sType
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("left-right-arrow"));
1355 case SID_DRAWTBX_CS_FLOWCHART
:
1356 sType
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flowchart-internal-storage"));
1358 case SID_DRAWTBX_CS_CALLOUT
:
1359 sType
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("round-rectangular-callout"));
1361 case SID_DRAWTBX_CS_STAR
:
1362 sType
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("star5"));
1364 case SID_DRAWTBX_CS_BASIC
:
1366 sType
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diamond"));
1370 sType
= aUrl
.Complete
.getToken(0,'.',nIndex
);
1372 m_pMyOwnView
->SetInsertObj( OBJ_CUSTOMSHAPE
,sType
);
1373 createDefaultControl(aArgs
);
1377 case SID_RPT_SHOWREPORTEXPLORER
:
1378 if ( isUiVisible() )
1379 m_pMyOwnView
->toggleReportExplorer();
1381 case SID_FM_ADD_FIELD
:
1382 if ( isUiVisible() )
1383 m_pMyOwnView
->toggleAddField();
1385 case SID_SHOW_PROPERTYBROWSER
:
1386 if ( m_bShowProperties
)
1387 m_sLastActivePage
= m_pMyOwnView
->getCurrentPage();
1389 m_pMyOwnView
->setCurrentPage(m_sLastActivePage
);
1391 if ( isUiVisible() )
1393 m_bShowProperties
= !m_bShowProperties
;
1394 if ( aArgs
.getLength() == 1 )
1395 aArgs
[0].Value
>>= m_bShowProperties
;
1397 m_pMyOwnView
->togglePropertyBrowser(m_bShowProperties
);
1400 case SID_PROPERTYBROWSER_LAST_PAGE
: // nothing to do
1401 m_sLastActivePage
= m_pMyOwnView
->getCurrentPage();
1403 case SID_SPLIT_POSITION
:
1404 m_pMyOwnView
->Resize();
1406 case SID_PAGEDIALOG
:
1407 case SID_ATTR_CHAR_COLOR_BACKGROUND
:
1409 uno::Reference
<report::XSection
> xSection
;
1410 if (aArgs
.getLength() == 1 )
1411 aArgs
[0].Value
>>= xSection
;
1412 openPageDialog(xSection
);
1413 bForceBroadcast
= sal_True
;
1416 case SID_SORTINGANDGROUPING
:
1417 openSortingAndGroupingDialog();
1418 m_bGroupFloaterWasVisible
= m_pGroupsFloater
&& m_pGroupsFloater
->IsVisible();
1420 case SID_BACKGROUND_COLOR
:
1422 const util::Color
aColor( lcl_extractBackgroundColor( aArgs
) );
1423 if ( !impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CONTROLBACKGROUND
,uno::makeAny(aColor
),aArgs
) )
1425 uno::Reference
< report::XSection
> xSection
= m_pMyOwnView
->getCurrentSection();
1426 if ( xSection
.is() )
1428 xSection
->setBackColor( aColor
);
1431 bForceBroadcast
= sal_True
;
1434 case SID_ATTR_CHAR_WEIGHT
:
1435 case SID_ATTR_CHAR_POSTURE
:
1436 case SID_ATTR_CHAR_UNDERLINE
:
1438 ::std::auto_ptr
<UndoManagerListAction
> pListAction
;
1439 uno::Reference
< awt::XWindow
> xWindow
;
1440 ::std::vector
< uno::Reference
< uno::XInterface
> > aControlsFormats
;
1441 lcl_getReportControlFormat(aArgs
,m_pMyOwnView
,xWindow
,aControlsFormats
);
1442 bool bMulti
= aControlsFormats
.size() > 1;
1443 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aControlsFormats
.begin();
1444 for(; aIter
!= aControlsFormats
.end();++aIter
)
1446 if ( !pListAction
.get() && bMulti
)
1448 const String
sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT
));
1449 pListAction
.reset(new UndoManagerListAction(m_aUndoManager
,sUndoAction
));
1450 } // if ( !pListAction.get() )
1451 uno::Reference
< report::XReportControlFormat
> xReportControlFormat(*aIter
,uno::UNO_QUERY
);
1452 lcl_setFontWPU_nothrow(xReportControlFormat
,_nId
);
1456 case SID_ATTR_CHAR_COLOR
:
1457 case SID_ATTR_CHAR_COLOR2
:
1459 const SequenceAsHashMap
aMap(aArgs
);
1460 const util::Color aColor
= aMap
.getUnpackedValueOrDefault(PROPERTY_FONTCOLOR
,util::Color());
1461 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARCOLOR
,uno::makeAny(aColor
),aArgs
);
1462 bForceBroadcast
= sal_True
;
1465 case SID_ATTR_CHAR_FONT
:
1466 if ( aArgs
.getLength() == 1 )
1468 awt::FontDescriptor aFont
;
1469 if ( aArgs
[0].Value
>>= aFont
)
1471 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARFONTNAME
,uno::makeAny(aFont
.Name
),aArgs
);
1472 } // if ( aArgs[0].Value >>= aFont )
1475 case SID_ATTR_CHAR_FONTHEIGHT
:
1476 if ( aArgs
.getLength() == 1 )
1478 float fSelVal
= 0.0;
1479 if ( aArgs
[0].Value
>>= fSelVal
)
1480 impl_setPropertyAtControls_throw(RID_STR_UNDO_CHANGEFONT
,PROPERTY_CHARHEIGHT
,aArgs
[0].Value
,aArgs
);
1483 case SID_ATTR_PARA_ADJUST_LEFT
:
1484 case SID_ATTR_PARA_ADJUST_CENTER
:
1485 case SID_ATTR_PARA_ADJUST_RIGHT
:
1487 sal_Int16 nValue
= awt::TextAlign::LEFT
;
1490 case SID_ATTR_PARA_ADJUST_LEFT
:
1491 nValue
= awt::TextAlign::LEFT
;
1493 case SID_ATTR_PARA_ADJUST_CENTER
:
1494 nValue
= awt::TextAlign::CENTER
;
1496 case SID_ATTR_PARA_ADJUST_RIGHT
:
1497 nValue
= awt::TextAlign::RIGHT
;
1500 impl_setPropertyAtControls_throw(RID_STR_UNDO_ALIGNMENT
,PROPERTY_PARAADJUST
,uno::makeAny(nValue
),aArgs
);
1502 InvalidateFeature(SID_ATTR_PARA_ADJUST_LEFT
);
1503 InvalidateFeature(SID_ATTR_PARA_ADJUST_CENTER
);
1504 InvalidateFeature(SID_ATTR_PARA_ADJUST_RIGHT
);
1509 ::std::auto_ptr
<UndoManagerListAction
> pListAction
;
1510 uno::Sequence
< beans::NamedValue
> aSettings
;
1511 uno::Reference
< awt::XWindow
> xWindow
;
1512 ::std::vector
< uno::Reference
< uno::XInterface
> > aControlsFormats
;
1513 lcl_getReportControlFormat(aArgs
,m_pMyOwnView
,xWindow
,aControlsFormats
);
1514 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aControlsFormats
.begin();
1515 for(; aIter
!= aControlsFormats
.end();++aIter
)
1517 uno::Reference
< report::XReportControlFormat
> xFormat(*aIter
,uno::UNO_QUERY
);
1520 if ( !pListAction
.get() )
1522 const String
sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT
));
1523 pListAction
.reset(new UndoManagerListAction(m_aUndoManager
,sUndoAction
));
1524 rptui::openCharDialog(xFormat
,xWindow
,aSettings
);
1525 } // if ( !pListAction.get() )
1526 applyCharacterSettings( xFormat
, aSettings
);
1528 } // for(; aIter != aControlsFormats.end();++aIter)
1529 if ( !aControlsFormats
.empty() )
1533 //case SID_FM_DESIGN_MODE:
1535 case SID_INSERT_GRAPHIC
:
1538 case SID_SETCONTROLDEFAULTS
:
1540 case SID_CONDITIONALFORMATTING
:
1542 uno::Reference
< report::XFormattedField
> xFormattedField(m_pMyOwnView
->getCurrentControlModel(),uno::UNO_QUERY
);
1543 if ( xFormattedField
.is() )
1545 ConditionalFormattingDialog
aDlg( getView(), xFormattedField
.get(), *this );
1551 if ( m_xReportDefinition
.is() )
1553 if ( !aArgs
.getLength() )
1555 ODateTimeDialog
aDlg(getView(),m_pMyOwnView
->getCurrentSection(),this);
1559 createDateTime(aArgs
);
1560 } // if ( m_xReportDefinition.is() )
1562 case SID_INSERT_FLD_PGNUMBER
:
1563 if ( m_xReportDefinition
.is() )
1565 if ( !aArgs
.getLength() )
1567 OPageNumberDialog
aDlg(getView(),m_xReportDefinition
,this);
1571 createPageNumber(aArgs
);
1572 } // if ( m_xReportDefinition.is() )
1575 case SID_EXPORTDOCASPDF
:
1577 case SID_PRINTPREVIEW
:
1578 if ( m_xReportDefinition
.is() )
1584 { // the state should be changed to not editable
1585 switch (saveModified())
1588 // don't change anything here so return
1591 setModified(sal_False
); // and we are not modified yet
1597 setEditable(!isEditable());
1598 //getJoinView()->setReadOnly(!isEditable());
1604 if ( aArgs
.getLength() == 0 )
1608 else if ( aArgs
.getLength() == 1 && aArgs
[0].Name
.equalsAscii("Zoom") )
1610 SvxZoomItem aZoomItem
;
1611 aZoomItem
.PutValue(aArgs
[0].Value
);
1612 m_nZoomValue
= aZoomItem
.GetValue();
1613 m_eZoomType
= aZoomItem
.GetType();
1614 impl_zoom_nothrow();
1615 } // if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("Zoom") )
1617 case SID_ATTR_ZOOMSLIDER
:
1618 if ( aArgs
.getLength() == 1 && aArgs
[0].Name
.equalsAscii("ZoomSlider") )
1620 SvxZoomSliderItem aZoomSlider
;
1621 aZoomSlider
.PutValue(aArgs
[0].Value
);
1622 m_nZoomValue
= aZoomSlider
.GetValue();
1623 m_eZoomType
= SVX_ZOOM_PERCENT
;
1624 impl_zoom_nothrow();
1628 OReportController_BASE::Execute(_nId
,aArgs
);
1630 InvalidateFeature(_nId
,Reference
< XStatusListener
>(),bForceBroadcast
);
1632 // -----------------------------------------------------------------------------
1633 short OReportController::saveModified()
1637 // -----------------------------------------------------------------------------
1638 void OReportController::impl_initialize( )
1640 OReportController_BASE::impl_initialize();
1642 const ::comphelper::NamedValueCollection
& rArguments( getInitParams() );
1644 rArguments
.get_ensureType( (::rtl::OUString
)PROPERTY_REPORTNAME
, m_sName
);
1645 if ( !m_sName
.getLength() )
1646 rArguments
.get_ensureType( "DocumentTitle", m_sName
);
1650 if ( m_xReportDefinition
.is() )
1652 //m_sName = m_xReportDefinition->getName();
1653 getView()->initialize(); // show the windows and fill with our informations
1654 getUndoMgr()->Clear(); // clear all undo redo things
1656 if ( !m_aReportModel
)
1660 setEditable( !m_aReportModel
->IsReadOnly() );
1661 m_xFormatter
.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY
);
1662 m_xFormatter
->attachNumberFormatsSupplier(Reference
< XNumberFormatsSupplier
>(m_xReportDefinition
,uno::UNO_QUERY
));
1664 if ( !m_xReportDefinition
->getCommand().getLength() && getConnection().is())
1666 uno::Reference
<sdbcx::XTablesSupplier
> xTablesSup(getConnection(),uno::UNO_QUERY_THROW
);
1667 uno::Reference
<container::XNameAccess
> xTables
= xTablesSup
->getTables();
1668 const uno::Sequence
< ::rtl::OUString
> aNames( xTables
->getElementNames() );
1670 if ( aNames
.hasElements() )
1672 m_xReportDefinition
->setCommand(aNames
[0]);
1673 m_xReportDefinition
->setCommandType(sdb::CommandType::TABLE
);
1677 } // if ( m_xReportDefinition.is() )
1679 // check if chart is supported by the engine
1680 checkChartEnabled();
1681 // restore the view data
1682 m_pMyOwnView
->toggleGrid(m_bGridVisible
);
1683 m_pMyOwnView
->showRuler(m_bShowRuler
);
1684 m_pMyOwnView
->togglePropertyBrowser(m_bShowProperties
);
1685 m_pMyOwnView
->setCurrentPage(m_sLastActivePage
);
1686 m_pMyOwnView
->unmarkAllObjects(NULL
);
1688 if ( m_nPageNum
!= -1 )
1690 if ( m_nPageNum
< m_aReportModel
->GetPageCount() )
1692 const OReportPage
* pPage
= dynamic_cast<OReportPage
*>(m_aReportModel
->GetPage(static_cast<sal_uInt16
>(m_nPageNum
)));
1695 uno::Sequence
< beans::PropertyValue
> aArgs(1);
1696 aArgs
[0].Value
<<= pPage
->getSection();
1697 executeUnChecked(SID_SELECT
,aArgs
);
1703 m_pMyOwnView
->collapseSections(m_aCollapsedSections
);
1704 impl_zoom_nothrow();
1705 m_pMyOwnView
->Resize();
1706 m_pMyOwnView
->Invalidate();
1709 if ( m_bShowProperties
&& m_nPageNum
== -1 )
1711 m_sLastActivePage
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data"));
1712 m_pMyOwnView
->setCurrentPage(m_sLastActivePage
);
1713 uno::Sequence
< beans::PropertyValue
> aArgs
;
1714 executeUnChecked(SID_SELECT_REPORT
,aArgs
);
1715 } // if ( m_bShowProperties && m_nPageNum == -1 )
1717 setModified(sal_False
); // and we are not modified yet
1719 // open the global help agent
1720 // we need a Frame but at this time there is no frame, therefore we send a UserEvent
1721 getView()->PostUserEvent(LINK(this, OReportController
, OnOpenHelpAgent
));
1723 catch(const SQLException
&)
1725 OSL_ENSURE(sal_False
, "OReportController::initialize: caught an exception!");
1728 // -----------------------------------------------------------------------------
1729 IMPL_LINK( OReportController
, OnOpenHelpAgent
, void* ,/*_pMemfun*/)
1731 //m_nExecuteReportEvent = 0;
1735 // -----------------------------------------------------------------------------
1736 IMPL_LINK( OReportController
, OnCreateHdl
, OAddFieldWindow
* ,_pAddFieldDlg
)
1738 WaitObject
aObj(m_pMyOwnView
);
1739 uno::Sequence
< beans::PropertyValue
> aArgs
= _pAddFieldDlg
->getSelectedFieldDescriptors();
1740 // we use this way to create undo actions
1741 if ( aArgs
.getLength() )
1743 executeChecked(SID_ADD_CONTROL_PAIR
,aArgs
);
1747 // -----------------------------------------------------------------------------
1749 void OReportController::doOpenHelpAgent()
1751 if (getFrame().is())
1753 rtl::OUString suURL
= rtl::OUString::createFromAscii("vnd.sun.star.help://shared/text/shared/explorer/database/rep_main.xhp?UseDB=no&DbPAR=swriter");
1754 openHelpAgent(suURL
);
1755 // openHelpAgent(68245 /* HID_REPORT_DESIGN... UNKNOWN */ );
1756 // HID_APP_REPORT_TREE
1760 // as long as we don't get a Frame, we send the user event again.
1761 getView()->PostUserEvent(LINK(this, OReportController
, OnOpenHelpAgent
));
1764 // -----------------------------------------------------------------------------
1765 sal_Bool
OReportController::Construct(Window
* pParent
)
1767 m_pMyOwnView
= new ODesignView(pParent
,getORB(),*this);
1768 StartListening(*(m_pMyOwnView
));
1769 m_pView
= m_pMyOwnView
;
1771 // now that we have a view we can create the clipboard listener
1772 m_aSystemClipboard
= TransferableDataHelper::CreateFromSystemClipboard( getView() );
1773 m_aSystemClipboard
.StartClipboardListening( );
1774 m_pClipbordNotifier
= new TransferableClipboardListener( LINK( this, OReportController
, OnClipboardChanged
) );
1775 m_pClipbordNotifier
->acquire();
1776 m_pClipbordNotifier
->AddRemoveListener( getView(), sal_True
);
1778 OReportController_BASE::Construct(pParent
);
1779 //getView()->Show();
1782 // -----------------------------------------------------------------------------
1783 sal_Bool SAL_CALL
OReportController::suspend(sal_Bool
/*_bSuspend*/) throw( RuntimeException
)
1785 if ( getBroadcastHelper().bInDispose
|| getBroadcastHelper().bDisposed
)
1788 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
1789 ::osl::MutexGuard
aGuard( getMutex() );
1791 if ( getView() && getView()->IsInModalMode() )
1794 // this suspend will be handled in the DBAccess interceptor implementation
1797 // -----------------------------------------------------------------------------
1798 void OReportController::describeSupportedFeatures()
1800 OSingleDocumentController::describeSupportedFeatures();
1802 implDescribeSupportedFeature( ".uno:TextDocument", SID_RPT_TEXTDOCUMENT
, CommandGroup::APPLICATION
);
1803 implDescribeSupportedFeature( ".uno:Spreadsheet", SID_RPT_SPREADSHEET
, CommandGroup::APPLICATION
);
1805 implDescribeSupportedFeature( ".uno:Redo", SID_REDO
, CommandGroup::EDIT
);
1806 implDescribeSupportedFeature( ".uno:Undo", SID_UNDO
, CommandGroup::EDIT
);
1807 //implDescribeSupportedFeature( ".uno:PasteSpecial", SID_PASTE, CommandGroup::EDIT );
1808 implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL
, CommandGroup::EDIT
);
1809 implDescribeSupportedFeature( ".uno:SelectAllInSection", SID_SELECTALL_IN_SECTION
, CommandGroup::EDIT
);
1810 implDescribeSupportedFeature( ".uno:Delete", SID_DELETE
, CommandGroup::EDIT
);
1811 implDescribeSupportedFeature( ".uno:SelectReport", SID_SELECT_REPORT
, CommandGroup::EDIT
);
1812 implDescribeSupportedFeature( ".uno:ExecuteReport", SID_EXECUTE_REPORT
, CommandGroup::EDIT
);
1814 implDescribeSupportedFeature( ".uno:GridVisible", SID_GRID_VISIBLE
, CommandGroup::VIEW
);
1815 implDescribeSupportedFeature( ".uno:GridUse", SID_GRID_USE
, CommandGroup::VIEW
);
1816 implDescribeSupportedFeature( ".uno:HelplinesMove", SID_HELPLINES_MOVE
, CommandGroup::VIEW
);
1817 implDescribeSupportedFeature( ".uno:ShowRuler", SID_RULER
, CommandGroup::VIEW
);
1818 implDescribeSupportedFeature( ".uno:AddField", SID_FM_ADD_FIELD
, CommandGroup::VIEW
);
1819 implDescribeSupportedFeature( ".uno:ReportNavigator", SID_RPT_SHOWREPORTEXPLORER
, CommandGroup::VIEW
);
1820 implDescribeSupportedFeature( ".uno:ControlProperties", SID_SHOW_PROPERTYBROWSER
, CommandGroup::VIEW
);
1821 //implDescribeSupportedFeature( ".uno:SwitchControlDesignMode", SID_FM_DESIGN_MODE, CommandGroup::VIEW );
1822 implDescribeSupportedFeature( ".uno:DbSortingAndGrouping", SID_SORTINGANDGROUPING
, CommandGroup::VIEW
);
1823 implDescribeSupportedFeature( ".uno:PageHeaderFooter", SID_PAGEHEADERFOOTER
, CommandGroup::VIEW
);
1824 implDescribeSupportedFeature( ".uno:ReportHeaderFooter", SID_REPORTHEADERFOOTER
, CommandGroup::VIEW
);
1825 implDescribeSupportedFeature( ".uno:ZoomSlider", SID_ATTR_ZOOMSLIDER
, CommandGroup::VIEW
);
1826 implDescribeSupportedFeature( ".uno:Zoom", SID_ATTR_ZOOM
, CommandGroup::VIEW
);
1827 //implDescribeSupportedFeature( ".uno:SwitchControlDesignMode", SID_FM_DESIGN_MODE, CommandGroup::VIEW );
1829 implDescribeSupportedFeature( ".uno:ConditionalFormatting", SID_CONDITIONALFORMATTING
, CommandGroup::FORMAT
);
1830 implDescribeSupportedFeature( ".uno:PageDialog", SID_PAGEDIALOG
, CommandGroup::FORMAT
);
1831 implDescribeSupportedFeature( ".uno:ResetAttributes", SID_SETCONTROLDEFAULTS
, CommandGroup::FORMAT
);
1833 implDescribeSupportedFeature( ".uno:Bold", SID_ATTR_CHAR_WEIGHT
, CommandGroup::FORMAT
);
1834 implDescribeSupportedFeature( ".uno:Italic", SID_ATTR_CHAR_POSTURE
, CommandGroup::FORMAT
);
1835 implDescribeSupportedFeature( ".uno:Underline", SID_ATTR_CHAR_UNDERLINE
, CommandGroup::FORMAT
);
1836 implDescribeSupportedFeature( ".uno:BackColor", SID_ATTR_CHAR_COLOR_BACKGROUND
, CommandGroup::FORMAT
);
1837 implDescribeSupportedFeature( ".uno:BackgroundColor", SID_BACKGROUND_COLOR
, CommandGroup::FORMAT
);
1838 implDescribeSupportedFeature( ".uno:Color", SID_ATTR_CHAR_COLOR
);
1839 implDescribeSupportedFeature( ".uno:FontColor", SID_ATTR_CHAR_COLOR2
, CommandGroup::FORMAT
);
1840 implDescribeSupportedFeature( ".uno:FontDialog", SID_CHAR_DLG
, CommandGroup::FORMAT
);
1841 implDescribeSupportedFeature( ".uno:LeftPara", SID_ATTR_PARA_ADJUST_LEFT
, CommandGroup::FORMAT
);
1842 implDescribeSupportedFeature( ".uno:CenterPara", SID_ATTR_PARA_ADJUST_CENTER
, CommandGroup::FORMAT
);
1843 implDescribeSupportedFeature( ".uno:RightPara", SID_ATTR_PARA_ADJUST_RIGHT
, CommandGroup::FORMAT
);
1844 implDescribeSupportedFeature( ".uno:FontHeight", SID_ATTR_CHAR_FONTHEIGHT
, CommandGroup::FORMAT
);
1845 implDescribeSupportedFeature( ".uno:CharFontName", SID_ATTR_CHAR_FONT
, CommandGroup::FORMAT
);
1847 implDescribeSupportedFeature( ".uno:ArrangeMenu", SID_ARRANGEMENU
, CommandGroup::FORMAT
);
1848 implDescribeSupportedFeature( ".uno:BringToFront", SID_FRAME_TO_TOP
, CommandGroup::FORMAT
);
1849 implDescribeSupportedFeature( ".uno:ObjectBackOne", SID_FRAME_DOWN
, CommandGroup::FORMAT
);
1850 implDescribeSupportedFeature( ".uno:ObjectForwardOne", SID_FRAME_UP
, CommandGroup::FORMAT
);
1851 implDescribeSupportedFeature( ".uno:SendToBack", SID_FRAME_TO_BOTTOM
, CommandGroup::FORMAT
);
1852 implDescribeSupportedFeature( ".uno:SetObjectToForeground", SID_OBJECT_HEAVEN
, CommandGroup::FORMAT
);
1853 implDescribeSupportedFeature( ".uno:SetObjectToBackground", SID_OBJECT_HELL
, CommandGroup::FORMAT
);
1855 implDescribeSupportedFeature( ".uno:ObjectAlign", SID_OBJECT_ALIGN
, CommandGroup::FORMAT
);
1856 implDescribeSupportedFeature( ".uno:ObjectAlignLeft", SID_OBJECT_ALIGN_LEFT
, CommandGroup::FORMAT
);
1857 implDescribeSupportedFeature( ".uno:AlignCenter", SID_OBJECT_ALIGN_CENTER
, CommandGroup::FORMAT
);
1858 implDescribeSupportedFeature( ".uno:ObjectAlignRight", SID_OBJECT_ALIGN_RIGHT
, CommandGroup::FORMAT
);
1859 implDescribeSupportedFeature( ".uno:AlignUp", SID_OBJECT_ALIGN_UP
, CommandGroup::FORMAT
);
1860 implDescribeSupportedFeature( ".uno:AlignMiddle", SID_OBJECT_ALIGN_MIDDLE
, CommandGroup::FORMAT
);
1861 implDescribeSupportedFeature( ".uno:AlignDown", SID_OBJECT_ALIGN_DOWN
, CommandGroup::FORMAT
);
1863 implDescribeSupportedFeature( ".uno:SectionAlign", SID_SECTION_ALIGN
, CommandGroup::FORMAT
);
1864 implDescribeSupportedFeature( ".uno:SectionAlignLeft", SID_SECTION_ALIGN_LEFT
, CommandGroup::FORMAT
);
1865 implDescribeSupportedFeature( ".uno:SectionAlignCenter", SID_SECTION_ALIGN_CENTER
, CommandGroup::FORMAT
);
1866 implDescribeSupportedFeature( ".uno:SectionAlignRight", SID_SECTION_ALIGN_RIGHT
, CommandGroup::FORMAT
);
1867 implDescribeSupportedFeature( ".uno:SectionAlignTop", SID_SECTION_ALIGN_UP
, CommandGroup::FORMAT
);
1868 implDescribeSupportedFeature( ".uno:SectionAlignMiddle", SID_SECTION_ALIGN_MIDDLE
, CommandGroup::FORMAT
);
1869 implDescribeSupportedFeature( ".uno:SectionAlignBottom", SID_SECTION_ALIGN_DOWN
, CommandGroup::FORMAT
);
1871 implDescribeSupportedFeature( ".uno:ObjectResize", SID_OBJECT_RESIZING
, CommandGroup::FORMAT
);
1872 implDescribeSupportedFeature( ".uno:SmallestWidth", SID_OBJECT_SMALLESTWIDTH
, CommandGroup::FORMAT
);
1873 implDescribeSupportedFeature( ".uno:SmallestHeight", SID_OBJECT_SMALLESTHEIGHT
, CommandGroup::FORMAT
);
1874 implDescribeSupportedFeature( ".uno:GreatestWidth", SID_OBJECT_GREATESTWIDTH
, CommandGroup::FORMAT
);
1875 implDescribeSupportedFeature( ".uno:GreatestHeight", SID_OBJECT_GREATESTHEIGHT
, CommandGroup::FORMAT
);
1876 implDescribeSupportedFeature( ".uno:Distribution", SID_DISTRIBUTION
, CommandGroup::FORMAT
);
1878 implDescribeSupportedFeature( ".uno:HelpMenu", SID_HELPMENU
, CommandGroup::APPLICATION
);
1879 implDescribeSupportedFeature( ".uno:ExportTo", SID_EXPORTDOC
, CommandGroup::APPLICATION
);
1880 implDescribeSupportedFeature( ".uno:ExportToPDF", SID_EXPORTDOCASPDF
, CommandGroup::APPLICATION
);
1881 implDescribeSupportedFeature( ".uno:PrintPreview", SID_PRINTPREVIEW
, CommandGroup::APPLICATION
);
1883 implDescribeSupportedFeature( ".uno:NewDoc", SID_NEWDOC
, CommandGroup::DOCUMENT
);
1884 implDescribeSupportedFeature( ".uno:Save", SID_SAVEDOC
, CommandGroup::DOCUMENT
);
1885 implDescribeSupportedFeature( ".uno:SaveAs", SID_SAVEASDOC
, CommandGroup::DOCUMENT
);
1887 implDescribeSupportedFeature( ".uno:InsertPageNumberField", SID_INSERT_FLD_PGNUMBER
, CommandGroup::INSERT
);
1888 implDescribeSupportedFeature( ".uno:InsertDateTimeField", SID_DATETIME
, CommandGroup::INSERT
);
1889 implDescribeSupportedFeature( ".uno:InsertObjectChart", SID_INSERT_DIAGRAM
, CommandGroup::INSERT
);
1890 implDescribeSupportedFeature( ".uno:InsertGraphic", SID_INSERT_GRAPHIC
, CommandGroup::INSERT
);
1892 implDescribeSupportedFeature( ".uno:SelectObject", SID_OBJECT_SELECT
, CommandGroup::INSERT
);
1893 implDescribeSupportedFeature( ".uno:Label", SID_FM_FIXEDTEXT
, CommandGroup::INSERT
);
1894 implDescribeSupportedFeature( ".uno:Edit", SID_FM_EDIT
, CommandGroup::INSERT
);
1895 implDescribeSupportedFeature( ".uno:ImageControl", SID_FM_IMAGECONTROL
, CommandGroup::INSERT
);
1896 implDescribeSupportedFeature( ".uno:HFixedLine", SID_INSERT_HFIXEDLINE
, CommandGroup::INSERT
);
1897 implDescribeSupportedFeature( ".uno:VFixedLine", SID_INSERT_VFIXEDLINE
, CommandGroup::INSERT
);
1900 implDescribeSupportedFeature( ".uno:BasicShapes", SID_DRAWTBX_CS_BASIC
, CommandGroup::INSERT
);
1901 implDescribeSupportedFeature( ".uno:BasicShapes.rectangle", SID_DRAWTBX_CS_BASIC1
, CommandGroup::INSERT
);
1902 implDescribeSupportedFeature( ".uno:BasicShapes.round-rectangle",SID_DRAWTBX_CS_BASIC2
, CommandGroup::INSERT
);
1903 implDescribeSupportedFeature( ".uno:BasicShapes.quadrat", SID_DRAWTBX_CS_BASIC3
, CommandGroup::INSERT
);
1904 implDescribeSupportedFeature( ".uno:BasicShapes.round-quadrat", SID_DRAWTBX_CS_BASIC4
, CommandGroup::INSERT
);
1905 implDescribeSupportedFeature( ".uno:BasicShapes.circle", SID_DRAWTBX_CS_BASIC5
, CommandGroup::INSERT
);
1906 implDescribeSupportedFeature( ".uno:BasicShapes.ellipse", SID_DRAWTBX_CS_BASIC6
, CommandGroup::INSERT
);
1907 implDescribeSupportedFeature( ".uno:BasicShapes.circle-pie", SID_DRAWTBX_CS_BASIC7
, CommandGroup::INSERT
);
1908 implDescribeSupportedFeature( ".uno:BasicShapes.isosceles-triangle",SID_DRAWTBX_CS_BASIC8
, CommandGroup::INSERT
);
1909 implDescribeSupportedFeature( ".uno:BasicShapes.right-triangle",SID_DRAWTBX_CS_BASIC9
, CommandGroup::INSERT
);
1910 implDescribeSupportedFeature( ".uno:BasicShapes.trapezoid", SID_DRAWTBX_CS_BASIC10
, CommandGroup::INSERT
);
1911 implDescribeSupportedFeature( ".uno:BasicShapes.diamond", SID_DRAWTBX_CS_BASIC11
, CommandGroup::INSERT
);
1912 implDescribeSupportedFeature( ".uno:BasicShapes.parallelogram", SID_DRAWTBX_CS_BASIC12
, CommandGroup::INSERT
);
1913 implDescribeSupportedFeature( ".uno:BasicShapes.pentagon", SID_DRAWTBX_CS_BASIC13
, CommandGroup::INSERT
);
1914 implDescribeSupportedFeature( ".uno:BasicShapes.hexagon", SID_DRAWTBX_CS_BASIC14
, CommandGroup::INSERT
);
1915 implDescribeSupportedFeature( ".uno:BasicShapes.octagon", SID_DRAWTBX_CS_BASIC15
, CommandGroup::INSERT
);
1916 implDescribeSupportedFeature( ".uno:BasicShapes.cross", SID_DRAWTBX_CS_BASIC16
, CommandGroup::INSERT
);
1917 implDescribeSupportedFeature( ".uno:BasicShapes.ring", SID_DRAWTBX_CS_BASIC17
, CommandGroup::INSERT
);
1918 implDescribeSupportedFeature( ".uno:BasicShapes.block-arc", SID_DRAWTBX_CS_BASIC18
, CommandGroup::INSERT
);
1919 implDescribeSupportedFeature( ".uno:BasicShapes.can", SID_DRAWTBX_CS_BASIC19
, CommandGroup::INSERT
);
1920 implDescribeSupportedFeature( ".uno:BasicShapes.cube", SID_DRAWTBX_CS_BASIC20
, CommandGroup::INSERT
);
1921 implDescribeSupportedFeature( ".uno:BasicShapes.paper", SID_DRAWTBX_CS_BASIC21
, CommandGroup::INSERT
);
1922 implDescribeSupportedFeature( ".uno:BasicShapes.frame", SID_DRAWTBX_CS_BASIC22
, CommandGroup::INSERT
);
1924 implDescribeSupportedFeature( ".uno:SymbolShapes", SID_DRAWTBX_CS_SYMBOL
, CommandGroup::INSERT
);
1926 implDescribeSupportedFeature( ".uno:SymbolShapes.smiley" , SID_DRAWTBX_CS_SYMBOL1
, CommandGroup::INSERT
);
1927 implDescribeSupportedFeature( ".uno:SymbolShapes.sun" , SID_DRAWTBX_CS_SYMBOL2
, CommandGroup::INSERT
);
1928 implDescribeSupportedFeature( ".uno:SymbolShapes.moon" , SID_DRAWTBX_CS_SYMBOL3
, CommandGroup::INSERT
);
1929 implDescribeSupportedFeature( ".uno:SymbolShapes.lightning" , SID_DRAWTBX_CS_SYMBOL4
, CommandGroup::INSERT
);
1930 implDescribeSupportedFeature( ".uno:SymbolShapes.heart" , SID_DRAWTBX_CS_SYMBOL5
, CommandGroup::INSERT
);
1931 implDescribeSupportedFeature( ".uno:SymbolShapes.flower" , SID_DRAWTBX_CS_SYMBOL6
, CommandGroup::INSERT
);
1932 implDescribeSupportedFeature( ".uno:SymbolShapes.cloud" , SID_DRAWTBX_CS_SYMBOL7
, CommandGroup::INSERT
);
1933 implDescribeSupportedFeature( ".uno:SymbolShapes.forbidden" , SID_DRAWTBX_CS_SYMBOL8
, CommandGroup::INSERT
);
1934 implDescribeSupportedFeature( ".uno:SymbolShapes.puzzle" , SID_DRAWTBX_CS_SYMBOL9
, CommandGroup::INSERT
);
1935 implDescribeSupportedFeature( ".uno:SymbolShapes.bracket-pair" ,SID_DRAWTBX_CS_SYMBOL10
, CommandGroup::INSERT
);
1936 implDescribeSupportedFeature( ".uno:SymbolShapes.left-bracket" ,SID_DRAWTBX_CS_SYMBOL11
, CommandGroup::INSERT
);
1937 implDescribeSupportedFeature( ".uno:SymbolShapes.right-bracket",SID_DRAWTBX_CS_SYMBOL12
, CommandGroup::INSERT
);
1938 implDescribeSupportedFeature( ".uno:SymbolShapes.brace-pair" , SID_DRAWTBX_CS_SYMBOL13
, CommandGroup::INSERT
);
1939 implDescribeSupportedFeature( ".uno:SymbolShapes.left-brace" , SID_DRAWTBX_CS_SYMBOL14
, CommandGroup::INSERT
);
1940 implDescribeSupportedFeature( ".uno:SymbolShapes.right-brace" , SID_DRAWTBX_CS_SYMBOL15
, CommandGroup::INSERT
);
1941 implDescribeSupportedFeature( ".uno:SymbolShapes.quad-bevel" , SID_DRAWTBX_CS_SYMBOL16
, CommandGroup::INSERT
);
1942 implDescribeSupportedFeature( ".uno:SymbolShapes.octagon-bevel",SID_DRAWTBX_CS_SYMBOL17
, CommandGroup::INSERT
);
1943 implDescribeSupportedFeature( ".uno:SymbolShapes.diamond-bevel",SID_DRAWTBX_CS_SYMBOL18
, CommandGroup::INSERT
);
1945 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow" , SID_DRAWTBX_CS_ARROW1
, CommandGroup::INSERT
);
1946 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow" , SID_DRAWTBX_CS_ARROW2
, CommandGroup::INSERT
);
1947 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow" , SID_DRAWTBX_CS_ARROW3
, CommandGroup::INSERT
);
1948 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow" , SID_DRAWTBX_CS_ARROW4
, CommandGroup::INSERT
);
1949 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow" , SID_DRAWTBX_CS_ARROW5
, CommandGroup::INSERT
);
1950 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow" , SID_DRAWTBX_CS_ARROW6
, CommandGroup::INSERT
);
1951 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow" , SID_DRAWTBX_CS_ARROW7
, CommandGroup::INSERT
);
1952 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-down-arrow" , SID_DRAWTBX_CS_ARROW8
, CommandGroup::INSERT
);
1953 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow" , SID_DRAWTBX_CS_ARROW9
, CommandGroup::INSERT
);
1954 implDescribeSupportedFeature( ".uno:ArrowShapes.corner-right-arrow" , SID_DRAWTBX_CS_ARROW10
, CommandGroup::INSERT
);
1955 implDescribeSupportedFeature( ".uno:ArrowShapes.split-arrow" , SID_DRAWTBX_CS_ARROW11
, CommandGroup::INSERT
);
1956 implDescribeSupportedFeature( ".uno:ArrowShapes.striped-right-arrow" , SID_DRAWTBX_CS_ARROW12
, CommandGroup::INSERT
);
1957 implDescribeSupportedFeature( ".uno:ArrowShapes.notched-right-arrow" , SID_DRAWTBX_CS_ARROW13
, CommandGroup::INSERT
);
1958 implDescribeSupportedFeature( ".uno:ArrowShapes.pentagon-right" , SID_DRAWTBX_CS_ARROW14
, CommandGroup::INSERT
);
1959 implDescribeSupportedFeature( ".uno:ArrowShapes.chevron" , SID_DRAWTBX_CS_ARROW15
, CommandGroup::INSERT
);
1960 implDescribeSupportedFeature( ".uno:ArrowShapes.right-arrow-callout" , SID_DRAWTBX_CS_ARROW16
, CommandGroup::INSERT
);
1961 implDescribeSupportedFeature( ".uno:ArrowShapes.left-arrow-callout" , SID_DRAWTBX_CS_ARROW17
, CommandGroup::INSERT
);
1962 implDescribeSupportedFeature( ".uno:ArrowShapes.up-arrow-callout" , SID_DRAWTBX_CS_ARROW18
, CommandGroup::INSERT
);
1963 implDescribeSupportedFeature( ".uno:ArrowShapes.down-arrow-callout" , SID_DRAWTBX_CS_ARROW19
, CommandGroup::INSERT
);
1964 implDescribeSupportedFeature( ".uno:ArrowShapes.left-right-arrow-callout",SID_DRAWTBX_CS_ARROW20
, CommandGroup::INSERT
);
1965 implDescribeSupportedFeature( ".uno:ArrowShapes.up-down-arrow-callout" ,SID_DRAWTBX_CS_ARROW21
, CommandGroup::INSERT
);
1966 implDescribeSupportedFeature( ".uno:ArrowShapes.up-right-arrow-callout",SID_DRAWTBX_CS_ARROW22
, CommandGroup::INSERT
);
1967 implDescribeSupportedFeature( ".uno:ArrowShapes.quad-arrow-callout" , SID_DRAWTBX_CS_ARROW23
, CommandGroup::INSERT
);
1968 implDescribeSupportedFeature( ".uno:ArrowShapes.circular-arrow" , SID_DRAWTBX_CS_ARROW24
, CommandGroup::INSERT
);
1969 implDescribeSupportedFeature( ".uno:ArrowShapes.split-round-arrow" , SID_DRAWTBX_CS_ARROW25
, CommandGroup::INSERT
);
1970 implDescribeSupportedFeature( ".uno:ArrowShapes.s-sharped-arrow" , SID_DRAWTBX_CS_ARROW26
, CommandGroup::INSERT
);
1972 implDescribeSupportedFeature( ".uno:StarShapes.bang" , SID_DRAWTBX_CS_STAR1
, CommandGroup::INSERT
);
1973 implDescribeSupportedFeature( ".uno:StarShapes.star4" , SID_DRAWTBX_CS_STAR2
, CommandGroup::INSERT
);
1974 implDescribeSupportedFeature( ".uno:StarShapes.star5" , SID_DRAWTBX_CS_STAR3
, CommandGroup::INSERT
);
1975 implDescribeSupportedFeature( ".uno:StarShapes.star6" , SID_DRAWTBX_CS_STAR4
, CommandGroup::INSERT
);
1976 implDescribeSupportedFeature( ".uno:StarShapes.star8" , SID_DRAWTBX_CS_STAR5
, CommandGroup::INSERT
);
1977 implDescribeSupportedFeature( ".uno:StarShapes.star12" , SID_DRAWTBX_CS_STAR6
, CommandGroup::INSERT
);
1978 implDescribeSupportedFeature( ".uno:StarShapes.star24" , SID_DRAWTBX_CS_STAR7
, CommandGroup::INSERT
);
1979 implDescribeSupportedFeature( ".uno:StarShapes.concave-star6" , SID_DRAWTBX_CS_STAR8
, CommandGroup::INSERT
);
1980 implDescribeSupportedFeature( ".uno:StarShapes.vertical-scroll" , SID_DRAWTBX_CS_STAR9
, CommandGroup::INSERT
);
1981 implDescribeSupportedFeature( ".uno:StarShapes.horizontal-scroll" , SID_DRAWTBX_CS_STAR10
, CommandGroup::INSERT
);
1982 implDescribeSupportedFeature( ".uno:StarShapes.signet" , SID_DRAWTBX_CS_STAR11
, CommandGroup::INSERT
);
1983 implDescribeSupportedFeature( ".uno:StarShapes.doorplate" , SID_DRAWTBX_CS_STAR12
, CommandGroup::INSERT
);
1985 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-process" , SID_DRAWTBX_CS_FLOWCHART1
, CommandGroup::INSERT
);
1986 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-alternate-process" , SID_DRAWTBX_CS_FLOWCHART2
, CommandGroup::INSERT
);
1987 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-decision" , SID_DRAWTBX_CS_FLOWCHART3
, CommandGroup::INSERT
);
1988 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-data" , SID_DRAWTBX_CS_FLOWCHART4
, CommandGroup::INSERT
);
1989 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-predefined-process" , SID_DRAWTBX_CS_FLOWCHART5
, CommandGroup::INSERT
);
1990 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-internal-storage" , SID_DRAWTBX_CS_FLOWCHART6
, CommandGroup::INSERT
);
1991 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-document" , SID_DRAWTBX_CS_FLOWCHART7
, CommandGroup::INSERT
);
1992 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-multidocument" , SID_DRAWTBX_CS_FLOWCHART8
, CommandGroup::INSERT
);
1993 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-terminator" , SID_DRAWTBX_CS_FLOWCHART9
, CommandGroup::INSERT
);
1994 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-preparation" , SID_DRAWTBX_CS_FLOWCHART10
, CommandGroup::INSERT
);
1995 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-input" , SID_DRAWTBX_CS_FLOWCHART11
, CommandGroup::INSERT
);
1996 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-manual-operation" , SID_DRAWTBX_CS_FLOWCHART12
, CommandGroup::INSERT
);
1997 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-connector" , SID_DRAWTBX_CS_FLOWCHART13
, CommandGroup::INSERT
);
1998 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-off-page-connector" , SID_DRAWTBX_CS_FLOWCHART14
, CommandGroup::INSERT
);
1999 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-card" , SID_DRAWTBX_CS_FLOWCHART15
, CommandGroup::INSERT
);
2000 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-punched-tape" , SID_DRAWTBX_CS_FLOWCHART16
, CommandGroup::INSERT
);
2001 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-summing-junction" , SID_DRAWTBX_CS_FLOWCHART17
, CommandGroup::INSERT
);
2002 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-or" , SID_DRAWTBX_CS_FLOWCHART18
, CommandGroup::INSERT
);
2003 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-collate" , SID_DRAWTBX_CS_FLOWCHART19
, CommandGroup::INSERT
);
2004 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sort" , SID_DRAWTBX_CS_FLOWCHART20
, CommandGroup::INSERT
);
2005 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-extract" , SID_DRAWTBX_CS_FLOWCHART21
, CommandGroup::INSERT
);
2006 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-merge" , SID_DRAWTBX_CS_FLOWCHART22
, CommandGroup::INSERT
);
2007 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-stored-data" , SID_DRAWTBX_CS_FLOWCHART23
, CommandGroup::INSERT
);
2008 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-delay" , SID_DRAWTBX_CS_FLOWCHART24
, CommandGroup::INSERT
);
2009 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-sequential-access" , SID_DRAWTBX_CS_FLOWCHART25
, CommandGroup::INSERT
);
2010 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-magnetic-disk" , SID_DRAWTBX_CS_FLOWCHART26
, CommandGroup::INSERT
);
2011 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-direct-access-storage",SID_DRAWTBX_CS_FLOWCHART27
, CommandGroup::INSERT
);
2012 implDescribeSupportedFeature( ".uno:FlowChartShapes.flowchart-display" , SID_DRAWTBX_CS_FLOWCHART28
, CommandGroup::INSERT
);
2014 implDescribeSupportedFeature( ".uno:CalloutShapes.rectangular-callout" , SID_DRAWTBX_CS_CALLOUT1
, CommandGroup::INSERT
);
2015 implDescribeSupportedFeature( ".uno:CalloutShapes.round-rectangular-callout" , SID_DRAWTBX_CS_CALLOUT2
, CommandGroup::INSERT
);
2016 implDescribeSupportedFeature( ".uno:CalloutShapes.round-callout" , SID_DRAWTBX_CS_CALLOUT3
, CommandGroup::INSERT
);
2017 implDescribeSupportedFeature( ".uno:CalloutShapes.cloud-callout" , SID_DRAWTBX_CS_CALLOUT4
, CommandGroup::INSERT
);
2018 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-1" , SID_DRAWTBX_CS_CALLOUT5
, CommandGroup::INSERT
);
2019 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-2" , SID_DRAWTBX_CS_CALLOUT6
, CommandGroup::INSERT
);
2020 implDescribeSupportedFeature( ".uno:CalloutShapes.line-callout-3" , SID_DRAWTBX_CS_CALLOUT7
, CommandGroup::INSERT
);
2022 implDescribeSupportedFeature( ".uno:ArrowShapes", SID_DRAWTBX_CS_ARROW
, CommandGroup::INSERT
);
2024 implDescribeSupportedFeature( ".uno:FlowChartShapes", SID_DRAWTBX_CS_FLOWCHART
, CommandGroup::INSERT
);
2025 implDescribeSupportedFeature( ".uno:CalloutShapes", SID_DRAWTBX_CS_CALLOUT
, CommandGroup::INSERT
);
2026 implDescribeSupportedFeature( ".uno:StarShapes", SID_DRAWTBX_CS_STAR
, CommandGroup::INSERT
);
2030 implDescribeSupportedFeature( ".uno:Escape", SID_ESCAPE
, CommandGroup::CONTROLS
);
2033 implDescribeSupportedFeature( ".uno:RPT_RPTHEADER_UNDO", SID_REPORTHEADER_WITHOUT_UNDO
);
2034 implDescribeSupportedFeature( ".uno:RPT_RPTFOOTER_UNDO", SID_REPORTFOOTER_WITHOUT_UNDO
);
2035 implDescribeSupportedFeature( ".uno:RPT_PGHEADER_UNDO", SID_PAGEHEADER_WITHOUT_UNDO
);
2036 implDescribeSupportedFeature( ".uno:RPT_PGFOOTER_UNDO", SID_PAGEFOOTER_WITHOUT_UNDO
);
2037 implDescribeSupportedFeature( ".uno:DBBackgroundColor", SID_ATTR_CHAR_COLOR_BACKGROUND
);
2038 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER", SID_GROUPHEADER
);
2039 implDescribeSupportedFeature( ".uno:SID_GROUPHEADER_WITHOUT_UNDO", SID_GROUPHEADER_WITHOUT_UNDO
);
2040 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER", SID_GROUPFOOTER
);
2041 implDescribeSupportedFeature( ".uno:SID_GROUPFOOTER_WITHOUT_UNDO", SID_GROUPFOOTER_WITHOUT_UNDO
);
2042 implDescribeSupportedFeature( ".uno:SID_GROUP_REMOVE", SID_GROUP_REMOVE
);
2043 implDescribeSupportedFeature( ".uno:SID_GROUP_APPEND", SID_GROUP_APPEND
);
2044 implDescribeSupportedFeature( ".uno:SID_ADD_CONTROL_PAIR", SID_ADD_CONTROL_PAIR
);
2045 implDescribeSupportedFeature( ".uno:SplitPosition", SID_SPLIT_POSITION
);
2046 implDescribeSupportedFeature( ".uno:LastPropertyBrowserPage", SID_PROPERTYBROWSER_LAST_PAGE
);
2047 implDescribeSupportedFeature( ".uno:Select", SID_SELECT
);
2048 implDescribeSupportedFeature( ".uno:InsertFunction", SID_RPT_NEW_FUNCTION
);
2049 implDescribeSupportedFeature( ".uno:NextMark", SID_NEXT_MARK
);
2050 implDescribeSupportedFeature( ".uno:PrevMark", SID_PREV_MARK
);
2051 implDescribeSupportedFeature( ".uno:TerminateInplaceActivation", SID_TERMINATE_INPLACEACTIVATION
);
2052 implDescribeSupportedFeature( ".uno:SelectAllLabels", SID_SELECT_ALL_LABELS
);
2053 implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS
);
2055 // -----------------------------------------------------------------------------
2056 SfxUndoManager
* OReportController::getUndoMgr()
2058 return &m_aUndoManager
;
2060 // -----------------------------------------------------------------------------
2061 void OReportController::setModified(sal_Bool _bModified
)
2063 ::osl::MutexGuard
aGuard( getMutex() );
2066 if ( m_xReportDefinition
.is() )
2067 m_xReportDefinition
->setModified(_bModified
);
2068 OSingleDocumentController::setModified(_bModified
);
2070 catch(uno::Exception
)
2073 // -----------------------------------------------------------------------------
2074 void OReportController::losingConnection( )
2076 // let the base class do it's reconnect
2077 OReportController_BASE::losingConnection( );
2081 // -----------------------------------------------------------------------------
2082 void OReportController::onLoadedMenu(const Reference
< frame::XLayoutManager
>& _xLayoutManager
)
2084 if ( _xLayoutManager
.is() )
2086 static const ::rtl::OUString s_sMenu
[] = {
2087 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/statusbar/statusbar"))
2088 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/reportcontrols"))
2089 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/drawbar"))
2090 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/Formatting"))
2091 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/alignmentbar"))
2092 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/sectionalignmentbar"))
2093 ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/resizebar"))
2095 for (size_t i
= 0; i
< sizeof(s_sMenu
)/sizeof(s_sMenu
[0]); ++i
)
2097 _xLayoutManager
->createElement( s_sMenu
[i
] );
2098 _xLayoutManager
->requestElement( s_sMenu
[i
] );
2100 } // if ( _xLayoutManager.is() )
2102 // -----------------------------------------------------------------------------
2103 void OReportController::notifyGroupSections(const ContainerEvent
& _rEvent
,bool _bShow
)
2105 uno::Reference
< report::XGroup
> xGroup(_rEvent
.Element
,uno::UNO_QUERY
);
2108 ::vos::OGuard
aSolarGuard(Application::GetSolarMutex());
2109 ::osl::MutexGuard
aGuard( getMutex() );
2110 sal_Int32 nGroupPos
= 0;
2111 _rEvent
.Accessor
>>= nGroupPos
;
2115 xGroup
->addPropertyChangeListener(PROPERTY_HEADERON
, static_cast<XPropertyChangeListener
*>(this));
2116 xGroup
->addPropertyChangeListener(PROPERTY_FOOTERON
, static_cast<XPropertyChangeListener
*>(this));
2120 xGroup
->removePropertyChangeListener(PROPERTY_HEADERON
, static_cast<XPropertyChangeListener
*>(this));
2121 xGroup
->removePropertyChangeListener(PROPERTY_FOOTERON
, static_cast<XPropertyChangeListener
*>(this));
2124 if ( xGroup
->getHeaderOn() )
2126 groupChange(xGroup
,PROPERTY_HEADERON
,nGroupPos
,_bShow
);
2128 if ( xGroup
->getFooterOn() )
2130 groupChange(xGroup
,PROPERTY_FOOTERON
,nGroupPos
,_bShow
);
2134 // -----------------------------------------------------------------------------
2135 // ::container::XContainerListener
2136 void SAL_CALL
OReportController::elementInserted( const ContainerEvent
& _rEvent
) throw(RuntimeException
)
2138 notifyGroupSections(_rEvent
,true);
2140 // -----------------------------------------------------------------------------
2141 void SAL_CALL
OReportController::elementRemoved( const ContainerEvent
& _rEvent
) throw(RuntimeException
)
2143 notifyGroupSections(_rEvent
,false);
2145 // -----------------------------------------------------------------------------
2146 void SAL_CALL
OReportController::elementReplaced( const ContainerEvent
& /*_rEvent*/ ) throw(RuntimeException
)
2148 ::vos::OGuard
aSolarGuard(Application::GetSolarMutex());
2149 ::osl::MutexGuard
aGuard( getMutex() );
2150 OSL_ENSURE(0,"Not yet implemented!");
2152 // -----------------------------------------------------------------------------
2153 void SAL_CALL
OReportController::propertyChange( const beans::PropertyChangeEvent
& evt
) throw (RuntimeException
)
2155 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
2156 ::osl::MutexGuard
aGuard( getMutex() );
2159 sal_Bool bShow
= sal_False
;
2160 evt
.NewValue
>>= bShow
;
2161 if ( evt
.Source
== m_xReportDefinition
)
2163 if ( evt
.PropertyName
.equals( PROPERTY_REPORTHEADERON
) )
2165 const USHORT nPosition
= m_xReportDefinition
->getPageHeaderOn() ? 1 : 0;
2167 m_pMyOwnView
->addSection(m_xReportDefinition
->getReportHeader(),DBREPORTHEADER
,nPosition
);
2169 m_pMyOwnView
->removeSection(nPosition
);
2171 else if ( evt
.PropertyName
.equals( PROPERTY_REPORTFOOTERON
) )
2173 USHORT nPosition
= m_pMyOwnView
->getSectionCount();
2174 if ( m_xReportDefinition
->getPageFooterOn() )
2177 m_pMyOwnView
->addSection(m_xReportDefinition
->getReportFooter(),DBREPORTFOOTER
,nPosition
);
2179 m_pMyOwnView
->removeSection(nPosition
- 1);
2181 else if ( evt
.PropertyName
.equals( PROPERTY_PAGEHEADERON
) )
2184 m_pMyOwnView
->addSection(m_xReportDefinition
->getPageHeader(),DBPAGEHEADER
,0);
2186 m_pMyOwnView
->removeSection(USHORT(0));
2188 else if ( evt
.PropertyName
.equals( PROPERTY_PAGEFOOTERON
) )
2191 m_pMyOwnView
->addSection(m_xReportDefinition
->getPageFooter(),DBPAGEFOOTER
);
2193 m_pMyOwnView
->removeSection(m_pMyOwnView
->getSectionCount() - 1);
2195 else if ( evt
.PropertyName
.equals( PROPERTY_COMMAND
)
2196 || evt
.PropertyName
.equals( PROPERTY_COMMANDTYPE
)
2197 || evt
.PropertyName
.equals( PROPERTY_ESCAPEPROCESSING
)
2198 || evt
.PropertyName
.equals( PROPERTY_FILTER
)
2201 InvalidateFeature(SID_FM_ADD_FIELD
);
2202 if ( !m_pMyOwnView
->isAddFieldVisible() && isUiVisible() )
2203 m_pMyOwnView
->toggleAddField();
2205 /// TODO: check what we need to notify here TitleHelper
2206 /*else if ( evt.PropertyName.equals( PROPERTY_CAPTION ) )
2208 } // if ( evt.Source == m_xReportDefinition )
2211 uno::Reference
< report::XGroup
> xGroup(evt
.Source
,uno::UNO_QUERY
);
2214 sal_Int32 nGroupPos
= getGroupPosition(xGroup
);
2216 groupChange(xGroup
,evt
.PropertyName
,nGroupPos
,bShow
);
2220 catch(const uno::Exception
&)
2222 DBG_UNHANDLED_EXCEPTION();
2226 // -----------------------------------------------------------------------------
2227 void SAL_CALL
OReportController::disposing( const lang::EventObject
& Source
) throw(uno::RuntimeException
)
2229 OReportController_BASE::disposing(Source
);
2232 // -----------------------------------------------------------------------------
2233 USHORT
lcl_getNonVisbleGroupsBefore( const uno::Reference
< report::XGroups
>& _xGroups
2234 ,sal_Int32 _nGroupPos
2235 ,::std::mem_fun_t
<sal_Bool
,OGroupHelper
>&_pGroupMemberFunction
)
2237 uno::Reference
< report::XGroup
> xGroup
;
2238 USHORT nNonVisibleGroups
= 0;
2239 sal_Int32 nCount
= _xGroups
->getCount();
2240 for( sal_Int32 i
= 0; i
< _nGroupPos
&& i
< nCount
; ++i
)
2242 xGroup
.set(_xGroups
->getByIndex(i
),uno::UNO_QUERY
);
2243 OSL_ENSURE(xGroup
.is(),"Group is NULL! -> GPF");
2244 OGroupHelper
aGroupHelper(xGroup
);
2245 if ( !_pGroupMemberFunction(&aGroupHelper
) )
2246 ++nNonVisibleGroups
;
2248 return nNonVisibleGroups
;
2250 // -----------------------------------------------------------------------------
2251 void OReportController::groupChange( const uno::Reference
< report::XGroup
>& _xGroup
,const ::rtl::OUString
& _sPropName
,sal_Int32 _nGroupPos
,bool _bShow
)
2253 //adjustSectionName(_xGroup,_nGroupPos);
2254 ::std::mem_fun_t
<sal_Bool
,OGroupHelper
> pMemFun
= ::std::mem_fun(&OGroupHelper::getHeaderOn
);
2255 ::std::mem_fun_t
<uno::Reference
<report::XSection
> , OGroupHelper
> pMemFunSection
= ::std::mem_fun(&OGroupHelper::getHeader
);
2256 ::rtl::OUString
sColor(DBGROUPHEADER
);
2257 USHORT nPosition
= 0;
2258 bool bHandle
= false;
2259 if ( _sPropName
.equals( PROPERTY_HEADERON
) )
2261 nPosition
= m_xReportDefinition
->getPageHeaderOn() ? (m_xReportDefinition
->getReportHeaderOn() ? 2 : 1) : (m_xReportDefinition
->getReportHeaderOn() ? 1 : 0);
2262 nPosition
+= (static_cast<USHORT
>(_nGroupPos
) - lcl_getNonVisbleGroupsBefore(m_xReportDefinition
->getGroups(),_nGroupPos
,pMemFun
));
2265 else if ( _sPropName
.equals( PROPERTY_FOOTERON
) )
2267 pMemFun
= ::std::mem_fun(&OGroupHelper::getFooterOn
);
2268 pMemFunSection
= ::std::mem_fun(&OGroupHelper::getFooter
);
2269 nPosition
= m_pMyOwnView
->getSectionCount();
2271 if ( m_xReportDefinition
->getPageFooterOn() )
2273 if ( m_xReportDefinition
->getReportFooterOn() )
2275 sColor
= DBGROUPFOOTER
;
2276 nPosition
-= (static_cast<USHORT
>(_nGroupPos
) - lcl_getNonVisbleGroupsBefore(m_xReportDefinition
->getGroups(),_nGroupPos
,pMemFun
));
2285 OGroupHelper
aGroupHelper(_xGroup
);
2286 m_pMyOwnView
->addSection(pMemFunSection(&aGroupHelper
),sColor
,nPosition
);
2289 m_pMyOwnView
->removeSection(nPosition
);
2292 //------------------------------------------------------------------------------
2293 IMPL_LINK( OReportController
, OnClipboardChanged
, void*, EMPTYARG
)
2295 return OnInvalidateClipboard( NULL
);
2297 //------------------------------------------------------------------------------
2298 IMPL_LINK( OReportController
, NotifyUndoActionHdl
, SfxUndoAction
*, _pUndoAction
)
2300 OSL_ENSURE(_pUndoAction
,"UndoAction is NULL!");
2301 addUndoActionAndInvalidate(_pUndoAction
);
2304 //------------------------------------------------------------------------------
2305 IMPL_LINK(OReportController
, OnInvalidateClipboard
, void*, EMPTYARG
)
2307 InvalidateFeature(SID_CUT
);
2308 InvalidateFeature(SID_COPY
);
2309 InvalidateFeature(SID_PASTE
);
2312 // -----------------------------------------------------------------------------
2313 void OReportController::openPageDialog(const uno::Reference
<report::XSection
>& _xSection
)
2315 if ( !m_xReportDefinition
.is() )
2319 static SfxItemInfo aItemInfos
[] =
2321 { SID_ATTR_LRSPACE
, SFX_ITEM_POOLABLE
},
2322 { SID_ATTR_ULSPACE
, SFX_ITEM_POOLABLE
},
2323 { SID_ATTR_PAGE
, SFX_ITEM_POOLABLE
},
2324 { SID_ATTR_PAGE_SIZE
, SFX_ITEM_POOLABLE
},
2325 { SID_ENUM_PAGE_MODE
, SFX_ITEM_POOLABLE
},
2326 { SID_PAPER_START
, SFX_ITEM_POOLABLE
},
2327 { SID_PAPER_END
, SFX_ITEM_POOLABLE
},
2328 { SID_ATTR_BRUSH
, SFX_ITEM_POOLABLE
},
2329 { SID_FLAG_TYPE
, SFX_ITEM_POOLABLE
},
2330 { SID_ATTR_METRIC
, SFX_ITEM_POOLABLE
}
2333 MeasurementSystem eSystem
= SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
2334 FieldUnit eUserMetric
= MEASURE_METRIC
== eSystem
? FUNIT_CM
: FUNIT_INCH
;
2335 SfxPoolItem
* pDefaults
[] =
2337 new SvxLRSpaceItem(RPTUI_ID_LRSPACE
),
2338 new SvxULSpaceItem(RPTUI_ID_ULSPACE
),
2339 new SvxPageItem(RPTUI_ID_PAGE
),
2340 new SvxSizeItem(RPTUI_ID_SIZE
),
2341 new SfxAllEnumItem(RPTUI_ID_PAGE_MODE
,SVX_PAGE_MODE_STANDARD
),
2342 new SfxAllEnumItem(RPTUI_ID_START
,SVX_PAPER_A4
),
2343 new SfxAllEnumItem(RPTUI_ID_END
,SVX_PAPER_E
),
2344 new SvxBrushItem(ITEMID_BRUSH
),
2345 new SfxUInt16Item(RPTUI_ID_METRIC
,static_cast<UINT16
>(eUserMetric
))
2348 static USHORT pRanges
[] =
2350 RPTUI_ID_LRSPACE
,RPTUI_ID_BRUSH
,
2351 SID_ATTR_METRIC
,SID_ATTR_METRIC
,
2355 SfxItemPool
* pPool
= new SfxItemPool(String::CreateFromAscii("ReportPageProperties"), RPTUI_ID_LRSPACE
,RPTUI_ID_METRIC
, aItemInfos
, pDefaults
);
2356 pPool
->SetDefaultMetric( SFX_MAPUNIT_100TH_MM
); // ripped, don't understand why
2357 pPool
->FreezeIdRanges(); // the same
2361 SfxItemSet
aDescriptor(*pPool
, pRanges
);
2364 if ( _xSection
.is() )
2365 aDescriptor
.Put(SvxBrushItem(::Color(_xSection
->getBackColor()),ITEMID_BRUSH
));
2368 aDescriptor
.Put(SvxSizeItem(RPTUI_ID_SIZE
,VCLSize(getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
))));
2369 aDescriptor
.Put(SvxLRSpaceItem(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
)
2370 ,getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
),0,0,RPTUI_ID_LRSPACE
));
2371 aDescriptor
.Put(SvxULSpaceItem(static_cast<USHORT
>(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_TOPMARGIN
))
2372 ,static_cast<USHORT
>(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_BOTTOMMARGIN
)),RPTUI_ID_ULSPACE
));
2373 aDescriptor
.Put(SfxUInt16Item(SID_ATTR_METRIC
,static_cast<UINT16
>(eUserMetric
)));
2375 uno::Reference
< style::XStyle
> xPageStyle(getUsedStyle(m_xReportDefinition
));
2376 if ( xPageStyle
.is() )
2378 SvxPageItem
aPageItem(RPTUI_ID_PAGE
);
2379 aPageItem
.SetDescName(xPageStyle
->getName());
2380 uno::Reference
<beans::XPropertySet
> xProp(xPageStyle
,uno::UNO_QUERY_THROW
);
2381 aPageItem
.PutValue(xProp
->getPropertyValue(PROPERTY_PAGESTYLELAYOUT
),MID_PAGE_LAYOUT
);
2382 aPageItem
.SetLandscape(getStyleProperty
<sal_Bool
>(m_xReportDefinition
,PROPERTY_ISLANDSCAPE
));
2383 aPageItem
.SetNumType((SvxNumType
)getStyleProperty
<sal_Int16
>(m_xReportDefinition
,PROPERTY_NUMBERINGTYPE
));
2384 aDescriptor
.Put(aPageItem
);
2385 aDescriptor
.Put(SvxBrushItem(::Color(getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_BACKCOLOR
)),RPTUI_ID_BRUSH
));
2389 { // want the dialog to be destroyed before our set
2390 ORptPageDialog
aDlg(getView(), &aDescriptor
, _xSection
.is() ? RID_PAGEDIALOG_BACKGROUND
: RID_PAGEDIALOG_PAGE
);
2391 if (RET_OK
== aDlg
.Execute())
2396 const SfxItemSet
* pSet
= aDlg
.GetOutputItemSet();
2397 if ( _xSection
.is() )
2399 const SfxPoolItem
* pItem
;
2400 if ( SFX_ITEM_SET
== pSet
->GetItemState( RPTUI_ID_BRUSH
,sal_True
,&pItem
))
2401 _xSection
->setBackColor(static_cast<const SvxBrushItem
*>(pItem
)->GetColor().GetColor());
2405 uno::Reference
< beans::XPropertySet
> xProp(getUsedStyle(m_xReportDefinition
),uno::UNO_QUERY_THROW
);
2406 const String
sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEPAGE
));
2407 UndoManagerListAction
aListAction(m_aUndoManager
,sUndoAction
);
2408 const SfxPoolItem
* pItem
= NULL
;
2409 if ( SFX_ITEM_SET
== pSet
->GetItemState( RPTUI_ID_SIZE
,sal_True
,&pItem
))
2411 const Size aPaperSize
= static_cast<const SvxSizeItem
*>(pItem
)->GetSize();
2413 static_cast<const SvxSizeItem
*>(pItem
)->QueryValue(aValue
,MID_SIZE_SIZE
);
2414 xProp
->setPropertyValue(PROPERTY_PAPERSIZE
,aValue
);
2418 if ( SFX_ITEM_SET
== pSet
->GetItemState( RPTUI_ID_LRSPACE
,sal_True
,&pItem
))
2420 xProp
->setPropertyValue(PROPERTY_LEFTMARGIN
,uno::makeAny(static_cast<const SvxLRSpaceItem
*>(pItem
)->GetLeft()));
2421 xProp
->setPropertyValue(PROPERTY_RIGHTMARGIN
,uno::makeAny(static_cast<const SvxLRSpaceItem
*>(pItem
)->GetRight()));
2423 if ( SFX_ITEM_SET
== pSet
->GetItemState( RPTUI_ID_ULSPACE
,sal_True
,&pItem
))
2425 xProp
->setPropertyValue(PROPERTY_TOPMARGIN
,uno::makeAny(static_cast<const SvxULSpaceItem
*>(pItem
)->GetUpper()));
2426 xProp
->setPropertyValue(PROPERTY_BOTTOMMARGIN
,uno::makeAny(static_cast<const SvxULSpaceItem
*>(pItem
)->GetLower()));
2428 if ( SFX_ITEM_SET
== pSet
->GetItemState( RPTUI_ID_PAGE
,sal_True
,&pItem
))
2430 const SvxPageItem
* pPageItem
= static_cast<const SvxPageItem
*>(pItem
);
2431 xProp
->setPropertyValue(PROPERTY_ISLANDSCAPE
,uno::makeAny(static_cast<sal_Bool
>(pPageItem
->IsLandscape())));
2432 xProp
->setPropertyValue(PROPERTY_NUMBERINGTYPE
,uno::makeAny(static_cast<sal_Int16
>(pPageItem
->GetNumType())));
2434 pPageItem
->QueryValue(aValue
,MID_PAGE_LAYOUT
);
2435 xProp
->setPropertyValue(PROPERTY_PAGESTYLELAYOUT
,aValue
);
2438 if ( SFX_ITEM_SET
== pSet
->GetItemState( RPTUI_ID_BRUSH
,sal_True
,&pItem
))
2440 ::Color aBackColor
= static_cast<const SvxBrushItem
*>(pItem
)->GetColor();
2441 xProp
->setPropertyValue(PROPERTY_BACKTRANSPARENT
,uno::makeAny(aBackColor
== COL_TRANSPARENT
));
2442 xProp
->setPropertyValue(PROPERTY_BACKCOLOR
,uno::makeAny(aBackColor
.GetColor()));
2450 DBG_UNHANDLED_EXCEPTION();
2453 SfxItemPool::Free(pPool
);
2455 for (sal_uInt16 i
=0; i
<sizeof(pDefaults
)/sizeof(pDefaults
[0]); ++i
)
2456 delete pDefaults
[i
];
2458 // -----------------------------------------------------------------------------
2459 sal_Bool SAL_CALL
OReportController::attachModel(const uno::Reference
< frame::XModel
> & xModel
) throw( uno::RuntimeException
)
2461 ::osl::MutexGuard
aGuard( getMutex() );
2462 m_xReportDefinition
.set(xModel
,uno::UNO_QUERY
);
2463 return m_xReportDefinition
.is();
2465 // -----------------------------------------------------------------------------
2466 void OReportController::openSortingAndGroupingDialog()
2468 if ( !m_xReportDefinition
.is() )
2470 if ( !m_pGroupsFloater
)
2472 m_pGroupsFloater
= new OGroupsSortingDialog(getView(),!isEditable(),this);
2473 m_pGroupsFloater
->AddEventListener(LINK(this,OReportController
,EventLstHdl
));
2475 else if ( isUiVisible() )
2476 m_pGroupsFloater
->Show(!m_pGroupsFloater
->IsVisible());
2478 // -----------------------------------------------------------------------------
2479 sal_Int32
OReportController::getGroupPosition(const uno::Reference
< report::XGroup
>& _xGroup
)
2481 return rptui::getPositionInIndexAccess(m_xReportDefinition
->getGroups().get(),_xGroup
);
2483 // -----------------------------------------------------------------------------
2484 // -----------------------------------------------------------------------------
2485 IMPL_LINK( OReportController
, EventLstHdl
, VclWindowEvent
*, _pEvent
)
2487 if ( _pEvent
&& _pEvent
->GetId() == VCLEVENT_WINDOW_CLOSE
)
2489 InvalidateFeature(SID_SORTINGANDGROUPING
);
2490 InvalidateFeature(SID_FM_ADD_FIELD
);
2491 InvalidateFeature(SID_RPT_SHOWREPORTEXPLORER
);
2495 // -----------------------------------------------------------------------------
2496 void OReportController::Notify(SfxBroadcaster
& /*rBc*/, SfxHint
const & rHint
)
2498 if (rHint
.ISA(DlgEdHint
)
2499 && (static_cast< DlgEdHint
const & >(rHint
).GetKind()
2500 == RPTUI_HINT_SELECTIONCHANGED
))
2502 const sal_Int32 nSelectionCount
= m_pMyOwnView
->getMarkedObjectCount();
2503 if ( m_nSelectionCount
!= nSelectionCount
)
2505 m_nSelectionCount
= nSelectionCount
;
2508 lang::EventObject
aEvent(*this);
2509 m_aSelectionListeners
.forEach
<view::XSelectionChangeListener
>(
2510 ::boost::bind(&view::XSelectionChangeListener::selectionChanged
,_1
,boost::cref(aEvent
)));
2514 // -----------------------------------------------------------------------------
2515 void OReportController::executeMethodWithUndo(USHORT _nUndoStrId
,const ::std::mem_fun_t
<void,ODesignView
>& _pMemfun
)
2517 const String sUndoAction
= String((ModuleRes(_nUndoStrId
)));
2518 UndoManagerListAction
aListAction(m_aUndoManager
,sUndoAction
);
2519 _pMemfun(m_pMyOwnView
);
2520 InvalidateFeature( SID_SAVEDOC
);
2521 InvalidateFeature( SID_UNDO
);
2523 // -----------------------------------------------------------------------------
2524 void OReportController::alignControlsWithUndo(USHORT _nUndoStrId
,sal_Int32 _nControlModification
,bool _bAlignAtSection
)
2526 const String sUndoAction
= String((ModuleRes(_nUndoStrId
)));
2527 UndoManagerListAction
aListAction(m_aUndoManager
,sUndoAction
);
2528 m_pMyOwnView
->alignMarkedObjects(_nControlModification
,_bAlignAtSection
);
2529 InvalidateFeature( SID_SAVEDOC
);
2530 InvalidateFeature( SID_UNDO
);
2532 // -----------------------------------------------------------------------------
2533 uno::Any SAL_CALL
OReportController::getViewData(void) throw( uno::RuntimeException
)
2535 ::osl::MutexGuard
aGuard( getMutex() );
2536 typedef ::std::pair
< ::rtl::OUString
,sal_uInt16
> TStringIntPair
;
2537 const TStringIntPair pViewDataList
[] =
2539 TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridVisible")), SID_GRID_VISIBLE
)
2540 ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridUse")), SID_GRID_USE
)
2541 ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelplinesMove")), SID_HELPLINES_MOVE
)
2542 ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowRuler")), SID_RULER
)
2543 ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlProperties")), SID_SHOW_PROPERTYBROWSER
)
2544 ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LastPropertyBrowserPage")),SID_PROPERTYBROWSER_LAST_PAGE
)
2545 ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SplitPosition")), SID_SPLIT_POSITION
)
2548 uno::Sequence
<beans::PropertyValue
> aCommandProps(sizeof(pViewDataList
)/sizeof(pViewDataList
[0]));
2549 beans::PropertyValue
* pIter
= aCommandProps
.getArray();
2550 beans::PropertyValue
* pEnd
= pIter
+ aCommandProps
.getLength();
2551 for (sal_Int32 i
= 0; pIter
!= pEnd
; ++pIter
,++i
)
2553 FeatureState aFeatureState
= GetState(pViewDataList
[i
].second
);
2554 pIter
->Name
= pViewDataList
[i
].first
;
2555 if ( !!aFeatureState
.bChecked
)
2556 pIter
->Value
<<= (*aFeatureState
.bChecked
) ? sal_True
: sal_False
;
2557 else if ( aFeatureState
.aValue
.hasValue() )
2558 pIter
->Value
= aFeatureState
.aValue
;
2560 } // for (; pIter != pEnd; ++pIter)
2562 uno::Sequence
<beans::PropertyValue
> aProps(1);
2563 aProps
[0].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandProperties"));
2564 aProps
[0].Value
<<= aCommandProps
;
2568 ::std::vector
<sal_uInt16
> aCollapsedPositions
;
2569 m_pMyOwnView
->fillCollapsedSections(aCollapsedPositions
);
2570 if ( !aCollapsedPositions
.empty() )
2572 uno::Sequence
<beans::PropertyValue
> aCollapsedSections(aCollapsedPositions
.size());
2573 beans::PropertyValue
* pCollapsedIter
= aCollapsedSections
.getArray();
2574 ::std::vector
<sal_uInt16
>::iterator aIter
= aCollapsedPositions
.begin();
2575 ::std::vector
<sal_uInt16
>::iterator aEnd
= aCollapsedPositions
.end();
2576 for (sal_Int32 i
= 1; aIter
!= aEnd
; ++aIter
,++pCollapsedIter
,++i
)
2578 pCollapsedIter
->Name
= PROPERTY_SECTION
+ ::rtl::OUString::valueOf(i
);
2579 pCollapsedIter
->Value
<<= static_cast<sal_Int32
>(*aIter
);
2581 const sal_Int32 nCount
= aProps
.getLength();
2582 aProps
.realloc( nCount
+ 1 );
2583 aProps
[nCount
].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CollapsedSections"));
2584 aProps
[nCount
].Value
<<= aCollapsedSections
;
2587 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= m_pMyOwnView
->getMarkedSection();
2588 if ( pSectionWindow
.get() )
2590 const sal_Int32 nCount
= aProps
.getLength();
2591 aProps
.realloc( nCount
+ 1 );
2592 aProps
[nCount
].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MarkedSection"));
2593 aProps
[nCount
].Value
<<= (sal_Int32
)pSectionWindow
->getReportSection().getPage()->GetPageNum();
2594 } // if ( pSectionWindow.get() )
2595 } // if ( m_pMyOwnView )
2596 const sal_Int32 nCount
= aProps
.getLength();
2597 aProps
.realloc( nCount
+ 1 );
2598 aProps
[nCount
].Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZoomFactor"));
2599 aProps
[nCount
].Value
<<= m_nZoomValue
;
2600 return uno::makeAny(aProps
);
2602 // -----------------------------------------------------------------------------
2603 void SAL_CALL
OReportController::restoreViewData(const uno::Any
& Data
) throw( uno::RuntimeException
)
2605 ::osl::MutexGuard
aGuard( getMutex() );
2606 uno::Sequence
<beans::PropertyValue
> aProps
;
2607 if ( Data
>>= aProps
)
2609 const beans::PropertyValue
* pPropsIter
= aProps
.getConstArray();
2610 const beans::PropertyValue
* pPropsEnd
= pPropsIter
+ aProps
.getLength();
2611 for (sal_Int32 i
= 0; pPropsIter
!= pPropsEnd
; ++pPropsIter
,++i
)
2613 if ( pPropsIter
->Name
.equalsAscii("CommandProperties") )
2616 uno::Sequence
< beans::PropertyValue
> aArgs(1);
2617 beans::PropertyValue
* pArg
= aArgs
.getArray();
2618 pArg
->Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"));
2619 uno::Sequence
< beans::PropertyValue
> aCommandProps
;
2620 if ( pPropsIter
->Value
>>= aCommandProps
)
2622 const beans::PropertyValue
* pIter
= aCommandProps
.getConstArray();
2623 const beans::PropertyValue
* pEnd
= pIter
+ aCommandProps
.getLength();
2624 for (; pIter
!= pEnd
; ++pIter
)
2626 pArg
->Value
= pIter
->Value
;
2627 if ( pArg
->Value
.hasValue() )
2629 aCommand
.Complete
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:")) + pIter
->Name
;
2630 executeUnChecked(aCommand
,aArgs
);
2635 else if ( pPropsIter
->Name
.equalsAscii("CollapsedSections") )
2636 pPropsIter
->Value
>>= m_aCollapsedSections
;
2637 else if ( pPropsIter
->Name
.equalsAscii("MarkedSection") )
2638 pPropsIter
->Value
>>= m_nPageNum
;
2639 else if ( pPropsIter
->Name
.equalsAscii("ZoomFactor") )
2640 pPropsIter
->Value
>>= m_nZoomValue
;
2644 // -----------------------------------------------------------------------------
2645 void OReportController::updateFloater()
2647 if ( m_pGroupsFloater
&& m_pGroupsFloater
->IsVisible() )
2648 m_pGroupsFloater
->UpdateData();
2651 // -----------------------------------------------------------------------------
2652 Reference
<XFrame
> OReportController::getXFrame()
2654 if ( !m_xFrameLoader
.is() )
2656 m_xFrameLoader
.set(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),uno::UNO_QUERY_THROW
);
2658 const sal_Int32 nFrameSearchFlag
= frame::FrameSearchFlag::TASKS
| frame::FrameSearchFlag::CREATE
;
2659 const ::rtl::OUString
sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
2660 Reference
<XFrame
> xFrame
= Reference
<XFrame
>(m_xFrameLoader
,uno::UNO_QUERY_THROW
)->findFrame(sTarget
,nFrameSearchFlag
);
2664 // -----------------------------------------------------------------------------
2665 uno::Reference
<frame::XModel
> OReportController::executeReport()
2667 OSL_ENSURE(m_xReportDefinition
.is(),"Where is my report?");
2669 uno::Reference
<frame::XModel
> xModel
;
2670 if ( m_xReportDefinition
.is() )
2672 sal_uInt16 nErrorId
= RID_ERR_NO_COMMAND
;
2673 bool bEnabled
= m_xReportDefinition
->getCommand().getLength() != 0;
2677 const sal_uInt16 nCount
= m_aReportModel
->GetPageCount();
2679 for (; i
< nCount
&& !bEnabled
; ++i
)
2681 const SdrPage
* pPage
= m_aReportModel
->GetPage(i
);
2682 bEnabled
= pPage
->GetObjCount() != 0;
2685 nErrorId
= RID_ERR_NO_OBJECTS
;
2688 dbtools::SQLExceptionInfo aInfo
;
2691 sdb::SQLContext aFirstMessage
;
2692 String sInfo
= String( ModuleRes( nErrorId
) );
2693 aFirstMessage
.Message
= sInfo
;
2694 aInfo
= aFirstMessage
;
2697 sal_uInt16 nCommand
= 0;
2698 if ( nErrorId
== RID_ERR_NO_COMMAND
)
2700 if ( !m_bShowProperties
)
2701 executeUnChecked(SID_SHOW_PROPERTYBROWSER
,uno::Sequence
< beans::PropertyValue
>());
2703 m_sLastActivePage
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data"));
2704 m_pMyOwnView
->setCurrentPage(m_sLastActivePage
);
2705 nCommand
= SID_SELECT_REPORT
;
2707 else if ( m_pMyOwnView
&& !m_pMyOwnView
->isAddFieldVisible() )
2709 nCommand
= SID_FM_ADD_FIELD
;
2713 uno::Sequence
< beans::PropertyValue
> aArgs
;
2714 executeUnChecked(nCommand
,aArgs
);
2722 WaitObject
aWait(getView()); // cursor
2723 if ( !m_xReportEngine
.is() )
2724 m_xReportEngine
.set(getORB()->createInstance(SERVICE_REPORTENGINE
),uno::UNO_QUERY_THROW
);
2725 m_xReportEngine
->setReportDefinition(m_xReportDefinition
);
2726 m_xReportEngine
->setActiveConnection(getConnection());
2727 Reference
<XFrame
> xFrame
= getXFrame();
2728 xModel
= m_xReportEngine
->createDocumentAlive(xFrame
);
2730 catch( const sdbc::SQLException
& /*e*/ )
2731 { // SQLExceptions and derived exceptions must not be translated
2732 aInfo
= ::cppu::getCaughtException();
2734 catch(const uno::Exception
& e
)
2736 uno::Any
aCaughtException( ::cppu::getCaughtException() );
2738 // our first message says: we caught an exception
2739 sdb::SQLContext aFirstMessage
;
2740 String sInfo
= String( ModuleRes( RID_STR_CAUGHT_FOREIGN_EXCEPTION
) );
2741 sInfo
.SearchAndReplaceAllAscii( "$type$", aCaughtException
.getValueTypeName() );
2742 aFirstMessage
.Message
= sInfo
;
2744 // our second message: the message of the exception we caught
2745 sdbc::SQLException aSecondMessage
;
2746 aSecondMessage
.Message
= e
.Message
;
2747 aSecondMessage
.Context
= e
.Context
;
2749 // maybe our third message: the message which is wrapped in the exception we caught
2750 sdbc::SQLException aThirdMessage
;
2751 lang::WrappedTargetException aWrapped
;
2752 if ( aCaughtException
>>= aWrapped
)
2754 aThirdMessage
.Message
= aWrapped
.Message
;
2755 aThirdMessage
.Context
= aWrapped
.Context
;
2758 if ( aThirdMessage
.Message
.getLength() )
2759 aSecondMessage
.NextException
<<= aThirdMessage
;
2760 aFirstMessage
.NextException
<<= aSecondMessage
;
2762 aInfo
= aFirstMessage
;
2764 if (aInfo
.isValid())
2766 const String suSQLContext
= String( ModuleRes( RID_STR_COULD_NOT_CREATE_REPORT
) );
2767 aInfo
.prepend(suSQLContext
);
2771 if (aInfo
.isValid())
2778 // -----------------------------------------------------------------------------
2779 uno::Reference
< frame::XModel
> SAL_CALL
OReportController::getModel(void) throw( uno::RuntimeException
)
2781 return m_xReportDefinition
.get();
2783 // -----------------------------------------------------------------------------
2784 uno::Reference
< sdbc::XRowSet
> OReportController::getRowSet()
2786 OSL_PRECOND( m_xReportDefinition
.is(), "OReportController::getRowSet: no report definition?!" );
2788 if ( m_xRowSet
.is() || !m_xReportDefinition
.is() )
2793 uno::Reference
< sdbc::XRowSet
> xRowSet( getORB()->createInstance(
2794 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.RowSet" ) ) ), uno::UNO_QUERY
);
2795 uno::Reference
< beans::XPropertySet
> xRowSetProp( xRowSet
, uno::UNO_QUERY_THROW
);
2797 xRowSetProp
->setPropertyValue( PROPERTY_ACTIVECONNECTION
, uno::makeAny( getConnection() ) );
2798 xRowSetProp
->setPropertyValue( PROPERTY_APPLYFILTER
, uno::makeAny( sal_True
) );
2800 TPropertyNamePair aPropertyMediation
;
2801 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_COMMAND
, PROPERTY_COMMAND
) );
2802 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_COMMANDTYPE
, PROPERTY_COMMANDTYPE
) );
2803 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_ESCAPEPROCESSING
, PROPERTY_ESCAPEPROCESSING
) );
2804 aPropertyMediation
.insert( TPropertyNamePair::value_type( PROPERTY_FILTER
, PROPERTY_FILTER
) );
2806 m_xRowSetMediator
= new OPropertyMediator( m_xReportDefinition
.get(), xRowSetProp
, aPropertyMediation
);
2807 m_xRowSet
= xRowSet
;
2809 catch( const uno::Exception
& )
2811 DBG_UNHANDLED_EXCEPTION();
2816 // -----------------------------------------------------------------------------
2817 void OReportController::insertGraphic()
2819 const String
sTitle(ModuleRes(RID_STR_IMPORT_GRAPHIC
));
2820 // build some arguments for the upcoming dialog
2823 uno::Reference
< report::XSection
> xSection
= m_pMyOwnView
->getCurrentSection();
2824 ::sfx2::FileDialogHelper
aDialog( ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW
, SFXWB_GRAPHIC
);
2825 aDialog
.SetTitle( sTitle
);
2827 uno::Reference
< ui::dialogs::XFilePickerControlAccess
> xController(aDialog
.GetFilePicker(), UNO_QUERY_THROW
);
2828 xController
->setValue(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PREVIEW
, 0, ::cppu::bool2any(sal_True
));
2829 xController
->enableControl(ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, sal_False
/*sal_True*/);
2830 sal_Bool bLink
= sal_True
;
2831 xController
->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0, ::cppu::bool2any( bLink
) );
2833 if ( ERRCODE_NONE
== aDialog
.Execute() )
2835 xController
->getValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK
, 0) >>= bLink
;
2836 uno::Sequence
<beans::PropertyValue
> aArgs(2);
2837 aArgs
[0].Name
= PROPERTY_IMAGEURL
;
2838 aArgs
[0].Value
<<= ::rtl::OUString(aDialog
.GetPath());
2839 aArgs
[1].Name
= PROPERTY_PRESERVEIRI
;
2840 aArgs
[1].Value
<<= bLink
;
2841 createControl(aArgs
,xSection
,::rtl::OUString(),OBJ_DLG_IMAGECONTROL
);
2846 DBG_UNHANDLED_EXCEPTION();
2849 // -----------------------------------------------------------------------------
2850 ::boost::shared_ptr
<rptui::OReportModel
> OReportController::getSdrModel()
2852 if ( !m_aReportModel
)
2854 m_aReportModel
= reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition
);
2855 if ( m_aReportModel
)
2857 m_aReportModel
->attachController( *this );
2858 m_aReportModel
->SetNotifyUndoActionHdl(LINK( this, OReportController
, NotifyUndoActionHdl
));
2861 return m_aReportModel
;
2863 // -----------------------------------------------------------------------------
2864 ::sal_Bool SAL_CALL
OReportController::select( const Any
& aSelection
) throw (IllegalArgumentException
, RuntimeException
)
2866 ::osl::MutexGuard
aGuard( getMutex() );
2867 ::sal_Bool bRet
= sal_True
;
2870 m_pMyOwnView
->unmarkAllObjects(NULL
);
2871 m_pMyOwnView
->SetMode(RPTUI_SELECT
);
2873 uno::Sequence
< uno::Reference
<report::XReportComponent
> > aElements
;
2874 if ( aSelection
>>= aElements
)
2876 if ( aElements
.getLength() > 0 )
2877 m_pMyOwnView
->showProperties(uno::Reference
<uno::XInterface
>(aElements
[0],uno::UNO_QUERY
));
2878 m_pMyOwnView
->setMarked(aElements
,sal_True
);
2882 uno::Reference
<uno::XInterface
> xObject(aSelection
,uno::UNO_QUERY
);
2883 uno::Reference
<report::XReportComponent
> xProp(xObject
,uno::UNO_QUERY
);
2886 m_pMyOwnView
->showProperties(xObject
);
2887 aElements
.realloc(1);
2888 aElements
[0] = xProp
;
2889 m_pMyOwnView
->setMarked(aElements
,sal_True
);
2893 uno::Reference
<report::XSection
> xSection(aSelection
,uno::UNO_QUERY
);
2894 if ( !xSection
.is() && xObject
.is() )
2895 m_pMyOwnView
->showProperties(xObject
);
2896 m_pMyOwnView
->setMarked(xSection
,xSection
.is());
2903 // -----------------------------------------------------------------------------
2904 Any SAL_CALL
OReportController::getSelection( ) throw (RuntimeException
)
2906 ::osl::MutexGuard
aGuard( getMutex() );
2910 aRet
= m_pMyOwnView
->getCurrentlyShownProperty();
2911 if ( !aRet
.hasValue() )
2912 aRet
<<= m_pMyOwnView
->getCurrentSection();
2916 // -----------------------------------------------------------------------------
2917 void SAL_CALL
OReportController::addSelectionChangeListener( const Reference
< view::XSelectionChangeListener
>& _Listener
) throw (RuntimeException
)
2919 m_aSelectionListeners
.addInterface( _Listener
);
2921 // -----------------------------------------------------------------------------
2922 void SAL_CALL
OReportController::removeSelectionChangeListener( const Reference
< view::XSelectionChangeListener
>& _Listener
) throw (RuntimeException
)
2924 m_aSelectionListeners
.removeInterface( _Listener
);
2926 // -----------------------------------------------------------------------------
2927 void OReportController::createNewFunction(const uno::Any
& _aValue
)
2929 uno::Reference
< container::XIndexContainer
> xFunctions(_aValue
,uno::UNO_QUERY_THROW
);
2930 const ::rtl::OUString sNewName
= String(ModuleRes(RID_STR_FUNCTION
));
2931 uno::Reference
< report::XFunction
> xFunction(report::Function::create(m_xContext
));
2932 xFunction
->setName(sNewName
);
2933 // the call below will also create an undo action -> listener
2934 xFunctions
->insertByIndex(xFunctions
->getCount(),uno::makeAny(xFunction
));
2936 // -----------------------------------------------------------------------------
2937 IMPL_LINK( OReportController
, OnExecuteReport
, void* ,/*_pMemfun*/)
2939 //m_nExecuteReportEvent = 0;
2943 // -----------------------------------------------------------------------------
2944 void OReportController::createControl(const Sequence
< PropertyValue
>& _aArgs
,const uno::Reference
< report::XSection
>& _xSection
,const ::rtl::OUString
& _sFunction
,sal_uInt16 _nObjectId
)
2946 SequenceAsHashMap
aMap(_aArgs
);
2947 m_pMyOwnView
->setMarked(_xSection
,sal_True
);
2948 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= m_pMyOwnView
->getMarkedSection();
2949 if ( !pSectionWindow
)
2952 OSL_ENSURE(pSectionWindow
->getReportSection().getSection() == _xSection
,"Invalid section after marking the corrct one.");
2954 sal_Int32 nLeftMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
);
2955 const sal_Int32 nRightMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
);
2956 const sal_Int32 nPaperWidth
= getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
).Width
- nRightMargin
;
2957 awt::Point aPos
= aMap
.getUnpackedValueOrDefault(PROPERTY_POSITION
,awt::Point(nLeftMargin
,0));
2958 if ( aPos
.X
< nLeftMargin
)
2959 aPos
.X
= nLeftMargin
;
2961 SdrObject
* pNewControl
= NULL
;
2962 uno::Reference
< report::XReportComponent
> xShapeProp
;
2963 if ( _nObjectId
== OBJ_CUSTOMSHAPE
)
2965 pNewControl
= SdrObjFactory::MakeNewObject( ReportInventor
, _nObjectId
, pSectionWindow
->getReportSection().getPage(),m_aReportModel
.get() );
2966 xShapeProp
.set(pNewControl
->getUnoShape(),uno::UNO_QUERY
);
2967 pSectionWindow
->getReportSection().createDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diamond")),pNewControl
); // TODO: use real custom shape type
2968 } // if ( _nObjectId == OBJ_CUSTOMSHAPE )
2969 else if ( _nObjectId
== OBJ_OLE2
|| OBJ_DLG_SUBREPORT
== _nObjectId
)
2971 pNewControl
= SdrObjFactory::MakeNewObject( ReportInventor
, _nObjectId
, pSectionWindow
->getReportSection().getPage(),m_aReportModel
.get() );
2973 pNewControl
->SetLogicRect(Rectangle(3000,500,8000,5500)); // switch height and width
2974 xShapeProp
.set(pNewControl
->getUnoShape(),uno::UNO_QUERY_THROW
);
2975 OOle2Obj
* pObj
= dynamic_cast<OOle2Obj
*>(pNewControl
);
2976 if ( pObj
&& !pObj
->IsEmpty() )
2978 pObj
->initializeChart(getModel());
2983 SdrUnoObj
* pLabel( NULL
);
2984 SdrUnoObj
* pControl( NULL
);
2985 FmFormView::createControlLabelPair(m_pMyOwnView
2987 ,NULL
,NULL
,_nObjectId
,::rtl::OUString(),ReportInventor
,OBJ_DLG_FIXEDTEXT
,
2988 NULL
,pSectionWindow
->getReportSection().getPage(),m_aReportModel
.get(),
2992 pNewControl
= pControl
;
2993 OUnoObject
* pObj
= dynamic_cast<OUnoObject
*>(pControl
);
2994 uno::Reference
<beans::XPropertySet
> xUnoProp(pObj
->GetUnoControlModel(),uno::UNO_QUERY
);
2995 xShapeProp
.set(pObj
->getUnoShape(),uno::UNO_QUERY
);
2996 uno::Reference
<beans::XPropertySetInfo
> xShapeInfo
= xShapeProp
->getPropertySetInfo();
2997 uno::Reference
<beans::XPropertySetInfo
> xInfo
= xUnoProp
->getPropertySetInfo();
2999 const ::rtl::OUString sProps
[] = { PROPERTY_NAME
3000 ,PROPERTY_FONTDESCRIPTOR
3001 ,PROPERTY_FONTDESCRIPTORASIAN
3002 ,PROPERTY_FONTDESCRIPTORCOMPLEX
3003 ,PROPERTY_ORIENTATION
3005 ,PROPERTY_FORMATSSUPPLIER
3006 ,PROPERTY_BACKGROUNDCOLOR
3008 for(size_t i
= 0; i
< sizeof(sProps
)/sizeof(sProps
[0]);++i
)
3010 if ( xInfo
->hasPropertyByName(sProps
[i
]) && xShapeInfo
->hasPropertyByName(sProps
[i
]) )
3011 xUnoProp
->setPropertyValue(sProps
[i
],xShapeProp
->getPropertyValue(sProps
[i
]));
3012 } // for(size_t i = 0; i < sizeof(sProps)/sizeof(sProps[0]);++i)
3014 if ( xInfo
->hasPropertyByName(PROPERTY_BORDER
) && xShapeInfo
->hasPropertyByName(PROPERTY_CONTROLBORDER
) )
3015 xUnoProp
->setPropertyValue(PROPERTY_BORDER
,xShapeProp
->getPropertyValue(PROPERTY_CONTROLBORDER
));
3018 if ( xInfo
->hasPropertyByName(PROPERTY_DATAFIELD
) && _sFunction
.getLength() )
3020 ReportFormula
aFunctionFormula( ReportFormula::Expression
, _sFunction
);
3021 xUnoProp
->setPropertyValue( PROPERTY_DATAFIELD
, uno::makeAny( aFunctionFormula
.getCompleteFormula() ) );
3024 sal_Int32 nFormatKey
= aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEY
,sal_Int32(0));
3025 if ( nFormatKey
&& xInfo
->hasPropertyByName(PROPERTY_FORMATKEY
) )
3026 xUnoProp
->setPropertyValue( PROPERTY_FORMATKEY
, uno::makeAny( nFormatKey
) );
3028 ::rtl::OUString sUrl
= aMap
.getUnpackedValueOrDefault(PROPERTY_IMAGEURL
,::rtl::OUString());
3029 if ( sUrl
.getLength() && xInfo
->hasPropertyByName(PROPERTY_IMAGEURL
) )
3030 xUnoProp
->setPropertyValue( PROPERTY_IMAGEURL
, uno::makeAny( sUrl
) );
3032 pObj
->CreateMediator(sal_True
);
3034 if ( _nObjectId
== OBJ_DLG_FIXEDTEXT
) // special case for fixed text
3035 xUnoProp
->setPropertyValue(PROPERTY_LABEL
,uno::makeAny(OUnoObject::GetDefaultName(pObj
)));
3036 else if ( _nObjectId
== OBJ_DLG_VFIXEDLINE
)
3038 awt::Size aOlSize
= xShapeProp
->getSize();
3039 xShapeProp
->setSize(awt::Size(aOlSize
.Height
,aOlSize
.Width
)); // switch height and width
3043 const sal_Int32 nShapeWidth
= aMap
.getUnpackedValueOrDefault(PROPERTY_WIDTH
,xShapeProp
->getWidth());
3044 if ( nShapeWidth
!= xShapeProp
->getWidth() )
3045 xShapeProp
->setWidth( nShapeWidth
);
3047 const bool bChangedPos
= (aPos
.X
+ nShapeWidth
) > nPaperWidth
;
3049 aPos
.X
= nPaperWidth
- nShapeWidth
;
3050 xShapeProp
->setPosition(aPos
);
3052 correctOverlapping(pNewControl
,pSectionWindow
->getReportSection());
3054 // -----------------------------------------------------------------------------
3055 void OReportController::createDateTime(const Sequence
< PropertyValue
>& _aArgs
)
3057 m_pMyOwnView
->unmarkAllObjects(NULL
);
3059 const String
sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL
));
3060 UndoManagerListAction
aListAction(m_aUndoManager
,sUndoAction
);
3062 SequenceAsHashMap
aMap(_aArgs
);
3063 aMap
.createItemIfMissing(PROPERTY_FORMATKEY
,aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE
,sal_Int32(0)));
3065 uno::Reference
< report::XSection
> xSection
= aMap
.getUnpackedValueOrDefault(PROPERTY_SECTION
,uno::Reference
< report::XSection
>());
3066 ::rtl::OUString sFunction
;
3068 sal_Bool bDate
= aMap
.getUnpackedValueOrDefault(PROPERTY_DATE_STATE
,sal_False
);
3071 sFunction
= ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("TODAY()"));
3072 createControl(aMap
.getAsConstPropertyValueList(),xSection
,sFunction
);
3074 sal_Bool bTime
= aMap
.getUnpackedValueOrDefault(PROPERTY_TIME_STATE
,sal_False
);
3077 sFunction
= ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("NOW()"));
3078 aMap
[PROPERTY_FORMATKEY
] <<= aMap
.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME
,sal_Int32(0));
3079 createControl(aMap
.getAsConstPropertyValueList(),xSection
,sFunction
);
3082 // -----------------------------------------------------------------------------
3083 void OReportController::createPageNumber(const Sequence
< PropertyValue
>& _aArgs
)
3085 m_pMyOwnView
->unmarkAllObjects(NULL
);
3087 const String
sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL
));
3088 UndoManagerListAction
aListAction(m_aUndoManager
,sUndoAction
);
3090 if ( !m_xReportDefinition
->getPageHeaderOn() )
3092 uno::Sequence
< beans::PropertyValue
> aArgs
;
3093 executeChecked(SID_PAGEHEADERFOOTER
,aArgs
);
3094 } // if ( !m_xHoldAlive->getPageHeaderOn() )
3096 SequenceAsHashMap
aMap(_aArgs
);
3097 sal_Bool bStateOfPage
= aMap
.getUnpackedValueOrDefault(PROPERTY_STATE
,sal_False
);
3099 String sFunction
= String(ModuleRes(STR_RPT_PN_PAGE
));
3100 ::rtl::OUString
sPageNumber(RTL_CONSTASCII_USTRINGPARAM("PageNumber()"));
3101 sFunction
.SearchAndReplace(String::CreateFromAscii("#PAGENUMBER#"),sPageNumber
);
3105 ::rtl::OUString
sPageCount(RTL_CONSTASCII_USTRINGPARAM("PageCount()"));
3106 sFunction
+= String(ModuleRes(STR_RPT_PN_PAGE_OF
));
3107 sFunction
.SearchAndReplace(String::CreateFromAscii("#PAGECOUNT#"),sPageCount
);
3110 sal_Bool bInPageHeader
= aMap
.getUnpackedValueOrDefault(PROPERTY_PAGEHEADERON
,sal_True
);
3111 createControl(_aArgs
,bInPageHeader
? m_xReportDefinition
->getPageHeader() : m_xReportDefinition
->getPageFooter(),sFunction
);
3114 // -----------------------------------------------------------------------------
3115 void OReportController::addPairControls(const Sequence
< PropertyValue
>& aArgs
)
3117 m_pMyOwnView
->unmarkAllObjects(NULL
);
3118 //////////////////////////////////////////////////////////////////////
3119 // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird
3120 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
[2];
3121 pSectionWindow
[0] = m_pMyOwnView
->getMarkedSection();
3123 if ( !pSectionWindow
[0] )
3125 select(uno::makeAny(m_xReportDefinition
->getDetail()));
3126 pSectionWindow
[0] = m_pMyOwnView
->getMarkedSection();
3127 if ( !pSectionWindow
[0] )
3131 uno::Reference
<report::XSection
> xCurrentSection
= m_pMyOwnView
->getCurrentSection();
3132 UndoManagerListAction
aUndo( *getUndoMgr(), String( ModuleRes( RID_STR_UNDO_INSERT_CONTROL
) ) );
3136 bool bHandleOnlyOne
= false;
3137 const PropertyValue
* pIter
= aArgs
.getConstArray();
3138 const PropertyValue
* pEnd
= pIter
+ aArgs
.getLength();
3139 for(;pIter
!= pEnd
&& !bHandleOnlyOne
;++pIter
)
3141 Sequence
< PropertyValue
> aValue
;
3142 if ( !(pIter
->Value
>>= aValue
) )
3143 { // the sequence has only one element which already contains the descriptor
3144 bHandleOnlyOne
= true;
3147 ::svx::ODataAccessDescriptor
aDescriptor(aValue
);
3148 SequenceAsHashMap
aMap(aValue
);
3149 uno::Reference
<report::XSection
> xSection
= aMap
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Section")),xCurrentSection
);
3150 uno::Reference
<report::XReportDefinition
> xReportDefinition
= xSection
->getReportDefinition();
3152 m_pMyOwnView
->setMarked(xSection
,sal_True
);
3153 pSectionWindow
[0] = m_pMyOwnView
->getMarkedSection();
3155 sal_Int32 nLeftMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_LEFTMARGIN
);
3156 awt::Point aPos
= aMap
.getUnpackedValueOrDefault(PROPERTY_POSITION
,awt::Point(nLeftMargin
,0));
3157 if ( aPos
.X
< nLeftMargin
)
3158 aPos
.X
= nLeftMargin
;
3160 // LLA: new feature, add the Label in dependency of the given DND_ACTION one section up, normal or one section down
3161 sal_Int8 nDNDAction
= aMap
.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DNDAction")), sal_Int8(0));
3162 pSectionWindow
[1] = pSectionWindow
[0];
3163 // ::boost::shared_ptr<OReportSection> pReportSectionPost;
3164 sal_Bool bLabelAboveTextField
= nDNDAction
== DND_ACTION_COPY
;
3165 if ( bLabelAboveTextField
|| nDNDAction
== DND_ACTION_LINK
)
3167 // Add the Label one Section up
3168 pSectionWindow
[1] = m_pMyOwnView
->getMarkedSection(bLabelAboveTextField
? PREVIOUS
: POST
);
3169 if (!pSectionWindow
[1])
3171 // maybe out of bounds
3172 pSectionWindow
[1] = pSectionWindow
[0];
3175 // clear all selections
3176 m_pMyOwnView
->unmarkAllObjects(NULL
);
3178 uno::Reference
< beans::XPropertySet
> xField( aDescriptor
[ ::svx::daColumnObject
], uno::UNO_QUERY
);
3179 uno::Reference
< lang::XComponent
> xHoldAlive
;
3182 ::rtl::OUString sCommand
;
3183 ::rtl::OUString sColumnName
;
3184 sal_Int32
nCommandType( -1 );
3185 OSL_VERIFY( aDescriptor
[ ::svx::daCommand
] >>= sCommand
);
3186 OSL_VERIFY( aDescriptor
[ ::svx::daColumnName
] >>= sColumnName
);
3187 OSL_VERIFY( aDescriptor
[ ::svx::daCommandType
] >>= nCommandType
);
3189 uno::Reference
< container::XNameAccess
> xColumns
;
3190 uno::Reference
< sdbc::XConnection
> xConnection( getConnection() );
3191 if ( sCommand
.getLength() && nCommandType
!= -1 && sColumnName
.getLength() && xConnection
.is() )
3193 if ( !xReportDefinition
->getCommand().getLength() )
3195 xReportDefinition
->setCommand(sCommand
);
3196 xReportDefinition
->setCommandType(nCommandType
);
3197 } // if ( !xReportDefinition->getCommand().getLength() )
3199 xColumns
= dbtools::getFieldsByCommandDescriptor(xConnection
,nCommandType
,sCommand
,xHoldAlive
);
3200 if ( xColumns
.is() && xColumns
->hasByName(sColumnName
) )
3201 xField
.set( xColumns
->getByName( sColumnName
), uno::UNO_QUERY
);
3206 #if OSL_DEBUG_LEVEL > 0
3209 uno::Reference
< beans::XPropertySet
> xRowSetProps( getRowSet(), UNO_QUERY_THROW
);
3210 ::rtl::OUString sRowSetCommand
;
3211 sal_Int32
nRowSetCommandType( -1 );
3212 OSL_VERIFY( xRowSetProps
->getPropertyValue( PROPERTY_COMMAND
) >>= sRowSetCommand
);
3213 OSL_VERIFY( xRowSetProps
->getPropertyValue( PROPERTY_COMMANDTYPE
) >>= nRowSetCommandType
);
3214 OSL_ENSURE( ( sRowSetCommand
== sCommand
) && ( nCommandType
== nRowSetCommandType
),
3215 "OReportController::addPairControls: this only works for a data source which equals our current settings!" );
3216 // if this asserts, then either our row set and our report definition are not in sync, or somebody
3217 // requested the creation of a control/pair for another data source than what our report
3218 // definition is bound to - which is not supported for the parameters case, since we
3219 // can retrieve parameters from the RowSet only.
3221 catch( const Exception
& )
3223 DBG_UNHANDLED_EXCEPTION();
3227 // no column name - perhaps a parameter name?
3228 uno::Reference
< sdb::XParametersSupplier
> xSuppParam( getRowSet(), uno::UNO_QUERY_THROW
);
3229 uno::Reference
< container::XIndexAccess
> xParams( xSuppParam
->getParameters(), uno::UNO_QUERY_THROW
);
3230 sal_Int32
nParamCount( xParams
->getCount() );
3231 for ( sal_Int32 i
=0; i
<nParamCount
; ++i
)
3233 uno::Reference
< beans::XPropertySet
> xParamCol( xParams
->getByIndex(i
), uno::UNO_QUERY_THROW
);
3234 ::rtl::OUString sParamName
;
3235 OSL_VERIFY( xParamCol
->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sParamName
);
3236 if ( sParamName
== sColumnName
)
3247 sal_uInt16 nOBJID
= 0;
3248 sal_Int32 nDataType
= sdbc::DataType::BINARY
;
3249 xField
->getPropertyValue(PROPERTY_TYPE
) >>= nDataType
;
3250 switch ( nDataType
)
3252 case sdbc::DataType::BINARY
:
3253 case sdbc::DataType::VARBINARY
:
3254 case sdbc::DataType::LONGVARBINARY
:
3255 nOBJID
= OBJ_DLG_IMAGECONTROL
;
3258 nOBJID
= OBJ_DLG_FORMATTEDFIELD
;
3265 Reference
< util::XNumberFormatsSupplier
> xSupplier
= getReportNumberFormatter()->getNumberFormatsSupplier();
3266 if ( !xSupplier
.is() )
3269 Reference
< XNumberFormats
> xNumberFormats(xSupplier
->getNumberFormats());
3270 SdrUnoObj
* pControl
[2];
3273 //m_pMyOwnView->GetModel()->GetUndoEnv().Lock();
3274 const sal_Int32 nRightMargin
= getStyleProperty
<sal_Int32
>(m_xReportDefinition
,PROPERTY_RIGHTMARGIN
);
3275 const sal_Int32 nPaperWidth
= getStyleProperty
<awt::Size
>(m_xReportDefinition
,PROPERTY_PAPERSIZE
).Width
- nRightMargin
;
3276 OSectionView
* pSectionViews
[2];
3277 pSectionViews
[0] = &pSectionWindow
[1]->getReportSection().getSectionView();
3278 pSectionViews
[1] = &pSectionWindow
[0]->getReportSection().getSectionView();
3280 FmFormView::createControlLabelPair(m_pMyOwnView
3282 ,xField
,xNumberFormats
,nOBJID
,::rtl::OUString(),ReportInventor
,OBJ_DLG_FIXEDTEXT
,
3283 pSectionWindow
[1]->getReportSection().getPage(),pSectionWindow
[0]->getReportSection().getPage(),m_aReportModel
.get(),
3284 pControl
[0],pControl
[1]);
3285 //m_pMyOwnView->GetModel()->GetUndoEnv().UnLock();
3286 if ( pControl
[0] && pControl
[1] )
3288 SdrPageView
* pPgViews
[2];
3289 pPgViews
[0] = pSectionViews
[0]->GetSdrPageView();
3290 pPgViews
[1] = pSectionViews
[1]->GetSdrPageView();
3291 if ( pPgViews
[0] && pPgViews
[1] )
3293 ::rtl::OUString sDefaultName
;
3295 OUnoObject
* pObjs
[2];
3296 for(i
= 0; i
< sizeof(pControl
)/sizeof(pControl
[0]);++i
)
3298 pObjs
[i
] = dynamic_cast<OUnoObject
*>(pControl
[i
]);
3299 uno::Reference
<beans::XPropertySet
> xUnoProp(pObjs
[i
]->GetUnoControlModel(),uno::UNO_QUERY_THROW
);
3300 uno::Reference
< report::XReportComponent
> xShapeProp(pObjs
[i
]->getUnoShape(),uno::UNO_QUERY_THROW
);
3301 xUnoProp
->setPropertyValue(PROPERTY_NAME
,xShapeProp
->getPropertyValue(PROPERTY_NAME
));
3303 uno::Reference
<beans::XPropertySetInfo
> xShapeInfo
= xShapeProp
->getPropertySetInfo();
3304 uno::Reference
<beans::XPropertySetInfo
> xInfo
= xUnoProp
->getPropertySetInfo();
3305 const ::rtl::OUString sProps
[] = { PROPERTY_FONTDESCRIPTOR
3306 ,PROPERTY_FONTDESCRIPTORASIAN
3307 ,PROPERTY_FONTDESCRIPTORCOMPLEX
3309 ,PROPERTY_BACKGROUNDCOLOR
3311 for(size_t k
= 0; k
< sizeof(sProps
)/sizeof(sProps
[0]);++k
)
3313 if ( xInfo
->hasPropertyByName(sProps
[k
]) && xShapeInfo
->hasPropertyByName(sProps
[k
]) )
3314 xUnoProp
->setPropertyValue(sProps
[k
],xShapeProp
->getPropertyValue(sProps
[k
]));
3316 if ( xInfo
->hasPropertyByName(PROPERTY_DATAFIELD
) )
3318 ::rtl::OUString sName
;
3319 xUnoProp
->getPropertyValue(PROPERTY_DATAFIELD
) >>= sName
;
3320 sDefaultName
= sName
;
3321 xUnoProp
->setPropertyValue(PROPERTY_NAME
,uno::makeAny(sDefaultName
));
3323 ReportFormula
aFormula( ReportFormula::Field
, sName
);
3324 xUnoProp
->setPropertyValue( PROPERTY_DATAFIELD
, uno::makeAny( aFormula
.getCompleteFormula() ) );
3325 } // if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
3327 if ( xInfo
->hasPropertyByName(PROPERTY_BORDER
) && xShapeInfo
->hasPropertyByName(PROPERTY_CONTROLBORDER
) )
3328 xUnoProp
->setPropertyValue(PROPERTY_BORDER
,xShapeProp
->getPropertyValue(PROPERTY_CONTROLBORDER
));
3330 pObjs
[i
]->CreateMediator(sal_True
);
3331 // need SectionView from the above or follow Section
3332 // (getMarkedSection) returns the current Section
3333 //pSectionViews[i]->InsertObjectAtView(pControl[i],*pPgViews[i],SDRINSERT_ADDMARK);
3335 const sal_Int32 nShapeWidth
= xShapeProp
->getWidth();
3336 const bool bChangedPos
= (aPos
.X
+ nShapeWidth
) > nPaperWidth
;
3338 aPos
.X
= nPaperWidth
- nShapeWidth
;
3339 xShapeProp
->setPosition(aPos
);
3341 aPos
.Y
+= xShapeProp
->getHeight();
3342 aPos
.X
+= nShapeWidth
;
3344 if (pSectionViews
[0] != pSectionViews
[1] &&
3345 nOBJID
== OBJ_DLG_FORMATTEDFIELD
) // we want this nice feature only at FORMATTEDFIELD
3347 // we have two different Views, so set the position x new.
3348 // pSectionViews[1].position.x = pSectionViews[0].position.x
3349 uno::Reference
< report::XReportComponent
> xShapePropLabel(pObjs
[0]->getUnoShape(),uno::UNO_QUERY_THROW
);
3350 uno::Reference
< report::XReportComponent
> xShapePropTextField(pObjs
[1]->getUnoShape(),uno::UNO_QUERY_THROW
);
3351 awt::Point aPosLabel
= xShapePropLabel
->getPosition();
3352 awt::Point aPosTextField
= xShapePropTextField
->getPosition();
3353 aPosTextField
.X
= aPosLabel
.X
;
3354 xShapePropTextField
->setPosition(aPosTextField
);
3355 if (bLabelAboveTextField
)
3357 // move the label down near the splitter
3358 const uno::Reference
<report::XSection
> xLabelSection
= pSectionWindow
[1]->getReportSection().getSection();
3359 aPosLabel
.Y
= xLabelSection
->getHeight() - xShapePropLabel
->getHeight();
3363 // move the label up to the splitter
3366 xShapePropLabel
->setPosition(aPosLabel
);
3368 OUnoObject
* pObj
= dynamic_cast<OUnoObject
*>(pControl
[0]);
3369 uno::Reference
< report::XReportComponent
> xShapeProp(pObj
->getUnoShape(),uno::UNO_QUERY_THROW
);
3370 xShapeProp
->setName(xShapeProp
->getName() + sDefaultName
);
3372 for(i
= 0; i
< sizeof(pControl
)/sizeof(pControl
[0]);++i
) // insert controls
3374 correctOverlapping(pControl
[i
],pSectionWindow
[1-i
]->getReportSection());
3377 if (!bLabelAboveTextField
)
3379 if ( pSectionViews
[0] == pSectionViews
[1] )
3381 Rectangle aLabel
= getRectangleFromControl(pControl
[0]);
3382 Rectangle aTextfield
= getRectangleFromControl(pControl
[1]);
3384 // create a Union of the given Label and Textfield
3385 Rectangle
aLabelAndTextfield( aLabel
);
3386 aLabelAndTextfield
.Union(aTextfield
);
3388 // check if there exists other fields and if yes, move down
3389 bool bOverlapping
= true;
3390 bool bHasToMove
= false;
3391 while ( bOverlapping
)
3393 const SdrObject
* pOverlappedObj
= isOver(aLabelAndTextfield
, *pSectionWindow
[0]->getReportSection().getPage(), *pSectionViews
[0], true, pControl
, 2);
3394 bOverlapping
= pOverlappedObj
!= NULL
;
3397 const Rectangle
& aLogicRect
= pOverlappedObj
->GetLogicRect();
3398 aLabelAndTextfield
.Move(0,aLogicRect
.Top() + aLogicRect
.getHeight() - aLabelAndTextfield
.Top());
3405 // There was a move down, we need to move the Label and the Textfield down
3406 aLabel
.Move(0, aLabelAndTextfield
.Top() - aLabel
.Top());
3407 aTextfield
.Move(0, aLabelAndTextfield
.Top() - aTextfield
.Top());
3409 uno::Reference
< report::XReportComponent
> xLabel(pControl
[0]->getUnoShape(),uno::UNO_QUERY_THROW
);
3410 xLabel
->setPositionY(aLabel
.Top());
3412 uno::Reference
< report::XReportComponent
> xTextfield(pControl
[1]->getUnoShape(),uno::UNO_QUERY_THROW
);
3413 xTextfield
->setPositionY(aTextfield
.Top());
3416 // this should never happen.
3419 // DBG_ERROR("unhandled case.");
3426 for(size_t i
= 0; i
< sizeof(pControl
)/sizeof(pControl
[0]);++i
)
3431 catch( const Exception
& )
3433 DBG_UNHANDLED_EXCEPTION();
3437 // -----------------------------------------------------------------------------
3438 OSectionView
* OReportController::getCurrentSectionView() const
3440 OSectionView
* pSectionView
= NULL
;
3441 ::boost::shared_ptr
<OSectionWindow
> pSectionWindow
= m_pMyOwnView
->getMarkedSection();
3442 if ( pSectionWindow
.get() )
3443 pSectionView
= &pSectionWindow
->getReportSection().getSectionView();
3444 return pSectionView
;
3446 // -----------------------------------------------------------------------------
3447 void OReportController::changeZOrder(sal_Int32 _nId
)
3449 OSectionView
* pSectionView
= getCurrentSectionView();
3454 case SID_FRAME_TO_TOP
:
3455 pSectionView
->MovMarkedToTop();
3457 case SID_FRAME_DOWN
:
3461 case SID_FRAME_TO_BOTTOM
:
3462 pSectionView
->MovMarkedToBtm();
3464 case SID_OBJECT_HEAVEN
:
3465 pSectionView
->PutMarkedToTop();
3467 case SID_OBJECT_HELL
:
3468 pSectionView
->PutMarkedToBtm();
3473 // -----------------------------------------------------------------------------
3474 void OReportController::listen(const bool _bAdd
)
3476 const ::rtl::OUString aProps
[] = { PROPERTY_REPORTHEADERON
,PROPERTY_REPORTFOOTERON
3477 ,PROPERTY_PAGEHEADERON
,PROPERTY_PAGEFOOTERON
3478 ,PROPERTY_COMMAND
, PROPERTY_COMMANDTYPE
,PROPERTY_CAPTION
3481 void (SAL_CALL
XPropertySet::*pPropertyListenerAction
)( const ::rtl::OUString
&, const uno::Reference
< XPropertyChangeListener
>& ) =
3482 _bAdd
? &XPropertySet::addPropertyChangeListener
: &XPropertySet::removePropertyChangeListener
;
3484 for (size_t i
= 0; i
< sizeof(aProps
)/sizeof(aProps
[0]); ++i
)
3485 (m_xReportDefinition
.get()->*pPropertyListenerAction
)( aProps
[i
], static_cast< XPropertyChangeListener
* >( this ) );
3487 OXUndoEnvironment
& rUndoEnv
= m_aReportModel
->GetUndoEnv();
3488 uno::Reference
< XPropertyChangeListener
> xUndo
= &rUndoEnv
;
3489 uno::Sequence
< beans::Property
> aSeq
= m_xReportDefinition
->getPropertySetInfo()->getProperties();
3490 const beans::Property
* pIter
= aSeq
.getConstArray();
3491 const beans::Property
* pEnd
= pIter
+ aSeq
.getLength();
3492 const ::rtl::OUString
* pPropsBegin
= &aProps
[0];
3493 const ::rtl::OUString
* pPropsEnd
= pPropsBegin
+ (sizeof(aProps
)/sizeof(aProps
[0])) - 3;
3494 for(;pIter
!= pEnd
;++pIter
)
3496 if ( ::std::find(pPropsBegin
,pPropsEnd
,pIter
->Name
) == pPropsEnd
)
3497 (m_xReportDefinition
.get()->*pPropertyListenerAction
)( pIter
->Name
, xUndo
);
3500 void (OXUndoEnvironment::*pElementUndoFunction
)( const uno::Reference
< uno::XInterface
>& ) =
3501 _bAdd
? &OXUndoEnvironment::AddElement
: &OXUndoEnvironment::RemoveElement
;
3503 (rUndoEnv
.*pElementUndoFunction
)( m_xReportDefinition
->getStyleFamilies() );
3504 (rUndoEnv
.*pElementUndoFunction
)( m_xReportDefinition
->getFunctions() );
3506 if ( m_xReportDefinition
->getPageHeaderOn() && _bAdd
)
3507 m_pMyOwnView
->addSection(m_xReportDefinition
->getPageHeader(),DBPAGEHEADER
);
3508 if ( m_xReportDefinition
->getReportHeaderOn() && _bAdd
)
3509 m_pMyOwnView
->addSection(m_xReportDefinition
->getReportHeader(),DBREPORTHEADER
);
3511 uno::Reference
< report::XGroups
> xGroups
= m_xReportDefinition
->getGroups();
3512 const sal_Int32 nCount
= xGroups
->getCount();
3513 _bAdd
? xGroups
->addContainerListener(&rUndoEnv
) : xGroups
->removeContainerListener(&rUndoEnv
);
3515 for (sal_Int32 i
=0;i
<nCount
; ++i
)
3517 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
3518 (xGroup
.get()->*pPropertyListenerAction
)( PROPERTY_HEADERON
, static_cast< XPropertyChangeListener
* >( this ) );
3519 (xGroup
.get()->*pPropertyListenerAction
)( PROPERTY_FOOTERON
, static_cast< XPropertyChangeListener
* >( this ) );
3521 (rUndoEnv
.*pElementUndoFunction
)( xGroup
);
3522 (rUndoEnv
.*pElementUndoFunction
)( xGroup
->getFunctions() );
3523 if ( xGroup
->getHeaderOn() && _bAdd
)
3524 m_pMyOwnView
->addSection(xGroup
->getHeader(),DBGROUPHEADER
);
3525 } // for (sal_Int32 i=0;i<nCount ; ++i)
3529 m_pMyOwnView
->addSection(m_xReportDefinition
->getDetail(),DBDETAIL
);
3531 for (sal_Int32 i
=nCount
;i
> 0 ; --i
)
3533 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
-1),uno::UNO_QUERY
);
3534 if ( xGroup
->getFooterOn() )
3535 m_pMyOwnView
->addSection(xGroup
->getFooter(),DBGROUPFOOTER
);
3537 if ( m_xReportDefinition
->getReportFooterOn() )
3538 m_pMyOwnView
->addSection(m_xReportDefinition
->getReportFooter(),DBREPORTFOOTER
);
3539 if ( m_xReportDefinition
->getPageFooterOn())
3540 m_pMyOwnView
->addSection(m_xReportDefinition
->getPageFooter(),DBPAGEFOOTER
);
3545 _bAdd
? xGroups
->addContainerListener(static_cast<XContainerListener
*>(this))
3546 : xGroups
->removeContainerListener(static_cast<XContainerListener
*>(this));
3547 _bAdd
? m_xReportDefinition
->addModifyListener(static_cast<XModifyListener
*>(this))
3548 : m_xReportDefinition
->removeModifyListener(static_cast<XModifyListener
*>(this));
3551 m_aReportModel
->detachController();
3553 // -----------------------------------------------------------------------------
3554 void OReportController::switchReportSection(const sal_Int16 _nId
)
3556 OSL_ENSURE(_nId
== SID_REPORTHEADER_WITHOUT_UNDO
|| _nId
== SID_REPORTFOOTER_WITHOUT_UNDO
|| _nId
== SID_REPORTHEADERFOOTER
,"Illegal id given!");
3558 if ( m_xReportDefinition
.is() )
3560 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3561 const bool bSwitchOn
= !m_xReportDefinition
->getReportHeaderOn();
3562 if ( SID_REPORTHEADERFOOTER
== _nId
)
3564 const String
sUndoAction(ModuleRes(bSwitchOn
? RID_STR_UNDO_ADD_REPORTHEADERFOOTER
: RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
));
3565 getUndoMgr()->EnterListAction( sUndoAction
, String() );
3567 addUndoActionAndInvalidate(new OReportSectionUndo(*(m_aReportModel
),SID_REPORTHEADER_WITHOUT_UNDO
3568 ,::std::mem_fun(&OReportHelper::getReportHeader
)
3569 ,m_xReportDefinition
3570 ,bSwitchOn
? Inserted
: Removed
3574 addUndoActionAndInvalidate(new OReportSectionUndo(*(m_aReportModel
),SID_REPORTFOOTER_WITHOUT_UNDO
3575 ,::std::mem_fun(&OReportHelper::getReportFooter
)
3576 ,m_xReportDefinition
3577 ,bSwitchOn
? Inserted
: Removed
3584 case SID_REPORTHEADER_WITHOUT_UNDO
:
3585 m_xReportDefinition
->setReportHeaderOn( bSwitchOn
);
3587 case SID_REPORTFOOTER_WITHOUT_UNDO
:
3588 m_xReportDefinition
->setReportFooterOn( !m_xReportDefinition
->getReportFooterOn() );
3590 case SID_REPORTHEADERFOOTER
:
3591 m_xReportDefinition
->setReportHeaderOn( bSwitchOn
);
3592 m_xReportDefinition
->setReportFooterOn( bSwitchOn
);
3596 if ( SID_REPORTHEADERFOOTER
== _nId
)
3597 getUndoMgr()->LeaveListAction();
3598 getView()->Resize();
3601 // -----------------------------------------------------------------------------
3602 void OReportController::switchPageSection(const sal_Int16 _nId
)
3604 OSL_ENSURE(_nId
== SID_PAGEHEADERFOOTER
|| _nId
== SID_PAGEHEADER_WITHOUT_UNDO
|| _nId
== SID_PAGEFOOTER_WITHOUT_UNDO
,"Illegal id given!");
3605 if ( m_xReportDefinition
.is() )
3607 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3608 const bool bSwitchOn
= !m_xReportDefinition
->getPageHeaderOn();
3610 if ( SID_PAGEHEADERFOOTER
== _nId
)
3612 const String
sUndoAction(ModuleRes(bSwitchOn
? RID_STR_UNDO_ADD_REPORTHEADERFOOTER
: RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER
));
3613 getUndoMgr()->EnterListAction( sUndoAction
, String() );
3615 addUndoActionAndInvalidate(new OReportSectionUndo(*m_aReportModel
3616 ,SID_PAGEHEADER_WITHOUT_UNDO
3617 ,::std::mem_fun(&OReportHelper::getPageHeader
)
3618 ,m_xReportDefinition
3619 ,bSwitchOn
? Inserted
: Removed
3623 addUndoActionAndInvalidate(new OReportSectionUndo(*m_aReportModel
3624 ,SID_PAGEFOOTER_WITHOUT_UNDO
3625 ,::std::mem_fun(&OReportHelper::getPageFooter
)
3626 ,m_xReportDefinition
3627 ,bSwitchOn
? Inserted
: Removed
3630 } // if ( SID_PAGEHEADERFOOTER == _nId )
3633 case SID_PAGEHEADER_WITHOUT_UNDO
:
3634 m_xReportDefinition
->setPageHeaderOn( bSwitchOn
);
3636 case SID_PAGEFOOTER_WITHOUT_UNDO
:
3637 m_xReportDefinition
->setPageFooterOn( !m_xReportDefinition
->getPageFooterOn() );
3639 case SID_PAGEHEADERFOOTER
:
3640 m_xReportDefinition
->setPageHeaderOn( bSwitchOn
);
3641 m_xReportDefinition
->setPageFooterOn( bSwitchOn
);
3644 if ( SID_PAGEHEADERFOOTER
== _nId
)
3645 getUndoMgr()->LeaveListAction();
3646 getView()->Resize();
3649 // -----------------------------------------------------------------------------
3650 void OReportController::modifyGroup(const bool _bAppend
, const Sequence
< PropertyValue
>& _aArgs
)
3652 if ( !m_xReportDefinition
.is() )
3657 const SequenceAsHashMap
aMap( _aArgs
);
3658 uno::Reference
< report::XGroup
> xGroup
= aMap
.getUnpackedValueOrDefault( PROPERTY_GROUP
, uno::Reference
< report::XGroup
>() );
3662 OXUndoEnvironment
& rUndoEnv
= m_aReportModel
->GetUndoEnv();
3663 uno::Reference
< report::XGroups
> xGroups
= m_xReportDefinition
->getGroups();
3666 const sal_Int32 nPos
= aMap
.getUnpackedValueOrDefault( PROPERTY_POSITIONY
, xGroups
->getCount() );
3667 xGroups
->insertByIndex( nPos
, uno::makeAny( xGroup
) );
3668 rUndoEnv
.AddElement( xGroup
->getFunctions() );
3671 addUndoActionAndInvalidate( new OGroupUndo(
3673 _bAppend
? RID_STR_UNDO_APPEND_GROUP
: RID_STR_UNDO_REMOVE_GROUP
,
3674 _bAppend
? Inserted
: Removed
,
3681 rUndoEnv
.RemoveElement( xGroup
->getFunctions() );
3682 const sal_Int32 nPos
= getGroupPosition( xGroup
);
3683 const OXUndoEnvironment::OUndoEnvLock
aLock( m_aReportModel
->GetUndoEnv() );
3684 xGroups
->removeByIndex( nPos
);
3687 catch( const Exception
& )
3689 DBG_UNHANDLED_EXCEPTION();
3693 // -----------------------------------------------------------------------------
3694 void OReportController::createGroupSection(const bool _bUndo
,const bool _bHeader
, const Sequence
< PropertyValue
>& _aArgs
)
3696 if ( m_xReportDefinition
.is() )
3698 const SequenceAsHashMap
aMap(_aArgs
);
3699 const sal_Bool bSwitchOn
= aMap
.getUnpackedValueOrDefault(_bHeader
? PROPERTY_HEADERON
: PROPERTY_FOOTERON
,sal_False
);
3700 uno::Reference
< report::XGroup
> xGroup
= aMap
.getUnpackedValueOrDefault(PROPERTY_GROUP
,uno::Reference
< report::XGroup
>());
3703 const OXUndoEnvironment::OUndoEnvLock
aLock(m_aReportModel
->GetUndoEnv());
3705 addUndoActionAndInvalidate(new OGroupSectionUndo(*m_aReportModel
3706 ,_bHeader
? SID_GROUPHEADER_WITHOUT_UNDO
: SID_GROUPFOOTER_WITHOUT_UNDO
3707 ,_bHeader
? ::std::mem_fun(&OGroupHelper::getHeader
) : ::std::mem_fun(&OGroupHelper::getFooter
)
3709 ,bSwitchOn
? Inserted
: Removed
3711 (bSwitchOn
? RID_STR_UNDO_ADD_GROUP_HEADER
: RID_STR_UNDO_REMOVE_GROUP_HEADER
)
3712 :(bSwitchOn
? RID_STR_UNDO_ADD_GROUP_FOOTER
: RID_STR_UNDO_REMOVE_GROUP_FOOTER
)
3717 xGroup
->setHeaderOn( bSwitchOn
);
3719 xGroup
->setFooterOn( bSwitchOn
);
3723 // -----------------------------------------------------------------------------
3724 void OReportController::markSection(const bool _bNext
)
3726 ::boost::shared_ptr
<OSectionWindow
> pSection
= m_pMyOwnView
->getMarkedSection();
3729 ::boost::shared_ptr
<OSectionWindow
> pPrevSection
= m_pMyOwnView
->getMarkedSection(_bNext
? POST
: PREVIOUS
);
3730 if ( pPrevSection
!= pSection
&& pPrevSection
)
3731 select(uno::makeAny(pPrevSection
->getReportSection().getSection()));
3733 select(uno::makeAny(m_xReportDefinition
));
3737 m_pMyOwnView
->markSection(_bNext
? 0 : m_pMyOwnView
->getSectionCount() - 1);
3738 pSection
= m_pMyOwnView
->getMarkedSection();
3740 select(uno::makeAny(pSection
->getReportSection().getSection()));
3743 // -----------------------------------------------------------------------------
3744 void OReportController::createDefaultControl(const uno::Sequence
< beans::PropertyValue
>& _aArgs
)
3746 uno::Reference
< report::XSection
> xSection
= m_pMyOwnView
->getCurrentSection();
3747 if ( xSection
.is() )
3749 const ::rtl::OUString
sKeyModifier(RTL_CONSTASCII_USTRINGPARAM("KeyModifier"));
3750 const beans::PropertyValue
* pIter
= _aArgs
.getConstArray();
3751 const beans::PropertyValue
* pEnd
= pIter
+ _aArgs
.getLength();
3752 const beans::PropertyValue
* pFind
= ::std::find_if(pIter
,pEnd
,::std::bind2nd(PropertyValueCompare(),boost::cref(sKeyModifier
)));
3753 sal_Int16 nKeyModifier
= 0;
3754 if ( pFind
!= pEnd
&& (pFind
->Value
>>= nKeyModifier
) && nKeyModifier
== KEY_MOD1
)
3756 Sequence
< PropertyValue
> aCreateArgs
;
3757 m_pMyOwnView
->unmarkAllObjects(NULL
);
3758 createControl(aCreateArgs
,xSection
,::rtl::OUString(),m_pMyOwnView
->GetInsertObj());
3762 // -----------------------------------------------------------------------------
3763 uno::Reference
< util::XNumberFormatter
> OReportController::getReportNumberFormatter() const
3765 return m_xFormatter
;
3767 // -----------------------------------------------------------------------------
3768 void OReportController::checkChartEnabled()
3770 if ( !m_bChartEnabledAsked
)
3772 m_bChartEnabledAsked
= true;
3773 const ::rtl::OUString
sConfigName( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.ReportDesign" ) );
3774 const ::rtl::OUString
sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "UserData/Chart" ) );
3778 ::utl::OConfigurationTreeRoot
aConfiguration(
3779 ::utl::OConfigurationTreeRoot::createWithServiceFactory( m_xServiceFactory
, sConfigName
) );
3781 sal_Bool bChartEnabled
= sal_False
;
3782 if ( aConfiguration
.hasByHierarchicalName(sPropertyName
) )
3783 aConfiguration
.getNodeValue( sPropertyName
) >>= bChartEnabled
;
3784 m_bChartEnabled
= bChartEnabled
;
3786 catch(const Exception
&)
3791 // -----------------------------------------------------------------------------
3794 ::rtl::OUString SAL_CALL
OReportController::getTitle()
3795 throw (uno::RuntimeException
)
3797 vos::OGuard
aSolarGuard( Application::GetSolarMutex() );
3798 ::osl::MutexGuard
aGuard( getMutex() );
3800 uno::Reference
< frame::XTitle
> xTitle(m_xReportDefinition
,uno::UNO_QUERY_THROW
);
3802 return xTitle
->getTitle ();
3804 // -----------------------------------------------------------------------------
3805 void OReportController::getPropertyDefaultByHandle( sal_Int32
/*_nHandle*/, Any
& _rDefault
) const
3807 _rDefault
<<= sal_Int16(100);
3809 // -----------------------------------------------------------------------------
3810 // comphelper::OPropertyArrayUsageHelper
3811 ::cppu::IPropertyArrayHelper
* OReportController::createArrayHelper( ) const
3813 Sequence
< Property
> aProps
;
3814 describeProperties(aProps
);
3815 return new ::cppu::OPropertyArrayHelper(aProps
);
3817 // -------------------------------------------------------------------------
3819 // cppu::OPropertySetHelper
3820 ::cppu::IPropertyArrayHelper
& SAL_CALL
OReportController::getInfoHelper()
3822 typedef ::comphelper::OPropertyArrayUsageHelper
<OReportController_BASE
> OReportController_PROP
;
3823 return *OReportController_PROP::getArrayHelper();
3825 // -----------------------------------------------------------------------------
3826 void SAL_CALL
OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle
,const Any
& _aValue
) throw (Exception
)
3828 if ( _nHandle
== PROPERTY_ID_ZOOMVALUE
)
3830 _aValue
>>= m_nZoomValue
;
3831 impl_zoom_nothrow();
3834 void SAL_CALL
OReportController::setMode( const ::rtl::OUString
& aMode
) throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
)
3836 ::osl::MutexGuard
aGuard( getMutex() );
3839 ::rtl::OUString SAL_CALL
OReportController::getMode( ) throw (::com::sun::star::uno::RuntimeException
)
3841 ::osl::MutexGuard
aGuard( getMutex() );
3844 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
OReportController::getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException
)
3846 static ::rtl::OUString s_sModes
[] = { ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("remote")),
3847 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal")) };
3848 return uno::Sequence
< ::rtl::OUString
> (&s_sModes
[0],sizeof(s_sModes
)/sizeof(s_sModes
[0]));
3850 ::sal_Bool SAL_CALL
OReportController::supportsMode( const ::rtl::OUString
& aMode
) throw (::com::sun::star::uno::RuntimeException
)
3852 uno::Sequence
< ::rtl::OUString
> aModes
= getSupportedModes();
3853 const ::rtl::OUString
* pIter
= aModes
.getConstArray();
3854 const ::rtl::OUString
* pEnd
= pIter
+ aModes
.getLength();
3855 for(;pIter
!= pEnd
;++pIter
)
3857 if ( pIter
->equals(aMode
) )
3860 return pIter
!= pEnd
;
3862 // -----------------------------------------------------------------------------
3863 bool OReportController::isUiVisible() const
3865 return !m_sMode
.equalsAscii("remote");
3867 // -----------------------------------------------------------------------------
3868 void OReportController::impl_fillState_nothrow(const ::rtl::OUString
& _sProperty
,dbaui::FeatureState
& _rState
) const
3870 _rState
.bEnabled
= isEditable();
3871 if ( _rState
.bEnabled
)
3873 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
3874 m_pMyOwnView
->fillControlModelSelection(aSelection
);
3875 _rState
.bEnabled
= !aSelection
.empty();
3876 if ( _rState
.bEnabled
)
3879 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
3880 for(; aIter
!= aSelection
.end() && _rState
.bEnabled
;++aIter
)
3882 uno::Reference
< beans::XPropertySet
> xProp(*aIter
,uno::UNO_QUERY
);
3885 uno::Any aTemp2
= xProp
->getPropertyValue(_sProperty
);
3886 if ( aIter
== aSelection
.begin() )
3890 else if ( !comphelper::compare(aTemp
,aTemp2
) )
3893 catch(beans::UnknownPropertyException
&)
3895 _rState
.bEnabled
= sal_False
;
3897 } // for(; aIter != aSelection.end();++aIter)
3898 if ( aIter
== aSelection
.end() )
3899 _rState
.aValue
= aTemp
;
3901 } // if ( _rState.bEnabled )
3903 // -----------------------------------------------------------------------------
3904 void OReportController::impl_zoom_nothrow()
3906 Fraction
aZoom(m_nZoomValue
,100);
3907 setZoomFactor(aZoom
,*m_pMyOwnView
);
3908 m_pMyOwnView
->zoom(aZoom
);
3910 /*m_pMyOwnView->Invalidate(INVALIDATE_NOCHILDREN);*/
3911 InvalidateFeature(SID_ATTR_ZOOM
,Reference
< XStatusListener
>(),sal_True
);
3912 InvalidateFeature(SID_ATTR_ZOOMSLIDER
,Reference
< XStatusListener
>(),sal_True
);
3914 // -----------------------------------------------------------------------------
3915 sal_Bool
OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand
,const uno::Reference
< report::XReportControlFormat
>& _xReportControlFormat
) const
3917 sal_Bool bRet
= sal_False
;
3918 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
3922 const awt::FontDescriptor aFontDescriptor
= _xReportControlFormat
->getFontDescriptor();
3926 case SID_ATTR_CHAR_WEIGHT
:
3927 bRet
= awt::FontWeight::BOLD
== aFontDescriptor
.Weight
;
3929 case SID_ATTR_CHAR_POSTURE
:
3930 bRet
= awt::FontSlant_ITALIC
== aFontDescriptor
.Slant
;
3932 case SID_ATTR_CHAR_UNDERLINE
:
3933 bRet
= awt::FontUnderline::SINGLE
== aFontDescriptor
.Underline
;
3937 } // switch(_nCommand)
3939 catch(uno::Exception
&)
3945 // -----------------------------------------------------------------------------
3946 bool OReportController::impl_setPropertyAtControls_throw(const sal_uInt16 _nUndoResId
,const ::rtl::OUString
& _sProperty
,const uno::Any
& _aValue
,const Sequence
< PropertyValue
>& _aArgs
)
3948 ::std::auto_ptr
<UndoManagerListAction
> pListAction
;
3949 ::std::vector
< uno::Reference
< uno::XInterface
> > aSelection
;
3950 uno::Reference
< awt::XWindow
> xWindow
;
3951 lcl_getReportControlFormat(_aArgs
,m_pMyOwnView
,xWindow
,aSelection
);
3952 const bool bMultiSet
= aSelection
.size() > 1;
3953 ::std::vector
< uno::Reference
< uno::XInterface
> >::iterator aIter
= aSelection
.begin();
3954 for(; aIter
!= aSelection
.end();++aIter
)
3956 if ( !pListAction
.get() && _nUndoResId
&& bMultiSet
)
3958 const String sUndoAction
= String(ModuleRes(_nUndoResId
));
3959 pListAction
.reset(new UndoManagerListAction(m_aUndoManager
,sUndoAction
));
3960 } // if ( !pListAction.get() )
3961 const uno::Reference
< beans::XPropertySet
> xControlModel(*aIter
,uno::UNO_QUERY
);
3962 if ( xControlModel
.is() )
3963 xControlModel
->setPropertyValue(_sProperty
,_aValue
);
3964 } // for(; aIter != aSelection.end();++aIter)
3965 return !aSelection
.empty();
3967 // -----------------------------------------------------------------------------
3968 void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType
,dbaui::FeatureState
& _rState
) const
3970 _rState
.bEnabled
= isEditable();
3971 _rState
.bChecked
= m_pMyOwnView
->GetInsertObj() == OBJ_CUSTOMSHAPE
&& m_pMyOwnView
->GetInsertObjString().compareToAscii(_pCustomShapeType
) == 0;
3973 // -----------------------------------------------------------------------------
3974 void OReportController::openZoomDialog()
3976 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
3979 static SfxItemInfo aItemInfos
[] =
3981 { SID_ATTR_ZOOM
, SFX_ITEM_POOLABLE
}
3983 SfxPoolItem
* pDefaults
[] =
3987 static USHORT pRanges
[] =
3989 SID_ATTR_ZOOM
,SID_ATTR_ZOOM
,
3993 SfxItemPool
* pPool
= new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM
,SID_ATTR_ZOOM
, aItemInfos
, pDefaults
);
3994 pPool
->SetDefaultMetric( SFX_MAPUNIT_100TH_MM
); // ripped, don't understand why
3995 pPool
->FreezeIdRanges(); // the same
3999 SfxItemSet
aDescriptor(*pPool
, pRanges
);
4002 SvxZoomItem
aZoomItem( m_eZoomType
, m_nZoomValue
, SID_ATTR_ZOOM
);
4003 aZoomItem
.SetValueSet(SVX_ZOOM_ENABLE_100
|SVX_ZOOM_ENABLE_WHOLEPAGE
|SVX_ZOOM_ENABLE_PAGEWIDTH
);
4004 aDescriptor
.Put(aZoomItem
);
4006 ::std::auto_ptr
<AbstractSvxZoomDialog
> pDlg( pFact
->CreateSvxZoomDialog(NULL
, aDescriptor
, RID_SVXDLG_ZOOM
) );
4007 pDlg
->SetLimits( 20, 400 );
4008 bool bCancel
= ( RET_CANCEL
== pDlg
->Execute() );
4012 const SvxZoomItem
& rZoomItem
= (const SvxZoomItem
&)pDlg
->GetOutputItemSet()->Get( SID_ATTR_ZOOM
);
4013 m_eZoomType
= rZoomItem
.GetType();
4014 m_nZoomValue
= rZoomItem
.GetValue();
4015 if ( m_eZoomType
!= SVX_ZOOM_PERCENT
)
4016 m_nZoomValue
= m_pMyOwnView
->getZoomFactor( m_eZoomType
);
4018 impl_zoom_nothrow();
4019 } // if ( !bCancel )
4021 catch(uno::Exception
&)
4023 DBG_UNHANDLED_EXCEPTION();
4026 SfxItemPool::Free(pPool
);
4028 for (sal_uInt16 i
=0; i
<sizeof(pDefaults
)/sizeof(pDefaults
[0]); ++i
)
4029 delete pDefaults
[i
];
4032 // -----------------------------------------------------------------------------