[PATCH] Remove HTMLMODE_FRM_COLUMNS and export column-count CSS attr...
Harri Pitkänen (via_Code_Review)
gerrit at gerrit.libreoffice.org
Sat Mar 23 13:20:06 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2950
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/50/2950/1
Remove HTMLMODE_FRM_COLUMNS and export column-count CSS attribute
For multi-column sections in Writer, HTMLMODE_FRM_COLUMNS controlled
whether column settings for the section were exported to html or not.
This was disabled for Internet Explorer and enabled for other browsers.
The export was implemented using non-standard MULTICOL html element
and did not actually work in any modern browser (apparently only
some versions of Netscape have ever supported this). This patch
- exports the column count also using "column-count" CSS attribute
which is supported by latest versions of Opera and IE. Firefox and
Webkit based browsers would currently require -moz-column-count and
-webkit-column-count but I have not added these since the browsers
will likely stop requiring the prefix in the future anyway.
- removes HTMLMODE_FRM_COLUMNS conditional so that this export will
happen with all html compatibility options, including IE.
Remaining issue: Using the MULTICOL element (as opposed to DIV element)
confuses at least Opera so that it ignores all style attributes applied
on the element. But corresponding html import code in LibreOffice still
relies on MULTICOL. I will work on a separate patch to add support for
column-count CSS attribute to the import code and switch export to use
DIV instead.
Change-Id: I82a065fdda0e074fbfcd0007e6ff6e46185be3f5
---
M sfx2/inc/sfx2/htmlmode.hxx
M sw/source/filter/html/css1atr.cxx
M sw/source/filter/html/css1kywd.cxx
M sw/source/filter/html/css1kywd.hxx
M sw/source/filter/html/wrthtml.cxx
M sw/source/filter/html/wrthtml.hxx
M sw/source/ui/config/viewopt.cxx
7 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/sfx2/inc/sfx2/htmlmode.hxx b/sfx2/inc/sfx2/htmlmode.hxx
index 90af4b2..0ce8e43 100644
--- a/sfx2/inc/sfx2/htmlmode.hxx
+++ b/sfx2/inc/sfx2/htmlmode.hxx
@@ -21,7 +21,6 @@
#define HTMLMODE_ON 0x0001
#define HTMLMODE_PARA_DISTANCE 0x0004
-#define HTMLMODE_FRM_COLUMNS 0x0010
#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */
#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */
#define HTMLMODE_PARA_BLOCK 0x0100
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 500b66c..1625050 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -57,6 +57,7 @@
#include <unotools/charclass.hxx>
#include <i18npool/languagetag.hxx>
#include <charfmt.hxx>
+#include <fmtclds.hxx>
#include <fmtcol.hxx>
#include <fmtfsize.hxx>
#include <fmtornt.hxx>
@@ -2271,7 +2272,7 @@
}
}
-void SwHTMLWriter::OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt )
+void SwHTMLWriter::OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt, const SwFmtCol *pCol )
{
SwCSS1OutMode aMode( *this, CSS1_OUTMODE_STYLE_OPT_ON |
CSS1_OUTMODE_ENCODE|
@@ -2282,6 +2283,12 @@
if( SFX_ITEM_SET==rItemSet.GetItemState( RES_BACKGROUND, sal_False, &pItem ) )
OutCSS1_SvxBrush( *this, *pItem, CSS1_BACKGROUND_SECTION, 0 );
+ if (pCol)
+ {
+ OString sColumnCount(OString::number(static_cast<sal_Int32>(pCol->GetNumCols())));
+ OutCSS1_PropertyAscii(sCSS1_P_column_count, sColumnCount);
+ }
+
if( !bFirstCSS1Property )
Strm() << '\"';
}
diff --git a/sw/source/filter/html/css1kywd.cxx b/sw/source/filter/html/css1kywd.cxx
index 4117052..ef3a0eb 100644
--- a/sw/source/filter/html/css1kywd.cxx
+++ b/sw/source/filter/html/css1kywd.cxx
@@ -219,6 +219,7 @@
sal_Char CSS1_CONSTASCII_DEF( sCSS1_P_float, "float" );
+sal_Char CSS1_CONSTASCII_DEF( sCSS1_P_column_count, "column-count" );
// Strings fuer Positioning
diff --git a/sw/source/filter/html/css1kywd.hxx b/sw/source/filter/html/css1kywd.hxx
index 0b4bd5d..35a0481 100644
--- a/sw/source/filter/html/css1kywd.hxx
+++ b/sw/source/filter/html/css1kywd.hxx
@@ -229,6 +229,7 @@
extern sal_Char CSS1_CONSTASCII_DECL( sCSS1_P_float, "float" );
+extern sal_Char CSS1_CONSTASCII_DECL( sCSS1_P_column_count, "column-count" );
// Strings fuer Positioning
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index fc9181d..78f7e7a 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -469,15 +469,13 @@
return nWarn;
}
-static const SwFmtCol *lcl_html_GetFmtCol( const SwHTMLWriter& rHTMLWrt,
- const SwSection& rSection,
+static const SwFmtCol *lcl_html_GetFmtCol( const SwSection& rSection,
const SwSectionFmt& rFmt )
{
const SwFmtCol *pCol = 0;
const SfxPoolItem* pItem;
- if( rHTMLWrt.IsHTMLMode( HTMLMODE_FRM_COLUMNS ) &&
- FILE_LINK_SECTION != rSection.GetType() &&
+ if( FILE_LINK_SECTION != rSection.GetType() &&
SFX_ITEM_SET == rFmt.GetAttrSet().GetItemState(RES_COL,sal_False,&pItem) &&
((const SwFmtCol *)pItem)->GetNumCols() > 1 )
{
@@ -496,7 +494,7 @@
{
const SwSection& rSection = pSectNd->GetSection();
const SwSectionFmt *pFmt = rSection.GetFmt();
- if( pFmt && lcl_html_GetFmtCol( rHTMLWrt, rSection, *pFmt ) )
+ if( pFmt && lcl_html_GetFmtCol( rSection, *pFmt ) )
bRet = true;
}
@@ -615,7 +613,7 @@
rHTMLWrt.Strm() << sOut.makeStringAndClear().getStr();
if( rHTMLWrt.IsHTMLMode( rHTMLWrt.bCfgOutStyles ) )
- rHTMLWrt.OutCSS1_SectionFmtOptions( rFmt );
+ rHTMLWrt.OutCSS1_SectionFmtOptions( rFmt, pCol );
rHTMLWrt.Strm() << '>';
@@ -660,7 +658,7 @@
sal_uInt32 nSectSttIdx = rSectNd.GetIndex();
sal_uInt32 nSectEndIdx = rSectNd.EndOfSectionIndex();
- const SwFmtCol *pCol = lcl_html_GetFmtCol( rHTMLWrt, rSection, *pFmt );
+ const SwFmtCol *pCol = lcl_html_GetFmtCol( rSection, *pFmt );
if( pCol )
{
// If the next node is a columned section node, too, don't export
@@ -686,7 +684,7 @@
pSurrSection = &pSurrSectNd->GetSection();
pSurrFmt = pSurrSection->GetFmt();
if( pSurrFmt )
- pSurrCol = lcl_html_GetFmtCol( rHTMLWrt, *pSurrSection,
+ pSurrCol = lcl_html_GetFmtCol( *pSurrSection,
*pSurrFmt );
}
}
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index a506a73..6d10be7 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -473,7 +473,7 @@
sal_uInt32 nFrmOpts, const rtl::OString& rEndTags = rtl::OString() );
void OutCSS1_TableFrmFmtOptions( const SwFrmFmt& rFrmFmt );
void OutCSS1_TableCellBorderHack(const SwFrmFmt& rFrmFmt);
- void OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt );
+ void OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt, const SwFmtCol *pCol );
void OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, sal_uInt32 nFrmOpts,
const SdrObject *pSdrObj=0,
const SfxItemSet *pItemSet=0 );
diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx
index 73bed77..b0003d3 100644
--- a/sw/source/ui/config/viewopt.cxx
+++ b/sw/source/ui/config/viewopt.cxx
@@ -320,10 +320,10 @@
nRet |= HTMLMODE_FULL_STYLES;
break;
case HTML_CFG_NS40:
- nRet |= HTMLMODE_FRM_COLUMNS;
+ // no special features for this browser
break;
case HTML_CFG_WRITER:
- nRet |= HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES;
+ nRet |= HTMLMODE_FULL_STYLES;
break;
}
}
--
To view, visit https://gerrit.libreoffice.org/2950
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82a065fdda0e074fbfcd0007e6ff6e46185be3f5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Harri Pitkänen <hatapitk at iki.fi>
More information about the LibreOffice
mailing list