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 )
379 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast )
393 std::vector<sc::ColRowSpan> aSpans;
405 if (nTotal > nSelected)
418 if (!pDocColl->
empty())
421 for (
const auto& rxDB : rDBs)
423 if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
427 rxDB->GetFilterSelCount(nSelected, nTotal);
428 if (nTotal > nSelected)
431 rxDB->GetArea(aRange);
434 if (rxDB->HasHeader())
466 if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && bHighContrast && !bDark )
493 aScrPos =
Point( 0, nScrPos );
495 aScrPos =
Point( nScrPos, 0 );
498 if ( nEntryNo >=
nSize )
499 nScrPos = nPEnd + nLayoutSign;
510 else if ((nScrPos+nSizePix*nLayoutSign)*nLayoutSign >= nPStart*nLayoutSign)
512 Point aEndPos(aScrPos);
514 aEndPos =
Point( aScrPos.X()+nBarSize-1, aScrPos.Y()+(nSizePix-1)*nLayoutSign );
516 aEndPos =
Point( aScrPos.X()+(nSizePix-1)*nLayoutSign, aScrPos.Y()+nBarSize-1 );
528 aGrid.
AddHorLine(
true, aScrPos.X(), aEndPos.X(), aEndPos.Y());
530 aGrid.
AddVerLine(
true, aEndPos.X(), aScrPos.Y(), aEndPos.Y());
534 if ( nEntryNo+1 <
nSize )
539 Point(aEndPos.X(),aEndPos.Y()-nLayoutSign) );
542 Point(aEndPos.X()-nLayoutSign,aEndPos.Y()) );
552 bool bAutoFilterPos =
false;
553 for (
const auto& rSpan : aSpans)
555 if (nEntryNo >= rSpan.mnStart && nEntryNo <= rSpan.mnEnd)
557 bAutoFilterPos =
true;
566 else if (bAutoFilterPos)
590 Point aTxtPos(aScrPos);
593 aTxtPos.AdjustX((nBarSize-aTextSize.
Width())/2 );
594 aTxtPos.AdjustY((nSizePix*nLayoutSign-aTextSize.
Height())/2 );
600 aTxtPos.AdjustX((nSizePix*nLayoutSign-aTextSize.
Width()+1)/2 );
601 aTxtPos.AdjustY((nBarSize-aTextSize.
Height())/2 );
611 nScrPos += nSizePix * nLayoutSign;
615 while ( nScrPos * nLayoutSign <= nPEnd * nLayoutSign );
640 if (nEntryNo >
nSize)
641 nScrPos = nEndPos + nLayoutSign;
645 nDif = nMousePos - nScrPos;
646 if (nDif >= -2 && nDif <= 2)
651 else if (nDif * nLayoutSign >= 0 && nEntryNo <
nSize)
655 while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
668 sal_uInt16 nTab = rViewData.
GetTabNo();
671 bool bSelectAllowed =
true;
675 bool bCellsProtected =
false;
693 bSelectAllowed = bSelProtected;
695 bSelectAllowed = bSelUnprotected;
697 return bSelectAllowed;
714 if (
SC_MOD()->IsFormulaMode() )
739 if ( nClicks && nClicks%2==0 )
802 if (
SC_MOD()->IsFormulaMode() )
822 tools::Long nNewWidth = bLayoutRTL ? ( nScrPos - nMousePos + 1 )
823 : ( nMousePos + 2 - nScrPos );
829 while (nNewWidth < 0)
924 if ( nCmd == CommandEventId::ContextMenu )
940 SC_MOD()->InputEnterHandler();
952 aNewRange =
ScRange( 0, sal::static_int_cast<SCROW>(
nPos), nTab,
953 rDoc.
MaxCol(), sal::static_int_cast<SCROW>(
nPos), nTab );
955 aNewRange =
ScRange( sal::static_int_cast<SCCOL>(
nPos), 0, nTab,
956 sal::static_int_cast<SCCOL>(
nPos), rDoc.
MaxRow(), nTab );
961 bool bSelected = aRanges.
Intersects(aNewRange);
971 else if ( nCmd == CommandEventId::StartDrag )
1022 aRect.
SetLeft( aMousePos.X() );
1023 aRect.
SetTop( aPos.Y() - 4 );
1024 nAlign = QuickHelpFlags::Bottom|QuickHelpFlags::Center;
1030 aRect.
SetTop( aMousePos.Y() - 2 );
1031 nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
1058 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)
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 & 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)
virtual 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