22#include <com/sun/star/scanner/XScannerManager2.hpp>
24#include <svx/svxids.hrc>
31#include <drawview.hxx>
41 const css::scanner::ScannerContext aContext(
mxScannerManager->getAvailableScanners().getConstArray()[ 0 ] );
42 const css::scanner::ScanError eError =
mxScannerManager->getError( aContext );
44 if( css::scanner::ScanError_ScanErrorNone == eError )
46 const css::uno::Reference< css::awt::XBitmap > xBitmap(
mxScannerManager->getBitmap( aContext ) );
57 const MapMode aMap100( MapUnit::Map100thMM );
59 if( !aBmpSize.Width() || !aBmpSize.Height() )
70 if( ( ( aBmpSize.Height() > aPageSize.
Height() ) || ( aBmpSize.Width() > aPageSize.
Width() ) ) && aBmpSize.Height() && aPageSize.
Height() )
72 double fGrfWH =
static_cast<double>(aBmpSize.Width()) / aBmpSize.Height();
73 double fWinWH =
static_cast<double>(aPageSize.
Width()) / aPageSize.
Height();
77 aBmpSize.setWidth(
FRound( aPageSize.
Height() * fGrfWH ) );
78 aBmpSize.setHeight( aPageSize.
Height() );
80 else if( fGrfWH > 0.F )
82 aBmpSize.setWidth( aPageSize.
Width() );
83 aBmpSize.setHeight(
FRound( aPageSize.
Width() / fGrfWH ) );
87 Point aPnt ( ( aPageSize.
Width() - aBmpSize.Width() ) >> 1, ( aPageSize.
Height() - aBmpSize.Height() ) >> 1 );
90 bool bInsertNewObject =
true;
92 if(
GetView()->AreObjectsMarked() )
101 if(
auto pGrafObj =
dynamic_cast< SdrGrafObj *
>( pObj ) )
103 if( pGrafObj->IsEmptyPresObj() )
105 bInsertNewObject =
false;
107 pGrafObj->SetOutlinerParaObject(std::nullopt);
108 pGrafObj->SetGraphic(
Graphic( aScanBmp ) );
114 if( bInsertNewObject )
117 GetView()->getSdrModelFromSdrView(),
const MapMode & GetPrefMapMode() const
const Size & GetPrefSize() const
const Size & GetSizePixel() const
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
SdrObject * GetMarkedSdrObj() const
void SetEmptyPresObj(bool bEpt)
sal_Int32 GetUpperBorder() const
sal_Int32 GetRightBorder() const
sal_Int32 GetLeftBorder() const
sal_Int32 GetLowerBorder() const
SdrPageView * GetSdrPageView() const
void Invalidate(sal_uInt16 nId)
SfxBindings & GetBindings()
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
static BitmapEx GetBitmap(const css::uno::Reference< css::awt::XBitmap > &rxBitmap)
css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager
std::unique_ptr< DrawView > mpDrawView
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
::sd::View * GetView() const
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Point PixelToLogic(const Point &rDevicePt) const
tools::Long FRound(double fVal)