sc/source/ui/view/tabvwsh4.cxx |    5 ++++-
 vcl/osx/DataFlavorMapping.cxx  |   19 +++++++++++++------
 2 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit 56fde5e66f22d68237150c501583fdf734c69c96
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Sep 9 19:57:02 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Sep 9 21:43:26 2025 +0200

    tdf#166121 reduce cost of clipboard during Remove Duplicates
    
    we were spending a lot of time constructing temporary strings
    to compare against. Rather construct a temporary of the thing
    that is outside the loop.
    
    Change-Id: I474e1bed2800c555093d401453beaa4866e89fbc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190726
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx
index 855f6db9a287..31f70a3bff4d 100644
--- a/vcl/osx/DataFlavorMapping.cxx
+++ b/vcl/osx/DataFlavorMapping.cxx
@@ -32,6 +32,7 @@
 
 #include <rtl/ustring.hxx>
 #include <osl/endian.h>
+#include <o3tl/string_view.hxx>
 
 #include <cassert>
 #include <string.h>
@@ -513,14 +514,20 @@ DataFlavorMapper::~DataFlavorMapper()
 DataFlavor DataFlavorMapper::systemToOpenOfficeFlavor( const NSString* 
systemDataFlavor) const
 {
     DataFlavor oOOFlavor;
-
+    NSData *utf8Data = [systemDataFlavor 
dataUsingEncoding:NSUTF8StringEncoding];
+    std::string_view flavorView { static_cast<const char*>([utf8Data bytes]), 
[utf8Data length] };
     for (size_t i = 0; i < SIZE_FLAVOR_MAP; i++)
     {
-        if ((flavorMap[i].SystemFlavor == nil && ([systemDataFlavor 
isEqualToString:[NSString stringWithUTF8String:flavorMap[i].OOoFlavor]]
-                                                  ||
-                                                  [systemDataFlavor 
hasPrefix:[[NSString stringWithUTF8String:flavorMap[i].OOoFlavor] 
stringByAppendingString:@";"]]))
-            ||
-            (flavorMap[i].SystemFlavor != nil && [systemDataFlavor 
isEqualToString:const_cast<NSString*>(flavorMap[i].SystemFlavor)]))
+        if ((flavorMap[i].SystemFlavor == nil
+                && (flavorView == flavorMap[i].OOoFlavor
+                    || o3tl::starts_with(flavorView, 
Concat2View(OString::Concat(flavorMap[i].OOoFlavor) + ";"))))
+            || (flavorMap[i].SystemFlavor != nil
+               && [systemDataFlavor 
isEqualToString:const_cast<NSString*>(flavorMap[i].SystemFlavor)]))
+//        if ((flavorMap[i].SystemFlavor == nil && ([systemDataFlavor 
isEqualToString:[NSString stringWithUTF8String:flavorMap[i].OOoFlavor]]
+//                                                  ||
+//                                                  [systemDataFlavor 
hasPrefix:[[NSString stringWithUTF8String:flavorMap[i].OOoFlavor] 
stringByAppendingString:@";"]]))
+//            ||
+//            (flavorMap[i].SystemFlavor != nil && [systemDataFlavor 
isEqualToString:const_cast<NSString*>(flavorMap[i].SystemFlavor)]))
         {
           if (flavorMap[i].SystemFlavor == nil)
               oOOFlavor.MimeType = NSStringToOUString(systemDataFlavor);
commit 29425a537bc182b38efcb1120e9f430b28d503a4
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Sep 9 19:09:49 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Sep 9 21:43:14 2025 +0200

    tdf#166121 supress row height calc during "Remove Duplicate"
    
    shaves 50% off time required
    
    Change-Id: I479015afd5dc5dcf8d14bf4cb17ed931ddbc56fd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190725
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 29f929d3527e..deadef989275 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1912,17 +1912,20 @@ void ScTabViewShell::HandleDuplicateRecords(const 
css::uno::Reference<css::sheet
 
     uno::Reference<sheet::XCalculatable> xCalculatable(xModel, uno::UNO_QUERY);
     bool bAutoCalc = xCalculatable->isAutomaticCalculationEnabled();
+    ScDocument& rDoc = GetViewData().GetDocShell().GetDocument();
 
     comphelper::ScopeGuard aUndoContextGuard(
-        [&xUndoManager, &xLockable, &xModel, &xCalculatable, &bAutoCalc, 
&bRemove] {
+        [&xUndoManager, &xLockable, &xModel, &xCalculatable, &bAutoCalc, 
&bRemove, &rDoc] {
         xUndoManager->getUndoManager()->leaveUndoContext();
         if (bRemove)
             xCalculatable->enableAutomaticCalculation(bAutoCalc);
         xLockable->removeActionLock();
         if (xModel->hasControllersLocked())
             xModel->unlockControllers();
+        rDoc.UnlockAdjustHeight();
     });
 
+    rDoc.LockAdjustHeight();
     xModel->lockControllers();
     xLockable->addActionLock();
     if (bRemove)

Reply via email to