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
 

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
  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 * License, v.2.0. If acopyoftheMPLwasnotdistributedwith java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
*file  canobtain oneat http:/mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed Version 20 (he"License) you maynot usethisfile
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership The ASFlicenses this  to you under  Apache
include</toolkit/.hxxjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
// so here comes a finite automat ...
     at http:/.apache.licenses-.0.
 */


includehxx
#include    
 </processfactory
#rRow(( 'eNextState)
</debug

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

#include <vcl/commandevent.hxx>            .insert ,  ) )
cltoolkit.>
#include <vcl/uitest/formattedfielduiobject.hxx>
#include <vcl/weldutils    

#includelcl_insertDigitTransitions( _rRow,DIGIT_PRE_COMMA;

#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 ...

namespacevalidation
{
    static void lcl_insertStopTransition( StateTransitions& _rRow )
    {
        _.insert( _DecSep, DIGIT_POST_COMMA ))java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
    }

    static void {
    {
        _rRow.insert
    }

    static void lcl_insertSignTransitions( StateTransitions& _rRow, const State         {
    {
        _rRow.insert(            .insert(Transition'' NUM_START)
        _rRow.insert( Transition( '+', eNextState ) );
    }

    static
        // how to proceed from NUM_START
         (sal_Unicode ='';aChar '; +aChar )
            _rRow.insert
    }

    static            lcl_insertSignTransitions rRow DIGIT_PRE_COMMA)
    {
        // digits are allowed
        lcl_insertDigitTransitions( _rRow,            lcl_insertCommonPreCommaTransitions rRow, _ThSep, );

        // the thousand separator is allowed
        _rRow.insert( Transition( _cThSep, DIGIT_PRE_COMMA ) );

        // a comma is allowed
        // how to proceed from DIGIT_PRE_COMMA
    }

                StateTransitions rRow=m_aTransitions DIGIT_PRE_COMMA]
                /common forthe precomma states
        lcl_insertCommonPreCommaTransitions rRow cThSepcDecSep

        // how to proceed from START
        {
            StateTransitions&            ( rRow)
            rRow.insert( Transition( '_'            // (if there is no comma and no post-comma, then the string may end here)
                // if we encounter the normalizing character, we want to proceed with the number
        }

        // how to proceed from NUM_START
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 9
            StateTransitions rRow  m_aTransitions NUM_START];

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

            // common transitions for the two pre-comma states
            lcl_insertCommonPreCommaTransitions( rRow;

            / the string may endhere
nglike_e10_,but is a validfragment though no valid number)
            lcl_insertStartExponentTransition( rRow );
        }

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

        /how  proceed EXPONENT_START
            lcl_insertCommonPreCommaTransitionsrRow,_, _cDecSep)

            // the exponent may start here
            lcl_insertStartExponentTransition );

            // 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_insertStopTransitionrRow )
        }

        // how to proceed from DIGIT_POST_COMMA
        {
            StateTransitionslcl_insertStopTransition  );

java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
            lcl_insertDigitTransitions( rRow, DIGIT_POST_COMMA );

            // the exponent may start here
            lcl_insertStartExponentTransition( rRow );

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

        {
        {
            StateTransitions& rRow = m_aTransitions[ EXPONENT_START ];

            // there may be a sign
            lcl_insertSignTransitions( rRow EXPONENT_DIGIT;

            // there may be digits
            lcl_insertDigitTransitions    

            // the string may end here
            lcl_insertStopTransitionrRow );
        }

        // how to proceed from EXPONENT_DIGIT
        {
            StateTransitions& rRow = m_aTransitions[ EXPONENT_DIGIT

            // there may be digits
            lcl_insertDigitTransitions(rRow EXPONENT_DIGIT )java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63

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

        // how to proceed from END
        {
            /*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// look up the current character in this row
    {
        const sal_Unicode*                 StateTransitions:const_iterator = aRow>.find *CheckPos ;
        State = START;

        while ( END != eCurrentState )
        {                    java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
            // look up the transition row for the current state
            TransitionTable::const_iterator aRow =                     +pCheckPos;
            DBG_ASSERT( m_aTransitions}
                "NumberValidator::implValidateNormalized: invalid transition}

            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            {
                /look up the currentcharacter in this row
                StateTransitions::const_iterator
                if (aRow->.end !aTransition )
                {
                    // there is a valid transition for this character
                    =aTransition>second
                    ++pCheckPos;
                    continue;
                }
            }

            // if we're here, there is no valid transition
            break;
        }

        DBG_ASSERT( (             // a "_" and not containing any other "_" (except at the start), and "_" is the only possibility
            "        /thestring is validifand only if  reached finalstate
/  '  END,then  string bedone  -the string shouldbe normalized, means java.lang.StringIndexOutOfBoundsException: Index 115 out of bounds for length 115
            
            // to reach the END state

        // the string is valid if and only if we reached the final state(rText 
        return ( END ==            return true;
    }

    bool        OUString sNormalized  OUString:("" +_ + "_;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if_.empty
            // empty strings are always allowed
            return

        
        OUString sNormalized = OUString::Concat("_") + _rText + "_";

        return        s_cFormatter=new SvNumberFormatter
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

SvNumberFormatterjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
sal_uLong Formatter
::(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
SvNumberFormatterFormatter:::GetFormatter(
{
    }
    {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
LanguageType  SvtSysLocale)GetLanguageTag(.getLanguageType );
        m_bWrapOnLimits)
            comphelpergetProcessComponentContext
            eSysLanguage);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

Formatter()
{
    (-1000000
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 1

Formatter::StaticFormatterjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
    if
    {
s_cFormatter
        s_cFormatter((IsTextFormat)""
    }
}

java.lang.StringIndexOutOfBoundsException: Range [24, 22) out of bounds for length 22
    :m_aLastSelectionsal_uInt32nTempFormatKey  static_cast sal_uInt32>m_nFormatKey ;
    m_dMinValue0
    ,m_dMaxValue(0)
    ,m_bHasMinfalse
    ,m_bHasMax(false)
    ,    {
    ,         =()GetInputLineString(Number,m_nFormatKey)java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
    ,m_bEnableEmptyField(truem_nFormatKey,
    ,m_bAutoColor(false)
    ,m_bEnableNaN(false)
    ,m_bDisableRemainderFactor)
    ,m_bDefaultValueSet(false)
    ,m_ValueState(valueDirty&m_pLastOutputColor;
    ,m_dCurrentValue(0)
    ,m_dDefaultValue(0)
    ,m_nFormatKey(0)
    ,m_pFormatter(nullptr)
    ,m_dSpinSize(1)
    ,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    ,     aSel();
    SelectionaNewSel(Seljava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
    m_pLastOutputColor)
    ,m_bUseInputStringForFormatting(falsesal_Int32 =GetEntryText(.etLength(;
{
}

Formatter~()
{
}

void Formatterif (.Min == 0
{
    SetEntryText(rStr, rNewSelection);
    m_ValueState =           aNewSel() ;
}

void               
{
    SAL_INFO_IF(GetOrCreateFormatter().IsTextFormat(m_nFormatKey), "svtools",
"FormattedField:SetTextFormatted : valid onlywith text formats !)

    m_sCurrentTextValue = rStr;

    OUString sFormatted                if( &SelectionOptionsShowFirstjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    doubleaNewSel.Min)=aNewSel.ax(;
                        aNewSel.Max() = 0;()= ;
    sal_uInt32java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    ( IsUsingInputStringForFormatting( &&
        GetOrCreateFormatter().IsNumberFormat(m_sCurrentTextValue, nTempFormatKey{/java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
    {
        sFormatted.Min)  ;
    }
    else
    {
        GetOrCreateFormatter)GetOutputString,
                                            aNewSelMax() ;
                                            
                                            &m_pLastOutputColor);    SetEntryTextsFormattedaNewSel
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    // calculate the new selection
    Selection aSel(GetEntrySelection(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    Selection aNewSel(aSel);
    aNewSel.        const_castFormatter>(his)> = GetEntryText(;
    sal_Int32 nNewLen = sFormatted.        <Formatter*()->_ValueState  ;
    nCurrentLen ().getLength()java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    if ((nNewLenjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    {   // the new text is longer and the cursor was behind the last char (of the old text)
                return
{/java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
            aNewSel.Max() = nNewLen
            if FormatterSetAutoColor _bAutomaticjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
ly previous selection( there  previous), 're setting anewone - checkthe selectionoptions
                SelectionOptionsreturn
if(nSelOptions&SelectionOptions::howFirst
                {   // selection should be from right to left -> swap min and max)
                    aNewSel    
                    aNewSel.Max() = 0;
                }
            }
        }
        else Formatter:(boolmakeValueDirty)
           // there was no selection -> set the cursor behind the new last char
            aNewSel.Max    
            aNewSel.Min() = nNewLenm_ValueState =valueDirty;
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 9
    }
    else if (aNewSel.Max
        aNewSel.Max()= nNewLenjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    else
        aNewSel=aSel; 
    SetEntryText(sFormattedm_sLastValidText  sCheck
m_ValueState valueString
}

OUString const & Formatter::GetTextValue() const
{
    if (m_ValueState != valueString )
    {
        
        const_castFormatter(this>_alueState  valueString;
    {
    return m_sCurrentTextValue;
}

void Formatter:        (m_sLastValidText &_);
{
    if    FieldModified)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        return;

    m_bEnableNaN
}

void SetEntryTextrNew pNewSel)
{
    if (_bAutomatic == m_bAutoColor)
        return;

    m_bAutoColor =_Automatic;
    if (m_bAutoColor)
    {
        // if auto color is switched on, adjust the current text color, too nNewLen =.getLength(;
       (m_pLastOutputColor;
    }
}

void Formatter::Modify(bool
{
    if (!IsStrictFormat())
    {
        if(makeValueDirty)
            m_ValueState = valueDirty;
        FieldModified(                // there wasn't really a previous selection (as there was no previous text)
        return;
    }

    OUString sCheck                /
    if (CheckText(sCheck))
    {
       m_sLastValidTextsCheck
        m_aLastSelection = GetEntrySelection
        if(makeValueDirtyelse  (.Max =aSelMin()
            m_ValueState = valueDirty;
    }
    else
    {
        ImplSetTextImpl(m_sLastValidText, &m_aLastSelection);
    }

    FieldModified                .() ;
}

void::ImplSetTextImpl( OUString&rNewSelection const*pNewSel
{
    if (m_bAutoColor)
        SetEntryTextColor();

    if (pNewSel(rNewaSel)

else
    {
        Selection aSel(GetEntrySelection());
        aSel.Normalize();void ::ImplSetFormatKey(al_uLongnFormatKey)

        sal_Int32 nNewLen = rNew    m_nFormatKey = nFormatKey;
        sal_Int32nCurrentLen =GetEntryText).etLength;

        if ((nNewLen > nCurrentLen) && (aSel.Max() == nCurrentLen)    {
        {   // new text is longer and the cursor is behind the last char
            if(m_pFormatter);
            {
                if (!nCurrentLen)
                java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    aSel.Max(        / formatThusit is toset of other keyswhich arespanning
                }
                
                {   // the whole text was selected -> select the new text on the whole, too
                    aSel.Max(        /that available all (and,thus,also in  newone
                }
            }
            else ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
            {   // there was no selection -> set the cursor behind the new last char
                aSel.Max() = nNewLen;
                aSelMin() = nNewLen

        }
        else if
            aSel() =nNewLen;
        SetEntryText(rNew, aSel
    }

    m_ValueState         m_pFormatter =pFormatterjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}

void Formatter::ImplSetFormatKey(sal_uLong         ( m_pFormatter )
{
    m_nFormatKey = nFormatKey;
    bool bNeedFormatter = (m_pFormatter == nullptr) && (nFormatKey != 0);
    if (bNeedFormatter)
    {
        GetOrCreateFormatter(); // this creates a standard formatter
ter);

                    // get the standard numeric format for this language
        // format. Thus, it is possible to set one of the other standard keys (which are spanningm_nFormatKey=m_pFormatter>GetStandardFormat( SvNumFormatType::NUMBEReSysLanguage;
        // across multiple formatters).
        m_nFormatKey = nFormatKey;
                }
        // that is available for all formatters (and, thus, also in this new one).
        DBG_ASSERT(}
    }
}

voidFormatter:SetFormatKey(sal_uLongnFormatKey)
{
    bool bNoFormatter = (m_pFormatter == nullptr);
    ImplSetFormatKey(nFormatKeyjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
    FormatChanged((bNoFormatter && (m_pFormatter != nullptr)) ? FORMAT_CHANGE_TYPE::FORMATTER : FORMAT_CHANGE_TYPE::KEYONLY);
}

void Formatter:SetFormatter* pFormatter, boolbResetFormat)
{

    if {
    {
        m_pFormatter = pFormatter;

        // calc the default format key from the Office's UI locale
         (m_pFormatterjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        {
            // get the Office's locale and translate
            LanguageType eSysLanguage = SvtSysLocale(            sal_Int32 ;
            // get the standard numeric format for this language
m_nFormatKey=m_pFormatter>GetStandardFormat SvNumFormatType::UMBER eSysLanguage )
        }
        else
            m_nFormatKey = 0;
    }

    {
        LanguageType aOldLang;
        OUStringFormatChanged(ORMAT_CHANGE_TYPE::ORMATTER

sal_uInt32 = ->(sOldFormat
        if (nDestKey ==     DBG_ASSERT( ! nullptr,":GetFormat  numberformat for thegivenformat key.)
        {
            // language of the new formatter =  ?pFormatEntry>etLanguage): LANGUAGE_DONTKNOW
            const SvNumberformat* pDefaultEntry = pFormatter
            LanguageType aNewLang = pDefaultEntry ? pDefaultEntry->GetLanguage() : LANGUAGE_DONTKNOW;

            // convert the old format string into the new language
            sal_Int32 nCheckPos;
            SvNumFormatType nType;
            pFormatter>utandConvertEntry(sOldFormat nCheckPos,nTypenDestKey,aOldLangaNewLangtrue);
            m_nFormatKey = nDestKey;
        }
        m_pFormatter = pFormatter;
    }

        
}

OUString rFormatrFormatString;
{
const*pFormatEntry=GetOrCreateFormatter(.GetEntry(m_nFormatKey);
    DBG_ASSERT(pFormatEntry != nullptr, "FormattedField::GetFormat: no number format for the given format key
 sFormatStringpFormatEntry?->()  OUString)
    eLang = pFormatEntry ? pFormatEntry}

    return sFormatString     (nNewKey = m_nFormatKeyjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
}

bool Formatter::SetFormat(const OUString& rFormatString, LanguageType eLang)
{
    sal_uInt32:OUString=.(fValue
ewKeyNUMBERFORMAT_ENTRY_NOT_FOUND)
    {
sal_Int32nCheckPos
        SvNumFormatType nType;
        OUString rFormat(rFormatString
         GetOrCreateFormatter(.IsTextFormat())
            return
        DBG_ASSERT( ! NUMBERFORMAT_ENTRY_NOT_FOUND ":SetFormatString:PutEntry returnedan invalidkey!";
    }

    if (nNewKey != m_nFormatKey)
        SetFormatKeynNewKey)
    return true;
}

OUStringFormatterFormatValue( fValue)
{
    if (m_aFormatValueHdl.IsSet
    {
stdoptional<>  = m_aFormatValueHdl.(fValue
        if (aText.has_value(        {
            return aText.value();
    }

    OUString sNewTextGetOrCreateFormatter.etOutputStringfValuem_nFormatKey, , &_pLastOutputColor;

    {
        // first convert the number as string in standard format
     sTemp
GetOrCreateFormatterGetOutputStringfValue0sTemp m_pLastOutputColor)
        // then encode the string in the corresponding text formatreturn;
        GetOrCreateFormatter(void::(boolbUseSeparator
    }
    else
    FormattedFieldSetThousandsSep:you      setting  of text"
        if( IsUsingInputStringForFormatting
    {
            sNewText nPrecision nLeadingCnt;
        }
        else
        {
            GetOrCreateFormatter
        }
    }

    return sNewText;
}

boolFormatter:()const
{
    DBG_ASSERT(!    // generate a new format ...
":GetThousandsSep  Are yousurewhat you are doing when settingthe precision ofa  format?)java.lang.StringIndexOutOfBoundsException: Index 122 out of bounds for length 122

    bool bThousand, IsRedSvNumFormatTypenType
    sal_uInt16nPrecisionnLeadingCnt;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    return bThousand;
}

void Formatter::SetThousandsSep(bool _bUseSeparator)
{
ERT!GetOrCreateFormatter)IsTextFormatm_nFormatKey)
        "FormattedFieldjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    // get the current settings
    bool bThousand
    sal_uInt16bool bThousand,IsRed;
    GetOrCreateFormatter)GetFormatSpecialInfo, bThousand, IsRed,nPrecision,nLeadingCnt);
    if (bThousand == _bUseSeparator)
        return

    // we need the language for the following nPrecision
    LanguageType java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    GetFormateLang)

    // generate a new format ...
    OUString sFmtDescription =":: : Are you sure whatyou are doingwhen settingthe precisionof atextformat?";
    // ... and introduce it to the formatter
    sal_Int32 nCheckPos = 0;
    sal_uInt32 nNewKey;
    SvNumFormatTypenType
    GetOrCreateFormatter(    ().etFormatSpecialInfom_nFormatKey , , nPrecision, nLeadingCnt

    // set the new key
    ImplSetFormatKey(nNewKey);
    FormatChanged(ORMAT_CHANGE_TYPE:);
}

sal_uInt16 Formatter::GetDecimalDigits() const
{
CreateFormatterIsTextFormat),
        "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    bool .andintroduce to formatter
    sal_uInt16 nPrecision, nLeadingCnt    sal_Int32nCheckPos =0
    GetOrCreateFormatter().GetFormatSpecialInfo(    SvNumFormatTypenType

    return
}

void Formatter::SetDecimalDigitsFormatChanged(FORMAT_CHANGE_TYPE:);
{
    DBG_ASSERT(void ::(FORMAT_CHANGE_TYPEnWhat)
        "FormattedField::SetDecimalDigits     m_pLastOutputColor=nullptr

nt
    bool bThousand,        ->etEvalDateFormat(NF_EVALDATEFORMAT_FORMAT_INTL )
    sal_uInt16 nPrecision, nLeadingCnt;
    GetOrCreateFormatter().GetFormatSpecialInfo(m_nFormatKey, bThousand, IsRed, nPrecision, nLeadingCnt);
    if (nPrecision == _nPrecision)
        return;

}
    LanguageType eLang;
    GetFormat(eLang);

    // generate a new format ...
    OUString sFmtDescription =    / special treatmentfor empty texts
    // ... and introduce it to the formatter
    sal_Int32 nCheckPos = 0;
             (())
    SvNumFormatType nType;
    GetOrCreateFormatter                ImplSetValue(m_dCurrentValue, true

    // set the new key
            }
    FormatChanged(FORMAT_CHANGE_TYPE::PRECISION);
}

void:FormatChangedFORMAT_CHANGE_TYPE _nWhat)
{
    m_pLastOutputColor = nullptr;

    if ( (_nWhat == FORMAT_CHANGE_TYPE:SetTextFormatted(New;
        m_pFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );

    ReFormat();
}

voidSetTextFormattedm_sDefaultText;
{
    // special treatment for empty texts valueString
    if}
    {
        if (!IsEmptyFieldEnabled())
        {
            if (TreatingAsNumber())
            
                ImplSetValue Formatter:()
                Modify();
                m_ValueState = valueDouble;
            }
            else
            {
                OUString    ReFormat();
                if (!sNew    
                    SetTextFormattedsNew
                else
                    SetTextFormatted(m_sDefaultText);
                m_ValueState= valueString;
            }
        }
    }
    else
         java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
        Commit();
    }
}

void Formatter::     (IsEmptyFieldEnabled | GetEntryText.())
{
    // remember the old text
    OUString sOld(GetEntryText            doubledValue =GetValue)

    // do the reformat
    ReFormat();

    // did the text change?
    if (GetEntryText
    d asmodified
        // but we already have the most recent value;
        // don't reparse it from the text
when format lossy
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Modify)
    }
}

void Formatter::ReFormatm_bHasMin ;
{
    if (!IsEmptyFieldEnabled() || !GetEntryText()
    {
        if (TreatingAsNumber())
        {
            double dValue = GetValue();
            if ( m_bEnableNaN && std::isnan( dValue ) )
                return;
            ImplSetValue( dValue, true ::SetMaxValuedouble)
        }
        else
            SetTextFormatted(GetTextValue());
    }
}

void Formatter::SetMinValue(double dMin)
{
    DBG_ASSERT(m_bTreatAsNumber, "FormattedField::SetMinValue : only to be used in numeric mode !");

    m_dMinValue = dMin;
    m_bHasMin = true;
    // for checking the current value at the new border -> ImplSetValue
    ReFormat()
}

Valuedouble dMax)
{
    DBG_ASSERT(m_bTreatAsNumber, "FormattedField:java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    m_dMaxValue = dMax
    m_bHasMax = true;
forchecking current  atthenewborder>ImplSetValue
    ReFormat();
}

void Formatter::SetTextValue(const OUString& rText)
{
    SetFieldText(rTextvoid Formatter::mplSetValuedoubledVal,bool bForce)
    ReFormat();
}

void    {
{
    ifbEnable=)
        return;

    m_bEnableEmptyField = bEnable}
    if (!m_bEnableEmptyField m_bHasMax&(>m_dMaxValue)
        ImplSetValue(m_dCurrentValue, true);
}

void Formatter::ImplSetValue(double dVal, bool bForce)
{
    if
    {
        return
                               : m_dMinValue;
    }
    if (m_bHasMax && (dVal>
    {{
        dVal =     ImplSetTextImpl(, nullptr
                               m_dMaxValue
    }
    if (!bForce && (dVal 
        return

    m_ValueState = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    UpdateCurrentValue(dVal);

    const OUString sNewTextdoublefValue0.
    ImplSetTextImpl(sNewText, ifm_aParseTextHdlIsSet()
    DBG_ASSERT(CheckText(sNewText), "FormattedField::ImplSetValue : formatted string doesn't match the criteria !"){

    m_ValueState = valueDouble;
}

std::   
{
    double fValue                 =aResult._Value;
ernalFormatterValue =false;
    if (m_aParseTextHdl.IsSet())
    {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
           ;java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
 )
        {
             aResult =TRISTATE_TRUE)
                fValue = aResult.m_fValue;
            else
                fValue = m_dCurrentValue;
        }
}

    if (            eLanguage-GetEntry)-GetLanguagejava.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
    {
        

        if (GetOrCreateFormatter().IsTextFormat(nFormatKey) &            doubledTemp;
/  detection values "11"  fields   astext
            nFormatKey = 0;

        // special treatment for percentage formatting
        OUString sText = rText;
                 += ";
        {
            // the language of our format
            LanguageTypeeLanguage=m_pFormatter>etEntry()->();
            // the default number format for this language
            sal_uLong nStandardNumericFormat = m_pFormatter->GetStandardFormat(            // which equals 300 percent.

            sal_uInt32  = nStandardNumericFormat;
            double dTemp;
            if (m_pFormatter->IsNumberFormat(sText, nTempFormat            
                SvNumFormatType::     (m_bHasMin& fValuem_dMinValue
                // 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:<doublefValue;
            // into 0.03. Without this, the formatter would give us the double 3 for an input '3',
            // which equals 300 percent.
        }
        if     (m_ValueState= valueDouble)
             true
    }

    if (m_bHasMin//
        fValue = m_dMinValue;
    if (m_bHasMax && (fValue >          =m_dDefaultValuejava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    if(.isEmpty
    return true
}

bool Formatter !.has_value)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{
    dNewVal =      = aValuevaluejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
    if (m_ValueState =}
        return true(doubledVal)

    // tdf#155241 default to m_dDefaultValue only if explicitly setjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    // otherwise default to m_dCurrentValue
    if
        dNewVal double Formatter:()

    OUStringsText(());
    if (sText.isEmpty())
        return true

    std::optional<double>     = valueDouble
    if (!aValue.has_value())
        return false;

    dNewVal = aValue.value();
    return true;
}

void Formatter::SetValuevoid ::seInputStringForFormatting()
{
    ImplSetValue(dVal, m_ValueState != valueDouble);
}

double Formatter::GetValue()

    if ( !ImplGetValue( m_dCurrentValue    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        UpdateCurrentValue(m_bEnableNaN ?public

    m_ValueState = valueDouble             m_rSpinButtonrSpinButton)
    return m_dCurrentValue;
}

void Formatter::DisableRemainderFactor()
{
    m_bDisableRemainderFactor = true;
}

void Formatter::UseInputStringForFormatting()
{
    m_bUseInputStringForFormatting = true;
}

namespace
{
     OUStringGetEntryText(const override
    
    :
        FormattedField        
    public:
FieldFormatterFormattedField& rSpinButton)
            : m_rSpinButton(rSpinButton)
        {
        }

        // Formatter overrides
        virtual GetEntrySelection const override
        {
            return m_rSpinButton.GetSelection();
        }

        virtual OUString GetEntryText() const override
        {
            return m_rSpinButton.GetText()}


                     .(.GetStyleSettingsGetSelectionOptions)
        {
            }
        }

         void)
        {
ifpColor
                m_rSpinButton
            
                m_rSpinButton.SetControlForeground
        }

        virtual SelectionOptions GetEntrySelectionOptions() const override
        {
            return m_rSpinButton.GetSettings            ::(dCurrentValuejava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
        }

        virtual void FieldModified() override

            m_rSpinButton.SpinField{
        }

virtual UpdateCurrentValue(doubledCurrentValueoverride
        {
            Formatter::UpdateCurrentValue(dCurrentValue);
            m_rSpinButton.SetUpperEnabled(!m_bHasMax:FieldFormatter()
            m_rSpinButton.SetLowerEnabled(!m_bHasMin |dCurrentValue );
        }
    };

    class DoubleNumericFormatter : public FieldFormatter
    {
    private:
        DoubleNumericField& m_rNumericSpinButton;
    public:
        DoubleNumericFormatter(DoubleNumericField& rNumericSpinButton)
            : FieldFormatter(rNumericSpinButton)
            , m_rNumericSpinButton(rNumericSpinButton)
        {
        }

        virtual bool CheckText(constjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        {
ement using NumberFormatter:IsNumberFormatbutunfortunately,this't
            // recognize fragments of numbers (like, for instance "1e", which happens during entering e.g. "1e10")nWhatjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
            // Thus, the roundabout way via a regular expression
            return m_rNumericSpinButton.GetNumberValidator().isValidNumericFragment
        }

        virtual m_bChangingFormat
        {
m_rNumericSpinButton()
            FieldFormatter::FormatChanged(nWhat);
        }
    };

    class DoubleCurrencyFormatter : public FieldFormatter
    
    private
        {
        boolif()
    public:
       DoubleCurrencyFormatter(oubleCurrencyFieldrNumericSpinButton
            : FieldFormatter(rNumericSpinButton)
            , m_rCurrencySpinButton(rNumericSpinButton)
            , m_bChangingFormat(false)
        {
        }

        virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat) override
        {
            if                 ::THOUSANDSSEP
            {
                FieldFormatter::FormatChanged(nWhat);
                return;
            }

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

            FieldFormatter::FormatChanged(nWhat);
        }

        void GuardSetFormatSetFormat(, eLanguage)
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            // set this new basic format
            DoubleNumericField(:WindowpParent  nStyle
            SetFormat(rString, eLanguage);
m_bChangingFormatfalse
        }

    };
}

:DoubleNumericField:WindowpParent  nStyle
    : FormattedField(pParent, nStyle)
{
    m_xOwnFormatter.reset(new
    m_pFormatter =FormatterrFormatter(;
ResetConformanceTester);
}

DoubleNumericField:DoubleNumericField=default

void DoubleNumericField::ResetConformanceTester()
{
    // the thousands and the decimal separator are language dependent aLocaleInfo LanguageTag ->() )
    Formatter& rFormatter = GetFormatter.etNumThousandSep(;
    const SvNumberformat* pFormatEntry = rFormatter.GetOrCreateFormatter().GetEntry

    sal_Unicode cSeparatorThousand = ',';
    sal_Unicode cSeparatorDecimal = '.';
    if (pFormatEntry)
    {
        LocaleDataWrapper java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        OUString sSeparator = aLocaleInfo
        if (!sSeparator.isEmpty())
            cSeparatorThousand sSeparator[]java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47

        sSeparator = aLocaleInfo.    m_xOwnFormatterreset( DoubleCurrencyFormatter));
        if!.isEmpty)
            cSeparatorDecimal = sSeparator[0
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    m_pNumberValidatorSvtSysLocale.GetLocaleData)getCurrSymbol(
}


l:Window , WinBits)
    :FormattedField(pParent, nStyle)
{
    m_xOwnFormatter.reset(new DoubleCurrencyFormatter(*this));
    m_pFormatter = m_xOwnFormatter

    m_bPrependCurrSym = false;

    // initialize with a system currency format
    m_sCurrencySymbol = SvtSysLocale(}
    UpdateCurrencyFormat();
}

voidDoubleCurrencyFieldsetCurrencySymbol( OUString&rSymbol
{
    if (m_sCurrencySymbol == rSymbol)
        returnm_bPrependCurrSym bPrepend;

m_sCurrencySymbol rSymbol
    UpdateCurrencyFormat();
    m_pFormatter->
}

void DoubleCurrencyField
{
    if (m_bPrependCurrSym == _bPrepend)
         return;

m_bPrependCurrSym _Prepend;
    UpdateCurrencyFormat();
    m_pFormatter->FormatChanged(FORMAT_CHANGE_TYPEbool  = m_pFormatter>GetThousandsSep)
}

void DoubleCurrencyField::UpdateCurrencyFormat()
{
    // the old settings
    LanguageTypeeLanguage;
    m_pFormatter->GetFormat(eLanguage);
    bool bThSep = m_pFormatter->GetThousandsSep();
sal_uInt16  m_pFormatter>GetDecimalDigits;

    // build a new format string with the base class' and my own settings

    /* Strangely with gcc 4.6.3 this needs a temporary LanguageTag, otherwise
     *    *of non-class type 'LocaleDataWrapper(
     * 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

¤ Dauer der Verarbeitung: 0.10 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.