LCOV - code coverage report
Current view: top level - reportdesign/source/ui/report - propbrw.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 248 0.0 %
Date: 2014-04-14 Functions: 0 20 0.0 %
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, 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(sal_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 :     if (m_xBrowserController.is())
     189           0 :         implDetachController();
     190             : 
     191             :     try
     192             :     {
     193           0 :         uno::Reference<container::XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY);
     194           0 :         if ( xName.is() )
     195             :         {
     196             :             const OUString pProps[] = { OUString( "ContextDocument" )
     197             :                                             ,  OUString( "DialogParentWindow" )
     198           0 :                                             , OUString( "ActiveConnection" )};
     199           0 :             for (size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i)
     200           0 :                 xName->removeByName(pProps[i]);
     201           0 :         }
     202             :     }
     203           0 :     catch(Exception&)
     204             :     {}
     205             : 
     206           0 :     ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
     207           0 : }
     208             : 
     209           0 : void PropBrw::setCurrentPage(const OUString& _sLastActivePage)
     210             : {
     211           0 :     m_sLastActivePage = _sLastActivePage;
     212           0 : }
     213             : 
     214             : 
     215           0 : void PropBrw::implDetachController()
     216             : {
     217           0 :     m_sLastActivePage = getCurrentPage();
     218           0 :     implSetNewObject(  );
     219             : 
     220           0 :     if ( m_xMeAsFrame.is() )
     221           0 :         m_xMeAsFrame->setComponent( NULL, NULL );
     222             : 
     223           0 :     if ( m_xBrowserController.is() )
     224           0 :         m_xBrowserController->attachFrame( NULL );
     225             : 
     226           0 :     m_xMeAsFrame.clear();
     227           0 :     m_xBrowserController.clear();
     228           0 :     m_xBrowserComponentWindow.clear();
     229           0 : }
     230             : 
     231           0 : OUString PropBrw::getCurrentPage() const
     232             : {
     233           0 :     OUString sCurrentPage;
     234             :     try
     235             :     {
     236           0 :         if ( m_xBrowserController.is() )
     237             :         {
     238           0 :             OSL_VERIFY( m_xBrowserController->getViewData() >>= sCurrentPage );
     239             :         }
     240             : 
     241           0 :         if ( sCurrentPage.isEmpty() )
     242           0 :             sCurrentPage = m_sLastActivePage;
     243             :     }
     244           0 :     catch( const Exception& )
     245             :     {
     246             :         OSL_FAIL( "PropBrw::getCurrentPage: caught an exception while retrieving the current page!" );
     247             :     }
     248           0 :     return sCurrentPage;
     249             : }
     250             : 
     251             : 
     252           0 : bool PropBrw::Close()
     253             : {
     254           0 :     m_xLastSection.clear();
     255             :     // suspend the controller (it is allowed to veto)
     256           0 :     if ( m_xMeAsFrame.is() )
     257             :     {
     258             :         try
     259             :         {
     260           0 :             Reference< XController > xController( m_xMeAsFrame->getController() );
     261           0 :             if ( xController.is() && !xController->suspend( sal_True ) )
     262           0 :                 return false;
     263             :         }
     264           0 :         catch( const Exception& )
     265             :         {
     266             :             OSL_FAIL( "FmPropBrw::Close: caught an exception while asking the controller!" );
     267             :         }
     268             :     }
     269           0 :     implDetachController();
     270             : 
     271           0 :     if( IsRollUp() )
     272           0 :         RollDown();
     273             : 
     274           0 :     m_pDesignView->getController().executeUnChecked(SID_PROPERTYBROWSER_LAST_PAGE,uno::Sequence< beans::PropertyValue>());
     275             : 
     276           0 :     return true;
     277             : }
     278             : 
     279             : 
     280             : 
     281           0 : uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const SdrMarkList& _rMarkList)
     282             : {
     283           0 :     sal_uInt32 nMarkCount = _rMarkList.GetMarkCount();
     284           0 :     ::std::vector< uno::Reference< uno::XInterface> > aSets;
     285           0 :     aSets.reserve(nMarkCount);
     286             : 
     287           0 :     for(sal_uInt32 i=0;i<nMarkCount;++i)
     288             :     {
     289           0 :         SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj();
     290             : 
     291           0 :         ::std::auto_ptr<SdrObjListIter> pGroupIterator;
     292           0 :         if (pCurrent->IsGroupObject())
     293             :         {
     294           0 :             pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList()));
     295           0 :             pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
     296             :         }
     297             : 
     298           0 :         while (pCurrent)
     299             :         {
     300           0 :             OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent);
     301           0 :             if ( pObj )
     302           0 :                 aSets.push_back(CreateComponentPair(pObj));
     303             : 
     304             :             // next element
     305           0 :             pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
     306             :         }
     307           0 :     }
     308           0 :     Reference<uno::XInterface> *pSets = aSets.empty() ? NULL : &aSets[0];
     309           0 :     return uno::Sequence< Reference<uno::XInterface> >(pSets, aSets.size());
     310             : }
     311             : 
     312           0 : void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
     313             : {
     314           0 :     if ( m_xBrowserController.is() )
     315             :     {
     316             :         try
     317             :         {
     318           0 :             m_xBrowserController->inspect(uno::Sequence< Reference<uno::XInterface> >());
     319           0 :             m_xBrowserController->inspect(_aObjects);
     320             :         }
     321           0 :         catch( const Exception& )
     322             :         {
     323             :             OSL_FAIL( "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
     324             :         }
     325             :     }
     326           0 :     SetText( GetHeadlineName(_aObjects) );
     327           0 : }
     328             : 
     329             : 
     330             : 
     331           0 : OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
     332             : {
     333           0 :     OUString aName;
     334           0 :     if ( !_aObjects.getLength() )
     335             :     {
     336           0 :         aName = ModuleRes(RID_STR_BRWTITLE_NO_PROPERTIES);
     337             :     }
     338           0 :     else if ( _aObjects.getLength() == 1 )    // single selection
     339             :     {
     340           0 :         aName = ModuleRes(RID_STR_BRWTITLE_PROPERTIES);
     341             : 
     342           0 :         uno::Reference< container::XNameContainer > xNameCont(_aObjects[0],uno::UNO_QUERY);
     343           0 :         Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName("ReportComponent"), UNO_QUERY );
     344           0 :         if ( xServiceInfo.is() )
     345             :         {
     346           0 :             sal_uInt16 nResId = 0;
     347           0 :             if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) )
     348             :             {
     349           0 :                 nResId = RID_STR_PROPTITLE_FIXEDTEXT;
     350             :             }
     351           0 :             else if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL ) )
     352             :             {
     353           0 :                 nResId = RID_STR_PROPTITLE_IMAGECONTROL;
     354             :             }
     355           0 :             else if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ) )
     356             :             {
     357           0 :                 nResId = RID_STR_PROPTITLE_FORMATTED;
     358             :             }
     359           0 :             else if ( xServiceInfo->supportsService( SERVICE_SHAPE ) )
     360             :             {
     361           0 :                 nResId = RID_STR_PROPTITLE_SHAPE;
     362             :             }
     363           0 :             else if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
     364             :             {
     365           0 :                 nResId = RID_STR_PROPTITLE_REPORT;
     366             :             }
     367           0 :             else if ( xServiceInfo->supportsService( SERVICE_SECTION ) )
     368             :             {
     369           0 :                 nResId = RID_STR_PROPTITLE_SECTION;
     370             :             }
     371           0 :             else if ( xServiceInfo->supportsService( SERVICE_FUNCTION ) )
     372             :             {
     373           0 :                 nResId = RID_STR_PROPTITLE_FUNCTION;
     374             :             }
     375           0 :             else if ( xServiceInfo->supportsService( SERVICE_GROUP ) )
     376             :             {
     377           0 :                 nResId = RID_STR_PROPTITLE_GROUP;
     378             :             }
     379           0 :             else if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ) )
     380             :             {
     381           0 :                 nResId = RID_STR_PROPTITLE_FIXEDLINE;
     382             :             }
     383             :             else
     384             :             {
     385             :                 OSL_FAIL("Unknown service name!");
     386           0 :                 nResId = RID_STR_CLASS_FORMATTEDFIELD;
     387             :             }
     388             : 
     389           0 :             if (nResId)
     390             :             {
     391           0 :                 aName += ModuleRes(nResId);
     392             :             }
     393           0 :         }
     394             :     }
     395             :     else    // multiselection
     396             :     {
     397           0 :         aName = ModuleRes(RID_STR_BRWTITLE_PROPERTIES);
     398           0 :         aName += ModuleRes(RID_STR_BRWTITLE_MULTISELECT);
     399             :     }
     400             : 
     401           0 :     return aName;
     402             : }
     403             : 
     404           0 : uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj)
     405             : {
     406           0 :     _pObj->initializeOle();
     407           0 :     return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent());
     408             : }
     409             : 
     410           0 : uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(const uno::Reference< uno::XInterface>& _xFormComponent
     411             :                                                               ,const uno::Reference< uno::XInterface>& _xReportComponent)
     412             : {
     413           0 :     uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL)));
     414           0 :     xNameCont->insertByName(OUString("FormComponent"),uno::makeAny(_xFormComponent));
     415           0 :     xNameCont->insertByName(OUString("ReportComponent"),uno::makeAny(_xReportComponent));
     416           0 :     xNameCont->insertByName(OUString("RowSet")
     417           0 :             ,uno::makeAny(uno::Reference< uno::XInterface>(m_pDesignView->getController().getRowSet())));
     418             : 
     419           0 :     return xNameCont.get();
     420             : }
     421             : 
     422           0 : ::Size PropBrw::getMinimumSize() const
     423             : {
     424           0 :     ::Size aSize;
     425           0 :     Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
     426           0 :     if( xLayoutConstrains.is() )
     427             :     {
     428           0 :         awt::Size aMinSize = xLayoutConstrains->getMinimumSize();
     429           0 :         aMinSize.Height += 4;
     430           0 :         aMinSize.Width += 4;
     431           0 :         aSize.setHeight( aMinSize.Height );
     432           0 :         aSize.setWidth( aMinSize.Width );
     433             :     }
     434           0 :     return aSize;
     435             : }
     436             : 
     437           0 : void PropBrw::Resize()
     438             : {
     439           0 :     Window::Resize();
     440             : 
     441           0 :     Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
     442           0 :     if( xLayoutConstrains.is() )
     443             :     {
     444           0 :         ::Size aMinSize = getMinimumSize();
     445           0 :         SetMinOutputSizePixel( aMinSize );
     446           0 :         ::Size aSize = GetOutputSizePixel();
     447           0 :         sal_Bool bResize = sal_False;
     448           0 :         if( aSize.Width() < aMinSize.Width() )
     449             :         {
     450           0 :             aSize.setWidth( aMinSize.Width() );
     451           0 :             bResize = sal_True;
     452             :         }
     453           0 :         if( aSize.Height() < aMinSize.Height() )
     454             :         {
     455           0 :             aSize.setHeight( aMinSize.Height() );
     456           0 :             bResize = sal_True;
     457             :         }
     458           0 :         if( bResize )
     459           0 :             SetOutputSizePixel( aSize );
     460             :     }
     461             :     // adjust size
     462           0 :     if (m_xBrowserComponentWindow.is())
     463             :     {
     464           0 :            Size  aSize = GetOutputSizePixel();
     465           0 :         m_xBrowserComponentWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(),
     466           0 :             awt::PosSize::WIDTH | awt::PosSize::HEIGHT);
     467           0 :     }
     468           0 : }
     469             : 
     470           0 : void PropBrw::Update( OSectionView* pNewView )
     471             : {
     472             :     try
     473             :     {
     474           0 :         if ( m_pView )
     475             :         {
     476           0 :             EndListening( *(m_pView->GetModel()) );
     477           0 :             m_pView = NULL;
     478             :         }
     479             : 
     480             :         // set focus on initialization
     481           0 :         if ( m_bInitialStateChange )
     482             :         {
     483             :             // if we're just newly created, we want to have the focus
     484           0 :             PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ) );
     485           0 :             m_bInitialStateChange = sal_False;
     486             :             // and additionally, we want to show the page which was active during
     487             :             // our previous incarnation
     488           0 :             if ( !m_sLastActivePage.isEmpty() && m_xBrowserController.is() )
     489             :             {
     490             :                 try
     491             :                 {
     492           0 :                     m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) );
     493             :                 }
     494           0 :                 catch( const Exception& )
     495             :                 {
     496             :                     OSL_FAIL( "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
     497             :                 }
     498             :             }
     499             :         }
     500             : 
     501           0 :         if ( !pNewView )
     502           0 :             return;
     503             :         else
     504           0 :             m_pView = pNewView;
     505             : 
     506           0 :         uno::Sequence< Reference<uno::XInterface> > aMarkedObjects;
     507           0 :         OViewsWindow* pViews = m_pView->getReportSection()->getSectionWindow()->getViewsWindow();
     508           0 :         const sal_uInt16 nSectionCount = pViews->getSectionCount();
     509           0 :         for (sal_uInt16 i = 0; i < nSectionCount; ++i)
     510             :         {
     511           0 :             ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i);
     512           0 :             if ( pSectionWindow )
     513             :             {
     514           0 :                 const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList();
     515           0 :                 aMarkedObjects = ::comphelper::concatSequences(aMarkedObjects,CreateCompPropSet( rMarkList ));
     516             :             }
     517           0 :         }
     518             : 
     519           0 :         if ( aMarkedObjects.getLength() ) // multiple selection
     520             :         {
     521           0 :             m_xLastSection.clear();
     522           0 :             implSetNewObject( aMarkedObjects );
     523             :         }
     524           0 :         else if ( m_xLastSection != m_pView->getReportSection()->getSection() )
     525             :         {
     526           0 :             uno::Reference< uno::XInterface> xTemp(m_pView->getReportSection()->getSection());
     527           0 :             m_xLastSection = xTemp;
     528           0 :             uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL)));
     529           0 :             xNameCont->insertByName(OUString("ReportComponent"),uno::makeAny(xTemp));
     530           0 :             xTemp = xNameCont;
     531             : 
     532           0 :             implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
     533             :         }
     534             : 
     535           0 :         StartListening( *(m_pView->GetModel()) );
     536             :     }
     537           0 :     catch ( Exception& )
     538             :     {
     539             :         OSL_FAIL( "PropBrw::Update: Exception occurred!" );
     540             :     }
     541             : }
     542             : 
     543           0 : void PropBrw::Update( const uno::Reference< uno::XInterface>& _xReportComponent)
     544             : {
     545           0 :     if ( m_xLastSection != _xReportComponent )
     546             :     {
     547           0 :         m_xLastSection = _xReportComponent;
     548             :         try
     549             :         {
     550           0 :             if ( m_pView )
     551             :             {
     552           0 :                 EndListening( *(m_pView->GetModel()) );
     553           0 :                 m_pView = NULL;
     554             :             }
     555             : 
     556           0 :             uno::Reference< uno::XInterface> xTemp(CreateComponentPair(_xReportComponent,_xReportComponent));
     557           0 :             implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
     558             :         }
     559           0 :         catch ( Exception& )
     560             :         {
     561             :             OSL_FAIL( "PropBrw::Update: Exception occurred!" );
     562             :         }
     563             :     }
     564           0 : }
     565             : 
     566           0 : IMPL_LINK( PropBrw, OnAsyncGetFocus, void*,  )
     567             : {
     568           0 :     if (m_xBrowserComponentWindow.is())
     569           0 :         m_xBrowserComponentWindow->setFocus();
     570           0 :     return 0L;
     571             : }
     572             : 
     573           0 : void PropBrw::LoseFocus()
     574             : {
     575           0 :     DockingWindow::LoseFocus();
     576           0 :     m_pDesignView->getController().InvalidateAll();
     577           0 : }
     578             : 
     579             : }
     580             : 
     581             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10