filter/source/svg/svgexport.cxx                                 |    7 -
 oox/source/drawingml/textcharacterproperties.cxx                |    2 
 oox/source/token/properties.txt                                 |    1 
 sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx |binary
 sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx                  |   16 +++
 sw/source/filter/ww8/docxattributeoutput.cxx                    |   10 +-
 writerfilter/source/dmapper/DomainMapper.cxx                    |   42 
++++++++++
 writerfilter/source/dmapper/PropertyIds.cxx                     |    1 
 writerfilter/source/dmapper/PropertyIds.hxx                     |    1 
 9 files changed, 74 insertions(+), 6 deletions(-)

New commits:
commit 1757415b4f1d81a3445c1cc9cd353ffb98d1ce22
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Jun 12 12:10:09 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jun 13 23:20:26 2023 +0200

    cannot export selected fontwork in writer to svg
    
    Background property isn't supported
    
    Change-Id: Ic8c5ff979d16a328fece5b4b2f87c85348606bce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152896
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit b1b3c70f1f16f02a83e23d2b0265bc97b0188a11)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152917
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index fab15a59a2e3..776643a9740d 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -2329,7 +2329,8 @@ bool SVGFilter::implCreateObjects()
             if( xPropSet.is() )
             {
                 Reference< XPropertySet > xBackground;
-                xPropSet->getPropertyValue( "Background" ) >>= xBackground;
+                if 
(xPropSet->getPropertySetInfo()->hasPropertyByName("Background"))
+                    xPropSet->getPropertyValue( "Background" ) >>= xBackground;
                 if( xBackground.is() )
                 {
                     drawing::FillStyle aFillStyle;
commit f4c42593c683a0e05a5d251f8e5af09b12d1a8bc
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Jun 11 00:50:08 2023 +0900
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jun 13 23:20:19 2023 +0200

    ooxml: import and export char underline theme colors
    
    This adds support to import and export char underline theme color
    properties.
    
    Change-Id: Ia8948ee5aacd20e0c2b7cbb1b2fdf97fc65c04e0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152834
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit 953ef30494661788b2e980ece84b62c653d77321)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152974
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 0e1e2830a67f..1217c19441ae 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -206,6 +206,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
     {
         rPropMap.setProperty( PROP_CharUnderlineHasColor, true);
         rPropMap.setProperty( PROP_CharUnderlineColor, 
maUnderlineColor.getColor( rFilter.getGraphicHelper() ));
+        model::ComplexColor aComplexColor = maUnderlineColor.getComplexColor();
+        rPropMap.setProperty( PROP_CharUnderlineComplexColor, 
model::color::createXComplexColor(aComplexColor));
     }
     else
     {
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 40988ffb0222..025b0628b9d8 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -91,6 +91,7 @@ CharStyleName
 CharTransparence
 CharUnderline
 CharUnderlineColor
+CharUnderlineComplexColor
 CharUnderlineHasColor
 CharWeight
 CharWeightAsian
diff --git a/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx 
b/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx
new file mode 100644
index 000000000000..3ee3cdf457f0
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx 
b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
index 3804f4606187..f9e7155859ea 100644
--- a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
@@ -81,6 +81,22 @@ DECLARE_SW_ROUNDTRIP_TEST(testThemePortionBorderColor_DOCX, 
"Test_ThemeBorderCol
     CPPUNIT_ASSERT(isPropertyVoid(xParagraph, "RightBorderComplexColor"));
 }
 
+DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, 
"Test_CharUnderlineThemeColor.docx", nullptr,
+                          Test)
+{
+    auto xParagraph = getParagraph(1);
+    CPPUNIT_ASSERT(xParagraph.is());
+    auto xRun = getRun(xParagraph, 1);
+    auto xComplexColor
+        = getProperty<uno::Reference<util::XComplexColor>>(xRun, 
"CharUnderlineComplexColor");
+    auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
+    CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aComplexColor.getSchemeType());
+    auto const& rTransforms = aComplexColor.getTransformations();
+    CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
+    CPPUNIT_ASSERT_EQUAL(model::TransformationType::Shade, 
rTransforms[0].meType);
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f5742eae4515..a75682761d84 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7953,10 +7953,14 @@ void DocxAttributeOutput::CharUnderline( const 
SvxUnderlineItem& rUnderline )
     bool  bUnderlineHasColor = !aUnderlineColor.IsTransparent();
     if (bUnderlineHasColor)
     {
+        model::ComplexColor const& rComplexColor = 
rUnderline.getComplexColor();
         // Underline has a color
-        m_pSerializer->singleElementNS( XML_w, XML_u,
-                                        FSNS( XML_w, XML_val ), 
pUnderlineValue,
-                                        FSNS( XML_w, XML_color ), 
msfilter::util::ConvertColor(aUnderlineColor) );
+        rtl::Reference<FastAttributeList> pAttrList = 
FastSerializerHelper::createAttrList();
+        pAttrList->add(FSNS(XML_w, XML_val), pUnderlineValue);
+        pAttrList->add(FSNS(XML_w, XML_color), 
msfilter::util::ConvertColor(aUnderlineColor));
+        lclAddThemeColorAttributes(pAttrList, rComplexColor);
+        m_pSerializer->singleElementNS(XML_w, XML_u, pAttrList);
+
     }
     else
     {
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 21f1f782736e..aa131a625ce6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -352,6 +352,48 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_COLOR, 
uno::Any( nIntValue ) );
             }
             break;
+        case NS_ooxml::LN_CT_Underline_themeColor:
+        case NS_ooxml::LN_CT_Underline_themeTint:
+        case NS_ooxml::LN_CT_Underline_themeShade:
+            if (m_pImpl->GetTopContext())
+            {
+                uno::Reference<util::XComplexColor> xComplexColor;
+                model::ComplexColor aComplexColor;
+
+                PropertyMapPtr pTopContext = m_pImpl->GetTopContext();
+                std::optional<PropertyMap::Property> aValue;
+                if (pTopContext && (aValue = 
pTopContext->getProperty(PROP_CHAR_UNDERLINE_COMPLEX_COLOR)))
+                {
+                    aValue->second >>= xComplexColor;
+                    if (xComplexColor.is())
+                        aComplexColor = 
model::color::getFromXComplexColor(xComplexColor);
+                }
+
+                if (nName == NS_ooxml::LN_CT_Underline_themeColor)
+                {
+                    auto eThemeColorType = 
TDefTableHandler::getThemeColorTypeIndex(nIntValue);
+                    aComplexColor.setSchemeColor(eThemeColorType);
+                }
+                else if (nName == NS_ooxml::LN_CT_Underline_themeTint)
+                {
+                    if (nIntValue > 0)
+                    {
+                        sal_Int16 nTransformedValue = sal_Int16((255.0 - 
nIntValue) * 10000.0 / 255.0);
+                        
aComplexColor.addTransformation({model::TransformationType::Tint, 
sal_Int16(nTransformedValue)});
+                    }
+                }
+                else if (nName == NS_ooxml::LN_CT_Underline_themeShade)
+                {
+                    if (nIntValue > 0)
+                    {
+                        sal_Int16 nTransformedValue = sal_Int16((255.0 - 
nIntValue) * 10000.0 / 255.0);
+                        
aComplexColor.addTransformation({model::TransformationType::Shade, 
sal_Int16(nTransformedValue)});
+                    }
+                }
+                xComplexColor = 
model::color::createXComplexColor(aComplexColor);
+                
m_pImpl->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_COMPLEX_COLOR, 
uno::Any(xComplexColor));
+            }
+            break;
 
         case NS_ooxml::LN_CT_TabStop_val:
             if (sal::static_int_cast<Id>(nIntValue) == 
NS_ooxml::LN_Value_ST_TabJc_clear)
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index 47126a3af5b5..f809d54432c8 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -36,6 +36,7 @@ const OUString & getPropertyName( PropertyIds eId )
         { PROP_CHAR_RELIEF, u"CharRelief"},
         { PROP_CHAR_UNDERLINE, u"CharUnderline"},
         { PROP_CHAR_UNDERLINE_COLOR, u"CharUnderlineColor"},
+        { PROP_CHAR_UNDERLINE_COMPLEX_COLOR, u"CharUnderlineComplexColor"},
         { PROP_CHAR_UNDERLINE_HAS_COLOR, u"CharUnderlineHasColor"},
         { PROP_CHAR_WORD_MODE, u"CharWordMode"},
         { PROP_CHAR_ESCAPEMENT, u"CharEscapement"},
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index 575633c68313..60d6537ae6c2 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -125,6 +125,7 @@ enum PropertyIds
         ,PROP_CHAR_THEME_COLOR_TINT
         ,PROP_CHAR_UNDERLINE
         ,PROP_CHAR_UNDERLINE_COLOR
+        ,PROP_CHAR_UNDERLINE_COMPLEX_COLOR
         ,PROP_CHAR_UNDERLINE_HAS_COLOR
         ,PROP_CHAR_WEIGHT
         ,PROP_CHAR_WEIGHT_ASIAN
commit dc95aef10db94682b4d149fb125df7fe4d4d2349
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Jun 12 15:25:32 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jun 13 23:20:14 2023 +0200

    Resolves: tdf#155791 export of default impress slide master to svg failed
    
    Change-Id: Ie4ec64fef6d8c2c2844a01d06109ad9022714c11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152902
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 061d6a280d17d18012a2f53e9870b5b2715bcef0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152916
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index c27481baf79b..fab15a59a2e3 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -670,7 +670,7 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< 
XOutputStream >& rxOSt
 
     if( rxOStm.is() )
     {
-        if( !mSelectedPages.empty() && !mMasterPageTargets.empty() )
+        if (!mSelectedPages.empty())
         {
             ::rtl::Reference< ::utl::OStreamWrapper > aTempStmWrapper = new 
::utl::OStreamWrapper( aTempStm );
             Reference< XDocumentHandler > xDocHandler = 
implCreateExportDocumentHandler( aTempStmWrapper );
@@ -1024,7 +1024,7 @@ bool SVGFilter::implExportDocument()
                 mpSVGWriter->SetPreviewMode();
 
             // #i124608# export a given object selection, so no MasterPage 
export at all
-            if (!mbExportShapeSelection)
+            if (!mbExportShapeSelection && !mMasterPageTargets.empty())
                 implExportMasterPages( mMasterPageTargets, 0, 
mMasterPageTargets.size() - 1 );
             implExportDrawPages( mSelectedPages, 0, nLastPage );
 

Reply via email to