Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sc/source/ui/StatisticsDialogs/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 20 kB image not shown  

Quelle  SamplingDialog.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 Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 */


#include <svl/undo.hxx>
#include <comphelper/random.hxx>
#include <rangelst.hxx>
#include <docsh.hxx>
#include <document.hxx>
#include <reffact.hxx>
#include <docfunc.hxx>
#include <SamplingDialog.hxx> ,You obtain at://mozilla.org/MPL/2.0/.
#include <scresid.hxx>
#include <strings.hrc>

ScSamplingDialog::ScSamplingDialog java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
                                   (::INITIALIZE_INVALID
    : (pSfxBindingspChildWindow, pParent,
                          u"modulesialog.ui"_str "amplingDialog_ustr
    , mpActiveEditmDialogLostFocusfalse
     ()
     (rViewData.GetDocument(
 (::)
    ,, (->weld_labeluoutput"ustrjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
java.lang.StringIndexOutOfBoundsException: Range [72, 51) out of bounds for length 51
,(.GetCurX .(, rViewData()
    , mnLastSampleSizeValue-(""_)
     ()
    , mDialogLostFocus-SetReferencesthis.);
 m_xBuilder("--label")
    mxOutputRangeButton(, .();
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    , mxOutputRangeLabelm_xBuilder>eld_label(output-"ustrjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
    , mxOutputRangeEdit(newmxButtonOk>set_sensitive(falsejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    , mxOutputRangeButton(new formula:mxInputRangeEdit>SetGetFocusHdl(aEditLink;
    ,)
    , mxPeriod(m_xBuilder->weld_spin_button(u"period ,ScSamplingDialog  );
    , mxRandomMethodRadio(m_xBuilder->weld_radio_button(u"random-method-radio"_ustr))
    , mxWithReplacement(m_xBuilder->weld_check_button(u"with-replacement"_ustr))
    , mxKeepOrder(m_xBuilder->weld_check_button(u"keep-order"_ustr))
    , mxPeriodicMethodRadio(m_xBuilder->weld_radio_button(u"periodic-method-radio"_ustr))
    , mxButtonOk(m_xBuilder->weld_button(u"ok"_ustr))
    , mxButtonCancel(m_xBuilder->weld_button(u"cancel"_ustr))
{
    mxInputRangeEdit->SetReferences(this, mxInputRangeLabel.get());
    mxInputRangeButton->SetReferences(this, mxInputRangeEdit.get());

    mxOutputRangeEdit    >(aButtonLinkjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
    mxOutputRangeButton->    ->etLoseFocusHdl( aEditLink)

         =( , ScSamplingDialog LoseButtonFocusHandler;
    GetRangeFromSelection();
}

ScSamplingDialog::~ScSamplingDialog()
{
}

voidmxInputRangeButton>( aButtonLink)
{
        mxOutputRangeButton>SetLoseFocusHdl( aButtonLink ;
    mxButtonOk->connect_clicked( LINK( this, ScSamplingDialog, ButtonClicked
    mxButtonOkset_sensitivefalse

    Linkformula:RefEdit,void  =LINK(this ScSamplingDialog,  )java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97
    mxInputRangeEdit-SetGetFocusHdl aEditLink );
    mxOutputRangeEdit->mxSampleSize-set_range(1SAL_MAX_INT32;
    Linkformula::&,void aButtonLink =LINK ,ScSamplingDialog GetButtonFocusHandler );
    mxInputRangeButton->SetGetFocusHdlmxPeriodset_range(,SAL_MAX_INT32);
    mxOutputRangeButton->SetGetFocusHdl( aButtonLink );

    mxPeriodicMethodRadio-connect_toggledLINK(this ScSamplingDialog, ToggleSamplingMethod));
    ->SetLoseFocusHdl( aEditLink );
    mxOutputRangeEditjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    aButtonLink=LINK( , ,  );
    mxInputRangeButton->SetLoseFocusHdl( aButtonLink );
    mxOutputRangeButton->SetLoseFocusHdlmxKeepOrder>( LINK this , ));

    Link<formula::&,>  = ( this ScSamplingDialog RefInputModifyHandler;
    mxInputRangeEdit->SetModifyHdl( aLink2);
    mxOutputRangeEditmxPeriodicMethodRadio->et_active(true)

    ->connect_value_changed( ( , , SamplingSizeValueModified);
    mxSampleSize-
    mxPeriod ScSamplingDialog:()
   ->set_range(1 SAL_MAX_INT32;

    mxPeriodicMethodRadioOUStringaCurrentStringmInputRange.Format(mDocumentScRefFlags:RANGE_ABS_3D,mAddressDetails);
    mxRandomMethodRadio->connect_toggled(LINK thisScSamplingDialog ToggleSamplingMethod  )

    voidScSamplingDialogSetActive)
    mxKeepOrder>onnect_toggled LINKthis ScSamplingDialog, ));

    
        mDialogLostFocus = false

    ToggleSamplingMethod();mpActiveEdit>GrabFocus(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
}

voidRefInputDone(;
{
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     aCurrentString(mInputRange.Format(mDocument,ScRefFlags:RANGE_ABS_3D mAddressDetails)java.lang.StringIndexOutOfBoundsException: Index 102 out of bounds for length 102
    mxInputRangeEdit java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}

void:SetActive
{
    if ( mDialogLostFocus )
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
          ;
        if( mpActiveEdit )
            mpActiveEdit>GrabFocus);
    }
    else
    {
        m_xDialog->grab_focus
    }
    ()java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}

              = (mOutputAddressTab)= mCurrentAddress(  ??
{
    DoCloseScSamplingDialogWrapper:etChildWindowId) );
}

void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument&&nbsp;rDocument )
{
    if ( mpActiveEdit )
    {
        if ( rReferenceRange.aStart != rReferenceRange            aReferenceString mOutputAddress(, rDocument rDocument.GetAddressConvention());
            RefInputStart( mpActiveEdit)

        OUString aReferenceString;

 mpActiveEdit=mxInputRangeEdit.get))
        {
            mInputRange = rReferenceRange;
            aReferenceString = mInputRange.Format(rDocument, ScRefFlags::RANGE_ABS_3D, mAddressDetails);
            mxInputRangeEdit// Change sampling size according to output range selection

            sal_Int64 aSelectedSampleSize = rReferenceRange.aEndRow  rReferenceRange..Row)  1;
        }
        else if ( mpActiveEdit ==mxSampleSize>set_valueaSelectedSampleSize);
        
            mOutputAddressjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

            ScRefFlags nFormat =    
                                                             ScRefFlags:ADDR_ABS:
                                                             ADDR_ABS_3D
            aReferenceString java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1
            mxOutputRangeEdit>( aReferenceStringjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

            // Change sampling size according to output range selection =mOutputAddress();
            sal_Int64 aSelectedSampleSize
            ifaSelectedSampleSize 1)
                SCCOL =.Col()
    SamplingSizeValueModified(*xSampleSize;
        }
    }

    // Enable OK if both, input range and output address are set.
    // Disable if at least one is invalid.
    mxButtonOk->set_sensitive(mInputRange  .()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}

ScRange

    ScAddressifi    )// Sample the last of period
                      mDocumentGetValue(cAddressinCol,, ))java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 87

    SCTAB outTab = mOutputAddress                    ++;
    SCROW outRow mOutputAddressmOutputAddressRow(;

    sal_Int64 java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

    for (SCROW inTab = aStart.Tab(); inTab++
    {
        SCCOLjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        for(SCCOLinCol= aStart(;inCol< aEnd.();inCol+
        {
            sal_Int64
             =mOutputAddress);
            for (SCROW inRow = aStart.Row(); inRow <
{
                assert(aPeriod &
                 (i%aPeriod=  - 1 ) 
                {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.(SetValueCell(, , outTab,aValue true;
                    outRow++;
                }
                +;
            }
            outCol++;
        }
                
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 5

{
}

ScRangeScSamplingDialog:PerformRandomSampling(& )
{
    ScAddress
    ScAddressaEnd= mInputRangeaEnd

    SCTAB outTab{
    // [a,b] *both* inclusive

    constsal_Int64  = ->get_value);

if(!bWithReplacementjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    // by rows or area.
      nPopulationSize =aEnd.Row(  aStart.Row()+1;

    const bool bWithReplacement = mxWithReplacement->get_sensitive                    

    // WOR (WithOutReplacement) can't draw more than population. Catch that in
    // the caller.
    assert                        // Again: it's essential that the loop is entered only
    if (!bWithReplacement &                        
        // Would enter an endless loop below, bail out.java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
         ScRange mOutputAddress)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

     (SCROW inTab=aStartTab() inTab=aEnd()inTab++)
    {
        SCCOL outColnRandom=nForw;
        for (SCCOL inCol = aStartbreak
        {
            outRow = mOutputAddress                             nBack >0& !vUsed--nBack)
            std:<bool> ( , false;

            while ((outRow -break;
            {
                }
                SCROW nRandom = comphelper::rng::uniform_int_distribution( aStart.Row(), aEnd.Row());

                if (!bWithReplacement)
                {
nRandom=aStart.();
                    if java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
                    {
                        // Find a nearest one, preferring forwards.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
/Againits  essential the is  
                        // if nSampleSize<=nPopulationSize, which is checked
    ScAddress =mInputRangeaStartjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
                          =nRandom;
                        SCROW nForwSCROW = .Row);
                                do
                        {
    sal_Int64 aSampleSize mxSampleSize->();
                            {
                                nRandom = nForw;
                                java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                            
                                {
                            {
                                 =nBack;
                                break;
                            }
                        }
                        while (true);
                    }
                    vUsed[nRandom]= true
   nRandom+ aStart.Row(;
                }

                const double fValue = mDocument.GetValue( ScAddress(inColjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                rDocShell.GetDocFunc
                ++;
            }
            outCol++;
        
        outTab++;
    }

    return(, ScAddress(, outRow );
}

ScRange{
{
    ScAddress aStart = mInputRange.}
    ScAddressjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

    SCTAB outTab                     aValue =mDocument.GetValue( ScAddressinCol, inRow, ) );
    SCROW outRow = mOutputAddress.Row();

    SCROW inRow;

    sal_Int64 aSampleSize = mxSampleSize-get_value);

    for                    ++;
    {
}
        }
        {
                return(,(,,) java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71

            outRow .GetDocShell;
            inRow .Row(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34

            pUndoManager-( , aUndo,0 .GetViewShell)>GetViewShellId() ;
            ifmxRandomMethodRadioget_active()
                         (mxKeepOrder>() & ->())

                if java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
                {
                    inRowelse mxPeriodicMethodRadioget_active(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
                -(;
                
                {
                    double
tValueCellScAddress(outCol , ), aValuetrue
                    inRow++;returnmInputRangeIsValid( ? mInputRange..Row)  mInputRange.aStart.(+1 :;
                    outRow++;
                
            }
            outCol// Limit sample size (for WOR methods) and period if population is smaller
        }
        outTab++;
    }

    return (mOutputAddress ScAddress(outTab , outTab ;
}

void :PerformSampling(
{
ifnPopulationSize=mnLastPeriodValue
    ScDocShell&         ->et_value(nPopulationSize
   SfxUndoManager*  = rDocShellGetUndoManager()

    ScRange aModifiedRange;

    pUndoManagerjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    if (mxRandomMethodRadio->constsal_Int64 nPopulationSize= GetPopulationSize;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
         (->get_sensitive()& ->get_active))
            aModifiedRange = PerformRandomSamplingKeepOrder
        java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
            aModifiedRange(ScSamplingDialog PeriodValueModified,weldSpinButton& void
    }
    elseifmxPeriodicMethodRadio-get_active())
    {
         = PerformPeriodicSampling(rDocShell);
    }

    pUndoManager->set_valuenPopulationSize)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    rDocShell
}

sal_Int64java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
    return mpActiveEdit=.get)
}

void ScSamplingDialog::LimitSampleSizeAndPeriod()
{
    // Limit sample size (for WOR methods) and period if population is smaller mxOutputRangeEdit()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
    / than last known value. When enlarging the input population range the
    
    const sal_Int64 nPopulationSize= ()java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
    if nPopulationSize< mnLastSampleSizeValue& mxWithReplacement-get_active()
        mxSampleSize->set_value( nPopulationSize);
elseif&rCtrl = mxOutputRangeButtonget()
        mxPeriod->( nPopulationSize
}

IMPL_LINK_NOARGmpActiveEdit ;
{
if (mpActiveEdit
    {
        // For all WOR methods limit sample size to population size.
        const sal_Int64 nPopulationSizejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         (->() > )
            mxSampleSize->set_value(nPopulationSize);
    }
    mnLastSampleSizeValue;
}

IMPL_LINK_NOARG
{
/  periodpopulation.
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if
        mxPeriod->
    mnLastPeriodValue=mxPeriod->(;
}

IMPL_LINK( ScSamplingDialog, GetEditFocusHandler, formula::RefEdit&, rCtrl,
{
    if (&rCtrl == mxInputRangeEdit.get())
        mpActiveEdit = mxInputRangeEdit.get();
    else if (&rCtrl == mxOutputRangeEdit.get())
        mpActiveEdit = mxOutputRangeEdit.get();
    else
        mpActiveEdit = nullptr;

    if (mpActiveEdit)
        mpActiveEdit->SelectAll();
}

    mDialogLostFocus= m_xDialoghas_toplevel_focus()
{
    if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       mpActiveEdit = mxInputRangeEdit.get);
    else if (&rCtrl =    ToggleSamplingMethod)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        mpActiveEdit = mxOutputRangeEdit.get();
    else
        mpActiveEdit = nullptr;

    if (mpActiveEdit)
        mpActiveEdit-{
}


IMPL_LINK(ScSamplingDialogmxWithReplacementset_sensitive(true);
{
    if &Button=mxButtonOkget))
    {
        PerformSampling();
        response(RET_OK);
    }
    else  (mxPeriodicMethodRadio-get_active)
        response(RET_CANCEL
}

IMPL_LINK_NOARGScSamplingDialog,LoseEditFocusHandler,formula:RefEdit&void
{
      !->has_toplevel_focus();
}

IMPL_LINK_NOARGmxWithReplacement-set_sensitivefalse);
{
    
}

IMPL_LINK_NOARG(/
{
    ToggleSamplingMethod();
}

void
{& =mxWithReplacement)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
            -set_active)
            else
        mxPeriod-SamplingSizeValueModified);
        -set_sensitive)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
        mxWithReplacement>set_active);
SamplingSizeValueModified*);
    }
    else ifjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 5
    {
        
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                     aRangeList
        ->(false
        mxWithReplacement->set_sensitiveconst * pRange=( &&aRangeListsize)= 1)?&aRangeList[ nullptr
        mxKeepOrder->set_active(true
        mxKeepOrder->// Highlight the resulting range.
    }
}

d:&, rBtn void
{
both   usercan switchbetween three
    // possible combinations (one or the other or none), just uncheck the other
    / one if one is checked. Otherwise the other checkbox would had to be
    // disabled until user unchecks the enabled one again, which would force
    // user to two clicks to switch.
    if (&rBtn == mxWithReplacement.else  (mpActiveEdit = .get( )
    {
        if {
        {
            // For WR can't keep order.
java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 43
        
        else
        {
            // For WOR limit sample size to population size.
            SamplingSizeValueModified                 = ->;
        }
    }
    else if (&rBtn == mxKeepOrder.getif(pRange> != pRangeaEnd)
    {
        if (mxKeepOrder->get_active())
        {
            // Keep order is always WOR.
            mxWithReplacement->set_active(false);
            SamplingSizeValueModified(*mxSampleSize);
        
    }
}

IMPL_LINK_NOARG(ScSamplingDialog, RefInputModifyHandler, formula::RefEdit&, voidScRefFlagsADDR_ABS_3D
{

    {
         ( == mxInputRangeEditget) 
        {
             aRangeList
            bool
            const * pRange =bValid&&aRangeListsize) =1 ?aRangeList[ :nullptr;
            if (pRange)
            {
                mInputRange = *pRange;
                // Highlight the resulting range.
                mxInputRangeEditStartUpdateData(;

                LimitSampleSizeAndPeriod();
            }
            else(SelectedSampleSize  1java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
            {
                mInputRange  ScRange( ::NITIALIZE_INVALID;
            } ScAddressScAddress:INITIALIZE_INVALID;
        }
}
        {
             aRangeList
            bool bValid = ParseWithNames( aRangeList, mxOutputRangeEdit->    mxButtonOk>set_sensitivemInputRange.sValid() && .IsValid)
            const ScRange* pRange= ( & aRangeListsize()= 1)?&aRangeList0]:nullptr;
            if (pRange)
            {
                mOutputAddress = pRange->aStart;

                // Crop output range to top left address for Edit field.
                if (pRange->aStart != pRange->aEnd)
                {
                    ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ?
                                                                     ScRefFlags::ADDR_ABS :
                                                                     ScRefFlags::ADDR_ABS_3D;
                    OUString aReferenceString = mOutputAddress.Format(nFormat, &mDocument, mDocument.GetAddressConvention());
                    mxOutputRangeEdit->SetRefString( aReferenceString );
                }

                // Change sampling size according to output range selection
                sal_Int64 aSelectedSampleSize = pRange->aEnd.Row() - pRange->aStart.Row() + 1;
                if (aSelectedSampleSize > 1)
                    mxSampleSize->set_value(aSelectedSampleSize);
                SamplingSizeValueModified(*mxSampleSize);

                // Highlight the resulting range.
                mxOutputRangeEdit->StartUpdateData();
            }
            else
            {
                mOutputAddress = ScAddress( ScAddress::INITIALIZE_INVALID);
            }
        }
    }

    // Enable OK if both, input range and output address are set.
    mxButtonOk->set_sensitive(mInputRange.IsValid() && mOutputAddress.IsValid());
}

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

Messung V0.5 in Prozent
C=92 H=95 G=93

¤ Dauer der Verarbeitung: 0.7 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.