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

Takeshi Abe tabe at fixedpoint.jp
Mon Jun 11 10:36:11 UTC 2018


 sc/inc/editutil.hxx              |    6 ++----
 sc/source/core/tool/editutil.cxx |    8 +++-----
 sc/source/ui/inc/preview.hxx     |    3 +--
 sc/source/ui/inc/printfun.hxx    |    2 +-
 sc/source/ui/view/preview.cxx    |   10 +++-------
 sc/source/ui/view/printfun.cxx   |    7 +++----
 6 files changed, 13 insertions(+), 23 deletions(-)

New commits:
commit 9804cc4eff4c5899abdc5309eeb019eb6ec1bf46
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed May 9 18:30:15 2018 +0900

    sc: ScHeaderFieldData always stores a datetime
    
    It does not change only the date part nor the time part
    separately, thus holding single DateTime is sufficient.
    
    Change-Id: Ic619608ce7a961287c299698b9a004cbf7038702
    Reviewed-on: https://gerrit.libreoffice.org/54058
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 6aac49e77f51..a446b5cb385c 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -25,8 +25,7 @@
 #include "types.hxx"
 #include <editeng/editeng.hxx>
 #include <svx/pageitem.hxx>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
+#include <tools/datetime.hxx>
 #include <tools/gen.hxx>
 #include <tools/fract.hxx>
 #include <vcl/outdev.hxx>
@@ -190,8 +189,7 @@ struct ScHeaderFieldData
     OUString    aLongDocName;       // path and file name
     OUString    aShortDocName;      // pure file name
     OUString    aTabName;
-    Date        aDate;
-    tools::Time aTime;
+    DateTime    aDateTime;
     long        nPageNo;
     long        nTotalPages;
     SvxNumType  eNumType;
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index c475411fa371..bdadc8f64693 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -783,9 +783,7 @@ static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType)
 }
 
 ScHeaderFieldData::ScHeaderFieldData()
-    :
-        aDate( Date::EMPTY ),
-        aTime( tools::Time::EMPTY )
+    : aDateTime ( DateTime::EMPTY )
 {
     nPageNo = nTotalPages = 0;
     eNumType = SVX_NUM_ARABIC;
@@ -817,7 +815,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
         case text::textfield::Type::EXTENDED_TIME:
         case text::textfield::Type::TIME:
             // For now, time field in the header / footer is always dynamic.
-            aRet = ScGlobal::pLocaleData->getTime(aData.aTime);
+            aRet = ScGlobal::pLocaleData->getTime(aData.aDateTime);
         break;
         case text::textfield::Type::DOCINFO_TITLE:
             aRet = aData.aTitle;
@@ -838,7 +836,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
             aRet = aData.aTabName;
         break;
         case text::textfield::Type::DATE:
-            aRet = ScGlobal::pLocaleData->getDate(aData.aDate);
+            aRet = ScGlobal::pLocaleData->getDate(aData.aDateTime);
         break;
         default:
             aRet = "?";
diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx
index 54e8d04c4f22..a43002c545ae 100644
--- a/sc/source/ui/inc/preview.hxx
+++ b/sc/source/ui/inc/preview.hxx
@@ -47,8 +47,7 @@ private:
     long            nTabPage;           // Page of sheet
     long            nTabStart;          // First (real) page of the sheet
     long            nDisplayStart;      // same as above, relative to the start of counting
-    Date            aDate;
-    tools::Time     aTime;
+    DateTime        aDateTime;
     long            nTotalPages;
     Size            aPageSize;          // for GetOptimalZoom
     ScPrintState    aState;
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 2df47432c89a..d96fb277b788 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -303,7 +303,7 @@ public:
 
     void            SetOffset( const Point& rOfs );
     void            SetManualZoom( sal_uInt16 nNewZoom );
-    void            SetDateTime( const Date& rDate, const tools::Time& rTime );
+    void            SetDateTime( const DateTime& );
 
     void            SetClearFlag( bool bFlag );
     void            SetUseStyleColor( bool bFlag );
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 6f1602da97c7..b709cf1a3d12 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -96,8 +96,7 @@ ScPreview::ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell*
     nTabPage( 0 ),
     nTabStart( 0 ),
     nDisplayStart( 0 ),
-    aDate( Date::SYSTEM ),
-    aTime( tools::Time::SYSTEM ),
+    aDateTime( DateTime::SYSTEM ),
     nTotalPages( 0 ),
     pLocationData( nullptr ),
     pDrawView( nullptr ),
@@ -401,7 +400,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
 
         pPrintFunc->SetOffset(aOffset);
         pPrintFunc->SetManualZoom(nZoom);
-        pPrintFunc->SetDateTime(aDate,aTime);
+        pPrintFunc->SetDateTime(aDateTime);
         pPrintFunc->SetClearFlag(true);
         pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() );
 
@@ -701,10 +700,7 @@ const ScPreviewLocationData& ScPreview::GetLocationData()
 void ScPreview::DataChanged(bool bNewTime)
 {
     if (bNewTime)
-    {
-        aDate = Date( Date::SYSTEM );
-        aTime = tools::Time( tools::Time::SYSTEM );
-    }
+        aDateTime = DateTime( DateTime::SYSTEM );
 
     bValid = false;
     InvalidateLocationData( SfxHintId::ScDataChanged );
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 4ddc1f64f0ce..f96fd9b74d28 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1075,7 +1075,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
     else
         aFieldData.nTotalPages = nTotalPages;
 
-    SetDateTime( Date( Date::SYSTEM ), tools::Time( tools::Time::SYSTEM ) );
+    SetDateTime( DateTime( DateTime::SYSTEM ) );
 
     if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
         aFieldData.aTitle = pDocShell->getDocProperties()->getTitle();
@@ -1111,10 +1111,9 @@ void ScPrintFunc::GetScaleData( Size& rPhysSize, long& rDocHdr, long& rDocFtr )
     rDocFtr = aFtr.nHeight;
 }
 
-void ScPrintFunc::SetDateTime( const Date& rDate, const tools::Time& rTime )
+void ScPrintFunc::SetDateTime( const DateTime& rDateTime )
 {
-    aFieldData.aDate = rDate;
-    aFieldData.aTime = rTime;
+    aFieldData.aDateTime = rDateTime;
 }
 
 static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext *pOut,


More information about the Libreoffice-commits mailing list