From 15f0d61206dddee12159b68aeab5c860e3d5aff4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 7 Dec 2018 10:29:02 +0200 Subject: use Image(OUString) instead of Image(Bitmap(OUString)) which benefits LOOL since we can delay creating the image until we know the dpi setting of the display we are going to write to. Achieved by perl -pi -w -e "s/\bImage\s*\(\s*BitmapEx\s*\((\w+)\s*\)\s*\)/Image\(\1\)/g" $( git grep -lw "BitmapEx" ) followed by git grep -nP '\bImage\s*\(\s*BitmapEx\s*\(' followed by commenting out the BitmapEx(OUString) constructor and seeing what needed adjusting. Change-Id: I3224e11937d720fa484b0d659d25673a9e809267 Reviewed-on: https://gerrit.libreoffice.org/64760 Tested-by: Jenkins Reviewed-by: Michael Meeks --- sc/source/ui/app/inputwin.cxx | 20 ++++++++++---------- sc/source/ui/app/scmod.cxx | 4 ++-- sc/source/ui/cctrl/tbzoomsliderctrl.cxx | 6 +++--- sc/source/ui/miscdlgs/dataproviderdlg.cxx | 2 +- sc/source/ui/navipi/content.cxx | 3 +-- sc/source/ui/navipi/navipi.cxx | 2 +- sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 20 ++++++++++---------- sc/source/ui/view/olinewin.cxx | 2 +- sc/source/ui/xmlsource/xmlsourcedlg.cxx | 6 +++--- 9 files changed, 32 insertions(+), 33 deletions(-) (limited to 'sc/source/ui') diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 02a881304152..2162eb6b9f74 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -189,11 +189,11 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const SfxBindings* pBind ) : // Position window, 3 buttons, input window InsertWindow (1, aWndPos.get(), ToolBoxItemBits::NONE, 0); InsertSeparator (1); - InsertItem (SID_INPUT_FUNCTION, Image(BitmapEx(RID_BMP_INPUT_FUNCTION)), ToolBoxItemBits::NONE, 2); - InsertItem (SID_INPUT_SUM, Image(BitmapEx(RID_BMP_INPUT_SUM)), ToolBoxItemBits::NONE, 3); - InsertItem (SID_INPUT_EQUAL, Image(BitmapEx(RID_BMP_INPUT_EQUAL)), ToolBoxItemBits::NONE, 4); - InsertItem (SID_INPUT_CANCEL, Image(BitmapEx(RID_BMP_INPUT_CANCEL)), ToolBoxItemBits::NONE, 5); - InsertItem (SID_INPUT_OK, Image(BitmapEx(RID_BMP_INPUT_OK)), ToolBoxItemBits::NONE, 6); + InsertItem (SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2); + InsertItem (SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM), ToolBoxItemBits::NONE, 3); + InsertItem (SID_INPUT_EQUAL, Image(StockImage::Yes, RID_BMP_INPUT_EQUAL), ToolBoxItemBits::NONE, 4); + InsertItem (SID_INPUT_CANCEL, Image(StockImage::Yes, RID_BMP_INPUT_CANCEL), ToolBoxItemBits::NONE, 5); + InsertItem (SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6); InsertSeparator (7); InsertWindow (7, &aTextWindow, ToolBoxItemBits::NONE, 8); @@ -642,16 +642,16 @@ void ScInputWindow::DataChanged( const DataChangedEvent& rDCEvt ) if ( rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { // update item images - SetItemImage(SID_INPUT_FUNCTION, Image(BitmapEx(RID_BMP_INPUT_FUNCTION))); + SetItemImage(SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION)); if ( bIsOkCancelMode ) { - SetItemImage(SID_INPUT_CANCEL, Image(BitmapEx(RID_BMP_INPUT_CANCEL))); - SetItemImage(SID_INPUT_OK, Image(BitmapEx(RID_BMP_INPUT_OK))); + SetItemImage(SID_INPUT_CANCEL, Image(StockImage::Yes, RID_BMP_INPUT_CANCEL)); + SetItemImage(SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK)); } else { - SetItemImage(SID_INPUT_SUM, Image(BitmapEx(RID_BMP_INPUT_SUM))); - SetItemImage(SID_INPUT_EQUAL, Image(BitmapEx(RID_BMP_INPUT_EQUAL))); + SetItemImage(SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM)); + SetItemImage(SID_INPUT_EQUAL, Image(StockImage::Yes, RID_BMP_INPUT_EQUAL)); } } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 6b4df19ea669..632f61e4dda9 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2231,12 +2231,12 @@ std::unique_ptr ScModule::CreateStyleFamilies() pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para, ScResId(STR_STYLE_FAMILY_CELL), - Image(BitmapEx(BMP_STYLES_FAMILY_CELL)), + Image(StockImage::Yes, BMP_STYLES_FAMILY_CELL), RID_CELLSTYLEFAMILY, SC_MOD()->GetResLocale())); pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page, ScResId(STR_STYLE_FAMILY_PAGE), - Image(BitmapEx(BMP_STYLES_FAMILY_PAGE)), + Image(StockImage::Yes, BMP_STYLES_FAMILY_PAGE), RID_PAGESTYLEFAMILY, SC_MOD()->GetResLocale())); return pStyleFamilies; diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 6c9938bcfc85..9eb38a66ddd7 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -220,9 +220,9 @@ ScZoomSliderWnd::ScZoomSliderWnd( vcl::Window* pParent, aLogicalSize( 115, 40 ), m_xDispatchProvider( rDispatchProvider ) { - mpImpl->maSliderButton = Image(BitmapEx(RID_SVXBMP_SLIDERBUTTON)); - mpImpl->maIncreaseButton = Image(BitmapEx(RID_SVXBMP_SLIDERINCREASE)); - mpImpl->maDecreaseButton = Image(BitmapEx(RID_SVXBMP_SLIDERDECREASE)); + mpImpl->maSliderButton = Image(StockImage::Yes, RID_SVXBMP_SLIDERBUTTON); + mpImpl->maIncreaseButton = Image(StockImage::Yes, RID_SVXBMP_SLIDERINCREASE); + mpImpl->maDecreaseButton = Image(StockImage::Yes, RID_SVXBMP_SLIDERDECREASE); Size aSliderSize = LogicToPixel( aLogicalSize, MapMode( MapUnit::Map10thMM ) ); SetSizePixel( Size( aSliderSize.Width() * nSliderWidth-1, aSliderSize.Height() + nSliderHeight ) ); } diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index b8bff7916874..d4cd62bcf5aa 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -91,7 +91,7 @@ ScDataProviderBaseControl::ScDataProviderBaseControl(vcl::Window* pParent, mpApplyBtn->SetControlForeground(COL_GREEN); mpApplyBtn->SetControlBackground(COL_GREEN); mpApplyBtn->SetBackground(Wallpaper(COL_LIGHTGREEN)); - mpApplyBtn->SetModeImage(Image(BitmapEx("sc/res/xml_element.png"))); + mpApplyBtn->SetModeImage(Image(StockImage::Yes, "sc/res/xml_element.png")); mpApplyBtn->Show(); mpApplyBtn->SetClickHdl(LINK(this, ScDataProviderBaseControl, ApplyBtnHdl)); SetSizePixel(GetOptimalSize()); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index cca7461fea0b..c11936752551 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -250,8 +250,7 @@ void ScContentTree::InitRoot( ScContentId nType ) return; } - BitmapEx aBitmap(aContentBmps[static_cast(nType) - 1]); - Image aImage(aBitmap); + Image aImage(StockImage::Yes, aContentBmps[static_cast(nType) - 1]); OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast(nType)])); // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 2701cddda19d..b74176410920 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -428,7 +428,7 @@ void ScNavigatorDlg::UpdateButtons() sImageId = RID_BMP_DROP_COPY; break; } - aTbxCmd->SetItemImage(nDragModeId, Image(BitmapEx(sImageId))); + aTbxCmd->SetItemImage(nDragModeId, Image(StockImage::Yes, sImageId)); } ScNavigatorSettings::ScNavigatorSettings() diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index 819929a6f8b2..e1aadc00307b 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -57,16 +57,16 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel( maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR, *pBindings, *this), maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR, *pBindings, *this), - maIMGCellBorder(BitmapEx(RID_BMP_CELL_BORDER)), - maIMGLineStyle1(BitmapEx(RID_BMP_LINE_STYLE1)), - maIMGLineStyle2(BitmapEx(RID_BMP_LINE_STYLE2)), - maIMGLineStyle3(BitmapEx(RID_BMP_LINE_STYLE3)), - maIMGLineStyle4(BitmapEx(RID_BMP_LINE_STYLE4)), - maIMGLineStyle5(BitmapEx(RID_BMP_LINE_STYLE5)), - maIMGLineStyle6(BitmapEx(RID_BMP_LINE_STYLE6)), - maIMGLineStyle7(BitmapEx(RID_BMP_LINE_STYLE7)), - maIMGLineStyle8(BitmapEx(RID_BMP_LINE_STYLE8)), - maIMGLineStyle9(BitmapEx(RID_BMP_LINE_STYLE9)), + maIMGCellBorder(StockImage::Yes, RID_BMP_CELL_BORDER), + maIMGLineStyle1(StockImage::Yes, RID_BMP_LINE_STYLE1), + maIMGLineStyle2(StockImage::Yes, RID_BMP_LINE_STYLE2), + maIMGLineStyle3(StockImage::Yes, RID_BMP_LINE_STYLE3), + maIMGLineStyle4(StockImage::Yes, RID_BMP_LINE_STYLE4), + maIMGLineStyle5(StockImage::Yes, RID_BMP_LINE_STYLE5), + maIMGLineStyle6(StockImage::Yes, RID_BMP_LINE_STYLE6), + maIMGLineStyle7(StockImage::Yes, RID_BMP_LINE_STYLE7), + maIMGLineStyle8(StockImage::Yes, RID_BMP_LINE_STYLE8), + maIMGLineStyle9(StockImage::Yes, RID_BMP_LINE_STYLE9), mnInWidth(0), mnOutWidth(0), diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx index d60461963624..431c6259aef5 100644 --- a/sc/source/ui/view/olinewin.cxx +++ b/sc/source/ui/view/olinewin.cxx @@ -530,7 +530,7 @@ namespace { Image GetImage(const OUString& rId) { - return Image(BitmapEx(rId)); + return Image(StockImage::Yes, rId); } } diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 995498a4d6ee..fd8b652bd209 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -90,9 +90,9 @@ ScXMLSourceDlg::ScXMLSourceDlg( mpActiveEdit = mpRefEdit; - maXMLParam.maImgElementDefault = Image(BitmapEx(RID_BMP_ELEMENT_DEFAULT)); - maXMLParam.maImgElementRepeat = Image(BitmapEx(RID_BMP_ELEMENT_REPEAT)); - maXMLParam.maImgAttribute = Image(BitmapEx(RID_BMP_ELEMENT_ATTRIBUTE)); + maXMLParam.maImgElementDefault = Image(StockImage::Yes, RID_BMP_ELEMENT_DEFAULT); + maXMLParam.maImgElementRepeat = Image(StockImage::Yes, RID_BMP_ELEMENT_REPEAT); + maXMLParam.maImgAttribute = Image(StockImage::Yes, RID_BMP_ELEMENT_ATTRIBUTE); Link aBtnHdl = LINK(this, ScXMLSourceDlg, BtnPressedHdl); mpBtnSelectSource->SetClickHdl(aBtnHdl); -- cgit v1.2.3