LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - unodraw.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 4 75.0 %
Date: 2012-12-27 Functions: 3 4 75.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             : #ifndef _UNODRAW_HXX
      20             : #define _UNODRAW_HXX
      21             : 
      22             : #include <svx/fmdpage.hxx>
      23             : #include <calbck.hxx>
      24             : #include <frmfmt.hxx>
      25             : #include <com/sun/star/text/XTextContent.hpp>
      26             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      27             : #include <com/sun/star/drawing/XShape.hpp>
      28             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      29             : #include <com/sun/star/beans/XPropertyState.hpp>
      30             : #include <com/sun/star/drawing/XShapes.hpp>
      31             : #include <cppuhelper/implbase3.hxx> // helper for implementations
      32             : #include <cppuhelper/implbase4.hxx> // helper for implementations
      33             : #include <cppuhelper/implbase6.hxx> // helper for implementations
      34             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      35             : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
      36             : #include <svl/itemprop.hxx>
      37             : 
      38             : class SdrMarkList;
      39             : class SdrView;
      40             : class SwDoc;
      41             : 
      42             : class SwFmDrawPage : public SvxFmDrawPage
      43             : {
      44             :     SdrPageView*        pPageView;
      45             : protected:
      46             : 
      47             :     // Create a SdrObject according to a description. Can be used by derived classes to
      48             :     // support own ::com::sun::star::drawing::Shapes (e.g. controls).
      49             :     virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape ) throw ();
      50             : 
      51             : public:
      52             :     SwFmDrawPage( SdrPage* pPage );
      53             :     virtual ~SwFmDrawPage() throw ();
      54             : 
      55             :     const SdrMarkList&  PreGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes);
      56             :     void                PreUnGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >   xShapeGroup);
      57             : 
      58           0 :     SdrView*            GetDrawView() {return mpView;}
      59             :     SdrPageView*        GetPageView();
      60             :     void                RemovePageView();
      61             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >       GetInterface( SdrObject* pObj );
      62             : 
      63             :     // The following method is called when a SvxShape-object is to be created.
      64             :     // Derived classes may obtain at this point a derivation or an object
      65             :     // that is aggregating a SvxShape.
      66             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >  _CreateShape( SdrObject *pObj ) const throw ();
      67             : };
      68             : 
      69             : typedef cppu::WeakAggImplHelper4
      70             : <
      71             :     ::com::sun::star::container::XEnumerationAccess,
      72             :     ::com::sun::star::drawing::XDrawPage,
      73             :     ::com::sun::star::lang::XServiceInfo,
      74             :     ::com::sun::star::drawing::XShapeGrouper
      75             : >
      76             : SwXDrawPageBaseClass;
      77             : class SwXDrawPage : public SwXDrawPageBaseClass
      78             : {
      79             :     SwDoc*          pDoc;
      80             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >     xPageAgg;
      81             :     SwFmDrawPage*   pDrawPage;
      82             : public:
      83             :     SwXDrawPage(SwDoc* pDoc);
      84             :     ~SwXDrawPage();
      85             : 
      86             :     //XEnumerationAccess
      87             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
      88             : 
      89             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
      90             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
      91             : 
      92             :     //XIndexAccess
      93             :     virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
      94             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
      95             : 
      96             :     //XElementAccess
      97             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
      98             :     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
      99             : 
     100             :     //XShapes
     101             :     virtual void SAL_CALL add(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
     102             :     virtual void SAL_CALL remove(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
     103             : 
     104             :     //XShapeGrouper
     105             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >  SAL_CALL group(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes) throw( ::com::sun::star::uno::RuntimeException );
     106             :     virtual void SAL_CALL ungroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > & aGroup) throw( ::com::sun::star::uno::RuntimeException );
     107             : 
     108             :     //XServiceInfo
     109             :     virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
     110             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
     111             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
     112             : 
     113             :     SwFmDrawPage*   GetSvxPage();
     114             :     // renamed and outlined to detect where it's called
     115             :     void    InvalidateSwDoc(); // {pDoc = 0;}
     116             : };
     117             : 
     118             : class SwShapeDescriptor_Impl;
     119             : class SwXGroupShape;
     120             : typedef
     121             : cppu::WeakAggImplHelper6
     122             : <
     123             :     ::com::sun::star::beans::XPropertySet,
     124             :     ::com::sun::star::beans::XPropertyState,
     125             :     ::com::sun::star::text::XTextContent,
     126             :     ::com::sun::star::lang::XServiceInfo,
     127             :     ::com::sun::star::lang::XUnoTunnel,
     128             :     ::com::sun::star::drawing::XShape
     129             : >
     130             : SwXShapeBaseClass;
     131             : class SwXShape : public SwXShapeBaseClass,
     132             :     public SwClient
     133             : {
     134             :     friend class SwHTMLImageWatcher;
     135             :     friend class SwHTMLParser;
     136             :     friend class SwXGroupShape;
     137             :     friend class SwXDrawPage;
     138             : 
     139             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xShapeAgg;
     140             :     // reference to <XShape>, determined in the
     141             :     // constructor by <queryAggregation> at <xShapeAgg>.
     142             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
     143             : 
     144             :     const SfxItemPropertySet*           m_pPropSet;
     145             :     const SfxItemPropertyMapEntry*      m_pPropertyMapEntries;
     146             :     com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
     147             : 
     148             :     SwShapeDescriptor_Impl*     pImpl;
     149             : 
     150             :     sal_Bool                        m_bDescriptor;
     151             : 
     152        1298 :     SwFrmFmt*               GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
     153             : 
     154             :     SvxShape*               GetSvxShape();
     155             : 
     156             :     /** method to determine top group object
     157             : 
     158             :         @author OD
     159             :     */
     160             :     SdrObject* _GetTopGroupObj( SvxShape* _pSvxShape = 0L );
     161             : 
     162             :     /** method to determine position according to the positioning attributes
     163             : 
     164             :         @author OD
     165             :     */
     166             :     com::sun::star::awt::Point _GetAttrPosition();
     167             : 
     168             :     /** method to convert the position (translation) of the drawing object to
     169             :         the layout direction horizontal left-to-right.
     170             : 
     171             :         @author OD
     172             :     */
     173             :     ::com::sun::star::awt::Point _ConvertPositionToHoriL2R(
     174             :                                     const ::com::sun::star::awt::Point _aObjPos,
     175             :                                     const ::com::sun::star::awt::Size _aObjSize );
     176             : 
     177             :     /** method to convert the transformation of the drawing object to the layout
     178             :         direction, the drawing object is in
     179             : 
     180             :         @author OD
     181             :     */
     182             :     ::com::sun::star::drawing::HomogenMatrix3 _ConvertTransformationToLayoutDir(
     183             :                 ::com::sun::star::drawing::HomogenMatrix3 _aMatrixInHoriL2R );
     184             : 
     185             :     /** method to adjust the positioning properties
     186             : 
     187             :         @author OD
     188             : 
     189             :         @param _aPosition
     190             :         input parameter - point representing the new shape position. The position
     191             :         has to be given in the layout direction the shape is in and relative to
     192             :         its position alignment areas.
     193             :     */
     194             :     void _AdjustPositionProperties( const ::com::sun::star::awt::Point _aPosition );
     195             : 
     196             :     /** method to convert start or end position of the drawing object to the
     197             :         Writer specific position, which is the attribute position in layout direction
     198             : 
     199             :         @author OD
     200             :     */
     201             :     ::com::sun::star::awt::Point _ConvertStartOrEndPosToLayoutDir(
     202             :                             const ::com::sun::star::awt::Point& aStartOrEndPos );
     203             : 
     204             :     /** method to convert PolyPolygonBezier of the drawing object to the
     205             :         Writer specific position, which is the attribute position in layout direction
     206             : 
     207             :         @author OD
     208             :     */
     209             :     ::com::sun::star::drawing::PolyPolygonBezierCoords _ConvertPolyPolygonBezierToLayoutDir(
     210             :                     const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath );
     211             : 
     212             :     /** method to get property from aggregation object
     213             : 
     214             :         @author OD
     215             :     */
     216             :     ::com::sun::star::uno::Any _getPropAtAggrObj( const ::rtl::OUString& _rPropertyName )
     217             :             throw( ::com::sun::star::beans::UnknownPropertyException,
     218             :                    ::com::sun::star::lang::WrappedTargetException,
     219             :                    ::com::sun::star::uno::RuntimeException);
     220             : 
     221             : protected:
     222             :     virtual ~SwXShape();
     223             :     //SwClient
     224             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
     225             : 
     226             : public:
     227             :     SwXShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
     228             : 
     229             : 
     230             :     TYPEINFO();
     231             :     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
     232             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
     233             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
     234             :     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
     235             : 
     236             :     //XUnoTunnel
     237             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
     238             : 
     239             : 
     240             :     //XPropertySet
     241             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
     242             :     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     243             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     244             :     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     245             :     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     246             :     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     247             :     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     248             : 
     249             :     //XPropertyState
     250             :     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     251             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     252             :     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     253             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     254             : 
     255             :     //XTextContent
     256             :     virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
     257             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >  SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
     258             : 
     259             :     //XComponent
     260             :     virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
     261             :     virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
     262             :     virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
     263             : 
     264             :     //XServiceInfo
     265             :     virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
     266             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
     267             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
     268             : 
     269             :     virtual ::com::sun::star::awt::Point SAL_CALL getPosition(  ) throw (::com::sun::star::uno::RuntimeException);
     270             :     virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException);
     271             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
     272             :     virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
     273             :     virtual ::rtl::OUString SAL_CALL getShapeType(  ) throw (::com::sun::star::uno::RuntimeException);
     274             : 
     275          58 :     SwShapeDescriptor_Impl*     GetDescImpl() {return pImpl;}
     276          58 :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >                 GetAggregationInterface() {return xShapeAgg;}
     277             : 
     278             :     // helper
     279             :     static void AddExistingShapeToFmt( SdrObject& _rObj );
     280             : };
     281             : 
     282             : class SwXGroupShape :
     283             :     public SwXShape,
     284             :     public ::com::sun::star::drawing::XShapes
     285             : {
     286             : protected:
     287             :     virtual ~SwXGroupShape();
     288             : public:
     289             :     SwXGroupShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
     290             : 
     291             : 
     292             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
     293             :     virtual void SAL_CALL acquire(  ) throw();
     294             :     virtual void SAL_CALL release(  ) throw();
     295             : 
     296             :     //XShapes
     297             :     virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
     298             :     virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
     299             : 
     300             :     //XIndexAccess
     301             :     virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
     302             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
     303             : 
     304             :     //XElementAccess
     305             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
     306             :     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
     307             : };
     308             : #endif
     309             : 
     310             : 
     311             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10