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>
This commit is contained in:
parent
b4aa631867
commit
5b74eb6811
@ -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 )
|
||||
if( nOriginalDepth <= 8 )
|
||||
return;
|
||||
|
||||
uno::Sequence<rendering::ARGBColor> aARGBColor(1);
|
||||
uno::Sequence<rendering::RGBColor> aRGBColor(1);
|
||||
uno::Sequence<sal_Int8> 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() )
|
||||
{
|
||||
uno::Sequence<rendering::ARGBColor> aARGBColor(1);
|
||||
uno::Sequence<rendering::RGBColor> aRGBColor(1);
|
||||
uno::Sequence<sal_Int8> 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",
|
||||
aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor );
|
||||
CPPUNIT_ASSERT_MESSAGE( "Green pixel from bitmap mismatch with manually RGB-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,
|
||||
|
@ -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;
|
||||
if (pHelpWin || rHelpText.isEmpty())
|
||||
return;
|
||||
|
||||
pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle );
|
||||
pSVData->maHelpData.mpHelpWin = pHelpWin;
|
||||
pHelpWin->SetStatusText( rStatusText );
|
||||
pHelpWin->SetHelpArea( rHelpArea );
|
||||
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 );
|
||||
|
||||
// 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 )
|
||||
|
@ -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;
|
||||
aMapR[nX] = MinMax((nX + cR) / 2, 0, 255);
|
||||
aMapG[nX] = MinMax((nX + cG) / 2, 0, 255);
|
||||
aMapB[nX] = MinMax((nX + cB) / 2, 0, 255);
|
||||
}
|
||||
|
||||
const sal_uInt8 cR = aColor.GetRed();
|
||||
const sal_uInt8 cG = aColor.GetGreen();
|
||||
const sal_uInt8 cB = aColor.GetBlue();
|
||||
|
||||
for (nX = 0; nX < 256; ++nX)
|
||||
if (pWriteAccess->HasPalette())
|
||||
{
|
||||
for (sal_uInt16 i = 0, nCount = pWriteAccess->GetPaletteEntryCount(); i < nCount; i++)
|
||||
{
|
||||
aMapR[nX] = MinMax((nX + cR) / 2, 0, 255);
|
||||
aMapG[nX] = MinMax((nX + cG) / 2, 0, 255);
|
||||
aMapB[nX] = MinMax((nX + cB) / 2, 0, 255);
|
||||
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)
|
||||
{
|
||||
for (nY = 0; nY < nH; ++nY)
|
||||
{
|
||||
Scanline pScan = pWriteAccess->GetScanline(nY);
|
||||
|
||||
if (pWriteAccess->HasPalette())
|
||||
{
|
||||
for (sal_uInt16 i = 0, nCount = pWriteAccess->GetPaletteEntryCount(); i < nCount; i++)
|
||||
for (nX = 0; nX < nW; ++nX)
|
||||
{
|
||||
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)
|
||||
{
|
||||
for (nY = 0; nY < nH; ++nY)
|
||||
{
|
||||
Scanline pScan = pWriteAccess->GetScanline(nY);
|
||||
|
||||
for (nX = 0; nX < nW; ++nX)
|
||||
{
|
||||
*pScan = aMapB[*pScan]; pScan++;
|
||||
*pScan = aMapG[*pScan]; pScan++;
|
||||
*pScan = aMapR[*pScan]; pScan++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (nY = 0; nY < nH; ++nY)
|
||||
{
|
||||
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);
|
||||
}
|
||||
*pScan = aMapB[*pScan]; pScan++;
|
||||
*pScan = aMapG[*pScan]; pScan++;
|
||||
*pScan = aMapR[*pScan]; pScan++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (nY = 0; nY < nH; ++nY)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -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.X1 = 0;
|
||||
aRealRect.Y1 = 0;
|
||||
aRealRect.X2 = aRange.getMaxX() - aRange.getMinX();
|
||||
aRealRect.Y2 = aRange.getMaxY() - aRange.getMinY();
|
||||
|
||||
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));
|
||||
|
||||
if (xBitmap.is())
|
||||
{
|
||||
const css::uno::Reference<css::rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW);
|
||||
|
||||
if (xIntBmp.is())
|
||||
{
|
||||
rBitmapEx = vcl::unotools::bitmapExFromXBitmap(xIntBmp);
|
||||
}
|
||||
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();
|
||||
|
||||
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));
|
||||
|
||||
if (xBitmap.is())
|
||||
{
|
||||
const css::uno::Reference<css::rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW);
|
||||
|
||||
if (xIntBmp.is())
|
||||
{
|
||||
rBitmapEx = vcl::unotools::bitmapExFromXBitmap(xIntBmp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}} // end vcl::bitmap
|
||||
|
@ -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 )
|
||||
|
@ -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);
|
||||
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);
|
||||
|
||||
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 )
|
||||
|
@ -3043,55 +3043,56 @@ Size ImplListBoxFloatingWindow::CalcFloatSize()
|
||||
|
||||
void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking )
|
||||
{
|
||||
if( !IsInPopupMode() )
|
||||
if( IsInPopupMode() )
|
||||
return;
|
||||
|
||||
Size aFloatSz = CalcFloatSize();
|
||||
|
||||
SetSizePixel( aFloatSz );
|
||||
mpImplLB->SetSizePixel( GetOutputSizePixel() );
|
||||
|
||||
sal_Int32 nPos = mpImplLB->GetEntryList()->GetSelectedEntryPos( 0 );
|
||||
mnPopupModeStartSaveSelection = nPos;
|
||||
|
||||
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() )
|
||||
{
|
||||
Size aFloatSz = CalcFloatSize();
|
||||
|
||||
SetSizePixel( aFloatSz );
|
||||
mpImplLB->SetSizePixel( GetOutputSizePixel() );
|
||||
|
||||
sal_Int32 nPos = mpImplLB->GetEntryList()->GetSelectedEntryPos( 0 );
|
||||
mnPopupModeStartSaveSelection = nPos;
|
||||
|
||||
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 );
|
||||
|
||||
// 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();
|
||||
|
||||
if( pGrandparent->ImplIsAntiparallel() )
|
||||
pGrandparentOutDev->ReMirror( aRect );
|
||||
|
||||
// mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795
|
||||
StartPopupMode( aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::AllMouseButtonClose );
|
||||
|
||||
if( nPos != LISTBOX_ENTRY_NOTFOUND )
|
||||
mpImplLB->ShowProminentEntry( nPos );
|
||||
|
||||
if( bStartTracking )
|
||||
mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true );
|
||||
|
||||
if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
|
||||
mpImplLB->GetMainWindow()->GrabFocus();
|
||||
|
||||
mpImplLB->GetMainWindow()->ImplClearLayoutData();
|
||||
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 );
|
||||
|
||||
// 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();
|
||||
|
||||
if( pGrandparent->ImplIsAntiparallel() )
|
||||
pGrandparentOutDev->ReMirror( aRect );
|
||||
|
||||
// mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795
|
||||
StartPopupMode( aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::AllMouseButtonClose );
|
||||
|
||||
if( nPos != LISTBOX_ENTRY_NOTFOUND )
|
||||
mpImplLB->ShowProminentEntry( nPos );
|
||||
|
||||
if( bStartTracking )
|
||||
mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true );
|
||||
|
||||
if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
|
||||
mpImplLB->GetMainWindow()->GrabFocus();
|
||||
|
||||
mpImplLB->GetMainWindow()->ImplClearLayoutData();
|
||||
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -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;
|
||||
|
||||
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 (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
|
||||
{
|
||||
// rMEvt coordinates are in twips.
|
||||
Push(PushFlags::MAPMODE);
|
||||
EnableMapMode();
|
||||
MapMode aMapMode = GetMapMode();
|
||||
aMapMode.SetOrigin(Point(0, 0));
|
||||
SetMapMode(aMapMode);
|
||||
aPosPixel = LogicToPixel(rMEvt.GetPosPixel());
|
||||
Pop();
|
||||
nTrackFlags = StartTrackingFlags::ButtonRepeat;
|
||||
meScrollType = ScrollType::LineUp;
|
||||
}
|
||||
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() );
|
||||
|
||||
if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp,
|
||||
aControlRegion, rMousePos, bIsInside )?
|
||||
bIsInside:
|
||||
maBtn1Rect.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_BTN1_DISABLE) )
|
||||
{
|
||||
nTrackFlags = StartTrackingFlags::ButtonRepeat;
|
||||
meScrollType = ScrollType::LineUp;
|
||||
}
|
||||
nTrackFlags = StartTrackingFlags::ButtonRepeat;
|
||||
meScrollType = ScrollType::LineDown;
|
||||
}
|
||||
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) )
|
||||
{
|
||||
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) )
|
||||
{
|
||||
nTrackFlags = StartTrackingFlags::ButtonRepeat;
|
||||
|
||||
// HitTestNativeScrollbar, see remark at top of file
|
||||
if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper,
|
||||
maPage1Rect, rMousePos, bIsInside )?
|
||||
bIsInside:
|
||||
maPage1Rect.IsInside( rMousePos ) )
|
||||
if ( mnVisibleSize < mnMaxRange-mnMinRange )
|
||||
{
|
||||
nTrackFlags = StartTrackingFlags::NONE;
|
||||
meScrollType = ScrollType::Drag;
|
||||
|
||||
// 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 );
|
||||
nTrackFlags = StartTrackingFlags::ButtonRepeat;
|
||||
|
||||
if( bDragToMouse )
|
||||
ImplDragThumb( rMousePos );
|
||||
// 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 )
|
||||
|
@ -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) ) )
|
||||
if ( (nFlags & DrawFlags::NoControls ) || !( nFieldStyle & (WB_SPIN|WB_DROPDOWN) ) )
|
||||
return;
|
||||
|
||||
Point aPos = pDev->LogicToPixel( rPos );
|
||||
Size aSize = pDev->LogicToPixel( rSize );
|
||||
OutDevType eOutDevType = pDev->GetOutDevType();
|
||||
AllSettings aOldSettings = pDev->GetSettings();
|
||||
|
||||
pDev->Push();
|
||||
pDev->SetMapMode();
|
||||
|
||||
if (eOutDevType == OUTDEV_PRINTER)
|
||||
{
|
||||
Point aPos = pDev->LogicToPixel( rPos );
|
||||
Size aSize = pDev->LogicToPixel( rSize );
|
||||
OutDevType eOutDevType = pDev->GetOutDevType();
|
||||
AllSettings aOldSettings = pDev->GetSettings();
|
||||
|
||||
pDev->Push();
|
||||
pDev->SetMapMode();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
Color aButtonTextColor;
|
||||
if ((nFlags & DrawFlags::Mono) || (eOutDevType == OUTDEV_PRINTER))
|
||||
aButtonTextColor = Color( COL_BLACK );
|
||||
else
|
||||
aButtonTextColor = GetSettings().GetStyleSettings().GetButtonTextColor();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (GetStyle() & WB_SPIN)
|
||||
{
|
||||
ImplDrawSpinButton(*pDev, this, aUp, aDown, false, false);
|
||||
}
|
||||
|
||||
pDev->Pop();
|
||||
pDev->SetSettings(aOldSettings);
|
||||
StyleSettings aStyleSettings = aOldSettings.GetStyleSettings();
|
||||
aStyleSettings.SetFaceColor(COL_LIGHTGRAY);
|
||||
aStyleSettings.SetButtonTextColor(COL_BLACK);
|
||||
AllSettings aSettings(aOldSettings);
|
||||
aSettings.SetStyleSettings(aStyleSettings);
|
||||
pDev->SetSettings(aSettings);
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
Color aButtonTextColor;
|
||||
if ((nFlags & DrawFlags::Mono) || (eOutDevType == OUTDEV_PRINTER))
|
||||
aButtonTextColor = Color( COL_BLACK );
|
||||
else
|
||||
aButtonTextColor = GetSettings().GetStyleSettings().GetButtonTextColor();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (GetStyle() & WB_SPIN)
|
||||
{
|
||||
ImplDrawSpinButton(*pDev, this, aUp, aDown, false, false);
|
||||
}
|
||||
|
||||
pDev->Pop();
|
||||
pDev->SetSettings(aOldSettings);
|
||||
|
||||
}
|
||||
|
||||
FactoryFunction SpinField::GetUITestFactory() const
|
||||
|
@ -171,44 +171,45 @@ void TextEngine::SetActiveView( TextView* pTextView )
|
||||
|
||||
void TextEngine::SetFont( const vcl::Font& rFont )
|
||||
{
|
||||
if ( rFont != maFont )
|
||||
if ( rFont == maFont )
|
||||
return;
|
||||
|
||||
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();
|
||||
|
||||
FormatFullDoc();
|
||||
UpdateViews();
|
||||
|
||||
for ( auto nView = mpViews->size(); nView; )
|
||||
{
|
||||
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();
|
||||
|
||||
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 ) );
|
||||
}
|
||||
TextView* pView = (*mpViews)[ --nView ];
|
||||
pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TextEngine::SetMaxTextLen( sal_Int32 nLen )
|
||||
|
@ -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;
|
||||
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;
|
||||
}
|
||||
|
||||
ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW );
|
||||
m_rStm.WriteUInt32( mnTextHandle );
|
||||
ImplWriteExtent( -rFont.GetFontSize().Height() );
|
||||
ImplWriteExtent( rFont.GetFontSize().Width() );
|
||||
m_rStm.WriteInt32( rFont.GetOrientation() ).WriteInt32( rFont.GetOrientation() );
|
||||
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.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;
|
||||
}
|
||||
switch( rFont.GetPitch() )
|
||||
{
|
||||
case PITCH_FIXED: nPitchAndFamily = 0x01; break;
|
||||
case PITCH_VARIABLE: nPitchAndFamily = 0x02; break;
|
||||
default: nPitchAndFamily = 0x00; 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 );
|
||||
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.GetPitch() )
|
||||
{
|
||||
case PITCH_FIXED: nPitchAndFamily = 0x01; break;
|
||||
case PITCH_VARIABLE: nPitchAndFamily = 0x02; break;
|
||||
default: nPitchAndFamily = 0x00; break;
|
||||
}
|
||||
m_rStm.WriteUChar( nPitchAndFamily );
|
||||
|
||||
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;
|
||||
}
|
||||
for( i = 0; i < 32; i++ )
|
||||
m_rStm.WriteUInt16( ( i < aFontName.getLength() ) ? aFontName[ i ] : 0 );
|
||||
|
||||
m_rStm.WriteUChar( nPitchAndFamily );
|
||||
|
||||
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 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 elfVendorId
|
||||
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 );
|
||||
|
||||
// fill record to get a record size divideable by 4
|
||||
// dummy elfFullName
|
||||
for( i = 0; i < 64; i++ )
|
||||
m_rStm.WriteUInt16( 0 );
|
||||
|
||||
ImplEndRecord();
|
||||
// dummy elfStyle
|
||||
for( i = 0; i < 32; i++ )
|
||||
m_rStm.WriteUInt16( 0 );
|
||||
|
||||
// TextAlign
|
||||
sal_uInt32 nTextAlign;
|
||||
// dummy elfVersion, elfStyleSize, elfMatch, elfReserved
|
||||
m_rStm.WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ) ;
|
||||
|
||||
switch( rFont.GetAlignment() )
|
||||
{
|
||||
case ALIGN_TOP: nTextAlign = TA_TOP; break;
|
||||
case ALIGN_BOTTOM: nTextAlign = TA_BOTTOM; break;
|
||||
default: nTextAlign = TA_BASELINE; break;
|
||||
}
|
||||
nTextAlign |= mnHorTextAlign;
|
||||
// dummy elfVendorId
|
||||
m_rStm.WriteUInt32( 0 );
|
||||
|
||||
ImplBeginRecord( WIN_EMR_SETTEXTALIGN );
|
||||
m_rStm.WriteUInt32( nTextAlign );
|
||||
ImplEndRecord();
|
||||
// dummy elfCulture
|
||||
m_rStm.WriteUInt32( 0 );
|
||||
|
||||
// Text color
|
||||
ImplBeginRecord( WIN_EMR_SETTEXTCOLOR );
|
||||
ImplWriteColor( maVDev->GetTextColor() );
|
||||
ImplEndRecord();
|
||||
// dummy elfPanose
|
||||
m_rStm.WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 );
|
||||
|
||||
ImplBeginRecord( WIN_EMR_SELECTOBJECT );
|
||||
m_rStm.WriteUInt32( mnTextHandle );
|
||||
ImplEndRecord();
|
||||
// fill record to get a record size divideable by 4
|
||||
m_rStm.WriteUInt16( 0 );
|
||||
|
||||
ImplEndRecord();
|
||||
|
||||
// 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;
|
||||
|
||||
ImplBeginRecord( WIN_EMR_SETTEXTALIGN );
|
||||
m_rStm.WriteUInt32( nTextAlign );
|
||||
ImplEndRecord();
|
||||
|
||||
// Text color
|
||||
ImplBeginRecord( WIN_EMR_SETTEXTCOLOR );
|
||||
ImplWriteColor( maVDev->GetTextColor() );
|
||||
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 )
|
||||
if( !rBmp )
|
||||
return;
|
||||
|
||||
SvMemoryStream aMemStm( 65535, 65535 );
|
||||
const Size aBmpSizePixel( rBmp.GetSizePixel() );
|
||||
|
||||
ImplBeginRecord( WIN_EMR_STRETCHDIBITS );
|
||||
ImplWriteRect( tools::Rectangle( rPt, rSz ) );
|
||||
ImplWritePoint( rPt );
|
||||
m_rStm.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( aBmpSizePixel.Width() ).WriteInt32( aBmpSizePixel.Height() );
|
||||
|
||||
// write offset positions and sizes later
|
||||
const sal_uLong nOffPos = m_rStm.Tell();
|
||||
m_rStm.SeekRel( 16 );
|
||||
|
||||
m_rStm.WriteUInt32( 0 ).WriteInt32( ( RasterOp::Xor == maVDev->GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
|
||||
ImplWriteSize( rSz );
|
||||
|
||||
WriteDIB(rBmp, aMemStm, true, false);
|
||||
|
||||
sal_uInt32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
|
||||
sal_uInt16 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)
|
||||
{
|
||||
SvMemoryStream aMemStm( 65535, 65535 );
|
||||
const Size aBmpSizePixel( rBmp.GetSizePixel() );
|
||||
|
||||
ImplBeginRecord( WIN_EMR_STRETCHDIBITS );
|
||||
ImplWriteRect( tools::Rectangle( rPt, rSz ) );
|
||||
ImplWritePoint( rPt );
|
||||
m_rStm.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt32( aBmpSizePixel.Width() ).WriteInt32( aBmpSizePixel.Height() );
|
||||
|
||||
// write offset positions and sizes later
|
||||
const sal_uLong nOffPos = m_rStm.Tell();
|
||||
m_rStm.SeekRel( 16 );
|
||||
|
||||
m_rStm.WriteUInt32( 0 ).WriteInt32( ( RasterOp::Xor == maVDev->GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
|
||||
ImplWriteSize( rSz );
|
||||
|
||||
WriteDIB(rBmp, aMemStm, true, false);
|
||||
|
||||
sal_uInt32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
|
||||
sal_uInt16 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
|
||||
nPalCount = 1 << (sal_uInt32)nBitCount;
|
||||
}
|
||||
if (nColsUsed)
|
||||
nPalCount = nColsUsed;
|
||||
else
|
||||
{
|
||||
if (nCompression == BITFIELDS)
|
||||
nPalCount = 3;
|
||||
else
|
||||
nPalCount = 0;
|
||||
}
|
||||
|
||||
sal_uInt32 nPalSize = nPalCount * 4;
|
||||
|
||||
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 );
|
||||
|
||||
ImplEndRecord();
|
||||
nPalCount = 1 << (sal_uInt32)nBitCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nCompression == BITFIELDS)
|
||||
nPalCount = 3;
|
||||
else
|
||||
nPalCount = 0;
|
||||
}
|
||||
|
||||
sal_uInt32 nPalSize = nPalCount * 4;
|
||||
|
||||
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 );
|
||||
|
||||
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 )
|
||||
{
|
||||
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
|
||||
{
|
||||
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( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
|
||||
{
|
||||
const double fFactor = (double) nWidth / nNormWidth;
|
||||
|
||||
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
|
||||
for( i = 0; i < nLen; i++ )
|
||||
m_rStm.WriteUInt16( rText[ i ] );
|
||||
|
||||
// padding word
|
||||
if( nLen & 1 )
|
||||
m_rStm.WriteUInt16( 0 );
|
||||
|
||||
// write DX array
|
||||
ImplWriteExtent( pDX[ 0 ] );
|
||||
|
||||
if( nLen > 1 )
|
||||
{
|
||||
for( i = 1; i < ( nLen - 1 ); i++ )
|
||||
ImplWriteExtent( pDX[ i ] - pDX[ i - 1 ] );
|
||||
|
||||
ImplWriteExtent( pDX[ nLen - 2 ] / ( nLen - 1 ) );
|
||||
}
|
||||
|
||||
ImplEndRecord();
|
||||
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( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
|
||||
{
|
||||
const double fFactor = (double) nWidth / nNormWidth;
|
||||
|
||||
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
|
||||
for( i = 0; i < nLen; i++ )
|
||||
m_rStm.WriteUInt16( rText[ i ] );
|
||||
|
||||
// padding word
|
||||
if( nLen & 1 )
|
||||
m_rStm.WriteUInt16( 0 );
|
||||
|
||||
// write DX array
|
||||
ImplWriteExtent( pDX[ 0 ] );
|
||||
|
||||
if( nLen > 1 )
|
||||
{
|
||||
for( i = 1; i < ( nLen - 1 ); i++ )
|
||||
ImplWriteExtent( pDX[ i ] - pDX[ i - 1 ] );
|
||||
|
||||
ImplWriteExtent( pDX[ nLen - 2 ] / ( nLen - 1 ) );
|
||||
}
|
||||
|
||||
ImplEndRecord();
|
||||
|
||||
}
|
||||
|
||||
void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
|
||||
|
@ -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;
|
||||
|
||||
sal_uInt32 nPos = 0;
|
||||
|
||||
while( nPos + 1 < nTotalSize )
|
||||
{
|
||||
aStream.ReadUInt16( nWord );
|
||||
nCheckSum ^= nWord;
|
||||
nPos += 2;
|
||||
}
|
||||
|
||||
nCheckSum = static_cast< sal_uInt16 >( nCheckSum * -1 );
|
||||
|
||||
aStream.Seek( 0 );
|
||||
while( nRemainingSize > 0 )
|
||||
{
|
||||
sal_uInt32 nCurSize;
|
||||
if( nRemainingSize > 0x2000 )
|
||||
{
|
||||
nCurSize = 0x2000;
|
||||
nRemainingSize -= 0x2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
nCurSize = nRemainingSize;
|
||||
nRemainingSize = 0;
|
||||
}
|
||||
WriteEMFRecord( aStream,
|
||||
nCurSize,
|
||||
nRemainingSize,
|
||||
nTotalSize,
|
||||
nRecCounts,
|
||||
nCheckSum );
|
||||
nCheckSum = 0;
|
||||
}
|
||||
aStream.ReadUInt16( nWord );
|
||||
nCheckSum ^= nWord;
|
||||
nPos += 2;
|
||||
}
|
||||
|
||||
nCheckSum = static_cast< sal_uInt16 >( nCheckSum * -1 );
|
||||
|
||||
aStream.Seek( 0 );
|
||||
while( nRemainingSize > 0 )
|
||||
{
|
||||
sal_uInt32 nCurSize;
|
||||
if( nRemainingSize > 0x2000 )
|
||||
{
|
||||
nCurSize = 0x2000;
|
||||
nRemainingSize -= 0x2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
nCurSize = nRemainingSize;
|
||||
nRemainingSize = 0;
|
||||
}
|
||||
WriteEMFRecord( aStream,
|
||||
nCurSize,
|
||||
nRemainingSize,
|
||||
nTotalSize,
|
||||
nRecCounts,
|
||||
nCheckSum );
|
||||
nCheckSum = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void WMFWriter::WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize, sal_uInt32 nRemainingSize,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2254,64 +2254,65 @@ void PDFWriterImpl::newPage( double nPageWidth, double nPageHeight, PDFWriter::O
|
||||
|
||||
void PDFWriterImpl::endPage()
|
||||
{
|
||||
if( !m_aPages.empty() )
|
||||
if( m_aPages.empty() )
|
||||
return;
|
||||
|
||||
// close eventual MC sequence
|
||||
endStructureElementMCSeq();
|
||||
|
||||
// sanity check
|
||||
if( !m_aOutputStreams.empty() )
|
||||
{
|
||||
// close eventual MC sequence
|
||||
endStructureElementMCSeq();
|
||||
OSL_FAIL( "redirection across pages !!!" );
|
||||
m_aOutputStreams.clear(); // leak !
|
||||
m_aMapMode.SetOrigin( Point() );
|
||||
}
|
||||
|
||||
// sanity check
|
||||
if( !m_aOutputStreams.empty() )
|
||||
m_aGraphicsStack.clear();
|
||||
m_aGraphicsStack.emplace_back( );
|
||||
|
||||
// this should pop the PDF graphics stack if necessary
|
||||
updateGraphicsState();
|
||||
|
||||
m_aPages.back().endStream();
|
||||
|
||||
// reset the default font
|
||||
Font aFont;
|
||||
aFont.SetFamilyName( "Times" );
|
||||
aFont.SetFontSize( Size( 0, 12 ) );
|
||||
|
||||
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() )
|
||||
{
|
||||
OSL_FAIL( "redirection across pages !!!" );
|
||||
m_aOutputStreams.clear(); // leak !
|
||||
m_aMapMode.SetOrigin( Point() );
|
||||
}
|
||||
|
||||
m_aGraphicsStack.clear();
|
||||
m_aGraphicsStack.emplace_back( );
|
||||
|
||||
// this should pop the PDF graphics stack if necessary
|
||||
updateGraphicsState();
|
||||
|
||||
m_aPages.back().endStream();
|
||||
|
||||
// reset the default font
|
||||
Font aFont;
|
||||
aFont.SetFamilyName( "Times" );
|
||||
aFont.SetFontSize( Size( 0, 12 ) );
|
||||
|
||||
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() )
|
||||
{
|
||||
writeBitmapObject( *it );
|
||||
it->m_aBitmap = BitmapEx();
|
||||
}
|
||||
}
|
||||
for( std::list<JPGEmit>::iterator jpeg = m_aJPGs.begin(); jpeg != m_aJPGs.end(); ++jpeg )
|
||||
{
|
||||
if( jpeg->m_pStream )
|
||||
{
|
||||
writeJPG( *jpeg );
|
||||
jpeg->m_pStream.reset();
|
||||
jpeg->m_aMask = Bitmap();
|
||||
}
|
||||
}
|
||||
for( std::list<TransparencyEmit>::iterator t = m_aTransparentObjects.begin();
|
||||
t != m_aTransparentObjects.end(); ++t )
|
||||
{
|
||||
if( t->m_pContentStream )
|
||||
{
|
||||
writeTransparentObject( *t );
|
||||
delete t->m_pContentStream;
|
||||
t->m_pContentStream = nullptr;
|
||||
}
|
||||
writeBitmapObject( *it );
|
||||
it->m_aBitmap = BitmapEx();
|
||||
}
|
||||
}
|
||||
for( std::list<JPGEmit>::iterator jpeg = m_aJPGs.begin(); jpeg != m_aJPGs.end(); ++jpeg )
|
||||
{
|
||||
if( jpeg->m_pStream )
|
||||
{
|
||||
writeJPG( *jpeg );
|
||||
jpeg->m_pStream.reset();
|
||||
jpeg->m_aMask = Bitmap();
|
||||
}
|
||||
}
|
||||
for( std::list<TransparencyEmit>::iterator t = m_aTransparentObjects.begin();
|
||||
t != m_aTransparentObjects.end(); ++t )
|
||||
{
|
||||
if( t->m_pContentStream )
|
||||
{
|
||||
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 )
|
||||
if( !(m_aCurrentPDFState.m_aFont.GetEmphasisMark() & FontEmphasisMark::Style) )
|
||||
return;
|
||||
|
||||
tools::PolyPolygon aEmphPoly;
|
||||
tools::Rectangle aEmphRect1;
|
||||
tools::Rectangle aEmphRect2;
|
||||
long nEmphYOff;
|
||||
long nEmphWidth;
|
||||
long nEmphHeight;
|
||||
bool bEmphPolyLine;
|
||||
FontEmphasisMark nEmphMark;
|
||||
|
||||
push( PushFlags::ALL );
|
||||
|
||||
aLine.setLength( 0 );
|
||||
aLine.append( "q\n" );
|
||||
|
||||
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 )
|
||||
{
|
||||
tools::PolyPolygon aEmphPoly;
|
||||
tools::Rectangle aEmphRect1;
|
||||
tools::Rectangle aEmphRect2;
|
||||
long nEmphYOff;
|
||||
long nEmphWidth;
|
||||
long nEmphHeight;
|
||||
bool bEmphPolyLine;
|
||||
FontEmphasisMark nEmphMark;
|
||||
|
||||
push( PushFlags::ALL );
|
||||
|
||||
aLine.setLength( 0 );
|
||||
aLine.append( "q\n" );
|
||||
|
||||
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() );
|
||||
|
||||
Point aOffset = Point(0,0);
|
||||
|
||||
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();
|
||||
|
||||
Point aPos;
|
||||
const GlyphItem* pGlyph;
|
||||
int nStart = 0;
|
||||
while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
|
||||
{
|
||||
if (pGlyph->IsSpacing())
|
||||
{
|
||||
Point aAdjOffset = aOffset;
|
||||
aAdjOffset.X() += (pGlyph->mnNewWidth - nEmphWidth) / 2;
|
||||
aAdjOffset = aRotScale.transform( aAdjOffset );
|
||||
|
||||
aAdjOffset -= Point( nEmphWidth2, nEmphHeight2 );
|
||||
|
||||
aPos += aAdjOffset;
|
||||
aPos = m_pReferenceDevice->PixelToLogic( aPos );
|
||||
drawEmphasisMark( aPos.X(), aPos.Y(),
|
||||
aEmphPoly, bEmphPolyLine,
|
||||
aEmphRect1, aEmphRect2 );
|
||||
}
|
||||
}
|
||||
|
||||
writeBuffer( "Q\n", 2 );
|
||||
pop();
|
||||
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() );
|
||||
|
||||
Point aOffset = Point(0,0);
|
||||
|
||||
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();
|
||||
|
||||
Point aPos;
|
||||
const GlyphItem* pGlyph;
|
||||
int nStart = 0;
|
||||
while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
|
||||
{
|
||||
if (pGlyph->IsSpacing())
|
||||
{
|
||||
Point aAdjOffset = aOffset;
|
||||
aAdjOffset.X() += (pGlyph->mnNewWidth - nEmphWidth) / 2;
|
||||
aAdjOffset = aRotScale.transform( aAdjOffset );
|
||||
|
||||
aAdjOffset -= Point( nEmphWidth2, nEmphHeight2 );
|
||||
|
||||
aPos += aAdjOffset;
|
||||
aPos = m_pReferenceDevice->PixelToLogic( aPos );
|
||||
drawEmphasisMark( aPos.X(), aPos.Y(),
|
||||
aEmphPoly, bEmphPolyLine,
|
||||
aEmphRect1, aEmphRect2 );
|
||||
}
|
||||
}
|
||||
|
||||
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( (sal_Int32)nLineHeight, aLine, false );
|
||||
m_aPages.back().appendMappedLength( nDashLength, 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_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;
|
||||
}
|
||||
|
||||
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();
|
||||
if( !(m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4) )
|
||||
return;
|
||||
|
||||
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() );
|
||||
// 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 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() );
|
||||
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 )
|
||||
|
@ -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 );
|
||||
aSize.Width() *= -1;
|
||||
aPoint.X() -= aSize.Width();
|
||||
nMirrorFlags |= BmpMirrorFlags::Horizontal;
|
||||
}
|
||||
if( aSize.Height() < 0 )
|
||||
{
|
||||
aSize.Height() *= -1;
|
||||
aPoint.Y() -= aSize.Height();
|
||||
nMirrorFlags |= BmpMirrorFlags::Vertical;
|
||||
}
|
||||
|
||||
// #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;
|
||||
}
|
||||
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 )
|
||||
{
|
||||
// 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;
|
||||
|
||||
if( i_rContext.m_nMaxImageResolution > 50 )
|
||||
// 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;
|
||||
// do scaling
|
||||
Size aNewBmpSize;
|
||||
const double fBmpWH = fBmpPixelX / fBmpPixelY;
|
||||
const double fMaxWH = fMaxPixelX / fMaxPixelY;
|
||||
|
||||
// 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 ) )
|
||||
if( fBmpWH < fMaxWH )
|
||||
{
|
||||
// do scaling
|
||||
Size aNewBmpSize;
|
||||
const double fBmpWH = fBmpPixelX / fBmpPixelY;
|
||||
const double fMaxWH = fMaxPixelX / fMaxPixelY;
|
||||
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 );
|
||||
}
|
||||
const Size aSizePixel( aBitmapEx.GetSizePixel() );
|
||||
if ( aSizePixel.Width() && aSizePixel.Height() )
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
aBitmapEx.SetEmpty();
|
||||
}
|
||||
aMask = aBitmapEx.GetMask();
|
||||
}
|
||||
}
|
||||
Graphic aGraphic( aBitmapEx.GetBitmap() );
|
||||
|
||||
const Size aSizePixel( aBitmapEx.GetSizePixel() );
|
||||
if ( aSizePixel.Width() && aSizePixel.Height() )
|
||||
{
|
||||
if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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();
|
||||
}
|
||||
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
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
bTrueColorJPG = nBitsPerPixel != 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
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 )
|
||||
|
@ -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;
|
||||
|
||||
if( aMask.GetBitCount() > 1 )
|
||||
aMask.Convert( BmpConversion::N1BitThreshold );
|
||||
|
||||
// mirrored horizontically
|
||||
if( aDestSz.Width() < 0 )
|
||||
{
|
||||
aDestSz.Width() = -aDestSz.Width();
|
||||
aDestPt.X() -= ( aDestSz.Width() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Horizontal;
|
||||
}
|
||||
|
||||
// mirrored vertically
|
||||
if( aDestSz.Height() < 0 )
|
||||
{
|
||||
aDestSz.Height() = -aDestSz.Height();
|
||||
aDestPt.Y() -= ( aDestSz.Height() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Vertical;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
DrawRect(tools::Rectangle(aMapPt, aMapSz));
|
||||
}
|
||||
|
||||
Pop();
|
||||
delete[] pMapX;
|
||||
delete[] pMapY;
|
||||
mbMap = bOldMap;
|
||||
mpMetaFile = pOldMetaFile;
|
||||
aDestSz.Width() = -aDestSz.Width();
|
||||
aDestPt.X() -= ( aDestSz.Width() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Horizontal;
|
||||
}
|
||||
|
||||
// mirrored vertically
|
||||
if( aDestSz.Height() < 0 )
|
||||
{
|
||||
aDestSz.Height() = -aDestSz.Height();
|
||||
aDestPt.Y() -= ( aDestSz.Height() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Vertical;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
DrawRect(tools::Rectangle(aMapPt, aMapSz));
|
||||
}
|
||||
|
||||
Pop();
|
||||
delete[] pMapX;
|
||||
delete[] pMapY;
|
||||
mbMap = bOldMap;
|
||||
mpMetaFile = pOldMetaFile;
|
||||
|
||||
}
|
||||
|
||||
SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
|
||||
|
@ -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;
|
||||
if ( aRect.IsEmpty() )
|
||||
return;
|
||||
|
||||
mpMetaFile = &rMtf;
|
||||
mpMetaFile->AddAction( new MetaPushAction( PushFlags::ALL ) );
|
||||
mpMetaFile->AddAction( new MetaISectRectClipRegionAction( aRect ) );
|
||||
mpMetaFile->AddAction( new MetaLineColorAction( Color(), false ) );
|
||||
Gradient aGradient( rGradient );
|
||||
GDIMetaFile* pOldMtf = mpMetaFile;
|
||||
|
||||
// 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()++;
|
||||
mpMetaFile = &rMtf;
|
||||
mpMetaFile->AddAction( new MetaPushAction( PushFlags::ALL ) );
|
||||
mpMetaFile->AddAction( new MetaISectRectClipRegionAction( aRect ) );
|
||||
mpMetaFile->AddAction( new MetaLineColorAction( Color(), false ) );
|
||||
|
||||
// calculate step count if necessary
|
||||
if ( !aGradient.GetSteps() )
|
||||
aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
|
||||
// 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()++;
|
||||
|
||||
if( aGradient.GetStyle() == GradientStyle::Linear || aGradient.GetStyle() == GradientStyle::Axial )
|
||||
DrawLinearGradientToMetafile( aRect, aGradient );
|
||||
else
|
||||
DrawComplexGradientToMetafile( aRect, aGradient );
|
||||
// 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: */
|
||||
|
@ -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() )
|
||||
if( rBmp.IsEmpty() || !aSrcRect.GetWidth() || !aSrcRect.GetHeight() || !aDestSz.Width() || !aDestSz.Height() )
|
||||
return;
|
||||
|
||||
Bitmap aPaint( rBmp ), aMask( rMask );
|
||||
BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
|
||||
|
||||
if( aMask.GetBitCount() > 1 )
|
||||
aMask.Convert( BmpConversion::N1BitThreshold );
|
||||
|
||||
// mirrored horizontically
|
||||
if( aDestSz.Width() < 0 )
|
||||
{
|
||||
Bitmap aPaint( rBmp ), aMask( rMask );
|
||||
BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
|
||||
|
||||
if( aMask.GetBitCount() > 1 )
|
||||
aMask.Convert( BmpConversion::N1BitThreshold );
|
||||
|
||||
// mirrored horizontically
|
||||
if( aDestSz.Width() < 0 )
|
||||
{
|
||||
aDestSz.Width() = -aDestSz.Width();
|
||||
aDestPt.X() -= ( aDestSz.Width() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Horizontal;
|
||||
}
|
||||
|
||||
// mirrored vertically
|
||||
if( aDestSz.Height() < 0 )
|
||||
{
|
||||
aDestSz.Height() = -aDestSz.Height();
|
||||
aDestPt.Y() -= ( aDestSz.Height() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Vertical;
|
||||
}
|
||||
|
||||
// source cropped?
|
||||
if( aSrcRect != tools::Rectangle( Point(), aPaint.GetSizePixel() ) )
|
||||
{
|
||||
aPaint.Crop( aSrcRect );
|
||||
aMask.Crop( aSrcRect );
|
||||
}
|
||||
|
||||
// destination mirrored
|
||||
if( nMirrFlags != BmpMirrorFlags::NONE )
|
||||
{
|
||||
aPaint.Mirror( nMirrFlags );
|
||||
aMask.Mirror( nMirrFlags );
|
||||
}
|
||||
|
||||
// we always want to have a mask
|
||||
if( aMask.IsEmpty() )
|
||||
{
|
||||
aMask = Bitmap( aSrcRect.GetSize(), 1 );
|
||||
aMask.Erase( Color( COL_BLACK ) );
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
mbMap = false;
|
||||
|
||||
// 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
|
||||
Bitmap aBandBmp(aPaint);
|
||||
|
||||
aBandBmp.Crop(*aRectIter);
|
||||
DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
|
||||
}
|
||||
|
||||
mbMap = bOldMap;
|
||||
aDestSz.Width() = -aDestSz.Width();
|
||||
aDestPt.X() -= ( aDestSz.Width() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Horizontal;
|
||||
}
|
||||
|
||||
// mirrored vertically
|
||||
if( aDestSz.Height() < 0 )
|
||||
{
|
||||
aDestSz.Height() = -aDestSz.Height();
|
||||
aDestPt.Y() -= ( aDestSz.Height() - 1 );
|
||||
nMirrFlags |= BmpMirrorFlags::Vertical;
|
||||
}
|
||||
|
||||
// source cropped?
|
||||
if( aSrcRect != tools::Rectangle( Point(), aPaint.GetSizePixel() ) )
|
||||
{
|
||||
aPaint.Crop( aSrcRect );
|
||||
aMask.Crop( aSrcRect );
|
||||
}
|
||||
|
||||
// destination mirrored
|
||||
if( nMirrFlags != BmpMirrorFlags::NONE )
|
||||
{
|
||||
aPaint.Mirror( nMirrFlags );
|
||||
aMask.Mirror( nMirrFlags );
|
||||
}
|
||||
|
||||
// we always want to have a mask
|
||||
if( aMask.IsEmpty() )
|
||||
{
|
||||
aMask = Bitmap( aSrcRect.GetSize(), 1 );
|
||||
aMask.Erase( Color( COL_BLACK ) );
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
mbMap = false;
|
||||
|
||||
// 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
|
||||
Bitmap aBandBmp(aPaint);
|
||||
|
||||
aBandBmp.Crop(*aRectIter);
|
||||
DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
|
||||
}
|
||||
|
||||
mbMap = bOldMap;
|
||||
|
||||
}
|
||||
|
||||
// Caution: This method is nearly the same as
|
||||
|
@ -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);
|
||||
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);
|
||||
|
||||
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)
|
||||
|
@ -1102,59 +1102,60 @@ void Dialog::StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl )
|
||||
|
||||
void Dialog::EndDialog( long nResult )
|
||||
{
|
||||
if ( mbInExecute )
|
||||
if ( !mbInExecute )
|
||||
return;
|
||||
|
||||
SetModalInputMode(false);
|
||||
|
||||
// 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 )
|
||||
{
|
||||
vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
|
||||
vcl::Window* pPrevFrameParent = mpPrevExecuteDlg->ImplGetFrameWindow()->ImplGetParent();
|
||||
if( ( !pFrameParent && !pPrevFrameParent ) ||
|
||||
( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
|
||||
)
|
||||
{
|
||||
mpPrevExecuteDlg->GrabFocus();
|
||||
}
|
||||
}
|
||||
mpPrevExecuteDlg = nullptr;
|
||||
|
||||
Hide();
|
||||
if ( GetParent() )
|
||||
{
|
||||
NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
|
||||
GetParent()->CompatNotify( aNEvt );
|
||||
}
|
||||
|
||||
mpDialogImpl->mnResult = nResult;
|
||||
|
||||
if ( mpDialogImpl->mbStartedModal )
|
||||
{
|
||||
ImplEndExecuteModal();
|
||||
if (mpDialogImpl->maEndDialogHdl.IsSet())
|
||||
{
|
||||
mpDialogImpl->maEndDialogHdl.Call( *this );
|
||||
mpDialogImpl->maEndDialogHdl = Link<Dialog&,void>();
|
||||
}
|
||||
mpDialogImpl->mbStartedModal = false;
|
||||
mpDialogImpl->mnResult = -1;
|
||||
}
|
||||
mbInExecute = false;
|
||||
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() )
|
||||
)
|
||||
{
|
||||
mpPrevExecuteDlg->GrabFocus();
|
||||
}
|
||||
}
|
||||
mpPrevExecuteDlg = nullptr;
|
||||
|
||||
Hide();
|
||||
if ( GetParent() )
|
||||
{
|
||||
NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
|
||||
GetParent()->CompatNotify( aNEvt );
|
||||
}
|
||||
|
||||
mpDialogImpl->mnResult = nResult;
|
||||
|
||||
if ( mpDialogImpl->mbStartedModal )
|
||||
{
|
||||
ImplEndExecuteModal();
|
||||
if (mpDialogImpl->maEndDialogHdl.IsSet())
|
||||
{
|
||||
mpDialogImpl->maEndDialogHdl.Call( *this );
|
||||
mpDialogImpl->maEndDialogHdl = Link<Dialog&,void>();
|
||||
}
|
||||
mpDialogImpl->mbStartedModal = false;
|
||||
mpDialogImpl->mnResult = -1;
|
||||
}
|
||||
mbInExecute = false;
|
||||
|
||||
}
|
||||
|
||||
long Dialog::GetResult() const
|
||||
|
@ -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 ) :
|
||||
|
@ -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()
|
||||
|
@ -275,118 +275,119 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
|
||||
pParent = pParent->mpWindowImpl->mpParent;
|
||||
}
|
||||
|
||||
if ( ( pSVData->maWinData.mpFocusWin.get() != this &&
|
||||
!mpWindowImpl->mbInDispose ) ||
|
||||
( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus ) )
|
||||
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;
|
||||
|
||||
if( !bHasFocus )
|
||||
{
|
||||
// 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;
|
||||
|
||||
if( !bHasFocus )
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
VclPtr<vcl::Window> pOldFocusWindow = pSVData->maWinData.mpFocusWin;
|
||||
|
||||
pSVData->maWinData.mpFocusWin = this;
|
||||
|
||||
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 );
|
||||
}
|
||||
// menu windows never get the system focus
|
||||
// the application will keep the focus
|
||||
if( bMustNotGrabFocus )
|
||||
return;
|
||||
else
|
||||
{
|
||||
vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
|
||||
vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
|
||||
pNewOverlapWindow->mpWindowImpl->mbActive = true;
|
||||
pNewOverlapWindow->Activate();
|
||||
if ( pNewRealWindow != pNewOverlapWindow )
|
||||
{
|
||||
pNewRealWindow->mpWindowImpl->mbActive = true;
|
||||
pNewRealWindow->Activate();
|
||||
}
|
||||
// here we already switch focus as ToTop()
|
||||
// should not give focus to another window
|
||||
mpWindowImpl->mpFrame->ToTop( SalFrameToTop::GrabFocus | SalFrameToTop::GrabFocusOnly );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// call Get- and LoseFocus
|
||||
if ( pOldFocusWindow && ! pOldFocusWindow->IsDisposed() )
|
||||
VclPtr<vcl::Window> pOldFocusWindow = pSVData->maWinData.mpFocusWin;
|
||||
|
||||
pSVData->maWinData.mpFocusWin = this;
|
||||
|
||||
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
|
||||
{
|
||||
vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
|
||||
vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
|
||||
pNewOverlapWindow->mpWindowImpl->mbActive = true;
|
||||
pNewOverlapWindow->Activate();
|
||||
if ( pNewRealWindow != pNewOverlapWindow )
|
||||
{
|
||||
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 );
|
||||
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 );
|
||||
}
|
||||
|
||||
if ( pSVData->maWinData.mpFocusWin.get() == this )
|
||||
{
|
||||
if ( mpWindowImpl->mpSysObj )
|
||||
{
|
||||
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 )
|
||||
|
@ -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;
|
||||
|
||||
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;
|
||||
Size aSize = GetParent()->GetOutputSizePixel();
|
||||
if ( mbHorz )
|
||||
nCurMaxSize = aSize.Height();
|
||||
else
|
||||
nCurMaxSize = aSize.Width();
|
||||
}
|
||||
|
||||
if ( !mpSplitSet->mpItems.empty() )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
Size aSize = GetParent()->GetOutputSizePixel();
|
||||
if ( mbHorz )
|
||||
nCurMaxSize = aSize.Height();
|
||||
if ( bDown )
|
||||
maDragRect.Right() += mpSplitSet->mnSplitSize;
|
||||
else
|
||||
nCurMaxSize = aSize.Width();
|
||||
}
|
||||
|
||||
if ( !mpSplitSet->mpItems.empty() )
|
||||
{
|
||||
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
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Bottom() += mpSplitSet->mnSplitSize;
|
||||
else
|
||||
maDragRect.Top() -= mpSplitSet->mnSplitSize;
|
||||
}
|
||||
|
||||
if ( mnSplitPos )
|
||||
{
|
||||
long nTemp = mnSplitPos;
|
||||
while ( nTemp )
|
||||
{
|
||||
pSplitItem = mpSplitSet->mpItems[nTemp-1];
|
||||
if ( pSplitItem->mbFixed )
|
||||
break;
|
||||
else
|
||||
{
|
||||
if ( mnSplitTest & SPLIT_HORZ )
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Left() -= pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Right() += pSplitItem->mnPixSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Top() -= pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Bottom() += pSplitItem->mnPixSize;
|
||||
}
|
||||
}
|
||||
nTemp--;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
|
||||
{
|
||||
if ( bDown )
|
||||
{
|
||||
if ( mbHorz )
|
||||
maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
|
||||
else
|
||||
maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
if ( mnSplitTest & SPLIT_HORZ )
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Right() += pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Left() -= pSplitItem->mnPixSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Bottom() += pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Top() -= pSplitItem->mnPixSize;
|
||||
}
|
||||
}
|
||||
nTemp++;
|
||||
}
|
||||
}
|
||||
maDragRect.Left() -= mpSplitSet->mnSplitSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
maDragRect.Left() = mnLeftBorder;
|
||||
maDragRect.Top() = mnTopBorder;
|
||||
maDragRect.Right() = mnDX-mnRightBorder-1;
|
||||
maDragRect.Bottom() = mnDY-mnBottomBorder-1;
|
||||
if ( mbHorz )
|
||||
if ( bDown )
|
||||
maDragRect.Bottom() += mpSplitSet->mnSplitSize;
|
||||
else
|
||||
maDragRect.Top() -= mpSplitSet->mnSplitSize;
|
||||
}
|
||||
|
||||
if ( mnSplitPos )
|
||||
{
|
||||
long nTemp = mnSplitPos;
|
||||
while ( nTemp )
|
||||
{
|
||||
if ( mbBottomRight )
|
||||
maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
|
||||
pSplitItem = mpSplitSet->mpItems[nTemp-1];
|
||||
if ( pSplitItem->mbFixed )
|
||||
break;
|
||||
else
|
||||
{
|
||||
if ( mnSplitTest & SPLIT_HORZ )
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Left() -= pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Right() += pSplitItem->mnPixSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Top() -= pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Bottom() += pSplitItem->mnPixSize;
|
||||
}
|
||||
}
|
||||
nTemp--;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
|
||||
{
|
||||
if ( bDown )
|
||||
{
|
||||
if ( mbHorz )
|
||||
maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mbBottomRight )
|
||||
maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
|
||||
else
|
||||
maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
|
||||
}
|
||||
}
|
||||
|
||||
StartTracking();
|
||||
|
||||
mbDragFull = bool(GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Split);
|
||||
|
||||
ImplSplitMousePos( aMousePosPixel );
|
||||
|
||||
if (!mbDragFull)
|
||||
{
|
||||
ImplDrawSplitTracking(aMousePosPixel);
|
||||
else
|
||||
{
|
||||
if ( mbHorz )
|
||||
maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
|
||||
else
|
||||
maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
|
||||
}
|
||||
}
|
||||
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 *>::size_type nTemp = mnSplitPos+1;
|
||||
while ( nTemp < mpSplitSet->mpItems.size() )
|
||||
{
|
||||
mpLastSizes[i*2] = rItems[i]->mnSize;
|
||||
mpLastSizes[i*2+1] = rItems[i]->mnPixSize;
|
||||
pSplitItem = mpSplitSet->mpItems[nTemp];
|
||||
if ( pSplitItem->mbFixed )
|
||||
break;
|
||||
else
|
||||
{
|
||||
if ( mnSplitTest & SPLIT_HORZ )
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Right() += pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Left() -= pSplitItem->mnPixSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( bDown )
|
||||
maDragRect.Bottom() += pSplitItem->mnPixSize;
|
||||
else
|
||||
maDragRect.Top() -= pSplitItem->mnPixSize;
|
||||
}
|
||||
}
|
||||
nTemp++;
|
||||
}
|
||||
}
|
||||
mnMStartPos = mnMSplitPos;
|
||||
|
||||
PointerStyle eStyle = PointerStyle::Arrow;
|
||||
if ( mnSplitTest & SPLIT_HORZ )
|
||||
eStyle = PointerStyle::HSplit;
|
||||
else if ( mnSplitTest & SPLIT_VERT )
|
||||
eStyle = PointerStyle::VSplit;
|
||||
|
||||
Pointer aPtr( eStyle );
|
||||
SetPointer( aPtr );
|
||||
}
|
||||
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
|
||||
{
|
||||
if ( mbBottomRight )
|
||||
maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
|
||||
else
|
||||
maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
|
||||
}
|
||||
}
|
||||
|
||||
StartTracking();
|
||||
|
||||
mbDragFull = bool(GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Split);
|
||||
|
||||
ImplSplitMousePos( aMousePosPixel );
|
||||
|
||||
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++ )
|
||||
{
|
||||
mpLastSizes[i*2] = rItems[i]->mnSize;
|
||||
mpLastSizes[i*2+1] = rItems[i]->mnPixSize;
|
||||
}
|
||||
}
|
||||
mnMStartPos = mnMSplitPos;
|
||||
|
||||
PointerStyle eStyle = PointerStyle::Arrow;
|
||||
if ( mnSplitTest & SPLIT_HORZ )
|
||||
eStyle = PointerStyle::HSplit;
|
||||
else if ( mnSplitTest & SPLIT_VERT )
|
||||
eStyle = PointerStyle::VSplit;
|
||||
|
||||
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() )
|
||||
if ( IsTracking() )
|
||||
return;
|
||||
|
||||
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 ) )
|
||||
{
|
||||
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 )
|
||||
|
@ -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;
|
||||
if ( pItem->maRect.IsEmpty() )
|
||||
return;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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 )
|
||||
|
@ -1663,56 +1663,57 @@ IMPL_LINK( ToolBox, ImplCustomMenuListener, VclMenuEvent&, rEvent, void )
|
||||
IMPL_LINK_NOARG(ToolBox, ImplCallExecuteCustomMenu, void*, void)
|
||||
{
|
||||
mpData->mnEventId = nullptr;
|
||||
if( IsMenuEnabled() )
|
||||
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 ) );
|
||||
|
||||
// make sure all disabled entries will be shown
|
||||
GetMenu()->SetMenuFlags(
|
||||
GetMenu()->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
|
||||
|
||||
// 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() )
|
||||
{
|
||||
if( GetMenuType() & ToolBoxMenuType::Customize )
|
||||
// call button handler to allow for menu customization
|
||||
mpData->maMenuButtonHdl.Call( this );
|
||||
|
||||
GetMenu()->AddEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
|
||||
|
||||
// make sure all disabled entries will be shown
|
||||
GetMenu()->SetMenuFlags(
|
||||
GetMenu()->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
|
||||
|
||||
// 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() )
|
||||
// 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 );
|
||||
|
||||
if ( pWin->IsDisposed() )
|
||||
return;
|
||||
|
||||
if( GetMenu() )
|
||||
GetMenu()->RemoveEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
|
||||
if( bBorderDel )
|
||||
{
|
||||
if( pBorderWin->IsDisposed() )
|
||||
return;
|
||||
}
|
||||
|
||||
pWin->Invalidate( aMenuRect );
|
||||
|
||||
if( uId )
|
||||
GrabFocusToDocument();
|
||||
}
|
||||
|
||||
sal_uInt16 uId = GetMenu()->Execute( pWin, tools::Rectangle( ImplGetPopupPosition( aMenuRect ), Size() ),
|
||||
PopupMenuFlags::ExecuteDown | PopupMenuFlags::NoMouseUpClose );
|
||||
|
||||
if ( pWin->IsDisposed() )
|
||||
return;
|
||||
|
||||
if( GetMenu() )
|
||||
GetMenu()->RemoveEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
|
||||
if( bBorderDel )
|
||||
{
|
||||
if( pBorderWin->IsDisposed() )
|
||||
return;
|
||||
}
|
||||
|
||||
pWin->Invalidate( aMenuRect );
|
||||
|
||||
if( uId )
|
||||
GrabFocusToDocument();
|
||||
|
||||
}
|
||||
|
||||
void ToolBox::ExecuteCustomMenu( const tools::Rectangle& rRect )
|
||||
|
@ -440,23 +440,24 @@ void SalXLib::Init()
|
||||
OString aDisplay;
|
||||
m_pDisplay = OpenX11Display(aDisplay);
|
||||
|
||||
if ( !m_pDisplay )
|
||||
{
|
||||
OUString aProgramFileURL;
|
||||
osl_getExecutableFile( &aProgramFileURL.pData );
|
||||
OUString aProgramSystemPath;
|
||||
osl_getSystemPathFromFileURL (aProgramFileURL.pData, &aProgramSystemPath.pData);
|
||||
OString aProgramName = OUStringToOString(
|
||||
aProgramSystemPath,
|
||||
osl_getThreadTextEncoding() );
|
||||
std::fprintf( stderr, "%s X11 error: Can't open display: %s\n",
|
||||
aProgramName.getStr(), aDisplay.getStr());
|
||||
std::fprintf( stderr, " Set DISPLAY environment variable, use -display option\n");
|
||||
std::fprintf( stderr, " or check permissions of your X-Server\n");
|
||||
std::fprintf( stderr, " (See \"man X\" resp. \"man xhost\" for details)\n");
|
||||
std::fflush( stderr );
|
||||
exit(0);
|
||||
}
|
||||
if ( m_pDisplay )
|
||||
return;
|
||||
|
||||
OUString aProgramFileURL;
|
||||
osl_getExecutableFile( &aProgramFileURL.pData );
|
||||
OUString aProgramSystemPath;
|
||||
osl_getSystemPathFromFileURL (aProgramFileURL.pData, &aProgramSystemPath.pData);
|
||||
OString aProgramName = OUStringToOString(
|
||||
aProgramSystemPath,
|
||||
osl_getThreadTextEncoding() );
|
||||
std::fprintf( stderr, "%s X11 error: Can't open display: %s\n",
|
||||
aProgramName.getStr(), aDisplay.getStr());
|
||||
std::fprintf( stderr, " Set DISPLAY environment variable, use -display option\n");
|
||||
std::fprintf( stderr, " or check permissions of your X-Server\n");
|
||||
std::fprintf( stderr, " (See \"man X\" resp. \"man xhost\" for details)\n");
|
||||
std::fflush( stderr );
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
@ -2525,51 +2525,52 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap,
|
||||
|
||||
m_nUsed = 1 << m_aVisual.GetDepth();
|
||||
|
||||
if( m_aVisual.GetClass() == PseudoColor )
|
||||
{
|
||||
int r, g, b;
|
||||
if( m_aVisual.GetClass() != PseudoColor )
|
||||
return;
|
||||
|
||||
// black, white, gray, ~gray = 4
|
||||
GetXPixels( aColor, 0xC0, 0xC0, 0xC0 );
|
||||
int r, g, b;
|
||||
|
||||
// light colors: 3 * 2 = 6
|
||||
// black, white, gray, ~gray = 4
|
||||
GetXPixels( aColor, 0xC0, 0xC0, 0xC0 );
|
||||
|
||||
GetXPixels( aColor, 0x00, 0x00, 0xFF );
|
||||
GetXPixels( aColor, 0x00, 0xFF, 0x00 );
|
||||
GetXPixels( aColor, 0x00, 0xFF, 0xFF );
|
||||
// light colors: 3 * 2 = 6
|
||||
|
||||
// standard colors: 7 * 2 = 14
|
||||
GetXPixels( aColor, 0x00, 0x00, 0x80 );
|
||||
GetXPixels( aColor, 0x00, 0x80, 0x00 );
|
||||
GetXPixels( aColor, 0x00, 0x80, 0x80 );
|
||||
GetXPixels( aColor, 0x80, 0x00, 0x00 );
|
||||
GetXPixels( aColor, 0x80, 0x00, 0x80 );
|
||||
GetXPixels( aColor, 0x80, 0x80, 0x00 );
|
||||
GetXPixels( aColor, 0x80, 0x80, 0x80 );
|
||||
GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blue 7
|
||||
GetXPixels( aColor, 0x00, 0x00, 0xFF );
|
||||
GetXPixels( aColor, 0x00, 0xFF, 0x00 );
|
||||
GetXPixels( aColor, 0x00, 0xFF, 0xFF );
|
||||
|
||||
// cube: 6*6*6 - 8 = 208
|
||||
for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF
|
||||
for( g = 0; g < 0x100; g += 0x33 )
|
||||
for( b = 0; b < 0x100; b += 0x33 )
|
||||
GetXPixels( aColor, r, g, b );
|
||||
// standard colors: 7 * 2 = 14
|
||||
GetXPixels( aColor, 0x00, 0x00, 0x80 );
|
||||
GetXPixels( aColor, 0x00, 0x80, 0x00 );
|
||||
GetXPixels( aColor, 0x00, 0x80, 0x80 );
|
||||
GetXPixels( aColor, 0x80, 0x00, 0x00 );
|
||||
GetXPixels( aColor, 0x80, 0x00, 0x80 );
|
||||
GetXPixels( aColor, 0x80, 0x80, 0x00 );
|
||||
GetXPixels( aColor, 0x80, 0x80, 0x80 );
|
||||
GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blue 7
|
||||
|
||||
// gray: 16 - 6 = 10
|
||||
for( g = 0x11; g < 0xFF; g += 0x11 )
|
||||
GetXPixels( aColor, g, g, g );
|
||||
// cube: 6*6*6 - 8 = 208
|
||||
for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF
|
||||
for( g = 0; g < 0x100; g += 0x33 )
|
||||
for( b = 0; b < 0x100; b += 0x33 )
|
||||
GetXPixels( aColor, r, g, b );
|
||||
|
||||
// green: 16 - 6 = 10
|
||||
for( g = 0x11; g < 0xFF; g += 0x11 )
|
||||
GetXPixels( aColor, 0, g, 0 );
|
||||
// gray: 16 - 6 = 10
|
||||
for( g = 0x11; g < 0xFF; g += 0x11 )
|
||||
GetXPixels( aColor, g, g, g );
|
||||
|
||||
// red: 16 - 6 = 10
|
||||
for( r = 0x11; r < 0xFF; r += 0x11 )
|
||||
GetXPixels( aColor, r, 0, 0 );
|
||||
// green: 16 - 6 = 10
|
||||
for( g = 0x11; g < 0xFF; g += 0x11 )
|
||||
GetXPixels( aColor, 0, g, 0 );
|
||||
|
||||
// red: 16 - 6 = 10
|
||||
for( r = 0x11; r < 0xFF; r += 0x11 )
|
||||
GetXPixels( aColor, r, 0, 0 );
|
||||
|
||||
// blue: 16 - 6 = 10
|
||||
for( b = 0x11; b < 0xFF; b += 0x11 )
|
||||
GetXPixels( aColor, 0, 0, b );
|
||||
|
||||
// blue: 16 - 6 = 10
|
||||
for( b = 0x11; b < 0xFF; b += 0x11 )
|
||||
GetXPixels( aColor, 0, 0, b );
|
||||
}
|
||||
}
|
||||
|
||||
// MonoChrome
|
||||
|
@ -2163,26 +2163,27 @@ void WMAdaptor::switchToWorkArea( int nWorkArea ) const
|
||||
if( ! getWMshouldSwitchWorkspace() )
|
||||
return;
|
||||
|
||||
if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
|
||||
{
|
||||
XEvent aEvent;
|
||||
aEvent.type = ClientMessage;
|
||||
aEvent.xclient.display = m_pDisplay;
|
||||
aEvent.xclient.window = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() );
|
||||
aEvent.xclient.message_type = m_aWMAtoms[ NET_CURRENT_DESKTOP ];
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.data.l[0] = nWorkArea;
|
||||
aEvent.xclient.data.l[1] = 0;
|
||||
aEvent.xclient.data.l[2] = 0;
|
||||
aEvent.xclient.data.l[3] = 0;
|
||||
aEvent.xclient.data.l[4] = 0;
|
||||
XSendEvent( m_pDisplay,
|
||||
m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
|
||||
False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask,
|
||||
&aEvent
|
||||
);
|
||||
}
|
||||
if( !m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
|
||||
return;
|
||||
|
||||
XEvent aEvent;
|
||||
aEvent.type = ClientMessage;
|
||||
aEvent.xclient.display = m_pDisplay;
|
||||
aEvent.xclient.window = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() );
|
||||
aEvent.xclient.message_type = m_aWMAtoms[ NET_CURRENT_DESKTOP ];
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.data.l[0] = nWorkArea;
|
||||
aEvent.xclient.data.l[1] = 0;
|
||||
aEvent.xclient.data.l[2] = 0;
|
||||
aEvent.xclient.data.l[3] = 0;
|
||||
aEvent.xclient.data.l[4] = 0;
|
||||
XSendEvent( m_pDisplay,
|
||||
m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
|
||||
False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask,
|
||||
&aEvent
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2277,26 +2278,27 @@ void WMAdaptor::answerPing( X11SalFrame const * i_pFrame, XClientMessageEvent co
|
||||
|
||||
void WMAdaptor::activateWindow( X11SalFrame *pFrame, Time nTimestamp )
|
||||
{
|
||||
if (pFrame->bMapped_)
|
||||
{
|
||||
XEvent aEvent;
|
||||
if (!pFrame->bMapped_)
|
||||
return;
|
||||
|
||||
aEvent.xclient.type = ClientMessage;
|
||||
aEvent.xclient.window = pFrame->GetShellWindow();
|
||||
aEvent.xclient.message_type = m_aWMAtoms[ NET_ACTIVE_WINDOW ];
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.data.l[0] = 1;
|
||||
aEvent.xclient.data.l[1] = nTimestamp;
|
||||
aEvent.xclient.data.l[2] = None;
|
||||
aEvent.xclient.data.l[3] = 0;
|
||||
aEvent.xclient.data.l[4] = 0;
|
||||
XEvent aEvent;
|
||||
|
||||
aEvent.xclient.type = ClientMessage;
|
||||
aEvent.xclient.window = pFrame->GetShellWindow();
|
||||
aEvent.xclient.message_type = m_aWMAtoms[ NET_ACTIVE_WINDOW ];
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.data.l[0] = 1;
|
||||
aEvent.xclient.data.l[1] = nTimestamp;
|
||||
aEvent.xclient.data.l[2] = None;
|
||||
aEvent.xclient.data.l[3] = 0;
|
||||
aEvent.xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent( m_pDisplay,
|
||||
m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
|
||||
False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask,
|
||||
&aEvent );
|
||||
|
||||
XSendEvent( m_pDisplay,
|
||||
m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
|
||||
False,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask,
|
||||
&aEvent );
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -3475,33 +3475,34 @@ void SelectionManager::transferablesFlavorsChanged()
|
||||
pTypes[i] = *type_it;
|
||||
XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes );
|
||||
|
||||
if( m_aCurrentDropWindow != None && m_nCurrentProtocolVersion >= 0 )
|
||||
{
|
||||
// send synthetic leave and enter events
|
||||
if( m_aCurrentDropWindow == None || m_nCurrentProtocolVersion < 0 )
|
||||
return;
|
||||
|
||||
XEvent aEvent;
|
||||
// send synthetic leave and enter events
|
||||
|
||||
aEvent.type = ClientMessage;
|
||||
aEvent.xclient.display = m_pDisplay;
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.window = m_aDropWindow;
|
||||
aEvent.xclient.data.l[0] = m_aWindow;
|
||||
XEvent aEvent;
|
||||
|
||||
aEvent.xclient.message_type = m_nXdndLeave;
|
||||
aEvent.xclient.data.l[1] = 0;
|
||||
XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
|
||||
aEvent.type = ClientMessage;
|
||||
aEvent.xclient.display = m_pDisplay;
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.window = m_aDropWindow;
|
||||
aEvent.xclient.data.l[0] = m_aWindow;
|
||||
|
||||
aEvent.xclient.message_type = m_nXdndEnter;
|
||||
aEvent.xclient.data.l[1] = m_nCurrentProtocolVersion << 24;
|
||||
memset( aEvent.xclient.data.l + 2, 0, sizeof( long )*3 );
|
||||
// fill in data types
|
||||
if( nTypes > 3 )
|
||||
aEvent.xclient.data.l[1] |= 1;
|
||||
for( int j = 0; j < nTypes && j < 3; j++ )
|
||||
aEvent.xclient.data.l[j+2] = pTypes[j];
|
||||
aEvent.xclient.message_type = m_nXdndLeave;
|
||||
aEvent.xclient.data.l[1] = 0;
|
||||
XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
|
||||
|
||||
aEvent.xclient.message_type = m_nXdndEnter;
|
||||
aEvent.xclient.data.l[1] = m_nCurrentProtocolVersion << 24;
|
||||
memset( aEvent.xclient.data.l + 2, 0, sizeof( long )*3 );
|
||||
// fill in data types
|
||||
if( nTypes > 3 )
|
||||
aEvent.xclient.data.l[1] |= 1;
|
||||
for( int j = 0; j < nTypes && j < 3; j++ )
|
||||
aEvent.xclient.data.l[j+2] = pTypes[j];
|
||||
|
||||
XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
|
||||
|
||||
XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3892,44 +3893,45 @@ void SelectionManager::deregisterDropTarget( ::Window aWindow )
|
||||
osl::ClearableMutexGuard aGuard(m_aMutex);
|
||||
|
||||
m_aDropTargets.erase( aWindow );
|
||||
if( aWindow == m_aDragSourceWindow && m_aDragRunning.check() )
|
||||
if( aWindow != m_aDragSourceWindow || !m_aDragRunning.check() )
|
||||
return;
|
||||
|
||||
// abort drag
|
||||
std::unordered_map< ::Window, DropTargetEntry >::const_iterator it =
|
||||
m_aDropTargets.find( m_aDropWindow );
|
||||
if( it != m_aDropTargets.end() )
|
||||
{
|
||||
// abort drag
|
||||
std::unordered_map< ::Window, DropTargetEntry >::const_iterator it =
|
||||
m_aDropTargets.find( m_aDropWindow );
|
||||
if( it != m_aDropTargets.end() )
|
||||
{
|
||||
DropTargetEvent dte;
|
||||
dte.Source = static_cast< OWeakObject* >( it->second.m_pTarget );
|
||||
aGuard.clear();
|
||||
it->second.m_pTarget->dragExit( dte );
|
||||
}
|
||||
else if( m_aDropProxy != None && m_nCurrentProtocolVersion >= 0 )
|
||||
{
|
||||
// send XdndLeave
|
||||
XEvent aEvent;
|
||||
aEvent.type = ClientMessage;
|
||||
aEvent.xclient.display = m_pDisplay;
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.message_type = m_nXdndLeave;
|
||||
aEvent.xclient.window = m_aDropWindow;
|
||||
aEvent.xclient.data.l[0] = m_aWindow;
|
||||
memset( aEvent.xclient.data.l+1, 0, sizeof(long)*4);
|
||||
m_aDropWindow = m_aDropProxy = None;
|
||||
XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
|
||||
}
|
||||
// notify the listener
|
||||
DragSourceDropEvent dsde;
|
||||
dsde.Source = static_cast< OWeakObject* >(this);
|
||||
dsde.DragSourceContext = new DragSourceContext( m_aDropWindow, *this );
|
||||
dsde.DragSource = static_cast< XDragSource* >(this);
|
||||
dsde.DropAction = DNDConstants::ACTION_NONE;
|
||||
dsde.DropSuccess = false;
|
||||
css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
|
||||
m_xDragSourceListener.clear();
|
||||
DropTargetEvent dte;
|
||||
dte.Source = static_cast< OWeakObject* >( it->second.m_pTarget );
|
||||
aGuard.clear();
|
||||
xListener->dragDropEnd( dsde );
|
||||
it->second.m_pTarget->dragExit( dte );
|
||||
}
|
||||
else if( m_aDropProxy != None && m_nCurrentProtocolVersion >= 0 )
|
||||
{
|
||||
// send XdndLeave
|
||||
XEvent aEvent;
|
||||
aEvent.type = ClientMessage;
|
||||
aEvent.xclient.display = m_pDisplay;
|
||||
aEvent.xclient.format = 32;
|
||||
aEvent.xclient.message_type = m_nXdndLeave;
|
||||
aEvent.xclient.window = m_aDropWindow;
|
||||
aEvent.xclient.data.l[0] = m_aWindow;
|
||||
memset( aEvent.xclient.data.l+1, 0, sizeof(long)*4);
|
||||
m_aDropWindow = m_aDropProxy = None;
|
||||
XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
|
||||
}
|
||||
// notify the listener
|
||||
DragSourceDropEvent dsde;
|
||||
dsde.Source = static_cast< OWeakObject* >(this);
|
||||
dsde.DragSourceContext = new DragSourceContext( m_aDropWindow, *this );
|
||||
dsde.DragSource = static_cast< XDragSource* >(this);
|
||||
dsde.DropAction = DNDConstants::ACTION_NONE;
|
||||
dsde.DropSuccess = false;
|
||||
css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
|
||||
m_xDragSourceListener.clear();
|
||||
aGuard.clear();
|
||||
xListener->dragDropEnd( dsde );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -721,77 +721,78 @@ void
|
||||
PrinterGfx::PSSetFont ()
|
||||
{
|
||||
GraphicsStatus& rCurrent( currentState() );
|
||||
if( maVirtualStatus.maFont != rCurrent.maFont ||
|
||||
maVirtualStatus.mnTextHeight != rCurrent.mnTextHeight ||
|
||||
maVirtualStatus.maEncoding != rCurrent.maEncoding ||
|
||||
maVirtualStatus.mnTextWidth != rCurrent.mnTextWidth ||
|
||||
maVirtualStatus.mbArtBold != rCurrent.mbArtBold ||
|
||||
maVirtualStatus.mbArtItalic != rCurrent.mbArtItalic
|
||||
if( !(maVirtualStatus.maFont != rCurrent.maFont ||
|
||||
maVirtualStatus.mnTextHeight != rCurrent.mnTextHeight ||
|
||||
maVirtualStatus.maEncoding != rCurrent.maEncoding ||
|
||||
maVirtualStatus.mnTextWidth != rCurrent.mnTextWidth ||
|
||||
maVirtualStatus.mbArtBold != rCurrent.mbArtBold ||
|
||||
maVirtualStatus.mbArtItalic != rCurrent.mbArtItalic)
|
||||
)
|
||||
return;
|
||||
|
||||
rCurrent.maFont = maVirtualStatus.maFont;
|
||||
rCurrent.maEncoding = maVirtualStatus.maEncoding;
|
||||
rCurrent.mnTextWidth = maVirtualStatus.mnTextWidth;
|
||||
rCurrent.mnTextHeight = maVirtualStatus.mnTextHeight;
|
||||
rCurrent.mbArtItalic = maVirtualStatus.mbArtItalic;
|
||||
rCurrent.mbArtBold = maVirtualStatus.mbArtBold;
|
||||
|
||||
sal_Int32 nTextHeight = rCurrent.mnTextHeight;
|
||||
sal_Int32 nTextWidth = rCurrent.mnTextWidth ? rCurrent.mnTextWidth
|
||||
: rCurrent.mnTextHeight;
|
||||
|
||||
sal_Char pSetFont [256];
|
||||
sal_Int32 nChar = 0;
|
||||
|
||||
// postscript based fonts need reencoding
|
||||
if ( ( rCurrent.maEncoding == RTL_TEXTENCODING_MS_1252)
|
||||
|| ( rCurrent.maEncoding == RTL_TEXTENCODING_ISO_8859_1)
|
||||
|| ( rCurrent.maEncoding >= RTL_TEXTENCODING_USER_START
|
||||
&& rCurrent.maEncoding <= RTL_TEXTENCODING_USER_END)
|
||||
)
|
||||
{
|
||||
rCurrent.maFont = maVirtualStatus.maFont;
|
||||
rCurrent.maEncoding = maVirtualStatus.maEncoding;
|
||||
rCurrent.mnTextWidth = maVirtualStatus.mnTextWidth;
|
||||
rCurrent.mnTextHeight = maVirtualStatus.mnTextHeight;
|
||||
rCurrent.mbArtItalic = maVirtualStatus.mbArtItalic;
|
||||
rCurrent.mbArtBold = maVirtualStatus.mbArtBold;
|
||||
OString aReencodedFont =
|
||||
psp::GlyphSet::GetReencodedFontName (rCurrent.maEncoding,
|
||||
rCurrent.maFont);
|
||||
|
||||
sal_Int32 nTextHeight = rCurrent.mnTextHeight;
|
||||
sal_Int32 nTextWidth = rCurrent.mnTextWidth ? rCurrent.mnTextWidth
|
||||
: rCurrent.mnTextHeight;
|
||||
|
||||
sal_Char pSetFont [256];
|
||||
sal_Int32 nChar = 0;
|
||||
|
||||
// postscript based fonts need reencoding
|
||||
if ( ( rCurrent.maEncoding == RTL_TEXTENCODING_MS_1252)
|
||||
|| ( rCurrent.maEncoding == RTL_TEXTENCODING_ISO_8859_1)
|
||||
|| ( rCurrent.maEncoding >= RTL_TEXTENCODING_USER_START
|
||||
&& rCurrent.maEncoding <= RTL_TEXTENCODING_USER_END)
|
||||
)
|
||||
{
|
||||
OString aReencodedFont =
|
||||
psp::GlyphSet::GetReencodedFontName (rCurrent.maEncoding,
|
||||
rCurrent.maFont);
|
||||
|
||||
nChar += psp::appendStr ("(", pSetFont + nChar);
|
||||
nChar += psp::appendStr (aReencodedFont.getStr(),
|
||||
pSetFont + nChar);
|
||||
nChar += psp::appendStr (") cvn findfont ",
|
||||
pSetFont + nChar);
|
||||
}
|
||||
else
|
||||
// tt based fonts mustn't reencode, the encoding is implied by the fontname
|
||||
// same for symbol type1 fonts, don't try to touch them
|
||||
{
|
||||
nChar += psp::appendStr ("(", pSetFont + nChar);
|
||||
nChar += psp::appendStr (rCurrent.maFont.getStr(),
|
||||
pSetFont + nChar);
|
||||
nChar += psp::appendStr (") cvn findfont ",
|
||||
pSetFont + nChar);
|
||||
}
|
||||
|
||||
if( ! rCurrent.mbArtItalic )
|
||||
{
|
||||
nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
|
||||
nChar += psp::appendStr (" ", pSetFont + nChar);
|
||||
nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
|
||||
nChar += psp::appendStr (" matrix scale makefont setfont\n", pSetFont + nChar);
|
||||
}
|
||||
else // skew 15 degrees to right
|
||||
{
|
||||
nChar += psp::appendStr ( " [", pSetFont + nChar);
|
||||
nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
|
||||
nChar += psp::appendStr (" 0 ", pSetFont + nChar);
|
||||
nChar += psp::getValueOfDouble (pSetFont + nChar, 0.27*(double)nTextWidth, 3 );
|
||||
nChar += psp::appendStr ( " ", pSetFont + nChar);
|
||||
nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
|
||||
|
||||
nChar += psp::appendStr (" 0 0] makefont setfont\n", pSetFont + nChar);
|
||||
}
|
||||
|
||||
WritePS (mpPageBody, pSetFont, nChar);
|
||||
nChar += psp::appendStr ("(", pSetFont + nChar);
|
||||
nChar += psp::appendStr (aReencodedFont.getStr(),
|
||||
pSetFont + nChar);
|
||||
nChar += psp::appendStr (") cvn findfont ",
|
||||
pSetFont + nChar);
|
||||
}
|
||||
else
|
||||
// tt based fonts mustn't reencode, the encoding is implied by the fontname
|
||||
// same for symbol type1 fonts, don't try to touch them
|
||||
{
|
||||
nChar += psp::appendStr ("(", pSetFont + nChar);
|
||||
nChar += psp::appendStr (rCurrent.maFont.getStr(),
|
||||
pSetFont + nChar);
|
||||
nChar += psp::appendStr (") cvn findfont ",
|
||||
pSetFont + nChar);
|
||||
}
|
||||
|
||||
if( ! rCurrent.mbArtItalic )
|
||||
{
|
||||
nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
|
||||
nChar += psp::appendStr (" ", pSetFont + nChar);
|
||||
nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
|
||||
nChar += psp::appendStr (" matrix scale makefont setfont\n", pSetFont + nChar);
|
||||
}
|
||||
else // skew 15 degrees to right
|
||||
{
|
||||
nChar += psp::appendStr ( " [", pSetFont + nChar);
|
||||
nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
|
||||
nChar += psp::appendStr (" 0 ", pSetFont + nChar);
|
||||
nChar += psp::getValueOfDouble (pSetFont + nChar, 0.27*(double)nTextWidth, 3 );
|
||||
nChar += psp::appendStr ( " ", pSetFont + nChar);
|
||||
nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
|
||||
|
||||
nChar += psp::appendStr (" 0 0] makefont setfont\n", pSetFont + nChar);
|
||||
}
|
||||
|
||||
WritePS (mpPageBody, pSetFont, nChar);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -711,32 +711,33 @@ void PspSalInfoPrinter::GetPageInfo(
|
||||
JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData );
|
||||
|
||||
// get the selected page size
|
||||
if( aData.m_pParser )
|
||||
if( !aData.m_pParser )
|
||||
return;
|
||||
|
||||
|
||||
OUString aPaper;
|
||||
int width, height;
|
||||
int left = 0, top = 0, right = 0, bottom = 0;
|
||||
int nDPI = aData.m_aContext.getRenderResolution();
|
||||
|
||||
if( aData.m_eOrientation == psp::orientation::Portrait )
|
||||
{
|
||||
|
||||
OUString aPaper;
|
||||
int width, height;
|
||||
int left = 0, top = 0, right = 0, bottom = 0;
|
||||
int nDPI = aData.m_aContext.getRenderResolution();
|
||||
|
||||
if( aData.m_eOrientation == psp::orientation::Portrait )
|
||||
{
|
||||
aData.m_aContext.getPageSize( aPaper, width, height );
|
||||
aData.m_pParser->getMargins( aPaper, left, right, top, bottom );
|
||||
}
|
||||
else
|
||||
{
|
||||
aData.m_aContext.getPageSize( aPaper, height, width );
|
||||
aData.m_pParser->getMargins( aPaper, top, bottom, right, left );
|
||||
}
|
||||
|
||||
rPageWidth = width * nDPI / 72;
|
||||
rPageHeight = height * nDPI / 72;
|
||||
rPageOffX = left * nDPI / 72;
|
||||
rPageOffY = top * nDPI / 72;
|
||||
rOutWidth = ( width - left - right ) * nDPI / 72;
|
||||
rOutHeight = ( height - top - bottom ) * nDPI / 72;
|
||||
aData.m_aContext.getPageSize( aPaper, width, height );
|
||||
aData.m_pParser->getMargins( aPaper, left, right, top, bottom );
|
||||
}
|
||||
else
|
||||
{
|
||||
aData.m_aContext.getPageSize( aPaper, height, width );
|
||||
aData.m_pParser->getMargins( aPaper, top, bottom, right, left );
|
||||
}
|
||||
|
||||
rPageWidth = width * nDPI / 72;
|
||||
rPageHeight = height * nDPI / 72;
|
||||
rPageOffX = left * nDPI / 72;
|
||||
rPageOffY = top * nDPI / 72;
|
||||
rOutWidth = ( width - left - right ) * nDPI / 72;
|
||||
rOutHeight = ( height - top - bottom ) * nDPI / 72;
|
||||
|
||||
}
|
||||
|
||||
sal_uInt16 PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
|
||||
|
@ -1036,107 +1036,108 @@ void X11SalFrame::updateGraphics( bool bClear )
|
||||
|
||||
void X11SalFrame::SetIcon( sal_uInt16 nIcon )
|
||||
{
|
||||
if ( ! IsChildWindow() )
|
||||
if ( IsChildWindow() )
|
||||
return;
|
||||
|
||||
// 0 == default icon -> #1
|
||||
if ( nIcon == 0 )
|
||||
nIcon = 1;
|
||||
|
||||
mnIconID = nIcon;
|
||||
|
||||
XIconSize *pIconSize = nullptr;
|
||||
int nSizes = 0;
|
||||
int iconSize = 32;
|
||||
if ( XGetIconSizes( GetXDisplay(), GetDisplay()->GetRootWindow( m_nXScreen ), &pIconSize, &nSizes ) )
|
||||
{
|
||||
// 0 == default icon -> #1
|
||||
if ( nIcon == 0 )
|
||||
nIcon = 1;
|
||||
|
||||
mnIconID = nIcon;
|
||||
|
||||
XIconSize *pIconSize = nullptr;
|
||||
int nSizes = 0;
|
||||
int iconSize = 32;
|
||||
if ( XGetIconSizes( GetXDisplay(), GetDisplay()->GetRootWindow( m_nXScreen ), &pIconSize, &nSizes ) )
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "X11SalFrame::SetIcon(): found %d IconSizes:\n", nSizes);
|
||||
fprintf(stderr, "X11SalFrame::SetIcon(): found %d IconSizes:\n", nSizes);
|
||||
#endif
|
||||
|
||||
int i;
|
||||
for( i=0; i<nSizes; i++)
|
||||
int i;
|
||||
for( i=0; i<nSizes; i++)
|
||||
{
|
||||
// select largest supported icon
|
||||
if( pIconSize[i].max_width > iconSize )
|
||||
{
|
||||
// select largest supported icon
|
||||
if( pIconSize[i].max_width > iconSize )
|
||||
{
|
||||
iconSize = pIconSize[i].max_width;
|
||||
}
|
||||
iconSize = pIconSize[i].max_width;
|
||||
}
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf(stderr, "min: %d, %d\nmax: %d, %d\ninc: %d, %d\n\n",
|
||||
pIconSize[i].min_width, pIconSize[i].min_height,
|
||||
pIconSize[i].max_width, pIconSize[i].max_height,
|
||||
pIconSize[i].width_inc, pIconSize[i].height_inc);
|
||||
fprintf(stderr, "min: %d, %d\nmax: %d, %d\ninc: %d, %d\n\n",
|
||||
pIconSize[i].min_width, pIconSize[i].min_height,
|
||||
pIconSize[i].max_width, pIconSize[i].max_height,
|
||||
pIconSize[i].width_inc, pIconSize[i].height_inc);
|
||||
#endif
|
||||
}
|
||||
|
||||
XFree( pIconSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
const OUString& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() );
|
||||
if( rWM == "KWin" ) // assume KDE is running
|
||||
iconSize = 48;
|
||||
static bool bGnomeIconSize = false;
|
||||
static bool bGnomeChecked = false;
|
||||
if( ! bGnomeChecked )
|
||||
{
|
||||
bGnomeChecked=true;
|
||||
int nCount = 0;
|
||||
Atom* pProps = XListProperties( GetXDisplay(),
|
||||
GetDisplay()->GetRootWindow( m_nXScreen ),
|
||||
&nCount );
|
||||
for( int i = 0; i < nCount && !bGnomeIconSize; i++ )
|
||||
{
|
||||
char* pName = XGetAtomName( GetXDisplay(), pProps[i] );
|
||||
if( pName )
|
||||
{
|
||||
if( !strcmp( pName, "GNOME_PANEL_DESKTOP_AREA" ) )
|
||||
bGnomeIconSize = true;
|
||||
XFree( pName );
|
||||
}
|
||||
}
|
||||
if( pProps )
|
||||
XFree( pProps );
|
||||
}
|
||||
if( bGnomeIconSize )
|
||||
iconSize = 48;
|
||||
}
|
||||
|
||||
XWMHints Hints;
|
||||
Hints.flags = 0;
|
||||
XWMHints *pHints = XGetWMHints( GetXDisplay(), GetShellWindow() );
|
||||
if( pHints )
|
||||
{
|
||||
memcpy(&Hints, pHints, sizeof( XWMHints ));
|
||||
XFree( pHints );
|
||||
}
|
||||
pHints = &Hints;
|
||||
|
||||
NetWmIconData netwm_icon;
|
||||
bool bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
|
||||
nIcon, iconSize,
|
||||
pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
|
||||
if ( !bOk )
|
||||
{
|
||||
// load default icon (0)
|
||||
bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
|
||||
0, iconSize,
|
||||
pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
|
||||
}
|
||||
if( bOk )
|
||||
{
|
||||
pHints->flags |= IconPixmapHint;
|
||||
if( pHints->icon_mask )
|
||||
pHints->flags |= IconMaskHint;
|
||||
|
||||
XSetWMHints( GetXDisplay(), GetShellWindow(), pHints );
|
||||
if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ))
|
||||
XChangeProperty( GetXDisplay(), mhWindow,
|
||||
GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ),
|
||||
XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(netwm_icon.data()), netwm_icon.size());
|
||||
}
|
||||
XFree( pIconSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
const OUString& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() );
|
||||
if( rWM == "KWin" ) // assume KDE is running
|
||||
iconSize = 48;
|
||||
static bool bGnomeIconSize = false;
|
||||
static bool bGnomeChecked = false;
|
||||
if( ! bGnomeChecked )
|
||||
{
|
||||
bGnomeChecked=true;
|
||||
int nCount = 0;
|
||||
Atom* pProps = XListProperties( GetXDisplay(),
|
||||
GetDisplay()->GetRootWindow( m_nXScreen ),
|
||||
&nCount );
|
||||
for( int i = 0; i < nCount && !bGnomeIconSize; i++ )
|
||||
{
|
||||
char* pName = XGetAtomName( GetXDisplay(), pProps[i] );
|
||||
if( pName )
|
||||
{
|
||||
if( !strcmp( pName, "GNOME_PANEL_DESKTOP_AREA" ) )
|
||||
bGnomeIconSize = true;
|
||||
XFree( pName );
|
||||
}
|
||||
}
|
||||
if( pProps )
|
||||
XFree( pProps );
|
||||
}
|
||||
if( bGnomeIconSize )
|
||||
iconSize = 48;
|
||||
}
|
||||
|
||||
XWMHints Hints;
|
||||
Hints.flags = 0;
|
||||
XWMHints *pHints = XGetWMHints( GetXDisplay(), GetShellWindow() );
|
||||
if( pHints )
|
||||
{
|
||||
memcpy(&Hints, pHints, sizeof( XWMHints ));
|
||||
XFree( pHints );
|
||||
}
|
||||
pHints = &Hints;
|
||||
|
||||
NetWmIconData netwm_icon;
|
||||
bool bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
|
||||
nIcon, iconSize,
|
||||
pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
|
||||
if ( !bOk )
|
||||
{
|
||||
// load default icon (0)
|
||||
bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
|
||||
0, iconSize,
|
||||
pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
|
||||
}
|
||||
if( bOk )
|
||||
{
|
||||
pHints->flags |= IconPixmapHint;
|
||||
if( pHints->icon_mask )
|
||||
pHints->flags |= IconMaskHint;
|
||||
|
||||
XSetWMHints( GetXDisplay(), GetShellWindow(), pHints );
|
||||
if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ))
|
||||
XChangeProperty( GetXDisplay(), mhWindow,
|
||||
GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ),
|
||||
XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(netwm_icon.data()), netwm_icon.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void X11SalFrame::SetMaxClientSize( long nWidth, long nHeight )
|
||||
|
@ -33,43 +33,44 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, bool bShow )
|
||||
: m_pSocket( nullptr ),
|
||||
m_pRegion( nullptr )
|
||||
{
|
||||
if( pParent )
|
||||
{
|
||||
// our plug window
|
||||
m_pSocket = gtk_drawing_area_new();
|
||||
Show( bShow );
|
||||
// insert into container
|
||||
gtk_fixed_put( pParent->getFixedContainer(),
|
||||
m_pSocket,
|
||||
0, 0 );
|
||||
// realize so we can get a window id
|
||||
gtk_widget_realize( m_pSocket );
|
||||
if( !pParent )
|
||||
return;
|
||||
|
||||
// make it transparent; some plugins may not insert
|
||||
// their own window here but use the socket window itself
|
||||
gtk_widget_set_app_paintable( m_pSocket, TRUE );
|
||||
// our plug window
|
||||
m_pSocket = gtk_drawing_area_new();
|
||||
Show( bShow );
|
||||
// insert into container
|
||||
gtk_fixed_put( pParent->getFixedContainer(),
|
||||
m_pSocket,
|
||||
0, 0 );
|
||||
// realize so we can get a window id
|
||||
gtk_widget_realize( m_pSocket );
|
||||
|
||||
// system data
|
||||
m_aSystemData.nSize = sizeof( SystemEnvData );
|
||||
SalDisplay* pDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData());
|
||||
m_aSystemData.pDisplay = pDisp->GetDisplay();
|
||||
m_aSystemData.pVisual = pDisp->GetVisual(pParent->getXScreenNumber()).GetVisual();
|
||||
m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pSocket));
|
||||
m_aSystemData.aShellWindow = GDK_WINDOW_XWINDOW(widget_get_window(GTK_WIDGET(pParent->getWindow())));
|
||||
m_aSystemData.pSalFrame = nullptr;
|
||||
m_aSystemData.pWidget = m_pSocket;
|
||||
m_aSystemData.nScreen = pParent->getXScreenNumber().getXScreen();
|
||||
m_aSystemData.pToolkit = "gtk2";
|
||||
// make it transparent; some plugins may not insert
|
||||
// their own window here but use the socket window itself
|
||||
gtk_widget_set_app_paintable( m_pSocket, TRUE );
|
||||
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-press-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-release-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-in-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-out-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "destroy", G_CALLBACK(signalDestroy), this );
|
||||
// system data
|
||||
m_aSystemData.nSize = sizeof( SystemEnvData );
|
||||
SalDisplay* pDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData());
|
||||
m_aSystemData.pDisplay = pDisp->GetDisplay();
|
||||
m_aSystemData.pVisual = pDisp->GetVisual(pParent->getXScreenNumber()).GetVisual();
|
||||
m_aSystemData.aWindow = GDK_WINDOW_XWINDOW(widget_get_window(m_pSocket));
|
||||
m_aSystemData.aShellWindow = GDK_WINDOW_XWINDOW(widget_get_window(GTK_WIDGET(pParent->getWindow())));
|
||||
m_aSystemData.pSalFrame = nullptr;
|
||||
m_aSystemData.pWidget = m_pSocket;
|
||||
m_aSystemData.nScreen = pParent->getXScreenNumber().getXScreen();
|
||||
m_aSystemData.pToolkit = "gtk2";
|
||||
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-press-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-release-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-in-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-out-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "destroy", G_CALLBACK(signalDestroy), this );
|
||||
|
||||
// #i59255# necessary due to sync effects with java child windows
|
||||
pParent->Flush();
|
||||
|
||||
// #i59255# necessary due to sync effects with java child windows
|
||||
pParent->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
GtkSalObject::~GtkSalObject()
|
||||
|
@ -3300,28 +3300,29 @@ GtkSalFrame::IMHandler::~IMHandler()
|
||||
|
||||
void GtkSalFrame::IMHandler::createIMContext()
|
||||
{
|
||||
if( ! m_pIMContext )
|
||||
{
|
||||
m_pIMContext = gtk_im_multicontext_new ();
|
||||
g_signal_connect( m_pIMContext, "commit",
|
||||
G_CALLBACK (signalIMCommit), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_changed",
|
||||
G_CALLBACK (signalIMPreeditChanged), this );
|
||||
g_signal_connect( m_pIMContext, "retrieve_surrounding",
|
||||
G_CALLBACK (signalIMRetrieveSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "delete_surrounding",
|
||||
G_CALLBACK (signalIMDeleteSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_start",
|
||||
G_CALLBACK (signalIMPreeditStart), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_end",
|
||||
G_CALLBACK (signalIMPreeditEnd), this );
|
||||
if( m_pIMContext )
|
||||
return;
|
||||
|
||||
m_pIMContext = gtk_im_multicontext_new ();
|
||||
g_signal_connect( m_pIMContext, "commit",
|
||||
G_CALLBACK (signalIMCommit), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_changed",
|
||||
G_CALLBACK (signalIMPreeditChanged), this );
|
||||
g_signal_connect( m_pIMContext, "retrieve_surrounding",
|
||||
G_CALLBACK (signalIMRetrieveSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "delete_surrounding",
|
||||
G_CALLBACK (signalIMDeleteSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_start",
|
||||
G_CALLBACK (signalIMPreeditStart), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_end",
|
||||
G_CALLBACK (signalIMPreeditEnd), this );
|
||||
|
||||
GetGenericUnixSalData()->ErrorTrapPush();
|
||||
gtk_im_context_set_client_window( m_pIMContext, widget_get_window(GTK_WIDGET(m_pFrame->m_pWindow)) );
|
||||
gtk_im_context_focus_in( m_pIMContext );
|
||||
GetGenericUnixSalData()->ErrorTrapPop();
|
||||
m_bFocused = true;
|
||||
|
||||
GetGenericUnixSalData()->ErrorTrapPush();
|
||||
gtk_im_context_set_client_window( m_pIMContext, widget_get_window(GTK_WIDGET(m_pFrame->m_pWindow)) );
|
||||
gtk_im_context_focus_in( m_pIMContext );
|
||||
GetGenericUnixSalData()->ErrorTrapPop();
|
||||
m_bFocused = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GtkSalFrame::IMHandler::deleteIMContext()
|
||||
|
@ -4381,49 +4381,50 @@ static void NWEnsureGTKMenubar( SalX11Screen nScreen )
|
||||
|
||||
static void NWEnsureGTKMenu( SalX11Screen nScreen )
|
||||
{
|
||||
if( !gWidgetData[nScreen].gMenuWidget )
|
||||
{
|
||||
gWidgetData[nScreen].gMenuWidget = gtk_menu_new();
|
||||
gWidgetData[nScreen].gMenuItemMenuWidget = gtk_menu_item_new_with_label( "b" );
|
||||
gWidgetData[nScreen].gMenuItemCheckMenuWidget = gtk_check_menu_item_new_with_label( "b" );
|
||||
gWidgetData[nScreen].gMenuItemRadioMenuWidget = gtk_radio_menu_item_new_with_label( nullptr, "b" );
|
||||
gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = gtk_separator_menu_item_new();
|
||||
gWidgetData[nScreen].gImageMenuItem = gtk_image_menu_item_new();
|
||||
if( gWidgetData[nScreen].gMenuWidget )
|
||||
return;
|
||||
|
||||
g_object_ref_sink (gWidgetData[nScreen].gMenuWidget);
|
||||
gWidgetData[nScreen].gMenuWidget = gtk_menu_new();
|
||||
gWidgetData[nScreen].gMenuItemMenuWidget = gtk_menu_item_new_with_label( "b" );
|
||||
gWidgetData[nScreen].gMenuItemCheckMenuWidget = gtk_check_menu_item_new_with_label( "b" );
|
||||
gWidgetData[nScreen].gMenuItemRadioMenuWidget = gtk_radio_menu_item_new_with_label( nullptr, "b" );
|
||||
gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = gtk_separator_menu_item_new();
|
||||
gWidgetData[nScreen].gImageMenuItem = gtk_image_menu_item_new();
|
||||
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gImageMenuItem );
|
||||
g_object_ref_sink (gWidgetData[nScreen].gMenuWidget);
|
||||
|
||||
// do what NWAddWidgetToCacheWindow does except adding to def container
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gImageMenuItem );
|
||||
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
// do what NWAddWidgetToCacheWindow does except adding to def container
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuWidget );
|
||||
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
|
||||
gtk_widget_realize( gWidgetData[nScreen].gImageMenuItem );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gImageMenuItem );
|
||||
gtk_widget_realize( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
|
||||
gtk_widget_realize( gWidgetData[nScreen].gImageMenuItem );
|
||||
gtk_widget_ensure_style( gWidgetData[nScreen].gImageMenuItem );
|
||||
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemCheckMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemRadioMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemSeparatorMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gImageMenuItem) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gImageMenuItem );
|
||||
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemCheckMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemCheckMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemRadioMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemRadioMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gMenuItemSeparatorMenuWidget) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget );
|
||||
gWidgetDefaultFlags[ reinterpret_cast<long>(gWidgetData[nScreen].gImageMenuItem) ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gImageMenuItem );
|
||||
}
|
||||
}
|
||||
|
||||
static void NWEnsureGTKTooltip( SalX11Screen nScreen )
|
||||
|
@ -3629,28 +3629,29 @@ GtkSalFrame::IMHandler::~IMHandler()
|
||||
|
||||
void GtkSalFrame::IMHandler::createIMContext()
|
||||
{
|
||||
if( ! m_pIMContext )
|
||||
{
|
||||
m_pIMContext = gtk_im_multicontext_new ();
|
||||
g_signal_connect( m_pIMContext, "commit",
|
||||
G_CALLBACK (signalIMCommit), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_changed",
|
||||
G_CALLBACK (signalIMPreeditChanged), this );
|
||||
g_signal_connect( m_pIMContext, "retrieve_surrounding",
|
||||
G_CALLBACK (signalIMRetrieveSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "delete_surrounding",
|
||||
G_CALLBACK (signalIMDeleteSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_start",
|
||||
G_CALLBACK (signalIMPreeditStart), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_end",
|
||||
G_CALLBACK (signalIMPreeditEnd), this );
|
||||
if( m_pIMContext )
|
||||
return;
|
||||
|
||||
m_pIMContext = gtk_im_multicontext_new ();
|
||||
g_signal_connect( m_pIMContext, "commit",
|
||||
G_CALLBACK (signalIMCommit), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_changed",
|
||||
G_CALLBACK (signalIMPreeditChanged), this );
|
||||
g_signal_connect( m_pIMContext, "retrieve_surrounding",
|
||||
G_CALLBACK (signalIMRetrieveSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "delete_surrounding",
|
||||
G_CALLBACK (signalIMDeleteSurrounding), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_start",
|
||||
G_CALLBACK (signalIMPreeditStart), this );
|
||||
g_signal_connect( m_pIMContext, "preedit_end",
|
||||
G_CALLBACK (signalIMPreeditEnd), this );
|
||||
|
||||
GetGenericUnixSalData()->ErrorTrapPush();
|
||||
gtk_im_context_set_client_window(m_pIMContext, widget_get_window(m_pFrame->getMouseEventWidget()));
|
||||
gtk_im_context_focus_in( m_pIMContext );
|
||||
GetGenericUnixSalData()->ErrorTrapPop();
|
||||
m_bFocused = true;
|
||||
|
||||
GetGenericUnixSalData()->ErrorTrapPush();
|
||||
gtk_im_context_set_client_window(m_pIMContext, widget_get_window(m_pFrame->getMouseEventWidget()));
|
||||
gtk_im_context_focus_in( m_pIMContext );
|
||||
GetGenericUnixSalData()->ErrorTrapPop();
|
||||
m_bFocused = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GtkSalFrame::IMHandler::deleteIMContext()
|
||||
|
@ -992,44 +992,45 @@ private:
|
||||
virtual void adjustToNewSize() override
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,16,0)
|
||||
if (m_pGLArea)
|
||||
{
|
||||
int scale = gtk_widget_get_scale_factor(m_pGLArea);
|
||||
int width = m_aGLWin.Width * scale;
|
||||
int height = m_aGLWin.Height * scale;
|
||||
if (!m_pGLArea)
|
||||
return;
|
||||
|
||||
gtk_gl_area_make_current(GTK_GL_AREA(m_pGLArea));
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, width, height);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nDepthBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_nAreaFrameBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nRenderBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nDepthBuffer);
|
||||
int scale = gtk_widget_get_scale_factor(m_pGLArea);
|
||||
int width = m_aGLWin.Width * scale;
|
||||
int height = m_aGLWin.Height * scale;
|
||||
|
||||
gdk_gl_context_make_current(m_pContext);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nDepthBuffer);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_nFrameBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nRenderBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nDepthBuffer);
|
||||
glViewport(0, 0, width, height);
|
||||
gtk_gl_area_make_current(GTK_GL_AREA(m_pGLArea));
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, width, height);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nDepthBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_nAreaFrameBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nRenderBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nDepthBuffer);
|
||||
|
||||
gdk_gl_context_make_current(m_pContext);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nDepthBuffer);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_nFrameBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nRenderBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nDepthBuffer);
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderScratchBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, width, height);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nDepthScratchBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_nFrameScratchBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nRenderScratchBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nDepthScratchBuffer);
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nRenderScratchBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, width, height);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_nDepthScratchBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_nFrameScratchBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nRenderScratchBuffer);
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, m_nDepthScratchBuffer);
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -34,47 +34,48 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, bool bShow )
|
||||
, m_pParent(pParent)
|
||||
, m_pRegion(nullptr)
|
||||
{
|
||||
if( pParent )
|
||||
{
|
||||
// our plug window
|
||||
m_pSocket = gtk_grid_new();
|
||||
Show( bShow );
|
||||
// insert into container
|
||||
gtk_fixed_put( pParent->getFixedContainer(),
|
||||
m_pSocket,
|
||||
0, 0 );
|
||||
// realize so we can get a window id
|
||||
gtk_widget_realize( m_pSocket );
|
||||
if( !pParent )
|
||||
return;
|
||||
|
||||
// system data
|
||||
m_aSystemData.nSize = sizeof( SystemEnvData );
|
||||
m_aSystemData.aWindow = pParent->GetNativeWindowHandle(m_pSocket);
|
||||
m_aSystemData.aShellWindow = reinterpret_cast<sal_IntPtr>(this);
|
||||
m_aSystemData.pSalFrame = nullptr;
|
||||
m_aSystemData.pWidget = m_pSocket;
|
||||
m_aSystemData.nScreen = pParent->getXScreenNumber().getXScreen();
|
||||
m_aSystemData.pToolkit = "gtk3";
|
||||
GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(pParent->getWindow()));
|
||||
GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
|
||||
// our plug window
|
||||
m_pSocket = gtk_grid_new();
|
||||
Show( bShow );
|
||||
// insert into container
|
||||
gtk_fixed_put( pParent->getFixedContainer(),
|
||||
m_pSocket,
|
||||
0, 0 );
|
||||
// realize so we can get a window id
|
||||
gtk_widget_realize( m_pSocket );
|
||||
|
||||
// system data
|
||||
m_aSystemData.nSize = sizeof( SystemEnvData );
|
||||
m_aSystemData.aWindow = pParent->GetNativeWindowHandle(m_pSocket);
|
||||
m_aSystemData.aShellWindow = reinterpret_cast<sal_IntPtr>(this);
|
||||
m_aSystemData.pSalFrame = nullptr;
|
||||
m_aSystemData.pWidget = m_pSocket;
|
||||
m_aSystemData.nScreen = pParent->getXScreenNumber().getXScreen();
|
||||
m_aSystemData.pToolkit = "gtk3";
|
||||
GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(pParent->getWindow()));
|
||||
GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
|
||||
|
||||
#if defined(GDK_WINDOWING_X11)
|
||||
GdkDisplay *pDisplay = GtkSalFrame::getGdkDisplay();
|
||||
if (GDK_IS_X11_DISPLAY(pDisplay))
|
||||
{
|
||||
m_aSystemData.pDisplay = gdk_x11_display_get_xdisplay(pDisplay);
|
||||
m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
|
||||
}
|
||||
GdkDisplay *pDisplay = GtkSalFrame::getGdkDisplay();
|
||||
if (GDK_IS_X11_DISPLAY(pDisplay))
|
||||
{
|
||||
m_aSystemData.pDisplay = gdk_x11_display_get_xdisplay(pDisplay);
|
||||
m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-press-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-release-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-in-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-out-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "destroy", G_CALLBACK(signalDestroy), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-press-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "button-release-event", G_CALLBACK(signalButton), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-in-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "focus-out-event", G_CALLBACK(signalFocus), this );
|
||||
g_signal_connect( G_OBJECT(m_pSocket), "destroy", G_CALLBACK(signalDestroy), this );
|
||||
|
||||
// #i59255# necessary due to sync effects with java child windows
|
||||
pParent->Flush();
|
||||
|
||||
// #i59255# necessary due to sync effects with java child windows
|
||||
pParent->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
GtkSalObject::~GtkSalObject()
|
||||
|
@ -251,29 +251,30 @@ IMPL_LINK_NOARG( MyWin, SelectHdl, ListBox&, void)
|
||||
{
|
||||
OUString aEntry = m_aSvpBitmaps->GetSelectedEntry();
|
||||
sal_Int32 nPos = aEntry.indexOf( ": " );
|
||||
if( nPos != -1 )
|
||||
{
|
||||
OStringBuffer aCommand( 64 );
|
||||
aCommand.append( "get " );
|
||||
aCommand.append( OUStringToOString( aEntry.copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ) );
|
||||
OString aAnswer( processCommand( aCommand.makeStringAndClear() ) );
|
||||
SvMemoryStream aStream( aAnswer.getLength() );
|
||||
aStream.WriteBytes( aAnswer.getStr(), aAnswer.getLength() );
|
||||
aStream.Seek( STREAM_SEEK_TO_BEGIN );
|
||||
if( nPos == -1 )
|
||||
return;
|
||||
|
||||
Graphic aGraphicResult;
|
||||
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
|
||||
rFilter.ImportGraphic( aGraphicResult, OUString("import"), aStream );
|
||||
OStringBuffer aCommand( 64 );
|
||||
aCommand.append( "get " );
|
||||
aCommand.append( OUStringToOString( aEntry.copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ) );
|
||||
OString aAnswer( processCommand( aCommand.makeStringAndClear() ) );
|
||||
SvMemoryStream aStream( aAnswer.getLength() );
|
||||
aStream.WriteBytes( aAnswer.getStr(), aAnswer.getLength() );
|
||||
aStream.Seek( STREAM_SEEK_TO_BEGIN );
|
||||
|
||||
Bitmap aBitmap = aGraphicResult.GetBitmap();
|
||||
Graphic aGraphicResult;
|
||||
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
|
||||
rFilter.ImportGraphic( aGraphicResult, OUString("import"), aStream );
|
||||
|
||||
Bitmap aBitmap = aGraphicResult.GetBitmap();
|
||||
|
||||
SAL_INFO("vcl", "got bitmap of size " << aBitmap.GetSizePixel().Width() << "x" << aBitmap.GetSizePixel().Height());
|
||||
Size aFixedSize( aBitmap.GetSizePixel() );
|
||||
aFixedSize.Width() += 10;
|
||||
aFixedSize.Height() += 10;
|
||||
m_aImage->SetSizePixel( aFixedSize );
|
||||
m_aImage->SetImage( Image( BitmapEx( aBitmap ) ) );
|
||||
|
||||
SAL_INFO("vcl", "got bitmap of size " << aBitmap.GetSizePixel().Width() << "x" << aBitmap.GetSizePixel().Height());
|
||||
Size aFixedSize( aBitmap.GetSizePixel() );
|
||||
aFixedSize.Width() += 10;
|
||||
aFixedSize.Height() += 10;
|
||||
m_aImage->SetSizePixel( aFixedSize );
|
||||
m_aImage->SetImage( Image( BitmapEx( aBitmap ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user