diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-07-08 16:13:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-07-08 16:14:46 +0100 |
commit | 65f12c0e16638d3285539d9901e7300f3d12c615 (patch) | |
tree | 9a2bbe86ee737869086b00c71a3accbdcbc587a5 | |
parent | Convert RID_CONDFORMAT to .ui (diff) | |
download | core-65f12c0e16638d3285539d9901e7300f3d12c615.tar.gz core-65f12c0e16638d3285539d9901e7300f3d12c615.zip |
hook up scrolling
Change-Id: Iaf30a41dcc74e4542d3df60ca26354876badc81f
-rw-r--r-- | reportdesign/source/ui/dlg/CondFormat.cxx | 35 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Condition.cxx | 3 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/CondFormat.hxx | 2 | ||||
-rw-r--r-- | reportdesign/uiconfig/dbreport/ui/condformatdialog.ui | 31 |
4 files changed, 28 insertions, 43 deletions
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index a687b142ab09..82fb0fdf225d 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -92,9 +92,9 @@ namespace rptui long nHeight = m_aConditions[0]->get_preferred_size().Height(); size_t nVisibleConditions = ::std::min(nCount, MAX_CONDITIONS); nHeight *= nVisibleConditions; - if (nHeight != m_pConditionPlayground->get_height_request()) + if (nHeight != m_pScrollWindow->get_height_request()) { - m_pConditionPlayground->set_height_request(nHeight); + m_pScrollWindow->set_height_request(nHeight); if (!isCalculatingInitialLayoutSize() && !bFirst) setOptimalLayoutSize(); } @@ -111,7 +111,9 @@ namespace rptui ,m_bConstructed( false ) { get(m_pConditionPlayground, "condPlaygroundDrawingarea"); - get(m_pCondScroll, "condScrollbar"); + get(m_pScrollWindow, "scrolledwindow"); + m_pScrollWindow->setUserManagedScrolling(true); + m_pCondScroll = &(m_pScrollWindow->getVertScrollBar()); OSL_ENSURE( m_xFormatConditions.is(), "ConditionalFormattingDialog::ConditionalFormattingDialog: ReportControlModel is NULL -> Prepare for GPF!" ); @@ -183,6 +185,7 @@ namespace rptui ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) ); pCon->setCondition( xCond ); + pCon->reorderWithinParent(_nNewCondIndex); m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon ); } catch( const Exception& ) @@ -314,26 +317,11 @@ namespace rptui void ConditionalFormattingDialog::impl_layoutConditions() { -#if 0 - // position the condition's playground - long nConditionWidth = impl_getConditionWidth(); - long nConditionHeight = LogicToPixel( Size( 0, CONDITION_HEIGHT ), MAP_APPFONT ).Height(); - size_t nVisibleConditions = ::std::min( impl_getConditionCount(), MAX_CONDITIONS ); - Size aPlaygroundSize( nConditionWidth, nVisibleConditions * nConditionHeight ); - m_pConditionPlayground->SetSizePixel( aPlaygroundSize ); - _out_rBelowLastVisible = Point( 0, aPlaygroundSize.Height() ); - - // position the single conditions - Point aConditionPos( 0, -1 * nConditionHeight * impl_getFirstVisibleConditionIndex() ); - for ( Conditions::const_iterator cond = m_aConditions.begin(); - cond != m_aConditions.end(); - ++cond - ) - { - (*cond)->setPosSizePixel( aConditionPos.X(), aConditionPos.Y(), nConditionWidth, nConditionHeight ); - aConditionPos.Move( 0, nConditionHeight ); - } -#endif + if (m_aConditions.empty()) + return; + long nConditionHeight = m_aConditions[0]->get_preferred_size().Height(); + Point aConditionPos(0, -1 * nConditionHeight * impl_getFirstVisibleConditionIndex()); + m_pScrollWindow->get_child()->SetPosPixel(aConditionPos); } void ConditionalFormattingDialog::impl_layoutAll() @@ -356,6 +344,7 @@ namespace rptui { ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) ); Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY ); + pCon->reorderWithinParent(i); pCon->setCondition( xCond ); pCon->updateToolbar( xCond.get() ); m_aConditions.push_back( pCon ); diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index b14867af2591..12e675b4246d 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -62,7 +62,6 @@ ConditionField::ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *p , m_pFormula(pFormula) { m_pSubEdit->EnableRTL( false ); - m_pSubEdit->SetPosPixel( Point() ); m_pFormula->SetText(OUString("...")); m_pFormula->SetClickHdl( LINK( this, ConditionField, OnFormula ) ); @@ -159,7 +158,6 @@ void OColorPopup::KeyInput( const KeyEvent& rKEvt ) m_aColorSet.KeyInput(rKEvt); } - void OColorPopup::Resize() { Size aSize = GetOutputSizePixel(); @@ -168,7 +166,6 @@ void OColorPopup::Resize() m_aColorSet.SetPosSizePixel( Point(2,2), aSize ); } - void OColorPopup::StartSelection() { m_aColorSet.StartSelection(); diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx index 6edee15d1b55..130caa73367c 100644 --- a/reportdesign/source/ui/inc/CondFormat.hxx +++ b/reportdesign/source/ui/inc/CondFormat.hxx @@ -27,6 +27,7 @@ #include <vcl/dialog.hxx> #include <vcl/button.hxx> #include <vcl/fixed.hxx> +#include <vcl/layout.hxx> #include <vcl/scrbar.hxx> #include <boost/shared_ptr.hpp> @@ -75,6 +76,7 @@ namespace rptui OModuleClient m_aModuleClient; Window* m_pConditionPlayground; Conditions m_aConditions; + VclScrolledWindow* m_pScrollWindow; ScrollBar* m_pCondScroll; ::rptui::OReportController& m_rController; diff --git a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui index b6b57f4de2f9..741ce749bdc0 100644 --- a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui +++ b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui @@ -84,14 +84,24 @@ <property name="hexpand">True</property> <property name="vexpand">True</property> <child> - <object class="GtkBox" id="condPlaygroundDrawingarea"> + <object class="GtkScrolledWindow" id="scrolledwindow"> <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="orientation">vertical</property> + <property name="vscrollbar_policy">always</property> + <property name="shadow_type">in</property> <child> - <placeholder/> + <object class="GtkBox" id="condPlaygroundDrawingarea"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> </child> </object> <packing> @@ -100,19 +110,6 @@ <property name="position">0</property> </packing> </child> - <child> - <object class="GtkScrollbar" id="condScrollbar"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> |