chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx      |    5 -
 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx |    4 -
 editeng/source/items/textitem.cxx                                  |    4 -
 filter/source/msfilter/msdffimp.cxx                                |   17 ++---
 include/oox/drawingml/clrscheme.hxx                                |    2 
 oox/qa/unit/drawingml.cxx                                          |    7 ++
 oox/source/drawingml/clrscheme.cxx                                 |   18 +++++
 oox/source/drawingml/theme.cxx                                     |    4 +
 oox/source/export/drawingml.cxx                                    |    2 
 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx                    |    2 
 svx/source/fmcomp/fmgridif.cxx                                     |    2 
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx                  |    4 -
 svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx          |    4 -
 svx/source/styles/ColorSets.cxx                                    |   33 
+++++++++-
 svx/source/table/cell.cxx                                          |    2 
 sw/source/core/graphic/grfatr.cxx                                  |    8 +-
 sw/source/filter/ww8/docxattributeoutput.cxx                       |    3 
 sw/source/filter/ww8/docxsdrexport.cxx                             |    2 
 vcl/win/gdi/DWriteTextRenderer.cxx                                 |    2 
 19 files changed, 88 insertions(+), 37 deletions(-)

New commits:
commit 7ead98eec843e68dcec6c4d5c97a577be7adec4c
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Nov 22 12:22:45 2021 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Nov 22 15:20:24 2021 +0100

    Use less DegreeN::get()
    
    Change-Id: I97b8d6282c72307cc29a913af221d283523f2fae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125653
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index 6a1bb0867803..0dd0e5b6b6fe 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -878,10 +878,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 
nWhichId, const SfxItemSet
 
         case SCHATTR_TEXT_DEGREES:
         {
-            // convert int to double (divided by 100)
-            double fVal = static_cast< double >(
-                static_cast< const SdrAngleItem & >(
-                    rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
+            double fVal = 
toDegrees(rItemSet.Get(SCHATTR_TEXT_DEGREES).GetValue());
             double fOldVal = 0.0;
             bool bPropExisted =
                 ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= 
fOldVal );
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 5b6e9523fbef..990120a97a04 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -551,9 +551,7 @@ bool DataPointItemConverter::ApplySpecialItem(
 
         case SCHATTR_TEXT_DEGREES:
         {
-            double fValue = static_cast< double >(
-                static_cast< const SdrAngleItem & >(
-                    rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
+            double fValue = 
toDegrees(rItemSet.Get(SCHATTR_TEXT_DEGREES).GetValue());
             double fOldValue = 0.0;
             bool bPropExisted =
                 ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= 
fOldValue );
diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 8ecfa67584aa..02f8d6a9be4e 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -2196,7 +2196,7 @@ bool SvxTextRotateItem::GetPresentation(
     {
         rText = EditResId(RID_SVXITEMS_TEXTROTATE);
         rText = rText.replaceFirst("$(ARG1)",
-            OUString::number(GetValue().get() / 10));
+            OUString::number(toDegrees(GetValue())));
     }
     return true;
 }
@@ -2275,7 +2275,7 @@ bool SvxCharRotateItem::GetPresentation(
     {
         rText = EditResId( RID_SVXITEMS_CHARROTATE );
         rText = rText.replaceFirst( "$(ARG1)",
-                    OUString::number( GetValue().get() / 10 ));
+                    OUString::number( toDegrees(GetValue()) ));
         if( IsFitToLine() )
             rText += EditResId( RID_SVXITEMS_CHARROTATE_FITLINE );
     }
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 8e35938ceb5c..8de295d6b897 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2774,7 +2774,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( 
SvStream& rIn, SfxItem
         *pAny >>= fExtraTextRotateAngle;
 
     if ( rManager.mnFix16Angle )
-        fExtraTextRotateAngle += mnFix16Angle.get() / 100.0;
+        fExtraTextRotateAngle += toDegrees(mnFix16Angle);
     if ( rObjData.nSpFlags & ShapeFlag::FlipV )
         fExtraTextRotateAngle -= 180.0;
 
@@ -2797,24 +2797,21 @@ void DffPropertyReader::ImportGradientColor( 
SfxItemSet& aSet, sal_uInt32 eMSO_F
         nChgColors ^= 1;
 
     //Translate a MS clockwise(+) or count clockwise angle(-) into an AOO 
count clock wise angle
-    Degree10 nAngle( 3600 - ( ( Fix16ToAngle(nAngleFix16).get() + 5 ) / 10 ) );
+    Degree10 nAngle( 3600_deg10 - to<Degree10>( Fix16ToAngle(nAngleFix16) ) );
     //Make sure this angle belongs to 0~3600
-    while ( nAngle >= Degree10(3600) ) nAngle -= Degree10(3600);
-    while ( nAngle < Degree10(0) ) nAngle += Degree10(3600);
+    while ( nAngle >= 3600_deg10 ) nAngle -= 3600_deg10;
+    while ( nAngle < 0_deg10 ) nAngle += 3600_deg10;
 
     //Rotate angle
     if ( mbRotateGranientFillWithAngle )
     {
         sal_Int32 nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 );
-        if(nRotateAngle)//fixed point number
-            nRotateAngle = ( static_cast<sal_Int16>( nRotateAngle >> 16) * 
100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 );
-        nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up
         //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, 
then gradient needs to be rotated a little less
         //or it needs to be rotated a little more
-        nAngle -=  Degree10(nRotateAngle);
+        nAngle -= to<Degree10>(Fix16ToAngle(nRotateAngle));
     }
-    while ( nAngle >= Degree10(3600) ) nAngle -= Degree10(3600);
-    while ( nAngle < Degree10(0) ) nAngle += Degree10(3600);
+    while ( nAngle >= 3600_deg10 ) nAngle -= 3600_deg10;
+    while ( nAngle < 0_deg10 ) nAngle += 3600_deg10;
 
     css::awt::GradientStyle eGrad = css::awt::GradientStyle_LINEAR;
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index dd112c9b6643..3371c04eac8e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1858,7 +1858,7 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 
     // OOXML flips shapes before rotating them.
     if(bFlipH != bFlipV)
-        nRotation = Degree100(nRotation.get() * -1 + 36000);
+        nRotation = 36000_deg100 - nRotation;
 
     WriteTransformation(rXShape, tools::Rectangle(Point(aPos.X, aPos.Y), 
Size(aSize.Width, aSize.Height)), nXmlNamespace,
             bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation + 
nCameraRotation), IsGroupShape( rXShape ));
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx 
b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 28f17f3054dc..370b791573ed 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -322,7 +322,7 @@ void AlignmentPropertyPanel::NotifyItemUpdate(
         if (eState >= SfxItemState::DEFAULT)
         {
             Degree100 nTmp = static_cast<const 
ScRotateValueItem*>(pState)->GetValue();
-            mxMtrAngle->set_value(nTmp.get() / 100, FieldUnit::DEGREE);
+            mxMtrAngle->set_value(toDegrees(nTmp), FieldUnit::DEGREE);
         }
         else
         {
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 40e4eefd7d44..a96472e3ad14 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -97,7 +97,7 @@ static css::awt::FontDescriptor ImplCreateFontDescriptor( 
const vcl::Font& rFont
     aFD.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() );
     aFD.Underline = static_cast<sal_Int16>(rFont.GetUnderline());
     aFD.Strikeout = static_cast<sal_Int16>(rFont.GetStrikeout());
-    aFD.Orientation = rFont.GetOrientation().get() / 10.0;
+    aFD.Orientation = toDegrees(rFont.GetOrientation());
     aFD.Kerning = rFont.IsKerning();
     aFD.WordLineMode = rFont.IsWordLineMode();
     aFD.Type = 0;   // ??? => only to metric...
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx 
b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index f5d550ab51f7..428d35d94d59 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -307,7 +307,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, 
weld::ComboBox&, void)
                 mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor());
                 mxLbFillGradTo->SelectEntry(aGradient.GetEndColor());
 
-                mxMTRAngle->set_value(aGradient.GetAngle().get() / 10, 
FieldUnit::DEGREE);
+                mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), 
FieldUnit::DEGREE);
                 css::awt::GradientStyle eXGS = aGradient.GetGradientStyle();
                 mxGradientStyle->set_active(sal::static_int_cast< sal_Int32 >( 
eXGS ));
             }
@@ -1148,7 +1148,7 @@ void AreaPropertyPanelBase::Update()
                         if(mxGradientStyle->get_active() == 
sal_Int32(GradientStyle::Radial))
                             mxMTRAngle->set_sensitive(false);
                         else
-                            mxMTRAngle->set_value(aGradient.GetAngle().get() / 
10, FieldUnit::DEGREE);
+                            
mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()), FieldUnit::DEGREE);
                     }
                     else
                     {
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx 
b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
index 581d302a9d7d..c6c3fa4e4bbd 100644
--- a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
+++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
@@ -63,7 +63,7 @@ void 
AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem const
 
     if (rGradient.GetXOffset() == AreaPropertyPanelBase::DEFAULT_CENTERX
         && rGradient.GetYOffset() == AreaPropertyPanelBase::DEFAULT_CENTERY
-        && (rGradient.GetAngle().get() / 10) == 
AreaPropertyPanelBase::DEFAULT_ANGLE
+        && static_cast<sal_Int32>(toDegrees(rGradient.GetAngle())) == 
AreaPropertyPanelBase::DEFAULT_ANGLE
         && 
static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetStartColor().GetRed())
 + 1) * 100) / 255)
             == AreaPropertyPanelBase::DEFAULT_STARTVALUE
         && 
static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetEndColor().GetRed())
 + 1) * 100) / 255)
@@ -78,7 +78,7 @@ void 
AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem const
     }
     mxMtrTrgrCenterX->set_value(aGradient.GetXOffset(), FieldUnit::PERCENT);
     mxMtrTrgrCenterY->set_value(aGradient.GetYOffset(), FieldUnit::PERCENT);
-    mxMtrTrgrAngle->set_value(aGradient.GetAngle().get() / 10, 
FieldUnit::DEGREE);
+    mxMtrTrgrAngle->set_value(toDegrees(aGradient.GetAngle()), 
FieldUnit::DEGREE);
     
mxMtrTrgrStartValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aGradient.GetStartColor().GetRed())
 + 1) * 100) / 255), FieldUnit::PERCENT);
     
mxMtrTrgrEndValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aGradient.GetEndColor().GetRed())
 + 1) * 100) / 255), FieldUnit::PERCENT);
     mxMtrTrgrBorder->set_value(aGradient.GetBorder(), FieldUnit::PERCENT);
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 134becd88e8b..f09de95e7826 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -1218,7 +1218,7 @@ Any SAL_CALL Cell::getPropertyValue( const OUString& 
PropertyName )
         case SDRATTR_TABLE_TEXT_ROTATION:
         {
             const SvxTextRotateItem& rTextRotate = 
mpProperties->GetItem(SDRATTR_TABLE_TEXT_ROTATION);
-            return Any(sal_Int32(rTextRotate.GetValue().get() * 10));
+            return Any(sal_Int32(to<Degree100>(rTextRotate.GetValue())));
         }
         default:
         {
diff --git a/sw/source/core/graphic/grfatr.cxx 
b/sw/source/core/graphic/grfatr.cxx
index b267a55c19d2..50a84c12fb8e 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -148,17 +148,17 @@ SwCropGrf* SwCropGrf::Clone( SfxItemPool* ) const
 
 Degree10 SwRotationGrf::checkAndCorrectValue(Degree10 nValue)
 {
-    if(nValue.get() < 0)
+    if (nValue < 0_deg10)
     {
         // smaller zero, modulo (will keep negative) and add one range
         DBG_ASSERT(false, "SwRotationGrf: Value is in 10th degree and *has* to 
be in [0 .. 3600[ (!)");
-        return Degree10(3600 + (nValue.get() % 3600));
+        return 3600_deg10 + nValue % 3600_deg10;
     }
-    else if (nValue.get() >= 3600)
+    else if (nValue >= 3600_deg10)
     {
         // bigger range, use modulo
         DBG_ASSERT(false, "SwRotationGrf: Value is in 10th degree and *has* to 
be in [0 .. 3600[ (!)");
-        return Degree10(nValue.get() % 3600);
+        return nValue % 3600_deg10;
     }
 
     return nValue;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index bcdd1af1af4f..9b6a144ed481 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9388,8 +9388,7 @@ void DocxAttributeOutput::FormatFillGradient( const 
XFillGradientItem& rFillGrad
         //     /oox/source/vml/vmlformatting.cxx :: FillModel::pushToPropMap
         // and also in
         //     /oox/source/drawingml/fillproperties.cxx :: 
FillProperties::pushToPropMap
-        sal_Int32 nReverseAngle = (4500_deg10 - rGradient.GetAngle()).get();
-        nReverseAngle = nReverseAngle / 10;
+        sal_Int32 nReverseAngle = toDegrees(4500_deg10 - rGradient.GetAngle());
         nReverseAngle = (270 - nReverseAngle) % 360;
         if (nReverseAngle != 0)
             AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(),
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index dd15aeee8445..7166ed49565f 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -2082,7 +2082,7 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* 
pParentFrame, bool bText
     m_pImpl->getTextFrameStyle() = "position:absolute";
     if (!bTextBoxOnly)
     {
-        OString 
sRotation(OString::number(m_pImpl->getDMLandVMLTextFrameRotation().get() / 
-100));
+        OString 
sRotation(OString::number(-toDegrees(m_pImpl->getDMLandVMLTextFrameRotation())));
         
m_pImpl->getExport().SdrExporter().getTextFrameStyle().append(";rotation:" + 
sRotation);
     }
     m_pImpl->getExport().OutputFormat(pParentFrame->GetFrameFormat(), false, 
false, true);
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index 177f1e7c3384..edd0b700bdf6 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -414,7 +414,7 @@ 
WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, f
         // degrees.
         aTransform = aTransform
                      * D2D1::Matrix3x2F::Rotation(
-                           -static_cast<FLOAT>(angle.get()) / 10, rBaseline);
+                           -toDegrees(angle), rBaseline);
     }
     mpRenderTarget->SetTransform(aTransform);
 }
commit 2eaf79131dab04acce1411fed1d8ac8ab5c51575
Author:     Miklos Vajna <[email protected]>
AuthorDate: Mon Nov 22 13:31:58 2021 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Nov 22 15:20:09 2021 +0100

    PPTX: implement native handling of <a:clrScheme> children
    
    This was already handled by converting them to raw colors at import
    time. This commit imports the color scheme contents (the 12 colors) into
    the doc model.
    
    This is a dependency to export them back to PPTX and to be able to
    update these colors on the UI by picking a different theme.
    
    Change-Id: I177de4f15d5f0e628669998d1cda7db24220b2eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125651
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/include/oox/drawingml/clrscheme.hxx 
b/include/oox/drawingml/clrscheme.hxx
index fbb107601940..01711fe8bfbd 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -92,6 +92,8 @@ public:
 
     void SetName(const OUString& rName) { maName = rName; }
     const OUString& GetName() const { return maName; }
+
+    void ToAny(css::uno::Any& rVal) const;
 };
 
 }
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index b220170f3edc..e45ee8d98dd1 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -419,6 +419,13 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPptxTheme)
     // i.e. the name of the color scheme was lost on import.
     CPPUNIT_ASSERT_EQUAL(OUString("Office"), 
aMap["ColorSchemeName"].get<OUString>());
 
+    // Check the last color in the color set, value is from 
ppt/theme/theme1.xml.
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Cannot extract an Any(void) to []long!
+    auto aColorScheme = aMap["ColorScheme"].get<uno::Sequence<util::Color>>();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(12), aColorScheme.getLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<util::Color>(0x954F72), aColorScheme[11]);
+
     // Check the reference to that theme:
     uno::Reference<drawing::XShapes> xDrawPageShapes(xDrawPage, 
uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPageShapes->getByIndex(0), 
uno::UNO_QUERY);
diff --git a/oox/source/drawingml/clrscheme.cxx 
b/oox/source/drawingml/clrscheme.cxx
index 6b391d7877a8..19c0afd44900 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -19,9 +19,15 @@
 
 #include <algorithm>
 
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/Color.hpp>
+
 #include <osl/diagnose.h>
 #include <oox/drawingml/clrscheme.hxx>
 #include <oox/token/tokens.hxx>
+#include <comphelper/sequence.hxx>
+
+using namespace com::sun::star;
 
 namespace oox::drawingml {
 
@@ -102,6 +108,18 @@ bool ClrScheme::getColorByIndex(size_t nIndex, ::Color& 
rColor) const
     return true;
 }
 
+void ClrScheme::ToAny(css::uno::Any& rVal) const
+{
+    std::vector<util::Color> aRet;
+
+    for (const auto& rIndexAndColor : maClrScheme)
+    {
+        aRet.push_back(static_cast<sal_Int32>(rIndexAndColor.second));
+    }
+
+    rVal <<= comphelper::containerToSequence(aRet);
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index ba1761311154..56df9941169c 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -105,9 +105,13 @@ const TextFont* Theme::resolveFont( const OUString& rName 
) const
 
 void Theme::addTheme(const css::uno::Reference<css::drawing::XDrawPage>& 
xDrawPage) const
 {
+    beans::PropertyValue aColorScheme;
+    aColorScheme.Name = "ColorScheme";
+    maClrScheme.ToAny(aColorScheme.Value);
     beans::PropertyValues aValues = {
         comphelper::makePropertyValue("Name", maThemeName),
         comphelper::makePropertyValue("ColorSchemeName", 
maClrScheme.GetName()),
+        aColorScheme,
     };
     uno::Reference<beans::XPropertySet> xPropertySet(xDrawPage, 
uno::UNO_QUERY);
     xPropertySet->setPropertyValue("Theme", uno::makeAny(aValues));
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index fbcf4bd4a889..773e7c414ef3 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -15,9 +15,12 @@
 #include <libxml/xmlwriter.h>
 
 #include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/util/Color.hpp>
 
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/sequence.hxx>
+#include <sal/log.hxx>
 
 using namespace com::sun::star;
 
@@ -169,7 +172,14 @@ void Theme::ToAny(css::uno::Any& rVal) const
 
     if (mpColorSet)
     {
+        std::vector<util::Color> aColorScheme;
+        for (size_t i = 0; i < 12; ++i)
+        {
+            
aColorScheme.push_back(static_cast<sal_Int32>(mpColorSet->getColor(i)));
+        }
+
         aMap["ColorSchemeName"] <<= mpColorSet->getName();
+        aMap["ColorScheme"] <<= comphelper::containerToSequence(aColorScheme);
     }
 
     rVal <<= aMap.getAsConstPropertyValueList();
@@ -179,6 +189,7 @@ std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& 
rVal)
 {
     comphelper::SequenceAsHashMap aMap(rVal);
     std::unique_ptr<Theme> pTheme;
+    ColorSet* pColorSet = nullptr;
 
     auto it = aMap.find("Name");
     if (it != aMap.end())
@@ -193,8 +204,26 @@ std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& 
rVal)
     {
         OUString aName;
         it->second >>= aName;
-        auto pColorSet = std::make_unique<ColorSet>(aName);
-        pTheme->SetColorSet(std::move(pColorSet));
+        auto pSet = std::make_unique<ColorSet>(aName);
+        pTheme->SetColorSet(std::move(pSet));
+        pColorSet = pTheme->GetColorSet();
+    }
+
+    it = aMap.find("ColorScheme");
+    if (it != aMap.end() && pColorSet)
+    {
+        uno::Sequence<util::Color> aColors;
+        it->second >>= aColors;
+        for (size_t i = 0; i < aColors.size(); ++i)
+        {
+            if (i >= 12)
+            {
+                SAL_WARN("svx", "Theme::FromAny: too many colors in the color 
set");
+                break;
+            }
+
+            pColorSet->add(i, Color(ColorTransparency, aColors[i]));
+        }
     }
 
     return pTheme;

Reply via email to