summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-11 13:02:57 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-13 16:16:24 +0200
commit226fcda0a888c4959b1f895de31856f1624f04ee (patch)
tree6c13e9ff0231f9f3fc744884937e3849b641773e /reportdesign
parentb2e5f9ead2bb7f2979afe4ba13e3950e8a3cc278 (diff)
weld ConditionalFormattingDialog
Change-Id: I87c03555c5555b12a1be997e368a96d9b07d2b63 Reviewed-on: https://gerrit.libreoffice.org/80689 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx10
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.cxx228
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx295
-rw-r--r--reportdesign/source/ui/dlg/Condition.hxx116
-rw-r--r--reportdesign/source/ui/inc/AddField.hxx6
-rw-r--r--reportdesign/source/ui/inc/CondFormat.hxx40
-rw-r--r--reportdesign/source/ui/inc/GroupsSorting.hxx2
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx3
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx4
-rw-r--r--reportdesign/uiconfig/dbreport/ui/condformatdialog.ui10
-rw-r--r--reportdesign/uiconfig/dbreport/ui/conditionwin.ui82
11 files changed, 279 insertions, 517 deletions
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 5a56839f1ef9..6c7728ebc54d 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -172,7 +172,6 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent ,const uno::Reference< bea
m_aActions->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
m_aActions->SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
- setToolBox(m_aActions.get());
m_aActions->CheckItem(m_nSortUpId);
m_aActions->EnableItem(m_nInsertId, false);
@@ -450,15 +449,6 @@ IMPL_LINK_NOARG( OAddFieldWindow, OnDoubleClickHdl, SvTreeListBox*, bool )
return false;
}
-void OAddFieldWindow::resizeControls(const Size& _rDiff)
-{
- // we use large images so we must change them
- if ( _rDiff.Width() || _rDiff.Height() )
- {
- Invalidate();
- }
-}
-
IMPL_LINK_NOARG( OAddFieldWindow, OnSortAction, ToolBox*, void )
{
const sal_uInt16 nCurItem = m_aActions->GetCurItemId();
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
index 0fa1180884ba..bb5df9b50c73 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -58,25 +58,6 @@ namespace rptui
using namespace ::com::sun::star::report;
-
- // UpdateLocker
-
- class UpdateLocker
- {
- vcl::Window& m_rWindow;
-
- public:
- explicit UpdateLocker( vcl::Window& _rWindow )
- :m_rWindow( _rWindow )
- {
- _rWindow.SetUpdateMode( false );
- }
- ~UpdateLocker()
- {
- m_rWindow.SetUpdateMode( true );
- }
- };
-
void ConditionalFormattingDialog::impl_setPrefHeight(bool bFirst)
{
if (!m_bConstructed && !bFirst)
@@ -86,37 +67,35 @@ namespace rptui
size_t nCount = impl_getConditionCount();
if (nCount)
{
- long nHeight = m_aConditions[0]->get_preferred_size().Height();
+ auto nHeight = m_aConditions[0]->get_preferred_size().Height();
size_t nVisibleConditions = ::std::min(nCount, MAX_CONDITIONS);
nHeight *= nVisibleConditions;
- if (nHeight != m_pScrollWindow->get_height_request())
+ nHeight += 2;
+ if (nHeight != m_xScrollWindow->get_size_request().Height())
{
- m_pScrollWindow->set_height_request(nHeight);
- if (!isCalculatingInitialLayoutSize() && !bFirst)
- setOptimalLayoutSize();
+ m_xScrollWindow->set_size_request(-1, nHeight);
+ if (!bFirst)
+ m_xDialog->resize_to_request();
}
}
}
// class ConditionalFormattingDialog
ConditionalFormattingDialog::ConditionalFormattingDialog(
- vcl::Window* _pParent, const Reference< XReportControlModel >& _rxFormatConditions, ::rptui::OReportController& _rController )
- :ModalDialog( _pParent, "CondFormat", "modules/dbreport/ui/condformatdialog.ui" )
- ,m_rController( _rController )
- ,m_xFormatConditions( _rxFormatConditions )
- ,m_bDeletingCondition( false )
- ,m_bConstructed( false )
+ weld::Window* _pParent, const Reference< XReportControlModel >& _rxFormatConditions, ::rptui::OReportController& _rController)
+ : GenericDialogController(_pParent, "modules/dbreport/ui/condformatdialog.ui", "CondFormat")
+ , m_rController(_rController)
+ , m_xFormatConditions(_rxFormatConditions)
+ , m_bDeletingCondition(false)
+ , m_bConstructed(false)
+ , m_xScrollWindow(m_xBuilder->weld_scrolled_window("scrolledwindow"))
+ , m_xConditionPlayground(m_xBuilder->weld_box("condPlaygroundDrawingarea"))
{
- get(m_pConditionPlayground, "condPlaygroundDrawingarea");
- 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!" );
m_xCopy.set( m_xFormatConditions->createClone(), UNO_QUERY_THROW );
- m_pCondScroll->SetScrollHdl( LINK( this, ConditionalFormattingDialog, OnScroll ) );
+ m_xScrollWindow->connect_vadjustment_changed(LINK(this, ConditionalFormattingDialog, OnScroll));
impl_initializeConditions();
@@ -127,22 +106,6 @@ namespace rptui
ConditionalFormattingDialog::~ConditionalFormattingDialog()
{
- disposeOnce();
- }
-
- void ConditionalFormattingDialog::dispose()
- {
-
- for (auto& rxCondition : m_aConditions)
- {
- rxCondition.disposeAndClear();
- }
-
- m_aConditions.clear();
- m_pConditionPlayground.clear();
- m_pScrollWindow.clear();
- m_pCondScroll.clear();
- ModalDialog::dispose();
}
void ConditionalFormattingDialog::impl_updateConditionIndicies()
@@ -151,6 +114,7 @@ namespace rptui
for (const auto& rxCondition : m_aConditions)
{
rxCondition->setConditionIndex( nIndex, impl_getConditionCount() );
+ m_xConditionPlayground->reorder_child(rxCondition->get_widget(), nIndex);
++nIndex;
}
}
@@ -162,7 +126,6 @@ namespace rptui
impl_setPrefHeight(false);
- impl_updateScrollBarRange();
impl_updateConditionIndicies();
impl_layoutAll();
}
@@ -182,8 +145,6 @@ namespace rptui
void ConditionalFormattingDialog::impl_addCondition_nothrow( size_t _nNewCondIndex )
{
- UpdateLocker aLockUpdates( *this );
-
try
{
if ( _nNewCondIndex > static_cast<size_t>(m_xCopy->getCount()) )
@@ -192,10 +153,10 @@ namespace rptui
Reference< XFormatCondition > xCond = m_xCopy->createFormatCondition();
::comphelper::copyProperties(m_xCopy.get(),xCond.get());
m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) );
- VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController );
- pCon->setCondition( xCond );
- pCon->reorderWithinParent(_nNewCondIndex);
- m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon );
+ auto xCon = std::make_unique<Condition>(m_xConditionPlayground.get(), m_xDialog.get(), *this, m_rController);
+ xCon->setCondition(xCond);
+ m_xConditionPlayground->reorder_child(xCon->get_widget(), _nNewCondIndex);
+ m_aConditions.insert(m_aConditions.begin() + _nNewCondIndex, std::move(xCon));
}
catch( const Exception& )
{
@@ -207,21 +168,17 @@ namespace rptui
impl_ensureConditionVisible( _nNewCondIndex );
}
-
void ConditionalFormattingDialog::impl_focusCondition( size_t _nCondIndex )
{
OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
"ConditionalFormattingDialog::impl_focusCondition: illegal index!" );
impl_ensureConditionVisible( _nCondIndex );
- m_aConditions[ _nCondIndex ]->GrabFocus();
+ m_aConditions[ _nCondIndex ]->grab_focus();
}
-
void ConditionalFormattingDialog::impl_deleteCondition_nothrow( size_t _nCondIndex )
{
- UpdateLocker aLockUpdates( *this );
-
OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
"ConditionalFormattingDialog::impl_deleteCondition_nothrow: illegal index!" );
@@ -243,9 +200,13 @@ namespace rptui
}
else
{
- bSetNewFocus = (*pos)->HasChildPathFocus();
+ bSetNewFocus = (*pos)->has_focus();
m_bDeletingCondition = true;
- m_aConditions.erase( pos );
+
+ auto xMovedCondition = std::move(*pos);
+ m_aConditions.erase(pos);
+ m_xConditionPlayground->move(xMovedCondition->get_widget(), nullptr);
+
m_bDeletingCondition = false;
}
@@ -273,14 +234,14 @@ namespace rptui
// do this in two steps, so we don't become inconsistent if any of the UNO actions fails
Any aMovedCondition;
- Condition *pMovedCondition;
+ std::unique_ptr<Condition> xMovedCondition;
try
{
aMovedCondition = m_xCopy->getByIndex( static_cast<sal_Int32>(nOldConditionIndex) );
m_xCopy->removeByIndex( static_cast<sal_Int32>(nOldConditionIndex) );
Conditions::iterator aRemovePos( m_aConditions.begin() + nOldConditionIndex );
- pMovedCondition = aRemovePos->get();
+ xMovedCondition = std::move(*aRemovePos);
m_aConditions.erase( aRemovePos );
}
catch( const Exception& )
@@ -292,7 +253,7 @@ namespace rptui
try
{
m_xCopy->insertByIndex( static_cast<sal_Int32>(nNewConditionIndex), aMovedCondition );
- m_aConditions.insert( m_aConditions.begin() + nNewConditionIndex, pMovedCondition );
+ m_aConditions.insert(m_aConditions.begin() + nNewConditionIndex, std::move(xMovedCondition));
}
catch( const Exception& )
{
@@ -302,44 +263,27 @@ namespace rptui
// at least the two swapped conditions need to know their new index
impl_updateConditionIndicies();
- // re-layout all conditions
- impl_layoutConditions();
-
// ensure the moved condition is visible
impl_ensureConditionVisible( nNewConditionIndex );
}
- IMPL_LINK( ConditionalFormattingDialog, OnScroll, ScrollBar*, /*_pNotInterestedIn*/, void )
+ IMPL_LINK_NOARG(ConditionalFormattingDialog, OnScroll, weld::ScrolledWindow&, void)
{
size_t nFirstCondIndex( impl_getFirstVisibleConditionIndex() );
size_t nFocusCondIndex = impl_getFocusedConditionIndex( nFirstCondIndex );
- impl_layoutConditions();
-
if ( nFocusCondIndex < nFirstCondIndex )
impl_focusCondition( nFirstCondIndex );
else if ( nFocusCondIndex >= nFirstCondIndex + MAX_CONDITIONS )
impl_focusCondition( nFirstCondIndex + MAX_CONDITIONS - 1 );
}
- void ConditionalFormattingDialog::impl_layoutConditions()
- {
- if (m_aConditions.empty())
- return;
- long nConditionHeight = m_aConditions[0]->get_preferred_size().Height();
- Point aConditionPos(0, -1 * nConditionHeight * impl_getFirstVisibleConditionIndex());
- m_pConditionPlayground->SetPosPixel(aConditionPos);
- }
-
void ConditionalFormattingDialog::impl_layoutAll()
{
- // condition's positions
- impl_layoutConditions();
-
// scrollbar visibility
if ( m_aConditions.size() <= MAX_CONDITIONS )
// normalize the position, so it can, in all situations, be used as top index
- m_pCondScroll->SetThumbPos( 0 );
+ m_xScrollWindow->vadjustment_set_value(0);
}
void ConditionalFormattingDialog::impl_initializeConditions()
@@ -349,12 +293,12 @@ namespace rptui
sal_Int32 nCount = m_xCopy->getCount();
for ( sal_Int32 i = 0; i < nCount ; ++i )
{
- VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController );
+ auto xCon = std::make_unique<Condition>(m_xConditionPlayground.get(), m_xDialog.get(), *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 );
+ m_xConditionPlayground->reorder_child(xCon->get_widget(), i);
+ xCon->setCondition(xCond);
+ xCon->updateToolbar(xCond.get());
+ m_aConditions.push_back(std::move(xCon));
}
}
catch(Exception&)
@@ -378,7 +322,7 @@ namespace rptui
aArgs[0].Value <<= xReportControlFormat;
aArgs[1].Name = CURRENT_WINDOW;
- aArgs[1].Value <<= VCLUnoHelper::GetInterface(this);
+ aArgs[1].Value <<= m_xDialog->GetXWindow();
aArgs[2].Name = PROPERTY_FONTCOLOR;
aArgs[2].Value <<= rColor;
@@ -409,7 +353,6 @@ namespace rptui
impl_moveCondition_nothrow( _nCondIndex, false );
}
-
OUString ConditionalFormattingDialog::getDataField() const
{
OUString sDataField;
@@ -424,11 +367,10 @@ namespace rptui
return sDataField;
}
-
- short ConditionalFormattingDialog::Execute()
+ short ConditionalFormattingDialog::run()
{
- short nRet = ModalDialog::Execute();
- if ( nRet == RET_OK )
+ short nRet = GenericDialogController::run();
+ if (nRet == RET_OK)
{
const OUString sUndoAction( RptResId( RID_STR_UNDO_CONDITIONAL_FORMATTING ) );
const UndoContext aUndoContext( m_rController.getUndoManager(), sUndoAction );
@@ -474,105 +416,35 @@ namespace rptui
return nRet;
}
-
- bool ConditionalFormattingDialog::PreNotify( NotifyEvent& _rNEvt )
- {
- switch ( _rNEvt.GetType() )
- {
- case MouseNotifyEvent::KEYINPUT:
- {
- const KeyEvent* pKeyEvent( _rNEvt.GetKeyEvent() );
- const vcl::KeyCode& rKeyCode = pKeyEvent->GetKeyCode();
- if ( rKeyCode.IsMod1() && rKeyCode.IsMod2() )
- {
- if ( rKeyCode.GetCode() == 0x0508 )
- {
- impl_deleteCondition_nothrow( impl_getFocusedConditionIndex( 0 ) );
- return true;
- }
- if ( rKeyCode.GetCode() == 0x0507 ) // +
- {
- impl_addCondition_nothrow( impl_getFocusedConditionIndex( impl_getConditionCount() - 1 ) + 1 );
- return true;
- }
- }
- break;
- }
- case MouseNotifyEvent::GETFOCUS:
- {
- if (m_bDeletingCondition)
- break;
-
- if (!m_pConditionPlayground) //e.g. during dispose
- break;
-
- const vcl::Window* pGetFocusWindow( _rNEvt.GetWindow() );
-
- // determine whether the new focus window is part of an (currently invisible) condition
- const vcl::Window* pConditionCandidate = pGetFocusWindow->GetParent();
- const vcl::Window* pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : nullptr;
- while ( pPlaygroundCandidate
- && ( pPlaygroundCandidate != this )
- && ( pPlaygroundCandidate != m_pConditionPlayground )
- )
- {
- pConditionCandidate = pConditionCandidate->GetParent();
- pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : nullptr;
- }
- if (pConditionCandidate && pPlaygroundCandidate == m_pConditionPlayground)
- {
- impl_ensureConditionVisible( dynamic_cast< const Condition& >( *pConditionCandidate ).getConditionIndex() );
- }
- break;
- }
- default:
- break;
- }
-
- return ModalDialog::PreNotify( _rNEvt );
- }
-
-
size_t ConditionalFormattingDialog::impl_getFirstVisibleConditionIndex() const
{
- return static_cast<size_t>(m_pCondScroll->GetThumbPos());
+ auto nHeight = m_aConditions[0]->get_preferred_size().Height();
+ return m_xScrollWindow->vadjustment_get_value() / nHeight;
}
-
size_t ConditionalFormattingDialog::impl_getLastVisibleConditionIndex() const
{
return ::std::min( impl_getFirstVisibleConditionIndex() + MAX_CONDITIONS, impl_getConditionCount() ) - 1;
}
-
size_t ConditionalFormattingDialog::impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const
{
auto cond = std::find_if(m_aConditions.begin(), m_aConditions.end(),
- [](const VclPtr<Condition>& rxCondition) { return rxCondition->HasChildPathFocus(); });
+ [](const std::unique_ptr<Condition>& rxCondition) { return rxCondition->has_focus(); });
if (cond != m_aConditions.end())
return static_cast<size_t>(std::distance(m_aConditions.begin(), cond));
return _nFallBackIfNone;
}
-
- void ConditionalFormattingDialog::impl_updateScrollBarRange()
- {
- long nMax = ( impl_getConditionCount() > MAX_CONDITIONS ) ? impl_getConditionCount() - MAX_CONDITIONS + 1 : 0;
-
- m_pCondScroll->SetRangeMin( 0 );
- m_pCondScroll->SetRangeMax( nMax );
- m_pCondScroll->SetVisibleSize( 1 );
- }
-
-
- void ConditionalFormattingDialog::impl_scrollTo( size_t _nTopCondIndex )
+ void ConditionalFormattingDialog::impl_scrollTo( size_t nTopCondIndex )
{
- OSL_PRECOND( _nTopCondIndex + MAX_CONDITIONS <= impl_getConditionCount(),
+ OSL_PRECOND( nTopCondIndex + MAX_CONDITIONS <= impl_getConditionCount(),
"ConditionalFormattingDialog::impl_scrollTo: illegal index!" );
- m_pCondScroll->SetThumbPos( _nTopCondIndex );
- OnScroll( m_pCondScroll );
- }
+ auto nHeight = m_aConditions[0]->get_preferred_size().Height();
+ m_xScrollWindow->vadjustment_set_value(nTopCondIndex * nHeight);
+ OnScroll(*m_xScrollWindow);
+ }
void ConditionalFormattingDialog::impl_ensureConditionVisible( size_t _nCondIndex )
{
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 1504ea8f7d8a..9e79c3d8830b 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -55,236 +55,175 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-ConditionField::ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula)
+ConditionField::ConditionField(Condition* pParent, std::unique_ptr<weld::Entry> xSubEdit,
+ std::unique_ptr<weld::Button> xFormula)
: m_pParent(pParent)
- , m_pSubEdit(pSubEdit)
- , m_pFormula(pFormula)
+ , m_xSubEdit(std::move(xSubEdit))
+ , m_xFormula(std::move(xFormula))
{
- m_pSubEdit->EnableRTL( false );
-
- m_pFormula->SetText("...");
- m_pFormula->SetClickHdl( LINK( this, ConditionField, OnFormula ) );
+ m_xFormula->set_label("...");
+ m_xFormula->connect_clicked( LINK( this, ConditionField, OnFormula ) );
}
-IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton, void )
+IMPL_LINK_NOARG(ConditionField, OnFormula, weld::Button&, void)
{
- OUString sFormula(m_pSubEdit->GetText());
+ OUString sFormula(m_xSubEdit->get_text());
const sal_Int32 nLen = sFormula.getLength();
if ( nLen )
{
ReportFormula aFormula( sFormula );
sFormula = aFormula.getCompleteFormula();
}
- uno::Reference< awt::XWindow> xInspectorWindow = VCLUnoHelper::GetInterface(_pClickedButton);
+ uno::Reference< awt::XWindow> xInspectorWindow = m_pParent->GetXWindow();
uno::Reference< beans::XPropertySet> xProp(m_pParent->getController().getRowSet(),uno::UNO_QUERY);
if ( rptui::openDialogFormula_nothrow( sFormula, m_pParent->getController().getContext(),xInspectorWindow,xProp ) )
{
ReportFormula aFormula( sFormula );
- m_pSubEdit->SetText(aFormula.getUndecoratedContent());
+ m_xSubEdit->set_text(aFormula.getUndecoratedContent());
}
}
-ConditionColorWrapper::ConditionColorWrapper(Condition* pControl)
- : mxControl(pControl)
- , mnSlotId(0)
-{
-}
-
-void ConditionColorWrapper::dispose()
+ConditionColorWrapper::ConditionColorWrapper(Condition* pControl, sal_uInt16 nSlotId)
+ : mpControl(pControl)
+ , mnSlotId(nSlotId)
{
- mxControl.clear();
}
void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor)
{
- mxControl->ApplyCommand(mnSlotId, rNamedColor);
+ mpControl->ApplyCommand(mnSlotId, rNamedColor);
}
// = Condition
-
-
-Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController )
- : VclHBox(_pParent)
- , m_xPaletteManager(new PaletteManager)
- , m_aColorWrapper(this)
+Condition::Condition(weld::Container* pParent, weld::Window* pDialog, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController)
+ : m_xPaletteManager(new PaletteManager)
+ , m_aBackColorWrapper(this, SID_BACKGROUND_COLOR)
+ , m_aForeColorWrapper(this, SID_ATTR_CHAR_COLOR2)
, m_rController(_rController)
, m_rAction(_rAction)
, m_nCondIndex(0)
- , m_bInDestruction(false)
+ , m_pDialog(pDialog)
+ , m_xBuilder(Application::CreateBuilder(pParent, "modules/dbreport/ui/conditionwin.ui"))
+ , m_xContainer(m_xBuilder->weld_container("ConditionWin"))
+ , m_xHeader(m_xBuilder->weld_label("headerLabel"))
+ , m_xConditionType(m_xBuilder->weld_combo_box("typeCombobox"))
+ , m_xOperationList(m_xBuilder->weld_combo_box("opCombobox"))
+ , m_xOperandGlue(m_xBuilder->weld_label("andLabel"))
+ , m_xActions(m_xBuilder->weld_toolbar("formatToolbox"))
+ , m_xPreview(new weld::CustomWeld(*m_xBuilder, "previewDrawingarea", m_aPreview))
+ , m_xMoveUp(m_xBuilder->weld_button("upButton"))
+ , m_xMoveDown(m_xBuilder->weld_button("downButton"))
+ , m_xAddCondition(m_xBuilder->weld_button("addButton"))
+ , m_xRemoveCondition(m_xBuilder->weld_button("removeButton"))
{
- m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui"));
-
- get(m_pHeader, "headerLabel");
- get(m_pConditionType, "typeCombobox");
- get(m_pOperationList, "opCombobox");
- m_pCondLHS.reset( new ConditionField(this, get<Edit>("lhsEntry"), get<PushButton>("lhsButton")) );
- get(m_pOperandGlue, "andLabel");
- m_pCondRHS.reset( new ConditionField(this, get<Edit>("rhsEntry"), get<PushButton>("rhsButton")) );
- get(m_pActions, "formatToolbox");
- get(m_pPreview, "previewDrawingarea");
- get(m_pMoveUp, "upButton");
- get(m_pMoveDown, "downButton");
- get(m_pAddCondition, "addButton");
- get(m_pRemoveCondition, "removeButton");
-
- m_pActions->SetLineSpacing(true);
- m_pCondLHS->GrabFocus();
-
- m_pConditionType->SetSelectHdl( LINK( this, Condition, OnTypeSelected ) );
-
- m_pOperationList->SetDropDownLineCount( 10 );
- m_pOperationList->SetSelectHdl( LINK( this, Condition, OnOperationSelected ) );
-
- m_pActions->SetSelectHdl(LINK(this, Condition, OnFormatAction));
- m_pActions->SetDropdownClickHdl( LINK( this, Condition, DropdownClick ) );
- setToolBox(m_pActions);
-
- m_pMoveUp->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
- m_pMoveDown->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
- m_pAddCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
- m_pRemoveCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
-
- vcl::Font aFont( m_pAddCondition->GetFont() );
- aFont.SetWeight( WEIGHT_BOLD );
- m_pAddCondition->SetFont( aFont );
- m_pRemoveCondition->SetFont( aFont );
-
- m_pOperandGlue->SetStyle( m_pOperandGlue->GetStyle() | WB_VCENTER );
-
- m_pConditionType->SelectEntryPos( 0 );
- m_pOperationList->SelectEntryPos( 0 );
-
- m_nBoldId = m_pActions->GetItemId(".uno:Bold");
- m_nItalicId = m_pActions->GetItemId(".uno:Italic");
- m_nUnderLineId = m_pActions->GetItemId(".uno:Underline");
- m_nBackgroundColorId = m_pActions->GetItemId(".uno:BackgroundColor");
- m_nFontColorId = m_pActions->GetItemId(".uno:FontColor");
- m_nFontDialogId = m_pActions->GetItemId(".uno:FontDialog");
-
- m_pBtnUpdaterBackgroundColor.reset( new svx::ToolboxButtonColorUpdater(
- SID_BACKGROUND_COLOR, m_nBackgroundColorId, m_pActions, false,
- m_pActions->GetItemText( m_nBackgroundColorId ) ) );
- m_pBtnUpdaterFontColor.reset( new svx::ToolboxButtonColorUpdater(
- SID_ATTR_CHAR_COLOR2, m_nFontColorId, m_pActions, false,
- m_pActions->GetItemText( m_nFontColorId ) ) );
-
- Show();
+ m_xCondLHS.reset(new ConditionField(this, m_xBuilder->weld_entry("lhsEntry"), m_xBuilder->weld_button("lhsButton")));
+ m_xCondRHS.reset(new ConditionField(this, m_xBuilder->weld_entry("rhsEntry"), m_xBuilder->weld_button("rhsButton")));
+
+ m_xCondLHS->grab_focus();
+
+ m_xConditionType->connect_changed( LINK( this, Condition, OnTypeSelected ) );
+
+ m_xOperationList->connect_changed( LINK( this, Condition, OnOperationSelected ) );
+
+ m_xActions->connect_clicked(LINK(this, Condition, OnFormatAction));
+
+ m_xMoveUp->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+ m_xMoveDown->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+ m_xAddCondition->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+ m_xRemoveCondition->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+
+ m_xConditionType->set_active(0);
+ m_xOperationList->set_active(0);
+
+ SetBackgroundDropdownClick();
+ SetForegroundDropdownClick();
+
+ m_xContainer->show();
ConditionalExpressionFactory::getKnownConditionalExpressions( m_aConditionalExpressions );
}
-sal_uInt16 Condition::mapToolbarItemToSlotId(sal_uInt16 nItemId) const
+sal_uInt16 Condition::mapToolbarItemToSlotId(const OString& rItemId)
{
- if (nItemId == m_nBoldId)
+ if (rItemId == "bold")
return SID_ATTR_CHAR_WEIGHT;
- if (nItemId == m_nItalicId)
+ if (rItemId == "italic")
return SID_ATTR_CHAR_POSTURE;
- if (nItemId == m_nUnderLineId)
+ if (rItemId == "underline")
return SID_ATTR_CHAR_UNDERLINE;
- if (nItemId == m_nBackgroundColorId)
+ if (rItemId == "background")
return SID_BACKGROUND_COLOR;
- if (nItemId == m_nFontColorId)
+ if (rItemId == "foreground")
return SID_ATTR_CHAR_COLOR2;
- if (nItemId == m_nFontDialogId)
+ if (rItemId == "fontdialog")
return SID_CHAR_DLG;
return 0;
}
Condition::~Condition()
{
- disposeOnce();
}
-void Condition::dispose()
+void Condition::SetBackgroundDropdownClick()
{
- m_bInDestruction = true;
-
- m_pBtnUpdaterFontColor.reset();
- m_pCondLHS.reset();
- m_pCondRHS.reset();
- m_pBtnUpdaterBackgroundColor.reset();
- m_pHeader.clear();
- m_pConditionType.clear();
- m_pOperationList.clear();
- m_pOperandGlue.clear();
- m_pActions.clear();
- m_pPreview.clear();
- m_pMoveUp.clear();
- m_pMoveDown.clear();
- m_pAddCondition.clear();
- m_pRemoveCondition.clear();
- m_pColorFloat.disposeAndClear();
- m_aColorWrapper.dispose();
- disposeBuilder();
- VclHBox::dispose();
+ m_xBackColorFloat.reset(new ColorWindow(
+ m_xPaletteManager,
+ m_aColorStatus,
+ SID_BACKGROUND_COLOR,
+ nullptr,
+ m_pDialog,
+ MenuOrToolMenuButton(m_xActions.get(), "background"),
+ /*bInterimBuilder*/false,
+ m_aBackColorWrapper));
+
+ m_xActions->set_item_popover("background", m_xBackColorFloat->GetWidget());
}
-IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void)
+void Condition::SetForegroundDropdownClick()
{
- sal_uInt16 nId( m_pActions->GetCurItemId() );
- m_pColorFloat.disposeAndClear();
- sal_uInt16 nSlotId(mapToolbarItemToSlotId(nId));
- m_aColorWrapper.SetSlotId(nSlotId);
- m_pColorFloat = VclPtr<SvxColorWindow>::Create(
- OUString() /*m_aCommandURL*/,
- m_xPaletteManager,
- m_aColorStatus,
- nSlotId,
- nullptr,
- pToolBox,
- false,
- m_aColorWrapper);
-
- m_pColorFloat->EnableDocking();
- vcl::Window::GetDockingManager()->StartPopupMode(pToolBox, m_pColorFloat, FloatWinPopupFlags::GrabFocus);
+ m_xForeColorFloat.reset(new ColorWindow(
+ m_xPaletteManager,
+ m_aColorStatus,
+ SID_ATTR_CHAR_COLOR2,
+ nullptr,
+ m_pDialog,
+ MenuOrToolMenuButton(m_xActions.get(), "foreground"),
+ /*bInterimBuilder*/false,
+ m_aForeColorWrapper));
+
+ m_xActions->set_item_popover("foreground", m_xForeColorFloat->GetWidget());
}
-IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void )
+
+IMPL_LINK(Condition, OnFormatAction, const OString&, rIdent, void)
{
- ApplyCommand(mapToolbarItemToSlotId(m_pActions->GetCurItemId()),
+ ApplyCommand(mapToolbarItemToSlotId(rIdent),
NamedColor(COL_AUTO, "#" + COL_AUTO.AsRGBHexString()));
}
-IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton, void )
+IMPL_LINK(Condition, OnConditionAction, weld::Button&, rClickedButton, void)
{
- if ( _pClickedButton == m_pMoveUp )
+ if ( &rClickedButton == m_xMoveUp.get() )
m_rAction.moveConditionUp( getConditionIndex() );
- else if ( _pClickedButton == m_pMoveDown )
+ else if ( &rClickedButton == m_xMoveDown.get() )
m_rAction.moveConditionDown( getConditionIndex() );
- else if ( _pClickedButton == m_pAddCondition )
+ else if ( &rClickedButton == m_xAddCondition.get() )
m_rAction.addCondition( getConditionIndex() );
- else if ( _pClickedButton == m_pRemoveCondition )
+ else if ( &rClickedButton == m_xRemoveCondition.get() )
m_rAction.deleteCondition( getConditionIndex() );
}
void Condition::ApplyCommand( sal_uInt16 _nCommandId, const NamedColor& rNamedColor )
{
- if ( _nCommandId == SID_ATTR_CHAR_COLOR2 )
- m_pBtnUpdaterFontColor->Update( rNamedColor );
- else if ( _nCommandId == SID_BACKGROUND_COLOR )
- m_pBtnUpdaterBackgroundColor->Update( rNamedColor );
-
m_rAction.applyCommand( m_nCondIndex, _nCommandId, rNamedColor.first );
}
-void Condition::resizeControls(const Size& /*_rDiff*/)
-{
-}
-
-void Condition::GetFocus()
-{
- VclHBox::GetFocus();
- if ( !m_bInDestruction )
- m_pCondLHS->GrabFocus();
-}
-
-IMPL_LINK_NOARG( Condition, OnTypeSelected, ListBox&, void )
+IMPL_LINK_NOARG( Condition, OnTypeSelected, weld::ComboBox&, void )
{
impl_layoutOperands();
}
-
-IMPL_LINK_NOARG( Condition, OnOperationSelected, ListBox&, void )
+IMPL_LINK_NOARG( Condition, OnOperationSelected, weld::ComboBox&, void )
{
impl_layoutOperands();
}
@@ -303,9 +242,9 @@ void Condition::impl_layoutOperands()
);
// the "condition type" list box
- m_pOperationList->Show( !bIsExpression );
- m_pOperandGlue->Show( bHaveRHS );
- m_pCondRHS->Show( bHaveRHS );
+ m_xOperationList->set_visible( !bIsExpression );
+ m_xOperandGlue->set_visible( bHaveRHS );
+ m_xCondRHS->set_visible( bHaveRHS );
}
void Condition::impl_setCondition( const OUString& _rConditionFormula )
@@ -347,10 +286,10 @@ void Condition::impl_setCondition( const OUString& _rConditionFormula )
}
// update UI
- m_pConditionType->SelectEntryPos( static_cast<sal_uInt16>(eType) );
- m_pOperationList->SelectEntryPos( static_cast<sal_uInt16>(eOperation) );
- m_pCondLHS->SetText( sLHS );
- m_pCondRHS->SetText( sRHS );
+ m_xConditionType->set_active(static_cast<sal_uInt16>(eType));
+ m_xOperationList->set_active(static_cast<sal_uInt16>(eOperation));
+ m_xCondLHS->set_text( sLHS );
+ m_xCondRHS->set_text( sRHS );
// re-layout
impl_layoutOperands();
@@ -380,15 +319,15 @@ void Condition::setCondition( const uno::Reference< report::XFormatCondition >&
void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat >& _xReportControlFormat)
{
+ OString aItems[] = { "bold", "italic", "underline", "fontdialog" };
+
OSL_ENSURE(_xReportControlFormat.is(),"XReportControlFormat is NULL!");
if ( _xReportControlFormat.is() )
{
- ToolBox::ImplToolItems::size_type nItemCount = m_pActions->GetItemCount();
- for (ToolBox::ImplToolItems::size_type j = 0; j< nItemCount; ++j)
+ for (size_t j = 0; j < SAL_N_ELEMENTS(aItems); ++j)
{
- sal_uInt16 nItemId = m_pActions->GetItemId(j);
- m_pActions->CheckItem( nItemId, OReportController::isFormatCommandEnabled(mapToolbarItemToSlotId(nItemId),
- _xReportControlFormat ) );
+ m_xActions->set_item_active(aItems[j], OReportController::isFormatCommandEnabled(mapToolbarItemToSlotId(aItems[j]),
+ _xReportControlFormat));
}
try
@@ -399,9 +338,9 @@ void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat
aFont.SetEmphasisMark( static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) );
aFont.SetRelief( static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) );
aFont.SetColor( Color(_xReportControlFormat->getCharColor()) );
- m_pPreview->SetFont( aFont, aFont, aFont );
- m_pPreview->SetBackColor( Color(_xReportControlFormat->getControlBackground()) );
- m_pPreview->SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) );
+ m_aPreview.SetFont( aFont, aFont, aFont );
+ m_aPreview.SetBackColor( Color(_xReportControlFormat->getControlBackground()) );
+ m_aPreview.SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) );
}
catch( const Exception& )
{
@@ -415,8 +354,8 @@ void Condition::fillFormatCondition(const uno::Reference< report::XFormatConditi
const ConditionType eType( impl_getCurrentConditionType() );
const ComparisonOperation eOperation( impl_getCurrentComparisonOperation() );
- const OUString sLHS( m_pCondLHS->GetText() );
- const OUString sRHS( m_pCondRHS->GetText() );
+ const OUString sLHS( m_xCondLHS->get_text() );
+ const OUString sRHS( m_xCondRHS->get_text() );
OUString sUndecoratedFormula( sLHS );
@@ -438,20 +377,18 @@ void Condition::setConditionIndex( size_t _nCondIndex, size_t _nCondCount )
m_nCondIndex = _nCondIndex;
OUString sHeader( RptResId( STR_NUMBERED_CONDITION ) );
sHeader = sHeader.replaceFirst( "$number$", OUString::number( _nCondIndex + 1) );
- m_pHeader->SetText( sHeader );
+ m_xHeader->set_label( sHeader );
- m_pMoveUp->Enable( _nCondIndex > 0 );
+ m_xMoveUp->set_sensitive(_nCondIndex > 0);
OSL_PRECOND( _nCondCount > 0, "Condition::setConditionIndex: having no conditions at all is nonsense!" );
- m_pMoveDown->Enable( _nCondIndex < _nCondCount - 1 );
+ m_xMoveDown->set_sensitive(_nCondIndex < _nCondCount - 1);
}
-
bool Condition::isEmpty() const
{
- return m_pCondLHS->GetText().isEmpty();
+ return m_xCondLHS->get_text().isEmpty();
}
-
} // rptui
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index d8a03ac82f57..1b9a5ea365fa 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -24,8 +24,6 @@
#include <com/sun/star/report/XFormatCondition.hpp>
-#include <dbaccess/ToolBoxHelper.hxx>
-
#include <svx/colorwindow.hxx>
#include <svx/fntctrl.hxx>
@@ -35,7 +33,8 @@
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/builder.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
#include <memory>
@@ -50,84 +49,74 @@ namespace rptui
class ConditionField
{
- VclPtr<Condition> m_pParent;
- VclPtr<Edit> m_pSubEdit;
- VclPtr<PushButton> m_pFormula;
+ Condition* m_pParent;
+ std::unique_ptr<weld::Entry> m_xSubEdit;
+ std::unique_ptr<weld::Button> m_xFormula;
- DECL_LINK( OnFormula, Button*, void );
+ DECL_LINK(OnFormula, weld::Button&, void);
public:
- ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula);
- void GrabFocus() { m_pSubEdit->GrabFocus(); }
- void Show(bool bShow) { m_pSubEdit->Show(bShow); m_pFormula->Show(bShow); }
- void SetText(const OUString& rText) { m_pSubEdit->SetText(rText); }
- OUString GetText() const { return m_pSubEdit->GetText(); }
+ ConditionField(Condition* pParent, std::unique_ptr<weld::Entry> xSubEdit, std::unique_ptr<weld::Button> xFormula);
+ void grab_focus() { m_xSubEdit->grab_focus(); }
+ void set_visible(bool bShow) { m_xSubEdit->set_visible(bShow); m_xFormula->set_visible(bShow); }
+ void set_text(const OUString& rText) { m_xSubEdit->set_text(rText); }
+ OUString get_text() const { return m_xSubEdit->get_text(); }
};
class ConditionColorWrapper
{
public:
- ConditionColorWrapper(Condition* pControl);
- void SetSlotId(sal_uInt16 nSlotId) { mnSlotId = nSlotId; }
+ ConditionColorWrapper(Condition* pControl, sal_uInt16 nSlotId);
void operator()(const OUString& rCommand, const NamedColor& rColor);
void dispose();
private:
- VclPtr<Condition> mxControl;
+ Condition* mpControl;
sal_uInt16 mnSlotId;
};
//= Condition
- class Condition :public VclHBox
- ,public dbaui::OToolBoxHelper
- ,public VclBuilderContainer
+ class Condition
{
- sal_uInt16 m_nBoldId;
- sal_uInt16 m_nItalicId;
- sal_uInt16 m_nUnderLineId;
- sal_uInt16 m_nBackgroundColorId;
- sal_uInt16 m_nFontColorId;
- sal_uInt16 m_nFontDialogId;
std::shared_ptr<PaletteManager> m_xPaletteManager;
ColorStatus m_aColorStatus;
- ConditionColorWrapper m_aColorWrapper;
+ ConditionColorWrapper m_aBackColorWrapper;
+ ConditionColorWrapper m_aForeColorWrapper;
::rptui::OReportController& m_rController;
IConditionalFormatAction& m_rAction;
- VclPtr<FixedText> m_pHeader;
- VclPtr<ListBox> m_pConditionType;
- VclPtr<ListBox> m_pOperationList;
- std::unique_ptr<ConditionField> m_pCondLHS;
- VclPtr<FixedText> m_pOperandGlue;
- std::unique_ptr<ConditionField> m_pCondRHS;
- VclPtr<ToolBox> m_pActions;
- VclPtr<SvxFontPrevWindow> m_pPreview;
- VclPtr<PushButton> m_pMoveUp;
- VclPtr<PushButton> m_pMoveDown;
- VclPtr<PushButton> m_pAddCondition;
- VclPtr<PushButton> m_pRemoveCondition;
- VclPtr<SvxColorWindow> m_pColorFloat;
-
- std::unique_ptr<svx::ToolboxButtonColorUpdater> m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
- std::unique_ptr<svx::ToolboxButtonColorUpdater> m_pBtnUpdaterBackgroundColor;
-
size_t m_nCondIndex;
- bool m_bInDestruction;
ConditionalExpressions m_aConditionalExpressions;
- DECL_LINK( OnFormatAction, ToolBox*, void );
- DECL_LINK( DropdownClick, ToolBox*, void );
- DECL_LINK( OnConditionAction, Button*, void );
+ FontPrevWindow m_aPreview;
+ weld::Window* m_pDialog;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Label> m_xHeader;
+ std::unique_ptr<weld::ComboBox> m_xConditionType;
+ std::unique_ptr<weld::ComboBox> m_xOperationList;
+ std::unique_ptr<ConditionField> m_xCondLHS;
+ std::unique_ptr<weld::Label> m_xOperandGlue;
+ std::unique_ptr<ConditionField> m_xCondRHS;
+ std::unique_ptr<weld::Toolbar> m_xActions;
+ std::unique_ptr<weld::CustomWeld> m_xPreview;
+ std::unique_ptr<weld::Button> m_xMoveUp;
+ std::unique_ptr<weld::Button> m_xMoveDown;
+ std::unique_ptr<weld::Button> m_xAddCondition;
+ std::unique_ptr<weld::Button> m_xRemoveCondition;
+ std::unique_ptr<ColorWindow> m_xBackColorFloat;
+ std::unique_ptr<ColorWindow> m_xForeColorFloat;
+
+ void SetBackgroundDropdownClick();
+ void SetForegroundDropdownClick();
+
+ DECL_LINK( OnFormatAction, const OString&, void );
+ DECL_LINK( OnConditionAction, weld::Button&, void );
public:
- Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController );
- virtual ~Condition() override;
- virtual void dispose() override;
-
- /** will be called when the controls need to be resized.
- */
- virtual void resizeControls(const Size& _rDiff) override;
+ Condition(weld::Container* pParent, weld::Window* pDialog, IConditionalFormatAction& rAction, ::rptui::OReportController& rController);
+ ~Condition();
/** sets the props at the control
@param _xCondition the source
@@ -160,10 +149,14 @@ namespace rptui
::rptui::OReportController& getController() const { return m_rController; }
- sal_uInt16 mapToolbarItemToSlotId(sal_uInt16 nItemId) const;
+ static sal_uInt16 mapToolbarItemToSlotId(const OString& rItemId);
- protected:
- virtual void GetFocus() override;
+ css::uno::Reference<css::awt::XWindow> GetXWindow() const { return m_pDialog->GetXWindow(); }
+
+ void grab_focus() { m_xContainer->grab_focus(); }
+ bool has_focus() const { return m_xContainer->has_focus(); }
+ Size get_preferred_size() const { return m_xContainer->get_preferred_size(); }
+ weld::Widget* get_widget() const { return m_xContainer.get(); }
private:
void impl_layoutOperands();
@@ -177,23 +170,20 @@ namespace rptui
void impl_setCondition( const OUString& _rConditionFormula );
private:
- DECL_LINK( OnTypeSelected, ListBox&, void );
- DECL_LINK( OnOperationSelected, ListBox&, void );
+ DECL_LINK( OnTypeSelected, weld::ComboBox&, void );
+ DECL_LINK( OnOperationSelected, weld::ComboBox&, void );
};
-
inline ConditionType Condition::impl_getCurrentConditionType() const
{
- return sal::static_int_cast< ConditionType >( m_pConditionType->GetSelectedEntryPos() );
+ return sal::static_int_cast<ConditionType>(m_xConditionType->get_active());
}
-
inline ComparisonOperation Condition::impl_getCurrentComparisonOperation() const
{
- return sal::static_int_cast< ComparisonOperation >( m_pOperationList->GetSelectedEntryPos() );
+ return sal::static_int_cast<ComparisonOperation>(m_xOperationList->get_active());
}
-
} // namespace rptui
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_DLG_CONDITION_HXX
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx
index b122bb3012d7..2c16546e1004 100644
--- a/reportdesign/source/ui/inc/AddField.hxx
+++ b/reportdesign/source/ui/inc/AddField.hxx
@@ -32,7 +32,6 @@
#include <svx/dataaccessdescriptor.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <dbaccess/ToolBoxHelper.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/fixed.hxx>
@@ -48,7 +47,6 @@ class OAddFieldWindow :public FloatingWindow
, public ::cppu::BaseMutex
, public ::comphelper::OPropertyChangeListener
, public ::comphelper::OContainerListener
- , public dbaui::OToolBoxHelper
{
css::uno::Reference< css::lang::XComponent> m_xHoldAlive;
css::uno::Reference< css::container::XNameAccess> m_xColumns;
@@ -95,10 +93,6 @@ public:
css::uno::Sequence< css::beans::PropertyValue > getSelectedFieldDescriptors();
- /** will be called when the controls need to be resized.
- */
- virtual void resizeControls(const Size& _rDiff) override;
-
/// Updates the current field list
void Update();
diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx
index eecf554f8c46..a3260c134ecb 100644
--- a/reportdesign/source/ui/inc/CondFormat.hxx
+++ b/reportdesign/source/ui/inc/CondFormat.hxx
@@ -21,16 +21,9 @@
#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX
#include <com/sun/star/report/XReportControlModel.hpp>
-
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/scrbar.hxx>
-
+#include <vcl/weld.hxx>
#include <vector>
-
namespace rptui
{
@@ -62,15 +55,10 @@ namespace rptui
|* Conditional formatting dialog
|*
\************************************************************************/
- class ConditionalFormattingDialog :public ModalDialog
- ,public IConditionalFormatAction
+ class ConditionalFormattingDialog : public weld::GenericDialogController
+ , public IConditionalFormatAction
{
- typedef ::std::vector< VclPtr<Condition> > Conditions;
-
- VclPtr<vcl::Window> m_pConditionPlayground;
- Conditions m_aConditions;
- VclPtr<VclScrolledWindow> m_pScrollWindow;
- VclPtr<ScrollBar> m_pCondScroll;
+ typedef ::std::vector< std::unique_ptr<Condition> > Conditions;
::rptui::OReportController& m_rController;
css::uno::Reference< css::report::XReportControlModel >
@@ -81,16 +69,19 @@ namespace rptui
bool m_bDeletingCondition;
bool m_bConstructed;
+ std::unique_ptr<weld::ScrolledWindow> m_xScrollWindow;
+ std::unique_ptr<weld::Box> m_xConditionPlayground;
+ Conditions m_aConditions;
+
public:
ConditionalFormattingDialog(
- vcl::Window* pParent,
+ weld::Window* pParent,
const css::uno::Reference< css::report::XReportControlModel>& _xHoldAlive,
::rptui::OReportController& _rController
);
virtual ~ConditionalFormattingDialog() override;
- virtual void dispose() override;
// Dialog overridables
- virtual short Execute() override;
+ virtual short run() override;
// IConditionalFormatAction overridables
virtual void addCondition( size_t _nAddAfterIndex ) override;
@@ -100,11 +91,8 @@ namespace rptui
virtual void moveConditionDown( size_t _nCondIndex ) override;
virtual OUString getDataField() const override;
- protected:
- virtual bool PreNotify( NotifyEvent& rNEvt ) override;
-
private:
- DECL_LINK( OnScroll, ScrollBar*, void );
+ DECL_LINK(OnScroll, weld::ScrolledWindow&, void);
private:
/// returns the current number of conditions
@@ -125,9 +113,6 @@ namespace rptui
/// does the dialog layouting
void impl_layoutAll();
- /// does the layout for the condition windows
- void impl_layoutConditions();
-
/// called when the number of conditions has changed in any way
void impl_conditionCountChanged();
@@ -149,9 +134,6 @@ namespace rptui
/// focuses the condition with the given index, making it visible if necessary
void impl_focusCondition( size_t _nCondIndex );
- /// updates the scrollbar range. (does not update the scrollbar visibility)
- void impl_updateScrollBarRange();
-
/// scrolls the condition with the given index to the top position
void impl_scrollTo( size_t _nTopCondIndex );
diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx
index 453963c8687d..2c4be48ab602 100644
--- a/reportdesign/source/ui/inc/GroupsSorting.hxx
+++ b/reportdesign/source/ui/inc/GroupsSorting.hxx
@@ -38,8 +38,6 @@
#include <vector>
-#include <dbaccess/ToolBoxHelper.hxx>
-
namespace comphelper
{
class OPropertyChangeMultiplexer;
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 51d7b5e7cf69..21d6e3c8af7a 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -637,8 +637,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
{ SID_ATTR_CHAR_CTL_POSTURE, true },
{ SID_ATTR_CHAR_CTL_WEIGHT, true }
};
- VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
- ::std::unique_ptr<FontList> pFontList(new FontList( pParent ));
+ ::std::unique_ptr<FontList> pFontList(new FontList(Application::GetDefaultDevice()));
XColorListRef pColorList( XColorList::CreateStdColorList() );
std::vector<SfxPoolItem*> pDefaults
{
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index cf89c567fbd2..92481ac15918 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -1548,8 +1548,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
if ( xFormattedField.is() )
{
- ScopedVclPtrInstance< ConditionalFormattingDialog > aDlg( getView(), xFormattedField.get(), *this );
- aDlg->Execute();
+ ConditionalFormattingDialog aDlg(getFrameWeld(), xFormattedField.get(), *this);
+ aDlg.run();
}
}
break;
diff --git a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui
index 9ecfac38f421..0e19789d966a 100644
--- a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui
+++ b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="rpt">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="CondFormat">
@@ -8,7 +8,13 @@
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="condformatdialog|CondFormat">Conditional Formatting</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -87,10 +93,12 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkBox" id="condPlaygroundDrawingarea">
<property name="visible">True</property>
diff --git a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
index fa615089c50b..18ef29bae9af 100644
--- a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
+++ b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="rpt">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -17,7 +16,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
@@ -38,7 +36,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
@@ -46,7 +43,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkComboBoxText" id="typeCombobox">
@@ -89,17 +85,18 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
+ <property name="hexpand">True</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkEntry" id="lhsEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -112,8 +109,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -127,6 +122,7 @@
<object class="GtkLabel" id="andLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="valign">center</property>
<property name="label" translatable="yes" context="conditionwin|andLabel">and</property>
</object>
<packing>
@@ -140,17 +136,18 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
+ <property name="hexpand">True</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkEntry" id="rhsEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -163,8 +160,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -178,8 +173,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -193,8 +186,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -202,7 +193,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkToolbar" id="formatToolbox">
@@ -213,45 +203,42 @@
<property name="toolbar_style">icons</property>
<property name="show_arrow">False</property>
<child>
- <object class="GtkToolButton" id="ToolBoxItem1">
+ <object class="GtkToggleToolButton" id="bold">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:Bold</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem1">Bold</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_bold.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolBoxItem2">
+ <object class="GtkToggleToolButton" id="italic">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:Italic</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem2">Italic</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_italic.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolBoxItem3">
+ <object class="GtkToggleToolButton" id="underline">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:Underline</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem3">Underline</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_underline.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
@@ -265,45 +252,42 @@
</packing>
</child>
<child>
- <object class="GtkMenuToolButton" id="ToolBoxItem4">
+ <object class="GtkMenuToolButton" id="background">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:BackgroundColor</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem4">Background Color</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_backgroundcolor.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkMenuToolButton" id="ToolBoxItem5">
+ <object class="GtkMenuToolButton" id="foreground">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:FontColor</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem5">Font Color</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_fontcolor.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolBoxItem6">
+ <object class="GtkToggleToolButton" id="fontdialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:FontDialog</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem6">Character Formatting</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_fontdialog.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
</object>
@@ -314,10 +298,26 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxFontPrevWindow" id="previewDrawingarea">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">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="previewDrawingarea">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -329,8 +329,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -345,8 +343,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -373,8 +369,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -389,8 +383,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>