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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 17:46:50 PST 2012


 sc/source/core/data/conditio.cxx               |   34 ++++++++++++++++++-------
 sc/source/ui/condformat/condformatdlgentry.cxx |   10 +++++--
 2 files changed, 32 insertions(+), 12 deletions(-)

New commits:
commit 37f238837cdd2532363efe2af1735ab24cb9a1b9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Dec 18 23:05:29 2012 +0100

    some small fixes for UI around date cond formats

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 3fc1612..b516670 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1170,6 +1170,9 @@ ScDateFrmtEntry::ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCon
     {
         sal_Int32 nPos = static_cast<sal_Int32>(pFormat->GetDateType());
         maLbDateEntry.SelectEntryPos(nPos);
+
+        rtl::OUString aStyleName = pFormat->GetStyleName();
+        maLbStyle.SelectEntry(aStyleName);
     }
 }
 
@@ -1180,6 +1183,7 @@ void ScDateFrmtEntry::Init()
 
     FillStyleListBox( mpDoc, maLbStyle );
     maLbStyle.SetSelectHdl( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) );
+    maLbStyle.SelectEntryPos(1);
 }
 
 void ScDateFrmtEntry::SetActive()
@@ -1193,9 +1197,9 @@ void ScDateFrmtEntry::SetActive()
 
 void ScDateFrmtEntry::SetInactive()
 {
-    maLbDateEntry.Show();
-    maFtStyle.Show();
-    maWdPreview.Show();
+    maLbDateEntry.Hide();
+    maFtStyle.Hide();
+    maWdPreview.Hide();
 
     Deselect();
 }
commit 31eee6b372539f0f1ccb82d9a8012e878d498d56
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Dec 18 22:59:35 2012 +0100

    handle last week/next week betweek different years, fdo#58340

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 2b58f33..3dcc3be 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1684,24 +1684,40 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const
                 return true;
             break;
         case condformat::LASTWEEK:
-            if( rActDate.GetYear() == aCellDate.GetYear() )
+            if( rActDate.GetDayOfWeek() != SUNDAY )
             {
-                if( rActDate.GetWeekOfYear( SUNDAY ) == aCellDate.GetWeekOfYear( SUNDAY ) + 1 )
-                    return true;
+                Date aBegin(rActDate - 8 - static_cast<long>(rActDate.GetDayOfWeek()));
+                Date aEnd(rActDate - 2 -static_cast<long>(rActDate.GetDayOfWeek()));
+                return aCellDate.IsBetween( aBegin, aEnd );
+            }
+            else
+            {
+                Date aBegin(rActDate - 8);
+                Date aEnd(rActDate - 1);
+                return aCellDate.IsBetween( aBegin, aEnd );
             }
             break;
         case condformat::THISWEEK:
-            if( rActDate.GetYear() == aCellDate.GetYear() )
+            if( rActDate.GetDayOfWeek() != SUNDAY )
             {
-                if( rActDate.GetWeekOfYear( SUNDAY ) == aCellDate.GetWeekOfYear( SUNDAY ) )
-                    return true;
+                Date aBegin(rActDate - 1 - static_cast<long>(rActDate.GetDayOfWeek()));
+                Date aEnd(rActDate + 5 - static_cast<long>(rActDate.GetDayOfWeek()));
+                return aCellDate.IsBetween( aBegin, aEnd );
+            }
+            else
+            {
+                Date aEnd( rActDate + 6);
+                return aCellDate.IsBetween( rActDate, aEnd );
             }
             break;
         case condformat::NEXTWEEK:
-            if( rActDate.GetYear() == aCellDate.GetYear() )
+            if( rActDate.GetDayOfWeek() != SUNDAY )
             {
-                if( rActDate.GetWeekOfYear( SUNDAY ) == aCellDate.GetWeekOfYear( SUNDAY ) - 1 )
-                    return true;
+                return aCellDate.IsBetween( rActDate + 6 - static_cast<long>(rActDate.GetDayOfWeek()), rActDate + 12 - static_cast<long>(rActDate.GetDayOfWeek()) );
+            }
+            else
+            {
+                return aCellDate.IsBetween( rActDate + 7, rActDate + 13 );
             }
             break;
         case condformat::LASTMONTH:


More information about the Libreoffice-commits mailing list