Rebased ref, commits from common ancestor:
commit de32134b9059923fe023c3f188699f04a33521dc
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Oct 27 11:30:35 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Oct 28 18:09:59 2024 +0100

    cid#1633859: COPY_PASTE_ERROR
    
    Change-Id: I8934e68b169fe94ea6fb6fbf47d2ab09eb314ac6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175615
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Pranam Lashkari <lpra...@collabora.com>

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 8bc37d863810..3adaf9cd8ffe 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -287,7 +287,7 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
             if (mxNumberEntry->get_visible())
                 
mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 0));
             if (mxNumberEntry2->get_visible())
-                
mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 1));
+                
mxNumberEntry2->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 
1));
         }
         else if (type == ScFormatEntry::Type::Date)
         {
commit 1b3659880b6e3b213fb1157498003eda49d4ded0
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Thu Oct 17 06:23:21 2024 +0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Oct 28 18:09:59 2024 +0100

    sc: prefill easy condition dialog with editing condition data
    
    Change-Id: I207bcbf15bedf3dd51980f04899b2c751b64295d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175036
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 47936bdc64d9..8bc37d863810 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -273,10 +273,35 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
     aRange.Format(sRangeString, ScRefFlags::VALID, *mpDocument, 
mpDocument->GetAddressConvention());
     mxRangeEntry->SetText(sRangeString);
 
+    ScConditionalFormat* format = mpViewData->GetDocument().GetCondFormat(
+        maPosition.Col(), maPosition.Row(), maPosition.Tab());
+    OUString sStyleName;
+    if (format)
+    {
+        const ScFormatEntry* entry = format->GetEntry(mnEntryIndex);
+        ScFormatEntry::Type type = entry->GetType();
+        if (type == ScFormatEntry::Type::Condition)
+        {
+            const ScCondFormatEntry* condEntry = static_cast<const 
ScCondFormatEntry*>(entry);
+            sStyleName = condEntry->GetStyle();
+            if (mxNumberEntry->get_visible())
+                
mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 0));
+            if (mxNumberEntry2->get_visible())
+                
mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 1));
+        }
+        else if (type == ScFormatEntry::Type::Date)
+        {
+            const ScCondDateFormatEntry* dateEntry
+                = static_cast<const ScCondDateFormatEntry*>(entry);
+            sStyleName = dateEntry->GetStyleName();
+        }
+    }
+
     StartListening(*mpDocument->GetStyleSheetPool(), 
DuplicateHandling::Prevent);
     ScCondFormatHelper::FillStyleListBox(mpDocument, *mxStyles);
 
-    mxStyles->set_active(1);
+    mxStyles->set_active_text(sStyleName);
+    StyleSelectHdl(*mxStyles);
     mxWdPreviewWin->show();
 }
 

Reply via email to