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 @@
<glade-widget-class title="Path List" name="xsltdlglo-SvxPathControl"
generic-name="Path List" parent="GtkDrawingArea"
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"
generic-name="Print Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
......@@ -216,9 +213,6 @@
<glade-widget-class title="Chart Light Button" name="chartcontrollerlo-LightButton"
generic-name="ChartLightButton" parent="GtkButton"
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"
generic-name="Extended Macro Library List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
......
......@@ -143,6 +143,7 @@ protected:
public:
void Initialize (SfxChildWinInfo const * pInfo);
bool IsClosing() const;
virtual void Close() override;
virtual void EndDialog() override;
virtual void Activate() override;
......
......@@ -23,116 +23,99 @@
#include <sfx2/childwin.hxx>
#include <sfx2/basedlgs.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/customweld.hxx>
#include <svx/svxdllapi.h>
#include <rtl/ref.hxx>
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;
VclPtr<SvxRubyDialog> m_pParentDlg;
SvxRubyDialog* m_pParentDlg;
public:
RubyPreview(vcl::Window *pParent);
RubyPreview();
virtual ~RubyPreview() override;
virtual void dispose() override;
void setRubyDialog(SvxRubyDialog* pParentDlg)
{
m_pParentDlg = pParentDlg;
}
virtual Size GetOptimalSize() const override;
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
};
class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
{
public:
public:
SvxRubyChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * );
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;
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 nCurrentEdit;
bool bModified;
SfxBindings* pBindings;
DECL_LINK(ApplyHdl_Impl, Button*, void);
DECL_LINK(CloseHdl_Impl, Button*, void);
DECL_LINK(StylistHdl_Impl, Button*, void);
DECL_LINK(ScrollHdl_Impl, ScrollBar*, void);
DECL_LINK(PositionHdl_Impl, ListBox&, void);
DECL_LINK(AdjustHdl_Impl, ListBox&, void);
DECL_LINK(CharStyleHdl_Impl, ListBox&, void);
DECL_LINK(EditModifyHdl_Impl, Edit&, void);
DECL_LINK(EditScrollHdl_Impl, sal_Int32, bool);
DECL_LINK(EditJumpHdl_Impl, sal_Int32, void);
void SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
rtl::Reference<SvxRubyData_Impl> m_pImpl;
weld::Entry* aEditArr[8];
std::unique_ptr<weld::Label> m_xLeftFT;
std::unique_ptr<weld::Label> m_xRightFT;
std::unique_ptr<weld::Entry> m_xLeft1ED;
std::unique_ptr<weld::Entry> m_xRight1ED;
std::unique_ptr<weld::Entry> m_xLeft2ED;
std::unique_ptr<weld::Entry> m_xRight2ED;
std::unique_ptr<weld::Entry> m_xLeft3ED;
std::unique_ptr<weld::Entry> m_xRight3ED;
std::unique_ptr<weld::Entry> m_xLeft4ED;
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 ClearCharStyleList();
void AssertOneEntry();
void Update();
virtual bool Close() override;
virtual void Close() override;
long GetLastPos() const {return nLastPos;}
void SetLastPos(long nSet) {nLastPos = nSet;}
......@@ -144,21 +127,11 @@ class SvxRubyDialog : public SfxModelessDialog
void GetCurrentText(OUString& rBase, OUString& rRuby);
void UpdateColors();
protected:
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public:
SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent);
virtual ~SvxRubyDialog() override;
virtual void dispose() override;
SvxRubyDialog(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window* pParent);
virtual ~SvxRubyDialog() override;
virtual void Activate() override;
private:
rtl::Reference<SvxRubyData_Impl> m_pImpl;
};
#endif // INCLUDED_SVX_RUBYDIALOG_HXX
......
......@@ -120,7 +120,6 @@ public:
SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
virtual ~SvxSearchDialog() override;
virtual void EndDialog() override;
virtual void ChildWinDispose() override;
virtual void Close() override;
......@@ -143,7 +142,6 @@ public:
private:
bool mbSuccess;
bool mbClosing;
SfxBindings& rBindings;
bool bWriter;
......
......@@ -469,6 +469,11 @@ void SfxDialogController::EndDialog()
response(RET_CLOSE);
}
bool SfxModelessDialogController::IsClosing() const
{
return m_xImpl->bClosing;
}
void SfxModelessDialogController::EndDialog()
{
m_xImpl->bClosing = true;
......
......@@ -466,8 +466,6 @@ custom_widgets = [
'RefEdit',
'ReplaceEdit',
'RowEdit',
'RubyEdit',
'RubyPreview',
'SameContentListBox',
'ScCondFormatList',
'ScCsvTableBox',
......
......@@ -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/asianphoneticguidedialog.ui://GtkLabel[@id='basetextft'] 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://svxlo-RubyEdit[@id='Right1ED'] no-labelled-by
svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkEntry[@id='Left1ED'] 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://GtkEntry[@id='term'] no-labelled-by
svx/uiconfig/ui/chinesedictionary.ui://GtkLabel[@id='mappingft'] orphan-label
......
......@@ -257,7 +257,6 @@ SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWi
: SfxModelessDialogController(&rBind, pChildWin, pParent,
"svx/ui/findreplacedialog.ui", "FindReplaceDialog")
, mbSuccess(false)
, mbClosing(false)
, rBindings(rBind)
, bWriter(false)
, bSearch(true)
......@@ -488,13 +487,6 @@ void SvxSearchDialog::Construct_Impl()
}
}
void SvxSearchDialog::EndDialog()
{
mbClosing = true;
SfxModelessDialogController::EndDialog();
mbClosing = false;
}
void SvxSearchDialog::Close()
{
// remember strings
......@@ -519,7 +511,7 @@ void SvxSearchDialog::Close()
aOpt.SetSearchFormatted ( m_xSearchFormattedCB->get_active() );
aOpt.Commit();
if (mbClosing)
if (IsClosing())
return;
const SfxPoolItem* ppArgs[] = { pSearchItem.get(), nullptr };
......
......@@ -99,9 +99,8 @@
<child>
<object class="GtkScrolledWindow" id="ctlFavoriteswin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
......@@ -112,10 +111,8 @@
<child>
<object class="GtkDrawingArea" id="ctlFavorites">
<property name="visible">True</property>
<property name="can_focus">True</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="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
......
......@@ -40,10 +40,10 @@ class asianPhoneticGuide(UITestCase):
actionProps3 = mkPropertyValues(props3)
xstylelb.executeAction("SELECT", actionProps3)
xApplyBtn = xDialog.getChild("apply")
xApplyBtn = xDialog.getChild("ok")
xApplyBtn.executeAction("CLICK", tuple())
xCloseBtn = xDialog.getChild("close")
xCloseBtn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCloseBtn)
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