[Libreoffice-commits] core.git: include/xmloff sc/source xmloff/source

Kohei Yoshida kohei.yoshida at gmail.com
Wed Aug 21 16:20:27 PDT 2013


 include/xmloff/txtparae.hxx               |   10 -
 sc/source/filter/xml/editattributemap.cxx |  124 +++++++-------
 sc/source/filter/xml/editattributemap.hxx |   14 +
 sc/source/filter/xml/xmlcelli.cxx         |    2 
 sc/source/filter/xml/xmlexprt.cxx         |  251 ++++++++++++++++++++++++++----
 sc/source/filter/xml/xmlexprt.hxx         |    7 
 xmloff/source/style/xmlexppr.cxx          |    2 
 7 files changed, 306 insertions(+), 104 deletions(-)

New commits:
commit 21661ebfbec9ea162582bbc7ab46607eb9095f1a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Aug 21 19:16:23 2013 -0400

    fdo#60740: Populate auto styles from edit cells without using UNO API.
    
    Not using UNO API here alone made this code fly.
    
    Change-Id: Ib3eff168bbe49e49fb413909b7a14057f808cdf9

diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index df7ce28..31bff86 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -196,9 +196,10 @@ protected:
 
     SinglePropertySetInfoCache aCharStyleNamesPropInfoCache;
 
-//  SvXMLExport& GetExport() { return rExport; }
-//  const SvXMLExport& GetExport() const  { return rExport; }
+    SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; }
+    const SvXMLAutoStylePoolP& GetAutoStylePool() const { return rAutoStylePool; }
 
+public:
     UniReference < SvXMLExportPropertyMapper > GetParaPropMapper() const
     {
         return xParaPropMapper;
@@ -226,11 +227,6 @@ protected:
         return xRubyPropMapper;
     }
 
-
-    SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; }
-    const SvXMLAutoStylePoolP& GetAutoStylePool() const { return rAutoStylePool; }
-
-public:
     OUString FindTextStyleAndHyperlink(
             const ::com::sun::star::uno::Reference <
                 ::com::sun::star::beans::XPropertySet > & rPropSet,
diff --git a/sc/source/filter/xml/editattributemap.cxx b/sc/source/filter/xml/editattributemap.cxx
index 3c9c889..decea89 100644
--- a/sc/source/filter/xml/editattributemap.cxx
+++ b/sc/source/filter/xml/editattributemap.cxx
@@ -11,81 +11,81 @@
 
 #include "editeng/eeitem.hxx"
 #include "editeng/memberids.hrc"
+#include "xmloff/xmlnmspe.hxx"
 
-static struct {
-    const char* mpXMLName;
-    const char* mpAPIName;
-    sal_uInt16 mnItemID;
-    sal_uInt8 mnFlag;
+ScXMLEditAttributeMap::Entry aEntries[] = {
 
-} aEntries[] = {
-
-    { "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 },
+    { XML_NAMESPACE_FO, "color", "CharColor", EE_CHAR_COLOR, 0 },
+    { XML_NAMESPACE_STYLE, "font-charset", "CharFontCharSet", EE_CHAR_FONTINFO, MID_FONT_CHAR_SET },
+    { XML_NAMESPACE_STYLE, "font-charset-asian", "CharFontCharSetAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_CHAR_SET },
+    { XML_NAMESPACE_STYLE, "font-charset-complex", "CharFontCharSetComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_CHAR_SET },
+    { XML_NAMESPACE_FO, "font-family", "CharFontName", EE_CHAR_FONTINFO, MID_FONT_FAMILY_NAME },
+    { XML_NAMESPACE_STYLE, "font-family-asian", "CharFontNameAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_FAMILY_NAME },
+    { XML_NAMESPACE_STYLE, "font-family-complex", "CharFontNameAsian", EE_CHAR_FONTINFO_CTL, MID_FONT_FAMILY_NAME },
+    { XML_NAMESPACE_STYLE, "font-family-generic", "CharFontFamily", EE_CHAR_FONTINFO, MID_FONT_FAMILY },
+    { XML_NAMESPACE_STYLE, "font-family-generic-asian", "CharFontFamilyAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_FAMILY },
+    { XML_NAMESPACE_STYLE, "font-family-generic-complex", "CharFontFamilyComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_FAMILY },
+    { XML_NAMESPACE_STYLE, "font-pitch", "CharFontPitch", EE_CHAR_FONTINFO, MID_FONT_PITCH },
+    { XML_NAMESPACE_STYLE, "font-pitch-asian", "CharFontPitchAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_PITCH },
+    { XML_NAMESPACE_STYLE, "font-pitch-complex", "CharFontPitchComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_PITCH },
+    { XML_NAMESPACE_FO, "font-size", "CharHeight", EE_CHAR_FONTHEIGHT, MID_FONTHEIGHT },
+    { XML_NAMESPACE_STYLE, "font-size-asian", "CharHeightAsian", EE_CHAR_FONTHEIGHT_CJK, MID_FONTHEIGHT },
+    { XML_NAMESPACE_STYLE, "font-size-complex", "CharHeightComplex", EE_CHAR_FONTHEIGHT_CTL, MID_FONTHEIGHT },
+    { XML_NAMESPACE_FO, "font-style", "CharPosture", EE_CHAR_ITALIC, MID_POSTURE },
+    { XML_NAMESPACE_STYLE, "font-style-asian", "CharPostureAsian", EE_CHAR_ITALIC_CJK, MID_POSTURE },
+    { XML_NAMESPACE_STYLE, "font-style-complex", "CharPostureComplex", EE_CHAR_ITALIC_CTL, MID_POSTURE },
+    { XML_NAMESPACE_STYLE, "font-style-name", "CharFontStyleName", EE_CHAR_FONTINFO, MID_FONT_STYLE_NAME },
+    { XML_NAMESPACE_STYLE, "font-style-name-asian", "CharFontStyleNameAsian", EE_CHAR_FONTINFO_CJK, MID_FONT_STYLE_NAME },
+    { XML_NAMESPACE_STYLE, "font-style-name-complex", "CharFontStyleNameComplex", EE_CHAR_FONTINFO_CTL, MID_FONT_STYLE_NAME },
+    { XML_NAMESPACE_FO, "font-weight", "CharWeight", EE_CHAR_WEIGHT, MID_WEIGHT },
+    { XML_NAMESPACE_STYLE, "font-weight-asian", "CharWeightAsian", EE_CHAR_WEIGHT_CJK, MID_WEIGHT },
+    { XML_NAMESPACE_STYLE, "font-weight-complex", "CharWeightComplex", EE_CHAR_WEIGHT_CTL, MID_WEIGHT },
+    { XML_NAMESPACE_STYLE, "text-overline-width", "CharOverline", EE_CHAR_OVERLINE, MID_TL_STYLE },
+    { XML_NAMESPACE_STYLE, "text-overline-color", "CharOverlineColor", EE_CHAR_OVERLINE, MID_TL_COLOR },
+    { XML_NAMESPACE_STYLE, "text-overline-color", "CharOverlineHasColor", EE_CHAR_OVERLINE, MID_TL_HASCOLOR },
+    { XML_NAMESPACE_STYLE, "text-underline-width", "CharUnderline", EE_CHAR_UNDERLINE, MID_TL_STYLE },
+    { XML_NAMESPACE_STYLE, "text-underline-color", "CharUnderlineColor", EE_CHAR_UNDERLINE, MID_TL_COLOR },
+    { XML_NAMESPACE_STYLE, "text-underline-color", "CharUnderlineHasColor", EE_CHAR_UNDERLINE, MID_TL_HASCOLOR },
+    { XML_NAMESPACE_STYLE, "text-line-through-mode", "CharWordMode", EE_CHAR_WLM, 0 },
+    { XML_NAMESPACE_STYLE, "text-line-through-type", "CharStrikeout", EE_CHAR_STRIKEOUT, MID_CROSS_OUT },
+    { XML_NAMESPACE_STYLE, "font-relief", "CharRelief", EE_CHAR_RELIEF, MID_RELIEF },
+    { XML_NAMESPACE_STYLE, "text-outline", "CharContoured", EE_CHAR_OUTLINE, 0 },
+    { XML_NAMESPACE_FO, "text-shadow", "CharShadowed", EE_CHAR_SHADOW, 0 },
+    { XML_NAMESPACE_FO, "letter-spacing", "CharKerning", EE_CHAR_KERNING, 0 },
+    { XML_NAMESPACE_STYLE, "letter-kerning", "CharAutoKerning", EE_CHAR_PAIRKERNING, 0 },
+    { XML_NAMESPACE_STYLE, "text-scale", "CharScaleWidth", EE_CHAR_FONTWIDTH, 0 },
+    { XML_NAMESPACE_STYLE, "text-position", "CharEscapement", EE_CHAR_ESCAPEMENT, MID_ESC },
+    { XML_NAMESPACE_STYLE, "text-position", "CharEscapementHeight", EE_CHAR_ESCAPEMENT, MID_ESC_HEIGHT },
+    { XML_NAMESPACE_STYLE, "text-emphasize", "CharEmphasis", EE_CHAR_EMPHASISMARK, MID_EMPHASIS },
+    { XML_NAMESPACE_FO, "country", "CharLocale", EE_CHAR_LANGUAGE, MID_LANG_LOCALE },
+    { XML_NAMESPACE_STYLE, "country-asian", "CharLocaleAsian", EE_CHAR_LANGUAGE_CJK, MID_LANG_LOCALE },
+    { XML_NAMESPACE_STYLE, "country-complex", "CharLocaleComplex", EE_CHAR_LANGUAGE_CTL, MID_LANG_LOCALE },
 };
 
-ScXMLEditAttributeMap::Entry::Entry(sal_uInt16 nItemID, sal_uInt8 nFlag) :
-    mnItemID(nItemID), mnFlag(nFlag) {}
-
 ScXMLEditAttributeMap::ScXMLEditAttributeMap()
 {
     size_t n = sizeof(aEntries) / sizeof(aEntries[0]);
     for (size_t i = 0; i < n; ++i)
     {
-        maEntries.insert(
-            EntriesType::value_type(
-                OUString::createFromAscii(aEntries[i].mpAPIName),
-                Entry(aEntries[i].mnItemID, aEntries[i].mnFlag)));
+        maAPIEntries.insert(
+            StrToEntriesType::value_type(
+                OUString::createFromAscii(aEntries[i].mpAPIName), &aEntries[i]));
+
+        maItemIDEntries.insert(
+            IndexToEntriesType::value_type(aEntries[i].mnItemID, &aEntries[i]));
     }
 }
 
-const ScXMLEditAttributeMap::Entry* ScXMLEditAttributeMap::getEntry(const OUString& rXMLName) const
+const ScXMLEditAttributeMap::Entry* ScXMLEditAttributeMap::getEntryByAPIName(const OUString& rAPIName) const
+{
+    StrToEntriesType::const_iterator it = maAPIEntries.find(rAPIName);
+    return it == maAPIEntries.end() ? NULL : it->second;
+}
+
+const ScXMLEditAttributeMap::Entry* ScXMLEditAttributeMap::getEntryByItemID(sal_uInt16 nItemID) const
 {
-    EntriesType::const_iterator it = maEntries.find(rXMLName);
-    return it == maEntries.end() ? NULL : &it->second;
+    IndexToEntriesType::const_iterator it = maItemIDEntries.find(nItemID);
+    return it == maItemIDEntries.end() ? NULL : it->second;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/editattributemap.hxx b/sc/source/filter/xml/editattributemap.hxx
index fb981df..79c31e4 100644
--- a/sc/source/filter/xml/editattributemap.hxx
+++ b/sc/source/filter/xml/editattributemap.hxx
@@ -23,19 +23,23 @@ class ScXMLEditAttributeMap
 public:
     struct Entry
     {
+        sal_uInt16 nmXMLNS;
+        const char* mpXMLName;
+        const char* mpAPIName;
         sal_uInt16 mnItemID;
         sal_uInt8 mnFlag;
-
-        Entry(sal_uInt16 nItemID, sal_uInt8 nFlag);
     };
 
     ScXMLEditAttributeMap();
 
-    const Entry* getEntry(const OUString& rXMLName) const;
+    const Entry* getEntryByAPIName(const OUString& rAPIName) const;
+    const Entry* getEntryByItemID(sal_uInt16 nItemID) const;
 
 private:
-    typedef boost::unordered_map<OUString, Entry, OUStringHash> EntriesType;
-    EntriesType maEntries;
+    typedef boost::unordered_map<OUString, const Entry*, OUStringHash> StrToEntriesType;
+    typedef boost::unordered_map<sal_uInt16, const Entry*> IndexToEntriesType;
+    StrToEntriesType maAPIEntries;
+    IndexToEntriesType maItemIDEntries;
 };
 
 #endif
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index b03707f..69f5a73 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -419,7 +419,7 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, cons
             continue;
 
         const OUString& rName = xMapper->GetEntryAPIName(it->mnIndex);
-        const ScXMLEditAttributeMap::Entry* pEntry = rEditAttrMap.getEntry(rName);
+        const ScXMLEditAttributeMap::Entry* pEntry = rEditAttrMap.getEntryByAPIName(rName);
         if (!pEntry)
             continue;
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 8d12427e..7fc109e 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -60,6 +60,8 @@
 #include "conditio.hxx"
 #include "cellvalue.hxx"
 #include "stylehelper.hxx"
+#include "edittextiterator.hxx"
+#include "editattributemap.hxx"
 
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmlnmspe.hxx>
@@ -68,7 +70,25 @@
 #include <xmloff/families.hxx>
 #include <xmloff/numehelp.hxx>
 #include <xmloff/txtparae.hxx>
-#include <editeng/xmlcnitm.hxx>
+#include "editeng/autokernitem.hxx"
+#include "editeng/charreliefitem.hxx"
+#include "editeng/charscaleitem.hxx"
+#include "editeng/colritem.hxx"
+#include "editeng/contouritem.hxx"
+#include "editeng/crossedoutitem.hxx"
+#include "editeng/emphasismarkitem.hxx"
+#include "editeng/escapementitem.hxx"
+#include "editeng/fhgtitem.hxx"
+#include "editeng/fontitem.hxx"
+#include "editeng/kernitem.hxx"
+#include "editeng/langitem.hxx"
+#include "editeng/postitem.hxx"
+#include "editeng/sectionattribute.hxx"
+#include "editeng/shdditem.hxx"
+#include "editeng/udlnitem.hxx"
+#include "editeng/wghtitem.hxx"
+#include "editeng/wrlmitem.hxx"
+#include "editeng/xmlcnitm.hxx"
 #include <xmloff/xmlerror.hxx>
 #include <xmloff/XMLEventExport.hxx>
 
@@ -1093,39 +1113,209 @@ void ScXMLExport::ExportExternalRefCacheStyles()
     }
 }
 
-void ScXMLExport::ExportCellTextAutoStyles(const Reference <sheet::XSpreadsheet>& xTable)
+void ScXMLExport::ExportCellTextAutoStyles(sal_Int32 nTable)
 {
-    Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
-    if (!xCellRangesQuery.is())
+    if (!ValidTab(nTable))
         return;
 
-    Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
-    if (!xSheetCellRanges.is())
-        return;
+    UniReference<XMLPropertySetMapper> xMapper = GetTextParagraphExport()->GetTextPropMapper()->getPropertySetMapper();
+    sal_Int32 nEntryCount = xMapper->GetEntryCount();
+    UniReference<SvXMLAutoStylePoolP> xStylePool = GetAutoStylePool();
+    const ScXMLEditAttributeMap& rAttrMap = GetEditAttributeMap();
 
-    uno::Sequence< table::CellRangeAddress > aCellRangeAddresses (xSheetCellRanges->getRangeAddresses());
-    sal_uInt32 nCount(aCellRangeAddresses.getLength());
-    Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
-    if (!xCellsAccess.is())
-        return;
+    sc::EditTextIterator aIter(*pDoc, nTable);
+    sal_Int32 nCellCount = 0;
+    for (const EditTextObject* pEdit = aIter.first(); pEdit; pEdit = aIter.next(), ++nCellCount)
+    {
+        std::vector<editeng::SectionAttribute> aAttrs;
+        pEdit->GetAllSectionAttributes(aAttrs);
+        if (aAttrs.empty())
+            continue;
 
-    GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount);
-    Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
-    if (!xCells.is())
-        return;
+        std::vector<editeng::SectionAttribute>::const_iterator itSec = aAttrs.begin(), itSecEnd = aAttrs.end();
+        for (; itSec != itSecEnd; ++itSec)
+        {
+            const std::vector<const SfxPoolItem*>& rSecAttrs = itSec->maAttributes;
+            if (rSecAttrs.empty())
+                // No formats applied to this section. Skip it.
+                continue;
 
-    sal_uInt32 nCount2 = 0;
-    while (xCells->hasMoreElements())
-    {
-        Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
-        if (xText.is())
-            GetTextParagraphExport()->collectTextAutoStyles(xText, false, false);
-        ++nCount2;
-        IncrementProgressBar(false);
+            std::vector<XMLPropertyState> aPropStates;
+            aPropStates.reserve(rSecAttrs.size());
+            std::vector<const SfxPoolItem*>::const_iterator it = rSecAttrs.begin(), itEnd = rSecAttrs.end();
+            for (; it != itEnd; ++it)
+            {
+                const SfxPoolItem* p = *it;
+                const ScXMLEditAttributeMap::Entry* pEntry = rAttrMap.getEntryByItemID(p->Which());
+                if (!pEntry)
+                    continue;
+
+                sal_Int32 nIndex = xMapper->GetEntryIndex(
+                    pEntry->nmXMLNS, OUString::createFromAscii(pEntry->mpXMLName), 0);
+
+                if (nIndex == -1 || nIndex >= nEntryCount)
+                    continue;
+
+                uno::Any aAny;
+                switch (p->Which())
+                {
+                    case EE_CHAR_FONTINFO:
+                    case EE_CHAR_FONTINFO_CJK:
+                    case EE_CHAR_FONTINFO_CTL:
+                    {
+                        if (!static_cast<const SvxFontItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_WEIGHT:
+                    case EE_CHAR_WEIGHT_CJK:
+                    case EE_CHAR_WEIGHT_CTL:
+                    {
+                        if (!static_cast<const SvxWeightItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_FONTHEIGHT:
+                    case EE_CHAR_FONTHEIGHT_CJK:
+                    case EE_CHAR_FONTHEIGHT_CTL:
+                    {
+                        if (!static_cast<const SvxFontHeightItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_ITALIC:
+                    case EE_CHAR_ITALIC_CJK:
+                    case EE_CHAR_ITALIC_CTL:
+                    {
+                        if (!static_cast<const SvxPostureItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_OVERLINE:
+                    {
+                        if (!static_cast<const SvxOverlineItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_COLOR:
+                    {
+                        if (!static_cast<const SvxColorItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_WLM:
+                    {
+                        if (!static_cast<const SvxWordLineModeItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_STRIKEOUT:
+                    {
+                        if (!static_cast<const SvxCrossedOutItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_RELIEF:
+                    {
+                        if (!static_cast<const SvxCharReliefItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_OUTLINE:
+                    {
+                        if (!static_cast<const SvxContourItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_SHADOW:
+                    {
+                        if (!static_cast<const SvxShadowedItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_KERNING:
+                    {
+                        if (!static_cast<const SvxKerningItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_PAIRKERNING:
+                    {
+                        if (!static_cast<const SvxAutoKernItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_FONTWIDTH:
+                    {
+                        if (!static_cast<const SvxCharScaleWidthItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_ESCAPEMENT:
+                    {
+                        if (!static_cast<const SvxEscapementItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_EMPHASISMARK:
+                    {
+                        if (!static_cast<const SvxEmphasisMarkItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    case EE_CHAR_LANGUAGE:
+                    case EE_CHAR_LANGUAGE_CJK:
+                    case EE_CHAR_LANGUAGE_CTL:
+                    {
+                        if (!static_cast<const SvxLanguageItem*>(p)->QueryValue(aAny, pEntry->mnFlag))
+                            continue;
+
+                        aPropStates.push_back(XMLPropertyState(nIndex, aAny));
+                    }
+                    break;
+                    default:
+                        continue;
+                }
+            }
+
+            if (!aPropStates.empty())
+                OUString aName = xStylePool->Add(XML_STYLE_FAMILY_TEXT_TEXT, OUString(), aPropStates, false);
+        }
     }
 
-    if (nCount2 > nCount)
-        GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount);
+    GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCellCount);
 }
 
 void ScXMLExport::WriteRowContent()
@@ -1672,6 +1862,13 @@ void ScXMLExport::CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset
     }
 }
 
+const ScXMLEditAttributeMap& ScXMLExport::GetEditAttributeMap() const
+{
+    if (!mpEditAttrMap)
+        mpEditAttrMap.reset(new ScXMLEditAttributeMap);
+    return *mpEditAttrMap;
+}
+
 void ScXMLExport::_ExportContent()
 {
     nCurrentTable = 0;
@@ -2456,7 +2653,7 @@ void ScXMLExport::_ExportAutoStyles()
                 }
             }
 
-            ExportCellTextAutoStyles(xTable);
+            ExportCellTextAutoStyles(nTable);
         }
 
         pChangeTrackingExportHelper->CollectAutoStyles();
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 1823af3..2c93a59 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -34,6 +34,7 @@ namespace com { namespace sun { namespace star {
 } } }
 
 #include <boost/unordered_map.hpp>
+#include <boost/scoped_ptr.hpp>
 
 class ScOutlineArray;
 class SvXMLExportPropertyMapper;
@@ -58,6 +59,7 @@ class SfxItemPool;
 class ScAddress;
 class ScXMLCachedRowAttrAccess;
 class ScRangeName;
+class ScXMLEditAttributeMap;
 
 typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
 
@@ -70,6 +72,7 @@ class ScXMLExport : public SvXMLExport
     com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xSourceStream;
     sal_Int32                   nSourceStreamPos;
 
+    mutable boost::scoped_ptr<ScXMLEditAttributeMap> mpEditAttrMap;
     UniReference < XMLPropertyHandlerFactory >  xScPropHdlFactory;
     UniReference < XMLPropertySetMapper >       xCellStylesPropertySetMapper;
     UniReference < XMLPropertySetMapper >       xColumnStylesPropertySetMapper;
@@ -149,7 +152,7 @@ class ScXMLExport : public SvXMLExport
     void CloseHeaderColumn();
     void ExportColumns(const sal_Int32 nTable, const com::sun::star::table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader);
     void ExportExternalRefCacheStyles();
-    void ExportCellTextAutoStyles(const com::sun::star::uno::Reference<com::sun::star::sheet::XSpreadsheet>& xTable);
+    void ExportCellTextAutoStyles(sal_Int32 nTable);
     void ExportFormatRanges(const sal_Int32 nStartCol, const sal_Int32 nStartRow,
         const sal_Int32 nEndCol, const sal_Int32 nEndRow, const sal_Int32 nSheet);
     void WriteRowContent();
@@ -218,6 +221,8 @@ class ScXMLExport : public SvXMLExport
 
     void CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset, sal_Int32& rNewStart, sal_Int32& rNewEnd );
 
+    const ScXMLEditAttributeMap& GetEditAttributeMap() const;
+
 protected:
     virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
     virtual XMLPageExport* CreatePageExport();
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 92e6baa..df146bd 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -366,7 +366,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray(
         Sequence < PropertyState > aStates;
         const PropertyState *pStates = 0;
         Reference< XPropertyState > xPropState( rPropSet, UNO_QUERY );
-           if( xPropState.is() )
+        if( xPropState.is() )
         {
             aStates = xPropState->getPropertyStates( rApiNames );
             pStates = aStates.getConstArray();


More information about the Libreoffice-commits mailing list