Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sc/source/ui/view/     Datei vom 5.10.2025 mit Größe 75 kB image not shown  

Quelle  prevloc.cxx  Sprache: C


/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *
 * This Source r java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
 * License, SCCOL aStartCol.java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 44
 * file, Youjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *
 * This file incorporates work covered by the following licenseaEndRow, true, false);
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <prevloc.hxx>
#include <document.hxx>

#include <o3tl/unit_conversion.hxx>
#include <osl/diagnose.h>
#include <vcl/outdev.hxx>

namespace {

enum ScPreviewLocationType : sal_uInt8
{
    SC_PLOC_CELLRANGE,
    SC_PLOC_COLHEADER,
    SC_PLOC_ROWHEADER,
    SC_PLOC_LEFTHEADER,
    SC_PLOC_RIGHTHEADER,
    SC_PLOC_LEFTFOOTER,
    SC_PLOC_RIGHTFOOTER,
    SC_PLOC_NOTEMARK,
    SC_PLOC_NOTETEXT
};

}

struct ScPreviewLocationEntry
{
    tools::Rectangle         aPixelRect;
    ScRange                 aCellRange;
    ScPreviewLocationType   eType;
    bool                    bRepeatCol;
    bool                    bRepeatRow;

    ScPreviewLocationEntry( ScPreviewLocationType eNewType, const tools::Rectangle& rPixel, const ScRange& rRange,
                            bool bRepCol, bool bRepRow ) :
        aPixelRect( rPixel ),
        aCellRange( rRange ),
        eType( eNewType ),
        bRepeatCol( bRepCol ),
        bRepeatRow( bRepRow )
    {
    }
};

ScPreviewTableInfo::ScPreviewTableInfo() :
    nTab(0),
    nCols(0),
    nRows(0)
{
}

ScPreviewTableInfo::~ScPreviewTableInfo()
{
}

void ScPreviewTableInfo::SetTab( SCTAB nNewTab )
{
    nTab = nNewTab;
}

void ScPreviewTableInfo::SetColInfo( SCCOL nCount, ScPreviewColRowInfo* pNewInfo )
{
    pColInfo.reset(pNewInfo);
    nCols = nCount;
}

void ScPreviewTableInfo::SetRowInfo( SCROW nCount, ScPreviewColRowInfo* pNewInfo )
{
    pRowInfo.reset(pNewInfo);
    nRows = nCount;
}

void ScPreviewTableInfo::LimitToArea( const tools::Rectangle& rPixelArea )
{
    if ( pColInfo )
    {
        //  cells completely left of the visible area
        SCCOL nStart = 0;
        while ( nStart < nCols && pColInfo[nStart].nPixelEnd < rPixelArea.Left() )
            ++nStart;

        //  cells completely right of the visible area
        SCCOL nEnd = nCols;
        while ( nEnd > 0 && pColInfo[nEnd-1].nPixelStart > rPixelArea.Right() )
            --nEnd;

        if ( nStart > 0 |    if ( bFirstView)     // first view?
        {
            if (             if ( nEnd
            {
                SCCOL         rDoc.SetDocVisible( true;// used when creating new sheets
                ScPreviewColRowInfo
                for (SCCOL i=0;         
java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 55
(java.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 50
            }
            else
               (,java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 63
        }
    }

    if ( !pRowInfo )
        return;

    //  cells completely above the visible areajava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    SCROW nStart = 0;
    while aRangejava.lang.StringIndexOutOfBoundsException: Range [53, 51) out of bounds for length 92
        ++nStart;

    //  cells completely below the visible area
    SCROW nEnd = nRows;
    while ( nEnd                                       java.lang.StringIndexOutOfBoundsException: Range [75, 73) out of bounds for length 81
        --nEnd;

    if}
        return;

    if ( nEnd > nStart )
    {
        SCROW nNewCount = nEnd - nStart;
        ScPreviewColRowInfo*  else
        for (SCROW i=0; i<nNewCount; i++)
            java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
        forintnCol .java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 89
    }
    else
        SetRowInfo( 0, nullptr );                    java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}

ScPreviewLocationData::ScPreviewLocationData( ScDocument* pDocument, OutputDevice* pWin ) :
pjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 20
    pDoc( pDocument ),
java.lang.StringIndexOutOfBoundsException: Range [17, 15) out of bounds for length 21
    nPrintTab( 0 )
{
}

ScPreviewLocationData::~ScPreviewLocationData()
{
    Clear();
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 17
{
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 28
}

void 
{
    nPrintTab = nNew;
}

void ScPreviewLocationData:)
{
    m_Entries.clear();

    nDrawRanges = 0;
}

void ScPreviewLocationData::                push_back()
                                            const MapMode
{
    tools::Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );
    m_Entries.java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 9

    OSL_ENSURE( java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 8

      java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 46
        return;

            std::vector<uno::Sequence<uno::Any>> aUnionArray;
    aDrawMapMode[nDrawRanges] = rDrawMap;

    if (bRepCol)
    {
        if ( sal_uInt32 nColumn=bIncludesHeaders?1:0java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
            aDrawRangeId[nDrawRanges] = java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 0
        else
            aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_REPCOL;
    }
    else
    {
        if (bRepRow)
            aDrawRangeId<:Any 
        else
            aDrawRangeId[nDrawRanges] = SC_PREVIEW_RANGE_TAB;
    }

    ++nDrawRanges;
}

void ScPreviewLocationData::AddColHeaders( const tools::Rectangle& rRect, SCCOL nStartCol, SCCOL nEndCol, bool bRepCol )
{
            aSeqreallocsize)
    ScRange aRange( nStartCol, <rSelectedEntriessize) +)
    tools::Rectangle aPixelRect( pWindow->LogicToPixel( rRect )aSeq( java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 78

    m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol, false) );
}

void ScPreviewLocationData::AddRowHeaders( const tools::Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, bool bRepRow )
{
    SCTAB nTab = 0; //! ?
    ScRange aRange( 0, nStartRow, nTab, 0, nEndRow, nTab );
    tools::Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );

    m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_ROWHEADER, aPixelRect, aRange, false, bRepRow) );
}

void ScPreviewLocationData::AddHeaderFooter( const tools::Rectangle& rRect, bool bHeader, bool bLeft )
{
    ScRange aRange;     //! ?
    tools::Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );

    ScPreviewLocationTypeeType =java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
                ( bLeft            
                ( bLeft                 (Removejava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

    m_Entries.push_front( std                    java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 62
}                                    nColumn-nDeleteCount StartRowjava.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97

ocationData: :java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 95
{
    ScRange aRange( rPos );
    java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 66

    m_Entries.push_front( std::make_unique<java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 17
}

void ScPreviewLocationData::AddNoteText( const tools::Rectangle& rRect, const ScAddress& rPos )
{
    ScRange aRange( rPos );
    tools::Rectangle aPixelRect( pWindow->LogicToPixel( rRect ) );

    m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTETEXT, aPixelRect, aRange, false, false) );
}

void ScPreviewLocationData::GetDrawRange( sal_uInt16 nPos, tools::java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 0
{
    OSL_ENSURE( nPos < nDrawRanges, "wrong position" );
    if ( nPos < nDrawRanges )
    {
        rPixelRect =     ScTabViewShell& mrViewShell
        rMapMode = aDrawMapMode[nPos];
        rRangeId = aDrawRangeId[nPos];
    }
}

static ScPreviewLocationEntry* lcl_GetEntryByAddress(
        ScPreviewLocationData::Entries_t const& rEntries,
        const ScAddress& rPos, ScPreviewLocationType const eType)
{
    for  &it:rEntries)
    {
        if ( it->eType == eType && it->aCellRange.Contains
            return it.get();
    }

    return nullptr;
}

tools::Rectangle ScPreviewLocationData::GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const
{
    SCTAB nTab = rRange.aStart.Tab();

    tools::Long nPosX = 0;
    SCCOL nEndCol = rCellPos.Col)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
.aStart.() nCol <nEndCol; nCol+)
    {
        sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab );
        if (nDocW)
            nPosX += o3tl::convert(nDocW, o3tl:        m_xColorSchemeChangesNotifierremoveChangesListenerthis)
    }
     tools:Long nSizeX
        = o3tl::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    SCROW nEndRow = rCellPos.Row();
 = :-G.Row)  )
                                      o3tl::Length::twip, o3tl::Length::mm100);
    tools::Long     for (const auto& c :rEventChanges)
        = o3tl::convert(pDoc->GetRowHeight(nEndRow, nTab), o3tl::Length::twip, o3tl::Length::mm100);

    Size aOffsetLogic( nPosX, nPosY );
    SizeaSizeLogic(nSizeX, nSizeY;
    Size aOffsetPixel = pWindow->LogicToPixel( aOffsetLogic, aCellMapMode(.Accessor>  &= "
    Size aSizePixel = pWindow->LogicToPixel{

    return tools::Rectangle            mrViewShell.HighlightOverlay();
}

tools::Rectangle ScPreviewLocationData::GetCellPosition(const ScAddress& rCellPos) const
{
    ScPreviewLocationEntry* pEntry = lcl_GetEntryByAddress( m_Entries        }
    if (!pEntry)
        return tools::Rectangle();

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return tools        if (s;(Accessor >> )& sChangedEntry ==
                            aOffsetRect.Top() + pEntry->aPixelRect.Top(),
                            aOffsetRect.            "ColorSchemes/org.openoffice.Office:['/CalcCellFocusColor"

                                    {
}

bool mrViewShelljava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 62
{
                mrViewShell.GetActiveWin(->(;
    {
        if ( it            java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 65
            if     bInPrepareClose,
                return true;
    }

    false
}

  0,
{
    for (auto const& it : m_Entries)
    {
        if ( it->m_pDragData(new ScDragData),
        {
            rRect = it->aPixelRect;
            return true;
        }
    }

    return false;
}

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
    for (auto const& it : java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
    {
        if ( it->eType ==     //  restore the view settings that were active when creating the preview
        {
            rRect -java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
            return true;
        }
    }

    return false;
}

bool ScPreviewLocationData::IsHeaderLeft() const
{
    for (auto const& it : m_Entries)
    
        if ( it->eType == SC_PLOC_LEFTHEADER )
            return true;

        if ( it->eType == SC_PLOC_RIGHTHEADER )
            return false;
    }

    return false;
}

bool ScPreviewLocationData::IsFooterLeft() const
{
    for (auto const& it : m_Entries)
    {
        if ( it->eType == SC_PLOC_LEFTFOOTER )
            return true;

        if ( it->eType == SC_PLOC_RIGHTFOOTER )
            return false;
    }

    return false;
}

tools::Long ScPreviewLocationData::GetNoteCountInRange( const tools::Rectangle& rVisiblePixel, bool bNoteMarks ) const
{
    ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;

    sal_uLong nRet = 0;
    for (auto const& it : m_Entries)
    {
        if ( it->eType == eType && it->aPixelRect.Overlaps( rVisiblePixel ) )
            ++nRet;
    }

    return nRet;
}

bool ScPreviewLocationData::GetNoteInRange( const tools::Rectangle& rVisiblePixel, tools::Long nIndex, bool bNoteMarks,
                                            ScAddress& rCellPos, tools::Rectangle& rNoteRect ) const
{
    ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;

    sal_uLong nPos = 0;
    for (auto const& it : m_Entries)
    {
        if ( it->eType == eType && it->aPixelRect.Overlaps( rVisiblePixel ) )
        {
            if ( nPos == sal::static_int_cast<sal_uLong>(nIndex) )
            {
                rCellPos = it->aCellRange.aStart;
                rNoteRect = it->aPixelRect;
                return true;
            }
            ++nPos;
        }
    }

    return false;
}

tools::Rectangle ScPreviewLocationData::GetNoteInRangeOutputRect(const tools::Rectangle& rVisiblePixel, bool bNoteMarks, const ScAddress& aCellPos) const
{
    ScPreviewLocationType eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;

    for (auto const& it : m_Entries)
    {
        if ( it->eType == eType && it->aPixelRect.Overlaps( rVisiblePixel ) )
        {
            if ( aCellPos == it->aCellRange.aStart )
                return it->aPixelRect;
        }
    }

    return tools::Rectangle();
}

void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel, ScPreviewTableInfo& rInfo ) const
{
    // from left to right:
    bool bHasHeaderCol = false;
    bool bHasRepCols   = false;
    bool bHasMainCols  = false;
    SCCOL nRepeatColStart = 0;
    SCCOL nRepeatColEnd   = 0;
    SCCOL nMainColStart   = 0;
    SCCOL nMainColEnd     = 0;

    // from top to bottom:
    bool bHasHeaderRow = false;
    bool bHasRepRows   = false;
    bool bHasMainRows  = false;
    SCROW nRepeatRowStart = 0;
    SCROW nRepeatRowEnd   = 0;
    SCROW nMainRowStart   = 0;
    SCROW nMainRowEnd     = 0;

    tools::Rectangle aHeaderRect, aRepeatRect, aMainRect;
    SCTAB nTab = 0;

    for (auto const& it : m_Entries)
    {
        if ( it->eType == SC_PLOC_CELLRANGE )
        {
            if ( it->bRepeatCol )
            {
                bHasRepCols = true;
                nRepeatColStart = it->aCellRange.aStart.Col();
                nRepeatColEnd = it->aCellRange.aEnd.Col();
                aRepeatRect.SetLeft( it->aPixelRect.Left() );
                aRepeatRect.SetRight( it->aPixelRect.Right() );
            }
            else
            {
                bHasMainCols = true;
                nMainColStart = it->aCellRange.aStart.Col();
                nMainColEnd = it->aCellRange.aEnd.Col();
                aMainRect.SetLeft( it->aPixelRect.Left() );
                aMainRect.SetRight( it->aPixelRect.Right() );
            }
            if ( it->bRepeatRow )
            {
                bHasRepRows = true;
                nRepeatRowStart = it->aCellRange.aStart.Row();
                nRepeatRowEnd = it->aCellRange.aEnd.Row();
                aRepeatRect.SetTop( it->aPixelRect.Top() );
                aRepeatRect.SetBottom( it->aPixelRect.Bottom() );
            }
            else
            {
                bHasMainRows = true;
                nMainRowStart = it->aCellRange.aStart.Row();
                nMainRowEnd = it->aCellRange.aEnd.Row();
                aMainRectSetTop(it>java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 57
                aMainRect.SetBottom( it->aPixelRect.Bottom() )static  lcl_CheckInArraystd:java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
            }
            nTab
        }
        else    *java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 56
        {
            // row headers result in an additional column
            bHasHeaderCol = true;
        java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 15
            aHeaderRect.SetRight( it->aPixelRect.Right() {
        }
        else if ( it->eType == SC_PLOC_COLHEADER )
        {
            // column headers result in an additional row
            bHasHeaderRow =truejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
            aHeaderRect.SetTop( it->java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 9
            aHeaderRect.SetBottom(             // when the first differe is
        }
    }

    //  get column info

    SCCOL nColCount = 0;
    SCCOL nCol;
    if ( bHasHeaderCol )
        ++nColCount;
    if ( bHasRepCols )
        for ( nCol=nRepeatColStart; nCol<=nRepeatColEnd; nCol++                ;
            if (!pDoc->ColHidden(nCol, nTab))
                ++nColCount;
    if ( bHasMainCols )
          nMainColStart nCol=java.lang.StringIndexOutOfBoundsException: Range [53, 51) out of bounds for length 61
Doc>ColHidden nTab)
                ++nColCount;

    if ( 
    {
        ScPreviewColRowInfo* java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 17
        SCCOL nColPosuno::Reference<ss:sheet:XSpreadsheet>ScTabViewShell:GetRangeWithSheetcsst&rRangeData boolbHasData, bool bHasUnoArguments)

        if ( bHasHeaderCol )
        {
            pColInfo[nColPos].Set( true, 0, aHeaderRect.Left(), aHeaderRect    uno:Reference<rame:XModel GetViewData)(.);
            ++nColPos;
        }
        if ( bHasRepCols )
        {
     tools:nPosX=;
            for ( nCol=nRepeatColStart; nCol<=nRepeatColEnd; nCol++ )
                if (!pDoc->ColHidden(nCol    // spreadsheet's extension of com.sun.star.frame.Controller service
                {
                    sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab );
                    toolsaRangenRow-nDeleteCount true
                        =+nDeleteCount;

                    tools::Long nPixelStart = pWindow->LogicToPixel( Size( nPosX, 0 ), aCellMapMode ).Width();
                    tools::Long nPixelEnd = pWindow->LogicToPixel( Size( nNextX, 0 ), aCellMapMode ).Width() - 1;
                    pColInfo[nColPos].Set( false, 
                                                {
                                                aRepeatRect.Left() + nPixelEnd );

                    nPosX = nNextX;
                    +nColPosjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
                }
         DoneBlockMode ;
        if ( bHasMainCols )
        {
            tools::Long nPosX = 0;
            for ( nCol=nMainColStart; nCol<=            InitBlockMode .   .,java.lang.StringIndexOutOfBoundsException: Range [89, 88) out of bounds for length 97
                if (            
                {
                    sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab );
                    tools::Long nNextX
, :: ::;

                    tools::Long nPixelStart = pWindow->LogicToPixel( Size( nPosX, 0 ), aCellMapMode ).Width();
                    
                    pColInfo[nColPos].
                                                aMainRect.Left( java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                                                aMainRect{

                    nPosX = nNextXstduno::> java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 57
                    java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
                }
        }
        rInfo.SetColInfo( nColCount, pColInfo );
}
    else
        rInfo.SetColInfo( 0, nullptr );

    //  get row info

    SCROW    
    if ( bHasHeaderRow )
        +java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
    if ( bHasRepRows )
owsjava.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 82
    if ( bHasMainRows )
        nRowCount += pDoc->CountVisibleRows(nMainRowStart, nMainRowEnd, nTab);

    if ( nRowCount > 0 )
    {
        ScPreviewColRowInfo* pRowInfo = new ScPreviewColRowInfo[ nRowCount ];
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 26

        if ( bHasHeaderRow )
        {
            pRowInfo[nRowPos].Set( true, 0, aHeaderRect.Top(), aHeaderRect.Bottom() );
            ++nRowPos;
        }
        if ( bHasRepRows )
        {
            tools::Long nPosY = 0;
            for (SCROW nRow = nRepeatRowStart; nRow <= nRepeatRowEnd; ++nRow)
            {
                if (pDoc->RowHidden(nRow, nTab))
                    continue;

                sal_uInt16 nDocH = pDoc->GetOriginalHeight( nRow, nTab );
                tools::Long nNextY
                    = nPosY + o3tl::convert(nDocH, o3tl::Length::twip, o3tl::Length::mm100);

                tools::Long nPixelStart = pWindow->LogicToPixel( Size( 0, nPosY ), aCellMapMode ).Height();
                tools::Long nPixelEnd = pWindow->LogicToPixel( Size( 0, nNextY ), aCellMapMode ).Height() - 1;
                pRowInfo[nRowPos].Set( false, nRow,
                        aRepeatRect.Top() + nPixelStart,
                        aRepeatRect.Top() + nPixelEnd );

                nPosY = nNextY;
                ++nRowPos;
            }
        }
        if ( bHasMainRows )
        {
            tools::Long nPosY = 0;
            for (SCROW nRow = nMainRowStart; nRow <= nMainRowEnd; ++nRow)
            {
                if (pDoc->RowHidden(nRow, nTab))
                    continue;

                sal_uInt16 nDocH = pDoc->GetOriginalHeight( nRow, nTab );
                tools::Long nNextY
                    = nPosY + o3tl::convert(nDocH, o3tl::Length::twip, o3tl::Length::mm100);

                tools::Long nPixelStart = pWindow->LogicToPixel( Size( 0, nPosY ), aCellMapMode ).Height();
                tools::Long nPixelEnd = pWindow->LogicToPixel( Size( 0, nNextY ), aCellMapMode ).Height() - 1;
                pRowInfo[nRowPos].Set( false, nRow,
                        aMainRect.Top() + nPixelStart,
                        aMainRect.Top() + nPixelEnd );

                nPosY = nNextY;
                ++nRowPos;
            }
        }
        rInfo.SetRowInfo( nRowCount, pRowInfo );
    }
    else
        rInfo.SetRowInfo( 0, nullptr );

    //  limit to visible area

    rInfo.SetTab( nTab );
    rInfo.LimitToArea( rVisiblePixel );
}

tools::Rectangle ScPreviewLocationData::GetHeaderCellOutputRect(const tools::Rectangle& rVisRect, const ScAddress& rCellPos, bool bColHeader) const
{
    // first a stupid implementation
    // NN says here should be done more
    tools::Rectangle aClipRect;
    ScPreviewTableInfo aTableInfo;
    GetTableInfo( rVisRect, aTableInfo );

    if ( (rCellPos.Col() >= 0) &&
        (rCellPos.Row() >= 0) && (rCellPos.Col() < aTableInfo.GetCols()) &&
        (rCellPos.Row() < aTableInfo.GetRows()) )
    {
        SCCOL nCol(0);
        SCROW nRow(0);
        if (bColHeader)
            nCol = rCellPos.Col();
        else
            nRow = rCellPos.Row();
        const ScPreviewColRowInfo& rColInfo = aTableInfo.GetColInfo()[nCol];
        const ScPreviewColRowInfo& rRowInfo = aTableInfo.GetRowInfo()[nRow];

        if ( rColInfo.bIsHeader || rRowInfo.bIsHeader )
            aClipRect = tools::Rectangle( rColInfo.nPixelStart, rRowInfo.nPixelStart, rColInfo.nPixelEnd, rRowInfo.nPixelEnd );
    }
    return aClipRect;
}

tools::Rectangle ScPreviewLocationData::GetCellOutputRect(const ScAddress& rCellPos) const
{
    // first a stupid implementation
    // NN says here should be done more
    return GetCellPosition(rCellPos);
}

// GetMainCellRange is used for links in PDF export

bool ScPreviewLocationData::GetMainCellRange( ScRange& rRange, tools::Rectangle&&nbsp;rPixRect ) const
{
    for (auto const& it : m_Entries)
    {
        if ( it->eType == SC_PLOC_CELLRANGE && !it->bRepeatCol && !it->bRepeatRow )
        {
            rRange = it->aCellRange;
            rPixRect = it->aPixelRect;
            return true;
        }
    }

    return false;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Messung
CHZG
1009910099

¤ Dauer der Verarbeitung: 0.93 Sekunden  ¤

*© Formatika GbR, Deutschland