Symbian3/SDK/Source/GUID-80F83F9C-2B58-5238-AE38-1193BAE72CB0.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"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: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-80F83F9C-2B58-5238-AE38-1193BAE72CB0"><title>How to use styles</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Paragraph styles are encapsulated by the <xref href="GUID-76C10266-F6E3-354F-B26C-C0207710D603.dita"><apiname>RParagraphStyleInfo</apiname></xref>, <xref href="GUID-37304E7C-A6B0-3766-B4C3-0A40EEF40018.dita"><apiname>CParagraphStyle</apiname></xref> and <xref href="GUID-BC8CFDE5-403A-3D78-AEFB-3E78775ED90A.dita"><apiname>CStyleList</apiname></xref> classes. These three classes should be used as follows:</p> <ul><li id="GUID-C7F5A392-96DD-5A0B-92F0-76CAC951997B"><p>All styles are based on the global paragraph and character format layers. A <codeph>CParagraphStyle</codeph> object should be constructed specifying these normal layers.</p> </li> <li id="GUID-A627B292-0011-5317-811B-D39B2D3B9810"><p>To set the paragraph format of a <codeph>CParagraphStyle</codeph> object, use the <codeph>SetL()</codeph> function that it inherits from its base class <xref href="GUID-C5A6B3D4-1BDE-35B4-AC6B-DF517A4D4147.dita"><apiname>CParaFormatLayer</apiname></xref>.</p> </li> <li id="GUID-A6F45D0B-4087-5C5B-BA8A-F3C17A4617E1"><p>To set the character format of a <codeph>CParagraphStyle</codeph> object, use the <xref href="GUID-37304E7C-A6B0-3766-B4C3-0A40EEF40018.dita#GUID-37304E7C-A6B0-3766-B4C3-0A40EEF40018/GUID-E47452D3-9ED7-32FA-9488-7226984F628F"><apiname>CParagraphStyle::CharFormatLayer()</apiname></xref> function, which returns a non-null pointer to the <codeph>CCharFormatLayer</codeph> object, and then call its <codeph>SetL</codeph> function.</p> </li> <li id="GUID-F03318C1-A195-5011-896D-F1FD2E531C5D"><p>Paragraph styles inherit attributes from the normal style. Attributes explicitly set in the <codeph>CParagraphStyle</codeph> object override the attributes from the normal style.</p> </li> <li id="GUID-5B75407B-E9D4-5226-BFDE-677A2C4131FA"><p>Append all user defined styles to a <codeph>CStyleList</codeph>.</p> </li> <li id="GUID-371EB753-60AA-596C-B806-064669DF6468"><p>To do this, construct an <codeph>RParagraphStyleInfo</codeph> object, specifying the <codeph>CParagraphStyle</codeph> to be appended, and optionally, a style for the following paragraph. Any number of <codeph>RParagraphStyleInfo</codeph> s can be appended to the style list.</p> </li> <li id="GUID-FB12142A-F7A8-5AEB-8ACA-2038C2DA4F5B"><p>Pass the style list to the constructor of a <xref href="GUID-39945DA4-B362-3DF6-BF9E-DD079EEA7934.dita"><apiname>CRichText</apiname></xref> object. </p> <p>In this case, the rich text object owns the style list. If the rich text object is not passed an instance of a <codeph>CStyleList</codeph> upon construction, it may still use styles, by calling <xref href="GUID-39945DA4-B362-3DF6-BF9E-DD079EEA7934.dita#GUID-39945DA4-B362-3DF6-BF9E-DD079EEA7934/GUID-C25FC00C-E229-3557-9A1A-9F0AA6A8E6B3"><apiname>CRichText::SetStyleListExternallyOwned()</apiname></xref>. However, in this case, the style list is not owned by the rich text object. It will not be deleted when that rich text object is deleted, and must be stored and restored separately from the rich text object.</p> </li> </ul> <p>Styles may be specified as usually applying to one paragraph only. For example, after a user has just typed in a heading in a word processor, they will expect the style of the following paragraph to be normal text, not another heading. This 'following style' can be set either in the constructor of <xref href="GUID-76C10266-F6E3-354F-B26C-C0207710D603.dita"><apiname>RParagraphStyleInfo</apiname></xref> or set using <xref href="GUID-BC8CFDE5-403A-3D78-AEFB-3E78775ED90A.dita#GUID-BC8CFDE5-403A-3D78-AEFB-3E78775ED90A/GUID-C2991AD8-DD5C-3C4C-B483-59089A22BD54"><apiname>CStyleList::SetStyleToFollow()</apiname></xref> after it has been appended to the style list.</p> </conbody></concept>