textrendering/word/SRC/WPTESTPICTURE.H
changeset 0 1fb32624e06b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/textrendering/word/SRC/WPTESTPICTURE.H	Tue Feb 02 02:02:46 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef __WPTESTPICTURE_H__
+#define __WPTESTPICTURE_H__
+
+#include <e32std.h>
+#include <e32base.h>
+#include <s32stor.h>
+#include <gdi.h>
+
+const TUid KUidWordTestPictureType={268435511};
+
+//
+class CWordTestPicture : public CPicture
+/**
+Very simple picture: just draws a red square. 
+CWordTest inserts one of these in the rich text in its InsertPictureL method.
+@internalComponent
+*/
+    {
+public:
+	IMPORT_C static CWordTestPicture* NewLC();
+	IMPORT_C static CWordTestPicture* NewL(const CStreamStore& aStore,TStreamId aId);
+	IMPORT_C ~CWordTestPicture();
+	//
+	IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
+	IMPORT_C void InternalizeL(RReadStream& aStream);
+	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aId);
+	//
+	IMPORT_C void GetOriginalSizeInTwips(TSize& aSize) const;
+	//
+	IMPORT_C virtual void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap=NULL)const;
+private:
+	CWordTestPicture();
+	TSize iOriginalSizeInTwips;
+/**
+iLabel is a dummy data member. The CPicture framework seems to assume that 
+all CPictures will contain data members to externalize. If we do not externalize 
+anything to the stream we're given in ExternalizeL, then the stream store 
+will abandon that stream and reuse its stream ID for the next picture. 
+CStoreMap::BindL will subsequently panic because the map contains two identical 
+stream IDs which refer to different pictures.
+So we write something to the stream, to ensure that the store generates a 
+unique ID for each picture.
+*/
+	TChar iLabel; 
+	};
+
+class TWordTestPictureFactory : public MPictureFactory
+/**
+Factory which creates CWordTestPicture objects only. 
+Used for restoring pictures when loading documents. 
+CWordDocument needs to supply one of these to the rich text object. 
+@internalComponent
+*/
+	{
+public:
+	virtual void NewPictureL(TPictureHeader& aHeader,const CStreamStore& aDeferredPictureStore) const;
+	};
+
+#endif