diff options
-rw-r--r-- | vcl/inc/wizdlg.hxx | 1 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 7 | ||||
-rw-r--r-- | vcl/source/control/roadmapwizard.cxx | 56 | ||||
-rw-r--r-- | vcl/source/control/wizardmachine.cxx | 7 | ||||
-rw-r--r-- | vcl/source/control/wizimpldata.hxx | 47 |
5 files changed, 71 insertions, 47 deletions
diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx index 4416ed2e5891..56a9ed5261d7 100644 --- a/vcl/inc/wizdlg.hxx +++ b/vcl/inc/wizdlg.hxx @@ -128,6 +128,7 @@ namespace vcl void AddButton( Button* pButton, tools::Long nOffset = 0 ); void RemoveButton( Button* pButton ); + void AddButtonResponse( Button* pButton, int response); void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } const Size& GetPageSizePixel() const { return maPageSize; } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 151928f873f6..48946baa15f9 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -54,7 +54,14 @@ void response_help(vcl::Window* pWindow) vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP); ::Button* pButton = dynamic_cast<::Button*>(pButtonWindow); if (!pButton) + { + // Is it a wizard dialog? + vcl::RoadmapWizard* pWizard = dynamic_cast<vcl::RoadmapWizard*>(pWindow); + if (!pWizard || !pWizard->m_pHelp) + return; + pWizard->m_pHelp->Click(); return; + } pButton->Click(); } diff --git a/vcl/source/control/roadmapwizard.cxx b/vcl/source/control/roadmapwizard.cxx index 846e6f2ee2f3..1b3c9e96b477 100644 --- a/vcl/source/control/roadmapwizard.cxx +++ b/vcl/source/control/roadmapwizard.cxx @@ -28,59 +28,12 @@ #include <wizdlg.hxx> #include <vector> -#include <map> -#include <set> #include "wizimpldata.hxx" #include <uiobject-internal.hxx> namespace vcl { - using namespace RoadmapWizardTypes; - - namespace - { - typedef ::std::set< WizardTypes::WizardState > StateSet; - - typedef ::std::map< - PathId, - WizardPath - > Paths; - - typedef ::std::map< - WizardTypes::WizardState, - ::std::pair< - OUString, - RoadmapPageFactory - > - > StateDescriptions; - } - - struct RoadmapWizardImpl - { - ScopedVclPtr<ORoadmap> pRoadmap; - Paths aPaths; - PathId nActivePath; - StateDescriptions aStateDescriptors; - StateSet aDisabledStates; - bool bActivePathIsDefinite; - - RoadmapWizardImpl() - :pRoadmap( nullptr ) - ,nActivePath( -1 ) - ,bActivePathIsDefinite( false ) - { - } - - /// returns the index of the current state in given path, or -1 - static sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath ); - /// returns the index of the current state in the path with the given id, or -1 - sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, PathId _nPathId ); - /// returns the index of the first state in which the two given paths differ - static sal_Int32 getFirstDifferentIndex( const WizardPath& _rLHS, const WizardPath& _rRHS ); - }; - - sal_Int32 RoadmapWizardImpl::getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath ) { sal_Int32 nStateIndexInPath = 0; @@ -818,6 +771,15 @@ namespace vcl sal_Int32 nStartPos = sDialogId.lastIndexOf('/'); nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0; rJsonWriter.put("dialogid", sDialogId.copy(nStartPos)); + { + auto aResponses = rJsonWriter.startArray("responses"); + for (const auto& rResponse : m_xRoadmapImpl->maResponses) + { + auto aResponse = rJsonWriter.startStruct(); + rJsonWriter.put("id", rResponse.first->get_id()); + rJsonWriter.put("response", rResponse.second); + } + } vcl::Window* pFocusControl = GetFirstControlForFocus(); if (pFocusControl) diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx index 38cc87793675..68dd66004a9a 100644 --- a/vcl/source/control/wizardmachine.cxx +++ b/vcl/source/control/wizardmachine.cxx @@ -303,6 +303,11 @@ namespace vcl return nullptr; } + void RoadmapWizard::AddButtonResponse( Button* pButton, int response) + { + m_xRoadmapImpl->maResponses[pButton] = response; + } + void RoadmapWizard::implConstruct( const WizardButtonFlags _nButtonFlags ) { m_xWizardImpl->sTitleBase = GetText(); @@ -314,6 +319,8 @@ namespace vcl m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP); m_pHelp->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont))); m_pHelp->Show(); + m_pHelp->set_id("help"); + AddButtonResponse(m_pHelp, RET_HELP); AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X); } diff --git a/vcl/source/control/wizimpldata.hxx b/vcl/source/control/wizimpldata.hxx index 7565cb0897e4..9502e8ba4e81 100644 --- a/vcl/source/control/wizimpldata.hxx +++ b/vcl/source/control/wizimpldata.hxx @@ -20,6 +20,9 @@ #pragma once #include <stack> +#include <map> +#include <set> +#include <vcl/toolkit/roadmap.hxx> struct WizPageData { @@ -56,6 +59,50 @@ namespace vcl { } }; + + using namespace RoadmapWizardTypes; + namespace + { + typedef ::std::set< WizardTypes::WizardState > StateSet; + + typedef ::std::map< + PathId, + WizardPath + > Paths; + + typedef ::std::map< + WizardTypes::WizardState, + ::std::pair< + OUString, + RoadmapPageFactory + > + > StateDescriptions; + } + + struct RoadmapWizardImpl + { + ScopedVclPtr<ORoadmap> pRoadmap; + std::map<VclPtr<vcl::Window>, short> maResponses; + Paths aPaths; + PathId nActivePath; + StateDescriptions aStateDescriptors; + StateSet aDisabledStates; + bool bActivePathIsDefinite; + + RoadmapWizardImpl() + :pRoadmap( nullptr ) + ,nActivePath( -1 ) + ,bActivePathIsDefinite( false ) + { + } + + /// returns the index of the current state in given path, or -1 + static sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath ); + /// returns the index of the current state in the path with the given id, or -1 + sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, PathId _nPathId ); + /// returns the index of the first state in which the two given paths differ + static sal_Int32 getFirstDifferentIndex( const WizardPath& _rLHS, const WizardPath& _rRHS ); + }; } // namespace svt /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |