25 #include <osl/diagnose.h>
33 #include <document.hxx>
45 #define SC_HDRPAINT_SEL_BOTTOM 4
46 #define SC_HDRPAINT_BOTTOM 5
47 #define SC_HDRPAINT_TEXT 6
48 #define SC_HDRPAINT_COUNT 7
53 pSelEngine ( pSelectionEngine ),
54 aShowHelpTimer(
"sc HeaderControl Popover Timer"),
55 bVertical ( bNewVertical ),
64 nTipVisible ( nullptr ),
66 bIgnoreMove (
false ),
111 OSL_ENSURE(
bVertical,
"SetWidth works only on row headers" );
148 bool bEnabled =
SC_MOD()->GetInputOptions().GetMarkHeader();
166 if ( nNewStart == nOldStart )
168 if ( nNewEnd != nOldEnd )
169 DoPaint( std::min( nNewEnd, nOldEnd ) + 1, std::max( nNewEnd, nOldEnd ) );
171 else if ( nNewEnd == nOldEnd )
172 DoPaint( std::min( nNewStart, nOldStart ), std::max( nNewStart, nOldStart ) - 1 );
173 else if ( nNewStart > nOldEnd || nNewEnd < nOldStart )
180 DoPaint( std::min( nNewStart, nOldStart ), std::max( nNewEnd, nOldEnd ) );
194 if (nEntryNo >=
nSize)
214 nScrPos = nMax - nScrPos - 2;
277 nTransStart = nTransEnd;
295 nLineEnd += nSizePix * nLayoutSign;
299 tools::Long nLineStart = nLineEnd - ( nSizePix - 1 ) * nLayoutSign;
300 if ( nLineStart * nLayoutSign < nTransStart * nLayoutSign )
301 nTransStart = nLineStart;
302 if ( nLineEnd * nLayoutSign > nTransEnd * nLayoutSign )
303 nTransEnd = nLineEnd;
306 if ( nLineEnd * nLayoutSign > nPEnd * nLayoutSign )
325 if ( nLineEnd * nLayoutSign >= nInitScrPos * nLayoutSign )
335 if ( nLineEnd * nLayoutSign < nPEnd * nLayoutSign )
345 if ( nLineEnd * nLayoutSign >= nPStart * nLayoutSign )
347 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign )
383 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast )
397 std::vector<sc::ColRowSpan> aSpans;
409 if (nTotal > nSelected)
422 if (!pDocColl->
empty())
425 for (
const auto& rxDB : rDBs)
427 if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
431 rxDB->GetFilterSelCount(nSelected, nTotal);
432 if (nTotal > nSelected)
435 rxDB->GetArea(aRange);
438 if (rxDB->HasHeader())
470 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && bHighContrast && !bDark )
497 aScrPos =
Point( 0, nScrPos );
499 aScrPos =
Point( nScrPos, 0 );
502 if ( nEntryNo >= nSize )
503 nScrPos = nPEnd + nLayoutSign;
512 nCount += nHidden - 1;
514 else if ((nScrPos+nSizePix*nLayoutSign)*nLayoutSign >= nPStart*nLayoutSign)
516 Point aEndPos(aScrPos);
518 aEndPos =
Point( aScrPos.X()+nBarSize-1, aScrPos.Y()+(nSizePix-1)*nLayoutSign );
520 aEndPos =
Point( aScrPos.X()+(nSizePix-1)*nLayoutSign, aScrPos.Y()+nBarSize-1 );
532 aGrid.
AddHorLine(
true, aScrPos.X(), aEndPos.X(), aEndPos.Y());
534 aGrid.
AddVerLine(
true, aEndPos.X(), aScrPos.Y(), aEndPos.Y());
538 if ( nEntryNo+1 < nSize )
543 Point(aEndPos.X(),aEndPos.Y()-nLayoutSign) );
546 Point(aEndPos.X()-nLayoutSign,aEndPos.Y()) );
556 bool bAutoFilterPos =
false;
557 for (
const auto& rSpan : aSpans)
559 if (nEntryNo >= rSpan.mnStart && nEntryNo <= rSpan.mnEnd)
561 bAutoFilterPos =
true;
570 else if (bAutoFilterPos)
594 Point aTxtPos(aScrPos);
597 aTxtPos.AdjustX((nBarSize-aTextSize.
Width())/2 );
598 aTxtPos.AdjustY((nSizePix*nLayoutSign-aTextSize.
Height())/2 );
604 aTxtPos.AdjustX((nSizePix*nLayoutSign-aTextSize.
Width()+1)/2 );
605 aTxtPos.AdjustY((nBarSize-aTextSize.
Height())/2 );
615 nScrPos += nSizePix * nLayoutSign;
619 while ( nScrPos * nLayoutSign <= nPEnd * nLayoutSign );
641 nScrPos =
GetScrPos( nPos ) - nLayoutSign;
644 if (nEntryNo >
nSize)
645 nScrPos = nEndPos + nLayoutSign;
649 nDif = nMousePos - nScrPos;
650 if (nDif >= -2 && nDif <= 2)
655 else if (nDif * nLayoutSign >= 0 && nEntryNo <
nSize)
659 while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
672 sal_uInt16 nTab = rViewData.
GetTabNo();
675 bool bSelectAllowed =
true;
679 bool bCellsProtected =
false;
697 bSelectAllowed = bSelProtected;
699 bSelectAllowed = bSelUnprotected;
701 return bSelectAllowed;
718 if (
SC_MOD()->IsFormulaMode() )
744 if ( nClicks && nClicks%2==0 )
807 if (
SC_MOD()->IsFormulaMode() )
827 tools::Long nNewWidth = bLayoutRTL ? ( nScrPos - nMousePos + 1 )
828 : ( nMousePos + 2 - nScrPos );
834 while (nNewWidth < 0)
930 if ( nCmd == CommandEventId::ContextMenu )
946 SC_MOD()->InputEnterHandler();
958 aNewRange =
ScRange( 0, sal::static_int_cast<SCROW>(nPos), nTab,
959 rDoc.
MaxCol(), sal::static_int_cast<
SCROW>(nPos), nTab );
961 aNewRange =
ScRange( sal::static_int_cast<SCCOL>(nPos), 0, nTab,
962 sal::static_int_cast<SCCOL>(nPos), rDoc.
MaxRow(), nTab );
967 bool bSelected = aRanges.Intersects(aNewRange);
977 else if ( nCmd == CommandEventId::StartDrag )
1028 aRect.
SetLeft( aMousePos.X() );
1029 aRect.
SetTop( aPos.Y() - 4 );
1030 nAlign = QuickHelpFlags::Bottom|QuickHelpFlags::Center;
1036 aRect.
SetTop( aMousePos.Y() - 2 );
1037 nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
1064 Window::RequestHelp(rHEvt);
ScMarkData & GetMarkData()
#define LINK(Instance, Class, Member)
tools::Long GetTextHeight() const
#define SC_HDRPAINT_BOTTOM
bool SelMouseButtonDown(const MouseEvent &rMEvt)
void InitRefMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType)
bool HasAutoFilter() const
Point GetPointerPosPixel()
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
void GetFilterSelCount(SCSIZE &nSelected, SCSIZE &nTotal)
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
void setWidth(tools::Long nWidth)
void Merge(const Color &rMergeColor, sal_uInt8 cTransparency)
virtual void EnableRTL(bool bEnable=true)
const Color & GetHighlightTextColor() const
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
sheet protection state container
void AddVerLine(bool bWorksInPixels, tools::Long nX, tools::Long nY1, tools::Long nY2, bool bDashed=false)
void DoneRefMode(bool bContinue=false)
const StyleSettings & GetStyleSettings() const
const Color & GetFaceColor() const
virtual Size GetSizePixel() const
virtual void SetSizePixel(const Size &rNewSize)
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
void SetWeight(FontWeight)
bool HasEditView(ScSplitPos eWhich) const
ScSplitPos GetActivePart() const
ScDocument & GetDocument() const
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
virtual void dispose() override
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
void SetTextColor(const Color &rColor)
const Color & GetHighlightColor() const
constexpr tools::Long Width() const
sal_uInt16 GetClicks() const
bool isOptionEnabled(Option eOption) const
sal_uInt16 GetButtons() const
SC_DLLPUBLIC SCROW MaxRow() const
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
bool IsMouseEvent() const
static SfxViewShell * Current()
static void * ShowPopover(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rText, QuickHelpFlags nStyle)
bool GetHighContrastMode() const
void DrawLine(const Point &rStartPt, const Point &rEndPt)
ScViewData & GetViewData()
void DrawRect(const tools::Rectangle &rRect)
void AddHorLine(bool bWorksInPixels, tools::Long nX1, tools::Long nX2, tools::Long nY, bool bDashed=false)
void PutInOrder(T &nStart, T &nEnd)
const Color & GetDarkShadowColor() const
SC_DLLPUBLIC SCCOL MaxCol() const
Point LogicToPixel(const Point &rLogicPt) const
static void HidePopover(vcl::Window const *pParent, void *nId)
SfxDispatcher * GetDispatcher() const
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
bool SelMouseMove(const MouseEvent &rMEvt)
static bool IsQuickHelpEnabled()
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
bool SelMouseButtonUp(const MouseEvent &rMEvt)
IMPL_LINK_NOARG(ScHeaderControl, ShowDragHelpHdl, Timer *, void)
const AllSettings & GetSettings() const
CommandEventId GetCommand() const
virtual void Start(bool bStartTimer=true) override
bool IsMouseCaptured() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
virtual bool isProtected() const override
bool IsTrackingEnded() const
void SetWindow(vcl::Window *)
void SetColor(const Color &)
const Point & GetMousePosPixel() const
#define SC_HDRPAINT_COUNT
void SetVisibleArea(const tools::Rectangle &rNewArea)
Stores global named database ranges.
#define SC_HDRPAINT_SEL_BOTTOM
void SetPointer(PointerStyle)
const Color & GetButtonTextColor() const
constexpr tools::Long Height() const
void SetTransparent(bool bTransparent)
bool Command(const CommandEvent &rCEvt)
::OutputDevice const * GetOutDev() const
tools::Long AdjustWidth(tools::Long n)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
void SetInvokeHandler(const Link< Timer *, void > &rLink)
const vcl::Font & GetFont() const
const Point & GetPosPixel() const
tools::Long AdjustHeight(tools::Long n)
Size GetOutputSizePixel() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
void setHeight(tools::Long nHeight)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
bool IsTrackingCanceled() const
void SetFont(const vcl::Font &rNewFont)
Point OutputToScreenPixel(const Point &rPos) const
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
const MouseEvent & GetMouseEvent() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
bool m_bDetectedRangeSegmentation false
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const