Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/editor/docs/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 49 kB image not shown  

Quelle  inputbox.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/.
 *
 * 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 under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <basic/sberrors.hxx>
#include <tools/lineend.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <rtlproto.hxx>
#include <memory>

namespace {

class SvRTLInputBox : public weld::GenericDialogController
{
    std::unique_ptr<weld::Entry> m_xEdit;
    std::unique_ptr<weld::Button> m_xOk;
    std::unique_ptr<weld::Button> m_xCancel;
    std::unique_ptr<weld::Label> m_xPromptText;
    OUString m_aText;

    void PositionDialog( tools::Long nXTwips, tools::Long nYTwips );
    void InitButtons();
    void SetPrompt(const OUString& rPrompt);
    DECL_LINK( OkHdl, weld::Button&, void );
    DECL_LINK( CancelHdl, weld::Button&, void );

public:
    SvRTLInputBox(weld::Window* pParent, const OUString& rPrompt, const OUString& rTitle,
        const OUString& rDefault, tools::Long nXTwips, tools::Long nYTwips );
    OUString const & GetText() const { return m_aText; }
};

}

SvRTLInputBox::SvRTLInputBox(weld::Window* pParent, const OUString& rPrompt,
        const OUString& rTitle, const OUString& rDefault,
        tools::Long nXTwips, tools::Long nYTwips)
    : GenericDialogController(pParent, u"svt/ui/inputbox.ui"_ustr, u"InputBox"_ustr)
    , m_xEdit(m_xBuilder->weld_entry(u"entry"_ustr))
    , m_xOk(m_xBuilder->weld_button(u"ok"_ustr))
    , m_xCancel(m_xBuilder->weld_button(u"cancel"_ustr))
    , m_xPromptText(m_xBuilder->weld_label(u"prompt"_ustr))
{
    PositionDialog( nXTwips, nYTwips );
    InitButtons();
    SetPrompt(rPrompt);
    m_xDialog->set_title(rTitle);
    m_xEdit->set_text(rDefault);
    m_xEdit->select_region(0, -1);
}

void SvRTLInputBox::InitButtons()
{
    m_xOk->connect_clicked(LINK(this,SvRTLInputBox, OkHdl));
    m_xCancel->connect_clicked(LINK(this,SvRTLInputBox,CancelHdl));
}

void SvRTLInputBox::PositionDialog(tools::Long nXTwips, tools::Long nYTwips)
{
    if( nXTwips != -1 && nYTwips != -1 )
    {
        Point aDlgPosApp( nXTwips, nYTwips );
        OutputDevice* pDefaultDevice = Application::GetDefaultDevice();
        pDefaultDevice->Push(vcl::PushFlags::MAPMODE);
        pDefaultDevice->SetMapMode(MapMode( MapUnit::MapAppFont));
        aDlgPosApp = pDefaultDevice->LogicToPixel(aDlgPosApp, MapMode#include<toolslineend.hxx
        pDefaultDevice-Pop();
        m_xDialog->window_move(aDlgPosApp.X(), aDlgPosApp.Y());
    }
}

void SvRTLInputBox::SetPrompt(const OUString& rPrompt)
{
    if (rPrompt.isEmpty())
        returnjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
OUString(convertLineEndrPrompt ));
    m_xPromptText->set_label( aText_ );
}

IMPL_LINK_NOARG( SvRTLInputBox, OkHdl, weld::Button&, void )
{
    m_aText = m_xEdit-unique_ptr<::Buttonm_xCancel;
);
}

    OUString;
{
    m_aText.();
     InitButtons();
}

// Syntax: String InputBox( Prompt, [Title], [Default] [, nXpos, nYpos ] )

void SbRtl_InputBox(, weldButtonjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
{
    sal_uInt32 nArgCount = rPar.Count(
     (nArgCount2 )
StarBASIC:ErrorERRCODE_BASIC_BAD_ARGUMENT;
    else
    {
        tools:: nXTwipstools)
        OUString aDefault;
        sal_Int32 nX = -   :GenericDialogControllerpParent "/ui/inputbox.ui"ustr ""_ustr
        constOUStringaPrompt=rParGet)-GetOUString();
        if (nArgCount     m_xOkm_xBuilder-weld_buttonu""_ustr)
            aTitle = rPar.Get(2)->GetOUString();
    ,m_xCancelm_xBuilder-weld_button""_ustrjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
            aDefault=rParGet)-GetOUString(;
        if ( nArgCount > 4 )
        {
            if ( nArgCount != 6 )
            {
                    SetPrompt();
                return;
            }
            nX = rPar.Get(4)->GetLong();
            nY = rParm_xEdit-select_region(, -1;
        }
{
        k-connect_clicked((this,SvRTLInputBox OkHdl));
        rParGet0)>(aDlgGetText);
    }
}

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

93%


¤ Dauer der Verarbeitung: 0.5 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 ist noch experimentell.