summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 10:18:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 12:13:42 +0100
commit5b74eb68113d3721e1a3f9fa40024bf9b2a15f0c (patch)
tree1c959ccc7769fd8530a16cc904b5424d04faa208 /vcl/source
parentb4aa631867638b993fda98b1c4fcfc47e5c6a1aa (diff)
loplugin:flatten in vcl
Change-Id: I3527477277a9ae96eaf9fd068232f672da7c28c3 Reviewed-on: https://gerrit.libreoffice.org/44753 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/help.cxx45
-rw-r--r--vcl/source/bitmap/BitmapProcessor.cxx99
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx57
-rw-r--r--vcl/source/control/button.cxx45
-rw-r--r--vcl/source/control/imgctrl.cxx41
-rw-r--r--vcl/source/control/imp_listbox.cxx79
-rw-r--r--vcl/source/control/scrbar.cxx205
-rw-r--r--vcl/source/control/spinfld.cxx83
-rw-r--r--vcl/source/edit/texteng.cxx71
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx400
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx73
-rw-r--r--vcl/source/gdi/gdimtf.cxx963
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx487
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx307
-rw-r--r--vcl/source/gdi/print.cxx137
-rw-r--r--vcl/source/outdev/gradient.cxx123
-rw-r--r--vcl/source/outdev/transparent.cxx129
-rw-r--r--vcl/source/window/EnumContext.cxx108
-rw-r--r--vcl/source/window/dialog.cxx85
-rw-r--r--vcl/source/window/menubarwindow.cxx33
-rw-r--r--vcl/source/window/menufloatingwindow.cxx77
-rw-r--r--vcl/source/window/mouse.cxx185
-rw-r--r--vcl/source/window/splitwin.cxx318
-rw-r--r--vcl/source/window/toolbox.cxx59
-rw-r--r--vcl/source/window/toolbox2.cxx77
25 files changed, 2162 insertions, 2124 deletions
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 0f608b56d5b5..ebd861999667 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -535,28 +535,29 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe
}
}
- if (!pHelpWin && !rHelpText.isEmpty())
- {
- sal_uInt64 nCurTime = tools::Time::GetSystemTicks();
- if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
- || ( nStyle & QuickHelpFlags::NoDelay )
- )
- nDelayMode = HELPDELAY_NONE;
-
- pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle );
- pSVData->maHelpData.mpHelpWin = pHelpWin;
- pHelpWin->SetStatusText( rStatusText );
- pHelpWin->SetHelpArea( rHelpArea );
-
- // positioning
- Size aSz = pHelpWin->CalcOutSize();
- pHelpWin->SetOutputSizePixel( aSz );
- ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, rHelpArea );
- // if not called from Window::RequestHelp, then without delay...
- if ( !pSVData->maHelpData.mbRequestingHelp )
- nDelayMode = HELPDELAY_NONE;
- pHelpWin->ShowHelp( nDelayMode );
- }
+ if (pHelpWin || rHelpText.isEmpty())
+ return;
+
+ sal_uInt64 nCurTime = tools::Time::GetSystemTicks();
+ if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
+ || ( nStyle & QuickHelpFlags::NoDelay )
+ )
+ nDelayMode = HELPDELAY_NONE;
+
+ pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle );
+ pSVData->maHelpData.mpHelpWin = pHelpWin;
+ pHelpWin->SetStatusText( rStatusText );
+ pHelpWin->SetHelpArea( rHelpArea );
+
+ // positioning
+ Size aSz = pHelpWin->CalcOutSize();
+ pHelpWin->SetOutputSizePixel( aSz );
+ ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, rHelpArea );
+ // if not called from Window::RequestHelp, then without delay...
+ if ( !pSVData->maHelpData.mbRequestingHelp )
+ nDelayMode = HELPDELAY_NONE;
+ pHelpWin->ShowHelp( nDelayMode );
+
}
void ImplDestroyHelpWindow( bool bUpdateHideTime )
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index cda77c8d4601..52d5b6e779d7 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -139,68 +139,69 @@ void BitmapProcessor::colorizeImage(BitmapEx const & rBitmapEx, Color aColor)
Bitmap aBitmap = rBitmapEx.GetBitmap();
Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
- if (pWriteAccess)
+ if (!pWriteAccess)
+ return;
+
+ BitmapColor aBitmapColor;
+ const long nW = pWriteAccess->Width();
+ const long nH = pWriteAccess->Height();
+ std::vector<sal_uInt8> aMapR(256);
+ std::vector<sal_uInt8> aMapG(256);
+ std::vector<sal_uInt8> aMapB(256);
+ long nX;
+ long nY;
+
+ const sal_uInt8 cR = aColor.GetRed();
+ const sal_uInt8 cG = aColor.GetGreen();
+ const sal_uInt8 cB = aColor.GetBlue();
+
+ for (nX = 0; nX < 256; ++nX)
{
- BitmapColor aBitmapColor;
- const long nW = pWriteAccess->Width();
- const long nH = pWriteAccess->Height();
- std::vector<sal_uInt8> aMapR(256);
- std::vector<sal_uInt8> aMapG(256);
- std::vector<sal_uInt8> aMapB(256);
- long nX;
- long nY;
-
- const sal_uInt8 cR = aColor.GetRed();
- const sal_uInt8 cG = aColor.GetGreen();
- const sal_uInt8 cB = aColor.GetBlue();
-
- for (nX = 0; nX < 256; ++nX)
- {
- aMapR[nX] = MinMax((nX + cR) / 2, 0, 255);
- aMapG[nX] = MinMax((nX + cG) / 2, 0, 255);
- aMapB[nX] = MinMax((nX + cB) / 2, 0, 255);
- }
+ aMapR[nX] = MinMax((nX + cR) / 2, 0, 255);
+ aMapG[nX] = MinMax((nX + cG) / 2, 0, 255);
+ aMapB[nX] = MinMax((nX + cB) / 2, 0, 255);
+ }
- if (pWriteAccess->HasPalette())
+ if (pWriteAccess->HasPalette())
+ {
+ for (sal_uInt16 i = 0, nCount = pWriteAccess->GetPaletteEntryCount(); i < nCount; i++)
{
- for (sal_uInt16 i = 0, nCount = pWriteAccess->GetPaletteEntryCount(); i < nCount; i++)
- {
- const BitmapColor& rCol = pWriteAccess->GetPaletteColor(i);
- aBitmapColor.SetRed(aMapR[rCol.GetRed()]);
- aBitmapColor.SetGreen(aMapG[rCol.GetGreen()]);
- aBitmapColor.SetBlue(aMapB[rCol.GetBlue()]);
- pWriteAccess->SetPaletteColor(i, aBitmapColor);
- }
+ const BitmapColor& rCol = pWriteAccess->GetPaletteColor(i);
+ aBitmapColor.SetRed(aMapR[rCol.GetRed()]);
+ aBitmapColor.SetGreen(aMapG[rCol.GetGreen()]);
+ aBitmapColor.SetBlue(aMapB[rCol.GetBlue()]);
+ pWriteAccess->SetPaletteColor(i, aBitmapColor);
}
- else if (pWriteAccess->GetScanlineFormat() == ScanlineFormat::N24BitTcBgr)
+ }
+ else if (pWriteAccess->GetScanlineFormat() == ScanlineFormat::N24BitTcBgr)
+ {
+ for (nY = 0; nY < nH; ++nY)
{
- for (nY = 0; nY < nH; ++nY)
- {
- Scanline pScan = pWriteAccess->GetScanline(nY);
+ Scanline pScan = pWriteAccess->GetScanline(nY);
- for (nX = 0; nX < nW; ++nX)
- {
- *pScan = aMapB[*pScan]; pScan++;
- *pScan = aMapG[*pScan]; pScan++;
- *pScan = aMapR[*pScan]; pScan++;
- }
+ for (nX = 0; nX < nW; ++nX)
+ {
+ *pScan = aMapB[*pScan]; pScan++;
+ *pScan = aMapG[*pScan]; pScan++;
+ *pScan = aMapR[*pScan]; pScan++;
}
}
- else
+ }
+ else
+ {
+ for (nY = 0; nY < nH; ++nY)
{
- for (nY = 0; nY < nH; ++nY)
+ for (nX = 0; nX < nW; ++nX)
{
- for (nX = 0; nX < nW; ++nX)
- {
- aBitmapColor = pWriteAccess->GetPixel(nY, nX);
- aBitmapColor.SetRed(aMapR[aBitmapColor.GetRed()]);
- aBitmapColor.SetGreen(aMapG[aBitmapColor.GetGreen()]);
- aBitmapColor.SetBlue(aMapB[aBitmapColor.GetBlue()]);
- pWriteAccess->SetPixel(nY, nX, aBitmapColor);
- }
+ aBitmapColor = pWriteAccess->GetPixel(nY, nX);
+ aBitmapColor.SetRed(aMapR[aBitmapColor.GetRed()]);
+ aBitmapColor.SetGreen(aMapG[aBitmapColor.GetGreen()]);
+ aBitmapColor.SetBlue(aMapB[aBitmapColor.GetBlue()]);
+ pWriteAccess->SetPixel(nY, nX, aBitmapColor);
}
}
}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 554f16850c2c..ff8bf5cbf2d1 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -62,45 +62,46 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx,
Primitive2DSequence aPrimitiveSequence = xSvgParser->getDecomposition(aInputStream, sPath);
- if (aPrimitiveSequence.hasElements())
+ if (!aPrimitiveSequence.hasElements())
+ return;
+
+ uno::Sequence<beans::PropertyValue> aViewParameters;
+
+ const sal_Int32 nCount(aPrimitiveSequence.getLength());
+ geometry::RealRectangle2D aRealRect;
+ basegfx::B2DRange aRange;
+ for (sal_Int32 a = 0; a < nCount; ++a)
{
- uno::Sequence<beans::PropertyValue> aViewParameters;
+ const Primitive2DReference xReference(aPrimitiveSequence[a]);
- const sal_Int32 nCount(aPrimitiveSequence.getLength());
- geometry::RealRectangle2D aRealRect;
- basegfx::B2DRange aRange;
- for (sal_Int32 a = 0; a < nCount; ++a)
+ if (xReference.is())
{
- const Primitive2DReference xReference(aPrimitiveSequence[a]);
-
- if (xReference.is())
- {
- aRealRect = xReference->getRange(aViewParameters);
- aRange.expand(basegfx::B2DRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2));
- }
+ aRealRect = xReference->getRange(aViewParameters);
+ aRange.expand(basegfx::B2DRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2));
}
+ }
- aRealRect.X1 = 0;
- aRealRect.Y1 = 0;
- aRealRect.X2 = aRange.getMaxX() - aRange.getMinX();
- aRealRect.Y2 = aRange.getMaxY() - aRange.getMinY();
+ aRealRect.X1 = 0;
+ aRealRect.Y1 = 0;
+ aRealRect.X2 = aRange.getMaxX() - aRange.getMinX();
+ aRealRect.Y2 = aRange.getMaxY() - aRange.getMinY();
- double nDPI = 96 * fScalingFactor;
+ double nDPI = 96 * fScalingFactor;
- const css::uno::Reference<css::graphic::XPrimitive2DRenderer> xPrimitive2DRenderer = css::graphic::Primitive2DTools::create(xContext);
- const css::uno::Reference<css::rendering::XBitmap> xBitmap(
- xPrimitive2DRenderer->rasterize(aPrimitiveSequence, aViewParameters, nDPI, nDPI, aRealRect, 256*256));
+ const css::uno::Reference<css::graphic::XPrimitive2DRenderer> xPrimitive2DRenderer = css::graphic::Primitive2DTools::create(xContext);
+ const css::uno::Reference<css::rendering::XBitmap> xBitmap(
+ xPrimitive2DRenderer->rasterize(aPrimitiveSequence, aViewParameters, nDPI, nDPI, aRealRect, 256*256));
- if (xBitmap.is())
- {
- const css::uno::Reference<css::rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW);
+ if (xBitmap.is())
+ {
+ const css::uno::Reference<css::rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW);
- if (xIntBmp.is())
- {
- rBitmapEx = vcl::unotools::bitmapExFromXBitmap(xIntBmp);
- }
+ if (xIntBmp.is())
+ {
+ rBitmapEx = vcl::unotools::bitmapExFromXBitmap(xIntBmp);
}
}
+
}
}} // end vcl::bitmap
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 875734f51d15..a67ebb3ffe03 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3790,33 +3790,34 @@ void DisclosureButton::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext)
if (IsMouseOver() && GetMouseRect().IsInside(GetPointerPosPixel()))
nState |= ControlState::ROLLOVER;
- if (!rRenderContext.DrawNativeControl(ControlType::ListNode, ControlPart::Entire, aCtrlRegion,
+ if (rRenderContext.DrawNativeControl(ControlType::ListNode, ControlPart::Entire, aCtrlRegion,
nState, aControlValue, OUString()))
- {
- ImplSVCtrlData& rCtrlData(ImplGetSVData()->maCtrlData);
- if (!rCtrlData.mpDisclosurePlus)
- rCtrlData.mpDisclosurePlus = new Image(BitmapEx(SV_DISCLOSURE_PLUS));
- if (!rCtrlData.mpDisclosureMinus)
- rCtrlData.mpDisclosureMinus = new Image(BitmapEx(SV_DISCLOSURE_MINUS));
+ return;
- Image* pImg = nullptr;
- pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus;
+ ImplSVCtrlData& rCtrlData(ImplGetSVData()->maCtrlData);
+ if (!rCtrlData.mpDisclosurePlus)
+ rCtrlData.mpDisclosurePlus = new Image(BitmapEx(SV_DISCLOSURE_PLUS));
+ if (!rCtrlData.mpDisclosureMinus)
+ rCtrlData.mpDisclosureMinus = new Image(BitmapEx(SV_DISCLOSURE_MINUS));
- SAL_WARN_IF(!pImg, "vcl", "no disclosure image");
- if (!pImg)
- return;
+ Image* pImg = nullptr;
+ pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus;
- DrawImageFlags nStyle = DrawImageFlags::NONE;
- if (!IsEnabled())
- nStyle |= DrawImageFlags::Disable;
+ SAL_WARN_IF(!pImg, "vcl", "no disclosure image");
+ if (!pImg)
+ return;
+
+ DrawImageFlags nStyle = DrawImageFlags::NONE;
+ if (!IsEnabled())
+ nStyle |= DrawImageFlags::Disable;
+
+ Size aSize(aStateRect.GetSize());
+ Size aImgSize(pImg->GetSizePixel());
+ Point aOff((aSize.Width() - aImgSize.Width()) / 2,
+ (aSize.Height() - aImgSize.Height()) / 2);
+ aOff += aStateRect.TopLeft();
+ rRenderContext.DrawImage(aOff, *pImg, nStyle);
- Size aSize(aStateRect.GetSize());
- Size aImgSize(pImg->GetSizePixel());
- Point aOff((aSize.Width() - aImgSize.Width()) / 2,
- (aSize.Height() - aImgSize.Height()) / 2);
- aOff += aStateRect.TopLeft();
- rRenderContext.DrawImage(aOff, *pImg, nStyle);
- }
}
void DisclosureButton::KeyInput( const KeyEvent& rKEvt )
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
index f1ff32a111ba..265d018bbffe 100644
--- a/vcl/source/control/imgctrl.cxx
+++ b/vcl/source/control/imgctrl.cxx
@@ -130,26 +130,27 @@ void ImageControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
{
ImplDraw(rRenderContext, DrawFlags::NONE, Point(), GetOutputSizePixel());
- if (HasFocus())
- {
- vcl::Window* pBorderWindow = GetWindow(GetWindowType::Border);
-
- bool bFlat = (GetBorderStyle() == WindowBorderStyle::MONO);
- tools::Rectangle aRect(Point(0,0), pBorderWindow->GetOutputSizePixel());
- Color oldLineCol = pBorderWindow->GetLineColor();
- Color oldFillCol = pBorderWindow->GetFillColor();
- pBorderWindow->SetFillColor();
- pBorderWindow->SetLineColor(bFlat ? COL_WHITE : COL_BLACK);
- pBorderWindow->DrawRect(aRect);
- ++aRect.Left();
- --aRect.Right();
- ++aRect.Top();
- --aRect.Bottom();
- pBorderWindow->SetLineColor(bFlat ? COL_BLACK : COL_WHITE);
- pBorderWindow->DrawRect(aRect);
- pBorderWindow->SetLineColor(oldLineCol);
- pBorderWindow->SetFillColor(oldFillCol);
- }
+ if (!HasFocus())
+ return;
+
+ vcl::Window* pBorderWindow = GetWindow(GetWindowType::Border);
+
+ bool bFlat = (GetBorderStyle() == WindowBorderStyle::MONO);
+ tools::Rectangle aRect(Point(0,0), pBorderWindow->GetOutputSizePixel());
+ Color oldLineCol = pBorderWindow->GetLineColor();
+ Color oldFillCol = pBorderWindow->GetFillColor();
+ pBorderWindow->SetFillColor();
+ pBorderWindow->SetLineColor(bFlat ? COL_WHITE : COL_BLACK);
+ pBorderWindow->DrawRect(aRect);
+ ++aRect.Left();
+ --aRect.Right();
+ ++aRect.Top();
+ --aRect.Bottom();
+ pBorderWindow->SetLineColor(bFlat ? COL_BLACK : COL_WHITE);
+ pBorderWindow->DrawRect(aRect);
+ pBorderWindow->SetLineColor(oldLineCol);
+ pBorderWindow->SetFillColor(oldFillCol);
+
}
void ImageControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags )
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 5339213f75d6..d23659e3e8f1 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -3043,55 +3043,56 @@ Size ImplListBoxFloatingWindow::CalcFloatSize()
void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking )
{
- if( !IsInPopupMode() )
- {
- Size aFloatSz = CalcFloatSize();
+ if( IsInPopupMode() )
+ return;
- SetSizePixel( aFloatSz );
- mpImplLB->SetSizePixel( GetOutputSizePixel() );
+ Size aFloatSz = CalcFloatSize();
- sal_Int32 nPos = mpImplLB->GetEntryList()->GetSelectedEntryPos( 0 );
- mnPopupModeStartSaveSelection = nPos;
+ SetSizePixel( aFloatSz );
+ mpImplLB->SetSizePixel( GetOutputSizePixel() );
- Size aSz = GetParent()->GetSizePixel();
- Point aPos = GetParent()->GetPosPixel();
- aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos );
- // FIXME: this ugly hack is for Mac/Aqua
- // should be replaced by a real mechanism to place the float rectangle
- if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
- GetParent()->IsNativeWidgetEnabled() )
- {
- const sal_Int32 nLeft = 4, nTop = 4, nRight = 4, nBottom = 4;
- aPos.X() += nLeft;
- aPos.Y() += nTop;
- aSz.Width() -= nLeft + nRight;
- aSz.Height() -= nTop + nBottom;
- }
- tools::Rectangle aRect( aPos, aSz );
+ sal_Int32 nPos = mpImplLB->GetEntryList()->GetSelectedEntryPos( 0 );
+ mnPopupModeStartSaveSelection = nPos;
- // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI
- // where the document is unmirrored
- // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror
- vcl::Window *pGrandparent = GetParent()->GetParent();
- const OutputDevice *pGrandparentOutDev = pGrandparent->GetOutDev();
+ Size aSz = GetParent()->GetSizePixel();
+ Point aPos = GetParent()->GetPosPixel();
+ aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos );
+ // FIXME: this ugly hack is for Mac/Aqua
+ // should be replaced by a real mechanism to place the float rectangle
+ if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
+ GetParent()->IsNativeWidgetEnabled() )
+ {
+ const sal_Int32 nLeft = 4, nTop = 4, nRight = 4, nBottom = 4;
+ aPos.X() += nLeft;
+ aPos.Y() += nTop;
+ aSz.Width() -= nLeft + nRight;
+ aSz.Height() -= nTop + nBottom;
+ }
+ tools::Rectangle aRect( aPos, aSz );
- if( pGrandparent->ImplIsAntiparallel() )
- pGrandparentOutDev->ReMirror( aRect );
+ // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI
+ // where the document is unmirrored
+ // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror
+ vcl::Window *pGrandparent = GetParent()->GetParent();
+ const OutputDevice *pGrandparentOutDev = pGrandparent->GetOutDev();
- // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795
- StartPopupMode( aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::AllMouseButtonClose );
+ if( pGrandparent->ImplIsAntiparallel() )
+ pGrandparentOutDev->ReMirror( aRect );
- if( nPos != LISTBOX_ENTRY_NOTFOUND )
- mpImplLB->ShowProminentEntry( nPos );
+ // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795
+ StartPopupMode( aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::AllMouseButtonClose );
- if( bStartTracking )
- mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true );
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ mpImplLB->ShowProminentEntry( nPos );
- if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
- mpImplLB->GetMainWindow()->GrabFocus();
+ if( bStartTracking )
+ mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true );
+
+ if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
+ mpImplLB->GetMainWindow()->GrabFocus();
+
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
- mpImplLB->GetMainWindow()->ImplClearLayoutData();
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 6247e688a8bf..ee937aa854d6 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -846,134 +846,135 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
bool bPrimaryWarping = bWarp && rMEvt.IsLeft();
bool bPage = bPrimaryWarps ? rMEvt.IsRight() : rMEvt.IsLeft();
- if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight())
+ if (!rMEvt.IsLeft() && !rMEvt.IsMiddle() && !rMEvt.IsRight())
+ return;
+
+ Point aPosPixel;
+ if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip)
{
- Point aPosPixel;
- if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip)
- {
- // rMEvt coordinates are in twips.
- Push(PushFlags::MAPMODE);
- EnableMapMode();
- MapMode aMapMode = GetMapMode();
- aMapMode.SetOrigin(Point(0, 0));
- SetMapMode(aMapMode);
- aPosPixel = LogicToPixel(rMEvt.GetPosPixel());
- Pop();
- }
- const Point& rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rMEvt.GetPosPixel() : aPosPixel);
- StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE;
- bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
- bool bIsInside = false;
- bool bDragToMouse = false;
+ // rMEvt coordinates are in twips.
+ Push(PushFlags::MAPMODE);
+ EnableMapMode();
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetOrigin(Point(0, 0));
+ SetMapMode(aMapMode);
+ aPosPixel = LogicToPixel(rMEvt.GetPosPixel());
+ Pop();
+ }
+ const Point& rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rMEvt.GetPosPixel() : aPosPixel);
+ StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE;
+ bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
+ bool bIsInside = false;
+ bool bDragToMouse = false;
- Point aPoint( 0, 0 );
- tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() );
+ Point aPoint( 0, 0 );
+ tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() );
- if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp,
- aControlRegion, rMousePos, bIsInside )?
- bIsInside:
- maBtn1Rect.IsInside( rMousePos ) )
+ if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp,
+ aControlRegion, rMousePos, bIsInside )?
+ bIsInside:
+ maBtn1Rect.IsInside( rMousePos ) )
+ {
+ if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
{
- if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
- {
- nTrackFlags = StartTrackingFlags::ButtonRepeat;
- meScrollType = ScrollType::LineUp;
- }
+ nTrackFlags = StartTrackingFlags::ButtonRepeat;
+ meScrollType = ScrollType::LineUp;
}
- else if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown,
- aControlRegion, rMousePos, bIsInside )?
- bIsInside:
- maBtn2Rect.IsInside( rMousePos ) )
+ }
+ else if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown,
+ aControlRegion, rMousePos, bIsInside )?
+ bIsInside:
+ maBtn2Rect.IsInside( rMousePos ) )
+ {
+ if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
{
- if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
- {
- nTrackFlags = StartTrackingFlags::ButtonRepeat;
- meScrollType = ScrollType::LineDown;
- }
+ nTrackFlags = StartTrackingFlags::ButtonRepeat;
+ meScrollType = ScrollType::LineDown;
}
- else
- {
- bool bThumbHit = HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert,
- maThumbRect, rMousePos, bIsInside )
- ? bIsInside : maThumbRect.IsInside( rMousePos );
+ }
+ else
+ {
+ bool bThumbHit = HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert,
+ maThumbRect, rMousePos, bIsInside )
+ ? bIsInside : maThumbRect.IsInside( rMousePos );
- bool bThumbAction = bWarp || bPage;
+ bool bThumbAction = bWarp || bPage;
- bool bDragHandling = bWarp || (bThumbHit && bThumbAction);
- if( bDragHandling )
+ bool bDragHandling = bWarp || (bThumbHit && bThumbAction);
+ if( bDragHandling )
+ {
+ if( mpData )
{
- if( mpData )
+ mpData->mbHide = true; // disable focus blinking
+ if (HasFocus())
{
- mpData->mbHide = true; // disable focus blinking
- if (HasFocus())
- {
- mnStateFlags |= SCRBAR_DRAW_THUMB; // paint without focus
- Invalidate();
- }
- }
-
- if ( mnVisibleSize < mnMaxRange-mnMinRange )
- {
- nTrackFlags = StartTrackingFlags::NONE;
- meScrollType = ScrollType::Drag;
-
- // calculate mouse offset
- if (bWarp && (!bThumbHit || !bPrimaryWarping))
- {
- bDragToMouse = true;
- if ( GetStyle() & WB_HORZ )
- mnMouseOff = maThumbRect.GetWidth()/2;
- else
- mnMouseOff = maThumbRect.GetHeight()/2;
- }
- else
- {
- if ( GetStyle() & WB_HORZ )
- mnMouseOff = rMousePos.X()-maThumbRect.Left();
- else
- mnMouseOff = rMousePos.Y()-maThumbRect.Top();
- }
-
- mnStateFlags |= SCRBAR_STATE_THUMB_DOWN;
+ mnStateFlags |= SCRBAR_DRAW_THUMB; // paint without focus
Invalidate();
}
}
- else if(bPage && (!HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea,
- aControlRegion, rMousePos, bIsInside ) ||
- bIsInside) )
+
+ if ( mnVisibleSize < mnMaxRange-mnMinRange )
{
- nTrackFlags = StartTrackingFlags::ButtonRepeat;
+ nTrackFlags = StartTrackingFlags::NONE;
+ meScrollType = ScrollType::Drag;
- // HitTestNativeScrollbar, see remark at top of file
- if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper,
- maPage1Rect, rMousePos, bIsInside )?
- bIsInside:
- maPage1Rect.IsInside( rMousePos ) )
+ // calculate mouse offset
+ if (bWarp && (!bThumbHit || !bPrimaryWarping))
{
- meScrollType = ScrollType::PageUp;
+ bDragToMouse = true;
+ if ( GetStyle() & WB_HORZ )
+ mnMouseOff = maThumbRect.GetWidth()/2;
+ else
+ mnMouseOff = maThumbRect.GetHeight()/2;
}
else
{
- meScrollType = ScrollType::PageDown;
+ if ( GetStyle() & WB_HORZ )
+ mnMouseOff = rMousePos.X()-maThumbRect.Left();
+ else
+ mnMouseOff = rMousePos.Y()-maThumbRect.Top();
}
+
+ mnStateFlags |= SCRBAR_STATE_THUMB_DOWN;
+ Invalidate();
}
}
-
- // Should we start Tracking?
- if ( meScrollType != ScrollType::DontKnow )
+ else if(bPage && (!HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea,
+ aControlRegion, rMousePos, bIsInside ) ||
+ bIsInside) )
{
- // store original position for cancel and EndScroll delta
- mnStartPos = mnThumbPos;
- // #92906# Call StartTracking() before ImplDoMouseAction(), otherwise
- // MouseButtonUp() / EndTracking() may be called if somebody is spending
- // a lot of time in the scroll handler
- StartTracking( nTrackFlags );
- ImplDoMouseAction( rMousePos );
-
- if( bDragToMouse )
- ImplDragThumb( rMousePos );
+ nTrackFlags = StartTrackingFlags::ButtonRepeat;
+
+ // HitTestNativeScrollbar, see remark at top of file
+ if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper,
+ maPage1Rect, rMousePos, bIsInside )?
+ bIsInside:
+ maPage1Rect.IsInside( rMousePos ) )
+ {
+ meScrollType = ScrollType::PageUp;
+ }
+ else
+ {
+ meScrollType = ScrollType::PageDown;
+ }
}
}
+
+ // Should we start Tracking?
+ if ( meScrollType != ScrollType::DontKnow )
+ {
+ // store original position for cancel and EndScroll delta
+ mnStartPos = mnThumbPos;
+ // #92906# Call StartTracking() before ImplDoMouseAction(), otherwise
+ // MouseButtonUp() / EndTracking() may be called if somebody is spending
+ // a lot of time in the scroll handler
+ StartTracking( nTrackFlags );
+ ImplDoMouseAction( rMousePos );
+
+ if( bDragToMouse )
+ ImplDragThumb( rMousePos );
+ }
+
}
void ScrollBar::Tracking( const TrackingEvent& rTEvt )
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index bd351621f80e..c5ccad010628 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -961,55 +961,56 @@ void SpinField::Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, D
Edit::Draw(pDev, rPos, rSize, nFlags);
WinBits nFieldStyle = GetStyle();
- if ( !(nFlags & DrawFlags::NoControls ) && ( nFieldStyle & (WB_SPIN|WB_DROPDOWN) ) )
- {
- Point aPos = pDev->LogicToPixel( rPos );
- Size aSize = pDev->LogicToPixel( rSize );
- OutDevType eOutDevType = pDev->GetOutDevType();
- AllSettings aOldSettings = pDev->GetSettings();
+ if ( (nFlags & DrawFlags::NoControls ) || !( nFieldStyle & (WB_SPIN|WB_DROPDOWN) ) )
+ return;
- pDev->Push();
- pDev->SetMapMode();
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ OutDevType eOutDevType = pDev->GetOutDevType();
+ AllSettings aOldSettings = pDev->GetSettings();
- if (eOutDevType == OUTDEV_PRINTER)
- {
- StyleSettings aStyleSettings = aOldSettings.GetStyleSettings();
- aStyleSettings.SetFaceColor(COL_LIGHTGRAY);
- aStyleSettings.SetButtonTextColor(COL_BLACK);
- AllSettings aSettings(aOldSettings);
- aSettings.SetStyleSettings(aStyleSettings);
- pDev->SetSettings(aSettings);
- }
+ pDev->Push();
+ pDev->SetMapMode();
- tools::Rectangle aDD, aUp, aDown;
- ImplCalcButtonAreas(pDev, aSize, aDD, aUp, aDown);
- aDD.Move(aPos.X(), aPos.Y());
- aUp.Move(aPos.X(), aPos.Y());
- aUp.Top()++;
- aDown.Move(aPos.X(), aPos.Y());
+ if (eOutDevType == OUTDEV_PRINTER)
+ {
+ StyleSettings aStyleSettings = aOldSettings.GetStyleSettings();
+ aStyleSettings.SetFaceColor(COL_LIGHTGRAY);
+ aStyleSettings.SetButtonTextColor(COL_BLACK);
+ AllSettings aSettings(aOldSettings);
+ aSettings.SetStyleSettings(aStyleSettings);
+ pDev->SetSettings(aSettings);
+ }
- Color aButtonTextColor;
- if ((nFlags & DrawFlags::Mono) || (eOutDevType == OUTDEV_PRINTER))
- aButtonTextColor = Color( COL_BLACK );
- else
- aButtonTextColor = GetSettings().GetStyleSettings().GetButtonTextColor();
+ tools::Rectangle aDD, aUp, aDown;
+ ImplCalcButtonAreas(pDev, aSize, aDD, aUp, aDown);
+ aDD.Move(aPos.X(), aPos.Y());
+ aUp.Move(aPos.X(), aPos.Y());
+ aUp.Top()++;
+ aDown.Move(aPos.X(), aPos.Y());
- if (GetStyle() & WB_DROPDOWN)
- {
- DecorationView aView( pDev );
- tools::Rectangle aInnerRect = aView.DrawButton( aDD, DrawButtonFlags::NoLightBorder );
- DrawSymbolFlags nSymbolStyle = (IsEnabled() || (nFlags & DrawFlags::NoDisable)) ? DrawSymbolFlags::NONE : DrawSymbolFlags::Disable;
- aView.DrawSymbol(aInnerRect, SymbolType::SPIN_DOWN, aButtonTextColor, nSymbolStyle);
- }
+ Color aButtonTextColor;
+ if ((nFlags & DrawFlags::Mono) || (eOutDevType == OUTDEV_PRINTER))
+ aButtonTextColor = Color( COL_BLACK );
+ else
+ aButtonTextColor = GetSettings().GetStyleSettings().GetButtonTextColor();
- if (GetStyle() & WB_SPIN)
- {
- ImplDrawSpinButton(*pDev, this, aUp, aDown, false, false);
- }
+ if (GetStyle() & WB_DROPDOWN)
+ {
+ DecorationView aView( pDev );
+ tools::Rectangle aInnerRect = aView.DrawButton( aDD, DrawButtonFlags::NoLightBorder );
+ DrawSymbolFlags nSymbolStyle = (IsEnabled() || (nFlags & DrawFlags::NoDisable)) ? DrawSymbolFlags::NONE : DrawSymbolFlags::Disable;
+ aView.DrawSymbol(aInnerRect, SymbolType::SPIN_DOWN, aButtonTextColor, nSymbolStyle);
+ }
- pDev->Pop();
- pDev->SetSettings(aOldSettings);
+ if (GetStyle() & WB_SPIN)
+ {
+ ImplDrawSpinButton(*pDev, this, aUp, aDown, false, false);
}
+
+ pDev->Pop();
+ pDev->SetSettings(aOldSettings);
+
}
FactoryFunction SpinField::GetUITestFactory() const
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index d7e90cd555e9..e369e8299f9c 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -171,44 +171,45 @@ void TextEngine::SetActiveView( TextView* pTextView )
void TextEngine::SetFont( const vcl::Font& rFont )
{
- if ( rFont != maFont )
- {
- maFont = rFont;
- // #i40221# As the font's color now defaults to transparent (since i35764)
- // we have to choose a useful textcolor in this case.
- // Otherwise maTextColor and maFont.GetColor() are both transparent....
- if( rFont.GetColor() == COL_TRANSPARENT )
- maTextColor = COL_BLACK;
- else
- maTextColor = rFont.GetColor();
-
- // Do not allow transparent fonts because of selection
- // (otherwise delete the background in ImplPaint later differently)
- maFont.SetTransparent( false );
- // Tell VCL not to use the font color, use text color from OutputDevice
- maFont.SetColor( COL_TRANSPARENT );
- Color aFillColor( maFont.GetFillColor() );
- aFillColor.SetTransparency( 0 );
- maFont.SetFillColor( aFillColor );
-
- maFont.SetAlignment( ALIGN_TOP );
- mpRefDev->SetFont( maFont );
- mnDefTab = mpRefDev->GetTextWidth(" ");
- if ( !mnDefTab )
- mnDefTab = mpRefDev->GetTextWidth("XXXX");
- if ( !mnDefTab )
- mnDefTab = 1;
- mnCharHeight = mpRefDev->GetTextHeight();
+ if ( rFont == maFont )
+ return;
- FormatFullDoc();
- UpdateViews();
+ maFont = rFont;
+ // #i40221# As the font's color now defaults to transparent (since i35764)
+ // we have to choose a useful textcolor in this case.
+ // Otherwise maTextColor and maFont.GetColor() are both transparent....
+ if( rFont.GetColor() == COL_TRANSPARENT )
+ maTextColor = COL_BLACK;
+ else
+ maTextColor = rFont.GetColor();
+
+ // Do not allow transparent fonts because of selection
+ // (otherwise delete the background in ImplPaint later differently)
+ maFont.SetTransparent( false );
+ // Tell VCL not to use the font color, use text color from OutputDevice
+ maFont.SetColor( COL_TRANSPARENT );
+ Color aFillColor( maFont.GetFillColor() );
+ aFillColor.SetTransparency( 0 );
+ maFont.SetFillColor( aFillColor );
- for ( auto nView = mpViews->size(); nView; )
- {
- TextView* pView = (*mpViews)[ --nView ];
- pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) );
- }
+ maFont.SetAlignment( ALIGN_TOP );
+ mpRefDev->SetFont( maFont );
+ mnDefTab = mpRefDev->GetTextWidth(" ");
+ if ( !mnDefTab )
+ mnDefTab = mpRefDev->GetTextWidth("XXXX");
+ if ( !mnDefTab )
+ mnDefTab = 1;
+ mnCharHeight = mpRefDev->GetTextHeight();
+
+ FormatFullDoc();
+ UpdateViews();
+
+ for ( auto nView = mpViews->size(); nView; )
+ {
+ TextView* pView = (*mpViews)[ --nView ];
+ pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) );
}
+
}
void TextEngine::SetMaxTextLen( sal_Int32 nLen )
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index fabada800ea9..e3dd3d5231e1 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -361,21 +361,22 @@ void EMFWriter::ImplEndRecord()
{
SAL_WARN_IF( !mbRecordOpen, "vcl", "Record was not opened!" );
- if( mbRecordOpen )
- {
- sal_Int32 nFillBytes, nActPos = m_rStm.Tell();
- m_rStm.Seek( mnRecordPos + 4 );
- nFillBytes = nActPos - mnRecordPos;
- nFillBytes += 3; // each record has to be dword aligned
- nFillBytes ^= 3;
- nFillBytes &= 3;
- m_rStm.WriteUInt32( ( nActPos - mnRecordPos ) + nFillBytes );
- m_rStm.Seek( nActPos );
- while( nFillBytes-- )
- m_rStm.WriteUChar( 0 );
- mnRecordCount++;
- mbRecordOpen = false;
- }
+ if( !mbRecordOpen )
+ return;
+
+ sal_Int32 nFillBytes, nActPos = m_rStm.Tell();
+ m_rStm.Seek( mnRecordPos + 4 );
+ nFillBytes = nActPos - mnRecordPos;
+ nFillBytes += 3; // each record has to be dword aligned
+ nFillBytes ^= 3;
+ nFillBytes &= 3;
+ m_rStm.WriteUInt32( ( nActPos - mnRecordPos ) + nFillBytes );
+ m_rStm.Seek( nActPos );
+ while( nFillBytes-- )
+ m_rStm.WriteUChar( 0 );
+ mnRecordCount++;
+ mbRecordOpen = false;
+
}
bool EMFWriter::ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType )
@@ -447,113 +448,114 @@ void EMFWriter::ImplCheckFillAttr()
void EMFWriter::ImplCheckTextAttr()
{
- if( mbTextChanged && ImplPrepareHandleSelect( mnTextHandle, TEXT_SELECT ) )
+ if( !(mbTextChanged && ImplPrepareHandleSelect( mnTextHandle, TEXT_SELECT )) )
+ return;
+
+ const vcl::Font& rFont = maVDev->GetFont();
+ const OUString& aFontName( rFont.GetFamilyName() );
+ sal_Int32 nWeight;
+ sal_uInt16 i;
+ sal_uInt8 nPitchAndFamily;
+
+ ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW );
+ m_rStm.WriteUInt32( mnTextHandle );
+ ImplWriteExtent( -rFont.GetFontSize().Height() );
+ ImplWriteExtent( rFont.GetFontSize().Width() );
+ m_rStm.WriteInt32( rFont.GetOrientation() ).WriteInt32( rFont.GetOrientation() );
+
+ switch( rFont.GetWeight() )
{
- const vcl::Font& rFont = maVDev->GetFont();
- const OUString& aFontName( rFont.GetFamilyName() );
- sal_Int32 nWeight;
- sal_uInt16 i;
- sal_uInt8 nPitchAndFamily;
-
- ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW );
- m_rStm.WriteUInt32( mnTextHandle );
- ImplWriteExtent( -rFont.GetFontSize().Height() );
- ImplWriteExtent( rFont.GetFontSize().Width() );
- m_rStm.WriteInt32( rFont.GetOrientation() ).WriteInt32( rFont.GetOrientation() );
-
- switch( rFont.GetWeight() )
- {
- case WEIGHT_THIN: nWeight = 100; break;
- case WEIGHT_ULTRALIGHT: nWeight = 200; break;
- case WEIGHT_LIGHT: nWeight = 300; break;
- case WEIGHT_SEMILIGHT: nWeight = 300; break;
- case WEIGHT_NORMAL: nWeight = 400; break;
- case WEIGHT_MEDIUM: nWeight = 500; break;
- case WEIGHT_SEMIBOLD: nWeight = 600; break;
- case WEIGHT_BOLD: nWeight = 700; break;
- case WEIGHT_ULTRABOLD: nWeight = 800; break;
- case WEIGHT_BLACK: nWeight = 900; break;
- default: nWeight = 0; break;
- }
+ case WEIGHT_THIN: nWeight = 100; break;
+ case WEIGHT_ULTRALIGHT: nWeight = 200; break;
+ case WEIGHT_LIGHT: nWeight = 300; break;
+ case WEIGHT_SEMILIGHT: nWeight = 300; break;
+ case WEIGHT_NORMAL: nWeight = 400; break;
+ case WEIGHT_MEDIUM: nWeight = 500; break;
+ case WEIGHT_SEMIBOLD: nWeight = 600; break;
+ case WEIGHT_BOLD: nWeight = 700; break;
+ case WEIGHT_ULTRABOLD: nWeight = 800; break;
+ case WEIGHT_BLACK: nWeight = 900; break;
+ default: nWeight = 0; break;
+ }
- m_rStm.WriteInt32( nWeight );
- m_rStm.WriteUChar( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 );
- m_rStm.WriteUChar( ( LINESTYLE_NONE == rFont.GetUnderline() ) ? 0 : 1 );
- m_rStm.WriteUChar( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 );
- m_rStm.WriteUChar( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 );
- m_rStm.WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 );
+ m_rStm.WriteInt32( nWeight );
+ m_rStm.WriteUChar( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 );
+ m_rStm.WriteUChar( ( LINESTYLE_NONE == rFont.GetUnderline() ) ? 0 : 1 );
+ m_rStm.WriteUChar( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 );
+ m_rStm.WriteUChar( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 );
+ m_rStm.WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 );
- switch( rFont.GetPitch() )
- {
- case PITCH_FIXED: nPitchAndFamily = 0x01; break;
- case PITCH_VARIABLE: nPitchAndFamily = 0x02; break;
- default: nPitchAndFamily = 0x00; break;
- }
+ switch( rFont.GetPitch() )
+ {
+ case PITCH_FIXED: nPitchAndFamily = 0x01; break;
+ case PITCH_VARIABLE: nPitchAndFamily = 0x02; break;
+ default: nPitchAndFamily = 0x00; break;
+ }
- switch( rFont.GetFamilyType() )
- {
- case FAMILY_DECORATIVE: nPitchAndFamily |= 0x50; break;
- case FAMILY_MODERN: nPitchAndFamily |= 0x30; break;
- case FAMILY_ROMAN: nPitchAndFamily |= 0x10; break;
- case FAMILY_SCRIPT: nPitchAndFamily |= 0x40; break;
- case FAMILY_SWISS: nPitchAndFamily |= 0x20; break;
- default: break;
- }
+ switch( rFont.GetFamilyType() )
+ {
+ case FAMILY_DECORATIVE: nPitchAndFamily |= 0x50; break;
+ case FAMILY_MODERN: nPitchAndFamily |= 0x30; break;
+ case FAMILY_ROMAN: nPitchAndFamily |= 0x10; break;
+ case FAMILY_SCRIPT: nPitchAndFamily |= 0x40; break;
+ case FAMILY_SWISS: nPitchAndFamily |= 0x20; break;
+ default: break;
+ }
- m_rStm.WriteUChar( nPitchAndFamily );
+ m_rStm.WriteUChar( nPitchAndFamily );
- for( i = 0; i < 32; i++ )
- m_rStm.WriteUInt16( ( i < aFontName.getLength() ) ? aFontName[ i ] : 0 );
+ for( i = 0; i < 32; i++ )
+ m_rStm.WriteUInt16( ( i < aFontName.getLength() ) ? aFontName[ i ] : 0 );
- // dummy elfFullName
- for( i = 0; i < 64; i++ )
- m_rStm.WriteUInt16( 0 );
+ // dummy elfFullName
+ for( i = 0; i < 64; i++ )
+ m_rStm.WriteUInt16( 0 );
- // dummy elfStyle
- for( i = 0; i < 32; i++ )
- m_rStm.WriteUInt16( 0 );
+ // dummy elfStyle
+ for( i = 0; i < 32; i++ )
+ m_rStm.WriteUInt16( 0 );
- // dummy elfVersion, elfStyleSize, elfMatch, elfReserved
- m_rStm.WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ) ;
+ // dummy elfVersion, elfStyleSize, elfMatch, elfReserved
+ m_rStm.WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ) ;
- // dummy elfVendorId
- m_rStm.WriteUInt32( 0 );
+ // dummy elfVendorId
+ m_rStm.WriteUInt32( 0 );
- // dummy elfCulture
- m_rStm.WriteUInt32( 0 );
+ // dummy elfCulture
+ m_rStm.WriteUInt32( 0 );
- // dummy elfPanose
- m_rStm.WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 );
+ // dummy elfPanose
+ m_rStm.WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 );
- // fill record to get a record size divideable by 4
- m_rStm.WriteUInt16( 0 );
+ // fill record to get a record size divideable by 4
+ m_rStm.WriteUInt16( 0 );
- ImplEndRecord();
+ ImplEndRecord();
- // TextAlign
- sal_uInt32 nTextAlign;
+ // TextAlign
+ sal_uInt32 nTextAlign;
- switch( rFont.GetAlignment() )
- {
- case ALIGN_TOP: nTextAlign = TA_TOP; break;
- case ALIGN_BOTTOM: nTextAlign = TA_BOTTOM; break;
- default: nTextAlign = TA_BASELINE; break;
- }
- nTextAlign |= mnHorTextAlign;
+ switch( rFont.GetAlignment() )
+ {
+ case ALIGN_TOP: nTextAlign = TA_TOP; break;
+ case ALIGN_BOTTOM: nTextAlign = TA_BOTTOM; break;
+ default: nTextAlign = TA_BASELINE; break;
+ }
+ nTextAlign |= mnHorTextAlign;
- ImplBeginRecord( WIN_EMR_SETTEXTALIGN );
- m_rStm.WriteUInt32( nTextAlign );
- ImplEndRecord();
+ ImplBeginRecord( WIN_EMR_SETTEXTALIGN );
+ m_rStm.WriteUInt32( nTextAlign );
+ ImplEndRecord();
- // Text color
- ImplBeginRecord( WIN_EMR_SETTEXTCOLOR );
- ImplWriteColor( maVDev->GetTextColor() );
- ImplEndRecord();
+ // Text color
+ ImplBeginRecord( WIN_EMR_SETTEXTCOLOR );
+ ImplWriteColor( maVDev->GetTextColor() );
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SELECTOBJECT );
+ m_rStm.WriteUInt32( mnTextHandle );
+ ImplEndRecord();
- ImplBeginRecord( WIN_EMR_SELECTOBJECT );
- m_rStm.WriteUInt32( mnTextHandle );
- ImplEndRecord();
- }
}
void EMFWriter::ImplWriteColor( const Color& rColor )
@@ -772,133 +774,135 @@ void EMFWriter::ImplWritePath( const tools::PolyPolygon& rPolyPoly, bool bClosed
void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
const Size& rSz, sal_uInt32 nROP )
{
- if( !!rBmp )
- {
- SvMemoryStream aMemStm( 65535, 65535 );
- const Size aBmpSizePixel( rBmp.GetSizePixel() );
+ if( !rBmp )
+ return;
- ImplBeginRecord( WIN_EMR_STRETCHDIBITS );
- ImplWriteRect( tools::Rectangle( rPt, rSz ) );
- ImplWritePoint( rPt );
- m_rStm.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( aBmpSizePixel.Width() ).WriteInt32( aBmpSizePixel.Height() );
+ SvMemoryStream aMemStm( 65535, 65535 );
+ const Size aBmpSizePixel( rBmp.GetSizePixel() );
- // write offset positions and sizes later
- const sal_uLong nOffPos = m_rStm.Tell();
- m_rStm.SeekRel( 16 );
+ ImplBeginRecord( WIN_EMR_STRETCHDIBITS );
+ ImplWriteRect( tools::Rectangle( rPt, rSz ) );
+ ImplWritePoint( rPt );
+ m_rStm.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( aBmpSizePixel.Width() ).WriteInt32( aBmpSizePixel.Height() );
- m_rStm.WriteUInt32( 0 ).WriteInt32( ( RasterOp::Xor == maVDev->GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
- ImplWriteSize( rSz );
+ // write offset positions and sizes later
+ const sal_uLong nOffPos = m_rStm.Tell();
+ m_rStm.SeekRel( 16 );
- WriteDIB(rBmp, aMemStm, true, false);
+ m_rStm.WriteUInt32( 0 ).WriteInt32( ( RasterOp::Xor == maVDev->GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
+ ImplWriteSize( rSz );
- sal_uInt32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
- sal_uInt16 nBitCount;
+ WriteDIB(rBmp, aMemStm, true, false);
- // get DIB parameters
- aMemStm.Seek( 0 );
- aMemStm.ReadUInt32( nHeaderSize );
- aMemStm.SeekRel( 10 );
- aMemStm.ReadUInt16( nBitCount ).ReadUInt32( nCompression ).ReadUInt32( nImageSize );
- aMemStm.SeekRel( 8 );
- aMemStm.ReadUInt32( nColsUsed );
+ sal_uInt32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
+ sal_uInt16 nBitCount;
- if (nBitCount <= 8)
- {
- if (nColsUsed)
- nPalCount = nColsUsed;
- else
- nPalCount = 1 << (sal_uInt32)nBitCount;
- }
+ // get DIB parameters
+ aMemStm.Seek( 0 );
+ aMemStm.ReadUInt32( nHeaderSize );
+ aMemStm.SeekRel( 10 );
+ aMemStm.ReadUInt16( nBitCount ).ReadUInt32( nCompression ).ReadUInt32( nImageSize );
+ aMemStm.SeekRel( 8 );
+ aMemStm.ReadUInt32( nColsUsed );
+
+ if (nBitCount <= 8)
+ {
+ if (nColsUsed)
+ nPalCount = nColsUsed;
else
- {
- if (nCompression == BITFIELDS)
- nPalCount = 3;
- else
- nPalCount = 0;
- }
+ nPalCount = 1 << (sal_uInt32)nBitCount;
+ }
+ else
+ {
+ if (nCompression == BITFIELDS)
+ nPalCount = 3;
+ else
+ nPalCount = 0;
+ }
+
+ sal_uInt32 nPalSize = nPalCount * 4;
- sal_uInt32 nPalSize = nPalCount * 4;
+ m_rStm.WriteBytes( aMemStm.GetData(), nDIBSize );
- m_rStm.WriteBytes( aMemStm.GetData(), nDIBSize );
+ const sal_uLong nEndPos = m_rStm.Tell();
+ m_rStm.Seek( nOffPos );
+ m_rStm.WriteUInt32( 80 ).WriteUInt32( nHeaderSize + nPalSize );
+ m_rStm.WriteUInt32( 80 + nHeaderSize + nPalSize ).WriteUInt32( nImageSize );
+ m_rStm.Seek( nEndPos );
- const sal_uLong nEndPos = m_rStm.Tell();
- m_rStm.Seek( nOffPos );
- m_rStm.WriteUInt32( 80 ).WriteUInt32( nHeaderSize + nPalSize );
- m_rStm.WriteUInt32( 80 + nHeaderSize + nPalSize ).WriteUInt32( nImageSize );
- m_rStm.Seek( nEndPos );
+ ImplEndRecord();
- ImplEndRecord();
- }
}
void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, const long* pDXArray, sal_uInt32 nWidth )
{
sal_Int32 nLen = rText.getLength(), i;
- if( nLen )
+ if( !nLen )
+ return;
+
+ sal_uInt32 nNormWidth;
+ std::unique_ptr<long[]> pOwnArray;
+ long* pDX;
+
+ // get text sizes
+ if( pDXArray )
+ {
+ nNormWidth = maVDev->GetTextWidth( rText );
+ pDX = const_cast<long*>(pDXArray);
+ }
+ else
{
- sal_uInt32 nNormWidth;
- std::unique_ptr<long[]> pOwnArray;
- long* pDX;
+ pOwnArray.reset(new long[ nLen ]);
+ nNormWidth = maVDev->GetTextArray( rText, pOwnArray.get() );
+ pDX = pOwnArray.get();
+ }
- // get text sizes
- if( pDXArray )
- {
- nNormWidth = maVDev->GetTextWidth( rText );
- pDX = const_cast<long*>(pDXArray);
- }
- else
- {
- pOwnArray.reset(new long[ nLen ]);
- nNormWidth = maVDev->GetTextArray( rText, pOwnArray.get() );
- pDX = pOwnArray.get();
- }
+ if( nLen > 1 )
+ {
+ nNormWidth = pDX[ nLen - 2 ] + maVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
- if( nLen > 1 )
+ if( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
{
- nNormWidth = pDX[ nLen - 2 ] + maVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
+ const double fFactor = (double) nWidth / nNormWidth;
- if( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
- {
- const double fFactor = (double) nWidth / nNormWidth;
-
- for( i = 0; i < ( nLen - 1 ); i++ )
- pDX[ i ] = FRound( pDX[ i ] * fFactor );
- }
+ for( i = 0; i < ( nLen - 1 ); i++ )
+ pDX[ i ] = FRound( pDX[ i ] * fFactor );
}
+ }
- // write text record
- ImplBeginRecord( WIN_EMR_EXTTEXTOUTW );
-
- ImplWriteRect( tools::Rectangle( rPos, Size( nNormWidth, maVDev->GetTextHeight() ) ) );
- m_rStm.WriteUInt32( 1 );
- m_rStm.WriteInt32( 0 ).WriteInt32( 0 );
- ImplWritePoint( rPos );
- m_rStm.WriteUInt32( nLen ).WriteUInt32( 76 ).WriteUInt32( 2 );
- m_rStm.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( 0 );
- m_rStm.WriteUInt32( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) );
+ // write text record
+ ImplBeginRecord( WIN_EMR_EXTTEXTOUTW );
- // write text
- for( i = 0; i < nLen; i++ )
- m_rStm.WriteUInt16( rText[ i ] );
+ ImplWriteRect( tools::Rectangle( rPos, Size( nNormWidth, maVDev->GetTextHeight() ) ) );
+ m_rStm.WriteUInt32( 1 );
+ m_rStm.WriteInt32( 0 ).WriteInt32( 0 );
+ ImplWritePoint( rPos );
+ m_rStm.WriteUInt32( nLen ).WriteUInt32( 76 ).WriteUInt32( 2 );
+ m_rStm.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( 0 );
+ m_rStm.WriteUInt32( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) );
- // padding word
- if( nLen & 1 )
- m_rStm.WriteUInt16( 0 );
+ // write text
+ for( i = 0; i < nLen; i++ )
+ m_rStm.WriteUInt16( rText[ i ] );
- // write DX array
- ImplWriteExtent( pDX[ 0 ] );
+ // padding word
+ if( nLen & 1 )
+ m_rStm.WriteUInt16( 0 );
- if( nLen > 1 )
- {
- for( i = 1; i < ( nLen - 1 ); i++ )
- ImplWriteExtent( pDX[ i ] - pDX[ i - 1 ] );
+ // write DX array
+ ImplWriteExtent( pDX[ 0 ] );
- ImplWriteExtent( pDX[ nLen - 2 ] / ( nLen - 1 ) );
- }
+ if( nLen > 1 )
+ {
+ for( i = 1; i < ( nLen - 1 ); i++ )
+ ImplWriteExtent( pDX[ i ] - pDX[ i - 1 ] );
- ImplEndRecord();
+ ImplWriteExtent( pDX[ nLen - 2 ] / ( nLen - 1 ) );
}
+
+ ImplEndRecord();
+
}
void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index f7d2fdf80359..723a55ef4414 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1834,50 +1834,51 @@ void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF )
SvMemoryStream aStream;
EMFWriter aEMFWriter(aStream);
- if( aEMFWriter.WriteEMF( rMTF ) )
+ if( !aEMFWriter.WriteEMF( rMTF ) )
+ return;
+
+ sal_uInt64 const nTotalSize = aStream.Tell();
+ if( nTotalSize > SAL_MAX_UINT32 )
+ return;
+ aStream.Seek( 0 );
+ sal_uInt32 nRemainingSize = static_cast< sal_uInt32 >( nTotalSize );
+ sal_uInt32 nRecCounts = ( (nTotalSize - 1) / 0x2000 ) + 1;
+ sal_uInt16 nCheckSum = 0, nWord;
+
+ sal_uInt32 nPos = 0;
+
+ while( nPos + 1 < nTotalSize )
{
- sal_uInt64 const nTotalSize = aStream.Tell();
- if( nTotalSize > SAL_MAX_UINT32 )
- return;
- aStream.Seek( 0 );
- sal_uInt32 nRemainingSize = static_cast< sal_uInt32 >( nTotalSize );
- sal_uInt32 nRecCounts = ( (nTotalSize - 1) / 0x2000 ) + 1;
- sal_uInt16 nCheckSum = 0, nWord;
+ aStream.ReadUInt16( nWord );
+ nCheckSum ^= nWord;
+ nPos += 2;
+ }
- sal_uInt32 nPos = 0;
+ nCheckSum = static_cast< sal_uInt16 >( nCheckSum * -1 );
- while( nPos + 1 < nTotalSize )
+ aStream.Seek( 0 );
+ while( nRemainingSize > 0 )
+ {
+ sal_uInt32 nCurSize;
+ if( nRemainingSize > 0x2000 )
{
- aStream.ReadUInt16( nWord );
- nCheckSum ^= nWord;
- nPos += 2;
+ nCurSize = 0x2000;
+ nRemainingSize -= 0x2000;
}
-
- nCheckSum = static_cast< sal_uInt16 >( nCheckSum * -1 );
-
- aStream.Seek( 0 );
- while( nRemainingSize > 0 )
+ else
{
- sal_uInt32 nCurSize;
- if( nRemainingSize > 0x2000 )
- {
- nCurSize = 0x2000;
- nRemainingSize -= 0x2000;
- }
- else
- {
- nCurSize = nRemainingSize;
- nRemainingSize = 0;
- }
- WriteEMFRecord( aStream,
- nCurSize,
- nRemainingSize,
- nTotalSize,
- nRecCounts,
- nCheckSum );
- nCheckSum = 0;
+ nCurSize = nRemainingSize;
+ nRemainingSize = 0;
}
+ WriteEMFRecord( aStream,
+ nCurSize,
+ nRemainingSize,
+ nTotalSize,
+ nRecCounts,
+ nCheckSum );
+ nCheckSum = 0;
}
+
}
void WMFWriter::WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize, sal_uInt32 nRemainingSize,
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index a7c691fc1863..ca9df62fdc36 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -449,61 +449,62 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
MapMode aDrawMap( GetPrefMapMode() );
Size aDestSize( pOut->LogicToPixel( rSize ) );
- if( aDestSize.Width() && aDestSize.Height() )
- {
- GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
+ if( !aDestSize.Width() || !aDestSize.Height() )
+ return;
- if( ImplPlayWithRenderer( pOut, rPos, rSize ) )
- return;
+ GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
- Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
+ if( ImplPlayWithRenderer( pOut, rPos, rSize ) )
+ return;
- if( !aTmpPrefSize.Width() )
- aTmpPrefSize.Width() = aDestSize.Width();
+ Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
- if( !aTmpPrefSize.Height() )
- aTmpPrefSize.Height() = aDestSize.Height();
+ if( !aTmpPrefSize.Width() )
+ aTmpPrefSize.Width() = aDestSize.Width();
- Fraction aScaleX( aDestSize.Width(), aTmpPrefSize.Width() );
- Fraction aScaleY( aDestSize.Height(), aTmpPrefSize.Height() );
+ if( !aTmpPrefSize.Height() )
+ aTmpPrefSize.Height() = aDestSize.Height();
- aScaleX *= aDrawMap.GetScaleX(); aDrawMap.SetScaleX( aScaleX );
- aScaleY *= aDrawMap.GetScaleY(); aDrawMap.SetScaleY( aScaleY );
+ Fraction aScaleX( aDestSize.Width(), aTmpPrefSize.Width() );
+ Fraction aScaleY( aDestSize.Height(), aTmpPrefSize.Height() );
- // #i47260# Convert logical output position to offset within
- // the metafile's mapmode. Therefore, disable pixel offset on
- // outdev, it's inverse mnOutOffLogicX/Y is calculated for a
- // different mapmode (the one currently set on pOut, that is)
- // - thus, aDrawMap's origin would generally be wrong. And
- // even _if_ aDrawMap is similar to pOutDev's current mapmode,
- // it's _still_ undesirable to have pixel offset unequal zero,
- // because one would still get round-off errors (the
- // round-trip error for LogicToPixel( PixelToLogic() ) was the
- // reason for having pixel offset in the first place).
- const Size& rOldOffset( pOut->GetPixelOffset() );
- const Size aEmptySize;
- pOut->SetPixelOffset( aEmptySize );
- aDrawMap.SetOrigin( pOut->PixelToLogic( pOut->LogicToPixel( rPos ), aDrawMap ) );
- pOut->SetPixelOffset( rOldOffset );
+ aScaleX *= aDrawMap.GetScaleX(); aDrawMap.SetScaleX( aScaleX );
+ aScaleY *= aDrawMap.GetScaleY(); aDrawMap.SetScaleY( aScaleY );
- pOut->Push();
+ // #i47260# Convert logical output position to offset within
+ // the metafile's mapmode. Therefore, disable pixel offset on
+ // outdev, it's inverse mnOutOffLogicX/Y is calculated for a
+ // different mapmode (the one currently set on pOut, that is)
+ // - thus, aDrawMap's origin would generally be wrong. And
+ // even _if_ aDrawMap is similar to pOutDev's current mapmode,
+ // it's _still_ undesirable to have pixel offset unequal zero,
+ // because one would still get round-off errors (the
+ // round-trip error for LogicToPixel( PixelToLogic() ) was the
+ // reason for having pixel offset in the first place).
+ const Size& rOldOffset( pOut->GetPixelOffset() );
+ const Size aEmptySize;
+ pOut->SetPixelOffset( aEmptySize );
+ aDrawMap.SetOrigin( pOut->PixelToLogic( pOut->LogicToPixel( rPos ), aDrawMap ) );
+ pOut->SetPixelOffset( rOldOffset );
- if ( pMtf && pMtf->IsRecord() && ( pOut->GetOutDevType() != OUTDEV_PRINTER ) )
- pOut->SetRelativeMapMode( aDrawMap );
- else
- pOut->SetMapMode( aDrawMap );
+ pOut->Push();
- // #i23407# Set backwards-compatible text language and layout mode
- // This is necessary, since old metafiles don't even know of these
- // recent add-ons. Newer metafiles must of course explicitly set
- // those states.
- pOut->SetLayoutMode( ComplexTextLayoutFlags::Default );
- pOut->SetDigitLanguage( LANGUAGE_SYSTEM );
+ if ( pMtf && pMtf->IsRecord() && ( pOut->GetOutDevType() != OUTDEV_PRINTER ) )
+ pOut->SetRelativeMapMode( aDrawMap );
+ else
+ pOut->SetMapMode( aDrawMap );
- Play( pOut );
+ // #i23407# Set backwards-compatible text language and layout mode
+ // This is necessary, since old metafiles don't even know of these
+ // recent add-ons. Newer metafiles must of course explicitly set
+ // those states.
+ pOut->SetLayoutMode( ComplexTextLayoutFlags::Default );
+ pOut->SetDigitLanguage( LANGUAGE_SYSTEM );
+
+ Play( pOut );
+
+ pOut->Pop();
- pOut->Pop();
- }
}
void GDIMetaFile::Pause( bool _bPause )
@@ -839,462 +840,463 @@ void GDIMetaFile::Rotate( long nAngle10 )
nAngle10 %= 3600;
nAngle10 = ( nAngle10 < 0 ) ? ( 3599 + nAngle10 ) : nAngle10;
- if( nAngle10 )
- {
- GDIMetaFile aMtf;
- ScopedVclPtrInstance< VirtualDevice > aMapVDev;
- const double fAngle = F_PI1800 * nAngle10;
- const double fSin = sin( fAngle );
- const double fCos = cos( fAngle );
- tools::Rectangle aRect=tools::Rectangle( Point(), GetPrefSize() );
- tools::Polygon aPoly( aRect );
+ if( !nAngle10 )
+ return;
+
+ GDIMetaFile aMtf;
+ ScopedVclPtrInstance< VirtualDevice > aMapVDev;
+ const double fAngle = F_PI1800 * nAngle10;
+ const double fSin = sin( fAngle );
+ const double fCos = cos( fAngle );
+ tools::Rectangle aRect=tools::Rectangle( Point(), GetPrefSize() );
+ tools::Polygon aPoly( aRect );
- aPoly.Rotate( Point(), fSin, fCos );
+ aPoly.Rotate( Point(), fSin, fCos );
- aMapVDev->EnableOutput( false );
- aMapVDev->SetMapMode( GetPrefMapMode() );
+ aMapVDev->EnableOutput( false );
+ aMapVDev->SetMapMode( GetPrefMapMode() );
- const tools::Rectangle aNewBound( aPoly.GetBoundRect() );
+ const tools::Rectangle aNewBound( aPoly.GetBoundRect() );
- const Point aOrigin( GetPrefMapMode().GetOrigin().X(), GetPrefMapMode().GetOrigin().Y() );
- const Size aOffset( -aNewBound.Left(), -aNewBound.Top() );
+ const Point aOrigin( GetPrefMapMode().GetOrigin().X(), GetPrefMapMode().GetOrigin().Y() );
+ const Size aOffset( -aNewBound.Left(), -aNewBound.Top() );
- Point aRotAnchor( aOrigin );
- Size aRotOffset( aOffset );
+ Point aRotAnchor( aOrigin );
+ Size aRotOffset( aOffset );
+
+ for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() )
+ {
+ const MetaActionType nActionType = pAction->GetType();
- for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() )
+ switch( nActionType )
{
- const MetaActionType nActionType = pAction->GetType();
+ case MetaActionType::PIXEL:
+ {
+ MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
+ aMtf.AddAction( new MetaPixelAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetColor() ) );
+ }
+ break;
- switch( nActionType )
+ case MetaActionType::POINT:
{
- case MetaActionType::PIXEL:
- {
- MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
- aMtf.AddAction( new MetaPixelAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetColor() ) );
- }
- break;
+ MetaPointAction* pAct = static_cast<MetaPointAction*>(pAction);
+ aMtf.AddAction( new MetaPointAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- case MetaActionType::POINT:
- {
- MetaPointAction* pAct = static_cast<MetaPointAction*>(pAction);
- aMtf.AddAction( new MetaPointAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::LINE:
+ {
+ MetaLineAction* pAct = static_cast<MetaLineAction*>(pAction);
+ aMtf.AddAction( new MetaLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ ImplGetRotatedPoint( pAct->GetEndPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetLineInfo() ) );
+ }
+ break;
- case MetaActionType::LINE:
- {
- MetaLineAction* pAct = static_cast<MetaLineAction*>(pAction);
- aMtf.AddAction( new MetaLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- ImplGetRotatedPoint( pAct->GetEndPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetLineInfo() ) );
- }
- break;
+ case MetaActionType::RECT:
+ {
+ MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction);
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- case MetaActionType::RECT:
- {
- MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction);
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::ROUNDRECT:
+ {
+ MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction);
+ const tools::Polygon aRoundRectPoly( pAct->GetRect(), pAct->GetHorzRound(), pAct->GetVertRound() );
- case MetaActionType::ROUNDRECT:
- {
- MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction);
- const tools::Polygon aRoundRectPoly( pAct->GetRect(), pAct->GetHorzRound(), pAct->GetVertRound() );
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aRoundRectPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aRoundRectPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::ELLIPSE:
+ {
+ MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction);
+ const tools::Polygon aEllipsePoly( pAct->GetRect().Center(), pAct->GetRect().GetWidth() >> 1, pAct->GetRect().GetHeight() >> 1 );
- case MetaActionType::ELLIPSE:
- {
- MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction);
- const tools::Polygon aEllipsePoly( pAct->GetRect().Center(), pAct->GetRect().GetWidth() >> 1, pAct->GetRect().GetHeight() >> 1 );
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aEllipsePoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aEllipsePoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::ARC:
+ {
+ MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction);
+ const tools::Polygon aArcPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Arc );
- case MetaActionType::ARC:
- {
- MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction);
- const tools::Polygon aArcPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Arc );
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aArcPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aArcPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::PIE:
+ {
+ MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction);
+ const tools::Polygon aPiePoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Pie );
- case MetaActionType::PIE:
- {
- MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction);
- const tools::Polygon aPiePoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Pie );
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aPiePoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aPiePoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::CHORD:
+ {
+ MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction);
+ const tools::Polygon aChordPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Chord );
- case MetaActionType::CHORD:
- {
- MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction);
- const tools::Polygon aChordPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Chord );
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aChordPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aChordPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::POLYLINE:
+ {
+ MetaPolyLineAction* pAct = static_cast<MetaPolyLineAction*>(pAction);
+ aMtf.AddAction( new MetaPolyLineAction( ImplGetRotatedPolygon( pAct->GetPolygon(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->GetLineInfo() ) );
+ }
+ break;
- case MetaActionType::POLYLINE:
- {
- MetaPolyLineAction* pAct = static_cast<MetaPolyLineAction*>(pAction);
- aMtf.AddAction( new MetaPolyLineAction( ImplGetRotatedPolygon( pAct->GetPolygon(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->GetLineInfo() ) );
- }
- break;
+ case MetaActionType::POLYGON:
+ {
+ MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction);
+ aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( pAct->GetPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- case MetaActionType::POLYGON:
- {
- MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction);
- aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( pAct->GetPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::POLYPOLYGON:
+ {
+ MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction);
+ aMtf.AddAction( new MetaPolyPolygonAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
+ }
+ break;
- case MetaActionType::POLYPOLYGON:
- {
- MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction);
- aMtf.AddAction( new MetaPolyPolygonAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
- }
- break;
+ case MetaActionType::TEXT:
+ {
+ MetaTextAction* pAct = static_cast<MetaTextAction*>(pAction);
+ aMtf.AddAction( new MetaTextAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ) );
+ }
+ break;
- case MetaActionType::TEXT:
- {
- MetaTextAction* pAct = static_cast<MetaTextAction*>(pAction);
- aMtf.AddAction( new MetaTextAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ) );
- }
- break;
+ case MetaActionType::TEXTARRAY:
+ {
+ MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pAction);
+ aMtf.AddAction( new MetaTextArrayAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetText(), pAct->GetDXArray(), pAct->GetIndex(), pAct->GetLen() ) );
+ }
+ break;
- case MetaActionType::TEXTARRAY:
- {
- MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pAction);
- aMtf.AddAction( new MetaTextArrayAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetText(), pAct->GetDXArray(), pAct->GetIndex(), pAct->GetLen() ) );
- }
- break;
+ case MetaActionType::STRETCHTEXT:
+ {
+ MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pAction);
+ aMtf.AddAction( new MetaStretchTextAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetWidth(), pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ) );
+ }
+ break;
- case MetaActionType::STRETCHTEXT:
- {
- MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pAction);
- aMtf.AddAction( new MetaStretchTextAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetWidth(), pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ) );
- }
- break;
+ case MetaActionType::TEXTLINE:
+ {
+ MetaTextLineAction* pAct = static_cast<MetaTextLineAction*>(pAction);
+ aMtf.AddAction( new MetaTextLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline(), pAct->GetOverline() ) );
+ }
+ break;
- case MetaActionType::TEXTLINE:
- {
- MetaTextLineAction* pAct = static_cast<MetaTextLineAction*>(pAction);
- aMtf.AddAction( new MetaTextLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline(), pAct->GetOverline() ) );
- }
- break;
+ case MetaActionType::BMPSCALE:
+ {
+ MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
+ tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
+ tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
+ BitmapEx aBmpEx( pAct->GetBitmap() );
- case MetaActionType::BMPSCALE:
- {
- MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
- tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
- tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
- BitmapEx aBmpEx( pAct->GetBitmap() );
-
- aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
- aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(),
- aBmpEx ) );
- }
- break;
+ aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
+ aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(),
+ aBmpEx ) );
+ }
+ break;
- case MetaActionType::BMPSCALEPART:
- {
- MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
- tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetDestPoint(), pAct->GetDestSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
- tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
- BitmapEx aBmpEx( pAct->GetBitmap() );
+ case MetaActionType::BMPSCALEPART:
+ {
+ MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
+ tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetDestPoint(), pAct->GetDestSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
+ tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
+ BitmapEx aBmpEx( pAct->GetBitmap() );
- aBmpEx.Crop( tools::Rectangle( pAct->GetSrcPoint(), pAct->GetSrcSize() ) );
- aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
+ aBmpEx.Crop( tools::Rectangle( pAct->GetSrcPoint(), pAct->GetSrcSize() ) );
+ aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
- aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
- }
- break;
+ aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
+ }
+ break;
- case MetaActionType::BMPEXSCALE:
- {
- MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
- tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
- tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
- BitmapEx aBmpEx( pAct->GetBitmapEx() );
+ case MetaActionType::BMPEXSCALE:
+ {
+ MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
+ tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
+ tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
+ BitmapEx aBmpEx( pAct->GetBitmapEx() );
- aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
+ aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
- aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
- }
- break;
+ aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
+ }
+ break;
- case MetaActionType::BMPEXSCALEPART:
- {
- MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
- tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetDestPoint(), pAct->GetDestSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
- tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
- BitmapEx aBmpEx( pAct->GetBitmapEx() );
+ case MetaActionType::BMPEXSCALEPART:
+ {
+ MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
+ tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetDestPoint(), pAct->GetDestSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
+ tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
+ BitmapEx aBmpEx( pAct->GetBitmapEx() );
- aBmpEx.Crop( tools::Rectangle( pAct->GetSrcPoint(), pAct->GetSrcSize() ) );
- aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
+ aBmpEx.Crop( tools::Rectangle( pAct->GetSrcPoint(), pAct->GetSrcSize() ) );
+ aBmpEx.Rotate( nAngle10, Color( COL_TRANSPARENT ) );
- aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
- }
- break;
+ aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
+ }
+ break;
- case MetaActionType::GRADIENT:
- {
- MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
+ case MetaActionType::GRADIENT:
+ {
+ MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
- ImplAddGradientEx( aMtf, *aMapVDev.get(),
- ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetGradient() );
- }
- break;
+ ImplAddGradientEx( aMtf, *aMapVDev.get(),
+ ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetGradient() );
+ }
+ break;
- case MetaActionType::GRADIENTEX:
- {
- MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
- aMtf.AddAction( new MetaGradientExAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetGradient() ) );
- }
- break;
+ case MetaActionType::GRADIENTEX:
+ {
+ MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
+ aMtf.AddAction( new MetaGradientExAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetGradient() ) );
+ }
+ break;
- // Handle gradientex comment block correctly
- case MetaActionType::COMMENT:
+ // Handle gradientex comment block correctly
+ case MetaActionType::COMMENT:
+ {
+ MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction);
+ if( pCommentAct->GetComment() == "XGRAD_SEQ_BEGIN" )
{
- MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction);
- if( pCommentAct->GetComment() == "XGRAD_SEQ_BEGIN" )
+ int nBeginComments( 1 );
+ pAction = NextAction();
+
+ // skip everything, except gradientex action
+ while( pAction )
{
- int nBeginComments( 1 );
- pAction = NextAction();
+ const MetaActionType nType = pAction->GetType();
- // skip everything, except gradientex action
- while( pAction )
+ if( MetaActionType::GRADIENTEX == nType )
{
- const MetaActionType nType = pAction->GetType();
-
- if( MetaActionType::GRADIENTEX == nType )
+ // Add rotated gradientex
+ MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
+ ImplAddGradientEx( aMtf, *aMapVDev.get(),
+ ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetGradient() );
+ }
+ else if( MetaActionType::COMMENT == nType)
+ {
+ MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pAction);
+ if( pAct->GetComment() == "XGRAD_SEQ_END" )
{
- // Add rotated gradientex
- MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
- ImplAddGradientEx( aMtf, *aMapVDev.get(),
- ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetGradient() );
+ // handle nested blocks
+ --nBeginComments;
+
+ // gradientex comment block: end reached, done.
+ if( !nBeginComments )
+ break;
}
- else if( MetaActionType::COMMENT == nType)
+ else if( pAct->GetComment() == "XGRAD_SEQ_BEGIN" )
{
- MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pAction);
- if( pAct->GetComment() == "XGRAD_SEQ_END" )
- {
- // handle nested blocks
- --nBeginComments;
-
- // gradientex comment block: end reached, done.
- if( !nBeginComments )
- break;
- }
- else if( pAct->GetComment() == "XGRAD_SEQ_BEGIN" )
- {
- // handle nested blocks
- ++nBeginComments;
- }
-
+ // handle nested blocks
+ ++nBeginComments;
}
- pAction =NextAction();
}
+
+ pAction =NextAction();
}
- else
+ }
+ else
+ {
+ bool bPathStroke = (pCommentAct->GetComment() == "XPATHSTROKE_SEQ_BEGIN");
+ if ( bPathStroke || pCommentAct->GetComment() == "XPATHFILL_SEQ_BEGIN" )
{
- bool bPathStroke = (pCommentAct->GetComment() == "XPATHSTROKE_SEQ_BEGIN");
- if ( bPathStroke || pCommentAct->GetComment() == "XPATHFILL_SEQ_BEGIN" )
+ if ( pCommentAct->GetDataSize() )
{
- if ( pCommentAct->GetDataSize() )
+ SvMemoryStream aMemStm( const_cast<sal_uInt8 *>(pCommentAct->GetData()), pCommentAct->GetDataSize(), StreamMode::READ );
+ SvMemoryStream aDest;
+ if ( bPathStroke )
{
- SvMemoryStream aMemStm( const_cast<sal_uInt8 *>(pCommentAct->GetData()), pCommentAct->GetDataSize(), StreamMode::READ );
- SvMemoryStream aDest;
- if ( bPathStroke )
- {
- SvtGraphicStroke aStroke;
- ReadSvtGraphicStroke( aMemStm, aStroke );
- tools::Polygon aPath;
- aStroke.getPath( aPath );
- aStroke.setPath( ImplGetRotatedPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) );
- WriteSvtGraphicStroke( aDest, aStroke );
- aMtf.AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN", 0,
- static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) );
- }
- else
- {
- SvtGraphicFill aFill;
- ReadSvtGraphicFill( aMemStm, aFill );
- tools::PolyPolygon aPath;
- aFill.getPath( aPath );
- aFill.setPath( ImplGetRotatedPolyPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) );
- WriteSvtGraphicFill( aDest, aFill );
- aMtf.AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0,
- static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) );
- }
+ SvtGraphicStroke aStroke;
+ ReadSvtGraphicStroke( aMemStm, aStroke );
+ tools::Polygon aPath;
+ aStroke.getPath( aPath );
+ aStroke.setPath( ImplGetRotatedPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) );
+ WriteSvtGraphicStroke( aDest, aStroke );
+ aMtf.AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN", 0,
+ static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) );
+ }
+ else
+ {
+ SvtGraphicFill aFill;
+ ReadSvtGraphicFill( aMemStm, aFill );
+ tools::PolyPolygon aPath;
+ aFill.getPath( aPath );
+ aFill.setPath( ImplGetRotatedPolyPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) );
+ WriteSvtGraphicFill( aDest, aFill );
+ aMtf.AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0,
+ static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) );
}
- }
- else if ( pCommentAct->GetComment() == "XPATHSTROKE_SEQ_END"
- || pCommentAct->GetComment() == "XPATHFILL_SEQ_END" )
- {
- pAction->Execute( aMapVDev.get() );
- pAction->Duplicate();
- aMtf.AddAction( pAction );
}
}
+ else if ( pCommentAct->GetComment() == "XPATHSTROKE_SEQ_END"
+ || pCommentAct->GetComment() == "XPATHFILL_SEQ_END" )
+ {
+ pAction->Execute( aMapVDev.get() );
+ pAction->Duplicate();
+ aMtf.AddAction( pAction );
+ }
}
- break;
+ }
+ break;
- case MetaActionType::HATCH:
- {
- MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
- Hatch aHatch( pAct->GetHatch() );
+ case MetaActionType::HATCH:
+ {
+ MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
+ Hatch aHatch( pAct->GetHatch() );
- aHatch.SetAngle( aHatch.GetAngle() + (sal_uInt16) nAngle10 );
- aMtf.AddAction( new MetaHatchAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
- aHatch ) );
- }
- break;
+ aHatch.SetAngle( aHatch.GetAngle() + (sal_uInt16) nAngle10 );
+ aMtf.AddAction( new MetaHatchAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
+ aHatch ) );
+ }
+ break;
- case MetaActionType::Transparent:
- {
- MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction);
- aMtf.AddAction( new MetaTransparentAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetTransparence() ) );
- }
- break;
+ case MetaActionType::Transparent:
+ {
+ MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction);
+ aMtf.AddAction( new MetaTransparentAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
+ pAct->GetTransparence() ) );
+ }
+ break;
- case MetaActionType::FLOATTRANSPARENT:
- {
- MetaFloatTransparentAction* pAct = static_cast<MetaFloatTransparentAction*>(pAction);
- GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() );
- tools::Polygon aMtfPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
- tools::Rectangle aMtfRect( aMtfPoly.GetBoundRect() );
-
- aTransMtf.Rotate( nAngle10 );
- aMtf.AddAction( new MetaFloatTransparentAction( aTransMtf, aMtfRect.TopLeft(), aMtfRect.GetSize(),
- pAct->GetGradient() ) );
- }
- break;
+ case MetaActionType::FLOATTRANSPARENT:
+ {
+ MetaFloatTransparentAction* pAct = static_cast<MetaFloatTransparentAction*>(pAction);
+ GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() );
+ tools::Polygon aMtfPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
+ tools::Rectangle aMtfRect( aMtfPoly.GetBoundRect() );
- case MetaActionType::EPS:
- {
- MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
- GDIMetaFile aEPSMtf( pAct->GetSubstitute() );
- tools::Polygon aEPSPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
- tools::Rectangle aEPSRect( aEPSPoly.GetBoundRect() );
-
- aEPSMtf.Rotate( nAngle10 );
- aMtf.AddAction( new MetaEPSAction( aEPSRect.TopLeft(), aEPSRect.GetSize(),
- pAct->GetLink(), aEPSMtf ) );
- }
- break;
+ aTransMtf.Rotate( nAngle10 );
+ aMtf.AddAction( new MetaFloatTransparentAction( aTransMtf, aMtfRect.TopLeft(), aMtfRect.GetSize(),
+ pAct->GetGradient() ) );
+ }
+ break;
- case MetaActionType::CLIPREGION:
- {
- MetaClipRegionAction* pAct = static_cast<MetaClipRegionAction*>(pAction);
+ case MetaActionType::EPS:
+ {
+ MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
+ GDIMetaFile aEPSMtf( pAct->GetSubstitute() );
+ tools::Polygon aEPSPoly( ImplGetRotatedPolygon( tools::Rectangle( pAct->GetPoint(), pAct->GetSize() ), aRotAnchor, aRotOffset, fSin, fCos ) );
+ tools::Rectangle aEPSRect( aEPSPoly.GetBoundRect() );
- if( pAct->IsClipping() && pAct->GetRegion().HasPolyPolygonOrB2DPolyPolygon() )
- aMtf.AddAction( new MetaClipRegionAction( vcl::Region( ImplGetRotatedPolyPolygon( pAct->GetRegion().GetAsPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ), true ) );
- else
- {
- pAction->Duplicate();
- aMtf.AddAction( pAction );
- }
- }
- break;
+ aEPSMtf.Rotate( nAngle10 );
+ aMtf.AddAction( new MetaEPSAction( aEPSRect.TopLeft(), aEPSRect.GetSize(),
+ pAct->GetLink(), aEPSMtf ) );
+ }
+ break;
- case MetaActionType::ISECTRECTCLIPREGION:
+ case MetaActionType::CLIPREGION:
+ {
+ MetaClipRegionAction* pAct = static_cast<MetaClipRegionAction*>(pAction);
+
+ if( pAct->IsClipping() && pAct->GetRegion().HasPolyPolygonOrB2DPolyPolygon() )
+ aMtf.AddAction( new MetaClipRegionAction( vcl::Region( ImplGetRotatedPolyPolygon( pAct->GetRegion().GetAsPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ), true ) );
+ else
{
- MetaISectRectClipRegionAction* pAct = static_cast<MetaISectRectClipRegionAction*>(pAction);
- aMtf.AddAction( new MetaISectRegionClipRegionAction(vcl::Region(
- ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor,
- aRotOffset, fSin, fCos )) ) );
+ pAction->Duplicate();
+ aMtf.AddAction( pAction );
}
- break;
+ }
+ break;
- case MetaActionType::ISECTREGIONCLIPREGION:
- {
- MetaISectRegionClipRegionAction* pAct = static_cast<MetaISectRegionClipRegionAction*>(pAction);
- const vcl::Region& rRegion = pAct->GetRegion();
+ case MetaActionType::ISECTRECTCLIPREGION:
+ {
+ MetaISectRectClipRegionAction* pAct = static_cast<MetaISectRectClipRegionAction*>(pAction);
+ aMtf.AddAction( new MetaISectRegionClipRegionAction(vcl::Region(
+ ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor,
+ aRotOffset, fSin, fCos )) ) );
+ }
+ break;
- if( rRegion.HasPolyPolygonOrB2DPolyPolygon() )
- aMtf.AddAction( new MetaISectRegionClipRegionAction( vcl::Region( ImplGetRotatedPolyPolygon( rRegion.GetAsPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) ) );
- else
- {
- pAction->Duplicate();
- aMtf.AddAction( pAction );
- }
- }
- break;
+ case MetaActionType::ISECTREGIONCLIPREGION:
+ {
+ MetaISectRegionClipRegionAction* pAct = static_cast<MetaISectRegionClipRegionAction*>(pAction);
+ const vcl::Region& rRegion = pAct->GetRegion();
- case MetaActionType::REFPOINT:
+ if( rRegion.HasPolyPolygonOrB2DPolyPolygon() )
+ aMtf.AddAction( new MetaISectRegionClipRegionAction( vcl::Region( ImplGetRotatedPolyPolygon( rRegion.GetAsPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) ) );
+ else
{
- MetaRefPointAction* pAct = static_cast<MetaRefPointAction*>(pAction);
- aMtf.AddAction( new MetaRefPointAction( ImplGetRotatedPoint( pAct->GetRefPoint(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->IsSetting() ) );
+ pAction->Duplicate();
+ aMtf.AddAction( pAction );
}
- break;
+ }
+ break;
- case MetaActionType::FONT:
- {
- MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction);
- vcl::Font aFont( pAct->GetFont() );
+ case MetaActionType::REFPOINT:
+ {
+ MetaRefPointAction* pAct = static_cast<MetaRefPointAction*>(pAction);
+ aMtf.AddAction( new MetaRefPointAction( ImplGetRotatedPoint( pAct->GetRefPoint(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->IsSetting() ) );
+ }
+ break;
- aFont.SetOrientation( aFont.GetOrientation() + (sal_uInt16) nAngle10 );
- aMtf.AddAction( new MetaFontAction( aFont ) );
- }
- break;
+ case MetaActionType::FONT:
+ {
+ MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction);
+ vcl::Font aFont( pAct->GetFont() );
- case MetaActionType::BMP:
- case MetaActionType::BMPEX:
- case MetaActionType::MASK:
- case MetaActionType::MASKSCALE:
- case MetaActionType::MASKSCALEPART:
- case MetaActionType::WALLPAPER:
- case MetaActionType::TEXTRECT:
- case MetaActionType::MOVECLIPREGION:
- {
- OSL_FAIL( "GDIMetaFile::Rotate(): unsupported action" );
- }
- break;
+ aFont.SetOrientation( aFont.GetOrientation() + (sal_uInt16) nAngle10 );
+ aMtf.AddAction( new MetaFontAction( aFont ) );
+ }
+ break;
- default:
- {
- pAction->Execute( aMapVDev.get() );
- pAction->Duplicate();
- aMtf.AddAction( pAction );
+ case MetaActionType::BMP:
+ case MetaActionType::BMPEX:
+ case MetaActionType::MASK:
+ case MetaActionType::MASKSCALE:
+ case MetaActionType::MASKSCALEPART:
+ case MetaActionType::WALLPAPER:
+ case MetaActionType::TEXTRECT:
+ case MetaActionType::MOVECLIPREGION:
+ {
+ OSL_FAIL( "GDIMetaFile::Rotate(): unsupported action" );
+ }
+ break;
- // update rotation point and offset, if necessary
- if( ( MetaActionType::MAPMODE == nActionType ) ||
- ( MetaActionType::PUSH == nActionType ) ||
- ( MetaActionType::POP == nActionType ) )
- {
- aRotAnchor = OutputDevice::LogicToLogic( aOrigin, m_aPrefMapMode, aMapVDev->GetMapMode() );
- aRotOffset = OutputDevice::LogicToLogic( aOffset, m_aPrefMapMode, aMapVDev->GetMapMode() );
- }
+ default:
+ {
+ pAction->Execute( aMapVDev.get() );
+ pAction->Duplicate();
+ aMtf.AddAction( pAction );
+
+ // update rotation point and offset, if necessary
+ if( ( MetaActionType::MAPMODE == nActionType ) ||
+ ( MetaActionType::PUSH == nActionType ) ||
+ ( MetaActionType::POP == nActionType ) )
+ {
+ aRotAnchor = OutputDevice::LogicToLogic( aOrigin, m_aPrefMapMode, aMapVDev->GetMapMode() );
+ aRotOffset = OutputDevice::LogicToLogic( aOffset, m_aPrefMapMode, aMapVDev->GetMapMode() );
}
- break;
}
+ break;
}
+ }
- aMtf.m_aPrefMapMode = m_aPrefMapMode;
- aMtf.m_aPrefSize = aNewBound.GetSize();
+ aMtf.m_aPrefMapMode = m_aPrefMapMode;
+ aMtf.m_aPrefSize = aNewBound.GetSize();
+
+ *this = aMtf;
- *this = aMtf;
- }
}
static void ImplActionBounds( tools::Rectangle& o_rOutBounds,
@@ -2107,84 +2109,85 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
short nChannelBPercent, double fGamma, bool bInvert, bool msoBrightness )
{
// nothing to do? => return quickly
- if( nLuminancePercent || nContrastPercent ||
- nChannelRPercent || nChannelGPercent || nChannelBPercent ||
- ( fGamma != 1.0 ) || bInvert )
- {
- double fM, fROff, fGOff, fBOff, fOff;
- ImplColAdjustParam aColParam;
- ImplBmpAdjustParam aBmpParam;
+ if( !(nLuminancePercent || nContrastPercent ||
+ nChannelRPercent || nChannelGPercent || nChannelBPercent ||
+ ( fGamma != 1.0 ) || bInvert) )
+ return;
+
+ double fM, fROff, fGOff, fBOff, fOff;
+ ImplColAdjustParam aColParam;
+ ImplBmpAdjustParam aBmpParam;
+
+ aColParam.pMapR = new sal_uInt8[ 256 ];
+ aColParam.pMapG = new sal_uInt8[ 256 ];
+ aColParam.pMapB = new sal_uInt8[ 256 ];
+
+ // calculate slope
+ if( nContrastPercent >= 0 )
+ fM = 128.0 / ( 128.0 - 1.27 * MinMax( nContrastPercent, 0, 100 ) );
+ else
+ fM = ( 128.0 + 1.27 * MinMax( nContrastPercent, -100, 0 ) ) / 128.0;
- aColParam.pMapR = new sal_uInt8[ 256 ];
- aColParam.pMapG = new sal_uInt8[ 256 ];
- aColParam.pMapB = new sal_uInt8[ 256 ];
+ if(!msoBrightness)
+ // total offset = luminance offset + contrast offset
+ fOff = MinMax( nLuminancePercent, -100, 100 ) * 2.55 + 128.0 - fM * 128.0;
+ else
+ fOff = MinMax( nLuminancePercent, -100, 100 ) * 2.55;
- // calculate slope
- if( nContrastPercent >= 0 )
- fM = 128.0 / ( 128.0 - 1.27 * MinMax( nContrastPercent, 0, 100 ) );
- else
- fM = ( 128.0 + 1.27 * MinMax( nContrastPercent, -100, 0 ) ) / 128.0;
+ // channel offset = channel offset + total offset
+ fROff = nChannelRPercent * 2.55 + fOff;
+ fGOff = nChannelGPercent * 2.55 + fOff;
+ fBOff = nChannelBPercent * 2.55 + fOff;
+ // calculate gamma value
+ fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
+ const bool bGamma = ( fGamma != 1.0 );
+
+ // create mapping table
+ for( long nX = 0; nX < 256; nX++ )
+ {
if(!msoBrightness)
- // total offset = luminance offset + contrast offset
- fOff = MinMax( nLuminancePercent, -100, 100 ) * 2.55 + 128.0 - fM * 128.0;
+ {
+ aColParam.pMapR[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fROff ), 0, 255 );
+ aColParam.pMapG[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fGOff ), 0, 255 );
+ aColParam.pMapB[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fBOff ), 0, 255 );
+ }
else
- fOff = MinMax( nLuminancePercent, -100, 100 ) * 2.55;
-
- // channel offset = channel offset + total offset
- fROff = nChannelRPercent * 2.55 + fOff;
- fGOff = nChannelGPercent * 2.55 + fOff;
- fBOff = nChannelBPercent * 2.55 + fOff;
-
- // calculate gamma value
- fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
- const bool bGamma = ( fGamma != 1.0 );
-
- // create mapping table
- for( long nX = 0; nX < 256; nX++ )
{
- if(!msoBrightness)
- {
- aColParam.pMapR[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fROff ), 0, 255 );
- aColParam.pMapG[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fGOff ), 0, 255 );
- aColParam.pMapB[ nX ] = (sal_uInt8) MinMax( FRound( nX * fM + fBOff ), 0, 255 );
- }
- else
- {
- aColParam.pMapR[ nX ] = (sal_uInt8) MinMax( FRound( (nX+fROff/2-128) * fM + 128 + fROff/2 ), 0, 255 );
- aColParam.pMapG[ nX ] = (sal_uInt8) MinMax( FRound( (nX+fGOff/2-128) * fM + 128 + fGOff/2 ), 0, 255 );
- aColParam.pMapB[ nX ] = (sal_uInt8) MinMax( FRound( (nX+fBOff/2-128) * fM + 128 + fBOff/2 ), 0, 255 );
- }
- if( bGamma )
- {
- aColParam.pMapR[ nX ] = GAMMA( aColParam.pMapR[ nX ], fGamma );
- aColParam.pMapG[ nX ] = GAMMA( aColParam.pMapG[ nX ], fGamma );
- aColParam.pMapB[ nX ] = GAMMA( aColParam.pMapB[ nX ], fGamma );
- }
+ aColParam.pMapR[ nX ] = (sal_uInt8) MinMax( FRound( (nX+fROff/2-128) * fM + 128 + fROff/2 ), 0, 255 );
+ aColParam.pMapG[ nX ] = (sal_uInt8) MinMax( FRound( (nX+fGOff/2-128) * fM + 128 + fGOff/2 ), 0, 255 );
+ aColParam.pMapB[ nX ] = (sal_uInt8) MinMax( FRound( (nX+fBOff/2-128) * fM + 128 + fBOff/2 ), 0, 255 );
+ }
+ if( bGamma )
+ {
+ aColParam.pMapR[ nX ] = GAMMA( aColParam.pMapR[ nX ], fGamma );
+ aColParam.pMapG[ nX ] = GAMMA( aColParam.pMapG[ nX ], fGamma );
+ aColParam.pMapB[ nX ] = GAMMA( aColParam.pMapB[ nX ], fGamma );
+ }
- if( bInvert )
- {
- aColParam.pMapR[ nX ] = ~aColParam.pMapR[ nX ];
- aColParam.pMapG[ nX ] = ~aColParam.pMapG[ nX ];
- aColParam.pMapB[ nX ] = ~aColParam.pMapB[ nX ];
- }
+ if( bInvert )
+ {
+ aColParam.pMapR[ nX ] = ~aColParam.pMapR[ nX ];
+ aColParam.pMapG[ nX ] = ~aColParam.pMapG[ nX ];
+ aColParam.pMapB[ nX ] = ~aColParam.pMapB[ nX ];
}
+ }
- aBmpParam.nLuminancePercent = nLuminancePercent;
- aBmpParam.nContrastPercent = nContrastPercent;
- aBmpParam.nChannelRPercent = nChannelRPercent;
- aBmpParam.nChannelGPercent = nChannelGPercent;
- aBmpParam.nChannelBPercent = nChannelBPercent;
- aBmpParam.fGamma = fGamma;
- aBmpParam.bInvert = bInvert;
+ aBmpParam.nLuminancePercent = nLuminancePercent;
+ aBmpParam.nContrastPercent = nContrastPercent;
+ aBmpParam.nChannelRPercent = nChannelRPercent;
+ aBmpParam.nChannelGPercent = nChannelGPercent;
+ aBmpParam.nChannelBPercent = nChannelBPercent;
+ aBmpParam.fGamma = fGamma;
+ aBmpParam.bInvert = bInvert;
- // do color adjustment
- ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam );
+ // do color adjustment
+ ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam );
+
+ delete[] aColParam.pMapR;
+ delete[] aColParam.pMapG;
+ delete[] aColParam.pMapB;
- delete[] aColParam.pMapR;
- delete[] aColParam.pMapG;
- delete[] aColParam.pMapB;
- }
}
void GDIMetaFile::Convert( MtfConversion eConversion )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 33ea6b0f194e..2fdd577f2e9b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2254,64 +2254,65 @@ void PDFWriterImpl::newPage( double nPageWidth, double nPageHeight, PDFWriter::O
void PDFWriterImpl::endPage()
{
- if( !m_aPages.empty() )
- {
- // close eventual MC sequence
- endStructureElementMCSeq();
+ if( m_aPages.empty() )
+ return;
- // sanity check
- if( !m_aOutputStreams.empty() )
- {
- OSL_FAIL( "redirection across pages !!!" );
- m_aOutputStreams.clear(); // leak !
- m_aMapMode.SetOrigin( Point() );
- }
+ // close eventual MC sequence
+ endStructureElementMCSeq();
- m_aGraphicsStack.clear();
- m_aGraphicsStack.emplace_back( );
+ // sanity check
+ if( !m_aOutputStreams.empty() )
+ {
+ OSL_FAIL( "redirection across pages !!!" );
+ m_aOutputStreams.clear(); // leak !
+ m_aMapMode.SetOrigin( Point() );
+ }
- // this should pop the PDF graphics stack if necessary
- updateGraphicsState();
+ m_aGraphicsStack.clear();
+ m_aGraphicsStack.emplace_back( );
- m_aPages.back().endStream();
+ // this should pop the PDF graphics stack if necessary
+ updateGraphicsState();
- // reset the default font
- Font aFont;
- aFont.SetFamilyName( "Times" );
- aFont.SetFontSize( Size( 0, 12 ) );
+ m_aPages.back().endStream();
- m_aCurrentPDFState = m_aGraphicsStack.front();
- m_aGraphicsStack.front().m_aFont = aFont;
+ // reset the default font
+ Font aFont;
+ aFont.SetFamilyName( "Times" );
+ aFont.SetFontSize( Size( 0, 12 ) );
- for( std::list<BitmapEmit>::iterator it = m_aBitmaps.begin();
- it != m_aBitmaps.end(); ++it )
+ m_aCurrentPDFState = m_aGraphicsStack.front();
+ m_aGraphicsStack.front().m_aFont = aFont;
+
+ for( std::list<BitmapEmit>::iterator it = m_aBitmaps.begin();
+ it != m_aBitmaps.end(); ++it )
+ {
+ if( ! it->m_aBitmap.IsEmpty() )
{
- if( ! it->m_aBitmap.IsEmpty() )
- {
- writeBitmapObject( *it );
- it->m_aBitmap = BitmapEx();
- }
+ writeBitmapObject( *it );
+ it->m_aBitmap = BitmapEx();
}
- for( std::list<JPGEmit>::iterator jpeg = m_aJPGs.begin(); jpeg != m_aJPGs.end(); ++jpeg )
+ }
+ for( std::list<JPGEmit>::iterator jpeg = m_aJPGs.begin(); jpeg != m_aJPGs.end(); ++jpeg )
+ {
+ if( jpeg->m_pStream )
{
- if( jpeg->m_pStream )
- {
- writeJPG( *jpeg );
- jpeg->m_pStream.reset();
- jpeg->m_aMask = Bitmap();
- }
+ writeJPG( *jpeg );
+ jpeg->m_pStream.reset();
+ jpeg->m_aMask = Bitmap();
}
- for( std::list<TransparencyEmit>::iterator t = m_aTransparentObjects.begin();
- t != m_aTransparentObjects.end(); ++t )
+ }
+ for( std::list<TransparencyEmit>::iterator t = m_aTransparentObjects.begin();
+ t != m_aTransparentObjects.end(); ++t )
+ {
+ if( t->m_pContentStream )
{
- if( t->m_pContentStream )
- {
- writeTransparentObject( *t );
- delete t->m_pContentStream;
- t->m_pContentStream = nullptr;
- }
+ writeTransparentObject( *t );
+ delete t->m_pContentStream;
+ t->m_pContentStream = nullptr;
}
}
+
}
sal_Int32 PDFWriterImpl::createObject()
@@ -6909,87 +6910,88 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
// write eventual emphasis marks
- if( m_aCurrentPDFState.m_aFont.GetEmphasisMark() & FontEmphasisMark::Style )
- {
- tools::PolyPolygon aEmphPoly;
- tools::Rectangle aEmphRect1;
- tools::Rectangle aEmphRect2;
- long nEmphYOff;
- long nEmphWidth;
- long nEmphHeight;
- bool bEmphPolyLine;
- FontEmphasisMark nEmphMark;
+ if( !(m_aCurrentPDFState.m_aFont.GetEmphasisMark() & FontEmphasisMark::Style) )
+ return;
- push( PushFlags::ALL );
+ tools::PolyPolygon aEmphPoly;
+ tools::Rectangle aEmphRect1;
+ tools::Rectangle aEmphRect2;
+ long nEmphYOff;
+ long nEmphWidth;
+ long nEmphHeight;
+ bool bEmphPolyLine;
+ FontEmphasisMark nEmphMark;
- aLine.setLength( 0 );
- aLine.append( "q\n" );
+ push( PushFlags::ALL );
- nEmphMark = OutputDevice::ImplGetEmphasisMarkStyle( m_aCurrentPDFState.m_aFont );
- if ( nEmphMark & FontEmphasisMark::PosBelow )
- nEmphHeight = m_pReferenceDevice->mnEmphasisDescent;
- else
- nEmphHeight = m_pReferenceDevice->mnEmphasisAscent;
- m_pReferenceDevice->ImplGetEmphasisMark( aEmphPoly,
- bEmphPolyLine,
- aEmphRect1,
- aEmphRect2,
- nEmphYOff,
- nEmphWidth,
- nEmphMark,
- m_pReferenceDevice->ImplDevicePixelToLogicWidth(nEmphHeight) );
- if ( bEmphPolyLine )
- {
- setLineColor( m_aCurrentPDFState.m_aFont.GetColor() );
- setFillColor( Color( COL_TRANSPARENT ) );
- }
- else
- {
- setFillColor( m_aCurrentPDFState.m_aFont.GetColor() );
- setLineColor( Color( COL_TRANSPARENT ) );
- }
- writeBuffer( aLine.getStr(), aLine.getLength() );
+ aLine.setLength( 0 );
+ aLine.append( "q\n" );
- Point aOffset = Point(0,0);
+ nEmphMark = OutputDevice::ImplGetEmphasisMarkStyle( m_aCurrentPDFState.m_aFont );
+ if ( nEmphMark & FontEmphasisMark::PosBelow )
+ nEmphHeight = m_pReferenceDevice->mnEmphasisDescent;
+ else
+ nEmphHeight = m_pReferenceDevice->mnEmphasisAscent;
+ m_pReferenceDevice->ImplGetEmphasisMark( aEmphPoly,
+ bEmphPolyLine,
+ aEmphRect1,
+ aEmphRect2,
+ nEmphYOff,
+ nEmphWidth,
+ nEmphMark,
+ m_pReferenceDevice->ImplDevicePixelToLogicWidth(nEmphHeight) );
+ if ( bEmphPolyLine )
+ {
+ setLineColor( m_aCurrentPDFState.m_aFont.GetColor() );
+ setFillColor( Color( COL_TRANSPARENT ) );
+ }
+ else
+ {
+ setFillColor( m_aCurrentPDFState.m_aFont.GetColor() );
+ setLineColor( Color( COL_TRANSPARENT ) );
+ }
+ writeBuffer( aLine.getStr(), aLine.getLength() );
- if ( nEmphMark & FontEmphasisMark::PosBelow )
- aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent() + nEmphYOff;
- else
- aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent() + nEmphYOff;
+ Point aOffset = Point(0,0);
- long nEmphWidth2 = nEmphWidth / 2;
- long nEmphHeight2 = nEmphHeight / 2;
- aOffset += Point( nEmphWidth2, nEmphHeight2 );
+ if ( nEmphMark & FontEmphasisMark::PosBelow )
+ aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent() + nEmphYOff;
+ else
+ aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent() + nEmphYOff;
+
+ long nEmphWidth2 = nEmphWidth / 2;
+ long nEmphHeight2 = nEmphHeight / 2;
+ aOffset += Point( nEmphWidth2, nEmphHeight2 );
- if ( eAlign == ALIGN_BOTTOM )
- aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent();
- else if ( eAlign == ALIGN_TOP )
- aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent();
+ if ( eAlign == ALIGN_BOTTOM )
+ aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent();
+ else if ( eAlign == ALIGN_TOP )
+ aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent();
- Point aPos;
- const GlyphItem* pGlyph;
- int nStart = 0;
- while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
+ Point aPos;
+ const GlyphItem* pGlyph;
+ int nStart = 0;
+ while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
+ {
+ if (pGlyph->IsSpacing())
{
- if (pGlyph->IsSpacing())
- {
- Point aAdjOffset = aOffset;
- aAdjOffset.X() += (pGlyph->mnNewWidth - nEmphWidth) / 2;
- aAdjOffset = aRotScale.transform( aAdjOffset );
+ Point aAdjOffset = aOffset;
+ aAdjOffset.X() += (pGlyph->mnNewWidth - nEmphWidth) / 2;
+ aAdjOffset = aRotScale.transform( aAdjOffset );
- aAdjOffset -= Point( nEmphWidth2, nEmphHeight2 );
+ aAdjOffset -= Point( nEmphWidth2, nEmphHeight2 );
- aPos += aAdjOffset;
- aPos = m_pReferenceDevice->PixelToLogic( aPos );
- drawEmphasisMark( aPos.X(), aPos.Y(),
- aEmphPoly, bEmphPolyLine,
- aEmphRect1, aEmphRect2 );
- }
+ aPos += aAdjOffset;
+ aPos = m_pReferenceDevice->PixelToLogic( aPos );
+ drawEmphasisMark( aPos.X(), aPos.Y(),
+ aEmphPoly, bEmphPolyLine,
+ aEmphRect1, aEmphRect2 );
}
-
- writeBuffer( "Q\n", 2 );
- pop();
}
+
+ writeBuffer( "Q\n", 2 );
+ pop();
+
}
void PDFWriterImpl::drawEmphasisMark( long nX, long nY,
@@ -7412,96 +7414,97 @@ void PDFWriterImpl::drawStraightTextLine( OStringBuffer& aLine, long nWidth, Fon
break;
}
- if ( nLineHeight )
+ if ( !nLineHeight )
+ return;
+
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine );
+ aLine.append( " w " );
+ appendStrokingColor( aColor, aLine );
+ aLine.append( "\n" );
+
+ switch ( eTextLine )
{
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine );
- aLine.append( " w " );
- appendStrokingColor( aColor, aLine );
- aLine.append( "\n" );
+ case LINESTYLE_DOTTED:
+ case LINESTYLE_BOLDDOTTED:
+ aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( " ] 0 d\n" );
+ break;
+ case LINESTYLE_DASH:
+ case LINESTYLE_LONGDASH:
+ case LINESTYLE_BOLDDASH:
+ case LINESTYLE_BOLDLONGDASH:
+ {
+ sal_Int32 nDashLength = 4*nLineHeight;
+ sal_Int32 nVoidLength = 2*nLineHeight;
+ if ( ( eTextLine == LINESTYLE_LONGDASH ) || ( eTextLine == LINESTYLE_BOLDLONGDASH ) )
+ nDashLength = 8*nLineHeight;
- switch ( eTextLine )
- {
- case LINESTYLE_DOTTED:
- case LINESTYLE_BOLDDOTTED:
aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( nDashLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( " ] 0 d\n" );
+ }
+ break;
+ case LINESTYLE_DASHDOT:
+ case LINESTYLE_BOLDDASHDOT:
+ {
+ sal_Int32 nDashLength = 4*nLineHeight;
+ sal_Int32 nVoidLength = 2*nLineHeight;
+ aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( nDashLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( ' ' );
m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
aLine.append( " ] 0 d\n" );
- break;
- case LINESTYLE_DASH:
- case LINESTYLE_LONGDASH:
- case LINESTYLE_BOLDDASH:
- case LINESTYLE_BOLDLONGDASH:
- {
- sal_Int32 nDashLength = 4*nLineHeight;
- sal_Int32 nVoidLength = 2*nLineHeight;
- if ( ( eTextLine == LINESTYLE_LONGDASH ) || ( eTextLine == LINESTYLE_BOLDLONGDASH ) )
- nDashLength = 8*nLineHeight;
-
- aLine.append( "[ " );
- m_aPages.back().appendMappedLength( nDashLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( " ] 0 d\n" );
- }
- break;
- case LINESTYLE_DASHDOT:
- case LINESTYLE_BOLDDASHDOT:
- {
- sal_Int32 nDashLength = 4*nLineHeight;
- sal_Int32 nVoidLength = 2*nLineHeight;
- aLine.append( "[ " );
- m_aPages.back().appendMappedLength( nDashLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( " ] 0 d\n" );
- }
- break;
- case LINESTYLE_DASHDOTDOT:
- case LINESTYLE_BOLDDASHDOTDOT:
- {
- sal_Int32 nDashLength = 4*nLineHeight;
- sal_Int32 nVoidLength = 2*nLineHeight;
- aLine.append( "[ " );
- m_aPages.back().appendMappedLength( nDashLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( " ] 0 d\n" );
- }
- break;
- default:
- break;
- }
+ }
+ break;
+ case LINESTYLE_DASHDOTDOT:
+ case LINESTYLE_BOLDDASHDOTDOT:
+ {
+ sal_Int32 nDashLength = 4*nLineHeight;
+ sal_Int32 nVoidLength = 2*nLineHeight;
+ aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( nDashLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( " ] 0 d\n" );
+ }
+ break;
+ default:
+ break;
+ }
+ aLine.append( "0 " );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ aLine.append( " m " );
+ m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ aLine.append( " l S\n" );
+ if ( eTextLine == LINESTYLE_DOUBLE )
+ {
aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
aLine.append( " m " );
m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false );
aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
aLine.append( " l S\n" );
- if ( eTextLine == LINESTYLE_DOUBLE )
- {
- aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
- aLine.append( " m " );
- m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
- aLine.append( " l S\n" );
- }
}
+
}
void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor )
@@ -7540,32 +7543,33 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt
break;
}
- if ( nLineHeight )
- {
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine );
- aLine.append( " w " );
- appendStrokingColor( aColor, aLine );
- aLine.append( "\n" );
+ if ( !nLineHeight )
+ return;
+
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine );
+ aLine.append( " w " );
+ appendStrokingColor( aColor, aLine );
+ aLine.append( "\n" );
+
+ aLine.append( "0 " );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ aLine.append( " m " );
+ m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ aLine.append( " l S\n" );
+ if ( eStrikeout == STRIKEOUT_DOUBLE )
+ {
aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
aLine.append( " m " );
m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine );
aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
aLine.append( " l S\n" );
-
- if ( eStrikeout == STRIKEOUT_DOUBLE )
- {
- aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
- aLine.append( " m " );
- m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine );
- aLine.append( " l S\n" );
- }
}
+
}
void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout )
@@ -7925,39 +7929,40 @@ void PDFWriterImpl::endTransparencyGroup( const tools::Rectangle& rBoundingBox,
SAL_WARN_IF( nTransparentPercent > 100, "vcl.pdfwriter", "invalid alpha value" );
nTransparentPercent = nTransparentPercent % 100;
- if( m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4 )
- {
- // create XObject
- m_aTransparentObjects.emplace_back( );
- m_aTransparentObjects.back().m_aBoundRect = rBoundingBox;
- // convert rectangle to default user space
- m_aPages.back().convertRect( m_aTransparentObjects.back().m_aBoundRect );
- m_aTransparentObjects.back().m_nObject = createObject();
- m_aTransparentObjects.back().m_fAlpha = (double)(100-nTransparentPercent) / 100.0;
- // get XObject's content stream
- m_aTransparentObjects.back().m_pContentStream = static_cast<SvMemoryStream*>(endRedirect());
- m_aTransparentObjects.back().m_nExtGStateObject = createObject();
-
- OStringBuffer aObjName( 16 );
- aObjName.append( "Tr" );
- aObjName.append( m_aTransparentObjects.back().m_nObject );
- OString aTrName( aObjName.makeStringAndClear() );
- aObjName.append( "EGS" );
- aObjName.append( m_aTransparentObjects.back().m_nExtGStateObject );
- OString aExtName( aObjName.makeStringAndClear() );
-
- OStringBuffer aLine( 80 );
- // insert XObject
- aLine.append( "q /" );
- aLine.append( aExtName );
- aLine.append( " gs /" );
- aLine.append( aTrName );
- aLine.append( " Do Q\n" );
- writeBuffer( aLine.getStr(), aLine.getLength() );
+ if( !(m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4) )
+ return;
+
+ // create XObject
+ m_aTransparentObjects.emplace_back( );
+ m_aTransparentObjects.back().m_aBoundRect = rBoundingBox;
+ // convert rectangle to default user space
+ m_aPages.back().convertRect( m_aTransparentObjects.back().m_aBoundRect );
+ m_aTransparentObjects.back().m_nObject = createObject();
+ m_aTransparentObjects.back().m_fAlpha = (double)(100-nTransparentPercent) / 100.0;
+ // get XObject's content stream
+ m_aTransparentObjects.back().m_pContentStream = static_cast<SvMemoryStream*>(endRedirect());
+ m_aTransparentObjects.back().m_nExtGStateObject = createObject();
+
+ OStringBuffer aObjName( 16 );
+ aObjName.append( "Tr" );
+ aObjName.append( m_aTransparentObjects.back().m_nObject );
+ OString aTrName( aObjName.makeStringAndClear() );
+ aObjName.append( "EGS" );
+ aObjName.append( m_aTransparentObjects.back().m_nExtGStateObject );
+ OString aExtName( aObjName.makeStringAndClear() );
+
+ OStringBuffer aLine( 80 );
+ // insert XObject
+ aLine.append( "q /" );
+ aLine.append( aExtName );
+ aLine.append( " gs /" );
+ aLine.append( aTrName );
+ aLine.append( " Do Q\n" );
+ writeBuffer( aLine.getStr(), aLine.getLength() );
+
+ pushResource( ResXObject, aTrName, m_aTransparentObjects.back().m_nObject );
+ pushResource( ResExtGState, aExtName, m_aTransparentObjects.back().m_nExtGStateObject );
- pushResource( ResXObject, aTrName, m_aTransparentObjects.back().m_nObject );
- pushResource( ResExtGState, aExtName, m_aTransparentObjects.back().m_nExtGStateObject );
- }
}
void PDFWriterImpl::drawRectangle( const tools::Rectangle& rRect )
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index dc47a65b6554..18ff07afc556 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -68,186 +68,187 @@ void PDFWriterImpl::implWriteGradient( const tools::PolyPolygon& i_rPolyPoly, co
void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx, const Graphic& i_Graphic,
VirtualDevice const * i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext )
{
- if ( !i_rBitmapEx.IsEmpty() && i_rSize.Width() && i_rSize.Height() )
+ if ( i_rBitmapEx.IsEmpty() || !i_rSize.Width() || !i_rSize.Height() )
+ return;
+
+ BitmapEx aBitmapEx( i_rBitmapEx );
+ Point aPoint( i_rPoint );
+ Size aSize( i_rSize );
+
+ // #i19065# Negative sizes have mirror semantics on
+ // OutputDevice. BitmapEx and co. have no idea about that, so
+ // perform that _before_ doing anything with aBitmapEx.
+ BmpMirrorFlags nMirrorFlags(BmpMirrorFlags::NONE);
+ if( aSize.Width() < 0 )
{
- BitmapEx aBitmapEx( i_rBitmapEx );
- Point aPoint( i_rPoint );
- Size aSize( i_rSize );
-
- // #i19065# Negative sizes have mirror semantics on
- // OutputDevice. BitmapEx and co. have no idea about that, so
- // perform that _before_ doing anything with aBitmapEx.
- BmpMirrorFlags nMirrorFlags(BmpMirrorFlags::NONE);
- if( aSize.Width() < 0 )
- {
- aSize.Width() *= -1;
- aPoint.X() -= aSize.Width();
- nMirrorFlags |= BmpMirrorFlags::Horizontal;
- }
- if( aSize.Height() < 0 )
- {
- aSize.Height() *= -1;
- aPoint.Y() -= aSize.Height();
- nMirrorFlags |= BmpMirrorFlags::Vertical;
- }
+ aSize.Width() *= -1;
+ aPoint.X() -= aSize.Width();
+ nMirrorFlags |= BmpMirrorFlags::Horizontal;
+ }
+ if( aSize.Height() < 0 )
+ {
+ aSize.Height() *= -1;
+ aPoint.Y() -= aSize.Height();
+ nMirrorFlags |= BmpMirrorFlags::Vertical;
+ }
- if( nMirrorFlags != BmpMirrorFlags::NONE )
- {
- aBitmapEx.Mirror( nMirrorFlags );
- }
+ if( nMirrorFlags != BmpMirrorFlags::NONE )
+ {
+ aBitmapEx.Mirror( nMirrorFlags );
+ }
- bool bIsJpeg = false, bIsPng = false;
- if( i_Graphic.GetType() != GraphicType::NONE && i_Graphic.GetBitmapEx() == aBitmapEx )
- {
- GfxLinkType eType = i_Graphic.GetLink().GetType();
- bIsJpeg = (eType == GfxLinkType::NativeJpg);
- bIsPng = (eType == GfxLinkType::NativePng);
- }
+ bool bIsJpeg = false, bIsPng = false;
+ if( i_Graphic.GetType() != GraphicType::NONE && i_Graphic.GetBitmapEx() == aBitmapEx )
+ {
+ GfxLinkType eType = i_Graphic.GetLink().GetType();
+ bIsJpeg = (eType == GfxLinkType::NativeJpg);
+ bIsPng = (eType == GfxLinkType::NativePng);
+ }
- if( i_rContext.m_nMaxImageResolution > 50 )
+ if( i_rContext.m_nMaxImageResolution > 50 )
+ {
+ // do downsampling if necessary
+ const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic(i_pDummyVDev->LogicToPixel(aSize), MapMode(MapUnit::MapTwip)) );
+ const Size aBmpSize( aBitmapEx.GetSizePixel() );
+ const double fBmpPixelX = aBmpSize.Width();
+ const double fBmpPixelY = aBmpSize.Height();
+ const double fMaxPixelX = aDstSizeTwip.Width() * i_rContext.m_nMaxImageResolution / 1440.0;
+ const double fMaxPixelY = aDstSizeTwip.Height() * i_rContext.m_nMaxImageResolution / 1440.0;
+
+ // check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance)
+ if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) ||
+ ( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) &&
+ ( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) )
{
- // do downsampling if necessary
- const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic(i_pDummyVDev->LogicToPixel(aSize), MapMode(MapUnit::MapTwip)) );
- const Size aBmpSize( aBitmapEx.GetSizePixel() );
- const double fBmpPixelX = aBmpSize.Width();
- const double fBmpPixelY = aBmpSize.Height();
- const double fMaxPixelX = aDstSizeTwip.Width() * i_rContext.m_nMaxImageResolution / 1440.0;
- const double fMaxPixelY = aDstSizeTwip.Height() * i_rContext.m_nMaxImageResolution / 1440.0;
-
- // check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance)
- if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) ||
- ( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) &&
- ( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) )
- {
- // do scaling
- Size aNewBmpSize;
- const double fBmpWH = fBmpPixelX / fBmpPixelY;
- const double fMaxWH = fMaxPixelX / fMaxPixelY;
+ // do scaling
+ Size aNewBmpSize;
+ const double fBmpWH = fBmpPixelX / fBmpPixelY;
+ const double fMaxWH = fMaxPixelX / fMaxPixelY;
- if( fBmpWH < fMaxWH )
- {
- aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH );
- aNewBmpSize.Height() = FRound( fMaxPixelY );
- }
- else if( fBmpWH > 0.0 )
- {
- aNewBmpSize.Width() = FRound( fMaxPixelX );
- aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH);
- }
+ if( fBmpWH < fMaxWH )
+ {
+ aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH );
+ aNewBmpSize.Height() = FRound( fMaxPixelY );
+ }
+ else if( fBmpWH > 0.0 )
+ {
+ aNewBmpSize.Width() = FRound( fMaxPixelX );
+ aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH);
+ }
- if( aNewBmpSize.Width() && aNewBmpSize.Height() )
- {
- // #i121233# Use best quality for PDF exports
- aBitmapEx.Scale( aNewBmpSize, BmpScaleFlag::BestQuality );
- }
- else
- {
- aBitmapEx.SetEmpty();
- }
+ if( aNewBmpSize.Width() && aNewBmpSize.Height() )
+ {
+ // #i121233# Use best quality for PDF exports
+ aBitmapEx.Scale( aNewBmpSize, BmpScaleFlag::BestQuality );
+ }
+ else
+ {
+ aBitmapEx.SetEmpty();
}
}
+ }
- const Size aSizePixel( aBitmapEx.GetSizePixel() );
- if ( aSizePixel.Width() && aSizePixel.Height() )
+ const Size aSizePixel( aBitmapEx.GetSizePixel() );
+ if ( aSizePixel.Width() && aSizePixel.Height() )
+ {
+ if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
{
- if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
+ BmpConversion eConv = BmpConversion::N8BitGreys;
+ int nDepth = aBitmapEx.GetBitmap().GetBitCount();
+ if( nDepth <= 4 )
+ eConv = BmpConversion::N4BitGreys;
+ if( nDepth > 1 )
+ aBitmapEx.Convert( eConv );
+ }
+ bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
+ if ( bIsPng || ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
+ bUseJPGCompression = false;
+
+ SvMemoryStream aStrm;
+ Bitmap aMask;
+
+ bool bTrueColorJPG = true;
+ if ( bUseJPGCompression )
+ {
+
+ sal_uInt32 nZippedFileSize = 0; // sj: we will calculate the filesize of a zipped bitmap
+ if ( !bIsJpeg ) // to determine if jpeg compression is useful
{
- BmpConversion eConv = BmpConversion::N8BitGreys;
- int nDepth = aBitmapEx.GetBitmap().GetBitCount();
- if( nDepth <= 4 )
- eConv = BmpConversion::N4BitGreys;
- if( nDepth > 1 )
- aBitmapEx.Convert( eConv );
+ SvMemoryStream aTemp;
+ aTemp.SetCompressMode( aTemp.GetCompressMode() | SvStreamCompressFlags::ZBITMAP );
+ aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
+ WriteDIBBitmapEx(aBitmapEx, aTemp); // is capable of zlib stream compression
+ aTemp.Seek( STREAM_SEEK_TO_END );
+ nZippedFileSize = aTemp.Tell();
}
- bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
- if ( bIsPng || ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
- bUseJPGCompression = false;
+ if ( aBitmapEx.IsTransparent() )
+ {
+ if ( aBitmapEx.IsAlpha() )
+ aMask = aBitmapEx.GetAlpha().GetBitmap();
+ else
+ aMask = aBitmapEx.GetMask();
+ }
+ Graphic aGraphic( aBitmapEx.GetBitmap() );
- SvMemoryStream aStrm;
- Bitmap aMask;
+ Sequence< PropertyValue > aFilterData( 2 );
+ aFilterData[ 0 ].Name = "Quality";
+ aFilterData[ 0 ].Value <<= sal_Int32(i_rContext.m_nJPEGQuality);
+ aFilterData[ 1 ].Name = "ColorMode";
+ aFilterData[ 1 ].Value <<= sal_Int32(0);
- bool bTrueColorJPG = true;
- if ( bUseJPGCompression )
+ try
{
-
- sal_uInt32 nZippedFileSize = 0; // sj: we will calculate the filesize of a zipped bitmap
- if ( !bIsJpeg ) // to determine if jpeg compression is useful
+ uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm );
+ uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(xContext) );
+ uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
+ uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
+ uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
+ aOutMediaProperties[0].Name = "OutputStream";
+ aOutMediaProperties[0].Value <<= xOut;
+ aOutMediaProperties[1].Name = "MimeType";
+ aOutMediaProperties[1].Value <<= OUString("image/jpeg");
+ aOutMediaProperties[2].Name = "FilterData";
+ aOutMediaProperties[2].Value <<= aFilterData;
+ xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
+ xOut->flush();
+ if ( !bIsJpeg && xSeekable->getLength() > nZippedFileSize )
{
- SvMemoryStream aTemp;
- aTemp.SetCompressMode( aTemp.GetCompressMode() | SvStreamCompressFlags::ZBITMAP );
- aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
- WriteDIBBitmapEx(aBitmapEx, aTemp); // is capable of zlib stream compression
- aTemp.Seek( STREAM_SEEK_TO_END );
- nZippedFileSize = aTemp.Tell();
- }
- if ( aBitmapEx.IsTransparent() )
- {
- if ( aBitmapEx.IsAlpha() )
- aMask = aBitmapEx.GetAlpha().GetBitmap();
- else
- aMask = aBitmapEx.GetMask();
+ bUseJPGCompression = false;
}
- Graphic aGraphic( aBitmapEx.GetBitmap() );
-
- Sequence< PropertyValue > aFilterData( 2 );
- aFilterData[ 0 ].Name = "Quality";
- aFilterData[ 0 ].Value <<= sal_Int32(i_rContext.m_nJPEGQuality);
- aFilterData[ 1 ].Name = "ColorMode";
- aFilterData[ 1 ].Value <<= sal_Int32(0);
-
- try
+ else
{
- uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm );
- uno::Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW );
- uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
- uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(xContext) );
- uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
- uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
- uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
- aOutMediaProperties[0].Name = "OutputStream";
- aOutMediaProperties[0].Value <<= xOut;
- aOutMediaProperties[1].Name = "MimeType";
- aOutMediaProperties[1].Value <<= OUString("image/jpeg");
- aOutMediaProperties[2].Name = "FilterData";
- aOutMediaProperties[2].Value <<= aFilterData;
- xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
- xOut->flush();
- if ( !bIsJpeg && xSeekable->getLength() > nZippedFileSize )
+ aStrm.Seek( STREAM_SEEK_TO_END );
+
+ xSeekable->seek( 0 );
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[ 0 ].Name = "InputStream";
+ aArgs[ 0 ].Value <<= xStream;
+ uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) );
+ if ( xPropSet.is() )
{
- bUseJPGCompression = false;
- }
- else
- {
- aStrm.Seek( STREAM_SEEK_TO_END );
-
- xSeekable->seek( 0 );
- Sequence< PropertyValue > aArgs( 1 );
- aArgs[ 0 ].Name = "InputStream";
- aArgs[ 0 ].Value <<= xStream;
- uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) );
- if ( xPropSet.is() )
+ sal_Int16 nBitsPerPixel = 24;
+ if ( xPropSet->getPropertyValue("BitsPerPixel") >>= nBitsPerPixel )
{
- sal_Int16 nBitsPerPixel = 24;
- if ( xPropSet->getPropertyValue("BitsPerPixel") >>= nBitsPerPixel )
- {
- bTrueColorJPG = nBitsPerPixel != 8;
- }
+ bTrueColorJPG = nBitsPerPixel != 8;
}
}
}
- catch( uno::Exception& )
- {
- bUseJPGCompression = false;
- }
}
- if ( bUseJPGCompression )
- m_rOuterFace.DrawJPGBitmap( aStrm, bTrueColorJPG, aSizePixel, tools::Rectangle( aPoint, aSize ), aMask, i_Graphic );
- else if ( aBitmapEx.IsTransparent() )
- m_rOuterFace.DrawBitmapEx( aPoint, aSize, aBitmapEx );
- else
- m_rOuterFace.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap(), i_Graphic );
+ catch( uno::Exception& )
+ {
+ bUseJPGCompression = false;
+ }
}
+ if ( bUseJPGCompression )
+ m_rOuterFace.DrawJPGBitmap( aStrm, bTrueColorJPG, aSizePixel, tools::Rectangle( aPoint, aSize ), aMask, i_Graphic );
+ else if ( aBitmapEx.IsTransparent() )
+ m_rOuterFace.DrawBitmapEx( aPoint, aSize, aBitmapEx );
+ else
+ m_rOuterFace.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap(), i_Graphic );
}
+
}
void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevData* i_pOutDevData, const vcl::PDFWriter::PlayMetafileContext& i_rContext, VirtualDevice* pDummyVDev )
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 55f4b3fa3be9..62a12325847f 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -741,82 +741,83 @@ void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
aSrcRect.Justify();
- if( !rMask.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height() )
+ if( !(!rMask.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height()) )
+ return;
+
+ Bitmap aMask( rMask );
+ BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
+
+ if( aMask.GetBitCount() > 1 )
+ aMask.Convert( BmpConversion::N1BitThreshold );
+
+ // mirrored horizontically
+ if( aDestSz.Width() < 0 )
{
- Bitmap aMask( rMask );
- BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
+ aDestSz.Width() = -aDestSz.Width();
+ aDestPt.X() -= ( aDestSz.Width() - 1 );
+ nMirrFlags |= BmpMirrorFlags::Horizontal;
+ }
- if( aMask.GetBitCount() > 1 )
- aMask.Convert( BmpConversion::N1BitThreshold );
+ // mirrored vertically
+ if( aDestSz.Height() < 0 )
+ {
+ aDestSz.Height() = -aDestSz.Height();
+ aDestPt.Y() -= ( aDestSz.Height() - 1 );
+ nMirrFlags |= BmpMirrorFlags::Vertical;
+ }
- // mirrored horizontically
- if( aDestSz.Width() < 0 )
- {
- aDestSz.Width() = -aDestSz.Width();
- aDestPt.X() -= ( aDestSz.Width() - 1 );
- nMirrFlags |= BmpMirrorFlags::Horizontal;
- }
+ // source cropped?
+ if( aSrcRect != tools::Rectangle( aPt, aMask.GetSizePixel() ) )
+ aMask.Crop( aSrcRect );
- // mirrored vertically
- if( aDestSz.Height() < 0 )
- {
- aDestSz.Height() = -aDestSz.Height();
- aDestPt.Y() -= ( aDestSz.Height() - 1 );
- nMirrFlags |= BmpMirrorFlags::Vertical;
- }
+ // destination mirrored
+ if( nMirrFlags != BmpMirrorFlags::NONE)
+ aMask.Mirror( nMirrFlags );
- // source cropped?
- if( aSrcRect != tools::Rectangle( aPt, aMask.GetSizePixel() ) )
- aMask.Crop( aSrcRect );
-
- // destination mirrored
- if( nMirrFlags != BmpMirrorFlags::NONE)
- aMask.Mirror( nMirrFlags );
-
- // do painting
- const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
- long nX, nY; //, nWorkX, nWorkY, nWorkWidth, nWorkHeight;
- long* pMapX = new long[ nSrcWidth + 1 ];
- long* pMapY = new long[ nSrcHeight + 1 ];
- GDIMetaFile* pOldMetaFile = mpMetaFile;
- const bool bOldMap = mbMap;
-
- mpMetaFile = nullptr;
- mbMap = false;
- Push( PushFlags::FILLCOLOR | PushFlags::LINECOLOR );
- SetLineColor( rMaskColor );
- SetFillColor( rMaskColor );
- InitLineColor();
- InitFillColor();
-
- // create forward mapping tables
- for( nX = 0; nX <= nSrcWidth; nX++ )
- pMapX[ nX ] = aDestPt.X() + FRound( (double) aDestSz.Width() * nX / nSrcWidth );
-
- for( nY = 0; nY <= nSrcHeight; nY++ )
- pMapY[ nY ] = aDestPt.Y() + FRound( (double) aDestSz.Height() * nY / nSrcHeight );
-
- // walk through all rectangles of mask
- const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
- RectangleVector aRectangles;
- aWorkRgn.GetRegionRectangles(aRectangles);
-
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
- {
- const Point aMapPt(pMapX[aRectIter->Left()], pMapY[aRectIter->Top()]);
- const Size aMapSz(
- pMapX[aRectIter->Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
- pMapY[aRectIter->Bottom() + 1] - aMapPt.Y()); // same for Y
+ // do painting
+ const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
+ long nX, nY; //, nWorkX, nWorkY, nWorkWidth, nWorkHeight;
+ long* pMapX = new long[ nSrcWidth + 1 ];
+ long* pMapY = new long[ nSrcHeight + 1 ];
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ const bool bOldMap = mbMap;
- DrawRect(tools::Rectangle(aMapPt, aMapSz));
- }
+ mpMetaFile = nullptr;
+ mbMap = false;
+ Push( PushFlags::FILLCOLOR | PushFlags::LINECOLOR );
+ SetLineColor( rMaskColor );
+ SetFillColor( rMaskColor );
+ InitLineColor();
+ InitFillColor();
+
+ // create forward mapping tables
+ for( nX = 0; nX <= nSrcWidth; nX++ )
+ pMapX[ nX ] = aDestPt.X() + FRound( (double) aDestSz.Width() * nX / nSrcWidth );
+
+ for( nY = 0; nY <= nSrcHeight; nY++ )
+ pMapY[ nY ] = aDestPt.Y() + FRound( (double) aDestSz.Height() * nY / nSrcHeight );
+
+ // walk through all rectangles of mask
+ const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
+ RectangleVector aRectangles;
+ aWorkRgn.GetRegionRectangles(aRectangles);
+
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ {
+ const Point aMapPt(pMapX[aRectIter->Left()], pMapY[aRectIter->Top()]);
+ const Size aMapSz(
+ pMapX[aRectIter->Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
+ pMapY[aRectIter->Bottom() + 1] - aMapPt.Y()); // same for Y
- Pop();
- delete[] pMapX;
- delete[] pMapY;
- mbMap = bOldMap;
- mpMetaFile = pOldMetaFile;
+ DrawRect(tools::Rectangle(aMapPt, aMapSz));
}
+
+ Pop();
+ delete[] pMapX;
+ delete[] pMapY;
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
+
}
SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index ced9aa6d0661..68d3f6359694 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -419,25 +419,26 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect,
ImplDrawPolygon( aPoly, pClixPolyPoly );
}
}
- if ( !bLinear)
- {
- // draw middle polygon with end color
- nRed = GetGradientColorValue(nEndRed);
- nGreen = GetGradientColorValue(nEndGreen);
- nBlue = GetGradientColorValue(nEndBlue);
+ if ( bLinear)
+ return;
- mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+ // draw middle polygon with end color
+ nRed = GetGradientColorValue(nEndRed);
+ nGreen = GetGradientColorValue(nEndGreen);
+ nBlue = GetGradientColorValue(nEndBlue);
- aRect.Top() = (long)( fGradientLine + ((double)nSteps) * fScanInc );
- aRect.Bottom() = (long)( fMirrorGradientLine - ((double) nSteps) * fScanInc );
- aPoly[0] = aRect.TopLeft();
- aPoly[1] = aRect.TopRight();
- aPoly[2] = aRect.BottomRight();
- aPoly[3] = aRect.BottomLeft();
- aPoly.Rotate( aCenter, nAngle );
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+
+ aRect.Top() = (long)( fGradientLine + ((double)nSteps) * fScanInc );
+ aRect.Bottom() = (long)( fMirrorGradientLine - ((double) nSteps) * fScanInc );
+ aPoly[0] = aRect.TopLeft();
+ aPoly[1] = aRect.TopRight();
+ aPoly[2] = aRect.BottomRight();
+ aPoly[3] = aRect.BottomLeft();
+ aPoly.Rotate( aCenter, nAngle );
+
+ ImplDrawPolygon( aPoly, pClixPolyPoly );
- ImplDrawPolygon( aPoly, pClixPolyPoly );
- }
}
bool OutputDevice::is_double_buffered_window() const
@@ -769,25 +770,26 @@ void OutputDevice::DrawLinearGradientToMetafile( const tools::Rectangle& rRect,
mpMetaFile->AddAction( new MetaPolygonAction( aPoly ) );
}
}
- if ( !bLinear)
- {
- // draw middle polygon with end color
- nRed = GetGradientColorValue(nEndRed);
- nGreen = GetGradientColorValue(nEndGreen);
- nBlue = GetGradientColorValue(nEndBlue);
+ if ( bLinear)
+ return;
- mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), true ) );
+ // draw middle polygon with end color
+ nRed = GetGradientColorValue(nEndRed);
+ nGreen = GetGradientColorValue(nEndGreen);
+ nBlue = GetGradientColorValue(nEndBlue);
- aRect.Top() = (long)( fGradientLine + ((double)nSteps) * fScanInc );
- aRect.Bottom() = (long)( fMirrorGradientLine - ((double) nSteps) * fScanInc );
- aPoly[0] = aRect.TopLeft();
- aPoly[1] = aRect.TopRight();
- aPoly[2] = aRect.BottomRight();
- aPoly[3] = aRect.BottomLeft();
- aPoly.Rotate( aCenter, nAngle );
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), true ) );
+
+ aRect.Top() = (long)( fGradientLine + ((double)nSteps) * fScanInc );
+ aRect.Bottom() = (long)( fMirrorGradientLine - ((double) nSteps) * fScanInc );
+ aPoly[0] = aRect.TopLeft();
+ aPoly[1] = aRect.TopRight();
+ aPoly[2] = aRect.BottomRight();
+ aPoly[3] = aRect.BottomLeft();
+ aPoly.Rotate( aCenter, nAngle );
+
+ mpMetaFile->AddAction( new MetaPolygonAction( aPoly ) );
- mpMetaFile->AddAction( new MetaPolygonAction( aPoly ) );
- }
}
void OutputDevice::DrawComplexGradientToMetafile( const tools::Rectangle& rRect,
@@ -1019,35 +1021,36 @@ void OutputDevice::AddGradientActions( const tools::Rectangle& rRect, const Grad
aRect.Justify();
// do nothing if the rectangle is empty
- if ( !aRect.IsEmpty() )
- {
- Gradient aGradient( rGradient );
- GDIMetaFile* pOldMtf = mpMetaFile;
-
- mpMetaFile = &rMtf;
- mpMetaFile->AddAction( new MetaPushAction( PushFlags::ALL ) );
- mpMetaFile->AddAction( new MetaISectRectClipRegionAction( aRect ) );
- mpMetaFile->AddAction( new MetaLineColorAction( Color(), false ) );
-
- // because we draw with no border line, we have to expand gradient
- // rect to avoid missing lines on the right and bottom edge
- aRect.Left()--;
- aRect.Top()--;
- aRect.Right()++;
- aRect.Bottom()++;
-
- // calculate step count if necessary
- if ( !aGradient.GetSteps() )
- aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
-
- if( aGradient.GetStyle() == GradientStyle::Linear || aGradient.GetStyle() == GradientStyle::Axial )
- DrawLinearGradientToMetafile( aRect, aGradient );
- else
- DrawComplexGradientToMetafile( aRect, aGradient );
+ if ( aRect.IsEmpty() )
+ return;
+
+ Gradient aGradient( rGradient );
+ GDIMetaFile* pOldMtf = mpMetaFile;
+
+ mpMetaFile = &rMtf;
+ mpMetaFile->AddAction( new MetaPushAction( PushFlags::ALL ) );
+ mpMetaFile->AddAction( new MetaISectRectClipRegionAction( aRect ) );
+ mpMetaFile->AddAction( new MetaLineColorAction( Color(), false ) );
+
+ // because we draw with no border line, we have to expand gradient
+ // rect to avoid missing lines on the right and bottom edge
+ aRect.Left()--;
+ aRect.Top()--;
+ aRect.Right()++;
+ aRect.Bottom()++;
+
+ // calculate step count if necessary
+ if ( !aGradient.GetSteps() )
+ aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
+
+ if( aGradient.GetStyle() == GradientStyle::Linear || aGradient.GetStyle() == GradientStyle::Axial )
+ DrawLinearGradientToMetafile( aRect, aGradient );
+ else
+ DrawComplexGradientToMetafile( aRect, aGradient );
+
+ mpMetaFile->AddAction( new MetaPopAction() );
+ mpMetaFile = pOldMtf;
- mpMetaFile->AddAction( new MetaPopAction() );
- mpMetaFile = pOldMtf;
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 78f462db1a5a..9f9e1431548f 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -123,85 +123,86 @@ void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask
aSrcRect.Justify();
- if( !rBmp.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height() )
- {
- Bitmap aPaint( rBmp ), aMask( rMask );
- BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
+ if( rBmp.IsEmpty() || !aSrcRect.GetWidth() || !aSrcRect.GetHeight() || !aDestSz.Width() || !aDestSz.Height() )
+ return;
- if( aMask.GetBitCount() > 1 )
- aMask.Convert( BmpConversion::N1BitThreshold );
+ Bitmap aPaint( rBmp ), aMask( rMask );
+ BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
- // mirrored horizontically
- if( aDestSz.Width() < 0 )
- {
- aDestSz.Width() = -aDestSz.Width();
- aDestPt.X() -= ( aDestSz.Width() - 1 );
- nMirrFlags |= BmpMirrorFlags::Horizontal;
- }
+ if( aMask.GetBitCount() > 1 )
+ aMask.Convert( BmpConversion::N1BitThreshold );
- // mirrored vertically
- if( aDestSz.Height() < 0 )
- {
- aDestSz.Height() = -aDestSz.Height();
- aDestPt.Y() -= ( aDestSz.Height() - 1 );
- nMirrFlags |= BmpMirrorFlags::Vertical;
- }
+ // mirrored horizontically
+ if( aDestSz.Width() < 0 )
+ {
+ aDestSz.Width() = -aDestSz.Width();
+ aDestPt.X() -= ( aDestSz.Width() - 1 );
+ nMirrFlags |= BmpMirrorFlags::Horizontal;
+ }
- // source cropped?
- if( aSrcRect != tools::Rectangle( Point(), aPaint.GetSizePixel() ) )
- {
- aPaint.Crop( aSrcRect );
- aMask.Crop( aSrcRect );
- }
+ // mirrored vertically
+ if( aDestSz.Height() < 0 )
+ {
+ aDestSz.Height() = -aDestSz.Height();
+ aDestPt.Y() -= ( aDestSz.Height() - 1 );
+ nMirrFlags |= BmpMirrorFlags::Vertical;
+ }
- // destination mirrored
- if( nMirrFlags != BmpMirrorFlags::NONE )
- {
- aPaint.Mirror( nMirrFlags );
- aMask.Mirror( nMirrFlags );
- }
+ // source cropped?
+ if( aSrcRect != tools::Rectangle( Point(), aPaint.GetSizePixel() ) )
+ {
+ aPaint.Crop( aSrcRect );
+ aMask.Crop( aSrcRect );
+ }
- // we always want to have a mask
- if( aMask.IsEmpty() )
- {
- aMask = Bitmap( aSrcRect.GetSize(), 1 );
- aMask.Erase( Color( COL_BLACK ) );
- }
+ // destination mirrored
+ if( nMirrFlags != BmpMirrorFlags::NONE )
+ {
+ aPaint.Mirror( nMirrFlags );
+ aMask.Mirror( nMirrFlags );
+ }
- // do painting
- const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
- long nX, nY; // , nWorkX, nWorkY, nWorkWidth, nWorkHeight;
- std::unique_ptr<long[]> pMapX(new long[ nSrcWidth + 1 ]);
- std::unique_ptr<long[]> pMapY(new long[ nSrcHeight + 1 ]);
- const bool bOldMap = mbMap;
+ // we always want to have a mask
+ if( aMask.IsEmpty() )
+ {
+ aMask = Bitmap( aSrcRect.GetSize(), 1 );
+ aMask.Erase( Color( COL_BLACK ) );
+ }
- mbMap = false;
+ // do painting
+ const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
+ long nX, nY; // , nWorkX, nWorkY, nWorkWidth, nWorkHeight;
+ std::unique_ptr<long[]> pMapX(new long[ nSrcWidth + 1 ]);
+ std::unique_ptr<long[]> pMapY(new long[ nSrcHeight + 1 ]);
+ const bool bOldMap = mbMap;
- // create forward mapping tables
- for( nX = 0; nX <= nSrcWidth; nX++ )
- pMapX[ nX ] = aDestPt.X() + FRound( (double) aDestSz.Width() * nX / nSrcWidth );
+ mbMap = false;
- for( nY = 0; nY <= nSrcHeight; nY++ )
- pMapY[ nY ] = aDestPt.Y() + FRound( (double) aDestSz.Height() * nY / nSrcHeight );
+ // create forward mapping tables
+ for( nX = 0; nX <= nSrcWidth; nX++ )
+ pMapX[ nX ] = aDestPt.X() + FRound( (double) aDestSz.Width() * nX / nSrcWidth );
- // walk through all rectangles of mask
- const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
- RectangleVector aRectangles;
- aWorkRgn.GetRegionRectangles(aRectangles);
+ for( nY = 0; nY <= nSrcHeight; nY++ )
+ pMapY[ nY ] = aDestPt.Y() + FRound( (double) aDestSz.Height() * nY / nSrcHeight );
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
- {
- const Point aMapPt(pMapX[aRectIter->Left()], pMapY[aRectIter->Top()]);
- const Size aMapSz( pMapX[aRectIter->Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
- pMapY[aRectIter->Bottom() + 1] - aMapPt.Y()); // same for Y
- Bitmap aBandBmp(aPaint);
+ // walk through all rectangles of mask
+ const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
+ RectangleVector aRectangles;
+ aWorkRgn.GetRegionRectangles(aRectangles);
- aBandBmp.Crop(*aRectIter);
- DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
- }
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ {
+ const Point aMapPt(pMapX[aRectIter->Left()], pMapY[aRectIter->Top()]);
+ const Size aMapSz( pMapX[aRectIter->Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
+ pMapY[aRectIter->Bottom() + 1] - aMapPt.Y()); // same for Y
+ Bitmap aBandBmp(aPaint);
- mbMap = bOldMap;
+ aBandBmp.Crop(*aRectIter);
+ DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
}
+
+ mbMap = bOldMap;
+
}
// Caution: This method is nearly the same as
diff --git a/vcl/source/window/EnumContext.cxx b/vcl/source/window/EnumContext.cxx
index f2e46f1cf1ba..3e3431412e2d 100644
--- a/vcl/source/window/EnumContext.cxx
+++ b/vcl/source/window/EnumContext.cxx
@@ -111,22 +111,23 @@ void EnumContext::AddEntry (const ::rtl::OUString& rsName, const Application eAp
void EnumContext::ProvideApplicationContainers()
{
- if (maApplicationMap.empty())
- {
- AddEntry("com.sun.star.text.TextDocument", EnumContext::Application::Writer);
- AddEntry("com.sun.star.text.GlobalDocument", EnumContext::Application::WriterGlobal);
- AddEntry("com.sun.star.text.WebDocument", EnumContext::Application::WriterWeb);
- AddEntry("com.sun.star.xforms.XMLFormDocument", EnumContext::Application::WriterXML);
- AddEntry("com.sun.star.sdb.FormDesign", EnumContext::Application::WriterForm);
- AddEntry("com.sun.star.sdb.TextReportDesign", EnumContext::Application::WriterReport);
- AddEntry("com.sun.star.sheet.SpreadsheetDocument", EnumContext::Application::Calc);
- AddEntry("com.sun.star.chart2.ChartDocument", EnumContext::Application::Chart);
- AddEntry("com.sun.star.drawing.DrawingDocument", EnumContext::Application::Draw);
- AddEntry("com.sun.star.presentation.PresentationDocument", EnumContext::Application::Impress);
-
- AddEntry("any", EnumContext::Application::Any);
- AddEntry("none", EnumContext::Application::NONE);
- }
+ if (!maApplicationMap.empty())
+ return;
+
+ AddEntry("com.sun.star.text.TextDocument", EnumContext::Application::Writer);
+ AddEntry("com.sun.star.text.GlobalDocument", EnumContext::Application::WriterGlobal);
+ AddEntry("com.sun.star.text.WebDocument", EnumContext::Application::WriterWeb);
+ AddEntry("com.sun.star.xforms.XMLFormDocument", EnumContext::Application::WriterXML);
+ AddEntry("com.sun.star.sdb.FormDesign", EnumContext::Application::WriterForm);
+ AddEntry("com.sun.star.sdb.TextReportDesign", EnumContext::Application::WriterReport);
+ AddEntry("com.sun.star.sheet.SpreadsheetDocument", EnumContext::Application::Calc);
+ AddEntry("com.sun.star.chart2.ChartDocument", EnumContext::Application::Chart);
+ AddEntry("com.sun.star.drawing.DrawingDocument", EnumContext::Application::Draw);
+ AddEntry("com.sun.star.presentation.PresentationDocument", EnumContext::Application::Impress);
+
+ AddEntry("any", EnumContext::Application::Any);
+ AddEntry("none", EnumContext::Application::NONE);
+
}
EnumContext::Application EnumContext::GetApplicationEnum (const ::rtl::OUString& rsApplicationName)
@@ -155,43 +156,44 @@ void EnumContext::AddEntry (const ::rtl::OUString& rsName, const Context eContex
void EnumContext::ProvideContextContainers()
{
- if (maContextMap.empty())
- {
- AddEntry("any", Context::Any);
- AddEntry("default", Context::Default);
- AddEntry("empty", Context::Empty);
- AddEntry("3DObject", Context::ThreeDObject);
- AddEntry("Annotation", Context::Annotation);
- AddEntry("Auditing", Context::Auditing);
- AddEntry("Axis", Context::Axis);
- AddEntry("Cell", Context::Cell);
- AddEntry("Chart", Context::Chart);
- AddEntry("ChartElements", Context::ChartElements);
- AddEntry("Draw", Context::Draw);
- AddEntry("DrawLine", Context::DrawLine);
- AddEntry("DrawPage", Context::DrawPage);
- AddEntry("DrawText", Context::DrawText);
- AddEntry("EditCell", Context::EditCell);
- AddEntry("ErrorBar", Context::ErrorBar);
- AddEntry("Form", Context::Form);
- AddEntry("Frame", Context::Frame);
- AddEntry("Graphic", Context::Graphic);
- AddEntry("Grid", Context::Grid);
- AddEntry("HandoutPage", Context::HandoutPage);
- AddEntry("MasterPage", Context::MasterPage);
- AddEntry("Media", Context::Media);
- AddEntry("MultiObject", Context::MultiObject);
- AddEntry("NotesPage", Context::NotesPage);
- AddEntry("OLE", Context::OLE);
- AddEntry("OutlineText", Context::OutlineText);
- AddEntry("Pivot", Context::Pivot);
- AddEntry("Series", Context::Series);
- AddEntry("SlidesorterPage", Context::SlidesorterPage);
- AddEntry("Table", Context::Table);
- AddEntry("Text", Context::Text);
- AddEntry("TextObject", Context::TextObject);
- AddEntry("Trendline", Context::Trendline);
- }
+ if (!maContextMap.empty())
+ return;
+
+ AddEntry("any", Context::Any);
+ AddEntry("default", Context::Default);
+ AddEntry("empty", Context::Empty);
+ AddEntry("3DObject", Context::ThreeDObject);
+ AddEntry("Annotation", Context::Annotation);
+ AddEntry("Auditing", Context::Auditing);
+ AddEntry("Axis", Context::Axis);
+ AddEntry("Cell", Context::Cell);
+ AddEntry("Chart", Context::Chart);
+ AddEntry("ChartElements", Context::ChartElements);
+ AddEntry("Draw", Context::Draw);
+ AddEntry("DrawLine", Context::DrawLine);
+ AddEntry("DrawPage", Context::DrawPage);
+ AddEntry("DrawText", Context::DrawText);
+ AddEntry("EditCell", Context::EditCell);
+ AddEntry("ErrorBar", Context::ErrorBar);
+ AddEntry("Form", Context::Form);
+ AddEntry("Frame", Context::Frame);
+ AddEntry("Graphic", Context::Graphic);
+ AddEntry("Grid", Context::Grid);
+ AddEntry("HandoutPage", Context::HandoutPage);
+ AddEntry("MasterPage", Context::MasterPage);
+ AddEntry("Media", Context::Media);
+ AddEntry("MultiObject", Context::MultiObject);
+ AddEntry("NotesPage", Context::NotesPage);
+ AddEntry("OLE", Context::OLE);
+ AddEntry("OutlineText", Context::OutlineText);
+ AddEntry("Pivot", Context::Pivot);
+ AddEntry("Series", Context::Series);
+ AddEntry("SlidesorterPage", Context::SlidesorterPage);
+ AddEntry("Table", Context::Table);
+ AddEntry("Text", Context::Text);
+ AddEntry("TextObject", Context::TextObject);
+ AddEntry("Trendline", Context::Trendline);
+
}
EnumContext::Context EnumContext::GetContextEnum (const ::rtl::OUString& rsContextName)
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 720153d5c7d2..a409bdc6e126 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1102,59 +1102,60 @@ void Dialog::StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl )
void Dialog::EndDialog( long nResult )
{
- if ( mbInExecute )
- {
- SetModalInputMode(false);
+ if ( !mbInExecute )
+ return;
- // remove dialog from the list of dialogs which are being executed
- ImplSVData* pSVData = ImplGetSVData();
- Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
- while ( pExeDlg )
+ SetModalInputMode(false);
+
+ // remove dialog from the list of dialogs which are being executed
+ ImplSVData* pSVData = ImplGetSVData();
+ Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
+ while ( pExeDlg )
+ {
+ if ( pExeDlg == this )
{
- if ( pExeDlg == this )
- {
- pSVData->maWinData.mpLastExecuteDlg = mpPrevExecuteDlg;
- break;
- }
- pExeDlg = pExeDlg->mpPrevExecuteDlg;
+ pSVData->maWinData.mpLastExecuteDlg = mpPrevExecuteDlg;
+ break;
}
- // set focus to previous modal dialogue if it is modal for
- // the same frame parent (or NULL)
- if( mpPrevExecuteDlg )
+ pExeDlg = pExeDlg->mpPrevExecuteDlg;
+ }
+ // set focus to previous modal dialogue if it is modal for
+ // the same frame parent (or NULL)
+ if( mpPrevExecuteDlg )
+ {
+ vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
+ vcl::Window* pPrevFrameParent = mpPrevExecuteDlg->ImplGetFrameWindow()->ImplGetParent();
+ if( ( !pFrameParent && !pPrevFrameParent ) ||
+ ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
+ )
{
- vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
- vcl::Window* pPrevFrameParent = mpPrevExecuteDlg->ImplGetFrameWindow()->ImplGetParent();
- if( ( !pFrameParent && !pPrevFrameParent ) ||
- ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
- )
- {
- mpPrevExecuteDlg->GrabFocus();
- }
+ mpPrevExecuteDlg->GrabFocus();
}
- mpPrevExecuteDlg = nullptr;
+ }
+ mpPrevExecuteDlg = nullptr;
- Hide();
- if ( GetParent() )
- {
- NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
- GetParent()->CompatNotify( aNEvt );
- }
+ Hide();
+ if ( GetParent() )
+ {
+ NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
+ GetParent()->CompatNotify( aNEvt );
+ }
- mpDialogImpl->mnResult = nResult;
+ mpDialogImpl->mnResult = nResult;
- if ( mpDialogImpl->mbStartedModal )
+ if ( mpDialogImpl->mbStartedModal )
+ {
+ ImplEndExecuteModal();
+ if (mpDialogImpl->maEndDialogHdl.IsSet())
{
- ImplEndExecuteModal();
- if (mpDialogImpl->maEndDialogHdl.IsSet())
- {
- mpDialogImpl->maEndDialogHdl.Call( *this );
- mpDialogImpl->maEndDialogHdl = Link<Dialog&,void>();
- }
- mpDialogImpl->mbStartedModal = false;
- mpDialogImpl->mnResult = -1;
+ mpDialogImpl->maEndDialogHdl.Call( *this );
+ mpDialogImpl->maEndDialogHdl = Link<Dialog&,void>();
}
- mbInExecute = false;
+ mpDialogImpl->mbStartedModal = false;
+ mpDialogImpl->mnResult = -1;
}
+ mbInExecute = false;
+
}
long Dialog::GetResult() const
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 647eac636494..6486ffb86a9c 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -87,26 +87,27 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
if( nMaxHeight < getMinSize().Height() )
nMaxHeight = getMinSize().Height();
- if( (lastSize != nMaxHeight - border) || bForce )
- {
- lastSize = nMaxHeight - border;
+ if( (lastSize == nMaxHeight - border) && !bForce )
+ return;
- Color aEraseColor( 255, 255, 255, 255 );
- BitmapEx aBmpExDst( maImage.GetBitmapEx() );
- BitmapEx aBmpExSrc( aBmpExDst );
+ lastSize = nMaxHeight - border;
- aEraseColor.SetTransparency( 255 );
- aBmpExDst.Erase( aEraseColor );
- aBmpExDst.SetSizePixel( Size( lastSize, lastSize ) );
+ Color aEraseColor( 255, 255, 255, 255 );
+ BitmapEx aBmpExDst( maImage.GetBitmapEx() );
+ BitmapEx aBmpExSrc( aBmpExDst );
- tools::Rectangle aSrcRect( Point(0,0), maImage.GetSizePixel() );
- tools::Rectangle aDestRect( Point((lastSize - maImage.GetSizePixel().Width())/2,
- (lastSize - maImage.GetSizePixel().Height())/2 ),
- maImage.GetSizePixel() );
+ aEraseColor.SetTransparency( 255 );
+ aBmpExDst.Erase( aEraseColor );
+ aBmpExDst.SetSizePixel( Size( lastSize, lastSize ) );
+
+ tools::Rectangle aSrcRect( Point(0,0), maImage.GetSizePixel() );
+ tools::Rectangle aDestRect( Point((lastSize - maImage.GetSizePixel().Width())/2,
+ (lastSize - maImage.GetSizePixel().Height())/2 ),
+ maImage.GetSizePixel() );
+
+ aBmpExDst.CopyPixel( aDestRect, aSrcRect, &aBmpExSrc );
+ SetItemImage( IID_DOCUMENTCLOSE, Image( aBmpExDst ) );
- aBmpExDst.CopyPixel( aDestRect, aSrcRect, &aBmpExSrc );
- SetItemImage( IID_DOCUMENTCLOSE, Image( aBmpExDst ) );
- }
}
MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 0ec130ffe654..601434cbb8c7 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -64,51 +64,52 @@ MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, vcl::Window* pParent, WinBit
void MenuFloatingWindow::doShutdown()
{
- if( pMenu )
+ if( !pMenu )
+ return;
+
+ // #105373# notify toolkit that highlight was removed
+ // otherwise the entry will not be read when the menu is opened again
+ if( nHighlightedItem != ITEMPOS_INVALID )
+ pMenu->ImplCallEventListeners( VclEventId::MenuDehighlight, nHighlightedItem );
+ if (!bKeyInput && pMenu && pMenu->pStartedFrom && !pMenu->pStartedFrom->IsMenuBar())
{
- // #105373# notify toolkit that highlight was removed
- // otherwise the entry will not be read when the menu is opened again
- if( nHighlightedItem != ITEMPOS_INVALID )
- pMenu->ImplCallEventListeners( VclEventId::MenuDehighlight, nHighlightedItem );
- if (!bKeyInput && pMenu && pMenu->pStartedFrom && !pMenu->pStartedFrom->IsMenuBar())
+ // #102461# remove highlight in parent
+ size_t i, nCount = pMenu->pStartedFrom->pItemList->size();
+ for(i = 0; i < nCount; i++)
{
- // #102461# remove highlight in parent
- size_t i, nCount = pMenu->pStartedFrom->pItemList->size();
- for(i = 0; i < nCount; i++)
- {
- MenuItemData* pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i );
- if( pData && ( pData->pSubMenu == pMenu ) )
- break;
- }
- if( i < nCount )
- {
- MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
- if (pPWin)
- pPWin->InvalidateItem(i);
- }
+ MenuItemData* pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i );
+ if( pData && ( pData->pSubMenu == pMenu ) )
+ break;
}
-
- // free the reference to the accessible component
- SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() );
-
- aHighlightChangedTimer.Stop();
-
- // #95056# invalidate screen area covered by system window
- // so this can be taken into account if the commandhandler performs a scroll operation
- if( GetParent() )
+ if( i < nCount )
{
- tools::Rectangle aInvRect( GetWindowExtentsRelative( GetParent() ) );
- GetParent()->Invalidate( aInvRect );
+ MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
+ if (pPWin)
+ pPWin->InvalidateItem(i);
}
- pMenu = nullptr;
- RemoveEventListener( LINK( this, MenuFloatingWindow, ShowHideListener ) );
+ }
- aScrollTimer.Stop();
- aSubmenuCloseTimer.Stop();
- aSubmenuCloseTimer.Stop();
- aHighlightChangedTimer.Stop();
- aHighlightChangedTimer.Stop();
+ // free the reference to the accessible component
+ SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() );
+
+ aHighlightChangedTimer.Stop();
+
+ // #95056# invalidate screen area covered by system window
+ // so this can be taken into account if the commandhandler performs a scroll operation
+ if( GetParent() )
+ {
+ tools::Rectangle aInvRect( GetWindowExtentsRelative( GetParent() ) );
+ GetParent()->Invalidate( aInvRect );
}
+ pMenu = nullptr;
+ RemoveEventListener( LINK( this, MenuFloatingWindow, ShowHideListener ) );
+
+ aScrollTimer.Stop();
+ aSubmenuCloseTimer.Stop();
+ aSubmenuCloseTimer.Stop();
+ aHighlightChangedTimer.Stop();
+ aHighlightChangedTimer.Stop();
+
}
MenuFloatingWindow::~MenuFloatingWindow()
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 311018a52366..44b520dfe931 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -275,118 +275,119 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
pParent = pParent->mpWindowImpl->mpParent;
}
- if ( ( pSVData->maWinData.mpFocusWin.get() != this &&
- !mpWindowImpl->mbInDispose ) ||
- ( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus ) )
- {
- // EndExtTextInput if it is not the same window
- if ( pSVData->maWinData.mpExtTextInputWin &&
- (pSVData->maWinData.mpExtTextInputWin.get() != this) )
- pSVData->maWinData.mpExtTextInputWin->EndExtTextInput();
+ if ( !(( pSVData->maWinData.mpFocusWin.get() != this &&
+ !mpWindowImpl->mbInDispose ) ||
+ ( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus )) )
+ return;
+
+ // EndExtTextInput if it is not the same window
+ if ( pSVData->maWinData.mpExtTextInputWin &&
+ (pSVData->maWinData.mpExtTextInputWin.get() != this) )
+ pSVData->maWinData.mpExtTextInputWin->EndExtTextInput();
- // mark this windows as the last FocusWindow
- vcl::Window* pOverlapWindow = ImplGetFirstOverlapWindow();
- pOverlapWindow->mpWindowImpl->mpLastFocusWindow = this;
- mpWindowImpl->mpFrameData->mpFocusWin = this;
+ // mark this windows as the last FocusWindow
+ vcl::Window* pOverlapWindow = ImplGetFirstOverlapWindow();
+ pOverlapWindow->mpWindowImpl->mpLastFocusWindow = this;
+ mpWindowImpl->mpFrameData->mpFocusWin = this;
- if( !bHasFocus )
+ if( !bHasFocus )
+ {
+ // menu windows never get the system focus
+ // the application will keep the focus
+ if( bMustNotGrabFocus )
+ return;
+ else
{
- // menu windows never get the system focus
- // the application will keep the focus
- if( bMustNotGrabFocus )
- return;
- else
- {
- // here we already switch focus as ToTop()
- // should not give focus to another window
- mpWindowImpl->mpFrame->ToTop( SalFrameToTop::GrabFocus | SalFrameToTop::GrabFocusOnly );
- return;
- }
+ // here we already switch focus as ToTop()
+ // should not give focus to another window
+ mpWindowImpl->mpFrame->ToTop( SalFrameToTop::GrabFocus | SalFrameToTop::GrabFocusOnly );
+ return;
}
+ }
- VclPtr<vcl::Window> pOldFocusWindow = pSVData->maWinData.mpFocusWin;
+ VclPtr<vcl::Window> pOldFocusWindow = pSVData->maWinData.mpFocusWin;
- pSVData->maWinData.mpFocusWin = this;
+ pSVData->maWinData.mpFocusWin = this;
- if ( pOldFocusWindow )
- {
- // Cursor hidden
- if ( pOldFocusWindow->mpWindowImpl->mpCursor )
- pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide();
- }
+ if ( pOldFocusWindow )
+ {
+ // Cursor hidden
+ if ( pOldFocusWindow->mpWindowImpl->mpCursor )
+ pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide();
+ }
- // !!!!! due to old SV-Office Activate/Deactivate handling
- // !!!!! first as before
- if ( pOldFocusWindow )
- {
- // remember Focus
- vcl::Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow();
- vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
- if ( pOldOverlapWindow != pNewOverlapWindow )
- ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow );
- }
- else
+ // !!!!! due to old SV-Office Activate/Deactivate handling
+ // !!!!! first as before
+ if ( pOldFocusWindow )
+ {
+ // remember Focus
+ vcl::Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow();
+ vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
+ if ( pOldOverlapWindow != pNewOverlapWindow )
+ ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow );
+ }
+ else
+ {
+ vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
+ vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
+ pNewOverlapWindow->mpWindowImpl->mbActive = true;
+ pNewOverlapWindow->Activate();
+ if ( pNewRealWindow != pNewOverlapWindow )
{
- vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
- vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
- pNewOverlapWindow->mpWindowImpl->mbActive = true;
- pNewOverlapWindow->Activate();
- if ( pNewRealWindow != pNewOverlapWindow )
- {
- pNewRealWindow->mpWindowImpl->mbActive = true;
- pNewRealWindow->Activate();
- }
+ pNewRealWindow->mpWindowImpl->mbActive = true;
+ pNewRealWindow->Activate();
}
+ }
+
+ // call Get- and LoseFocus
+ if ( pOldFocusWindow && ! pOldFocusWindow->IsDisposed() )
+ {
+ if ( pOldFocusWindow->IsTracking() &&
+ (pSVData->maWinData.mnTrackFlags & StartTrackingFlags::FocusCancel) )
+ pOldFocusWindow->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Focus );
+ NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pOldFocusWindow );
+ if ( !ImplCallPreNotify( aNEvt ) )
+ pOldFocusWindow->CompatLoseFocus();
+ pOldFocusWindow->ImplCallDeactivateListeners( this );
+ }
- // call Get- and LoseFocus
- if ( pOldFocusWindow && ! pOldFocusWindow->IsDisposed() )
+ if ( pSVData->maWinData.mpFocusWin.get() == this )
+ {
+ if ( mpWindowImpl->mpSysObj )
{
- if ( pOldFocusWindow->IsTracking() &&
- (pSVData->maWinData.mnTrackFlags & StartTrackingFlags::FocusCancel) )
- pOldFocusWindow->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Focus );
- NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pOldFocusWindow );
- if ( !ImplCallPreNotify( aNEvt ) )
- pOldFocusWindow->CompatLoseFocus();
- pOldFocusWindow->ImplCallDeactivateListeners( this );
+ mpWindowImpl->mpFrameData->mpFocusWin = this;
+ if ( !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl )
+ mpWindowImpl->mpSysObj->GrabFocus();
}
if ( pSVData->maWinData.mpFocusWin.get() == this )
{
- if ( mpWindowImpl->mpSysObj )
+ if ( mpWindowImpl->mpCursor )
+ mpWindowImpl->mpCursor->ImplShow();
+ mpWindowImpl->mbInFocusHdl = true;
+ mpWindowImpl->mnGetFocusFlags = nFlags;
+ // if we're changing focus due to closing a popup floating window
+ // notify the new focus window so it can restore the inner focus
+ // eg, toolboxes can select their recent active item
+ if( pOldFocusWindow &&
+ ! pOldFocusWindow->IsDisposed() &&
+ ( pOldFocusWindow->GetDialogControlFlags() & DialogControlFlags::FloatWinPopupModeEndCancel ) )
+ mpWindowImpl->mnGetFocusFlags |= GetFocusFlags::FloatWinPopupModeEndCancel;
+ NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
+ if ( !ImplCallPreNotify( aNEvt ) && !xWindow->IsDisposed() )
+ CompatGetFocus();
+ if( !xWindow->IsDisposed() )
+ ImplCallActivateListeners( (pOldFocusWindow && ! pOldFocusWindow->IsDisposed()) ? pOldFocusWindow : nullptr );
+ if( !xWindow->IsDisposed() )
{
- mpWindowImpl->mpFrameData->mpFocusWin = this;
- if ( !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl )
- mpWindowImpl->mpSysObj->GrabFocus();
- }
-
- if ( pSVData->maWinData.mpFocusWin.get() == this )
- {
- if ( mpWindowImpl->mpCursor )
- mpWindowImpl->mpCursor->ImplShow();
- mpWindowImpl->mbInFocusHdl = true;
- mpWindowImpl->mnGetFocusFlags = nFlags;
- // if we're changing focus due to closing a popup floating window
- // notify the new focus window so it can restore the inner focus
- // eg, toolboxes can select their recent active item
- if( pOldFocusWindow &&
- ! pOldFocusWindow->IsDisposed() &&
- ( pOldFocusWindow->GetDialogControlFlags() & DialogControlFlags::FloatWinPopupModeEndCancel ) )
- mpWindowImpl->mnGetFocusFlags |= GetFocusFlags::FloatWinPopupModeEndCancel;
- NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this );
- if ( !ImplCallPreNotify( aNEvt ) && !xWindow->IsDisposed() )
- CompatGetFocus();
- if( !xWindow->IsDisposed() )
- ImplCallActivateListeners( (pOldFocusWindow && ! pOldFocusWindow->IsDisposed()) ? pOldFocusWindow : nullptr );
- if( !xWindow->IsDisposed() )
- {
- mpWindowImpl->mnGetFocusFlags = GetFocusFlags::NONE;
- mpWindowImpl->mbInFocusHdl = false;
- }
+ mpWindowImpl->mnGetFocusFlags = GetFocusFlags::NONE;
+ mpWindowImpl->mbInFocusHdl = false;
}
}
-
- ImplNewInputContext();
}
+
+ ImplNewInputContext();
+
}
void Window::ImplGrabFocusToDocument( GetFocusFlags nFlags )
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 1f05f3fc5be6..0ce98b7e2999 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -1794,185 +1794,186 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
Point aMousePosPixel = rMEvt.GetPosPixel();
mnSplitTest = ImplTestSplit( this, aMousePosPixel, mnMouseOff, &mpSplitSet, mnSplitPos );
- if ( mnSplitTest && !(mnSplitTest & SPLIT_NOSPLIT) )
+ if ( !mnSplitTest || (mnSplitTest & SPLIT_NOSPLIT) )
+ return;
+
+ ImplSplitItem* pSplitItem;
+ long nCurMaxSize;
+ bool bPropSmaller;
+
+ mnMouseModifier = rMEvt.GetModifier();
+ bPropSmaller = (mnMouseModifier & KEY_SHIFT) && (static_cast<sal_uInt16>(mnSplitPos+1) < mpSplitSet->mpItems.size());
+
+ // here we can set the maximum size
+ StartSplit();
+
+ if ( mnMaxSize )
+ nCurMaxSize = mnMaxSize;
+ else
{
- ImplSplitItem* pSplitItem;
- long nCurMaxSize;
- bool bPropSmaller;
+ Size aSize = GetParent()->GetOutputSizePixel();
+ if ( mbHorz )
+ nCurMaxSize = aSize.Height();
+ else
+ nCurMaxSize = aSize.Width();
+ }
- mnMouseModifier = rMEvt.GetModifier();
- bPropSmaller = (mnMouseModifier & KEY_SHIFT) && (static_cast<sal_uInt16>(mnSplitPos+1) < mpSplitSet->mpItems.size());
+ if ( !mpSplitSet->mpItems.empty() )
+ {
+ bool bDown = true;
+ if ( (mpSplitSet == mpMainSet) && mbBottomRight )
+ bDown = false;
- // here we can set the maximum size
- StartSplit();
+ pSplitItem = mpSplitSet->mpItems[mnSplitPos];
+ maDragRect.Left() = pSplitItem->mnLeft;
+ maDragRect.Top() = pSplitItem->mnTop;
+ maDragRect.Right() = pSplitItem->mnLeft+pSplitItem->mnWidth-1;
+ maDragRect.Bottom() = pSplitItem->mnTop+pSplitItem->mnHeight-1;
- if ( mnMaxSize )
- nCurMaxSize = mnMaxSize;
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ if ( bDown )
+ maDragRect.Right() += mpSplitSet->mnSplitSize;
+ else
+ maDragRect.Left() -= mpSplitSet->mnSplitSize;
+ }
else
{
- Size aSize = GetParent()->GetOutputSizePixel();
- if ( mbHorz )
- nCurMaxSize = aSize.Height();
+ if ( bDown )
+ maDragRect.Bottom() += mpSplitSet->mnSplitSize;
else
- nCurMaxSize = aSize.Width();
+ maDragRect.Top() -= mpSplitSet->mnSplitSize;
}
- if ( !mpSplitSet->mpItems.empty() )
+ if ( mnSplitPos )
{
- bool bDown = true;
- if ( (mpSplitSet == mpMainSet) && mbBottomRight )
- bDown = false;
-
- pSplitItem = mpSplitSet->mpItems[mnSplitPos];
- maDragRect.Left() = pSplitItem->mnLeft;
- maDragRect.Top() = pSplitItem->mnTop;
- maDragRect.Right() = pSplitItem->mnLeft+pSplitItem->mnWidth-1;
- maDragRect.Bottom() = pSplitItem->mnTop+pSplitItem->mnHeight-1;
-
- if ( mnSplitTest & SPLIT_HORZ )
- {
- if ( bDown )
- maDragRect.Right() += mpSplitSet->mnSplitSize;
- else
- maDragRect.Left() -= mpSplitSet->mnSplitSize;
- }
- else
+ long nTemp = mnSplitPos;
+ while ( nTemp )
{
- if ( bDown )
- maDragRect.Bottom() += mpSplitSet->mnSplitSize;
+ pSplitItem = mpSplitSet->mpItems[nTemp-1];
+ if ( pSplitItem->mbFixed )
+ break;
else
- maDragRect.Top() -= mpSplitSet->mnSplitSize;
- }
-
- if ( mnSplitPos )
- {
- long nTemp = mnSplitPos;
- while ( nTemp )
{
- pSplitItem = mpSplitSet->mpItems[nTemp-1];
- if ( pSplitItem->mbFixed )
- break;
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ if ( bDown )
+ maDragRect.Left() -= pSplitItem->mnPixSize;
+ else
+ maDragRect.Right() += pSplitItem->mnPixSize;
+ }
else
{
- if ( mnSplitTest & SPLIT_HORZ )
- {
- if ( bDown )
- maDragRect.Left() -= pSplitItem->mnPixSize;
- else
- maDragRect.Right() += pSplitItem->mnPixSize;
- }
+ if ( bDown )
+ maDragRect.Top() -= pSplitItem->mnPixSize;
else
- {
- if ( bDown )
- maDragRect.Top() -= pSplitItem->mnPixSize;
- else
- maDragRect.Bottom() += pSplitItem->mnPixSize;
- }
+ maDragRect.Bottom() += pSplitItem->mnPixSize;
}
- nTemp--;
}
+ nTemp--;
}
+ }
- if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
+ if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
+ {
+ if ( bDown )
{
- if ( bDown )
- {
- if ( mbHorz )
- maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
- else
- maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
- }
+ if ( mbHorz )
+ maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
else
- {
- if ( mbHorz )
- maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
- else
- maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
- }
+ maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
}
else
{
- std::vector<ImplSplitItem *>::size_type nTemp = mnSplitPos+1;
- while ( nTemp < mpSplitSet->mpItems.size() )
+ if ( mbHorz )
+ maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
+ else
+ maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
+ }
+ }
+ else
+ {
+ std::vector<ImplSplitItem *>::size_type nTemp = mnSplitPos+1;
+ while ( nTemp < mpSplitSet->mpItems.size() )
+ {
+ pSplitItem = mpSplitSet->mpItems[nTemp];
+ if ( pSplitItem->mbFixed )
+ break;
+ else
{
- pSplitItem = mpSplitSet->mpItems[nTemp];
- if ( pSplitItem->mbFixed )
- break;
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ if ( bDown )
+ maDragRect.Right() += pSplitItem->mnPixSize;
+ else
+ maDragRect.Left() -= pSplitItem->mnPixSize;
+ }
else
{
- if ( mnSplitTest & SPLIT_HORZ )
- {
- if ( bDown )
- maDragRect.Right() += pSplitItem->mnPixSize;
- else
- maDragRect.Left() -= pSplitItem->mnPixSize;
- }
+ if ( bDown )
+ maDragRect.Bottom() += pSplitItem->mnPixSize;
else
- {
- if ( bDown )
- maDragRect.Bottom() += pSplitItem->mnPixSize;
- else
- maDragRect.Top() -= pSplitItem->mnPixSize;
- }
+ maDragRect.Top() -= pSplitItem->mnPixSize;
}
- nTemp++;
}
+ nTemp++;
}
}
+ }
+ else
+ {
+ maDragRect.Left() = mnLeftBorder;
+ maDragRect.Top() = mnTopBorder;
+ maDragRect.Right() = mnDX-mnRightBorder-1;
+ maDragRect.Bottom() = mnDY-mnBottomBorder-1;
+ if ( mbHorz )
+ {
+ if ( mbBottomRight )
+ maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
+ else
+ maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
+ }
else
{
- maDragRect.Left() = mnLeftBorder;
- maDragRect.Top() = mnTopBorder;
- maDragRect.Right() = mnDX-mnRightBorder-1;
- maDragRect.Bottom() = mnDY-mnBottomBorder-1;
- if ( mbHorz )
- {
- if ( mbBottomRight )
- maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
- else
- maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
- }
+ if ( mbBottomRight )
+ maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
else
- {
- if ( mbBottomRight )
- maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
- else
- maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
- }
+ maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
}
+ }
- StartTracking();
+ StartTracking();
- mbDragFull = bool(GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Split);
+ mbDragFull = bool(GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Split);
- ImplSplitMousePos( aMousePosPixel );
+ ImplSplitMousePos( aMousePosPixel );
- if (!mbDragFull)
- {
- ImplDrawSplitTracking(aMousePosPixel);
- }
- else
+ if (!mbDragFull)
+ {
+ ImplDrawSplitTracking(aMousePosPixel);
+ }
+ else
+ {
+ std::vector< ImplSplitItem* >& rItems = mpSplitSet->mpItems;
+ sal_uInt16 nItems = mpSplitSet->mpItems.size();
+ mpLastSizes = new long[nItems*2];
+ for ( sal_uInt16 i = 0; i < nItems; i++ )
{
- std::vector< ImplSplitItem* >& rItems = mpSplitSet->mpItems;
- sal_uInt16 nItems = mpSplitSet->mpItems.size();
- mpLastSizes = new long[nItems*2];
- for ( sal_uInt16 i = 0; i < nItems; i++ )
- {
- mpLastSizes[i*2] = rItems[i]->mnSize;
- mpLastSizes[i*2+1] = rItems[i]->mnPixSize;
- }
+ mpLastSizes[i*2] = rItems[i]->mnSize;
+ mpLastSizes[i*2+1] = rItems[i]->mnPixSize;
}
- mnMStartPos = mnMSplitPos;
+ }
+ mnMStartPos = mnMSplitPos;
- PointerStyle eStyle = PointerStyle::Arrow;
- if ( mnSplitTest & SPLIT_HORZ )
- eStyle = PointerStyle::HSplit;
- else if ( mnSplitTest & SPLIT_VERT )
- eStyle = PointerStyle::VSplit;
+ PointerStyle eStyle = PointerStyle::Arrow;
+ if ( mnSplitTest & SPLIT_HORZ )
+ eStyle = PointerStyle::HSplit;
+ else if ( mnSplitTest & SPLIT_VERT )
+ eStyle = PointerStyle::VSplit;
+
+ Pointer aPtr( eStyle );
+ SetPointer( aPtr );
- Pointer aPtr( eStyle );
- SetPointer( aPtr );
- }
}
void SplitWindow::StartSplit()
@@ -2041,34 +2042,35 @@ void SplitWindow::MouseButtonDown( const MouseEvent& rMEvt )
void SplitWindow::MouseMove( const MouseEvent& rMEvt )
{
- if ( !IsTracking() )
- {
- Point aPos = rMEvt.GetPosPixel();
- long nTemp;
- ImplSplitSet* pTempSplitSet;
- sal_uInt16 nTempSplitPos;
- sal_uInt16 nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos );
- PointerStyle eStyle = PointerStyle::Arrow;
- tools::Rectangle aFadeInRect;
- tools::Rectangle aFadeOutRect;
+ if ( IsTracking() )
+ return;
- ImplGetFadeInRect( aFadeInRect );
- ImplGetFadeOutRect( aFadeOutRect );
- if ( !aFadeInRect.IsInside( aPos ) &&
- !aFadeOutRect.IsInside( aPos ) )
+ Point aPos = rMEvt.GetPosPixel();
+ long nTemp;
+ ImplSplitSet* pTempSplitSet;
+ sal_uInt16 nTempSplitPos;
+ sal_uInt16 nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos );
+ PointerStyle eStyle = PointerStyle::Arrow;
+ tools::Rectangle aFadeInRect;
+ tools::Rectangle aFadeOutRect;
+
+ ImplGetFadeInRect( aFadeInRect );
+ ImplGetFadeOutRect( aFadeOutRect );
+ if ( !aFadeInRect.IsInside( aPos ) &&
+ !aFadeOutRect.IsInside( aPos ) )
+ {
+ if ( nSplitTest && !(nSplitTest & SPLIT_NOSPLIT) )
{
- if ( nSplitTest && !(nSplitTest & SPLIT_NOSPLIT) )
- {
- if ( nSplitTest & SPLIT_HORZ )
- eStyle = PointerStyle::HSplit;
- else if ( nSplitTest & SPLIT_VERT )
- eStyle = PointerStyle::VSplit;
- }
+ if ( nSplitTest & SPLIT_HORZ )
+ eStyle = PointerStyle::HSplit;
+ else if ( nSplitTest & SPLIT_VERT )
+ eStyle = PointerStyle::VSplit;
}
-
- Pointer aPtr( eStyle );
- SetPointer( aPtr );
}
+
+ Pointer aPtr( eStyle );
+ SetPointer( aPtr );
+
}
void SplitWindow::Tracking( const TrackingEvent& rTEvt )
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 8541bed438dd..71172415fc49 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2963,35 +2963,36 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si
void ToolBox::ImplDrawFloatwinBorder(vcl::RenderContext& rRenderContext, ImplToolItem const * pItem)
{
- if ( !pItem->maRect.IsEmpty() )
- {
- tools::Rectangle aRect( mpFloatWin->ImplGetItemEdgeClipRect() );
- aRect.SetPos( AbsoluteScreenToOutputPixel( aRect.TopLeft() ) );
- rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetShadowColor());
- Point p1, p2;
-
- p1 = pItem->maRect.TopLeft();
- p1.X()++;
- p2 = pItem->maRect.TopRight();
- p2.X()--;
- rRenderContext.DrawLine( p1, p2);
- p1 = pItem->maRect.BottomLeft();
- p1.X()++;
- p2 = pItem->maRect.BottomRight();
- p2.X()--;
- rRenderContext.DrawLine( p1, p2);
-
- p1 = pItem->maRect.TopLeft();
- p1.Y()++;
- p2 = pItem->maRect.BottomLeft();
- p2.Y()--;
- rRenderContext.DrawLine( p1, p2);
- p1 = pItem->maRect.TopRight();
- p1.Y()++;
- p2 = pItem->maRect.BottomRight();
- p2.Y()--;
- rRenderContext.DrawLine( p1, p2);
- }
+ if ( pItem->maRect.IsEmpty() )
+ return;
+
+ tools::Rectangle aRect( mpFloatWin->ImplGetItemEdgeClipRect() );
+ aRect.SetPos( AbsoluteScreenToOutputPixel( aRect.TopLeft() ) );
+ rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetShadowColor());
+ Point p1, p2;
+
+ p1 = pItem->maRect.TopLeft();
+ p1.X()++;
+ p2 = pItem->maRect.TopRight();
+ p2.X()--;
+ rRenderContext.DrawLine( p1, p2);
+ p1 = pItem->maRect.BottomLeft();
+ p1.X()++;
+ p2 = pItem->maRect.BottomRight();
+ p2.X()--;
+ rRenderContext.DrawLine( p1, p2);
+
+ p1 = pItem->maRect.TopLeft();
+ p1.Y()++;
+ p2 = pItem->maRect.BottomLeft();
+ p2.Y()--;
+ rRenderContext.DrawLine( p1, p2);
+ p1 = pItem->maRect.TopRight();
+ p1.Y()++;
+ p2 = pItem->maRect.BottomRight();
+ p2.Y()--;
+ rRenderContext.DrawLine( p1, p2);
+
}
void ToolBox::ImplFloatControl( bool bStart, FloatingWindow* pFloatWindow )
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index c931c47c5553..c636b4023be0 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1663,56 +1663,57 @@ IMPL_LINK( ToolBox, ImplCustomMenuListener, VclMenuEvent&, rEvent, void )
IMPL_LINK_NOARG(ToolBox, ImplCallExecuteCustomMenu, void*, void)
{
mpData->mnEventId = nullptr;
- if( IsMenuEnabled() )
- {
- if( GetMenuType() & ToolBoxMenuType::Customize )
- // call button handler to allow for menu customization
- mpData->maMenuButtonHdl.Call( this );
+ if( !IsMenuEnabled() )
+ return;
+
+ if( GetMenuType() & ToolBoxMenuType::Customize )
+ // call button handler to allow for menu customization
+ mpData->maMenuButtonHdl.Call( this );
- GetMenu()->AddEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
+ GetMenu()->AddEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
- // make sure all disabled entries will be shown
- GetMenu()->SetMenuFlags(
- GetMenu()->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
+ // make sure all disabled entries will be shown
+ GetMenu()->SetMenuFlags(
+ GetMenu()->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
- // toolbox might be destroyed during execute
- bool bBorderDel = false;
+ // toolbox might be destroyed during execute
+ bool bBorderDel = false;
- VclPtr<vcl::Window> pWin = this;
- tools::Rectangle aMenuRect = mpData->maMenuRect;
- mpData->maMenuRect.SetEmpty();
- VclPtr<ImplBorderWindow> pBorderWin;
- if( aMenuRect.IsEmpty() && IsFloatingMode() )
+ VclPtr<vcl::Window> pWin = this;
+ tools::Rectangle aMenuRect = mpData->maMenuRect;
+ mpData->maMenuRect.SetEmpty();
+ VclPtr<ImplBorderWindow> pBorderWin;
+ if( aMenuRect.IsEmpty() && IsFloatingMode() )
+ {
+ // custom menu is placed in the decoration
+ pBorderWin = dynamic_cast<ImplBorderWindow*>( GetWindow( GetWindowType::Border ) );
+ if( pBorderWin && !pBorderWin->GetMenuRect().IsEmpty() )
{
- // custom menu is placed in the decoration
- pBorderWin = dynamic_cast<ImplBorderWindow*>( GetWindow( GetWindowType::Border ) );
- if( pBorderWin && !pBorderWin->GetMenuRect().IsEmpty() )
- {
- pWin = pBorderWin;
- aMenuRect = pBorderWin->GetMenuRect();
- bBorderDel = true;
- }
+ pWin = pBorderWin;
+ aMenuRect = pBorderWin->GetMenuRect();
+ bBorderDel = true;
}
+ }
- sal_uInt16 uId = GetMenu()->Execute( pWin, tools::Rectangle( ImplGetPopupPosition( aMenuRect ), Size() ),
- PopupMenuFlags::ExecuteDown | PopupMenuFlags::NoMouseUpClose );
+ sal_uInt16 uId = GetMenu()->Execute( pWin, tools::Rectangle( ImplGetPopupPosition( aMenuRect ), Size() ),
+ PopupMenuFlags::ExecuteDown | PopupMenuFlags::NoMouseUpClose );
- if ( pWin->IsDisposed() )
+ if ( pWin->IsDisposed() )
+ return;
+
+ if( GetMenu() )
+ GetMenu()->RemoveEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
+ if( bBorderDel )
+ {
+ if( pBorderWin->IsDisposed() )
return;
+ }
- if( GetMenu() )
- GetMenu()->RemoveEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
- if( bBorderDel )
- {
- if( pBorderWin->IsDisposed() )
- return;
- }
+ pWin->Invalidate( aMenuRect );
- pWin->Invalidate( aMenuRect );
+ if( uId )
+ GrabFocusToDocument();
- if( uId )
- GrabFocusToDocument();
- }
}
void ToolBox::ExecuteCustomMenu( const tools::Rectangle& rRect )