Help with setting properties

From: Ryan Pavlik <abiryan_at_ryand.net>
Date: Tue Jul 22 2008 - 21:41:27 CEST

Hi all! So I'm trying to replace the properties of a style in a couple
places in my GSoC code. It seems that recently I am removing the
properties from the style rather than replacing them. This happens
whether I redefine a style or "edit" one (which right now just calls
simplifyProperties). Here's the code I'm using - I call
"setAllProperties" which I added to remove duplicated code in my branch.
http://abisource.com/viewvc/abiword/branches/gsoc2008styles/src/text/ptbl/xp/pd_Style.cpp?view=markup
Start at line 388 or so.

Here's an example of what happens after I save a document after
simplifying a style (by clicking Edit in the Stylist)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE abiword PUBLIC "-//ABISOURCE//DTD AWML 1.0 Strict//EN"
"http://www.abisource.com/awml.dtd">
<abiword template="false" styles="unlocked"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:math="http://www.w3.org/1998/Math/MathML" xid-max="2"
xmlns:dc="http://purl.org/dc/elements/1.1/" fileformat="1.0"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:awml="http://www.abisource.com/awml.dtd"
xmlns="http://www.abisource.com/awml.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink" version="0.99.2"
xml:space="preserve" props="dom-dir:ltr;
document-footnote-restart-section:0; document-endnote-type:numeric;
document-endnote-place-enddoc:1; document-endnote-initial:1; lang:en-US;
document-endnote-restart-section:0; document-footnote-restart-page:0;
document-footnote-type:numeric; document-footnote-initial:1;
document-endnote-place-endsection:0">
<!--
======================================================================== -->
<!-- This file is an AbiWord
document. -->
<!-- AbiWord is a free, Open Source word
processor. -->
<!-- More information about AbiWord is available at
http://www.abisource.com/ -->
<!-- You should not edit this file by
hand. -->
<!--
======================================================================== -->

<metadata>
<m key="dc.format">application/x-abiword</m>
<m key="abiword.generator">AbiWord</m>
</metadata>
<history version="1" edit-time="39" last-saved="1216754687"
uid="c1b7bc60-5823-11dd-8a5d-f91990125da4">
<version id="1" started="1216754687"
uid="d892cc9a-5823-11dd-8a5d-f91990125da4" auto="0" top-xid="2"/>
</history>
<styles>
<s label="Normal" type="P" name="Normal" followedby="Current Settings"
props="font-family:Times New Roman; margin-top:0pt; color:000000;
margin-left:0pt; text-position:normal; widows:2; font-style:normal;
text-indent:0in; font-variant:normal; font-weight:normal;
margin-right:0pt; font-size:12pt; text-decoration:none;
margin-bottom:0pt; line-height:1.0; bgcolor:transparent;
text-align:left; font-stretch:normal"/>
<s name="Test" type="P" label="Label for Test" basedon="Normal"
followedby="Current Settings"/>
</styles>
<pagesize pagetype="Letter" orientation="portrait" width="8.500000"
height="11.000000" units="in" page-scale="1.000000"/>
<section xid="1" props="page-margin-footer:0.5in; page-margin-header:0.5in">
<p style="Normal" xid="2"><c props="font-family:Tourist Trap">test</c></p>
</section>
</abiword>

The desired result would include
<s name="Test" type="P" label="Label for Test" basedon="Normal"
followedby="Current Settings" props="font-family:Tourist Trap"/>

Thanks for any help you might be able to provide!

-- 
Ryan Pavlik
www.cleardefinition.com
#282  +  (442) -  [X]
A programmer started to cuss
Because getting to sleep was a fuss
As he lay there in bed
Looping 'round in his head
was: while(!asleep()) sheep++;
Received on Tue Jul 22 21:41:38 2008

This archive was generated by hypermail 2.1.8 : Tue Jul 22 2008 - 21:41:38 CEST