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

Generated by: LCOV version 1.10