diff options
-rw-r--r-- | vcl/inc/FileDefinitionWidgetDraw.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/widgetdraw/WidgetDefinitionReader.hxx | 50 | ||||
-rw-r--r-- | vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 29 | ||||
-rw-r--r-- | vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 128 | ||||
-rw-r--r-- | vcl/source/gdi/WidgetDefinitionReader.cxx | 146 |
5 files changed, 170 insertions, 185 deletions
diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx b/vcl/inc/FileDefinitionWidgetDraw.hxx index 97181c17bbcb..ba34cbe13467 100644 --- a/vcl/inc/FileDefinitionWidgetDraw.hxx +++ b/vcl/inc/FileDefinitionWidgetDraw.hxx @@ -22,7 +22,7 @@ class FileDefinitionWidgetDraw : public vcl::WidgetDrawInterface { private: SalGraphics& m_rGraphics; - WidgetDefinitionReader m_WidgetDefinitionReader; + WidgetDefinition m_aWidgetDefinition; public: FileDefinitionWidgetDraw(SalGraphics& rGraphics); diff --git a/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx b/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx index 77548c72aa0c..4d9caddce374 100644 --- a/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinitionReader.hxx @@ -109,7 +109,7 @@ public: float fY2); }; -class VCL_DLLPUBLIC WidgetDefinition +class VCL_DLLPUBLIC WidgetDefinitionPart { public: std::vector<std::shared_ptr<WidgetDefinitionState>> getStates(ControlState eState, @@ -118,24 +118,8 @@ public: std::vector<std::shared_ptr<WidgetDefinitionState>> maStates; }; -class VCL_DLLPUBLIC WidgetDefinitionReader +class VCL_DLLPUBLIC WidgetDefinition { -private: - OUString m_rFilePath; - - static void - readDefinition(tools::XmlWalker& rWalker, - std::unordered_map<OString, std::shared_ptr<WidgetDefinition>>& rDefinition); - - static void readPart(tools::XmlWalker& rWalker, std::shared_ptr<WidgetDefinition> rpPart); - - void readPushButton(tools::XmlWalker& rWalker); - void readRadioButton(tools::XmlWalker& rWalker); - void readEditbox(tools::XmlWalker& rWalker); - - static void readDrawingDefinition(tools::XmlWalker& rWalker, - std::shared_ptr<WidgetDefinitionState>& rStates); - public: Color maFaceColor; Color maCheckedColor; @@ -188,16 +172,32 @@ public: Color maToolTextColor; Color maFontColor; - std::unordered_map<OString, std::shared_ptr<WidgetDefinition>> maPushButtonDefinitions; - std::unordered_map<OString, std::shared_ptr<WidgetDefinition>> maRadioButtonDefinitions; - std::unordered_map<OString, std::shared_ptr<WidgetDefinition>> maEditboxDefinitions; + std::unordered_map<OString, std::shared_ptr<WidgetDefinitionPart>> maPushButtonDefinitions; + std::unordered_map<OString, std::shared_ptr<WidgetDefinitionPart>> maRadioButtonDefinitions; + std::unordered_map<OString, std::shared_ptr<WidgetDefinitionPart>> maEditboxDefinitions; - std::shared_ptr<WidgetDefinition> getPushButtonDefinition(ControlPart ePart); - std::shared_ptr<WidgetDefinition> getRadioButtonDefinition(ControlPart ePart); - std::shared_ptr<WidgetDefinition> getEditboxDefinition(ControlPart ePart); + std::shared_ptr<WidgetDefinitionPart> getPushButtonDefinition(ControlPart ePart); + std::shared_ptr<WidgetDefinitionPart> getRadioButtonDefinition(ControlPart ePart); + std::shared_ptr<WidgetDefinitionPart> getEditboxDefinition(ControlPart ePart); +}; + +class VCL_DLLPUBLIC WidgetDefinitionReader +{ +private: + OUString m_rFilePath; + + static void + readDefinition(tools::XmlWalker& rWalker, + std::unordered_map<OString, std::shared_ptr<WidgetDefinitionPart>>& rDefinition); + static void readPart(tools::XmlWalker& rWalker, std::shared_ptr<WidgetDefinitionPart> rpPart); + + static void readDrawingDefinition(tools::XmlWalker& rWalker, + std::shared_ptr<WidgetDefinitionState>& rStates); + +public: WidgetDefinitionReader(OUString const& rFilePath); - bool read(); + bool read(WidgetDefinition& rWidgetDefinition); }; } // end vcl namespace diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index d6dad8dca74a..54ac184651ca 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -37,25 +37,26 @@ public: void WidgetDefinitionReaderTest::testRead() { - vcl::WidgetDefinitionReader aReader(getFullUrl("definition1.xml")); + vcl::WidgetDefinition aDefinition; - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aReader.maFaceColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aReader.maCheckedColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aReader.maLightColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("000000"), aDefinition.maFaceColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("000000"), aDefinition.maCheckedColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("000000"), aDefinition.maLightColor.AsRGBHexString()); - aReader.read(); + vcl::WidgetDefinitionReader aReader(getFullUrl("definition1.xml")); + aReader.read(aDefinition); - CPPUNIT_ASSERT_EQUAL(OUString("123456"), aReader.maFaceColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("234567"), aReader.maCheckedColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("345678"), aReader.maLightColor.AsRGBHexString()); + 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("ffffff"), aReader.maVisitedLinkColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aReader.maToolTextColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aReader.maFontColor.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()); { std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates - = aReader.getPushButtonDefinition(ControlPart::Entire) + = aDefinition.getPushButtonDefinition(ControlPart::Entire) ->getStates(ControlState::DEFAULT | ControlState::ENABLED | ControlState::ROLLOVER, ImplControlValue()); @@ -70,7 +71,7 @@ void WidgetDefinitionReaderTest::testRead() { std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates - = aReader.getRadioButtonDefinition(ControlPart::Entire) + = aDefinition.getRadioButtonDefinition(ControlPart::Entire) ->getStates(ControlState::NONE, ImplControlValue(ButtonValue::On)); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpDrawCommands.size()); @@ -78,7 +79,7 @@ void WidgetDefinitionReaderTest::testRead() { std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates - = aReader.getRadioButtonDefinition(ControlPart::Entire) + = aDefinition.getRadioButtonDefinition(ControlPart::Entire) ->getStates(ControlState::NONE, ImplControlValue(ButtonValue::Off)); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates[0]->mpDrawCommands.size()); diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index 854066694e22..c28967eb9b7f 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -30,9 +30,9 @@ OUString lcl_getThemeDefinitionPath() FileDefinitionWidgetDraw::FileDefinitionWidgetDraw(SalGraphics& rGraphics) : m_rGraphics(rGraphics) - , m_WidgetDefinitionReader(lcl_getThemeDefinitionPath() + "definition.xml") { - m_WidgetDefinitionReader.read(); + WidgetDefinitionReader aReader(lcl_getThemeDefinitionPath() + "definition.xml"); + aReader.read(m_aWidgetDefinition); ImplSVData* pSVData = ImplGetSVData(); pSVData->maNWFData.mbNoFocusRects = true; @@ -196,11 +196,11 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart break; case ControlType::Pushbutton: { - std::shared_ptr<WidgetDefinition> pDefinition - = m_WidgetDefinitionReader.getPushButtonDefinition(ePart); - if (pDefinition) + std::shared_ptr<WidgetDefinitionPart> pPart + = m_aWidgetDefinition.getPushButtonDefinition(ePart); + if (pPart) { - auto aStates = pDefinition->getStates(eState, rValue); + auto aStates = pPart->getStates(eState, rValue); if (!aStates.empty()) { std::shared_ptr<WidgetDefinitionState> pState = aStates.back(); @@ -215,12 +215,12 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart break; case ControlType::Radiobutton: { - std::shared_ptr<WidgetDefinition> pDefinition - = m_WidgetDefinitionReader.getRadioButtonDefinition(ePart); - if (pDefinition) + std::shared_ptr<WidgetDefinitionPart> pPart + = m_aWidgetDefinition.getRadioButtonDefinition(ePart); + if (pPart) { std::shared_ptr<WidgetDefinitionState> pState - = pDefinition->getStates(eState, rValue).back(); + = pPart->getStates(eState, rValue).back(); { munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, nY, nWidth, nHeight); bOK = true; @@ -235,12 +235,12 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart case ControlType::EditboxNoBorder: case ControlType::MultilineEditbox: { - std::shared_ptr<WidgetDefinition> pDefinition - = m_WidgetDefinitionReader.getEditboxDefinition(ePart); - if (pDefinition) + std::shared_ptr<WidgetDefinitionPart> pPart + = m_aWidgetDefinition.getEditboxDefinition(ePart); + if (pPart) { std::shared_ptr<WidgetDefinitionState> pState - = pDefinition->getStates(eState, rValue).back(); + = pPart->getStates(eState, rValue).back(); { munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, nY, nWidth, nHeight); bOK = true; @@ -294,56 +294,56 @@ bool FileDefinitionWidgetDraw::updateSettings(AllSettings& rSettings) { StyleSettings aStyleSet = rSettings.GetStyleSettings(); - aStyleSet.SetFaceColor(m_WidgetDefinitionReader.maFaceColor); - aStyleSet.SetCheckedColor(m_WidgetDefinitionReader.maCheckedColor); - aStyleSet.SetLightColor(m_WidgetDefinitionReader.maLightColor); - aStyleSet.SetLightBorderColor(m_WidgetDefinitionReader.maLightBorderColor); - aStyleSet.SetShadowColor(m_WidgetDefinitionReader.maShadowColor); - aStyleSet.SetDarkShadowColor(m_WidgetDefinitionReader.maDarkShadowColor); - aStyleSet.SetButtonTextColor(m_WidgetDefinitionReader.maButtonTextColor); - aStyleSet.SetButtonRolloverTextColor(m_WidgetDefinitionReader.maButtonRolloverTextColor); - aStyleSet.SetRadioCheckTextColor(m_WidgetDefinitionReader.maRadioCheckTextColor); - aStyleSet.SetGroupTextColor(m_WidgetDefinitionReader.maGroupTextColor); - aStyleSet.SetLabelTextColor(m_WidgetDefinitionReader.maLabelTextColor); - aStyleSet.SetWindowColor(m_WidgetDefinitionReader.maWindowColor); - aStyleSet.SetWindowTextColor(m_WidgetDefinitionReader.maWindowTextColor); - aStyleSet.SetDialogColor(m_WidgetDefinitionReader.maDialogColor); - aStyleSet.SetDialogTextColor(m_WidgetDefinitionReader.maDialogTextColor); - aStyleSet.SetWorkspaceColor(m_WidgetDefinitionReader.maWorkspaceColor); - aStyleSet.SetMonoColor(m_WidgetDefinitionReader.maMonoColor); - aStyleSet.SetFieldColor(m_WidgetDefinitionReader.maFieldColor); - aStyleSet.SetFieldTextColor(m_WidgetDefinitionReader.maFieldTextColor); - aStyleSet.SetFieldRolloverTextColor(m_WidgetDefinitionReader.maFieldRolloverTextColor); - aStyleSet.SetActiveColor(m_WidgetDefinitionReader.maActiveColor); - aStyleSet.SetActiveTextColor(m_WidgetDefinitionReader.maActiveTextColor); - aStyleSet.SetActiveBorderColor(m_WidgetDefinitionReader.maActiveBorderColor); - aStyleSet.SetDeactiveColor(m_WidgetDefinitionReader.maDeactiveColor); - aStyleSet.SetDeactiveTextColor(m_WidgetDefinitionReader.maDeactiveTextColor); - aStyleSet.SetDeactiveBorderColor(m_WidgetDefinitionReader.maDeactiveBorderColor); - aStyleSet.SetMenuColor(m_WidgetDefinitionReader.maMenuColor); - aStyleSet.SetMenuBarColor(m_WidgetDefinitionReader.maMenuBarColor); - aStyleSet.SetMenuBarRolloverColor(m_WidgetDefinitionReader.maMenuBarRolloverColor); - aStyleSet.SetMenuBorderColor(m_WidgetDefinitionReader.maMenuBorderColor); - aStyleSet.SetMenuTextColor(m_WidgetDefinitionReader.maMenuTextColor); - aStyleSet.SetMenuBarTextColor(m_WidgetDefinitionReader.maMenuBarTextColor); - aStyleSet.SetMenuBarRolloverTextColor(m_WidgetDefinitionReader.maMenuBarRolloverTextColor); - aStyleSet.SetMenuBarHighlightTextColor(m_WidgetDefinitionReader.maMenuBarHighlightTextColor); - aStyleSet.SetMenuHighlightColor(m_WidgetDefinitionReader.maMenuHighlightColor); - aStyleSet.SetMenuHighlightTextColor(m_WidgetDefinitionReader.maMenuHighlightTextColor); - aStyleSet.SetHighlightColor(m_WidgetDefinitionReader.maHighlightColor); - aStyleSet.SetHighlightTextColor(m_WidgetDefinitionReader.maHighlightTextColor); - aStyleSet.SetActiveTabColor(m_WidgetDefinitionReader.maActiveTabColor); - aStyleSet.SetInactiveTabColor(m_WidgetDefinitionReader.maInactiveTabColor); - aStyleSet.SetTabTextColor(m_WidgetDefinitionReader.maTabTextColor); - aStyleSet.SetTabRolloverTextColor(m_WidgetDefinitionReader.maTabRolloverTextColor); - aStyleSet.SetTabHighlightTextColor(m_WidgetDefinitionReader.maTabHighlightTextColor); - aStyleSet.SetDisableColor(m_WidgetDefinitionReader.maDisableColor); - aStyleSet.SetHelpColor(m_WidgetDefinitionReader.maHelpColor); - aStyleSet.SetHelpTextColor(m_WidgetDefinitionReader.maHelpTextColor); - aStyleSet.SetLinkColor(m_WidgetDefinitionReader.maLinkColor); - aStyleSet.SetVisitedLinkColor(m_WidgetDefinitionReader.maVisitedLinkColor); - aStyleSet.SetToolTextColor(m_WidgetDefinitionReader.maToolTextColor); - aStyleSet.SetFontColor(m_WidgetDefinitionReader.maFontColor); + 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); rSettings.SetStyleSettings(aStyleSet); diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index 3a8848f50617..c3e6b10953da 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -146,7 +146,7 @@ void WidgetDefinitionReader::readDrawingDefinition(tools::XmlWalker& rWalker, void WidgetDefinitionReader::readDefinition( tools::XmlWalker& rWalker, - std::unordered_map<OString, std::shared_ptr<WidgetDefinition>>& rDefinition) + std::unordered_map<OString, std::shared_ptr<WidgetDefinitionPart>>& rPart) { rWalker.children(); while (rWalker.isValid()) @@ -154,8 +154,8 @@ void WidgetDefinitionReader::readDefinition( if (rWalker.name() == "part") { OString sPart = rWalker.attribute("value"); - std::shared_ptr<WidgetDefinition> pPart = std::make_shared<WidgetDefinition>(); - rDefinition.emplace(sPart, pPart); + std::shared_ptr<WidgetDefinitionPart> pPart = std::make_shared<WidgetDefinitionPart>(); + rPart.emplace(sPart, pPart); readPart(rWalker, pPart); } rWalker.next(); @@ -164,7 +164,7 @@ void WidgetDefinitionReader::readDefinition( } void WidgetDefinitionReader::readPart(tools::XmlWalker& rWalker, - std::shared_ptr<WidgetDefinition> rpPart) + std::shared_ptr<WidgetDefinitionPart> rpPart) { rWalker.children(); while (rWalker.isValid()) @@ -189,22 +189,7 @@ void WidgetDefinitionReader::readPart(tools::XmlWalker& rWalker, rWalker.parent(); } -void WidgetDefinitionReader::readPushButton(tools::XmlWalker& rWalker) -{ - readDefinition(rWalker, maPushButtonDefinitions); -} - -void WidgetDefinitionReader::readRadioButton(tools::XmlWalker& rWalker) -{ - readDefinition(rWalker, maRadioButtonDefinitions); -} - -void WidgetDefinitionReader::readEditbox(tools::XmlWalker& rWalker) -{ - readDefinition(rWalker, maEditboxDefinitions); -} - -bool WidgetDefinitionReader::read() +bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) { if (!lcl_fileExists(m_rFilePath)) return false; @@ -212,56 +197,56 @@ bool WidgetDefinitionReader::read() SvFileStream aFileStream(m_rFilePath, StreamMode::READ); std::unordered_map<OString, Color*> aStyleColorMap = { - { "faceColor", &maFaceColor }, - { "checkedColor", &maCheckedColor }, - { "lightColor", &maLightColor }, - { "lightBorderColor", &maLightBorderColor }, - { "shadowColor", &maShadowColor }, - { "darkShadowColor", &maDarkShadowColor }, - { "buttonTextColor", &maButtonTextColor }, - { "buttonRolloverTextColor", &maButtonRolloverTextColor }, - { "radioCheckTextColor", &maRadioCheckTextColor }, - { "groupTextColor", &maGroupTextColor }, - { "labelTextColor", &maLabelTextColor }, - { "windowColor", &maWindowColor }, - { "windowTextColor", &maWindowTextColor }, - { "dialogColor", &maDialogColor }, - { "dialogTextColor", &maDialogTextColor }, - { "workspaceColor", &maWorkspaceColor }, - { "monoColor", &maMonoColor }, - { "fieldColor", &maFieldColor }, - { "fieldTextColor", &maFieldTextColor }, - { "fieldRolloverTextColor", &maFieldRolloverTextColor }, - { "activeColor", &maActiveColor }, - { "activeTextColor", &maActiveTextColor }, - { "activeBorderColor", &maActiveBorderColor }, - { "deactiveColor", &maDeactiveColor }, - { "deactiveTextColor", &maDeactiveTextColor }, - { "deactiveBorderColor", &maDeactiveBorderColor }, - { "menuColor", &maMenuColor }, - { "menuBarColor", &maMenuBarColor }, - { "menuBarRolloverColor", &maMenuBarRolloverColor }, - { "menuBorderColor", &maMenuBorderColor }, - { "menuTextColor", &maMenuTextColor }, - { "menuBarTextColor", &maMenuBarTextColor }, - { "menuBarRolloverTextColor", &maMenuBarRolloverTextColor }, - { "menuBarHighlightTextColor", &maMenuBarHighlightTextColor }, - { "menuHighlightColor", &maMenuHighlightColor }, - { "menuHighlightTextColor", &maMenuHighlightTextColor }, - { "highlightColor", &maHighlightColor }, - { "highlightTextColor", &maHighlightTextColor }, - { "activeTabColor", &maActiveTabColor }, - { "inactiveTabColor", &maInactiveTabColor }, - { "tabTextColor", &maTabTextColor }, - { "tabRolloverTextColor", &maTabRolloverTextColor }, - { "tabHighlightTextColor", &maTabHighlightTextColor }, - { "disableColor", &maDisableColor }, - { "helpColor", &maHelpColor }, - { "helpTextColor", &maHelpTextColor }, - { "linkColor", &maLinkColor }, - { "visitedLinkColor", &maVisitedLinkColor }, - { "toolTextColor", &maToolTextColor }, - { "fontColor", &maFontColor }, + { "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 }, }; tools::XmlWalker aWalker; @@ -290,15 +275,15 @@ bool WidgetDefinitionReader::read() } else if (aWalker.name() == "pushbutton") { - readPushButton(aWalker); + readDefinition(aWalker, rWidgetDefinition.maPushButtonDefinitions); } else if (aWalker.name() == "radiobutton") { - readRadioButton(aWalker); + readDefinition(aWalker, rWidgetDefinition.maRadioButtonDefinitions); } else if (aWalker.name() == "editbox") { - readEditbox(aWalker); + readDefinition(aWalker, rWidgetDefinition.maEditboxDefinitions); } aWalker.next(); } @@ -392,36 +377,35 @@ OString xmlControlPart(ControlPart ePart) } // end anonymous namespace -std::shared_ptr<WidgetDefinition> WidgetDefinitionReader::getPushButtonDefinition(ControlPart ePart) +std::shared_ptr<WidgetDefinitionPart> WidgetDefinition::getPushButtonDefinition(ControlPart ePart) { auto aIterator = maPushButtonDefinitions.find(xmlControlPart(ePart)); if (aIterator != maPushButtonDefinitions.end()) return aIterator->second; - return std::shared_ptr<WidgetDefinition>(); + return std::shared_ptr<WidgetDefinitionPart>(); } -std::shared_ptr<WidgetDefinition> -WidgetDefinitionReader::getRadioButtonDefinition(ControlPart ePart) +std::shared_ptr<WidgetDefinitionPart> WidgetDefinition::getRadioButtonDefinition(ControlPart ePart) { auto aIterator = maRadioButtonDefinitions.find(xmlControlPart(ePart)); if (aIterator != maRadioButtonDefinitions.end()) return aIterator->second; - return std::shared_ptr<WidgetDefinition>(); + return std::shared_ptr<WidgetDefinitionPart>(); } -std::shared_ptr<WidgetDefinition> WidgetDefinitionReader::getEditboxDefinition(ControlPart ePart) +std::shared_ptr<WidgetDefinitionPart> WidgetDefinition::getEditboxDefinition(ControlPart ePart) { auto aIterator = maEditboxDefinitions.find(xmlControlPart(ePart)); if (aIterator != maEditboxDefinitions.end()) return aIterator->second; - return std::shared_ptr<WidgetDefinition>(); + return std::shared_ptr<WidgetDefinitionPart>(); } std::vector<std::shared_ptr<WidgetDefinitionState>> -WidgetDefinition::getStates(ControlState eState, ImplControlValue const& rValue) +WidgetDefinitionPart::getStates(ControlState eState, ImplControlValue const& rValue) { std::vector<std::shared_ptr<WidgetDefinitionState>> aStatesToAdd; |