summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-13 17:49:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-13 22:42:27 +0200
commit9886625d02fee7692ff94e7c5b63dc2f51e31fa1 (patch)
tree549d4b411a8eb40aaeda6a8507d05f477ed451d2
parentad6bf7e72325b7baf36d46512993fbd3cc9b4746 (diff)
weld SchAlignmentTabPage
Change-Id: I9b67720b087d2d89dd1a64933b0e073132e601b7 Reviewed-on: https://gerrit.libreoffice.org/61745 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx75
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx23
-rw-r--r--chart2/uiconfig/ui/titlerotationtabpage.ui21
3 files changed, 72 insertions, 47 deletions
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index f2d60eac5f60..79c696968322 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -29,30 +29,44 @@
namespace chart
{
-SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window* pWindow,
- const SfxItemSet& rInAttrs, bool bWithRotation) :
- SfxTabPage(pWindow, "TitleRotationTabPage","modules/schart/ui/titlerotationtabpage.ui", &rInAttrs)
+SchAlignmentTabPage::SchAlignmentTabPage(TabPageParent pParent,
+ const SfxItemSet& rInAttrs, bool bWithRotation)
+ : SfxTabPage(pParent, "modules/schart/ui/titlerotationtabpage.ui", "TitleRotationTabPage", &rInAttrs)
+ , m_xFtRotate(m_xBuilder->weld_label("degreeL"))
+ , m_xNfRotate(m_xBuilder->weld_spin_button("OrientDegree"))
+ , m_xCbStacked(m_xBuilder->weld_check_button("stackedCB"))
+ , m_xFtTextDirection(m_xBuilder->weld_label("textdirL"))
+ , m_xFtABCD(m_xBuilder->weld_label("labelABCD"))
+ , m_xLbTextDirection(new SchTextDirectionListBox(m_xBuilder->weld_combo_box("textdirLB")))
+ , m_xCtrlDial(new weld::CustomWeld(*m_xBuilder, "dialCtrl", m_aCtrlDial))
{
- get(m_pCtrlDial,"dialCtrl");
- get(m_pFtRotate,"degreeL");
- get(m_pNfRotate,"OrientDegree");
- get(m_pCbStacked,"stackedCB");
- get(m_pFtTextDirection,"textdirL");
- get(m_pLbTextDirection,"textdirLB");
- get(m_pFtABCD,"labelABCD");
- m_pCtrlDial->SetText(m_pFtABCD->GetText());
- m_pOrientHlp.reset( new svx::OrientationHelper(*m_pCtrlDial, *m_pNfRotate, *m_pCbStacked) );
-
- m_pCbStacked->EnableTriState( false );
- m_pOrientHlp->Enable();
- m_pOrientHlp->AddDependentWindow( *m_pFtRotate, TRISTATE_TRUE );
+ m_aCtrlDial.SetLinkedField(m_xNfRotate.get());
+ m_aCtrlDial.SetText(m_xFtABCD->get_label());
+ m_xCbStacked->connect_toggled(LINK(this, SchAlignmentTabPage, StackedToggleHdl));
+
+ m_xCtrlDial->set_sensitive(true);
+ m_xNfRotate->set_sensitive(true);
+ m_xCbStacked->set_sensitive(true);
+ m_xFtRotate->set_sensitive(true);
if( !bWithRotation )
{
- m_pOrientHlp->Hide();
+ m_xCtrlDial->hide();
+ m_xNfRotate->hide();
+ m_xCbStacked->hide();
+ m_xFtRotate->hide();
}
}
+IMPL_LINK_NOARG(SchAlignmentTabPage, StackedToggleHdl, weld::ToggleButton&, void)
+{
+ bool bActive = m_xCbStacked->get_active();
+ m_xNfRotate->set_sensitive(bActive);
+ m_xCtrlDial->set_sensitive(bActive);
+ m_aCtrlDial.StyleUpdated();
+ m_xFtRotate->set_sensitive(bActive);
+}
+
SchAlignmentTabPage::~SchAlignmentTabPage()
{
disposeOnce();
@@ -60,39 +74,33 @@ SchAlignmentTabPage::~SchAlignmentTabPage()
void SchAlignmentTabPage::dispose()
{
- m_pOrientHlp.reset();
- m_pCtrlDial.clear();
- m_pFtRotate.clear();
- m_pNfRotate.clear();
- m_pCbStacked.clear();
- m_pFtTextDirection.clear();
- m_pLbTextDirection.clear();
- m_pFtABCD.clear();
+ m_xCtrlDial.reset();
+ m_xLbTextDirection.reset();
SfxTabPage::dispose();
}
VclPtr<SfxTabPage> SchAlignmentTabPage::Create(TabPageParent pParent,
const SfxItemSet* rInAttrs)
{
- return VclPtr<SchAlignmentTabPage>::Create(pParent.pParent, *rInAttrs);
+ return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs);
}
VclPtr<SfxTabPage> SchAlignmentTabPage::CreateWithoutRotation(TabPageParent pParent,
const SfxItemSet* rInAttrs)
{
- return VclPtr<SchAlignmentTabPage>::Create(pParent.pParent, *rInAttrs, false);
+ return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs, false);
}
bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
{
//Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES
- bool bStacked = m_pOrientHlp->GetStackedState() == TRISTATE_TRUE;
+ bool bStacked = m_xCbStacked->get_active();
rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
- sal_Int32 nDegrees = bStacked ? 0 : m_pCtrlDial->GetRotation();
+ sal_Int32 nDegrees = bStacked ? 0 : m_aCtrlDial.GetRotation();
rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
- SvxFrameDirection aDirection( m_pLbTextDirection->GetSelectEntryValue() );
+ SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() );
rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) );
return true;
@@ -103,14 +111,15 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs)
const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES );
sal_Int32 nDegrees = pItem ? static_cast<const SfxInt32Item*>(pItem)->GetValue() : 0;
- m_pCtrlDial->SetRotation( nDegrees );
+ m_aCtrlDial.SetRotation( nDegrees );
pItem = GetItem( *rInAttrs, SCHATTR_TEXT_STACKED );
bool bStacked = pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue();
- m_pOrientHlp->SetStackedState( bStacked ? TRISTATE_TRUE : TRISTATE_FALSE );
+ m_xCbStacked->set_active(bStacked);
+ StackedToggleHdl(*m_xCbStacked);
if( rInAttrs->GetItemState(EE_PARA_WRITINGDIR, true, &pItem) == SfxItemState::SET)
- m_pLbTextDirection->SelectEntryValue( static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue() );
+ m_xLbTextDirection->set_active_id(static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue());
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index 8af1a4f67b9a..217f2e73a543 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -22,7 +22,8 @@
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
#include <svx/orienthelper.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
#include <TextDirectionListBox.hxx>
namespace chart
@@ -31,17 +32,19 @@ namespace chart
class SchAlignmentTabPage : public SfxTabPage
{
private:
- VclPtr<svx::DialControl> m_pCtrlDial;
- VclPtr<FixedText> m_pFtRotate;
- VclPtr<NumericField> m_pNfRotate;
- VclPtr<TriStateBox> m_pCbStacked;
- std::unique_ptr<svx::OrientationHelper> m_pOrientHlp;
- VclPtr<FixedText> m_pFtTextDirection;
- VclPtr<TextDirectionListBox> m_pLbTextDirection;
- VclPtr<FixedText> m_pFtABCD;
+ svx::SvxDialControl m_aCtrlDial;
+ std::unique_ptr<weld::Label> m_xFtRotate;
+ std::unique_ptr<weld::SpinButton> m_xNfRotate;
+ std::unique_ptr<weld::CheckButton> m_xCbStacked;
+ std::unique_ptr<weld::Label> m_xFtTextDirection;
+ std::unique_ptr<weld::Label> m_xFtABCD;
+ std::unique_ptr<SchTextDirectionListBox> m_xLbTextDirection;
+ std::unique_ptr<weld::CustomWeld> m_xCtrlDial;
+
+ DECL_LINK(StackedToggleHdl, weld::ToggleButton&, void);
public:
- SchAlignmentTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true);
+ SchAlignmentTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true);
virtual ~SchAlignmentTabPage() override;
virtual void dispose() override;
diff --git a/chart2/uiconfig/ui/titlerotationtabpage.ui b/chart2/uiconfig/ui/titlerotationtabpage.ui
index 9cb45970645e..a5fcda448942 100644
--- a/chart2/uiconfig/ui/titlerotationtabpage.ui
+++ b/chart2/uiconfig/ui/titlerotationtabpage.ui
@@ -84,12 +84,25 @@
</packing>
</child>
<child>
- <object class="svxlo-DialControl" id="dialCtrl">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
- <property name="active">True</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="dialCtrl">
+ <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>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -157,7 +170,7 @@
</packing>
</child>
<child>
- <object class="chartcontrollerlo-TextDirectionListBox" id="textdirLB">
+ <object class="GtkComboBoxText" id="textdirLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>