1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/texthandling/sfields/FLDBASE.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,75 @@
1.4 +/*
1.5 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include "FLDBASE.H"
1.23 +#include "FLDSTD.H"
1.24 +
1.25 +
1.26 +///////////////////////////////////////
1.27 +// CTextField
1.28 +///////////////////////////////////////
1.29 +
1.30 +
1.31 +EXPORT_C TStreamId CTextField::StoreL(CStreamStore& aStore) const
1.32 +// Assumes everything goes into the head stream.
1.33 +// (Must be replaced by concrete pictures that have components)
1.34 +/** Stores the field data to a stream store. Concrete field types with no persistent
1.35 +data should override this function to return KNullStreamId.
1.36 +
1.37 +@param aStore Stream store to which the field data is written.
1.38 +@return The ID of the stream store. */
1.39 + {
1.40 + RStoreWriteStream stream;
1.41 + TStreamId id=stream.CreateLC(aStore);
1.42 + stream<< *this; // provided by the concrete field
1.43 + stream.CommitL();
1.44 + CleanupStack::PopAndDestroy();
1.45 + return id;
1.46 + }
1.47 +
1.48 +
1.49 +EXPORT_C void CTextField::RestoreL(const CStreamStore& aStore,TStreamId aStreamId)
1.50 +// Creates a read-stream over aStore, and opens it over the specified stream ID.
1.51 +//
1.52 + /** Restores the field data from a stream store. Concrete field types with no persistent
1.53 + data should override this function to do nothing.
1.54 +
1.55 + @param aStore Stream store containing the field data to restore.
1.56 + @param aId The ID of the stream store in which the field data was previously
1.57 + stored. */
1.58 + {
1.59 + RStoreReadStream stream;
1.60 + stream.OpenLC(aStore,aStreamId);
1.61 + stream>> *this;
1.62 + CleanupStack::PopAndDestroy();
1.63 + }
1.64 +
1.65 +
1.66 +
1.67 +EXPORT_C void CTextField::ExternalizeL(RWriteStream& /*aStream*/)const
1.68 +//
1.69 + /** Externalises the field data. Called by StoreL().
1.70 +
1.71 + Calling this default implementation raises a panic. Concrete field classes
1.72 + with persistent data must provide their own implementation of this function.
1.73 + Concrete field classes with no persistent data must provide a StoreL() implementation
1.74 + that just returns KNullStreamId.
1.75 +
1.76 + @param aStream Not used. */
1.77 + {Panic(EDefaultFieldExternalizeCalled);}
1.78 +