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;
273 std::swap(nPStart, nPEnd);
274 std::swap(nTransStart, nTransEnd);
291 nLineEnd += nSizePix * nLayoutSign;
295 tools::Long nLineStart = nLineEnd - ( nSizePix - 1 ) * nLayoutSign;
296 if ( nLineStart * nLayoutSign < nTransStart * nLayoutSign )
297 nTransStart = nLineStart;
298 if ( nLineEnd * nLayoutSign > nTransEnd * nLayoutSign )
299 nTransEnd = nLineEnd;
302 if ( nLineEnd * nLayoutSign > nPEnd * nLayoutSign )
321 if ( nLineEnd * nLayoutSign >= nInitScrPos * nLayoutSign )
331 if ( nLineEnd * nLayoutSign < nPEnd * nLayoutSign )
341 if ( nLineEnd * nLayoutSign >= nPStart * nLayoutSign )
343 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign )
386 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast )
400 std::vector<sc::ColRowSpan> aSpans;
412 if (nTotal > nSelected)
425 if (!pDocColl->
empty())
428 for (
const auto& rxDB : rDBs)
430 if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
434 rxDB->GetFilterSelCount(nSelected, nTotal);
435 if (nTotal > nSelected)
438 rxDB->GetArea(aRange);
441 if (rxDB->HasHeader())
473 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && bHighContrast && !bDark )
500 aScrPos =
Point( 0, nScrPos );
502 aScrPos =
Point( nScrPos, 0 );
505 if ( nEntryNo >=
nSize )
506 nScrPos = nPEnd + nLayoutSign;
517 else if ((nScrPos+nSizePix*nLayoutSign)*nLayoutSign >= nPStart*nLayoutSign)
519 Point aEndPos(aScrPos);
521 aEndPos =
Point( aScrPos.
X()+nBarSize-1, aScrPos.
Y()+(nSizePix-1)*nLayoutSign );
523 aEndPos =
Point( aScrPos.
X()+(nSizePix-1)*nLayoutSign, aScrPos.
Y()+nBarSize-1 );
535 aGrid.
AddHorLine(
true, aScrPos.
X(), aEndPos.
X(), aEndPos.
Y());
537 aGrid.
AddVerLine(
true, aEndPos.
X(), aScrPos.
Y(), aEndPos.
Y());
541 if ( nEntryNo+1 <
nSize )
546 Point(aEndPos.
X(),aEndPos.
Y()-nLayoutSign) );
549 Point(aEndPos.
X()-nLayoutSign,aEndPos.
Y()) );
559 bool bAutoFilterPos =
false;
560 for (
const auto& rSpan : aSpans)
562 if (nEntryNo >= rSpan.mnStart && nEntryNo <= rSpan.mnEnd)
564 bAutoFilterPos =
true;
573 else if (bAutoFilterPos)
597 Point aTxtPos(aScrPos);
601 aTxtPos.
AdjustY((nSizePix*nLayoutSign-aTextSize.
Height())/2 );
607 aTxtPos.
AdjustX((nSizePix*nLayoutSign-aTextSize.
Width()+1)/2 );
618 nScrPos += nSizePix * nLayoutSign;
622 while ( nScrPos * nLayoutSign <= nPEnd * nLayoutSign );
647 if (nEntryNo >
nSize)
648 nScrPos = nEndPos + nLayoutSign;
652 nDif = nMousePos - nScrPos;
653 if (nDif >= -2 && nDif <= 2)
658 else if (nDif * nLayoutSign >= 0 && nEntryNo <
nSize)
662 while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
675 sal_uInt16 nTab = rViewData.
GetTabNo();
678 bool bSelectAllowed =
true;
682 bool bCellsProtected =
false;
700 bSelectAllowed = bSelProtected;
702 bSelectAllowed = bSelUnprotected;
704 return bSelectAllowed;
721 if (
SC_MOD()->IsFormulaMode() )
746 if ( nClicks && nClicks%2==0 )
809 if (
SC_MOD()->IsFormulaMode() )
829 tools::Long nNewWidth = bLayoutRTL ? ( nScrPos - nMousePos + 1 )
830 : ( nMousePos + 2 - nScrPos );
836 while (nNewWidth < 0)
931 if ( nCmd == CommandEventId::ContextMenu )
947 SC_MOD()->InputEnterHandler();
959 aNewRange =
ScRange( 0, sal::static_int_cast<SCROW>(
nPos), nTab,
960 rDoc.
MaxCol(), sal::static_int_cast<SCROW>(
nPos), nTab );
962 aNewRange =
ScRange( sal::static_int_cast<SCCOL>(
nPos), 0, nTab,
963 sal::static_int_cast<SCCOL>(
nPos), rDoc.
MaxRow(), nTab );
968 bool bSelected = aRanges.
Intersects(aNewRange);
978 else if ( nCmd == CommandEventId::StartDrag )
1031 nAlign = QuickHelpFlags::Bottom|QuickHelpFlags::Center;
1037 aRect.
SetTop( aMousePos.
Y() - 2 );
1038 nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
1065 Window::RequestHelp(rHEvt);
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 ...
void PutInOrder(T &nStart, T &nEnd)
const StyleSettings & GetStyleSettings() const
void Merge(const Color &rMergeColor, sal_uInt8 cTransparency)
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
static bool IsQuickHelpEnabled()
static void * ShowPopover(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rText, QuickHelpFlags nStyle)
static void HidePopover(vcl::Window const *pParent, void *nId)
sal_uInt16 GetClicks() const
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
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)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
Stores global named database ranges.
bool HasAutoFilter() const
void GetFilterSelCount(SCSIZE &nSelected, SCSIZE &nTotal)
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
void AddHorLine(bool bWorksInPixels, tools::Long nX1, tools::Long nX2, tools::Long nY, bool bDashed=false)
void AddVerLine(bool bWorksInPixels, tools::Long nX, tools::Long nY1, tools::Long nY2, bool bDashed=false)
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
bool Intersects(const ScRange &) const
void DoneRefMode(bool bContinue=false)
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
void InitRefMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType)
ScViewData & GetViewData()
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
sheet protection state container
bool isOptionEnabled(Option eOption) const
virtual bool isProtected() const override
ScMarkData & GetMarkData()
ScDocument & GetDocument() const
ScSplitPos GetActivePart() const
bool HasEditView(ScSplitPos eWhich) const
bool Command(const CommandEvent &rCEvt)
bool SelMouseMove(const MouseEvent &rMEvt)
bool SelMouseButtonDown(const MouseEvent &rMEvt)
void SetWindow(vcl::Window *)
void SetVisibleArea(const tools::Rectangle &rNewArea)
bool SelMouseButtonUp(const MouseEvent &rMEvt)
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
SfxDispatcher * GetDispatcher() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetDarkShadowColor() const
bool GetHighContrastMode() const
const Color & GetAccentColor() const
const Color & GetHighlightColor() const
const Color & GetFaceColor() const
const Color & GetHighlightTextColor() const
const Color & GetButtonTextColor() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
bool IsTrackingEnded() const
bool IsTrackingCanceled() const
const MouseEvent & GetMouseEvent() const
void SetTransparent(bool bTransparent)
void SetColor(const Color &)
void SetWeight(FontWeight)
Point OutputToScreenPixel(const Point &rPos) const
virtual void dispose() override
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
void SetFont(const vcl::Font &rNewFont)
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
bool IsMouseCaptured() const
Point LogicToPixel(const Point &rLogicPt) const
virtual void SetSizePixel(const Size &rNewSize)
virtual void EnableRTL(bool bEnable=true)
tools::Long GetTextHeight() const
const AllSettings & GetSettings() const
::OutputDevice const * GetOutDev() const
const vcl::Font & GetFont() const
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
Point GetPointerPosPixel()
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
virtual void SetPointer(PointerStyle)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void SetTextColor(const Color &rColor)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define SC_HDRPAINT_COUNT
IMPL_LINK_NOARG(ScHeaderControl, ShowDragHelpHdl, Timer *, void)
#define SC_HDRPAINT_BOTTOM
#define SC_HDRPAINT_SEL_BOTTOM
#define LINK(Instance, Class, Member)
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW