svgtopt/SVG/SVGImpl/inc/SVGSvgElementImpl.h
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  SVG Implementation header file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __INC_CSVGSVGELEMENT__
       
    20 #define __INC_CSVGSVGELEMENT__
       
    21 
       
    22 #include "SVGElementImpl.h"
       
    23 #include "GfxRectangle2D.h"
       
    24 #include "GfxAffineTransform.h"
       
    25 #include "SVGFitToViewBoxImpl.h"
       
    26 #include "SVGGElementImpl.h"
       
    27 #include "SVGZoomAndPan.h"
       
    28 #include "SVGTimedEntityInterface.h"
       
    29 
       
    30 
       
    31 class   CSvgViewSpec;
       
    32 class   CSvgTestAttrs;
       
    33 class   CSvgExternalResourcesRequiredAttrs;
       
    34 class   CSvgPresentationAttrs;
       
    35 class   CSvgAngle;
       
    36 class   CSvgMatrix;
       
    37 class   CSvgDocumentImpl;
       
    38 class   TGfxAffineTransform;
       
    39 class   CSvgElementImpl;
       
    40 class   MXmlDocument;
       
    41 
       
    42 
       
    43 /**
       
    44  * Class description
       
    45  */
       
    46 class CSvgSvgElementImpl : public CSvgElementImpl, public MSvgZoomAndPan
       
    47     {
       
    48     public:
       
    49 
       
    50 		CSvgSvgElementImpl();
       
    51 		/**
       
    52          * Need method description
       
    53          *
       
    54          * @since 1.0
       
    55          * @param
       
    56          * @return
       
    57          */
       
    58         static CSvgSvgElementImpl*NewL(  const TUint8 aElemID,
       
    59                                       CSvgDocumentImpl* aDoc );
       
    60 
       
    61 		/**
       
    62          * Need method description
       
    63          *
       
    64          * @since 1.0
       
    65          * @param
       
    66          * @return
       
    67          */
       
    68         static CSvgSvgElementImpl*NewLC(  const TUint8 aElemID,
       
    69                                        CSvgDocumentImpl* aDoc );
       
    70 
       
    71 	private:
       
    72 		/**
       
    73          * Need method description
       
    74          *
       
    75          * @since 1.0
       
    76          * @param
       
    77          * @return
       
    78          */
       
    79         void                            ConstructL(  const TUint8 aElemID  );
       
    80 
       
    81 
       
    82 	public:
       
    83 
       
    84 
       
    85         /**
       
    86          * Destructor
       
    87          */
       
    88         virtual                     ~CSvgSvgElementImpl();
       
    89 
       
    90 
       
    91         // From SVG DOM
       
    92 
       
    93         /**
       
    94          * Need method description
       
    95          *
       
    96          * @since 1.0
       
    97          * @param
       
    98          * @return
       
    99          */
       
   100         TFloatFixPt                      X();
       
   101 
       
   102 
       
   103         /**
       
   104          * Need method description
       
   105          *
       
   106          * @since 1.0
       
   107          * @param
       
   108          * @return
       
   109          */
       
   110         TFloatFixPt                      Y();
       
   111 
       
   112 
       
   113         /**
       
   114          * Need method description
       
   115          *
       
   116          * @since 1.0
       
   117          * @param
       
   118          * @return
       
   119          */
       
   120         TFloatFixPt                      Width();
       
   121 
       
   122 
       
   123         /**
       
   124          * Need method description
       
   125          *
       
   126          * @since 1.0
       
   127          * @param
       
   128          * @return
       
   129          */
       
   130         TFloatFixPt                      Height();
       
   131 
       
   132         /**
       
   133          * Accessor funciton for SyncBehaviorDefault value
       
   134          *
       
   135          * @since S60 3.2
       
   136          * @param none
       
   137          * @return TSvgSyncBehavior indicating default value.
       
   138          */
       
   139         TSvgSyncBehaviour                SyncBehaviorDefault();
       
   140 
       
   141         /**
       
   142          * Accessor funciton for SyncToleranceDefault value
       
   143          *
       
   144          * @since S60 3.2
       
   145          * @param none
       
   146          * @return TUint32 indicating default value in msecs.
       
   147          */
       
   148         TUint32        SyncToleranceDefault();
       
   149 
       
   150         
       
   151         /**
       
   152          * Need method description
       
   153          *
       
   154          * @since 1.0
       
   155          * @param
       
   156          * @return
       
   157          */
       
   158         MXmlElement*                GetElementById( const TDesC& aElementId );
       
   159         
       
   160 		TInt SetAttributeDesL( const TInt aNameId, TDesC& aValue );
       
   161 		
       
   162 		TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
       
   163 
       
   164 
       
   165         // SVG Implementation
       
   166 
       
   167         /**
       
   168          * Need method description
       
   169          *
       
   170          * @since 1.0
       
   171          * @param
       
   172          * @return
       
   173          */
       
   174         void                        SetWidth( TFloatFixPt aWidth );
       
   175 
       
   176 
       
   177         /**
       
   178          * Need method description
       
   179          *
       
   180          * @since 1.0
       
   181          * @param
       
   182          * @return
       
   183          */
       
   184         void                        SetHeight( TFloatFixPt aHeight );
       
   185 
       
   186 
       
   187 
       
   188 
       
   189         // From MXmlElement API
       
   190 
       
   191 
       
   192         /**
       
   193          * get attribute of CSvgSvgElementImpl
       
   194          */
       
   195         IMPORT_C TInt               GetAttribute( const TDesC& aName,
       
   196                                                   TDes& aValue );
       
   197 
       
   198 
       
   199         /**
       
   200          * set attribute
       
   201          */
       
   202         TInt                        SetAttributeL( const TDesC& aName,
       
   203                                                    const TDesC& aValue );
       
   204 
       
   205         // From MXmlElementOpt API
       
   206 
       
   207         /**
       
   208          * Need method description
       
   209          *
       
   210          * @since 1.0
       
   211          * @param
       
   212          * @return
       
   213          */
       
   214         TInt                        GetAttributeFloat( const TInt aNameId,
       
   215                                                        TFloatFixPt& aValue );
       
   216 
       
   217         /**
       
   218          * Need method description
       
   219          *
       
   220          * @since 1.0
       
   221          * @param
       
   222          * @return
       
   223          */
       
   224         TInt                        SetAttributeFloatL( const TInt aNameId,
       
   225                                                         const TFloatFixPt aValue );
       
   226 
       
   227 
       
   228         // From CSvgElementImpl
       
   229 
       
   230         /**
       
   231          * Need method description
       
   232          *
       
   233          * @since 1.0
       
   234          * @param
       
   235          * @return
       
   236          */
       
   237         MXmlElement*        CloneL(MXmlElement* aParentElement);
       
   238 
       
   239 
       
   240         /**
       
   241          * Need method description
       
   242          *
       
   243          * @since 1.0
       
   244          * @param
       
   245          * @return
       
   246          */
       
   247         TBool                       DrawL( CGfx2dGc* aGc,
       
   248                                            CSvgElementImpl* aElement );
       
   249 
       
   250 
       
   251         /**
       
   252          * Need method description
       
   253          *
       
   254          * @since 1.0
       
   255          * @param
       
   256          * @return
       
   257          */
       
   258         void                        GetBBox( TGfxRectangle2D& aBbox );
       
   259 
       
   260         /**
       
   261          * Need method description
       
   262          *
       
   263          * @since 1.0
       
   264          * @param
       
   265          * @return
       
   266          */
       
   267         virtual void                GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
       
   268 
       
   269         // From MSvgZoomAndPan
       
   270 
       
   271 
       
   272         /**
       
   273          * Need method description
       
   274          *
       
   275          * @since 1.0
       
   276          * @param
       
   277          * @return
       
   278          */
       
   279         TSvgZoomAndPanType          GetZoomAndPan();
       
   280 
       
   281 
       
   282         /**
       
   283          * Need method description
       
   284          *
       
   285          * @since 1.0
       
   286          * @param
       
   287          * @return
       
   288          */
       
   289         void                        SetZoomAndPan( TSvgZoomAndPanType aZoomAndPan );
       
   290 
       
   291         // From MSvgFitToViewBox
       
   292 
       
   293 
       
   294         /**
       
   295          * Need method description
       
   296          *
       
   297          * @since 1.0
       
   298          * @param
       
   299          * @return
       
   300          */
       
   301         void                        GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aAspectRatio );
       
   302 
       
   303         /**
       
   304          * Need method description
       
   305          *
       
   306          * @since 1.0
       
   307          * @param
       
   308          * @return
       
   309          */
       
   310         void                        SetPreserveAspectRatioL ( TSvgPreserveAspectAlignType aAlign,
       
   311                                                                  TSvgMeetOrSliceType aMeetslice );
       
   312 
       
   313 
       
   314         /**
       
   315          * Need method description
       
   316          *
       
   317          * @since 1.0
       
   318          * @param
       
   319          * @return
       
   320          */
       
   321         TBool                       GetViewBox( TGfxRectangle2D& aViewBox );
       
   322 
       
   323         /**
       
   324          * Need method description
       
   325          *
       
   326          * @since 1.0
       
   327          * @param
       
   328          * @return
       
   329          */
       
   330         void                       SetViewBoxL( TGfxRectangle2D aViewBox );
       
   331 
       
   332 
       
   333         /**
       
   334          * Need method description
       
   335          *
       
   336          * @since 1.0
       
   337          * @param
       
   338          * @return
       
   339          */
       
   340         TBool                       ViewBoxDefined();
       
   341 
       
   342         // From CSvgFitToViewBoxImpl
       
   343 
       
   344 
       
   345         /**
       
   346          * Need method description
       
   347          *
       
   348          * @since 1.0
       
   349          * @param
       
   350          * @return
       
   351          */
       
   352         void                        SetWindowViewportTrans( TGfxRectangle2D aXYWH,
       
   353                                                                                 TGfxAffineTransform& aTr );
       
   354 
       
   355 
       
   356 	
       
   357         // For Baseprofile
       
   358 
       
   359         /**
       
   360          * Need method description
       
   361          *
       
   362          * @since 1.0
       
   363          * @param
       
   364          * @return
       
   365          */
       
   366         const TDesC&                BaseProfile();
       
   367         // For Version
       
   368 
       
   369         /**
       
   370          * Need method description
       
   371          *
       
   372          * @since 1.0
       
   373          * @param
       
   374          * @return
       
   375          */
       
   376         const TDesC&                Version();
       
   377 
       
   378 
       
   379 
       
   380          /**
       
   381          * Constructor
       
   382          */
       
   383                                     CSvgSvgElementImpl( CSvgDocumentImpl* aDoc );
       
   384 
       
   385 		  /**
       
   386          * set base profile
       
   387          */
       
   388         void                        SetBaseProfileL( const TDesC& aValue );
       
   389 
       
   390 
       
   391         /**
       
   392          * set version
       
   393          */
       
   394         void                        SetVersion( const TDesC& aValue );
       
   395 
       
   396         /**
       
   397          * set synchronised behaviour default
       
   398          * @since S60 3.2
       
   399          * @param aValue canSlip | independent | locked | inherit
       
   400          * @return
       
   401          */
       
   402         void                        SetSyncBehaviorDefault( const 
       
   403             TDesC& aValue );
       
   404         
       
   405         /**
       
   406         * set synchronised tolerance default
       
   407         * @since S60 3.2
       
   408         * @param aValue Clock-value | "inherit"
       
   409         * @return none.
       
   410         */
       
   411         void                        SetSyncToleranceDefault( const 
       
   412             TDesC& aValue );
       
   413 
       
   414         /**
       
   415          * set synchronised behaviour default
       
   416          * @since S60 3.2
       
   417          * @param aValue canSlip | independent | locked | inherit
       
   418          * @return
       
   419          */
       
   420         void                        SetSyncBehaviorDefault( const 
       
   421             TSvgSyncBehaviour aValue );
       
   422         
       
   423         /**
       
   424         * set synchronised tolerance default
       
   425         * @since S60 3.2
       
   426         * @param aValue Clock-value 
       
   427         *        aInheritValue true/false, should tolerance default 
       
   428         * @return none.
       
   429         */
       
   430         void                        SetSyncToleranceDefault( const 
       
   431             TInt32 aValue, TBool aInheritValue = EFalse );
       
   432 
       
   433 		void 						Print( TBool aIsEncodeOn );
       
   434 
       
   435    
       
   436       
       
   437     private:
       
   438         TSvgZoomAndPanType          iZoomAndPan;
       
   439 
       
   440         TFloatFixPt                      iX;
       
   441         TFloatFixPt                      iY;
       
   442         TFloatFixPt                      iWidth;
       
   443         TFloatFixPt                      iHeight;
       
   444 
       
   445         CSvgFitToViewBoxImpl*       iViewBoxImpl;
       
   446 
       
   447         HBufC*                      iVersion;
       
   448 
       
   449         HBufC*                      iBaseProfile;
       
   450         
       
   451         // Default run time sync behaviour 
       
   452         TSvgSyncBehaviour           iSyncBehaviorDefault;
       
   453         
       
   454         // Default synchronised tolerance value in msecs
       
   455         TUint32                     iSyncToleranceDefault;
       
   456         
       
   457 	public:
       
   458 		// to support "%" for svg element in case of multiple
       
   459 		// render buffers of different sizes
       
   460 		TReal32						iWidthInUserCoordinate;
       
   461 		TReal32						iHeightInUserCoordinate;
       
   462 		TBool                       iWidthInPercentage;
       
   463 		TBool                       iHeightInPercentage;
       
   464 		
       
   465 		TBool                        iIsWidthSet;
       
   466 		TBool                        iIsHeightSet;
       
   467 		HBufC*                     iContent;
       
   468     };
       
   469 
       
   470 
       
   471 #endif /* __INC_CSVGSVGELEMENT__ */