LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/reportdesign/source/ui/report - propbrw.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 249 0.0 %
Date: 2013-07-09 Functions: 0 22 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             : DBG_NAME( rpt_PropBrw )
      93             : 
      94             : //----------------------------------------------------------------------------
      95             : 
      96           0 : PropBrw::PropBrw(const Reference< XComponentContext >& _xORB, Window* pParent, ODesignView*  _pDesignView)
      97             :           :DockingWindow(pParent,WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_3DLOOK|WB_ROLLABLE))
      98             :           ,m_xORB(_xORB)
      99             :           ,m_pDesignView(_pDesignView)
     100             :           ,m_pView( NULL )
     101           0 :           ,m_bInitialStateChange(sal_True)
     102             : {
     103             :     DBG_CTOR( rpt_PropBrw,NULL);
     104             : 
     105           0 :     Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y);
     106           0 :     SetOutputSizePixel(aPropWinSize);
     107             : 
     108             :     try
     109             :     {
     110             :         // create a frame wrapper for myself
     111           0 :         m_xMeAsFrame = Frame::create( m_xORB );
     112           0 :         m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) );
     113           0 :         m_xMeAsFrame->setName("report property browser");  // change name!
     114             :     }
     115           0 :     catch (Exception&)
     116             :     {
     117             :         OSL_FAIL("PropBrw::PropBrw: could not create/initialize my frame!");
     118             :         DBG_UNHANDLED_EXCEPTION();
     119           0 :         m_xMeAsFrame.clear();
     120             :     }
     121             : 
     122           0 :     if (m_xMeAsFrame.is())
     123             :     {
     124             :         try
     125             :         {
     126             :             ::cppu::ContextEntry_Init aHandlerContextInfo[] =
     127             :             {
     128           0 :                 ::cppu::ContextEntry_Init( OUString( "ContextDocument" ), makeAny( m_pDesignView->getController().getModel() )),
     129             :                 ::cppu::ContextEntry_Init( OUString( "DialogParentWindow" ), makeAny( VCLUnoHelper::GetInterface ( this ) )),
     130           0 :                 ::cppu::ContextEntry_Init( OUString( "ActiveConnection" ), makeAny( m_pDesignView->getController().getConnection() ) ),
     131           0 :             };
     132             :             m_xInspectorContext.set(
     133           0 :                 ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
     134           0 :                 m_xORB ) );
     135             :             // create a property browser controller
     136           0 :             bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB );
     137             :             Reference< inspection::XObjectInspectorModel> xInspectorModel( bEnableHelpSection
     138             :                 ?   report::inspection::DefaultComponentInspectorModel::createWithHelpSection( m_xInspectorContext, 3, 8 )
     139           0 :                 :   report::inspection::DefaultComponentInspectorModel::createDefault( m_xInspectorContext ) );
     140             : 
     141           0 :             m_xBrowserController = inspection::ObjectInspector::createWithModel(m_xInspectorContext, xInspectorModel);
     142           0 :             if ( !m_xBrowserController.is() )
     143             :             {
     144           0 :                 const OUString sServiceName( "com.sun.star.inspection.ObjectInspector" );
     145           0 :                 ShowServiceNotAvailableError(pParent, sServiceName, sal_True);
     146             :             }
     147             :             else
     148             :             {
     149           0 :                 m_xBrowserController->attachFrame( Reference<XFrame>(m_xMeAsFrame, UNO_QUERY_THROW));
     150           0 :                 m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow();
     151             :                 OSL_ENSURE(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!");
     152           0 :                 if ( bEnableHelpSection )
     153             :                 {
     154           0 :                     uno::Reference< inspection::XObjectInspector > xInspector( m_xBrowserController, uno::UNO_QUERY_THROW );
     155           0 :                     uno::Reference< inspection::XObjectInspectorUI > xInspectorUI( xInspector->getInspectorUI() );
     156           0 :                     uno::Reference< uno::XInterface > xDefaultHelpProvider( inspection::DefaultHelpProvider::create( m_xInspectorContext, xInspectorUI ) );
     157             :                 }
     158           0 :             }
     159             :         }
     160           0 :         catch (Exception&)
     161             :         {
     162             :             OSL_FAIL("PropBrw::PropBrw: could not create/initialize the browser controller!");
     163             :             DBG_UNHANDLED_EXCEPTION();
     164             :             try
     165             :             {
     166           0 :                 ::comphelper::disposeComponent(m_xBrowserController);
     167           0 :                 ::comphelper::disposeComponent(m_xBrowserComponentWindow);
     168             :             }
     169           0 :             catch(Exception&) { }
     170           0 :             m_xBrowserController.clear();
     171           0 :             m_xBrowserComponentWindow.clear();
     172             :         }
     173             :     }
     174             : 
     175           0 :     if (m_xBrowserComponentWindow.is())
     176             :     {
     177             : 
     178           0 :         m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(),
     179           0 :             awt::PosSize::WIDTH | awt::PosSize::HEIGHT | awt::PosSize::X | awt::PosSize::Y);
     180           0 :         Resize();
     181           0 :         m_xBrowserComponentWindow->setVisible(sal_True);
     182             :     }
     183           0 :     ::rptui::notifySystemWindow(pParent,this,::comphelper::mem_fun(&TaskPaneList::AddWindow));
     184           0 : }
     185             : 
     186             : //----------------------------------------------------------------------------
     187             : 
     188           0 : PropBrw::~PropBrw()
     189             : {
     190           0 :     if (m_xBrowserController.is())
     191           0 :         implDetachController();
     192             : 
     193             :     try
     194             :     {
     195           0 :         uno::Reference<container::XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY);
     196           0 :         if ( xName.is() )
     197             :         {
     198             :             const OUString pProps[] = { OUString( "ContextDocument" )
     199             :                                             ,  OUString( "DialogParentWindow" )
     200           0 :                                             , OUString( "ActiveConnection" )};
     201           0 :             for (size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i)
     202           0 :                 xName->removeByName(pProps[i]);
     203           0 :         }
     204             :     }
     205           0 :     catch(Exception&)
     206             :     {}
     207             : 
     208           0 :     ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
     209             : 
     210             :     DBG_DTOR( rpt_PropBrw,NULL);
     211           0 : }
     212             : // -----------------------------------------------------------------------------
     213           0 : void PropBrw::setCurrentPage(const OUString& _sLastActivePage)
     214             : {
     215           0 :     m_sLastActivePage = _sLastActivePage;
     216           0 : }
     217             : //----------------------------------------------------------------------------
     218             : 
     219           0 : void PropBrw::implDetachController()
     220             : {
     221           0 :     m_sLastActivePage = getCurrentPage();
     222           0 :     implSetNewObject(  );
     223             : 
     224           0 :     if ( m_xMeAsFrame.is() )
     225           0 :         m_xMeAsFrame->setComponent( NULL, NULL );
     226             : 
     227           0 :     if ( m_xBrowserController.is() )
     228           0 :         m_xBrowserController->attachFrame( NULL );
     229             : 
     230           0 :     m_xMeAsFrame.clear();
     231           0 :     m_xBrowserController.clear();
     232           0 :     m_xBrowserComponentWindow.clear();
     233           0 : }
     234             : //-----------------------------------------------------------------------
     235           0 : OUString PropBrw::getCurrentPage() const
     236             : {
     237           0 :     OUString sCurrentPage;
     238             :     try
     239             :     {
     240           0 :         if ( m_xBrowserController.is() )
     241             :         {
     242           0 :             OSL_VERIFY( m_xBrowserController->getViewData() >>= sCurrentPage );
     243             :         }
     244             : 
     245           0 :         if ( sCurrentPage.isEmpty() )
     246           0 :             sCurrentPage = m_sLastActivePage;
     247             :     }
     248           0 :     catch( const Exception& )
     249             :     {
     250             :         OSL_FAIL( "PropBrw::getCurrentPage: caught an exception while retrieving the current page!" );
     251             :     }
     252           0 :     return sCurrentPage;
     253             : }
     254             : //----------------------------------------------------------------------------
     255             : 
     256           0 : sal_Bool PropBrw::Close()
     257             : {
     258           0 :     m_xLastSection.clear();
     259             :     // suspend the controller (it is allowed to veto)
     260           0 :     if ( m_xMeAsFrame.is() )
     261             :     {
     262             :         try
     263             :         {
     264           0 :             Reference< XController > xController( m_xMeAsFrame->getController() );
     265           0 :             if ( xController.is() && !xController->suspend( sal_True ) )
     266           0 :                 return sal_False;
     267             :         }
     268           0 :         catch( const Exception& )
     269             :         {
     270             :             OSL_FAIL( "FmPropBrw::Close: caught an exception while asking the controller!" );
     271             :         }
     272             :     }
     273           0 :     implDetachController();
     274             : 
     275           0 :     if( IsRollUp() )
     276           0 :         RollDown();
     277             : 
     278           0 :     m_pDesignView->getController().executeUnChecked(SID_PROPERTYBROWSER_LAST_PAGE,uno::Sequence< beans::PropertyValue>());
     279             : 
     280           0 :     return sal_True;
     281             : }
     282             : 
     283             : //----------------------------------------------------------------------------
     284             : 
     285           0 : uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const SdrMarkList& _rMarkList)
     286             : {
     287           0 :     sal_uInt32 nMarkCount = _rMarkList.GetMarkCount();
     288           0 :     ::std::vector< uno::Reference< uno::XInterface> > aSets;
     289           0 :     aSets.reserve(nMarkCount);
     290             : 
     291           0 :     for(sal_uInt32 i=0;i<nMarkCount;++i)
     292             :     {
     293           0 :         SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj();
     294             : 
     295           0 :         ::std::auto_ptr<SdrObjListIter> pGroupIterator;
     296           0 :         if (pCurrent->IsGroupObject())
     297             :         {
     298           0 :             pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList()));
     299           0 :             pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
     300             :         }
     301             : 
     302           0 :         while (pCurrent)
     303             :         {
     304           0 :             OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent);
     305           0 :             if ( pObj )
     306           0 :                 aSets.push_back(CreateComponentPair(pObj));
     307             : 
     308             :             // next element
     309           0 :             pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
     310             :         }
     311           0 :     }
     312           0 :     Reference<uno::XInterface> *pSets = aSets.empty() ? NULL : &aSets[0];
     313           0 :     return uno::Sequence< Reference<uno::XInterface> >(pSets, aSets.size());
     314             : }
     315             : //----------------------------------------------------------------------------
     316           0 : void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
     317             : {
     318           0 :     if ( m_xBrowserController.is() )
     319             :     {
     320             :         try
     321             :         {
     322           0 :             m_xBrowserController->inspect(uno::Sequence< Reference<uno::XInterface> >());
     323           0 :             m_xBrowserController->inspect(_aObjects);
     324             :         }
     325           0 :         catch( const Exception& )
     326             :         {
     327             :             OSL_FAIL( "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
     328             :         }
     329             :     }
     330           0 :     SetText( GetHeadlineName(_aObjects) );
     331           0 : }
     332             : 
     333             : //----------------------------------------------------------------------------
     334             : 
     335           0 : OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
     336             : {
     337           0 :     OUString aName;
     338           0 :     if ( !_aObjects.getLength() )
     339             :     {
     340           0 :         aName = String(ModuleRes(RID_STR_BRWTITLE_NO_PROPERTIES));
     341             :     }
     342           0 :     else if ( _aObjects.getLength() == 1 )    // single selection
     343             :     {
     344           0 :         aName = String(ModuleRes(RID_STR_BRWTITLE_PROPERTIES));
     345             : 
     346           0 :         uno::Reference< container::XNameContainer > xNameCont(_aObjects[0],uno::UNO_QUERY);
     347           0 :         Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName("ReportComponent"), UNO_QUERY );
     348           0 :         if ( xServiceInfo.is() )
     349             :         {
     350           0 :             sal_uInt16 nResId = 0;
     351           0 :             if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) )
     352             :             {
     353           0 :                 nResId = RID_STR_PROPTITLE_FIXEDTEXT;
     354             :             }
     355           0 :             else if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL ) )
     356             :             {
     357           0 :                 nResId = RID_STR_PROPTITLE_IMAGECONTROL;
     358             :             }
     359           0 :             else if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ) )
     360             :             {
     361           0 :                 nResId = RID_STR_PROPTITLE_FORMATTED;
     362             :             }
     363           0 :             else if ( xServiceInfo->supportsService( SERVICE_SHAPE ) )
     364             :             {
     365           0 :                 nResId = RID_STR_PROPTITLE_SHAPE;
     366             :             }
     367           0 :             else if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
     368             :             {
     369           0 :                 nResId = RID_STR_PROPTITLE_REPORT;
     370             :             }
     371           0 :             else if ( xServiceInfo->supportsService( SERVICE_SECTION ) )
     372             :             {
     373           0 :                 nResId = RID_STR_PROPTITLE_SECTION;
     374             :             }
     375           0 :             else if ( xServiceInfo->supportsService( SERVICE_FUNCTION ) )
     376             :             {
     377           0 :                 nResId = RID_STR_PROPTITLE_FUNCTION;
     378             :             }
     379           0 :             else if ( xServiceInfo->supportsService( SERVICE_GROUP ) )
     380             :             {
     381           0 :                 nResId = RID_STR_PROPTITLE_GROUP;
     382             :             }
     383           0 :             else if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ) )
     384             :             {
     385           0 :                 nResId = RID_STR_PROPTITLE_FIXEDLINE;
     386             :             }
     387             :             else
     388             :             {
     389             :                 OSL_FAIL("Unknown service name!");
     390           0 :                 nResId = RID_STR_CLASS_FORMATTEDFIELD;
     391             :             }
     392             : 
     393           0 :             if (nResId)
     394             :             {
     395           0 :                 aName += String(ModuleRes(nResId));
     396             :             }
     397           0 :         }
     398             :     }
     399             :     else    // multiselection
     400             :     {
     401           0 :         aName = String(ModuleRes(RID_STR_BRWTITLE_PROPERTIES));
     402           0 :         aName += String(ModuleRes(RID_STR_BRWTITLE_MULTISELECT));
     403             :     }
     404             : 
     405           0 :     return aName;
     406             : }
     407             : // -----------------------------------------------------------------------------
     408           0 : uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(OObjectBase* _pObj)
     409             : {
     410           0 :     _pObj->initializeOle();
     411           0 :     return CreateComponentPair(_pObj->getAwtComponent(),_pObj->getReportComponent());
     412             : }
     413             : //----------------------------------------------------------------------------
     414           0 : uno::Reference< uno::XInterface> PropBrw::CreateComponentPair(const uno::Reference< uno::XInterface>& _xFormComponent
     415             :                                                               ,const uno::Reference< uno::XInterface>& _xReportComponent)
     416             : {
     417           0 :     uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL)));
     418           0 :     xNameCont->insertByName(OUString("FormComponent"),uno::makeAny(_xFormComponent));
     419           0 :     xNameCont->insertByName(OUString("ReportComponent"),uno::makeAny(_xReportComponent));
     420           0 :     xNameCont->insertByName(OUString("RowSet")
     421           0 :             ,uno::makeAny(uno::Reference< uno::XInterface>(m_pDesignView->getController().getRowSet())));
     422             : 
     423           0 :     return xNameCont.get();
     424             : }
     425             : // -----------------------------------------------------------------------------
     426           0 : ::Size PropBrw::getMinimumSize() const
     427             : {
     428           0 :     ::Size aSize;
     429           0 :     Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
     430           0 :     if( xLayoutConstrains.is() )
     431             :     {
     432           0 :         awt::Size aMinSize = xLayoutConstrains->getMinimumSize();
     433           0 :         aMinSize.Height += 4;
     434           0 :         aMinSize.Width += 4;
     435           0 :         aSize.setHeight( aMinSize.Height );
     436           0 :         aSize.setWidth( aMinSize.Width );
     437             :     }
     438           0 :     return aSize;
     439             : }
     440             : //----------------------------------------------------------------------------
     441           0 : void PropBrw::Resize()
     442             : {
     443           0 :     Window::Resize();
     444             : 
     445           0 :     Reference< awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
     446           0 :     if( xLayoutConstrains.is() )
     447             :     {
     448           0 :         ::Size aMinSize = getMinimumSize();
     449           0 :         SetMinOutputSizePixel( aMinSize );
     450           0 :         ::Size aSize = GetOutputSizePixel();
     451           0 :         sal_Bool bResize = sal_False;
     452           0 :         if( aSize.Width() < aMinSize.Width() )
     453             :         {
     454           0 :             aSize.setWidth( aMinSize.Width() );
     455           0 :             bResize = sal_True;
     456             :         }
     457           0 :         if( aSize.Height() < aMinSize.Height() )
     458             :         {
     459           0 :             aSize.setHeight( aMinSize.Height() );
     460           0 :             bResize = sal_True;
     461             :         }
     462           0 :         if( bResize )
     463           0 :             SetOutputSizePixel( aSize );
     464             :     }
     465             :     // adjust size
     466           0 :     if (m_xBrowserComponentWindow.is())
     467             :     {
     468           0 :            Size  aSize = GetOutputSizePixel();
     469           0 :         m_xBrowserComponentWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(),
     470           0 :             awt::PosSize::WIDTH | awt::PosSize::HEIGHT);
     471           0 :     }
     472           0 : }
     473             : //----------------------------------------------------------------------------
     474           0 : void PropBrw::Update( OSectionView* pNewView )
     475             : {
     476             :     try
     477             :     {
     478           0 :         if ( m_pView )
     479             :         {
     480           0 :             EndListening( *(m_pView->GetModel()) );
     481           0 :             m_pView = NULL;
     482             :         }
     483             : 
     484             :         // set focus on initialization
     485           0 :         if ( m_bInitialStateChange )
     486             :         {
     487             :             // if we're just newly created, we want to have the focus
     488           0 :             PostUserEvent( LINK( this, PropBrw, OnAsyncGetFocus ) );
     489           0 :             m_bInitialStateChange = sal_False;
     490             :             // and additionally, we want to show the page which was active during
     491             :             // our previous incarnation
     492           0 :             if ( !m_sLastActivePage.isEmpty() && m_xBrowserController.is() )
     493             :             {
     494             :                 try
     495             :                 {
     496           0 :                     m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) );
     497             :                 }
     498           0 :                 catch( const Exception& )
     499             :                 {
     500             :                     OSL_FAIL( "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
     501             :                 }
     502             :             }
     503             :         }
     504             : 
     505           0 :         if ( !pNewView )
     506           0 :             return;
     507             :         else
     508           0 :             m_pView = pNewView;
     509             : 
     510           0 :         uno::Sequence< Reference<uno::XInterface> > aMarkedObjects;
     511           0 :         OViewsWindow* pViews = m_pView->getReportSection()->getSectionWindow()->getViewsWindow();
     512           0 :         const sal_uInt16 nSectionCount = pViews->getSectionCount();
     513           0 :         for (sal_uInt16 i = 0; i < nSectionCount; ++i)
     514             :         {
     515           0 :             ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i);
     516           0 :             if ( pSectionWindow )
     517             :             {
     518           0 :                 const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList();
     519           0 :                 aMarkedObjects = ::comphelper::concatSequences(aMarkedObjects,CreateCompPropSet( rMarkList ));
     520             :             }
     521           0 :         }
     522             : 
     523           0 :         if ( aMarkedObjects.getLength() ) // multiple selection
     524             :         {
     525           0 :             m_xLastSection.clear();
     526           0 :             implSetNewObject( aMarkedObjects );
     527             :         }
     528           0 :         else if ( m_xLastSection != m_pView->getReportSection()->getSection() )
     529             :         {
     530           0 :             uno::Reference< uno::XInterface> xTemp(m_pView->getReportSection()->getSection());
     531           0 :             m_xLastSection = xTemp;
     532           0 :             uno::Reference< container::XNameContainer > xNameCont = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast<Reference<XInterface> * >(NULL)));
     533           0 :             xNameCont->insertByName(OUString("ReportComponent"),uno::makeAny(xTemp));
     534           0 :             xTemp = xNameCont;
     535             : 
     536           0 :             implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
     537             :         }
     538             : 
     539           0 :         StartListening( *(m_pView->GetModel()) );
     540             :     }
     541           0 :     catch ( Exception& )
     542             :     {
     543             :         OSL_FAIL( "PropBrw::Update: Exception occurred!" );
     544             :     }
     545             : }
     546             : //----------------------------------------------------------------------------
     547           0 : void PropBrw::Update( const uno::Reference< uno::XInterface>& _xReportComponent)
     548             : {
     549           0 :     if ( m_xLastSection != _xReportComponent )
     550             :     {
     551           0 :         m_xLastSection = _xReportComponent;
     552             :         try
     553             :         {
     554           0 :             if ( m_pView )
     555             :             {
     556           0 :                 EndListening( *(m_pView->GetModel()) );
     557           0 :                 m_pView = NULL;
     558             :             }
     559             : 
     560           0 :             uno::Reference< uno::XInterface> xTemp(CreateComponentPair(_xReportComponent,_xReportComponent));
     561           0 :             implSetNewObject( uno::Sequence< uno::Reference< uno::XInterface> >(&xTemp,1) );
     562             :         }
     563           0 :         catch ( Exception& )
     564             :         {
     565             :             OSL_FAIL( "PropBrw::Update: Exception occurred!" );
     566             :         }
     567             :     }
     568           0 : }
     569             : //-----------------------------------------------------------------------
     570           0 : IMPL_LINK( PropBrw, OnAsyncGetFocus, void*,  )
     571             : {
     572           0 :     if (m_xBrowserComponentWindow.is())
     573           0 :         m_xBrowserComponentWindow->setFocus();
     574           0 :     return 0L;
     575             : }
     576             : //----------------------------------------------------------------------------
     577           0 : void PropBrw::LoseFocus()
     578             : {
     579           0 :     DockingWindow::LoseFocus();
     580           0 :     m_pDesignView->getController().InvalidateAll();
     581           0 : }
     582             : //----------------------------------------------------------------------------
     583           0 : }
     584             : 
     585             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10