2019-01-10 07:38:59 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <FileDefinitionWidgetDraw.hxx>
|
|
|
|
|
|
|
|
#include <sal/config.h>
|
|
|
|
#include <svdata.hxx>
|
|
|
|
#include <rtl/bootstrap.hxx>
|
|
|
|
#include <config_folders.h>
|
|
|
|
|
2019-01-29 13:45:12 +01:00
|
|
|
#include <basegfx/range/b2drectangle.hxx>
|
|
|
|
#include <basegfx/polygon/b2dpolygontools.hxx>
|
2019-03-03 00:11:54 +01:00
|
|
|
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
2019-01-29 13:45:12 +01:00
|
|
|
|
2019-02-08 21:56:14 +01:00
|
|
|
#include <tools/stream.hxx>
|
|
|
|
#include <vcl/bitmapex.hxx>
|
|
|
|
#include <vcl/BitmapTools.hxx>
|
|
|
|
|
2019-03-03 00:11:54 +01:00
|
|
|
#include <vcl/pngwrite.hxx>
|
|
|
|
|
|
|
|
#include <comphelper/seqstream.hxx>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
|
|
|
|
#include <com/sun/star/graphic/SvgTools.hpp>
|
|
|
|
#include <basegfx/DrawCommands.hxx>
|
|
|
|
|
|
|
|
using namespace css;
|
|
|
|
|
2019-01-10 07:38:59 +01:00
|
|
|
namespace vcl
|
|
|
|
{
|
|
|
|
namespace
|
|
|
|
{
|
2019-01-22 21:12:40 +01:00
|
|
|
OUString lcl_getThemeDefinitionPath()
|
2019-01-10 07:38:59 +01:00
|
|
|
{
|
2019-01-22 21:12:40 +01:00
|
|
|
OUString sPath("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/theme_definitions/");
|
2019-01-10 07:38:59 +01:00
|
|
|
rtl::Bootstrap::expandMacros(sPath);
|
|
|
|
return sPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
|
|
|
FileDefinitionWidgetDraw::FileDefinitionWidgetDraw(SalGraphics& rGraphics)
|
|
|
|
: m_rGraphics(rGraphics)
|
|
|
|
{
|
2019-02-08 21:56:14 +01:00
|
|
|
OUString sDefinitionBasePath = lcl_getThemeDefinitionPath();
|
|
|
|
WidgetDefinitionReader aReader(sDefinitionBasePath + "definition.xml", sDefinitionBasePath);
|
2019-01-25 17:33:33 +01:00
|
|
|
aReader.read(m_aWidgetDefinition);
|
2019-01-10 07:38:59 +01:00
|
|
|
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->maNWFData.mbNoFocusRects = true;
|
|
|
|
pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
|
2019-02-19 14:26:40 +01:00
|
|
|
pSVData->maNWFData.mbNoActiveTabTextRaise = true;
|
|
|
|
pSVData->maNWFData.mbCenteredTabs = true;
|
|
|
|
pSVData->maNWFData.mbProgressNeedsErase = true;
|
|
|
|
pSVData->maNWFData.mnStatusBarLowerRightOffset = 10;
|
2019-03-03 13:35:24 +01:00
|
|
|
pSVData->maNWFData.mbCanDrawWidgetAnySize = true;
|
2019-01-10 07:38:59 +01:00
|
|
|
}
|
|
|
|
|
2019-01-29 13:53:48 +01:00
|
|
|
bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart ePart)
|
2019-01-10 07:38:59 +01:00
|
|
|
{
|
2019-01-22 21:24:15 +01:00
|
|
|
switch (eType)
|
|
|
|
{
|
|
|
|
case ControlType::Generic:
|
|
|
|
case ControlType::Pushbutton:
|
|
|
|
case ControlType::Radiobutton:
|
|
|
|
case ControlType::Checkbox:
|
2019-01-29 13:51:50 +01:00
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Combobox:
|
2019-01-29 13:53:48 +01:00
|
|
|
if (ePart == ControlPart::HasBackgroundTexture)
|
|
|
|
return false;
|
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Editbox:
|
|
|
|
case ControlType::EditboxNoBorder:
|
|
|
|
case ControlType::MultilineEditbox:
|
2019-01-24 18:00:47 +01:00
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Listbox:
|
2019-03-02 23:24:13 +01:00
|
|
|
if (ePart == ControlPart::HasBackgroundTexture)
|
|
|
|
return false;
|
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Spinbox:
|
2019-02-08 22:22:12 +01:00
|
|
|
if (ePart == ControlPart::AllButtons)
|
|
|
|
return false;
|
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::SpinButtons:
|
2019-02-19 14:26:40 +01:00
|
|
|
return false;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::TabItem:
|
|
|
|
case ControlType::TabPane:
|
|
|
|
case ControlType::TabHeader:
|
|
|
|
case ControlType::TabBody:
|
2019-02-19 14:26:40 +01:00
|
|
|
return true;
|
2019-02-19 14:12:42 +01:00
|
|
|
case ControlType::Scrollbar:
|
|
|
|
if (ePart == ControlPart::DrawBackgroundHorz
|
|
|
|
|| ePart == ControlPart::DrawBackgroundVert)
|
|
|
|
return false;
|
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Slider:
|
|
|
|
case ControlType::Fixedline:
|
|
|
|
case ControlType::Toolbar:
|
2019-03-02 23:37:02 +01:00
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Menubar:
|
|
|
|
case ControlType::MenuPopup:
|
2019-02-19 14:21:42 +01:00
|
|
|
return false;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Progress:
|
2019-02-19 14:21:42 +01:00
|
|
|
return true;
|
2019-03-03 13:35:24 +01:00
|
|
|
case ControlType::IntroProgress:
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Tooltip:
|
2019-03-02 23:30:42 +01:00
|
|
|
return false;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::WindowBackground:
|
|
|
|
case ControlType::Frame:
|
|
|
|
case ControlType::ListNode:
|
|
|
|
case ControlType::ListNet:
|
|
|
|
case ControlType::ListHeader:
|
2019-03-02 23:40:22 +01:00
|
|
|
return true;
|
2019-01-22 21:24:15 +01:00
|
|
|
}
|
|
|
|
|
2019-01-10 07:38:59 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FileDefinitionWidgetDraw::hitTestNativeControl(
|
|
|
|
ControlType /*eType*/, ControlPart /*ePart*/,
|
|
|
|
const tools::Rectangle& /*rBoundingControlRegion*/, const Point& /*aPos*/, bool& /*rIsInside*/)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-01-22 21:24:15 +01:00
|
|
|
namespace
|
|
|
|
{
|
2019-03-03 00:11:54 +01:00
|
|
|
void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics, long nX, long nY,
|
|
|
|
long nWidth, long nHeight)
|
|
|
|
{
|
|
|
|
basegfx::B2DRectangle aSVGRect = rDrawRoot.maRectangle;
|
|
|
|
|
|
|
|
basegfx::B2DRange aTargetSurface(nX, nY, nX + nWidth + 1, nY + nHeight + 1);
|
|
|
|
|
|
|
|
for (std::shared_ptr<gfx::DrawBase> const& pDrawBase : rDrawRoot.maChildren)
|
|
|
|
{
|
|
|
|
switch (pDrawBase->getType())
|
|
|
|
{
|
|
|
|
case gfx::DrawCommandType::Rectangle:
|
|
|
|
{
|
|
|
|
auto const& rRectangle = static_cast<gfx::DrawRectangle const&>(*pDrawBase);
|
|
|
|
|
|
|
|
basegfx::B2DRange aInputRectangle(rRectangle.maRectangle);
|
|
|
|
|
|
|
|
basegfx::B2DRange aFinalRectangle(
|
|
|
|
aTargetSurface.getMinX() + aInputRectangle.getMinX(),
|
|
|
|
aTargetSurface.getMinY() + aInputRectangle.getMinY(),
|
|
|
|
aTargetSurface.getMaxX() - (aSVGRect.getMaxX() - aInputRectangle.getMaxX()),
|
|
|
|
aTargetSurface.getMaxY() - (aSVGRect.getMaxY() - aInputRectangle.getMaxY()));
|
|
|
|
|
|
|
|
aInputRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
|
|
|
|
-aInputRectangle.getMinX(), -aInputRectangle.getMinY()));
|
|
|
|
aInputRectangle.transform(basegfx::utils::createScaleB2DHomMatrix(
|
|
|
|
aFinalRectangle.getWidth() / aInputRectangle.getWidth(),
|
|
|
|
aFinalRectangle.getHeight() / aInputRectangle.getHeight()));
|
|
|
|
aInputRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
|
|
|
|
aFinalRectangle.getMinX() - 0.5,
|
|
|
|
aFinalRectangle.getMinY()
|
|
|
|
- 0.5)); // compensate 0.5 for different interpretation of where the center of a pixel is
|
|
|
|
|
|
|
|
basegfx::B2DPolygon aB2DPolygon = basegfx::utils::createPolygonFromRect(
|
|
|
|
aInputRectangle, rRectangle.mnRx / aFinalRectangle.getWidth() * 2.0,
|
|
|
|
rRectangle.mnRy / aFinalRectangle.getHeight() * 2.0);
|
|
|
|
|
|
|
|
if (rRectangle.mpFillColor)
|
|
|
|
{
|
|
|
|
rGraphics.SetLineColor();
|
|
|
|
rGraphics.SetFillColor(Color(*rRectangle.mpFillColor));
|
|
|
|
rGraphics.DrawPolyPolygon(basegfx::B2DHomMatrix(),
|
|
|
|
basegfx::B2DPolyPolygon(aB2DPolygon), 0.0f, nullptr);
|
|
|
|
}
|
|
|
|
if (rRectangle.mpStrokeColor)
|
|
|
|
{
|
|
|
|
rGraphics.SetLineColor(Color(*rRectangle.mpStrokeColor));
|
|
|
|
rGraphics.SetFillColor();
|
|
|
|
rGraphics.DrawPolyLine(
|
|
|
|
basegfx::B2DHomMatrix(), aB2DPolygon, 0.0f,
|
|
|
|
basegfx::B2DVector(rRectangle.mnStrokeWidth, rRectangle.mnStrokeWidth),
|
|
|
|
basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND, 0.0f, false,
|
|
|
|
nullptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case gfx::DrawCommandType::Path:
|
|
|
|
{
|
|
|
|
auto const& rPath = static_cast<gfx::DrawPath const&>(*pDrawBase);
|
|
|
|
|
|
|
|
basegfx::B2DRange aPolyPolygonRange(rPath.maPolyPolygon.getB2DRange());
|
|
|
|
basegfx::B2DPolyPolygon aPolyPolygon(rPath.maPolyPolygon);
|
|
|
|
|
|
|
|
basegfx::B2DRange aFinalRectangle(
|
|
|
|
aTargetSurface.getMinX() + aPolyPolygonRange.getMinX(),
|
|
|
|
aTargetSurface.getMinY() + aPolyPolygonRange.getMinY(),
|
|
|
|
aTargetSurface.getMaxX() - (aSVGRect.getMaxX() - aPolyPolygonRange.getMaxX()),
|
|
|
|
aTargetSurface.getMaxY() - (aSVGRect.getMaxY() - aPolyPolygonRange.getMaxY()));
|
|
|
|
|
|
|
|
aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(
|
|
|
|
-aPolyPolygonRange.getMinX(), -aPolyPolygonRange.getMinY()));
|
2019-03-07 14:00:16 +01:00
|
|
|
|
|
|
|
double fScaleX = 1.0;
|
|
|
|
double fScaleY = 1.0;
|
|
|
|
if (aPolyPolygonRange.getWidth() > 0.0)
|
|
|
|
fScaleX = aFinalRectangle.getWidth() / aPolyPolygonRange.getWidth();
|
|
|
|
if (aPolyPolygonRange.getHeight() > 0.0)
|
|
|
|
fScaleY = aFinalRectangle.getHeight() / aPolyPolygonRange.getHeight();
|
|
|
|
|
|
|
|
aPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fScaleX, fScaleY));
|
|
|
|
|
2019-03-03 00:11:54 +01:00
|
|
|
aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(
|
|
|
|
aFinalRectangle.getMinX() - 0.5, aFinalRectangle.getMinY() - 0.5));
|
|
|
|
|
|
|
|
if (rPath.mpFillColor)
|
|
|
|
{
|
|
|
|
rGraphics.SetLineColor();
|
|
|
|
rGraphics.SetFillColor(Color(*rPath.mpFillColor));
|
|
|
|
rGraphics.DrawPolyPolygon(basegfx::B2DHomMatrix(), aPolyPolygon, 0.0f, nullptr);
|
|
|
|
}
|
|
|
|
if (rPath.mpStrokeColor)
|
|
|
|
{
|
|
|
|
rGraphics.SetLineColor(Color(*rPath.mpStrokeColor));
|
|
|
|
rGraphics.SetFillColor();
|
|
|
|
for (auto const& rPolygon : aPolyPolygon)
|
|
|
|
{
|
|
|
|
rGraphics.DrawPolyLine(
|
|
|
|
basegfx::B2DHomMatrix(), rPolygon, 0.0f,
|
|
|
|
basegfx::B2DVector(rPath.mnStrokeWidth, rPath.mnStrokeWidth),
|
|
|
|
basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND, 0.0f, false,
|
|
|
|
nullptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-22 21:24:15 +01:00
|
|
|
void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCommands,
|
|
|
|
SalGraphics& rGraphics, long nX, long nY, long nWidth, long nHeight)
|
|
|
|
{
|
|
|
|
for (std::shared_ptr<DrawCommand> const& pDrawCommand : rDrawCommands)
|
|
|
|
{
|
|
|
|
switch (pDrawCommand->maType)
|
|
|
|
{
|
|
|
|
case DrawCommandType::RECTANGLE:
|
|
|
|
{
|
|
|
|
auto const& rRectDrawCommand
|
|
|
|
= static_cast<RectangleDrawCommand const&>(*pDrawCommand);
|
|
|
|
|
2019-01-29 13:45:12 +01:00
|
|
|
basegfx::B2DRectangle rRect(
|
|
|
|
nX + (nWidth * rRectDrawCommand.mfX1), nY + (nHeight * rRectDrawCommand.mfY1),
|
|
|
|
nX + (nWidth * rRectDrawCommand.mfX2), nY + (nHeight * rRectDrawCommand.mfY2));
|
|
|
|
|
|
|
|
basegfx::B2DPolygon aB2DPolygon = basegfx::utils::createPolygonFromRect(
|
|
|
|
rRect, rRectDrawCommand.mnRx / rRect.getWidth() * 2.0,
|
|
|
|
rRectDrawCommand.mnRy / rRect.getHeight() * 2.0);
|
|
|
|
|
2019-01-25 17:01:12 +01:00
|
|
|
rGraphics.SetLineColor();
|
2019-01-22 21:24:15 +01:00
|
|
|
rGraphics.SetFillColor(rRectDrawCommand.maFillColor);
|
|
|
|
rGraphics.DrawPolyPolygon(basegfx::B2DHomMatrix(),
|
|
|
|
basegfx::B2DPolyPolygon(aB2DPolygon), 0.0f, nullptr);
|
2019-01-25 17:01:12 +01:00
|
|
|
rGraphics.SetLineColor(rRectDrawCommand.maStrokeColor);
|
|
|
|
rGraphics.SetFillColor();
|
|
|
|
rGraphics.DrawPolyLine(basegfx::B2DHomMatrix(), aB2DPolygon, 0.0f,
|
|
|
|
basegfx::B2DVector(rRectDrawCommand.mnStrokeWidth,
|
|
|
|
rRectDrawCommand.mnStrokeWidth),
|
|
|
|
basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND,
|
|
|
|
0.0f, false, nullptr);
|
2019-01-22 21:24:15 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:30:00 +01:00
|
|
|
case DrawCommandType::CIRCLE:
|
|
|
|
{
|
|
|
|
auto const& rCircleDrawCommand
|
|
|
|
= static_cast<CircleDrawCommand const&>(*pDrawCommand);
|
|
|
|
|
2019-01-29 13:45:12 +01:00
|
|
|
basegfx::B2DRectangle rRect(nX + (nWidth * rCircleDrawCommand.mfX1),
|
|
|
|
nY + (nHeight * rCircleDrawCommand.mfY1),
|
|
|
|
nX + (nWidth * rCircleDrawCommand.mfX2),
|
|
|
|
nY + (nHeight * rCircleDrawCommand.mfY2));
|
|
|
|
|
|
|
|
basegfx::B2DPolygon aB2DPolygon = basegfx::utils::createPolygonFromEllipse(
|
|
|
|
rRect.getCenter(), rRect.getWidth() / 2.0, rRect.getHeight() / 2.0);
|
2019-01-22 21:30:00 +01:00
|
|
|
|
|
|
|
rGraphics.SetLineColor(rCircleDrawCommand.maStrokeColor);
|
|
|
|
rGraphics.SetFillColor(rCircleDrawCommand.maFillColor);
|
|
|
|
rGraphics.DrawPolyPolygon(basegfx::B2DHomMatrix(),
|
|
|
|
basegfx::B2DPolyPolygon(aB2DPolygon), 0.0f, nullptr);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-25 16:43:54 +01:00
|
|
|
case DrawCommandType::LINE:
|
|
|
|
{
|
|
|
|
auto const& rLineDrawCommand = static_cast<LineDrawCommand const&>(*pDrawCommand);
|
2019-01-29 13:29:43 +01:00
|
|
|
Point aRectPoint(nX + 1, nY + 1);
|
2019-01-25 16:43:54 +01:00
|
|
|
|
2019-01-29 13:29:43 +01:00
|
|
|
Size aRectSize(nWidth - 1, nHeight - 1);
|
2019-01-25 16:43:54 +01:00
|
|
|
|
|
|
|
rGraphics.SetFillColor();
|
|
|
|
rGraphics.SetLineColor(rLineDrawCommand.maStrokeColor);
|
|
|
|
|
|
|
|
basegfx::B2DPolygon aB2DPolygon{
|
|
|
|
{ aRectPoint.X() + (aRectSize.Width() * rLineDrawCommand.mfX1),
|
|
|
|
aRectPoint.Y() + (aRectSize.Height() * rLineDrawCommand.mfY1) },
|
|
|
|
{ aRectPoint.X() + (aRectSize.Width() * rLineDrawCommand.mfX2),
|
|
|
|
aRectPoint.Y() + (aRectSize.Height() * rLineDrawCommand.mfY2) },
|
|
|
|
};
|
|
|
|
|
|
|
|
rGraphics.DrawPolyLine(basegfx::B2DHomMatrix(), aB2DPolygon, 0.0f,
|
|
|
|
basegfx::B2DVector(rLineDrawCommand.mnStrokeWidth,
|
|
|
|
rLineDrawCommand.mnStrokeWidth),
|
|
|
|
basegfx::B2DLineJoin::Round, css::drawing::LineCap_ROUND,
|
|
|
|
0.0f, false, nullptr);
|
|
|
|
}
|
|
|
|
break;
|
2019-02-08 21:56:14 +01:00
|
|
|
case DrawCommandType::IMAGE:
|
|
|
|
{
|
|
|
|
auto const& rDrawCommand = static_cast<ImageDrawCommand const&>(*pDrawCommand);
|
|
|
|
SvFileStream aFileStream(rDrawCommand.msSource, StreamMode::READ);
|
|
|
|
BitmapEx aBitmap;
|
|
|
|
vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, 1.0);
|
|
|
|
long nImageWidth = aBitmap.GetSizePixel().Width();
|
|
|
|
long nImageHeight = aBitmap.GetSizePixel().Height();
|
|
|
|
SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, nImageWidth, nImageHeight);
|
|
|
|
rGraphics.DrawBitmap(aTR, *aBitmap.GetBitmap().ImplGetSalBitmap().get(),
|
|
|
|
*aBitmap.GetAlpha().ImplGetSalBitmap().get(), nullptr);
|
|
|
|
}
|
|
|
|
break;
|
2019-03-03 00:11:54 +01:00
|
|
|
case DrawCommandType::EXTERNAL:
|
|
|
|
{
|
|
|
|
auto const& rDrawCommand = static_cast<ImageDrawCommand const&>(*pDrawCommand);
|
|
|
|
SvFileStream aFileStream(rDrawCommand.msSource, StreamMode::READ);
|
|
|
|
|
|
|
|
uno::Reference<uno::XComponentContext> xContext(
|
|
|
|
comphelper::getProcessComponentContext());
|
|
|
|
const uno::Reference<graphic::XSvgParser> xSvgParser
|
|
|
|
= graphic::SvgTools::create(xContext);
|
|
|
|
|
|
|
|
std::size_t nSize = aFileStream.remainingSize();
|
|
|
|
std::vector<sal_Int8> aBuffer(nSize + 1);
|
|
|
|
aFileStream.ReadBytes(aBuffer.data(), nSize);
|
|
|
|
aBuffer[nSize] = 0;
|
|
|
|
|
|
|
|
uno::Sequence<sal_Int8> aData(aBuffer.data(), nSize + 1);
|
|
|
|
uno::Reference<io::XInputStream> aInputStream(
|
|
|
|
new comphelper::SequenceInputStream(aData));
|
|
|
|
|
|
|
|
uno::Any aAny = xSvgParser->getDrawCommands(aInputStream, "");
|
|
|
|
if (aAny.has<sal_uInt64>())
|
|
|
|
{
|
|
|
|
auto* pDrawRoot = reinterpret_cast<gfx::DrawRoot*>(aAny.get<sal_uInt64>());
|
|
|
|
drawFromDrawCommands(*pDrawRoot, rGraphics, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
2019-02-19 14:12:42 +01:00
|
|
|
bool FileDefinitionWidgetDraw::resolveDefinition(ControlType eType, ControlPart ePart,
|
|
|
|
ControlState eState,
|
|
|
|
const ImplControlValue& rValue, long nX, long nY,
|
|
|
|
long nWidth, long nHeight)
|
|
|
|
{
|
|
|
|
bool bOK = false;
|
|
|
|
auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ePart);
|
|
|
|
if (pPart)
|
|
|
|
{
|
2019-03-03 10:00:05 +01:00
|
|
|
auto const& aStates = pPart->getStates(eType, eState, rValue);
|
2019-02-19 14:12:42 +01:00
|
|
|
if (!aStates.empty())
|
|
|
|
{
|
|
|
|
// use last defined state
|
|
|
|
auto const& pState = aStates.back();
|
|
|
|
{
|
|
|
|
munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, nY, nWidth, nHeight);
|
|
|
|
bOK = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bOK;
|
|
|
|
}
|
|
|
|
|
2019-01-22 21:24:15 +01:00
|
|
|
bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
|
|
|
|
const tools::Rectangle& rControlRegion,
|
|
|
|
ControlState eState,
|
2019-01-23 00:58:23 +01:00
|
|
|
const ImplControlValue& rValue,
|
2019-01-10 07:38:59 +01:00
|
|
|
const OUString& /*aCaptions*/)
|
|
|
|
{
|
2019-01-22 21:24:15 +01:00
|
|
|
bool bOldAA = m_rGraphics.getAntiAliasB2DDraw();
|
|
|
|
m_rGraphics.setAntiAliasB2DDraw(true);
|
|
|
|
|
2019-01-29 13:45:12 +01:00
|
|
|
long nWidth = rControlRegion.GetWidth() - 1;
|
|
|
|
long nHeight = rControlRegion.GetHeight() - 1;
|
|
|
|
long nX = rControlRegion.Left();
|
|
|
|
long nY = rControlRegion.Top();
|
2019-01-22 21:24:15 +01:00
|
|
|
|
|
|
|
bool bOK = false;
|
|
|
|
|
|
|
|
switch (eType)
|
|
|
|
{
|
|
|
|
case ControlType::Pushbutton:
|
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
/*bool bIsAction = false;
|
|
|
|
const PushButtonValue* pPushButtonValue = static_cast<const PushButtonValue*>(&rValue);
|
|
|
|
if (pPushButtonValue)
|
|
|
|
bIsAction = pPushButtonValue->mbIsAction;*/
|
|
|
|
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-01-22 21:24:15 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ControlType::Radiobutton:
|
2019-01-22 21:30:00 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-01-22 21:30:00 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Checkbox:
|
2019-01-29 13:51:50 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-01-29 13:51:50 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Combobox:
|
2019-01-29 13:53:48 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-01-29 13:53:48 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Editbox:
|
|
|
|
case ControlType::EditboxNoBorder:
|
|
|
|
case ControlType::MultilineEditbox:
|
2019-01-24 18:00:47 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-01-24 18:00:47 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Listbox:
|
2019-03-02 23:24:13 +01:00
|
|
|
{
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Spinbox:
|
2019-02-08 22:22:12 +01:00
|
|
|
{
|
|
|
|
if (rValue.getType() == ControlType::SpinButtons)
|
|
|
|
{
|
|
|
|
const SpinbuttonValue* pSpinVal = static_cast<const SpinbuttonValue*>(&rValue);
|
|
|
|
|
2019-02-20 11:48:14 +01:00
|
|
|
{
|
|
|
|
ControlPart eUpButtonPart = pSpinVal->mnUpperPart;
|
|
|
|
ControlState eUpButtonState = pSpinVal->mnUpperState;
|
2019-02-08 22:22:12 +01:00
|
|
|
|
2019-02-20 11:48:14 +01:00
|
|
|
long nUpperX = pSpinVal->maUpperRect.Left();
|
|
|
|
long nUpperY = pSpinVal->maUpperRect.Top();
|
|
|
|
long nUpperWidth = pSpinVal->maUpperRect.GetWidth() - 1;
|
|
|
|
long nUpperHeight = pSpinVal->maUpperRect.GetHeight() - 1;
|
2019-02-08 22:22:12 +01:00
|
|
|
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, eUpButtonPart, eUpButtonState,
|
|
|
|
ImplControlValue(), nUpperX, nUpperY, nUpperWidth,
|
|
|
|
nUpperHeight);
|
2019-02-08 22:22:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bOK)
|
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
ControlPart eDownButtonPart = pSpinVal->mnLowerPart;
|
|
|
|
ControlState eDownButtonState = pSpinVal->mnLowerState;
|
|
|
|
|
|
|
|
long nLowerX = pSpinVal->maLowerRect.Left();
|
|
|
|
long nLowerY = pSpinVal->maLowerRect.Top();
|
|
|
|
long nLowerWidth = pSpinVal->maLowerRect.GetWidth() - 1;
|
|
|
|
long nLowerHeight = pSpinVal->maLowerRect.GetHeight() - 1;
|
|
|
|
|
|
|
|
bOK = resolveDefinition(eType, eDownButtonPart, eDownButtonState,
|
|
|
|
ImplControlValue(), nLowerX, nLowerY, nLowerWidth,
|
|
|
|
nLowerHeight);
|
2019-02-08 22:22:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-02-08 22:22:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::SpinButtons:
|
2019-02-19 14:26:40 +01:00
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::TabItem:
|
2019-02-19 14:26:40 +01:00
|
|
|
case ControlType::TabHeader:
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::TabPane:
|
|
|
|
case ControlType::TabBody:
|
2019-02-19 14:26:40 +01:00
|
|
|
{
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Scrollbar:
|
2019-02-19 14:12:42 +01:00
|
|
|
{
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Slider:
|
2019-02-19 14:05:02 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
|
2019-02-19 14:05:02 +01:00
|
|
|
if (bOK)
|
|
|
|
{
|
|
|
|
const SliderValue* pSliderValue = static_cast<const SliderValue*>(&rValue);
|
|
|
|
|
2019-02-20 11:48:14 +01:00
|
|
|
long nThumbX = pSliderValue->maThumbRect.Left();
|
|
|
|
long nThumbY = pSliderValue->maThumbRect.Top();
|
|
|
|
long nThumbWidth = pSliderValue->maThumbRect.GetWidth() - 1;
|
|
|
|
long nThumbHeight = pSliderValue->maThumbRect.GetHeight() - 1;
|
|
|
|
|
|
|
|
bOK = resolveDefinition(eType, ControlPart::Button,
|
|
|
|
eState | pSliderValue->mnThumbState, rValue, nThumbX,
|
|
|
|
nThumbY, nThumbWidth, nThumbHeight);
|
2019-02-19 14:05:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Fixedline:
|
2019-02-19 14:17:54 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-02-19 14:17:54 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Toolbar:
|
2019-03-02 23:37:02 +01:00
|
|
|
{
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Menubar:
|
|
|
|
break;
|
|
|
|
case ControlType::MenuPopup:
|
|
|
|
break;
|
|
|
|
case ControlType::Progress:
|
2019-02-19 14:21:42 +01:00
|
|
|
{
|
2019-02-20 11:48:14 +01:00
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
2019-02-19 14:21:42 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-03-03 13:35:24 +01:00
|
|
|
case ControlType::IntroProgress:
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::Tooltip:
|
|
|
|
break;
|
|
|
|
case ControlType::WindowBackground:
|
|
|
|
case ControlType::Frame:
|
2019-03-02 23:30:42 +01:00
|
|
|
{
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
case ControlType::ListNode:
|
|
|
|
case ControlType::ListNet:
|
|
|
|
case ControlType::ListHeader:
|
2019-03-02 23:40:22 +01:00
|
|
|
{
|
|
|
|
bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
|
|
|
|
}
|
|
|
|
break;
|
2019-01-22 21:24:15 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_rGraphics.setAntiAliasB2DDraw(bOldAA);
|
|
|
|
|
|
|
|
return bOK;
|
2019-01-10 07:38:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool FileDefinitionWidgetDraw::getNativeControlRegion(
|
2019-02-08 22:22:12 +01:00
|
|
|
ControlType eType, ControlPart ePart, const tools::Rectangle& rBoundingControlRegion,
|
2019-01-29 13:51:50 +01:00
|
|
|
ControlState /*eState*/, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
|
2019-02-08 22:22:12 +01:00
|
|
|
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
|
2019-01-10 07:38:59 +01:00
|
|
|
{
|
2019-03-03 10:13:35 +01:00
|
|
|
Point aLocation(rBoundingControlRegion.TopLeft());
|
|
|
|
|
2019-01-29 13:51:50 +01:00
|
|
|
switch (eType)
|
|
|
|
{
|
2019-02-08 22:22:12 +01:00
|
|
|
case ControlType::Spinbox:
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
auto const& pButtonUpPart
|
|
|
|
= m_aWidgetDefinition.getDefinition(eType, ControlPart::ButtonUp);
|
|
|
|
if (!pButtonUpPart)
|
|
|
|
return false;
|
|
|
|
Size aButtonSizeUp(pButtonUpPart->mnWidth, pButtonUpPart->mnHeight);
|
|
|
|
|
|
|
|
auto const& pButtonDownPart
|
|
|
|
= m_aWidgetDefinition.getDefinition(eType, ControlPart::ButtonDown);
|
|
|
|
if (!pButtonDownPart)
|
|
|
|
return false;
|
|
|
|
Size aButtonSizeDown(pButtonDownPart->mnWidth, pButtonDownPart->mnHeight);
|
|
|
|
|
2019-03-03 10:13:35 +01:00
|
|
|
OString sOrientation = "decrease-edit-increase";
|
2019-02-08 22:22:12 +01:00
|
|
|
|
2019-03-03 10:13:35 +01:00
|
|
|
if (sOrientation == "decrease-edit-increase")
|
2019-02-08 22:22:12 +01:00
|
|
|
{
|
2019-03-03 10:13:35 +01:00
|
|
|
if (ePart == ControlPart::ButtonUp)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth()
|
|
|
|
- aButtonSizeUp.Width(),
|
|
|
|
aLocation.Y());
|
|
|
|
rNativeContentRegion = tools::Rectangle(aPoint, aButtonSizeUp);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::ButtonDown)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, aButtonSizeDown);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::SubEdit)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Point aPoint(aLocation.X() + aButtonSizeDown.Width(), aLocation.Y());
|
|
|
|
Size aSize(rBoundingControlRegion.GetWidth()
|
|
|
|
- (aButtonSizeDown.Width() + aButtonSizeUp.Width()),
|
|
|
|
std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height()));
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeContentRegion = tools::Rectangle(aPoint, aSize);
|
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::Entire)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Size aSize(rBoundingControlRegion.GetWidth(),
|
|
|
|
std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height()));
|
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, aSize);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
2019-02-08 22:22:12 +01:00
|
|
|
}
|
2019-03-03 10:13:35 +01:00
|
|
|
else
|
2019-02-08 22:22:12 +01:00
|
|
|
{
|
2019-03-03 10:13:35 +01:00
|
|
|
if (ePart == ControlPart::ButtonUp)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth()
|
|
|
|
- aButtonSizeUp.Width(),
|
|
|
|
aLocation.Y());
|
|
|
|
rNativeContentRegion = tools::Rectangle(aPoint, aButtonSizeUp);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::ButtonDown)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth()
|
|
|
|
- (aButtonSizeDown.Width() + aButtonSizeUp.Width()),
|
|
|
|
aLocation.Y());
|
|
|
|
rNativeContentRegion = tools::Rectangle(aPoint, aButtonSizeDown);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::SubEdit)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Size aSize(rBoundingControlRegion.GetWidth()
|
|
|
|
- (aButtonSizeDown.Width() + aButtonSizeUp.Width()),
|
|
|
|
std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height()));
|
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, aSize);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::Entire)
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
Size aSize(rBoundingControlRegion.GetWidth(),
|
|
|
|
std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height()));
|
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, aSize);
|
2019-03-03 10:13:35 +01:00
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
2019-02-08 22:22:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-01-29 13:51:50 +01:00
|
|
|
case ControlType::Checkbox:
|
2019-03-04 10:05:36 +01:00
|
|
|
{
|
|
|
|
auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ControlPart::Entire);
|
|
|
|
if (!pPart)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Size aSize(pPart->mnWidth, pPart->mnHeight);
|
|
|
|
rNativeContentRegion = tools::Rectangle(Point(), aSize);
|
2019-01-29 13:51:50 +01:00
|
|
|
return true;
|
2019-03-04 10:05:36 +01:00
|
|
|
}
|
2019-01-29 13:53:48 +01:00
|
|
|
case ControlType::Radiobutton:
|
2019-03-04 10:05:36 +01:00
|
|
|
{
|
|
|
|
auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ControlPart::Entire);
|
|
|
|
if (!pPart)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Size aSize(pPart->mnWidth, pPart->mnHeight);
|
|
|
|
rNativeContentRegion = tools::Rectangle(Point(), aSize);
|
2019-01-29 13:53:48 +01:00
|
|
|
return true;
|
2019-03-04 10:05:36 +01:00
|
|
|
}
|
2019-02-19 14:26:40 +01:00
|
|
|
case ControlType::TabItem:
|
|
|
|
{
|
2019-03-04 10:05:36 +01:00
|
|
|
auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ControlPart::Entire);
|
|
|
|
if (!pPart)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
rNativeBoundingRegion = tools::Rectangle(
|
|
|
|
rBoundingControlRegion.TopLeft(),
|
|
|
|
Size(rBoundingControlRegion.GetWidth() + pPart->mnMarginWidth,
|
|
|
|
rBoundingControlRegion.GetHeight() + pPart->mnMarginHeight));
|
2019-02-19 14:26:40 +01:00
|
|
|
rNativeContentRegion = rNativeBoundingRegion;
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-03 13:35:24 +01:00
|
|
|
case ControlType::Editbox:
|
|
|
|
case ControlType::EditboxNoBorder:
|
|
|
|
case ControlType::MultilineEditbox:
|
|
|
|
{
|
|
|
|
rNativeBoundingRegion = rBoundingControlRegion;
|
|
|
|
rNativeContentRegion = rBoundingControlRegion;
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-07 14:00:16 +01:00
|
|
|
break;
|
|
|
|
case ControlType::Scrollbar:
|
|
|
|
{
|
|
|
|
if (ePart == ControlPart::ButtonUp || ePart == ControlPart::ButtonDown
|
|
|
|
|| ePart == ControlPart::ButtonLeft || ePart == ControlPart::ButtonRight)
|
|
|
|
{
|
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, Size(0, 0));
|
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rNativeBoundingRegion = rBoundingControlRegion;
|
|
|
|
rNativeContentRegion = rNativeBoundingRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-03-07 14:10:24 +01:00
|
|
|
case ControlType::Combobox:
|
|
|
|
case ControlType::Listbox:
|
|
|
|
{
|
|
|
|
auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ControlPart::ButtonDown);
|
|
|
|
Size aComboButtonSize(pPart->mnWidth, pPart->mnHeight);
|
|
|
|
|
|
|
|
if (ePart == ControlPart::ButtonDown)
|
|
|
|
{
|
|
|
|
Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth()
|
|
|
|
- aComboButtonSize.Width(),
|
|
|
|
aLocation.Y());
|
|
|
|
rNativeContentRegion = tools::Rectangle(aPoint, aComboButtonSize);
|
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::SubEdit)
|
|
|
|
{
|
|
|
|
Size aSize(rBoundingControlRegion.GetWidth() - aComboButtonSize.Width(),
|
|
|
|
aComboButtonSize.Height());
|
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, aSize);
|
|
|
|
rNativeContentRegion.expand(1);
|
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (ePart == ControlPart::Entire)
|
|
|
|
{
|
|
|
|
Size aSize(rBoundingControlRegion.GetWidth(), aComboButtonSize.Height());
|
|
|
|
rNativeContentRegion = tools::Rectangle(aLocation, aSize);
|
|
|
|
rNativeBoundingRegion = rNativeContentRegion;
|
|
|
|
rNativeBoundingRegion.expand(1);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-03-03 13:35:24 +01:00
|
|
|
|
2019-01-29 13:51:50 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-01-10 07:38:59 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FileDefinitionWidgetDraw::updateSettings(AllSettings& rSettings)
|
|
|
|
{
|
|
|
|
StyleSettings aStyleSet = rSettings.GetStyleSettings();
|
|
|
|
|
2019-01-25 17:33:33 +01:00
|
|
|
aStyleSet.SetFaceColor(m_aWidgetDefinition.maFaceColor);
|
|
|
|
aStyleSet.SetCheckedColor(m_aWidgetDefinition.maCheckedColor);
|
|
|
|
aStyleSet.SetLightColor(m_aWidgetDefinition.maLightColor);
|
|
|
|
aStyleSet.SetLightBorderColor(m_aWidgetDefinition.maLightBorderColor);
|
|
|
|
aStyleSet.SetShadowColor(m_aWidgetDefinition.maShadowColor);
|
|
|
|
aStyleSet.SetDarkShadowColor(m_aWidgetDefinition.maDarkShadowColor);
|
|
|
|
aStyleSet.SetButtonTextColor(m_aWidgetDefinition.maButtonTextColor);
|
|
|
|
aStyleSet.SetButtonRolloverTextColor(m_aWidgetDefinition.maButtonRolloverTextColor);
|
|
|
|
aStyleSet.SetRadioCheckTextColor(m_aWidgetDefinition.maRadioCheckTextColor);
|
|
|
|
aStyleSet.SetGroupTextColor(m_aWidgetDefinition.maGroupTextColor);
|
|
|
|
aStyleSet.SetLabelTextColor(m_aWidgetDefinition.maLabelTextColor);
|
|
|
|
aStyleSet.SetWindowColor(m_aWidgetDefinition.maWindowColor);
|
|
|
|
aStyleSet.SetWindowTextColor(m_aWidgetDefinition.maWindowTextColor);
|
|
|
|
aStyleSet.SetDialogColor(m_aWidgetDefinition.maDialogColor);
|
|
|
|
aStyleSet.SetDialogTextColor(m_aWidgetDefinition.maDialogTextColor);
|
|
|
|
aStyleSet.SetWorkspaceColor(m_aWidgetDefinition.maWorkspaceColor);
|
|
|
|
aStyleSet.SetMonoColor(m_aWidgetDefinition.maMonoColor);
|
|
|
|
aStyleSet.SetFieldColor(m_aWidgetDefinition.maFieldColor);
|
|
|
|
aStyleSet.SetFieldTextColor(m_aWidgetDefinition.maFieldTextColor);
|
|
|
|
aStyleSet.SetFieldRolloverTextColor(m_aWidgetDefinition.maFieldRolloverTextColor);
|
|
|
|
aStyleSet.SetActiveColor(m_aWidgetDefinition.maActiveColor);
|
|
|
|
aStyleSet.SetActiveTextColor(m_aWidgetDefinition.maActiveTextColor);
|
|
|
|
aStyleSet.SetActiveBorderColor(m_aWidgetDefinition.maActiveBorderColor);
|
|
|
|
aStyleSet.SetDeactiveColor(m_aWidgetDefinition.maDeactiveColor);
|
|
|
|
aStyleSet.SetDeactiveTextColor(m_aWidgetDefinition.maDeactiveTextColor);
|
|
|
|
aStyleSet.SetDeactiveBorderColor(m_aWidgetDefinition.maDeactiveBorderColor);
|
|
|
|
aStyleSet.SetMenuColor(m_aWidgetDefinition.maMenuColor);
|
|
|
|
aStyleSet.SetMenuBarColor(m_aWidgetDefinition.maMenuBarColor);
|
|
|
|
aStyleSet.SetMenuBarRolloverColor(m_aWidgetDefinition.maMenuBarRolloverColor);
|
|
|
|
aStyleSet.SetMenuBorderColor(m_aWidgetDefinition.maMenuBorderColor);
|
|
|
|
aStyleSet.SetMenuTextColor(m_aWidgetDefinition.maMenuTextColor);
|
|
|
|
aStyleSet.SetMenuBarTextColor(m_aWidgetDefinition.maMenuBarTextColor);
|
|
|
|
aStyleSet.SetMenuBarRolloverTextColor(m_aWidgetDefinition.maMenuBarRolloverTextColor);
|
|
|
|
aStyleSet.SetMenuBarHighlightTextColor(m_aWidgetDefinition.maMenuBarHighlightTextColor);
|
|
|
|
aStyleSet.SetMenuHighlightColor(m_aWidgetDefinition.maMenuHighlightColor);
|
|
|
|
aStyleSet.SetMenuHighlightTextColor(m_aWidgetDefinition.maMenuHighlightTextColor);
|
|
|
|
aStyleSet.SetHighlightColor(m_aWidgetDefinition.maHighlightColor);
|
|
|
|
aStyleSet.SetHighlightTextColor(m_aWidgetDefinition.maHighlightTextColor);
|
|
|
|
aStyleSet.SetActiveTabColor(m_aWidgetDefinition.maActiveTabColor);
|
|
|
|
aStyleSet.SetInactiveTabColor(m_aWidgetDefinition.maInactiveTabColor);
|
|
|
|
aStyleSet.SetTabTextColor(m_aWidgetDefinition.maTabTextColor);
|
|
|
|
aStyleSet.SetTabRolloverTextColor(m_aWidgetDefinition.maTabRolloverTextColor);
|
|
|
|
aStyleSet.SetTabHighlightTextColor(m_aWidgetDefinition.maTabHighlightTextColor);
|
|
|
|
aStyleSet.SetDisableColor(m_aWidgetDefinition.maDisableColor);
|
|
|
|
aStyleSet.SetHelpColor(m_aWidgetDefinition.maHelpColor);
|
|
|
|
aStyleSet.SetHelpTextColor(m_aWidgetDefinition.maHelpTextColor);
|
|
|
|
aStyleSet.SetLinkColor(m_aWidgetDefinition.maLinkColor);
|
|
|
|
aStyleSet.SetVisitedLinkColor(m_aWidgetDefinition.maVisitedLinkColor);
|
|
|
|
aStyleSet.SetToolTextColor(m_aWidgetDefinition.maToolTextColor);
|
|
|
|
aStyleSet.SetFontColor(m_aWidgetDefinition.maFontColor);
|
2019-01-10 07:38:59 +01:00
|
|
|
|
2019-03-03 13:41:28 +01:00
|
|
|
vcl::Font aFont(FAMILY_SWISS, Size(0, 12));
|
|
|
|
aFont.SetCharSet(osl_getThreadTextEncoding());
|
|
|
|
aFont.SetWeight(WEIGHT_NORMAL);
|
|
|
|
aFont.SetFamilyName("Liberation Sans");
|
|
|
|
aStyleSet.SetAppFont(aFont);
|
|
|
|
aStyleSet.SetHelpFont(aFont);
|
|
|
|
aStyleSet.SetMenuFont(aFont);
|
|
|
|
aStyleSet.SetToolFont(aFont);
|
|
|
|
aStyleSet.SetGroupFont(aFont);
|
|
|
|
aStyleSet.SetLabelFont(aFont);
|
|
|
|
aStyleSet.SetRadioCheckFont(aFont);
|
|
|
|
aStyleSet.SetPushButtonFont(aFont);
|
|
|
|
aStyleSet.SetFieldFont(aFont);
|
|
|
|
aStyleSet.SetIconFont(aFont);
|
|
|
|
aStyleSet.SetTabFont(aFont);
|
|
|
|
|
|
|
|
aFont.SetWeight(WEIGHT_BOLD);
|
|
|
|
aStyleSet.SetFloatTitleFont(aFont);
|
|
|
|
aStyleSet.SetTitleFont(aFont);
|
|
|
|
|
|
|
|
aStyleSet.SetTitleHeight(16);
|
|
|
|
aStyleSet.SetFloatTitleHeight(12);
|
|
|
|
|
2019-01-10 07:38:59 +01:00
|
|
|
rSettings.SetStyleSettings(aStyleSet);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end vcl namespace
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|