LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/core/sdr - ReportDrawPage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 0.0 %
Date: 2012-12-27 Functions: 0 3 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 "ReportDrawPage.hxx"
      20             : #include "RptObject.hxx"
      21             : #include "RptModel.hxx"
      22             : #include "RptDef.hxx"
      23             : #include "corestrings.hrc"
      24             : #include <comphelper/mimeconfighelper.hxx>
      25             : #include <comphelper/classids.hxx>
      26             : #include <comphelper/embeddedobjectcontainer.hxx>
      27             : #include <comphelper/documentconstants.hxx>
      28             : 
      29             : #include <svx/svdmodel.hxx>
      30             : #include <com/sun/star/report/XFixedLine.hpp>
      31             : #include <com/sun/star/beans/NamedValue.hpp>
      32             : 
      33             : #include <tools/diagnose_ex.h>
      34             : #include <svx/unoshape.hxx>
      35             : 
      36             : namespace reportdesign
      37             : {
      38             :     using namespace ::com::sun::star;
      39             :     using namespace rptui;
      40             : 
      41           0 : OReportDrawPage::OReportDrawPage(SdrPage* _pPage
      42             :                                  ,const uno::Reference< report::XSection >& _xSection)
      43             : : SvxDrawPage(_pPage)
      44           0 : ,m_xSection(_xSection)
      45             : {
      46           0 : }
      47             : 
      48           0 : SdrObject* OReportDrawPage::_CreateSdrObject( const uno::Reference< drawing::XShape > & xDescr ) throw ()
      49             : {
      50           0 :     uno::Reference< report::XReportComponent> xReportComponent(xDescr,uno::UNO_QUERY);
      51           0 :     if ( xReportComponent.is() )
      52           0 :         return OObjectBase::createObject(xReportComponent);
      53           0 :     return SvxDrawPage::_CreateSdrObject( xDescr );
      54             : }
      55             : 
      56           0 : uno::Reference< drawing::XShape >  OReportDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
      57             : {
      58           0 :     OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj);
      59           0 :     if ( !pBaseObj )
      60           0 :         return SvxDrawPage::_CreateShape( pObj );
      61             : 
      62           0 :     uno::Reference< report::XSection> xSection = m_xSection;
      63           0 :     uno::Reference< lang::XMultiServiceFactory> xFactory;
      64           0 :     if ( xSection.is() )
      65           0 :         xFactory.set(xSection->getReportDefinition(),uno::UNO_QUERY);
      66           0 :     uno::Reference< drawing::XShape > xRet;
      67           0 :     uno::Reference< drawing::XShape > xShape;
      68           0 :     if ( xFactory.is() )
      69             :     {
      70           0 :         bool bChangeOrientation = false;
      71           0 :         ::rtl::OUString sServiceName = pBaseObj->getServiceName();
      72             :         OSL_ENSURE(!sServiceName.isEmpty(),"No Service Name given!");
      73             : 
      74           0 :         if ( pObj->ISA(OUnoObject) )
      75             :         {
      76           0 :             OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObj);
      77           0 :             if ( pUnoObj->GetObjIdentifier() == OBJ_DLG_FIXEDTEXT )
      78             :             {
      79           0 :                 uno::Reference<beans::XPropertySet> xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
      80           0 :                 if ( xControlModel.is() )
      81           0 :                     xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::makeAny(sal_True));
      82             :             }
      83             :             else
      84           0 :                 bChangeOrientation = pUnoObj->GetObjIdentifier() == OBJ_DLG_HFIXEDLINE;
      85           0 :             SvxShapeControl* pShape = new SvxShapeControl( pObj );
      86           0 :             xShape.set(static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper *>(pShape)),uno::UNO_QUERY);
      87           0 :             pShape->setShapeKind(pObj->GetObjIdentifier());
      88             :         }
      89           0 :         else if ( pObj->ISA(OCustomShape) )
      90             :         {
      91           0 :             SvxCustomShape* pShape = new SvxCustomShape( pObj );
      92           0 :             uno::Reference < drawing::XEnhancedCustomShapeDefaulter > xShape2 = pShape;
      93           0 :             xShape.set(xShape2,uno::UNO_QUERY);
      94           0 :             pShape->setShapeKind(pObj->GetObjIdentifier());
      95             :         }
      96           0 :         else if ( pObj->ISA(SdrOle2Obj) )
      97             :         {
      98           0 :             SdrOle2Obj* pOle2Obj = dynamic_cast<SdrOle2Obj*>(pObj);
      99           0 :             if ( !pOle2Obj->GetObjRef().is() )
     100             :             {
     101           0 :                 sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
     102           0 :                 uno::Reference < embed::XEmbeddedObject > xObj;
     103           0 :                 ::rtl::OUString sName;
     104           0 :                 xObj = pObj->GetModel()->GetPersist()->getEmbeddedObjectContainer().CreateEmbeddedObject(
     105             :                     ::comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation(
     106           0 :                     ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("80243D39-6741-46C5-926E-069164FF87BB"))), sName );
     107             :                 OSL_ENSURE(xObj.is(),"Embedded Object could not be created!");
     108             : 
     109             :                 /**************************************************
     110             :                 * Das leere OLE-Objekt bekommt ein neues IPObj
     111             :                 **************************************************/
     112           0 :                 pObj->SetEmptyPresObj(sal_False);
     113           0 :                 pOle2Obj->SetOutlinerParaObject(NULL);
     114           0 :                 pOle2Obj->SetObjRef(xObj);
     115           0 :                 pOle2Obj->SetPersistName(sName);
     116           0 :                 pOle2Obj->SetName(sName);
     117           0 :                 pOle2Obj->SetAspect(nAspect);
     118           0 :                 Rectangle aRect = pOle2Obj->GetLogicRect();
     119             : 
     120           0 :                 Size aTmp = aRect.GetSize();
     121           0 :                 awt::Size aSz( aTmp.Width(), aTmp.Height() );
     122           0 :                 xObj->setVisualAreaSize( nAspect, aSz );
     123             :             }
     124           0 :             SvxOle2Shape* pShape = new SvxOle2Shape( pObj );
     125           0 :             xShape.set(*pShape,uno::UNO_QUERY);
     126           0 :             pShape->setShapeKind(pObj->GetObjIdentifier());
     127             :         }
     128             : 
     129           0 :         if ( !xShape.is() )
     130           0 :             xShape.set( SvxDrawPage::_CreateShape( pObj ) );
     131             : 
     132             :         try
     133             :         {
     134           0 :             OReportModel* pRptModel = static_cast<OReportModel*>(pObj->GetModel());
     135           0 :             xRet.set( pRptModel->createShape(sServiceName,xShape,bChangeOrientation ? 0 : 1), uno::UNO_QUERY_THROW );
     136             :         }
     137           0 :         catch( const uno::Exception& )
     138             :         {
     139             :             DBG_UNHANDLED_EXCEPTION();
     140           0 :         }
     141             :     }
     142             : 
     143           0 :     return xRet;
     144             : }
     145             : 
     146             : }
     147             : 
     148             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10