LCOV - code coverage report
Current view: top level - include/svx - svdograf.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 7 71.4 %
Date: 2015-06-13 12:38:46 Functions: 3 6 50.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             : 
      20             : #ifndef INCLUDED_SVX_SVDOGRAF_HXX
      21             : #define INCLUDED_SVX_SVDOGRAF_HXX
      22             : 
      23             : #include <com/sun/star/io/XInputStream.hpp>
      24             : #include <vcl/graph.hxx>
      25             : #include <svx/svdorect.hxx>
      26             : #include <svtools/grfmgr.hxx>
      27             : #include <svx/svxdllapi.h>
      28             : #include <o3tl/typed_flags_set.hxx>
      29             : 
      30             : namespace sdr
      31             : {
      32             :     namespace properties
      33             :     {
      34             :         class GraphicProperties;
      35             :     } // end of namespace properties
      36             :     namespace contact
      37             :     {
      38             :         class ViewObjectContactOfGraphic;
      39             :     } // end of namespace contact
      40             : } // end of namespace sdr
      41             : 
      42             : /* options for GetTransformedGraphic() */
      43             : enum class SdrGrafObjTransformsAttrs
      44             : {
      45             :     NONE       = 0x00,
      46             :     COLOR      = 0x01,
      47             :     MIRROR     = 0x02,
      48             :     ROTATE     = 0x04,
      49             :     ALL        = 0x07,
      50             : };
      51             : namespace o3tl
      52             : {
      53             :     template<> struct typed_flags<SdrGrafObjTransformsAttrs> : is_typed_flags<SdrGrafObjTransformsAttrs, 7> {};
      54             : }
      55             : 
      56           0 : class SdrGrafObjGeoData : public SdrTextObjGeoData
      57             : {
      58             : public:
      59             :     bool                    bMirrored;
      60             : 
      61           1 :     SdrGrafObjGeoData()
      62           1 :     :   bMirrored(false)
      63             :     {
      64           1 :     }
      65             : };
      66             : 
      67             : class GraphicObject;
      68             : class SdrGraphicLink;
      69             : 
      70             : /**
      71             :  * This class represents an embedded or linked bitmap graphic object.
      72             :  */
      73             : class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj
      74             : {
      75             : private:
      76             :     // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
      77             :     friend class sdr::properties::GraphicProperties;
      78             : 
      79             :     // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
      80             :     friend class sdr::contact::ViewObjectContactOfGraphic;
      81             :     friend class SdrExchangeView; // Only for a ForceSwapIn() call.
      82             :     friend class SdrGraphicLink;
      83             : 
      84             : private:
      85             :     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
      86             :     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
      87             : 
      88             :     void                    ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren
      89             :     GraphicAttr             aGrafInfo;
      90             : 
      91             :     OUString aFileName;          // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
      92             :     OUString aReferer;
      93             :     OUString aFilterName;
      94             :     GraphicObject*          pGraphic;           // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
      95             :     GraphicObject*          mpReplacementGraphic;
      96             :     SdrGraphicLink*         pGraphicLink;       // Und hier noch ein Pointer fuer gelinkte Grafiken
      97             :     bool                    bMirrored:1;        // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
      98             : 
      99             :     // #111096#
     100             :     // Flag for allowing text animation. Default is sal_true.
     101             :     bool mbGrafAnimationAllowed:1;
     102             : 
     103             :     // #i25616#
     104             :     bool mbInsidePaint:1;
     105             :     bool mbIsPreview:1;
     106             : 
     107             : private:
     108             : 
     109             :     void                    ImpLinkAnmeldung();
     110             :     void                    ImpLinkAbmeldung();
     111             :     bool                    ImpUpdateGraphicLink( bool bAsynchron = true ) const;
     112             :     void                    ImpSetLinkedGraphic( const Graphic& rGraphic );
     113             :                             DECL_LINK( ImpSwapHdl, GraphicObject* );
     114             :     void onGraphicChanged();
     115             : 
     116             : public:
     117             :                             TYPEINFO_OVERRIDE();
     118             : 
     119             :                             SdrGrafObj();
     120             :                             SdrGrafObj(const Graphic& rGrf);
     121             :                             SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect);
     122             :     virtual                 ~SdrGrafObj();
     123             : 
     124             :     void                    SetGraphicObject( const GraphicObject& rGrfObj );
     125             :     const GraphicObject&    GetGraphicObject(bool bForceSwapIn = false) const;
     126             :     const GraphicObject*    GetReplacementGraphicObject() const;
     127             : 
     128             :     void                    NbcSetGraphic(const Graphic& rGrf);
     129             :     void                    SetGraphic(const Graphic& rGrf);
     130             :     const Graphic&          GetGraphic() const;
     131             : 
     132             :     Graphic                 GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
     133             : 
     134             :     GraphicType             GetGraphicType() const;
     135             : 
     136             :     // #111096#
     137             :     // Keep ATM for SD.
     138             :     bool IsAnimated() const;
     139             :     bool IsEPS() const;
     140             :     bool IsSwappedOut() const;
     141             : 
     142             :     const MapMode&          GetGrafPrefMapMode() const;
     143             :     const Size&             GetGrafPrefSize() const;
     144             : 
     145             :     void                    SetGrafStreamURL( const OUString& rGraphicStreamURL );
     146             :     OUString                GetGrafStreamURL() const;
     147             : 
     148             : private:
     149             :     void                    ForceSwapIn() const;
     150             : 
     151             : public:
     152             :     void                    SetGraphicLink(const OUString& rFileName, const OUString& rReferer, const OUString& rFilterName);
     153             :     void                    ReleaseGraphicLink();
     154             :     bool IsLinkedGraphic() const;
     155             : 
     156         360 :     const OUString& GetFileName() const { return aFileName;}
     157           0 :     const OUString& GetFilterName() const { return aFilterName;}
     158             : 
     159             :     void                    StartAnimation(OutputDevice* pOutDev, const Point& rPoint, const Size& rSize, long nExtraData=0L);
     160             : 
     161             :     virtual void            TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
     162             :     virtual sal_uInt16          GetObjIdentifier() const SAL_OVERRIDE;
     163             : 
     164             :     virtual OUString        TakeObjNameSingul() const SAL_OVERRIDE;
     165             :     virtual OUString        TakeObjNamePlural() const SAL_OVERRIDE;
     166             : 
     167             :     // #i25616#
     168             :     virtual basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
     169             : 
     170             :     virtual SdrGrafObj* Clone() const SAL_OVERRIDE;
     171             :     SdrGrafObj&             operator=(const SdrGrafObj& rObj);
     172             : 
     173             :     virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
     174             :     virtual SdrHdl*         GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
     175             : 
     176             :     virtual void            NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
     177             :     virtual void            NbcRotate(const Point& rRef, long nAngle, double sn, double cs) SAL_OVERRIDE;
     178             :     virtual void            NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
     179             :     virtual void            NbcShear (const Point& rRef, long nAngle, double tn, bool bVShear) SAL_OVERRIDE;
     180             :     virtual void            NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
     181             :     virtual void            NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
     182             :     virtual SdrObjGeoData*  NewGeoData() const SAL_OVERRIDE;
     183             :     virtual void            SaveGeoData(SdrObjGeoData& rGeo) const SAL_OVERRIDE;
     184             :     virtual void            RestGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
     185             : 
     186             :     bool                    HasGDIMetaFile() const;
     187             : 
     188             :     virtual void            SetPage(SdrPage* pNewPage) SAL_OVERRIDE;
     189             :     virtual void            SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
     190             : 
     191             :     bool isEmbeddedSvg() const;
     192             :     GDIMetaFile getMetafileFromEmbeddedSvg() const;
     193             : 
     194             :     virtual SdrObject*      DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
     195             : 
     196             :     virtual void            AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ) SAL_OVERRIDE;
     197             : 
     198             :     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     199             : 
     200        1275 :     bool IsMirrored() const { return bMirrored;}
     201             :     void SetMirrored( bool _bMirrored );
     202             : 
     203             :     // #111096#
     204             :     // Access to GrafAnimationAllowed flag
     205             :     void SetGrafAnimationAllowed(bool bNew);
     206             : 
     207             :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream();
     208             : 
     209             :     // #i103116# FullDrag support
     210             :     virtual SdrObject* getFullDragClone() const SAL_OVERRIDE;
     211             : 
     212             :     // add handles for crop mode when selected
     213             :     virtual void addCropHandles(SdrHdlList& rTarget) const SAL_OVERRIDE;
     214             : };
     215             : 
     216             : #endif // INCLUDED_SVX_SVDOGRAF_HXX
     217             : 
     218             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11