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