OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Rev 132 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 83
Line 15... Line 15...
15
 
15
 
16
import org.openconcerto.openoffice.Log;
16
import org.openconcerto.openoffice.Log;
17
import org.openconcerto.openoffice.ODDocument;
17
import org.openconcerto.openoffice.ODDocument;
18
import org.openconcerto.openoffice.ODFrame;
18
import org.openconcerto.openoffice.ODFrame;
19
import org.openconcerto.openoffice.ODValueType;
19
import org.openconcerto.openoffice.ODValueType;
20
import org.openconcerto.openoffice.OOXML;
-
 
21
import org.openconcerto.openoffice.StyleDesc;
20
import org.openconcerto.openoffice.StyleDesc;
22
import org.openconcerto.openoffice.XMLVersion;
21
import org.openconcerto.openoffice.XMLVersion;
23
import org.openconcerto.openoffice.spreadsheet.BytesProducer.ByteArrayProducer;
22
import org.openconcerto.openoffice.spreadsheet.BytesProducer.ByteArrayProducer;
24
import org.openconcerto.openoffice.spreadsheet.BytesProducer.ImageProducer;
23
import org.openconcerto.openoffice.spreadsheet.BytesProducer.ImageProducer;
25
import org.openconcerto.openoffice.spreadsheet.CellStyle.StyleTableCellProperties;
24
import org.openconcerto.openoffice.spreadsheet.CellStyle.StyleTableCellProperties;
Line 172... Line 171...
172
            }
171
            }
173
            this.getElement().setAttribute(type.getValueAttribute(), type.format(val), valueNS);
172
            this.getElement().setAttribute(type.getValueAttribute(), type.format(val), valueNS);
174
        }
173
        }
175
    }
174
    }
176
 
175
 
177
    // ATTN this removes any content associated with this cell be it notes, cell anchored objects,
-
 
178
    // etc. This is because it's difficult to tell apart the text content and the rest (e.g. notes),
-
 
179
    // for example in Calc office:annotation is a child of table:cell whereas in Writer it's a child
-
 
180
    // of text:p.
-
 
181
    private void setTextP(String value) {
176
    private void setTextP(String value) {
182
        if (value == null)
177
        if (value == null) {
183
            this.getElement().removeContent();
178
            this.getElement().removeContent();
184
        else {
179
        } else {
185
            // try to reuse the first text:p to keep style
-
 
186
            final Element child = this.getElement().getChild("p", getNS().getTEXT());
-
 
187
            final Element t = child != null ? child : new Element("p", getNS().getTEXT());
-
 
188
            t.setContent(OOXML.get(this.getODDocument().getFormatVersion(), false).encodeWSasList(value));
180
            new Lines(this.getODDocument(), value).setText(getElement(), getTextValueMode());
189
 
-
 
190
            this.getElement().setContent(t);
-
 
191
        }
181
        }
192
    }
182
    }
193
 
183
 
194
    private void setValue(ODValueType type, Object value, String textP) {
184
    private void setValue(ODValueType type, Object value, String textP) {
195
        this.setValueAttributes(type, value);
185
        this.setValueAttributes(type, value);