LibreOffice Module reportdesign (master) 1
GroupsSorting.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#include <GroupsSorting.hxx>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/container/XContainerListener.hpp>
24#include <com/sun/star/report/GroupOn.hpp>
25#include <com/sun/star/sdbc/DataType.hpp>
26
27#include <strings.hrc>
28#include <rptui_slotid.hrc>
29#include <core_resource.hxx>
30#include <helpids.h>
31#include "GroupExchange.hxx"
32#include <UITools.hxx>
33#include <UndoActions.hxx>
34#include <strings.hxx>
35#include <ReportController.hxx>
36#include <ColumnInfo.hxx>
37
40#include <vcl/commandevent.hxx>
41#include <vcl/svapp.hxx>
43
44#include <algorithm>
45
46#define HANDLE_ID 0
47#define FIELD_EXPRESSION 1
48#define GROUPS_START_LEN 5
49#define NO_GROUP -1
50
51namespace rptui
52{
53using namespace ::com::sun::star;
54using namespace svt;
55using namespace ::comphelper;
56
57 static void lcl_addToList_throw( weld::ComboBox& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns )
58 {
59 const uno::Sequence< OUString > aEntries = i_xColumns->getElementNames();
60 for ( const OUString& rEntry : aEntries )
61 {
62 uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(rEntry),uno::UNO_QUERY_THROW);
63 OUString sLabel;
64 if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
65 xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
66 o_aColumnList.emplace_back(rEntry,sLabel );
67 if ( !sLabel.isEmpty() )
68 _rListBox.append_text( sLabel );
69 else
70 _rListBox.append_text( rEntry );
71 }
72 }
73
77class OFieldExpressionControl;
78
79namespace {
80
81class OFieldExpressionControlContainerListener : public ::cppu::WeakImplHelper< container::XContainerListener >
82{
84public:
85 explicit OFieldExpressionControlContainerListener(OFieldExpressionControl* pParent) : mpParent(pParent) {}
86
87 // XEventListener
88 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
89 // XContainerListener
90 virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override;
91 virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override;
92 virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override;
93};
94
95}
96
98{
99 ::osl::Mutex m_aMutex;
100 ::std::vector<sal_Int32> m_aGroupPositions;
101 ::std::vector<ColumnInfo> m_aColumnInfo;
103 sal_Int32 m_nDataPos;
104 sal_Int32 m_nCurrentPos;
109
110public:
111 OFieldExpressionControl(OGroupsSortingDialog* pParentDialog, const css::uno::Reference<css::awt::XWindow> &rParent);
112 virtual ~OFieldExpressionControl() override;
113 virtual void dispose() override;
114
115 // XContainerListener
117 void elementInserted(const css::container::ContainerEvent& rEvent);
119 void elementRemoved(const css::container::ContainerEvent& rEvent);
120
121 virtual Size GetOptimalSize() const override;
122
123 void fillColumns(const uno::Reference< container::XNameAccess>& _xColumns);
124 void lateInit();
125 bool IsDeleteAllowed( ) const;
126 void DeleteRows();
127
128 sal_Int32 getGroupPosition(sal_Int32 _nRow) const { return _nRow != BROWSER_ENDOFSELECTION ? m_aGroupPositions[_nRow] : sal_Int32(NO_GROUP); }
129
132 uno::Sequence<uno::Any> fillSelectedGroups();
133
136 void moveGroups(const uno::Sequence<uno::Any>& _aGroups,sal_Int32 _nRow,bool _bSelect = true);
137
138 virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol) override;
139 using ::svt::EditBrowseBox::GetRowCount;
140protected:
141 virtual bool IsTabAllowed(bool bForward) const override;
142
143 virtual void InitController( ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol ) override;
144 virtual ::svt::CellController* GetController( sal_Int32 nRow, sal_uInt16 nCol ) override;
145 virtual void PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId ) const override;
146 virtual bool SeekRow( sal_Int32 nRow ) override;
147 virtual bool SaveModified() override;
148 virtual OUString GetCellText( sal_Int32 nRow, sal_uInt16 nColId ) const override;
149 virtual RowStatus GetRowStatus(sal_Int32 nRow) const override;
150
151 virtual void KeyInput(const KeyEvent& rEvt) override;
152 virtual void Command( const CommandEvent& rEvt ) override;
153
154 // D&D
155 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
156 virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ) override;
157 virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) override;
158
161
162private:
163
164 DECL_LINK( CBChangeHdl, weld::ComboBox&, void);
165
166public:
167 DECL_LINK( DelayedDelete, void*, void );
168
169};
170
171
172void OFieldExpressionControlContainerListener::disposing(const css::lang::EventObject& )
173{}
174
175void OFieldExpressionControlContainerListener::elementInserted(const css::container::ContainerEvent& rEvent)
176{ mpParent->elementInserted(rEvent); }
177
178void OFieldExpressionControlContainerListener::elementReplaced(const css::container::ContainerEvent& )
179{}
180
181void OFieldExpressionControlContainerListener::elementRemoved(const css::container::ContainerEvent& rEvent)
182{ mpParent->elementRemoved(rEvent); }
183
184OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* pParentDialog, const css::uno::Reference<css::awt::XWindow> &rParent)
188 ,m_aGroupPositions(GROUPS_START_LEN,-1)
189 ,m_pComboCell(nullptr)
190 ,m_nDataPos(-1)
191 ,m_nCurrentPos(-1)
192 ,m_nDeleteEvent(nullptr)
193 ,m_pParent(pParentDialog)
194 ,m_bIgnoreEvent(false)
195 ,aContainerListener(new OFieldExpressionControlContainerListener(this))
196{
197 SetBorderStyle(WindowBorderStyle::MONO);
198}
199
201{
202 disposeOnce();
203}
204
206{
207 uno::Reference< report::XGroups > xGroups = m_pParent->getGroups();
208 xGroups->removeContainerListener(aContainerListener);
209
210 // delete events from queue
211 if( m_nDeleteEvent )
213
214 m_pComboCell.disposeAndClear();
215 m_pParent = nullptr;
217}
218
220{
221 uno::Sequence<uno::Any> aList;
222 ::std::vector<uno::Any> vClipboardList;
223 vClipboardList.reserve(GetSelectRowCount());
224
225 uno::Reference<report::XGroups> xGroups = m_pParent->getGroups();
226 sal_Int32 nCount = xGroups->getCount();
227 if ( nCount >= 1 )
228 {
230 {
231 try
232 {
234 {
235 uno::Reference< report::XGroup> xOrgGroup(xGroups->getByIndex(m_aGroupPositions[nIndex]),uno::UNO_QUERY);
236 /*uno::Reference< report::XGroup> xCopy = xGroups->createGroup();
237 ::comphelper::copyProperties(xOrgGroup.get(),xCopy.get());*/
238 vClipboardList.push_back( uno::Any(xOrgGroup) );
239 }
240 }
241 catch(uno::Exception&)
242 {
243 OSL_FAIL("Can not access group!");
244 }
245 }
246 if ( !vClipboardList.empty() )
247 aList = uno::Sequence< uno::Any >(vClipboardList.data(), vClipboardList.size());
248 }
249 return aList;
250}
251
252void OFieldExpressionControl::StartDrag( sal_Int8 /*_nAction*/ , const Point& /*_rPosPixel*/ )
253{
254 if ( m_pParent && !m_pParent->isReadOnly( ) )
255 {
256 uno::Sequence<uno::Any> aClipboardList = fillSelectedGroups();
257
258 if( aClipboardList.hasElements() )
259 {
261 pData->StartDrag(this, DND_ACTION_MOVE );
262 }
263 }
264}
265
267{
268 sal_Int8 nAction = DND_ACTION_NONE;
269 if ( IsEditing() )
270 {
271 weld::ComboBox& rComboBox = m_pComboCell->get_widget();
272 sal_Int32 nPos = rComboBox.get_active();
273 if (nPos != -1 || !rComboBox.get_active_text().isEmpty())
274 SaveModified();
276 }
278 {
279 nAction = DND_ACTION_MOVE;
280 }
281 return nAction;
282}
283
285{
286 sal_Int8 nAction = DND_ACTION_NONE;
288 {
289 sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false);
291
292 TransferableDataHelper aDropped( rEvt.maDropEvent.Transferable );
293 uno::Any aDrop = aDropped.GetAny(OGroupExchange::getReportGroupId(), OUString());
294 uno::Sequence< uno::Any > aGroups;
295 aDrop >>= aGroups;
296 if ( aGroups.hasElements() )
297 {
298 moveGroups(aGroups,nRow);
299 nAction = DND_ACTION_MOVE;
300 }
301 }
302 return nAction;
303}
304
305void OFieldExpressionControl::moveGroups(const uno::Sequence<uno::Any>& _aGroups,sal_Int32 _nRow,bool _bSelect)
306{
307 if ( !_aGroups.hasElements() )
308 return;
309
310 m_bIgnoreEvent = true;
311 {
312 sal_Int32 nRow = _nRow;
313 const OUString sUndoAction(RptResId(RID_STR_UNDO_MOVE_GROUP));
314 const UndoContext aUndoContext( m_pParent->m_pController->getUndoManager(), sUndoAction );
315
316 uno::Reference< report::XGroups> xGroups = m_pParent->getGroups();
317 for(const uno::Any& rGroup : _aGroups)
318 {
319 uno::Reference< report::XGroup> xGroup(rGroup,uno::UNO_QUERY);
320 if ( xGroup.is() )
321 {
322 uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue(
323 PROPERTY_GROUP, xGroup) };
324 // we use this way to create undo actions
325 m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs);
326 aArgs.realloc(2);
327 auto pArgs = aArgs.getArray();
328 if ( nRow > xGroups->getCount() )
329 nRow = xGroups->getCount();
330 if ( _bSelect )
331 SelectRow(nRow);
332 pArgs[1].Name = PROPERTY_POSITIONY;
333 pArgs[1].Value <<= nRow;
334 m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
335 ++nRow;
336 }
337 }
338 }
339 m_bIgnoreEvent = false;
340 Invalidate();
341}
342
343void OFieldExpressionControl::fillColumns(const uno::Reference< container::XNameAccess>& _xColumns)
344{
345 weld::ComboBox& rComboBox = m_pComboCell->get_widget();
346 rComboBox.clear();
347 if ( _xColumns.is() )
348 lcl_addToList_throw(rComboBox, m_aColumnInfo, _xColumns);
349}
350
352{
353 uno::Reference< report::XGroups > xGroups = m_pParent->getGroups();
354 sal_Int32 nGroupsCount = xGroups->getCount();
355 m_aGroupPositions.resize(::std::max<sal_Int32>(nGroupsCount,sal_Int32(GROUPS_START_LEN)),NO_GROUP);
356 ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
357 for (sal_Int32 i = 0; i < nGroupsCount; ++i,++aIter)
358 *aIter = i;
359
360 if ( ColCount() == 0 )
361 {
362 vcl::Font aFont( GetDataWindow().GetFont() );
363 aFont.SetWeight( WEIGHT_NORMAL );
364 GetDataWindow().SetFont( aFont );
365
366 // Set font of the headline to light
367 aFont = GetFont();
368 aFont.SetWeight( WEIGHT_LIGHT );
369 SetFont(aFont);
370
371 InsertHandleColumn(static_cast<sal_uInt16>(GetTextWidth(OUString('0')) * 4)/*, sal_True */);
372 InsertDataColumn( FIELD_EXPRESSION, RptResId(STR_RPT_EXPRESSION), 100);
373
375 weld::ComboBox& rComboBox = m_pComboCell->get_widget();
376 rComboBox.connect_changed(LINK(this,OFieldExpressionControl,CBChangeHdl));
378
379 m_pComboCell->SetFocusInHdl(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusGot));
380
381
382 // set browse mode
383 BrowserMode nMode(BrowserMode::COLUMNSELECTION | BrowserMode::MULTISELECTION | BrowserMode::KEEPHIGHLIGHT |
384 BrowserMode::HLINES | BrowserMode::VLINES | BrowserMode::AUTOSIZE_LASTCOL | BrowserMode::AUTO_VSCROLL | BrowserMode::AUTO_HSCROLL);
385 if( m_pParent->isReadOnly() )
386 nMode |= BrowserMode::HIDECURSOR;
387 SetMode(nMode);
388 xGroups->addContainerListener(aContainerListener);
389 }
390 else
391 // not the first call
393
395}
396
398{
399 SaveModified();
400}
401
402bool OFieldExpressionControl::IsTabAllowed(bool /*bForward*/) const
403{
404 return false;
405}
406
408{
409 sal_Int32 nRow = GetCurRow();
410 if ( nRow == BROWSER_ENDOFSELECTION )
411 return true;
412
413 try
414 {
415 bool bAppend = false;
416 uno::Reference< report::XGroup> xGroup;
417 if ( m_aGroupPositions[nRow] == NO_GROUP )
418 {
419 bAppend = true;
420 OUString sUndoAction(RptResId(RID_STR_UNDO_APPEND_GROUP));
421 m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
422 xGroup = m_pParent->getGroups()->createGroup();
423 xGroup->setHeaderOn(true);
424
425 // find position where to insert the new group
426 sal_Int32 nGroupPos = 0;
427 ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
428 ::std::vector<sal_Int32>::const_iterator aEnd = m_aGroupPositions.begin() + nRow;
429 for(;aIter != aEnd;++aIter)
430 if ( *aIter != NO_GROUP )
431 nGroupPos = *aIter + 1;
432 uno::Sequence< beans::PropertyValue > aArgs{
435 };
436 m_bIgnoreEvent = true;
437 m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
438 m_bIgnoreEvent = false;
439 OSL_ENSURE(*aIter == NO_GROUP ,"Illegal iterator!");
440 *aIter++ = nGroupPos;
441
442 aEnd = m_aGroupPositions.end();
443 for(;aIter != aEnd;++aIter)
444 if ( *aIter != NO_GROUP )
445 ++*aIter;
446 }
447 else
448 xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
449 if ( xGroup.is() )
450 {
451 weld::ComboBox& rComboBox = m_pComboCell->get_widget();
452 sal_Int32 nPos = rComboBox.get_active();
453 OUString sExpression;
454 if (nPos == -1)
455 sExpression = rComboBox.get_active_text();
456 else
457 {
458 sExpression = m_aColumnInfo[nPos].sColumnName;
459 }
460 xGroup->setExpression( sExpression );
461
463
464 if ( bAppend )
466 }
467
468 if (Controller().is())
469 Controller()->SaveValue();
470 if ( GetRowCount() == m_pParent->getGroups()->getCount() )
471 {
473 m_aGroupPositions.push_back(NO_GROUP);
474 }
475
476 GoToRow(nRow);
477 m_pParent->DisplayData(nRow);
478 }
479 catch(uno::Exception&)
480 {
481 TOOLS_WARN_EXCEPTION( "reportdesign", "OFieldExpressionControl::SaveModified");
482 }
483
484 return true;
485}
486
487OUString OFieldExpressionControl::GetCellText( sal_Int32 nRow, sal_uInt16 /*nColId*/ ) const
488{
489 OUString sText;
490 if ( nRow != BROWSER_ENDOFSELECTION && m_aGroupPositions[nRow] != NO_GROUP )
491 {
492 try
493 {
494 uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
495 OUString sExpression = xGroup->getExpression();
496
497 auto aIter = std::find_if(m_aColumnInfo.begin(), m_aColumnInfo.end(),
498 [&sExpression](const ColumnInfo& rColumnInfo) { return rColumnInfo.sColumnName == sExpression; });
499 if (aIter != m_aColumnInfo.end() && !aIter->sLabel.isEmpty())
500 sExpression = aIter->sLabel;
501 sText = sExpression;
502 }
503 catch (const uno::Exception&)
504 {
505 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while getting expression value from the group");
506 }
507 }
508 return sText;
509}
510
511void OFieldExpressionControl::InitController( CellControllerRef& /*rController*/, sal_Int32 nRow, sal_uInt16 nColumnId )
512{
513 weld::ComboBox& rComboBox = m_pComboCell->get_widget();
514 rComboBox.set_entry_text(GetCellText(nRow, nColumnId));
515}
516
517bool OFieldExpressionControl::CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol)
518{
519
520 if (!EditBrowseBox::CursorMoving(nNewRow, nNewCol))
521 return false;
522 m_nDataPos = nNewRow;
523 tools::Long nOldDataPos = GetCurRow();
525 InvalidateStatusCell( nOldDataPos );
526
527 m_pParent->SaveData( nOldDataPos );
529 return true;
530}
531
532CellController* OFieldExpressionControl::GetController( sal_Int32 /*nRow*/, sal_uInt16 /*nColumnId*/ )
533{
536 return pCellController;
537}
538
539bool OFieldExpressionControl::SeekRow( sal_Int32 _nRow )
540{
541 // the basis class needs the call, because that's how the class knows which line will be painted
543 m_nCurrentPos = _nRow;
544 return true;
545}
546
547void OFieldExpressionControl::PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const
548{
549 OUString aText =GetCellText( m_nCurrentPos, nColumnId );
550
551 Point aPos( rRect.TopLeft() );
552 Size aTextSize( GetDataWindow().GetTextWidth( aText ), GetDataWindow().GetTextHeight() );
553
554 if( aPos.X() < rRect.Left() || aPos.X() + aTextSize.Width() > rRect.Right() ||
555 aPos.Y() < rRect.Top() || aPos.Y() + aTextSize.Height() > rRect.Bottom() )
556 rDev.SetClipRegion(vcl::Region(rRect));
557
558 rDev.DrawText( aPos, aText );
559
560 if( rDev.IsClipRegion() )
561 rDev.SetClipRegion();
562}
563
565{
566 if (nRow >= 0 && nRow == m_nDataPos)
568 if ( nRow != BROWSER_ENDOFSELECTION && nRow < static_cast<tools::Long>(m_aGroupPositions.size()) && m_aGroupPositions[nRow] != NO_GROUP )
569 {
570 try
571 {
572 uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
573 return (xGroup->getHeaderOn() || xGroup->getFooterOn())? EditBrowseBox::HEADERFOOTER : EditBrowseBox::CLEAN;
574 }
575 catch(uno::Exception&)
576 {
577 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while try to get a group!");
578 }
579 }
581}
582
583// XContainerListener
584
585void OFieldExpressionControl::elementInserted(const container::ContainerEvent& evt)
586{
587 if ( m_bIgnoreEvent )
588 return;
589 SolarMutexGuard aSolarGuard;
590 ::osl::MutexGuard aGuard( m_aMutex );
591 sal_Int32 nGroupPos = 0;
592 if ( !(evt.Accessor >>= nGroupPos) )
593 return;
594
595 if ( nGroupPos >= GetRowCount() )
596 {
597 sal_Int32 nAddedRows = nGroupPos - GetRowCount();
598 RowInserted(nAddedRows);
599 for (sal_Int32 i = 0; i < nAddedRows; ++i)
600 m_aGroupPositions.push_back(NO_GROUP);
601 m_aGroupPositions[nGroupPos] = nGroupPos;
602 }
603 else
604 {
605 ::std::vector<sal_Int32>::iterator aFind = m_aGroupPositions.begin()+ nGroupPos;
606 if ( aFind == m_aGroupPositions.end() )
607 aFind = ::std::find(m_aGroupPositions.begin(),m_aGroupPositions.end(),NO_GROUP);
608
609 if ( aFind != m_aGroupPositions.end() )
610 {
611 if ( *aFind != NO_GROUP )
612 aFind = m_aGroupPositions.insert(aFind,nGroupPos);
613 else
614 *aFind = nGroupPos;
615
616 ::std::vector<sal_Int32>::const_iterator aEnd = m_aGroupPositions.end();
617 for(++aFind;aFind != aEnd;++aFind)
618 if ( *aFind != NO_GROUP )
619 ++*aFind;
620 }
621 }
622 Invalidate();
623}
624
625void OFieldExpressionControl::elementRemoved(const container::ContainerEvent& evt)
626{
627 SolarMutexGuard aSolarGuard;
628 ::osl::MutexGuard aGuard( m_aMutex );
629
630 if ( m_bIgnoreEvent )
631 return;
632
633 sal_Int32 nGroupPos = 0;
634 if ( !(evt.Accessor >>= nGroupPos) )
635 return;
636
637 std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end();
638 std::vector<sal_Int32>::iterator aFind = std::find(m_aGroupPositions.begin(), aEnd, nGroupPos);
639 if (aFind != aEnd)
640 {
641 *aFind = NO_GROUP;
642 for(++aFind;aFind != aEnd;++aFind)
643 if ( *aFind != NO_GROUP )
644 --*aFind;
645 Invalidate();
646 }
647}
648
650{
651 return !m_pParent->isReadOnly() && GetSelectRowCount() > 0;
652}
653
655{
656 if (IsDeleteAllowed())
657 {
658 if (rEvt.GetKeyCode().GetCode() == KEY_DELETE && // Delete rows
659 !rEvt.GetKeyCode().IsShift() &&
660 !rEvt.GetKeyCode().IsMod1())
661 {
662 DeleteRows();
663 return;
664 }
665 }
667}
668
670{
671 switch (rEvt.GetCommand())
672 {
673 case CommandEventId::ContextMenu:
674 {
675 if (!rEvt.IsMouseEvent())
676 {
678 return;
679 }
680
681 sal_uInt16 nColId = GetColumnId(GetColumnAtXPosPixel(rEvt.GetMousePosPixel().X()));
682
683 if ( nColId == HANDLE_ID )
684 {
685 bool bEnable = false;
687 while( nIndex != SFX_ENDOFSELECTION && !bEnable )
688 {
690 bEnable = true;
692 }
693
694 ::tools::Rectangle aRect(rEvt.GetMousePosPixel(), Size(1, 1));
695 weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
696 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "modules/dbreport/ui/groupsortmenu.ui"));
697 std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu("menu"));
698 xContextMenu->set_sensitive("delete", IsDeleteAllowed() && bEnable);
699 if (!xContextMenu->popup_at_rect(pPopupParent, aRect).isEmpty())
700 {
701 if( m_nDeleteEvent )
703 m_nDeleteEvent = Application::PostUserEvent( LINK(this, OFieldExpressionControl, DelayedDelete), nullptr, true );
704 }
705 }
706 [[fallthrough]];
707 }
708 default:
710 }
711
712}
713
715{
716
717 bool bIsEditing = IsEditing();
718 if (bIsEditing)
719 {
721 }
724 {
725 nIndex = GetCurRow();
726 }
727 bool bFirstTime = true;
728
729 tools::Long nOldDataPos = nIndex;
730 m_bIgnoreEvent = true;
731 while( nIndex >= 0 )
732 {
734 {
735 if ( bFirstTime )
736 {
737 bFirstTime = false;
738 OUString sUndoAction(RptResId(RID_STR_UNDO_REMOVE_SELECTION));
739 m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
740 }
741
742 sal_Int32 nGroupPos = m_aGroupPositions[nIndex];
743 uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(nGroupPos);
744 uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue(
745 PROPERTY_GROUP, xGroup) };
746 // we use this way to create undo actions
747 m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs);
748
749 std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end();
750 std::vector<sal_Int32>::iterator aFind = std::find(m_aGroupPositions.begin(), aEnd, nGroupPos);
751 if (aFind != aEnd)
752 {
753 *aFind = NO_GROUP;
754 for(++aFind;aFind != aEnd;++aFind)
755 if ( *aFind != NO_GROUP )
756 --*aFind;
757 }
758 }
760 }
761
762 if ( !bFirstTime )
764
766 InvalidateStatusCell( nOldDataPos );
768 ActivateCell();
770 m_bIgnoreEvent = false;
771 Invalidate();
772}
773
774IMPL_LINK_NOARG( OFieldExpressionControl, DelayedDelete, void*, void )
775{
776 m_nDeleteEvent = nullptr;
777 DeleteRows();
778}
779
781{
782 return LogicToPixel(Size(106, 75), MapMode(MapUnit::MapAppFont));
783}
784
786 OReportController* pController)
787 : GenericDialogController(pParent, "modules/dbreport/ui/floatingsort.ui", "FloatingSort")
789 , m_pController(pController)
790 , m_xGroups(m_pController->getReportDefinition()->getGroups())
792 , m_xToolBox(m_xBuilder->weld_toolbar("toolbox"))
793 , m_xProperties(m_xBuilder->weld_widget("properties"))
794 , m_xOrderLst(m_xBuilder->weld_combo_box("sorting"))
795 , m_xHeaderLst(m_xBuilder->weld_combo_box("header"))
796 , m_xFooterLst(m_xBuilder->weld_combo_box("footer"))
797 , m_xGroupOnLst(m_xBuilder->weld_combo_box("group"))
798 , m_xGroupIntervalEd(m_xBuilder->weld_spin_button("interval"))
799 , m_xKeepTogetherLst(m_xBuilder->weld_combo_box("keep"))
800 , m_xHelpWindow(m_xBuilder->weld_label("helptext"))
801 , m_xBox(m_xBuilder->weld_container("box"))
802 , m_xTableCtrlParent(m_xBox->CreateChildFrame())
803 , m_xFieldExpression(VclPtr<OFieldExpressionControl>::Create(this, m_xTableCtrlParent))
804{
805 m_xHelpWindow->set_size_request(-1, m_xHelpWindow->get_text_height() * 4);
806 m_xFieldExpression->set_hexpand(true);
807 m_xFieldExpression->set_vexpand(true);
808
809 weld::Widget* pControlsLst[] = { m_xHeaderLst.get(), m_xFooterLst.get(), m_xGroupOnLst.get(),
810 m_xKeepTogetherLst.get(), m_xOrderLst.get(), m_xGroupIntervalEd.get() };
811 for (weld::Widget* i : pControlsLst)
812 {
813 i->connect_focus_in(LINK(this, OGroupsSortingDialog, OnWidgetFocusGot));
814 i->show();
815 }
816
817 m_xGroupIntervalEd->connect_focus_out(LINK(this, OGroupsSortingDialog, OnWidgetFocusLost));
818
819 for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst) - 1; ++i)
820 dynamic_cast<weld::ComboBox&>(*pControlsLst[i]).connect_changed(LINK(this,OGroupsSortingDialog,LBChangeHdl));
821
822 m_pReportListener = new OPropertyChangeMultiplexer(this, m_pController->getReportDefinition());
823 m_pReportListener->addProperty(PROPERTY_COMMAND);
824 m_pReportListener->addProperty(PROPERTY_COMMANDTYPE);
825
826 m_xFieldExpression->lateInit();
827 fillColumns();
828 Size aPrefSize = m_xFieldExpression->GetOptimalSize();
829 m_xBox->set_size_request(aPrefSize.Width(), aPrefSize.Height());
830 m_xFieldExpression->Show();
831
832 m_xToolBox->connect_clicked(LINK(this, OGroupsSortingDialog, OnFormatAction));
833
834 checkButtons(0);
835}
836
838{
839 m_pReportListener->dispose();
840 if ( m_pCurrentGroupListener.is() )
841 m_pCurrentGroupListener->dispose();
842 m_xFieldExpression.disposeAndClear();
843 m_xTableCtrlParent->dispose();
844 m_xTableCtrlParent.clear();
845}
846
848{
849 m_xFieldExpression->Invalidate();
850 sal_Int32 nCurRow = m_xFieldExpression->GetCurRow();
851 m_xFieldExpression->DeactivateCell();
852 m_xFieldExpression->ActivateCell(nCurRow, m_xFieldExpression->GetCurColumnId());
853 DisplayData(nCurRow);
854}
855
857{
858 const sal_Int32 nGroupPos = m_xFieldExpression->getGroupPosition(_nRow);
859 const bool bEmpty = nGroupPos == NO_GROUP;
860 m_xProperties->set_sensitive(!bEmpty);
861
862 checkButtons(_nRow);
863
864 if ( m_pCurrentGroupListener.is() )
865 m_pCurrentGroupListener->dispose();
866 m_pCurrentGroupListener = nullptr;
867 if (!bEmpty)
868 {
869 uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos);
870
874
875 displayGroup(xGroup);
876 }
877}
878
879void OGroupsSortingDialog::SaveData( sal_Int32 _nRow)
880{
881 sal_Int32 nGroupPos = m_xFieldExpression->getGroupPosition(_nRow);
882 if ( nGroupPos == NO_GROUP )
883 return;
884
885 uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos);
886 if (m_xHeaderLst->get_value_changed_from_saved())
887 xGroup->setHeaderOn( m_xHeaderLst->get_active() == 0 );
888 if (m_xFooterLst->get_value_changed_from_saved())
889 xGroup->setFooterOn( m_xFooterLst->get_active() == 0 );
890 if (m_xKeepTogetherLst->get_value_changed_from_saved())
891 xGroup->setKeepTogether( m_xKeepTogetherLst->get_active() );
892 if (m_xGroupOnLst->get_value_changed_from_saved())
893 {
894 auto nGroupOn = m_xGroupOnLst->get_active_id().toInt32();
895 xGroup->setGroupOn( nGroupOn );
896 }
897 if (m_xGroupIntervalEd->get_value_changed_from_saved())
898 {
899 xGroup->setGroupInterval(m_xGroupIntervalEd->get_value());
900 m_xGroupIntervalEd->save_value();
901 }
902 if ( m_xOrderLst->get_value_changed_from_saved() )
903 xGroup->setSortAscending( m_xOrderLst->get_active() == 0 );
904
905 weld::ComboBox* pControls[] = { m_xHeaderLst.get(), m_xFooterLst.get(), m_xGroupOnLst.get(),
906 m_xKeepTogetherLst.get(), m_xOrderLst.get() };
907 for (weld::ComboBox* pControl : pControls)
908 pControl->save_value();
909}
910
911sal_Int32 OGroupsSortingDialog::getColumnDataType(const OUString& _sColumnName)
912{
913 sal_Int32 nDataType = sdbc::DataType::VARCHAR;
914 try
915 {
916 if ( !m_xColumns.is() )
917 fillColumns();
918 if ( m_xColumns.is() && m_xColumns->hasByName(_sColumnName) )
919 {
920 uno::Reference< beans::XPropertySet> xColumn(m_xColumns->getByName(_sColumnName),uno::UNO_QUERY);
921 if ( xColumn.is() )
922 xColumn->getPropertyValue(PROPERTY_TYPE) >>= nDataType;
923 }
924 }
925 catch(uno::Exception&)
926 {
927 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while getting the type of a column");
928 }
929
930 return nDataType;
931}
932
934{
935 m_xHelpWindow->set_label(RptResId(STR_RPT_HELP_FIELD));
936}
937
938IMPL_LINK(OGroupsSortingDialog, OnWidgetFocusGot, weld::Widget&, rControl, void )
939{
940 const std::pair<weld::Widget*, TranslateId> pControls[] = {
941 { m_xHeaderLst.get(), STR_RPT_HELP_HEADER },
942 { m_xFooterLst.get(), STR_RPT_HELP_FOOTER },
943 { m_xGroupOnLst.get(), STR_RPT_HELP_GROUPON },
944 { m_xGroupIntervalEd.get(), STR_RPT_HELP_INTERVAL },
945 { m_xKeepTogetherLst.get(), STR_RPT_HELP_KEEP },
946 { m_xOrderLst.get(), STR_RPT_HELP_SORT }
947 };
948 for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i)
949 {
950 if (&rControl == pControls[i].first)
951 {
952 weld::ComboBox* pListBox = dynamic_cast<weld::ComboBox*>( &rControl );
953 if ( pListBox )
954 pListBox->save_value();
955 weld::SpinButton* pNumericField = dynamic_cast<weld::SpinButton*>(&rControl);
956 if ( pNumericField )
957 pNumericField->save_value();
958 //shows the text given by the id in the multiline edit
959 m_xHelpWindow->set_label(RptResId(pControls[i].second));
960 break;
961 }
962 }
963}
964
966{
967 if (m_xFieldExpression)
968 {
969 if (m_xGroupIntervalEd->get_value_changed_from_saved())
970 SaveData(m_xFieldExpression->GetCurRow());
971 }
972}
973
974IMPL_LINK(OGroupsSortingDialog, OnFormatAction, const OUString&, rCommand, void)
975{
976 if ( !m_xFieldExpression )
977 return;
978
979 tools::Long nIndex = m_xFieldExpression->GetCurrRow();
980 sal_Int32 nGroupPos = m_xFieldExpression->getGroupPosition(nIndex);
981 uno::Sequence<uno::Any> aClipboardList;
982 if ( nIndex >= 0 && nGroupPos != NO_GROUP )
983 {
984 aClipboardList = { m_xGroups->getByIndex(nGroupPos) };
985 }
986 if (rCommand == "up")
987 {
988 --nIndex;
989 }
990 if (rCommand == "down")
991 {
992 ++nIndex;
993 }
994 if (rCommand == "delete")
995 {
996 Application::PostUserEvent(LINK(m_xFieldExpression, OFieldExpressionControl, DelayedDelete));
997 }
998 else
999 {
1000 if ( nIndex >= 0 && aClipboardList.hasElements() )
1001 {
1002 m_xFieldExpression->SetNoSelection();
1003 m_xFieldExpression->moveGroups(aClipboardList,nIndex,false);
1004 m_xFieldExpression->DeactivateCell();
1005 m_xFieldExpression->GoToRow(nIndex);
1006 m_xFieldExpression->ActivateCell(nIndex, m_xFieldExpression->GetCurColumnId());
1007 DisplayData(nIndex);
1008 }
1009 }
1010}
1011
1012IMPL_LINK( OGroupsSortingDialog, LBChangeHdl, weld::ComboBox&, rListBox, void )
1013{
1014 if ( !rListBox.get_value_changed_from_saved() )
1015 return;
1016
1017 sal_Int32 nRow = m_xFieldExpression->GetCurRow();
1018 sal_Int32 nGroupPos = m_xFieldExpression->getGroupPosition(nRow);
1019 if (&rListBox != m_xHeaderLst.get() && &rListBox != m_xFooterLst.get())
1020 {
1021 if ( rListBox.get_value_changed_from_saved() )
1022 SaveData(nRow);
1023 if ( &rListBox == m_xGroupOnLst.get() )
1024 m_xGroupIntervalEd->set_sensitive(rListBox.get_active() != 0);
1025 }
1026 else if ( nGroupPos != NO_GROUP )
1027 {
1028 uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos);
1029 const OUString aHeaderFooterOnName(( m_xHeaderLst.get() == &rListBox )
1030 ? std::u16string_view(PROPERTY_HEADERON)
1031 : std::u16string_view(PROPERTY_FOOTERON));
1032 uno::Sequence< beans::PropertyValue > aArgs{
1033 comphelper::makePropertyValue(aHeaderFooterOnName, rListBox.get_active() == 0),
1035 };
1036 m_pController->executeChecked(m_xHeaderLst.get() == &rListBox ? SID_GROUPHEADER : SID_GROUPFOOTER, aArgs);
1037 m_xFieldExpression->InvalidateHandleColumn();
1038 }
1039}
1040
1041void OGroupsSortingDialog::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
1042{
1043 uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY);
1044 if ( xGroup.is() )
1045 displayGroup(xGroup);
1046 else
1047 fillColumns();
1048}
1049
1051{
1053 m_xFieldExpression->fillColumns(m_xColumns);
1054}
1055
1056void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _xGroup)
1057{
1058 m_xHeaderLst->set_active(_xGroup->getHeaderOn() ? 0 : 1 );
1059 m_xFooterLst->set_active(_xGroup->getFooterOn() ? 0 : 1 );
1060 sal_Int32 nDataType = getColumnDataType(_xGroup->getExpression());
1061
1062 // first clear whole group on list
1063 while (m_xGroupOnLst->get_count() > 1 )
1064 {
1065 m_xGroupOnLst->remove(1);
1066 }
1067
1068 switch(nDataType)
1069 {
1070 case sdbc::DataType::LONGVARCHAR:
1071 case sdbc::DataType::VARCHAR:
1072 case sdbc::DataType::CHAR:
1073 m_xGroupOnLst->append(OUString::number(report::GroupOn::PREFIX_CHARACTERS), RptResId(STR_RPT_PREFIXCHARS));
1074 break;
1075 case sdbc::DataType::DATE:
1076 case sdbc::DataType::TIME:
1077 case sdbc::DataType::TIMESTAMP:
1078 {
1079 const TranslateId aIds[] = { STR_RPT_YEAR, STR_RPT_QUARTER,STR_RPT_MONTH,STR_RPT_WEEK,STR_RPT_DAY,STR_RPT_HOUR,STR_RPT_MINUTE };
1080 for (size_t i = 0; i < SAL_N_ELEMENTS(aIds); ++i)
1081 {
1082 m_xGroupOnLst->append(OUString::number(i+2), RptResId(aIds[i]));
1083 }
1084 }
1085 break;
1086 default:
1087 m_xGroupOnLst->append(OUString::number(report::GroupOn::INTERVAL), RptResId(STR_RPT_INTERVAL));
1088 break;
1089 }
1090 sal_Int32 nPos = 0;
1091 switch(_xGroup->getGroupOn())
1092 {
1093 case report::GroupOn::DEFAULT:
1094 nPos = 0;
1095 break;
1096 case report::GroupOn::PREFIX_CHARACTERS:
1097 nPos = 1;
1098 break;
1099 case report::GroupOn::YEAR:
1100 nPos = 1;
1101 break;
1102 case report::GroupOn::QUARTAL:
1103 nPos = 2;
1104 break;
1105 case report::GroupOn::MONTH:
1106 nPos = 3;
1107 break;
1108 case report::GroupOn::WEEK:
1109 nPos = 4;
1110 break;
1111 case report::GroupOn::DAY:
1112 nPos = 5;
1113 break;
1114 case report::GroupOn::HOUR:
1115 nPos = 6;
1116 break;
1117 case report::GroupOn::MINUTE:
1118 nPos = 7;
1119 break;
1120 case report::GroupOn::INTERVAL:
1121 nPos = 1;
1122 break;
1123 default:
1124 nPos = 0;
1125 }
1126 m_xGroupOnLst->set_active(nPos);
1127 m_xGroupIntervalEd->set_value(_xGroup->getGroupInterval());
1128 m_xGroupIntervalEd->save_value();
1129 m_xGroupIntervalEd->set_sensitive( nPos != 0 );
1130 m_xKeepTogetherLst->set_active(_xGroup->getKeepTogether());
1131 m_xOrderLst->set_active(_xGroup->getSortAscending() ? 0 : 1);
1132
1133 weld::ComboBox* pControls[] = { m_xHeaderLst.get(), m_xFooterLst.get(), m_xGroupOnLst.get(),
1134 m_xKeepTogetherLst.get(), m_xOrderLst.get() };
1135 for (weld::ComboBox* pControl : pControls)
1136 pControl->save_value();
1137
1139 for (weld::ComboBox* pControl : pControls)
1140 pControl->set_sensitive(!bReadOnly);
1141 m_xGroupIntervalEd->set_editable(!bReadOnly);
1142}
1143
1145{
1146 sal_Int32 nGroupCount = m_xGroups->getCount();
1147 sal_Int32 nRowCount = m_xFieldExpression->GetRowCount();
1148 bool bEnabled = nGroupCount > 1;
1149
1150 if (bEnabled && _nRow > 0 )
1151 {
1152 m_xToolBox->set_item_sensitive("up", true);
1153 }
1154 else
1155 {
1156 m_xToolBox->set_item_sensitive("up", false);
1157 }
1158 if (bEnabled && _nRow < (nRowCount - 1) )
1159 {
1160 m_xToolBox->set_item_sensitive("down", true);
1161 }
1162 else
1163 {
1164 m_xToolBox->set_item_sensitive("down", false);
1165 }
1166
1167 sal_Int32 nGroupPos = m_xFieldExpression->getGroupPosition(_nRow);
1168 if ( nGroupPos != NO_GROUP )
1169 {
1170 bool bEnableDelete = nGroupCount > 0;
1171 m_xToolBox->set_item_sensitive("delete", bEnableDelete);
1172 }
1173 else
1174 {
1175 m_xToolBox->set_item_sensitive("delete", false);
1176 }
1177}
1178
1179} // rptui
1180
1181/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nDataType
VclPtr< OFieldExpressionControl > mpParent
#define GROUPS_START_LEN
#define FIELD_EXPRESSION
#define NO_GROUP
#define HANDLE_ID
constexpr sal_Int32 BROWSER_ENDOFSELECTION
BrowserMode
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
void RowRemoved(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true)
sal_uInt16 GetColumnId(sal_uInt16 nPos) const
virtual void Command(const CommandEvent &rEvt) override
BrowserDataWin & GetDataWindow() const
void InsertDataColumn(sal_uInt16 nItemId, const OUString &rText, tools::Long nSize, HeaderBarItemBits nBits=HeaderBarItemBits::STDSTYLE, sal_uInt16 nPos=HEADERBAR_APPEND)
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
bool GoToRow(sal_Int32 nRow)
sal_Int32 GetCurRow() const
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
sal_Int32 GetRowAtYPosPixel(tools::Long nY, bool bRelToBrowser=true) const
sal_uInt16 ColCount() const
void InsertHandleColumn(sal_uLong nWidth)
void SetFont(const vcl::Font &rNewFont)
void SetMode(BrowserMode nMode)
sal_Int32 GetSelectRowCount() const
const vcl::Font & GetFont() const
void RowInserted(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true, bool bKeepSelection=false)
sal_uInt16 GetColumnAtXPosPixel(tools::Long nX) const
sal_Int32 FirstSelectedRow()
virtual sal_Int32 GetRowCount() const override
virtual void SetNoSelection() override
virtual void SelectRow(sal_Int32 nRow, bool _bSelect=true, bool bExpand=true) override
sal_Int32 NextSelectedRow()
vcl::Window * GetWindow() const
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
const vcl::KeyCode & GetKeyCode() 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
size_t LeaveListAction()
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
css::uno::Any GetAny(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
static VclPtr< reference_type > Create(Arg &&... arg)
friend friend class OPropertyChangeMultiplexer
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
DECL_LINK(DelayedDelete, void *, void)
OFieldExpressionControl(OGroupsSortingDialog *pParentDialog, const css::uno::Reference< css::awt::XWindow > &rParent)
sal_Int32 getGroupPosition(sal_Int32 _nRow) const
void fillColumns(const uno::Reference< container::XNameAccess > &_xColumns)
VclPtr< ::svt::ComboBoxControl > m_pComboCell
virtual bool SaveModified() override
virtual ::svt::CellController * GetController(sal_Int32 nRow, sal_uInt16 nCol) override
virtual void dispose() override
::std::vector< sal_Int32 > m_aGroupPositions
DECL_LINK(CBChangeHdl, weld::ComboBox &, void)
virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override
virtual sal_Int8 ExecuteDrop(const BrowserExecuteDropEvent &rEvt) override
virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol) override
virtual sal_Int8 AcceptDrop(const BrowserAcceptDropEvent &rEvt) override
virtual bool IsTabAllowed(bool bForward) const override
uno::Sequence< uno::Any > fillSelectedGroups()
returns the sequence with the selected groups
virtual void InitController(::svt::CellControllerRef &rController, sal_Int32 nRow, sal_uInt16 nCol) override
virtual bool SeekRow(sal_Int32 nRow) override
void elementRemoved(const css::container::ContainerEvent &rEvent)
virtual void Command(const CommandEvent &rEvt) override
virtual Size GetOptimalSize() const override
virtual RowStatus GetRowStatus(sal_Int32 nRow) const override
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColId) const override
virtual void KeyInput(const KeyEvent &rEvt) override
void elementInserted(const css::container::ContainerEvent &rEvent)
void moveGroups(const uno::Sequence< uno::Any > &_aGroups, sal_Int32 _nRow, bool _bSelect=true)
move groups given by _aGroups
virtual ~OFieldExpressionControl() override
::std::vector< ColumnInfo > m_aColumnInfo
OGroupsSortingDialog * m_pParent
rtl::Reference< OFieldExpressionControlContainerListener > aContainerListener
clipboard class for group rows in the groups and sorting dialog
static SotClipboardFormatId getReportGroupId()
OGroupsSortingDialog(OGroupsSortingDialog const &)=delete
bool isReadOnly() const
returns <TRUE> when the dialog should be read only
::rptui::OReportController * m_pController
void SaveData(sal_Int32 _nRow)
saves the values from the listboxes into the group at position _nRow
std::unique_ptr< weld::Widget > m_xProperties
VclPtr< OFieldExpressionControl > m_xFieldExpression
std::unique_ptr< weld::ComboBox > m_xOrderLst
std::unique_ptr< weld::ComboBox > m_xGroupOnLst
virtual ~OGroupsSortingDialog() override
std::unique_ptr< weld::Toolbar > m_xToolBox
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvent) override
std::unique_ptr< weld::SpinButton > m_xGroupIntervalEd
std::unique_ptr< weld::ComboBox > m_xKeepTogetherLst
void DisplayData(sal_Int32 _nRow)
updates the listboxes with the new group properties
css::uno::Reference< css::report::XGroup > getGroup(sal_Int32 _nPos)
css::uno::Reference< css::report::XGroups > m_xGroups
std::unique_ptr< weld::ComboBox > m_xFooterLst
void fillColumns()
clears the m_xColumns member and reset the fields
void checkButtons(sal_Int32 _nRow)
enables or disables the up and down button
css::uno::Reference< css::container::XNameAccess > m_xColumns
sal_Int32 getColumnDataType(const OUString &_sColumnName)
returns the data type for the given column name
std::unique_ptr< weld::ComboBox > m_xHeaderLst
void displayGroup(const css::uno::Reference< css::report::XGroup > &_xGroup)
display the group props
css::uno::Reference< css::awt::XWindow > m_xTableCtrlParent
::rtl::Reference< comphelper::OPropertyChangeMultiplexer > m_pCurrentGroupListener
::rtl::Reference< comphelper::OPropertyChangeMultiplexer > m_pReportListener
css::uno::Reference< css::report::XGroups > & getGroups()
returns the groups
SfxUndoManager & getUndoManager() const
css::uno::Reference< css::container::XNameAccess > const & getColumns() const
weld::ComboBox & GetComboBox() const
bool IsEditing() const
virtual void DeactivateCell(bool bUpdate=true)
const CellControllerRef & Controller() const
virtual void KeyInput(const KeyEvent &rEvt) override
virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol)
void InvalidateStatusCell(sal_Int32 nRow)
virtual bool SeekRow(sal_Int32 nRow) override
virtual void dispose() override
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
void SetWeight(FontWeight)
bool IsMod1() const
sal_uInt16 GetCode() const
bool IsShift() const
virtual OUString get_active_text() const=0
virtual void set_entry_editable(bool bEditable)=0
virtual void clear()=0
virtual void set_entry_text(const OUString &rStr)=0
void append_text(const OUString &rStr)
virtual int get_active() const=0
void connect_changed(const Link< ComboBox &, void > &rLink)
void save_value()
OUString RptResId(TranslateId aId)
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
ScXMLEditAttributeMap::Entry const aEntries[]
EditBrowseBoxFlags
WEIGHT_NORMAL
WEIGHT_LIGHT
Reference< XColumn > xColumn
bool bReadOnly
constexpr OUStringLiteral HID_RPT_FIELDEXPRESSION
Definition: helpids.h:32
std::mutex m_aMutex
bool m_bReadOnly
sal_Int32 nIndex
constexpr sal_uInt16 KEY_DELETE
sal_uInt16 nPos
void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< sal_Int32[]> pData
#define SFX_ENDOFSELECTION
NONE
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
constexpr OUStringLiteral first
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
static void lcl_addToList_throw(weld::ComboBox &_rListBox, ::std::vector< ColumnInfo > &o_aColumnList, const uno::Reference< container::XNameAccess > &i_xColumns)
IMPL_LINK_NOARG(OAddFieldWindow, FocusChangeHdl, weld::Container &, void)
Definition: AddField.cxx:120
void adjustSectionName(const css::uno::Reference< css::report::XGroup > &_xGroup, sal_Int32 _nPos)
set the name of the header and footer of the group by the expression appended by the localized name o...
IMPL_LINK(OAddFieldWindow, DragBeginHdl, bool &, rUnsetDragIcon, bool)
Definition: AddField.cxx:50
long Long
weld::Window * GetPopupParent(vcl::Window &rOutWin, tools::Rectangle &rRect)
sal_Int32 m_nCurrentPos
constexpr OUStringLiteral PROPERTY_LABEL
Definition: strings.hxx:89
constexpr OUStringLiteral PROPERTY_GROUP
Definition: strings.hxx:48
constexpr OUStringLiteral PROPERTY_TYPE
Definition: strings.hxx:211
constexpr OUStringLiteral PROPERTY_HEADERON
Definition: strings.hxx:71
constexpr OUStringLiteral PROPERTY_COMMAND
Definition: strings.hxx:59
constexpr OUStringLiteral PROPERTY_POSITIONY
Definition: strings.hxx:75
constexpr OUStringLiteral PROPERTY_FOOTERON
Definition: strings.hxx:72
constexpr OUStringLiteral PROPERTY_COMMANDTYPE
Definition: strings.hxx:66
#define DND_ACTION_MOVE
#define DND_ACTION_NONE
signed char sal_Int8
WinBits const WB_TABSTOP