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* pDoc = pViewData->GetDocument();
57  SCTAB nTab = pViewData->GetTabNo();
58  ScDPObject* pDPObj = pDoc->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  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  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* pDoc = pViewData->GetDocument();
107  SCTAB nTab = pViewData->GetTabNo();
108  Point aScrPos = pViewData->GetScrPos(nCol, nRow, eWhich);
109  Point aDiffPix = rMEvt.GetPosPixel();
110 
111  aDiffPix -= aScrPos;
112  bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
113  if ( bLayoutRTL )
114  aDiffPix.setX( -aDiffPix.X() );
115 
116  long nSizeX, nSizeY;
117  pViewData->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(pDoc->GetRowHeight(nRow, nTab), pViewData->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(), &pViewData->GetZoomY(), pDoc));
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* pDoc = pViewData->GetDocument();
151  SCTAB nTab = pViewData->GetTabNo();
152 
153  ScDPObject* pDPObj = pDoc->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  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( pViewData->GetViewShell()->GetPool(),
200  aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, pViewData, &aQueryParam ) );
201 
203 
205  pFact->CreateScPivotFilterDlg(
206  pViewData->GetViewShell()->GetFrameWeld(), aArgSet, nSrcTab));
207  if ( pDlg->Execute() == RET_OK )
208  {
209  ScSheetSourceDesc aNewDesc(pDoc);
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( *pViewData->GetDocShell() );
219  aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false );
220  pViewData->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  pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) );
259  if ( nDy != 0 )
260  pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) );
261 
262  bTimer = true;
263  }
264 
265  SCCOL nPosX;
266  SCROW nPosY;
267  pViewData->GetPosFromPixel( aPixel.X(), aPixel.Y(), eWhich, nPosX, nPosY );
268  bool bMouseLeft;
269  bool bMouseTop;
270  pViewData->GetMouseQuadrant( aPixel, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop );
271 
272  ScAddress aPos( nPosX, nPosY, pViewData->GetTabNo() );
273 
274  tools::Rectangle aPosRect;
275  DataPilotFieldOrientation nOrient;
276  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  pViewData->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( *pViewData->GetDocShell() );
330  // when dragging fields, allow re-positioning (bAllowMove)
331  aFunc.DataPilotUpdate( pDragDPObj, &aNewObj, true, false, true );
332  pViewData->GetView()->CursorPosChanged(); // shells may be switched
333  }
334  }
335 
336  if (bTimer && bMove)
337  pViewData->GetView()->SetTimer( this, rMEvt ); // repeat event
338  else
339  pViewData->GetView()->ResetTimer();
340 }
341 
343  const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, ScDPObject* pDPObj)
344 {
345  bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
346 
347  // Get the geometry of the cell.
348  Point aScrPos = pViewData->GetScrPos(rPos.Col(), rPos.Row(), eWhich);
349  long nSizeX, nSizeY;
350  pViewData->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  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, 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  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  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  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  mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pViewData->GetDocument(), bDimOrientNotPage));
471 
472  ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget();
473  rControl.setExtendedData(std::move(pDPData));
474  rControl.setOKAction(new DPFieldPopupOKAction(this));
475  {
476  // Populate field members.
477  size_t n = rLabelData.maMembers.size();
478  rControl.setMemberSize(n);
479  for (size_t i = 0; i < n; ++i)
480  {
481  const ScDPLabelData::Member& rMem = rLabelData.maMembers[i];
482  OUString aName = rMem.getDisplayName();
483  if (aName.isEmpty())
484  // Use special string for an empty name.
485  rControl.addMember(ScResId(STR_EMPTYDATA), rMem.mbVisible);
486  else
487  rControl.addMember(rMem.getDisplayName(), rMem.mbVisible);
488  }
489  }
490 
491  if (bDimOrientNotPage)
492  {
493  vector<OUString> aUserSortNames;
494  ScUserList* pUserList = ScGlobal::GetUserList();
495  if (pUserList)
496  {
497  size_t n = pUserList->size();
498  aUserSortNames.reserve(n);
499  for (size_t i = 0; i < n; ++i)
500  {
501  const ScUserListData& rData = (*pUserList)[i];
502  aUserSortNames.push_back(rData.GetString());
503  }
504  }
505 
506  // Populate the menus.
507  ScTabViewShell* pViewShell = pViewData->GetViewShell();
508  rControl.addMenuItem(
509  ScResId(STR_MENU_SORT_ASC),
510  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::ASCENDING, 0, pViewShell));
511  rControl.addMenuItem(
512  ScResId(STR_MENU_SORT_DESC),
513  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::DESCENDING, 0, pViewShell));
514 
515  ScCheckListMenuWindow* pSubMenu = rControl.addSubMenuItem(ScResId(STR_MENU_SORT_CUSTOM), !aUserSortNames.empty());
516  if (pSubMenu)
517  {
518  ScCheckListMenuControl& rSubMenu = pSubMenu->get_widget();
519  size_t n = aUserSortNames.size();
520  for (size_t i = 0; i < n; ++i)
521  {
522  rSubMenu.addMenuItem(aUserSortNames[i],
523  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::CUSTOM, sal_uInt16(i), pViewShell));
524  }
525  rSubMenu.resizeToFitMenuItems();
526  }
527  }
528 
529  rControl.initMembers();
530 
531  tools::Rectangle aCellRect(rScrPos, rScrSize);
532 
534  aConfig.mbAllowEmptySet = false;
535  aConfig.mbRTL = pViewData->GetDocument()->IsLayoutRTL(pViewData->GetTabNo());
536  rControl.setConfig(aConfig);
537  if (IsMouseCaptured())
538  ReleaseMouse();
539  rControl.launch(aCellRect);
540 }
541 
543 {
544  typedef std::unordered_map<OUString, OUString> MemNameMapType;
545 
546  if (!mpDPFieldPopup)
547  return;
548 
549  ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget();
550 
551  DPFieldPopupData* pDPData = static_cast<DPFieldPopupData*>(rControl.getExtendedData());
552  if (!pDPData)
553  return;
554 
555  ScDPObject* pDPObj = pDPData->mpDPObj;
556  ScDPSaveData* pSaveData = pDPObj->GetSaveData();
557 
558  bool bIsDataLayout;
559  OUString aDimName = pDPObj->GetDimName(pDPData->mnDim, bIsDataLayout);
560  ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(aDimName);
561  if (!pDim)
562  return;
563 
564  // Build a map of layout names to original names.
565  const ScDPLabelData& rLabelData = pDPData->maLabels;
566  MemNameMapType aMemNameMap;
567  for (const auto& rMember : rLabelData.maMembers)
568  aMemNameMap.emplace(rMember.maLayoutName, rMember.maName);
569 
570  // The raw result may contain a mixture of layout names and original names.
572  rControl.getResult(aRawResult);
573 
574  std::unordered_map<OUString, bool> aResult;
575  for (const auto& rItem : aRawResult)
576  {
577  MemNameMapType::const_iterator itrNameMap = aMemNameMap.find(rItem.aName);
578  if (itrNameMap == aMemNameMap.end())
579  {
580  // This is an original member name. Use it as-is.
581  OUString aName = rItem.aName;
582  if (aName == ScResId(STR_EMPTYDATA))
583  // Translate the special empty name into an empty string.
584  aName.clear();
585 
586  aResult.emplace(aName, rItem.bValid);
587  }
588  else
589  {
590  // This is a layout name. Get the original member name and use it.
591  aResult.emplace(itrNameMap->second, rItem.bValid);
592  }
593  }
594  pDim->UpdateMemberVisibility(aResult);
595 
596  ScDBDocFunc aFunc(*pViewData->GetDocShell());
597  aFunc.UpdatePivotTable(*pDPObj, true, false);
598 }
599 
600 namespace {
601 
602 template <typename T>
603 inline
604 T lcl_getValidValue(T value, T defvalue)
605 {
606  return (value <0) ? defvalue : value;
607 }
608 
609 } // anonymous namespace
610 
612 {
613  ScDocument const& rDoc = *pViewData->GetDocument();
614  SCCOL nPosX = 0;
615  SCROW nPosY = 0;
616  SCCOL nXRight = rDoc.MaxCol();
617  SCROW nYBottom = rDoc.MaxRow();
618 
620  {
621  ScTabViewShell* pViewShell = pViewData->GetViewShell();
622  nPosX = lcl_getValidValue(pViewShell->GetLOKStartHeaderCol(), nPosX);
623  nPosY = lcl_getValidValue(pViewShell->GetLOKStartHeaderRow(), nPosY);
624  nXRight = lcl_getValidValue(pViewShell->GetLOKEndHeaderCol(), nXRight);
625  nYBottom = lcl_getValidValue(pViewShell->GetLOKEndHeaderRow(), nYBottom);
626  }
627  else
628  {
629  nPosX = pViewData->GetPosX(eHWhich);
630  nPosY = pViewData->GetPosY(eVWhich);
631  nXRight = nPosX + pViewData->VisibleCellsX(eHWhich);
632  if (nXRight > rDoc.MaxCol())
633  nXRight = rDoc.MaxCol();
634  nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich);
635  if (nYBottom > rDoc.MaxRow())
636  nYBottom = rDoc.MaxRow();
637  }
638 
639  // Store the current visible range.
640  bool bChanged = maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
641  if (bChanged)
642  ResetAutoSpell();
643 
644  return bChanged;
645 }
646 
648 {
649  DPTestMouse( rMEvt, true );
650 }
651 
653 {
654  bDPMouse = false;
655  ReleaseMouse();
656 
657  DPTestMouse( rMEvt, false );
658  SetPointer( PointerStyle::Arrow );
659 }
660 
661 void ScGridWindow::UpdateDragRect( bool bShowRange, const tools::Rectangle& rPosRect )
662 {
663  SCCOL nStartX = ( rPosRect.Left() >= 0 ) ? static_cast<SCCOL>(rPosRect.Left()) : SCCOL_MAX;
664  SCROW nStartY = ( rPosRect.Top() >= 0 ) ? static_cast<SCROW>(rPosRect.Top()) : SCROW_MAX;
665  SCCOL nEndX = ( rPosRect.Right() >= 0 ) ? static_cast<SCCOL>(rPosRect.Right()) : SCCOL_MAX;
666  SCROW nEndY = ( rPosRect.Bottom() >= 0 ) ? static_cast<SCROW>(rPosRect.Bottom()) : SCROW_MAX;
667 
668  if ( bShowRange == bDragRect && nDragStartX == nStartX && nDragEndX == nEndX &&
669  nDragStartY == nStartY && nDragEndY == nEndY )
670  {
671  return; // everything unchanged
672  }
673 
674  if ( bShowRange )
675  {
676  nDragStartX = nStartX;
677  nDragStartY = nStartY;
678  nDragEndX = nEndX;
679  nDragEndY = nEndY;
680  bDragRect = true;
681  }
682  else
683  bDragRect = false;
684 
685  UpdateDragRectOverlay();
686 }
687 
688 // Page-Break Mode
689 
690 sal_uInt16 ScGridWindow::HitPageBreak( const Point& rMouse, ScRange* pSource,
691  SCCOLROW* pBreak, SCCOLROW* pPrev )
692 {
693  sal_uInt16 nFound = SC_PD_NONE; // 0
694  ScRange aSource;
695  SCCOLROW nBreak = 0;
696  SCCOLROW nPrev = 0;
697 
698  ScPageBreakData* pPageData = pViewData->GetView()->GetPageBreakData();
699  if ( pPageData )
700  {
701  bool bHori = false;
702  bool bVert = false;
703  SCCOL nHitX = 0;
704  SCROW nHitY = 0;
705 
706  long nMouseX = rMouse.X();
707  long nMouseY = rMouse.Y();
708  SCCOL nPosX;
709  SCROW nPosY;
710  pViewData->GetPosFromPixel( nMouseX, nMouseY, eWhich, nPosX, nPosY );
711  Point aTL = pViewData->GetScrPos( nPosX, nPosY, eWhich );
712  Point aBR = pViewData->GetScrPos( nPosX+1, nPosY+1, eWhich );
713 
714  // Horizontal more tolerances as for vertical, because there is more space
715  if ( nMouseX <= aTL.X() + 4 )
716  {
717  bHori = true;
718  nHitX = nPosX;
719  }
720  else if ( nMouseX >= aBR.X() - 6 )
721  {
722  bHori = true;
723  nHitX = nPosX+1; // left edge of the next cell
724  }
725  if ( nMouseY <= aTL.Y() + 2 )
726  {
727  bVert = true;
728  nHitY = nPosY;
729  }
730  else if ( nMouseY >= aBR.Y() - 4 )
731  {
732  bVert = true;
733  nHitY = nPosY+1; // upper edge of the next cell
734  }
735 
736  if ( bHori || bVert )
737  {
738  sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
739  for (sal_uInt16 nPos=0; nPos<nCount && !nFound; nPos++)
740  {
741  ScPrintRangeData& rData = pPageData->GetData(nPos);
742  ScRange aRange = rData.GetPrintRange();
743  bool bLHit = ( bHori && nHitX == aRange.aStart.Col() );
744  bool bRHit = ( bHori && nHitX == aRange.aEnd.Col() + 1 );
745  bool bTHit = ( bVert && nHitY == aRange.aStart.Row() );
746  bool bBHit = ( bVert && nHitY == aRange.aEnd.Row() + 1 );
747  bool bInsideH = ( nPosX >= aRange.aStart.Col() && nPosX <= aRange.aEnd.Col() );
748  bool bInsideV = ( nPosY >= aRange.aStart.Row() && nPosY <= aRange.aEnd.Row() );
749 
750  if ( bLHit )
751  {
752  if ( bTHit )
753  nFound = SC_PD_RANGE_TL;
754  else if ( bBHit )
755  nFound = SC_PD_RANGE_BL;
756  else if ( bInsideV )
757  nFound = SC_PD_RANGE_L;
758  }
759  else if ( bRHit )
760  {
761  if ( bTHit )
762  nFound = SC_PD_RANGE_TR;
763  else if ( bBHit )
764  nFound = SC_PD_RANGE_BR;
765  else if ( bInsideV )
766  nFound = SC_PD_RANGE_R;
767  }
768  else if ( bTHit && bInsideH )
769  nFound = SC_PD_RANGE_T;
770  else if ( bBHit && bInsideH )
771  nFound = SC_PD_RANGE_B;
772  if (nFound)
773  aSource = aRange;
774 
775  // breaks
776 
777  if ( bVert && bInsideH && !nFound )
778  {
779  size_t nRowCount = rData.GetPagesY();
780  const SCROW* pRowEnd = rData.GetPageEndY();
781  for (size_t nRowPos=0; nRowPos+1<nRowCount; nRowPos++)
782  if ( pRowEnd[nRowPos]+1 == nHitY )
783  {
784  nFound = SC_PD_BREAK_V;
785  aSource = aRange;
786  nBreak = nHitY;
787  if ( nRowPos )
788  nPrev = pRowEnd[nRowPos-1]+1;
789  else
790  nPrev = aRange.aStart.Row();
791  }
792  }
793  if ( bHori && bInsideV && !nFound )
794  {
795  size_t nColCount = rData.GetPagesX();
796  const SCCOL* pColEnd = rData.GetPageEndX();
797  for (size_t nColPos=0; nColPos+1<nColCount; nColPos++)
798  if ( pColEnd[nColPos]+1 == nHitX )
799  {
800  nFound = SC_PD_BREAK_H;
801  aSource = aRange;
802  nBreak = nHitX;
803  if ( nColPos )
804  nPrev = pColEnd[nColPos-1]+1;
805  else
806  nPrev = aRange.aStart.Col();
807  }
808  }
809  }
810  }
811  }
812 
813  if (pSource)
814  *pSource = aSource; // print break
815  if (pBreak)
816  *pBreak = nBreak; // X/Y position of the moved page break
817  if (pPrev)
818  *pPrev = nPrev; // X/Y beginning of the page, which is above the break
819  return nFound;
820 }
821 
822 void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp )
823 {
826 
827  // Scrolling
828 
829  bool bTimer = false;
830  Point aPos = rMEvt.GetPosPixel();
831  SCCOL nDx = 0;
832  SCROW nDy = 0;
833  if ( aPos.X() < 0 ) nDx = -1;
834  if ( aPos.Y() < 0 ) nDy = -1;
835  Size aSize = GetOutputSizePixel();
836  if ( aPos.X() >= aSize.Width() )
837  nDx = 1;
838  if ( aPos.Y() >= aSize.Height() )
839  nDy = 1;
840  if ( nDx != 0 || nDy != 0 )
841  {
842  if ( bPagebreakDrawn ) // invert
843  {
844  bPagebreakDrawn = false;
845  UpdateDragRectOverlay();
846  }
847 
848  if ( nDx != 0 ) pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) );
849  if ( nDy != 0 ) pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) );
850  bTimer = true;
851  }
852 
853  // Switching when fixating (so Scrolling works)
854 
855  if ( eWhich == pViewData->GetActivePart() ) //??
856  {
857  if ( pViewData->GetHSplitMode() == SC_SPLIT_FIX )
858  if ( nDx > 0 )
859  {
860  if ( eWhich == SC_SPLIT_TOPLEFT )
861  pViewData->GetView()->ActivatePart( SC_SPLIT_TOPRIGHT );
862  else if ( eWhich == SC_SPLIT_BOTTOMLEFT )
863  pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT );
864  }
865 
866  if ( pViewData->GetVSplitMode() == SC_SPLIT_FIX )
867  if ( nDy > 0 )
868  {
869  if ( eWhich == SC_SPLIT_TOPLEFT )
870  pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT );
871  else if ( eWhich == SC_SPLIT_TOPRIGHT )
872  pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT );
873  }
874  }
875 
876  // from here new
877 
878  // Searching for a position between the cells (before nPosX / nPosY)
879  SCCOL nPosX;
880  SCROW nPosY;
881  pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
882  bool bLeft, bTop;
883  pViewData->GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bLeft, bTop );
884  if ( !bLeft ) ++nPosX;
885  if ( !bTop ) ++nPosY;
886 
887  bool bBreak = ( nPagebreakMouse == SC_PD_BREAK_H || nPagebreakMouse == SC_PD_BREAK_V );
888  bool bHide = false;
889  bool bToEnd = false;
890  ScRange aDrawRange = aPagebreakSource;
891  if ( bBreak )
892  {
893  if ( nPagebreakMouse == SC_PD_BREAK_H )
894  {
895  if ( nPosX > aPagebreakSource.aStart.Col() &&
896  nPosX <= aPagebreakSource.aEnd.Col() + 1 ) // to the end is also allowed
897  {
898  bToEnd = ( nPosX == aPagebreakSource.aEnd.Col() + 1 );
899  aDrawRange.aStart.SetCol( nPosX );
900  aDrawRange.aEnd.SetCol( nPosX - 1 );
901  }
902  else
903  bHide = true;
904  }
905  else
906  {
907  if ( nPosY > aPagebreakSource.aStart.Row() &&
908  nPosY <= aPagebreakSource.aEnd.Row() + 1 ) // to the end is also allowed
909  {
910  bToEnd = ( nPosY == aPagebreakSource.aEnd.Row() + 1 );
911  aDrawRange.aStart.SetRow( nPosY );
912  aDrawRange.aEnd.SetRow( nPosY - 1 );
913  }
914  else
915  bHide = true;
916  }
917  }
918  else
919  {
920  if ( nPagebreakMouse & SC_PD_RANGE_L )
921  aDrawRange.aStart.SetCol( nPosX );
922  if ( nPagebreakMouse & SC_PD_RANGE_T )
923  aDrawRange.aStart.SetRow( nPosY );
924  if ( nPagebreakMouse & SC_PD_RANGE_R )
925  {
926  if ( nPosX > 0 )
927  aDrawRange.aEnd.SetCol( nPosX-1 );
928  else
929  bHide = true;
930  }
931  if ( nPagebreakMouse & SC_PD_RANGE_B )
932  {
933  if ( nPosY > 0 )
934  aDrawRange.aEnd.SetRow( nPosY-1 );
935  else
936  bHide = true;
937  }
938  if ( aDrawRange.aStart.Col() > aDrawRange.aEnd.Col() ||
939  aDrawRange.aStart.Row() > aDrawRange.aEnd.Row() )
940  bHide = true;
941  }
942 
943  if ( !bPagebreakDrawn || bUp || aDrawRange != aPagebreakDrag )
944  {
945  // draw...
946 
947  if ( bPagebreakDrawn )
948  {
949  // invert
950  bPagebreakDrawn = false;
951  }
952  aPagebreakDrag = aDrawRange;
953  if ( !bUp && !bHide )
954  {
955  // revert
956  bPagebreakDrawn = true;
957  }
958  UpdateDragRectOverlay();
959  }
960 
961  // when ButtonUp execute the changes
962 
963  if ( bUp )
964  {
965  ScViewFunc* pViewFunc = pViewData->GetView();
966  ScDocShell* pDocSh = pViewData->GetDocShell();
967  ScDocument& rDoc = pDocSh->GetDocument();
968  SCTAB nTab = pViewData->GetTabNo();
969  bool bUndo (rDoc.IsUndoEnabled());
970 
971  if ( bBreak )
972  {
973  bool bColumn = ( nPagebreakMouse == SC_PD_BREAK_H );
974  SCCOLROW nNew = bColumn ? static_cast<SCCOLROW>(nPosX) : static_cast<SCCOLROW>(nPosY);
975  if ( nNew != nPagebreakBreak )
976  {
977  if (bUndo)
978  {
979  OUString aUndo = ScResId( STR_UNDO_DRAG_BREAK );
980  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pViewData->GetViewShell()->GetViewShellId() );
981  }
982 
983  bool bGrow = !bHide && nNew > nPagebreakBreak;
984  if ( bColumn )
985  {
986  if (rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakBreak), nTab) & ScBreakType::Manual)
987  {
988  ScAddress aOldAddr( static_cast<SCCOL>(nPagebreakBreak), nPosY, nTab );
989  pViewFunc->DeletePageBreak( true, true, &aOldAddr, false );
990  }
991  if ( !bHide && !bToEnd ) // not at the end
992  {
993  ScAddress aNewAddr( static_cast<SCCOL>(nNew), nPosY, nTab );
994  pViewFunc->InsertPageBreak( true, true, &aNewAddr, false );
995  }
996  if ( bGrow )
997  {
998  // change last break to hard, and change scaling
999  bool bManualBreak(rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakPrev), nTab) & ScBreakType::Manual);
1000  if ( static_cast<SCCOL>(nPagebreakPrev) > aPagebreakSource.aStart.Col() && !bManualBreak )
1001  {
1002  ScAddress aPrev( static_cast<SCCOL>(nPagebreakPrev), nPosY, nTab );
1003  pViewFunc->InsertPageBreak( true, true, &aPrev, false );
1004  }
1005 
1006  if (!pDocSh->AdjustPrintZoom( ScRange(
1007  static_cast<SCCOL>(nPagebreakPrev),0,nTab, static_cast<SCCOL>(nNew-1),0,nTab ) ))
1008  bGrow = false;
1009  }
1010  }
1011  else
1012  {
1013  if (rDoc.HasRowBreak(nPagebreakBreak, nTab) & ScBreakType::Manual)
1014  {
1015  ScAddress aOldAddr( nPosX, nPagebreakBreak, nTab );
1016  pViewFunc->DeletePageBreak( false, true, &aOldAddr, false );
1017  }
1018  if ( !bHide && !bToEnd ) // not at the end
1019  {
1020  ScAddress aNewAddr( nPosX, nNew, nTab );
1021  pViewFunc->InsertPageBreak( false, true, &aNewAddr, false );
1022  }
1023  if ( bGrow )
1024  {
1025  // change last break to hard, and change scaling
1026  bool bManualBreak(rDoc.HasRowBreak(nPagebreakPrev, nTab) & ScBreakType::Manual);
1027  if ( nPagebreakPrev > aPagebreakSource.aStart.Row() && !bManualBreak )
1028  {
1029  ScAddress aPrev( nPosX, nPagebreakPrev, nTab );
1030  pViewFunc->InsertPageBreak( false, true, &aPrev, false );
1031  }
1032 
1033  if (!pDocSh->AdjustPrintZoom( ScRange(
1034  0,nPagebreakPrev,nTab, 0,nNew-1,nTab ) ))
1035  bGrow = false;
1036  }
1037  }
1038 
1039  if (bUndo)
1040  {
1041  pDocSh->GetUndoManager()->LeaveListAction();
1042  }
1043 
1044  if (!bGrow) // otherwise has already happened in AdjustPrintZoom
1045  {
1046  pViewFunc->UpdatePageBreakData( true );
1047  pDocSh->SetDocumentModified();
1048  }
1049  }
1050  }
1051  else if ( bHide || aPagebreakDrag != aPagebreakSource )
1052  {
1053  // set print range
1054 
1055  OUString aNewRanges;
1056  sal_uInt16 nOldCount = rDoc.GetPrintRangeCount( nTab );
1057  if ( nOldCount )
1058  {
1059  for (sal_uInt16 nPos=0; nPos<nOldCount; nPos++)
1060  {
1061  const ScRange* pOld = rDoc.GetPrintRange( nTab, nPos );
1062  if ( pOld )
1063  {
1064  OUString aTemp;
1065  if ( *pOld != aPagebreakSource )
1066  aTemp = pOld->Format(rDoc, ScRefFlags::VALID);
1067  else if ( !bHide )
1068  aTemp = aPagebreakDrag.Format(rDoc, ScRefFlags::VALID);
1069  if (!aTemp.isEmpty())
1070  {
1071  if ( !aNewRanges.isEmpty() )
1072  aNewRanges += ";";
1073  aNewRanges += aTemp;
1074  }
1075  }
1076  }
1077  }
1078  else if (!bHide)
1079  aNewRanges = aPagebreakDrag.Format(rDoc, ScRefFlags::VALID);
1080 
1081  pViewFunc->SetPrintRanges( rDoc.IsPrintEntireSheet( nTab ), &aNewRanges, nullptr, nullptr, false );
1082  }
1083  }
1084 
1085  // Timer for Scrolling
1086 
1087  if (bTimer && !bUp)
1088  pViewData->GetView()->SetTimer( this, rMEvt ); // repeat event
1089  else
1090  pViewData->GetView()->ResetTimer();
1091 }
1092 
1093 /* 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
long Width() const
const int nColCount
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:358
OUString GetDimName(long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
Definition: dpobject.cxx:1196
void DPMouseMove(const MouseEvent &rMEvt)
Definition: gridwin2.cxx:647
SCROW GetLOKStartHeaderRow() const
Definition: tabview.hxx:605
std::set< ResultEntry > ResultType
Collection of user-defined sort lists.
Definition: userlist.hxx:66
#define SC_PD_RANGE_BL
Definition: gridwin.hxx:77
ScAddress aStart
Definition: address.hxx:500
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:714
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:98
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:202
long Height() const
void UpdateDPFromFieldPopupMenu()
Definition: gridwin2.cxx:542
sal_uInt16 char char * pDesc
Definition: callform.cxx:58
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
const SCCOL * GetPageEndX() const
Definition: pagedata.hxx:50
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:708
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:2819
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:4361
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4163
bool UpdatePivotTable(ScDPObject &rDPObj, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1534
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2805
const SCROW * GetPageEndY() const
Definition: pagedata.hxx:52
SCCOL GetLOKEndHeaderCol() const
Definition: tabview.hxx:608
bool AdjustPrintZoom(const ScRange &rRange)
Definition: docsh4.cxx:1634
Action to perform when an event takes place.
long Right() const
Stores individual user-defined sort list.
Definition: userlist.hxx:33
Configuration options for this popup window.
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:876
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
SCROW GetLOKEndHeaderRow() const
Definition: tabview.hxx:606
int nCount
void getPopupBoundingBox(Point &rPos, Size &rSize) const
Definition: dpcontrol.cxx:140
#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:6281
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
long Top() const
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:279
bool IsPrintEntireSheet(SCTAB nTab) const
Returns true, if the specified sheet is always printed.
Definition: document.cxx:6268
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:661
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:875
void getResult(ResultType &rResult)
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6273
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:1239
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:2207
const ScRange & GetPrintRange() const
Definition: pagedata.hxx:44
void DPMouseButtonUp(const MouseEvent &rMEvt)
Definition: gridwin2.cxx:652
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(const OUString &rName) const
Definition: dpsave.cxx:846
bool DoPageFieldSelection(SCCOL nCol, SCROW nRow)
Definition: gridwin2.cxx:94
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
long Bottom() const
const OUString & GetString() const
Definition: userlist.hxx:54
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:277
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:822
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)
void setConfig(const Config &rConfig)
void DPTestMouse(const MouseEvent &rMEvt, bool bMove)
Definition: gridwin2.cxx:232
bool UpdateVisibleRange()
Definition: gridwin2.cxx:611
SfxViewShell * GetViewShell() const
SCCOL Col() const
Definition: address.hxx:267
size_t LeaveListAction()
void launch(const tools::Rectangle &rRect)
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:4376
OUString aName
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:38
#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
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:216
css::sheet::DataPilotFieldOrientation GetDPFieldOrientation(SCCOL nCol, SCROW nRow) const
Definition: gridwin2.cxx:54
SCCOL GetLOKStartHeaderCol() const
Definition: tabview.hxx:607
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:49
long Left() const
PointerStyle
ScCheckListMenuControl & get_widget()
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:993
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:1534
#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
long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
Definition: dpobject.cxx:1407
void BuildAllDimensionMembers()
Definition: dpobject.cxx:960
size_t GetPagesY() const
Definition: pagedata.hxx:51
static long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:686
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:835
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1445
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:690
void setBoundingBox(const Point &rPos, const Size &rSize, bool bLayoutRTL)
Definition: dpcontrol.cxx:54