diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-09 02:16:27 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-11 22:33:34 -0500 |
commit | e4f956a39dd104da8ff04c5a87082a03204cf316 (patch) | |
tree | 134b298dcd92a8d7eca1856a9ef766c469a5a924 /sc | |
parent | 7b42be6cf4f6888ed23285e1c9f2b9c7deb261c3 (diff) |
Import all possible text format properties.
Change-Id: I4bbe93450d16a26e9b882041e0d21cf1c4140253
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/editattributemap.cxx | 60 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 175 |
2 files changed, 211 insertions, 24 deletions
diff --git a/sc/source/filter/xml/editattributemap.cxx b/sc/source/filter/xml/editattributemap.cxx index 3580cc026e37..174f5080d8f1 100644 --- a/sc/source/filter/xml/editattributemap.cxx +++ b/sc/source/filter/xml/editattributemap.cxx @@ -16,19 +16,57 @@ namespace { struct { const char* mpXMLName; + const char* mpAPIName; sal_uInt16 mnItemID; sal_uInt8 mnFlag; + } Entries[] = { - { "color", EE_CHAR_COLOR, 0 }, - { "font-weight", EE_CHAR_WEIGHT, MID_WEIGHT }, - { "font-weight-asian", EE_CHAR_WEIGHT_CJK, MID_WEIGHT }, - { "font-weight-complex", EE_CHAR_WEIGHT_CTL, MID_WEIGHT }, - { "font-size", EE_CHAR_FONTHEIGHT, MID_FONTHEIGHT }, - { "font-size-asian", EE_CHAR_FONTHEIGHT_CJK, MID_FONTHEIGHT }, - { "font-size-complex", EE_CHAR_FONTHEIGHT_CTL, MID_FONTHEIGHT }, - { "font-style", EE_CHAR_ITALIC, MID_POSTURE }, - { "font-style-asian", EE_CHAR_ITALIC_CJK, MID_POSTURE }, - { "font-style-complex", EE_CHAR_ITALIC_CTL, MID_POSTURE }, + + { "color", "CharColor", EE_CHAR_COLOR, 0 }, + { "font-charset", "CharFontCharSet", EE_CHAR_FONTINFO, MID_FONT_CHAR_SET }, + { "font-charset-asian", "CharFontCharSetAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_CHAR_SET }, + { "font-charset-complex", "CharFontCharSetComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_CHAR_SET }, + { "font-family", "CharFontName", EE_CHAR_FONTINFO, MID_FONT_FAMILY_NAME }, + { "font-family-asian", "CharFontNameAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_FAMILY_NAME }, + { "font-family-complex", "CharFontNameAsian", EE_CHAR_FONTINFO_CTL, MID_FONT_FAMILY_NAME }, + { "font-family-generic", "CharFontFamily", EE_CHAR_FONTINFO, MID_FONT_FAMILY }, + { "font-family-generic-asian", "CharFontFamilyAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_FAMILY }, + { "font-family-generic-complex", "CharFontFamilyComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_FAMILY }, + { "font-pitch", "CharFontPitch", EE_CHAR_FONTINFO, MID_FONT_PITCH }, + { "font-pitch-asian", "CharFontPitchAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_PITCH }, + { "font-pitch-complex", "CharFontPitchComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_PITCH }, + { "font-size", "CharHeight", EE_CHAR_FONTHEIGHT, MID_FONTHEIGHT }, + { "font-size-asian", "CharHeightAsian", EE_CHAR_FONTHEIGHT_CJK, MID_FONTHEIGHT }, + { "font-size-complex", "CharHeightComplex", EE_CHAR_FONTHEIGHT_CTL, MID_FONTHEIGHT }, + { "font-style", "CharPosture", EE_CHAR_ITALIC, MID_POSTURE }, + { "font-style-asian", "CharPostureAsian", EE_CHAR_ITALIC_CJK, MID_POSTURE }, + { "font-style-complex", "CharPostureComplex", EE_CHAR_ITALIC_CTL, MID_POSTURE }, + { "font-style-name", "CharFontStyleName", EE_CHAR_FONTINFO, MID_FONT_STYLE_NAME }, + { "font-style-name-asian", "CharFontStyleNameAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_STYLE_NAME }, + { "font-style-name-complex", "CharFontStyleNameComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_STYLE_NAME }, + { "font-weight", "CharWeight", EE_CHAR_WEIGHT, MID_WEIGHT }, + { "font-weight-asian", "CharWeightAsian", EE_CHAR_WEIGHT_CJK, MID_WEIGHT }, + { "font-weight-complex", "CharWeightComplex", EE_CHAR_WEIGHT_CTL, MID_WEIGHT }, + { "text-overline-width", "CharOverline", EE_CHAR_OVERLINE, MID_TL_STYLE }, + { "text-overline-color", "CharOverlineColor", EE_CHAR_OVERLINE, MID_TL_COLOR }, + { "text-overline-color", "CharOverlineHasColor", EE_CHAR_OVERLINE, MID_TL_HASCOLOR }, + { "text-underline-width", "CharUnderline", EE_CHAR_UNDERLINE, MID_TL_STYLE }, + { "text-underline-color", "CharUnderlineColor", EE_CHAR_UNDERLINE, MID_TL_COLOR }, + { "text-underline-color", "CharUnderlineHasColor", EE_CHAR_UNDERLINE, MID_TL_HASCOLOR }, + { "text-line-through-mode", "CharWordMode", EE_CHAR_WLM, 0 }, + { "text-line-through-type", "CharStrikeout", EE_CHAR_STRIKEOUT, MID_CROSS_OUT }, + { "font-relief", "CharRelief", EE_CHAR_RELIEF, MID_RELIEF }, + { "text-outline", "CharContoured", EE_CHAR_OUTLINE, 0 }, + { "text-shadow", "CharShadowed", EE_CHAR_SHADOW, 0 }, + { "letter-spacing", "CharKerning", EE_CHAR_KERNING, 0 }, + { "letter-kerning", "CharAutoKerning", EE_CHAR_PAIRKERNING, 0 }, + { "text-scale", "CharScaleWidth", EE_CHAR_FONTWIDTH, 0 }, + { "text-position", "CharEscapement", EE_CHAR_ESCAPEMENT, MID_ESC }, + { "text-position", "CharEscapementHeight", EE_CHAR_ESCAPEMENT, MID_ESC_HEIGHT }, + { "text-emphasize", "CharEmphasis", EE_CHAR_EMPHASISMARK, MID_EMPHASIS }, + { "country", "CharLocale", EE_CHAR_LANGUAGE, MID_LANG_LOCALE }, + { "country-asian", "CharLocaleAsian", EE_CHAR_LANGUAGE_CJK, MID_LANG_LOCALE }, + { "country-complex", "CharLocaleComplex", EE_CHAR_LANGUAGE_CTL, MID_LANG_LOCALE }, }; } @@ -43,7 +81,7 @@ ScXMLEditAttributeMap::ScXMLEditAttributeMap() { maEntries.insert( EntriesType::value_type( - OUString::createFromAscii(Entries[i].mpXMLName), + OUString::createFromAscii(Entries[i].mpAPIName), Entry(Entries[i].mnItemID, Entries[i].mnFlag))); } } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index cba7fdbba703..72de86c54f11 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -65,6 +65,19 @@ #include "editeng/colritem.hxx" #include "editeng/fhgtitem.hxx" #include "editeng/postitem.hxx" +#include "editeng/fontitem.hxx" +#include "editeng/udlnitem.hxx" +#include "editeng/wrlmitem.hxx" +#include "editeng/crsditem.hxx" +#include "editeng/charreliefitem.hxx" +#include "editeng/charscaleitem.hxx" +#include "editeng/cntritem.hxx" +#include "editeng/shdditem.hxx" +#include "editeng/kernitem.hxx" +#include "editeng/akrnitem.hxx" +#include "editeng/escpitem.hxx" +#include "editeng/emphitem.hxx" +#include "editeng/langitem.hxx" #include <svx/unoapi.hxx> #include <svl/languageoptions.hxx> #include <sax/tools/converter.hxx> @@ -348,57 +361,193 @@ void ScXMLTableRowCellContext::PushParagraphSpan(const OUString& rSpan, const OU rFmt.maSelection.nStartPos = nBegin; rFmt.maSelection.nEndPos = nEnd; + boost::scoped_ptr<SfxPoolItem> pPoolItem; + sal_uInt16 nLastItemID = EE_CHAR_END + 1; + std::vector<XMLPropertyState>::const_iterator it = rProps.begin(), itEnd = rProps.end(); for (; it != itEnd; ++it) { if (it->mnIndex == -1 || it->mnIndex >= nEntryCount) continue; - const OUString& rName = xMapper->GetEntryXMLName(it->mnIndex); + const OUString& rName = xMapper->GetEntryAPIName(it->mnIndex); const ScXMLEditAttributeMap::Entry* pEntry = rEditAttrMap.getEntry(rName); if (!pEntry) continue; + if (nLastItemID != pEntry->mnItemID && pPoolItem) + { + // Flush the last item when the item ID changes. + rFmt.maItemSet.Put(*pPoolItem); + pPoolItem.reset(); + } + switch (pEntry->mnItemID) { + case EE_CHAR_FONTINFO: + case EE_CHAR_FONTINFO_CJK: + case EE_CHAR_FONTINFO_CTL: + { + // Font properties need to be consolidated into a single item. + if (!pPoolItem) + pPoolItem.reset(new SvxFontItem(pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; case EE_CHAR_WEIGHT: case EE_CHAR_WEIGHT_CJK: case EE_CHAR_WEIGHT_CTL: { - SvxWeightItem aItem(WEIGHT_NORMAL, pEntry->mnItemID); - aItem.PutValue(it->maValue, pEntry->mnFlag); - rFmt.maItemSet.Put(aItem); + if (!pPoolItem) + pPoolItem.reset(new SvxWeightItem(WEIGHT_NORMAL, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); } break; case EE_CHAR_FONTHEIGHT: case EE_CHAR_FONTHEIGHT_CJK: case EE_CHAR_FONTHEIGHT_CTL: { - SvxFontHeightItem aItem(240, 100, pEntry->mnItemID); - aItem.PutValue(it->maValue, pEntry->mnFlag); - rFmt.maItemSet.Put(aItem); + if (!pPoolItem) + pPoolItem.reset(new SvxFontHeightItem(240, 100, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); } break; case EE_CHAR_ITALIC: case EE_CHAR_ITALIC_CJK: case EE_CHAR_ITALIC_CTL: { - SvxPostureItem aItem(ITALIC_NONE, pEntry->mnItemID); - aItem.PutValue(it->maValue, pEntry->mnFlag); - rFmt.maItemSet.Put(aItem); + if (!pPoolItem) + pPoolItem.reset(new SvxPostureItem(ITALIC_NONE, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_UNDERLINE: + { + if (!pPoolItem) + pPoolItem.reset(new SvxUnderlineItem(UNDERLINE_NONE, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_OVERLINE: + { + if (!pPoolItem) + pPoolItem.reset(new SvxOverlineItem(UNDERLINE_NONE, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); } break; case EE_CHAR_COLOR: { - SvxColorItem aItem(pEntry->mnItemID); - aItem.PutValue(it->maValue, pEntry->mnFlag); - rFmt.maItemSet.Put(aItem); + if (!pPoolItem) + pPoolItem.reset(new SvxColorItem(pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_WLM: + { + if (!pPoolItem) + pPoolItem.reset(new SvxWordLineModeItem(false, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_STRIKEOUT: + { + if (!pPoolItem) + pPoolItem.reset(new SvxCrossedOutItem(STRIKEOUT_NONE, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_RELIEF: + { + if (!pPoolItem) + pPoolItem.reset(new SvxCharReliefItem(RELIEF_NONE, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_OUTLINE: + { + if (!pPoolItem) + pPoolItem.reset(new SvxContourItem(false, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_SHADOW: + { + if (!pPoolItem) + pPoolItem.reset(new SvxShadowedItem(false, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_KERNING: + { + if (!pPoolItem) + pPoolItem.reset(new SvxKerningItem(0, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_PAIRKERNING: + { + if (!pPoolItem) + pPoolItem.reset(new SvxAutoKernItem(false, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_FONTWIDTH: + { + if (!pPoolItem) + pPoolItem.reset(new SvxCharScaleWidthItem(100, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_ESCAPEMENT: + { + if (!pPoolItem) + pPoolItem.reset(new SvxEscapementItem(pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_EMPHASISMARK: + { + if (!pPoolItem) + pPoolItem.reset(new SvxEmphasisMarkItem(EMPHASISMARK_NONE, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); + } + break; + case EE_CHAR_LANGUAGE: + case EE_CHAR_LANGUAGE_CJK: + case EE_CHAR_LANGUAGE_CTL: + { + if (!pPoolItem) + pPoolItem.reset(new SvxLanguageItem(LANGUAGE_DONTKNOW, pEntry->mnItemID)); + + pPoolItem->PutValue(it->maValue, pEntry->mnFlag); } break; default: ; } + + nLastItemID = pEntry->mnItemID; } + + if (pPoolItem) + rFmt.maItemSet.Put(*pPoolItem); } void ScXMLTableRowCellContext::PushParagraphEnd() |