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