summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/source/activex/StdAfx2.h1
-rw-r--r--include/rtl/ustring.hxx23
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/source/filter/html/css1atr.cxx113
-rw-r--r--sw/source/filter/html/css1kywd.cxx215
-rw-r--r--sw/source/filter/html/css1kywd.hxx279
-rw-r--r--sw/source/filter/html/svxcss1.cxx131
-rw-r--r--sw/source/filter/html/wrthtml.hxx22
8 files changed, 277 insertions, 508 deletions
diff --git a/extensions/source/activex/StdAfx2.h b/extensions/source/activex/StdAfx2.h
index ed889271aed8..b2ab095e91f3 100644
--- a/extensions/source/activex/StdAfx2.h
+++ b/extensions/source/activex/StdAfx2.h
@@ -55,6 +55,7 @@
extern CComModule _Module;
#include <atlcom.h>
#include <atlctl.h>
+#undef min
#if defined __clang__
#pragma clang diagnostic pop
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 263cb71d74c9..c4869f43a8f0 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -35,6 +35,7 @@
#include <utility>
#if defined LIBO_INTERNAL_ONLY
+#include <algorithm>
#include <string_view>
#include <type_traits>
#endif
@@ -47,6 +48,7 @@
#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
#include "config_global.h"
+#include "o3tl/safeint.hxx"
#include "rtl/stringconcat.hxx"
#endif
@@ -1307,6 +1309,15 @@ public:
return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
}
+#if defined LIBO_INTERNAL_ONLY
+ bool equalsIgnoreAsciiCaseAscii( std::string_view asciiStr ) const
+ {
+ return o3tl::make_unsigned(pData->length) == asciiStr.length()
+ && rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+ pData->buffer, pData->length, asciiStr.data(), asciiStr.length()) == 0;
+ }
+#endif
+
/**
Compares two ASCII strings ignoring case
@@ -1330,6 +1341,18 @@ public:
return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
}
+#if defined LIBO_INTERNAL_ONLY
+ sal_Int32 compareToIgnoreAsciiCaseAscii( std::string_view asciiStr ) const
+ {
+ sal_Int32 nMax = std::min<size_t>(asciiStr.length(), std::numeric_limits<sal_Int32>::max());
+ sal_Int32 result = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+ pData->buffer, pData->length, asciiStr.data(), nMax);
+ if (result == 0 && o3tl::make_unsigned(pData->length) < asciiStr.length())
+ result = -1;
+ return result;
+ }
+#endif
+
/**
Perform an ASCII lowercase comparison of two strings.
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 8a79be4f9e41..5abd6bb541d7 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -536,7 +536,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/filter/basflt/shellio \
sw/source/filter/html/SwAppletImpl \
sw/source/filter/html/css1atr \
- sw/source/filter/html/css1kywd \
sw/source/filter/html/htmlatr \
sw/source/filter/html/htmlbas \
sw/source/filter/html/htmlcss1 \
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 349891c0eb92..0f39024e11e3 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -254,7 +254,7 @@ public:
}
-void SwHTMLWriter::OutCSS1_Property( const char *pProp,
+void SwHTMLWriter::OutCSS1_Property( std::string_view pProp,
std::string_view sVal,
const OUString *pSVal,
std::optional<sw::Css1Background> oMode )
@@ -262,7 +262,7 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp,
OString aPropertyValue(sVal);
if (aPropertyValue.isEmpty() && pSVal)
{
- aPropertyValue = pSVal->toUtf8();
+ aPropertyValue = OUStringToOString(*pSVal, RTL_TEXTENCODING_UTF8);
}
if (IgnorePropertyForReqIF(mbReqIF, pProp, aPropertyValue, oMode))
return;
@@ -373,10 +373,7 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp,
else
{
// for STYLE-Tag print string directly
- if( !sVal.empty() )
- sOut.append(sVal);
- else if( pSVal )
- sOut.append(OUStringToOString(*pSVal, RTL_TEXTENCODING_UTF8));
+ sOut.append(aPropertyValue);
}
if (!sOut.isEmpty())
@@ -395,7 +392,7 @@ static void AddUnitPropertyValue(OStringBuffer &rOut, tools::Long nVal,
o3tl::Length eTo;
int nFac; // used to get specific number of decimals
- const char *pUnit;
+ std::string_view pUnit;
switch( eUnit )
{
case FieldUnit::MM_100TH:
@@ -461,14 +458,14 @@ static void AddUnitPropertyValue(OStringBuffer &rOut, tools::Long nVal,
rOut.append(pUnit);
}
-void SwHTMLWriter::OutCSS1_UnitProperty( const char *pProp, tools::Long nVal )
+void SwHTMLWriter::OutCSS1_UnitProperty( std::string_view pProp, tools::Long nVal )
{
OStringBuffer sOut;
AddUnitPropertyValue(sOut, nVal, m_eCSS1Unit);
OutCSS1_PropertyAscii(pProp, sOut);
}
-void SwHTMLWriter::OutCSS1_PixelProperty( const char *pProp, tools::Long nVal,
+void SwHTMLWriter::OutCSS1_PixelProperty( std::string_view pProp, tools::Long nVal,
bool bVert )
{
OString sOut(OString::number(ToPixel(nVal,bVert)) + sCSS1_UNIT_px);
@@ -1124,7 +1121,7 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem,
if( bContainsKeyword || !bGeneric )
return;
- const char *pStr = nullptr;
+ std::string_view pStr;
switch( rFontItem.GetFamily() )
{
case FAMILY_ROMAN: pStr = sCSS1_PV_serif; break;
@@ -1136,7 +1133,7 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem,
;
}
- if( pStr )
+ if( !pStr.empty() )
{
if( !rNames.isEmpty() )
rNames += ", ";
@@ -1616,14 +1613,14 @@ static SwHTMLWriter& OutCSS1_SwPageDesc( SwHTMLWriter& rWrt, const SwPageDesc& r
if( bPseudo )
{
- const char *pPseudo = nullptr;
+ std::string_view pPseudo;
switch( rPageDesc.GetPoolFormatId() )
{
case RES_POOLPAGE_FIRST: pPseudo = sCSS1_first; break;
case RES_POOLPAGE_LEFT: pPseudo = sCSS1_left; break;
case RES_POOLPAGE_RIGHT: pPseudo = sCSS1_right; break;
}
- if( pPseudo )
+ if( !pPseudo.empty() )
aSelector += ":" + OStringToOUString( pPseudo, RTL_TEXTENCODING_ASCII_US );
}
@@ -1864,7 +1861,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatOptions( const SwFrameFormat& rFrameFormat
if( !(nFrameOpts & HtmlFrmOpts::Align) )
{
// float
- const char *pStr = text::HoriOrientation::RIGHT==rHoriOri.GetHoriOrient()
+ std::string_view pStr = text::HoriOrientation::RIGHT==rHoriOri.GetHoriOrient()
? sCSS1_PV_right
: sCSS1_PV_left;
OutCSS1_PropertyAscii( sCSS1_P_float, pStr );
@@ -2219,8 +2216,8 @@ static SwHTMLWriter& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( SwHTMLWriter& rWrt,
const SvxBlinkItem *pBItem )
{
bool bNone = false;
+ OStringBuffer sOut;
- const char *pUStr = nullptr;
if( pUItem )
{
switch( pUItem->GetLineStyle() )
@@ -2237,13 +2234,12 @@ static SwHTMLWriter& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( SwHTMLWriter& rWrt,
// a STYLE-Options, and must not be written as Hint
OSL_ENSURE( !rWrt.IsCSS1Source(CSS1_OUTMODE_HINT) || rWrt.mbReqIF,
"write underline as Hint?" );
- pUStr = sCSS1_PV_underline;
+ sOut.append(sCSS1_PV_underline);
}
break;
}
}
- const char *pOStr = nullptr;
if( pOItem )
{
switch( pOItem->GetLineStyle() )
@@ -2260,13 +2256,14 @@ static SwHTMLWriter& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( SwHTMLWriter& rWrt,
// a STYLE-Options, and must not be written as Hint
OSL_ENSURE( !rWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"write overline as Hint?" );
- pOStr = sCSS1_PV_overline;
+ if (!sOut.isEmpty())
+ sOut.append(' ');
+ sOut.append(sCSS1_PV_overline);
}
break;
}
}
- const char *pCOStr = nullptr;
if( pCOItem )
{
switch( pCOItem->GetStrikeout() )
@@ -2283,13 +2280,14 @@ static SwHTMLWriter& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( SwHTMLWriter& rWrt,
// a STYLE-Options, and must not be written as Hint
OSL_ENSURE( !rWrt.IsCSS1Source(CSS1_OUTMODE_HINT) || rWrt.mbReqIF,
"write crossedOut as Hint?" );
- pCOStr = sCSS1_PV_line_through;
+ if (!sOut.isEmpty())
+ sOut.append(' ');
+ sOut.append(sCSS1_PV_line_through);
}
break;
}
}
- const char *pBStr = nullptr;
if( pBItem )
{
if( !pBItem->GetValue() )
@@ -2302,35 +2300,12 @@ static SwHTMLWriter& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( SwHTMLWriter& rWrt,
// a STYLE-Options, and must not be written as Hint
OSL_ENSURE( !rWrt.IsCSS1Source(CSS1_OUTMODE_HINT),
"write blink as Hint?" );
- pBStr = sCSS1_PV_blink;
+ if (!sOut.isEmpty())
+ sOut.append(' ');
+ sOut.append(sCSS1_PV_blink);
}
}
- OStringBuffer sOut;
- if( pUStr )
- sOut.append(pUStr);
-
- if( pOStr )
- {
- if (!sOut.isEmpty())
- sOut.append(' ');
- sOut.append(pOStr);
- }
-
- if( pCOStr )
- {
- if (!sOut.isEmpty())
- sOut.append(' ');
- sOut.append(pCOStr);
- }
-
- if( pBStr )
- {
- if (!sOut.isEmpty())
- sOut.append(' ');
- sOut.append(pBStr);
- }
-
if (!sOut.isEmpty())
rWrt.OutCSS1_PropertyAscii( sCSS1_P_text_decoration, sOut );
else if( bNone )
@@ -2460,7 +2435,7 @@ static SwHTMLWriter& OutCSS1_SvxPosture( SwHTMLWriter& rWrt, const SfxPoolItem&
if( !rWrt.IsCSS1Script( nScript ) )
return rWrt;
- const char *pStr = nullptr;
+ std::string_view pStr;
switch( static_cast<const SvxPostureItem&>(rHt).GetPosture() )
{
case ITALIC_NONE: pStr = sCSS1_PV_normal; break;
@@ -2479,7 +2454,7 @@ static SwHTMLWriter& OutCSS1_SvxPosture( SwHTMLWriter& rWrt, const SfxPoolItem&
;
}
- if( pStr )
+ if( !pStr.empty() )
rWrt.OutCSS1_PropertyAscii( sCSS1_P_font_style, pStr );
return rWrt;
@@ -2586,7 +2561,7 @@ static SwHTMLWriter& OutCSS1_SvxFontWeight( SwHTMLWriter& rWrt, const SfxPoolIte
if( !rWrt.IsCSS1Script( nScript ) )
return rWrt;
- const char *pStr = nullptr;
+ std::string_view pStr;
switch( static_cast<const SvxWeightItem&>(rHt).GetWeight() )
{
case WEIGHT_ULTRALIGHT: pStr = sCSS1_PV_extra_light; break;
@@ -2609,7 +2584,7 @@ static SwHTMLWriter& OutCSS1_SvxFontWeight( SwHTMLWriter& rWrt, const SfxPoolIte
pStr = sCSS1_PV_normal;
}
- if( pStr )
+ if( !pStr.empty() )
rWrt.OutCSS1_PropertyAscii( sCSS1_P_font_weight, pStr );
return rWrt;
@@ -2686,7 +2661,7 @@ static SwHTMLWriter& OutCSS1_SvxAdjust( SwHTMLWriter& rWrt, const SfxPoolItem& r
!rWrt.m_bNoAlign)
return rWrt;
- const char* pStr = nullptr;
+ std::string_view pStr;
switch( static_cast<const SvxAdjustItem&>(rHt).GetAdjust() )
{
case SvxAdjust::Left: pStr = sCSS1_PV_left; break;
@@ -2697,7 +2672,7 @@ static SwHTMLWriter& OutCSS1_SvxAdjust( SwHTMLWriter& rWrt, const SfxPoolItem& r
;
}
- if( pStr )
+ if( !pStr.empty() )
rWrt.OutCSS1_PropertyAscii( sCSS1_P_text_align, pStr );
return rWrt;
@@ -2705,7 +2680,7 @@ static SwHTMLWriter& OutCSS1_SvxAdjust( SwHTMLWriter& rWrt, const SfxPoolItem& r
static SwHTMLWriter& OutCSS1_SvxFormatSplit( SwHTMLWriter& rWrt, const SfxPoolItem& rHt )
{
- const char *pStr = static_cast<const SvxFormatSplitItem&>(rHt).GetValue()
+ std::string_view pStr = static_cast<const SvxFormatSplitItem&>(rHt).GetValue()
? sCSS1_PV_auto
: sCSS1_PV_avoid;
rWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_inside, pStr );
@@ -2715,7 +2690,7 @@ static SwHTMLWriter& OutCSS1_SvxFormatSplit( SwHTMLWriter& rWrt, const SfxPoolIt
static SwHTMLWriter& OutCSS1_SwFormatLayoutSplit( SwHTMLWriter& rWrt, const SfxPoolItem& rHt )
{
- const char *pStr = static_cast<const SwFormatLayoutSplit&>(rHt).GetValue()
+ std::string_view pStr = static_cast<const SwFormatLayoutSplit&>(rHt).GetValue()
? sCSS1_PV_auto
: sCSS1_PV_avoid;
rWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_inside, pStr );
@@ -2972,8 +2947,8 @@ static SwHTMLWriter& OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( SwHTMLW
if( !rWrt.IsHTMLMode(HTMLMODE_PRINT_EXT) )
return rWrt;
- const char *pBreakBefore = nullptr;
- const char *pBreakAfter = nullptr;
+ std::string_view pBreakBefore;
+ std::string_view pBreakAfter;
if( pKeepItem )
{
@@ -2985,7 +2960,7 @@ static SwHTMLWriter& OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( SwHTMLW
{
case SvxBreak::NONE:
pBreakBefore = sCSS1_PV_auto;
- if( !pBreakAfter )
+ if( pBreakAfter.empty() )
pBreakAfter = sCSS1_PV_auto;
break;
@@ -3013,7 +2988,7 @@ static SwHTMLWriter& OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( SwHTMLW
default: pBreakBefore = sCSS1_PV_always; break;
}
}
- else if( !pBreakBefore )
+ else if( pBreakBefore.empty() )
{
pBreakBefore = sCSS1_PV_auto;
}
@@ -3023,10 +2998,10 @@ static SwHTMLWriter& OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( SwHTMLW
// No page break when writing only a fragment.
return rWrt;
- if( pBreakBefore )
+ if( !pBreakBefore.empty() )
rWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_before,
pBreakBefore );
- if( pBreakAfter )
+ if( !pBreakAfter.empty() )
rWrt.OutCSS1_PropertyAscii( sCSS1_P_page_break_after,
pBreakAfter );
@@ -3124,7 +3099,7 @@ static SwHTMLWriter& OutCSS1_SvxBrush( SwHTMLWriter& rWrt, const SfxPoolItem& rH
return rWrt;
// if necessary, add the orientation of the Graphic
- const char *pRepeat = nullptr, *pHori = nullptr, *pVert = nullptr;
+ std::string_view pRepeat, pHori, pVert;
if( pGrf || !aLink.isEmpty() )
{
if( GPOS_TILED==ePos )
@@ -3181,7 +3156,7 @@ static SwHTMLWriter& OutCSS1_SvxBrush( SwHTMLWriter& rWrt, const SfxPoolItem& rH
;
}
- if( pHori || pVert )
+ if( !pHori.empty() || !pVert.empty() )
pRepeat = sCSS1_PV_no_repeat;
}
}
@@ -3219,16 +3194,16 @@ static SwHTMLWriter& OutCSS1_SvxBrush( SwHTMLWriter& rWrt, const SfxPoolItem& rH
aLink) + ")";
}
- if( pRepeat )
+ if( !pRepeat.empty() )
{
sOut += " " + OStringToOUString(pRepeat, RTL_TEXTENCODING_ASCII_US);
}
- if( pHori )
+ if( !pHori.empty() )
{
sOut += " " + OStringToOUString(pHori, RTL_TEXTENCODING_ASCII_US);
}
- if( pVert )
+ if( !pVert.empty() )
{
sOut += " " + OStringToOUString(pVert, RTL_TEXTENCODING_ASCII_US);
}
@@ -3247,7 +3222,7 @@ static SwHTMLWriter& OutCSS1_SvxBrush( SwHTMLWriter& rWrt, const SfxPoolItem& rH
}
static void OutCSS1_SvxBorderLine( SwHTMLWriter& rWrt,
- const char *pProperty,
+ std::string_view pProperty,
const SvxBorderLine *pLine )
{
if( !pLine || pLine->isEmpty() )
@@ -3400,7 +3375,7 @@ static SwHTMLWriter& OutCSS1_SvxFrameDirection( SwHTMLWriter& rWrt, const SfxPoo
SvxFrameDirection nDir =
static_cast< const SvxFrameDirectionItem& >( rHt ).GetValue();
- const char* pStr = nullptr;
+ std::string_view pStr;
switch( nDir )
{
case SvxFrameDirection::Horizontal_LR_TB:
@@ -3417,7 +3392,7 @@ static SwHTMLWriter& OutCSS1_SvxFrameDirection( SwHTMLWriter& rWrt, const SfxPoo
default: break;
}
- if( pStr )
+ if( !pStr.empty() )
rWrt.OutCSS1_PropertyAscii( sCSS1_P_direction, pStr );
return rWrt;
diff --git a/sw/source/filter/html/css1kywd.cxx b/sw/source/filter/html/css1kywd.cxx
deleted file mode 100644
index 12d70903ad39..000000000000
--- a/sw/source/filter/html/css1kywd.cxx
+++ /dev/null
@@ -1,215 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "css1kywd.hxx"
-
-const char* const sCSS_mimetype = "text/css";
-
-const char* const sCSS1_page = "page";
-//const char* const sCSS1_media = "media";
-
-const char* const sCSS1_link = "link";
-const char* const sCSS1_visited = "visited";
-const char* const sCSS1_first_letter = "first-letter";
-
-const char* const sCSS1_left = "left";
-const char* const sCSS1_right = "right";
-const char* const sCSS1_first = "first";
-
-const char* const sCSS1_url = "url";
-
-const char* const sCSS1_UNIT_pt = "pt";
-const char* const sCSS1_UNIT_mm = "mm";
-const char* const sCSS1_UNIT_cm = "cm";
-const char* const sCSS1_UNIT_pc = "pc";
-const char* const sCSS1_UNIT_inch = "in";
-const char* const sCSS1_UNIT_px = "px";
-
-// Strings for font properties
-
-const char* const sCSS1_P_font_family = "font-family";
-
-const char* const sCSS1_PV_serif = "serif";
-const char* const sCSS1_PV_sans_serif = "sans-serif";
-const char* const sCSS1_PV_cursive = "cursive";
-const char* const sCSS1_PV_fantasy = "fantasy";
-const char* const sCSS1_PV_monospace = "monospace";
-
-const char* const sCSS1_P_font_style = "font-style";
-
-const char* const sCSS1_PV_normal = "normal";
-const char* const sCSS1_PV_italic = "italic";
-const char* const sCSS1_PV_oblique = "oblique";
-
-const char* const sCSS1_P_font_variant = "font-variant";
-
-//const char* const sCSS1_PV_normal = "normal";
-const char* const sCSS1_PV_small_caps = "small-caps";
-
-const char* const sCSS1_P_font_weight = "font-weight";
-
-const char* const sCSS1_PV_extra_light = "extra-light";
-const char* const sCSS1_PV_light = "light";
-const char* const sCSS1_PV_demi_light = "demi-light";
-//const char* const sCSS1_PV_medium = "medium";
-const char* const sCSS1_PV_demi_bold = "demi-bold";
-const char* const sCSS1_PV_bold = "bold";
-const char* const sCSS1_PV_extra_bold = "extra-bold";
-
-const char* const sCSS1_P_text_transform = "text-transform";
-
-const char* const sCSS1_PV_capitalize = "capitalize";
-const char* const sCSS1_PV_uppercase = "uppercase";
-const char* const sCSS1_PV_lowercase = "lowercase";
-
-const char* const sCSS1_P_font_size = "font-size";
-
-const char* const sCSS1_P_font = "font";
-
-// Strings for color and background properties
-
-const char* const sCSS1_P_color = "color";
-
-const char* const sCSS1_P_background = "background";
-const char* const sCSS1_P_background_color = "background-color";
-
-const char* const sCSS1_PV_transparent = "transparent";
-
-const char* const sCSS1_PV_repeat = "repeat";
-const char* const sCSS1_PV_no_repeat = "no-repeat";
-
-const char* const sCSS1_PV_top = "top";
-const char* const sCSS1_PV_middle = "middle";
-const char* const sCSS1_PV_bottom = "bottom";
-
-const char* const sCSS1_PV_scroll = "scroll";
-
-// Strings for text properties
-
-const char* const sCSS1_P_letter_spacing = "letter-spacing";
-
-const char* const sCSS1_P_text_decoration = "text-decoration";
-
-const char* const sCSS1_PV_none = "none";
-const char* const sCSS1_PV_underline = "underline";
-const char* const sCSS1_PV_overline = "overline";
-const char* const sCSS1_PV_line_through = "line-through";
-const char* const sCSS1_PV_blink = "blink";
-
-const char* const sCSS1_P_text_align = "text-align";
-
-const char* const sCSS1_PV_left = "left";
-const char* const sCSS1_PV_center = "center";
-const char* const sCSS1_PV_right = "right";
-const char* const sCSS1_PV_justify = "justify";
-
-const char* const sCSS1_P_text_indent = "text-indent";
-
-const char* const sCSS1_P_line_height = "line-height";
-const char* const sCSS1_P_list_style_type = "list-style-type";
-
-// Strings for box properties
-
-const char* const sCSS1_P_margin_left = "margin-left";
-const char* const sCSS1_P_margin_right = "margin-right";
-const char* const sCSS1_P_margin_top = "margin-top";
-const char* const sCSS1_P_margin_bottom = "margin-bottom";
-const char* const sCSS1_P_margin = "margin";
-
-const char* const sCSS1_P_padding_top = "padding-top";
-const char* const sCSS1_P_padding_bottom = "padding-bottom";
-const char* const sCSS1_P_padding_left = "padding-left";
-const char* const sCSS1_P_padding_right = "padding-right";
-const char* const sCSS1_P_padding = "padding";
-
-const char* const sCSS1_PV_auto = "auto";
-
-const char* const sCSS1_P_border_left_width = "border-left-width";
-const char* const sCSS1_P_border_right_width = "border-right-width";
-const char* const sCSS1_P_border_top_width = "border-top-width";
-const char* const sCSS1_P_border_bottom_width = "border-bottom-width";
-const char* const sCSS1_P_border_width = "border-width";
-const char* const sCSS1_P_border_color = "border-color";
-const char* const sCSS1_P_border_style = "border-style";
-const char* const sCSS1_P_border_left = "border-left";
-const char* const sCSS1_P_border_right = "border-right";
-const char* const sCSS1_P_border_top = "border-top";
-const char* const sCSS1_P_border_bottom = "border-bottom";
-const char* const sCSS1_P_border = "border";
-
-//const char* const sCSS1_PV_none = "none";
-const char* const sCSS1_PV_dotted = "dotted";
-const char* const sCSS1_PV_dashed = "dashed";
-const char* const sCSS1_PV_solid = "solid";
-const char* const sCSS1_PV_double = "double";
-const char* const sCSS1_PV_groove = "groove";
-const char* const sCSS1_PV_ridge = "ridge";
-const char* const sCSS1_PV_inset = "inset";
-const char* const sCSS1_PV_outset = "outset";
-
-const char* const sCSS1_P_width = "width";
-const char* const sCSS1_P_max_width = "max-width";
-
-const char* const sCSS1_P_height = "height";
-
-const char* const sCSS1_P_float = "float";
-
-const char* const sCSS1_P_column_count = "column-count";
-const char* const sCSS1_P_dir = "dir";
-
-// Strings for positioning
-
-const char* const sCSS1_P_position = "position";
-
-const char* const sCSS1_PV_absolute = "absolute";
-
-const char* const sCSS1_P_left = "left";
-
-const char* const sCSS1_P_top = "top";
-
-// Strings for printing extensions
-
-const char* const sCSS1_P_page_break_before = "page-break-before";
-const char* const sCSS1_P_page_break_after = "page-break-after";
-const char* const sCSS1_P_page_break_inside = "page-break-inside";
-const char* const sCSS1_P_size = "size";
-const char* const sCSS1_P_widows = "widows";
-const char* const sCSS1_P_visibility = "visibility";
-const char* const sCSS1_P_orphans = "orphans";
-//const char* const sCSS1_P_marks = "marks";
-
-const char* const sCSS1_PV_always = "always";
-const char* const sCSS1_PV_avoid = "avoid";
-
-const char* const sCSS1_PV_portrait = "portrait";
-const char* const sCSS1_PV_landscape = "landscape";
-
-//const char* const sCSS1_PV_crop = "crop";
-//const char* const sCSS1_PV_cross = "cross";
-
-const char* const sCSS1_P_so_language = "so-language";
-
-const char* const sCSS1_P_direction = "direction";
-const char* const sCSS1_PV_ltr = "ltr";
-const char* const sCSS1_PV_rtl = "rtl";
-const char* const sCSS1_PV_inherit = "inherit";
-
-const char* const sCSS1_P_display = "display";
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/css1kywd.hxx b/sw/source/filter/html/css1kywd.hxx
index 67d2c9e2802c..5d84e3825191 100644
--- a/sw/source/filter/html/css1kywd.hxx
+++ b/sw/source/filter/html/css1kywd.hxx
@@ -20,197 +20,202 @@
#ifndef INCLUDED_SW_SOURCE_FILTER_HTML_CSS1KYWD_HXX
#define INCLUDED_SW_SOURCE_FILTER_HTML_CSS1KYWD_HXX
-extern const char* const sCSS_mimetype;
+#include <sal/config.h>
-extern const char* const sCSS1_page;
+#include <string_view>
-extern const char* const sCSS1_link;
-extern const char* const sCSS1_visited;
-extern const char* const sCSS1_first_letter;
+constexpr inline std::string_view sCSS_mimetype = "text/css";
-extern const char* const sCSS1_left;
-extern const char* const sCSS1_right;
-extern const char* const sCSS1_first;
+constexpr inline std::string_view sCSS1_page = "page";
+//constexpr inline std::string_view sCSS1_media = "media";
-extern const char* const sCSS1_url;
+constexpr inline std::string_view sCSS1_link = "link";
+constexpr inline std::string_view sCSS1_visited = "visited";
+constexpr inline std::string_view sCSS1_first_letter = "first-letter";
-extern const char* const sCSS1_UNIT_pt;
-extern const char* const sCSS1_UNIT_mm;
-extern const char* const sCSS1_UNIT_cm;
-extern const char* const sCSS1_UNIT_pc;
-extern const char* const sCSS1_UNIT_inch;
-extern const char* const sCSS1_UNIT_px;
+constexpr inline std::string_view sCSS1_left = "left";
+constexpr inline std::string_view sCSS1_right = "right";
+constexpr inline std::string_view sCSS1_first = "first";
+
+constexpr inline std::string_view sCSS1_url = "url";
+
+constexpr inline std::string_view sCSS1_UNIT_pt = "pt";
+constexpr inline std::string_view sCSS1_UNIT_mm = "mm";
+constexpr inline std::string_view sCSS1_UNIT_cm = "cm";
+constexpr inline std::string_view sCSS1_UNIT_pc = "pc";
+constexpr inline std::string_view sCSS1_UNIT_inch = "in";
+constexpr inline std::string_view sCSS1_UNIT_px = "px";
// Strings for font properties
-extern const char* const sCSS1_P_font_family;
+constexpr inline std::string_view sCSS1_P_font_family = "font-family";
-extern const char* const sCSS1_PV_serif;
-extern const char* const sCSS1_PV_sans_serif;
-extern const char* const sCSS1_PV_cursive;
-extern const char* const sCSS1_PV_fantasy;
-extern const char* const sCSS1_PV_monospace;
+constexpr inline std::string_view sCSS1_PV_serif = "serif";
+constexpr inline std::string_view sCSS1_PV_sans_serif = "sans-serif";
+constexpr inline std::string_view sCSS1_PV_cursive = "cursive";
+constexpr inline std::string_view sCSS1_PV_fantasy = "fantasy";
+constexpr inline std::string_view sCSS1_PV_monospace = "monospace";
-extern const char* const sCSS1_P_font_style;
+constexpr inline std::string_view sCSS1_P_font_style = "font-style";
-extern const char* const sCSS1_PV_normal;
-extern const char* const sCSS1_PV_italic;
-extern const char* const sCSS1_PV_oblique;
+constexpr inline std::string_view sCSS1_PV_normal = "normal";
+constexpr inline std::string_view sCSS1_PV_italic = "italic";
+constexpr inline std::string_view sCSS1_PV_oblique = "oblique";
-extern const char* const sCSS1_P_font_variant;
+constexpr inline std::string_view sCSS1_P_font_variant = "font-variant";
-//extern const char* const sCSS1_PV_normal;
-extern const char* const sCSS1_PV_small_caps;
+//constexpr inline std::string_view sCSS1_PV_normal = "normal";
+constexpr inline std::string_view sCSS1_PV_small_caps = "small-caps";
-extern const char* const sCSS1_P_text_transform;
+constexpr inline std::string_view sCSS1_P_text_transform = "text-transform";
-extern const char* const sCSS1_PV_capitalize;
-extern const char* const sCSS1_PV_uppercase;
-extern const char* const sCSS1_PV_lowercase;
+constexpr inline std::string_view sCSS1_PV_capitalize = "capitalize";
+constexpr inline std::string_view sCSS1_PV_uppercase = "uppercase";
+constexpr inline std::string_view sCSS1_PV_lowercase = "lowercase";
-extern const char* const sCSS1_P_font_weight;
+constexpr inline std::string_view sCSS1_P_font_weight = "font-weight";
-extern const char* const sCSS1_PV_extra_light;
-extern const char* const sCSS1_PV_light;
-extern const char* const sCSS1_PV_demi_light;
-//extern const char* const sCSS1_PV_medium;
-extern const char* const sCSS1_PV_demi_bold;
-extern const char* const sCSS1_PV_bold;
-extern const char* const sCSS1_PV_extra_bold;
+constexpr inline std::string_view sCSS1_PV_extra_light = "extra-light";
+constexpr inline std::string_view sCSS1_PV_light = "light";
+constexpr inline std::string_view sCSS1_PV_demi_light = "demi-light";
+//constexpr inline std::string_view sCSS1_PV_medium = "medium";
+constexpr inline std::string_view sCSS1_PV_demi_bold = "demi-bold";
+constexpr inline std::string_view sCSS1_PV_bold = "bold";
+constexpr inline std::string_view sCSS1_PV_extra_bold = "extra-bold";
-extern const char* const sCSS1_P_font_size;
+constexpr inline std::string_view sCSS1_P_font_size = "font-size";
-extern const char* const sCSS1_P_font;
+constexpr inline std::string_view sCSS1_P_font = "font";
// Strings for color and background properties
-extern const char* const sCSS1_P_color;
+constexpr inline std::string_view sCSS1_P_color = "color";
-extern const char* const sCSS1_P_background;
-extern const char* const sCSS1_P_background_color;
+constexpr inline std::string_view sCSS1_P_background = "background";
+constexpr inline std::string_view sCSS1_P_background_color = "background-color";
-extern const char* const sCSS1_PV_transparent;
+constexpr inline std::string_view sCSS1_PV_transparent = "transparent";
-extern const char* const sCSS1_PV_repeat;
-extern const char* const sCSS1_PV_no_repeat;
+constexpr inline std::string_view sCSS1_PV_repeat = "repeat";
+constexpr inline std::string_view sCSS1_PV_no_repeat = "no-repeat";
-extern const char* const sCSS1_PV_top;
-extern const char* const sCSS1_PV_middle;
-extern const char* const sCSS1_PV_bottom;
+constexpr inline std::string_view sCSS1_PV_top = "top";
+constexpr inline std::string_view sCSS1_PV_middle = "middle";
+constexpr inline std::string_view sCSS1_PV_bottom = "bottom";
-extern const char* const sCSS1_PV_scroll;
+constexpr inline std::string_view sCSS1_PV_scroll = "scroll";
// Strings for text properties
-extern const char* const sCSS1_P_letter_spacing;
+constexpr inline std::string_view sCSS1_P_letter_spacing = "letter-spacing";
-extern const char* const sCSS1_P_text_decoration;
+constexpr inline std::string_view sCSS1_P_text_decoration = "text-decoration";
-extern const char* const sCSS1_PV_none;
-extern const char* const sCSS1_PV_underline;
-extern const char* const sCSS1_PV_overline;
-extern const char* const sCSS1_PV_line_through;
-extern const char* const sCSS1_PV_blink;
+constexpr inline std::string_view sCSS1_PV_none = "none";
+constexpr inline std::string_view sCSS1_PV_underline = "underline";
+constexpr inline std::string_view sCSS1_PV_overline = "overline";
+constexpr inline std::string_view sCSS1_PV_line_through = "line-through";
+constexpr inline std::string_view sCSS1_PV_blink = "blink";
-extern const char* const sCSS1_P_text_align;
+constexpr inline std::string_view sCSS1_P_text_align = "text-align";
-extern const char* const sCSS1_PV_left;
-extern const char* const sCSS1_PV_center;
-extern const char* const sCSS1_PV_right;
-extern const char* const sCSS1_PV_justify;
+constexpr inline std::string_view sCSS1_PV_left = "left";
+constexpr inline std::string_view sCSS1_PV_center = "center";
+constexpr inline std::string_view sCSS1_PV_right = "right";
+constexpr inline std::string_view sCSS1_PV_justify = "justify";
-extern const char* const sCSS1_P_text_indent;
+constexpr inline std::string_view sCSS1_P_text_indent = "text-indent";
-extern const char* const sCSS1_P_line_height;
+constexpr inline std::string_view sCSS1_P_line_height = "line-height";
-extern const char* const sCSS1_P_list_style_type;
+constexpr inline std::string_view sCSS1_P_list_style_type = "list-style-type";
// Strings for box properties
-extern const char* const sCSS1_P_margin_left;
-extern const char* const sCSS1_P_margin_right;
-extern const char* const sCSS1_P_margin_top;
-extern const char* const sCSS1_P_margin_bottom;
-extern const char* const sCSS1_P_margin;
-
-extern const char* const sCSS1_P_padding_top;
-extern const char* const sCSS1_P_padding_bottom;
-extern const char* const sCSS1_P_padding_left;
-extern const char* const sCSS1_P_padding_right;
-extern const char* const sCSS1_P_padding;
-
-extern const char* const sCSS1_PV_auto;
-
-extern const char* const sCSS1_P_border_left_width;
-extern const char* const sCSS1_P_border_right_width;
-extern const char* const sCSS1_P_border_top_width;
-extern const char* const sCSS1_P_border_bottom_width;
-extern const char* const sCSS1_P_border_width;
-extern const char* const sCSS1_P_border_color;
-extern const char* const sCSS1_P_border_style;
-extern const char* const sCSS1_P_border_left;
-extern const char* const sCSS1_P_border_right;
-extern const char* const sCSS1_P_border_top;
-extern const char* const sCSS1_P_border_bottom;
-extern const char* const sCSS1_P_border;
-
-//extern const char* const sCSS1_PV_none;
-extern const char* const sCSS1_PV_dotted;
-extern const char* const sCSS1_PV_dashed;
-extern const char* const sCSS1_PV_solid;
-extern const char* const sCSS1_PV_double;
-extern const char* const sCSS1_PV_groove;
-extern const char* const sCSS1_PV_ridge;
-extern const char* const sCSS1_PV_inset;
-extern const char* const sCSS1_PV_outset;
-
-extern const char* const sCSS1_P_width;
-extern const char* const sCSS1_P_max_width;
-
-extern const char* const sCSS1_P_height;
-
-extern const char* const sCSS1_P_float;
-
-extern const char* const sCSS1_P_column_count;
-extern const char* const sCSS1_P_dir;
+constexpr inline std::string_view sCSS1_P_margin_left = "margin-left";
+constexpr inline std::string_view sCSS1_P_margin_right = "margin-right";
+constexpr inline std::string_view sCSS1_P_margin_top = "margin-top";
+constexpr inline std::string_view sCSS1_P_margin_bottom = "margin-bottom";
+constexpr inline std::string_view sCSS1_P_margin = "margin";
+
+constexpr inline std::string_view sCSS1_P_padding_top = "padding-top";
+constexpr inline std::string_view sCSS1_P_padding_bottom = "padding-bottom";
+constexpr inline std::string_view sCSS1_P_padding_left = "padding-left";
+constexpr inline std::string_view sCSS1_P_padding_right = "padding-right";
+constexpr inline std::string_view sCSS1_P_padding = "padding";
+
+constexpr inline std::string_view sCSS1_PV_auto = "auto";
+
+constexpr inline std::string_view sCSS1_P_border_left_width = "border-left-width";
+constexpr inline std::string_view sCSS1_P_border_right_width = "border-right-width";
+constexpr inline std::string_view sCSS1_P_border_top_width = "border-top-width";
+constexpr inline std::string_view sCSS1_P_border_bottom_width = "border-bottom-width";
+constexpr inline std::string_view sCSS1_P_border_width = "border-width";
+constexpr inline std::string_view sCSS1_P_border_color = "border-color";
+constexpr inline std::string_view sCSS1_P_border_style = "border-style";
+constexpr inline std::string_view sCSS1_P_border_left = "border-left";
+constexpr inline std::string_view sCSS1_P_border_right = "border-right";
+constexpr inline std::string_view sCSS1_P_border_top = "border-top";
+constexpr inline std::string_view sCSS1_P_border_bottom = "border-bottom";
+constexpr inline std::string_view sCSS1_P_border = "border";
+
+//constexpr inline std::string_view sCSS1_PV_none = "none";
+constexpr inline std::string_view sCSS1_PV_dotted = "dotted";
+constexpr inline std::string_view sCSS1_PV_dashed = "dashed";
+constexpr inline std::string_view sCSS1_PV_solid = "solid";
+constexpr inline std::string_view sCSS1_PV_double = "double";
+constexpr inline std::string_view sCSS1_PV_groove = "groove";
+constexpr inline std::string_view sCSS1_PV_ridge = "ridge";
+constexpr inline std::string_view sCSS1_PV_inset = "inset";
+constexpr inline std::string_view sCSS1_PV_outset = "outset";
+
+constexpr inline std::string_view sCSS1_P_width = "width";
+constexpr inline std::string_view sCSS1_P_max_width = "max-width";
+
+constexpr inline std::string_view sCSS1_P_height = "height";
+
+constexpr inline std::string_view sCSS1_P_float = "float";
+
+constexpr inline std::string_view sCSS1_P_column_count = "column-count";
+constexpr inline std::string_view sCSS1_P_dir = "dir";
// Strings for positioning
-extern const char* const sCSS1_P_position;
+constexpr inline std::string_view sCSS1_P_position = "position";
-extern const char* const sCSS1_PV_absolute;
+constexpr inline std::string_view sCSS1_PV_absolute = "absolute";
-extern const char* const sCSS1_P_left;
+constexpr inline std::string_view sCSS1_P_left = "left";
-extern const char* const sCSS1_P_top;
+constexpr inline std::string_view sCSS1_P_top = "top";
// Strings for printing extensions
-extern const char* const sCSS1_P_page_break_before;
-extern const char* const sCSS1_P_page_break_after;
-extern const char* const sCSS1_P_page_break_inside;
-extern const char* const sCSS1_P_size;
-extern const char* const sCSS1_P_widows;
-extern const char* const sCSS1_P_visibility;
-extern const char* const sCSS1_P_orphans;
-//extern const char* const sCSS1_P_marks;
+constexpr inline std::string_view sCSS1_P_page_break_before = "page-break-before";
+constexpr inline std::string_view sCSS1_P_page_break_after = "page-break-after";
+constexpr inline std::string_view sCSS1_P_page_break_inside = "page-break-inside";
+constexpr inline std::string_view sCSS1_P_size = "size";
+constexpr inline std::string_view sCSS1_P_widows = "widows";
+constexpr inline std::string_view sCSS1_P_visibility = "visibility";
+constexpr inline std::string_view sCSS1_P_orphans = "orphans";
+//constexpr inline std::string_view sCSS1_P_marks = "marks";
-extern const char* const sCSS1_PV_always;
-extern const char* const sCSS1_PV_avoid;
+constexpr inline std::string_view sCSS1_PV_always = "always";
+constexpr inline std::string_view sCSS1_PV_avoid = "avoid";
-extern const char* const sCSS1_PV_portrait;
-extern const char* const sCSS1_PV_landscape;
+constexpr inline std::string_view sCSS1_PV_portrait = "portrait";
+constexpr inline std::string_view sCSS1_PV_landscape = "landscape";
-//extern const char* const sCSS1_PV_crop;
-//extern const char* const sCSS1_PV_cross;
+//constexpr inline std::string_view sCSS1_PV_crop = "crop";
+//constexpr inline std::string_view sCSS1_PV_cross = "cross";
-extern const char* const sCSS1_P_so_language;
-extern const char* const sCSS1_P_direction;
-extern const char* const sCSS1_PV_ltr;
-extern const char* const sCSS1_PV_rtl;
-extern const char* const sCSS1_PV_inherit;
+constexpr inline std::string_view sCSS1_P_so_language = "so-language";
+constexpr inline std::string_view sCSS1_P_direction = "direction";
+constexpr inline std::string_view sCSS1_PV_ltr = "ltr";
+constexpr inline std::string_view sCSS1_PV_rtl = "rtl";
+constexpr inline std::string_view sCSS1_PV_inherit = "inherit";
-extern const char* const sCSS1_P_display;
+constexpr inline std::string_view sCSS1_P_display = "display";
#endif
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 1e63389f592c..3155d62f2984 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -3057,80 +3057,71 @@ namespace {
// the assignment of property to parsing function
struct CSS1PropEntry
{
- const char * pName;
+ std::string_view pName;
FnParseCSS1Prop pFunc;
};
}
-#define CSS1_PROP_ENTRY(p) \
- { sCSS1_P_##p, ParseCSS1_##p }
-
// the table with assignments
CSS1PropEntry const aCSS1PropFnTab[] =
{
- CSS1_PROP_ENTRY(background),
- CSS1_PROP_ENTRY(background_color),
- CSS1_PROP_ENTRY(border),
- CSS1_PROP_ENTRY(border_bottom),
- CSS1_PROP_ENTRY(border_bottom_width),
- CSS1_PROP_ENTRY(border_color),
- CSS1_PROP_ENTRY(border_left),
- CSS1_PROP_ENTRY(border_left_width),
- CSS1_PROP_ENTRY(border_right),
- CSS1_PROP_ENTRY(border_right_width),
- CSS1_PROP_ENTRY(border_style),
- CSS1_PROP_ENTRY(border_top),
- CSS1_PROP_ENTRY(border_top_width),
- CSS1_PROP_ENTRY(border_width),
- CSS1_PROP_ENTRY(color),
- CSS1_PROP_ENTRY(column_count),
- CSS1_PROP_ENTRY(direction),
- CSS1_PROP_ENTRY(float),
- CSS1_PROP_ENTRY(font),
- CSS1_PROP_ENTRY(font_family),
- CSS1_PROP_ENTRY(font_size),
- CSS1_PROP_ENTRY(font_style),
- CSS1_PROP_ENTRY(font_variant),
- CSS1_PROP_ENTRY(font_weight),
- CSS1_PROP_ENTRY(height),
- CSS1_PROP_ENTRY(left),
- CSS1_PROP_ENTRY(letter_spacing),
- CSS1_PROP_ENTRY(line_height),
- CSS1_PROP_ENTRY(list_style_type),
- CSS1_PROP_ENTRY(margin),
- CSS1_PROP_ENTRY(margin_bottom),
- CSS1_PROP_ENTRY(margin_left),
- CSS1_PROP_ENTRY(margin_right),
- CSS1_PROP_ENTRY(margin_top),
- CSS1_PROP_ENTRY(orphans),
- CSS1_PROP_ENTRY(padding),
- CSS1_PROP_ENTRY(padding_bottom),
- CSS1_PROP_ENTRY(padding_left),
- CSS1_PROP_ENTRY(padding_right),
- CSS1_PROP_ENTRY(padding_top),
- CSS1_PROP_ENTRY(page_break_after),
- CSS1_PROP_ENTRY(page_break_before),
- CSS1_PROP_ENTRY(page_break_inside),
- CSS1_PROP_ENTRY(position),
- CSS1_PROP_ENTRY(size),
- CSS1_PROP_ENTRY(so_language),
- CSS1_PROP_ENTRY(text_align),
- CSS1_PROP_ENTRY(text_decoration),
- CSS1_PROP_ENTRY(text_indent),
- CSS1_PROP_ENTRY(text_transform),
- CSS1_PROP_ENTRY(top),
- CSS1_PROP_ENTRY(visibility),
- CSS1_PROP_ENTRY(widows),
- CSS1_PROP_ENTRY(width),
+ { sCSS1_P_background, ParseCSS1_background },
+ { sCSS1_P_background_color, ParseCSS1_background_color },
+ { sCSS1_P_border, ParseCSS1_border },
+ { sCSS1_P_border_bottom, ParseCSS1_border_bottom },
+ { sCSS1_P_border_bottom_width, ParseCSS1_border_bottom_width },
+ { sCSS1_P_border_color, ParseCSS1_border_color },
+ { sCSS1_P_border_left, ParseCSS1_border_left },
+ { sCSS1_P_border_left_width, ParseCSS1_border_left_width },
+ { sCSS1_P_border_right, ParseCSS1_border_right },
+ { sCSS1_P_border_right_width, ParseCSS1_border_right_width },
+ { sCSS1_P_border_style, ParseCSS1_border_style },
+ { sCSS1_P_border_top, ParseCSS1_border_top },
+ { sCSS1_P_border_top_width, ParseCSS1_border_top_width },
+ { sCSS1_P_border_width, ParseCSS1_border_width },
+ { sCSS1_P_color, ParseCSS1_color },
+ { sCSS1_P_column_count, ParseCSS1_column_count },
+ { sCSS1_P_direction, ParseCSS1_direction },
+ { sCSS1_P_float, ParseCSS1_float },
+ { sCSS1_P_font, ParseCSS1_font },
+ { sCSS1_P_font_family, ParseCSS1_font_family },
+ { sCSS1_P_font_size, ParseCSS1_font_size },
+ { sCSS1_P_font_style, ParseCSS1_font_style },
+ { sCSS1_P_font_variant, ParseCSS1_font_variant },
+ { sCSS1_P_font_weight, ParseCSS1_font_weight },
+ { sCSS1_P_height, ParseCSS1_height },
+ { sCSS1_P_left, ParseCSS1_left },
+ { sCSS1_P_letter_spacing, ParseCSS1_letter_spacing },
+ { sCSS1_P_line_height, ParseCSS1_line_height },
+ { sCSS1_P_list_style_type, ParseCSS1_list_style_type },
+ { sCSS1_P_margin, ParseCSS1_margin },
+ { sCSS1_P_margin_bottom, ParseCSS1_margin_bottom },
+ { sCSS1_P_margin_left, ParseCSS1_margin_left },
+ { sCSS1_P_margin_right, ParseCSS1_margin_right },
+ { sCSS1_P_margin_top, ParseCSS1_margin_top },
+ { sCSS1_P_orphans, ParseCSS1_orphans },
+ { sCSS1_P_padding, ParseCSS1_padding },
+ { sCSS1_P_padding_bottom, ParseCSS1_padding_bottom },
+ { sCSS1_P_padding_left, ParseCSS1_padding_left },
+ { sCSS1_P_padding_right, ParseCSS1_padding_right },
+ { sCSS1_P_padding_top, ParseCSS1_padding_top },
+ { sCSS1_P_page_break_after, ParseCSS1_page_break_after },
+ { sCSS1_P_page_break_before, ParseCSS1_page_break_before },
+ { sCSS1_P_page_break_inside, ParseCSS1_page_break_inside },
+ { sCSS1_P_position, ParseCSS1_position },
+ { sCSS1_P_size, ParseCSS1_size },
+ { sCSS1_P_so_language, ParseCSS1_so_language },
+ { sCSS1_P_text_align, ParseCSS1_text_align },
+ { sCSS1_P_text_decoration, ParseCSS1_text_decoration },
+ { sCSS1_P_text_indent, ParseCSS1_text_indent },
+ { sCSS1_P_text_transform, ParseCSS1_text_transform },
+ { sCSS1_P_top, ParseCSS1_top },
+ { sCSS1_P_visibility, ParseCSS1_visibility },
+ { sCSS1_P_widows, ParseCSS1_widows },
+ { sCSS1_P_width, ParseCSS1_width },
};
-#if !defined NDEBUG
-static bool CSS1PropEntryCompare( const CSS1PropEntry &lhs, const CSS1PropEntry &rhs)
-{
- return strcmp(lhs.pName, rhs.pName) < 0;
-}
-#endif
static bool CSS1PropEntryFindCompare(CSS1PropEntry const & lhs, OUString const & s)
{
return s.compareToIgnoreAsciiCaseAscii(lhs.pName) > 0;
@@ -3141,14 +3132,12 @@ void SvxCSS1Parser::DeclarationParsed( const OUString& rProperty,
{
OSL_ENSURE( m_pItemSet, "DeclarationParsed() without ItemSet" );
- static bool bSortedPropFns = false;
-
- if( !bSortedPropFns )
- {
+ // TODO: convert to static_assert, when C++20 constexpr std::is_sorted is available
+ [[maybe_unused]] static const bool bSortedPropFns = []() {
assert( std::is_sorted( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab),
- CSS1PropEntryCompare ) );
- bSortedPropFns = true;
- }
+ [](const auto& lhs, const auto& rhs) constexpr { return lhs.pName < rhs.pName; } ) );
+ return true;
+ }();
auto it = std::lower_bound( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab), rProperty,
CSS1PropEntryFindCompare );
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 43012ccfefc4..f65803149ea1 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -478,15 +478,13 @@ public:
void OutStyleSheet( const SwPageDesc& rPageDesc );
- inline void OutCSS1_PropertyAscii( const char *pProp,
- const char *pVal );
- inline void OutCSS1_PropertyAscii( const char *pProp,
+ inline void OutCSS1_PropertyAscii( std::string_view pProp,
std::string_view rVal );
- inline void OutCSS1_Property( const char *pProp, const OUString& rVal );
- void OutCSS1_Property( const char *pProp, std::string_view pVal,
+ inline void OutCSS1_Property( std::string_view pProp, const OUString& rVal );
+ void OutCSS1_Property( std::string_view pProp, std::string_view pVal,
const OUString *pSVal, std::optional<sw::Css1Background> oBackground = std::nullopt );
- void OutCSS1_UnitProperty( const char *pProp, tools::Long nVal );
- void OutCSS1_PixelProperty( const char *pProp, tools::Long nVal, bool bVert );
+ void OutCSS1_UnitProperty( std::string_view pProp, tools::Long nVal );
+ void OutCSS1_PixelProperty( std::string_view pProp, tools::Long nVal, bool bVert );
void OutCSS1_SfxItemSet( const SfxItemSet& rItemSet, bool bDeep=true );
// events of BODY tag from SFX configuration
@@ -630,19 +628,13 @@ inline bool SwHTMLWriter::IsCSS1Script( sal_uInt16 n ) const
return CSS1_OUTMODE_ANY_SCRIPT == nScript || n == nScript;
}
-inline void SwHTMLWriter::OutCSS1_PropertyAscii( const char *pProp,
- const char *pVal )
-{
- OutCSS1_Property( pProp, pVal, nullptr );
-}
-
-inline void SwHTMLWriter::OutCSS1_PropertyAscii( const char *pProp,
+inline void SwHTMLWriter::OutCSS1_PropertyAscii( std::string_view pProp,
std::string_view rVal )
{
OutCSS1_Property( pProp, rVal, nullptr );
}
-inline void SwHTMLWriter::OutCSS1_Property( const char *pProp,
+inline void SwHTMLWriter::OutCSS1_Property( std::string_view pProp,
const OUString& rVal )
{
OutCSS1_Property( pProp, std::string_view(), &rVal );