Kaydet (Commit) 8ec5c249 authored tarafından tagezi's avatar tagezi Kaydeden (comit) Mike Kaganski

Format and document combobox classes of BasicIDE

Change-Id: Ie4f9c142d221b16072748c9c2deaa96c4704b90d
Reviewed-on: https://gerrit.libreoffice.org/64422
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst efe28895
......@@ -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
......
......@@ -245,8 +245,6 @@ basctl/source/accessibility/accessibledialogcontrolshape.cxx
basctl/source/accessibility/accessibledialogwindow.cxx
basctl/source/basicide/basdoc.cxx
basctl/source/basicide/basdoc.hxx
basctl/source/basicide/basicbox.cxx
basctl/source/basicide/basicbox.hxx
basctl/source/basicide/basicmod.hxx
basctl/source/basicide/basicrenderable.cxx
basctl/source/basicide/basicrenderable.hxx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment