LibreOffice Module cui (master)  1
ImageViewerDialog.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #include <vcl/virdev.hxx>
11 #include <ImageViewerDialog.hxx>
12 
13 ImageViewerDialog::ImageViewerDialog(weld::Dialog* pParent, BitmapEx aBitmap, OUString atitle)
14  : GenericDialogController(pParent, "cui/ui/imageviewer.ui", "ImageViewerDialog")
15  , m_xDisplayImage(m_xBuilder->weld_image("ImgVW_mainImage"))
16 {
17  m_xDialog->set_title(atitle);
18  aBitmap.Scale(Size(300, 300), BmpScaleFlag::Fast);
19  ScopedVclPtr<VirtualDevice> m_pVirDev = m_xDisplayImage->create_virtual_device();
20  m_pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel());
21  m_pVirDev->DrawBitmapEx(Point(0, 0), aBitmap);
22  m_xDisplayImage->set_image(m_pVirDev.get());
23  m_pVirDev.disposeAndClear();
24 }
std::shared_ptr< weld::Dialog > m_xDialog
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
ImageViewerDialog(weld::Dialog *pParent, BitmapEx aBitmap, OUString atitle)
std::unique_ptr< weld::Image > m_xDisplayImage
VirtualDevice * get() const
const Size & GetSizePixel() const