weld SvxRubyDialog

Change-Id: I32f26b9d3e495e64a38cd8a56e532374dd4891f1
Reviewed-on: https://gerrit.libreoffice.org/69651
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-03-24 17:57:59 +00:00
parent 87f998fedb
commit f1f9c6ee94
12 changed files with 427 additions and 490 deletions

View File

@@ -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 @@
<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"/>

View File

@@ -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;

View File

@@ -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:
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: public:
RubyEdit(vcl::Window* pParent) SvxRubyChildWindow( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo const * );
: Edit(pParent, WB_BORDER) SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
{
}
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;
weld::Entry* aEditArr[8];
DECL_LINK(ApplyHdl_Impl, Button*, void); std::unique_ptr<weld::Label> m_xLeftFT;
DECL_LINK(CloseHdl_Impl, Button*, void); std::unique_ptr<weld::Label> m_xRightFT;
DECL_LINK(StylistHdl_Impl, Button*, void); std::unique_ptr<weld::Entry> m_xLeft1ED;
DECL_LINK(ScrollHdl_Impl, ScrollBar*, void); std::unique_ptr<weld::Entry> m_xRight1ED;
DECL_LINK(PositionHdl_Impl, ListBox&, void); std::unique_ptr<weld::Entry> m_xLeft2ED;
DECL_LINK(AdjustHdl_Impl, ListBox&, void); std::unique_ptr<weld::Entry> m_xRight2ED;
DECL_LINK(CharStyleHdl_Impl, ListBox&, void); std::unique_ptr<weld::Entry> m_xLeft3ED;
DECL_LINK(EditModifyHdl_Impl, Edit&, void); std::unique_ptr<weld::Entry> m_xRight3ED;
DECL_LINK(EditScrollHdl_Impl, sal_Int32, bool); std::unique_ptr<weld::Entry> m_xLeft4ED;
DECL_LINK(EditJumpHdl_Impl, sal_Int32, void); std::unique_ptr<weld::Entry> m_xRight4ED;
void SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight); 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
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

View File

@@ -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:
private: private:
bool mbSuccess; bool mbSuccess;
bool mbClosing;
SfxBindings& rBindings; SfxBindings& rBindings;
bool bWriter; bool bWriter;

View File

@@ -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;

View File

@@ -466,8 +466,6 @@ custom_widgets = [
'RefEdit', 'RefEdit',
'ReplaceEdit', 'ReplaceEdit',
'RowEdit', 'RowEdit',
'RubyEdit',
'RubyPreview',
'SameContentListBox', 'SameContentListBox',
'ScCondFormatList', 'ScCondFormatList',
'ScCsvTableBox', 'ScCsvTableBox',

View File

@@ -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

View File

@@ -1,4 +1,3 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
@@ -27,6 +26,7 @@
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx>
#include <svl/eitem.hxx> #include <svl/eitem.hxx>
#include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/style/XStyle.hpp>
@@ -70,13 +70,9 @@ static const sal_Char cRubyCharStyleName[] = "RubyCharStyleName";
SvxRubyChildWindow::SvxRubyChildWindow(vcl::Window* _pParent, sal_uInt16 nId,SfxBindings* pBindings, SfxChildWinInfo const * pInfo) SvxRubyChildWindow::SvxRubyChildWindow(vcl::Window* _pParent, sal_uInt16 nId,SfxBindings* pBindings, SfxChildWinInfo const * pInfo)
: SfxChildWindow(_pParent, nId) : SfxChildWindow(_pParent, nId)
{ {
VclPtr<SvxRubyDialog> pDlg = VclPtr<SvxRubyDialog>::Create(pBindings, this, _pParent); std::shared_ptr<SvxRubyDialog> xDlg(new SvxRubyDialog(pBindings, this, _pParent->GetFrameWeld()));
SetWindow(pDlg); SetController(xDlg);
xDlg->Initialize(pInfo);
if (pInfo->nFlags & SfxChildWindowFlags::ZOOMIN)
pDlg->RollUp();
pDlg->Initialize(pInfo);
} }
SfxChildWinInfo SvxRubyChildWindow::GetInfo() const SfxChildWinInfo SvxRubyChildWindow::GetInfo() const
@@ -200,123 +196,97 @@ void SvxRubyData_Impl::AssertOneEntry()
} }
} }
SvxRubyDialog::SvxRubyDialog(SfxBindings* pBind, SfxChildWindow* pCW, vcl::Window* _pParent) SvxRubyDialog::SvxRubyDialog(SfxBindings* pBind, SfxChildWindow* pCW, weld::Window* pParent)
: SfxModelessDialog(pBind, pCW, _pParent, "AsianPhoneticGuideDialog", "svx/ui/asianphoneticguidedialog.ui") : SfxModelessDialogController(pBind, pCW, pParent,
"svx/ui/asianphoneticguidedialog.ui", "AsianPhoneticGuideDialog")
, nLastPos(0) , nLastPos(0)
, nCurrentEdit(0) , nCurrentEdit(0)
, bModified(false) , bModified(false)
, pBindings(pBind) , pBindings(pBind)
, m_pImpl( new SvxRubyData_Impl ) , m_pImpl( new SvxRubyData_Impl )
, m_xLeftFT(m_xBuilder->weld_label("basetextft"))
, m_xRightFT(m_xBuilder->weld_label("rubytextft"))
, m_xLeft1ED(m_xBuilder->weld_entry("Left1ED"))
, m_xRight1ED(m_xBuilder->weld_entry("Right1ED"))
, m_xLeft2ED(m_xBuilder->weld_entry("Left2ED"))
, m_xRight2ED(m_xBuilder->weld_entry("Right2ED"))
, m_xLeft3ED(m_xBuilder->weld_entry("Left3ED"))
, m_xRight3ED(m_xBuilder->weld_entry("Right3ED"))
, m_xLeft4ED(m_xBuilder->weld_entry("Left4ED"))
, m_xRight4ED(m_xBuilder->weld_entry("Right4ED"))
, m_xScrolledWindow(m_xBuilder->weld_scrolled_window("scrolledwindow"))
, m_xAdjustLB(m_xBuilder->weld_combo_box("adjustlb"))
, m_xPositionLB(m_xBuilder->weld_combo_box("positionlb"))
, m_xCharStyleFT(m_xBuilder->weld_label("styleft"))
, m_xCharStyleLB(m_xBuilder->weld_combo_box("stylelb"))
, m_xStylistPB(m_xBuilder->weld_button("styles"))
, m_xApplyPB(m_xBuilder->weld_button("ok"))
, m_xClosePB(m_xBuilder->weld_button("cancel"))
, m_xContentArea(m_xDialog->weld_content_area())
, m_xGrid(m_xBuilder->weld_widget("grid"))
, m_xPreviewWin(new RubyPreview)
, m_xPreview(new weld::CustomWeld(*m_xBuilder, "preview", *m_xPreviewWin))
{ {
get(m_pLeftFT, "basetextft"); m_xCharStyleLB->make_sorted();
get(m_pRightFT, "rubytextft"); m_xPreviewWin->setRubyDialog(this);
get(m_pAdjustLB, "adjustlb"); m_xScrolledWindow->set_user_managed_scrolling();
get(m_pPositionLB, "positionlb"); m_xScrolledWindow->set_size_request(-1, m_xGrid->get_preferred_size().Height());
get(m_pCharStyleFT, "styleft"); m_xScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
get(m_pCharStyleLB, "stylelb");
m_pCharStyleLB->SetStyle(m_pCharStyleLB->GetStyle() | WB_SORT);
get(m_pStylistPB, "styles");
get(m_pApplyPB, "apply");
get(m_pClosePB, "close");
get(m_pPreviewWin, "preview");
m_pPreviewWin->setRubyDialog(this);
get(m_pScrolledWindow, "scrolledwindow");
m_pScrolledWindow->setUserManagedScrolling(true);
m_pScrollSB = &m_pScrolledWindow->getVertScrollBar();
get(m_pLeft1ED, "Left1ED");
get(m_pRight1ED, "Right1ED");
get(m_pLeft2ED, "Left2ED");
get(m_pRight2ED, "Right2ED");
get(m_pLeft3ED, "Left3ED");
get(m_pRight3ED, "Right3ED");
get(m_pLeft4ED, "Left4ED");
get(m_pRight4ED, "Right4ED");
aEditArr[0] = m_pLeft1ED; aEditArr[1] = m_pRight1ED;
aEditArr[2] = m_pLeft2ED; aEditArr[3] = m_pRight2ED;
aEditArr[4] = m_pLeft3ED; aEditArr[5] = m_pRight3ED;
aEditArr[6] = m_pLeft4ED; aEditArr[7] = m_pRight4ED;
m_pApplyPB->SetClickHdl(LINK(this, SvxRubyDialog, ApplyHdl_Impl)); aEditArr[0] = m_xLeft1ED.get(); aEditArr[1] = m_xRight1ED.get();
m_pClosePB->SetClickHdl(LINK(this, SvxRubyDialog, CloseHdl_Impl)); aEditArr[2] = m_xLeft2ED.get(); aEditArr[3] = m_xRight2ED.get();
m_pStylistPB->SetClickHdl(LINK(this, SvxRubyDialog, StylistHdl_Impl)); aEditArr[4] = m_xLeft3ED.get(); aEditArr[5] = m_xRight3ED.get();
m_pAdjustLB->SetSelectHdl(LINK(this, SvxRubyDialog, AdjustHdl_Impl)); aEditArr[6] = m_xLeft4ED.get(); aEditArr[7] = m_xRight4ED.get();
m_pPositionLB->SetSelectHdl(LINK(this, SvxRubyDialog, PositionHdl_Impl));
m_pCharStyleLB->SetSelectHdl(LINK(this, SvxRubyDialog, CharStyleHdl_Impl));
Link<ScrollBar*,void> aScrLk(LINK(this, SvxRubyDialog, ScrollHdl_Impl)); m_xApplyPB->connect_clicked(LINK(this, SvxRubyDialog, ApplyHdl_Impl));
m_pScrollSB->SetScrollHdl(aScrLk); m_xClosePB->connect_clicked(LINK(this, SvxRubyDialog, CloseHdl_Impl));
m_pScrollSB->SetEndScrollHdl(aScrLk); m_xStylistPB->connect_clicked(LINK(this, SvxRubyDialog, StylistHdl_Impl));
m_xAdjustLB->connect_changed(LINK(this, SvxRubyDialog, AdjustHdl_Impl));
m_xPositionLB->connect_changed(LINK(this, SvxRubyDialog, PositionHdl_Impl));
m_xCharStyleLB->connect_changed(LINK(this, SvxRubyDialog, CharStyleHdl_Impl));
Link<Edit&,void> aEditLk(LINK(this, SvxRubyDialog, EditModifyHdl_Impl)); Link<weld::ScrolledWindow&, void> aScrLk(LINK(this, SvxRubyDialog, ScrollHdl_Impl));
Link<sal_Int32,bool> aScrollLk(LINK(this, SvxRubyDialog, EditScrollHdl_Impl)); m_xScrolledWindow->connect_vadjustment_changed(aScrLk);
Link<sal_Int32,void> aJumpLk(LINK(this, SvxRubyDialog, EditJumpHdl_Impl));
Link<weld::Entry&,void> aEditLk(LINK(this, SvxRubyDialog, EditModifyHdl_Impl));
Link<weld::Widget&,void> aFocusLk(LINK(this, SvxRubyDialog, EditFocusHdl_Impl));
Link<const KeyEvent&,bool> aKeyUpDownLk(LINK(this, SvxRubyDialog, KeyUpDownHdl_Impl));
Link<const KeyEvent&,bool> aKeyTabUpDownLk(LINK(this, SvxRubyDialog, KeyUpDownTabHdl_Impl));
for (sal_uInt16 i = 0; i < 8; i++) for (sal_uInt16 i = 0; i < 8; i++)
{ {
aEditArr[i]->SetModifyHdl(aEditLk); aEditArr[i]->connect_changed(aEditLk);
aEditArr[i]->SetJumpHdl(aJumpLk); aEditArr[i]->connect_focus_in(aFocusLk);
if (!i || 7 == i) if (!i || 7 == i)
aEditArr[i]->SetScrollHdl(aScrollLk); aEditArr[i]->connect_key_press(aKeyTabUpDownLk);
else
aEditArr[i]->connect_key_press(aKeyUpDownLk);
} }
UpdateColors();
} }
SvxRubyDialog::~SvxRubyDialog() SvxRubyDialog::~SvxRubyDialog()
{
disposeOnce();
}
void SvxRubyDialog::dispose()
{ {
ClearCharStyleList(); ClearCharStyleList();
EventObject aEvent; EventObject aEvent;
m_pImpl->disposing(aEvent); m_pImpl->disposing(aEvent);
m_pLeftFT.clear();
m_pRightFT.clear();
m_pLeft1ED.clear();
m_pRight1ED.clear();
m_pLeft2ED.clear();
m_pRight2ED.clear();
m_pLeft3ED.clear();
m_pRight3ED.clear();
m_pLeft4ED.clear();
m_pRight4ED.clear();
for (int i = 0; i < 7; i++)
aEditArr[i].clear();
m_pScrolledWindow.clear();
m_pScrollSB.clear();
m_pAdjustLB.clear();
m_pPositionLB.clear();
m_pCharStyleFT.clear();
m_pCharStyleLB.clear();
m_pStylistPB.clear();
m_pPreviewWin.clear();
m_pApplyPB.clear();
m_pClosePB.clear();
SfxModelessDialog::dispose();
} }
void SvxRubyDialog::ClearCharStyleList() void SvxRubyDialog::ClearCharStyleList()
{ {
for (sal_Int32 i = 0; i < m_pCharStyleLB->GetEntryCount(); i++) m_xCharStyleLB->clear();
{
void* pData = m_pCharStyleLB->GetEntryData(i);
delete static_cast<OUString*>(pData);
}
m_pCharStyleLB->Clear();
} }
bool SvxRubyDialog::Close() void SvxRubyDialog::Close()
{ {
pBindings->GetDispatcher()->Execute( SID_RUBY_DIALOG, if (IsClosing())
SfxCallMode::ASYNCHRON | return;
SfxCallMode::RECORD); SfxViewShell* pViewShell = SfxViewShell::Current();
return true; if (pViewShell)
pViewShell->GetViewFrame()->ToggleChildWindow(SID_RUBY_DIALOG);
} }
void SvxRubyDialog::Activate() void SvxRubyDialog::Activate()
{ {
SfxModelessDialog::Activate(); SfxModelessDialogController::Activate();
std::unique_ptr<SfxPoolItem> pState; std::unique_ptr<SfxPoolItem> pState;
//get selection from current view frame //get selection from current view frame
SfxViewFrame* pCurFrm = SfxViewFrame::Current(); SfxViewFrame* pCurFrm = SfxViewFrame::Current();
@@ -331,7 +301,7 @@ void SvxRubyDialog::Activate()
if (xRubySel.is()) if (xRubySel.is())
{ {
Reference< XModel > xModel = m_pImpl->GetModel(); Reference< XModel > xModel = m_pImpl->GetModel();
const OUString sCharStyleSelect = m_pCharStyleLB->GetSelectedEntry(); const OUString sCharStyleSelect = m_xCharStyleLB->get_active_text();
ClearCharStyleList(); ClearCharStyleList();
Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY); Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY);
if (xSupplier.is()) if (xSupplier.is())
@@ -370,8 +340,7 @@ void SvxRubyDialog::Activate()
} }
if (!sName.isEmpty()) if (!sName.isEmpty())
{ {
const sal_Int32 nPos = m_pCharStyleLB->InsertEntry(sName); m_xCharStyleLB->append(sCoreName, sName);
m_pCharStyleLB->SetEntryData( nPos, new OUString(sCoreName) );
} }
} }
@@ -381,18 +350,18 @@ void SvxRubyDialog::Activate()
{ {
OSL_FAIL("exception in style access"); OSL_FAIL("exception in style access");
} }
if(!sCharStyleSelect.isEmpty()) if (!sCharStyleSelect.isEmpty())
m_pCharStyleLB->SelectEntry(sCharStyleSelect); m_xCharStyleLB->set_active_text(sCharStyleSelect);
} }
m_pCharStyleLB->Enable(xSupplier.is()); m_xCharStyleLB->set_sensitive(xSupplier.is());
m_pCharStyleFT->Enable(xSupplier.is()); m_xCharStyleFT->set_sensitive(xSupplier.is());
} }
Update(); Update();
m_pPreviewWin->Invalidate(); m_xPreviewWin->Invalidate();
} }
} }
void SvxRubyDialog::SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight) void SvxRubyDialog::SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry& rRight)
{ {
OUString sLeft, sRight; OUString sLeft, sRight;
const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
@@ -413,12 +382,12 @@ void SvxRubyDialog::SetRubyText(sal_Int32 nPos, Edit& rLeft, Edit& rRight)
{ {
bEnable = true; bEnable = true;
} }
rLeft.Enable(bEnable); rLeft.set_sensitive(bEnable);
rRight.Enable(bEnable); rRight.set_sensitive(bEnable);
rLeft.SetText(sLeft); rLeft.set_text(sLeft);
rRight.SetText(sRight); rRight.set_text(sRight);
rLeft.SaveValue(); rLeft.save_value();
rRight.SaveValue(); rRight.save_value();
} }
void SvxRubyDialog::GetRubyText() void SvxRubyDialog::GetRubyText()
@@ -426,8 +395,9 @@ void SvxRubyDialog::GetRubyText()
long nTempLastPos = GetLastPos(); long nTempLastPos = GetLastPos();
for (int i = 0; i < 8; i+=2) for (int i = 0; i < 8; i+=2)
{ {
if (aEditArr[i]->IsEnabled() && if (aEditArr[i]->get_sensitive() &&
(aEditArr[i]->IsValueChangedFromSaved() || aEditArr[i + 1]->IsValueChangedFromSaved())) (aEditArr[i]->get_value_changed_from_saved() ||
aEditArr[i + 1]->get_value_changed_from_saved()))
{ {
Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index" ); DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index" );
@@ -436,9 +406,9 @@ void SvxRubyDialog::GetRubyText()
for (PropertyValue & propVal : rProps) for (PropertyValue & propVal : rProps)
{ {
if (propVal.Name == cRubyBaseText) if (propVal.Name == cRubyBaseText)
propVal.Value <<= aEditArr[i]->GetText(); propVal.Value <<= aEditArr[i]->get_text();
else if (propVal.Name == cRubyText) else if (propVal.Name == cRubyText)
propVal.Value <<= aEditArr[i + 1]->GetText(); propVal.Value <<= aEditArr[i + 1]->get_text();
} }
} }
} }
@@ -448,9 +418,11 @@ void SvxRubyDialog::Update()
{ {
const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
sal_Int32 nLen = aRubyValues.getLength(); sal_Int32 nLen = aRubyValues.getLength();
m_pScrollSB->Enable(nLen > 4); m_xScrolledWindow->vadjustment_configure(0, 0, !nLen ? 1 : nLen, 1, 4, 4);
m_pScrollSB->SetRange( Range(0, nLen > 4 ? nLen - 4 : 0)); if (nLen > 4)
m_pScrollSB->SetThumbPos(0); m_xScrolledWindow->set_vpolicy(VclPolicyType::ALWAYS);
else
m_xScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
SetLastPos(0); SetLastPos(0);
SetModified(false); SetModified(false);
@@ -499,65 +471,65 @@ void SvxRubyDialog::Update()
nPosition = 0; nPosition = 0;
} }
if (nAdjust > -1) if (nAdjust > -1)
m_pAdjustLB->SelectEntryPos(nAdjust); m_xAdjustLB->set_active(nAdjust);
else else
m_pAdjustLB->SetNoSelection(); m_xAdjustLB->set_active(-1);
if (nPosition > -1) if (nPosition > -1)
m_pPositionLB->SelectEntryPos(nPosition); m_xPositionLB->set_active(nPosition);
if (!nLen || (bCharStyleEqual && sCharStyleName.isEmpty())) if (!nLen || (bCharStyleEqual && sCharStyleName.isEmpty()))
sCharStyleName = "Rubies"; sCharStyleName = "Rubies";
if (!sCharStyleName.isEmpty()) if (!sCharStyleName.isEmpty())
{ {
for (sal_Int32 i = 0; i < m_pCharStyleLB->GetEntryCount(); i++) for (int i = 0, nEntryCount = m_xCharStyleLB->get_count(); i < nEntryCount; i++)
{ {
const OUString* pCoreName = static_cast<const OUString*>(m_pCharStyleLB->GetEntryData(i)); OUString sCoreName = m_xCharStyleLB->get_id(i);
if (pCoreName && sCharStyleName == *pCoreName) if (sCharStyleName == sCoreName)
{ {
m_pCharStyleLB->SelectEntryPos(i); m_xCharStyleLB->set_active(i);
break; break;
} }
} }
} }
else else
m_pCharStyleLB->SetNoSelection(); m_xCharStyleLB->set_active(-1);
ScrollHdl_Impl(m_pScrollSB); ScrollHdl_Impl(*m_xScrolledWindow);
} }
void SvxRubyDialog::GetCurrentText(OUString& rBase, OUString& rRuby) void SvxRubyDialog::GetCurrentText(OUString& rBase, OUString& rRuby)
{ {
rBase = aEditArr[nCurrentEdit * 2]->GetText(); rBase = aEditArr[nCurrentEdit * 2]->get_text();
rRuby = aEditArr[nCurrentEdit * 2 + 1]->GetText(); rRuby = aEditArr[nCurrentEdit * 2 + 1]->get_text();
} }
IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, ScrollBar*, pScroll, void) IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, weld::ScrolledWindow&, rScroll, void)
{ {
long nPos = pScroll->GetThumbPos(); int nPos = rScroll.vadjustment_get_value();
if (GetLastPos() != nPos) if (GetLastPos() != nPos)
{ {
GetRubyText(); GetRubyText();
} }
SetRubyText(nPos++, *m_pLeft1ED, *m_pRight1ED); SetRubyText(nPos++, *m_xLeft1ED, *m_xRight1ED);
SetRubyText(nPos++, *m_pLeft2ED, *m_pRight2ED); SetRubyText(nPos++, *m_xLeft2ED, *m_xRight2ED);
SetRubyText(nPos++, *m_pLeft3ED, *m_pRight3ED); SetRubyText(nPos++, *m_xLeft3ED, *m_xRight3ED);
SetRubyText(nPos, *m_pLeft4ED, *m_pRight4ED); SetRubyText(nPos, *m_xLeft4ED, *m_xRight4ED);
SetLastPos(nPos - 3); SetLastPos(nPos - 3);
m_pPreviewWin->Invalidate(); m_xPreviewWin->Invalidate();
} }
IMPL_LINK_NOARG(SvxRubyDialog, ApplyHdl_Impl, Button*, void) IMPL_LINK_NOARG(SvxRubyDialog, ApplyHdl_Impl, weld::Button&, void)
{ {
const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); const Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
if (!aRubyValues.getLength()) if (!aRubyValues.getLength())
{ {
AssertOneEntry(); AssertOneEntry();
PositionHdl_Impl(*m_pPositionLB); PositionHdl_Impl(*m_xPositionLB);
AdjustHdl_Impl(*m_pAdjustLB); AdjustHdl_Impl(*m_xAdjustLB);
CharStyleHdl_Impl(*m_pCharStyleLB); CharStyleHdl_Impl(*m_xCharStyleLB);
} }
GetRubyText(); GetRubyText();
//reset all edit fields - SaveValue is called //reset all edit fields - SaveValue is called
ScrollHdl_Impl(m_pScrollSB); ScrollHdl_Impl(*m_xScrolledWindow);
Reference<XRubySelection> xSelection = m_pImpl->GetRubySelection(); Reference<XRubySelection> xSelection = m_pImpl->GetRubySelection();
if (IsModified() && xSelection.is()) if (IsModified() && xSelection.is())
@@ -573,12 +545,12 @@ IMPL_LINK_NOARG(SvxRubyDialog, ApplyHdl_Impl, Button*, void)
} }
} }
IMPL_LINK_NOARG(SvxRubyDialog, CloseHdl_Impl, Button*, void) IMPL_LINK_NOARG(SvxRubyDialog, CloseHdl_Impl, weld::Button&, void)
{ {
Close(); Close();
} }
IMPL_LINK_NOARG(SvxRubyDialog, StylistHdl_Impl, Button*, void) IMPL_LINK_NOARG(SvxRubyDialog, StylistHdl_Impl, weld::Button&, void)
{ {
std::unique_ptr<SfxPoolItem> pState; std::unique_ptr<SfxPoolItem> pState;
SfxItemState eState = pBindings->QueryState(SID_STYLE_DESIGNER, pState); SfxItemState eState = pBindings->QueryState(SID_STYLE_DESIGNER, pState);
@@ -589,10 +561,10 @@ IMPL_LINK_NOARG(SvxRubyDialog, StylistHdl_Impl, Button*, void)
} }
} }
IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, ListBox&, rBox, void) IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, weld::ComboBox&, rBox, void)
{ {
AssertOneEntry(); AssertOneEntry();
sal_Int16 nAdjust = rBox.GetSelectedEntryPos(); sal_Int16 nAdjust = rBox.get_active();
Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
for (PropertyValues & rProps : aRubyValues) for (PropertyValues & rProps : aRubyValues)
{ {
@@ -603,13 +575,13 @@ IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, ListBox&, rBox, void)
} }
SetModified(true); SetModified(true);
} }
m_pPreviewWin->Invalidate(); m_xPreviewWin->Invalidate();
} }
IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, ListBox&, rBox, void) IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, weld::ComboBox&, rBox, void)
{ {
AssertOneEntry(); AssertOneEntry();
sal_Int16 nPosition = rBox.GetSelectedEntryPos(); sal_Int16 nPosition = rBox.get_active();
Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
for (PropertyValues & rProps : aRubyValues) for (PropertyValues & rProps : aRubyValues)
{ {
@@ -620,15 +592,15 @@ IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, ListBox&, rBox, void)
} }
SetModified(true); SetModified(true);
} }
m_pPreviewWin->Invalidate(); m_xPreviewWin->Invalidate();
} }
IMPL_LINK_NOARG(SvxRubyDialog, CharStyleHdl_Impl, ListBox&, void) IMPL_LINK_NOARG(SvxRubyDialog, CharStyleHdl_Impl, weld::ComboBox&, void)
{ {
AssertOneEntry(); AssertOneEntry();
OUString sStyleName; OUString sStyleName;
if (LISTBOX_ENTRY_NOTFOUND != m_pCharStyleLB->GetSelectedEntryPos()) if (m_xCharStyleLB->get_active() != -1)
sStyleName = *static_cast<OUString*>(m_pCharStyleLB->GetSelectedEntryData()); sStyleName = m_xCharStyleLB->get_active_id();
Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues();
for (PropertyValues & rProps : aRubyValues) for (PropertyValues & rProps : aRubyValues)
{ {
@@ -643,7 +615,7 @@ IMPL_LINK_NOARG(SvxRubyDialog, CharStyleHdl_Impl, ListBox&, void)
} }
} }
IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit&, rEdit, void) IMPL_LINK(SvxRubyDialog, EditFocusHdl_Impl, weld::Widget&, rEdit, void)
{ {
for (sal_uInt16 i = 0; i < 8; i++) for (sal_uInt16 i = 0; i < 8; i++)
{ {
@@ -653,43 +625,47 @@ IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit&, rEdit, void)
break; break;
} }
} }
m_pPreviewWin->Invalidate(); m_xPreviewWin->Invalidate();
} }
IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32, nParam, bool) IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, weld::Entry&, rEdit, void)
{
EditFocusHdl_Impl(rEdit);
}
bool SvxRubyDialog::EditScrollHdl_Impl(sal_Int32 nParam)
{ {
bool bRet = false; bool bRet = false;
if (m_pScrollSB->IsEnabled()) //scroll forward
if (nParam > 0 && (aEditArr[7]->has_focus() || aEditArr[6]->has_focus() ))
{ {
//scroll forward if (m_xScrolledWindow->vadjustment_get_upper() >
if (nParam > 0 && (aEditArr[7]->HasFocus() || aEditArr[6]->HasFocus() )) m_xScrolledWindow->vadjustment_get_value() + m_xScrolledWindow->vadjustment_get_page_size())
{ {
if (m_pScrollSB->GetRangeMax() > m_pScrollSB->GetThumbPos()) m_xScrolledWindow->vadjustment_set_value(m_xScrolledWindow->vadjustment_get_value() + 1);
{ aEditArr[6]->grab_focus();
m_pScrollSB->SetThumbPos(m_pScrollSB->GetThumbPos() + 1);
aEditArr[6]->GrabFocus();
bRet = true;
}
}
//scroll backward
else if (m_pScrollSB->GetThumbPos() && (aEditArr[0]->HasFocus()||aEditArr[1]->HasFocus()) )
{
m_pScrollSB->SetThumbPos(m_pScrollSB->GetThumbPos() - 1);
aEditArr[1]->GrabFocus();
bRet = true; bRet = true;
} }
if (bRet)
ScrollHdl_Impl(m_pScrollSB);
} }
//scroll backward
else if (m_xScrolledWindow->vadjustment_get_value() && (aEditArr[0]->has_focus()||aEditArr[1]->has_focus()) )
{
m_xScrolledWindow->vadjustment_set_value(m_xScrolledWindow->vadjustment_get_value() - 1);
aEditArr[1]->grab_focus();
bRet = true;
}
if (bRet)
ScrollHdl_Impl(*m_xScrolledWindow);
return bRet; return bRet;
} }
IMPL_LINK(SvxRubyDialog, EditJumpHdl_Impl, sal_Int32, nParam, void) bool SvxRubyDialog::EditJumpHdl_Impl(sal_Int32 nParam)
{ {
bool bHandled = false;
sal_uInt16 nIndex = USHRT_MAX; sal_uInt16 nIndex = USHRT_MAX;
for (sal_uInt16 i = 0; i < 8; i++) for (sal_uInt16 i = 0; i < 8; i++)
{ {
if(aEditArr[i]->HasFocus()) if(aEditArr[i]->has_focus())
nIndex = i; nIndex = i;
} }
if (nIndex < 8) if (nIndex < 8)
@@ -697,94 +673,65 @@ IMPL_LINK(SvxRubyDialog, EditJumpHdl_Impl, sal_Int32, nParam, void)
if (nParam > 0) if (nParam > 0)
{ {
if (nIndex < 6) if (nIndex < 6)
aEditArr[nIndex + 2]->GrabFocus(); aEditArr[nIndex + 2]->grab_focus();
else if( EditScrollHdl_Impl(nParam)) else if( EditScrollHdl_Impl(nParam))
aEditArr[nIndex]->GrabFocus(); aEditArr[nIndex]->grab_focus();
} }
else else
{ {
if (nIndex > 1) if (nIndex > 1)
aEditArr[nIndex - 2]->GrabFocus(); aEditArr[nIndex - 2]->grab_focus();
else if( EditScrollHdl_Impl(nParam)) else if( EditScrollHdl_Impl(nParam))
aEditArr[nIndex]->GrabFocus(); aEditArr[nIndex]->grab_focus();
} }
bHandled = true;
} }
}; return bHandled;
}
void SvxRubyDialog::AssertOneEntry() void SvxRubyDialog::AssertOneEntry()
{ {
m_pImpl->AssertOneEntry(); m_pImpl->AssertOneEntry();
} }
void SvxRubyDialog::UpdateColors()
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
svtools::ColorConfig aColorConfig;
vcl::Font aFont(m_pPreviewWin->GetFont());
Color aNewTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
Color aNewFillColor(rStyleSettings.GetWindowColor());
if (aNewFillColor != aFont.GetFillColor() || aNewTextColor != aFont.GetColor())
{
aFont.SetFillColor(aNewFillColor);
aFont.SetColor(aNewTextColor);
m_pPreviewWin->SetFont(aFont);
}
}
void SvxRubyDialog::DataChanged( const DataChangedEvent& rDCEvt )
{
SfxModelessDialog::DataChanged( rDCEvt );
if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
{
UpdateColors();
}
}
void SvxRubyDialog::EnableControls(bool bEnable) void SvxRubyDialog::EnableControls(bool bEnable)
{ {
get_content_area()->Enable(bEnable); m_xContentArea->set_sensitive(bEnable);
m_pApplyPB->Enable(bEnable); m_xApplyPB->set_sensitive(bEnable);
} }
RubyPreview::RubyPreview(vcl::Window *pParent) RubyPreview::RubyPreview()
: Window(pParent, WB_BORDER) : m_pParentDlg(nullptr)
, m_pParentDlg(nullptr)
{ {
SetBorderStyle(WindowBorderStyle::MONO);
} }
RubyPreview::~RubyPreview() RubyPreview::~RubyPreview()
{ {
disposeOnce();
} }
void RubyPreview::dispose()
{
m_pParentDlg.clear();
vcl::Window::dispose();
}
VCL_BUILDER_FACTORY(RubyPreview)
void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
{ {
rRenderContext.Push(PushFlags::MAPMODE); rRenderContext.Push(PushFlags::ALL);
rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip));
Size aWinSize = rRenderContext.GetOutputSize(); Size aWinSize = rRenderContext.GetOutputSize();
vcl::Font aSaveFont = rRenderContext.GetFont(); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
aSaveFont.SetFontHeight(aWinSize.Height() / 4); svtools::ColorConfig aColorConfig;
rRenderContext.SetFont(aSaveFont);
Color aNewTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
Color aNewFillColor(rStyleSettings.GetWindowColor());
vcl::Font aFont = rRenderContext.GetFont();
aFont.SetFontHeight(aWinSize.Height() / 4);
aFont.SetFillColor(aNewFillColor);
aFont.SetColor(aNewTextColor);
rRenderContext.SetFont(aFont);
tools::Rectangle aRect(Point(0, 0), aWinSize); tools::Rectangle aRect(Point(0, 0), aWinSize);
rRenderContext.SetLineColor(); rRenderContext.SetLineColor();
rRenderContext.SetFillColor(aSaveFont.GetFillColor()); rRenderContext.SetFillColor(aFont.GetFillColor());
rRenderContext.DrawRect(aRect); rRenderContext.DrawRect(aRect);
OUString sBaseText, sRubyText; OUString sBaseText, sRubyText;
@@ -793,13 +740,13 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
long nTextHeight = rRenderContext.GetTextHeight(); long nTextHeight = rRenderContext.GetTextHeight();
long nBaseWidth = rRenderContext.GetTextWidth(sBaseText); long nBaseWidth = rRenderContext.GetTextWidth(sBaseText);
vcl::Font aRubyFont(aSaveFont); vcl::Font aRubyFont(aFont);
aRubyFont.SetFontHeight(aRubyFont.GetFontHeight() * 70 / 100); aRubyFont.SetFontHeight(aRubyFont.GetFontHeight() * 70 / 100);
rRenderContext.SetFont(aRubyFont); rRenderContext.SetFont(aRubyFont);
long nRubyWidth = rRenderContext.GetTextWidth(sRubyText); long nRubyWidth = rRenderContext.GetTextWidth(sRubyText);
rRenderContext.SetFont(aSaveFont); rRenderContext.SetFont(aFont);
RubyAdjust nAdjust = static_cast<RubyAdjust>(m_pParentDlg->m_pAdjustLB->GetSelectedEntryPos()); RubyAdjust nAdjust = static_cast<RubyAdjust>(m_pParentDlg->m_xAdjustLB->get_active());
//use center if no adjustment is available //use center if no adjustment is available
if (nAdjust > RubyAdjust_INDENT_BLOCK) if (nAdjust > RubyAdjust_INDENT_BLOCK)
nAdjust = RubyAdjust_CENTER; nAdjust = RubyAdjust_CENTER;
@@ -816,7 +763,7 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
long nYRuby = aWinSize.Height() / 4 - nTextHeight / 2; long nYRuby = aWinSize.Height() / 4 - nTextHeight / 2;
long nYBase = aWinSize.Height() * 3 / 4 - nTextHeight / 2; long nYBase = aWinSize.Height() * 3 / 4 - nTextHeight / 2;
sal_Int16 nRubyPos = m_pParentDlg->m_pPositionLB->GetSelectedEntryPos(); sal_Int16 nRubyPos = m_pParentDlg->m_xPositionLB->get_active();
if ( nRubyPos == 1 ) // BOTTOM if ( nRubyPos == 1 ) // BOTTOM
{ {
long nTmp = nYRuby; long nTmp = nYRuby;
@@ -860,7 +807,7 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
nYOutput = nYBase; nYOutput = nYBase;
sOutputText = sBaseText; sOutputText = sBaseText;
nOutTextWidth = nBaseWidth; nOutTextWidth = nBaseWidth;
rRenderContext.SetFont(aSaveFont); rRenderContext.SetFont(aFont);
} }
switch (nAdjust) switch (nAdjust)
@@ -873,7 +820,7 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
break; break;
case RubyAdjust_INDENT_BLOCK: case RubyAdjust_INDENT_BLOCK:
{ {
long nCharWidth = GetTextWidth("X"); long nCharWidth = rRenderContext.GetTextWidth("X");
if (nOutTextWidth < (nRightEnd - nLeftStart - nCharWidth)) if (nOutTextWidth < (nRightEnd - nLeftStart - nCharWidth))
{ {
nCharWidth /= 2; nCharWidth /= 2;
@@ -887,12 +834,12 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
if (sOutputText.getLength() > 1) if (sOutputText.getLength() > 1)
{ {
sal_Int32 nCount = sOutputText.getLength(); sal_Int32 nCount = sOutputText.getLength();
long nSpace = ((nRightEnd - nLeftStart) - GetTextWidth(sOutputText)) / (nCount - 1); long nSpace = ((nRightEnd - nLeftStart) - rRenderContext.GetTextWidth(sOutputText)) / (nCount - 1);
for (sal_Int32 i = 0; i < nCount; i++) for (sal_Int32 i = 0; i < nCount; i++)
{ {
OUString sChar(sOutputText[i]); OUString sChar(sOutputText[i]);
rRenderContext.DrawText(Point(nLeftStart , nYOutput), sChar); rRenderContext.DrawText(Point(nLeftStart , nYOutput), sChar);
long nCharWidth = GetTextWidth(sChar); long nCharWidth = rRenderContext.GetTextWidth(sChar);
nLeftStart += nCharWidth + nSpace; nLeftStart += nCharWidth + nSpace;
} }
break; break;
@@ -904,47 +851,44 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
break; break;
default: break; default: break;
} }
rRenderContext.SetFont(aSaveFont);
rRenderContext.Pop(); rRenderContext.Pop();
} }
Size RubyPreview::GetOptimalSize() const void RubyPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{ {
return LogicToPixel(Size(215, 50), MapMode(MapUnit::MapAppFont)); pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 40,
pDrawingArea->get_text_height() * 7);
CustomWidgetController::SetDrawingArea(pDrawingArea);
} }
void RubyEdit::GetFocus() IMPL_LINK(SvxRubyDialog, KeyUpDownHdl_Impl, const KeyEvent&, rKEvt, bool)
{
GetModifyHdl().Call(*this);
Edit::GetFocus();
}
bool RubyEdit::PreNotify(NotifyEvent& rNEvt)
{ {
bool bHandled = false; bool bHandled = false;
if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
sal_uInt16 nCode = rKeyCode.GetCode();
if (KEY_UP == nCode || KEY_DOWN == nCode)
{ {
const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); sal_Int32 nParam = KEY_UP == nCode ? -1 : 1;
const vcl::KeyCode& rKeyCode = pKEvt->GetKeyCode(); bHandled = EditJumpHdl_Impl(nParam);
sal_uInt16 nMod = rKeyCode.GetModifier();
sal_uInt16 nCode = rKeyCode.GetCode();
if (nCode == KEY_TAB && (!nMod || KEY_SHIFT == nMod))
{
sal_Int32 nParam = KEY_SHIFT == nMod ? -1 : 1;
if(aScrollHdl.IsSet() && aScrollHdl.Call(nParam))
bHandled = true;
}
else if (KEY_UP == nCode || KEY_DOWN == nCode)
{
sal_Int32 nParam = KEY_UP == nCode ? -1 : 1;
aJumpHdl.Call(nParam);
}
} }
if (!bHandled)
bHandled = Edit::PreNotify(rNEvt);
return bHandled; return bHandled;
} }
VCL_BUILDER_FACTORY(RubyEdit) IMPL_LINK(SvxRubyDialog, KeyUpDownTabHdl_Impl, const KeyEvent&, rKEvt, bool)
{
bool bHandled = false;
const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
sal_uInt16 nMod = rKeyCode.GetModifier();
sal_uInt16 nCode = rKeyCode.GetCode();
if (nCode == KEY_TAB && (!nMod || KEY_SHIFT == nMod))
{
sal_Int32 nParam = KEY_SHIFT == nMod ? -1 : 1;
if (EditScrollHdl_Impl(nParam))
bHandled = true;
}
if (!bHandled)
bHandled = KeyUpDownHdl_Impl(rKEvt);
return bHandled;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -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()
} }
} }
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()
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 };

View File

@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.22.1 -->
<interface domain="svx"> <interface domain="svx">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="AsianPhoneticGuideDialog"> <object class="GtkDialog" id="AsianPhoneticGuideDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="asianphoneticguidedialog|AsianPhoneticGuideDialog">Asian Phonetic Guide</property> <property name="title" translatable="yes" context="asianphoneticguidedialog|AsianPhoneticGuideDialog">Asian Phonetic Guide</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
@@ -18,7 +22,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>
<object class="GtkButton" id="apply"> <object class="GtkButton" id="ok">
<property name="label">gtk-apply</property> <property name="label">gtk-apply</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@@ -34,7 +38,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="close"> <object class="GtkButton" id="cancel">
<property name="label">gtk-close</property> <property name="label">gtk-close</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@@ -117,132 +121,144 @@
<object class="GtkScrolledWindow" id="scrolledwindow"> <object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="hscrollbar_policy">never</property> <property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>
<child> <child>
<object class="GtkViewport" id="viewport1"> <object class="GtkViewport" id="viewport1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child> <child>
<object class="GtkGrid" id="grid1"> <object class="GtkGrid" id="grid">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_right">3</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="column_spacing">3</property>
<child> <child>
<object class="svxlo-RubyEdit" id="Left2ED"> <object class="GtkGrid" id="grid1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<child internal-child="accessible"> <property name="row_spacing">6</property>
<object class="AtkObject" id="Left2ED-atkobject"> <property name="column_spacing">12</property>
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Left2ED-atkobject">Base text</property> <property name="border_width">6</property>
<child>
<object class="GtkEntry" id="Left2ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="Left2ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Left2ED-atkobject">Base text</property>
</object>
</child>
</object> </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Left1ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Right1ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Right2ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="Right2ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Right2ED-atkobject">Ruby text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Left3ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="Left3ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Left3ED-atkobject">Base text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Right3ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="Right3ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Right3ED-atkobject">Ruby text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Right4ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="Right4ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Right4ED-atkobject">Ruby text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="Left4ED">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="Left4ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Left4ED-atkobject">Base text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child> </child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="svxlo-RubyEdit" id="Left1ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="svxlo-RubyEdit" id="Right1ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="svxlo-RubyEdit" id="Right2ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="Right2ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Right2ED-atkobject">Ruby text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="svxlo-RubyEdit" id="Left3ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="Left3ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Left3ED-atkobject">Base text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="svxlo-RubyEdit" id="Right3ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="Right3ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Right3ED-atkobject">Ruby text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="svxlo-RubyEdit" id="Right4ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="Right4ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Right4ED-atkobject">Ruby text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="svxlo-RubyEdit" id="Left4ED">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="Left4ED-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="asianphoneticguidedialog|Left4ED-atkobject">Base text</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
</object> </object>
</child> </child>
</object> </object>
@@ -304,7 +320,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="stylelb"> <object class="GtkComboBoxText" id="stylelb">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
@@ -386,9 +402,28 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="svxlo-RubyPreview" id="preview"> <object class="GtkScrolledWindow" id="ctlFavoriteswin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</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>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@@ -406,8 +441,8 @@
</object> </object>
</child> </child>
<action-widgets> <action-widgets>
<action-widget response="0">apply</action-widget> <action-widget response="-5">ok</action-widget>
<action-widget response="-7">close</action-widget> <action-widget response="-7">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
</object> </object>

View File

@@ -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 @@
<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>

View File

@@ -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")