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