[Libreoffice-commits] core.git: compilerplugins/clang dbaccess/source editeng/source filter/source sc/source sd/source sfx2/source starmath/source svtools/source svx/source sw/source vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Feb 22 06:24:24 UTC 2018


 compilerplugins/clang/redundantcopy.cxx                |    1 +
 compilerplugins/clang/test/redundantcopy.cxx           |   13 +++++++++++++
 dbaccess/source/ui/querydesign/JoinTableView.cxx       |    2 +-
 dbaccess/source/ui/querydesign/TableWindow.cxx         |    2 +-
 dbaccess/source/ui/querydesign/TableWindowTitle.cxx    |    4 ++--
 editeng/source/editeng/impedit3.cxx                    |    2 +-
 filter/source/msfilter/msdffimp.cxx                    |    3 +--
 filter/source/msfilter/util.cxx                        |    2 +-
 sc/source/ui/view/hdrcont.cxx                          |    2 +-
 sd/source/filter/html/htmlex.cxx                       |    6 +++---
 sd/source/ui/annotations/annotationmanager.cxx         |    6 +++---
 sd/source/ui/dlg/animobjs.cxx                          |    4 ++--
 sd/source/ui/dlg/docprev.cxx                           |    4 ++--
 sd/source/ui/dlg/headerfooterdlg.cxx                   |    2 +-
 sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx |    8 ++++----
 sd/source/ui/slidesorter/view/SlsTheme.cxx             |    2 +-
 sd/source/ui/view/sdview.cxx                           |    2 +-
 sfx2/source/sidebar/Paint.cxx                          |    2 +-
 starmath/source/tmpdevice.cxx                          |    2 +-
 svtools/source/control/ruler.cxx                       |    4 ++--
 svx/source/dialog/connctrl.cxx                         |    2 +-
 svx/source/dialog/dlgctrl.cxx                          |    2 +-
 svx/source/dialog/paraprev.cxx                         |    2 +-
 svx/source/dialog/swframeexample.cxx                   |    2 +-
 svx/source/styles/CommonStylePreviewRenderer.cxx       |    4 ++--
 svx/source/svdraw/svdpntv.cxx                          |    2 +-
 svx/source/tbxctrls/layctrl.cxx                        |    4 ++--
 svx/source/tbxctrls/tbcontrl.cxx                       |    4 ++--
 svx/source/unodraw/unoctabl.cxx                        |    2 +-
 sw/source/filter/ww8/ww8graf.cxx                       |    4 ++--
 sw/source/filter/ww8/ww8par.cxx                        |    3 +--
 sw/source/filter/ww8/ww8par6.cxx                       |    2 +-
 sw/source/ui/config/optpage.cxx                        |    8 ++++----
 sw/source/uibase/docvw/PostItMgr.cxx                   |    6 +++---
 vcl/source/bitmap/BitmapProcessor.cxx                  |    2 +-
 35 files changed, 67 insertions(+), 55 deletions(-)

New commits:
commit 331b4603be47fe059095307b2b3e2c1d399b04f9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 21 14:07:42 2018 +0200

    loplugin:redundantcopy extend to Color
    
    Change-Id: I224cc955d49ee100d328e0171da710f38068d2d4
    Reviewed-on: https://gerrit.libreoffice.org/50114
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/redundantcopy.cxx b/compilerplugins/clang/redundantcopy.cxx
index 4466339095cc..bffe89014eeb 100644
--- a/compilerplugins/clang/redundantcopy.cxx
+++ b/compilerplugins/clang/redundantcopy.cxx
@@ -33,6 +33,7 @@ public:
         }
         auto tc = loplugin::TypeCheck(t1);
         if (!(tc.Class("OUString").Namespace("rtl").GlobalNamespace()
+              || tc.Class("Color").GlobalNamespace()
               || tc.Class("unique_ptr").StdNamespace()))
         {
             return true;
diff --git a/compilerplugins/clang/test/redundantcopy.cxx b/compilerplugins/clang/test/redundantcopy.cxx
index 24207a60be69..0e3e7f0377c2 100644
--- a/compilerplugins/clang/test/redundantcopy.cxx
+++ b/compilerplugins/clang/test/redundantcopy.cxx
@@ -12,6 +12,9 @@
 #include <memory>
 
 #include "rtl/ustring.hxx"
+#include "tools/color.hxx"
+
+void method1(OUString const &);
 
 int main() {
     OUString s;
@@ -22,6 +25,16 @@ int main() {
     (void) T2(s); // expected-error {{redundant copy construction from 'rtl::OUString' to 'T2' (aka 'const rtl::OUString') [loplugin:redundantcopy]}}
 
     (void) std::unique_ptr<int>(std::unique_ptr<int>(new int{})); // expected-error {{redundant copy construction from 'std::unique_ptr<int>' to 'std::unique_ptr<int>' [loplugin:redundantcopy]}}
+
+    OUString s1;
+    method1( OUString(s1) ); // expected-error {{redundant copy construction from 'rtl::OUString' to 'rtl::OUString' [loplugin:redundantcopy]}}
+
+    OUString s2;
+    s2 = OUString(s1); // expected-error {{redundant copy construction from 'rtl::OUString' to 'rtl::OUString' [loplugin:redundantcopy]}}
+
+    Color col1;
+    Color col2 = Color(col1); // expected-error {{redundant copy construction from 'Color' to 'Color' [loplugin:redundantcopy]}}
+    (void)col2;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 1437d3deb64c..8de5711da57f 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -607,7 +607,7 @@ void OJoinTableView::InitColors()
 {
     // the colors for the illustration should be the system colors
     StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
-    SetBackground(Wallpaper(Color(aSystemStyle.GetDialogColor())));
+    SetBackground(Wallpaper(aSystemStyle.GetDialogColor()));
 }
 
 void OJoinTableView::BeginChildMove( OTableWindow* pTabWin, const Point& rMousePos  )
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 2267047e1378..6843cc1ecbd2 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -321,7 +321,7 @@ void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt)
         // In the worst-case the colours have changed so
         // adapt myself to the new colours
         const StyleSettings&  aSystemStyle = Application::GetSettings().GetStyleSettings();
-        SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor())));
+        SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
         SetTextColor(aSystemStyle.GetButtonTextColor());
     }
 }
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 5a6939a88d7e..6a917ec8c034 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -43,7 +43,7 @@ OTableWindowTitle::OTableWindowTitle( OTableWindow* pParent ) :
 {
     // set background- and text colour
     StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
-    SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor())));
+    SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
     SetTextColor(aSystemStyle.GetButtonTextColor());
 
     vcl::Font aFont( GetFont() );
@@ -168,7 +168,7 @@ void OTableWindowTitle::DataChanged(const DataChangedEvent& rDCEvt)
     {
         // assume worst-case: colours have changed, therefore I have to adept
         StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
-        SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor())));
+        SetBackground(Wallpaper(aSystemStyle.GetFaceColor()));
         SetTextColor(aSystemStyle.GetButtonTextColor());
     }
 }
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 211fa6387c2c..a5879f7bdb6d 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3667,7 +3667,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                             }
                                         }
                                         Color aOldColor( pOutDev->GetLineColor() );
-                                        pOutDev->SetLineColor( Color( GetColorConfig().GetColorValue( svtools::SPELL ).nColor ) );
+                                        pOutDev->SetLineColor( GetColorConfig().GetColorValue( svtools::SPELL ).nColor );
                                         lcl_DrawRedLines( pOutDev, aTmpFont.GetFontSize().Height(), aRedLineTmpPos, static_cast<size_t>(nIndex), static_cast<size_t>(nIndex) + rTextPortion.GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), rTextPortion.IsRightToLeft() );
                                         pOutDev->SetLineColor( aOldColor );
                                     }
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 376eee8c7d03..da4b6d4258ac 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5427,8 +5427,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
             SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR,
                                                      false, &pPoolItem );
             if( SfxItemState::DEFAULT == eState )
-                aSet.Put( XFillColorItem( OUString(),
-                          Color( mnDefaultColor ) ) );
+                aSet.Put( XFillColorItem( OUString(), mnDefaultColor ) );
             pObj->SetMergedItemSet(aSet);
         }
 
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index bcc877a40957..0a4446984dbd 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -1326,7 +1326,7 @@ sal_uInt8 TransColToIco( const Color& rCol )
         };
         BitmapPalette aBmpPal(16);
         for( sal_uInt16 i = 0; i < 16; ++i )
-            aBmpPal[i] = Color( aColArr[ i ] );
+            aBmpPal[i] = aColArr[ i ];
 
         nCol = static_cast< sal_uInt8 >(GetBestIndex(aBmpPal, rCol) + 1);
         break;
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index a73b7d84d174..7c0eae5c4306 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -455,7 +455,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools
                         aTransRect = tools::Rectangle( 0, nTransStart, nBarSize-1, nTransEnd );
                     else
                         aTransRect = tools::Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 );
-                    SetBackground( Color( rStyleSettings.GetFaceColor() ) );
+                    SetBackground( rStyleSettings.GetFaceColor() );
                     DrawSelectionBackground( aTransRect, 0, true, false );
                     SetBackground();
                 }
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 97e84651351c..ffd17fd09389 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -807,9 +807,9 @@ void HtmlExport::SetDocColors( SdPage* pPage )
         pPage = mpDoc->GetSdPage(0, PageKind::Standard);
 
     svtools::ColorConfig aConfig;
-    maVLinkColor = Color(aConfig.GetColorValue(svtools::LINKSVISITED).nColor);
-    maALinkColor = Color(aConfig.GetColorValue(svtools::LINKS).nColor);
-    maLinkColor  = Color(aConfig.GetColorValue(svtools::LINKS).nColor);
+    maVLinkColor = aConfig.GetColorValue(svtools::LINKSVISITED).nColor;
+    maALinkColor = aConfig.GetColorValue(svtools::LINKS).nColor;
+    maLinkColor  = aConfig.GetColorValue(svtools::LINKS).nColor;
     maTextColor  = Color(COL_BLACK);
 
     SfxStyleSheet* pSheet = nullptr;
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index c727d8b8d1ad..d12e80d2e91a 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -1221,7 +1221,7 @@ Color AnnotationManagerImpl::GetColor(sal_uInt16 aAuthorIndex)
             COL_AUTHOR4_NORMAL,     COL_AUTHOR5_NORMAL,     COL_AUTHOR6_NORMAL,
             COL_AUTHOR7_NORMAL,     COL_AUTHOR8_NORMAL,     COL_AUTHOR9_NORMAL };
 
-        return Color( aArrayNormal[ aAuthorIndex % SAL_N_ELEMENTS( aArrayNormal ) ] );
+        return aArrayNormal[ aAuthorIndex % SAL_N_ELEMENTS( aArrayNormal ) ];
     }
 
     return Color(COL_WHITE);
@@ -1236,7 +1236,7 @@ Color AnnotationManagerImpl::GetColorLight(sal_uInt16 aAuthorIndex)
             COL_AUTHOR4_LIGHT,      COL_AUTHOR5_LIGHT,      COL_AUTHOR6_LIGHT,
             COL_AUTHOR7_LIGHT,      COL_AUTHOR8_LIGHT,      COL_AUTHOR9_LIGHT };
 
-        return Color( aArrayLight[ aAuthorIndex % SAL_N_ELEMENTS( aArrayLight ) ] );
+        return aArrayLight[ aAuthorIndex % SAL_N_ELEMENTS( aArrayLight ) ];
     }
 
     return Color(COL_WHITE);
@@ -1251,7 +1251,7 @@ Color AnnotationManagerImpl::GetColorDark(sal_uInt16 aAuthorIndex)
             COL_AUTHOR4_DARK,       COL_AUTHOR5_DARK,       COL_AUTHOR6_DARK,
             COL_AUTHOR7_DARK,       COL_AUTHOR8_DARK,       COL_AUTHOR9_DARK };
 
-        return Color( aArrayAnkor[  aAuthorIndex % SAL_N_ELEMENTS( aArrayAnkor ) ] );
+        return aArrayAnkor[  aAuthorIndex % SAL_N_ELEMENTS( aArrayAnkor ) ];
     }
 
     return Color(COL_WHITE);
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 14e8bf068fa1..b2786b38c451 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -59,7 +59,7 @@ SdDisplay::SdDisplay(vcl::Window* pWin)
 {
     SetMapMode(MapMode(MapUnit::MapPixel));
     const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
-    SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+    SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
 }
 
 SdDisplay::~SdDisplay()
@@ -113,7 +113,7 @@ void SdDisplay::DataChanged( const DataChangedEvent& rDCEvt )
     if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
     {
         const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
-        SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+        SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
         SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode()
             ? sd::OUTPUT_DRAWMODE_CONTRAST
             : sd::OUTPUT_DRAWMODE_COLOR );
diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx
index 85dea1b94a90..a654fbe6417e 100644
--- a/sd/source/ui/dlg/docprev.cxx
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -121,7 +121,7 @@ void SdDocPreviewWin::ImpPaint( OutputDevice* pVDev )
     svtools::ColorConfig aColorConfig;
 
     pVDev->SetLineColor();
-    pVDev->SetFillColor( Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor ) );
+    pVDev->SetFillColor( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
     pVDev->DrawRect(::tools::Rectangle( Point(0,0 ), pVDev->GetOutputSize()));
 }
 
@@ -154,7 +154,7 @@ void SdDocPreviewWin::updateViewSettings()
     else
     {
         svtools::ColorConfig aColorConfig;
-        maDocumentColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+        maDocumentColor = aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor;
     }
 
     Invalidate();
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index be8c9b9641eb..f706d61b0a3d 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -753,7 +753,7 @@ void PresLayoutPreview::Paint(vcl::RenderContext& rRenderContext, SdrTextObj con
     svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( bVisible ? svtools::FONTCOLOR : svtools::OBJECTBOUNDARIES ) );
 
     // paint at OutDev
-    rRenderContext.SetLineColor(Color(aColor.nColor));
+    rRenderContext.SetLineColor(aColor.nColor);
     rRenderContext.SetFillColor();
 
     for (sal_uInt32 a(0); a < aGeometry.count(); a++)
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index e870e7e91dc4..a053444ce89a 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -231,7 +231,7 @@ void PageObjectPainter::PaintPageNumber (
         // Page number is painted on background for hover or selection or
         // both.  Each of these background colors has a predefined luminance
         // which is compatible with the PageNumberHover color.
-        aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHover));
+        aPageNumberColor = mpTheme->GetColor(Theme::Color_PageNumberHover);
     }
     else
     {
@@ -240,7 +240,7 @@ void PageObjectPainter::PaintPageNumber (
         // When the background color is black then this is interpreted as
         // high contrast mode and the font color is set to white.
         if (nBackgroundLuminance == 0)
-            aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHighContrast));
+            aPageNumberColor = mpTheme->GetColor(Theme::Color_PageNumberHighContrast);
         else
         {
             // Compare luminance of default page number color and background
@@ -250,9 +250,9 @@ void PageObjectPainter::PaintPageNumber (
             if (abs(nBackgroundLuminance - nFontLuminance) < 60)
             {
                 if (nBackgroundLuminance > nFontLuminance-30)
-                    aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberBrightBackground));
+                    aPageNumberColor = mpTheme->GetColor(Theme::Color_PageNumberBrightBackground);
                 else
-                    aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberDarkBackground));
+                    aPageNumberColor = mpTheme->GetColor(Theme::Color_PageNumberDarkBackground);
             }
         }
     }
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index 5b22ad40f474..a15c8c382e5e 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -89,7 +89,7 @@ void Theme::Update (const std::shared_ptr<controller::Properties>& rpProperties)
     maColor[Color_Background] = maBackgroundColor;
     const Color aSelectionColor (rpProperties->GetSelectionColor());
     maColor[Color_Selection] = aSelectionColor;
-    if (Color(aSelectionColor).IsBright())
+    if (aSelectionColor.IsBright())
         maColor[Color_PageCountFontColor] = Black;
     else
         maColor[Color_PageCountFontColor] = White;
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 7927bbda1bef..6ffe568b7099 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -260,7 +260,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected
                 if( aColor.bIsVisible )
                 {
                     // get basic object transformation
-                    const basegfx::BColor aRGBColor(Color(aColor.nColor).getBColor());
+                    const basegfx::BColor aRGBColor(aColor.nColor.getBColor());
                     basegfx::B2DHomMatrix aObjectMatrix;
                     basegfx::B2DPolyPolygon aObjectPolyPolygon;
                     pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon);
diff --git a/sfx2/source/sidebar/Paint.cxx b/sfx2/source/sidebar/Paint.cxx
index 6e5a133f3af4..114ef9339b74 100644
--- a/sfx2/source/sidebar/Paint.cxx
+++ b/sfx2/source/sidebar/Paint.cxx
@@ -45,7 +45,7 @@ Paint Paint::Create (const css::uno::Any& rValue)
 {
     Color aColor (0);
     if (rValue >>= aColor)
-        return Paint(Color(aColor));
+        return Paint(aColor);
 
     awt::Gradient aAwtGradient;
     if (rValue >>= aAwtGradient)
diff --git a/starmath/source/tmpdevice.cxx b/starmath/source/tmpdevice.cxx
index 3e822a3f7854..a6bb67a7d77f 100644
--- a/starmath/source/tmpdevice.cxx
+++ b/starmath/source/tmpdevice.cxx
@@ -65,7 +65,7 @@ Color SmTmpDevice::Impl_GetColor( const Color& rColor )
                 nNewCol = COL_BLACK;
         }
     }
-    return Color( nNewCol );
+    return nNewCol;
 }
 
 
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 9e4a87d60f8f..eb34a0204c22 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -969,7 +969,7 @@ void Ruler::ApplySettings(vcl::RenderContext& rRenderContext)
 
     Color aColor;
     svtools::ColorConfig aColorConfig;
-    aColor = Color(aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
+    aColor = aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor;
     ApplyControlBackground(rRenderContext, aColor);
 }
 
@@ -997,7 +997,7 @@ void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
     {
         Color aColor;
         svtools::ColorConfig aColorConfig;
-        aColor = Color(aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
+        aColor = aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor;
         ApplyControlBackground(*this, aColor);
     }
 
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
index ca37e67be718..f9eebf9f8a70 100644
--- a/svx/source/dialog/connctrl.cxx
+++ b/svx/source/dialog/connctrl.cxx
@@ -307,7 +307,7 @@ void SvxXConnectionPreview::SetStyles()
 {
     const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
     SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
-    SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+    SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
 }
 
 void SvxXConnectionPreview::DataChanged( const DataChangedEvent& rDCEvt )
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 129e19c0b25b..92f2d147379c 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -164,7 +164,7 @@ void SvxRectCtl::InitRectBitmap()
     aColorAry2[2] = rStyles.GetLightColor();
     aColorAry2[3] = rStyles.GetShadowColor();
     aColorAry2[4] = rStyles.GetDarkShadowColor();
-    aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+    aColorAry2[5] = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
     aColorAry2[6] = rStyles.GetDialogColor();
 
 #ifdef DBG_UTIL
diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx
index 82dfbf67f0d7..3eee8771b4e5 100644
--- a/svx/source/dialog/paraprev.cxx
+++ b/svx/source/dialog/paraprev.cxx
@@ -68,7 +68,7 @@ void SvxParaPrevWindow::DrawParagraph(vcl::RenderContext& rRenderContext)
     const Color& rWinColor = rStyleSettings.GetWindowColor();
     Color aGrayColor(COL_LIGHTGRAY);
 
-    rRenderContext.SetFillColor(Color(rWinColor));
+    rRenderContext.SetFillColor(rWinColor);
     rRenderContext.DrawRect(tools::Rectangle(Point(), aWinSize));
 
     rRenderContext.SetLineColor();
diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx
index 1e621f420636..245864645af8 100644
--- a/svx/source/dialog/swframeexample.cxx
+++ b/svx/source/dialog/swframeexample.cxx
@@ -71,7 +71,7 @@ Size SvxSwFrameExample::GetOptimalSize() const
 void SvxSwFrameExample::InitColors_Impl()
 {
     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
-    m_aBgCol = Color( rSettings.GetWindowColor() );
+    m_aBgCol = rSettings.GetWindowColor();
 
     bool bHC = rSettings.GetHighContrastMode();
 
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx
index 866c2edc9a6c..f56d6fed9513 100644
--- a/svx/source/styles/CommonStylePreviewRenderer.cxx
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -113,7 +113,7 @@ bool CommonStylePreviewRenderer::recalculate()
     }
     if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_COLOR)) != nullptr)
     {
-        maFontColor = Color(static_cast<const SvxColorItem*>(pItem)->GetValue());
+        maFontColor = static_cast<const SvxColorItem*>(pItem)->GetValue();
     }
 
     if (mpStyle->GetFamily() == SfxStyleFamily::Para)
@@ -125,7 +125,7 @@ bool CommonStylePreviewRenderer::recalculate()
             {
                 if ((pItem = pItemSet->GetItem(XATTR_FILLCOLOR)) != nullptr)
                 {
-                    maBackgroundColor = Color(static_cast<const XFillColorItem*>(pItem)->GetColorValue());
+                    maBackgroundColor = static_cast<const XFillColorItem*>(pItem)->GetColorValue();
                 }
             }
         }
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index ee95936790d7..fd3d6ecffc57 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -1244,7 +1244,7 @@ void SdrPaintView::VisAreaChanged()
 
 void SdrPaintView::onChangeColorConfig()
 {
-    maGridColor = Color( maColorConfig.GetColorValue( svtools::DRAWGRID ).nColor );
+    maGridColor = maColorConfig.GetColorValue( svtools::DRAWGRID ).nColor;
 }
 
 
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index ed6b6fcf0883..3314ec00b02c 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -130,7 +130,7 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, vcl::Window* pParent, const OUStri
 
     SetBackground( aBackgroundColor );
     vcl::Font aFont = GetFont();
-    aFont.SetColor( ::Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor )  );
+    aFont.SetColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
     aFont.SetFillColor( aBackgroundColor );
     aFont.SetTransparent( false );
     SetFont( aFont );
@@ -416,7 +416,7 @@ ColumnsWindow::ColumnsWindow( sal_uInt16 nId, vcl::Window* pParent, const OUStri
 {
     const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
     svtools::ColorConfig aColorConfig;
-    aLineColor = ::Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+    aLineColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
     aHighlightLineColor = rStyles.GetHighlightTextColor();
     aFillColor = rStyles.GetWindowColor();
     aHighlightFillColor = rStyles.GetHighlightColor();
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 20d04a2c055e..d1a47efad2a8 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -742,7 +742,7 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo
                 pItem = pItemSet->GetItem( SID_ATTR_CHAR_COLOR );
                 // text color, when nothing is selected
                 if ( (nullptr != pItem) && bIsNotSelected)
-                    aFontCol = Color( static_cast< const SvxColorItem* >( pItem )->GetValue() );
+                    aFontCol = static_cast< const SvxColorItem* >( pItem )->GetValue();
 
                 drawing::FillStyle style = drawing::FillStyle_NONE;
                 // which kind of Fill style is selected
@@ -758,7 +758,7 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo
                         // set background color
                         pItem = pItemSet->GetItem( XATTR_FILLCOLOR );
                         if ( nullptr != pItem )
-                            aBackCol = Color( static_cast< const XFillColorItem* >( pItem )->GetColorValue() );
+                            aBackCol = static_cast< const XFillColorItem* >( pItem )->GetColorValue();
 
                         if ( aBackCol != COL_AUTO )
                         {
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index 267726fe93c5..a2474deb9052 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -122,7 +122,7 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno:
     if( nIndex == -1  )
         throw container::NoSuchElementException();
 
-    pList->Replace(nIndex, o3tl::make_unique<XColorEntry>(Color(static_cast<Color>(nColor)), aName ));
+    pList->Replace(nIndex, o3tl::make_unique<XColorEntry>(static_cast<Color>(nColor), aName ));
 }
 
 // XNameAccess
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 61ad5ce85638..8f7cf453a6c1 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -141,7 +141,7 @@ Color WW8TransCol(SVBT32 nWC)
                 nIdx += ((nWC[i] == 0xff) ? 2 : 1);
         }
         if (eColA[nIdx] != COL_BLACK)
-            return Color(eColA[nIdx]);  // default color
+            return eColA[nIdx];  // default color
     }
 #endif
 
@@ -1759,7 +1759,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
         const sal_Int32 nShdDistY = WW8ITEMVALUE(rOldSet, SDRATTR_SHADOWYDIST,
             SdrMetricItem);
 
-        aShadow.SetColor( Color( aShdColor ) );
+        aShadow.SetColor( aShdColor );
 
         aShadow.SetWidth(writer_cast<sal_uInt16>((std::abs( nShdDistX) +
             std::abs( nShdDistY )) / 2 ));
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 2be8a9562df4..05f9de2d82f7 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -930,8 +930,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
             SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR,
                                                      false, &pPoolItem );
             if( SfxItemState::DEFAULT == eState )
-                aSet.Put( XFillColorItem( OUString(),
-                          Color( mnDefaultColor ) ) );
+                aSet.Put( XFillColorItem( OUString(), mnDefaultColor ) );
             pObj->SetMergedItemSet(aSet);
         }
 
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e9ad64afc8b9..073c0913480b 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3472,7 +3472,7 @@ void SwWW8ImplReader::Read_TextColor( sal_uInt16, const sal_uInt8* pData, short
         if( b > 16 )                // unknown -> Black
             b = 0;
 
-        NewAttr( SvxColorItem(Color(GetCol(b)), RES_CHRATR_COLOR));
+        NewAttr( SvxColorItem(GetCol(b), RES_CHRATR_COLOR));
         if (m_pCurrentColl && m_xStyles)
             m_xStyles->bTextColChanged = true;
     }
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index ec277a1922d9..5634f8153bc5 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1590,7 +1590,7 @@ void SwMarkPreview::InitColors()
     // m_aTransCol and m_aMarkCol are _not_ changed because they are set from outside!
 
     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
-    m_aBgCol = Color( rSettings.GetWindowColor() );
+    m_aBgCol = rSettings.GetWindowColor();
 
     bool bHC = rSettings.GetHighContrastMode();
     m_aLineCol = bHC? SwViewOption::GetFontColor() : Color( COL_BLACK );
@@ -1917,13 +1917,13 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet*  )
     InitFontStyle(*m_pChangedPreviewWN);
 
     Color nColor = rInsertAttr.m_nColor;
-    m_pInsertColorLB->SelectEntry(Color(nColor));
+    m_pInsertColorLB->SelectEntry(nColor);
 
     nColor = rDeletedAttr.m_nColor;
-    m_pDeletedColorLB->SelectEntry(Color(nColor));
+    m_pDeletedColorLB->SelectEntry(nColor);
 
     nColor = rChangedAttr.m_nColor;
-    m_pChangedColorLB->SelectEntry(Color(nColor));
+    m_pChangedColorLB->SelectEntry(nColor);
 
     m_pMarkColorLB->SelectEntry(pOpt->GetMarkAlignColor());
 
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 479770bf6d70..0eb0cbb2d9e0 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -2044,7 +2044,7 @@ Color SwPostItMgr::GetColorDark(std::size_t aAuthorIndex)
             COL_AUTHOR4_NORMAL,     COL_AUTHOR5_NORMAL,     COL_AUTHOR6_NORMAL,
             COL_AUTHOR7_NORMAL,     COL_AUTHOR8_NORMAL,     COL_AUTHOR9_NORMAL };
 
-        return Color( aArrayNormal[ aAuthorIndex % SAL_N_ELEMENTS( aArrayNormal )]);
+        return aArrayNormal[ aAuthorIndex % SAL_N_ELEMENTS( aArrayNormal )];
     }
     else
         return Color(COL_WHITE);
@@ -2059,7 +2059,7 @@ Color SwPostItMgr::GetColorLight(std::size_t aAuthorIndex)
             COL_AUTHOR4_LIGHT,      COL_AUTHOR5_LIGHT,      COL_AUTHOR6_LIGHT,
             COL_AUTHOR7_LIGHT,      COL_AUTHOR8_LIGHT,      COL_AUTHOR9_LIGHT };
 
-        return Color( aArrayLight[ aAuthorIndex % SAL_N_ELEMENTS( aArrayLight )]);
+        return aArrayLight[ aAuthorIndex % SAL_N_ELEMENTS( aArrayLight )];
     }
     else
         return Color(COL_WHITE);
@@ -2074,7 +2074,7 @@ Color SwPostItMgr::GetColorAnchor(std::size_t aAuthorIndex)
             COL_AUTHOR4_DARK,       COL_AUTHOR5_DARK,       COL_AUTHOR6_DARK,
             COL_AUTHOR7_DARK,       COL_AUTHOR8_DARK,       COL_AUTHOR9_DARK };
 
-        return Color( aArrayAnchor[  aAuthorIndex % SAL_N_ELEMENTS( aArrayAnchor )]);
+        return aArrayAnchor[  aAuthorIndex % SAL_N_ELEMENTS( aArrayAnchor )];
     }
     else
         return Color(COL_WHITE);
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 378191ece8bd..ab191189ccf6 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -34,7 +34,7 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx)
                 BitmapColor aBmpColor = pRead->HasPalette() ?
                                         pRead->GetPaletteColor(pRead->GetIndexFromData(pScanlineRead, nX)) :
                                         pRead->GetPixelFromData(pScanlineRead, nX);
-                basegfx::BColor aBColor(Color(aBmpColor.Invert().GetColor()).getBColor());
+                basegfx::BColor aBColor(aBmpColor.Invert().GetColor().getBColor());
                 aBColor = basegfx::utils::rgb2hsl(aBColor);
 
                 double fHue = aBColor.getRed();


More information about the Libreoffice-commits mailing list