First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #include "WPTESTPICTURE.H"
23 const TInt KWordTestPictureDimensions = 500; //width & height in twips
25 EXPORT_C void TWordTestPictureFactory::NewPictureL(
26 TPictureHeader& aHeader, const CStreamStore& aDeferredPictureStore) const
28 if (aHeader.iPictureType==KUidWordTestPictureType)
30 aHeader.iPicture=CWordTestPicture::NewL(aDeferredPictureStore,aHeader.iPicture.AsId());
34 Panic(EPictureTypeNotSupported);
38 EXPORT_C CWordTestPicture* CWordTestPicture::NewLC()
40 CWordTestPicture* p = new(ELeave) CWordTestPicture();
41 CleanupStack::PushL(p);
45 EXPORT_C CWordTestPicture* CWordTestPicture::NewL(const CStreamStore& aStore,TStreamId aId)
47 CWordTestPicture* self=new(ELeave) CWordTestPicture();
48 CleanupStack::PushL(self);
49 self->RestoreL(aStore,aId);
54 EXPORT_C CWordTestPicture::CWordTestPicture()
55 :iOriginalSizeInTwips(KWordTestPictureDimensions,KWordTestPictureDimensions)
60 EXPORT_C CWordTestPicture::~CWordTestPicture()
64 EXPORT_C void CWordTestPicture::ExternalizeL(RWriteStream& aStream)const
66 aStream.WriteUint32L(iLabel);
70 EXPORT_C void CWordTestPicture::InternalizeL(RReadStream& aStream)
72 iLabel=(TChar)aStream.ReadUint32L();
75 EXPORT_C void CWordTestPicture::RestoreL(const CStreamStore& aStore,TStreamId aStreamId)
77 RStoreReadStream stream;
78 stream.OpenLC(aStore,aStreamId);
80 CleanupStack::PopAndDestroy();
84 EXPORT_C void CWordTestPicture::Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const
88 aGc.SetClippingRect(aClipRect);
90 GetSizeInPixels(aMap,size);
93 box.iBr.iX=aTopLeft.iX+size.iWidth;
94 box.iBr.iY=aTopLeft.iY+size.iHeight;
96 aGc.SetBrushColor(red);
97 aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
101 EXPORT_C void CWordTestPicture::GetOriginalSizeInTwips(TSize& aSize)const
104 aSize=iOriginalSizeInTwips;