summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorHarri Pitkänen <hatapitk@iki.fi>2013-03-23 12:10:15 +0200
committerPetr Mladek <pmladek@suse.cz>2013-03-27 12:50:50 +0000
commitda45a0e255f77d002c35438e9c2a17fecdde6d81 (patch)
treea72670f131f569d3829f7728deb125ab441ba45b /sw
parentf5442623090dd535a1a561f1ecfdb09f2dff129b (diff)
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 Reviewed-on: https://gerrit.libreoffice.org/2950 Reviewed-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/css1atr.cxx9
-rw-r--r--sw/source/filter/html/css1kywd.cxx1
-rw-r--r--sw/source/filter/html/css1kywd.hxx1
-rw-r--r--sw/source/filter/html/wrthtml.cxx14
-rw-r--r--sw/source/filter/html/wrthtml.hxx2
-rw-r--r--sw/source/ui/config/viewopt.cxx4
6 files changed, 19 insertions, 12 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 500b66c23e56..16250505f516 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_TableCellBorderHack(SwFrmFmt const& rFrmFmt)
}
}
-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 @@ void SwHTMLWriter::OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt )
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 4117052bcb6a..ef3a0ebc7a43 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_height, "height" );
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 0b4bd5db1b44..35a048130a82 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_height, "height" );
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 fc9181df08f0..78f7e7a1bda4 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -469,15 +469,13 @@ sal_uLong SwHTMLWriter::WriteStream()
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 @@ static bool lcl_html_IsMultiColStart( const SwHTMLWriter& rHTMLWrt, sal_uLong nI
{
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 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt,
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 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd )
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 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd )
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 a506a73a2243..6d10be73b388 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -473,7 +473,7 @@ public:
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 73bed7787f60..b0003d3feee2 100644
--- a/sw/source/ui/config/viewopt.cxx
+++ b/sw/source/ui/config/viewopt.cxx
@@ -320,10 +320,10 @@ sal_uInt16 GetHtmlMode(const SwDocShell* pShell)
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;
}
}