os/textandloc/textrendering/word/SRC/WPDOC.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 1997-2009 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: 
    15 *
    16 */
    17 
    18 
    19 #ifndef __WPDOC_H__
    20 #define __WPDOC_H__
    21 
    22 #include <gdi.h>
    23 #include <fldbltin.h>
    24 #include <txtmrtsr.h>
    25 #include <eikdoc.h>
    26 #include <eikapp.h>
    27 #include "WNGMODEL.H"	// only #included for Model() inline
    28 #include <e32base.h>
    29 
    30 #include "WPTESTPICTURE.H"
    31 
    32 /**
    33 @internalComponent
    34 */
    35 #if !defined KUidWordAppValue
    36 #ifdef _UNICODE
    37 #define KUidWordAppValue KUidWordAppValue16
    38 #else
    39 #define KUidWordAppValue KUidWordAppValue8
    40 #endif
    41 #endif
    42 
    43 /**
    44 @internalComponent
    45 */
    46 const TUid KUidWordAppValue8={0x1000007F};
    47 const TUid KUidWordAppValue16={0x10003A64};
    48 
    49 class CFileStore;
    50 class CWordAppUi;
    51 class TWordUiData;
    52 
    53 class CWordDocument : public CEikDocument, public MRichTextStoreResolver, public MFieldFileNameInfo, public MFieldNumPagesInfo
    54 /**
    55 @internalComponent
    56 */
    57 	{
    58 public:
    59 	static CWordDocument* NewL(CEikApplication& aApp);
    60 	~CWordDocument();
    61 	//
    62 	// CApaDocument implementation
    63 	virtual void StoreL(CStreamStore& aStore,CStreamDictionary& aStreamDic) const;
    64 	virtual void RestoreL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
    65 	virtual void DetachFromStoreL(CPicture::TDetach aDegree);
    66 	void StoreUiDataL(CStreamStore& aStore,CStreamDictionary& aStreamDic)const;
    67 	void RestoreUiDataL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic);
    68 	virtual void NewDocumentL();
    69 	//
    70 	virtual const CStreamStore& StreamStoreL(TInt aPos)const;  // MRichTextStoreResolver
    71 	virtual TInt UpdateFieldFileName(TPtr& aValueText)const;  // MFieldFileNameInfo
    72 	virtual TInt UpdateFieldNumPages()const;  // MFieldNumPagesInfo
    73 	//
    74 	// File
    75 	void DoFileNewL(const TFileName& aFileName, const TFileName& aTemplateFileName);
    76 	void DoFileOpenL(const TFileName& aFileName,TUint aFileMode=EFileWrite);
    77 	void GetFileOpenModeL(TUint& aFileMode,const TDesC& aFilename,RFs& aSession);
    78 	void DoFileSaveToCurrentL();
    79 	void DoFileSaveToNewL(const TFileName& aFileName);
    80 	void DoFileSaveToNewNoSwitchL(const TFileName& aNewFileName);
    81 	void DoFileRevertL();
    82 	//
    83 	// Handles
    84 	inline TWordUiData& UiData();
    85 	inline CWordModel* Model()const;
    86 	inline CWordAppUi& WordAppUi();
    87 	inline const CWordAppUi& WordAppUi()const;
    88 	inline CTextPageRegionPrinter& PageRegionPrinter()const;
    89 	//
    90 	// Utilities
    91 	inline TBool FileNameExists(const TFileName& aFileName) const;
    92 private:
    93 	enum TKeepStoreOpen
    94 		{
    95 		EKeepFalse,
    96 		EKeepTrue
    97 		};
    98 private:
    99 	inline CWordDocument(CEikApplication& aApp);
   100 	void ConstructL();
   101 	void CreateModelL();
   102 	void ConstructPrintL();
   103 	void LocateTemplateL(const TDes& aFullFileName)const;
   104 	void VerifyDocumentTypeL(const TFileName& aFileName)const;
   105 	CFileStore* DoNewDocumentL(const TDesC& aStandardDocument,TKeepStoreOpen aKeepStoreOpen=EKeepFalse);
   106 	void SetMainStoreAndMainDocFileName(CFileStore* aMainStore,const TDesC& aMainDocFileName);
   107 	//
   108 	// CApaDocument implementation
   109 	CEikAppUi* CreateAppUiL();
   110 private:
   111 	CWordModel* iModel;
   112 	CTextPageRegionPrinter* iPrint;
   113 	TWordUiData* iUiData;
   114 	TBool iNewDocument;
   115 	TWordTestPictureFactory iPictureFactory;
   116 	};
   117 
   118 
   119 #include "WPDOC.INL"
   120 
   121 
   122 #endif