diff options
-rw-r--r-- | vcl/inc/widgetdraw/WidgetDefinition.hxx | 7 | ||||
-rw-r--r-- | vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 17 | ||||
-rw-r--r-- | vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 102 | ||||
-rw-r--r-- | vcl/source/gdi/WidgetDefinitionReader.cxx | 105 |
4 files changed, 119 insertions, 112 deletions
diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx index c183edd9e315..7e1505c8daae 100644 --- a/vcl/inc/widgetdraw/WidgetDefinition.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -208,7 +208,7 @@ public: std::vector<std::shared_ptr<WidgetDefinitionState>> maStates; }; -class VCL_DLLPUBLIC WidgetDefinition +class VCL_DLLPUBLIC WidgetDefinitionStyle { public: Color maFaceColor; @@ -261,7 +261,12 @@ public: Color maVisitedLinkColor; Color maToolTextColor; Color maFontColor; +}; +class VCL_DLLPUBLIC WidgetDefinition +{ +public: + std::shared_ptr<WidgetDefinitionStyle> mpStyle; std::unordered_map<ControlTypeAndPart, std::shared_ptr<WidgetDefinitionPart>> maDefinitions; std::shared_ptr<WidgetDefinitionPart> getDefinition(ControlType eType, ControlPart ePart); }; diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index 20b3270267dd..c56379cc70c7 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -39,20 +39,17 @@ void WidgetDefinitionReaderTest::testRead() { vcl::WidgetDefinition aDefinition; - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aDefinition.maFaceColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aDefinition.maCheckedColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aDefinition.maLightColor.AsRGBHexString()); - vcl::WidgetDefinitionReader aReader(getFullUrl("definition1.xml"), getFullUrl("")); aReader.read(aDefinition); - CPPUNIT_ASSERT_EQUAL(OUString("123456"), aDefinition.maFaceColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("234567"), aDefinition.maCheckedColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("345678"), aDefinition.maLightColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("123456"), aDefinition.mpStyle->maFaceColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("234567"), aDefinition.mpStyle->maCheckedColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("345678"), aDefinition.mpStyle->maLightColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aDefinition.maVisitedLinkColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aDefinition.maToolTextColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aDefinition.maFontColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), + aDefinition.mpStyle->maVisitedLinkColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aDefinition.mpStyle->maToolTextColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aDefinition.mpStyle->maFontColor.AsRGBHexString()); // Pushbutton { diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index abd55fb0bca0..bc2636491829 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -786,56 +786,58 @@ bool FileDefinitionWidgetDraw::updateSettings(AllSettings& rSettings) { StyleSettings aStyleSet = rSettings.GetStyleSettings(); - 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); + auto pDefinitionStyle = m_aWidgetDefinition.mpStyle; + + aStyleSet.SetFaceColor(pDefinitionStyle->maFaceColor); + aStyleSet.SetCheckedColor(pDefinitionStyle->maCheckedColor); + aStyleSet.SetLightColor(pDefinitionStyle->maLightColor); + aStyleSet.SetLightBorderColor(pDefinitionStyle->maLightBorderColor); + aStyleSet.SetShadowColor(pDefinitionStyle->maShadowColor); + aStyleSet.SetDarkShadowColor(pDefinitionStyle->maDarkShadowColor); + aStyleSet.SetButtonTextColor(pDefinitionStyle->maButtonTextColor); + aStyleSet.SetButtonRolloverTextColor(pDefinitionStyle->maButtonRolloverTextColor); + aStyleSet.SetRadioCheckTextColor(pDefinitionStyle->maRadioCheckTextColor); + aStyleSet.SetGroupTextColor(pDefinitionStyle->maGroupTextColor); + aStyleSet.SetLabelTextColor(pDefinitionStyle->maLabelTextColor); + aStyleSet.SetWindowColor(pDefinitionStyle->maWindowColor); + aStyleSet.SetWindowTextColor(pDefinitionStyle->maWindowTextColor); + aStyleSet.SetDialogColor(pDefinitionStyle->maDialogColor); + aStyleSet.SetDialogTextColor(pDefinitionStyle->maDialogTextColor); + aStyleSet.SetWorkspaceColor(pDefinitionStyle->maWorkspaceColor); + aStyleSet.SetMonoColor(pDefinitionStyle->maMonoColor); + aStyleSet.SetFieldColor(pDefinitionStyle->maFieldColor); + aStyleSet.SetFieldTextColor(pDefinitionStyle->maFieldTextColor); + aStyleSet.SetFieldRolloverTextColor(pDefinitionStyle->maFieldRolloverTextColor); + aStyleSet.SetActiveColor(pDefinitionStyle->maActiveColor); + aStyleSet.SetActiveTextColor(pDefinitionStyle->maActiveTextColor); + aStyleSet.SetActiveBorderColor(pDefinitionStyle->maActiveBorderColor); + aStyleSet.SetDeactiveColor(pDefinitionStyle->maDeactiveColor); + aStyleSet.SetDeactiveTextColor(pDefinitionStyle->maDeactiveTextColor); + aStyleSet.SetDeactiveBorderColor(pDefinitionStyle->maDeactiveBorderColor); + aStyleSet.SetMenuColor(pDefinitionStyle->maMenuColor); + aStyleSet.SetMenuBarColor(pDefinitionStyle->maMenuBarColor); + aStyleSet.SetMenuBarRolloverColor(pDefinitionStyle->maMenuBarRolloverColor); + aStyleSet.SetMenuBorderColor(pDefinitionStyle->maMenuBorderColor); + aStyleSet.SetMenuTextColor(pDefinitionStyle->maMenuTextColor); + aStyleSet.SetMenuBarTextColor(pDefinitionStyle->maMenuBarTextColor); + aStyleSet.SetMenuBarRolloverTextColor(pDefinitionStyle->maMenuBarRolloverTextColor); + aStyleSet.SetMenuBarHighlightTextColor(pDefinitionStyle->maMenuBarHighlightTextColor); + aStyleSet.SetMenuHighlightColor(pDefinitionStyle->maMenuHighlightColor); + aStyleSet.SetMenuHighlightTextColor(pDefinitionStyle->maMenuHighlightTextColor); + aStyleSet.SetHighlightColor(pDefinitionStyle->maHighlightColor); + aStyleSet.SetHighlightTextColor(pDefinitionStyle->maHighlightTextColor); + aStyleSet.SetActiveTabColor(pDefinitionStyle->maActiveTabColor); + aStyleSet.SetInactiveTabColor(pDefinitionStyle->maInactiveTabColor); + aStyleSet.SetTabTextColor(pDefinitionStyle->maTabTextColor); + aStyleSet.SetTabRolloverTextColor(pDefinitionStyle->maTabRolloverTextColor); + aStyleSet.SetTabHighlightTextColor(pDefinitionStyle->maTabHighlightTextColor); + aStyleSet.SetDisableColor(pDefinitionStyle->maDisableColor); + aStyleSet.SetHelpColor(pDefinitionStyle->maHelpColor); + aStyleSet.SetHelpTextColor(pDefinitionStyle->maHelpTextColor); + aStyleSet.SetLinkColor(pDefinitionStyle->maLinkColor); + aStyleSet.SetVisitedLinkColor(pDefinitionStyle->maVisitedLinkColor); + aStyleSet.SetToolTextColor(pDefinitionStyle->maToolTextColor); + aStyleSet.SetFontColor(pDefinitionStyle->maFontColor); vcl::Font aFont(FAMILY_SWISS, Size(0, 12)); aFont.SetCharSet(osl_getThreadTextEncoding()); diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index 467e4dbfe2b3..f52757d37629 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -370,60 +370,63 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) if (!lcl_fileExists(m_rDefinitionFile)) return false; - SvFileStream aFileStream(m_rDefinitionFile, StreamMode::READ); + auto pStyle = std::make_shared<WidgetDefinitionStyle>(); std::unordered_map<OString, Color*> aStyleColorMap = { - { "faceColor", &rWidgetDefinition.maFaceColor }, - { "checkedColor", &rWidgetDefinition.maCheckedColor }, - { "lightColor", &rWidgetDefinition.maLightColor }, - { "lightBorderColor", &rWidgetDefinition.maLightBorderColor }, - { "shadowColor", &rWidgetDefinition.maShadowColor }, - { "darkShadowColor", &rWidgetDefinition.maDarkShadowColor }, - { "buttonTextColor", &rWidgetDefinition.maButtonTextColor }, - { "buttonRolloverTextColor", &rWidgetDefinition.maButtonRolloverTextColor }, - { "radioCheckTextColor", &rWidgetDefinition.maRadioCheckTextColor }, - { "groupTextColor", &rWidgetDefinition.maGroupTextColor }, - { "labelTextColor", &rWidgetDefinition.maLabelTextColor }, - { "windowColor", &rWidgetDefinition.maWindowColor }, - { "windowTextColor", &rWidgetDefinition.maWindowTextColor }, - { "dialogColor", &rWidgetDefinition.maDialogColor }, - { "dialogTextColor", &rWidgetDefinition.maDialogTextColor }, - { "workspaceColor", &rWidgetDefinition.maWorkspaceColor }, - { "monoColor", &rWidgetDefinition.maMonoColor }, - { "fieldColor", &rWidgetDefinition.maFieldColor }, - { "fieldTextColor", &rWidgetDefinition.maFieldTextColor }, - { "fieldRolloverTextColor", &rWidgetDefinition.maFieldRolloverTextColor }, - { "activeColor", &rWidgetDefinition.maActiveColor }, - { "activeTextColor", &rWidgetDefinition.maActiveTextColor }, - { "activeBorderColor", &rWidgetDefinition.maActiveBorderColor }, - { "deactiveColor", &rWidgetDefinition.maDeactiveColor }, - { "deactiveTextColor", &rWidgetDefinition.maDeactiveTextColor }, - { "deactiveBorderColor", &rWidgetDefinition.maDeactiveBorderColor }, - { "menuColor", &rWidgetDefinition.maMenuColor }, - { "menuBarColor", &rWidgetDefinition.maMenuBarColor }, - { "menuBarRolloverColor", &rWidgetDefinition.maMenuBarRolloverColor }, - { "menuBorderColor", &rWidgetDefinition.maMenuBorderColor }, - { "menuTextColor", &rWidgetDefinition.maMenuTextColor }, - { "menuBarTextColor", &rWidgetDefinition.maMenuBarTextColor }, - { "menuBarRolloverTextColor", &rWidgetDefinition.maMenuBarRolloverTextColor }, - { "menuBarHighlightTextColor", &rWidgetDefinition.maMenuBarHighlightTextColor }, - { "menuHighlightColor", &rWidgetDefinition.maMenuHighlightColor }, - { "menuHighlightTextColor", &rWidgetDefinition.maMenuHighlightTextColor }, - { "highlightColor", &rWidgetDefinition.maHighlightColor }, - { "highlightTextColor", &rWidgetDefinition.maHighlightTextColor }, - { "activeTabColor", &rWidgetDefinition.maActiveTabColor }, - { "inactiveTabColor", &rWidgetDefinition.maInactiveTabColor }, - { "tabTextColor", &rWidgetDefinition.maTabTextColor }, - { "tabRolloverTextColor", &rWidgetDefinition.maTabRolloverTextColor }, - { "tabHighlightTextColor", &rWidgetDefinition.maTabHighlightTextColor }, - { "disableColor", &rWidgetDefinition.maDisableColor }, - { "helpColor", &rWidgetDefinition.maHelpColor }, - { "helpTextColor", &rWidgetDefinition.maHelpTextColor }, - { "linkColor", &rWidgetDefinition.maLinkColor }, - { "visitedLinkColor", &rWidgetDefinition.maVisitedLinkColor }, - { "toolTextColor", &rWidgetDefinition.maToolTextColor }, - { "fontColor", &rWidgetDefinition.maFontColor }, + { "faceColor", &pStyle->maFaceColor }, + { "checkedColor", &pStyle->maCheckedColor }, + { "lightColor", &pStyle->maLightColor }, + { "lightBorderColor", &pStyle->maLightBorderColor }, + { "shadowColor", &pStyle->maShadowColor }, + { "darkShadowColor", &pStyle->maDarkShadowColor }, + { "buttonTextColor", &pStyle->maButtonTextColor }, + { "buttonRolloverTextColor", &pStyle->maButtonRolloverTextColor }, + { "radioCheckTextColor", &pStyle->maRadioCheckTextColor }, + { "groupTextColor", &pStyle->maGroupTextColor }, + { "labelTextColor", &pStyle->maLabelTextColor }, + { "windowColor", &pStyle->maWindowColor }, + { "windowTextColor", &pStyle->maWindowTextColor }, + { "dialogColor", &pStyle->maDialogColor }, + { "dialogTextColor", &pStyle->maDialogTextColor }, + { "workspaceColor", &pStyle->maWorkspaceColor }, + { "monoColor", &pStyle->maMonoColor }, + { "fieldColor", &pStyle->maFieldColor }, + { "fieldTextColor", &pStyle->maFieldTextColor }, + { "fieldRolloverTextColor", &pStyle->maFieldRolloverTextColor }, + { "activeColor", &pStyle->maActiveColor }, + { "activeTextColor", &pStyle->maActiveTextColor }, + { "activeBorderColor", &pStyle->maActiveBorderColor }, + { "deactiveColor", &pStyle->maDeactiveColor }, + { "deactiveTextColor", &pStyle->maDeactiveTextColor }, + { "deactiveBorderColor", &pStyle->maDeactiveBorderColor }, + { "menuColor", &pStyle->maMenuColor }, + { "menuBarColor", &pStyle->maMenuBarColor }, + { "menuBarRolloverColor", &pStyle->maMenuBarRolloverColor }, + { "menuBorderColor", &pStyle->maMenuBorderColor }, + { "menuTextColor", &pStyle->maMenuTextColor }, + { "menuBarTextColor", &pStyle->maMenuBarTextColor }, + { "menuBarRolloverTextColor", &pStyle->maMenuBarRolloverTextColor }, + { "menuBarHighlightTextColor", &pStyle->maMenuBarHighlightTextColor }, + { "menuHighlightColor", &pStyle->maMenuHighlightColor }, + { "menuHighlightTextColor", &pStyle->maMenuHighlightTextColor }, + { "highlightColor", &pStyle->maHighlightColor }, + { "highlightTextColor", &pStyle->maHighlightTextColor }, + { "activeTabColor", &pStyle->maActiveTabColor }, + { "inactiveTabColor", &pStyle->maInactiveTabColor }, + { "tabTextColor", &pStyle->maTabTextColor }, + { "tabRolloverTextColor", &pStyle->maTabRolloverTextColor }, + { "tabHighlightTextColor", &pStyle->maTabHighlightTextColor }, + { "disableColor", &pStyle->maDisableColor }, + { "helpColor", &pStyle->maHelpColor }, + { "helpTextColor", &pStyle->maHelpTextColor }, + { "linkColor", &pStyle->maLinkColor }, + { "visitedLinkColor", &pStyle->maVisitedLinkColor }, + { "toolTextColor", &pStyle->maToolTextColor }, + { "fontColor", &pStyle->maFontColor }, }; + rWidgetDefinition.mpStyle = pStyle; + + SvFileStream aFileStream(m_rDefinitionFile, StreamMode::READ); tools::XmlWalker aWalker; if (!aWalker.open(&aFileStream)) |