LibreOffice Module sc (master)  1
gridwin2.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 <scitems.hxx>
21 #include <vcl/settings.hxx>
22 #include <comphelper/lok.hxx>
23 
24 #include <gridwin.hxx>
25 #include <tabvwsh.hxx>
26 #include <docsh.hxx>
27 #include <viewdata.hxx>
28 #include <pivot.hxx>
29 #include <uiitems.hxx>
30 #include <scresid.hxx>
31 #include <globstr.hrc>
32 #include <strings.hrc>
33 #include <pagedata.hxx>
34 #include <dpobject.hxx>
35 #include <dpsave.hxx>
36 #include <dpshttab.hxx>
37 #include <dbdocfun.hxx>
38 #include <checklistmenu.hxx>
39 #include <dpcontrol.hxx>
40 #include <userlist.hxx>
41 #include <scabstdlg.hxx>
42 
43 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
44 
45 #include <unordered_map>
46 #include <memory>
47 #include <vector>
48 
49 using namespace css;
50 using namespace css::sheet;
51 using css::sheet::DataPilotFieldOrientation;
52 using std::vector;
53 
54 DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const
55 {
56  ScDocument& rDoc = mrViewData.GetDocument();
57  SCTAB nTab = mrViewData.GetTabNo();
58  ScDPObject* pDPObj = rDoc.GetDPAtCursor(nCol, nRow, nTab);
59  if (!pDPObj)
60  return DataPilotFieldOrientation_HIDDEN;
61 
62  DataPilotFieldOrientation nOrient = DataPilotFieldOrientation_HIDDEN;
63 
64  // Check for page field first.
65  if (nCol > 0)
66  {
67  // look for the dimension header left of the drop-down arrow
68  tools::Long nField = pDPObj->GetHeaderDim( ScAddress( nCol-1, nRow, nTab ), nOrient );
69  if ( nField >= 0 && nOrient == DataPilotFieldOrientation_PAGE )
70  {
71  bool bIsDataLayout = false;
72  OUString aFieldName = pDPObj->GetDimName( nField, bIsDataLayout );
73  if ( !aFieldName.isEmpty() && !bIsDataLayout )
74  return DataPilotFieldOrientation_PAGE;
75  }
76  }
77 
78  nOrient = DataPilotFieldOrientation_HIDDEN;
79 
80  // Now, check for row/column field.
81  tools::Long nField = pDPObj->GetHeaderDim(ScAddress(nCol, nRow, nTab), nOrient);
82  if (nField >= 0 && (nOrient == DataPilotFieldOrientation_COLUMN || nOrient == DataPilotFieldOrientation_ROW) )
83  {
84  bool bIsDataLayout = false;
85  OUString aFieldName = pDPObj->GetDimName(nField, bIsDataLayout);
86  if (!aFieldName.isEmpty() && !bIsDataLayout)
87  return nOrient;
88  }
89 
90  return DataPilotFieldOrientation_HIDDEN;
91 }
92 
93 // private method for mouse button handling
95 {
96  if (GetDPFieldOrientation( nCol, nRow ) == DataPilotFieldOrientation_PAGE)
97  {
98  LaunchPageFieldMenu( nCol, nRow );
99  return true;
100  }
101  return false;
102 }
103 
104 bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt )
105 {
106  ScDocument& rDoc = mrViewData.GetDocument();
107  SCTAB nTab = mrViewData.GetTabNo();
108  Point aScrPos = mrViewData.GetScrPos(nCol, nRow, eWhich);
109  Point aDiffPix = rMEvt.GetPosPixel();
110 
111  aDiffPix -= aScrPos;
112  bool bLOKActive = comphelper::LibreOfficeKit::isActive();
113  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
114  if ( bLayoutRTL && !bLOKActive )
115  aDiffPix.setX( -aDiffPix.X() );
116 
117  tools::Long nSizeX, nSizeY;
118  mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
119  // The button height should not use the merged cell height, should still use single row height
120  nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY());
121  Size aScrSize(nSizeX-1, nSizeY-1);
122 
123  // Check if the mouse cursor is clicking on the popup arrow box.
124  mpFilterButton.reset(new ScDPFieldButton(GetOutDev(), &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc));
125  mpFilterButton->setBoundingBox(aScrPos, aScrSize, bLayoutRTL && !bLOKActive);
126  mpFilterButton->setPopupLeft(bLayoutRTL && bLOKActive ? false : bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
127  Point aPopupPos;
128  Size aPopupSize;
129  mpFilterButton->getPopupBoundingBox(aPopupPos, aPopupSize);
130  tools::Rectangle aRect(aPopupPos, aPopupSize);
131  if (aRect.Contains(rMEvt.GetPosPixel()))
132  {
133  if ( DoPageFieldSelection( nCol, nRow ) )
134  return true;
135 
136  bool bFilterActive = IsAutoFilterActive(nCol, nRow, nTab);
137  mpFilterButton->setHasHiddenMember(bFilterActive);
138  mpFilterButton->setDrawBaseButton(false);
139  mpFilterButton->setDrawPopupButton(true);
140  mpFilterButton->setPopupPressed(true);
141  mpFilterButton->draw();
142  LaunchAutoFilterMenu(nCol, nRow);
143  return true;
144  }
145 
146  return false;
147 }
148 
149 void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt, bool bButton, bool bPopup )
150 {
151  ScDocument& rDoc = mrViewData.GetDocument();
152  SCTAB nTab = mrViewData.GetTabNo();
153 
154  ScDPObject* pDPObj = rDoc.GetDPAtCursor(nCol, nRow, nTab);
155 
156  if (pDPObj)
157  {
158  DataPilotFieldOrientation nOrient = DataPilotFieldOrientation_HIDDEN;
159  ScAddress aPos( nCol, nRow, nTab );
160  ScAddress aDimPos = aPos;
161  if (!bButton && bPopup && aDimPos.Col() > 0)
162  // For page field selection cell, the real field position is to the left.
163  aDimPos.IncCol(-1);
164 
165  tools::Long nField = pDPObj->GetHeaderDim(aDimPos, nOrient);
166  if ( nField >= 0 )
167  {
168  bDPMouse = false;
169  nDPField = nField;
170  pDragDPObj = pDPObj;
171  if (bPopup && DPTestFieldPopupArrow(rMEvt, aPos, aDimPos, pDPObj))
172  {
173  // field name pop up menu has been launched. Don't activate
174  // field move.
175  return;
176  }
177 
178  if (bButton)
179  {
180  bDPMouse = true;
181  DPTestMouse( rMEvt, true );
182  StartTracking();
183  }
184  }
185  else if ( pDPObj->IsFilterButton(aPos) )
186  {
187  ReleaseMouse(); // may have been captured in ButtonDown
188 
189  ScQueryParam aQueryParam;
190  SCTAB nSrcTab = 0;
191  const ScSheetSourceDesc* pDesc = pDPObj->GetSheetDesc();
192  OSL_ENSURE(pDesc, "no sheet source for filter button");
193  if (pDesc)
194  {
195  aQueryParam = pDesc->GetQueryParam();
196  nSrcTab = pDesc->GetSourceRange().aStart.Tab();
197  }
198 
199  SfxItemSetFixed<SCITEM_QUERYDATA, SCITEM_QUERYDATA> aArgSet( mrViewData.GetViewShell()->GetPool() );
200  aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, &mrViewData, &aQueryParam ) );
201 
203 
205  pFact->CreateScPivotFilterDlg(
206  mrViewData.GetViewShell()->GetFrameWeld(), aArgSet, nSrcTab));
207  if ( pDlg->Execute() == RET_OK )
208  {
209  ScSheetSourceDesc aNewDesc(&rDoc);
210  if (pDesc)
211  aNewDesc = *pDesc;
212 
213  const ScQueryItem& rQueryItem = pDlg->GetOutputItem();
214  aNewDesc.SetQueryParam(rQueryItem.GetQueryData());
215 
216  ScDPObject aNewObj( *pDPObj );
217  aNewObj.SetSheetDesc( aNewDesc );
218  ScDBDocFunc aFunc( *mrViewData.GetDocShell() );
219  aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false );
220  mrViewData.GetView()->CursorPosChanged(); // shells may be switched
221  }
222  }
223  }
224  else
225  {
226  OSL_FAIL("Nothing here");
227  }
228 }
229 
230 // Data Pilot interaction
231 
232 void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, bool bMove )
233 {
234  OSL_ENSURE(pDragDPObj, "pDragDPObj missing");
235 
236  // scroll window if at edges
238 
239  bool bTimer = false;
240  Point aPixel = rMEvt.GetPosPixel();
241 
242  SCCOL nDx = 0;
243  SCROW nDy = 0;
244  if ( aPixel.X() < 0 )
245  nDx = -1;
246  if ( aPixel.Y() < 0 )
247  nDy = -1;
248  Size aSize = GetOutputSizePixel();
249  if ( aPixel.X() >= aSize.Width() )
250  nDx = 1;
251  if ( aPixel.Y() >= aSize.Height() )
252  nDy = 1;
253  if ( nDx != 0 || nDy != 0 )
254  {
255  UpdateDragRect( false, tools::Rectangle() );
256 
257  if ( nDx != 0)
258  mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) );
259  if ( nDy != 0 )
260  mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) );
261 
262  bTimer = true;
263  }
264 
265  SCCOL nPosX;
266  SCROW nPosY;
267  mrViewData.GetPosFromPixel( aPixel.X(), aPixel.Y(), eWhich, nPosX, nPosY );
268  bool bMouseLeft;
269  bool bMouseTop;
270  mrViewData.GetMouseQuadrant( aPixel, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop );
271 
272  ScAddress aPos( nPosX, nPosY, mrViewData.GetTabNo() );
273 
274  tools::Rectangle aPosRect;
275  DataPilotFieldOrientation nOrient;
276  tools::Long nDimPos;
277  bool bHasRange = pDragDPObj->GetHeaderDrag( aPos, bMouseLeft, bMouseTop, nDPField,
278  aPosRect, nOrient, nDimPos );
279  UpdateDragRect( bHasRange && bMove, aPosRect );
280 
281  bool bIsDataLayout;
282  sal_Int32 nDimFlags = 0;
283  OUString aDimName = pDragDPObj->GetDimName( nDPField, bIsDataLayout, &nDimFlags );
284  bool bAllowed = !bHasRange || ScDPObject::IsOrientationAllowed( nOrient, nDimFlags );
285 
286  if (bMove) // set mouse pointer
287  {
288  PointerStyle ePointer = PointerStyle::PivotDelete;
289  if ( !bAllowed )
290  ePointer = PointerStyle::NotAllowed;
291  else if ( bHasRange )
292  switch (nOrient)
293  {
294  case DataPilotFieldOrientation_COLUMN: ePointer = PointerStyle::PivotCol; break;
295  case DataPilotFieldOrientation_ROW: ePointer = PointerStyle::PivotRow; break;
296  case DataPilotFieldOrientation_PAGE:
297  case DataPilotFieldOrientation_DATA: ePointer = PointerStyle::PivotField; break;
298  default: break;
299  }
300  SetPointer( ePointer );
301  }
302  else // execute change
303  {
304  if (!bHasRange)
305  nOrient = DataPilotFieldOrientation_HIDDEN;
306 
307  if ( bIsDataLayout && ( nOrient != DataPilotFieldOrientation_COLUMN &&
308  nOrient != DataPilotFieldOrientation_ROW ) )
309  {
310  // removing data layout is not allowed
311  mrViewData.GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED);
312  }
313  else if ( bAllowed )
314  {
315  ScDPSaveData aSaveData( *pDragDPObj->GetSaveData() );
316 
317  ScDPSaveDimension* pDim;
318  if ( bIsDataLayout )
319  pDim = aSaveData.GetDataLayoutDimension();
320  else
321  pDim = aSaveData.GetDimensionByName(aDimName);
322  pDim->SetOrientation( nOrient );
323  aSaveData.SetPosition( pDim, nDimPos );
324 
326 
327  ScDPObject aNewObj( *pDragDPObj );
328  aNewObj.SetSaveData( aSaveData );
329  ScDBDocFunc aFunc( *mrViewData.GetDocShell() );
330  // when dragging fields, allow re-positioning (bAllowMove)
331  aFunc.DataPilotUpdate( pDragDPObj, &aNewObj, true, false, true );
332  mrViewData.GetView()->CursorPosChanged(); // shells may be switched
333  }
334  }
335 
336  if (bTimer && bMove)
337  mrViewData.GetView()->SetTimer( this, rMEvt ); // repeat event
338  else
339  mrViewData.GetView()->ResetTimer();
340 }
341 
343  const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, ScDPObject* pDPObj)
344 {
345  bool bLayoutRTL = mrViewData.GetDocument().IsLayoutRTL( mrViewData.GetTabNo() );
347 
348  // Get the geometry of the cell.
349  Point aScrPos = mrViewData.GetScrPos(rPos.Col(), rPos.Row(), eWhich);
350  tools::Long nSizeX, nSizeY;
351  mrViewData.GetMergeSizePixel(rPos.Col(), rPos.Row(), nSizeX, nSizeY);
352  Size aScrSize(nSizeX-1, nSizeY-1);
353 
354  // Check if the mouse cursor is clicking on the popup arrow box.
355  ScDPFieldButton aBtn(GetOutDev(), &GetSettings().GetStyleSettings(), &GetMapMode().GetScaleY());
356  aBtn.setBoundingBox(aScrPos, aScrSize, bLayoutRTL);
357  aBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
358  Point aPopupPos;
359  Size aPopupSize;
360  aBtn.getPopupBoundingBox(aPopupPos, aPopupSize);
361  tools::Rectangle aRect(aPopupPos, aPopupSize);
362  if (aRect.Contains(rMEvt.GetPosPixel()))
363  {
364  // Mouse cursor inside the popup arrow box. Launch the field menu.
365  DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), aScrSize, rDimPos, pDPObj);
366  return true;
367  }
368 
369  return false;
370 }
371 
372 namespace {
373 
374 struct DPFieldPopupData : public ScCheckListMenuControl::ExtendedData
375 {
377  ScDPObject* mpDPObj;
378  tools::Long mnDim;
379 };
380 
381 class DPFieldPopupOKAction : public ScCheckListMenuControl::Action
382 {
383 public:
384  explicit DPFieldPopupOKAction(ScGridWindow* p) :
385  mpGridWindow(p) {}
386 
387  virtual bool execute() override
388  {
389  mpGridWindow->UpdateDPFromFieldPopupMenu();
390  return true;
391  }
392 private:
393  VclPtr<ScGridWindow> mpGridWindow;
394 };
395 
396 class PopupSortAction : public ScCheckListMenuControl::Action
397 {
398 public:
399  enum SortType { ASCENDING, DESCENDING, CUSTOM };
400 
401  explicit PopupSortAction(ScDPObject* pDPObject, tools::Long nDimIndex, SortType eType,
402  sal_uInt16 nUserListIndex, ScTabViewShell* pViewShell)
403  : mpDPObject(pDPObject)
404  , mnDimIndex(nDimIndex)
405  , meType(eType)
406  , mnUserListIndex(nUserListIndex)
407  , mpViewShell(pViewShell)
408  {}
409 
410  virtual bool execute() override
411  {
412  switch (meType)
413  {
414  case ASCENDING:
415  mpViewShell->DataPilotSort(mpDPObject, mnDimIndex, true);
416  break;
417  case DESCENDING:
418  mpViewShell->DataPilotSort(mpDPObject, mnDimIndex, false);
419  break;
420  case CUSTOM:
421  mpViewShell->DataPilotSort(mpDPObject, mnDimIndex, true, &mnUserListIndex);
422  break;
423  default:
424  ;
425  }
426  return true;
427  }
428 
429 private:
430  ScDPObject* mpDPObject;
431  tools::Long mnDimIndex;
432  SortType meType;
433  sal_uInt16 mnUserListIndex;
434  ScTabViewShell* mpViewShell;
435 };
436 
437 }
438 
439 void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScreenPosition, const Size& rScreenSize,
440  const ScAddress& rAddress, ScDPObject* pDPObject)
441 {
442  DataPilotFieldOrientation nOrient;
443  tools::Long nDimIndex = pDPObject->GetHeaderDim(rAddress, nOrient);
444 
445  DPLaunchFieldPopupMenu(rScreenPosition, rScreenSize, nDimIndex, pDPObject);
446 }
447 
448 void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScrSize,
449  tools::Long nDimIndex, ScDPObject* pDPObj)
450 {
451  std::unique_ptr<DPFieldPopupData> pDPData(new DPFieldPopupData);
452  pDPData->mnDim = nDimIndex;
453  pDPObj->GetSource();
454 
455  bool bIsDataLayout;
456  OUString aDimName = pDPObj->GetDimName(pDPData->mnDim, bIsDataLayout);
457  pDPObj->BuildAllDimensionMembers();
458  const ScDPSaveData* pSaveData = pDPObj->GetSaveData();
459  const ScDPSaveDimension* pDim = pSaveData->GetExistingDimensionByName(aDimName);
460  if (!pDim)
461  // This should never happen.
462  return;
463 
464  bool bDimOrientNotPage = pDim->GetOrientation() != DataPilotFieldOrientation_PAGE;
465 
466  // We need to get the list of field members.
467  pDPObj->FillLabelData(pDPData->mnDim, pDPData->maLabels);
468  pDPData->mpDPObj = pDPObj;
469 
470  const ScDPLabelData& rLabelData = pDPData->maLabels;
471 
472  mpDPFieldPopup.reset();
473 
474  weld::Window* pPopupParent = GetFrameWeld();
475  mpDPFieldPopup.reset(new ScCheckListMenuControl(pPopupParent, mrViewData,
476  false, -1));
477 
478  mpDPFieldPopup->setExtendedData(std::move(pDPData));
479  mpDPFieldPopup->setOKAction(new DPFieldPopupOKAction(this));
480  {
481  // Populate field members.
482  size_t n = rLabelData.maMembers.size();
483  mpDPFieldPopup->setMemberSize(n);
484  for (size_t i = 0; i < n; ++i)
485  {
486  const ScDPLabelData::Member& rMem = rLabelData.maMembers[i];
487  OUString aName = rMem.getDisplayName();
488  if (aName.isEmpty())
489  // Use special string for an empty name.
490  mpDPFieldPopup->addMember(ScResId(STR_EMPTYDATA), 0.0, rMem.mbVisible);
491  else
492  mpDPFieldPopup->addMember(rMem.getDisplayName(), 0.0, rMem.mbVisible);
493  }
494  }
495 
496  if (bDimOrientNotPage)
497  {
498  vector<OUString> aUserSortNames;
499  ScUserList* pUserList = ScGlobal::GetUserList();
500  if (pUserList)
501  {
502  size_t n = pUserList->size();
503  aUserSortNames.reserve(n);
504  for (size_t i = 0; i < n; ++i)
505  {
506  const ScUserListData& rData = (*pUserList)[i];
507  aUserSortNames.push_back(rData.GetString());
508  }
509  }
510 
511  // Populate the menus.
512  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
513  mpDPFieldPopup->addMenuItem(
514  ScResId(STR_MENU_SORT_ASC),
515  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::ASCENDING, 0, pViewShell));
516  mpDPFieldPopup->addMenuItem(
517  ScResId(STR_MENU_SORT_DESC),
518  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::DESCENDING, 0, pViewShell));
519 
520  ScListSubMenuControl* pSubMenu = mpDPFieldPopup->addSubMenuItem(ScResId(STR_MENU_SORT_CUSTOM), !aUserSortNames.empty(), false);
521  if (pSubMenu)
522  {
523  size_t n = aUserSortNames.size();
524  for (size_t i = 0; i < n; ++i)
525  {
526  pSubMenu->addMenuItem(aUserSortNames[i],
527  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::CUSTOM, sal_uInt16(i), pViewShell));
528  }
529  pSubMenu->resizeToFitMenuItems();
530  }
531  }
532 
533  mpDPFieldPopup->initMembers();
534 
535  tools::Rectangle aCellRect(rScrPos, rScrSize);
537  aConfig.mbAllowEmptySet = false;
538  aConfig.mbRTL = mrViewData.GetDocument().IsLayoutRTL(mrViewData.GetTabNo());
539  mpDPFieldPopup->setConfig(aConfig);
540  if (IsMouseCaptured())
541  ReleaseMouse();
542  mpDPFieldPopup->launch(pPopupParent, aCellRect);
543 }
544 
546 {
547  typedef std::unordered_map<OUString, OUString> MemNameMapType;
548 
549  if (!mpDPFieldPopup)
550  return;
551 
552  DPFieldPopupData* pDPData = static_cast<DPFieldPopupData*>(mpDPFieldPopup->getExtendedData());
553  if (!pDPData)
554  return;
555 
556  ScDPObject* pDPObj = pDPData->mpDPObj;
557  ScDPSaveData* pSaveData = pDPObj->GetSaveData();
558 
559  bool bIsDataLayout;
560  OUString aDimName = pDPObj->GetDimName(pDPData->mnDim, bIsDataLayout);
561  ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(aDimName);
562  if (!pDim)
563  return;
564 
565  // Build a map of layout names to original names.
566  const ScDPLabelData& rLabelData = pDPData->maLabels;
567  MemNameMapType aMemNameMap;
568  for (const auto& rMember : rLabelData.maMembers)
569  aMemNameMap.emplace(rMember.maLayoutName, rMember.maName);
570 
571  // The raw result may contain a mixture of layout names and original names.
573  mpDPFieldPopup->getResult(aRawResult);
574 
575  std::unordered_map<OUString, bool> aResult;
576  for (const auto& rItem : aRawResult)
577  {
578  MemNameMapType::const_iterator itrNameMap = aMemNameMap.find(rItem.aName);
579  if (itrNameMap == aMemNameMap.end())
580  {
581  // This is an original member name. Use it as-is.
582  OUString aName = rItem.aName;
583  if (aName == ScResId(STR_EMPTYDATA))
584  // Translate the special empty name into an empty string.
585  aName.clear();
586 
587  aResult.emplace(aName, rItem.bValid);
588  }
589  else
590  {
591  // This is a layout name. Get the original member name and use it.
592  aResult.emplace(itrNameMap->second, rItem.bValid);
593  }
594  }
595  pDim->UpdateMemberVisibility(aResult);
596 
597  ScDBDocFunc aFunc(*mrViewData.GetDocShell());
598  aFunc.UpdatePivotTable(*pDPObj, true, false);
599 }
600 
601 namespace {
602 
603 template <typename T>
604 inline
605 T lcl_getValidValue(T value, T defvalue)
606 {
607  return (value <0) ? defvalue : value;
608 }
609 
610 } // anonymous namespace
611 
613 {
614  ScDocument const& rDoc = mrViewData.GetDocument();
615  SCCOL nPosX = 0;
616  SCROW nPosY = 0;
617  SCCOL nXRight = rDoc.MaxCol();
618  SCROW nYBottom = rDoc.MaxRow();
619 
621  {
622  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
623  nPosX = lcl_getValidValue(pViewShell->GetLOKStartHeaderCol(), nPosX);
624  nPosY = lcl_getValidValue(pViewShell->GetLOKStartHeaderRow(), nPosY);
625  nXRight = lcl_getValidValue(pViewShell->GetLOKEndHeaderCol(), nXRight);
626  nYBottom = lcl_getValidValue(pViewShell->GetLOKEndHeaderRow(), nYBottom);
627  }
628  else
629  {
630  nPosX = mrViewData.GetPosX(eHWhich);
631  nPosY = mrViewData.GetPosY(eVWhich);
632  nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich);
633  if (nXRight > rDoc.MaxCol())
634  nXRight = rDoc.MaxCol();
635  nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich);
636  if (nYBottom > rDoc.MaxRow())
637  nYBottom = rDoc.MaxRow();
638  }
639 
640  // Store the current visible range.
641  return maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
642 }
643 
645 {
646  DPTestMouse( rMEvt, true );
647 }
648 
650 {
651  bDPMouse = false;
652  ReleaseMouse();
653 
654  DPTestMouse( rMEvt, false );
655  SetPointer( PointerStyle::Arrow );
656 }
657 
658 void ScGridWindow::UpdateDragRect( bool bShowRange, const tools::Rectangle& rPosRect )
659 {
660  SCCOL nStartX = ( rPosRect.Left() >= 0 ) ? static_cast<SCCOL>(rPosRect.Left()) : SCCOL_MAX;
661  SCROW nStartY = ( rPosRect.Top() >= 0 ) ? static_cast<SCROW>(rPosRect.Top()) : SCROW_MAX;
662  SCCOL nEndX = ( rPosRect.Right() >= 0 ) ? static_cast<SCCOL>(rPosRect.Right()) : SCCOL_MAX;
663  SCROW nEndY = ( rPosRect.Bottom() >= 0 ) ? static_cast<SCROW>(rPosRect.Bottom()) : SCROW_MAX;
664 
665  if ( bShowRange == bDragRect && nDragStartX == nStartX && nDragEndX == nEndX &&
666  nDragStartY == nStartY && nDragEndY == nEndY )
667  {
668  return; // everything unchanged
669  }
670 
671  if ( bShowRange )
672  {
673  nDragStartX = nStartX;
674  nDragStartY = nStartY;
675  nDragEndX = nEndX;
676  nDragEndY = nEndY;
677  bDragRect = true;
678  }
679  else
680  bDragRect = false;
681 
682  UpdateDragRectOverlay();
683 }
684 
685 // Page-Break Mode
686 
687 sal_uInt16 ScGridWindow::HitPageBreak( const Point& rMouse, ScRange* pSource,
688  SCCOLROW* pBreak, SCCOLROW* pPrev )
689 {
690  sal_uInt16 nFound = SC_PD_NONE; // 0
691  ScRange aSource;
692  SCCOLROW nBreak = 0;
693  SCCOLROW nPrev = 0;
694 
695  ScPageBreakData* pPageData = mrViewData.GetView()->GetPageBreakData();
696  if ( pPageData )
697  {
698  bool bHori = false;
699  bool bVert = false;
700  SCCOL nHitX = 0;
701  SCROW nHitY = 0;
702 
703  tools::Long nMouseX = rMouse.X();
704  tools::Long nMouseY = rMouse.Y();
705  SCCOL nPosX;
706  SCROW nPosY;
707  mrViewData.GetPosFromPixel( nMouseX, nMouseY, eWhich, nPosX, nPosY );
708  Point aTL = mrViewData.GetScrPos( nPosX, nPosY, eWhich );
709  Point aBR = mrViewData.GetScrPos( nPosX+1, nPosY+1, eWhich );
710 
711  // Horizontal more tolerances as for vertical, because there is more space
712  if ( nMouseX <= aTL.X() + 4 )
713  {
714  bHori = true;
715  nHitX = nPosX;
716  }
717  else if ( nMouseX >= aBR.X() - 6 )
718  {
719  bHori = true;
720  nHitX = nPosX+1; // left edge of the next cell
721  }
722  if ( nMouseY <= aTL.Y() + 2 )
723  {
724  bVert = true;
725  nHitY = nPosY;
726  }
727  else if ( nMouseY >= aBR.Y() - 4 )
728  {
729  bVert = true;
730  nHitY = nPosY+1; // upper edge of the next cell
731  }
732 
733  if ( bHori || bVert )
734  {
735  sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
736  for (sal_uInt16 nPos=0; nPos<nCount && !nFound; nPos++)
737  {
738  ScPrintRangeData& rData = pPageData->GetData(nPos);
739  ScRange aRange = rData.GetPrintRange();
740  bool bLHit = ( bHori && nHitX == aRange.aStart.Col() );
741  bool bRHit = ( bHori && nHitX == aRange.aEnd.Col() + 1 );
742  bool bTHit = ( bVert && nHitY == aRange.aStart.Row() );
743  bool bBHit = ( bVert && nHitY == aRange.aEnd.Row() + 1 );
744  bool bInsideH = ( nPosX >= aRange.aStart.Col() && nPosX <= aRange.aEnd.Col() );
745  bool bInsideV = ( nPosY >= aRange.aStart.Row() && nPosY <= aRange.aEnd.Row() );
746 
747  if ( bLHit )
748  {
749  if ( bTHit )
750  nFound = SC_PD_RANGE_TL;
751  else if ( bBHit )
752  nFound = SC_PD_RANGE_BL;
753  else if ( bInsideV )
754  nFound = SC_PD_RANGE_L;
755  }
756  else if ( bRHit )
757  {
758  if ( bTHit )
759  nFound = SC_PD_RANGE_TR;
760  else if ( bBHit )
761  nFound = SC_PD_RANGE_BR;
762  else if ( bInsideV )
763  nFound = SC_PD_RANGE_R;
764  }
765  else if ( bTHit && bInsideH )
766  nFound = SC_PD_RANGE_T;
767  else if ( bBHit && bInsideH )
768  nFound = SC_PD_RANGE_B;
769  if (nFound)
770  aSource = aRange;
771 
772  // breaks
773 
774  if ( bVert && bInsideH && !nFound )
775  {
776  size_t nRowCount = rData.GetPagesY();
777  const SCROW* pRowEnd = rData.GetPageEndY();
778  for (size_t nRowPos=0; nRowPos+1<nRowCount; nRowPos++)
779  if ( pRowEnd[nRowPos]+1 == nHitY )
780  {
781  nFound = SC_PD_BREAK_V;
782  aSource = aRange;
783  nBreak = nHitY;
784  if ( nRowPos )
785  nPrev = pRowEnd[nRowPos-1]+1;
786  else
787  nPrev = aRange.aStart.Row();
788  }
789  }
790  if ( bHori && bInsideV && !nFound )
791  {
792  size_t nColCount = rData.GetPagesX();
793  const SCCOL* pColEnd = rData.GetPageEndX();
794  for (size_t nColPos=0; nColPos+1<nColCount; nColPos++)
795  if ( pColEnd[nColPos]+1 == nHitX )
796  {
797  nFound = SC_PD_BREAK_H;
798  aSource = aRange;
799  nBreak = nHitX;
800  if ( nColPos )
801  nPrev = pColEnd[nColPos-1]+1;
802  else
803  nPrev = aRange.aStart.Col();
804  }
805  }
806  }
807  }
808  }
809 
810  if (pSource)
811  *pSource = aSource; // print break
812  if (pBreak)
813  *pBreak = nBreak; // X/Y position of the moved page break
814  if (pPrev)
815  *pPrev = nPrev; // X/Y beginning of the page, which is above the break
816  return nFound;
817 }
818 
819 void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp )
820 {
823 
824  // Scrolling
825 
826  bool bTimer = false;
827  Point aPos = rMEvt.GetPosPixel();
828  SCCOL nDx = 0;
829  SCROW nDy = 0;
830  if ( aPos.X() < 0 ) nDx = -1;
831  if ( aPos.Y() < 0 ) nDy = -1;
832  Size aSize = GetOutputSizePixel();
833  if ( aPos.X() >= aSize.Width() )
834  nDx = 1;
835  if ( aPos.Y() >= aSize.Height() )
836  nDy = 1;
837  if ( nDx != 0 || nDy != 0 )
838  {
839  if ( bPagebreakDrawn ) // invert
840  {
841  bPagebreakDrawn = false;
842  UpdateDragRectOverlay();
843  }
844 
845  if ( nDx != 0 ) mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) );
846  if ( nDy != 0 ) mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) );
847  bTimer = true;
848  }
849 
850  // Switching when fixating (so Scrolling works)
851 
852  if ( eWhich == mrViewData.GetActivePart() ) //??
853  {
854  if ( mrViewData.GetHSplitMode() == SC_SPLIT_FIX )
855  if ( nDx > 0 )
856  {
857  if ( eWhich == SC_SPLIT_TOPLEFT )
858  mrViewData.GetView()->ActivatePart( SC_SPLIT_TOPRIGHT );
859  else if ( eWhich == SC_SPLIT_BOTTOMLEFT )
860  mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT );
861  }
862 
863  if ( mrViewData.GetVSplitMode() == SC_SPLIT_FIX )
864  if ( nDy > 0 )
865  {
866  if ( eWhich == SC_SPLIT_TOPLEFT )
867  mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT );
868  else if ( eWhich == SC_SPLIT_TOPRIGHT )
869  mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT );
870  }
871  }
872 
873  // from here new
874 
875  // Searching for a position between the cells (before nPosX / nPosY)
876  SCCOL nPosX;
877  SCROW nPosY;
878  mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
879  bool bLeft, bTop;
880  mrViewData.GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bLeft, bTop );
881  if ( !bLeft ) ++nPosX;
882  if ( !bTop ) ++nPosY;
883 
884  bool bBreak = ( nPagebreakMouse == SC_PD_BREAK_H || nPagebreakMouse == SC_PD_BREAK_V );
885  bool bHide = false;
886  bool bToEnd = false;
887  ScRange aDrawRange = aPagebreakSource;
888  if ( bBreak )
889  {
890  if ( nPagebreakMouse == SC_PD_BREAK_H )
891  {
892  if ( nPosX > aPagebreakSource.aStart.Col() &&
893  nPosX <= aPagebreakSource.aEnd.Col() + 1 ) // to the end is also allowed
894  {
895  bToEnd = ( nPosX == aPagebreakSource.aEnd.Col() + 1 );
896  aDrawRange.aStart.SetCol( nPosX );
897  aDrawRange.aEnd.SetCol( nPosX - 1 );
898  }
899  else
900  bHide = true;
901  }
902  else
903  {
904  if ( nPosY > aPagebreakSource.aStart.Row() &&
905  nPosY <= aPagebreakSource.aEnd.Row() + 1 ) // to the end is also allowed
906  {
907  bToEnd = ( nPosY == aPagebreakSource.aEnd.Row() + 1 );
908  aDrawRange.aStart.SetRow( nPosY );
909  aDrawRange.aEnd.SetRow( nPosY - 1 );
910  }
911  else
912  bHide = true;
913  }
914  }
915  else
916  {
917  if ( nPagebreakMouse & SC_PD_RANGE_L )
918  aDrawRange.aStart.SetCol( nPosX );
919  if ( nPagebreakMouse & SC_PD_RANGE_T )
920  aDrawRange.aStart.SetRow( nPosY );
921  if ( nPagebreakMouse & SC_PD_RANGE_R )
922  {
923  if ( nPosX > 0 )
924  aDrawRange.aEnd.SetCol( nPosX-1 );
925  else
926  bHide = true;
927  }
928  if ( nPagebreakMouse & SC_PD_RANGE_B )
929  {
930  if ( nPosY > 0 )
931  aDrawRange.aEnd.SetRow( nPosY-1 );
932  else
933  bHide = true;
934  }
935  if ( aDrawRange.aStart.Col() > aDrawRange.aEnd.Col() ||
936  aDrawRange.aStart.Row() > aDrawRange.aEnd.Row() )
937  bHide = true;
938  }
939 
940  if ( !bPagebreakDrawn || bUp || aDrawRange != aPagebreakDrag )
941  {
942  // draw...
943 
944  if ( bPagebreakDrawn )
945  {
946  // invert
947  bPagebreakDrawn = false;
948  }
949  aPagebreakDrag = aDrawRange;
950  if ( !bUp && !bHide )
951  {
952  // revert
953  bPagebreakDrawn = true;
954  }
955  UpdateDragRectOverlay();
956  }
957 
958  // when ButtonUp execute the changes
959 
960  if ( bUp )
961  {
962  ScViewFunc* pViewFunc = mrViewData.GetView();
963  ScDocShell* pDocSh = mrViewData.GetDocShell();
964  ScDocument& rDoc = pDocSh->GetDocument();
965  SCTAB nTab = mrViewData.GetTabNo();
966  bool bUndo (rDoc.IsUndoEnabled());
967 
968  if ( bBreak )
969  {
970  bool bColumn = ( nPagebreakMouse == SC_PD_BREAK_H );
971  SCCOLROW nNew = bColumn ? static_cast<SCCOLROW>(nPosX) : static_cast<SCCOLROW>(nPosY);
972  if ( nNew != nPagebreakBreak )
973  {
974  if (bUndo)
975  {
976  OUString aUndo = ScResId( STR_UNDO_DRAG_BREAK );
977  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, mrViewData.GetViewShell()->GetViewShellId() );
978  }
979 
980  bool bGrow = !bHide && nNew > nPagebreakBreak;
981  if ( bColumn )
982  {
983  if (rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakBreak), nTab) & ScBreakType::Manual)
984  {
985  ScAddress aOldAddr( static_cast<SCCOL>(nPagebreakBreak), nPosY, nTab );
986  pViewFunc->DeletePageBreak( true, true, &aOldAddr, false );
987  }
988  if ( !bHide && !bToEnd ) // not at the end
989  {
990  ScAddress aNewAddr( static_cast<SCCOL>(nNew), nPosY, nTab );
991  pViewFunc->InsertPageBreak( true, true, &aNewAddr, false );
992  }
993  if ( bGrow )
994  {
995  // change last break to hard, and change scaling
996  bool bManualBreak(rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakPrev), nTab) & ScBreakType::Manual);
997  if ( static_cast<SCCOL>(nPagebreakPrev) > aPagebreakSource.aStart.Col() && !bManualBreak )
998  {
999  ScAddress aPrev( static_cast<SCCOL>(nPagebreakPrev), nPosY, nTab );
1000  pViewFunc->InsertPageBreak( true, true, &aPrev, false );
1001  }
1002 
1003  if (!pDocSh->AdjustPrintZoom( ScRange(
1004  static_cast<SCCOL>(nPagebreakPrev),0,nTab, static_cast<SCCOL>(nNew-1),0,nTab ) ))
1005  bGrow = false;
1006  }
1007  }
1008  else
1009  {
1010  if (rDoc.HasRowBreak(nPagebreakBreak, nTab) & ScBreakType::Manual)
1011  {
1012  ScAddress aOldAddr( nPosX, nPagebreakBreak, nTab );
1013  pViewFunc->DeletePageBreak( false, true, &aOldAddr, false );
1014  }
1015  if ( !bHide && !bToEnd ) // not at the end
1016  {
1017  ScAddress aNewAddr( nPosX, nNew, nTab );
1018  pViewFunc->InsertPageBreak( false, true, &aNewAddr, false );
1019  }
1020  if ( bGrow )
1021  {
1022  // change last break to hard, and change scaling
1023  bool bManualBreak(rDoc.HasRowBreak(nPagebreakPrev, nTab) & ScBreakType::Manual);
1024  if ( nPagebreakPrev > aPagebreakSource.aStart.Row() && !bManualBreak )
1025  {
1026  ScAddress aPrev( nPosX, nPagebreakPrev, nTab );
1027  pViewFunc->InsertPageBreak( false, true, &aPrev, false );
1028  }
1029 
1030  if (!pDocSh->AdjustPrintZoom( ScRange(
1031  0,nPagebreakPrev,nTab, 0,nNew-1,nTab ) ))
1032  bGrow = false;
1033  }
1034  }
1035 
1036  if (bUndo)
1037  {
1038  pDocSh->GetUndoManager()->LeaveListAction();
1039  }
1040 
1041  if (!bGrow) // otherwise has already happened in AdjustPrintZoom
1042  {
1043  pViewFunc->UpdatePageBreakData( true );
1044  pDocSh->SetDocumentModified();
1045  }
1046  }
1047  }
1048  else if ( bHide || aPagebreakDrag != aPagebreakSource )
1049  {
1050  // set print range
1051 
1052  OUString aNewRanges;
1053  sal_uInt16 nOldCount = rDoc.GetPrintRangeCount( nTab );
1054  if ( nOldCount )
1055  {
1056  for (sal_uInt16 nPos=0; nPos<nOldCount; nPos++)
1057  {
1058  const ScRange* pOld = rDoc.GetPrintRange( nTab, nPos );
1059  if ( pOld )
1060  {
1061  OUString aTemp;
1062  if ( *pOld != aPagebreakSource )
1063  aTemp = pOld->Format(rDoc, ScRefFlags::VALID);
1064  else if ( !bHide )
1065  aTemp = aPagebreakDrag.Format(rDoc, ScRefFlags::VALID);
1066  if (!aTemp.isEmpty())
1067  {
1068  if ( !aNewRanges.isEmpty() )
1069  aNewRanges += ";";
1070  aNewRanges += aTemp;
1071  }
1072  }
1073  }
1074  }
1075  else if (!bHide)
1076  aNewRanges = aPagebreakDrag.Format(rDoc, ScRefFlags::VALID);
1077 
1078  pViewFunc->SetPrintRanges( rDoc.IsPrintEntireSheet( nTab ), &aNewRanges, nullptr, nullptr, false );
1079  }
1080  }
1081 
1082  // Timer for Scrolling
1083 
1084  if (bTimer && !bUp)
1085  mrViewData.GetView()->SetTimer( this, rMEvt ); // repeat event
1086  else
1087  mrViewData.GetView()->ResetTimer();
1088 }
1089 
1090 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:972
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:377
void DPMouseMove(const MouseEvent &rMEvt)
Definition: gridwin2.cxx:644
SCROW GetLOKStartHeaderRow() const
Definition: tabview.hxx:606
std::set< ResultEntry > ResultType
Collection of user-defined sort lists.
Definition: userlist.hxx:66
#define SC_PD_RANGE_BL
Definition: gridwin.hxx:78
ScAddress aStart
Definition: address.hxx:497
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:728
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SC_PD_RANGE_L
Definition: gridwin.hxx:72
This class takes care of physically drawing field button controls inside data pilot tables...
Definition: dpcontrol.hxx:35
void SetOrientation(css::sheet::DataPilotFieldOrientation nNew)
Definition: dpsave.cxx:318
std::vector< Member > maMembers
Definition: pivot.hxx:98
SCROW Row() const
Definition: address.hxx:274
void SetPrintRanges(bool bEntireSheet, const OUString *pPrint, const OUString *pRepCol, const OUString *pRepRow, bool bAddPrint)
Definition: viewfun2.cxx:1045
bool DoAutoFilterButton(SCCOL nCol, SCROW nRow, const MouseEvent &rMEvt)
Definition: gridwin2.cxx:104
css::sheet::DataPilotFieldOrientation GetOrientation() const
Definition: dpsave.hxx:202
constexpr tools::Long Left() const
bool Contains(const Point &rPOINT) const
void UpdateDPFromFieldPopupMenu()
Definition: gridwin2.cxx:545
sal_uInt16 char char * pDesc
Definition: callform.cxx:57
bool DPTestFieldPopupArrow(const MouseEvent &rMEvt, const ScAddress &rPos, const ScAddress &rDimPos, ScDPObject *pDPObj)
Check if the mouse click is on a field popup button.
Definition: gridwin2.cxx:342
long Long
const SCCOL * GetPageEndX() const
Definition: pagedata.hxx:50
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:722
const SCCOL SCCOL_MAX
Definition: address.hxx:56
sal_Int64 n
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
Definition: dpobject.cxx:2438
ScPrintRangeData & GetData(size_t i)
Definition: pagedata.cxx:60
void SetDocumentModified()
Definition: docsh.cxx:2959
const ContentProperties & rData
#define SC_PD_RANGE_BR
Definition: gridwin.hxx:79
#define SC_PD_RANGE_R
Definition: gridwin.hxx:73
size_t size() const
Definition: userlist.cxx:345
ScAddress aEnd
Definition: address.hxx:498
This class implements a popup window for the auto filter dropdown.
virtual short Execute()=0
#define SCITEM_QUERYDATA
Definition: scitems.hxx:91
const SCROW SCROW_MAX
Definition: address.hxx:55
void SetQueryParam(const ScQueryParam &rParam)
Definition: dpshttab.cxx:270
SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4409
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4211
bool UpdatePivotTable(ScDPObject &rDPObj, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1592
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2945
constexpr tools::Long Width() const
const SCROW * GetPageEndY() const
Definition: pagedata.hxx:52
SCCOL GetLOKEndHeaderCol() const
Definition: tabview.hxx:609
bool AdjustPrintZoom(const ScRange &rRange)
Definition: docsh4.cxx:1684
static tools::Long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:700
Action to perform when an event takes place.
Stores individual user-defined sort list.
Definition: userlist.hxx:32
Configuration options for this popup window.
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:891
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
SCROW GetLOKEndHeaderRow() const
Definition: tabview.hxx:607
int nCount
void getPopupBoundingBox(Point &rPos, Size &rSize) const
Definition: dpcontrol.cxx:148
#define SC_PD_BREAK_H
Definition: gridwin.hxx:80
SCTAB Tab() const
Definition: address.hxx:283
SC_DLLPUBLIC const ScRange * GetPrintRange(SCTAB nTab, sal_uInt16 nPos)
Definition: document.cxx:6381
void SetRow(SCROW nRowP)
Definition: address.hxx:287
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
Definition: dpshttab.cxx:230
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
Definition: dpobject.cxx:414
size_t GetCount() const
Definition: pagedata.hxx:73
uint8_t maLabels[mnMaxStaticSize]
void SetCol(SCCOL nColP)
Definition: address.hxx:291
bool IsPrintEntireSheet(SCTAB nTab) const
Returns true, if the specified sheet is always printed.
Definition: document.cxx:6368
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:989
void UpdateDragRect(bool bShowRange, const tools::Rectangle &rPosRect)
Definition: gridwin2.cxx:658
const ScQueryParam & GetQueryParam() const
Definition: dpshttab.hxx:63
SC_DLLPUBLIC OUString const & getDisplayName() const
Definition: pivot2.cxx:45
bool IsFilterButton(const ScAddress &rPos)
Definition: dpobject.cxx:1402
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:890
void addMenuItem(const OUString &rText, ScCheckListMenuControl::Action *pAction)
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6373
int i
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
Definition: dpobject.cxx:515
sal_Int16 SCCOL
Definition: types.hxx:21
#define SC_PD_RANGE_TL
Definition: gridwin.hxx:76
bool DataPilotUpdate(ScDPObject *pOldObj, const ScDPObject *pNewObj, bool bRecord, bool bApi, bool bAllowMove=false)
Definition: dbdocfun.cxx:1297
void SetSaveData(const ScDPSaveData &rData)
Definition: dpobject.cxx:386
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
const ScRange & GetPrintRange() const
Definition: pagedata.hxx:44
void DPMouseButtonUp(const MouseEvent &rMEvt)
Definition: gridwin2.cxx:649
constexpr tools::Long Right() const
bool DoPageFieldSelection(SCCOL nCol, SCROW nRow)
Definition: gridwin2.cxx:94
const OUString & GetString() const
Definition: userlist.hxx:54
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:284
constexpr tools::Long Top() const
void PagebreakMove(const MouseEvent &rMEvt, bool bUp)
Definition: gridwin2.cxx:819
ScDPSaveData * GetSaveData() const
Definition: dpobject.hxx:141
const ScQueryParam & GetQueryData() const
Definition: uiitems.cxx:214
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
Definition: dpsave.cxx:846
void DPTestMouse(const MouseEvent &rMEvt, bool bMove)
Definition: gridwin2.cxx:232
bool UpdateVisibleRange()
Definition: gridwin2.cxx:612
SfxViewShell * GetViewShell() const
SCCOL Col() const
Definition: address.hxx:279
size_t LeaveListAction()
constexpr tools::Long Bottom() const
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
Definition: dpobject.cxx:1197
static bool IsOrientationAllowed(css::sheet::DataPilotFieldOrientation nOrient, sal_Int32 nDimFlags)
Definition: dpobject.cxx:2707
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define SC_PD_BREAK_V
Definition: gridwin.hxx:81
sal_Int32 SCROW
Definition: types.hxx:17
virtual const ScQueryItem & GetOutputItem()=0
constexpr tools::Long Height() const
void UpdateMemberVisibility(const std::unordered_map< OUString, bool > &rData)
Definition: dpsave.cxx:612
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4424
OUString aName
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
#define SC_PD_NONE
Definition: gridwin.hxx:71
RET_OK
#define SC_PD_RANGE_B
Definition: gridwin.hxx:75
const ScSheetSourceDesc * GetSheetDesc() const
Definition: dpobject.hxx:156
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
#define SC_PD_RANGE_T
Definition: gridwin.hxx:74
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
css::sheet::DataPilotFieldOrientation GetDPFieldOrientation(SCCOL nCol, SCROW nRow) const
Definition: gridwin2.cxx:54
SCCOL GetLOKStartHeaderCol() const
Definition: tabview.hxx:608
const Point & GetPosPixel() const
void DoPushPivotButton(SCCOL nCol, SCROW nRow, const MouseEvent &rMEvt, bool bButton, bool bPopup)
Definition: gridwin2.cxx:149
size_t GetPagesX() const
Definition: pagedata.hxx:49
PointerStyle
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:989
virtual VclPtr< AbstractScPivotFilterDlg > CreateScPivotFilterDlg(weld::Window *pParent, const SfxItemSet &rArgSet, sal_uInt16 nSourceTab)=0
bool IsUndoEnabled() const
Definition: document.hxx:1590
#define SC_PD_RANGE_TR
Definition: gridwin.hxx:77
void DPLaunchFieldPopupMenu(const Point &rScrPos, const Size &rScrSize, const ScAddress &rPos, ScDPObject *pDPObj)
Definition: gridwin2.cxx:439
void BuildAllDimensionMembers()
Definition: dpobject.cxx:959
size_t GetPagesY() const
Definition: pagedata.hxx:51
Extended data that the client code may need to store.
This class contains authoritative information on the internal reference used as the data source for d...
Definition: dpshttab.hxx:39
RedlineType meType
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
void setPopupLeft(bool b)
Definition: dpcontrol.cxx:86
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
Definition: dpsave.cxx:835
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1479
tools::Long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
Definition: dpobject.cxx:1409
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
sal_uInt16 HitPageBreak(const Point &rMouse, ScRange *pSource, SCCOLROW *pBreak, SCCOLROW *pPrev)
Definition: gridwin2.cxx:687
void setBoundingBox(const Point &rPos, const Size &rSize, bool bLayoutRTL)
Definition: dpcontrol.cxx:55
bool m_bDetectedRangeSegmentation false