svx/source/sidebar/nbdtmg.cxx           |    2 +-
 sw/source/filter/html/htmlflywriter.cxx |   12 ++++++------
 sw/source/filter/html/htmlplug.cxx      |   17 +++--------------
 3 files changed, 10 insertions(+), 21 deletions(-)

New commits:
commit b957f091a0479e224225249528000fa94baf5723
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Jun 29 02:40:48 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Jun 29 02:47:21 2021 +0200

    write out image size in html export for 'keep ratio' images
    
    Without this the code was leaving out writing any size to the html
    output. Which means the size was the original image size, which may
    not be the size used by Writer.
    
    Change-Id: Ia249035a604f0f51f59b3190ebb8975a686533c7

diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index d5189d83a4b9..6f01a5c7008d 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -962,9 +962,9 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& 
aHtml, const SwFrameForma
         sal_uInt8 nPercentHeight = pFSItem->GetHeightPercent();
 
         // Size of the object in Twips without margins
-        Size aTwipSz( (nPercentWidth ? 0
+        Size aTwipSz( (nPercentWidth && nPercentWidth != 255 ? 0
                                  : pFSItem->GetWidth()-aTwipSpc.Width()),
-                      (nPercentHeight ? 0
+                      (nPercentHeight && nPercentHeight != 255 ? 0
                                   : pFSItem->GetHeight()-aTwipSpc.Height()) );
 
         OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, "Frame size 
minus spacing < 0!!!???" );
@@ -990,7 +990,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& 
aHtml, const SwFrameForma
             ((nPercentWidth && nPercentWidth!=255) || aPixelSz.Width()) )
         {
             OString sWidth;
-            if (nPercentWidth)
+            if (nPercentWidth && nPercentWidth != 255)
                 sWidth = 
OString::number(static_cast<sal_Int32>(nPercentWidth)) + "%";
             else
                 sWidth = 
OString::number(static_cast<sal_Int32>(aPixelSz.Width()));
@@ -1001,7 +1001,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& 
aHtml, const SwFrameForma
             ((nPercentHeight && nPercentHeight!=255) || aPixelSz.Height()) )
         {
             OString sHeight;
-            if (nPercentHeight)
+            if (nPercentHeight && nPercentHeight != 255)
                 sHeight = 
OString::number(static_cast<sal_Int32>(nPercentHeight)) + "%";
             else
                 sHeight = 
OString::number(static_cast<sal_Int32>(aPixelSz.Height()));
commit 60f6342308d1fb03422de255a2007f4785e91b0f
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Jun 15 15:24:15 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Jun 29 02:47:11 2021 +0200

    fix a size warning
    
    d7855213ae60d79f converted this incorrectly, the code right above
    may set the size as (0,0), and before the commit the invalid size
    was only negative.
    
    Change-Id: I198d025f5c02780ae509f97782bc41ac77fa3407

diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 627da9eaee8e..542df1d7414e 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -845,7 +845,7 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, 
sal_uInt16 nIndex, sal_uInt1
                     const Graphic* pGrf = 
pLevelSettings->pBrushItem->GetGraphic();
                     Size aSize = pLevelSettings->aSize;
                     sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
-                    if (!isResetSize  && aFmt.GetGraphicSize()!=Size(0,0))\
+                    if (!isResetSize  && aFmt.GetGraphicSize()!=Size(0,0))
                         aSize = aFmt.GetGraphicSize();
                     else if (aSize.IsEmpty() && pGrf)
                         aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf );
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 9f249b06d4d3..d5189d83a4b9 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -686,7 +686,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const 
SwFrameFormat &rFrameFormat,
                       (nPercentHeight ? 0
                                   : pFSItem->GetHeight()-aTwipSpc.Height()) );
 
-        OSL_ENSURE( !aTwipSz.IsEmpty(), "Frame size minus spacing  < 0!!!???" 
);
+        OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, "Frame size 
minus spacing  < 0!!!???" );
         if( aTwipSz.Width() < 0 )
             aTwipSz.setWidth( 0 );
         if( aTwipSz.Height() < 0 )
@@ -967,7 +967,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& 
aHtml, const SwFrameForma
                       (nPercentHeight ? 0
                                   : pFSItem->GetHeight()-aTwipSpc.Height()) );
 
-        OSL_ENSURE( !aTwipSz.IsEmpty(), "Frame size minus spacing < 0!!!???" );
+        OSL_ENSURE( aTwipSz.Width() >= 0 && aTwipSz.Height() >= 0, "Frame size 
minus spacing < 0!!!???" );
         if( aTwipSz.Width() < 0 )
             aTwipSz.setWidth( 0 );
         if( aTwipSz.Height() < 0 )
commit d05fa2fbc4c9befd969fc8e3cbca296ab55bdc23
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Jun 17 12:43:34 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Jun 29 02:46:47 2021 +0200

    set size properly when setting embed size from fallback graphic
    
    When loading e.g. OLE from ReqIF, the file contains object tag
    for the OLE and then as a fallback also an image. This loading
    code apparently sets the OLE geometry to the same as the image,
    for whatever reason, but if that's to be done, at least do it
    consistently, the same way it's done when reading the OLE. Otherwise
    e.g. relative width is ignored.
    
    Change-Id: Ifeafaefa4274db9ddffc6ff16210f7ecc2301a3c

diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index 8138e7d0bab5..4c7e90758f1d 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -496,25 +496,14 @@ bool SwHTMLParser::InsertEmbed()
         rObj.SetGraphic(aGraphic, aType);
 
         // Set the size of the OLE frame to the size of the graphic.
-        OutputDevice* pDevice = Application::GetDefaultDevice();
-        if (aSize.getHeight() == USHRT_MAX || aSize.getWidth() == USHRT_MAX)
-        {
-            Size aPixelSize = aGraphic.GetSizePixel(pDevice);
-            if (aSize.getWidth() == USHRT_MAX)
-                aSize.setWidth(aPixelSize.getWidth());
-            if (aSize.getHeight() == USHRT_MAX)
-                aSize.setHeight(aPixelSize.getHeight());
-        }
-
         SwFrameFormat* pFormat = pOLENode->GetFlyFormat();
         if (!pFormat)
             return true;
-
         SwAttrSet aAttrSet(pFormat->GetAttrSet());
         aAttrSet.ClearItem(RES_CNTNT);
-        Size aTwipSize(pDevice->PixelToLogic(aSize, 
MapMode(MapUnit::MapTwip)));
-        SwFormatFrameSize aFrameSize(SwFrameSize::Fixed, aTwipSize.Width(), 
aTwipSize.Height());
-        aAttrSet.Put(aFrameSize);
+        OutputDevice* pDevice = Application::GetDefaultDevice();
+        Size 
aDefaultTwipSize(pDevice->PixelToLogic(aGraphic.GetSizePixel(pDevice), 
MapMode(MapUnit::MapTwip)));
+        SetFixSize(aSize, aDefaultTwipSize, bPercentWidth, bPercentHeight, 
aPropInfo, aAttrSet);
         pOLENode->GetDoc()->SetFlyFrameAttr(*pFormat, aAttrSet);
         return true;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to