LCOV - code coverage report
Current view: top level - include/svx - svdoashp.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 6 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             : 
      20             : #ifndef INCLUDED_SVX_SVDOASHP_HXX
      21             : #define INCLUDED_SVX_SVDOASHP_HXX
      22             : 
      23             : #include <svx/svdobj.hxx>
      24             : #include <svx/svdotext.hxx>
      25             : #include <svx/svdhdl.hxx>
      26             : #include <vector>
      27             : #include <com/sun/star/uno/Reference.h>
      28             : #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
      29             : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      30             : #include <svx/svxdllapi.h>
      31             : 
      32             : 
      33             : //   Initial Declarations
      34             : 
      35             : 
      36             : class SdrObjList;
      37             : class SdrObjListIter;
      38             : class SfxItemSet;
      39             : 
      40             : namespace sdr
      41             : {
      42             :     namespace properties
      43             :     {
      44             :         class CustomShapeProperties;
      45             :     } // end of namespace properties
      46             : } // end of namespace sdr
      47             : 
      48           0 : class SdrAShapeObjGeoData : public SdrTextObjGeoData
      49             : {
      50             :     public:
      51             : 
      52             :     bool        bMirroredX;
      53             :     bool        bMirroredY;
      54             :     double      fObjectRotation;
      55             : 
      56             :     com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >
      57             :                 aAdjustmentSeq;
      58             : };
      59             : 
      60             : #define CUSTOMSHAPE_HANDLE_RESIZE_FIXED         1
      61             : #define CUSTOMSHAPE_HANDLE_CREATE_FIXED         2
      62             : #define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X    4
      63             : #define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y    8
      64             : #define CUSTOMSHAPE_HANDLE_MOVE_SHAPE           16
      65             : #define CUSTOMSHAPE_HANDLE_ORTHO4               32
      66             : 
      67           0 : struct SdrCustomShapeInteraction
      68             : {
      69             :     com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle >   xInteraction;
      70             :     com::sun::star::awt::Point                                                      aPosition;
      71             :     sal_Int32                                                                       nMode;
      72             : };
      73             : 
      74             : 
      75             : //   SdrObjCustomShape
      76             : 
      77             : 
      78             : class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj
      79             : {
      80             : private:
      81             :     // fObjectRotation is containing the object rotation in degrees.
      82             :     double fObjectRotation;
      83             : 
      84             : protected:
      85             :     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
      86             :     virtual void impl_setUnoShape(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& rxUnoShape) SAL_OVERRIDE;
      87             : 
      88             : public:
      89             :     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
      90             : 
      91             :     // to allow sdr::properties::CustomShapeProperties access
      92             :     friend class sdr::properties::CustomShapeProperties;
      93             : 
      94             :     com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mXRenderedCustomShape;
      95             : 
      96             :     mutable com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > mxCustomShapeEngine;
      97             : 
      98             :     // #i37011# render geometry shadow
      99             :     SdrObject*                                          mpLastShadowGeometry;
     100             : 
     101             :     com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > GetCustomShapeEngine() const;
     102             : 
     103             : //  SVX_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > >
     104             : //      SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const;
     105             : // #i47293#
     106             : //  SVX_DLLPRIVATE std::vector< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > > GetFixedInteractionHandle() const;
     107             : 
     108             :     SVX_DLLPRIVATE std::vector< SdrCustomShapeInteraction > GetInteractionHandles( const SdrObjCustomShape* pCustomShape ) const;
     109             : 
     110             :     SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
     111             : 
     112             :     SVX_DLLPRIVATE void DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const;
     113             :     SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const;
     114             : 
     115             :     // #i37011# centralize throw-away of render geometry
     116             :     void InvalidateRenderGeometry();
     117             : 
     118             :     // #i38892#
     119             :     void ImpCheckCustomGluePointsAreAdded();
     120             : 
     121             :     // returns the new text rect that corresponds to the current logic rect, the return value can be empty if nothing changed.
     122             :     Rectangle ImpCalculateTextFrame( const bool bHgt, const bool bWdt );
     123             : 
     124             : public:
     125             :     // #i37011#
     126             :     const SdrObject* GetSdrObjectFromCustomShape() const;
     127             :     const SdrObject* GetSdrObjectShadowFromCustomShape() const;
     128             :     bool GetTextBounds( Rectangle& rTextBound ) const;
     129             :     bool IsTextPath() const;
     130             :     static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const bool bBezierAllowed );
     131             : 
     132             : protected:
     133             :     // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
     134             :     // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
     135             :     // and object sizes
     136             :     virtual void AdaptTextMinSize() SAL_OVERRIDE;
     137             : 
     138             :     OUString      aName;
     139             : 
     140             : public:
     141             : 
     142             :     bool UseNoFillStyle() const;
     143             : 
     144             :     bool IsMirroredX() const;
     145             :     bool IsMirroredY() const;
     146             :     bool IsPostRotate() const;
     147             :     void SetMirroredX( const bool bMirroredX );
     148             :     void SetMirroredY( const bool bMirroredY );
     149             : 
     150             :     double GetObjectRotation() const;
     151             :     double GetExtraTextRotation( const bool bPreRotation = false ) const;
     152             : 
     153             :     TYPEINFO_OVERRIDE();
     154             :     SdrObjCustomShape();
     155             :     virtual ~SdrObjCustomShape();
     156             : 
     157             :     /* is merging default attributes from type-shype into the SdrCustomShapeGeometryItem. If pType
     158             :     is NULL then the type is being taken from the "Type" property of the SdrCustomShapeGeometryItem.
     159             :     MergeDefaultAttributes is called when creating CustomShapes via UI and after importing */
     160             :     void MergeDefaultAttributes( const OUString* pType = NULL );
     161             : 
     162             :     /* the method is checking if the geometry data is unchanged/default, in this case the data might not be stored */
     163             :     enum DefaultType
     164             :     {
     165             :         DEFAULT_PATH,
     166             :         DEFAULT_VIEWBOX,
     167             :         DEFAULT_SEGMENTS,
     168             :         DEFAULT_GLUEPOINTS,
     169             :         DEFAULT_STRETCHX,
     170             :         DEFAULT_STRETCHY,
     171             :         DEFAULT_EQUATIONS,
     172             :         DEFAULT_HANDLES,
     173             :         DEFAULT_TEXTFRAMES
     174             :     };
     175             :     bool IsDefaultGeometry( const DefaultType eDefaultType ) const;
     176             : 
     177             :     virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
     178             :     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
     179             : 
     180             :     virtual void SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
     181             : 
     182             :     virtual void RecalcSnapRect() SAL_OVERRIDE;
     183             : 
     184             :     virtual const Rectangle& GetSnapRect()  const SAL_OVERRIDE;
     185             :     virtual const Rectangle& GetCurrentBoundRect() const SAL_OVERRIDE;
     186             :     virtual const Rectangle& GetLogicRect() const SAL_OVERRIDE;
     187             : 
     188             :     virtual void Move(const Size& rSiz) SAL_OVERRIDE;
     189             :     virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE;
     190             :     virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
     191             :     virtual void SetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
     192             :     virtual void SetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
     193             : 
     194             :     virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE;
     195             :     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
     196             :     virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
     197             :     virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
     198             :     virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
     199             :     virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
     200             :     virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
     201             : 
     202             :     virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const SAL_OVERRIDE;
     203             : 
     204             :     virtual void NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr ) SAL_OVERRIDE;
     205             : 
     206             :     // special drag methods
     207             :     virtual bool hasSpecialDrag() const SAL_OVERRIDE;
     208             :     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const SAL_OVERRIDE;
     209             :     virtual bool applySpecialDrag(SdrDragStat& rDrag) SAL_OVERRIDE;
     210             : 
     211             :     virtual bool BegCreate( SdrDragStat& rStat ) SAL_OVERRIDE;
     212             :     virtual bool MovCreate(SdrDragStat& rStat) SAL_OVERRIDE; // #i37448#
     213             :     virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
     214             : 
     215             :     virtual bool AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt = true, bool bWdt = true) const SAL_OVERRIDE;
     216             :     virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true) SAL_OVERRIDE;
     217             :     virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true) SAL_OVERRIDE;
     218             :     virtual bool IsAutoGrowHeight() const SAL_OVERRIDE;
     219             :     virtual bool IsAutoGrowWidth() const SAL_OVERRIDE;
     220             :     virtual void SetVerticalWriting( bool bVertical ) SAL_OVERRIDE;
     221             :     virtual bool BegTextEdit( SdrOutliner& rOutl ) SAL_OVERRIDE;
     222             :     virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const SAL_OVERRIDE;
     223             :     virtual void EndTextEdit( SdrOutliner& rOutl ) SAL_OVERRIDE;
     224             :     virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const SAL_OVERRIDE;
     225             :     virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText = false,
     226             :         Rectangle* pAnchorRect=NULL, bool bLineWidth = true ) const SAL_OVERRIDE;
     227             :     virtual SdrObjCustomShape* Clone() const SAL_OVERRIDE;
     228             :     SdrObjCustomShape& operator=(const SdrObjCustomShape& rObj);
     229             : 
     230             :     virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
     231             :     virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
     232             : 
     233             :     virtual basegfx::B2DPolyPolygon TakeCreatePoly( const SdrDragStat& rDrag) const SAL_OVERRIDE;
     234             : 
     235             :     virtual basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
     236             :     virtual basegfx::B2DPolyPolygon TakeContour() const SAL_OVERRIDE;
     237             : 
     238             :     virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) SAL_OVERRIDE;
     239             : 
     240             :     virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
     241             : 
     242             :     virtual void SetPage( SdrPage* pNewPage ) SAL_OVERRIDE;
     243             : 
     244             :     virtual SdrObjGeoData *NewGeoData() const SAL_OVERRIDE;
     245             :     virtual void          SaveGeoData(SdrObjGeoData &rGeo) const SAL_OVERRIDE;
     246             :     virtual void          RestGeoData(const SdrObjGeoData &rGeo) SAL_OVERRIDE;
     247             : 
     248             :     // need to take fObjectRotation instead of aGeo.nWink, replace it temporary
     249             :     virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const SAL_OVERRIDE;
     250             :     virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) SAL_OVERRIDE;
     251             : 
     252             :     virtual const SdrGluePointList* GetGluePointList() const SAL_OVERRIDE;
     253             :     //virtual SdrGluePointList* GetGluePointList();
     254             :     virtual SdrGluePointList* ForceGluePointList() SAL_OVERRIDE;
     255             : 
     256             :     virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
     257             :     virtual SdrHdl* GetHdl( sal_uInt32 nHdlNum ) const SAL_OVERRIDE;
     258             : 
     259             :     // #i33136#
     260             :     static bool doConstructOrthogonal(const OUString& rName);
     261             : 
     262             :     using SdrTextObj::NbcSetOutlinerParaObject;
     263             : 
     264             :     OUString GetCustomShapeName();
     265             : };
     266             : 
     267             : #endif // INCLUDED_SVX_SVDOASHP_HXX
     268             : 
     269             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10