[Libreoffice-commits] core.git: vcl/qa vcl/source vcl/unx vcl/workben
Noel Grandin
noel.grandin at collabora.co.uk
Wed Nov 15 11:14:21 UTC 2017
vcl/qa/cppunit/canvasbitmaptest.cxx | 51 -
vcl/source/app/help.cxx | 45 -
vcl/source/bitmap/BitmapProcessor.cxx | 99 +--
vcl/source/bitmap/BitmapTools.cxx | 57 -
vcl/source/control/button.cxx | 45 -
vcl/source/control/imgctrl.cxx | 41 -
vcl/source/control/imp_listbox.cxx | 79 +-
vcl/source/control/scrbar.cxx | 205 +++---
vcl/source/control/spinfld.cxx | 83 +-
vcl/source/edit/texteng.cxx | 71 +-
vcl/source/filter/wmf/emfwr.cxx | 400 ++++++------
vcl/source/filter/wmf/wmfwr.cxx | 73 +-
vcl/source/gdi/gdimtf.cxx | 963 +++++++++++++++----------------
vcl/source/gdi/pdfwriter_impl.cxx | 487 +++++++--------
vcl/source/gdi/pdfwriter_impl2.cxx | 307 ++++-----
vcl/source/gdi/print.cxx | 137 ++--
vcl/source/outdev/gradient.cxx | 123 ++-
vcl/source/outdev/transparent.cxx | 129 ++--
vcl/source/window/EnumContext.cxx | 108 +--
vcl/source/window/dialog.cxx | 85 +-
vcl/source/window/menubarwindow.cxx | 33 -
vcl/source/window/menufloatingwindow.cxx | 77 +-
vcl/source/window/mouse.cxx | 185 ++---
vcl/source/window/splitwin.cxx | 318 +++++-----
vcl/source/window/toolbox.cxx | 59 -
vcl/source/window/toolbox2.cxx | 77 +-
vcl/unx/generic/app/saldata.cxx | 35 -
vcl/unx/generic/app/saldisp.cxx | 91 +-
vcl/unx/generic/app/wmadaptor.cxx | 78 +-
vcl/unx/generic/dtrans/X11_selection.cxx | 116 +--
vcl/unx/generic/print/common_gfx.cxx | 133 ++--
vcl/unx/generic/print/genprnpsp.cxx | 45 -
vcl/unx/generic/window/salframe.cxx | 173 ++---
vcl/unx/gtk/gtkobject.cxx | 75 +-
vcl/unx/gtk/gtksalframe.cxx | 43 -
vcl/unx/gtk/salnativewidgets-gtk.cxx | 69 +-
vcl/unx/gtk3/gtk3gtkframe.cxx | 43 -
vcl/unx/gtk3/gtk3gtkinst.cxx | 71 +-
vcl/unx/gtk3/gtk3gtkobject.cxx | 73 +-
vcl/workben/svpclient.cxx | 47 -
40 files changed, 2742 insertions(+), 2687 deletions(-)
New commits:
commit 5b74eb68113d3721e1a3f9fa40024bf9b2a15f0c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Nov 15 10:18:43 2017 +0200
loplugin:flatten in vcl
Change-Id: I3527477277a9ae96eaf9fd068232f672da7c28c3
Reviewed-on: https://gerrit.libreoffice.org/44753
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index f8ad6160d256..7570f9c22672 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -207,34 +207,35 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"150th pixel is not white", 1.0, pRGBStart[150].Blue, 1E-12);
- if( nOriginalDepth > 8 )
- {
- uno::Sequence<rendering::ARGBColor> aARGBColor(1);
- uno::Sequence<rendering::RGBColor> aRGBColor(1);
- uno::Sequence<sal_Int8> aPixel3, aPixel4;
+ if( nOriginalDepth <= 8 )
+ return;
- const Color aCol(COL_GREEN);
- aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
- aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
- aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
- aARGBColor[0].Alpha = 1.0;
-
- aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
- aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
- aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
-
- aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
- aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
- CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually converted green pixel",
- bool(aPixel3 == aPixel4));
+ uno::Sequence<rendering::ARGBColor> aARGBColor(1);
+ uno::Sequence<rendering::RGBColor> aRGBColor(1);
+ uno::Sequence<sal_Int8> aPixel3, aPixel4;
- if( !aContainedBmpEx.IsTransparent() )
- {
- aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
- CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually RGB-converted green pixel",
- bool(aPixel3 == aPixel4));
- }
+ const Color aCol(COL_GREEN);
+ aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
+ aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+ aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
+ aARGBColor[0].Alpha = 1.0;
+
+ aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed());
+ aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen());
+ aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue());
+
+ aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor );
+ aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) );
+ CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually converted green pixel",
+ bool(aPixel3 == aPixel4));
+
+ if( !aContainedBmpEx.IsTransparent() )
+ {
+ aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
+ CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually RGB-converted green pixel",
+ bool(aPixel3 == aPixel4));
}
+
}
class TestBitmap : public cppu::WeakImplHelper< rendering::XIntegerReadOnlyBitmap,
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;
+ }
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list