[Libreoffice-commits] .: 3 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 14:24:33 PST 2012


 sc/source/core/data/bcaslot.cxx      |    4 +-
 sc/source/filter/excel/xecontent.cxx |   67 ++++++++++++++++++++++++++++++++++-
 sc/source/filter/excel/xestyle.cxx   |   17 +++++++-
 sc/source/filter/inc/xecontent.hxx   |   13 ++++++
 4 files changed, 95 insertions(+), 6 deletions(-)

New commits:
commit ef5fa06e6e918103cac2fc4844dbb62a3522b4e8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Nov 26 18:41:53 2012 +0100

    no need for this copy
    
    Change-Id: I0c64a411926ea0de04d214acb993337a695f6acb

diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 444928e..d03afa8 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1130,7 +1130,7 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
     XclExpRecord( EXC_ID_CONDFMT ),
     XclExpRoot( rRoot )
 {
-    ScRangeList aScRanges = rCondFormat.GetRange();
+    const ScRangeList& aScRanges = rCondFormat.GetRange();
     GetAddressConverter().ConvertRangeList( maXclRanges, aScRanges, true );
     if( !maXclRanges.empty() )
     {
commit 80904d027f5a7adb0fec7da99536f8cc02bdd2d9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Nov 26 18:19:50 2012 +0100

    implement OOXML export for date cond formats
    
    Change-Id: I0485edfb6571ff9db9e52b54099a24c92f566dc9

diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 557538e..444928e 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -977,6 +977,69 @@ void XclExpCF::SaveXml( XclExpXmlStream& rStrm )
     mxImpl->SaveXml( rStrm );
 }
 
+XclExpDateFormat::XclExpDateFormat( const XclExpRoot& rRoot, const ScCondDateFormatEntry& rFormatEntry, sal_Int32 nPriority ):
+    XclExpRecord( EXC_ID_CF ),
+    XclExpRoot( rRoot ),
+    mrFormatEntry(rFormatEntry),
+    mnPriority(nPriority)
+{
+}
+
+XclExpDateFormat::~XclExpDateFormat()
+{
+}
+
+namespace {
+
+const char* getTimePeriodString( condformat::ScCondFormatDateType eType )
+{
+    switch(eType)
+    {
+        case condformat::TODAY:
+            return "today";
+        case condformat::YESTERDAY:
+            return "yesterday";
+        case condformat::TOMORROW:
+            return "yesterday";
+        case condformat::THISWEEK:
+            return "thisWeek";
+        case condformat::LASTWEEK:
+            return "lastWeek";
+        case condformat::NEXTWEEK:
+            return "nextWeek";
+        case condformat::THISMONTH:
+            return "thisMonth";
+        case condformat::LASTMONTH:
+            return "lastMonth";
+        case condformat::NEXTMONTH:
+            return "nextMonth";
+        case condformat::LAST7DAYS:
+            return "last7Days";
+        default:
+            break;
+    }
+    return NULL;
+}
+
+}
+
+void XclExpDateFormat::SaveXml( XclExpXmlStream& rStrm )
+{
+    // only write the supported entries into OOXML
+    const char* sTimePeriod = getTimePeriodString(mrFormatEntry.GetDateType());
+    if(!sTimePeriod)
+        return;
+
+    sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+    rWorksheet->startElement( XML_cfRule,
+            XML_type, "timePeriod",
+            XML_priority, OString::valueOf( mnPriority + 1 ).getStr(),
+            XML_timePeriod, sTimePeriod,
+            XML_dxfId, OString::valueOf( GetDxfs().GetDxfId( mrFormatEntry.GetStyleName() ) ).getStr(),
+            FSEND );
+    rWorksheet->endElement( XML_cfRule);
+}
+
 XclExpCfvo::XclExpCfvo(const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rAddr, bool bFirst):
     XclExpRecord(),
     XclExpRoot( rRoot ),
@@ -1082,6 +1145,8 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
                     maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), ++rIndex, xExtLst ) );
                 else if(pFormatEntry->GetType() == condformat::ICONSET)
                     maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), static_cast<const ScIconSetFormat&>(*pFormatEntry), ++rIndex ) );
+                else if(pFormatEntry->GetType() == condformat::DATE)
+                    maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast<const ScCondDateFormatEntry&>(*pFormatEntry), ++rIndex ) );
             }
         aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 );
     }
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index ba639b6..772b36e 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2901,11 +2901,22 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
                 for (size_t nFormatEntry = 0; nFormatEntry < nEntryCount; ++nFormatEntry)
                 {
                     const ScFormatEntry* pFormatEntry = itr->GetEntry(nFormatEntry);
-                    if (!pFormatEntry || pFormatEntry->GetType() != condformat::CONDITION)
+                    if (!pFormatEntry || (pFormatEntry->GetType() != condformat::CONDITION &&
+                                pFormatEntry->GetType() != condformat::DATE))
                         continue;
-                    const ScCondFormatEntry* pEntry = static_cast<const ScCondFormatEntry*>(pFormatEntry);
 
-                    rtl::OUString aStyleName = pEntry->GetStyle();
+                    rtl::OUString aStyleName;
+                    if(pFormatEntry->GetType() == condformat::CONDITION)
+                    {
+                        const ScCondFormatEntry* pEntry = static_cast<const ScCondFormatEntry*>(pFormatEntry);
+                        aStyleName= pEntry->GetStyle();
+                    }
+                    else
+                    {
+                        const ScCondDateFormatEntry* pEntry = static_cast<const ScCondDateFormatEntry*>(pFormatEntry);
+                        aStyleName = pEntry->GetStyleName();
+                    }
+
                     if (maStyleNameToDxfId.find(aStyleName) == maStyleNameToDxfId.end())
                     {
                         maStyleNameToDxfId.insert(std::pair<rtl::OUString, sal_Int32>(aStyleName, nIndex));
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index 7e94df9..7b1015a 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -191,6 +191,19 @@ private:
     XclExpCFImplPtr     mxImpl;
 };
 
+class XclExpDateFormat : public XclExpRecord, protected XclExpRoot
+{
+public:
+    explicit XclExpDateFormat( const XclExpRoot& rRoot, const ScCondDateFormatEntry& rFormatEntry, sal_Int32 nPriority );
+    virtual ~XclExpDateFormat();
+
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+
+private:
+    const ScCondDateFormatEntry& mrFormatEntry;
+    sal_Int32 mnPriority;
+};
+
 class XclExpCfvo : public XclExpRecord, protected XclExpRoot
 {
 public:
commit 179b568a82e1506dced0d2f94c607f7bee2459fe
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Nov 26 16:00:24 2012 +0100

    easy performance improvement related to fdo#48312
    
    Change-Id: I61287dc910fb168c18fa7c9e46b8c29ae1300858

diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index b30a21e..116980d 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -275,8 +275,8 @@ sal_Bool ScBroadcastAreaSlot::AreaBroadcast( const ScHint& rHint) const
         return false;
     sal_Bool bIsBroadcasted = false;
     const ScAddress& rAddress = rHint.GetAddress();
-    for (ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin());
-            aIter != aBroadcastAreaTbl.end(); /* increment in body */ )
+    for (ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin()),
+            aIterEnd = aBroadcastAreaTbl.end(); aIter != aIterEnd; /* increment in body */ )
     {
         ScBroadcastArea* pArea = *aIter;
         // A Notify() during broadcast may call EndListeningArea() and thus


More information about the Libreoffice-commits mailing list