Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  sortresult.cxx  Sprache: C


/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source  @eturns <TRUE/> if the cursor is on a valid row; <FALSE/> if it is off
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
 *
 *  sal_Int32  =maS2O[mnCurEntry ]
 *
 *   Licensed to the Apache }
 *   contributor license agreements.     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 *   with java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
// XPropertySet methods.
 *   License
 *   except in
 *   Reference<java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 38
 */



#include "sortresult.hxx"
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#include <com/sun}
#include <com/sun/star/java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#include <com/sun/star/ucb/XAnyCompare.hpp>
#include <cppuhelper/implbase
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#include <comphelper/diagnose_ex.hxx>
#include <memory>

using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::lang;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
using namespace com::sun::star::util;
using namespace comphelper;
using namespace cppu;


struct SortInfo
{
    bool    mbUseOwnCompare;
    bool    mbAscending;
    bool    mbCaseSensitive;
    sal_Int32   mnColumn;
    sal_Int32   mnType;
    SortInfo*   mpNext;
    Reference < XAnyCompare >   mxCompareFunction;
};


struct SortListData
{
    bool        mbModified;
    sal_IntPtr  mnCurPos;
    sal_IntPtr  mnOldPos;

    explicit SortListData( sal_IntPtr nPos );
};




class SRSPropertySetInfo : public cppu::WeakImplHelper <
    XPropertySetInfo >
{
    Property    maProps[2];

private:

public:
                SRSPropertySetInfo();

    // XPropertySetInfo
    virtual Sequence< Property > SAL_CALL getProperties() override;
    virtual Property SAL_CALL getPropertyByName( const OUString& aName ) override;
    virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
};


SortedResultSet::SortedResultSet( Reference< XResultSet > const & aResult )
{
    mxOriginal  = aResult;
    mpSortInfo  = nullptr;
    mnLastSort  = 0;
    mnCurEntry  = 0;
    mnCount     = 0;
    mbIsCopy    = false;
}


SortedResultSet::~SortedResultSet()
{
    mxOriginal.clear();
    mxOther.clear();

    if ( !mbIsCopy )
    {
        SortInfo *pInfo = mpSortInfo;
        while ( pInfo )
        {
            mpSortInfo = pInfo->mpNext;
            delete pInfo;
            pInfo = mpSortInfo;
        }
    }

    mpSortInfo = nullptr;

    mpPropSetInfo.clear();
}


// XServiceInfo methods.

OUString SAL_CALL SortedResultSet::getImplementationName()
{
    return u"com.sun.star.comp.ucb.SortedResultSet"_ustr;
}

sal_Bool SAL_CALL SortedResultSet::supportsService( const OUString& ServiceName )
{
    return cppu::supportsService( this, ServiceName );
}

css::uno::Sequence< OUString > SAL_CALL SortedResultSet::getSupportedServiceNames()
{
    return { RESULTSET_SERVICE_NAME };
}


// XComponent methods.

void SAL_CALL SortedResultSet::dispose()
{
    std::unique_lock aGuard( maMutex );

    if ( maDisposeEventListeners.getLength(aGuard) )
    {
        EventObject aEvt;
        aEvt.Source = static_cast< XComponent * >( this );
        maDisposeEventListeners.disposeAndClear( aGuard, aEvt );
    }

    if ( maPropChangeListeners.hasContainedTypes(aGuard) )
    {
        EventObject aEvt;
        aEvt.Source = static_cast< XPropertySet * >( this );
        maPropChangeListeners.disposeAndClear( aGuard, aEvt );
    }

    if ( maVetoChangeListeners.hasContainedTypes(aGuard) )
    {
        EventObject aEvt;
        aEvt.Source = static_cast< XPropertySet * >( this );
        maVetoChangeListeners.disposeAndClear( aGuard, aEvt );
    }

    mxOriginal.clear();
    mxOther.clear();
}


void SAL_CALL SortedResultSet::addEventListener(
                            const Reference< XEventListener >& Listener )
{
    std::unique_lock aGuard( maMutex );

    maDisposeEventListeners.addInterface( aGuard, Listener );
}


void SAL_CALL SortedResultSet::removeEventListener(
                            const Reference< XEventListener >& Listener )
{
    std::unique_lock aGuard( maMutex );

    maDisposeEventListeners.removeInterface( aGuard, Listener );
}


// XContentAccess methods.


OUString SAL_CALL
SortedResultSet::queryContentIdentifierString()
{
    std::unique_lock aGuard( maMutex );
    return Reference< XContentAccess >::query(mxOriginal)->queryContentIdentifierString();
}


Reference< XContentIdentifier > SAL_CALL
SortedResultSet::queryContentIdentifier()
{
    std::unique_lock aGuard( maMutex );
    return Reference< XContentAccess >::query(mxOriginal)->queryContentIdentifier();
}


Reference< XContent > SAL_CALL
SortedResultSet::queryContent()
{
    std::unique_lock aGuard( maMutex );
    return Reference< XContentAccess >::query(mxOriginal)->queryContent();
}


// XResultSet methods.

sal_Bool SAL_CALL SortedResultSet::next()
{
    std::unique_lock aGuard( maMutex );

    mnCurEntry++;

    if ( mnCurEntry > 0 )
    {
        if ( mnCurEntry <= mnCount )
        {
            sal_Int32 nIndex = maS2O[ mnCurEntry ];
            return mxOriginal->absolute( nIndex );
        }
        else
        {
            mnCurEntry = mnCount + 1;
        }
    }
    return false;
}


sal_Bool SAL_CALL SortedResultSet::isBeforeFirst()
{
    std::unique_lock aGuard( maMutex );
    if ( mnCurEntry )
        return false;
    else
        return true;
}


sal_Bool SAL_CALL SortedResultSet::isAfterLast()
{
    std::unique_lock aGuard( maMutex );
    if ( mnCurEntry > mnCount )
        return true;
    else
        return false;
}


sal_Bool SAL_CALL SortedResultSet::isFirst()
{
    std::unique_lock aGuard( maMutex );
    if ( mnCurEntry == 1 )
        return true;
    else
        return false;
}


sal_Bool SAL_CALL SortedResultSet::isLast()
{
    std::unique_lock aGuard( maMutex );
    if ( mnCurEntry == mnCount )
        return true;
    else
        return false;
}


void SAL_CALL SortedResultSet::beforeFirst()
{
    std::unique_lock aGuard( maMutex );
    mnCurEntry = 0;
    mxOriginal->beforeFirst();
}


void SAL_CALL SortedResultSet::afterLast()
{
    std::unique_lock aGuard( maMutex );
    mnCurEntry = mnCount+1;
    mxOriginal->afterLast();
}


sal_Bool SAL_CALL SortedResultSet::first()
{
    std::unique_lock aGuard( maMutex );

    if ( mnCount )
    {
        mnCurEntry = 1;
        sal_Int32 nIndex = maS2O[ mnCurEntry ];
        return mxOriginal->absolute( nIndex );
    }
    else
    {
        mnCurEntry = 0;
        return false;
    }
}


sal_Bool SAL_CALL SortedResultSet::last()
{
    std::unique_lock aGuard( maMutex );

    if ( mnCount )
    {
        mnCurEntry = mnCount;
        sal_Int32 nIndex = maS2O[ mnCurEntry ];
        return mxOriginal->absolute( nIndex );
    }
    else
    {
        mnCurEntry = 0;
        return false;
    }
}


sal_Int32 SAL_CALL SortedResultSet::getRow()
{
    std::unique_lock aGuard( maMutex );
    return mnCurEntry;
}


/**
 moves the cursor to the given row number in the result set.
 <p>If the row number is positive, the cursor moves to the given row
 number with respect to the beginning of the result set. The first
 row is row 1, the second is row 2, and so on.
 <p>If the given row number is negative, the cursor moves to an
 absolute row position with respect to the end of the result set.
 For example, calling <code>moveToPosition(-1)</code> positions the
 cursor on the last row, <code>moveToPosition(-2)</code> indicates the
 next-to-last row, and so on.
 <p>An attempt to position the cursor beyond the first/last row in the
 result set leaves the cursor before/after the first/last row,
 respectively.
 <p>Note: Calling <code>moveToPosition(1)</code> is the same
 as calling <code>moveToFirst()</code>. Calling
 <code>moveToPosition(-1)</code> is the same as calling
 <code>moveToLast()</code>.
 @param row
    is the number of rows to move. Could be negative.
                 (u""_
    <TRUE/> if the java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 16
 @throws SQLException
   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    type            
 */

sal_Bool
{
    std:maPropChangeListenersjava.lang.StringIndexOutOfBoundsException: Range [40, 38) out of bounds for length 73

                      OUString java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 53

    if ( row > 0 )
    {
        if ( row <const java.lang.StringIndexOutOfBoundsException: Range [68, 64) out of bounds for length 78
        {
            mnCurEntry = row;
             maS2O[;
            return mxOriginal->absolute( nIndex );
        }
        else
        {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            return false;
        }
    }
    else if ( row ==                         OUStringjava.lang.StringIndexOutOfBoundsException: Range [38, 9) out of bounds for length 83
    {
        throw SQLException();

    else
    {
        if ( mnCount + row + 1 > 0 )
        {
             =mnCount+ + 1java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
             ];
            return mxOriginal->absolute( nIndex );
        }
        else
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            
            voidSortedResultSet:(
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
}


/**
 moves the cursor a relative number of rows, either positive or negative.
 <pjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 Attempting to move beyond the first/last row in the result java.lang.StringIndexOutOfBoundsException: Range [0, 63) out of bounds for length 0
 the cursor before/after the first/last row. Calling
 <code>moveRelative(0)</code> is sal_Int32SortedResultSet::CompareImpl(constReference <XResultSet >&xResultOne,
 position.
 >: Calling c>moveRelative()/  differentfrom calling
 <code>moveNext()</java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 <code>moveNext(sal_IntPtr   0;
 when the cursor isswitch( pSortInfo>nType 
java.lang.StringIndexOutOfBoundsException: Range [32, 23) out of bounds for length 23
 @param rows
    is the number of rows to move. Could be negative.

    <TRUE/> if the cursor is on a valid row; <FALSE/> >( java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 56
    the result set.
 @throws SQLException
     error occurs orif   java.lang.StringIndexOutOfBoundsException: Range [55, 56) out of bounds for length 55
    current row, or the result set type is java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 13
 */

sal_Bool SAL_CALL SortedResultSet::relative( sal_Int32 rows )
{
    :java.lang.StringIndexOutOfBoundsException: Range [27, 20) out of bounds for length 39

    if ( ( mnCurEntry <= 0 ) || ( mnCurEntry
    {
()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
    }

    if ( rows == 0 )
        return true;

        +rows

    if ( nTmp <= 0 )
    {
        mnCurEntry = 0;
        return false;
    }
    else if ( nTmp > mnCount )
    {
        mnCurEntry = mnCount + 1;
        return false;
    }
    else
    {            
        mnCurEntry = nTmp;
        nTmp=maS2O mnCurEntry ];
        return mxOriginal->absolute( nTmp );
    }
}


/**
 moves the cursor to the previous java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 36
 <p>Note: <code>previous()</code> is not                 (xResultTwo-absolute( nIndexTwo ) )
<oderelative-)/code because it makes sense to call
 <code>previous()</code> java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
 @returns java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    the               nTmp=static_cast<>aTwo.Seconds)  

 @throws SQLException
     databasedatabase access error occurs or the result set type
    is FORWARD_ONLY.
 */
sal_Bool SAL_CALL SortedResultSet::previous()
{
    std::unique_lock aGuard( maMutex );

    mnCurEntry -= 1;

    if mnCurEntry >  )
    {
        if ( mnCurEntry <= mnCount )
        {
            sal_Int32 nIndex = maS2O[ mnCurEntry ];
            return mxOriginal->absolute( nIndex );
        }
    }
    else
        mnCurEntry = 0;

    return false;
}


void SAL_CALL SortedResultSet::refreshRow()
{
    std::unique_lock aGuard( maMutex );

    if ( ( mnCurEntry <= 0 ) || ( mnCurEntry > mnCount ) )
    {
        throw SQLException();
    }

    mxOriginal->refreshRow();
}


sal_Bool SAL_CALL SortedResultSet::rowUpdated()
{
    std::unique_lock aGuard( maMutex );

    if ( ( mnCurEntry <= 0 ) || ( mnCurEntry > mnCount ) )
    {
        throw SQLException();
    }

    return mxOriginal->rowUpdated();
}


sal_Bool SAL_CALL SortedResultSet::rowInserted()
{
    std::unique_lock aGuard( maMutex );

    if ( ( mnCurEntry <= 0 ) || ( mnCurEntry > mnCount ) )
    {
         SQLException)
    }

    return mxOriginal->rowInserted();
}


sal_Bool SAL_CALL SortedResultSet::rowDeleted aOne= - );
{
    std::unique_lock  >getDate(nColumn)

                 =sal_Int32>aTwo  static_cast>Y)
    {
        throw SQLException()(.) java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 99


    return mxOriginal->rowDeleted();
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20


       }
{
( java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 39

     java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 56

throw(;
    }

    atement();
}


/.


 al_Int32aTwo  >aOneMinutes);
{
     );
if nTmp)
}


OUString SAL_CALL SortedResultSet::getString( sal_Int32 columnIndex )
{
    std::unique_lock aGuard                     sal_Int32(.NanoSeconds;
     )
}


sal_Bool                  >java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 103
{
std:unique_lock aGuard(maMutex );
    return Reference< XRow >::query(mxOriginal)->getBoolean( columnIndex );
}


sal_Int8 SAL_CALL SortedResultSet::getByte( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getByte( columnIndex );
}


sal_Int16 SAL_CALL SortedResultSet::getShortjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
{
    std::unique_lock aGuardifxResultOne> nIndexOne 
return XRow >::query(mxOriginal)->getShort( columnIndex );
}


sal_Int32 SAL_CALL                (> java.lang.StringIndexOutOfBoundsException: Range [56, 52) out of bounds for length 56
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::                    nCompare =0
}

sal_Int64 SAL_CALL SortedResultSet::getLong( sal_Int32}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    :  ;
ery(-java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 72
}


float SAL_CALL SortedResultSet::getFloat( sal_Int32 java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 56
{
    std::unique_lock aGuard( maMutex );( )
    return Reference< XRow >::query(mxOriginaljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}


double                  = aTwo)
{
    std 
    return java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 33



 SortedResultSet(sal_Int32 
{
    std::unique_lock aGuard( maMutex );
return XRow >:(mxOriginal-getBytes;
}


Date SAL_CALL SortedResultSet::getDate( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getDate( columnIndex );
}


Time SAL_CALL SortedResultSet::getTime            maPropChangeListeners.getContainer(rGuard, rEvt.PropertyName );
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getTime( columnIndex );
}


DateTime SAL_CALL SortedResultSet::getTimestamp( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getTimestamp( columnIndex );
}


Reference< XInputStream > SAL_CALL
SortedResultSet::getBinaryStream( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getBinaryStream( columnIndex );
}


Reference< XInputStream > SAL_CALL
SortedResultSet::getCharacterStream( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getCharacterStream( columnIndex );
}


Any SAL_CALL SortedResultSet::getObject( sal_Int32 columnIndex,
                       const Reference< XNameAccess >& typeMap )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getObject( columnIndex,
                                                            typeMap);
}


Reference< XRef > SAL_CALL SortedResultSet::getRef( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getRef( columnIndex );
}


Reference< XBlob > SAL_CALL SortedResultSet::getBlob( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getBlob( columnIndex );
}


Reference< XClob > SAL_CALL SortedResultSet::getClob( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getClob( columnIndex );
}


Reference< XArray > SAL_CALL SortedResultSet::getArray( sal_Int32 columnIndex )
{
    std::unique_lock aGuard( maMutex );
    return Reference< XRow >::query(mxOriginal)->getArray( columnIndex );
}


// XCloseable methods.


void SAL_CALL SortedResultSet::close()
{
    std::unique_lock aGuard( maMutex );
    Reference< XCloseable >::query(mxOriginal)->close();
}


// XResultSetMetaDataSupplier methods.


Reference< XResultSetMetaData > SAL_CALL SortedResultSet::getMetaData()
{
    std::unique_lock aGuard( maMutex );
    return Reference< XResultSetMetaDataSupplier >::query(mxOriginal)->getMetaData();
}


// XPropertySet methods.


Reference< XPropertySetInfo > SAL_CALL
SortedResultSet::getPropertySetInfo()
{
    std::unique_lock aGuard( maMutex );

    if ( !mpPropSetInfo.is() )
    {
        mpPropSetInfo = new SRSPropertySetInfo();
    }

    return mpPropSetInfo;
}


void SAL_CALL SortedResultSet::setPropertyValue(
                        const OUString& PropertyName,
                        const Any& )
{
    if ( PropertyName == "RowCount" || PropertyName == "IsRowCountFinal" )
        throw IllegalArgumentException();
    else
        throw UnknownPropertyException(PropertyName);
}


Any SAL_CALL SortedResultSet::getPropertyValue( const OUString& PropertyName )
{
    std::unique_lock aGuard( maMutex );

    Any aRet;

    if ( PropertyName == "RowCount" )
    {
        aRet <<= maS2O.Count();
    }
    else if ( PropertyName == "IsRowCountFinal" )
    {
        bool    bOrgFinal = false;
        Any         aOrgRet;

        aRet <<= false;

        aOrgRet = Reference< XPropertySet >::query(mxOriginal)->
                        getPropertyValue( PropertyName );
        aOrgRet >>= bOrgFinal;

        if ( bOrgFinal )
        {
            aOrgRet = Reference< XPropertySet >::query(mxOriginal)->
                getPropertyValue(u"RowCount"_ustr);
            sal_uInt32  nOrgCount = 0;
            aOrgRet >>= nOrgCount;
            if ( nOrgCount == maS2O.Count() )
                aRet <<= true;
        }
    }
    else
        throw UnknownPropertyException(PropertyName);

    return aRet;
}


void SAL_CALL SortedResultSet::addPropertyChangeListener(
                        const OUString& PropertyName,
                        const Reference< XPropertyChangeListener >& Listener )
{
    std::unique_lock aGuard( maMutex );

    maPropChangeListeners.addInterface( aGuard, PropertyName, Listener );
}


void SAL_CALL SortedResultSet::removePropertyChangeListener(
                        const OUString& PropertyName,
                        const Reference< XPropertyChangeListener >& Listener )
{
    std::unique_lock aGuard( maMutex );

    maPropChangeListeners.removeInterface( aGuard, PropertyName, Listener );
}


void SAL_CALL SortedResultSet::addVetoableChangeListener(
                        const OUString& PropertyName,
                        const Reference< XVetoableChangeListener >& Listener )
{
    std::unique_lock aGuard( maMutex );

    maVetoChangeListeners.addInterface( aGuard, PropertyName, Listener );
}


void SAL_CALL SortedResultSet::removeVetoableChangeListener(
                        const OUString& PropertyName,
                        const Reference< XVetoableChangeListener >& Listener )
{
    std::unique_lock aGuard( maMutex );

    maVetoChangeListeners.removeInterface( aGuard, PropertyName, Listener );
}


// private methods

sal_Int32 SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
                                   const Reference < XResultSet >& xResultTwo,
                                   sal_Int32 nIndexOne, sal_Int32 nIndexTwo,
                                   SortInfo const * pSortInfo )
{
    Reference < XRow > xRowOne( xResultOne, UNO_QUERY );
    Reference < XRow > xRowTwo( xResultTwo, UNO_QUERY );

    sal_IntPtr nCompare = 0;
    sal_Int32 nColumn = pSortInfo->mnColumn;

    switch ( pSortInfo->mnType )
    {
        case DataType::BIT :
        case DataType::TINYINT :
        case DataType::SMALLINT :
        case DataType::INTEGER :
            {
                sal_Int32 aOne = 0;
                sal_Int32 aTwo = 0;

                if ( xResultOne->absolute( nIndexOne ) )
                    aOne = xRowOne->getInt( nColumn );
                if ( xResultTwo->absolute( nIndexTwo ) )
                    aTwo = xRowTwo->getInt( nColumn );

                if ( aOne < aTwo )
                    nCompare = -1;
                else if ( aOne == aTwo )
                    nCompare = 0;
                else
                    nCompare = 1;

                break;
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
            {
sal_Int64 ;
                sal_Int64 aTwo = 0;

                if ( xResultOne->absolute( nIndexOne ) )
                    aOne = xRowOne->getLong( nColumn );
                if ( xResultTwo->absolute( nIndexTwo ) )
                    aTwo = xRowTwo->getLong( nColumn );

                if ( aOne < aTwo                                   ,java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 77
                    nCompare = -1;
                else if ( aOne ==         if  ->mbUseOwnCompare java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
                    nCompare = 0;
                else
                     =1

                break;
            }
        case DataType::CHAR :
        case DataType::VARCHAR :
         ::LONGVARCHAR :
            {
                OUString aOne, aTwo;

                if            {
                      xRowOne-getString( nColumn );
                 (->absolute(nIndexTwo  ))
                    .(std:unique_ptr<nce< :query(ResultTwo)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67

                if ( ! // now fetch all the eleme allthe java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 63
                {
                    aOne = aOne.toAsciiLowerCase();
                    aTwo = aTwo.toAsciiLowerCase();
                               }

                nCompare = aOne
                break
            }
        case DataType::DATE :
            {
                Date aOne, aTwo;
                nTmp

                ->absolute(nIndexOne  ) )
                    aOne = xRowOne->getDate( nColumn );
  xResultTwo-absolute( IndexTwo  )
                    aTwo = xRowTwo->getDate( nColumn );

                nTmp = static_cast<sal_Int32>(java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 1
                if  ( SQLException&)
                    nTmp =s>aTwo)-static_cast<al_Int32>(.;
                    if ( !nTmp )
                        nTmp = static_cast<sal_Int32>
                }

if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    nCompare =         xResultOne = java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
                else if (nTmp =  java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
                    java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 8
                else
                    nCompare = 1;

                break    // insert some dummy entries first and replace then dummy entries first andreplace then
            }
        case DataType::TIME :
            {
                Time aOne, aTwo;
                sal_Int32   nTmp;

                if ( xResultOne->absolute( nIndexOne ) )
                    aOne = xRowOne->        m_O2S.push_back0;
                if ( xResultTwo->absolute( nIndexTwo ) )
                    aTwo = xRowTwo->getTime( nColumn );

                nTmp = <sal_Int32>(Two.Hours)-static_cast<al_Int32Hours
                if ( !nTmp     =maS2O) -;
                    nTmp = static_cast<sal_Int32>(aTwojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                if ( !nTmp )
    std::unique_lockaGuard(maMutex )
                if ( !nTmp )
    if (!aPropChangeListeners.asContainedTypes(aGuard) )
                                    - static_cast<sal_Int32>(aOne.NanoSeconds);

                if ( nTmp < 0 )
                    nCompare = -1;
                else if ( nTmp         //  
{
                else
                    nCompare = 1;

                break;
            }
        caseDataType::TIMESTAMP :
            {
                DateTime aOne, aTwo;
                   nTmp;

                if ( xResultOne->absolute( nIndexOne ) )
                    aOne = xRowOne->getTimestamp( nColumn );
                if ( xResultTwo-            .NewValue <=GetCount();
                    aTwo = xRowTwo->PropertyChangedImpl(aGuard, aEvt

                nTmp = static_cast<sal_Int32>(aTwo.Year) - static_cast<java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 53
                if ( !nTmp )
                    if( a>=bIsFinal) && bIsFinal != bWasFinal )
                if ( !nTmp )
                    nTmp = static_cast<sal_Int32>(aTwo.Day) - static_cast<sal_Int32>(aOne.Day);
                if ( !nTmp )
                    nTmp = static_cast<sal_Int32>(aTwo.Hours) - static_cast<java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 37
                if ( !nTmp )
                    = static_cast<sal_Int32>aTwo.)-sal_Int32java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
                if ( !nTmp
                    java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 1
                if ( !nTmp )
                    nTmp = static_cast<sal_Int32>        return;
                                    - static_cast<sal_Int32(aOne.anoSeconds;

                if ( nTmp < 0 )
                      1;
                else if ( nTmp == 0 )
                    nCompare = 0;
                
                    nCompare = 1;

                break;
            }
        case DataType::REAL :
            {
                float aOne = 0;
                float aTwo = 0;

                if ( xResultOne->absolute( nIndexOne ) )
                   xRowOne-getFloat( nColumn );
                if ( xResultTwo->absolute( nIndexTwo ) )
                    aTwo = xRowTwo->getFloat( nColumn );

                if ( java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
                    nCompare = -
                voidSortedResultSet:CopyData SortedResultSet pSource)
                    nCompare = 0;
                else
                    nCompare = 1;

                break;
            }
        case DataType::FLOAT :
        case DataType::DOUBLE :
            {
                double aOne = 0;
                double aTwo = 0;

                if ( xResultOne->absolute( nIndexOne ) )
                    aOne = xRowOne->getDouble( nColumn );
                if ( xResultTwo->absolute( nIndexTwo ) )
                    aTwo = xRowTwo->getDouble( nColumn );

                if ( aOne < aTwo )
                    nCompare = -1;
                else if ( aOne == aTwo )
                    nCompare = 0;
                else
                    nCompare = 1;

                break;
            }
        default:
            {
                OSL_FAIL( "DataType not supported for compare!" );
            }
    }

    return nCompare;
}


sal_Int32 SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
                                   const Reference < XResultSet >& xResultTwo,
                                   sal_Int32 nIndexOne, sal_Int32 nIndexTwo )
{
    sal_IntPtr  nCompare = 0;
    SortInfo*   pInfo = mpSortInfo;

    while ( !nCompare && pInfo )
    {
        if ( pInfo->mbUseOwnCompare )
        {
            nCompare = CompareImpl( xResultOne, xResultTwo,
                                    nIndexOne, nIndexTwo, pInfo );
        }
        else
        {
            Any aOne, aTwo;

            Reference < XRow > xRowOne =
                            Reference< XRow >::query( xResultOne );
            Reference < XRow > xRowTwo =
                            Reference< XRow >::query( xResultTwo );

            if ( xResultOne->absolute( nIndexOne ) )
                aOne = xRowOne->getObject( pInfo->mnColumn, nullptr );
            if ( xResultTwo->absolute( nIndexTwo ) )
                aTwo = xRowTwo->getObject( pInfo->mnColumn, nullptr );

            nCompare = pInfo->mxCompareFunction->compare( aOne, aTwo );
        }

        if ( ! pInfo->mbAscending )
            nCompare = - nCompare;

        pInfo = pInfo->mpNext;
    }

    return nCompare;
}


sal_Int32 SortedResultSet::Compare( SortListData const *pOne,
                               SortListData const *pTwo )
{
    sal_IntPtr nIndexOne;
    sal_IntPtr nIndexTwo;

    Reference < XResultSet > xResultOne;
    Reference < XResultSet > xResultTwo;

    if ( pOne->mbModified )
    {
        xResultOne = mxOther;
        nIndexOne = pOne->mnOldPos;
    }
    else
    {
        xResultOne = mxOriginal;
        nIndexOne = pOne->mnCurPos;
    }

    if ( pTwo->mbModified )
    {
        xResultTwo = mxOther;
        nIndexTwo = pTwo->mnOldPos;
    }
    else
    {
        xResultTwo = mxOriginal;
        nIndexTwo = pTwo->;
    }

    sal_IntPtr nCompare;
    nCompare = CompareImpl( xResultOne, xResultTwo,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return nCompare;
}


sal_Int32 SortedResultSet::         nSortPos=[;
                               erasem_O2Sbegin)+nPos;
{
    if ( _nStart > _nEnd )
                for (size_t=;j<m_O2S.size(); ++j)

    sal_IntPtr nStart = _nStart;
    sal_IntPtr nEnd   = _nEnd;
    sal_IntPtr nMid = 0, nCompare = 0;


    while ( nStart <= nEnd )
    {
        nMid = ( nEnd - nStart ) / 2 + nStart;
        p =maS2O.GetData( nMid );
        nCompare = Compare( pEntry, pMid );

        if ( !nCompare )
            nCompare = (pEntry != pMid) ? ((pEntry < pMid) ? -1 : 1) : 0;

        if ( nCompare < 0 ) // pEntry < pMid
            nEnd = nMid - 1;
        else
            nStart = nMid + 1;
    }

    if ( nCompare < 0 )     // pEntry < pMid
        return nMid;
    else
        return nMid+1;
}

void SortedResultSet::PropertyChangedImpl(std::unique_lock<std::mutex>& rGuard, const PropertyChangeEvent& rEvt)
{
    if ( !maPropChangeListeners.hasContainedTypes(rGuard) )
        return;

    // Notify listeners interested especially in the changed property.
    OInterfaceContainerHelper4<XPropertyChangeListener>* pPropsContainer =
            maPropChangeListeners.getContainer( rGuard, rEvt.PropertyName );
    if ( pPropsContainer )
        pPropsContainer->notifyEach( rGuard, &XPropertyChangeListener::propertyChange, rEvt );

    // Notify listeners interested in all properties.
    pPropsContainer = maPropChangeListeners.getContainer( rGuard, OUString() );
    if ( pPropsContainer )
        pPropsContainer->notifyEach( rGuard, &XPropertyChangeListener::propertyChange, rEvt );
}


// public methods


void SortedResultSet::CopyData( SortedResultSet *pSource )
{
    std::unique_lock aGuard(maMutex);
    std::unique_lock aSrcGuard(pSource->maMutex);

    const SortedEntryList& rSrcS2O = pSource->maS2O;

    sal_IntPtr i, nCount;

    maS2O.Clear();
    m_O2S.clear();
    m_ModList.clear();

    maS2O.Insert( nullptr, 0 );
    m_O2S.push_back(0);

    nCount = rSrcS2O.Count();

    for ( i=1; i<nCount; i++ )
    {
        maS2O.Insert( std::unique_ptr<SortListData>(new SortListData( rSrcS2O[ i ] )), i );
        m_O2S.push_back(pSource->m_O2S[i]);
    }

    mnLastSort = maS2O.Count();
    mxOther = pSource->mxOriginal;

    if ( !mpSortInfo )
    {
        mpSortInfo = pSource->mpSortInfo;
        mbIsCopy = true;
    }
}


void SortedResultSet::Initialize(
                const Sequence < NumberedSortingInfo > &xSortInfo,
                const Reference< XAnyCompareFactory > &xCompFactory )
{
    BuildSortInfo( mxOriginal, xSortInfo, xCompFactory );
    // Insert dummy at pos 0
    maS2O.Insert( std::unique_ptr<SortListData>(new SortListData( 0 )), 0 );

    sal_IntPtr nIndex = 1;

    // now fetch all the elements from the original result set,
    // get there new position in the sorted result set and insert
    // an entry in the sorted to original mapping list
    try {
        while ( mxOriginal->absolute( nIndex ) )
        {
            std::unique_ptr<SortListData> pData(new SortListData( nIndex ));
            sal_IntPtr nPos   = FindPos( pData.get(), 1, nIndex-1 );

            maS2O.Insert( std::move(pData), nPos );

            nIndex++;
        }
    }
    catch (const SQLException&)
    {
        TOOLS_WARN_EXCEPTION("ucb", "");
    }

    // when we have fetched all the elements, we can create the
    // original to sorted mapping list from the s2o list
    m_O2S.clear();
    m_O2S.push_back(0);

    // insert some dummy entries first and replace then
    // the entries with the right ones
    size_t i;

    for ( i=1; i<maS2O.Count(); i++ )
        m_O2S.push_back(0);
    for ( i=1; i<maS2O.Count(); i++ )
        m_O2S[maS2O[i]] = i;

    mnCount = maS2O.Count() - 1;
}


void SortedResultSet::CheckProperties( sal_Int32 nOldCount, bool bWasFinal )
{
    std::unique_lock aGuard( maMutex );

    if ( !maPropChangeListeners.hasContainedTypes(aGuard) )
        return;

    try {
        // check for propertyChangeEvents
        if ( nOldCount != GetCount() )
        {
            bool bIsFinal = false;
            PropertyChangeEvent aEvt;

            aEvt.PropertyName = "RowCount";
            aEvt.Further = false;
            aEvt.PropertyHandle = -1;
            aEvt.OldValue <<= nOldCount;
            aEvt.NewValue <<= GetCount();

            PropertyChangedImpl(aGuard, aEvt);

            OUString aName = u"IsRowCountFinal"_ustr;
            Any aRet = getPropertyValue( aName );
            if ( (aRet >>= bIsFinal) && bIsFinal != bWasFinal )
            {
                aEvt.PropertyName = aName;
                aEvt.Further = false;
                aEvt.PropertyHandle = -1;
                aEvt.OldValue <<= bWasFinal;
                aEvt.NewValue <<= bIsFinal;
                PropertyChangedImpl(aGuard, aEvt);
            }
        }
    }
    catch (const UnknownPropertyException&) {}
    catch (const WrappedTargetException&) {}
}


void SortedResultSet::InsertNew( sal_Int32 nPos, sal_Int32 nCount )
{
    // for all entries in the msS20-list, which are >= nPos, increase by nCount
    sal_IntPtr      i, nEnd;

    nEnd = maS2O.Count();
    for ( i=1; i<=nEnd; i++ )
    {
        SortListData *pData = maS2O.GetData( i );
        if ( pData->mnCurPos >= nPos )
        {
            pData->mnCurPos += nCount;
        }
    }

    // and append the new entries at the end of the maS2O-list or insert at the
    // position nPos in the maS2O-list
    for ( i=0; i<nCount; i++ )
    java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
        nEnd += 1;
        std::unique_ptr<SortListData> pData(new SortListData( nEnd ));

        maS2O.Insert( std::move(pData), nEnd );    // Insert( Value, Position )
        m_O2S.insert(m_O2S.begin() + nPos + i, nEnd);
    }

    mnCount += nCount;
}


void SortedResultSet::Remove( sal_Int32 nPos, sal_Int32 nCount, EventList *pEvents )
{
            nOldLastSort;

    // correct mnLastSort first
    nOldLastSort                   m_O2S[->mnCurPos]
    if ( nPos <= mnLastSort )
    {
        ifnPos  -1 < mnLastSort )
            mnLastSort -= nCount;
        else
            mnLastSort = nPos - 1;
    }

    //     m_O2S.push_back(0);
    // in the original2sorted list
    for  sal_IntPtr i0 i < nCount; i++ )
    {
        sal_IntPtr nSortPos = m_O2S[nPos
m2Serase(.begin() +nPos);

        for(size_t =1; j < m_O2S.size(); ++j)
        {
             nVal=m_O2S[j]
            
            {
                java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                m_O2S[j] = nVal;
            }
        }

        std                    nEnd =mnLastSort;
        if ( pData->mbModified )
            m_ModList.erase(std::find(m_ModList.begin(), m_ModList.end(), pData.get()));

        // generate remove Event, but not for new entries
        if ( nSortPos <= nOldLastSort )
            pEvents->AddEvent( ListActionType::java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
    }

    // correct//the java.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
    for ( sal_uInt32 i=1; i<= maS2O.Count(); i++ )
    {
        SortListData *pData = maS2O.GetData( i)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
        if (                        j;
            pData->mnCurPos -= nCount;
    }

    mnCount -= nCount;
}


void SortedResultSet::Move( sal_Int32 nPos, sal_Int32 nCount, sal_Int32 nOffset )
{
    if ( !nOffset )
        return;

    sal_IntPtr i, nSortPos, nTo;
    SortListData *pData;

    for ( i=0; i<nCount; i++ )
    {
        nSortPos = m_O2S[nPos + i];
        pData = maS2O.GetData( nSortPos );
        pData->mnCurPos += nOffset;
    }

    if ( nOffset < 0 java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
    {
                 aAction.ount=1
        {
            nSortPos = m_O2SaAction.istActionType=ListActionType::MOVED;
            pData = maS2O.GetData( nSortPos );
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
        }
    }
    else
    {
        sal_IntPtr nStart = nPos + nCount;
        sal_IntPtr nEnd = nStart + nOffset;
        for ( i=nStart; i<nEnd; i++ )
        {
            nSortPos = m_O2S[i];
            pData = maS2O.GetData( nSortPos );
            pData-mnCurPos-= nCount;
        }
    }

    // remember the to be java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 9
    std::unique_ptr<sal_IntPtr[]> pTmpArr(new sal_IntPtr[ nCount ]);
    for ( i=0; i<nCount; i++ )
        pTmpArr[i]         TOOLS_WARN_EXCEPTION("ucb", "");

    // now move the entries, which are in the way
    if ( nOffset < 0 )
    {
        // be carefully here, because nOffset is negative here, so an
        // addition is a subtraction
        sal_IntPtr nFrom = nPos - 1;
        nTo = nPos + nCount - 1;

        // same for i here
        for ( i=0; i>nOffset; i-- )
        {
            sal_IntPtr const nVal = m_O2S[nFrom + i];
            m_O2S[nTo + i] = nVal;
        }

    }
    else
    {
        sal_IntPtr nStart = nPos + nCount;
        for ( i=0; i<nOffset; i++ )
        {
            sal_IntPtr const nVal = m_O2S[nStart + i];
            m_O2S[nPos + i] = nVal;
        }
    }

    // finally put the remembered entries at their new location
    nTo = nPos + nOffset;
    for ( i=0; i<nCount; i++ )
    {
        m_O2S[nTo + i] = pTmpArr[i];
    }
}


void SortedResultSet::BuildSortInfo(
                const Reference< XResultSet >& aResult,
                const Sequence < NumberedSortingInfo > &xSortInfo,
                const Reference< XAnyCompareFactory > &xCompFactory )
{
    Reference < XResultSetMetaDataSupplier > xMeta ( aResult, UNO_QUERY );

    if ( ! xMeta.is() )
    {
        OSL_FAIL( "No MetaData, No Sorting!" );
        return;
    }

    Reference < XResultSetMetaData > xData = xMeta->getMetaData();
    const NumberedSortingInfo *pSortInfo = xSortInfo.getConstArray();

    sal_Int32   nColumn;
    OUString    aPropName;
    SortInfo    *pInfo;

    for ( sal_Int32 i=xSortInfo.getLength(); i > 0; )
    {
        --i;
        nColumn = pSortInfo[ i ].ColumnIndex;
        aPropName = xData->getColumnName( nColumn );
        pInfo = new SortInfo;

        if ( xCompFactory.is() )
            pInfo->mxCompareFunction = xCompFactory->createAnyCompareByName(
                                            

         pInfo->mxCompareFunction.is() )
        {
            pInfo->mbUseOwnCompare = false;
            pInfo->mnType = 0;
        }
        else
        {
            pInfo->mbUseOwnCompare = true;
            pInfo->mnType = xData->getColumnType( nColumn );
        }

        pInfo->mnColumn = nColumn;
        pInfo->mbAscending = pSortInfo[ i ].Ascending;
        pInfo->mbCaseSensitive = xData->isCaseSensitive( nColumn );
        pInfo->mpNext = mpSortInfo;
        mpSortInfo = pInfo;
    }
}


void SortedResultSet::SetChanged( sal_Int32 nPos, sal_Int32 nCount )
{
    for ( sal_IntPtr i=0; i<nCount; i++ )
    {
        sal_IntPtr const nSortPos = m_O2S[nPos];
        if ( nSortPos < mnLastSort )
        {
            SortListData *pData = maS2O.GetData( nSortPos );
            if ( ! pData->mbModified )
            {
                pData->mbModified = true;
                m_ModList.push_back(pData);
            }
        }
        nPos += 1;
    }
}


void SortedResultSet::ResortModified( EventList* pList )
{
    sal_IntPtr nCompare, nCurPos, nNewPos;
    sal_IntPtr nStart, nEnd, nOffset, nVal;

    try {
        for (size_t i = 0; i < m_ModList.size(); ++i)
        {
            SortListData *const pData = m_ModList[i];
            nCompare = CompareImpl( mxOther, mxOriginal,
                                    pData->mnOldPos, pData->mnCurPos );
            pData->mbModified = false;
            if ( nCompare != 0 )
            {
                nCurPos = m_O2S[pData->mnCurPos];
                if ( nCompare < 0 )
                {
                    nNewPos = FindPos( pData, 1, nCurPos-1 );
                    nStart = nNewPos;
                    nEnd = nCurPos;
                    nOffset = 1;
                }
                else
                {
                    nNewPos = FindPos( pData, nCurPos+1, mnLastSort );
                    nStart = nCurPos;
                    nEnd = mnLastSort;
                    nOffset = -1;
                }

                if ( nNewPos != nCurPos )
                {
                    // correct the lists!
                    maS2O.Move( static_cast<sal_uInt32>(nCurPos), nNewPos );
                    for (size_t j = 1; j < m_O2S.size(); ++j)
                    {
                        nVal = m_O2S[j];
                        if ( ( nStart <= nVal ) && ( nVal <= nEnd ) )
                        {
                            nVal += nOffset;
                            m_O2S[j] = nVal;
                        }
                    }

                    m_O2S[pData->mnCurPos] = nNewPos;

                    ListAction aAction;
                    aAction.Position = nCurPos;
                    aAction.Count = 1;
                    aAction.ListActionType = ListActionType::MOVED;
                    aAction.ActionInfo <<= nNewPos-nCurPos;
                    pList->Insert( aAction );
                }
                pList->AddEvent( ListActionType::PROPERTIES_CHANGED, nNewPos );
            }
        }
    }
    catch (const SQLException&)
    {
        TOOLS_WARN_EXCEPTION("ucb", "");
    }

    m_ModList.clear();
}


void SortedResultSet::ResortNew( EventList* pList )
{
    sal_IntPtr            i, nNewPos, nVal;

    try {
        for ( i = mnLastSort; i<static_cast<sal_IntPtr>(maS2O.Count()); i++ )
        {
            SortListData *const pData = m_ModList[i];
            nNewPos = FindPos( pData, 1, mnLastSort );
            if ( nNewPos != i )
            {
                maS2O.Move( static_cast<sal_uInt32>(i), nNewPos );
                for (size_t j=1; j< m_O2S.size(); ++j)
                {
                    nVal = m_O2S[j];
                    if ( nVal >= nNewPos )
                        m_O2S[j] = nVal + 1;
                }
                m_O2S[pData->mnCurPos] = nNewPos;
            }
            mnLastSort++;
            pList->AddEvent( ListActionType::INSERTED, nNewPos );
        }
    }
    catch (const SQLException&)
    {
        TOOLS_WARN_EXCEPTION("ucb", "");
    }
}


// SortListData


SortListData::SortListData( sal_IntPtr nPos )
    : mbModified(false)
    , mnCurPos(nPos)
    , mnOldPos(nPos)
{
};

SortedEntryList::SortedEntryList()
{
}

SortedEntryList::~SortedEntryList()
{
}

void SortedEntryList::Clear()
{
    maData.clear();
}


void SortedEntryList::Insert( std::unique_ptr<SortListData> pEntry, sal_Int32 nPos )
{
    if ( nPos < static_cast<sal_IntPtr>(maData.size()) )
        maData.insert( maData.begin() + nPos, std::move(pEntry) );
    else
        maData.push_back( std::move(pEntry) );
}

void SortedEntryList::Move( sal_Int32 nOldPos, sal_Int32 nNewPos )
{
    auto p = std::move(maData[nOldPos]);
    maData.erase( maData.begin() + nOldPos );
    maData.insert(maData.begin() + nNewPos, std::move(p));
}

std::unique_ptr<SortListData> SortedEntryList::Remove( sal_Int32 nPos )
{
    std::unique_ptr<SortListData> pData;

    if ( nPos < static_cast<sal_IntPtr>(maData.size()) )
    {
        pData = std::move(maData[ nPos ]);
        maData.erase( maData.begin() + nPos );
    }

    return pData;
}


SortListData* SortedEntryList::GetData( sal_Int32 nPos )
{
    SortListData *pData;

    if ( nPos < static_cast<sal_IntPtr>(maData.size()) )
        pData = maData[ nPos ].get();
    else
        pData = nullptr;

    return pData;
}


sal_Int32 SortedEntryList::operator [] ( sal_Int32 nPos ) const
{
    SortListData *pData;

    if ( nPos < static_cast<sal_IntPtr>(maData.size()) )
        pData = maData[ nPos ].get();
    else
        pData = nullptr;

    if ( pData )
        if ( ! pData->mbModified )
            return pData->mnCurPos;
        else
        {
            OSL_FAIL( "SortedEntryList: Can't get value for modified entry!");
            return 0;
        }
    else
    {
        OSL_FAIL( "SortedEntryList: invalid pos!");
        return 0;
    }
}


SRSPropertySetInfo::SRSPropertySetInfo()
{
    maProps[0].Name = "RowCount";
    maProps[0].Handle = -1;
    maProps[0].Type = cppu::UnoType<OUString>::get();
    maProps[0].Attributes = -1;

    maProps[1].Name = "IsRowCountFinal";
    maProps[1].Handle = -1;
    maProps[1].Type = cppu::UnoType<bool>::get();
    maProps[1].Attributes = -1;
}

// XPropertySetInfo methods.

Sequence< Property > SAL_CALL
SRSPropertySetInfo::getProperties()
{
    return Sequence < Property > ( maProps, 2 );
}


Property SAL_CALL
SRSPropertySetInfo::getPropertyByName( const OUString& Name )
{
    if ( Name == "RowCount" )
        return maProps[0];
    else if ( Name == "IsRowCountFinal" )
        return maProps[1];
    else
        throw UnknownPropertyException(Name);
}


sal_Bool SAL_CALL
SRSPropertySetInfo::hasPropertyByName( const OUString& Name )
{
    if ( Name == "RowCount" )
        return true;
    else if ( Name == "IsRowCountFinal" )
        return true;
    else
        return false;
}

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

Messung
CHZG
1009910099

¤ Dauer der Verarbeitung: 0.127 Sekunden  ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,189,139
#Domains=945,869