/* -*- 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 .
*/
// Clean up message text with tabs
OUString aMessText(maMessText.replaceAll("\t", " "));
//If window too small, we make dialog box be wider
tools::Long nMaxWidth = 630 * GetDPIScaleFactor();
// MessagBox should be at least as wide as to see the title // Extra-Width for Close button, because Close button is set after this call
nTitleWidth = CalcTitleWidth();
// for an image, get its size, create a suitable control and position it
aImageSize = maImage.GetSizePixel(); if ( aImageSize.Width() )
{
aImageSize.AdjustWidth(4 );
aImageSize.AdjustHeight(4 );
aTextPos.AdjustX(aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE );
mpFixedImage = VclPtr<FixedImage>::Create( this );
mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
aImageSize );
mpFixedImage->SetImage( maImage );
mpFixedImage->Show();
nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
} else
aTextPos.AdjustX(IMPL_MSGBOX_OFFSET_EXTRA_X );
// Determine maximum line length without wordbreak
aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
nMaxLineWidth = aFormatRect.GetWidth();
nTextStyle |= DrawTextFlags::WordBreak;
// Determine the width for text formatting if ( nMaxLineWidth > 450 )
nWidth = 450; elseif ( nMaxLineWidth > 300 )
nWidth = nMaxLineWidth+5; else
nWidth = 300;
nWidth *= GetDPIScaleFactor();
if ( nButtonSize > nWidth )
nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET); if ( nWidth > nMaxWidth )
nWidth = nMaxWidth;
xServiceManager.set( xContext->getServiceManager(), css::uno::UNO_QUERY_THROW ); // set global process service factory used by unotools config helpers
::comphelper::setProcessServiceFactory( xServiceManager );
}
VCLXToolkit * pTk = static_cast<VCLXToolkit *>(pArgs);
bInitedByVCLToolkit = !IsVCLInit() && InitVCL(); if( bInitedByVCLToolkit )
{
UnoWrapper* pUnoWrapper = new UnoWrapper( pTk );
UnoWrapperBase::SetUnoWrapper( pUnoWrapper );
}
getInitCondition().set(); if( bInitedByVCLToolkit )
{
{
SolarMutexGuard aGuard;
Application::Execute();
} try
{
pTk->dispose();
} catch( css::uno::Exception & )
{
}
DeInitVCL();
} else
{ // having the thread join itself is pretty stupid. // but we can't get the osl_Thread to destroy here so just leak it.
}
}
}
class InfoBox : public MessBox
{ public:
InfoBox(vcl::Window* pParent, const OUString& rMessage)
: MessBox(pParent, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, 0, OUString(), rMessage)
{ // Default Text is the display title from the application if (GetText().isEmpty())
SetText(GetStandardInfoBoxText());
SetImage(GetStandardInfoBoxImage());
}
};
class ErrorBox : public MessBox
{ public:
ErrorBox(vcl::Window* pParent, MessBoxStyle nStyle, WinBits nWinBits, const OUString& rMessage)
: MessBox(pParent, nStyle, nWinBits, OUString(), rMessage)
{ // Default Text is the display title from the application if (GetText().isEmpty())
SetText(GetStandardErrorBoxText());
SetImage(GetStandardErrorBoxImage());
}
};
class QueryBox : public MessBox
{ public:
QueryBox(vcl::Window* pParent, MessBoxStyle nStyle, WinBits nWinBits, const OUString& rMessage)
: MessBox(pParent, nStyle, nWinBits, OUString(), rMessage)
{ // Default Text is the display title from the application if (GetText().isEmpty())
SetText(GetStandardQueryBoxText());
SetImage(GetStandardQueryBoxImage());
}
};
class WarningBox : public MessBox
{ public:
WarningBox(vcl::Window* pParent, MessBoxStyle nStyle, WinBits nWinBits, const OUString& rMessage)
: MessBox(pParent, nStyle, nWinBits, OUString(), rMessage)
{ // Default Text is the display title from the application if (GetText().isEmpty())
SetText(GetStandardWarningBoxText());
SetImage(GetStandardWarningBoxImage());
}
};
VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch (nPropType)
{ case BASEPROPERTY_COMPLETE:
{ bool b = false;
Value >>= b;
pField->SetRoadmapComplete( b);
} break;
case BASEPROPERTY_ACTIVATED:
{ bool b = false;
Value >>= b;
pField->SetRoadmapInteractive( b);
} break;
case BASEPROPERTY_CURRENTITEMID:
{
sal_Int32 nId = 0;
Value >>= nId;
pField->SelectRoadmapItemByID( static_cast<vcl::RoadmapTypes::ItemId>(nId) );
} break;
case BASEPROPERTY_TEXT:
{
OUString aStr;
Value >>= aStr;
pField->SetText( aStr );
pField->Invalidate();
} break;
default:
SVTXRoadmap_Base::setProperty( PropertyName, Value ); break;
}
} else
SVTXRoadmap_Base::setProperty( PropertyName, Value );
}
if ( eType != WindowType::NONE )
{
SolarMutexGuard aVclGuard; switch ( eType )
{ case WindowType::CANCELBUTTON:
pNewWindow = VclPtr<CancelButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::CHECKBOX:
pNewWindow = VclPtr<CheckBox>::Create( pParent, nWinBits );
*ppNewComp = new VCLXCheckBox; break; case WindowType::COMBOBOX:
pNewWindow = VclPtr<ComboBox>::Create( pParent, nWinBits|WB_AUTOHSCROLL ); static_cast<ComboBox*>(pNewWindow.get())->EnableAutoSize( false );
*ppNewComp = new VCLXComboBox; break; case WindowType::CURRENCYBOX:
pNewWindow = VclPtr<CurrencyBox>::Create( pParent, nWinBits ); break; case WindowType::CURRENCYFIELD:
pNewWindow = VclPtr<CurrencyField>::Create( pParent, nWinBits ); static_cast<CurrencyField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField; static_cast<VCLXFormattedSpinField*>((*ppNewComp).get())->SetFormatter( static_cast<FormatterBase*>(static_cast<CurrencyField*>(pNewWindow.get())) ); break; case WindowType::DATEBOX:
pNewWindow = VclPtr<DateBox>::Create( pParent, nWinBits ); break; case WindowType::DOCKINGAREA:
pNewWindow = VclPtr<DockingAreaWindow>::Create( pParent ); break; case WindowType::MULTILINEEDIT:
pNewWindow = VclPtr<MultiLineEdit>::Create(pParent, nWinBits|WB_IGNORETAB); static_cast<MultiLineEdit*>(pNewWindow.get())->DisableSelectionOnFocus();
*ppNewComp = new VCLXMultiLineEdit; break; case WindowType::EDIT:
pNewWindow = VclPtr<Edit>::Create( pParent, nWinBits );
*ppNewComp = new VCLXEdit; break; case WindowType::ERRORBOX:
pNewWindow = VclPtr<ErrorBox>::Create( pParent, nMessBoxStyle, nWinBits, OUString() );
*ppNewComp = new VCLXMessageBox; break; case WindowType::FIXEDBITMAP:
pNewWindow = VclPtr<FixedBitmap>::Create( pParent, nWinBits ); break; case WindowType::FIXEDIMAGE:
pNewWindow = VclPtr<ImageControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXImageControl; break; case WindowType::FIXEDLINE:
pNewWindow = VclPtr<FixedLine>::Create( pParent, nWinBits ); break; case WindowType::FIXEDTEXT:
pNewWindow = VclPtr<FixedText>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFixedText; break; case WindowType::FLOATINGWINDOW:
pNewWindow = VclPtr<FloatingWindow>::Create( pParent, nWinBits ); break; case WindowType::GROUPBOX:
pNewWindow = VclPtr<GroupBox>::Create( pParent, nWinBits ); if ( bFrameControl )
{
GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow.get() );
*ppNewComp = new VCLXFrame; // Frame control needs to receive // Mouse events
pGroupBox->SetMouseTransparent( false );
} break; case WindowType::HELPBUTTON:
pNewWindow = VclPtr<HelpButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::IMAGEBUTTON:
pNewWindow = VclPtr<ImageButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::INFOBOX:
pNewWindow = VclPtr<InfoBox>::Create( pParent, OUString() );
*ppNewComp = new VCLXMessageBox; break; case WindowType::LISTBOX:
pNewWindow = VclPtr<ListBox>::Create( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL ); static_cast<ListBox*>(pNewWindow.get())->EnableAutoSize( false );
*ppNewComp = new VCLXListBox; break; case WindowType::LONGCURRENCYBOX:
pNewWindow = VclPtr<LongCurrencyBox>::Create( pParent, nWinBits ); break; case WindowType::MENUBUTTON:
pNewWindow = VclPtr<MenuButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::MESSBOX:
pNewWindow = VclPtr<MessBox>::Create( pParent, nMessBoxStyle, nWinBits, OUString(), OUString() );
*ppNewComp = new VCLXMessageBox; break; case WindowType::METRICBOX:
pNewWindow = VclPtr<MetricBox>::Create( pParent, nWinBits ); break; case WindowType::METRICFIELD:
pNewWindow = VclPtr<MetricField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXMetricField; static_cast<VCLXFormattedSpinField*>((*ppNewComp).get())->SetFormatter( static_cast<FormatterBase*>(static_cast<MetricField*>(pNewWindow.get())) ); break; case WindowType::DIALOG: case WindowType::MODELESSDIALOG:
{ // Modal/Modeless only via Show/Execute if ( (pParent == nullptr ) && ( rDescriptor.ParentIndex == -1 ) )
pNewWindow = VclPtr<toolkit::ScrollableDialog>::Create( nullptr, nWinBits, Dialog::InitFlag::NoParent ); else
pNewWindow = VclPtr<toolkit::ScrollableDialog>::Create( pParent, nWinBits ); // #i70217# Don't always create a new component object. It's possible that VCL has called // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() ) // which creates a component object.
css::uno::Reference< css::awt::XWindowPeer > xWinPeer = pNewWindow->GetComponentInterface( false ); if ( xWinPeer.is() )
*ppNewComp = dynamic_cast< VCLXDialog* >( xWinPeer.get() ); else
*ppNewComp = new VCLXDialog;
} break; case WindowType::MOREBUTTON:
pNewWindow = VclPtr<MoreButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::MULTILISTBOX:
pNewWindow = VclPtr<MultiListBox>::Create( pParent, nWinBits );
*ppNewComp = new VCLXListBox; break; case WindowType::NUMERICBOX:
pNewWindow = VclPtr<NumericBox>::Create( pParent, nWinBits ); break; case WindowType::OKBUTTON:
pNewWindow = VclPtr<OKButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::PATTERNBOX:
pNewWindow = VclPtr<PatternBox>::Create( pParent, nWinBits ); break; case WindowType::PATTERNFIELD:
pNewWindow = VclPtr<PatternField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXPatternField; static_cast<VCLXFormattedSpinField*>((*ppNewComp).get())->SetFormatter( static_cast<FormatterBase*>(static_cast<PatternField*>(pNewWindow.get())) ); break; case WindowType::PUSHBUTTON:
pNewWindow = VclPtr<PushButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton; break; case WindowType::QUERYBOX:
pNewWindow = VclPtr<QueryBox>::Create( pParent, nMessBoxStyle, nWinBits, OUString() );
*ppNewComp = new VCLXMessageBox; break; case WindowType::RADIOBUTTON:
pNewWindow = VclPtr<RadioButton>::Create(pParent, false, nWinBits);
*ppNewComp = new VCLXRadioButton;
// by default, disable RadioCheck // Since the VCLXRadioButton really cares for its RadioCheck settings, this is important: // if we enable it, the VCLXRadioButton will use RadioButton::Check instead of RadioButton::SetState // This leads to a strange behaviour if the control is newly created: when settings the initial // state to "checked", the RadioButton::Check (called because RadioCheck=sal_True) will uncheck // _all_other_ radio buttons in the same group. However, at this moment the grouping of the controls // is not really valid: the controls are grouped after they have been created, but we're still in // the creation process, so the RadioButton::Check relies on invalid grouping information. // 07.08.2001 - #87254# - frank.schoenheit@sun.com static_cast<RadioButton*>(pNewWindow.get())->EnableRadioCheck( false ); break; case WindowType::SCROLLBAR:
pNewWindow = VclPtr<ScrollBar>::Create( pParent, nWinBits );
*ppNewComp = new VCLXScrollBar; break; case WindowType::SCROLLBARBOX:
pNewWindow = VclPtr<ScrollBarBox>::Create( pParent, nWinBits ); break; case WindowType::SPINBUTTON:
pNewWindow = VclPtr<SpinButton>::Create( pParent, nWinBits );
*ppNewComp = new ::toolkit::VCLXSpinButton; break; case WindowType::SPINFIELD:
pNewWindow = VclPtr<SpinField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXNumericField; break; case WindowType::SPLITTER:
pNewWindow = VclPtr<Splitter>::Create( pParent, nWinBits ); break; case WindowType::SPLITWINDOW:
pNewWindow = VclPtr<SplitWindow>::Create( pParent, nWinBits ); break; case WindowType::STATUSBAR:
pNewWindow = VclPtr<StatusBar>::Create( pParent, nWinBits ); break; case WindowType::TOOLKIT_SYSTEMCHILDWINDOW:
pNewWindow = VclPtr<SystemChildWindow>::Create( pParent, nWinBits );
*ppNewComp = new VCLXSystemDependentWindow(); break; case WindowType::TABCONTROL:
pNewWindow = VclPtr<TabControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXMultiPage; break; case WindowType::TABDIALOG:
pNewWindow = VclPtr<TabDialog>::Create( pParent, nWinBits ); break; case WindowType::TABPAGE:
{
pNewWindow = VclPtr<TabPage>::Create( pParent, nWinBits );
*ppNewComp = new VCLXTabPage;
} break; case WindowType::TIMEBOX:
pNewWindow = VclPtr<TimeBox>::Create( pParent, nWinBits ); break; case WindowType::TIMEFIELD:
pNewWindow = VclPtr<TimeField>::Create( pParent, nWinBits ); static_cast<TimeField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXTimeField; static_cast<VCLXFormattedSpinField*>((*ppNewComp).get())->SetFormatter( static_cast<FormatterBase*>(static_cast<TimeField*>(pNewWindow.get())) ); break; case WindowType::TOOLBOX:
pNewWindow = VclPtr<ToolBox>::Create( pParent, nWinBits );
*ppNewComp = new VCLXWindow; break; case WindowType::TRISTATEBOX:
pNewWindow = VclPtr<CheckBox>::Create( pParent, nWinBits ); static_cast<CheckBox*>(pNewWindow.get())->EnableTriState(true); break; case WindowType::WARNINGBOX:
pNewWindow = VclPtr<WarningBox>::Create( pParent, nMessBoxStyle, nWinBits, OUString() );
*ppNewComp = new VCLXMessageBox; break; case WindowType::WORKWINDOW: case WindowType::WINDOW: case WindowType::TOOLKIT_FRAMEWINDOW: case WindowType::DOCKINGWINDOW: if ( rDescriptor.Type == css::awt::WindowClass_TOP )
{ if (eType == WindowType::DOCKINGWINDOW )
pNewWindow = VclPtr<DockingWindow>::Create( pParent, nWinBits ); else
{ if ((pParent == nullptr) && rDescriptor.Parent.is())
{ // try to get a system dependent window handle
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.24 Sekunden
(vorverarbeitet)
¤
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.