Kaydet (Commit) f1f9c6ee authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxRubyDialog

Change-Id: I32f26b9d3e495e64a38cd8a56e532374dd4891f1
Reviewed-on: https://gerrit.libreoffice.org/69651Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 87f998fe
...@@ -195,9 +195,6 @@ ...@@ -195,9 +195,6 @@
<glade-widget-class title="Path List" name="xsltdlglo-SvxPathControl" <glade-widget-class title="Path List" name="xsltdlglo-SvxPathControl"
generic-name="Path List" parent="GtkDrawingArea" generic-name="Path List" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Ruby Preview" name="svxlo-RubyPreview"
generic-name="Ruby Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Print Preview" name="vcllo-PrintPreviewWindow" <glade-widget-class title="Print Preview" name="vcllo-PrintPreviewWindow"
generic-name="Print Preview" parent="GtkDrawingArea" generic-name="Print Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
...@@ -216,9 +213,6 @@ ...@@ -216,9 +213,6 @@
<glade-widget-class title="Chart Light Button" name="chartcontrollerlo-LightButton" <glade-widget-class title="Chart Light Button" name="chartcontrollerlo-LightButton"
generic-name="ChartLightButton" parent="GtkButton" generic-name="ChartLightButton" parent="GtkButton"
icon-name="widget-gtk-button"/> icon-name="widget-gtk-button"/>
<glade-widget-class title="Ruby Edit" name="svxlo-RubyEdit"
generic-name="RubyEdit" parent="GtkEntry"
icon-name="widget-gtk-textentry"/>
<glade-widget-class title="Extended Macro Library" name="basctllo-ExtTreeListBox" <glade-widget-class title="Extended Macro Library" name="basctllo-ExtTreeListBox"
generic-name="Extended Macro Library List" parent="GtkTreeView" generic-name="Extended Macro Library List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/> icon-name="widget-gtk-treeview"/>
......
...@@ -143,6 +143,7 @@ protected: ...@@ -143,6 +143,7 @@ protected:
public: public:
void Initialize (SfxChildWinInfo const * pInfo); void Initialize (SfxChildWinInfo const * pInfo);
bool IsClosing() const;
virtual void Close() override; virtual void Close() override;
virtual void EndDialog() override; virtual void EndDialog() override;
virtual void Activate() override; virtual void Activate() override;
......
...@@ -23,116 +23,99 @@ ...@@ -23,116 +23,99 @@
#include <sfx2/childwin.hxx> #include <sfx2/childwin.hxx>
#include <sfx2/basedlgs.hxx> #include <sfx2/basedlgs.hxx>
#include <vcl/layout.hxx> #include <vcl/customweld.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/scrbar.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
class SvxRubyDialog; class SvxRubyDialog;
class RubyPreview final : public vcl::Window class RubyPreview final : public weld::CustomWidgetController
{ {
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
VclPtr<SvxRubyDialog> m_pParentDlg; SvxRubyDialog* m_pParentDlg;
public: public:
RubyPreview(vcl::Window *pParent); RubyPreview();
virtual ~RubyPreview() override; virtual ~RubyPreview() override;
virtual void dispose() override;
void setRubyDialog(SvxRubyDialog* pParentDlg) void setRubyDialog(SvxRubyDialog* pParentDlg)
{ {
m_pParentDlg = pParentDlg; m_pParentDlg = pParentDlg;
} }
virtual Size GetOptimalSize() const override; virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
}; };
class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
{ {
public: public:
SvxRubyChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * ); SvxRubyChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * );
SFX_DECL_CHILDWINDOW( SvxRubyChildWindow ); SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
};
class SvxRubyData_Impl;
class RubyEdit : public Edit
{
Link<sal_Int32,bool> aScrollHdl;
Link<sal_Int32,void> aJumpHdl;
virtual void GetFocus() override;
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
public:
RubyEdit(vcl::Window* pParent)
: Edit(pParent, WB_BORDER)
{
}
void SetScrollHdl(Link<sal_Int32,bool> const & rLink) {aScrollHdl = rLink;}
void SetJumpHdl(Link<sal_Int32,void> const & rLink) {aJumpHdl = rLink;}
}; };
class SvxRubyData_Impl;
class SvxRubyDialog : public SfxModelessDialog class SvxRubyDialog : public SfxModelessDialogController
{ {
friend class RubyPreview; friend class RubyPreview;
VclPtr<FixedText> m_pLeftFT;
VclPtr<FixedText> m_pRightFT;
VclPtr<RubyEdit> m_pLeft1ED;
VclPtr<RubyEdit> m_pRight1ED;
VclPtr<RubyEdit> m_pLeft2ED;
VclPtr<RubyEdit> m_pRight2ED;
VclPtr<RubyEdit> m_pLeft3ED;
VclPtr<RubyEdit> m_pRight3ED;
VclPtr<RubyEdit> m_pLeft4ED;
VclPtr<RubyEdit> m_pRight4ED;
VclPtr<RubyEdit> aEditArr[8];
VclPtr<VclScrolledWindow> m_pScrolledWindow;
VclPtr<ScrollBar> m_pScrollSB;
VclPtr<ListBox> m_pAdjustLB;
VclPtr<ListBox> m_pPositionLB;
VclPtr<FixedText> m_pCharStyleFT;
VclPtr<ListBox> m_pCharStyleLB;
VclPtr<PushButton> m_pStylistPB;
VclPtr<RubyPreview> m_pPreviewWin;
VclPtr<PushButton> m_pApplyPB;
VclPtr<PushButton> m_pClosePB;
long nLastPos; long nLastPos;
long nCurrentEdit; long nCurrentEdit;
bool bModified; bool bModified;
SfxBindings* pBindings; SfxBindings* pBindings;
rtl::Reference<SvxRubyData_Impl> m_pImpl;
DECL_LINK(ApplyHdl_Impl, Button*, void); weld::Entry* aEditArr[8];
DECL_LINK(CloseHdl_Impl, Button*, void);
DECL_LINK(StylistHdl_Impl, Button*, void); std::unique_ptr<weld::Label> m_xLeftFT;
DECL_LINK(ScrollHdl_Impl, ScrollBar*, void); std::unique_ptr<weld::Label> m_xRightFT;
DECL_LINK(PositionHdl_Impl, ListBox&, void); std::unique_ptr<weld::Entry> m_xLeft1ED;
DECL_LINK(AdjustHdl_Impl, ListBox&, void); std::unique_ptr<weld::Entry> m_xRight1ED;
DECL_LINK(CharStyleHdl_Impl, ListBox&, void); std::unique_ptr<weld::Entry> m_xLeft2ED;
DECL_LINK(EditModifyHdl_Impl, Edit&, void); std::unique_ptr<weld::Entry> m_xRight2ED;
DECL_LINK(EditScrollHdl_Impl, sal_Int32, bool); std::unique_ptr<weld::Entry> m_xLeft3ED;
DECL_LINK(EditJumpHdl_Impl, sal_Int32, void); std::unique_ptr<weld::Entry> m_xRight3ED;
std::unique_ptr<weld::Entry> m_xLeft4ED;
void SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight); std::unique_ptr<weld::Entry> m_xRight4ED;
std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
std::unique_ptr<weld::ComboBox> m_xAdjustLB;
std::unique_ptr<weld::ComboBox> m_xPositionLB;
std::unique_ptr<weld::Label> m_xCharStyleFT;
std::unique_ptr<weld::ComboBox> m_xCharStyleLB;
std::unique_ptr<weld::Button> m_xStylistPB;
std::unique_ptr<weld::Button> m_xApplyPB;
std::unique_ptr<weld::Button> m_xClosePB;
std::unique_ptr<weld::Container> m_xContentArea;
std::unique_ptr<weld::Widget> m_xGrid;
std::unique_ptr<RubyPreview> m_xPreviewWin;
std::unique_ptr<weld::CustomWeld> m_xPreview;
DECL_LINK(ApplyHdl_Impl, weld::Button&, void);
DECL_LINK(CloseHdl_Impl, weld::Button&, void);
DECL_LINK(StylistHdl_Impl, weld::Button&, void);
DECL_LINK(ScrollHdl_Impl, weld::ScrolledWindow&, void);
DECL_LINK(PositionHdl_Impl, weld::ComboBox&, void);
DECL_LINK(AdjustHdl_Impl, weld::ComboBox&, void);
DECL_LINK(CharStyleHdl_Impl, weld::ComboBox&, void);
DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
DECL_LINK(EditFocusHdl_Impl, weld::Widget&, void);
DECL_LINK(KeyUpDownHdl_Impl, const KeyEvent&, bool);
DECL_LINK(KeyUpDownTabHdl_Impl, const KeyEvent&, bool);
bool EditScrollHdl_Impl(sal_Int32 nParam);
bool EditJumpHdl_Impl(sal_Int32 nParam);
void SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry& rRight);
void GetRubyText(); void GetRubyText();
void ClearCharStyleList(); void ClearCharStyleList();
void AssertOneEntry(); void AssertOneEntry();
void Update(); void Update();
virtual bool Close() override; virtual void Close() override;
long GetLastPos() const {return nLastPos;} long GetLastPos() const {return nLastPos;}
void SetLastPos(long nSet) {nLastPos = nSet;} void SetLastPos(long nSet) {nLastPos = nSet;}
...@@ -144,21 +127,11 @@ class SvxRubyDialog : public SfxModelessDialog ...@@ -144,21 +127,11 @@ class SvxRubyDialog : public SfxModelessDialog
void GetCurrentText(OUString& rBase, OUString& rRuby); void GetCurrentText(OUString& rBase, OUString& rRuby);
void UpdateColors();
protected:
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public: public:
SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW, SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window* pParent);
vcl::Window* pParent); virtual ~SvxRubyDialog() override;
virtual ~SvxRubyDialog() override;
virtual void dispose() override;
virtual void Activate() override; virtual void Activate() override;
private:
rtl::Reference<SvxRubyData_Impl> m_pImpl;
}; };
#endif // INCLUDED_SVX_RUBYDIALOG_HXX #endif // INCLUDED_SVX_RUBYDIALOG_HXX
......
...@@ -120,7 +120,6 @@ public: ...@@ -120,7 +120,6 @@ public:
SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ); SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
virtual ~SvxSearchDialog() override; virtual ~SvxSearchDialog() override;
virtual void EndDialog() override;
virtual void ChildWinDispose() override; virtual void ChildWinDispose() override;
virtual void Close() override; virtual void Close() override;
...@@ -143,7 +142,6 @@ public: ...@@ -143,7 +142,6 @@ public:
private: private:
bool mbSuccess; bool mbSuccess;
bool mbClosing;
SfxBindings& rBindings; SfxBindings& rBindings;
bool bWriter; bool bWriter;
......
...@@ -469,6 +469,11 @@ void SfxDialogController::EndDialog() ...@@ -469,6 +469,11 @@ void SfxDialogController::EndDialog()
response(RET_CLOSE); response(RET_CLOSE);
} }
bool SfxModelessDialogController::IsClosing() const
{
return m_xImpl->bClosing;
}
void SfxModelessDialogController::EndDialog() void SfxModelessDialogController::EndDialog()
{ {
m_xImpl->bClosing = true; m_xImpl->bClosing = true;
......
...@@ -466,8 +466,6 @@ custom_widgets = [ ...@@ -466,8 +466,6 @@ custom_widgets = [
'RefEdit', 'RefEdit',
'ReplaceEdit', 'ReplaceEdit',
'RowEdit', 'RowEdit',
'RubyEdit',
'RubyPreview',
'SameContentListBox', 'SameContentListBox',
'ScCondFormatList', 'ScCondFormatList',
'ScCsvTableBox', 'ScCsvTableBox',
......
...@@ -3,8 +3,8 @@ svx/uiconfig/ui/addmodeldialog.ui://GtkLabel[@id='alttitle'] orphan-label ...@@ -3,8 +3,8 @@ svx/uiconfig/ui/addmodeldialog.ui://GtkLabel[@id='alttitle'] orphan-label
svx/uiconfig/ui/addnamespacedialog.ui://GtkLabel[@id='alttitle'] orphan-label svx/uiconfig/ui/addnamespacedialog.ui://GtkLabel[@id='alttitle'] orphan-label
svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkLabel[@id='basetextft'] orphan-label svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkLabel[@id='basetextft'] orphan-label
svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkLabel[@id='rubytextft'] orphan-label svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkLabel[@id='rubytextft'] orphan-label
svx/uiconfig/ui/asianphoneticguidedialog.ui://svxlo-RubyEdit[@id='Left1ED'] no-labelled-by svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkEntry[@id='Left1ED'] no-labelled-by
svx/uiconfig/ui/asianphoneticguidedialog.ui://svxlo-RubyEdit[@id='Right1ED'] no-labelled-by svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkEntry[@id='Right1ED'] no-labelled-by
svx/uiconfig/ui/chinesedictionary.ui://GtkLabel[@id='termft'] orphan-label svx/uiconfig/ui/chinesedictionary.ui://GtkLabel[@id='termft'] orphan-label
svx/uiconfig/ui/chinesedictionary.ui://GtkEntry[@id='term'] no-labelled-by svx/uiconfig/ui/chinesedictionary.ui://GtkEntry[@id='term'] no-labelled-by
svx/uiconfig/ui/chinesedictionary.ui://GtkLabel[@id='mappingft'] orphan-label svx/uiconfig/ui/chinesedictionary.ui://GtkLabel[@id='mappingft'] orphan-label
......
...@@ -257,7 +257,6 @@ SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWi ...@@ -257,7 +257,6 @@ SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWi
: SfxModelessDialogController(&rBind, pChildWin, pParent, : SfxModelessDialogController(&rBind, pChildWin, pParent,
"svx/ui/findreplacedialog.ui", "FindReplaceDialog") "svx/ui/findreplacedialog.ui", "FindReplaceDialog")
, mbSuccess(false) , mbSuccess(false)
, mbClosing(false)
, rBindings(rBind) , rBindings(rBind)
, bWriter(false) , bWriter(false)
, bSearch(true) , bSearch(true)
...@@ -488,13 +487,6 @@ void SvxSearchDialog::Construct_Impl() ...@@ -488,13 +487,6 @@ void SvxSearchDialog::Construct_Impl()
} }
} }
void SvxSearchDialog::EndDialog()
{
mbClosing = true;
SfxModelessDialogController::EndDialog();
mbClosing = false;
}
void SvxSearchDialog::Close() void SvxSearchDialog::Close()
{ {
// remember strings // remember strings
...@@ -519,7 +511,7 @@ void SvxSearchDialog::Close() ...@@ -519,7 +511,7 @@ void SvxSearchDialog::Close()
aOpt.SetSearchFormatted ( m_xSearchFormattedCB->get_active() ); aOpt.SetSearchFormatted ( m_xSearchFormattedCB->get_active() );
aOpt.Commit(); aOpt.Commit();
if (mbClosing) if (IsClosing())
return; return;
const SfxPoolItem* ppArgs[] = { pSearchItem.get(), nullptr }; const SfxPoolItem* ppArgs[] = { pSearchItem.get(), nullptr };
......
...@@ -99,9 +99,8 @@ ...@@ -99,9 +99,8 @@
<child> <child>
<object class="GtkScrolledWindow" id="ctlFavoriteswin"> <object class="GtkScrolledWindow" id="ctlFavoriteswin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property> <property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property> <property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>
...@@ -112,10 +111,8 @@ ...@@ -112,10 +111,8 @@
<child> <child>
<object class="GtkDrawingArea" id="ctlFavorites"> <object class="GtkDrawingArea" id="ctlFavorites">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property>
</object> </object>
</child> </child>
</object> </object>
......
...@@ -40,10 +40,10 @@ class asianPhoneticGuide(UITestCase): ...@@ -40,10 +40,10 @@ class asianPhoneticGuide(UITestCase):
actionProps3 = mkPropertyValues(props3) actionProps3 = mkPropertyValues(props3)
xstylelb.executeAction("SELECT", actionProps3) xstylelb.executeAction("SELECT", actionProps3)
xApplyBtn = xDialog.getChild("apply") xApplyBtn = xDialog.getChild("ok")
xApplyBtn.executeAction("CLICK", tuple()) xApplyBtn.executeAction("CLICK", tuple())
xCloseBtn = xDialog.getChild("close") xCloseBtn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCloseBtn) self.ui_test.close_dialog_through_button(xCloseBtn)
self.assertEqual(document.Text.String[0:1], "a") self.assertEqual(document.Text.String[0:1], "a")
......
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