Fixed HTML export of image bullet list. Removed width, height, align
attributes in <ul>. Removed two unused variables.

This code is contributed under the LGPLv3+ / MPL.
From b9b6146ab0651c44f99a6a13ee85c1782f3d955b Mon Sep 17 00:00:00 2001
From: Timothy Markle <tmark...@gmail.com>
Date: Sat, 8 Feb 2014 20:11:56 +0100
Subject: [PATCH] fdo#66822 - refactor HTML export of image to bullet list

Replaced src attribute with style attribute in <ul>.
Removed invalid width, height, and align attributes.
Removed two unused variables rSize and pVert.

Change-Id: I40390bd02c7fb11a445da44d33492a59c8e6372c
---
 sw/source/filter/html/htmlatr.cxx |  3 +--
 sw/source/filter/html/htmlfly.cxx | 57 +++------------------------------------
 sw/source/filter/html/htmlnum.cxx |  4 +--
 sw/source/filter/html/wrthtml.hxx |  4 +--
 4 files changed, 7 insertions(+), 61 deletions(-)

diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 351d4ff..c691f9d 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -974,8 +974,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
         OSL_ENSURE( aNumInfo.GetNumRule(), "Wo ist die Numerierung geblieben???" );
         OSL_ENSURE( nBulletGrfLvl < MAXLEVEL, "So viele Ebenen gibt's nicht" );
         const SwNumFmt& rNumFmt = aNumInfo.GetNumRule()->Get(nBulletGrfLvl);
-        OutHTML_BulletImage( rWrt, OOO_STRING_SVTOOLS_HTML_image, rNumFmt.GetBrush(),
-                             rNumFmt.GetGraphicSize(), rNumFmt.GetGraphicOrientation() );
+        OutHTML_BulletImage( rWrt, OOO_STRING_SVTOOLS_HTML_image, rNumFmt.GetBrush() );
     }
 
     rHWrt.GetNumInfo() = aNumInfo;
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index 4c07230..7e67b99 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -1188,9 +1188,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt,
 
 Writer& OutHTML_BulletImage( Writer& rWrt,
                              const sal_Char *pTag,
-                             const SvxBrushItem* pBrush,
-                             const Size &rSize,
-                             const SwFmtVertOrient* pVertOrient )
+                             const SvxBrushItem* pBrush )
 {
     SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
 
@@ -1213,59 +1211,12 @@ Writer& OutHTML_BulletImage( Writer& rWrt,
         sOut.append('<').append(pTag);
 
     sOut.append(' ');
-    sOut.append(OOO_STRING_SVTOOLS_HTML_O_src).append("=\"").
+    sOut.append(OOO_STRING_SVTOOLS_HTML_O_style).append("=\"").
+    append("list-style-image: ").append("url(").
     append(OOO_STRING_SVTOOLS_HTML_O_data).append(":");
     rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
     HTMLOutFuncs::Out_String( rWrt.Strm(), aGraphicInBase64, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
-    sOut.append('\"');
-
-    // Groesse des Objekts Twips ohne Raender
-    Size aPixelSz( 0, 0 );
-    if( (rSize.Width() || rSize.Height()) && Application::GetDefaultDevice() )
-    {
-        aPixelSz =
-            Application::GetDefaultDevice()->LogicToPixel( rSize,
-                                                MapMode(MAP_TWIP) );
-        if( !aPixelSz.Width() && rSize.Width() )
-            aPixelSz.Width() = 1;
-        if( !aPixelSz.Height() && rSize.Height() )
-            aPixelSz.Height() = 1;
-    }
-
-    if( aPixelSz.Width() )
-    {
-        sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
-            append("=\"").append(static_cast<sal_Int32>(aPixelSz.Width())).append("\"");
-    }
-
-    if( aPixelSz.Height() )
-    {
-        sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height).
-            append("=\"").append(static_cast<sal_Int32>(aPixelSz.Height())).append("\"");
-    }
-
-    if( pVertOrient )
-    {
-        const sal_Char *pStr = 0;
-        switch( pVertOrient->GetVertOrient() )
-        {
-        case text::VertOrientation::LINE_TOP:     pStr = OOO_STRING_SVTOOLS_HTML_VA_top;        break;
-        case text::VertOrientation::CHAR_TOP:
-        case text::VertOrientation::BOTTOM:       pStr = OOO_STRING_SVTOOLS_HTML_VA_texttop;    break;  // geht nicht
-        case text::VertOrientation::LINE_CENTER:
-        case text::VertOrientation::CHAR_CENTER:  pStr = OOO_STRING_SVTOOLS_HTML_VA_absmiddle;  break;  // geht nicht
-        case text::VertOrientation::CENTER:       pStr = OOO_STRING_SVTOOLS_HTML_VA_middle;     break;
-        case text::VertOrientation::LINE_BOTTOM:
-        case text::VertOrientation::CHAR_BOTTOM:  pStr = OOO_STRING_SVTOOLS_HTML_VA_absbottom;  break;  // geht nicht
-        case text::VertOrientation::TOP:          pStr = OOO_STRING_SVTOOLS_HTML_VA_bottom;     break;
-        case text::VertOrientation::NONE:     break;
-        }
-        if( pStr )
-        {
-            sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).
-                append("=\"").append(pStr).append("\"");
-        }
-    }
+    sOut.append(");").append('\"');
 
     if (pTag)
         sOut.append('>');
diff --git a/sw/source/filter/html/htmlnum.cxx b/sw/source/filter/html/htmlnum.cxx
index 99ff3bd..d4bb297 100644
--- a/sw/source/filter/html/htmlnum.cxx
+++ b/sw/source/filter/html/htmlnum.cxx
@@ -827,9 +827,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
             rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
             OutHTML_BulletImage( rWrt,
                                     0,
-                                    rNumFmt.GetBrush(),
-                                    rNumFmt.GetGraphicSize(),
-                                    rNumFmt.GetGraphicOrientation() );
+                                    rNumFmt.GetBrush() );
         }
         else
         {
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 95bd99d..bb954e5 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -630,9 +630,7 @@ Writer& OutHTML_Image( Writer&, const SwFrmFmt& rFmt,
                        const ImageMap *pGenImgMap = 0 );
 
 Writer& OutHTML_BulletImage( Writer& rWrt, const sal_Char *pTag,
-                             const SvxBrushItem* pBrush,
-                             const Size &rSize,
-                             const SwFmtVertOrient* pVertOrient );
+                             const SvxBrushItem* pBrush );
 
 Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt );
 Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt );
-- 
1.8.3.2

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to