[Libreoffice-commits] .: 2 commits - sw/source

Tor Lillqvist tml at kemper.freedesktop.org
Mon Jun 20 05:04:55 PDT 2011


 sw/source/filter/html/css1atr.cxx |    3 ---
 sw/source/filter/html/htmlatr.cxx |    4 ++--
 sw/source/filter/html/svxcss1.cxx |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 5 deletions(-)

New commits:
commit bc35eece8b9eb9ba6c11c07a7cdedce0ada0623b
Author: Harri Pitkänen <hatapitk at iki.fi>
Date:   Sat Jun 18 21:12:01 2011 +0300

    Support CSS text-transform property in HTML import

diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 117ef4e..2fcf673 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -128,6 +128,14 @@ static CSS1PropertyEnum const aFontVariantTable[] =
     { 0,					0					}
 };
 
+static CSS1PropertyEnum const aTextTransformTable[] =
+{
+    { sCSS1_PV_uppercase,  SVX_CASEMAP_VERSALIEN },
+    { sCSS1_PV_lowercase,  SVX_CASEMAP_GEMEINE   },
+    { sCSS1_PV_capitalize, SVX_CASEMAP_TITEL     },
+    { 0,                   0                     }
+};
+
 static CSS1PropertyEnum const aDirectionTable[] =
 {
     { sCSS1_PV_ltr,			FRMDIR_HORI_LEFT_TOP		},
@@ -1314,6 +1322,32 @@ static void ParseCSS1_font_variant( const CSS1Expression *pExpr,
     }
 }
 
+static void ParseCSS1_text_transform( const CSS1Expression *pExpr,
+                                    SfxItemSet &rItemSet,
+                                    SvxCSS1PropertyInfo& /*rPropInfo*/,
+                                    const SvxCSS1Parser& /*rParser*/ )
+{
+    OSL_ENSURE( pExpr, "no expression" );
+
+    // none | capitalize | uppercase | lowercase
+
+    switch( pExpr->GetType() )
+    {
+    case CSS1_IDENT:
+        {
+            sal_uInt16 nCaseMap;
+            if( SvxCSS1Parser::GetEnum( aTextTransformTable, pExpr->GetString(),
+                                        nCaseMap ) )
+            {
+                rItemSet.Put( SvxCaseMapItem( (SvxCaseMap)nCaseMap,
+                                                aItemIds.nCaseMap ) );
+            }
+        }
+    default:
+        ;
+    }
+}
+
 /*  */
 
 static void ParseCSS1_color( const CSS1Expression *pExpr,
@@ -3140,6 +3174,7 @@ static CSS1PropEntry aCSS1PropFnTab[] =
     CSS1_PROP_ENTRY(text_align),
     CSS1_PROP_ENTRY(text_decoration),
     CSS1_PROP_ENTRY(text_indent),
+    CSS1_PROP_ENTRY(text_transform),
     CSS1_PROP_ENTRY(margin_left),
     CSS1_PROP_ENTRY(margin_right),
     CSS1_PROP_ENTRY(margin_top),
commit 671ac0917ce0ff374b01251bd5b41c0485c5d77e
Author: Harri Pitkänen <hatapitk at iki.fi>
Date:   Sat Jun 18 15:57:14 2011 +0300

    Import and export character case transformations unconditionally to/from HTML
    
    Import small caps and export small caps, lowecase, uppercase and titlecase
    transformations unconditionally to/from HTML. Previously import and export
    was limited by browser compatibility settings but all mainstream browsers
    released within last 5 years or so should support the relevant CSS attributes.

diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 92a149b..d980b55 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2561,9 +2561,6 @@ static Writer& OutCSS1_SvxCaseMap( Writer& rWrt, const SfxPoolItem& rHt )
 {
     SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
 
-    if( !rHTMLWrt.IsHTMLMode(HTMLMODE_SMALL_CAPS) )
-        return rWrt;
-
     switch( ((const SvxCaseMapItem&)rHt).GetCaseMap() )
     {
     case SVX_CASEMAP_NOT_MAPPED:
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 2d10e6f..f7a0ec1 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -1505,8 +1505,8 @@ HTMLOnOffState HTMLEndPosLst::GetHTMLItemState( const SfxPoolItem& rItem )
         break;
 
     case RES_CHRATR_CASEMAP:
-        if( IsHTMLMode(HTMLMODE_SMALL_CAPS) )
-            eState = HTML_STYLE_VALUE;
+        eState = HTML_STYLE_VALUE;
+        break;
 
     case RES_CHRATR_KERNING:
         if( IsHTMLMode(HTMLMODE_FULL_STYLES) )


More information about the Libreoffice-commits mailing list