[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - vcl/inc vcl/qa vcl/source vcl/uiconfig
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 25 07:27:39 UTC 2019
vcl/inc/widgetdraw/WidgetDefinition.hxx | 7 ++
vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 9 ++
vcl/qa/cppunit/widgetdraw/data/definitionSettings3.xml | 7 ++
vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 44 +++++++++++---
vcl/source/gdi/WidgetDefinitionReader.cxx | 7 ++
vcl/uiconfig/theme_definitions/ios/definition.xml | 47 ++++++++++++---
6 files changed, 103 insertions(+), 18 deletions(-)
New commits:
commit 097cb6c01bf6f383a3ef0f8b2c32d6da1ab0852e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Nov 23 23:01:48 2019 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Nov 25 08:27:11 2019 +0100
widget theme: add new settings to ios theme
Change-Id: I98b4632501bb8e7f826a9dd2664a6663f4a7a208
Reviewed-on: https://gerrit.libreoffice.org/83592
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 738a11f20ef5b9bcfcc71cca6b0fbea9d06c438b)
Reviewed-on: https://gerrit.libreoffice.org/83625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/vcl/uiconfig/theme_definitions/ios/definition.xml b/vcl/uiconfig/theme_definitions/ios/definition.xml
index 310f450f0f04..8725e14ee1f2 100644
--- a/vcl/uiconfig/theme_definitions/ios/definition.xml
+++ b/vcl/uiconfig/theme_definitions/ios/definition.xml
@@ -57,15 +57,44 @@
<fontColor value="#000000"/>
</style>
- <!-- <state> attributes:
- enabled="any"
- focused="any"
- pressed="any"
- rollover="any"
- default="any"
- selected="any"
- button-value="any"
- extra="any"
+ <!--
+ Various setting for controls that aren't style colors.
+ Empty "value" attribute or if setting is not present means default will be used.
+ -->
+
+ <settings>
+ <noActiveTabTextRaise value="true"/>
+ <centeredTabs value="true"/>
+ <listBoxEntryMargin value="20"/>
+ <defaultFontSize value="10"/>
+ <titleHeight value="16"/>
+ <floatTitleHeight value="12"/>
+ <listBoxPreviewDefaultLogicWidth value="16"/>
+ <listBoxPreviewDefaultLogicHeight value="16"/>
+ </settings>
+
+ <!--
+ Follows the definitions od various controls.
+ The definition is always in form:
+
+ <{ControlType} attributes...>
+ <{ControlPart} attributes...>
+ <state attributes...>
+ {draw commands}
+ ...
+ </state>
+ </{ControlPart}>
+ </{ControlType}>
+
+ Supported <state> attributes are:
+ enabled="true|false|any"
+ focused="true|false|any"
+ pressed="true|false|any"
+ rollover="true|false|any"
+ default="true|false|any"
+ selected="true|false|any"
+ button-value="true|false|any"
+ extra="{various}"
-->
<pushbutton>
commit 362a394044a884ae68bee15d0374214a9f7afd83
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Nov 23 22:09:50 2019 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Nov 25 08:27:02 2019 +0100
widget theme: add additional settings to the theme definition
Change-Id: Ib50ebadf73979068d3595f09de113aa8745eccb9
Reviewed-on: https://gerrit.libreoffice.org/83591
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit cb7a4428679428066d56eba4370154c667b7d4c5)
Reviewed-on: https://gerrit.libreoffice.org/83624
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx
index 1c76645b55c0..9bc5c5066e8e 100644
--- a/vcl/inc/widgetdraw/WidgetDefinition.hxx
+++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx
@@ -201,7 +201,14 @@ public:
class VCL_DLLPUBLIC WidgetDefinitionSettings
{
public:
+ OString msNoActiveTabTextRaise;
OString msCenteredTabs;
+ OString msListBoxEntryMargin;
+ OString msDefaultFontSize;
+ OString msTitleHeight;
+ OString msFloatTitleHeight;
+ OString msListBoxPreviewDefaultLogicWidth;
+ OString msListBoxPreviewDefaultLogicHeight;
};
class VCL_DLLPUBLIC WidgetDefinitionStyle
diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx
index 4c507ec1c5da..5fbff3869bf9 100644
--- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx
+++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx
@@ -57,7 +57,16 @@ void WidgetDefinitionReaderTest::testReadSettings()
vcl::WidgetDefinition aDefinition;
vcl::WidgetDefinitionReader aReader(getFullUrl("definitionSettings3.xml"), getFullUrl(""));
CPPUNIT_ASSERT(aReader.read(aDefinition));
+ CPPUNIT_ASSERT_EQUAL(OString("true"), aDefinition.mpSettings->msNoActiveTabTextRaise);
CPPUNIT_ASSERT_EQUAL(OString("false"), aDefinition.mpSettings->msCenteredTabs);
+ CPPUNIT_ASSERT_EQUAL(OString("0"), aDefinition.mpSettings->msListBoxEntryMargin);
+ CPPUNIT_ASSERT_EQUAL(OString("10"), aDefinition.mpSettings->msDefaultFontSize);
+ CPPUNIT_ASSERT_EQUAL(OString("16"), aDefinition.mpSettings->msTitleHeight);
+ CPPUNIT_ASSERT_EQUAL(OString("12"), aDefinition.mpSettings->msFloatTitleHeight);
+ CPPUNIT_ASSERT_EQUAL(OString("15"),
+ aDefinition.mpSettings->msListBoxPreviewDefaultLogicWidth);
+ CPPUNIT_ASSERT_EQUAL(OString("7"),
+ aDefinition.mpSettings->msListBoxPreviewDefaultLogicHeight);
}
}
diff --git a/vcl/qa/cppunit/widgetdraw/data/definitionSettings3.xml b/vcl/qa/cppunit/widgetdraw/data/definitionSettings3.xml
index 20541b2a219e..9ad88dd54569 100644
--- a/vcl/qa/cppunit/widgetdraw/data/definitionSettings3.xml
+++ b/vcl/qa/cppunit/widgetdraw/data/definitionSettings3.xml
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<widgets>
<settings>
+ <noActiveTabTextRaise value="true"/>
<centeredTabs value="false"/>
+ <listBoxEntryMargin value="0"/>
+ <defaultFontSize value="10"/>
+ <titleHeight value="16"/>
+ <floatTitleHeight value="12"/>
+ <listBoxPreviewDefaultLogicWidth value="15"/>
+ <listBoxPreviewDefaultLogicHeight value="7"/>
</settings>
</widgets>
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 34707ea751cc..8256b0529dd7 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -31,6 +31,7 @@
#include <comphelper/seqstream.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/lok.hxx>
+#include <comphelper/string.hxx>
#include <com/sun/star/graphic/SvgTools.hpp>
#include <basegfx/DrawCommands.hxx>
@@ -86,6 +87,15 @@ std::shared_ptr<WidgetDefinition> getWidgetDefinitionForTheme(OUString const& rT
return spDefinition;
}
+int getSettingValueInteger(OString const& rValue, int nDefault)
+{
+ if (rValue.isEmpty())
+ return nDefault;
+ if (!comphelper::string::isdigitAsciiString(rValue))
+ return nDefault;
+ return rValue.toInt32();
+}
+
bool getSettingValueBool(OString const& rValue, bool bDefault)
{
if (rValue.isEmpty())
@@ -110,16 +120,21 @@ FileDefinitionWidgetDraw::FileDefinitionWidgetDraw(SalGraphics& rGraphics)
if (m_pWidgetDefinition)
{
+ auto& pSettings = m_pWidgetDefinition->mpSettings;
+
ImplSVData* pSVData = ImplGetSVData();
pSVData->maNWFData.mbNoFocusRects = true;
pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
- pSVData->maNWFData.mbNoActiveTabTextRaise = true;
- pSVData->maNWFData.mbCenteredTabs
- = getSettingValueBool(m_pWidgetDefinition->mpSettings->msCenteredTabs, true);
+ pSVData->maNWFData.mbNoActiveTabTextRaise
+ = getSettingValueBool(pSettings->msNoActiveTabTextRaise, true);
+ pSVData->maNWFData.mbCenteredTabs = getSettingValueBool(pSettings->msCenteredTabs, true);
pSVData->maNWFData.mbProgressNeedsErase = true;
pSVData->maNWFData.mnStatusBarLowerRightOffset = 10;
pSVData->maNWFData.mbCanDrawWidgetAnySize = true;
- pSVData->maNWFData.mnListBoxEntryMargin = 20;
+
+ int nDefaultListboxEntryMargin = pSVData->maNWFData.mnListBoxEntryMargin;
+ pSVData->maNWFData.mnListBoxEntryMargin
+ = getSettingValueInteger(pSettings->msListBoxEntryMargin, nDefaultListboxEntryMargin);
m_bIsActive = true;
}
@@ -952,7 +967,7 @@ bool FileDefinitionWidgetDraw::updateSettings(AllSettings& rSettings)
{
StyleSettings aStyleSet = rSettings.GetStyleSettings();
- auto pDefinitionStyle = m_pWidgetDefinition->mpStyle;
+ auto& pDefinitionStyle = m_pWidgetDefinition->mpStyle;
aStyleSet.SetFaceColor(pDefinitionStyle->maFaceColor);
aStyleSet.SetCheckedColor(pDefinitionStyle->maCheckedColor);
@@ -1008,7 +1023,10 @@ bool FileDefinitionWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetToolTextColor(pDefinitionStyle->maToolTextColor);
aStyleSet.SetFontColor(pDefinitionStyle->maFontColor);
- vcl::Font aFont(FAMILY_SWISS, Size(0, 10));
+ auto& pSettings = m_pWidgetDefinition->mpSettings;
+
+ int nFontSize = getSettingValueInteger(pSettings->msDefaultFontSize, 10);
+ vcl::Font aFont(FAMILY_SWISS, Size(0, nFontSize));
aFont.SetCharSet(osl_getThreadTextEncoding());
aFont.SetWeight(WEIGHT_NORMAL);
aFont.SetFamilyName("Liberation Sans");
@@ -1028,9 +1046,17 @@ bool FileDefinitionWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetFloatTitleFont(aFont);
aStyleSet.SetTitleFont(aFont);
- aStyleSet.SetTitleHeight(16);
- aStyleSet.SetFloatTitleHeight(12);
- aStyleSet.SetListBoxPreviewDefaultLogicSize(Size(16, 16));
+ int nTitleHeight = getSettingValueInteger(pSettings->msTitleHeight, aStyleSet.GetTitleHeight());
+ aStyleSet.SetTitleHeight(nTitleHeight);
+
+ int nFloatTitleHeight
+ = getSettingValueInteger(pSettings->msFloatTitleHeight, aStyleSet.GetFloatTitleHeight());
+ aStyleSet.SetFloatTitleHeight(nFloatTitleHeight);
+
+ int nLogicWidth = getSettingValueInteger(pSettings->msListBoxPreviewDefaultLogicWidth,
+ 15); // See vcl/source/app/settings.cxx
+ int nLogicHeight = getSettingValueInteger(pSettings->msListBoxPreviewDefaultLogicHeight, 7);
+ aStyleSet.SetListBoxPreviewDefaultLogicSize(Size(nLogicWidth, nLogicHeight));
rSettings.SetStyleSettings(aStyleSet);
diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx
index c9c38aefc1b5..f00a1601f708 100644
--- a/vcl/source/gdi/WidgetDefinitionReader.cxx
+++ b/vcl/source/gdi/WidgetDefinitionReader.cxx
@@ -425,7 +425,14 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition)
auto pSettings = std::make_shared<WidgetDefinitionSettings>();
std::unordered_map<OString, OString*> aSettingMap = {
+ { "noActiveTabTextRaise", &pSettings->msNoActiveTabTextRaise },
{ "centeredTabs", &pSettings->msCenteredTabs },
+ { "listBoxEntryMargin", &pSettings->msListBoxEntryMargin },
+ { "defaultFontSize", &pSettings->msDefaultFontSize },
+ { "titleHeight", &pSettings->msTitleHeight },
+ { "floatTitleHeight", &pSettings->msFloatTitleHeight },
+ { "listBoxPreviewDefaultLogicWidth", &pSettings->msListBoxPreviewDefaultLogicWidth },
+ { "listBoxPreviewDefaultLogicHeight", &pSettings->msListBoxPreviewDefaultLogicHeight },
};
rWidgetDefinition.mpSettings = pSettings;
More information about the Libreoffice-commits
mailing list