summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml/xmlcelli.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-08 16:34:01 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-08 19:25:37 -0400
commit40af04cea332e5311edab8d9c395299c15b7d4ec (patch)
treef957081bb02ca96217b4a1839908988a1feb53d4 /sc/source/filter/xml/xmlcelli.cxx
parent665cd87e5b594a21b4a2f578564efca7b3f653b8 (diff)
fdo#62116: Handle field objects with formats correctly.
Field objects can have formats applied to them, and when they do, they appear inside a <text:span> element. Change-Id: I7b4346389f393a4ddf708670b2c524a6594128b5
Diffstat (limited to 'sc/source/filter/xml/xmlcelli.cxx')
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx50
1 files changed, 29 insertions, 21 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index d9b5decc1a06..5f4acb9bc8fb 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -337,6 +337,26 @@ void ScXMLTableRowCellContext::PushParagraphSpan(const OUString& rSpan, const OU
sal_Int32 nEnd = nBegin + rSpan.getLength();
maParagraph.append(rSpan);
+ PushFormat(nBegin, nEnd, rStyleName);
+}
+
+void ScXMLTableRowCellContext::PushParagraphField(SvxFieldData* pData, const OUString& rStyleName)
+{
+ maFields.push_back(new Field(pData));
+ Field& rField = maFields.back();
+
+ sal_Int32 nPos = maParagraph.getLength();
+ maParagraph.append(sal_Unicode('\1')); // Placeholder text for inserted field item.
+ rField.maSelection.nStartPara = mnCurParagraph;
+ rField.maSelection.nEndPara = mnCurParagraph;
+ rField.maSelection.nStartPos = nPos;
+ rField.maSelection.nEndPos = nPos+1;
+
+ PushFormat(nPos, nPos+1, rStyleName);
+}
+
+void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString& rStyleName)
+{
if (rStyleName.isEmpty())
return;
@@ -559,38 +579,26 @@ void ScXMLTableRowCellContext::PushParagraphSpan(const OUString& rSpan, const OU
rFmt.maItemSet.Put(*pPoolItem);
}
-void ScXMLTableRowCellContext::PushParagraphField(SvxFieldData* pData)
-{
- maFields.push_back(new Field(pData));
- Field& rField = maFields.back();
-
- sal_Int32 nPos = maParagraph.getLength();
- maParagraph.append(sal_Unicode('\1')); // Placeholder text for inserted field item.
- rField.maSelection.nStartPara = mnCurParagraph;
- rField.maSelection.nEndPara = mnCurParagraph;
- rField.maSelection.nStartPos = nPos;
- rField.maSelection.nEndPos = nPos+1;
-}
-
-void ScXMLTableRowCellContext::PushParagraphFieldDate()
+void ScXMLTableRowCellContext::PushParagraphFieldDate(const OUString& rStyleName)
{
- PushParagraphField(new SvxDateField);
+ PushParagraphField(new SvxDateField, rStyleName);
}
-void ScXMLTableRowCellContext::PushParagraphFieldSheetName()
+void ScXMLTableRowCellContext::PushParagraphFieldSheetName(const OUString& rStyleName)
{
SCTAB nTab = GetScImport().GetTables().GetCurrentCellPos().Tab();
- PushParagraphField(new SvxTableField(nTab));
+ PushParagraphField(new SvxTableField(nTab), rStyleName);
}
-void ScXMLTableRowCellContext::PushParagraphFieldDocTitle()
+void ScXMLTableRowCellContext::PushParagraphFieldDocTitle(const OUString& rStyleName)
{
- PushParagraphField(new SvxFileField);
+ PushParagraphField(new SvxFileField, rStyleName);
}
-void ScXMLTableRowCellContext::PushParagraphFieldURL(const OUString& rURL, const OUString& rRep)
+void ScXMLTableRowCellContext::PushParagraphFieldURL(
+ const OUString& rURL, const OUString& rRep, const OUString& rStyleName)
{
- PushParagraphField(new SvxURLField(rURL, rRep, SVXURLFORMAT_REPR));
+ PushParagraphField(new SvxURLField(rURL, rRep, SVXURLFORMAT_REPR), rStyleName);
}
void ScXMLTableRowCellContext::PushParagraphEnd()