[Libreoffice-commits] core.git: include/vcl sd/source vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 7 19:15:16 UTC 2018


 include/vcl/image.hxx                             |    3 +++
 sd/source/ui/controller/slidelayoutcontroller.cxx |    2 +-
 vcl/source/control/fixed.cxx                      |    2 +-
 vcl/source/image/Image.cxx                        |    5 +++++
 vcl/source/window/builder.cxx                     |    4 ++--
 vcl/source/window/msgbox.cxx                      |    8 ++++----
 6 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 0f104bf33530467380044b9eb4cd3f8bd9c283f1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Dec 7 14:25:36 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Dec 7 20:14:45 2018 +0100

    utility constructor for Image "private:graphicrepository" urls
    
    Change-Id: I118039f4e47818a43da9302ce3550ea800522675
    Reviewed-on: https://gerrit.libreoffice.org/64765
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins

diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx
index 17bfce780461..c115a676102d 100644
--- a/include/vcl/image.hxx
+++ b/include/vcl/image.hxx
@@ -45,6 +45,8 @@ namespace vcl
 
 #define IMAGELIST_IMAGE_NOTFOUND    (sal_uInt16(0xFFFF))
 
+enum class StockImage { Yes };
+
 class SAL_WARN_UNUSED VCL_DLLPUBLIC Image
 {
     friend class ::OutputDevice;
@@ -54,6 +56,7 @@ public:
                     explicit Image( const BitmapEx& rBitmapEx );
                     explicit Image( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic );
                     explicit Image( const OUString &rPNGFileUrl );
+                    explicit Image( StockImage, const OUString &rPNGFilePath );
 
     Size            GetSizePixel() const;
 
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 6f4ba93c1e92..27d597b2172f 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -132,7 +132,7 @@ static void fillLayoutValueSet( ValueSet* pValue, const snewfoil_value_info_layo
     for( ; pInfo->mpStrResId; pInfo++ )
     {
         OUString aText(SdResId(pInfo->mpStrResId));
-        Image aImg("private:graphicrepository/" + OUString::createFromAscii(pInfo->msBmpResId));
+        Image aImg(StockImage::Yes, OUString::createFromAscii(pInfo->msBmpResId));
         pValue->InsertItem(static_cast<sal_uInt16>(pInfo->maAutoLayout)+1, aImg, aText);
         aLayoutItemSize.setWidth( std::max( aLayoutItemSize.Width(),  aImg.GetSizePixel().Width()  ) );
         aLayoutItemSize.setHeight( std::max( aLayoutItemSize.Height(), aImg.GetSizePixel().Height() ) );
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 7423859045d5..365c421e9b34 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -951,7 +951,7 @@ void FixedImage::SetModeImage( const Image& rImage )
 
 Image FixedImage::loadThemeImage(const OUString &rFileName)
 {
-    return Image("private:graphicrepository/" + rFileName);
+    return Image(StockImage::Yes, rFileName);
 }
 
 bool FixedImage::set_property(const OString &rKey, const OUString &rValue)
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index ecb514c5bbac..e22f5f814304 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -70,6 +70,11 @@ Image::Image(const OUString & rFileUrl)
     }
 }
 
+Image::Image(StockImage, const OUString & rFileUrl)
+    : mpImplData(new ImplImage(rFileUrl))
+{
+}
+
 void Image::ImplInit(const BitmapEx& rBitmapEx)
 {
     if (!rBitmapEx.IsEmpty())
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 8ff3f0621d2a..210982ddb365 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -676,7 +676,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
                 SAL_WARN_IF(eType != SymbolType::IMAGE, "vcl.layout", "unimplemented symbol type for radiobuttons");
             if (eType == SymbolType::IMAGE)
             {
-                Image const aImage("private:graphicrepository/" +
+                Image const aImage(StockImage::Yes,
                                    mapStockToImageResource(rImageInfo.m_sStock));
                 if (!elem.m_bRadio)
                     pTargetButton->SetModeImage(aImage);
@@ -721,7 +721,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
         if (eType != SymbolType::IMAGE)
             continue;
 
-        Image const aImage("private:graphicrepository/" +
+        Image const aImage(StockImage::Yes,
                            mapStockToImageResource(rImageInfo.m_sStock));
         pImage->SetImage(aImage);
     }
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 31307c542a9c..23f7ca2f5e73 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -40,10 +40,10 @@ static void ImplInitMsgBoxImageList()
     std::vector<Image> &rImages = pSVData->maWinData.maMsgBoxImgList;
     if (rImages.empty())
     {
-        rImages.emplace_back(Image("private:graphicrepository/" SV_RESID_BITMAP_ERRORBOX));
-        rImages.emplace_back(Image("private:graphicrepository/" SV_RESID_BITMAP_QUERYBOX));
-        rImages.emplace_back(Image("private:graphicrepository/" SV_RESID_BITMAP_WARNINGBOX));
-        rImages.emplace_back(Image("private:graphicrepository/" SV_RESID_BITMAP_INFOBOX));
+        rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_ERRORBOX));
+        rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_QUERYBOX));
+        rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_WARNINGBOX));
+        rImages.emplace_back(Image(StockImage::Yes, SV_RESID_BITMAP_INFOBOX));
     }
 }
 


More information about the Libreoffice-commits mailing list