sw: remove char color GrabBag and fix export, fix tint/shade calc.

Don't store values from grab bag when exporting character theme
colors and tint/shade values. The values could be wrong now and
aren't needed anyway as we support the values in the model.
Add proper export support for char color theme information with
correct conversion of values into tint/shade values in 0-255
inverted interval.
This also fixes the import of tint/shade values whcih calculation
was slightly off. We divided by 256 instead of 255, which
introduced an error.

In addition introduce ThemeColorUsage enum, which marks if the
theme color type has a specific "usage" - text or background. This
is determined on import if the theme type is background{1,2} or
text{1,2}. This is then taken into account on export, so the
exact type is preserved.

Change-Id: I0022a159397fd0c3d39a118a7149bb2488dfc149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152705
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
Tomaž Vajngerl
2023-06-08 07:45:13 +02:00
committed by Tomaž Vajngerl
parent 5a2c6f4df7
commit 17105fc44b
14 changed files with 667 additions and 30 deletions
+1
View File
@@ -88,6 +88,7 @@ public:
::Color maLastColor;
ThemeColorType meSchemeType = ThemeColorType::Unknown;
ThemeColorUsage meThemeColorUsage = ThemeColorUsage::Unknown;
std::vector<Transformation> maTransformations;
::Color maFinalColor;
@@ -31,6 +31,13 @@ enum class ThemeColorType : sal_Int32
LAST = FollowedHyperlink
};
enum class ThemeColorUsage
{
Unknown = 0,
Text,
Background
};
constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex)
{
if (nIndex < 0 || nIndex > 11)
+2 -2
View File
@@ -963,7 +963,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkThemeColor)
// Make sure the fallback in <w:color> has correct values
assertXPath(pXmlDoc, sElement + "w:color", "val", "948A54");
assertXPath(pXmlDoc, sElement + "w:color", "themeColor", "background2");
assertXPath(pXmlDoc, sElement + "w:color", "themeColor", "light2");
assertXPath(pXmlDoc, sElement + "w:color", "themeShade", "80");
// ... and w14:textFill exists and has correct values.
@@ -977,7 +977,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkThemeColor)
// Make sure the fallback in <w:color> has correct values
assertXPath(pXmlDoc, sElement + "w:color", "val", "558ED5");
assertXPath(pXmlDoc, sElement + "w:color", "themeColor", "text2");
assertXPath(pXmlDoc, sElement + "w:color", "themeColor", "dark2");
assertXPath(pXmlDoc, sElement + "w:color", "themeTint", "99");
// ... and w14:textFill exists and has correct values.
+53
View File
@@ -0,0 +1,53 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# 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/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sw_ooxml_theme_export))
$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_ooxml_theme_export))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_ooxml_theme_export, \
sw/qa/extras/ooxmlexport/ooxml_ThemeExport \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_ooxml_theme_export, \
$(sw_ooxmlexport_libraries) \
))
$(eval $(call gb_CppunitTest_use_externals,sw_ooxml_theme_export,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_ooxml_theme_export,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/qa/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_ooxml_theme_export,\
udkapi \
offapi \
oovbaapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_ooxml_theme_export))
$(eval $(call gb_CppunitTest_use_vcl,sw_ooxml_theme_export))
$(eval $(call gb_CppunitTest_use_rdb,sw_ooxml_theme_export,services))
$(eval $(call gb_CppunitTest_use_configuration,sw_ooxml_theme_export))
$(eval $(call gb_CppunitTest_use_packages,sw_ooxml_theme_export,\
oox_generated \
))
# vim: set noet sw=4 ts=4:
+1
View File
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_libraries,msword,\
comphelper \
cppu \
cppuhelper \
docmodel \
editeng \
i18nlangtag \
i18nutil \
+1
View File
@@ -98,6 +98,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_ooxmllinks \
CppunitTest_sw_ooxmlw14export \
CppunitTest_sw_ooxmlencryption \
CppunitTest_sw_ooxml_theme_export \
CppunitTest_sw_ooxmlimport \
CppunitTest_sw_ooxmlimport2 \
CppunitTest_sw_ww8export \
+12
View File
@@ -46,6 +46,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeading)
CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aComplexColor.getSchemeType());
}
CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeadingODT)
{
createSwDoc("ThemeColorInHeading.fodt");
SwDoc* pDoc = getSwDoc();
CPPUNIT_ASSERT(pDoc);
auto xComplexColor
= getProperty<uno::Reference<util::XComplexColor>>(getParagraph(1), "CharComplexColor");
auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aComplexColor.getSchemeType());
}
void checkFillStyles(std::vector<model::FillStyle> const& rStyleList)
{
CPPUNIT_ASSERT_EQUAL(size_t(3), rStyleList.size());
@@ -0,0 +1,420 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta><meta:initial-creator>quikee</meta:initial-creator><dc:creator>quikee</dc:creator><meta:editing-cycles>2</meta:editing-cycles><meta:creation-date>2023-06-06T13:26:00</meta:creation-date><dc:date>2023-06-06T13:32:00</dc:date><meta:editing-duration>PT6M</meta:editing-duration><meta:generator>LibreOfficeDev/7.6.0.0.alpha1$Linux_X86_64 LibreOffice_project/5a25d9252791409f5e73616ff752a9ae8227aaf7</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="2" meta:character-count="11" meta:non-whitespace-character-count="10"/><meta:user-defined meta:name="AppVersion">16.0000</meta:user-defined><meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:title="Normal.dotm" xlink:href=""/></office:meta>
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">39848</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">8945</config:config-item>
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
<config:config-item config:name="ViewLeft" config:type="long">11963</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">3041</config:config-item>
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">39846</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">8943</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
<config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
<config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
<config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
<config:config-item config:name="KeepRatio" config:type="boolean">false</config:config-item>
<config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
<config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item>
<config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item>
<config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-indexed>
</config:config-item-set>
<config:config-item-set config:name="ooo:configuration-settings">
<config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
<config:config-item config:name="WordLikeWrapForAsCharFlys" config:type="boolean">true</config:config-item>
<config:config-item config:name="AutoFirstLineIndentDisregardLineSpace" config:type="boolean">true</config:config-item>
<config:config-item config:name="HeaderSpacingBelowLastPara" config:type="boolean">true</config:config-item>
<config:config-item config:name="ProtectBookmarks" config:type="boolean">false</config:config-item>
<config:config-item config:name="ContinuousEndnotes" config:type="boolean">false</config:config-item>
<config:config-item config:name="DisableOffPagePositioning" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
<config:config-item config:name="SubtractFlysAnchoredAtFlys" config:type="boolean">false</config:config-item>
<config:config-item config:name="ApplyParagraphMarkFormatToNumbering" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintFaxName" config:type="string"/>
<config:config-item config:name="SurroundTextWrapSmall" config:type="boolean">true</config:config-item>
<config:config-item config:name="TreatSingleColumnBreakAsPageBreak" config:type="boolean">true</config:config-item>
<config:config-item config:name="PropLineSpacingShrinksFirstLine" config:type="boolean">true</config:config-item>
<config:config-item config:name="TabOverSpacing" config:type="boolean">true</config:config-item>
<config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item>
<config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item>
<config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="ClippedPictures" config:type="boolean">true</config:config-item>
<config:config-item config:name="FrameAutowidthWithMorePara" config:type="boolean">true</config:config-item>
<config:config-item config:name="FloattableNomargins" config:type="boolean">true</config:config-item>
<config:config-item config:name="UnbreakableNumberings" config:type="boolean">true</config:config-item>
<config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
<config:config-item config:name="UseVariableWidthNBSP" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="RsidRoot" config:type="int">1874693</config:config-item>
<config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
<config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
<config:config-item config:name="Rsid" config:type="int">1874693</config:config-item>
<config:config-item config:name="FootnoteInColumnToPageEnd" config:type="boolean">true</config:config-item>
<config:config-item config:name="ProtectFields" config:type="boolean">false</config:config-item>
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
<config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
<config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
<config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
<config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddParaLineSpacingToTableCells" config:type="boolean">true</config:config-item>
<config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
<config:config-item config:name="HyphenateURLs" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">false</config:config-item>
<config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
<config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="ImagePreferredDPI" config:type="int">0</config:config-item>
<config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
<config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item>
<config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
<config:config-item config:name="DropCapPunctuation" config:type="boolean">true</config:config-item>
<config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrinterName" config:type="string"/>
<config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
<config:config-item config:name="AddParaTableSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
<config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddVerticalFrameOffsets" config:type="boolean">true</config:config-item>
<config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">true</config:config-item>
<config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
<config:config-item config:name="MsWordCompMinLineHeightByFly" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
<config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
<config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
<config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item>
<config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">true</config:config-item>
<config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item>
<config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">true</config:config-item>
<config:config-item config:name="EmbeddedDatabaseName" config:type="string"/>
<config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
<config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
<config:config-item config:name="MsWordCompTrailingBlanks" config:type="boolean">true</config:config-item>
<config:config-item config:name="EmptyDbFieldHidesPara" config:type="boolean">true</config:config-item>
<config:config-item config:name="TableRowKeep" config:type="boolean">true</config:config-item>
<config:config-item config:name="NoNumberingShowFollowBy" config:type="boolean">true</config:config-item>
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">true</config:config-item>
<config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">true</config:config-item>
<config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">true</config:config-item>
<config:config-item config:name="GutterAtTop" config:type="boolean">false</config:config-item>
<config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item>
<config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
<config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
<config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
<config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
</config:config-item-set>
</office:settings>
<office:scripts>
<office:script script:language="ooo:Basic">
<ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</office:script>
</office:scripts>
<office:font-face-decls>
<style:font-face style:name="Calibri" svg:font-family="Calibri" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Calibri1" svg:font-family="Calibri" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="F" svg:font-family="" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit Devanagari&apos;"/>
<style:font-face style:name="Lohit Devanagari1" svg:font-family="&apos;Lohit Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Noto Sans CJK SC" svg:font-family="&apos;Noto Sans CJK SC&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:styles>
<style:default-style style:family="graphic">
<style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0cm" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Calibri" fo:font-size="11pt" fo:language="en" fo:country="GB" style:letter-kerning="true" style:font-name-asian="Calibri1" style:font-size-asian="11pt" style:language-asian="en" style:country-asian="US" style:font-name-complex="F" style:font-size-complex="11pt" style:language-complex="ar" style:country-complex="SA"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.27cm" style:writing-mode="page"/>
<style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Calibri" fo:font-size="11pt" fo:language="en" fo:country="GB" style:letter-kerning="true" style:font-name-asian="Calibri1" style:font-size-asian="11pt" style:language-asian="en" style:country-asian="US" style:font-name-complex="F" style:font-size-complex="11pt" style:language-complex="ar" style:country-complex="SA" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.282cm" style:contextual-spacing="false" fo:line-height="108%" fo:text-align="start" style:justify-single-word="false" fo:orphans="2" fo:widows="2" style:writing-mode="lr-tb"/>
</style:style>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always"/>
<style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC" style:font-family-asian="&apos;Noto Sans CJK SC&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lohit Devanagari1" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
</style:style>
<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" style:contextual-spacing="false" fo:line-height="115%"/>
</style:style>
<style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;"/>
</style:style>
<style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-size-complex="12pt" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;"/>
</style:style>
<style:style style:name="Default_20_Paragraph_20_Font_20__28_WW_29_" style:display-name="Default Paragraph Font (WW)" style:family="text"/>
<text:outline-style style:name="Outline">
<text:outline-level-style text:level="1" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="2" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="3" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="4" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="5" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="6" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="7" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="8" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="9" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
<text:outline-level-style text:level="10" style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab"/>
</style:list-level-properties>
</text:outline-level-style>
</text:outline-style>
<text:list-style style:name="No_20_List_20__28_WW_29_" style:display-name="No List (WW)">
<text:list-level-style-number text:level="1" loext:num-list-format="%1%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-0.635cm" fo:margin-left="1.27cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="2" loext:num-list-format="%2%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.905cm" fo:text-indent="-0.635cm" fo:margin-left="1.905cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="3" loext:num-list-format="%3%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-0.635cm" fo:margin-left="2.54cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="4" loext:num-list-format="%4%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.175cm" fo:text-indent="-0.635cm" fo:margin-left="3.175cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="5" loext:num-list-format="%5%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.81cm" fo:text-indent="-0.635cm" fo:margin-left="3.81cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="6" loext:num-list-format="%6%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="4.445cm" fo:text-indent="-0.635cm" fo:margin-left="4.445cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="7" loext:num-list-format="%7%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.08cm" fo:text-indent="-0.635cm" fo:margin-left="5.08cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="8" loext:num-list-format="%8%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.715cm" fo:text-indent="-0.635cm" fo:margin-left="5.715cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="9" loext:num-list-format="%9%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.35cm" fo:text-indent="-0.635cm" fo:margin-left="6.35cm"/>
</style:list-level-properties>
</text:list-level-style-number>
<text:list-level-style-number text:level="10" loext:num-list-format="%10%." style:num-suffix="." style:num-format="">
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.985cm" fo:text-indent="-0.635cm" fo:margin-left="6.985cm"/>
</style:list-level-properties>
</text:list-level-style-number>
</text:list-style>
<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
<text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
<style:default-page-layout>
<style:page-layout-properties style:layout-grid-standard-mode="true"/>
</style:default-page-layout>
<loext:theme loext:name="Office Theme">
<loext:theme-colors loext:name="Red">
<loext:color loext:name="dark1" loext:color="#000000"/>
<loext:color loext:name="light1" loext:color="#ffffff"/>
<loext:color loext:name="dark2" loext:color="#323232"/>
<loext:color loext:name="light2" loext:color="#e5c243"/>
<loext:color loext:name="accent1" loext:color="#a5300f"/>
<loext:color loext:name="accent2" loext:color="#d55816"/>
<loext:color loext:name="accent3" loext:color="#e19825"/>
<loext:color loext:name="accent4" loext:color="#b19c7d"/>
<loext:color loext:name="accent5" loext:color="#7f5f52"/>
<loext:color loext:name="accent6" loext:color="#b27d49"/>
<loext:color loext:name="hyperlink" loext:color="#6b9f25"/>
<loext:color loext:name="followed-hyperlink" loext:color="#b26b02"/>
</loext:theme-colors>
</loext:theme>
</office:styles>
<office:automatic-styles>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:color="#ef9769" loext:opacity="100%">
<loext:char-complex-color loext:theme-type="accent2" loext:color-type="theme">
<loext:transformation loext:type="tint" loext:value="4000"/>
</loext:char-complex-color>
</style:text-properties>
</style:style>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2.54cm" fo:margin-bottom="2.54cm" fo:margin-left="2.54cm" fo:margin-right="2.54cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="38" style:layout-grid-base-height="0.635cm" style:layout-grid-ruby-height="0cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.423cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm2">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm3" style:page-usage="left">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm4" style:page-usage="right">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm5">
<style:page-layout-properties fo:page-width="22.901cm" fo:page-height="11.4cm" style:num-format="1" style:print-orientation="landscape" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm6">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1cm" fo:margin-bottom="1cm" fo:margin-left="2cm" fo:margin-right="1cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm7">
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:page-layout style:name="pm8">
<style:page-layout-properties fo:page-width="29.7cm" fo:page-height="21.001cm" style:num-format="1" style:print-orientation="landscape" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style/>
<style:footer-style/>
</style:page-layout>
<style:style style:name="dp1" style:family="drawing-page">
<style:drawing-page-properties draw:background-size="full"/>
</style:style>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/>
<style:master-page style:name="First_20_Page" style:display-name="First Page" style:page-layout-name="pm2" style:next-style-name="Standard"/>
<style:master-page style:name="Left_20_Page" style:display-name="Left Page" style:page-layout-name="pm3" style:next-style-name="Right_20_Page"/>
<style:master-page style:name="Right_20_Page" style:display-name="Right Page" style:page-layout-name="pm4" style:next-style-name="Left_20_Page"/>
<style:master-page style:name="Envelope" style:page-layout-name="pm5"/>
<style:master-page style:name="Index" style:page-layout-name="pm2"/>
<style:master-page style:name="HTML" style:page-layout-name="pm6"/>
<style:master-page style:name="Footnote" style:page-layout-name="pm7"/>
<style:master-page style:name="Endnote" style:page-layout-name="pm7"/>
<style:master-page style:name="Landscape" style:page-layout-name="pm8"/>
</office:master-styles>
<office:body>
<office:text>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
<text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
</text:sequence-decls>
<text:p text:style-name="Standard" loext:marker-style-name="T1"><text:span text:style-name="T1">Sample Text</text:span></text:p>
</office:text>
</office:body>
</office:document>
@@ -0,0 +1,56 @@
/* -*- 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 <swmodeltestbase.hxx>
#include <o3tl/string_view.hxx>
#include <docmodel/uno/UnoComplexColor.hxx>
#include <docmodel/color/ComplexColor.hxx>
class Test : public SwModelTestBase
{
public:
Test()
: SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text")
{
}
};
DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_ODF,
"Test_ThemePortionLevel_CharColor.fodt", nullptr, Test)
{
auto xParagraph = getParagraph(1);
CPPUNIT_ASSERT(xParagraph.is());
auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(getRun(xParagraph, 1),
"CharComplexColor");
auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType());
auto const& rTransforms = aComplexColor.getTransformations();
CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType);
CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
}
DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_DOCX,
"Test_ThemePortionLevel_CharColor.docx", nullptr, Test)
{
auto xParagraph = getParagraph(1);
CPPUNIT_ASSERT(xParagraph.is());
auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(getRun(xParagraph, 1),
"CharComplexColor");
auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType());
auto const& rTransforms = aComplexColor.getTransformations();
CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType);
CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+91 -26
View File
@@ -7648,10 +7648,27 @@ void DocxAttributeOutput::CharCaseMap( const SvxCaseMapItem& rCaseMap )
}
}
void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
void DocxAttributeOutput::CharColor(const SvxColorItem& rColorItem)
{
const Color aColor( rColor.GetValue() );
OString aColorString = msfilter::util::ConvertColor( aColor );
static std::unordered_map<model::ThemeColorType, const char*> constThemeColorTypeTokenMap = {
{ model::ThemeColorType::Dark1, "dark1" },
{ model::ThemeColorType::Light1, "light1" },
{ model::ThemeColorType::Dark2, "dark2" },
{ model::ThemeColorType::Light2, "light2" },
{ model::ThemeColorType::Accent1, "accent1" },
{ model::ThemeColorType::Accent2, "accent2" },
{ model::ThemeColorType::Accent3, "accent3" },
{ model::ThemeColorType::Accent4, "accent4" },
{ model::ThemeColorType::Accent5, "accent5" },
{ model::ThemeColorType::Accent6, "accent6" },
{ model::ThemeColorType::Hyperlink, "hlink" },
{ model::ThemeColorType::FollowedHyperlink, "folHlink" }
};
const Color aColor = rColorItem.getColor();
const model::ComplexColor aComplexColor = rColorItem.getComplexColor();
OString aColorString = msfilter::util::ConvertColor(aColor);
std::string_view pExistingValue;
if (m_pColorAttrList.is() && m_pColorAttrList->getAsView(FSNS(XML_w, XML_val), pExistingValue))
@@ -7660,7 +7677,77 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
return;
}
AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_val ), aColorString );
if (aComplexColor.getType() == model::ColorType::Scheme &&
aComplexColor.getSchemeType() != model::ThemeColorType::Unknown)
{
OString sSchemeType = constThemeColorTypeTokenMap[aComplexColor.getSchemeType()];
if (aComplexColor.meThemeColorUsage == model::ThemeColorUsage::Text)
{
if (aComplexColor.getSchemeType() == model::ThemeColorType::Dark1)
sSchemeType = "text1";
else if (aComplexColor.getSchemeType() == model::ThemeColorType::Dark2)
sSchemeType = "text2";
}
else if (aComplexColor.meThemeColorUsage == model::ThemeColorUsage::Background)
{
if (aComplexColor.getSchemeType() == model::ThemeColorType::Light1)
sSchemeType = "background1";
else if (aComplexColor.getSchemeType() == model::ThemeColorType::Light2)
sSchemeType = "background2";
}
AddToAttrList(m_pColorAttrList, FSNS(XML_w, XML_themeColor), sSchemeType);
sal_Int16 nLumMod = 10'000;
sal_Int16 nLumOff = 0;
sal_Int16 nTint = 0;
sal_Int16 nShade = 0;
for (auto const& rTransform : aComplexColor.getTransformations())
{
if (rTransform.meType == model::TransformationType::LumMod)
nLumMod = rTransform.mnValue;
if (rTransform.meType == model::TransformationType::LumOff)
nLumOff = rTransform.mnValue;
if (rTransform.meType == model::TransformationType::Tint)
nTint = rTransform.mnValue;
if (rTransform.meType == model::TransformationType::Shade)
nShade = rTransform.mnValue;
}
if (nLumMod == 10'000 && nLumOff == 0)
{
if (nTint != 0)
{
// Convert from 0-100 into 0-255
sal_Int16 nTint255 = std::round(255.0 - (double(nTint) / 10000.0) * 255.0);
AddToAttrList(m_pColorAttrList, FSNS(XML_w, XML_themeTint), OString::number(nTint255, 16));
}
else if (nShade != 0)
{
// Convert from 0-100 into 0-255
sal_Int16 nShade255 = std::round(255.0 - (double(nShade) / 10000.0) * 255.0);
AddToAttrList(m_pColorAttrList, FSNS(XML_w, XML_themeShade), OString::number(nShade255, 16));
}
}
else
{
double nPercentage = 0.0;
if (nLumOff > 0)
nPercentage = double(nLumOff) / 100.0;
else
nPercentage = (-10'000 + double(nLumMod)) / 100.0;
// Convert from 0-100 into 0-255
sal_Int16 nTintShade255 = std::round(255.0 - (std::abs(nPercentage) / 100.0) * 255.0);
if (nPercentage > 0)
AddToAttrList(m_pColorAttrList, FSNS(XML_w, XML_themeTint), OString::number(nTintShade255, 16));
else if (nPercentage < 0)
AddToAttrList(m_pColorAttrList, FSNS(XML_w, XML_themeShade), OString::number(nTintShade255, 16));
}
}
AddToAttrList(m_pColorAttrList, FSNS(XML_w, XML_val), aColorString);
m_nCharTransparence = 255 - aColor.GetAlpha();
}
@@ -9892,7 +9979,6 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
bool bWriteCSTheme = true;
bool bWriteAsciiTheme = true;
bool bWriteEastAsiaTheme = true;
bool bWriteThemeFontColor = true;
OUString sOriginalValue;
for ( const auto & rGrabBagElement : rMap )
{
@@ -9914,12 +10000,6 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
bWriteEastAsiaTheme =
( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_eastAsia ) ) == sOriginalValue );
}
else if ( m_pColorAttrList.is() && rGrabBagElement.first == "CharThemeOriginalColor" )
{
if ( rGrabBagElement.second >>= sOriginalValue )
bWriteThemeFontColor =
( m_pColorAttrList->getOptionalValue( FSNS( XML_w, XML_val ) ) == sOriginalValue );
}
}
// save theme attributes back to the run properties
@@ -9948,21 +10028,6 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
rGrabBagElement.second >>= str;
AddToAttrList( m_pFontsAttrList, FSNS( XML_w, XML_hAnsiTheme ), str );
}
else if ( rGrabBagElement.first == "CharThemeColor" && bWriteThemeFontColor )
{
rGrabBagElement.second >>= str;
AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_themeColor ), str );
}
else if ( rGrabBagElement.first == "CharThemeColorShade" )
{
rGrabBagElement.second >>= str;
AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_themeShade ), str );
}
else if ( rGrabBagElement.first == "CharThemeColorTint" )
{
rGrabBagElement.second >>= str;
AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_themeTint ), str );
}
else if( rGrabBagElement.first == "CharThemeFontNameCs" ||
rGrabBagElement.first == "CharThemeFontNameAscii" ||
rGrabBagElement.first == "CharThemeFontNameEastAsia" ||
+6 -2
View File
@@ -2225,17 +2225,21 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
auto eType = TDefTableHandler::getThemeColorTypeIndex(pThemeColorHandler->mnIndex);
if (eType != model::ThemeColorType::Unknown)
{
model::ComplexColor aComplexColor;
aComplexColor.setSchemeColor(eType);
auto eUsage = TDefTableHandler::getThemeColorUsage(pThemeColorHandler->mnIndex);
aComplexColor.meThemeColorUsage = eUsage;
if (pThemeColorHandler->mnTint > 0 )
{
sal_Int16 nTint = sal_Int16((256 - pThemeColorHandler->mnTint) * 10000 / 256);
sal_Int16 nTint = sal_Int16((255 - pThemeColorHandler->mnTint) * 10000 / 255);
aComplexColor.addTransformation({model::TransformationType::Tint, nTint});
}
if (pThemeColorHandler->mnShade > 0)
{
sal_Int16 nShade = sal_Int16((256 - pThemeColorHandler->mnShade) * 10000 / 256);
sal_Int16 nShade = sal_Int16((255 - pThemeColorHandler->mnShade) * 10000 / 255);
aComplexColor.addTransformation({model::TransformationType::Shade, nShade});
}
@@ -313,6 +313,22 @@ model::ThemeColorType TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
return model::ThemeColorType::Unknown;
}
model::ThemeColorUsage TDefTableHandler::getThemeColorUsage(sal_Int32 nType)
{
switch (nType)
{
case NS_ooxml::LN_Value_St_ThemeColor_background1:
case NS_ooxml::LN_Value_St_ThemeColor_background2:
return model::ThemeColorUsage::Background;
case NS_ooxml::LN_Value_St_ThemeColor_text1:
case NS_ooxml::LN_Value_St_ThemeColor_text2:
return model::ThemeColorUsage::Text;
default:
break;
}
return model::ThemeColorUsage::Unknown;
}
void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
{
sal_Int32 nIntValue = rVal.getInt();
@@ -69,6 +69,7 @@ public:
static OUString getBorderTypeString(sal_Int32 nType);
static OUString getThemeColorTypeString(sal_Int32 nType);
static model::ThemeColorType getThemeColorTypeIndex(sal_Int32 nType);
static model::ThemeColorUsage getThemeColorUsage(sal_Int32 nType);
};
}