22#include <osl/diagnose.h>
27#include <document.hxx>
37#define SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN 65
47 m_pViewData( pNewViewData ),
52 OSL_ENSURE(
m_pViewData,
"ViewData==0 at FunctionSet");
64 bool bLeftScroll,
bool bTopScroll,
bool bRightScroll,
bool bBottomScroll )
72 double nWinRight = rWinSize.
getWidth() + aRootPos.
getX();
73 double nMarginRight = aScrRect.
GetWidth() - nWinRight;
74 double nHOffset = rEffPos.
X() - rWinSize.
Width();
75 double nHAccelRate = nHOffset / nMarginRight;
77 if (nHAccelRate > 1.0)
85 double nMarginLeft = aRootPos.
getX();
86 double nHOffset = -rEffPos.
X();
87 double nHAccelRate = nHOffset / nMarginLeft;
89 if (nHAccelRate > 1.0)
93 if (nUpdateInterval > nTmp)
94 nUpdateInterval = nTmp;
100 double nMarginBottom = aScrRect.
GetHeight() - nWinBottom;
101 double nVOffset = rEffPos.
Y() - rWinSize.
Height();
102 double nVAccelRate = nVOffset / nMarginBottom;
104 if (nVAccelRate > 1.0)
108 if (nUpdateInterval > nTmp)
109 nUpdateInterval = nTmp;
114 double nMarginTop = aRootPos.
getY();
115 double nVOffset = -rEffPos.
Y();
116 double nVAccelRate = nVOffset / nMarginTop;
118 if (nVAccelRate > 1.0)
122 if (nUpdateInterval > nTmp)
123 nUpdateInterval = nTmp;
129 if (bRefMode && nUpdateInterval < SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN)
135 nUpdateInterval = SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN;
137 return nUpdateInterval;
194 ScRange aMarkRange = pTransferObj->GetRange();
197 SCCOL nHandleX = (nPosX >= nStartX) ? nPosX - nStartX : 0;
198 SCROW nHandleY = (nPosY >= nStartY) ? nPosY - nStartY : 0;
199 pTransferObj->SetDragHandlePos( nHandleX, nHandleY );
201 pTransferObj->SetVisibleTab( nTab );
203 pTransferObj->SetDragSource( pDocSh, rMark );
207 pWindow->
EndTracking( TrackingEventFlags::Cancel );
212 SC_MOD()->SetDragObject( pTransferObj.get(),
nullptr );
213 pTransferObj->StartDrag( pWindow, nDragActions );
224 bool bRefMode =
SC_MOD()->IsFormulaMode();
233 bool bRefMode =
SC_MOD()->IsFormulaMode();
280 bool bRefMode =
SC_MOD()->IsFormulaMode();
309 Point aEffPos = rPointPixel;
310 if ( aEffPos.
X() == 0 )
312 if ( aEffPos.
Y() == 0 )
317 bool bLeftScroll = ( aEffPos.
X() < 0 );
318 bool bTopScroll = ( aEffPos.
Y() < 0 );
323 nPosX, nPosY,
true, true );
335 if (bFillingSelection)
337 bBottomScroll = aEffPos.
Y() >= aWinSize.
Height();
338 bRightScroll = aEffPos.
X() >= aWinSize.
Width();
343 bBottomScroll = aEditArea.
Bottom() >= aWinSize.
Height();
344 bRightScroll = aEditArea.
Right() >= aWinSize.
Width();
347 bool bScroll = bRightScroll || bBottomScroll || bLeftScroll || bTopScroll;
350 if (bFillingSelection)
356 if ( bLeft && !bRightScroll )
357 do --nPosX;
while ( nPosX>=0 && rDoc.
ColHidden( nPosX, nTab ) );
358 if ( bTop && !bBottomScroll )
375 if ( aEffPos.
X() >= aWinSize.
Width() )
392 if ( aEffPos.
Y() >= aWinSize.
Height() )
413 aWinSize, aEffPos, bLeftScroll, bTopScroll, bRightScroll, bBottomScroll);
434 return nPosX >= startX && nPosX <= endX && nPosY >= startY && nPosY <= endY;
445 if (nPosX < 0 || nPosY < 0)
455 if ( bSkipProtected && bSkipUnprotected )
459 if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
507 SCCOL nStartX, nEndX;
508 SCROW nStartY, nEndY;
521 if ( nPosX+1 >= nStartX && nPosX <= nEndX &&
522 nPosY+1 >= nStartY && nPosY <= nEndY &&
523 ( nPosX != nEndX || nPosY != nEndY ) )
528 for (
SCCOL i=nPosX+1;
i<=nEndX;
i++)
532 SCCOL nDelStartX = nStartX;
533 SCROW nDelStartY = nStartY;
534 if ( nSizeX > nSizeY )
535 nDelStartX = nPosX + 1;
537 nDelStartY = nPosY + 1;
540 if ( nDelStartX < nStartX )
541 nDelStartX = nStartX;
542 if ( nDelStartY < nStartY )
543 nDelStartY = nStartY;
548 nEndX,nEndY,nTab ) );
572 bool bNegX = ( nPosX < nStartX );
573 bool bNegY = ( nPosY < nStartY );
580 do ++nPosX;
while ( nPosX<nStartX && rDoc.
ColHidden(nPosX, nTab) );
585 for (
SCCOL i=nEndX+1;
i<=nPosX;
i++)
593 if (++nPosY < nStartY)
604 if ( nSizeX > nSizeY )
615 SCCOL nRefStX = bNegX ? nEndX : nStartX;
616 SCROW nRefStY = bNegY ? nEndY : nStartY;
631 OSL_ENSURE( rDoc.
IsEmbedded(),
"!rDoc.IsEmbedded()" );
648 SCCOL nStartX, nEndX;
649 SCROW nStartY, nEndY;
659 if ( nPosX < nStartX ) nPosX = nStartX;
660 if ( nPosY < nStartY ) nPosY = nStartY;
688 pView->
MarkCursor( nPosX, nPosY, nTab,
false,
false,
true );
716 if ( nOldX != nPosX || nOldY != nPosY )
742 bool bRefMode =
SC_MOD()->IsFormulaMode();
771 bool bRefMode =
SC_MOD()->IsFormulaMode();
796 pViewData( pNewViewData ),
802 OSL_ENSURE(
pViewData,
"ViewData==0 at FunctionSet");
861 bScroll = ( rPointPixel.
X() < 0 || rPointPixel.
X() >= aWinSize.
Width() );
863 bScroll = ( rPointPixel.
Y() < 0 || rPointPixel.
Y() >= aWinSize.
Height() );
866 bool bSwitched =
false;
871 if ( rPointPixel.
X() > aWinSize.
Width() )
890 if ( rPointPixel.
Y() > aWinSize.
Height() )
915 nPosX, nPosY, false );
960 nPosX, nPosY,
false );
OUString GetURLNoPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
bool ValidRow(SCROW nRow) const
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
void GetEmbedded(ScRange &rRange) const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool IsMultiMarked() const
bool IsColumnMarked(SCCOL nCol) const
bool IsRowMarked(SCROW nRow) const
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
bool IsModalMode(SfxObjectShell *pDocSh=nullptr)
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
bool IsRefInputMode() const
void InitBlockMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bTestNeg=false, bool bCols=false, bool bRows=false, bool bForceNeg=false)
void FakeButtonUp(ScSplitPos eWhich)
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
void DoneBlockMode(bool bContinue=false)
void DoneRefMode(bool bContinue=false)
void SelectionChanged(bool bFromPaste=false)
void InitRefMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType)
void MarkCursor(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bCols=false, bool bRows=false, bool bCellSelection=false)
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
void ActivatePart(ScSplitPos eWhich)
void UpdateShrinkOverlay()
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
bool IsMarking(SCCOL nCol, SCROW nRow, SCTAB nTab) const
sheet protection state container
bool isOptionEnabled(Option eOption) const
ScFillMode GetFillMode() const
ScMarkData & GetMarkData()
void GetMouseQuadrant(const Point &rClickPos, ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, bool &rLeft, bool &rTop)
ScDocument & GetDocument() const
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
SCCOL GetRefStartX() const
ScRefType GetRefType() const
ScSplitMode GetHSplitMode() const
bool IsSelCtrlMouseClick() const
ScDocShell * GetDocShell() const
ScGridWindow * GetActiveWin()
void GetPosFromPixel(tools::Long nClickX, tools::Long nClickY, ScSplitPos eWhich, SCCOL &rPosX, SCROW &rPosY, bool bTestMerge=true, bool bRepair=false, SCTAB nForTab=-1)
void SetDelMark(const ScRange &rRange)
ScTabViewShell * GetViewShell() const
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
ScDBFunc * GetView() const
ScSplitPos GetActivePart() const
bool GetDelMark(ScRange &rRange) const
SCROW GetRefStartY() const
ScSplitMode GetVSplitMode() const
tools::Rectangle GetEditArea(ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, vcl::Window *pWin, const ScPatternAttr *pPattern, bool bForceToTop, bool bInPrintTwips=false)
SfxObjectShell * GetSfxDocShell() const
bool IsAnyFillMode() const
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
void SetRefStart(SCCOL nNewX, SCROW nNewY, SCTAB nNewZ)
bool SelectionEditable(bool *pOnlyNotBecauseOfMatrix=nullptr)
SC_DLLPUBLIC bool CopyToClip(ScDocument *pClipDoc, bool bCut, bool bApi=false, bool bIncludeObjects=false, bool bStopEdit=true)
virtual void DeselectAtPoint(const Point &rPointPixel) override
virtual void DeselectAll() override
bool SetCursorAtCell(SCCOL nPosX, SCROW nPosY, bool bScroll)
virtual void CreateAnchor() override
ScSplitPos GetWhich() const
virtual void BeginDrag() override
void SetAnchorFlag(bool bSet)
sal_uLong CalcUpdateInterval(const Size &rWinSize, const Point &rEffPos, bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll)
void SetSelectionEngine(ScViewSelectionEngine *pSelEngine)
ScViewFunctionSet(ScViewData *pNewViewData)
virtual void DestroyAnchor() override
void SetAnchor(SCCOL nPosX, SCROW nPosY)
virtual void SetCursorAtPoint(const Point &rPointPixel, bool bDontSelectAtCursor=false) override
bool CheckRefBounds(SCCOL nPosX, SCROW nPosY)
ScViewSelectionEngine * m_pEngine
virtual bool IsSelectionAtPoint(const Point &rPointPixel) override
ScSplitPos GetWhich() const
ScViewSelectionEngine(vcl::Window *pWindow, ScTabView *pView, ScSplitPos eSplitPos)
const MouseEvent & GetMouseEvent() const
const Point & GetMousePosPixel() const
void EnableDrag(bool bOn)
vcl::Window * GetWindow() const
void SetSelectionMode(SelectionMode eMode)
void SetUpdateInterval(sal_uLong nInterval)
static LOKDeviceFormFactor getDeviceFormFactor()
const INetURLObject & GetURLObject() const
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
SfxMedium * GetMedium() const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
tools::Rectangle GetDesktopRectPixel() const
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Size GetOutputSizePixel() const
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
sal_uInt16 nScFillModeMouseModifier
constexpr sal_uInt16 KEY_MOD1
static bool bDidSwitch
Member.
#define SELENG_AUTOREPEAT_INTERVAL_MAX
#define SELENG_AUTOREPEAT_INTERVAL
#define DND_ACTION_COPYMOVE
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
ScHSplitPos WhichH(ScSplitPos ePos)
ScRefType
Mouse mode to select areas.
ScVSplitPos WhichV(ScSplitPos ePos)