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  mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, &mrViewData.GetDocument(),
471  bDimOrientNotPage, false));
472 
473  ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget();
474  rControl.setExtendedData(std::move(pDPData));
475  rControl.setOKAction(new DPFieldPopupOKAction(this));
476  {
477  // Populate field members.
478  size_t n = rLabelData.maMembers.size();
479  rControl.setMemberSize(n);
480  for (size_t i = 0; i < n; ++i)
481  {
482  const ScDPLabelData::Member& rMem = rLabelData.maMembers[i];
483  OUString aName = rMem.getDisplayName();
484  if (aName.isEmpty())
485  // Use special string for an empty name.
486  rControl.addMember(ScResId(STR_EMPTYDATA), rMem.mbVisible);
487  else
488  rControl.addMember(rMem.getDisplayName(), rMem.mbVisible);
489  }
490  }
491 
492  if (bDimOrientNotPage)
493  {
494  vector<OUString> aUserSortNames;
495  ScUserList* pUserList = ScGlobal::GetUserList();
496  if (pUserList)
497  {
498  size_t n = pUserList->size();
499  aUserSortNames.reserve(n);
500  for (size_t i = 0; i < n; ++i)
501  {
502  const ScUserListData& rData = (*pUserList)[i];
503  aUserSortNames.push_back(rData.GetString());
504  }
505  }
506 
507  // Populate the menus.
508  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
509  rControl.addMenuItem(
510  ScResId(STR_MENU_SORT_ASC),
511  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::ASCENDING, 0, pViewShell));
512  rControl.addMenuItem(
513  ScResId(STR_MENU_SORT_DESC),
514  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::DESCENDING, 0, pViewShell));
515 
516  ScCheckListMenuWindow* pSubMenu = rControl.addSubMenuItem(ScResId(STR_MENU_SORT_CUSTOM), !aUserSortNames.empty());
517  if (pSubMenu)
518  {
519  ScCheckListMenuControl& rSubMenu = pSubMenu->get_widget();
520  size_t n = aUserSortNames.size();
521  for (size_t i = 0; i < n; ++i)
522  {
523  rSubMenu.addMenuItem(aUserSortNames[i],
524  new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::CUSTOM, sal_uInt16(i), pViewShell));
525  }
526  rSubMenu.resizeToFitMenuItems();
527  }
528  }
529 
530  rControl.initMembers();
531 
532  tools::Rectangle aCellRect(rScrPos, rScrSize);
533 
535  aConfig.mbAllowEmptySet = false;
536  aConfig.mbRTL = mrViewData.GetDocument().IsLayoutRTL(mrViewData.GetTabNo());
537  rControl.setConfig(aConfig);
538  if (IsMouseCaptured())
539  ReleaseMouse();
540  rControl.launch(aCellRect);
541 }
542 
544 {
545  typedef std::unordered_map<OUString, OUString> MemNameMapType;
546 
547  if (!mpDPFieldPopup)
548  return;
549 
550  ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget();
551 
552  DPFieldPopupData* pDPData = static_cast<DPFieldPopupData*>(rControl.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  rControl.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  bool bChanged = maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
642  if (bChanged)
643  ResetAutoSpell();
644 
645  return bChanged;
646 }
647 
649 {
650  DPTestMouse( rMEvt, true );
651 }
652 
654 {
655  bDPMouse = false;
656  ReleaseMouse();
657 
658  DPTestMouse( rMEvt, false );
659  SetPointer( PointerStyle::Arrow );
660 }
661 
662 void ScGridWindow::UpdateDragRect( bool bShowRange, const tools::Rectangle& rPosRect )
663 {
664  SCCOL nStartX = ( rPosRect.Left() >= 0 ) ? static_cast<SCCOL>(rPosRect.Left()) : SCCOL_MAX;
665  SCROW nStartY = ( rPosRect.Top() >= 0 ) ? static_cast<SCROW>(rPosRect.Top()) : SCROW_MAX;
666  SCCOL nEndX = ( rPosRect.Right() >= 0 ) ? static_cast<SCCOL>(rPosRect.Right()) : SCCOL_MAX;
667  SCROW nEndY = ( rPosRect.Bottom() >= 0 ) ? static_cast<SCROW>(rPosRect.Bottom()) : SCROW_MAX;
668 
669  if ( bShowRange == bDragRect && nDragStartX == nStartX && nDragEndX == nEndX &&
670  nDragStartY == nStartY && nDragEndY == nEndY )
671  {
672  return; // everything unchanged
673  }
674 
675  if ( bShowRange )
676  {
677  nDragStartX = nStartX;
678  nDragStartY = nStartY;
679  nDragEndX = nEndX;
680  nDragEndY = nEndY;
681  bDragRect = true;
682  }
683  else
684  bDragRect = false;
685 
686  UpdateDragRectOverlay();
687 }
688 
689 // Page-Break Mode
690 
691 sal_uInt16 ScGridWindow::HitPageBreak( const Point& rMouse, ScRange* pSource,
692  SCCOLROW* pBreak, SCCOLROW* pPrev )
693 {
694  sal_uInt16 nFound = SC_PD_NONE; // 0
695  ScRange aSource;
696  SCCOLROW nBreak = 0;
697  SCCOLROW nPrev = 0;
698 
699  ScPageBreakData* pPageData = mrViewData.GetView()->GetPageBreakData();
700  if ( pPageData )
701  {
702  bool bHori = false;
703  bool bVert = false;
704  SCCOL nHitX = 0;
705  SCROW nHitY = 0;
706 
707  tools::Long nMouseX = rMouse.X();
708  tools::Long nMouseY = rMouse.Y();
709  SCCOL nPosX;
710  SCROW nPosY;
711  mrViewData.GetPosFromPixel( nMouseX, nMouseY, eWhich, nPosX, nPosY );
712  Point aTL = mrViewData.GetScrPos( nPosX, nPosY, eWhich );
713  Point aBR = mrViewData.GetScrPos( nPosX+1, nPosY+1, eWhich );
714 
715  // Horizontal more tolerances as for vertical, because there is more space
716  if ( nMouseX <= aTL.X() + 4 )
717  {
718  bHori = true;
719  nHitX = nPosX;
720  }
721  else if ( nMouseX >= aBR.X() - 6 )
722  {
723  bHori = true;
724  nHitX = nPosX+1; // left edge of the next cell
725  }
726  if ( nMouseY <= aTL.Y() + 2 )
727  {
728  bVert = true;
729  nHitY = nPosY;
730  }
731  else if ( nMouseY >= aBR.Y() - 4 )
732  {
733  bVert = true;
734  nHitY = nPosY+1; // upper edge of the next cell
735  }
736 
737  if ( bHori || bVert )
738  {
739  sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
740  for (sal_uInt16 nPos=0; nPos<nCount && !nFound; nPos++)
741  {
742  ScPrintRangeData& rData = pPageData->GetData(nPos);
743  ScRange aRange = rData.GetPrintRange();
744  bool bLHit = ( bHori && nHitX == aRange.aStart.Col() );
745  bool bRHit = ( bHori && nHitX == aRange.aEnd.Col() + 1 );
746  bool bTHit = ( bVert && nHitY == aRange.aStart.Row() );
747  bool bBHit = ( bVert && nHitY == aRange.aEnd.Row() + 1 );
748  bool bInsideH = ( nPosX >= aRange.aStart.Col() && nPosX <= aRange.aEnd.Col() );
749  bool bInsideV = ( nPosY >= aRange.aStart.Row() && nPosY <= aRange.aEnd.Row() );
750 
751  if ( bLHit )
752  {
753  if ( bTHit )
754  nFound = SC_PD_RANGE_TL;
755  else if ( bBHit )
756  nFound = SC_PD_RANGE_BL;
757  else if ( bInsideV )
758  nFound = SC_PD_RANGE_L;
759  }
760  else if ( bRHit )
761  {
762  if ( bTHit )
763  nFound = SC_PD_RANGE_TR;
764  else if ( bBHit )
765  nFound = SC_PD_RANGE_BR;
766  else if ( bInsideV )
767  nFound = SC_PD_RANGE_R;
768  }
769  else if ( bTHit && bInsideH )
770  nFound = SC_PD_RANGE_T;
771  else if ( bBHit && bInsideH )
772  nFound = SC_PD_RANGE_B;
773  if (nFound)
774  aSource = aRange;
775 
776  // breaks
777 
778  if ( bVert && bInsideH && !nFound )
779  {
780  size_t nRowCount = rData.GetPagesY();
781  const SCROW* pRowEnd = rData.GetPageEndY();
782  for (size_t nRowPos=0; nRowPos+1<nRowCount; nRowPos++)
783  if ( pRowEnd[nRowPos]+1 == nHitY )
784  {
785  nFound = SC_PD_BREAK_V;
786  aSource = aRange;
787  nBreak = nHitY;
788  if ( nRowPos )
789  nPrev = pRowEnd[nRowPos-1]+1;
790  else
791  nPrev = aRange.aStart.Row();
792  }
793  }
794  if ( bHori && bInsideV && !nFound )
795  {
796  size_t nColCount = rData.GetPagesX();
797  const SCCOL* pColEnd = rData.GetPageEndX();
798  for (size_t nColPos=0; nColPos+1<nColCount; nColPos++)
799  if ( pColEnd[nColPos]+1 == nHitX )
800  {
801  nFound = SC_PD_BREAK_H;
802  aSource = aRange;
803  nBreak = nHitX;
804  if ( nColPos )
805  nPrev = pColEnd[nColPos-1]+1;
806  else
807  nPrev = aRange.aStart.Col();
808  }
809  }
810  }
811  }
812  }
813 
814  if (pSource)
815  *pSource = aSource; // print break
816  if (pBreak)
817  *pBreak = nBreak; // X/Y position of the moved page break
818  if (pPrev)
819  *pPrev = nPrev; // X/Y beginning of the page, which is above the break
820  return nFound;
821 }
822 
823 void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp )
824 {
827 
828  // Scrolling
829 
830  bool bTimer = false;
831  Point aPos = rMEvt.GetPosPixel();
832  SCCOL nDx = 0;
833  SCROW nDy = 0;
834  if ( aPos.X() < 0 ) nDx = -1;
835  if ( aPos.Y() < 0 ) nDy = -1;
836  Size aSize = GetOutputSizePixel();
837  if ( aPos.X() >= aSize.Width() )
838  nDx = 1;
839  if ( aPos.Y() >= aSize.Height() )
840  nDy = 1;
841  if ( nDx != 0 || nDy != 0 )
842  {
843  if ( bPagebreakDrawn ) // invert
844  {
845  bPagebreakDrawn = false;
846  UpdateDragRectOverlay();
847  }
848 
849  if ( nDx != 0 ) mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) );
850  if ( nDy != 0 ) mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) );
851  bTimer = true;
852  }
853 
854  // Switching when fixating (so Scrolling works)
855 
856  if ( eWhich == mrViewData.GetActivePart() ) //??
857  {
858  if ( mrViewData.GetHSplitMode() == SC_SPLIT_FIX )
859  if ( nDx > 0 )
860  {
861  if ( eWhich == SC_SPLIT_TOPLEFT )
862  mrViewData.GetView()->ActivatePart( SC_SPLIT_TOPRIGHT );
863  else if ( eWhich == SC_SPLIT_BOTTOMLEFT )
864  mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT );
865  }
866 
867  if ( mrViewData.GetVSplitMode() == SC_SPLIT_FIX )
868  if ( nDy > 0 )
869  {
870  if ( eWhich == SC_SPLIT_TOPLEFT )
871  mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT );
872  else if ( eWhich == SC_SPLIT_TOPRIGHT )
873  mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT );
874  }
875  }
876 
877  // from here new
878 
879  // Searching for a position between the cells (before nPosX / nPosY)
880  SCCOL nPosX;
881  SCROW nPosY;
882  mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
883  bool bLeft, bTop;
884  mrViewData.GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bLeft, bTop );
885  if ( !bLeft ) ++nPosX;
886  if ( !bTop ) ++nPosY;
887 
888  bool bBreak = ( nPagebreakMouse == SC_PD_BREAK_H || nPagebreakMouse == SC_PD_BREAK_V );
889  bool bHide = false;
890  bool bToEnd = false;
891  ScRange aDrawRange = aPagebreakSource;
892  if ( bBreak )
893  {
894  if ( nPagebreakMouse == SC_PD_BREAK_H )
895  {
896  if ( nPosX > aPagebreakSource.aStart.Col() &&
897  nPosX <= aPagebreakSource.aEnd.Col() + 1 ) // to the end is also allowed
898  {
899  bToEnd = ( nPosX == aPagebreakSource.aEnd.Col() + 1 );
900  aDrawRange.aStart.SetCol( nPosX );
901  aDrawRange.aEnd.SetCol( nPosX - 1 );
902  }
903  else
904  bHide = true;
905  }
906  else
907  {
908  if ( nPosY > aPagebreakSource.aStart.Row() &&
909  nPosY <= aPagebreakSource.aEnd.Row() + 1 ) // to the end is also allowed
910  {
911  bToEnd = ( nPosY == aPagebreakSource.aEnd.Row() + 1 );
912  aDrawRange.aStart.SetRow( nPosY );
913  aDrawRange.aEnd.SetRow( nPosY - 1 );
914  }
915  else
916  bHide = true;
917  }
918  }
919  else
920  {
921  if ( nPagebreakMouse & SC_PD_RANGE_L )
922  aDrawRange.aStart.SetCol( nPosX );
923  if ( nPagebreakMouse & SC_PD_RANGE_T )
924  aDrawRange.aStart.SetRow( nPosY );
925  if ( nPagebreakMouse & SC_PD_RANGE_R )
926  {
927  if ( nPosX > 0 )
928  aDrawRange.aEnd.SetCol( nPosX-1 );
929  else
930  bHide = true;
931  }
932  if ( nPagebreakMouse & SC_PD_RANGE_B )
933  {
934  if ( nPosY > 0 )
935  aDrawRange.aEnd.SetRow( nPosY-1 );
936  else
937  bHide = true;
938  }
939  if ( aDrawRange.aStart.Col() > aDrawRange.aEnd.Col() ||
940  aDrawRange.aStart.Row() > aDrawRange.aEnd.Row() )
941  bHide = true;
942  }
943 
944  if ( !bPagebreakDrawn || bUp || aDrawRange != aPagebreakDrag )
945  {
946  // draw...
947 
948  if ( bPagebreakDrawn )
949  {
950  // invert
951  bPagebreakDrawn = false;
952  }
953  aPagebreakDrag = aDrawRange;
954  if ( !bUp && !bHide )
955  {
956  // revert
957  bPagebreakDrawn = true;
958  }
959  UpdateDragRectOverlay();
960  }
961 
962  // when ButtonUp execute the changes
963 
964  if ( bUp )
965  {
966  ScViewFunc* pViewFunc = mrViewData.GetView();
967  ScDocShell* pDocSh = mrViewData.GetDocShell();
968  ScDocument& rDoc = pDocSh->GetDocument();
969  SCTAB nTab = mrViewData.GetTabNo();
970  bool bUndo (rDoc.IsUndoEnabled());
971 
972  if ( bBreak )
973  {
974  bool bColumn = ( nPagebreakMouse == SC_PD_BREAK_H );
975  SCCOLROW nNew = bColumn ? static_cast<SCCOLROW>(nPosX) : static_cast<SCCOLROW>(nPosY);
976  if ( nNew != nPagebreakBreak )
977  {
978  if (bUndo)
979  {
980  OUString aUndo = ScResId( STR_UNDO_DRAG_BREAK );
981  pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, mrViewData.GetViewShell()->GetViewShellId() );
982  }
983 
984  bool bGrow = !bHide && nNew > nPagebreakBreak;
985  if ( bColumn )
986  {
987  if (rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakBreak), nTab) & ScBreakType::Manual)
988  {
989  ScAddress aOldAddr( static_cast<SCCOL>(nPagebreakBreak), nPosY, nTab );
990  pViewFunc->DeletePageBreak( true, true, &aOldAddr, false );
991  }
992  if ( !bHide && !bToEnd ) // not at the end
993  {
994  ScAddress aNewAddr( static_cast<SCCOL>(nNew), nPosY, nTab );
995  pViewFunc->InsertPageBreak( true, true, &aNewAddr, false );
996  }
997  if ( bGrow )
998  {
999  // change last break to hard, and change scaling
1000  bool bManualBreak(rDoc.HasColBreak(static_cast<SCCOL>(nPagebreakPrev), nTab) & ScBreakType::Manual);
1001  if ( static_cast<SCCOL>(nPagebreakPrev) > aPagebreakSource.aStart.Col() && !bManualBreak )
1002  {
1003  ScAddress aPrev( static_cast<SCCOL>(nPagebreakPrev), nPosY, nTab );
1004  pViewFunc->InsertPageBreak( true, true, &aPrev, false );
1005  }
1006 
1007  if (!pDocSh->AdjustPrintZoom( ScRange(
1008  static_cast<SCCOL>(nPagebreakPrev),0,nTab, static_cast<SCCOL>(nNew-1),0,nTab ) ))
1009  bGrow = false;
1010  }
1011  }
1012  else
1013  {
1014  if (rDoc.HasRowBreak(nPagebreakBreak, nTab) & ScBreakType::Manual)
1015  {
1016  ScAddress aOldAddr( nPosX, nPagebreakBreak, nTab );
1017  pViewFunc->DeletePageBreak( false, true, &aOldAddr, false );
1018  }
1019  if ( !bHide && !bToEnd ) // not at the end
1020  {
1021  ScAddress aNewAddr( nPosX, nNew, nTab );
1022  pViewFunc->InsertPageBreak( false, true, &aNewAddr, false );
1023  }
1024  if ( bGrow )
1025  {
1026  // change last break to hard, and change scaling
1027  bool bManualBreak(rDoc.HasRowBreak(nPagebreakPrev, nTab) & ScBreakType::Manual);
1028  if ( nPagebreakPrev > aPagebreakSource.aStart.Row() && !bManualBreak )
1029  {
1030  ScAddress aPrev( nPosX, nPagebreakPrev, nTab );
1031  pViewFunc->InsertPageBreak( false, true, &aPrev, false );
1032  }
1033 
1034  if (!pDocSh->AdjustPrintZoom( ScRange(
1035  0,nPagebreakPrev,nTab, 0,nNew-1,nTab ) ))
1036  bGrow = false;
1037  }
1038  }
1039 
1040  if (bUndo)
1041  {
1042  pDocSh->GetUndoManager()->LeaveListAction();
1043  }
1044 
1045  if (!bGrow) // otherwise has already happened in AdjustPrintZoom
1046  {
1047  pViewFunc->UpdatePageBreakData( true );
1048  pDocSh->SetDocumentModified();
1049  }
1050  }
1051  }
1052  else if ( bHide || aPagebreakDrag != aPagebreakSource )
1053  {
1054  // set print range
1055 
1056  OUString aNewRanges;
1057  sal_uInt16 nOldCount = rDoc.GetPrintRangeCount( nTab );
1058  if ( nOldCount )
1059  {
1060  for (sal_uInt16 nPos=0; nPos<nOldCount; nPos++)
1061  {
1062  const ScRange* pOld = rDoc.GetPrintRange( nTab, nPos );
1063  if ( pOld )
1064  {
1065  OUString aTemp;
1066  if ( *pOld != aPagebreakSource )
1067  aTemp = pOld->Format(rDoc, ScRefFlags::VALID);
1068  else if ( !bHide )
1069  aTemp = aPagebreakDrag.Format(rDoc, ScRefFlags::VALID);
1070  if (!aTemp.isEmpty())
1071  {
1072  if ( !aNewRanges.isEmpty() )
1073  aNewRanges += ";";
1074  aNewRanges += aTemp;
1075  }
1076  }
1077  }
1078  }
1079  else if (!bHide)
1080  aNewRanges = aPagebreakDrag.Format(rDoc, ScRefFlags::VALID);
1081 
1082  pViewFunc->SetPrintRanges( rDoc.IsPrintEntireSheet( nTab ), &aNewRanges, nullptr, nullptr, false );
1083  }
1084  }
1085 
1086  // Timer for Scrolling
1087 
1088  if (bTimer && !bUp)
1089  mrViewData.GetView()->SetTimer( this, rMEvt ); // repeat event
1090  else
1091  mrViewData.GetView()->ResetTimer();
1092 }
1093 
1094 /* 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:372
void DPMouseMove(const MouseEvent &rMEvt)
Definition: gridwin2.cxx:648
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: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:543
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
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: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:4359
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4161
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:53
SCCOL GetLOKEndHeaderCol() const
Definition: tabview.hxx:608
bool AdjustPrintZoom(const ScRange &rRange)
Definition: docsh4.cxx:1632
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:873
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
tools::Long Bottom() const
#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:6279
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:6266
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:662
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:872
void getResult(ResultType &rResult)
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6271
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:2203
const ScRange & GetPrintRange() const
Definition: pagedata.hxx:45
void DPMouseButtonUp(const MouseEvent &rMEvt)
Definition: gridwin2.cxx:653
tools::Long Width() const
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(const OUString &rName) const
Definition: dpsave.cxx:845
bool DoPageFieldSelection(SCCOL nCol, SCROW nRow)
Definition: gridwin2.cxx:94
size_t initMembers(int nMaxMemberWidth=-1)
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
const OUString & GetString() const
Definition: userlist.hxx:54
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:274
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:823
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)
tools::Long Top() const
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: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:4374
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
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: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:50
PointerStyle
ScCheckListMenuControl & get_widget()
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:994
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:1531
#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:691
void setBoundingBox(const Point &rPos, const Size &rSize, bool bLayoutRTL)
Definition: dpcontrol.cxx:54