[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 4 commits - cui/qa cui/source sw/qa sw/source writerfilter/CppunitTest_writerfilter_dmapper.mk writerfilter/qa writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 12 07:28:33 UTC 2020
cui/qa/uitest/dialogs/chardlg.py | 54 ++++++
cui/source/tabpages/chardlg.cxx | 2
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 33 ++++
sw/source/filter/ww8/docxattributeoutput.cxx | 20 ++
sw/source/filter/ww8/docxattributeoutput.hxx | 1
sw/source/ui/chrdlg/chardlg.cxx | 3
writerfilter/CppunitTest_writerfilter_dmapper.mk | 1
writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx | 78 ++++++++++
writerfilter/qa/cppunittests/dmapper/data/semi-transparent-text.docx |binary
writerfilter/source/dmapper/DomainMapper.cxx | 9 +
writerfilter/source/dmapper/PropertyIds.cxx | 1
writerfilter/source/dmapper/PropertyIds.hxx | 1
writerfilter/source/dmapper/TextEffectsHandler.cxx | 50 ++++++
writerfilter/source/dmapper/TextEffectsHandler.hxx | 2
14 files changed, 251 insertions(+), 4 deletions(-)
New commits:
commit 42a4789a5acb260b819d51b1bd87747b81453b74
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Feb 17 21:31:10 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue May 12 09:18:20 2020 +0200
tdf#130384 cui: fix automatic color showing up as white in the char dlg
Regression from commit b4554b8eddd048532269df610e89ae739c46fab7 (cui:
add UI for semi-transparent shape text, 2019-11-22), the problem was
that COL_AUTO has the alpha channel set to 0xff, and we should not clear
that, otherwise the color list box will present the automatic color as
white.
(cherry picked from commit 8553024059f934aaf8bc488f01869fdc6922c120)
Change-Id: I6eae788606b003eec014c0c4a22b40053ff534d5
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
index 26aff0f4a5be..2545d268274a 100644
--- a/cui/qa/uitest/dialogs/chardlg.py
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -79,4 +79,25 @@ class Test(UITestCase):
self.assertEqual(paragraph.CharTransparence, 5)
self.ui_test.close_doc()
+ def testSvxCharEffectsPageWriterAutomatic(self):
+ # Start Writer.
+ self.ui_test.create_doc_in_start_center("writer")
+ doc = self.xUITest.getTopFocusWindow()
+ editWin = doc.getChild("writer_edit")
+
+ # Use Format -> Character.
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ # Select RID_SVXPAGE_CHAR_EFFECTS.
+ select_pos(xTabs, "1")
+ xFontColorLB = xDialog.getChild("fontcolorlb")
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: 'White' != 'Automatic'
+ # i.e. the auto color lost its alpha component and appeared as white.
+ self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic")
+
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 211ec9e15679..3d4f85b7d199 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1565,7 +1565,7 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
m_aPreviewWin.Invalidate();
Color aRGBColor = aColor;
- if (aRGBColor.GetTransparency())
+ if (aRGBColor.GetTransparency() && aColor != COL_AUTO)
{
aRGBColor.SetTransparency(0);
}
commit 0e28584876c321f598fcb7e5a86c3e6294bdd857
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jan 28 21:21:19 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue May 12 09:16:06 2020 +0200
sw: add UI for semi-transparent text
Somewhat surprisingly the test passed without the fix, i.e. the uitest
operated happily on a hidden widget; so explicitly assert that it's
visible.
(cherry picked from commit 6d6e80435fd7f71342c429a67759a7b7b280cc55)
Change-Id: I321c7e0e3cb2d67a07724523c885d50577a116a5
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
index 59cf10d18c29..26aff0f4a5be 100644
--- a/cui/qa/uitest/dialogs/chardlg.py
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -7,6 +7,7 @@
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_state_as_dict
# Test for cui/source/tabpages/chardlg.cxx.
class Test(UITestCase):
@@ -46,4 +47,36 @@ class Test(UITestCase):
self.assertEqual(shape.CharTransparence, 5)
self.ui_test.close_doc()
+ def testSvxCharEffectsPageWriter(self):
+ # Start Writer.
+ self.ui_test.create_doc_in_start_center("writer")
+ doc = self.xUITest.getTopFocusWindow()
+ editWin = doc.getChild("writer_edit")
+ # Type a character and select it.
+ editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+ editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ # Now use Format -> Character.
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ # Select RID_SVXPAGE_CHAR_EFFECTS.
+ select_pos(xTabs, "1")
+ xFontTransparency = xDialog.getChild("fonttransparencymtr")
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: 'false' != 'true'
+ # i.e. the transparency widget was hidden.
+ self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true")
+ for _ in range(5):
+ xFontTransparency.executeAction("UP", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+
+ # Verify the result.
+ component = self.ui_test.get_component()
+ paragraph = component.Text.createEnumeration().nextElement()
+
+ self.assertEqual(paragraph.CharTransparence, 5)
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index 9b423ca7570e..18e9f37f1ad1 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -115,7 +115,8 @@ void SwCharDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
}
else if (rId == "fonteffects")
{
- aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER|SVX_ENABLE_FLASH));
+ aSet.Put(SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER | SVX_ENABLE_FLASH
+ | SVX_ENABLE_CHAR_TRANSPARENCY));
rPage.PageCreated(aSet);
}
else if (rId == "position")
commit dc3ce4055e5fabb440351ede5be288075474a15c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jan 21 21:25:08 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue May 12 09:10:43 2020 +0200
sw: add DOCX export for semi-transparent text
This is the case when the value is not in the grab-bag, that was already
supported.
(cherry picked from commit 6f6a64952d9aa4826e83ad94c2a6de2344cbe2de)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
Change-Id: I334333ec441644229540a358d7bf8811373618c7
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 36eb90e7e1c1..c860b061df58 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -15,6 +15,7 @@
#include <editsh.hxx>
#include <frmatr.hxx>
#include <tools/lineend.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
#include <com/sun/star/text/TableColumnSeparator.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/XDocumentIndex.hpp>
@@ -346,6 +347,38 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testUserField)
assertXPath(pXmlDoc, "//w:docVars/w:docVar", "val", "bar");
}
+CPPUNIT_TEST_FIXTURE(SwModelTestBase, testSemiTransparentText)
+{
+ // Create an in-memory empty document.
+ loadURL("private:factory/swriter", nullptr);
+
+ // Set text to half-transparent and type a character.
+ uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xParagraph.is());
+ sal_Int16 nTransparence = 75;
+ xParagraph->setPropertyValue("CharTransparence", uno::makeAny(nTransparence));
+ uno::Reference<text::XTextRange> xTextRange(xParagraph, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xTextRange.is());
+ xTextRange->setString("x");
+
+ // Export to docx.
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString("Office Open XML Text");
+ xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+ mbExported = true;
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ CPPUNIT_ASSERT(pXmlDoc);
+ OString aXPath
+ = "/w:document/w:body/w:p/w:r/w:rPr/w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha";
+ double fValue = getXPath(pXmlDoc, aXPath, "val").toDouble();
+ sal_Int16 nActual = basegfx::fround(fValue / oox::drawingml::PER_PERCENT);
+
+ // Without the accompanying fix in place, this test would have failed, as the w14:textFill
+ // element was missing.
+ CPPUNIT_ASSERT_EQUAL(nTransparence, nActual);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 832dab20d9ff..8c6fa174a88b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2601,7 +2601,6 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
if ( m_pColorAttrList.is() )
{
XFastAttributeListRef xAttrList( m_pColorAttrList.get() );
- m_pColorAttrList.clear();
m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList );
}
@@ -2620,6 +2619,24 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
}
+ if (m_nCharTransparence != 0 && m_pColorAttrList && m_aTextEffectsGrabBag.empty())
+ {
+ const char* pVal = nullptr;
+ m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal);
+ if (OString("auto") != pVal)
+ {
+ m_pSerializer->startElementNS(XML_w14, XML_textFill);
+ m_pSerializer->startElementNS(XML_w14, XML_solidFill);
+ m_pSerializer->startElementNS(XML_w14, XML_srgbClr, FSNS(XML_w14, XML_val), pVal);
+ sal_Int32 nTransparence = m_nCharTransparence * oox::drawingml::MAX_PERCENT / 255.0;
+ m_pSerializer->singleElementNS(XML_w14, XML_alpha, FSNS(XML_w14, XML_val), OString::number(nTransparence));
+ m_pSerializer->endElementNS(XML_w14, XML_srgbClr);
+ m_pSerializer->endElementNS(XML_w14, XML_solidFill);
+ m_pSerializer->endElementNS(XML_w14, XML_textFill);
+ m_nCharTransparence = 0;
+ }
+ }
+ m_pColorAttrList.clear();
for (const beans::PropertyValue & i : m_aTextEffectsGrabBag)
{
boost::optional<sal_Int32> aElementId = lclGetElementIdForName(i.Name);
@@ -6920,6 +6937,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
}
AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_val ), aColorString.getStr() );
+ m_nCharTransparence = aColor.GetTransparency();
}
void DocxAttributeOutput::CharContour( const SvxContourItem& rContour )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index b5a5508f02de..b87d5e4efd9e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -746,6 +746,7 @@ private:
bool m_bStartedParaSdt;
/// Attributes of the run color
rtl::Reference<sax_fastparser::FastAttributeList> m_pColorAttrList;
+ sal_uInt8 m_nCharTransparence = 0;
/// Attributes of the paragraph background
rtl::Reference<sax_fastparser::FastAttributeList> m_pBackgroundAttrList;
OUString m_sOriginalBackgroundColor;
commit 55175fd421ffcca6ec6e2566fe3f7abc93e3c319
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Jan 15 21:24:17 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue May 12 09:06:27 2020 +0200
sw: add DOCX import for semi-transparent text
This is one of the text effects properties, which is already
grab-bagged. That is done in a generic way, so the easiest is to just
read the value from the grab-bag, rather than from the dmapper tokens
directly.
(cherry picked from commit 3a749d7278bbe65cfc063e64460df8af6bc2af47)
Conflicts:
writerfilter/CppunitTest_writerfilter_dmapper.mk
Change-Id: Id74a3eb0abddf745a9e4e59625bf9345f7df9dfe
diff --git a/writerfilter/CppunitTest_writerfilter_dmapper.mk b/writerfilter/CppunitTest_writerfilter_dmapper.mk
index 8678bb92da10..55299bb672a9 100644
--- a/writerfilter/CppunitTest_writerfilter_dmapper.mk
+++ b/writerfilter/CppunitTest_writerfilter_dmapper.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_dmapper, \
writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl \
writerfilter/qa/cppunittests/dmapper/PropertyMap \
writerfilter/qa/cppunittests/dmapper/GraphicImport \
+ writerfilter/qa/cppunittests/dmapper/TextEffectsHandler \
))
$(eval $(call gb_CppunitTest_use_libraries,writerfilter_dmapper, \
diff --git a/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx b/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx
new file mode 100644
index 000000000000..1678aac52773
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx
@@ -0,0 +1,78 @@
+/* -*- 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/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for writerfilter/source/dmapper/TextEffectsHandler.cxx.
+class Test : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+ uno::Reference<uno::XComponentContext> mxComponentContext;
+ uno::Reference<lang::XComponent> mxComponent;
+
+public:
+ void setUp() override;
+ void tearDown() override;
+ uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+};
+
+void Test::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void Test::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+char const DATA_DIRECTORY[] = "/writerfilter/qa/cppunittests/dmapper/data/";
+
+CPPUNIT_TEST_FIXTURE(Test, testSemiTransparentText)
+{
+ // Load a document with a single paragraph: second text portion has semi-transparent text.
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "semi-transparent-text.docx";
+ getComponent() = loadFromDesktop(aURL);
+ uno::Reference<text::XTextDocument> xTextDocument(getComponent(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumerationAccess> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration();
+ xPortionEnum->nextElement();
+ uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY);
+ sal_Int16 nCharTransparence = 0;
+ xPortion->getPropertyValue("CharTransparence") >>= nCharTransparence;
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 74
+ // - Actual : 0
+ // i.e. text was imported as regular text with solid color only.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(74), nCharTransparence);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/semi-transparent-text.docx b/writerfilter/qa/cppunittests/dmapper/data/semi-transparent-text.docx
new file mode 100644
index 000000000000..6c0f8a79cbb4
Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/semi-transparent-text.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 97e34afb7926..72ec656a7574 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2669,7 +2669,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
{
pProperties->resolve(*pTextEffectsHandlerPtr);
- rContext->Insert(*aPropertyId, uno::makeAny(pTextEffectsHandlerPtr->getInteropGrabBag()), true, CHAR_GRAB_BAG);
+ beans::PropertyValue aGrabBag = pTextEffectsHandlerPtr->getInteropGrabBag();
+ rContext->Insert(*aPropertyId, uno::makeAny(aGrabBag), true, CHAR_GRAB_BAG);
+
+ sal_Int16 nTransparency = TextEffectsHandler::GetTextFillSolidFillAlpha(aGrabBag);
+ if (nTransparency != 0)
+ {
+ rContext->Insert(PROP_CHAR_TRANSPARENCE, uno::makeAny(nTransparency));
+ }
}
}
}
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 6fecf7fe2be4..d2393bab7938 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -355,6 +355,7 @@ OUString getPropertyName( PropertyIds eId )
case PROP_COMMAND_TYPE: sName = "DataCommandType"; break;
case PROP_DATATABLE_NAME: sName = "DataTableName"; break;
case PROP_DATACOLUMN_NAME: sName = "DataColumnName"; break;
+ case PROP_CHAR_TRANSPARENCE: sName = "CharTransparence"; break;
}
assert(sName.getLength()>0);
return sName;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index d511fd737238..aa609341b84b 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -355,6 +355,7 @@ enum PropertyIds
,PROP_COMMAND_TYPE
,PROP_DATATABLE_NAME
,PROP_DATACOLUMN_NAME
+ ,PROP_CHAR_TRANSPARENCE
};
//Returns the UNO string equivalent to eId.
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx
index fcefb30295a3..1c0a9da9a26c 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.cxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx
@@ -17,6 +17,8 @@
#include <rtl/ustrbuf.hxx>
#include <comphelper/string.hxx>
#include <ooxml/resourceids.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
namespace writerfilter {
namespace dmapper
@@ -749,6 +751,54 @@ beans::PropertyValue TextEffectsHandler::getInteropGrabBag()
return aReturn;
}
+sal_uInt8 TextEffectsHandler::GetTextFillSolidFillAlpha(const css::beans::PropertyValue& rValue)
+{
+ if (rValue.Name != "textFill")
+ {
+ return 0;
+ }
+
+ uno::Sequence<beans::PropertyValue> aPropertyValues;
+ rValue.Value >>= aPropertyValues;
+ comphelper::SequenceAsHashMap aMap(aPropertyValues);
+ auto it = aMap.find("solidFill");
+ if (it == aMap.end())
+ {
+ return 0;
+ }
+
+ comphelper::SequenceAsHashMap aSolidFillMap(it->second);
+ it = aSolidFillMap.find("srgbClr");
+ if (it == aSolidFillMap.end())
+ {
+ return 0;
+ }
+
+ comphelper::SequenceAsHashMap aSrgbClrMap(it->second);
+ it = aSrgbClrMap.find("alpha");
+ if (it == aSrgbClrMap.end())
+ {
+ return 0;
+ }
+
+ comphelper::SequenceAsHashMap aAlphaMap(it->second);
+ it = aAlphaMap.find("attributes");
+ if (it == aAlphaMap.end())
+ {
+ return 0;
+ }
+
+ comphelper::SequenceAsHashMap aAttributesMap(it->second);
+ it = aAttributesMap.find("val");
+ if (it == aAttributesMap.end())
+ {
+ return 0;
+ }
+ sal_Int32 nVal = 0;
+ it->second >>= nVal;
+ return nVal / oox::drawingml::PER_PERCENT;
+}
+
}//namespace dmapper
} //namespace writerfilter
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx b/writerfilter/source/dmapper/TextEffectsHandler.hxx
index 6a40ed67a0db..6746253a5de5 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.hxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx
@@ -66,6 +66,8 @@ public:
static OUString getNumFormString(sal_Int32 nType);
static OUString getNumSpacingString(sal_Int32 nType);
+ static sal_uInt8 GetTextFillSolidFillAlpha(const css::beans::PropertyValue& rValue);
+
};
}}
More information about the Libreoffice-commits
mailing list