chart2/source/tools/TitleHelper.cxx |    2 +-
 desktop/source/lib/init.cxx         |   35 ++++++++++++++++++++++++++---------
 2 files changed, 27 insertions(+), 10 deletions(-)

New commits:
commit dd7e03fe7f1d913b8fad2ade6d3c04d02c0cf92c
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Wed Apr 3 00:08:45 2024 +0530
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 3 14:26:11 2024 +0200

    LOK: set creation date when online creates file from template
    
    problem:
    when online created file using WOPI clients, creation dates were never set.
    in online files are created using templates, even empty files are created 
using
    an empty template
    
    Change-Id: I3f022427745de7204faac9418620e2a87f9cf684
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165711
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3963b86eab34..9b49a9c934a6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3354,6 +3354,19 @@ static void lo_registerCallback (LibreOfficeKit* pThis,
     pApp->m_pCallbackData = pLib->mpCallbackData = pData;
 }
 
+static SfxObjectShell* getSfxObjectShell(LibreOfficeKitDocument* pThis)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    if (!pDocument)
+        return nullptr;
+
+    SfxBaseModel* pBaseModel = 
dynamic_cast<SfxBaseModel*>(pDocument->mxComponent.get());
+    if (!pBaseModel)
+        return nullptr;
+
+    return pBaseModel->GetObjectShell();
+}
+
 static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const 
char* pFormat, const char* pFilterOptions)
 {
     comphelper::ProfileZone aZone("doc_saveAs");
@@ -3503,6 +3516,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, 
const char* sUrl, const cha
         const uno::Sequence<OUString> aOptionSeq = 
comphelper::string::convertCommaSeparated(aFilterOptions);
         std::vector<OUString> aFilteredOptionVec;
         bool bTakeOwnership = false;
+        bool bCreateFromTemplate = false;
         MediaDescriptor aSaveMediaDescriptor;
         for (const auto& rOption : aOptionSeq)
         {
@@ -3510,10 +3524,21 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, 
const char* sUrl, const cha
                 bTakeOwnership = true;
             else if (rOption == "NoFileSync")
                 aSaveMediaDescriptor[u"NoFileSync"_ustr] <<= true;
+            else if (rOption == "FromTemplate")
+                bCreateFromTemplate = true;
             else
                 aFilteredOptionVec.push_back(rOption);
         }
 
+        if (bCreateFromTemplate && bTakeOwnership)
+        {
+            if (SfxObjectShell* pObjectShell = getSfxObjectShell(pThis))
+            {
+                DateTime now( ::DateTime::SYSTEM );
+                
pObjectShell->getDocProperties()->setCreationDate(now.GetUNODateTime());
+            }
+        }
+
         aSaveMediaDescriptor[u"Overwrite"_ustr] <<= true;
         aSaveMediaDescriptor[u"FilterName"_ustr] <<= aFilterName;
 
@@ -5903,15 +5928,7 @@ static void doc_resetSelection(LibreOfficeKitDocument* 
pThis)
 
 static char* getDocReadOnly(LibreOfficeKitDocument* pThis)
 {
-    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-    if (!pDocument)
-        return nullptr;
-
-    SfxBaseModel* pBaseModel = 
dynamic_cast<SfxBaseModel*>(pDocument->mxComponent.get());
-    if (!pBaseModel)
-        return nullptr;
-
-    SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell();
+    SfxObjectShell* pObjectShell = getSfxObjectShell(pThis);
     if (!pObjectShell)
         return nullptr;
 
commit 33ca999cb238246709494285bb27d85745e7d112
Author:     Andrea Gelmini <andrea.gelm...@gelma.net>
AuthorDate: Wed Apr 3 12:22:34 2024 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Wed Apr 3 14:26:07 2024 +0200

    Fix typo
    
    Change-Id: Iaa7a84f5568b13f223e9a45c50c5a7de66e08f42
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165740
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/chart2/source/tools/TitleHelper.cxx 
b/chart2/source/tools/TitleHelper.cxx
index 6fdb4f5adef3..e9f76c619985 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -374,7 +374,7 @@ void TitleHelper::setCompleteString( const OUString& 
rNewText
         if (bDialogTitle && aNewText.equals(getUnstackedStr(aFullString)))
         {
             // If the new title setted from a dialog window to a new string
-            // the first old text portion will be maintained if its a new 
string,
+            // the first old text portion will be maintained if it's a new 
string,
             // otherwise we use the original one.
             aNewStringList = aOldStringList;
         }

Reply via email to