basegfx/source/tools/stringconversiontools.cxx |   15 +++++----------
 sw/source/uibase/uno/unotxdoc.cxx              |    2 +-
 2 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 4002a399af823055b6ba59db18ded1caba4969c9
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Jul 4 13:05:08 2022 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Jul 4 16:28:53 2022 +0200

    sw content control, picture, lok: fix change of placeholder after insert
    
    Commit c769c369c87a46ec877b7eefee27988044a2798f (sw content controls:
    fix picture placeholders, 2022-07-01) fixed picture placeholders on the
    desktop, but left the LOK case still broken.
    
    This is a problem since picture placeholders are protected (which is
    wanted), and these only allow SID_CHANGE_PICTURE, not
    SID_INSERT_GRAPHIC.
    
    Fix the problem by adapting
    SwXTextDocument::executeContentControlEvent() to dispatch
    SID_CHANGE_PICTURE (and not SID_INSERT_GRAPHIC), but do keep the slot ID
    of the argument as SID_INSERT_GRAPHIC, since SwView::InsertGraphicDlg()
    looks for a non-interactive URL as SID_INSERT_GRAPHIC even if we're
    changing an image, not inserting a new one.
    
    This means that LOK clients can't use SID_INSERT_GRAPHIC to change
    picture placeholders, they have to go via
    SwXTextDocument::executeContentControlEvent(), which is what
    gtktiledviewer does already.
    
    Change-Id: Ica42939f6564da3d59396a4b302be826d3968f8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136797
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index b3f6e2e7487f..b59795d3c2a4 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3423,7 +3423,7 @@ void SwXTextDocument::executeContentControlEvent(const 
StringMap& rArguments)
 
         // The current placeholder is selected, so this will replace, not 
insert.
         SfxStringItem aItem(SID_INSERT_GRAPHIC, it->second);
-        pView->GetViewFrame()->GetDispatcher()->ExecuteList(SID_INSERT_GRAPHIC,
+        pView->GetViewFrame()->GetDispatcher()->ExecuteList(SID_CHANGE_PICTURE,
                                                             
SfxCallMode::SYNCHRON, { &aItem });
     }
     else if (it->second == "date")
commit 895643431e6aea672158bae3772a36f26cd05cde
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 1 14:04:00 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jul 4 16:28:41 2022 +0200

    tdf#137544 no need to create a OUStringBuffer here
    
    we can just pass a view here
    
    Change-Id: I71679106ee749f64eac4819c2a4f282e40865639
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136803
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basegfx/source/tools/stringconversiontools.cxx 
b/basegfx/source/tools/stringconversiontools.cxx
index 3a671ae539f0..79b6d604662e 100644
--- a/basegfx/source/tools/stringconversiontools.cxx
+++ b/basegfx/source/tools/stringconversiontools.cxx
@@ -50,19 +50,17 @@ namespace basegfx::internal
         {
             const sal_Int64 nStrSize = rStr.size();
             sal_Unicode aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
-            OUStringBuffer sNumberString;
+            const sal_Int32 nStartPos = io_rPos;
 
             // sign
             if(aChar == '+' || aChar == '-')
             {
-                sNumberString.append(rStr[io_rPos]);
                 aChar = rStr[++io_rPos];
             }
 
             // numbers before point
             while('0' <= aChar && '9' >= aChar)
             {
-                sNumberString.append(rStr[io_rPos]);
                 io_rPos++;
                 aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
             }
@@ -70,7 +68,6 @@ namespace basegfx::internal
             // point
             if(aChar == '.')
             {
-                sNumberString.append(rStr[io_rPos]);
                 io_rPos++;
                 aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
             }
@@ -78,7 +75,6 @@ namespace basegfx::internal
             // numbers after point
             while ('0' <= aChar && '9' >= aChar)
             {
-                sNumberString.append(rStr[io_rPos]);
                 io_rPos++;
                 aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
             }
@@ -86,14 +82,12 @@ namespace basegfx::internal
             // 'e'
             if(aChar == 'e' || aChar == 'E')
             {
-                sNumberString.append(rStr[io_rPos]);
                 io_rPos++;
                 aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
 
                 // sign for 'e'
                 if(aChar == '+' || aChar == '-')
                 {
-                    sNumberString.append(rStr[io_rPos]);
                     io_rPos++;
                     aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
                 }
@@ -101,16 +95,17 @@ namespace basegfx::internal
                 // number for 'e'
                 while('0' <= aChar && '9' >= aChar)
                 {
-                    sNumberString.append(rStr[io_rPos]);
                     io_rPos++;
                     aChar = io_rPos < nStrSize ? rStr[io_rPos] : 0;
                 }
             }
 
-            if(sNumberString.getLength())
+            const sal_Int32 nLen = io_rPos - nStartPos;
+            if(nLen)
             {
+                rStr = rStr.substr(nStartPos, nLen);
                 rtl_math_ConversionStatus eStatus;
-                o_fRetval = ::rtl::math::stringToDouble( sNumberString,
+                o_fRetval = ::rtl::math::stringToDouble( rStr,
                                                             '.',
                                                             ',',
                                                             &eStatus );

Reply via email to