emfio/inc/wmfreader.hxx                                        |    1 
 emfio/qa/cppunit/wmf/data/TestBigPPI.wmf                       |binary
 emfio/qa/cppunit/wmf/wmfimporttest.cxx                         |   23 +++++++++
 emfio/source/reader/wmfreader.cxx                              |   24 
++++++++--
 officecfg/registry/data/org/openoffice/Office/Accelerators.xcu |   18 +++----
 sw/source/core/doc/DocumentStylePoolManager.cxx                |   15 ------
 6 files changed, 53 insertions(+), 28 deletions(-)

New commits:
commit 85d77da410eec9dffb813c2e11e1537b691d84a2
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Mon Oct 3 13:06:19 2022 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Oct 24 20:57:23 2022 +0200

    tdf#126657, tdf#145104: Don’t set language to none on defined styles
    
    Language is used for more things than spell checking (localized digits,
    accessibility, OpenType layout, and probably more).
    
    A better way is needed to disable spell checking for parts of the
    document by default while keeping the language alone, but right now I’m
    reverting these changes because they are workarounds for essentially
    cosmetic issues.
    
    This reverts the following commits:
    
    commit ca91beb9d983754a5cba9e3df1bf18295e6640a0
    Author: Vladimir Glazounov <v...@openoffice.org>
    Date:   Wed Jun 4 08:50:40 2008 +0000
    
        INTEGRATION: CWS sw30bf04 (1.51.2); FILE MERGED
        2008/05/13 07:20:17 fme 1.51.2.1: #i40133# rail: Set internet link 
style language to none to prevent spell checking
    
    commit 137a1d5380e310a43d36932c643e1331a94fd70d
    Author: Heiko Tietze <tietze.he...@gmail.com>
    Date:   Mon Jul 19 16:40:50 2021 +0200
    
        Resolves tdf#143066 - Language set to None for indices
    
    Change-Id: Idc9455f3f04e661bd00a9829dd0f0916844dc8eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140902
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@aliftype.com>
    (cherry picked from commit 2cca160f8bfc4597cf0ad3aaaf0017a5210ea0ec)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140958

diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx 
b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 1dc1885c8e98..4c9720e067bb 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -823,14 +823,6 @@ SwTextFormatColl* 
DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
                     aSet.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
                     aSet.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
                 }
-                // tdf#143066 : set language to 'none' to prevent spell 
checking for indices
-                if (nId == RES_POOLCOLL_REGISTER_BASE)
-                {
-                    aSet.Put( SvxLanguageItem( LANGUAGE_NONE, 
RES_CHRATR_LANGUAGE ) );
-                    aSet.Put( SvxLanguageItem( LANGUAGE_NONE, 
RES_CHRATR_CJK_LANGUAGE ) );
-                    aSet.Put( SvxLanguageItem( LANGUAGE_NONE, 
RES_CHRATR_CTL_LANGUAGE ) );
-                }
-                break;
             }
             break;
 
@@ -1559,19 +1551,12 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( 
sal_uInt16 nId )
         {
             aSet.Put( SvxColorItem( COL_BLUE, RES_CHRATR_COLOR ) );
             aSet.Put( SvxUnderlineItem( LINESTYLE_SINGLE, RES_CHRATR_UNDERLINE 
) );
-            // i40133: patch submitted by rail: set language to 'none' to 
prevent spell checking:
-            aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
-            aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE 
) );
-            aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE 
) );
         }
         break;
     case RES_POOLCHR_INET_VISIT:
         {
             aSet.Put( SvxColorItem( COL_RED, RES_CHRATR_COLOR ) );
             aSet.Put( SvxUnderlineItem( LINESTYLE_SINGLE, RES_CHRATR_UNDERLINE 
) );
-            aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
-            aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE 
) );
-            aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE 
) );
         }
         break;
     case RES_POOLCHR_JUMPEDIT:
commit 919e710e44e654ad78c0635cc459e23636c0888c
Author:     Aron Budea <aron.bu...@collabora.com>
AuthorDate: Tue Oct 11 15:59:54 2022 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Oct 24 20:56:44 2022 +0200

    tdf#150682 Change shortcut of inserting Math objects to Alt+Shift+E
    
    Ctrl+Alt combinations don't work on Windows if they're also
    doubling as AltGr modifiers, eg. in French keyboard layout,
    Ctrl+Alt+'=' (which is the same as AltGr+'=' ) is '}'.
    Avoid this by switching to different modifiers.
    
    In addition '=' can require a modifier to enter, eg. in German
    layout (Shift+0), so use an ASCII character, 'E' instead.
    
    Ctrl+Shift+E is listed as a problematic combination in
    Accelerators.xcu, settled on Alt+Shift+E in the end.
    
    Also partially revert d156e891db34e88991a6c18fd3cff6feddfc61c8,
    which did not work.
    
    Change-Id: Ie3625f2c55171187fbbe2c4f79821eba8c25f40a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141227
    Tested-by: Jenkins
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    (cherry picked from commit 77fb3ffdb6a8077cd3931985de923fbd1396d424)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141362
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu 
b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index 9514b9cdca14..7cb37c7799a4 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -795,7 +795,7 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some 
emoji thing
             <value xml:lang="en-US">.uno:FillDown</value>
           </prop>
         </node>
-        <node oor:name="EQUAL_MOD1_MOD2" oor:op="replace">
+        <node oor:name="E_SHIFT_MOD2" oor:op="replace">
           <prop oor:name="Command">
             <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
             <value xml:lang="en-US">.uno:InsertObjectStarMath</value>
@@ -1724,7 +1724,7 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some 
emoji thing
             <value xml:lang="es">.uno:SelectAll</value>
           </prop>
         </node>
-        <node oor:name="EQUAL_MOD1_MOD2" oor:op="replace">
+        <node oor:name="E_SHIFT_MOD2" oor:op="replace">
           <prop oor:name="Command">
             <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
             <value xml:lang="en-US">.uno:InsertMath</value>
@@ -2944,12 +2944,6 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some 
emoji thing
             <value xml:lang="en-US">.uno:PreviousAnnotation</value>
           </prop>
         </node>
-        <node oor:name="EQUAL_MOD1_MOD2" oor:op="replace">
-          <prop oor:name="Command">
-            <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
-            <value xml:lang="en-US">.uno:InsertMath</value>
-          </prop>
-        </node>
         <node oor:name="1_MOD1" oor:op="replace">
           <prop oor:name="Command">
             <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
@@ -3069,6 +3063,12 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some 
emoji thing
             <value xml:lang="es">.uno:SelectAll</value>
           </prop>
         </node>
+        <node oor:name="E_SHIFT_MOD2" oor:op="replace">
+          <prop oor:name="Command">
+            <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+            <value xml:lang="en-US">.uno:InsertMath</value>
+          </prop>
+        </node>
         <node oor:name="END_SHIFT_MOD1" oor:op="replace">
           <prop oor:name="Command">
             <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
@@ -6208,7 +6208,7 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some 
emoji thing
             <value xml:lang="es">.uno:SelectAll</value>
           </prop>
         </node>
-        <node oor:name="EQUAL_MOD1_MOD2" oor:op="replace">
+        <node oor:name="E_SHIFT_MOD2" oor:op="replace">
           <prop oor:name="Command">
             <value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
             <value xml:lang="en-US">.uno:InsertObjectStarMath</value>
commit 52aeefe7d01bdcf91725ea2067089379945932c3
Author:     Paris Oplopoios <paris.oplopo...@collabora.com>
AuthorDate: Wed Oct 19 16:57:11 2022 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Oct 24 20:54:47 2022 +0200

    tdf#150888 Scale down PPI if it would result in a tiny image
    
    The reason for the blurry document in tdf#150888 is that the image is
    tiny. PPI is 2540 in that image but when using the window bounding box
    (96, 81) this results in a very small image that the .odt then scales up
    which makes it blurry.
    
    Apart from that, when opening the extracted .wmf in Draw it's also very
    small, around 0.04" squared.
    
    Because MM_ANISOTROPICs definition allows for arbritrary scaling, when
    an image would be smaller than an inch squared the PPI is scaled down to
    either the images width or height. This makes the extracted WMF match
    the size of competitor office suites and fix the blur bug without
    breaking past tests.
    
    Change-Id: I11eab879848d9308f818708a91fd9eb91fc65200
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141533
    Tested-by: Jenkins
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit a03a47bb0791d88fedb2650bca412c28469b0b27)

diff --git a/emfio/inc/wmfreader.hxx b/emfio/inc/wmfreader.hxx
index f7788d53651c..5c6979550ef4 100644
--- a/emfio/inc/wmfreader.hxx
+++ b/emfio/inc/wmfreader.hxx
@@ -33,6 +33,7 @@ namespace emfio
     private:
         sal_uInt16      mnUnitsPerInch;
         sal_uInt32      mnRecSize;
+        bool            mbPlaceable;
 
         // embedded EMF data
         std::optional<std::vector<sal_uInt8>> mpEMFStream;
diff --git a/emfio/qa/cppunit/wmf/data/TestBigPPI.wmf 
b/emfio/qa/cppunit/wmf/data/TestBigPPI.wmf
new file mode 100644
index 000000000000..e120af2790db
Binary files /dev/null and b/emfio/qa/cppunit/wmf/data/TestBigPPI.wmf differ
diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx 
b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index d6533d8ba07c..33cf3f546c92 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -52,6 +52,7 @@ public:
     void testEmfProblem();
     void testEmfLineStyles();
     void testWorldTransformFontSize();
+    void testBigPPI();
     void testTdf93750();
     void testTdf99402();
     void testTdf39894();
@@ -65,6 +66,7 @@ public:
     CPPUNIT_TEST(testEmfProblem);
     CPPUNIT_TEST(testEmfLineStyles);
     CPPUNIT_TEST(testWorldTransformFontSize);
+    CPPUNIT_TEST(testBigPPI);
     CPPUNIT_TEST(testTdf93750);
     CPPUNIT_TEST(testTdf99402);
     CPPUNIT_TEST(testTdf39894);
@@ -308,6 +310,27 @@ void WmfTest::testWorldTransformFontSize()
     assertXPath(pDoc, "/metafile/font[4]", "weight", "normal");
 }
 
+void WmfTest::testBigPPI()
+{
+    // Test that PPI is reduced from 2540 to 96 (width from META_SETWINDOWEXT) 
to make the graphic
+    // bigger
+    SvFileStream aFileStream(getFullUrl(u"TestBigPPI.wmf"), StreamMode::READ);
+    GDIMetaFile aGDIMetaFile;
+    ReadWindowMetafile(aFileStream, aGDIMetaFile);
+
+    MetafileXmlDump dumper;
+    dumper.filterAllActionTypes();
+    dumper.filterActionType(MetaActionType::FONT, false);
+    xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile);
+
+    CPPUNIT_ASSERT(pDoc);
+
+    // If the PPI was not reduced the width and height would be <100 which is 
too small
+    // Related: tdf#150888
+    assertXPath(pDoc, "/metafile", "width", "2540");
+    assertXPath(pDoc, "/metafile", "height", "2143");
+}
+
 void WmfTest::testTdf93750()
 {
     SvFileStream aFileStream(getFullUrl(u"tdf93750.emf"), StreamMode::READ);
diff --git a/emfio/source/reader/wmfreader.cxx 
b/emfio/source/reader/wmfreader.cxx
index c4d21b3231b1..4985c0aac8b3 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -1412,11 +1412,11 @@ namespace emfio
 
         tools::Rectangle aPlaceableBound;
 
-        bool bPlaceable = nPlaceableMetaKey == 0x9ac6cdd7L;
+        mbPlaceable = nPlaceableMetaKey == 0x9ac6cdd7L;
 
-        SAL_INFO("emfio", "Placeable: \"" << (bPlaceable ? "yes" : "no") << 
"\"");
+        SAL_INFO("emfio", "Placeable: \"" << (mbPlaceable ? "yes" : "no") << 
"\"");
 
-        if (bPlaceable)
+        if (mbPlaceable)
         {
             //TODO do some real error handling here
             sal_Int16 nVal(0);
@@ -1669,9 +1669,10 @@ namespace emfio
         Point aViewportOrg(0,0);
         std::optional<Size>  aViewportExt;
 
+        sal_Int16 nMapMode = MM_ANISOTROPIC;
+
         if (nEnd - nPos)
         {
-            sal_Int16 nMapMode = MM_ANISOTROPIC;
             sal_uInt16 nFunction;
             sal_uInt32 nRSize;
 
@@ -2001,6 +2002,21 @@ namespace emfio
         if (aWinExt)
         {
             rPlaceableBound = tools::Rectangle(aWinOrg, *aWinExt);
+            if (mbPlaceable && nMapMode == MM_ANISOTROPIC)
+            {
+                // It seems that (in MM_ANISOTROPIC WMFs) the "inch" field 
(PPI) in META_PLACEABLE is
+                // ignored and instead competitor office suites decide what it 
should be arbitrarily
+                // Could have to do with MM_ANISOTROPICs definition:
+                // Logical units are mapped to arbitrary units with 
arbitrarily scaled axes.
+                // The issue is that when PPI is bigger than the window size, 
the image appears
+                // tiny (smaller than an inch squared).
+                // A solution is to scale PPI down in such images to an 
arbitrary amount that makes
+                // the image visible:
+                auto nWidth = rPlaceableBound.GetWidth();
+                auto nHeight = rPlaceableBound.GetHeight();
+                if (mnUnitsPerInch > nWidth && mnUnitsPerInch > nHeight)
+                    mnUnitsPerInch = std::max(nWidth, nHeight);
+            }
             SAL_INFO("emfio", "Window dimension "
                        " left: " << rPlaceableBound.Left()  << " top: " << 
rPlaceableBound.Top()
                     << " right: " << rPlaceableBound.Right() << " bottom: " << 
rPlaceableBound.Bottom());

Reply via email to