LibreOffice Module dbaccess (master) 1
RelationControl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <RelationControl.hxx>
21
23#include <com/sun/star/beans/XPropertySet.hpp>
27#include <TableConnection.hxx>
28#include <TableWindow.hxx>
29#include <com/sun/star/awt/XWindow.hpp>
30#include <com/sun/star/container/XNameAccess.hpp>
31#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
32#include <RelControliFace.hxx>
33#include <helpids.h>
34#include <o3tl/safeint.hxx>
35#include <osl/diagnose.h>
36
37#include <vector>
38#include <utility>
39using std::pair;
40using std::make_pair;
41
42#define SOURCE_COLUMN 1
43#define DEST_COLUMN 2
44
45namespace dbaui
46{
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::beans;
49 using namespace ::com::sun::star::sdbc;
50 using namespace ::com::sun::star::sdbcx;
51 using namespace ::com::sun::star::container;
52 using namespace svt;
53
56 {
58
60 TTableConnectionData::value_type m_pConnData;
66 typedef std::vector< pair < opcode, pair < OConnectionLineDataVec::size_type, OConnectionLineDataVec::size_type> > > ops_type;
68
69 void fillListBox(const Reference< XPropertySet>& _xDest);
76 sal_uInt16 getColumnIdent( sal_uInt16 _nColId ) const;
77 public:
78 explicit ORelationControl(const css::uno::Reference<css::awt::XWindow>& rParent);
80 {
81 m_pBoxControl = pController;
82 }
83
90 void setWindowTables(const OTableWindow* _pSource,const OTableWindow* _pDest);
91
96 const TTableConnectionData::value_type& getData() const { return m_pConnData; }
97
98 void lateInit();
99
100 protected:
101 virtual ~ORelationControl() override { disposeOnce(); }
102 virtual void dispose() override { m_pListCell.disposeAndClear(); ORelationControl_Base::dispose(); }
103 virtual void Resize() override;
104 virtual Size GetOptimalSize() const override;
105 virtual bool PreNotify(NotifyEvent& rNEvt ) override;
106
107 virtual bool IsTabAllowed(bool bForward) const override;
108
109 void Init(const TTableConnectionData::value_type& _pConnData);
111 virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
112 virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
113 virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
114 virtual bool SeekRow( sal_Int32 nRow ) override;
115 virtual bool SaveModified() override;
116 virtual OUString GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const override;
117
118 virtual void CellModified() override;
119
120 DECL_LINK( AsynchDeactivate, void*, void );
121 private:
122
123 DECL_LINK( AsynchActivate, void*, void );
124
125 };
126
127 ORelationControl::ORelationControl(const css::uno::Reference<css::awt::XWindow>& rParent)
128 : EditBrowseBox(VCLUnoHelper::GetWindow(rParent),
132 , m_pBoxControl(nullptr)
133 , m_nDataPos(0)
134 {
135 }
136
137 void ORelationControl::Init(const TTableConnectionData::value_type& _pConnData)
138 {
139
140 m_pConnData = _pConnData;
141 OSL_ENSURE(m_pConnData, "No data supplied!");
142
143 m_pConnData->normalizeLines();
144 }
145
147 {
148 if ( !m_pConnData )
149 return;
150 m_xSourceDef = m_pConnData->getReferencingTable()->getTable();
151 m_xDestDef = m_pConnData->getReferencedTable()->getTable();
152
153 if ( ColCount() == 0 )
154 {
155 InsertDataColumn( SOURCE_COLUMN, m_pConnData->getReferencingTable()->GetWinName(), 100);
156 InsertDataColumn( DEST_COLUMN, m_pConnData->getReferencedTable()->GetWinName(), 100);
157 // If the Defs do not yet exits, we need to set them with SetSource-/-DestDef
158
160
161 // set browse mode
162 SetMode( BrowserMode::COLUMNSELECTION |
163 BrowserMode::HLINES |
164 BrowserMode::VLINES |
165 BrowserMode::HIDECURSOR |
166 BrowserMode::HIDESELECT |
167 BrowserMode::AUTO_HSCROLL |
168 BrowserMode::AUTO_VSCROLL);
169 }
170 else
171 // not the first call
173
174 RowInserted(0, m_pConnData->GetConnLineDataList().size() + 1); // add one extra row
175 }
176
178 {
180 tools::Long nOutputWidth = GetOutputSizePixel().Width() - 1;
181 SetColumnWidth(1, (nOutputWidth / 2));
182 SetColumnWidth(2, (nOutputWidth / 2));
183 }
184
186 {
187 if (rNEvt.GetType() == NotifyEventType::LOSEFOCUS && !HasChildPathFocus() && !ControlHasFocus())
188 PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate), nullptr, true);
189 else if (rNEvt.GetType() == NotifyEventType::GETFOCUS)
190 PostUserEvent(LINK(this, ORelationControl, AsynchActivate), nullptr, true);
191
192 return EditBrowseBox::PreNotify(rNEvt);
193 }
194
195 IMPL_LINK_NOARG(ORelationControl, AsynchActivate, void*, void)
196 {
197 ActivateCell();
198 }
199
200 IMPL_LINK_NOARG(ORelationControl, AsynchDeactivate, void*, void)
201 {
202 DeactivateCell();
203 }
204
205 bool ORelationControl::IsTabAllowed(bool bForward) const
206 {
207 sal_Int32 nRow = GetCurRow();
208 sal_uInt16 nCol = GetCurColumnId();
209
210 bool bRet = !( ( bForward && (nCol == DEST_COLUMN) && (nRow == GetRowCount() - 1))
211 || (!bForward && (nCol == SOURCE_COLUMN) && (nRow == 0)));
212
213 return bRet && EditBrowseBox::IsTabAllowed(bForward);
214 }
215
217 {
218 sal_Int32 nRow = GetCurRow();
219 if ( nRow != BROWSER_ENDOFSELECTION )
220 {
221 weld::ComboBox& rListBox = m_pListCell->get_widget();
222 OUString sFieldName(rListBox.get_active_text());
223 OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList();
224 if ( rLines.size() <= o3tl::make_unsigned(nRow) )
225 {
226 rLines.push_back(new OConnectionLineData());
227 nRow = rLines.size() - 1;
228 // add new past-rLines row
229 m_ops.emplace_back(INSERT, make_pair(nRow+1, nRow+2));
230 }
231
232 OConnectionLineDataRef pConnLineData = rLines[nRow];
233
234 switch( getColumnIdent( GetCurColumnId() ) )
235 {
236 case SOURCE_COLUMN:
237 pConnLineData->SetSourceFieldName( sFieldName );
238 break;
239 case DEST_COLUMN:
240 pConnLineData->SetDestFieldName( sFieldName );
241 break;
242 }
243 // the modification we just did does *not* need to be registered in m_ops;
244 // it is already taken into account (by the codepath that called us)
245 //m_ops.push_back(make_pair(MODIFY, make_pair(nRow, nRow+1)));
246 }
247
248 const OConnectionLineDataVec::size_type oldSize = m_pConnData->GetConnLineDataList().size();
249 OConnectionLineDataVec::size_type line = m_pConnData->normalizeLines();
250 const OConnectionLineDataVec::size_type newSize = m_pConnData->GetConnLineDataList().size();
251 assert(newSize <= oldSize);
252 m_ops.emplace_back(MODIFY, make_pair(line, newSize));
253 m_ops.emplace_back(DELETE, make_pair(newSize, oldSize));
254
255 return true;
256 }
257
258 sal_uInt16 ORelationControl::getColumnIdent( sal_uInt16 _nColId ) const
259 {
260 sal_uInt16 nId = _nColId;
261 if ( m_pConnData->getReferencingTable() != m_pBoxControl->getReferencingTable() )
262 nId = ( _nColId == SOURCE_COLUMN) ? DEST_COLUMN : SOURCE_COLUMN;
263 return nId;
264 }
265
266 OUString ORelationControl::GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const
267 {
268 OUString sText;
269 if ( m_pConnData->GetConnLineDataList().size() > o3tl::make_unsigned(nRow) )
270 {
271 OConnectionLineDataRef pConnLineData = m_pConnData->GetConnLineDataList()[nRow];
272 switch( getColumnIdent( nColId ) )
273 {
274 case SOURCE_COLUMN:
275 sText = pConnLineData->GetSourceFieldName();
276 break;
277 case DEST_COLUMN:
278 sText = pConnLineData->GetDestFieldName();
279 break;
280 }
281 }
282 return sText;
283 }
284
285 void ORelationControl::InitController( CellControllerRef& /*rController*/, sal_Int32 nRow, sal_uInt16 nColumnId )
286 {
287
288 OUString sHelpId( HID_RELATIONDIALOG_LEFTFIELDCELL );
289
291 switch ( getColumnIdent(nColumnId) )
292 {
293 case SOURCE_COLUMN:
294 xDef = m_xSourceDef;
296 break;
297 case DEST_COLUMN:
298 xDef = m_xDestDef;
300 break;
301 default:
302 // ?????????
303 break;
304 }
305
306 if ( !xDef.is() )
307 return;
308
309 fillListBox(xDef);
310 OUString sName = GetCellText( nRow, nColumnId );
311 weld::ComboBox& rList = m_pListCell->get_widget();
312 rList.set_active_text(sName);
313 if (rList.get_active_text() != sName)
314 {
315 rList.append_text(sName);
316 rList.set_active_text(sName);
317 }
318
319 rList.set_help_id(sHelpId);
320 }
321
322 CellController* ORelationControl::GetController( sal_Int32 /*nRow*/, sal_uInt16 /*nColumnId*/ )
323 {
324 return new ListBoxCellController( m_pListCell.get() );
325 }
326
327 bool ORelationControl::SeekRow( sal_Int32 nRow )
328 {
329 m_nDataPos = nRow;
330 return true;
331 }
332
333 void ORelationControl::PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const
334 {
335 OUString aText = GetCellText( m_nDataPos, nColumnId );
336
337 Point aPos( rRect.TopLeft() );
338 Size aTextSize( GetDataWindow().GetTextWidth( aText ), GetDataWindow().GetTextHeight() );
339
340 if( aPos.X() < rRect.Left() || aPos.X() + aTextSize.Width() > rRect.Right() ||
341 aPos.Y() < rRect.Top() || aPos.Y() + aTextSize.Height() > rRect.Bottom() )
342 {
343 rDev.SetClipRegion(vcl::Region(rRect));
344 }
345
346 rDev.DrawText( aPos, aText );
347
348 if( rDev.IsClipRegion() )
349 rDev.SetClipRegion();
350 }
352 {
353 weld::ComboBox& rList = m_pListCell->get_widget();
354 rList.clear();
355 try
356 {
357 if ( _xDest.is() )
358 {
359 //sal_Int32 nRows = GetRowCount();
360 Reference<XColumnsSupplier> xSup(_xDest,UNO_QUERY);
361 Reference<XNameAccess> xColumns = xSup->getColumns();
362 Sequence< OUString> aNames = xColumns->getElementNames();
363 const OUString* pIter = aNames.getConstArray();
364 const OUString* pEnd = pIter + aNames.getLength();
365 for(;pIter != pEnd;++pIter)
366 {
367 rList.append_text(*pIter);
368 }
369 rList.insert_text(0, OUString());
370 }
371 }
372 catch( const Exception& )
373 {
374 DBG_UNHANDLED_EXCEPTION("dbaccess");
375 }
376 }
378 {
379 // If I edit here, hide
380 bool bWasEditing = IsEditing();
381 if ( bWasEditing )
383
384 if ( _pSource && _pDest )
385 {
386 m_xSourceDef = _pSource->GetTable();
387 SetColumnTitle(1, _pSource->GetName());
388
389 m_xDestDef = _pDest->GetTable();
390 SetColumnTitle(2, _pDest->GetName());
391
392 const OJoinTableView* pView = _pSource->getTableView();
393 OTableConnection* pConn = pView->GetTabConn(_pSource,_pDest);
394 if ( pConn && !m_pConnData->GetConnLineDataList().empty() )
395 {
396 m_pConnData->CopyFrom(*pConn->GetData());
398 }
399 else
400 {
401 // no connection found so we clear our data
402 OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList();
403 for( const auto& rLine : rLines )
404 {
405 rLine->Reset();
406 }
407
408 m_pConnData->setReferencingTable(_pSource->GetData());
409 m_pConnData->setReferencedTable(_pDest->GetData());
410 }
411 m_pConnData->normalizeLines();
412
413 }
414 // Repaint
415 Invalidate();
416
417 if ( bWasEditing )
418 {
419 GoToRow(0);
420 ActivateCell();
421 }
422 }
423
425 {
427 SaveModified();
428 assert(m_pBoxControl);
430 }
431
433 {
434 return LogicToPixel(Size(140, 80), MapMode(MapUnit::MapAppFont));
435 }
436
438 const OJoinTableView::OTableWindowMap* _pTableMap,
439 IRelationControlInterface* _pParentDialog)
440 : m_xLeftTable(_pParent->weld_combo_box("table1"))
441 , m_xRightTable(_pParent->weld_combo_box("table2"))
442 , m_xTable(_pParent->weld_container("relations"))
443 , m_xTableCtrlParent(m_xTable->CreateChildFrame())
444 , m_xRC_Tables(VclPtr<ORelationControl>::Create(m_xTableCtrlParent))
445 , m_pTableMap(_pTableMap)
446 , m_pParentDialog(_pParentDialog)
447 {
448 Size aPrefSize = m_xRC_Tables->GetOptimalSize();
449 m_xTable->set_size_request(aPrefSize.Width(), aPrefSize.Height());
450
451 m_xRC_Tables->SetController(this);
452 m_xRC_Tables->Init();
453
454 lateUIInit();
455
456 Link<weld::ComboBox&,void> aLink(LINK(this, OTableListBoxControl, OnTableChanged));
457 m_xLeftTable->connect_changed(aLink);
458 m_xRightTable->connect_changed(aLink);
459 }
460
462 {
463 m_xRC_Tables.disposeAndClear();
464 m_xTableCtrlParent->dispose();
465 m_xTableCtrlParent.clear();
466 }
467
469 {
470 OSL_ENSURE( !m_pTableMap->empty(), "OTableListBoxControl::fillListBoxes: no table window!");
471 OTableWindow* pInitialLeft = nullptr;
472 OTableWindow* pInitialRight = nullptr;
473
474 // Collect the names of all TabWins
475 for (auto const& elem : *m_pTableMap)
476 {
477 m_xLeftTable->append_text(elem.first);
478 m_xRightTable->append_text(elem.first);
479
480 if (!pInitialLeft)
481 {
482 pInitialLeft = elem.second;
483 m_strCurrentLeft = elem.first;
484 }
485 else if (!pInitialRight)
486 {
487 pInitialRight = elem.second;
488 m_strCurrentRight = elem.first;
489 }
490 }
491
492 if ( !pInitialRight )
493 {
494 pInitialRight = pInitialLeft;
496 }
497
498 // The corresponding Defs for my Controls
499 m_xRC_Tables->setWindowTables(pInitialLeft,pInitialRight);
500
501 // The table selected in a ComboBox must not be available in the other
502
503 if ( m_pTableMap->size() > 2 )
504 {
505 m_xLeftTable->remove_text(m_strCurrentRight);
506 m_xRightTable->remove_text(m_strCurrentLeft);
507 }
508
509 // Select the first one on the left side and on the right side,
510 // select the second one
511 m_xLeftTable->set_active_text(m_strCurrentLeft);
512 m_xRightTable->set_active_text(m_strCurrentRight);
513
514 m_xLeftTable->grab_focus();
515 }
516
517 IMPL_LINK(OTableListBoxControl, OnTableChanged, weld::ComboBox&, rListBox, void)
518 {
519 OUString strSelected(rListBox.get_active_text());
520 OTableWindow* pLeft = nullptr;
521 OTableWindow* pRight = nullptr;
522
523 // Special treatment: If there are only two tables, we need to switch the other one too when changing in a LB
524 if ( m_pTableMap->size() == 2 )
525 {
526 weld::ComboBox* pOther;
527 if (&rListBox == m_xLeftTable.get())
528 pOther = m_xRightTable.get();
529 else
530 pOther = m_xLeftTable.get();
531 pOther->set_active(1 - pOther->get_active());
532
533 OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin();
534 OTableWindow* pFirst = aIter->second;
535 ++aIter;
536 OTableWindow* pSecond = aIter->second;
537
538 if (m_xLeftTable->get_active_text() == pFirst->GetName())
539 {
540 pLeft = pFirst;
541 pRight = pSecond;
542 }
543 else
544 {
545 pLeft = pSecond;
546 pRight = pFirst;
547 }
548 }
549 else
550 {
551 // First we need the TableDef to the Table and with it the TabWin
552 OJoinTableView::OTableWindowMap::const_iterator aFind = m_pTableMap->find(strSelected);
553 OTableWindow* pLoop = nullptr;
554 if( aFind != m_pTableMap->end() )
555 pLoop = aFind->second;
556 OSL_ENSURE(pLoop != nullptr, "ORelationDialog::OnTableChanged: invalid ListBox entry!");
557 // We need to find strSelect, because we filled the ListBoxes with the table names with which we compare now
558 if (&rListBox == m_xLeftTable.get())
559 {
560 // Insert the previously selected Entry on the left side on the right side
561 m_xRightTable->append_text(m_strCurrentLeft);
562 // Remove the currently selected Entry
563 m_xRightTable->remove_text(strSelected);
564 m_strCurrentLeft = strSelected;
565
566 pLeft = pLoop;
567
568 OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->find(m_xRightTable->get_active_text());
569 OSL_ENSURE( aIter != m_pTableMap->end(), "Invalid name");
570 if ( aIter != m_pTableMap->end() )
571 pRight = aIter->second;
572
573 m_xLeftTable->grab_focus();
574 }
575 else
576 {
577 // Insert the previously selected Entry on the right side on the left side
578 m_xLeftTable->append_text(m_strCurrentRight);
579 // Remove the currently selected Entry
580 m_xLeftTable->remove_text(strSelected);
581 m_strCurrentRight = strSelected;
582
583 pRight = pLoop;
584 OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->find(m_xLeftTable->get_active_text());
585 OSL_ENSURE( aIter != m_pTableMap->end(), "Invalid name");
586 if ( aIter != m_pTableMap->end() )
587 pLeft = aIter->second;
588 }
589 }
590
591 rListBox.grab_focus();
592
593 m_xRC_Tables->setWindowTables(pLeft,pRight);
594
595 NotifyCellChange();
596 }
597
599 {
600 // Enable/disable the OK button, depending on having a valid situation
601 TTableConnectionData::value_type pConnData = m_xRC_Tables->getData();
602 const OConnectionLineDataVec& rLines = pConnData->GetConnLineDataList();
603 bool bValid = !rLines.empty();
604 if (bValid)
605 {
606 for (auto const& line : rLines)
607 {
608 bValid = ! (line->GetSourceFieldName().isEmpty() || line->GetDestFieldName().isEmpty());
609 if (!bValid)
610 break;
611 }
612 }
613 m_pParentDialog->setValid(bValid);
614
615 m_xRC_Tables->DeactivateCell();
616 for (auto const& elem : m_xRC_Tables->m_ops)
617 {
618 switch(elem.first)
619 {
621 m_xRC_Tables->RowRemoved(elem.second.first, elem.second.second - elem.second.first);
622 break;
624 m_xRC_Tables->RowInserted(elem.second.first, elem.second.second - elem.second.first);
625 break;
627 for(OConnectionLineDataVec::size_type j = elem.second.first; j < elem.second.second; ++j)
628 m_xRC_Tables->RowModified(j);
629 break;
630 }
631 }
632 m_xRC_Tables->ActivateCell();
633 m_xRC_Tables->m_ops.clear();
634 }
635
636 static void fillEntryAndDisable(weld::ComboBox& _rListBox,const OUString& _sEntry)
637 {
638 _rListBox.append_text(_sEntry);
639 _rListBox.set_active(0);
640 _rListBox.set_sensitive(false);
641 }
642
643 void OTableListBoxControl::fillAndDisable(const TTableConnectionData::value_type& _pConnectionData)
644 {
645 fillEntryAndDisable(*m_xLeftTable, _pConnectionData->getReferencingTable()->GetWinName());
646 fillEntryAndDisable(*m_xRightTable, _pConnectionData->getReferencedTable()->GetWinName());
647 }
648
649 void OTableListBoxControl::Init(const TTableConnectionData::value_type& _pConnData)
650 {
651 m_xRC_Tables->Init(_pConnData);
652 }
653
655 {
656 m_xRC_Tables->Show();
657 lateInit();
658 }
659
661 {
662 m_xRC_Tables->lateInit();
663 }
664
666 {
667 m_xLeftTable->set_sensitive(false);
668 m_xRightTable->set_sensitive(false);
669 m_xRC_Tables->Disable();
670 }
671
673 {
674 m_xRC_Tables->Invalidate();
675 }
676
678 {
679 m_xRC_Tables->SaveModified();
680 }
681
682 TTableWindowData::value_type const & OTableListBoxControl::getReferencingTable() const
683 {
684 return m_xRC_Tables->getData()->getReferencingTable();
685 }
686
688 {
689 if ( !_bEnable )
690 m_xRC_Tables->PostUserEvent(LINK(m_xRC_Tables, ORelationControl, AsynchDeactivate));
691 m_xRC_Tables->Enable(_bEnable);
692 }
693}
694
695/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sName
#define SOURCE_COLUMN
#define DEST_COLUMN
constexpr sal_Int32 BROWSER_ENDOFSELECTION
BrowserMode
void RowRemoved(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true)
BrowserDataWin & GetDataWindow() const
void InsertDataColumn(sal_uInt16 nItemId, const OUString &rText, tools::Long nSize, HeaderBarItemBits nBits=HeaderBarItemBits::STDSTYLE, sal_uInt16 nPos=HEADERBAR_APPEND)
bool GoToRow(sal_Int32 nRow)
sal_Int32 GetCurRow() const
sal_uInt16 ColCount() const
void SetColumnTitle(sal_uInt16 nColumnId, const OUString &rTitle)
void SetMode(BrowserMode nMode)
void SetColumnWidth(sal_uInt16 nColumnId, sal_uLong nWidth)
sal_uInt16 GetCurColumnId() const
void RowInserted(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true, bool bKeepSelection=false)
virtual sal_Int32 GetRowCount() const override
NotifyEventType GetType() const
bool IsClipRegion() const
void SetClipRegion()
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual void setValid(bool _bValid)=0
setValid set the valid inside, can be used for OK buttons
virtual void notifyConnectionChange()=0
notifyConnectionChange is callback which is called when the table selection has changed and a new con...
the class OConnectionLineData contains the data of a connection e.g.
std::map< OUString, VclPtr< OTableWindow > > OTableWindowMap
OTableConnection * GetTabConn(const OTableWindow *pLhs, const OTableWindow *pRhs, bool _bSuppressCrossOrNaturalJoin=false) const
virtual bool SaveModified() override
TTableConnectionData::value_type m_pConnData
void setWindowTables(const OTableWindow *_pSource, const OTableWindow *_pDest)
searches for a connection between these two tables
virtual void Resize() override
virtual bool IsTabAllowed(bool bForward) const override
void SetController(OTableListBoxControl *pController)
virtual Size GetOptimalSize() const override
const TTableConnectionData::value_type & getData() const
allows to access the connection data from outside
virtual void CellModified() override
void fillListBox(const Reference< XPropertySet > &_xDest)
DECL_LINK(AsynchActivate, void *, void)
sal_uInt16 getColumnIdent(sal_uInt16 _nColId) const
returns the column id for the editbrowsebox
virtual ~ORelationControl() override
DECL_LINK(AsynchDeactivate, void *, void)
VclPtr< ::svt::ListBoxControl > m_pListCell
virtual ::svt::CellController * GetController(sal_Int32 nRow, sal_uInt16 nCol) override
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColId) const override
std::vector< pair< opcode, pair< OConnectionLineDataVec::size_type, OConnectionLineDataVec::size_type > > > ops_type
virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override
ORelationControl(const css::uno::Reference< css::awt::XWindow > &rParent)
virtual void InitController(::svt::CellControllerRef &rController, sal_Int32 nRow, sal_uInt16 nCol) override
Reference< XPropertySet > m_xDestDef
OTableListBoxControl * m_pBoxControl
virtual void dispose() override
Reference< XPropertySet > m_xSourceDef
virtual bool SeekRow(sal_Int32 nRow) override
virtual bool PreNotify(NotifyEvent &rNEvt) override
const TTableConnectionData::value_type & GetData() const
IRelationControlInterface * getContainer() const
getContainer returns the container interface
OTableListBoxControl(weld::Builder *_pParent, const OJoinTableView::OTableWindowMap *_pTableMap, IRelationControlInterface *_pParentDialog)
std::unique_ptr< weld::Container > m_xTable
std::unique_ptr< weld::ComboBox > m_xRightTable
std::unique_ptr< weld::ComboBox > m_xLeftTable
VclPtr< ORelationControl > m_xRC_Tables
void fillAndDisable(const TTableConnectionData::value_type &_pConnectionData)
fillAndDisable fill the listboxes only with one entry and then disable them
css::uno::Reference< css::awt::XWindow > m_xTableCtrlParent
const OJoinTableView::OTableWindowMap * m_pTableMap
void NotifyCellChange()
NotifyCellChange notifies the browse control that the connection data has changed.
TTableWindowData::value_type const & getReferencingTable() const
IRelationControlInterface * m_pParentDialog
void fillListBoxes()
fillListBoxes fills the list boxes with the table windows
void enableRelation(bool _bEnable)
enables the relation control
void Init(const TTableConnectionData::value_type &_pConnData)
Init is a call through to the control inside this one.
OJoinTableView * getTableView()
const TTableWindowData::value_type & GetData() const
virtual OUString GetName() const =0
returns the name which should be used when displaying join or relations
css::uno::Reference< css::beans::XPropertySet > GetTable() const
virtual bool IsTabAllowed(bool bForward) const
bool IsEditing() const
virtual void DeactivateCell(bool bUpdate=true)
virtual void Resize() override
virtual bool PreNotify(NotifyEvent &rNEvt) override
bool ControlHasFocus() const
virtual void Init()
virtual void dispose() override
virtual void CellModified()
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
virtual OUString get_active_text() const=0
virtual void clear()=0
virtual void set_active(int pos)=0
void append_text(const OUString &rStr)
void insert_text(int pos, const OUString &rStr)
virtual int get_active() const=0
void set_active_text(const OUString &rStr)
virtual void set_help_id(const OUString &rName)=0
virtual void set_sensitive(bool sensitive)=0
#define DBG_UNHANDLED_EXCEPTION(...)
EditBrowseBoxFlags
constexpr OUStringLiteral HID_RELATIONDIALOG_LEFTFIELDCELL
Definition: helpids.h:64
constexpr OUStringLiteral HID_RELATIONDIALOG_RIGHTFIELDCELL
Definition: helpids.h:65
@ Exception
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
std::vector< OConnectionLineDataRef > OConnectionLineDataVec
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
static void fillEntryAndDisable(weld::ComboBox &_rListBox, const OUString &_sEntry)
::svt::EditBrowseBox ORelationControl_Base
line
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
long Long
sal_Int16 nId
WinBits const WB_BORDER
WinBits const WB_TABSTOP