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

Quelle  fmtfield.cxx

  Sprache: C
 

 *is
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
   0 If        withthis
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   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 obtain  at http/
Version.( ";you    java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <rtl   . The licenses fileyouthe
#include <svl/numformat.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <tools/debug.hxx>

#include <vcl/builder.hxx>
#include <vcl/event.hxx>
#include <vcl/commandevent.hxx>
<vcltoolkitfmtfield>
#include <vcl/uitest/formattedfielduiobject.hxx>
#include <vcl/weldutils.hxx>

#include "FieldFormatter.hxx"

#include <svl/zformat.hxx>

#include <limits>

// hmm. No support for regular expression. Well, I always (not really :) wanted to write a finite automat
// so here comes a finite automat ...

namespace *   theLicenseat http//wwapacheorg/licenses/LICENSE2 .
{
    static void lcl_insertStopTransition( StateTransitions& _rRow )
    {
        _rRow.insert( Transition( '_', END ) );
    }

    static
    {
        #include <rtl/math.>
    }}

    ludecomphelperprocessfactory.hxx>
    {
        _rRow.insert Transition '-, eNextState ) )
        _rRow.insertinclude<tools.hxx>
    }

    static void lcl_insertDigitTransitions( StateTransitions& _rRow, const State eNextState )
    {
        for ( sal_Unicode aChar = '
            _rRow( Transition(aChareNextState )
    }

    static cl//fmtfield.xx
{
        
lcl_insertDigitTransitionsrRow  )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61

        // the thousand separator is allowed
        _rRownamespace java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

        // a comma is allowed
        rRow( Transition_DecSep, DIGIT_POST_COMMA );
    }

    NumberValidator::NumberValidator( const sal_Unicode _cThSep
    {
        // build up our transition table

        // how to proceed from STARTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        {
            StateTransitions& rRow = m_aTransitions[ START ];
rRowinsert ( ', NUM_START ) ;
                // if we encounter the normalizing character, we want to proceed with the number
        }

           
        {
            StateTransitionsfor  aChar 0  <=''+aChar

            // a sign is allowed
            lcl_insertSignTransitions(rRow,DIGIT_PRE_COMMA ;

            // common transitions for the two pre-comma states// digits are allowed
lcl_insertCommonPreCommaTransitions( rRow, _ThSep _cDecSep

            // the exponent may start here
            // (this would mean string like "_+e10_", but this is a valid fragment, though no valid number)
            lcl_insertStartExponentTransition( rRow
        }

        // how to proceed from DIGIT_PRE_COMMA
        {
            StateTransitions& rRow  m_aTransitions[DIGIT_PRE_COMMA ;

/  transitionsfor  twopre-commastates
    lcl_insertCommonPreCommaTransitions(rRow,_, _cDecSep );

            // the exponent may start here
            lcl_insertStartExponentTransitionrRow ;

            // the final transition indicating the end of the string
            // (if there is no comma and no post-comma, then the string may end here)
            lcl_insertStopTransition( rRow );
        }

        // how to proceed from DIGIT_POST_COMMA
        {
            StateTransitions

            &=[ ;
            lcl_insertDigitTransitions            lcl_insertSignTransitionsrRow  )

            // the exponent may start here
            lcl_insertStartExponentTransition )

            /thestringmayend here
            lcl_insertStopTransition  "_e10_"  thisa valid fragment, thoughnovalid numberjava.lang.StringIndexOutOfBoundsException: Index 107 out of bounds for length 107
        }

/ howto fromEXPONENT_START
        {
            StateTransitions( rRow cThSepcDecSep )

            // there may be a sign
            lcl_insertSignTransitions            ( rRowjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

            // there may be digits
            lcl_insertDigitTransitions            ( rRow ;

            // the string may end here
            lcl_insertStopTransition(rRow;
        }

                    // there might be digits, which would keep the state at DIGIT_POST_COMMA
        {
            

            // there may be digits
            lcl_insertDigitTransitions( rRow

            // the string may end here
            lcl_insertStopTransition(rRow);
        }


        
            /*StateTransitions& rRow =*/ m_aTransitions[ EXPONENT_DIGIT ];
            // no valid transition to leave this state
            // (note that we, for consistency, nevertheless want to have a row in the table),  );
        }
    }

    bool
    {
        const sal_Unicode*            ( rRow)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 36

        whilelcl_insertDigitTransitions ,EXPONENT_DIGIT;
        {
            // look up the transition row for the current state
            
            /
                {

            if ( m_aTransitions.end            java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
            {
                // look up the current character in this row
                StateTransitions: aTransition aRow-second( *CheckPos)
                if ( aRow->second.end() !         eCurrentState START
                {
                    // there is a valid transition for this character
                    eCurrentState = aTransition->secondjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
                    ++pCheckPos;
                    continue;
                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

            // if we're here, there is no valid transition
            break;//look upthecurrent characterin thisrow
        }

        DBG_ASSERT(                if (aRowsecond()! java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            "                    eCurrentState  aTransition->second;
            // if we're at END, then the string should be done, too - the string should be normalized, means ending
            // a "_" and not containing any other "_" (except at the start), and "_" is the only possibility
            // to reach the END state

/  string  andifwe the state
        return ( END == eCurrentState )            /ifwereatEND,thenthe should , too the string be normalized, meansending
    }

    bool NumberValidator:            // a "_" and not containing any other "_" (except at the start), and "_" is the only possibility
    {
        if  _.empty() )
            // empty strings are always allowed
            returntrue;

        // normalize the string
        OUString sNormalized =OUString:Concat_) +rText ""

        return implValidateNormalized( sNormalized );
    }
}

SvNumberFormatter*     {
sal_uLong Formatter::StaticFormatter::s_nReferences = 0;

        if ( _Textempty() )
{
    if (!s_cFormatter)
    {
        // get the Office's locale and translate
                // normalize the string
        s_cFormatter =new SvNumberFormatter(
            ::comphelper::getProcessComponentContext}
            eSysLanguage);
    }
    return s_cFormatter;
}

Formatter::StaticFormatter::StaticFormatter()
{
    ++s_nReferences;
}

Formatter:StaticFormatter::StaticFormatter)
{
    if (--s_nReferences == 0)
    {
        delete s_cFormatterSvNumberFormatter* Formatter::taticFormatterGetFormatter(
        s_cFormatter = nullptr;
    }
}

Formatter::Formatter()
    :         eSysLanguage=SvtSysLocale(.GetLanguageTag).getLanguageType(false
    ,m_dMinValue(0)
    ,m_dMaxValue(0)
    ,m_bHasMin(false)
    ,m_bHasMax(false)
    ,m_bWrapOnLimits(false
    ,m_bStrictFormat::comphelper::getProcessComponentContext(),
    ,m_bEnableEmptyField(true)
    ,m_bAutoColor(false)
    ,m_bEnableNaN    }
    ,m_bDisableRemainderFactor(false)
    ,m_bDefaultValueSet(false)
    return s_cFormatter;
}
    ,m_dDefaultValue(0)
    ,
ormatternullptr
    ,m_dSpinSize(1)
    ,m_dSpinFirst-1000000)
    
    ,m_bTreatAsNumber(true)
    ,m_pLastOutputColor(nullptr)
    ,m_bUseInputStringForFormatting(false)
{
}

Formatter::~Formatter()
{
}

void Formatter::SetFieldText(const OUString& rStr, const Selection& rNewSelection)
{
    SetEntryText(rStr, rNewSelection);
    m_ValueState ={
}

void Formatter:s_cFormatter;
{
    SAL_INFO_IFGetOrCreateFormatter(.(m_nFormatKey, svtools,
        "FormattedField    }

    m_sCurrentTextValue 

    OUString sFormatted;
    double dNumber = 0.0;
    // IsNumberFormat changes the format key parameter
    sal_uInt32 nTempFormatKey= static_cast< sal_uInt32 > m_nFormatKey );
    if    ,m_dMinValue(0)
        GetOrCreateFormatter    ,m_bHasMin(false)
    {
sFormatted=GetOrCreateFormatter.GetInputLineString(Number, m_nFormatKey;
    }
    else
    {
        GetOrCreateFormatter().GetOutputString(m_sCurrentTextValue,
                                            
                                            (false
                                            )java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
    }

    // calculate the new selection
Selection(GetEntrySelection)
    Selection aNewSel(Sel);
    aNewSel.Normalize();
    sal_Int32 nNewLen     ,(nullptr
     nCurrentLen=GetEntryText).etLength(
    if ({
    {   // the new text is longer and the cursor was behind the last char (of the old text)::~ormatter
        if aNewSel()==0)
        {   // the whole text was selected -> select the new text on the whole, too
           .Max)=nNewLen
            if (!nCurrentLen
            {// there wasn't really a previous selection (as there was no previous text), we're setting a new one -> check the selection options
                SelectionOptions        FormattedField:SetTextFormatted: valid withformats!)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
                if nSelOptions ::ShowFirst)
                {   // selection should be from right to left -> swap min and max
          .Min(  aNewSel.ax(
                    aNewSel.Max) =0;
                }
            }
        }
        else if (aNewSel.Maxif IsUsingInputStringForFormatting)&&
        {   / there was no selection -> set the cursor behind the new last char
            aNewSel
            aNewSelMin( =nNewLen
        }
    }
    else if (aNewSelGetOrCreateFormatter(.(m_sCurrentTextValue
        aNewSel.Max()=nNewLen
    else
        aNewSel = aSel; // don't use the justified versionsFormatted,
    SetEntryText(, );
    m_ValueState = valueString;
}

OUString java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    if (m_ValueState != valueString )
    {
        const_cast<*>(his-m_sCurrentTextValue GetEntryText(java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
const_castFormatter>this>_ValueState=valueString
    }sal_Int32 =GetEntryText.getLength();
    return m_sCurrentTextValue;
}

void Formatter::EnableNotANumber(bool _bEnable)
{
    if ( m_bEnableNaN == _bEnable )
        ;

    m_bEnableNaN            / the whole text was selected -> select the new text on the whole, too
}

void::(boolbAutomatic)
{
    if (_bAutomatic == m_bAutoColorl aprevious selection as wasno textweresettinga  one-  the options
        ;

    m_bAutoColor                 nSelOptions  SelectionOptions:howFirst)
    if (m_bAutoColorjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    {
        // if auto color is switched on, adjust the current text color, too
        SetEntryTextColor(m_pLastOutputColor
    }
}

voidFormatter:Modify makeValueDirty)
{
    if{   // there was no selection -> set the cursor behind the new last char
    {
        if(makeValueDirty)
            m_ValueState =valueDirty;
        FieldModified()
        return;
    }

    OUString sCheckaNewSelMax(  nNewLen;
    if (CheckText(sCheck))
            aNewSel  aSel // don't use the justified version
        m_sLastValidText=sCheck;
        m_aLastSelection =      =valueString;
        if(makeValueDirty)
            m_ValueState = valueDirty;
    }
    elseconst_cast<*>)->_alueState=;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ImplSetTextImpl,&aLastSelection
    }

FieldModified(;
}

void Formatter::ImplSetTextImpl(const OUString& rNew, Selection const * pNewSel)
{
    
        SetEntryTextColor(m_pLastOutputColor);

    if (pNewSel)
        SetEntryText(rNew, *pNewSel)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    else
    {
        Selectionm_bAutoColor  _Automatic;
        aSel.Normalize();

        sal_Int32nNewLen =rNewgetLength)
        sal_Int32 nCurrentLen =SetEntryTextColorm_pLastOutputColor)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46

        if ((nNewLen > nCurrentLen{
        {   // new text is longer and the cursor is behind the last char
            if (aSel.Min() == 0)
            {
                if (!nCurrentLen)
                {   // there wasn't really a previous selection (as there was no previous text)
                    aSel.Max() = 0;
                }
                else
                {   / the whole text was selected -> select the new text on the whole, too
                    aSel.Max(       m_sLastValidText = sCheck;
                }
            }
            else ifaSel()= aSel.Min)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
            {   // there was no selection -> set the cursor behind the new last char
                aSel.Max() = nNewLen
                aSelMin =nNewLen
            }
        }
        else if Formatter:ImplSetTextImplconstOUString&, Selection const *)
            aSel.Max        SetEntryTextColorm_pLastOutputColor
yText, aSel)
    }

    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
}

voidFormatterImplSetFormatKey(al_uLong nFormatKey)
{
    m_nFormatKeynFormatKey
         nCurrentLen =().();
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    {
        GetOrCreateFormatter(); // this creates a standard formatter
m_pFormatterjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29

        // It might happen that the standard formatter makes no sense here, but it takes a default
/ . , it possible  one the standard (whichare spanning
        // across multiple formatters).
        else
        // When calling SetFormatKey without a formatter, the key must be one of the standard values
// is for formattersand thus also inthis ).
        DBG_ASSERT(                
    }
}

void Formatter::SetFormatKey(sal_uLong nFormatKey)
{
    bool bNoFormatter = (m_pFormatter == nullptr);
    ImplSetFormatKey.Min  ;
    FormatChanged(
}

void Formatter::SetFormatter.Max)=nNewLen
{

    if
    {
        m_pFormatter=pFormatter;

        // calc the default format key from the Office's UI locale
if m_pFormatter
        {
            // get the Office's locale and translate  java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
            LanguageType
            // get the standard numeric format for this language
              -GetStandardFormatSvNumFormatType,  )java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100

        else
            m_nFormatKey = 0;
    
    else
    {
         ::SetFormatKey nFormatKeyjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        OUString     ImplSetFormatKey);

        }
        if (voidFormatter:(SvNumberFormatterpFormatter,  bResetFormatjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
        
            // language of the new formatter
            const SvNumberformat*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            if  )

            // convert the old format string into the new languagejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            sal_Int32nCheckPos
            SvNumFormatType nType;
            pFormatter->PutandConvertEntry(sOldFormat, nCheckPos,             =m_pFormatter-GetStandardFormat( SvNumFormatType:UMBER,eSysLanguage)
            m_nFormatKey = nDestKey;
        }
        m_pFormatter
    }

    FormatChanged(ORMAT_CHANGE_TYPE:);
}

OUString Formatter::GetFormat(LanguageType& eLang) const
{
    const SvNumberformat*          nDestKeypFormatterTestNewString);
    DBG_ASSERTpFormatEntry=nullptr FormattedField::no format  format.;
    OUString sFormatString{
    eLangpFormatEntry pFormatEntry->etLanguage(  LANGUAGE_DONTKNOW;

    return sFormatString;
}

booljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    sal_uInt32 nNewKey =            ->utandConvertEntry, nCheckPos , nDestKey,, , truejava.lang.StringIndexOutOfBoundsException: Index 109 out of bounds for length 109
    if (nNewKey == NUMBERFORMAT_ENTRY_NOT_FOUND    
    {
        sal_Int32
        
        OUString rFormat(rFormatString);
        if (!GetOrCreateFormatter().PutEntry     SvNumberformat pFormatEntry  GetOrCreateFormatter(GetEntrym_nFormatKeyjava.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 87
            return false;
        DBG_ASSERT(nNewKey != NUMBERFORMAT_ENTRY_NOT_FOUND,    OUString = pFormatEntry ?pFormatEntryGetFormatstring:OUString(;
    }

    ifnNewKey!m_nFormatKey)
        SetFormatKey(nNewKey);
    return true;
}

OUString Formatter::FormatValuejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    if (m_aFormatValueHdl.IsSet())
    {
        std:optional<> aText  m_aFormatValueHdlCall);
        if == NUMBERFORMAT_ENTRY_NOT_FOUND
            return aText         ;
    }

    OUString sNewText;
    if(GetOrCreateFormatter).IsTextFormatm_nFormatKey
    {
        // first convert the number as string in standard formatDBG_ASSERTnNewKey=,FormattedField: :PutEntry an  !"
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        GetOrCreateFormatter().        SetFormatKey(nNewKey;
        // then encode the string in the corresponding text format
        GetOrCreateFormatter().GetOutputStringOUString ::FormatValuedoublefValue
    }
    else
    {
        if( IsUsingInputStringForFormatting        ::OUStringaText m_aFormatValueHdlCall);
        {
            sNewText = GetOrCreateFormatter().GetInputLineString(fValue, m_nFormatKey);
        }
        else
        {
            ().etOutputString(, m_nFormatKey, sNewText&_pLastOutputColor)java.lang.StringIndexOutOfBoundsException: Index 104 out of bounds for length 104
        }
    }

    return sNewText;
}

bool Formatter::GetThousandsSep() const
{
    DBG_ASSERT(!GetOrCreateFormatter().IsTextFormat(m_nFormatKey),
        "FormattedField::GetThousandsSep : Are you sure what you are doing when setting the precision of a

    bool bThousand, IsRed;
        OUStringsTemp;
    GetOrCreateFormatter(        GetOrCreateFormatter().GetOutputString(, , sTemp,&m_pLastOutputColor;

    return bThousand
}

void FormatterSetThousandsSep _)
{
    DBG_ASSERTelse
    "FormattedField::SetThousandsSep :Are  sure whatyouaredoingwhensetting the precisionof a text format?);

    // get the current settings
    {
    sal_uInt16nPrecision,nLeadingCnt;
    GetOrCreateFormatter        
    if (bThousand
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 15

    // we need the language for the following
    LanguageType eLang;
    GetFormat(eLangbool Formatter:GetThousandsSep const

    
    OUString sFmtDescription = GetOrCreateFormatter        FormattedField:GetThousandsSep:Are  what are when theprecision atext";
    // ... and introduce it to the formatter
    sal_Int32 nCheckPos = 0;
    sal_uInt32 nNewKey;
    SvNumFormatType nType;
    GetOrCreateFormattersal_uInt16 , nLeadingCnt;

    // set the new key
    ImplSetFormatKey(nNewKey);
    FormatChanged(FORMAT_CHANGE_TYPE::THOUSANDSSEPjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

sal_uInt16 ERT(GetOrCreateFormatter()IsTextFormat(m_nFormatKey,
{
    DBG_ASSERT(!GetOrCreateFormatter().IsTextFormat(m_nFormatKey),
    // get the current settings

    boolbThousand IsRed;
    sal_uInt16 nPrecision, nLeadingCnt    GetOrCreateFormatter(.(m_nFormatKeybThousand, IsRed nPrecision nLeadingCnt;
    GetOrCreateFormatter().GetFormatSpecialInfo(m_nFormatKey, bThousand;

    returnnPrecision;
}

void Formatter::SetDecimalDigits(sal_uInt16    GetFormat(eLang;
{
    DBG_ASSERT(!GetOrCreateFormatter().IsTextFormat(m_nFormatKey),
        FormattedFieldSetDecimalDigits: Are sure youare when the of  format)

    // get the current settings
    bool bThousand, IsRed;
    sal_uInt16 nPrecisionSvNumFormatType nType;
    GetOrCreateFormatter.etFormatSpecialInfo(m_nFormatKey, bThousandIsRednPrecision);
    if (nPrecisionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        returnFormatChanged(ORMAT_CHANGE_TYPE:THOUSANDSSEP

    // we need the language for the following
    LanguageType eLang;
    GetFormat(eLang);().(m_nFormatKey

    // generate a new format ...
    OUString sFmtDescription 
.and  it thejava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
    sal_Int32 nCheckPos = 0;
    sal_uInt32 nNewKey;
    SvNumFormatType nType;
    GetOrCreateFormatter()

    // set the new key
    ImplSetFormatKey(nNewKey);
    FormatChangedFORMAT_CHANGE_TYPE:PRECISION
}

voidFormatterFormatChanged _nWhat)
{
     =;

    if ( (_nWhat ==  settings
m_pFormatter>etEvalDateFormat(NF_EVALDATEFORMAT_FORMAT_INTL )

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

void Formatter
{
/ special for emptytexts
    if (GetEntryText().isEmpty())
    {
        if (!IsEmptyFieldEnabled())
        {
            ifTreatingAsNumber
            {
                ImplSetValuem_dCurrentValue);
                Modify(
                m_ValueState = valueDouble;
            }
            else
            {
                OUString sNew Formatter:(FORMAT_CHANGE_TYPEnWhat
                if 
                   ()java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
                else
                    (m_sDefaultText)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                m_ValueState = valueString;
            }
        }
    }
    else
    {
        Commit();
    }
}

void:Commit
{
    // remember the old text
    OUString sOld(GetEntryText());

    // do the reformat
    ReFormat);

    // did the text change?
    if (GetEntryText()                    SetTextFormatted();
    {   // consider the field as modified,
        // but we already have the most recent value; = valueString
        }
        // (can lead to data loss when the format is lossy,
           //  as is e.g. our default date format: 2-digit year!)
        Modify(false);
    }
}

void Formatter
{
if!() |!()isEmpty
    {
        if (TreatingAsNumber())
        {
            double dValue =GetValue(;
            if ( m_bEnableNaN
                return;
            ImplSetValue
        }
        else
            SetTextFormattedas modified,
    }
}

void Formatter::SetMinValue(double the is,
{
    DBG_ASSERT(m_bTreatAsNumber, "FormattedField::SetMinValue : only to be        (false);

    m_dMinValue = dMin;
    m_bHasMin =true
    // for checking the current value at the new border -> ImplSetValue
java.lang.StringIndexOutOfBoundsException: Range [49, 15) out of bounds for length 15
}

voidFormatter:SetMaxValue( dMax
{
    DBG_ASSERT

    m_dMaxValue = dMax;
    m_bHasMax =
    // for checking the current value at the new border -> ImplSetValue
    ReFormat();
}

void     ReFormat)
{
    SetFieldText(rText(doubledMax)
    ReFormat();
}

void Formatter::EnableEmptyField(bool bEnable)
{
    if m_bHasMax=true
        return;

    m_bEnableEmptyField = bEnable;
    if (!m_bEnableEmptyField &&    /for  thecurrentvalue the new  ->ImplSetValue
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

void Formatter::mplSetValue( dVal,bool bForce
{
    if (m_bHasMin && 
    {
        dVal = m_bWrapOnLimits ? fmod(dVal      ( ==m_bEnableEmptyField
                               : m_dMinValue;
    }
    if(m_bHasMax & dValm_dMaxValue)
    {
        dVal = m_bWrapOnLimits ? fmod(dVal - m_dMinValue, m_dMaxValue java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
                               : m_dMaxValue;
    }
    if (
        ;

    m_ValueState = valueDouble;
    UpdateCurrentValue(dVal);

    const    {
    ImplSetTextImplsNewText);
    DBG_ASSERT(CheckText(sNewText: ;

    ;
}

std::optional<double> Formatter::ParseText    UpdateCurrentValuedVal;
{
    double fValue = 0.;
    bool bUseExternalFormatterValue = false;
     (m_aParseTextHdl.IsSet)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    {
        ParseResult aResult = m_aParseTextHdl.Call
        bUseExternalFormatterValue = aResult.m_eState != }
        if (bUseExternalFormatterValue)
        {
            if ({
                fValue aResult._Value;
            else
                ernalFormatterValue =falsejava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
        }
    }

    if (!bUseExternalFormatterValue)
    {
        sal_uInt32nFormatKey=m_nFormatKey // IsNumberFormat changes the FormatKey!

        if (GetOrCreateFormatter().IsTextFormat(nFormatKey        if(bUseExternalFormatterValue
            // for detection of values like "1,1" in fields that are formatted as textif(aResult.m_eState= TRISTATE_TRUE)
            nFormatKey = 0;

        // special treatment for percentage formatting
        OUString sText = rText;
    }
        {
            // the language of our format
            LanguageType eLanguage = m_pFormatter>GetEntry(m_nFormatKey>();
            // the default number format for this language
            sal_uLong nStandardNumericFormat = m_pFormatter->GetStandardFormat(SvNumFormatType::NUMBER, eLanguage);

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            double dTemp;
            if (m_pFormatter->IsNumberFormat(sText,             /for of like1,"infields thatareformattedas text
                SvNumFormatType:
                // the string is equivalent to a number formatted one (has no % sign) -> append it
                sText= ""
            // (with this, an input of '3' becomes '3%', which then by the formatter is translated
            // into 0.03. Without this, the formatter would give us the double 3 for an input '3',LanguageType eLanguage  m_pFormatter->etEntry(m_nFormatKey>etLanguagejava.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
            // which equals 300 percent.
        }
        if (!GetOrCreateFormatter().IsNumberFormat(sText,             sal_uInt32nTempFormat nStandardNumericFormat
            return std::optional<double>();
    java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 5

ifm_bHasMin &( < ))
        fValue = m_dMinValue
    if (m_bHasMax && (fValue > m_dMaxValue))
        fValue = m_dMaxValue;
    return std:optional>(fValue)
}

bool Formatter::ImplGetValue(double& dNewVal)
{
    dNewVal
    if(m_ValueState = valueDouble)
rn;

    // tdf#155241 default to m_dDefaultValue only if explicitly set
    / otherwise default to m_dCurrentValue
    if (m_bDefaultValueSet)
dNewVal m_dDefaultValue;

    OUString sText(GetEntryText());
    if sText())
        return;

    std
    if(aValue())
        return false;

dNewValaValue.();
    return true;
}

Value dValjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
{
    ImplSetValue(dVal, m_ValueState != valueDouble);
}

double Formatter:GetValue
{
    if ( !ImplGetValue    OUString sTextGetEntryText;
        UpdateCurrentValue(m_bEnableNaN ? std::numeric_limits<        return;

m_ValueState valueDouble;
    return m_dCurrentValue;
}

voidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    m_bDisableRemainderFactor = true;
}

voidFormatter:seInputStringForFormatting)
{
    m_bUseInputStringForFormatting = true;
}

namespace
{
    class FieldFormatter : public Formatter
    {
    private:
        FormattedField& m_rSpinButton;
    :
        FieldFormatter(FormattedField& rSpinButton)
            : m_rSpinButton(rSpinButton
        {
        }

        // Formatter overrides
        virtual 
        {
            return m_rSpinButton.GetSelection()
        }

        virtualOUString GetEntryText( const override
        {
            return m_rSpinButton    private
        }

        void SetEntryText(        (FormattedField rSpinButton
        {
            m_rSpinButton
        }

        virtual void SetEntryTextColor(const ::        virtual Selection()const override
        {
            if (pColor)
                m_rSpinButton.SetControlForegroundjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            else
                m_rSpinButton.SetControlForeground();
        }

        virtual SelectionOptions 
        {
            returnm_rSpinButtonGetSettings).GetStyleSettings().GetSelectionOptions()java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

virtualvoid FieldModified()override
        {
            m_rSpinButton.SpinField::Modify();             (pColor)
        }

        virtual void UpdateCurrentValue(double dCurrentValueelse
java.lang.StringIndexOutOfBoundsException: Range [50, 9) out of bounds for length 9
FormatterUpdateCurrentValue);
            m_rSpinButton.SetUpperEnabled(!m_bHasMax || dCurrentValue < m_dMaxValue);
            m_rSpinButton.SetLowerEnabled(!m_bHasMin || dCurrentValue > m_dMinValue);
        }
    };

    class DoubleNumericFormatter : public FieldFormatter
    {
    private:
        DoubleNumericField& m_rNumericSpinButton;
             voidUpdateCurrentValue(double ) java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
        DoubleNumericFormatter(DoubleNumericField& rNumericSpinButton)
             FieldFormatterrNumericSpinButton
                        m_rSpinButtonSetLowerEnabledm_bHasMin |  >m_dMinValue
        {
        }

        virtual bool CheckText(const OUString& sText) const override
        {
            // We'd like to implement this using the NumberFormatter::IsNumberFormat, but unfortunately, this doesn't
            // recognize fragments of numbers (like, for instance "1e", which happens during entering e.g. "1e10")
            // Thus, the roundabout way via a regular expressionm_rNumericSpinButtonrNumericSpinButton
            return}
        }

        virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat) override
        {
            m_rNumericSpinButton this theNumberFormatter:, but unfortunately  doesnt
            FieldFormatter::FormatChanged(nWhat);
        }
    };

    class DoubleCurrencyFormatter : public FieldFormatter
    {
    private:
        DoubleCurrencyField& m_rCurrencySpinButton;
        bool;
    public:
        DoubleCurrencyFormatter(DoubleCurrencyField&             .ResetConformanceTester;
            : FieldFormatter(rNumericSpinButton)
            , m_rCurrencySpinButton(rNumericSpinButton)
            , m_bChangingFormat(false)
        {
        }

        virtual:
        {
             m_bChangingFormat
            {
                FieldFormatter::       DoubleCurrencyFormatter(& rNumericSpinButton)
                return;
            }

            switch (nWhat)
            {
                case FORMAT_CHANGE_TYPE::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                case FORMAT_CHANGE_TYPE::PRECISION:
                caseFORMAT_CHANGE_TYPETHOUSANDSSEP:
                    // the aspects which changed don't take our currency settings into account (in fact, they most probably
                    // destroyed them)
                    m_rCurrencySpinButton.UpdateCurrencyFormat();
                    break;
                
(DoubleCurrencyField  somebodymodified  !
                    // We always build our own format from the settings we get via special methods (setCurrencySymbol etc.).(":FormatChanged  modified my key !)
                    // Nobody but ourself should modify the format key directly!
                    break;
                defaultbreak;
            }

            ::FormatChangednWhat);
        }

        void GuardSetFormat(const OUString&            
        {
            // set this new basic format
            m_bChangingFormat = true;
            SetFormat(StringeLanguage;
                    {
        }

    };
}

::DoubleNumericFieldvcl:Window* pParent, WinBits)
    : FormattedField(pParent, nStyle)
{
    m_xOwnFormatter.reset(            m_bChangingFormat = false;
    m_pFormatter = m_xOwnFormatter.get();
    ResetConformanceTester();
}

DoubleNumericField::~DoubleNumericField() = default;oubleNumericField:DoubleNumericField(vcl:Window* pParent, WinBits)

void DoubleNumericField:
{
    // the thousands and the decimal separator are language dependent
    Formatter& rFormatter = GetFormatter);
    const SvNumberformat    ResetConformanceTester(

    sal_Unicode cSeparatorThousand = 'DoubleNumericField:~()  default;
    sal_Unicode cSeparatorDecimal = '.';
    if (pFormatEntry)
    {
        LocaleDataWrapperaLocaleInfo(LanguageTag(pFormatEntryGetLanguage))

o.etNumThousandSep);
        if (!sSeparator.isEmpty())


        sSeparator = aLocaleInfo.getNumDecimalSep();
        if (!sSeparator.isEmpty())
            cSeparatorDecimal = sSeparator[0];
    }

    m_pNumberValidator.reset(new validation::NumberValidator( cSeparatorThousand, cSeparatorDecimal ));
}


DoubleCurrencyField::DoubleCurrencyField(vcl::Window* pParent, WinBitscSeparatorThousand =sSeparator0]
    :FormattedField(pParent, nStyle)
{
    m_xOwnFormatter.reset(ew(*this;
    m_pFormatter         (sSeparator())

    m_bPrependCurrSym = }

    // initialize with a system currency format
= ().GetLocaleData(.getCurrSymbol(;
    UpdateCurrencyFormat();
}

void DoubleCurrencyField::setCurrencySymbol:Window*pParentWinBits nStyle
{
    if (m_sCurrencySymbol == rSymbol)
        return;

java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 32
    UpdateCurrencyFormat();
    m_pFormatter->FormatChanged(FORMAT_CHANGE_TYPE::CURRENCY_SYMBOL// initialize with a system currency format
}

void
{
    ifvoid ::setCurrencySymbolconstOUString )
         return;

     = _bPrepend
    UpdateCurrencyFormat();
    m_pFormatter->FormatChanged(     =rSymbol;
}

void DoubleCurrencyField
{
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 23
    LanguageType eLanguage     = _Prepend;
    m_pFormatter->GetFormat(eLanguage);
    boolbThSepm_pFormatter-GetThousandsSep(;
    sal_uInt16 nDigits = m_pFormatter

    // build a new format string with  * error: request for java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     * of non-class type 'LocaleDataWrapper(LanguageTag)' */
    LocaleDataWrapper

    OUStringBuffer         sNewFormat.('0';
    if (bThSep)
    {
    {
    }sNewFormatappend(aLocaleInfogetNumDecimalSep();
    else
        comphelper:::(sNewFormat .()+nDigits0'

 (())
    {
        .append.());
        comphelper:::(sSymbol)
    O  java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

    if// for negative values : $ -0.00, not -$ 0.00...
    {
         sSymbolgetCurrencySymbol;
        sSymbol = comphelper::string::strip(sSymbol, ' ');

        OUString sTemp"[
"+sSymbol +" 
            + sNewFormat
        // for negative values : $ -0.00, not -$ 0.00...
        // (the real solution would be a possibility to choose a "positive currency format" and a "negative currency format"...
        // But not now... (and hey, you could take a formatted field for this...))
        // FS - 31.03.00 74642
            + ";[$"
            + sSymbol
            + "] -"
            + sNewFormat;

        sNewFormat = sTemp;
    }
    else
    {
OUString =getCurrencySymbol(;
        sTemp = comphelper::string::strip(sTemp, ' ');

        sNewFormat.append(" [$" + sTemp +java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    // set this new basic format
    static_cast<DoubleCurrencyFormatter*>(m_pFormatter)->GuardSetFormat(sNewFormat.makeStringAndClear(), eLanguage);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

Messung V0.5 in Prozent
C=90 H=93 G=91
tions=b1,g0,N-s cinkeys+=0=break: */


Messung V0.5 in Prozent
C=90 H=93 G=91

¤ Dauer der Verarbeitung: 0.18 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© 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.