Files
libreoffice/vcl/source/window/dialog.cxx

1180 lines
34 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes (at least) relevant parts of: linecap: Reintegrating finished LineCap feature Patch contributed by Regina Henschel http://svn.apache.org/viewvc?view=revision&revision=1232507 Patches contributed by Sven Jacobi impress212: #i81610# fixed animation export http://svn.apache.org/viewvc?view=revision&revision=1167620 impress212: drawinglayer gbuild environment changes http://svn.apache.org/viewvc?view=revision&revision=1167627 http://svn.apache.org/viewvc?view=revision&revision=1167628 impress212: DffPropSet -> minor code improvements, removing table http://svn.apache.org/viewvc?view=revision&revision=1167634 impress212: #158494# fixed excel import (text rotation) http://svn.apache.org/viewvc?view=revision&revision=1167638 Patches contributed by Armin Le Grand Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement http://svn.apache.org/viewvc?view=revision&revision=1220836 #118728# changed indentifying definitions for Svg file detection http://svn.apache.org/viewvc?view=revision&revision=1229961 #118838# LineGeometry creation for complicated cases optimized to create single Polygons http://svn.apache.org/viewvc?view=revision&revision=1236232 #119176# corrected file type detection for SVG for svg files without xml header http://svn.apache.org/viewvc?view=revision&revision=1309445 #118728# Extended Svg file detection http://svn.apache.org/viewvc?view=revision&revision=1230531 #118529# solve break converters and convert commands for OLEs and images http://svn.apache.org/viewvc?view=revision&revision=1186168 svg: added WaE changes from branch svgreplacement to trunc http://svn.apache.org/viewvc?view=revision&revision=1222974 svg: corrected missing member initialization http://svn.apache.org/viewvc?view=revision&revision=1226134 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles to bitmapEx ... http://svn.apache.org/viewvc?view=revision&revision=1293316 fix for #118525#: removed no longer used variable maOriginalMapMode, one more exception eliminated http://svn.apache.org/viewvc?view=revision&revision=1227097 #16758# Added buffering to the VDev usages of the VclProcessor2D derivates... http://svn.apache.org/viewvc?view=revision&revision=1229521 #116758# Secured VDev buffer device to Vcl deinit http://svn.apache.org/viewvc?view=revision&revision=1230574 #116758# added remembering allocated VDevs for VDevBuffer to be able to also delete these when vcl goes down; it should never happen, but You never know http://svn.apache.org/viewvc?view=revision&revision=1230927 #118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive representation instead of TransparencePrimitive2D http://svn.apache.org/viewvc?view=revision&revision=1231198 #118822# secured 3D geometry creation (slices) by subdividing the 2D source polyPolygon early http://svn.apache.org/viewvc?view=revision&revision=1234749 #118829# enhanced Svg gradient quality, obstacles avoided http://svn.apache.org/viewvc?view=revision&revision=1235361 #118834# Unified usage of TextBreakupHelper as single tooling class for i18n text primitive breakup http://svn.apache.org/viewvc?view=revision&revision=1236110 #118853# added square pixel size limit to conversion of TransparencePrimitive2D to Metafile action http://svn.apache.org/viewvc?view=revision&revision=1237656 #118824# coreccted mirroring and boundrect when the graphicmanager is used for bitmap output http://svn.apache.org/viewvc?view=revision&revision=1240097 #115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for various optimization scenarios http://svn.apache.org/viewvc?view=revision&revision=1241434 #118783# Corrected errors in ID strings, corrected Svg line/fill export, corrected polygon close state http://svn.apache.org/viewvc?view=revision&revision=1232006 #118796# corrected null-pointer usage in SVG text exporter http://svn.apache.org/viewvc?view=revision&revision=1240262 #118729# Use GraphicStreamUrl and GraphicUrl to allow multi image import with linked graphics, too http://svn.apache.org/viewvc?view=revision&revision=1229962 #118898# corrected error in GDIMetaFile::GetBoundRect in handling MetaFloatTransparentAction http://svn.apache.org/viewvc?view=revision&revision=1293349 #118855# Corrected handling of possibly created empty clipRegions after PolyPolygon clipping http://svn.apache.org/viewvc?view=revision&revision=1237725 #115962# Better (but not yet optimal, see comments in task) handling of MetaFloatTransparentAction in PDF export http://svn.apache.org/viewvc?view=revision&revision=1241078 IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ... http://svn.apache.org/viewvc?view=revision&revision=1200879 118779# Added svg content streaming in/out to ImpGraphic stream operators http://svn.apache.org/viewvc?view=revision&revision=1231908 linecap: correctons for WaE and mac drawing http://svn.apache.org/viewvc?view=revision&revision=1232793 svg: uses current system Dpi for Svg replacement image creation http://svn.apache.org/viewvc?view=revision&revision=1233948 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1394326 Remove duplicate header includes. cws mba34issues01: #i117720#: convert assertion into warning http://svn.apache.org/viewvc?view=revision&revision=1172352 118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand. http://svn.apache.org/viewvc?view=revision&revision=1182166 cws mba34issues01: #i117714#: remove assertion http://svn.apache.org/viewvc?view=revision&revision=1172357 Patch contributed by Jurgen Schmidt add some additional checks to ensure proper reading operations http://svn.apache.org/viewvc?view=revision&revision=1209022 mostly prefer our stream / bounds checking work. Patches contributed by Herbert Duerr #i118816# add clarifying comment regarding Font::*Color*() methods http://svn.apache.org/viewvc?view=revision&revision=1233833 extend macro->string handling for empty strings http://svn.apache.org/viewvc?view=revision&revision=1175801 avoid magic constants for SALCOLOR_NONE http://svn.apache.org/viewvc?view=revision&revision=1177543 initialize slant properly in ImplFontMetricData constructor (author=iorsh) http://svn.apache.org/viewvc?view=revision&revision=1177551 #i118675# make check for extension updates more stable http://svn.apache.org/viewvc?view=revision&revision=1214797 #a118617# remove VBasicEventListener.dll binary There are no known users depending on its CLSID http://svn.apache.org/viewvc?view=revision&revision=1203697 Patches contributed by Ariel Constenla-Haile Fix build breaker on Linux/gcc http://svn.apache.org/viewvc?view=revision&revision=1221104 Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG http://svn.apache.org/viewvc?view=revision&revision=1215559 Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider instances of <SwFlyDrawObj> http://svn.apache.org/viewvc?view=revision&revision=1172120 sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 gnumake4 work variously from Hans-Joachim Lankenau http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1396782 http://svn.apache.org/viewvc?view=revision&revision=1394707 plus some amount of re-splitting of legacy headers. Patch contributed by Pavel Janik WaE: Remove unused variables. http://svn.apache.org/viewvc?view=revision&revision=1230697 Patches contributed by Takashi Ono mingwport35: i#117795: MinGW port fix for vcl2gnumake http://svn.apache.org/viewvc?view=revision&revision=1172091 mingwport35: i#117795: MinGW port fix for vcl2gnumake http://svn.apache.org/viewvc?view=revision&revision=1172091 Patch contributed by Christian Lippka impress212: #i98044# re enable Text menu for outline and title shapes http://svn.apache.org/viewvc?view=revision&revision=1167639 Patch contributed by Andre Fischer 118674: Made category B code optional and disabled by default. http://svn.apache.org/viewvc?view=revision&revision=1215131 118881: Ignore empty paragraphs after bullets. http://svn.apache.org/viewvc?view=revision&revision=1296205 Patches contributed by Philipp Lohmann ooo340fixes: #i117780# use rtl allocator http://svn.apache.org/viewvc?view=revision&revision=1172087 ooo34gsl02: #i117807# fix an off by one error (index actually inside the pfb section header) http://svn.apache.org/viewvc?view=revision&revision=1167576 various cleanups, related compilation fixes, warning cleanups, re-working of obsolete stl template pieces to use boost instead, changed string classes, re-adapt KDE about data, about dialog, fixing warnings, and other fixes & improvements. Disable svg import / render for about/ branding code-paths for now. Restore full icon theme set. Remove OS/2 conditionals and sources. Remove conflicting gtk/full-screen monitors support. Retain existing svg rasterizer files - temporarily disabled. Standardize stringificaiton and fixup dllpostfix issues. Rename SvgGradientHelper::== to equalTo to avoid overloading issues. Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
/*
* 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 .
*/
2000-09-18 16:07:07 +00:00
#include <config_features.h>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/thePathSettings.hpp>
#include <comphelper/processfactory.hxx>
#include <osl/file.hxx>
2000-09-18 16:07:07 +00:00
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <svdata.hxx>
#include <window.h>
#include <brdwin.hxx>
2011-09-14 21:59:35 +01:00
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
2011-09-14 21:59:35 +01:00
#include <vcl/builder.hxx>
2011-11-28 22:16:26 +00:00
#include <vcl/layout.hxx>
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/button.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/dialog.hxx>
#include <vcl/decoview.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/unowrap.hxx>
#include <vcl/settings.hxx>
#include <iostream>
2000-09-18 16:07:07 +00:00
#if !HAVE_FEATURE_DESKTOP
#include <touch/touch.h>
#endif
static OString ImplGetDialogText( Dialog* pDialog )
2000-09-18 16:07:07 +00:00
{
OStringBuffer aErrorStr(OUStringToOString(
2011-09-14 21:59:35 +01:00
pDialog->GetText(), RTL_TEXTENCODING_UTF8));
2000-09-18 16:07:07 +00:00
if ( (pDialog->GetType() == WINDOW_MESSBOX) ||
(pDialog->GetType() == WINDOW_INFOBOX) ||
(pDialog->GetType() == WINDOW_WARNINGBOX) ||
(pDialog->GetType() == WINDOW_ERRORBOX) ||
(pDialog->GetType() == WINDOW_QUERYBOX) )
{
2011-09-14 21:59:35 +01:00
aErrorStr.append(", ");
aErrorStr.append(OUStringToOString(
2011-09-14 21:59:35 +01:00
((MessBox*)pDialog)->GetMessText(), RTL_TEXTENCODING_UTF8));
2000-09-18 16:07:07 +00:00
}
2011-09-14 21:59:35 +01:00
return aErrorStr.makeStringAndClear();
2000-09-18 16:07:07 +00:00
}
static bool ImplIsMnemonicCtrl( Window* pWindow )
2000-09-18 16:07:07 +00:00
{
if( ! pWindow->GetSettings().GetStyleSettings().GetAutoMnemonic() )
return false;
2000-09-18 16:07:07 +00:00
if ( (pWindow->GetType() == WINDOW_RADIOBUTTON) ||
(pWindow->GetType() == WINDOW_CHECKBOX) ||
(pWindow->GetType() == WINDOW_TRISTATEBOX) ||
(pWindow->GetType() == WINDOW_PUSHBUTTON) )
return true;
2000-09-18 16:07:07 +00:00
if ( pWindow->GetType() == WINDOW_FIXEDTEXT )
{
FixedText *pText = static_cast<FixedText*>(pWindow);
if (pText->get_mnemonic_widget())
return true;
//This is the legacy pre-layout logic which we retain
//until we can be sure we can remove it
2000-09-18 16:07:07 +00:00
if ( pWindow->GetStyle() & (WB_INFO | WB_NOLABEL) )
return false;
2000-09-18 16:07:07 +00:00
Window* pNextWindow = pWindow->GetWindow( WINDOW_NEXT );
if ( !pNextWindow )
return false;
2000-09-18 16:07:07 +00:00
pNextWindow = pNextWindow->GetWindow( WINDOW_CLIENT );
if ( !(pNextWindow->GetStyle() & WB_TABSTOP) ||
(pNextWindow->GetType() == WINDOW_FIXEDTEXT) ||
(pNextWindow->GetType() == WINDOW_GROUPBOX) ||
(pNextWindow->GetType() == WINDOW_RADIOBUTTON) ||
(pNextWindow->GetType() == WINDOW_CHECKBOX) ||
(pNextWindow->GetType() == WINDOW_TRISTATEBOX) ||
(pNextWindow->GetType() == WINDOW_PUSHBUTTON) )
return false;
2000-09-18 16:07:07 +00:00
return true;
2000-09-18 16:07:07 +00:00
}
return false;
2000-09-18 16:07:07 +00:00
}
// Called by native error dialog popup implementations
void ImplHideSplash()
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->mpIntroWindow )
pSVData->mpIntroWindow->Hide();
}
//Get next window after pChild of a pTopLevel window as
//if any intermediate layout widgets didn't exist
Window * nextLogicalChildOfParent(Window *pTopLevel, Window *pChild)
{
Window *pLastChild = pChild;
if (isContainerWindow(*pChild))
pChild = pChild->GetWindow(WINDOW_FIRSTCHILD);
else
pChild = pChild->GetWindow(WINDOW_NEXT);
while (!pChild)
{
Window *pParent = pLastChild->GetParent();
if (!pParent)
return NULL;
if (pParent == pTopLevel)
return NULL;
pLastChild = pParent;
pChild = pParent->GetWindow(WINDOW_NEXT);
}
if (pChild && isContainerWindow(*pChild))
2012-05-18 15:54:19 +01:00
pChild = nextLogicalChildOfParent(pTopLevel, pChild);
return pChild;
}
Window * prevLogicalChildOfParent(Window *pTopLevel, Window *pChild)
{
Window *pLastChild = pChild;
if (isContainerWindow(*pChild))
2012-05-18 15:54:19 +01:00
pChild = pChild->GetWindow(WINDOW_LASTCHILD);
else
pChild = pChild->GetWindow(WINDOW_PREV);
while (!pChild)
{
Window *pParent = pLastChild->GetParent();
if (!pParent)
return NULL;
if (pParent == pTopLevel)
return NULL;
pLastChild = pParent;
pChild = pParent->GetWindow(WINDOW_PREV);
}
if (pChild && isContainerWindow(*pChild))
2012-05-18 15:54:19 +01:00
pChild = prevLogicalChildOfParent(pTopLevel, pChild);
return pChild;
}
//Get first window of a pTopLevel window as
//if any intermediate layout widgets didn't exist
Window * firstLogicalChildOfParent(Window *pTopLevel)
{
Window *pChild = pTopLevel->GetWindow(WINDOW_FIRSTCHILD);
if (pChild && isContainerWindow(*pChild))
pChild = nextLogicalChildOfParent(pTopLevel, pChild);
return pChild;
}
2000-09-18 16:07:07 +00:00
void ImplWindowAutoMnemonic( Window* pWindow )
{
2002-05-16 10:22:20 +00:00
MnemonicGenerator aMnemonicGenerator;
2000-09-18 16:07:07 +00:00
Window* pGetChild;
Window* pChild;
// register the assigned mnemonics
2000-09-18 16:07:07 +00:00
pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
while ( pGetChild )
{
pChild = pGetChild->ImplGetWindow();
aMnemonicGenerator.RegisterMnemonic( pChild->GetText() );
pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
2000-09-18 16:07:07 +00:00
}
// take the Controls of the dialog into account for TabPages
2000-09-18 16:07:07 +00:00
if ( pWindow->GetType() == WINDOW_TABPAGE )
{
Window* pParent = pWindow->GetParent();
if ( pParent->GetType() == WINDOW_TABCONTROL )
pParent = pParent->GetParent();
if ( (pParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL )
{
pGetChild = pParent->GetWindow( WINDOW_FIRSTCHILD );
2000-09-18 16:07:07 +00:00
while ( pGetChild )
{
pChild = pGetChild->ImplGetWindow();
aMnemonicGenerator.RegisterMnemonic( pChild->GetText() );
pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
2000-09-18 16:07:07 +00:00
}
}
}
// assign mnemonics to Controls which have none
2000-09-18 16:07:07 +00:00
pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
while ( pGetChild )
{
pChild = pGetChild->ImplGetWindow();
if ( ImplIsMnemonicCtrl( pChild ) )
{
OUString aText = pChild->GetText();
OUString aNewText = aMnemonicGenerator.CreateMnemonic( aText );
if ( aText != aNewText )
pChild->SetText( aNewText );
2000-09-18 16:07:07 +00:00
}
pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
2000-09-18 16:07:07 +00:00
}
}
static VclButtonBox* getActionArea(Dialog *pDialog)
2011-12-01 11:57:05 +00:00
{
VclButtonBox *pButtonBox = NULL;
2011-12-01 11:57:05 +00:00
if (pDialog->isLayoutEnabled())
{
Window *pBox = pDialog->GetWindow(WINDOW_FIRSTCHILD);
Window *pChild = pBox->GetWindow(WINDOW_LASTCHILD);
while (pChild)
{
pButtonBox = dynamic_cast<VclButtonBox*>(pChild);
if (pButtonBox)
break;
pChild = pChild->GetWindow(WINDOW_PREV);
}
2011-12-01 11:57:05 +00:00
}
return pButtonBox;
}
static Window* getActionAreaButtonList(Dialog *pDialog)
{
VclButtonBox* pButtonBox = getActionArea(pDialog);
if (pButtonBox)
return pButtonBox->GetWindow(WINDOW_FIRSTCHILD);
return pDialog->GetWindow(WINDOW_FIRSTCHILD);
2011-12-01 11:57:05 +00:00
}
2000-09-18 16:07:07 +00:00
static PushButton* ImplGetDefaultButton( Dialog* pDialog )
{
2011-12-01 11:57:05 +00:00
Window* pChild = getActionAreaButtonList(pDialog);
2000-09-18 16:07:07 +00:00
while ( pChild )
{
if ( pChild->ImplIsPushButton() )
{
PushButton* pPushButton = (PushButton*)pChild;
if ( pPushButton->ImplIsDefButton() )
return pPushButton;
}
pChild = pChild->GetWindow( WINDOW_NEXT );
}
return NULL;
}
static PushButton* ImplGetOKButton( Dialog* pDialog )
{
2011-12-01 11:57:05 +00:00
Window* pChild = getActionAreaButtonList(pDialog);
2000-09-18 16:07:07 +00:00
while ( pChild )
{
if ( pChild->GetType() == WINDOW_OKBUTTON )
return (PushButton*)pChild;
pChild = pChild->GetWindow( WINDOW_NEXT );
}
return NULL;
}
static PushButton* ImplGetCancelButton( Dialog* pDialog )
{
2011-12-01 11:57:05 +00:00
Window* pChild = getActionAreaButtonList(pDialog);
2000-09-18 16:07:07 +00:00
while ( pChild )
{
if ( pChild->GetType() == WINDOW_CANCELBUTTON )
return (PushButton*)pChild;
pChild = pChild->GetWindow( WINDOW_NEXT );
}
return NULL;
}
static void ImplMouseAutoPos( Dialog* pDialog )
{
sal_uLong nMouseOptions = pDialog->GetSettings().GetMouseSettings().GetOptions();
2000-09-18 16:07:07 +00:00
if ( nMouseOptions & MOUSE_OPTION_AUTOCENTERPOS )
{
Size aSize = pDialog->GetOutputSizePixel();
pDialog->SetPointerPosPixel( Point( aSize.Width()/2, aSize.Height()/2 ) );
}
else if ( nMouseOptions & MOUSE_OPTION_AUTODEFBTNPOS )
{
Window* pWindow = ImplGetDefaultButton( pDialog );
if ( !pWindow )
pWindow = ImplGetOKButton( pDialog );
if ( !pWindow )
pWindow = ImplGetCancelButton( pDialog );
if ( !pWindow )
pWindow = pDialog;
Size aSize = pWindow->GetOutputSizePixel();
pWindow->SetPointerPosPixel( Point( aSize.Width()/2, aSize.Height()/2 ) );
}
}
struct DialogImpl
{
long mnResult;
bool mbStartedModal;
Link maEndDialogHdl;
DialogImpl() : mnResult( -1 ), mbStartedModal( false ) {}
};
void Dialog::ImplInitDialogData()
2000-09-18 16:07:07 +00:00
{
mpWindowImpl->mbDialog = true;
mpPrevExecuteDlg = NULL;
mbInExecute = false;
mbOldSaveBack = false;
mbInClose = false;
mbModalMode = false;
mpContentArea = NULL;
mpActionArea = NULL;
mnMousePositioned = 0;
mpDialogImpl = new DialogImpl;
2000-09-18 16:07:07 +00:00
}
void Dialog::ImplInit( Window* pParent, WinBits nStyle )
{
sal_uInt16 nSysWinMode = Application::GetSystemWindowMode();
2000-09-18 16:07:07 +00:00
if ( !(nStyle & WB_NODIALOGCONTROL) )
nStyle |= WB_DIALOGCONTROL;
nStyle |= WB_ROLLABLE;
// Now, all Dialogs are per default system windows !!!
nStyle |= WB_SYSTEMWINDOW;
// parent is NULL: get the default Dialog parent
2000-09-18 16:07:07 +00:00
if ( !pParent )
{
pParent = Application::GetDefDialogParent();
if ( !pParent && !(nStyle & WB_SYSTEMWINDOW) )
pParent = ImplGetSVData()->maWinData.mpAppWin;
2000-09-18 16:07:07 +00:00
// If Parent is disabled, then we search for a modal dialog
// in this frame
if ( pParent && (!pParent->IsInputEnabled() || pParent->IsInModalMode()) )
2000-09-18 16:07:07 +00:00
{
ImplSVData* pSVData = ImplGetSVData();
Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
while ( pExeDlg )
{
// only if visible and enabled
if ( pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild( pExeDlg, true ) &&
2000-09-18 16:07:07 +00:00
pExeDlg->IsReallyVisible() &&
pExeDlg->IsEnabled() && pExeDlg->IsInputEnabled() && !pExeDlg->IsInModalMode() )
2000-09-18 16:07:07 +00:00
{
pParent = pExeDlg;
break;
}
pExeDlg = pExeDlg->mpPrevExecuteDlg;
}
}
}
// DIALOG_NO_PARENT: explicitly don't have a parent for this Dialog
else if( pParent == DIALOG_NO_PARENT )
pParent = NULL;
2000-09-18 16:07:07 +00:00
if ( !pParent || (nStyle & WB_SYSTEMWINDOW) ||
(pParent->mpWindowImpl->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SYSTEMWINDOW_MODE_NOAUTOMODE)) ||
2000-09-18 16:07:07 +00:00
(nSysWinMode & SYSTEMWINDOW_MODE_DIALOG) )
{
// create window with a small border ?
if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )
2000-09-18 16:07:07 +00:00
{
ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_FRAME );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
mpWindowImpl->mpBorderWindow = pBorderWin;
mpWindowImpl->mpRealParent = pParent;
2000-09-18 16:07:07 +00:00
}
else
{
mpWindowImpl->mbFrame = true;
mpWindowImpl->mbOverlapWin = true;
CWS-TOOLING: integrate CWS vcl100 2009-03-26 21:27:56 +0100 pl r270106 : #i10000# fix an include path missing when using configure 2009-03-16 12:18:24 +0100 pl r269518 : #i98963# revert change 2009-03-13 14:56:47 +0100 pl r269483 : #i98980# work around a mysterious crash 2009-03-12 20:02:48 +0100 pl r269440 : resolve some warnings 2009-03-12 19:30:32 +0100 pl r269439 : resolve some warnings 2009-03-12 18:07:47 +0100 pl r269432 : solve some warnings 2009-03-12 09:07:33 +0100 hdu r269358 : #i100134# remove obsolete RCS/CVS keywords from source 2009-03-11 21:18:28 +0100 pl r269355 : #i100134# change sft.h and ttcr.h to c++ headers 2009-03-11 20:19:15 +0100 pl r269353 : #i100134# remove some ugly C style lists 2009-03-11 18:19:35 +0100 hdu r269347 : #i100134# make psprint.fontsubset source C++ and make it compile 2009-03-11 14:44:35 +0100 hdu r269334 : #i99862# fix justification of vocalized hebrew (thanks hennerdrewes) 2009-03-11 13:40:35 +0100 pl r269327 : CWS-TOOLING: rebase CWS vcl100 to trunk@269297 (milestone: DEV300:m43) 2009-03-10 16:49:34 +0100 hdu r269284 : #i1000020# add style-matching heuristics for single-char stylenames 2009-03-10 15:42:53 +0100 hdu r269278 : use fast ASCII-matching for extracting attributes from PSName 2009-03-09 16:29:08 +0100 pl r269200 : #i98980# skip bundles that are not NP plugins 2009-03-09 13:26:14 +0100 hdu r269083 : #i99868# fix text breaking for large nCharExtra 2009-03-09 12:20:01 +0100 hdu r269078 : #i99868# fix text breaking for large nCharExtra 2009-03-06 17:35:27 +0100 pl r269032 : #i98980# mouse events 2009-03-06 17:10:14 +0100 pl r269024 : #i98980# flash animations, initial paint problem 2009-03-05 20:00:21 +0100 pl r268939 : #i98980# more plugin support 2009-03-05 15:35:06 +0100 pl r268914 : #i98980# first twitches of a live plugin 2009-03-05 15:34:10 +0100 pl r268913 : #i98980# access to carbon headers 2009-03-04 15:46:29 +0100 pl r268839 : #i98980# generalize vcl SystemChildWindow from QTMovieView to NSView 2009-03-04 15:40:20 +0100 pl r268838 : #i98980# generalize vcl SystemChildWindow from QTMovieView to NSView 2009-03-04 11:30:49 +0100 hdu r268801 : #i99722# for OSX any anisotropy reported for the display resolution is best ignored 2009-03-02 15:52:21 +0100 pl r268655 : #i99770# fix ambiguous looking if statements (thanks cmc) 2009-03-02 13:28:17 +0100 pl r268649 : #i99770# fix ambiguous looking if statements (thanks cmc) 2009-02-27 15:39:30 +0100 pl r268603 : #i97512# omit degenrate current matrix 2009-02-27 12:37:29 +0100 pl r268579 : #i99716# remove unused code (thanks cmc) 2009-02-27 11:21:18 +0100 pl r268569 : #i99705 remove unused code (thanks cmc) 2009-02-23 10:42:00 +0100 pl r268345 : #i99492# remove a typo (thanks tono) 2009-02-19 12:46:21 +0100 pl r268274 : #i99411# add new mimetype 2009-02-10 12:57:59 +0100 pl r267548 : #i98980# more aqua plugin changes 2009-02-06 16:50:34 +0100 pl r267475 : #i98980# plugin detection 2009-02-06 16:46:48 +0100 pl r267474 : #i98980# make debug compilation work 2009-02-06 12:16:37 +0100 pl r267449 : #98963# add missing wrapper 2009-02-04 20:06:59 +0100 pl r267402 : #i97135# work around a gcc x64 optimizer bug 2009-02-04 13:45:36 +0100 pl r267380 : #159153# do not emit empty glyph vector 2009-02-03 17:47:16 +0100 pl r267338 : #i98533# recent gtk versions do not support GTK_MODULES for accessibility anymore 2009-02-03 10:39:46 +0100 pl r267305 : #i97146# check if the idle formatted view is still valid 2009-01-28 11:23:23 +0100 pl r267045 : #i42227# #i48965# refinement of check markings images 2009-01-27 19:40:01 +0100 pl r267016 : #i42227# #i48965# change menus wrt checkmarks and images
2009-04-01 11:54:14 +00:00
SystemWindow::ImplInit( pParent, (nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)) | WB_CLOSEABLE, NULL );
// Now set all style bits
mpWindowImpl->mnStyle = nStyle;
2000-09-18 16:07:07 +00:00
}
}
else
{
ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
mpWindowImpl->mpBorderWindow = pBorderWin;
mpWindowImpl->mpRealParent = pParent;
2000-09-18 16:07:07 +00:00
}
SetActivateMode( ACTIVATE_MODE_GRABFOCUS );
ImplInitSettings();
}
void Dialog::ImplInitSettings()
{
// user override
2000-09-18 16:07:07 +00:00
if ( IsControlBackground() )
SetBackground( GetControlBackground() );
// NWF background
else if( IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG ) )
{
mpWindowImpl->mnNativeBackground = PART_BACKGROUND_DIALOG;
EnableChildTransparentMode( true );
}
// fallback to settings color
2000-09-18 16:07:07 +00:00
else
SetBackground( GetSettings().GetStyleSettings().GetDialogColor() );
}
Dialog::Dialog( WindowType nType )
: SystemWindow( nType )
2000-09-18 16:07:07 +00:00
{
ImplInitDialogData();
2000-09-18 16:07:07 +00:00
}
OUString VclBuilderContainer::getUIRootDir()
{
/*to-do, check if user config has an override before using shared one, etc*/
css::uno::Reference< css::util::XPathSettings > xPathSettings = css::util::thePathSettings::get(
::comphelper::getProcessComponentContext() );
OUString sShareLayer = xPathSettings->getBasePathShareLayer();
// "UIConfig" is a "multi path" ... use first part only here!
sal_Int32 nPos = sShareLayer.indexOf(';');
if (nPos > 0)
sShareLayer = sShareLayer.copy(0, nPos);
// Note: May be an user uses URLs without a final slash! Check it ...
if (!sShareLayer.endsWith("/"))
sShareLayer += "/";
sShareLayer += "soffice.cfg/";
/*to-do, can we merge all this foo with existing soffice.cfg finding code, etc*/
return sShareLayer;
}
//we can't change sizeable after the fact, so need to defer until we know and then
//do the init. Find the real parent stashed in mpDialogParent.
void Dialog::doDeferredInit(bool bResizable, bool bCloseable)
{
WinBits nBits = WB_3DLOOK|WB_CLOSEABLE|WB_MOVEABLE;
if (bResizable)
nBits |= WB_SIZEABLE;
if (bCloseable)
nBits |= WB_CLOSEABLE;
Window *pParent = mpDialogParent;
mpDialogParent = NULL;
ImplInit(pParent, nBits);
mbIsDefferedInit = false;
}
Dialog::Dialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
: SystemWindow(WINDOW_DIALOG)
{
ImplInitDialogData();
loadUI(pParent, rID, rUIXMLDescription);
}
Dialog::Dialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, WindowType nType)
: SystemWindow(nType)
{
ImplInitDialogData();
loadUI(pParent, rID, rUIXMLDescription);
}
Dialog::Dialog(Window* pParent, WinBits nStyle)
: SystemWindow(WINDOW_DIALOG)
2000-09-18 16:07:07 +00:00
{
ImplInitDialogData();
2000-09-18 16:07:07 +00:00
ImplInit( pParent, nStyle );
}
void Dialog::set_action_area(VclButtonBox* pActionArea)
{
mpActionArea = pActionArea;
}
void Dialog::set_content_area(VclBox* pContentArea)
{
mpContentArea = pContentArea;
}
void Dialog::settingOptimalLayoutSize(VclBox *pBox)
{
const DialogStyle& rDialogStyle =
GetSettings().GetStyleSettings().GetDialogStyle();
pBox->set_border_width(rDialogStyle.content_area_border);
pBox->set_spacing(pBox->get_spacing() +
rDialogStyle.content_area_spacing);
VclButtonBox *pActionArea = getActionArea(this);
if (pActionArea)
{
pActionArea->set_border_width(rDialogStyle.action_area_border);
pActionArea->set_spacing(rDialogStyle.button_spacing);
}
}
Dialog::~Dialog()
{
delete mpDialogImpl;
mpDialogImpl = NULL;
}
IMPL_LINK_NOARG(Dialog, ImplAsyncCloseHdl)
{
Close();
return 0;
}
bool Dialog::Notify( NotifyEvent& rNEvt )
2000-09-18 16:07:07 +00:00
{
// first call the base class due to Tab control
bool nRet = SystemWindow::Notify( rNEvt );
2000-09-18 16:07:07 +00:00
if ( !nRet )
{
if ( rNEvt.GetType() == EVENT_KEYINPUT )
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
sal_uInt16 nKeyCode = aKeyCode.GetCode();
2000-09-18 16:07:07 +00:00
if ( (nKeyCode == KEY_ESCAPE) &&
((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) )
{
// #i89505# for the benefit of slightly mentally challenged implementations
// like e.g. SfxModelessDialog which destroy themselves inside Close()
// post this Close asynchronous so we can leave our key handler before
// we get destroyed
PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this );
return true;
2000-09-18 16:07:07 +00:00
}
}
else if ( rNEvt.GetType() == EVENT_GETFOCUS )
{
// make sure the dialog is still modal
// changing focus between application frames may
// have re-enabled input for our parent
if( mbInExecute && mbModalMode )
{
// do not change modal counter (pSVData->maAppData.mnModalDialog)
SetModalInputMode( false );
SetModalInputMode( true );
// #93022# def-button might have changed after show
if( !mnMousePositioned )
{
mnMousePositioned = 1;
ImplMouseAutoPos( this );
}
}
}
2000-09-18 16:07:07 +00:00
}
return nRet;
}
//What we really want here is something that gives the available width and
//height of a users screen, taking away the space taken up the OS
//taskbar, menus, etc.
Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
{
long w = rScreenSize.Width();
if (w <= 800)
w -= 15;
else if (w <= 1024)
w -= 65;
else
w -= 115;
long h = rScreenSize.Height();
if (h <= 768)
h -= 50;
else
h -= 100;
return Size(w, h);
}
void Dialog::StateChanged( StateChangedType nType )
{
if (nType == STATE_CHANGE_INITSHOW)
{
if ( GetSettings().GetStyleSettings().GetAutoMnemonic() )
ImplWindowAutoMnemonic( this );
DoInitialLayout();
2012-04-16 15:14:42 +01:00
2000-09-18 16:07:07 +00:00
if ( !HasChildPathFocus() || HasFocus() )
GrabFocusToFirstControl();
if ( !(GetStyle() & WB_CLOSEABLE) )
{
if ( ImplGetCancelButton( this ) || ImplGetOKButton( this ) )
{
if ( ImplGetBorderWindow() )
((ImplBorderWindow*)ImplGetBorderWindow())->SetCloser();
}
}
ImplMouseAutoPos( this );
}
SystemWindow::StateChanged( nType );
if (nType == STATE_CHANGE_CONTROLBACKGROUND)
2000-09-18 16:07:07 +00:00
{
ImplInitSettings();
Invalidate();
}
}
void Dialog::DataChanged( const DataChangedEvent& rDCEvt )
{
SystemWindow::DataChanged( rDCEvt );
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
{
ImplInitSettings();
Invalidate();
}
}
bool Dialog::Close()
2000-09-18 16:07:07 +00:00
{
2001-11-27 08:52:58 +00:00
ImplDelData aDelData;
ImplAddDel( &aDelData );
ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
if ( aDelData.IsDead() )
return false;
2001-11-27 08:52:58 +00:00
ImplRemoveDel( &aDelData );
if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() )
return false;
2000-09-18 16:07:07 +00:00
mbInClose = true;
2000-09-18 16:07:07 +00:00
if ( !(GetStyle() & WB_CLOSEABLE) )
{
bool bRet = true;
2000-09-18 16:07:07 +00:00
ImplAddDel( &aDelData );
PushButton* pButton = ImplGetCancelButton( this );
if ( pButton )
pButton->Click();
else
{
pButton = ImplGetOKButton( this );
if ( pButton )
pButton->Click();
2001-08-07 10:54:21 +00:00
else
bRet = false;
2000-09-18 16:07:07 +00:00
}
if ( aDelData.IsDead() )
return true;
2000-09-18 16:07:07 +00:00
ImplRemoveDel( &aDelData );
2001-08-07 10:54:21 +00:00
return bRet;
2000-09-18 16:07:07 +00:00
}
if ( IsInExecute() )
{
EndDialog( RET_CANCEL );
mbInClose = false;
return true;
2000-09-18 16:07:07 +00:00
}
else
{
mbInClose = false;
2000-09-18 16:07:07 +00:00
return SystemWindow::Close();
}
}
bool Dialog::ImplStartExecuteModal()
2000-09-18 16:07:07 +00:00
{
if ( mbInExecute )
{
#ifdef DBG_UTIL
OStringBuffer aErrorStr;
aErrorStr.append("Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): ");
2011-09-14 21:59:35 +01:00
aErrorStr.append(ImplGetDialogText(this));
OSL_FAIL(aErrorStr.getStr());
2000-09-18 16:07:07 +00:00
#endif
return false;
2000-09-18 16:07:07 +00:00
}
switch ( Application::GetDialogCancelMode() )
2000-09-18 16:07:07 +00:00
{
case Application::DIALOG_CANCEL_OFF:
break;
case Application::DIALOG_CANCEL_SILENT:
SAL_INFO(
"vcl",
"Dialog \"" << ImplGetDialogText(this).getStr()
<< "\"cancelled in silent mode");
return false;
default:
assert(false && "this cannot happen");
// fall through
case Application::DIALOG_CANCEL_FATAL:
std::abort();
2000-09-18 16:07:07 +00:00
}
#ifdef DBG_UTIL
Window* pParent = GetParent();
if ( pParent )
{
pParent = pParent->ImplGetFirstOverlapWindow();
DBG_ASSERT( pParent->IsReallyVisible(),
"Dialog::StartExecuteModal() - Parent not visible" );
2001-12-10 12:36:20 +00:00
DBG_ASSERT( pParent->IsInputEnabled(),
"Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" );
DBG_ASSERT( ! pParent->IsInModalMode(),
"Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" );
2000-09-18 16:07:07 +00:00
}
#endif
ImplSVData* pSVData = ImplGetSVData();
// link all dialogs which are being executed
2000-09-18 16:07:07 +00:00
mpPrevExecuteDlg = pSVData->maWinData.mpLastExecuteDlg;
pSVData->maWinData.mpLastExecuteDlg = this;
// stop capturing, in order to have control over the dialog
2000-09-18 16:07:07 +00:00
if ( pSVData->maWinData.mpTrackWin )
pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
if ( pSVData->maWinData.mpCaptureWin )
pSVData->maWinData.mpCaptureWin->ReleaseMouse();
EnableInput( true, true );
2000-09-18 16:07:07 +00:00
if ( GetParent() )
{
NotifyEvent aNEvt( EVENT_EXECUTEDIALOG, this );
GetParent()->Notify( aNEvt );
}
mbInExecute = true;
SetModalInputMode( true );
2000-09-18 16:07:07 +00:00
mbOldSaveBack = IsSaveBackgroundEnabled();
EnableSaveBackground();
// FIXME: no layouting, workaround some clipping issues
ImplAdjustNWFSizes();
2000-09-18 16:07:07 +00:00
Show();
pSVData->maAppData.mnModalMode++;
return true;
}
void Dialog::ImplEndExecuteModal()
{
ImplSVData* pSVData = ImplGetSVData();
pSVData->maAppData.mnModalMode--;
}
short Dialog::Execute()
{
#if HAVE_FEATURE_DESKTOP
setDeferredProperties();
if ( !ImplStartExecuteModal() )
return 0;
2000-09-18 16:07:07 +00:00
ImplDelData aDelData;
ImplAddDel( &aDelData );
#ifdef DBG_UTIL
ImplDelData aParentDelData;
Window* pDialogParent = mpDialogParent;
if( pDialogParent )
pDialogParent->ImplAddDel( &aParentDelData );
#endif
// Yield util EndDialog is called or dialog gets destroyed
// (the latter should not happen, but better safe than sorry
while ( !aDelData.IsDead() && mbInExecute )
2000-09-18 16:07:07 +00:00
Application::Yield();
ImplEndExecuteModal();
#ifdef DBG_UTIL
if( pDialogParent )
{
if( ! aParentDelData.IsDead() )
pDialogParent->ImplRemoveDel( &aParentDelData );
else
2011-03-01 19:08:19 +01:00
OSL_FAIL( "Dialog::Execute() - Parent of dialog destroyed in Execute()" );
}
#endif
if ( !aDelData.IsDead() )
2000-09-18 16:07:07 +00:00
ImplRemoveDel( &aDelData );
#ifdef DBG_UTIL
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
2000-09-18 16:07:07 +00:00
}
#endif
long nRet = mpDialogImpl->mnResult;
mpDialogImpl->mnResult = -1;
2000-09-18 16:07:07 +00:00
return (short)nRet;
#else
MLODialogKind kind;
switch (GetType())
{
case WINDOW_MESSBOX:
kind = MLODialogMessage;
break;
case WINDOW_INFOBOX:
kind = MLODialogInformation;
break;
case WINDOW_WARNINGBOX:
kind = MLODialogWarning;
break;
case WINDOW_ERRORBOX:
kind = MLODialogError;
break;
case WINDOW_QUERYBOX:
kind = MLODialogQuery;
break;
default:
SAL_WARN("vcl", "Dialog::Execute: Unhandled window type %d" << GetType());
kind = MLODialogInformation;
break;
}
MLODialogResult result = touch_ui_dialog_modal(kind, ImplGetDialogText(this).getStr());
switch (result)
{
case MLODialogOK:
return RET_OK;
case MLODialogCancel:
return RET_CANCEL;
case MLODialogNo:
return RET_NO;
case MLODialogYes:
return RET_YES;
case MLODialogRetry:
return RET_RETRY;
case MLODialogIgnore:
return RET_IGNORE;
default:
SAL_WARN("vcl", "Dialog::Execute: Unhandled dialog result %d" << result);
return RET_OK;
}
#endif
2000-09-18 16:07:07 +00:00
}
// virtual
void Dialog::StartExecuteModal( const Link& rEndDialogHdl )
{
if ( !ImplStartExecuteModal() )
return;
mpDialogImpl->maEndDialogHdl = rEndDialogHdl;
mpDialogImpl->mbStartedModal = true;
}
2000-09-18 16:07:07 +00:00
void Dialog::EndDialog( long nResult )
{
if ( mbInExecute )
{
SetModalInputMode( false );
2000-09-18 16:07:07 +00:00
// remove dialog from the list of dialogs which are being executed
2000-09-18 16:07:07 +00:00
ImplSVData* pSVData = ImplGetSVData();
Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
while ( pExeDlg )
{
if ( pExeDlg == this )
{
pSVData->maWinData.mpLastExecuteDlg = mpPrevExecuteDlg;
2000-09-18 16:07:07 +00:00
break;
}
pExeDlg = pExeDlg->mpPrevExecuteDlg;
}
// set focus to previous modal dialogue if it is modal for
// the same frame parent (or NULL)
if( mpPrevExecuteDlg )
{
Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
Window* pPrevFrameParent = mpPrevExecuteDlg->ImplGetFrameWindow()->ImplGetParent();
if( ( !pFrameParent && !pPrevFrameParent ) ||
( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
)
{
mpPrevExecuteDlg->GrabFocus();
}
}
2000-09-18 16:07:07 +00:00
mpPrevExecuteDlg = NULL;
Hide();
EnableSaveBackground( mbOldSaveBack );
if ( GetParent() )
{
NotifyEvent aNEvt( EVENT_ENDEXECUTEDIALOG, this );
GetParent()->Notify( aNEvt );
}
mpDialogImpl->mnResult = nResult;
if ( mpDialogImpl->mbStartedModal )
{
ImplEndExecuteModal();
mpDialogImpl->maEndDialogHdl.Call( this );
mpDialogImpl->maEndDialogHdl = Link();
mpDialogImpl->mbStartedModal = false;
mpDialogImpl->mnResult = -1;
}
mbInExecute = false;
2000-09-18 16:07:07 +00:00
}
}
long Dialog::GetResult() const
{
return mpDialogImpl->mnResult;
}
2001-01-29 14:48:32 +00:00
void Dialog::EndAllDialogs( Window* pParent )
{
ImplSVData* pSVData = ImplGetSVData();
Dialog* pTempModDialog;
Dialog* pModDialog = pSVData->maWinData.mpLastExecuteDlg;
while ( pModDialog )
{
pTempModDialog = pModDialog->mpPrevExecuteDlg;
if( !pParent || ( pParent && pParent->IsWindowOrChild( pModDialog, true ) ) )
{
pModDialog->EndDialog( RET_CANCEL );
pModDialog->PostUserEvent( Link() );
}
pModDialog = pTempModDialog;
}
}
void Dialog::SetModalInputMode( bool bModal )
2000-09-18 16:07:07 +00:00
{
if ( bModal == mbModalMode )
return;
ImplSVData* pSVData = ImplGetSVData();
mbModalMode = bModal;
if ( bModal )
{
pSVData->maAppData.mnModalDialog++;
// Diable the prev Modal Dialog, because our dialog must close at first,
// before the other dialog can be closed (because the other dialog
// is on stack since our dialog returns)
if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, true ) )
mpPrevExecuteDlg->EnableInput( false, true, true, this );
2000-09-18 16:07:07 +00:00
// determine next overlap dialog parent
Window* pParent = GetParent();
if ( pParent )
{
// #103716# dialogs should always be modal to the whole frame window
2014-04-10 09:35:15 +02:00
// #115933# disable the whole frame hierarchy, useful if our parent
// is a modeless dialog
mpDialogParent = pParent->mpWindowImpl->mpFrameWindow;
mpDialogParent->ImplIncModalCount();
}
2001-12-10 12:36:20 +00:00
2000-09-18 16:07:07 +00:00
}
else
{
pSVData->maAppData.mnModalDialog--;
if ( mpDialogParent )
{
2014-04-10 09:35:15 +02:00
// #115933# re-enable the whole frame hierarchy again (see above)
// note that code in getfocus assures that we do not accidentally enable
// windows that were disabled before
mpDialogParent->ImplDecModalCount();
}
2000-09-18 16:07:07 +00:00
// Enable the prev Modal Dialog
if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, true ) )
{
mpPrevExecuteDlg->EnableInput( true, true, true, this );
// ensure continued modality of prev dialog
// do not change modality counter
// #i119994# need find the last modal dialog before reactive it
Dialog * pPrevModalDlg = mpPrevExecuteDlg;
while( pPrevModalDlg && !pPrevModalDlg->IsModalInputMode() )
pPrevModalDlg = pPrevModalDlg->mpPrevExecuteDlg;
if( pPrevModalDlg &&
( pPrevModalDlg == mpPrevExecuteDlg
|| !pPrevModalDlg->IsWindowOrChild( this, true ) ) )
{
mpPrevExecuteDlg->SetModalInputMode( false );
mpPrevExecuteDlg->SetModalInputMode( true );
}
}
2000-09-18 16:07:07 +00:00
}
}
void Dialog::SetModalInputMode( bool bModal, bool bSubModalDialogs )
2000-09-18 16:07:07 +00:00
{
if ( bSubModalDialogs )
{
Window* pOverlap = ImplGetFirstOverlapWindow();
pOverlap = pOverlap->mpWindowImpl->mpFirstOverlap;
2000-09-18 16:07:07 +00:00
while ( pOverlap )
{
if ( pOverlap->IsDialog() )
((Dialog*)pOverlap)->SetModalInputMode( bModal, true );
pOverlap = pOverlap->mpWindowImpl->mpNext;
2000-09-18 16:07:07 +00:00
}
}
SetModalInputMode( bModal );
}
void Dialog::GrabFocusToFirstControl()
{
Window* pFocusControl;
// find focus control, even if the dialog has focus
2000-09-18 16:07:07 +00:00
if ( HasFocus() )
pFocusControl = NULL;
else
{
// prefer a child window which had focus before
pFocusControl = ImplGetFirstOverlapWindow()->mpWindowImpl->mpLastFocusWindow;
// find the control out of the dialog control
2000-09-18 16:07:07 +00:00
if ( pFocusControl )
pFocusControl = ImplFindDlgCtrlWindow( pFocusControl );
}
// no control had the focus before or the control is not
// part of the tab-control, now give focus to the
// first control in the tab-control
2000-09-18 16:07:07 +00:00
if ( !pFocusControl ||
!(pFocusControl->GetStyle() & WB_TABSTOP) ||
!isVisibleInLayout(pFocusControl) ||
!isEnabledInLayout(pFocusControl) || !pFocusControl->IsInputEnabled() )
2000-09-18 16:07:07 +00:00
{
sal_uInt16 n = 0;
2000-09-18 16:07:07 +00:00
pFocusControl = ImplGetDlgWindow( n, DLGWINDOW_FIRST );
}
if ( pFocusControl )
pFocusControl->ImplControlFocus( GETFOCUS_INIT );
}
void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
2001-06-05 12:52:42 +00:00
{
ImplBorderWindow aImplWin( (Window*)this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
aImplWin.GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
}
void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong )
2001-02-14 17:11:46 +00:00
{
Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize );
Wallpaper aWallpaper = GetBackground();
if ( !aWallpaper.IsBitmap() )
ImplInitSettings();
2001-02-14 17:11:46 +00:00
2001-02-16 10:13:00 +00:00
pDev->Push();
pDev->SetMapMode();
pDev->SetLineColor();
if ( aWallpaper.IsBitmap() )
pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() );
else
{
pDev->SetFillColor( aWallpaper.GetColor() );
pDev->DrawRect( Rectangle( aPos, aSize ) );
}
2001-02-16 10:13:00 +00:00
if (!( GetStyle() & WB_NOBORDER ))
{
ImplBorderWindow aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
aImplWin.SetText( GetText() );
aImplWin.setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
aImplWin.SetDisplayActive( true );
aImplWin.InitView();
2001-02-16 10:13:00 +00:00
aImplWin.Draw( Rectangle( aPos, aSize ), pDev, aPos );
}
2001-02-14 17:11:46 +00:00
pDev->Pop();
}
void Dialog::queue_resize(StateChangedType eReason)
{
2012-04-16 15:14:42 +01:00
if (IsInClose())
return;
SystemWindow::queue_resize(eReason);
}
bool Dialog::set_property(const OString &rKey, const OString &rValue)
{
if (rKey == "border-width")
set_border_width(rValue.toInt32());
else
return SystemWindow::set_property(rKey, rValue);
return true;
}
VclBuilderContainer::VclBuilderContainer()
: m_pUIBuilder(NULL)
{
}
VclBuilderContainer::~VclBuilderContainer()
{
delete m_pUIBuilder;
}
ModelessDialog::ModelessDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
: Dialog(pParent, rID, rUIXMLDescription, WINDOW_MODELESSDIALOG)
{
}
2000-09-18 16:07:07 +00:00
ModalDialog::ModalDialog( Window* pParent, WinBits nStyle ) :
Dialog( WINDOW_MODALDIALOG )
{
ImplInit( pParent, nStyle );
}
ModalDialog::ModalDialog( Window* pParent, const OString& rID, const OUString& rUIXMLDescription ) :
Dialog(pParent, rID, rUIXMLDescription, WINDOW_MODALDIALOG)
{
2000-09-18 16:07:07 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */