diff options
author | Stefan Knorr (astron) <heinzlesspam@gmail.com> | 2011-12-19 12:37:59 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-12-27 22:30:13 +0100 |
commit | 640c1788efe181bbf834fb78ebb3c08820847a7e (patch) | |
tree | ae87c22dcc1cf84f5636aadf4f4f64ff3ed5c8d3 /sw | |
parent | 8efd3f8f43b7ecaeee545fc20e8eb0765d4c77d7 (diff) |
Try to draw replacement preview at original size
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 288141b243ed..de3c4df0b862 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -224,7 +224,7 @@ static FrmMap aHFlyHtmlMap[] = {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_FLY_REL_PG_FRAME} }; -// own vertical alignment map for to frame anchored objects +// own vertical alignment map for objects anchored to frame #define VERT_FRAME_REL (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA) static FrmMap aVFrameMap[] = @@ -1941,7 +1941,7 @@ IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB ) } /*-------------------------------------------------------------------- - Description: horizonal Pos + Description: horizontal Pos --------------------------------------------------------------------*/ IMPL_LINK( SwFrmPage, RelHdl, ListBox *, pLB ) { @@ -2555,14 +2555,24 @@ void BmpWindow::Paint( const Rectangle& ) aGrfSize = ::GetGraphicSizeTwip(aGraphic, this); //it should show the default bitmap also if no graphic can be found if(!aGrfSize.Width() && !aGrfSize.Height()) - aGrfSize = PixelToLogic(aBmp.GetSizePixel()); + aGrfSize = PixelToLogic(aBmp.GetSizePixel()); long nRelGrf = aGrfSize.Width() * 100L / aGrfSize.Height(); long nRelWin = aPntSz.Width() * 100L / aPntSz.Height(); if(nRelGrf < nRelWin) { const long nWidth = aPntSz.Width(); - aPntSz.Width() = aPntSz.Height() * nRelGrf /100; + // if we use a replacement preview, try to draw at original size + if ( !bGraphic && ( aGrfSize.Width() <= aPntSz.Width() ) && ( aGrfSize.Height() <= aPntSz.Height() ) ) + { + const long nHeight = aPntSz.Height(); + aPntSz.Width() = aGrfSize.Width(); + aPntSz.Height() = aGrfSize.Height(); + aPntPos.Y() += (nHeight - aPntSz.Height()) / 2; + } + else + aPntSz.Width() = aPntSz.Height() * nRelGrf /100; + if(!bLeftAlign) aPntPos.X() += nWidth - aPntSz.Width() ; } |