Kaydet (Commit) 0f104bf3 authored tarafından Noel Grandin's avatar Noel Grandin

utility constructor for Image "private:graphicrepository" urls

Change-Id: I118039f4e47818a43da9302ce3550ea800522675
Reviewed-on: https://gerrit.libreoffice.org/64765Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
üst 8fa5c031
......@@ -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;
......
......@@ -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() ) );
......
......@@ -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)
......
......@@ -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())
......
......@@ -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);
}
......
......@@ -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));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment