LCOV - code coverage report
Current view: top level - svx/inc/svx - svdoashp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 2 50.0 %
Date: 2012-08-25 Functions: 2 6 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVDOASHP_HXX
      30                 :            : #define _SVDOASHP_HXX
      31                 :            : 
      32                 :            : #include <svx/svdobj.hxx>
      33                 :            : #include <svx/svdotext.hxx>
      34                 :            : #include <svx/svdhdl.hxx>
      35                 :            : #include <vector>
      36                 :            : #include <com/sun/star/uno/Reference.h>
      37                 :            : #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
      38                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      39                 :            : #include "svx/svxdllapi.h"
      40                 :            : 
      41                 :            : //************************************************************
      42                 :            : //   Vorausdeklarationen
      43                 :            : //************************************************************
      44                 :            : 
      45                 :            : class SdrObjList;
      46                 :            : class SdrObjListIter;
      47                 :            : class SfxItemSet;
      48                 :            : 
      49                 :            : namespace sdr
      50                 :            : {
      51                 :            :     namespace properties
      52                 :            :     {
      53                 :            :         class CustomShapeProperties;
      54                 :            :     } // end of namespace properties
      55                 :            : } // end of namespace sdr
      56                 :            : 
      57 [ +  - ][ -  + ]:        456 : class SdrAShapeObjGeoData : public SdrTextObjGeoData
                 [ +  - ]
      58                 :            : {
      59                 :            :     public:
      60                 :            : 
      61                 :            :     sal_Bool    bMirroredX;
      62                 :            :     sal_Bool    bMirroredY;
      63                 :            :     double      fObjectRotation;
      64                 :            : 
      65                 :            :     com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >
      66                 :            :                 aAdjustmentSeq;
      67                 :            : };
      68                 :            : 
      69                 :            : #define CUSTOMSHAPE_HANDLE_RESIZE_FIXED         1
      70                 :            : #define CUSTOMSHAPE_HANDLE_CREATE_FIXED         2
      71                 :            : #define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X    4
      72                 :            : #define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y    8
      73                 :            : #define CUSTOMSHAPE_HANDLE_MOVE_SHAPE           16
      74                 :            : #define CUSTOMSHAPE_HANDLE_ORTHO4               32
      75                 :            : 
      76                 :          0 : struct SdrCustomShapeInteraction
      77                 :            : {
      78                 :            :     com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle >   xInteraction;
      79                 :            :     com::sun::star::awt::Point                                                      aPosition;
      80                 :            :     sal_Int32                                                                       nMode;
      81                 :            : };
      82                 :            : 
      83                 :            : //************************************************************
      84                 :            : //   SdrObjCustomShape
      85                 :            : //************************************************************
      86                 :            : 
      87                 :            : class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj
      88                 :            : {
      89                 :            : private:
      90                 :            :     // fObjectRotation is containing the object rotation in degrees.
      91                 :            :     double fObjectRotation;
      92                 :            : 
      93                 :            : protected:
      94                 :            :     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
      95                 :            : 
      96                 :            : public:
      97                 :            :     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
      98                 :            : 
      99                 :            :     // to allow sdr::properties::CustomShapeProperties access
     100                 :            :     friend class sdr::properties::CustomShapeProperties;
     101                 :            : 
     102                 :            :     com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mXRenderedCustomShape;
     103                 :            : 
     104                 :            :     // #i37011# render geometry shadow
     105                 :            :     SdrObject*                                          mpLastShadowGeometry;
     106                 :            : 
     107                 :            :     static com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape );
     108                 :            : 
     109                 :            : //  SVX_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > >
     110                 :            : //      SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const;
     111                 :            : // #i47293#
     112                 :            : //  SVX_DLLPRIVATE std::vector< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > > GetFixedInteractionHandle() const;
     113                 :            : 
     114                 :            :     SVX_DLLPRIVATE std::vector< SdrCustomShapeInteraction > GetInteractionHandles( const SdrObjCustomShape* pCustomShape ) const;
     115                 :            : 
     116                 :            :     SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
     117                 :            : 
     118                 :            :     SVX_DLLPRIVATE void DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const;
     119                 :            :     SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const;
     120                 :            : 
     121                 :            :     // #i37011# centralize throw-away of render geometry
     122                 :            :     void InvalidateRenderGeometry();
     123                 :            : 
     124                 :            :     // #i38892#
     125                 :            :     void ImpCheckCustomGluePointsAreAdded();
     126                 :            : 
     127                 :            :     // returns the new text rect that corresponds to the current logic rect, the return value can be empty if nothing changed.
     128                 :            :     Rectangle ImpCalculateTextFrame( const bool bHgt, const bool bWdt );
     129                 :            : 
     130                 :            : public:
     131                 :            :     // #i37011#
     132                 :            :     const SdrObject* GetSdrObjectFromCustomShape() const;
     133                 :            :     const SdrObject* GetSdrObjectShadowFromCustomShape() const;
     134                 :            :     sal_Bool GetTextBounds( Rectangle& rTextBound ) const;
     135                 :            :     sal_Bool IsTextPath() const;
     136                 :            :     static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed );
     137                 :            : 
     138                 :            : protected:
     139                 :            : 
     140                 :            :     String      aName;
     141                 :            : 
     142                 :            : public:
     143                 :            : 
     144                 :            :     sal_Bool UseNoFillStyle() const;
     145                 :            : 
     146                 :            :     sal_Bool IsMirroredX() const;
     147                 :            :     sal_Bool IsMirroredY() const;
     148                 :            :     bool     IsPostRotate() const;
     149                 :            :     void SetMirroredX( const sal_Bool bMirroredX );
     150                 :            :     void SetMirroredY( const sal_Bool bMirroredY );
     151                 :            : 
     152                 :            :     double GetObjectRotation() const;
     153                 :            :     double GetExtraTextRotation( const bool bPreRotation = false ) const;
     154                 :            : 
     155                 :            :     TYPEINFO();
     156                 :            :     SdrObjCustomShape();
     157                 :            :     virtual ~SdrObjCustomShape();
     158                 :            : 
     159                 :            :     /* is merging default attributes from type-shype into the SdrCustomShapeGeometryItem. If pType
     160                 :            :     is NULL then the type is being taken from the "Type" property of the SdrCustomShapeGeometryItem.
     161                 :            :     MergeDefaultAttributes is called when creating CustomShapes via UI and after importing */
     162                 :            :     void MergeDefaultAttributes( const rtl::OUString* pType = NULL );
     163                 :            : 
     164                 :            :     /* the method is checking if the geometry data is unchanged/default, in this case the data might not be stored */
     165                 :            :     enum DefaultType
     166                 :            :     {
     167                 :            :         DEFAULT_PATH,
     168                 :            :         DEFAULT_VIEWBOX,
     169                 :            :         DEFAULT_SEGMENTS,
     170                 :            :         DEFAULT_GLUEPOINTS,
     171                 :            :         DEFAULT_STRETCHX,
     172                 :            :         DEFAULT_STRETCHY,
     173                 :            :         DEFAULT_EQUATIONS,
     174                 :            :         DEFAULT_HANDLES,
     175                 :            :         DEFAULT_TEXTFRAMES
     176                 :            :     };
     177                 :            :     sal_Bool IsDefaultGeometry( const DefaultType eDefaultType ) const;
     178                 :            : 
     179                 :            :     virtual sal_uInt16 GetObjIdentifier() const;
     180                 :            :     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
     181                 :            : 
     182                 :            :     virtual void SetModel(SdrModel* pNewModel);
     183                 :            : 
     184                 :            :     virtual void RecalcSnapRect();
     185                 :            : 
     186                 :            :     virtual const Rectangle& GetSnapRect()  const;
     187                 :            :     virtual const Rectangle& GetCurrentBoundRect() const;
     188                 :            :     virtual const Rectangle& GetLogicRect() const;
     189                 :            : 
     190                 :            :     virtual void Move(const Size& rSiz);
     191                 :            :     virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
     192                 :            :     virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear);
     193                 :            :     virtual void SetSnapRect(const Rectangle& rRect);
     194                 :            :     virtual void SetLogicRect(const Rectangle& rRect);
     195                 :            : 
     196                 :            :     virtual void NbcMove(const Size& rSiz);
     197                 :            :     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
     198                 :            :     virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
     199                 :            :     virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
     200                 :            :     virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear);
     201                 :            :     virtual void NbcSetSnapRect(const Rectangle& rRect);
     202                 :            :     virtual void NbcSetLogicRect(const Rectangle& rRect);
     203                 :            : 
     204                 :            :     virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
     205                 :            : 
     206                 :            :     virtual void NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr );
     207                 :            : 
     208                 :            :     // special drag methods
     209                 :            :     virtual bool hasSpecialDrag() const;
     210                 :            :     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
     211                 :            :     virtual bool applySpecialDrag(SdrDragStat& rDrag);
     212                 :            : 
     213                 :            :     virtual bool BegCreate( SdrDragStat& rStat );
     214                 :            :     virtual bool MovCreate(SdrDragStat& rStat); // #i37448#
     215                 :            :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
     216                 :            : 
     217                 :            :     virtual bool AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt = true, bool bWdt = true) const;
     218                 :            :     virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
     219                 :            :     virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
     220                 :            :     virtual bool IsAutoGrowHeight() const;
     221                 :            :     virtual bool IsAutoGrowWidth() const;
     222                 :            :     virtual void SetVerticalWriting( sal_Bool bVertical );
     223                 :            :     virtual sal_Bool BegTextEdit( SdrOutliner& rOutl );
     224                 :            :     virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
     225                 :            :     virtual void EndTextEdit( SdrOutliner& rOutl );
     226                 :            :     virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const;
     227                 :            :     virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText = false,
     228                 :            :         Rectangle* pAnchorRect=NULL, bool bLineWidth = true ) const;
     229                 :            :     virtual SdrObjCustomShape* Clone() const;
     230                 :            :     SdrObjCustomShape& operator=(const SdrObjCustomShape& rObj);
     231                 :            : 
     232                 :            :     virtual void TakeObjNameSingul(String& rName) const;
     233                 :            :     virtual void TakeObjNamePlural(String& rName) const;
     234                 :            : 
     235                 :            :     virtual basegfx::B2DPolyPolygon TakeCreatePoly( const SdrDragStat& rDrag) const;
     236                 :            : 
     237                 :            :     virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
     238                 :            :     virtual basegfx::B2DPolyPolygon TakeContour() const;
     239                 :            : 
     240                 :            :     virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
     241                 :            : 
     242                 :            :     virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
     243                 :            : 
     244                 :            :     virtual void SetPage( SdrPage* pNewPage );
     245                 :            : 
     246                 :            :     virtual SdrObjGeoData *NewGeoData() const;
     247                 :            :     virtual void          SaveGeoData(SdrObjGeoData &rGeo) const;
     248                 :            :     virtual void          RestGeoData(const SdrObjGeoData &rGeo);
     249                 :            : 
     250                 :            :     // need to take fObjectRotation instead of aGeo.nWink, replace it temporary
     251                 :            :     virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
     252                 :            :     virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
     253                 :            : 
     254                 :            :     virtual const SdrGluePointList* GetGluePointList() const;
     255                 :            :     //virtual SdrGluePointList* GetGluePointList();
     256                 :            :     virtual SdrGluePointList* ForceGluePointList();
     257                 :            : 
     258                 :            :     virtual sal_uInt32 GetHdlCount() const;
     259                 :            :     virtual SdrHdl* GetHdl( sal_uInt32 nHdlNum ) const;
     260                 :            : 
     261                 :            :     // #i33136#
     262                 :            :     static bool doConstructOrthogonal(const ::rtl::OUString& rName);
     263                 :            : 
     264                 :            :     using SdrTextObj::NbcSetOutlinerParaObject;
     265                 :            : };
     266                 :            : 
     267                 :            : #endif //_SVDOASHP_HXX
     268                 :            : 
     269                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10