diff options
author | tagezi <lera.goncharuk@gmail.com> | 2018-11-28 22:37:13 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-06 10:26:45 +0100 |
commit | 8ec5c249fc40fb80d2a00e54a0bd76451dbc6477 (patch) | |
tree | 0ece6b24de67dbc49c1ca70003da5a5382cc5f0a /basctl/source/basicide/basicbox.hxx | |
parent | efe28895498b03f1468a9dc9f510452f36affc2f (diff) |
Format and document combobox classes of BasicIDE
Change-Id: Ie4f9c142d221b16072748c9c2deaa96c4704b90d
Reviewed-on: https://gerrit.libreoffice.org/64422
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basctl/source/basicide/basicbox.hxx')
-rw-r--r-- | basctl/source/basicide/basicbox.hxx | 250 |
1 files changed, 181 insertions, 69 deletions
diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx index 260c774956c1..e7c7bb907b83 100644 --- a/basctl/source/basicide/basicbox.hxx +++ b/basctl/source/basicide/basicbox.hxx @@ -26,116 +26,228 @@ namespace basctl { - -class LibBoxControl: public SfxToolBoxControl +/*! + * @brief Manage states of macro and dialog Library ComboBox + * + * @see LibBox Class + */ +class LibBoxControl : public SfxToolBoxControl { public: - SFX_DECL_TOOLBOX_CONTROL(); + /*! + * Macro for registring two metods + * + * @code + * static SfxToolBoxControl* CreateImpl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) + * static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule* pMod=nullptr) + * @endcode + * @see Macro SFX_IMPL_TOOLBOX_CONTROL + */ + SFX_DECL_TOOLBOX_CONTROL(); - LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + /*! + * @param nSlotId -- the slot as internal operation number + * @param nId -- this item's unique id in ToolBox + * @param rTbx -- the ToolBox which contains this ComboBox + */ + LibBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) override; - virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override; + /*! + * Triggered if state was changed + * + * @param nSlotID -- the slot as internal operation number (not used in this place) + * @param eState -- enum value which contains ComboBox state + * @param pState -- + */ + virtual void StateChanged(sal_uInt16 nSlotID, SfxItemState eState, + const SfxPoolItem* pState) override; + /*! + * Create combobox of Macro and Dialog Library + * + * @param pParent -- parent window + * @return ComboBox of macro and dialog Library + */ + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override; }; -/** base class for list boxes which need to update their content according to the list - of open documents -*/ -class DocListenerBox :public ListBox - ,public DocumentEventListener +/*! + * @brief Base class for all ComboBox elements. + * + * Base class for ComboBoxes which need to update their content according + * to the list of open documents. + */ +class DocListenerBox : public ListBox, public DocumentEventListener { protected: - DocListenerBox( vcl::Window* pParent ); + /// @param pParent -- parent window + DocListenerBox(vcl::Window* pParent); virtual ~DocListenerBox() override; virtual void dispose() override; -protected: - virtual void FillBox() = 0; + virtual void FillBox() = 0; private: // DocumentEventListener - virtual void onDocumentCreated( const ScriptDocument& _rDocument ) override; - virtual void onDocumentOpened( const ScriptDocument& _rDocument ) override; - virtual void onDocumentSave( const ScriptDocument& _rDocument ) override; - virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) override; - virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) override; - virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) override; - virtual void onDocumentClosed( const ScriptDocument& _rDocument ) override; - virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) override; - virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) override; + virtual void onDocumentCreated(const ScriptDocument& _rDoc) override; + virtual void onDocumentOpened(const ScriptDocument& _rDoc) override; + virtual void onDocumentSave(const ScriptDocument& _rDoc) override; + virtual void onDocumentSaveDone(const ScriptDocument& _rDoc) override; + virtual void onDocumentSaveAs(const ScriptDocument& _rDoc) override; + virtual void onDocumentSaveAsDone(const ScriptDocument& _rDoc) override; + virtual void onDocumentClosed(const ScriptDocument& _rDoc) override; + virtual void onDocumentTitleChanged(const ScriptDocument& _rDoc) override; + virtual void onDocumentModeChanged(const ScriptDocument& _rDoc) override; -private: - DocumentEventNotifier m_aNotifier; + DocumentEventNotifier maNotifier; }; - +/*! + * @brief Macros and Dialogs Library ComboBox + * + * @see LibBoxControl Class + */ class LibBox : public DocListenerBox { -private: - OUString aCurText; - bool bIgnoreSelect; - bool bFillBox; +public: + /// @param pParent + LibBox(vcl::Window* pParent); + virtual ~LibBox() override; + virtual void dispose() override; - static void ReleaseFocus(); - void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation ); + using Window::Update; + /*! + * Update selection in ComboBox of macro and dialog Library + * + * @param pItem -- string that was selected + */ + void Update(const SfxStringItem* pItem); - void ClearBox(); - void NotifyIDE(); +protected: + /// Called for setting language when user selects a language in ComboBox + virtual void Select() override; - // DocListenerBox - virtual void FillBox() override; + /*! + * Handle keystrokes and mouse + * + * @param rNEvt represents mouse event + * @return a bool value: true if was handled, and false if there was nothing handled + */ + virtual bool PreNotify(NotifyEvent& rNEvt) override; -protected: - virtual void Select() override; - virtual bool PreNotify( NotifyEvent& rNEvt ) override; +private: + static void ReleaseFocus(); -public: - LibBox( vcl::Window* pParent ); - virtual ~LibBox() override; - virtual void dispose() override; + /*! + * Insert name library in specified position + * + * @param rDocument -- macro or dialog + * @param eLocation -- enum value of Locations + */ + void InsertEntries(const ScriptDocument& rDocument, LibraryLocation eLocation); - using Window::Update; - void Update( const SfxStringItem* pItem ); + void ClearBox(); + void NotifyIDE(); + + /// Fill up the combobox + virtual void FillBox() override; + + OUString maCurrentText; + bool mbIgnoreSelect; + bool mbFillBox; ///< If true, when FillBox() is called }; -class LanguageBoxControl: public SfxToolBoxControl +/*! + * @brief Manage stats of Language ComboBox + * + * @see LanguageBox Class + */ +class LanguageBoxControl : public SfxToolBoxControl { public: - SFX_DECL_TOOLBOX_CONTROL(); + /*! Macro for registring two metods + * + * @code + * static SfxToolBoxControl* CreateImpl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) + * static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule* pMod=nullptr) + * @endcode + * @see Macro SFX_IMPL_TOOLBOX_CONTROL + */ + SFX_DECL_TOOLBOX_CONTROL(); - LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); + /*! + * @param nSlotId -- the slot as internal operation number + * @param nId -- this item's unique id in ToolBox + * @param rTbx -- the ToolBox which contains this ComboBox + */ + LanguageBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; - virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override; + /*! + * Triggered if state was changed + * + * @param nSlotID -- the slot as internal operation number (not used in this place) + * @param eState -- enum value which contains ComboBox state + * @param pState -- + */ + virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + /*! + * Create ComboBox of Language + * + * @param pParent + * @return LanguageBox ComboBox + */ + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override; }; +/*! + * @brief Class language ComboBox + * + * @see LanguageBoxControl Class + */ class LanguageBox : public DocListenerBox { -private: - OUString m_sNotLocalizedStr; - OUString m_sDefaultLanguageStr; - OUString m_sCurrentText; +public: + /*! + * @param pParent + */ + LanguageBox(vcl::Window* pParent); + virtual ~LanguageBox() override; + virtual void dispose() override; - bool m_bIgnoreSelect; + using Window::Update; + /*! + * Update selection in ComboBox of macro and dialog Library + * + * @param pItem -- string that was selected + */ + void Update(const SfxStringItem* pItem); - void ClearBox(); - void SetLanguage(); +protected: + /// Called for setting language when user selects a language in ComboBox + virtual void Select() override; - // DocListenerBox - virtual void FillBox() override; + /*! + * Handle keystrokes and mouse + * + * @param rNEvt represents mouse event + * @return a bool value: true if was handled, and false if there was nothing handled + */ + virtual bool PreNotify(NotifyEvent& rNEvt) override; -protected: - virtual void Select() override; - virtual bool PreNotify( NotifyEvent& rNEvt ) override; +private: + /// Delete all langiages form ComboBox + void ClearBox(); + /// Swich inferface of dialog to selected language + void SetLanguage(); -public: - LanguageBox( vcl::Window* pParent ); - virtual ~LanguageBox() override; - virtual void dispose() override; + /// Fill up the language combobox + virtual void FillBox() override; + + OUString msNotLocalizedStr; + OUString msDefaultLanguageStr; + OUString msCurrentText; - using Window::Update; - void Update( const SfxStringItem* pItem ); + bool mbIgnoreSelect; ///< do not use in this class }; } // namespace basctl |