diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx index 0ee545122ea9..c183edd9e315 100644 --- a/vcl/inc/widgetdraw/WidgetDefinition.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -196,6 +196,12 @@ public: class VCL_DLLPUBLIC WidgetDefinitionPart { public: + sal_Int32 mnWidth; + sal_Int32 mnHeight; + sal_Int32 mnMarginWidth; + sal_Int32 mnMarginHeight; + OString msOrientation; + std::vector> getStates(ControlType eType, ControlState eState, ImplControlValue const& rValue); diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index 17cf7b91615c..bbb32a7acec9 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -113,7 +113,6 @@ bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr return false; case ControlType::WindowBackground: case ControlType::Frame: - return true; case ControlType::ListNode: case ControlType::ListNet: case ControlType::ListHeader: @@ -571,40 +570,52 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion( { case ControlType::Spinbox: { - Size aButtonSize(44, 26); + 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); + OString sOrientation = "decrease-edit-increase"; if (sOrientation == "decrease-edit-increase") { if (ePart == ControlPart::ButtonUp) { - rNativeContentRegion - = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth() - - aButtonSize.Width(), - aLocation.Y()), - aButtonSize); + Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth() + - aButtonSizeUp.Width(), + aLocation.Y()); + rNativeContentRegion = tools::Rectangle(aPoint, aButtonSizeUp); rNativeBoundingRegion = rNativeContentRegion; return true; } else if (ePart == ControlPart::ButtonDown) { - rNativeContentRegion = tools::Rectangle(aLocation, aButtonSize); + rNativeContentRegion = tools::Rectangle(aLocation, aButtonSizeDown); rNativeBoundingRegion = rNativeContentRegion; return true; } else if (ePart == ControlPart::SubEdit) { - Point aPoint(aLocation.X() + aButtonSize.getWidth(), aLocation.Y()); - Size aSize(rBoundingControlRegion.GetWidth() - (2 * aButtonSize.Width()), - aButtonSize.Height()); + Point aPoint(aLocation.X() + aButtonSizeDown.Width(), aLocation.Y()); + Size aSize(rBoundingControlRegion.GetWidth() + - (aButtonSizeDown.Width() + aButtonSizeUp.Width()), + std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height())); rNativeContentRegion = tools::Rectangle(aPoint, aSize); rNativeBoundingRegion = rNativeContentRegion; return true; } else if (ePart == ControlPart::Entire) { - rNativeContentRegion = tools::Rectangle( - aLocation, Size(rBoundingControlRegion.GetWidth(), aButtonSize.Height())); + Size aSize(rBoundingControlRegion.GetWidth(), + std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height())); + rNativeContentRegion = tools::Rectangle(aLocation, aSize); rNativeBoundingRegion = rNativeContentRegion; return true; } @@ -613,37 +624,36 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion( { if (ePart == ControlPart::ButtonUp) { - rNativeContentRegion - = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth() - - aButtonSize.Width(), - aLocation.Y()), - aButtonSize); + Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth() + - aButtonSizeUp.Width(), + aLocation.Y()); + rNativeContentRegion = tools::Rectangle(aPoint, aButtonSizeUp); rNativeBoundingRegion = rNativeContentRegion; return true; } else if (ePart == ControlPart::ButtonDown) { - rNativeContentRegion - = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth() - - (2 * aButtonSize.Width()), - aLocation.Y()), - aButtonSize); + Point aPoint(aLocation.X() + rBoundingControlRegion.GetWidth() + - (aButtonSizeDown.Width() + aButtonSizeUp.Width()), + aLocation.Y()); + rNativeContentRegion = tools::Rectangle(aPoint, aButtonSizeDown); rNativeBoundingRegion = rNativeContentRegion; return true; } else if (ePart == ControlPart::SubEdit) { - rNativeContentRegion - = tools::Rectangle(aLocation, Size(rBoundingControlRegion.GetWidth() - - (2 * aButtonSize.Width()), - aButtonSize.Height())); + Size aSize(rBoundingControlRegion.GetWidth() + - (aButtonSizeDown.Width() + aButtonSizeUp.Width()), + std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height())); + rNativeContentRegion = tools::Rectangle(aLocation, aSize); rNativeBoundingRegion = rNativeContentRegion; return true; } else if (ePart == ControlPart::Entire) { - rNativeContentRegion = tools::Rectangle( - aLocation, Size(rBoundingControlRegion.GetWidth(), aButtonSize.Height())); + Size aSize(rBoundingControlRegion.GetWidth(), + std::max(aButtonSizeUp.Height(), aButtonSizeDown.Height())); + rNativeContentRegion = tools::Rectangle(aLocation, aSize); rNativeBoundingRegion = rNativeContentRegion; return true; } @@ -651,16 +661,35 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion( } break; case ControlType::Checkbox: - rNativeContentRegion = tools::Rectangle(Point(), Size(44, 26)); + { + auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ControlPart::Entire); + if (!pPart) + return false; + + Size aSize(pPart->mnWidth, pPart->mnHeight); + rNativeContentRegion = tools::Rectangle(Point(), aSize); return true; + } case ControlType::Radiobutton: - rNativeContentRegion = tools::Rectangle(Point(), Size(32, 32)); + { + auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ControlPart::Entire); + if (!pPart) + return false; + + Size aSize(pPart->mnWidth, pPart->mnHeight); + rNativeContentRegion = tools::Rectangle(Point(), aSize); return true; + } case ControlType::TabItem: { - rNativeBoundingRegion = tools::Rectangle(rBoundingControlRegion.TopLeft(), - Size(rBoundingControlRegion.GetWidth() + 20, - rBoundingControlRegion.GetHeight() + 6)); + 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)); rNativeContentRegion = rNativeBoundingRegion; return true; } diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index 52f15823cf02..467e4dbfe2b3 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -298,7 +298,37 @@ void WidgetDefinitionReader::readDefinition(tools::XmlWalker& rWalker, { OString sPart = rWalker.attribute("value"); ControlPart ePart = xmlStringToControlPart(sPart); + std::shared_ptr pPart = std::make_shared(); + + OString sWidth = rWalker.attribute("width"); + if (!sWidth.isEmpty()) + { + sal_Int32 nWidth = sWidth.isEmpty() ? 0 : sWidth.toInt32(); + pPart->mnWidth = nWidth; + } + + OString sHeight = rWalker.attribute("height"); + if (!sHeight.isEmpty()) + { + sal_Int32 nHeight = sHeight.isEmpty() ? 0 : sHeight.toInt32(); + pPart->mnHeight = nHeight; + } + + OString sMarginHeight = rWalker.attribute("margin-height"); + if (!sMarginHeight.isEmpty()) + { + sal_Int32 nMarginHeight = sMarginHeight.isEmpty() ? 0 : sMarginHeight.toInt32(); + pPart->mnMarginHeight = nMarginHeight; + } + + OString sMarginWidth = rWalker.attribute("margin-width"); + if (!sMarginWidth.isEmpty()) + { + sal_Int32 nMarginWidth = sMarginWidth.isEmpty() ? 0 : sMarginWidth.toInt32(); + pPart->mnMarginWidth = nMarginWidth; + } + rWidgetDefinition.maDefinitions.emplace(ControlTypeAndPart(eType, ePart), pPart); readPart(rWalker, pPart); } diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml index 6b5f85fd9bb8..0e902fb27318 100644 --- a/vcl/uiconfig/theme_definitions/definition.xml +++ b/vcl/uiconfig/theme_definitions/definition.xml @@ -77,7 +77,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -191,12 +191,12 @@ - + - + @@ -286,7 +286,7 @@ - +