LCOV - code coverage report
Current view: top level - reportdesign/source/ui/report - propbrw.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 253 0.4 %
Date: 2015-06-13 12:38:46 Functions: 2 23 8.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "propbrw.hxx"
      20             : #include "RptObject.hxx"
      21             : #include "ReportController.hxx"
      22             : #include <cppuhelper/component_context.hxx>
      23             : #include <RptResId.hrc>
      24             : #include "rptui_slotid.hrc"
      25             : #include <tools/debug.hxx>
      26             : #include <tools/diagnose_ex.h>
      27             : #include <com/sun/star/awt/XLayoutConstrains.hpp>
      28             : #include <com/sun/star/awt/PosSize.hpp>
      29             : #include <com/sun/star/beans/PropertyValue.hpp>
      30             : #include <com/sun/star/frame/Frame.hpp>
      31             : #include <com/sun/star/inspection/ObjectInspector.hpp>
      32             : #include <com/sun/star/inspection/DefaultHelpProvider.hpp>
      33             : #include <com/sun/star/lang/XServiceInfo.hpp>
      34             : #include <com/sun/star/report/inspection/DefaultComponentInspectorModel.hpp>
      35             : #include <svx/svxids.hrc>
      36             : #include <vcl/stdtext.hxx>
      37             : #include <svx/svdview.hxx>
      38             : #include <svx/svdogrp.hxx>
      39             : #include <svx/svdpage.hxx>
      40             : #include <svx/svditer.hxx>
      41             : 
      42             : #include <toolkit/helper/vclunohelper.hxx>
      43             : #include <comphelper/property.hxx>
      44             : #include <comphelper/namecontainer.hxx>
      45             : #include <comphelper/stl_types.hxx>
      46             : #include <comphelper/types.hxx>
      47             : #include <comphelper/sequence.hxx>
      48             : #include <comphelper/processfactory.hxx>
      49             : #include "SectionView.hxx"
      50             : #include "ReportSection.hxx"
      51             : #include "uistrings.hrc"
      52             : #include "DesignView.hxx"
      53             : #include "ViewsWindow.hxx"
      54             : #include "UITools.hxx"
      55             : #include <unotools/confignode.hxx>
      56             : 
      57             : namespace rptui
      58             : {
      59             : #define STD_WIN_SIZE_X  300
      60             : #define STD_WIN_SIZE_Y  350
      61             : 
      62             : using namespace ::com::sun::star;
      63             : using namespace uno;
      64             : using namespace lang;
      65             : using namespace frame;
      66             : using namespace beans;
      67             : using namespace container;
      68             : using namespace ::comphelper;
      69             : 
      70             : 
      71             : 
      72             : namespace
      73             : {
      74           0 :     static bool lcl_shouldEnableHelpSection( const Reference< XComponentContext >& _rxContext )
      75             :     {
      76           0 :         const OUString sConfigName( "/org.openoffice.Office.ReportDesign/PropertyBrowser/" );
      77           0 :         const OUString sPropertyName( "DirectHelp" );
      78             : 
      79             :         ::utl::OConfigurationTreeRoot aConfiguration(
      80           0 :             ::utl::OConfigurationTreeRoot::createWithComponentContext( _rxContext, sConfigName ) );
      81             : 
      82           0 :         bool bEnabled = false;
      83           0 :         OSL_VERIFY( aConfiguration.getNodeValue( sPropertyName ) >>= bEnabled );
      84           0 :         return bEnabled;
      85             :     }
      86             : }
      87             : 
      88             : 
      89             : // PropBrw
      90             : 
      91             : 
      92             : 
      93             : 
      94             : 
      95           0 : PropBrw::PropBrw(const Reference< XComponentContext >& _xORB, vcl::Window* pParent, ODesignView*  _pDesignView)
      96             :           :DockingWindow(pParent,WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_3DLOOK|WB_ROLLABLE))
      97             :           ,m_xORB(_xORB)
      98             :           ,m_pDesignView(_pDesignView)
      99             :           ,m_pView( NULL )
     100           0 :           ,m_bInitialStateChange(true)
     101             : {
     102             : 
     103           0 :     Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y);
     104           0 :     SetOutputSizePixel(aPropWinSize);
     105             : 
     106             :     try
     107             :     {
     108             :         // create a frame wrapper for myself
     109           0 :         m_xMeAsFrame = Frame::create( m_xORB );
     110           0 :         m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) );
     111           0 :         m_xMeAsFrame->setName("report property browser");  // change name!
     112             :     }
     113           0 :     catch (Exception&)
     114             :     {
     115             :         OSL_FAIL("PropBrw::PropBrw: could not create/initialize my frame!");
     116             :         DBG_UNHANDLED_EXCEPTION();
     117           0 :         m_xMeAsFrame.clear();
     118             :     }
     119             : 
     120           0 :     if (m_xMeAsFrame.is())
     121             :     {
     122             :         try
     123             :         {
     124             :             ::cppu::ContextEntry_Init aHandlerContextInfo[] =
     125             :             {
     126           0 :                 ::cppu::ContextEntry_Init( OUString( "ContextDocument" ), makeAny( m_pDesignView->getController().getModel() )),
     127             :                 ::cppu::ContextEntry_Init( OUString( "DialogParentWindow" ), makeAny( VCLUnoHelper::GetInterface ( this ) )),
     128           0 :                 ::cppu::ContextEntry_Init( OUString( "ActiveConnection" ), makeAny( m_pDesignView->getController().getConnection() ) ),
     129           0 :             };
     130             :             m_xInspectorContext.set(
     131           0 :                 ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
     132           0 :                 m_xORB ) );
     133             :             // create a property browser controller
     134           0 :             bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB );
     135             :             Reference< inspection::XObjectInspectorModel> xInspectorModel( bEnableHelpSection
     136             :                 ?   report::inspection::DefaultComponentInspectorModel::createWithHelpSection( m_xInspectorContext, 3, 8 )
     137           0 :                 :   report::inspection::DefaultComponentInspectorModel::createDefault( m_xInspectorContext ) );
     138             : 
     139           0 :             m_xBrowserController = inspection::ObjectInspector::createWithModel(m_xInspectorContext, xInspectorModel);
     140           0 :             if ( !m_xBrowserController.is() )
     141             :             {
     142           0 :                 const OUString sServiceName( "com.sun.star.inspection.ObjectInspector" );
     143           0 :                 ShowServiceNotAvailableError(pParent, sServiceName, true);
     144             :             }
     145             :             else
     146             :             {
     147           0 :                 m_xBrowserController->attachFrame( Reference<XFrame>(m_xMeAsFrame, UNO_QUERY_THROW));
     148           0 :                 m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow();
     149             :                 OSL_ENSURE(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!");
     150           0 :                 if ( bEnableHelpSection )
     151             :                 {
     152           0 :                     uno::Reference< inspection::XObjectInspector > xInspector( m_xBrowserController, uno::UNO_QUERY_THROW );
     153           0 :                     uno::Reference< inspection::XObjectInspectorUI > xInspectorUI( xInspector->getInspectorUI() );
     154           0 :                     uno::Reference< uno::XInterface > xDefaultHelpProvider( inspection::DefaultHelpProvider::create( m_xInspectorContext, xInspectorUI ) );
     155             :                 }
     156           0 :             }
     157             :         }
     158           0 :         catch (Exception&)
     159             :         {
     160             :             OSL_FAIL("PropBrw::PropBrw: could not create/initialize the browser controller!");
     161             :             DBG_UNHANDLED_EXCEPTION();
     162             :             try
     163             :             {
     164           0 :                 ::comphelper::disposeComponent(m_xBrowserController);
     165           0 :                 ::comphelper::disposeComponent(m_xBrowserComponentWindow);
     166             :             }
     167           0 :             catch(Exception&) { }
     168           0 :             m_xBrowserController.clear();
     169           0 :             m_xBrowserComponentWindow.clear();
     170             :         }
     171             :     }
     172             : 
     173           0 :     if (m_xBrowserComponentWindow.is())
     174             :     {
     175             : 
     176           0 :         m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(),
     177           0 :             awt::PosSize::WIDTH | awt::PosSize::HEIGHT | awt::PosSize::X | awt::PosSize::Y);
     178           0 :         Resize();
     179           0 :         m_xBrowserComponentWindow->setVisible(sal_True);
     180             :     }
     181           0 :     ::rptui::notifySystemWindow(pParent,this,::comphelper::mem_fun(&TaskPaneList::AddWindow));
     182           0 : }
     183             : 
     184             : 
     185             : 
     186           0 : PropBrw::~PropBrw()
     187             : {
     188           0 :     disposeOnce();
     189           0 : }
     190             : 
     191           0 : void PropBrw::dispose()
     192             : {
     193           0 :     if (m_xBrowserController.is())
     194           0 :         implDetachController();
     195             : 
     196             :     try
     197             :     {
     198           0 :         uno::Reference<container::XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY);
     199           0 :         if ( xName.is() )
     200             :         {
     201             :             const OUString pProps[] = { OUString( "ContextDocument" )
     202             :                                             ,  OUString( "DialogParentWindow" )
     203           0 :                                             , OUString( "ActiveConnection" )};
     204           0 :             for (size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i)
     205           0 :                 xName->removeByName(pProps[i]);
     206           0 :         }
     207             :     }
     208           0 :     catch(Exception&)
     209             :     {}
     210             : 
     211           0 :     ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
     212           0 :     m_pDesignView.clear();
     213           0 :     DockingWindow::dispose();
     214           0 : }
     215             : 
     216           0 : void PropBrw::setCurrentPage(const OUString& _sLastActivePage)
     217             : {
     218           0 :     m_sLastActivePage = _sLastActivePage;
     219           0 : }
     220             : 
     221             : 
     222           0 : void PropBrw::implDetachController()
     223             : {
     224           0 :     m_sLastActivePage = getCurrentPage();
     225           0 :     implSetNewObject(  );
     226             : 
     227           0 :     if ( m_xMeAsFrame.is() )
     228           0 :         m_xMeAsFrame->setComponent( NULL, NULL );
     229             : 
     230           0 :     if ( m_xBrowserController.is() )
     231           0 :         m_xBrowserController->attachFrame( NULL );
     232             : 
     233           0 :     m_xMeAsFrame.clear();
     234           0 :     m_xBrowserController.clear();
     235           0 :     m_xBrowserComponentWindow.clear();
     236           0 : }
     237             : 
     238           0 : OUString PropBrw::getCurrentPage() const
     239             : {
     240           0 :     OUString sCurrentPage;
     241             :     try
     242             :     {
     243           0 :         if ( m_xBrowserController.is() )
     244             :         {
     245           0 :             OSL_VERIFY( m_xBrowserController->getViewData() >>= sCurrentPage );
     246             :         }
     247             : 
     248           0 :         if ( sCurrentPage.isEmpty() )
     249           0 :             sCurrentPage = m_sLastActivePage;
     250             :     }
     251           0 :     catch( const Exception& )
     252             :     {
     253             :         OSL_FAIL( "PropBrw::getCurrentPage: caught an exception while retrieving the current page!" );
     254             :     }
     255           0 :     return sCurrentPage;
     256             : }
     257             : 
     258             : 
     259           0 : bool PropBrw::Close()
     260             : {
     261           0 :     m_xLastSection.clear();
     262             :     // suspend the controller (it is allowed to veto)
     263           0 :     if ( m_xMeAsFrame.is() )
     264             :     {
     265             :         try
     266             :         {
     267           0 :             Reference< XController > xController( m_xMeAsFrame->getController() );
     268           0 :             if ( xController.is() && !xController->suspend( sal_True ) )
     269           0 :                 return false;
     270             :         }
     271           0 :         catch( const Exception& )
     272             :         {
     273             :             OSL_FAIL( "FmPropBrw::Close: caught an exception while asking the controller!" );
     274             :         }
     275             :     }
     276           0 :     implDetachController();
     277             : 
     278           0 :     if( IsRollUp() )
     279           0 :         RollDown();
     280             : 
     281           0 :     m_pDesignView->getController().executeUnChecked(SID_PROPERTYBROWSER_LAST_PAGE,uno::Sequence< beans::PropertyValue>());
     282             : 
     283           0 :     return true;
     284             : }
     285             : 
     286             : 
     287             : 
     288           0 : uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const SdrMarkList& _rMarkList)
     289             : {
     290           0 :     const size_t nMarkCount = _rMarkList.GetMarkCount();
     291           0 :     ::std::vector< uno::Reference< uno::XInterface> > aSets;
     292           0 :     aSets.reserve(nMarkCount);
     293             : 
     294           0 :     for(size_t i=0; i<nMarkCount; ++i)
     295             :     {
     296           0 :         SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj();
     297             : 
     298           0 :         ::std::unique_ptr<SdrObjListIter> pGroupIterator;
     299           0 :         if (pCurrent->IsGroupObject())
     300             :         {
     301           0 :             pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList()));
     302           0 :             pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
     303             :         }
     304             : 
     305           0 :         while (pCurrent)
     306             :         {
     307           0 :             OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent);
     308           0 :             if ( pObj )
     309           0 :                 aSets.push_back(CreateComponentPair(pObj));
     310             : 
     311             :             // next element
     312           0 :             pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
     313             :         }
     314           0 :     }
     315           0 :     return uno::Sequence< Reference<uno::XInterface> >(aSets.data(), aSets.size());
     316             : }
     317             : 
     318           0 : void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
     319             : {
     320           0 :     if ( m_xBrowserController.is() )
     321             :     {
     322             :         try
     323             :         {
     324           0 :             m_xBrowserController->inspect(uno::Sequence< Reference<uno::XInterface> >());
     325           0 :             m_xBrowserController->inspect(_aObjects);
     326             :         }
     327           0 :         catch( const Exception& )
     328             :         {
     329             :             OSL_FAIL( "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
     330             :         }
     331             :     }
     332           0 :     SetText( GetHeadlineName(_aObjects) );
     333           0 : }
     334             : 
     335             : 
     336             : 
     337           0 : OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
     338             : {
     339           0 :     OUString aName;
     340           0 :     if ( !_aObjects.getLength() )
     341             :     {
     342           0 :         aName = ModuleRes(RID_STR_BRWTITLE_NO_PROPERTIES);
     343             :     }
     344           0 :     else if ( _aObjects.getLength() == 1 )    // single selection
     345             :     {
     346           0 :         aName = ModuleRes(RID_STR_BRWTITLE_PROPERTIES);
     347             : 
     348           0 :         uno::Reference< container::XNameContainer > xNameCont(_aObjects[0],uno::UNO_QUERY);
     349           0 :         Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName("ReportComponent"), UNO_QUERY );
     350           0 :         if ( xServiceInfo.is() )
     351             :         {
     352           0 :             sal_uInt16 nResId = 0;
     353           0 :             if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) )
     354             :             {
     355           0 :                 nResId = RID_STR_PROPTITLE_FIXEDTEXT;
     356             :             }
     357           0 :             else if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL ) )
     358             :             {
     359           0 :                 nResId = RID_STR_PROPTITLE_IMAGECONTROL;
     360             :             }
     361           0 :             else if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ) )
     362             :             {
     363           0 :                 nResId = RID_STR_PROPTITLE_FORMATTED;
     364             :             }
     365           0 :             else if ( xServiceInfo->supportsService( SERVICE_SHAPE ) )
     366             :             {
     367           0 :                 nResId = RID_STR_PROPTITLE_SHAPE;
     368             :             }
     369           0 :             else if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
     370             :             {
     371           0 :                 nResId = RID_STR_PROPTITLE_REPORT;
     372             :             }
     373           0 :             else if ( xServiceInfo->supportsService( SERVICE_SECTION ) )
     374             :             {
     375           0 :                 nResId = RID_STR_PROPTITLE_SECTION;
     376             :             }
     377           0 :             else if ( xServiceInfo->supportsService( SERVICE_FUNCTION ) )
     378             :             {
     379           0 :                 nResId = RID_STR_PROPTITLE_FUNCTION;
     380             :             }
     381           0 :             else if ( xServiceInfo->supportsService( SERVICE_GROUP ) )
     382             :             {
     383           0 :                 nResId = RID_STR_PROPTITLE_GROUP;
     384             :             }
     385           0 :             else if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ) )
     386             :             {
     387           0 :                 nResId = RID_STR_PROPTITLE_FIXEDLINE;
     388             :             }
     389             :             else
     390             :             {
     391             :                 OSL_FAIL("Unknown service name!");
     392           0 :                 nResId = RID_STR_CLASS_FORMATTEDFIELD;
     393             :             }
     394             : 
     395           0 :             if (nResId)
     396             :             {
     397           0 :                 aName += ModuleRes(nResId);
     398             :             }
     399           0 :         }
     400             :     }
     401             :     else    // multiselection
     402             :     {
     403           0 :         aName = ModuleRes(RID_STR_BRWTITLE_PROPERTIES);
     404           0 :         aName += ModuleRes(RID_STR_BRWTITLE_MULTISELECT);
     405             :     }
     406             : 
     407           0 :     return aName;
     408             : }
     409             : 
     410           0 : uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj)
     411             : {
     412           0 :     _pObj->initializeOle();
     413           0 :     return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent());
     414             : }
     415             : 
     416           0 : uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(const uno::Reference< uno::XInterface>& _xFormComponent
     417             :                                                               ,const uno::Reference< uno::XInterface>& _xReportComponent)
     418             : {
     419           0 :     uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(cppu::UnoType<XInterface>::get());
     420           0 :     xNameCont->insertByName(OUString("FormComponent"),uno::makeAny(_xFormComponent));
     421           0 :     xNameCont->insertByName(OUString("ReportComponent"),uno::makeAny(_xReportComponent));
     422           0 :     xNameCont->insertByName(OUString("RowSet")
     423           0 :             ,uno::makeAny(uno::Reference< uno::XInterface>(m_pDesignView->getController().getRowSet())));
     424             : 
     425           0 :     return xNameCont.get();
     426             : }
     427             : 
     428           0 : ::Size PropBrw::getMinimumSize() const
     429             : {
     430           0 :     ::Size aSize;
     431           0 :     Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
     432           0 :     if( xLayoutConstrains.is() )
     433             :     {
     434           0 :         awt::Size aMinSize = xLayoutConstrains->getMinimumSize();
     435           0 :         aMinSize.Height += 4;
     436           0 :         aMinSize.Width += 4;
     437           0 :         aSize.setHeight( aMinSize.Height );
     438           0 :         aSize.setWidth( aMinSize.Width );
     439             :     }
     440           0 :     return aSize;
     441             : }
     442             : 
     443           0 : void PropBrw::Resize()
     444             : {
     445           0 :     Window::Resize();
     446             : 
     447           0 :     Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
     448           0 :     if( xLayoutConstrains.is() )
     449             :     {
     450           0 :         ::Size aMinSize = getMinimumSize();
     451           0 :         SetMinOutputSizePixel( aMinSize );
     452           0 :         ::Size aSize = GetOutputSizePixel();
     453           0 :         bool bResize = false;
     454           0 :         if( aSize.Width() < aMinSize.Width() )
     455             :         {
     456           0 :             aSize.setWidth( aMinSize.Width() );
     457           0 :             bResize = true;
     458             :         }
     459           0 :         if( aSize.Height() < aMinSize.Height() )
     460             :         {
     461           0 :             aSize.setHeight( aMinSize.Height() );
     462           0 :             bResize = true;
     463             :         }
     464           0 :         if( bResize )
     465           0 :             SetOutputSizePixel( aSize );
     466             :     }
     467             :     // adjust size
     468           0 :     if (m_xBrowserComponentWindow.is())
     469             :     {
     470           0 :            Size  aSize = GetOutputSizePixel();
     471           0 :         m_xBrowserComponentWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(),
     472           0 :             awt::PosSize::WIDTH | awt::PosSize::HEIGHT);
     473           0 :     }
     474           0 : }
     475             : 
     476           0 : void PropBrw::Update( OSectionView* pNewView )
     477             : {
     478             :     try
     479             :     {
     480           0 :         if ( m_pView )
     481             :         {
     482           0 :             EndListening( *(m_pView->GetModel()) );
     483           0 :             m_pView = NULL;
     484             :         }
     485             : 
     486             :         // set focus on initialization
     487           0 :         if ( m_bInitialStateChange )
     488             :         {
     489             :             // if we're just newly created, we want to have the focus
     490           0 :             PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ), NULL, true );
     491           0 :             m_bInitialStateChange = false;
     492             :             // and additionally, we want to show the page which was active during
     493             :             // our previous incarnation
     494           0 :             if ( !m_sLastActivePage.isEmpty() && m_xBrowserController.is() )
     495             :             {
     496             :                 try
     497             :                 {
     498           0 :                     m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) );
     499             :                 }
     500           0 :                 catch( const Exception& )
     501             :                 {
     502             :                     OSL_FAIL( "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
     503             :                 }
     504             :             }
     505             :         }
     506             : 
     507           0 :         if ( !pNewView )
     508           0 :             return;
     509             :         else
     510           0 :             m_pView = pNewView;
     511             : 
     512           0 :         uno::Sequence< Reference<uno::XInterface> > aMarkedObjects;
     513           0 :         OViewsWindow* pViews = m_pView->getReportSection()->getSectionWindow()->getViewsWindow();
     514           0 :         const sal_uInt16 nSectionCount = pViews->getSectionCount();
     515           0 :         for (sal_uInt16 i = 0; i < nSectionCount; ++i)
     516             :         {
     517           0 :             OSectionWindow* pSectionWindow = pViews->getSectionWindow(i);
     518           0 :             if ( pSectionWindow )
     519             :             {
     520           0 :                 const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList();
     521           0 :                 aMarkedObjects = ::comphelper::concatSequences(aMarkedObjects,CreateCompPropSet( rMarkList ));
     522             :             }
     523             :         }
     524             : 
     525           0 :         if ( aMarkedObjects.getLength() ) // multiple selection
     526             :         {
     527           0 :             m_xLastSection.clear();
     528           0 :             implSetNewObject( aMarkedObjects );
     529             :         }
     530           0 :         else if ( m_xLastSection != m_pView->getReportSection()->getSection() )
     531             :         {
     532           0 :             uno::Reference< uno::XInterface> xTemp(m_pView->getReportSection()->getSection());
     533           0 :             m_xLastSection = xTemp;
     534           0 :             uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(cppu::UnoType<XInterface>::get() );
     535           0 :             xNameCont->insertByName(OUString("ReportComponent"),uno::makeAny(xTemp));
     536           0 :             xTemp = xNameCont;
     537             : 
     538           0 :             implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
     539             :         }
     540             : 
     541           0 :         StartListening( *(m_pView->GetModel()) );
     542             :     }
     543           0 :     catch ( Exception& )
     544             :     {
     545             :         OSL_FAIL( "PropBrw::Update: Exception occurred!" );
     546             :     }
     547             : }
     548             : 
     549           0 : void PropBrw::Update( const uno::Reference< uno::XInterface>& _xReportComponent)
     550             : {
     551           0 :     if ( m_xLastSection != _xReportComponent )
     552             :     {
     553           0 :         m_xLastSection = _xReportComponent;
     554             :         try
     555             :         {
     556           0 :             if ( m_pView )
     557             :             {
     558           0 :                 EndListening( *(m_pView->GetModel()) );
     559           0 :                 m_pView = NULL;
     560             :             }
     561             : 
     562           0 :             uno::Reference< uno::XInterface> xTemp(CreateComponentPair(_xReportComponent,_xReportComponent));
     563           0 :             implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
     564             :         }
     565           0 :         catch ( Exception& )
     566             :         {
     567             :             OSL_FAIL( "PropBrw::Update: Exception occurred!" );
     568             :         }
     569             :     }
     570           0 : }
     571             : 
     572           0 : IMPL_LINK_NOARG( PropBrw, OnAsyncGetFocus )
     573             : {
     574           0 :     if (m_xBrowserComponentWindow.is())
     575           0 :         m_xBrowserComponentWindow->setFocus();
     576           0 :     return 0L;
     577             : }
     578             : 
     579           0 : void PropBrw::LoseFocus()
     580             : {
     581           0 :     DockingWindow::LoseFocus();
     582           0 :     if (m_pDesignView)
     583           0 :         m_pDesignView->getController().InvalidateAll();
     584           0 : }
     585             : 
     586           3 : }
     587             : 
     588             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11