2010-10-14 08:27:31 +02:00
|
|
|
/* -*- 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
|
|
|
|
2014-05-22 11:12:44 +03:00
|
|
|
#include <config_features.h>
|
2014-02-24 16:51:31 +01:00
|
|
|
|
2011-01-24 16:34:14 +01:00
|
|
|
#include "comphelper/processfactory.hxx"
|
|
|
|
|
|
|
|
#include "osl/module.h"
|
|
|
|
#include "osl/file.hxx"
|
|
|
|
#include "osl/thread.h"
|
|
|
|
|
|
|
|
#include "rtl/tencinfo.h"
|
|
|
|
#include "rtl/instance.hxx"
|
|
|
|
|
2009-02-19 13:44:30 +00:00
|
|
|
#include "tools/debug.hxx"
|
|
|
|
#include "tools/time.hxx"
|
2011-01-24 16:34:14 +01:00
|
|
|
|
2013-04-05 18:40:39 +02:00
|
|
|
#include "i18nlangtag/mslangid.hxx"
|
2011-01-24 16:34:14 +01:00
|
|
|
|
|
|
|
#include "unotools/syslocaleoptions.hxx"
|
|
|
|
|
2009-02-19 13:44:30 +00:00
|
|
|
#include "vcl/settings.hxx"
|
|
|
|
#include "vcl/keycod.hxx"
|
|
|
|
#include "vcl/event.hxx"
|
|
|
|
#include "vcl/vclevent.hxx"
|
|
|
|
#include "vcl/virdev.hxx"
|
|
|
|
#include "vcl/wrkwin.hxx"
|
|
|
|
#include "vcl/svapp.hxx"
|
|
|
|
#include "vcl/cvtgrf.hxx"
|
|
|
|
#include "vcl/unowrap.hxx"
|
|
|
|
#include "vcl/timer.hxx"
|
2015-02-26 07:33:59 +00:00
|
|
|
#include "vcl/scheduler.hxx"
|
2009-02-19 13:44:30 +00:00
|
|
|
#include "vcl/unohelp.hxx"
|
2011-01-24 16:34:14 +01:00
|
|
|
#include "vcl/lazydelete.hxx"
|
|
|
|
|
|
|
|
#include "salinst.hxx"
|
|
|
|
#include "salframe.hxx"
|
|
|
|
#include "salsys.hxx"
|
|
|
|
#include "svdata.hxx"
|
|
|
|
#include "salimestatus.hxx"
|
|
|
|
#include "xconnection.hxx"
|
|
|
|
#include "window.h"
|
|
|
|
#include "accmgr.hxx"
|
|
|
|
#include "idlemgr.hxx"
|
|
|
|
#include "svids.hrc"
|
2009-02-19 13:44:30 +00:00
|
|
|
|
|
|
|
#include "com/sun/star/uno/Reference.h"
|
|
|
|
#include "com/sun/star/awt/XToolkit.hpp"
|
|
|
|
#include "com/sun/star/uno/XNamingService.hpp"
|
|
|
|
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
2013-05-14 13:15:38 +02:00
|
|
|
#include "comphelper/solarmutex.hxx"
|
2010-10-20 06:26:34 -05:00
|
|
|
#include "osl/process.h"
|
2002-11-26 14:37:09 +00:00
|
|
|
|
2014-06-04 08:45:54 +02:00
|
|
|
#include <cassert>
|
2004-06-25 16:08:44 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2011-11-04 14:40:18 +00:00
|
|
|
using namespace ::com::sun::star;
|
2001-05-18 08:26:12 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
2002-10-23 12:18:26 +00:00
|
|
|
// keycodes handled internally by VCL
|
2002-10-25 10:43:13 +00:00
|
|
|
class ImplReservedKey
|
|
|
|
{
|
|
|
|
public:
|
2014-08-23 22:22:32 +03:00
|
|
|
ImplReservedKey( vcl::KeyCode aKeyCode, sal_uInt16 nResId ) :
|
2002-10-25 10:43:13 +00:00
|
|
|
mKeyCode(aKeyCode), mnResId( nResId)
|
|
|
|
{}
|
|
|
|
|
2014-08-23 22:22:32 +03:00
|
|
|
vcl::KeyCode mKeyCode;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 mnResId;
|
2002-10-25 10:43:13 +00:00
|
|
|
};
|
|
|
|
|
2004-06-25 16:08:44 +00:00
|
|
|
typedef std::pair<ImplReservedKey*, size_t> ReservedKeys;
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct ImplReservedKeysImpl
|
|
|
|
{
|
|
|
|
ReservedKeys* operator()()
|
|
|
|
{
|
|
|
|
static ImplReservedKey ImplReservedKeys[] =
|
|
|
|
{
|
2014-08-23 22:22:32 +03:00
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F1,0), SV_SHORTCUT_HELP),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F1,KEY_SHIFT), SV_SHORTCUT_ACTIVEHELP),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F1,KEY_MOD1), SV_SHORTCUT_CONTEXTHELP),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F2,KEY_SHIFT), SV_SHORTCUT_CONTEXTHELP),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F4,KEY_MOD1), SV_SHORTCUT_DOCKUNDOCK),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F4,KEY_MOD2), SV_SHORTCUT_DOCKUNDOCK),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F4,KEY_MOD1|KEY_MOD2), SV_SHORTCUT_DOCKUNDOCK),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F6,0), SV_SHORTCUT_NEXTSUBWINDOW),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F6,KEY_MOD1), SV_SHORTCUT_TODOCUMENT),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F6,KEY_SHIFT), SV_SHORTCUT_PREVSUBWINDOW),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F6,KEY_MOD1|KEY_SHIFT), SV_SHORTCUT_SPLITTER),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_F10,0), SV_SHORTCUT_MENUBAR)
|
2003-03-27 16:59:30 +00:00
|
|
|
#ifdef UNX
|
2004-06-25 16:08:44 +00:00
|
|
|
,
|
2014-08-23 22:22:32 +03:00
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_1,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_2,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_3,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_4,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_5,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_6,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_7,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_8,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_9,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_0,KEY_SHIFT|KEY_MOD1), 0),
|
|
|
|
ImplReservedKey(vcl::KeyCode(KEY_ADD,KEY_SHIFT|KEY_MOD1), 0)
|
2003-03-27 16:59:30 +00:00
|
|
|
#endif
|
2004-06-25 16:08:44 +00:00
|
|
|
};
|
|
|
|
static ReservedKeys aKeys
|
|
|
|
(
|
|
|
|
&ImplReservedKeys[0],
|
|
|
|
sizeof(ImplReservedKeys) / sizeof(ImplReservedKey)
|
|
|
|
);
|
|
|
|
return &aKeys;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ImplReservedKeys
|
|
|
|
: public rtl::StaticAggregate<ReservedKeys, ImplReservedKeysImpl> {};
|
|
|
|
}
|
2002-10-23 12:18:26 +00:00
|
|
|
|
2001-03-15 10:33:48 +00:00
|
|
|
extern "C" {
|
|
|
|
typedef UnoWrapperBase* (SAL_CALL *FN_TkCreateUnoWrapper)();
|
2006-06-19 18:14:25 +00:00
|
|
|
}
|
2001-03-15 10:33:48 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
struct ImplHotKey
|
|
|
|
{
|
|
|
|
ImplHotKey* mpNext;
|
|
|
|
void* mpUserData;
|
2014-08-23 22:22:32 +03:00
|
|
|
vcl::KeyCode maKeyCode;
|
2015-04-30 10:20:00 +02:00
|
|
|
Link<> maLink;
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ImplEventHook
|
|
|
|
{
|
|
|
|
ImplEventHook* mpNext;
|
|
|
|
void* mpUserData;
|
|
|
|
VCLEventHookProc mpProc;
|
|
|
|
};
|
|
|
|
|
2004-08-12 09:46:07 +00:00
|
|
|
struct ImplPostEventData
|
|
|
|
{
|
2011-01-12 15:07:10 +01:00
|
|
|
sal_uLong mnEvent;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<vcl::Window> mpWin;
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * mnEventId;
|
2004-08-12 09:46:07 +00:00
|
|
|
KeyEvent maKeyEvent;
|
|
|
|
MouseEvent maMouseEvent;
|
2013-03-03 01:06:17 +02:00
|
|
|
ZoomEvent maZoomEvent;
|
|
|
|
ScrollEvent maScrollEvent;
|
2004-08-12 09:46:07 +00:00
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent ) :
|
2004-08-12 09:46:07 +00:00
|
|
|
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maKeyEvent( rKeyEvent ) {}
|
2015-03-09 14:29:30 +02:00
|
|
|
ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent ) :
|
2004-08-12 09:46:07 +00:00
|
|
|
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maMouseEvent( rMouseEvent ) {}
|
2014-04-08 08:39:36 +02:00
|
|
|
#if !HAVE_FEATURE_DESKTOP
|
2015-03-09 14:29:30 +02:00
|
|
|
ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const ZoomEvent& rZoomEvent ) :
|
2013-03-03 01:06:17 +02:00
|
|
|
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maZoomEvent( rZoomEvent ) {}
|
2015-03-09 14:29:30 +02:00
|
|
|
ImplPostEventData( sal_uLong nEvent, vcl::Window* pWin, const ScrollEvent& rScrollEvent ) :
|
2013-03-03 01:06:17 +02:00
|
|
|
mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maScrollEvent( rScrollEvent ) {}
|
2014-04-08 08:39:36 +02:00
|
|
|
#endif
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
~ImplPostEventData() {}
|
|
|
|
};
|
|
|
|
|
2015-03-17 15:13:34 +02:00
|
|
|
typedef ::std::pair< VclPtr<vcl::Window>, ImplPostEventData* > ImplPostEventPair;
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
static ::std::list< ImplPostEventPair > aPostedEventList;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Application* GetpApp()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData )
|
|
|
|
return NULL;
|
|
|
|
return pSVData->mpApp;
|
|
|
|
}
|
|
|
|
|
|
|
|
Application::Application()
|
|
|
|
{
|
2013-01-10 17:38:18 +00:00
|
|
|
// useful for themes at least, perhaps extensions too
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aVar("LIBO_VERSION"), aValue(LIBO_VERSION_DOTTED);
|
2013-01-10 17:38:18 +00:00
|
|
|
osl_setEnvironment(aVar.pData, aValue.pData);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplGetSVData()->mpApp = this;
|
|
|
|
InitSalData();
|
|
|
|
}
|
|
|
|
|
|
|
|
Application::~Application()
|
|
|
|
{
|
|
|
|
ImplDeInitSVData();
|
|
|
|
DeInitSalData();
|
|
|
|
ImplGetSVData()->mpApp = NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-29 13:03:28 +11:00
|
|
|
int Application::Main()
|
|
|
|
{
|
|
|
|
SAL_WARN("vcl", "Application is a base class and should be overridden.");
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::QueryExit()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin;
|
|
|
|
|
2013-03-03 23:56:37 +11:00
|
|
|
// call the close handler of the application window
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pAppWin )
|
|
|
|
return pAppWin->Close();
|
|
|
|
else
|
2014-02-21 12:53:51 +01:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-13 08:43:02 +00:00
|
|
|
void Application::Init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-10-12 15:31:05 +01:00
|
|
|
void Application::InitFinished()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-10-23 05:44:59 +00:00
|
|
|
void Application::DeInit()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-10-20 06:26:34 -05:00
|
|
|
sal_uInt16 Application::GetCommandLineParamCount()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-10-20 06:26:34 -05:00
|
|
|
return (sal_uInt16)osl_getCommandArgCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 13:49:12 +01:00
|
|
|
OUString Application::GetCommandLineParam( sal_uInt16 nParam )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aParam;
|
2010-10-26 11:38:27 +01:00
|
|
|
osl_getCommandArg( nParam, &aParam.pData );
|
|
|
|
return aParam;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 13:49:12 +01:00
|
|
|
OUString Application::GetAppFileName()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2013-03-03 17:58:00 +11:00
|
|
|
DBG_ASSERT( pSVData->maAppData.mpAppFileName, "AppFileName should be set to something after SVMain!" );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pSVData->maAppData.mpAppFileName )
|
|
|
|
return *pSVData->maAppData.mpAppFileName;
|
2001-09-07 12:47:30 +00:00
|
|
|
|
|
|
|
/*
|
2013-06-30 13:49:12 +01:00
|
|
|
* provide a fallback for people without initialized vcl here (like setup
|
|
|
|
* in responsefile mode)
|
2001-09-07 12:47:30 +00:00
|
|
|
*/
|
2013-06-30 13:49:12 +01:00
|
|
|
OUString aAppFileName;
|
|
|
|
OUString aExeFileName;
|
|
|
|
osl_getExecutableFile(&aExeFileName.pData);
|
2001-09-07 12:47:30 +00:00
|
|
|
|
2013-06-30 13:49:12 +01:00
|
|
|
// convert path to native file format
|
|
|
|
osl::FileBase::getSystemPathFromFileURL(aExeFileName, aAppFileName);
|
2001-09-07 12:47:30 +00:00
|
|
|
|
|
|
|
return aAppFileName;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 Application::Exception( sal_uInt16 nError )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
switch ( nError & EXC_MAJORTYPE )
|
|
|
|
{
|
2012-07-01 21:10:41 +02:00
|
|
|
// System has precedence (so do nothing)
|
2000-09-18 16:07:07 +00:00
|
|
|
case EXC_SYSTEM:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case EXC_DISPLAY:
|
|
|
|
case EXC_REMOTE:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
case EXC_RSCNOTLOADED:
|
2013-04-07 12:06:47 +02:00
|
|
|
Abort(OUString("Resource not loaded"));
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
2013-04-07 12:06:47 +02:00
|
|
|
Abort(OUString("Unknown Error"));
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
#else
|
|
|
|
default:
|
2013-04-07 12:06:47 +02:00
|
|
|
Abort(OUString());
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-06-30 13:49:12 +01:00
|
|
|
void Application::Abort( const OUString& rErrorText )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-06-23 20:42:27 +02:00
|
|
|
//HACK: Dump core iff --norestore command line argument is given (assuming
|
2011-09-28 15:08:45 +02:00
|
|
|
// this process is run by developers who are interested in cores, vs. end
|
|
|
|
// users who are not):
|
|
|
|
bool dumpCore = false;
|
|
|
|
sal_uInt16 n = GetCommandLineParamCount();
|
|
|
|
for (sal_uInt16 i = 0; i != n; ++i) {
|
2014-12-18 13:39:25 +01:00
|
|
|
if (GetCommandLineParam(i) == "--norestore") {
|
2011-09-28 15:08:45 +02:00
|
|
|
dumpCore = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SalAbort( rErrorText, dumpCore );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-05-06 23:49:29 +10:00
|
|
|
sal_uLong Application::GetReservedKeyCodeCount()
|
2002-10-23 12:18:26 +00:00
|
|
|
{
|
2004-06-25 16:08:44 +00:00
|
|
|
return ImplReservedKeys::get()->second;
|
2002-10-23 12:18:26 +00:00
|
|
|
}
|
2002-10-25 10:43:13 +00:00
|
|
|
|
2014-08-23 22:22:32 +03:00
|
|
|
const vcl::KeyCode* Application::GetReservedKeyCode( sal_uLong i )
|
2002-10-23 11:13:22 +00:00
|
|
|
{
|
2002-10-23 12:18:26 +00:00
|
|
|
if( i >= GetReservedKeyCodeCount() )
|
|
|
|
return NULL;
|
|
|
|
else
|
2004-06-25 16:08:44 +00:00
|
|
|
return &ImplReservedKeys::get()->first[i].mKeyCode;
|
2002-10-25 10:43:13 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::Execute()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2014-02-21 12:53:51 +01:00
|
|
|
pSVData->maAppData.mbInAppExecute = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
while ( !pSVData->maAppData.mbAppQuit )
|
|
|
|
Application::Yield();
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
pSVData->maAppData.mbInAppExecute = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 13:44:30 +00:00
|
|
|
inline void ImplYield( bool i_bWait, bool i_bAllEvents )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2015-03-05 11:57:50 +00:00
|
|
|
//Process all Tasks
|
2015-02-26 07:33:59 +00:00
|
|
|
Scheduler::ProcessTaskScheduling(false);
|
2015-01-13 09:14:46 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->maAppData.mnDispatchLevel++;
|
2009-02-19 13:44:30 +00:00
|
|
|
// do not wait for events if application was already quit; in that
|
|
|
|
// case only dispatch events already available
|
|
|
|
// do not wait for events either if the app decided that it is too busy for timers
|
|
|
|
// (feature added for the slideshow)
|
|
|
|
pSVData->mpDefInst->Yield( i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, i_bAllEvents );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->maAppData.mnDispatchLevel--;
|
2007-01-23 06:07:44 +00:00
|
|
|
|
2013-10-02 23:23:46 +02:00
|
|
|
DBG_TESTSOLARMUTEX(); // must be locked on return from Yield
|
|
|
|
|
2007-01-23 06:07:44 +00:00
|
|
|
// flush lazy deleted objects
|
|
|
|
if( pSVData->maAppData.mnDispatchLevel == 0 )
|
|
|
|
vcl::LazyDelete::flush();
|
2009-02-19 13:44:30 +00:00
|
|
|
|
2014-11-10 15:05:25 +01:00
|
|
|
// the system timer events will not necessarily come in non waiting mode
|
2013-12-05 22:01:05 +02:00
|
|
|
// e.g. on OS X; need to trigger timer checks manually
|
2015-01-19 13:08:26 +00:00
|
|
|
if( pSVData->maAppData.mbNoYield )
|
2009-02-19 13:44:30 +00:00
|
|
|
{
|
2015-03-05 11:57:50 +00:00
|
|
|
//Process all timers
|
2015-02-26 07:33:59 +00:00
|
|
|
Scheduler::ProcessTaskScheduling(true);
|
2009-02-19 13:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// call post yield listeners
|
|
|
|
if( pSVData->maAppData.mpPostYieldListeners )
|
|
|
|
pSVData->maAppData.mpPostYieldListeners->callListeners( NULL );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 13:44:30 +00:00
|
|
|
void Application::Reschedule( bool i_bAllEvents )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-02-19 13:44:30 +00:00
|
|
|
ImplYield( false, i_bAllEvents );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-10 10:36:03 +01:00
|
|
|
void Application::Yield()
|
2009-02-19 13:44:30 +00:00
|
|
|
{
|
2013-07-10 10:36:03 +01:00
|
|
|
ImplYield( true, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2015-05-09 21:59:01 +02:00
|
|
|
IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplQuitMsg )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
ImplGetSVData()->maAppData.mbAppQuit = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::Quit()
|
|
|
|
{
|
2015-04-28 15:10:58 +02:00
|
|
|
Application::PostUserEvent( LINK( NULL, ImplSVAppData, ImplQuitMsg ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-14 13:15:38 +02:00
|
|
|
comphelper::SolarMutex& Application::GetSolarMutex()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return *(pSVData->mpDefInst->GetYieldMutex());
|
|
|
|
}
|
|
|
|
|
2010-10-10 21:29:08 -05:00
|
|
|
oslThreadIdentifier Application::GetMainThreadIdentifier()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplGetSVData()->mnMainThreadId;
|
|
|
|
}
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
sal_uLong Application::ReleaseSolarMutex()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return pSVData->mpDefInst->ReleaseYieldMutex();
|
|
|
|
}
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
void Application::AcquireSolarMutex( sal_uLong nCount )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->mpDefInst->AcquireYieldMutex( nCount );
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsInMain()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-06-04 10:06:17 +01:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2015-06-04 14:13:38 +02:00
|
|
|
return pSVData && pSVData->maAppData.mbInAppMain;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsInExecute()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mbInAppExecute;
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsInModalMode()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return (ImplGetSVData()->maAppData.mnModalMode != 0);
|
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 Application::GetDispatchLevel()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mnDispatchLevel;
|
|
|
|
}
|
|
|
|
|
2015-01-01 16:49:23 +02:00
|
|
|
bool Application::AnyInput( VclInputFlags nType )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-01-19 00:31:00 +09:00
|
|
|
return ImplGetSVData()->mpDefInst->AnyInput( nType );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2015-04-09 14:27:30 +02:00
|
|
|
sal_uInt64 Application::GetLastInputInterval()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-09-28 15:49:26 +02:00
|
|
|
return (tools::Time::GetSystemTicks()-ImplGetSVData()->maAppData.mnLastInputTime);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern int nImplSysDialog;
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsUICaptured()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2012-07-01 21:10:41 +02:00
|
|
|
|
|
|
|
// If mouse was captured, or if in tracking- or in select-mode of a floatingwindow (e.g. menus
|
|
|
|
// or pulldown toolboxes) another window should be created
|
|
|
|
// D&D active !!!
|
2001-02-14 07:32:01 +00:00
|
|
|
if ( pSVData->maWinData.mpCaptureWin || pSVData->maWinData.mpTrackWin ||
|
|
|
|
pSVData->maWinData.mpFirstFloat || nImplSysDialog )
|
2014-02-21 12:53:51 +01:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2014-02-21 12:53:51 +01:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-01-24 19:27:41 +11:00
|
|
|
void Application::OverrideSystemSettings( AllSettings& /*rSettings*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::MergeSystemSettings( AllSettings& rSettings )
|
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pWindow = ImplGetSVData()->maWinData.mpFirstFrame;
|
2003-04-11 16:27:47 +00:00
|
|
|
if( ! pWindow )
|
|
|
|
pWindow = ImplGetDefaultWindow();
|
2006-05-18 09:08:08 +00:00
|
|
|
if( pWindow )
|
2003-04-11 16:27:47 +00:00
|
|
|
{
|
2006-05-18 09:08:08 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData->maAppData.mbSettingsInit )
|
|
|
|
{
|
2009-09-11 11:10:31 +00:00
|
|
|
// side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
|
2006-05-18 09:08:08 +00:00
|
|
|
pWindow->ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings );
|
2014-02-21 12:53:51 +01:00
|
|
|
pSVData->maAppData.mbSettingsInit = true;
|
2006-05-18 09:08:08 +00:00
|
|
|
}
|
2009-09-11 11:10:31 +00:00
|
|
|
// side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
|
2014-02-21 12:53:51 +01:00
|
|
|
pWindow->ImplUpdateGlobalSettings( rSettings, false );
|
2003-04-11 16:27:47 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Application::SetSettings( const AllSettings& rSettings )
|
|
|
|
{
|
2014-02-22 11:02:48 +00:00
|
|
|
const SolarMutexGuard aGuard;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData->maAppData.mpSettings )
|
|
|
|
{
|
2014-10-27 12:30:28 +02:00
|
|
|
InitSettings(pSVData);
|
2000-09-18 16:07:07 +00:00
|
|
|
*pSVData->maAppData.mpSettings = rSettings;
|
2013-03-29 14:07:33 +01:00
|
|
|
ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AllSettings aOldSettings = *pSVData->maAppData.mpSettings;
|
2012-11-22 12:26:52 +01:00
|
|
|
if( aOldSettings.GetUILanguageTag().getLanguageType() != rSettings.GetUILanguageTag().getLanguageType() &&
|
|
|
|
pSVData->mpResMgr )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
|
|
|
delete pSVData->mpResMgr;
|
|
|
|
pSVData->mpResMgr = NULL;
|
|
|
|
}
|
2013-03-29 14:07:33 +01:00
|
|
|
ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag() );
|
2000-09-18 16:07:07 +00:00
|
|
|
*pSVData->maAppData.mpSettings = rSettings;
|
2015-01-12 12:55:32 +02:00
|
|
|
AllSettingsFlags nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings );
|
|
|
|
if ( bool(nChangeFlags) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-01-09 16:29:43 +02:00
|
|
|
DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, &aOldSettings, nChangeFlags );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-07-01 06:39:55 +00:00
|
|
|
// notify data change handler
|
2002-07-17 08:43:42 +00:00
|
|
|
ImplCallEventListeners( VCLEVENT_APPLICATION_DATACHANGED, NULL, &aDCEvt);
|
2002-07-01 06:39:55 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Update all windows
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pFirstFrame = pSVData->maWinData.mpFirstFrame;
|
2012-07-01 21:10:41 +02:00
|
|
|
// Reset data that needs to be re-calculated
|
2004-09-08 14:04:25 +00:00
|
|
|
long nOldDPIX = 0;
|
|
|
|
long nOldDPIY = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pFirstFrame )
|
|
|
|
{
|
2014-11-21 01:34:07 +11:00
|
|
|
nOldDPIX = pFirstFrame->GetDPIX();
|
|
|
|
nOldDPIY = pFirstFrame->GetDPIY();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window::ImplInitAppFontData(pFirstFrame);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pFrame = pFirstFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pFrame )
|
|
|
|
{
|
2012-07-01 21:10:41 +02:00
|
|
|
// restore AppFont cache data
|
2005-01-13 17:38:27 +00:00
|
|
|
pFrame->mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-07-01 21:10:41 +02:00
|
|
|
// call UpdateSettings from ClientWindow in order to prevent updating data twice
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pClientWin = pFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pClientWin->ImplGetClientWindow() )
|
|
|
|
pClientWin = pClientWin->ImplGetClientWindow();
|
2014-02-21 12:53:51 +01:00
|
|
|
pClientWin->UpdateSettings( rSettings, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pTempWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pTempWin )
|
|
|
|
{
|
2012-07-01 21:10:41 +02:00
|
|
|
// call UpdateSettings from ClientWindow in order to prevent updating data twice
|
2000-09-18 16:07:07 +00:00
|
|
|
pClientWin = pTempWin;
|
|
|
|
while ( pClientWin->ImplGetClientWindow() )
|
|
|
|
pClientWin = pClientWin->ImplGetClientWindow();
|
2014-02-21 12:53:51 +01:00
|
|
|
pClientWin->UpdateSettings( rSettings, true );
|
2005-01-13 17:38:27 +00:00
|
|
|
pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2012-07-01 21:10:41 +02:00
|
|
|
// if DPI resolution for screen output was changed set the new resolution for all
|
2013-08-20 18:26:05 +01:00
|
|
|
// screen compatible VirDev's
|
2000-09-18 16:07:07 +00:00
|
|
|
pFirstFrame = pSVData->maWinData.mpFirstFrame;
|
|
|
|
if ( pFirstFrame )
|
|
|
|
{
|
2014-11-21 01:34:07 +11:00
|
|
|
if ( (pFirstFrame->GetDPIX() != nOldDPIX) ||
|
|
|
|
(pFirstFrame->GetDPIY() != nOldDPIY) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
|
|
|
|
while ( pVirDev )
|
|
|
|
{
|
|
|
|
if ( pVirDev->mbScreenComp &&
|
2014-11-21 01:34:07 +11:00
|
|
|
(pVirDev->GetDPIX() == nOldDPIX) &&
|
|
|
|
(pVirDev->GetDPIY() == nOldDPIY) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-11-21 01:34:07 +11:00
|
|
|
pVirDev->SetDPIX( pFirstFrame->GetDPIX() );
|
|
|
|
pVirDev->SetDPIY( pFirstFrame->GetDPIY() );
|
|
|
|
if ( pVirDev->IsMapModeEnabled() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
MapMode aMapMode = pVirDev->GetMapMode();
|
|
|
|
pVirDev->SetMapMode();
|
|
|
|
pVirDev->SetMapMode( aMapMode );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pVirDev = pVirDev->mpNext;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const AllSettings& Application::GetSettings()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pSVData->maAppData.mpSettings )
|
2009-10-16 00:05:16 +02:00
|
|
|
{
|
2014-10-27 12:30:28 +02:00
|
|
|
InitSettings(pSVData);
|
2009-10-16 00:05:16 +02:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return *(pSVData->maAppData.mpSettings);
|
|
|
|
}
|
|
|
|
|
2014-10-27 12:30:28 +02:00
|
|
|
void Application::InitSettings(ImplSVData* pSVData)
|
2014-01-22 18:45:19 +11:00
|
|
|
{
|
2014-06-26 17:44:58 +01:00
|
|
|
assert(!pSVData->maAppData.mpSettings && "initialization should not happen twice!");
|
2014-01-22 18:45:19 +11:00
|
|
|
|
|
|
|
pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener;
|
|
|
|
pSVData->maAppData.mpSettings = new AllSettings();
|
|
|
|
pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Application::NotifyAllWindows( DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pFrame = pSVData->maWinData.mpFirstFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pFrame )
|
|
|
|
{
|
2011-12-07 02:33:51 -08:00
|
|
|
pFrame->NotifyAllChildren( rDCEvt );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
while ( pSysWin )
|
|
|
|
{
|
2011-12-07 02:33:51 -08:00
|
|
|
pSysWin->NotifyAllChildren( rDCEvt );
|
2005-01-13 17:38:27 +00:00
|
|
|
pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2005-01-13 17:38:27 +00:00
|
|
|
pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
void Application::ImplCallEventListeners( sal_uLong nEvent, vcl::Window *pWin, void* pData )
|
2002-07-01 06:39:55 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2002-07-17 08:43:42 +00:00
|
|
|
VclWindowEvent aEvent( pWin, nEvent, pData );
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpEventListeners )
|
2011-02-08 13:01:00 +01:00
|
|
|
pSVData->maAppData.mpEventListeners->Call( &aEvent );
|
2002-07-17 08:43:42 +00:00
|
|
|
}
|
|
|
|
|
2006-05-05 09:51:27 +00:00
|
|
|
void Application::ImplCallEventListeners( VclSimpleEvent* pEvent )
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpEventListeners )
|
2011-02-08 13:01:00 +01:00
|
|
|
pSVData->maAppData.mpEventListeners->Call( pEvent );
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::AddEventListener( const Link<>& rEventListener )
|
2002-07-17 08:43:42 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( !pSVData->maAppData.mpEventListeners )
|
|
|
|
pSVData->maAppData.mpEventListeners = new VclEventListeners;
|
2011-02-08 13:01:00 +01:00
|
|
|
pSVData->maAppData.mpEventListeners->addListener( rEventListener );
|
2002-07-17 08:43:42 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::RemoveEventListener( const Link<>& rEventListener )
|
2002-07-17 08:43:42 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( pSVData->maAppData.mpEventListeners )
|
2011-02-08 13:01:00 +01:00
|
|
|
pSVData->maAppData.mpEventListeners->removeListener( rEventListener );
|
2002-07-01 06:39:55 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::AddKeyListener( const Link<>& rKeyListener )
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( !pSVData->maAppData.mpKeyListeners )
|
|
|
|
pSVData->maAppData.mpKeyListeners = new VclEventListeners;
|
2011-02-08 13:01:00 +01:00
|
|
|
pSVData->maAppData.mpKeyListeners->addListener( rKeyListener );
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::RemoveKeyListener( const Link<>& rKeyListener )
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( pSVData->maAppData.mpKeyListeners )
|
2011-02-08 13:01:00 +01:00
|
|
|
pSVData->maAppData.mpKeyListeners->removeListener( rKeyListener );
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
bool Application::HandleKey( sal_uLong nEvent, vcl::Window *pWin, KeyEvent* pKeyEvent )
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
|
|
|
// let listeners process the key event
|
2015-06-08 16:29:41 +02:00
|
|
|
VclWindowEvent aEvent( pWin, nEvent, static_cast<void *>(pKeyEvent) );
|
2002-07-18 07:04:31 +00:00
|
|
|
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2014-02-21 12:53:51 +01:00
|
|
|
bool bProcessed = false;
|
2002-07-18 07:04:31 +00:00
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpKeyListeners )
|
2011-02-08 13:01:00 +01:00
|
|
|
bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent );
|
2002-07-18 07:04:31 +00:00
|
|
|
|
|
|
|
return bProcessed;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ImplSVEvent * Application::PostKeyEvent( sal_uLong nEvent, vcl::Window *pWin, KeyEvent* pKeyEvent )
|
2004-08-12 09:46:07 +00:00
|
|
|
{
|
2010-10-14 16:43:53 -05:00
|
|
|
const SolarMutexGuard aGuard;
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * nEventId = 0;
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
if( pWin && pKeyEvent )
|
|
|
|
{
|
|
|
|
ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, *pKeyEvent );
|
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
nEventId = PostUserEvent(
|
2015-04-28 15:10:58 +02:00
|
|
|
LINK( NULL, Application, PostEventHandler ),
|
2004-08-12 09:46:07 +00:00
|
|
|
pPostEventData );
|
|
|
|
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
pPostEventData->mnEventId = nEventId;
|
|
|
|
aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pPostEventData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nEventId;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ImplSVEvent * Application::PostMouseEvent( sal_uLong nEvent, vcl::Window *pWin, MouseEvent* pMouseEvent )
|
2004-08-12 09:46:07 +00:00
|
|
|
{
|
2010-10-14 16:43:53 -05:00
|
|
|
const SolarMutexGuard aGuard;
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * nEventId = 0;
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
if( pWin && pMouseEvent )
|
|
|
|
{
|
|
|
|
Point aTransformedPos( pMouseEvent->GetPosPixel() );
|
|
|
|
|
2014-11-21 01:34:07 +11:00
|
|
|
aTransformedPos.X() += pWin->GetOutOffXPixel();
|
|
|
|
aTransformedPos.Y() += pWin->GetOutOffYPixel();
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
const MouseEvent aTransformedEvent( aTransformedPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(),
|
|
|
|
pMouseEvent->GetButtons(), pMouseEvent->GetModifier() );
|
|
|
|
|
|
|
|
ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, aTransformedEvent );
|
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
nEventId = PostUserEvent(
|
2015-04-28 15:10:58 +02:00
|
|
|
LINK( NULL, Application, PostEventHandler ),
|
2004-08-12 09:46:07 +00:00
|
|
|
pPostEventData );
|
|
|
|
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
pPostEventData->mnEventId = nEventId;
|
|
|
|
aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pPostEventData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nEventId;
|
|
|
|
}
|
2002-10-09 10:27:24 +00:00
|
|
|
|
2013-04-19 14:04:55 +03:00
|
|
|
#if !HAVE_FEATURE_DESKTOP
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ImplSVEvent * Application::PostZoomEvent( sal_uLong nEvent, vcl::Window *pWin, ZoomEvent* pZoomEvent )
|
2013-03-02 20:58:15 +02:00
|
|
|
{
|
|
|
|
const SolarMutexGuard aGuard;
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * nEventId = 0;
|
2013-03-02 20:58:15 +02:00
|
|
|
|
|
|
|
if( pWin && pZoomEvent )
|
|
|
|
{
|
2013-03-03 01:06:17 +02:00
|
|
|
Point aTransformedPos( pZoomEvent->GetCenter() );
|
|
|
|
|
2014-11-21 01:34:07 +11:00
|
|
|
aTransformedPos.X() += pWin->GetOutOffXPixel();
|
|
|
|
aTransformedPos.Y() += pWin->GetOutOffYPixel();
|
2013-03-03 01:06:17 +02:00
|
|
|
|
|
|
|
const ZoomEvent aTransformedEvent( aTransformedPos, pZoomEvent->GetScale() );
|
|
|
|
|
|
|
|
ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, aTransformedEvent );
|
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
nEventId = PostUserEvent(
|
2015-04-28 15:10:58 +02:00
|
|
|
LINK( NULL, Application, PostEventHandler ),
|
2013-03-03 01:06:17 +02:00
|
|
|
pPostEventData );
|
|
|
|
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
pPostEventData->mnEventId = nEventId;
|
2013-03-07 10:15:28 +02:00
|
|
|
aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pPostEventData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nEventId;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
ImplSVEvent * Application::PostScrollEvent( sal_uLong nEvent, vcl::Window *pWin, ScrollEvent* pScrollEvent )
|
2013-03-07 10:15:28 +02:00
|
|
|
{
|
|
|
|
const SolarMutexGuard aGuard;
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * nEventId = 0;
|
2013-03-07 10:15:28 +02:00
|
|
|
|
|
|
|
if( pWin && pScrollEvent )
|
|
|
|
{
|
|
|
|
ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, *pScrollEvent );
|
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
nEventId = PostUserEvent(
|
2015-04-28 15:10:58 +02:00
|
|
|
LINK( NULL, Application, PostEventHandler ),
|
2013-03-07 10:15:28 +02:00
|
|
|
pPostEventData );
|
|
|
|
|
|
|
|
if( nEventId )
|
|
|
|
{
|
|
|
|
pPostEventData->mnEventId = nEventId;
|
2013-03-03 01:06:17 +02:00
|
|
|
aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
delete pPostEventData;
|
2013-03-02 20:58:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return nEventId;
|
|
|
|
}
|
|
|
|
|
2013-04-19 14:04:55 +03:00
|
|
|
#endif // !HAVE_FEATURE_DESKTOP
|
2004-08-12 09:46:07 +00:00
|
|
|
|
2015-05-09 21:35:10 +02:00
|
|
|
IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData )
|
2002-10-09 10:27:24 +00:00
|
|
|
{
|
2010-10-14 16:43:53 -05:00
|
|
|
const SolarMutexGuard aGuard;
|
2004-08-12 09:46:07 +00:00
|
|
|
ImplPostEventData* pData = static_cast< ImplPostEventData * >( pCallData );
|
|
|
|
const void* pEventData;
|
2011-01-12 15:07:10 +01:00
|
|
|
sal_uLong nEvent;
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * const nEventId = pData->mnEventId;
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
switch( pData->mnEvent )
|
2002-10-09 10:27:24 +00:00
|
|
|
{
|
2004-08-12 09:46:07 +00:00
|
|
|
case VCLEVENT_WINDOW_MOUSEMOVE:
|
|
|
|
nEvent = SALEVENT_EXTERNALMOUSEMOVE;
|
|
|
|
pEventData = &pData->maMouseEvent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
|
|
|
|
nEvent = SALEVENT_EXTERNALMOUSEBUTTONDOWN;
|
|
|
|
pEventData = &pData->maMouseEvent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VCLEVENT_WINDOW_MOUSEBUTTONUP:
|
|
|
|
nEvent = SALEVENT_EXTERNALMOUSEBUTTONUP;
|
|
|
|
pEventData = &pData->maMouseEvent;
|
|
|
|
break;
|
|
|
|
|
2002-10-09 10:27:24 +00:00
|
|
|
case VCLEVENT_WINDOW_KEYINPUT:
|
|
|
|
nEvent = SALEVENT_EXTERNALKEYINPUT;
|
2004-08-12 09:46:07 +00:00
|
|
|
pEventData = &pData->maKeyEvent;
|
|
|
|
break;
|
|
|
|
|
2002-10-09 10:27:24 +00:00
|
|
|
case VCLEVENT_WINDOW_KEYUP:
|
|
|
|
nEvent = SALEVENT_EXTERNALKEYUP;
|
2004-08-12 09:46:07 +00:00
|
|
|
pEventData = &pData->maKeyEvent;
|
|
|
|
break;
|
|
|
|
|
2013-03-03 01:06:17 +02:00
|
|
|
case VCLEVENT_WINDOW_ZOOM:
|
|
|
|
nEvent = SALEVENT_EXTERNALZOOM;
|
|
|
|
pEventData = &pData->maZoomEvent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VCLEVENT_WINDOW_SCROLL:
|
|
|
|
nEvent = SALEVENT_EXTERNALSCROLL;
|
|
|
|
pEventData = &pData->maScrollEvent;
|
|
|
|
break;
|
|
|
|
|
2002-10-09 10:27:24 +00:00
|
|
|
default:
|
2004-08-12 09:46:07 +00:00
|
|
|
nEvent = 0;
|
|
|
|
pEventData = NULL;
|
|
|
|
break;
|
2002-10-09 10:27:24 +00:00
|
|
|
};
|
2004-08-12 09:46:07 +00:00
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
if( pData->mpWin && pData->mpWin.get()->mpWindowImpl->mpFrameWindow.get() && pEventData )
|
|
|
|
ImplWindowFrameProc( pData->mpWin.get()->mpWindowImpl->mpFrameWindow.get(), NULL, (sal_uInt16) nEvent, pEventData );
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
// remove this event from list of posted events, watch for destruction of internal data
|
|
|
|
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
|
|
|
|
|
|
|
|
while( aIter != aPostedEventList.end() )
|
|
|
|
{
|
|
|
|
if( nEventId == (*aIter).second->mnEventId )
|
|
|
|
{
|
|
|
|
delete (*aIter).second;
|
|
|
|
aIter = aPostedEventList.erase( aIter );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++aIter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
void Application::RemoveMouseAndKeyEvents( vcl::Window* pWin )
|
2004-08-12 09:46:07 +00:00
|
|
|
{
|
2010-10-14 16:43:53 -05:00
|
|
|
const SolarMutexGuard aGuard;
|
2004-08-12 09:46:07 +00:00
|
|
|
|
|
|
|
// remove all events for specific window, watch for destruction of internal data
|
|
|
|
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
|
|
|
|
|
|
|
|
while( aIter != aPostedEventList.end() )
|
|
|
|
{
|
|
|
|
if( pWin == (*aIter).first )
|
|
|
|
{
|
|
|
|
if( (*aIter).second->mnEventId )
|
|
|
|
RemoveUserEvent( (*aIter).second->mnEventId );
|
|
|
|
|
|
|
|
delete (*aIter).second;
|
|
|
|
aIter = aPostedEventList.erase( aIter );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++aIter;
|
|
|
|
}
|
2002-10-09 10:27:24 +00:00
|
|
|
}
|
|
|
|
|
2015-05-07 22:08:21 +01:00
|
|
|
ImplSVEvent * Application::PostUserEvent( const Link<>& rLink, void* pCaller,
|
|
|
|
bool bReferenceLink )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVEvent* pSVEvent = new ImplSVEvent;
|
|
|
|
pSVEvent->mpData = pCaller;
|
2015-04-30 10:20:00 +02:00
|
|
|
pSVEvent->mpLink = new Link<>( rLink );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVEvent->mpWindow = NULL;
|
2014-02-21 12:53:51 +01:00
|
|
|
pSVEvent->mbCall = true;
|
2015-05-07 22:08:21 +01:00
|
|
|
if (bReferenceLink)
|
|
|
|
{
|
2015-05-08 22:09:02 +01:00
|
|
|
SolarMutexGuard aGuard;
|
2015-05-07 22:08:21 +01:00
|
|
|
// Double check that this is indeed a vcl::Window instance.
|
|
|
|
assert(dynamic_cast<vcl::Window *>(
|
2015-05-08 23:03:14 +02:00
|
|
|
static_cast<vcl::Window *>(rLink.GetInstance())) ==
|
|
|
|
static_cast<vcl::Window *>(rLink.GetInstance()));
|
|
|
|
pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance());
|
2015-05-07 22:08:21 +01:00
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pDefWindow = ImplGetDefaultWindow();
|
2014-05-07 11:49:46 +02:00
|
|
|
if ( pDefWindow == 0 || !pDefWindow->ImplGetFrame()->PostEvent( pSVEvent ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-05-07 11:49:46 +02:00
|
|
|
delete pSVEvent->mpLink;
|
2000-09-18 16:07:07 +00:00
|
|
|
delete pSVEvent;
|
2014-05-07 11:49:46 +02:00
|
|
|
pSVEvent = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-05-07 11:49:46 +02:00
|
|
|
return pSVEvent;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
void Application::RemoveUserEvent( ImplSVEvent * nUserEvent )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-03-19 11:51:05 +00:00
|
|
|
if(nUserEvent)
|
|
|
|
{
|
2014-05-07 11:49:46 +02:00
|
|
|
DBG_ASSERT( !nUserEvent->mpWindow,
|
2004-03-19 11:51:05 +00:00
|
|
|
"Application::RemoveUserEvent(): Event is send to a window" );
|
2014-05-07 11:49:46 +02:00
|
|
|
DBG_ASSERT( nUserEvent->mbCall,
|
2004-03-19 11:51:05 +00:00
|
|
|
"Application::RemoveUserEvent(): Event is already removed" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-05-07 11:49:46 +02:00
|
|
|
if ( nUserEvent->mpWindow )
|
2004-03-19 11:51:05 +00:00
|
|
|
{
|
2014-05-07 11:49:46 +02:00
|
|
|
if( ! nUserEvent->maDelData.IsDead() )
|
|
|
|
nUserEvent->mpWindow->ImplRemoveDel( &(nUserEvent->maDelData) );
|
2015-06-05 16:37:49 +01:00
|
|
|
nUserEvent->mpWindow.clear();
|
2004-03-19 11:51:05 +00:00
|
|
|
}
|
2015-06-05 16:37:49 +01:00
|
|
|
nUserEvent->mpInstanceRef.clear();
|
2014-05-07 11:49:46 +02:00
|
|
|
nUserEvent->mbCall = false;
|
2004-03-19 11:51:05 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
bool Application::InsertIdleHdl( const Link<>& rLink, sal_uInt16 nPrio )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2013-03-03 23:56:37 +11:00
|
|
|
// create if does not exist
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pSVData->maAppData.mpIdleMgr )
|
|
|
|
pSVData->maAppData.mpIdleMgr = new ImplIdleMgr;
|
|
|
|
|
|
|
|
return pSVData->maAppData.mpIdleMgr->InsertIdleHdl( rLink, nPrio );
|
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::RemoveIdleHdl( const Link<>& rLink )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpIdleMgr )
|
|
|
|
pSVData->maAppData.mpIdleMgr->RemoveIdleHdl( rLink );
|
|
|
|
}
|
|
|
|
|
2014-01-19 13:13:07 +11:00
|
|
|
void Application::EnableNoYieldMode()
|
2009-02-19 13:44:30 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2014-01-19 13:13:07 +11:00
|
|
|
pSVData->maAppData.mbNoYield = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::DisableNoYieldMode()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->maAppData.mbNoYield = false;
|
2009-02-19 13:44:30 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::AddPostYieldListener( const Link<>& i_rListener )
|
2009-02-19 13:44:30 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( ! pSVData->maAppData.mpPostYieldListeners )
|
|
|
|
pSVData->maAppData.mpPostYieldListeners = new VclEventListeners2();
|
|
|
|
pSVData->maAppData.mpPostYieldListeners->addListener( i_rListener );
|
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::RemovePostYieldListener( const Link<>& i_rListener )
|
2009-02-19 13:44:30 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( pSVData->maAppData.mpPostYieldListeners )
|
|
|
|
pSVData->maAppData.mpPostYieldListeners->removeListener( i_rListener );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
WorkWindow* Application::GetAppWindow()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maWinData.mpAppWin;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* Application::GetFocusWindow()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplGetSVData()->maWinData.mpFocusWin;
|
|
|
|
}
|
|
|
|
|
|
|
|
OutputDevice* Application::GetDefaultDevice()
|
|
|
|
{
|
|
|
|
return ImplGetDefaultWindow();
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* Application::GetFirstTopLevelWindow()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return pSVData->maWinData.mpFirstFrame;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* Application::GetNextTopLevelWindow( vcl::Window* pWindow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-01-13 17:38:27 +00:00
|
|
|
return pWindow->mpWindowImpl->mpFrameData->mpNextFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 07:04:31 +00:00
|
|
|
long Application::GetTopWindowCount()
|
|
|
|
{
|
|
|
|
long nRet = 0;
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2015-03-09 14:29:30 +02:00
|
|
|
vcl::Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame.get() : NULL;
|
2002-07-18 07:04:31 +00:00
|
|
|
while( pWin )
|
|
|
|
{
|
2002-08-13 13:04:46 +00:00
|
|
|
if( pWin->ImplGetWindow()->IsTopWindow() )
|
2002-07-18 07:04:31 +00:00
|
|
|
nRet++;
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* Application::GetTopWindow( long nIndex )
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
|
|
|
long nIdx = 0;
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2015-03-09 14:29:30 +02:00
|
|
|
vcl::Window *pWin = pSVData ? pSVData->maWinData.mpFirstFrame.get() : NULL;
|
2002-07-18 07:04:31 +00:00
|
|
|
while( pWin )
|
|
|
|
{
|
2002-08-13 13:04:46 +00:00
|
|
|
if( pWin->ImplGetWindow()->IsTopWindow() )
|
2008-12-11 07:05:03 +00:00
|
|
|
{
|
2002-07-18 07:04:31 +00:00
|
|
|
if( nIdx == nIndex )
|
2002-08-13 13:04:46 +00:00
|
|
|
return pWin->ImplGetWindow();
|
2002-07-18 07:04:31 +00:00
|
|
|
else
|
|
|
|
nIdx++;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* Application::GetActiveTopWindow()
|
2002-07-18 07:04:31 +00:00
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = ImplGetSVData()->maWinData.mpFocusWin;
|
2002-07-18 07:04:31 +00:00
|
|
|
while( pWin )
|
|
|
|
{
|
|
|
|
if( pWin->IsTopWindow() )
|
|
|
|
return pWin;
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpParent;
|
2002-07-18 07:04:31 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-24 16:43:46 +02:00
|
|
|
void Application::SetAppName( const OUString& rUniqueName )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2013-03-03 23:56:37 +11:00
|
|
|
// create if does not exist
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pSVData->maAppData.mpAppName )
|
2013-07-24 16:43:46 +02:00
|
|
|
pSVData->maAppData.mpAppName = new OUString( rUniqueName );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
*(pSVData->maAppData.mpAppName) = rUniqueName;
|
|
|
|
}
|
|
|
|
|
2013-07-24 16:43:46 +02:00
|
|
|
OUString Application::GetAppName()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( pSVData->maAppData.mpAppName )
|
|
|
|
return *(pSVData->maAppData.mpAppName);
|
|
|
|
else
|
2013-09-08 17:34:06 +01:00
|
|
|
return OUString();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-02-21 03:54:57 +05:30
|
|
|
void Application::SetDisplayName( const OUString& rName )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2013-03-03 23:56:37 +11:00
|
|
|
// create if does not exist
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pSVData->maAppData.mpDisplayName )
|
2013-02-21 03:54:57 +05:30
|
|
|
pSVData->maAppData.mpDisplayName = new OUString( rName );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
*(pSVData->maAppData.mpDisplayName) = rName;
|
|
|
|
}
|
|
|
|
|
2013-02-21 03:54:57 +05:30
|
|
|
OUString Application::GetDisplayName()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( pSVData->maAppData.mpDisplayName )
|
|
|
|
return *(pSVData->maAppData.mpDisplayName);
|
|
|
|
else if ( pSVData->maWinData.mpAppWin )
|
|
|
|
return pSVData->maWinData.mpAppWin->GetText();
|
|
|
|
else
|
2013-07-24 16:43:46 +02:00
|
|
|
return OUString("");
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-07-26 08:11:18 +00:00
|
|
|
unsigned int Application::GetScreenCount()
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetDisplayScreenCount() : 0;
|
|
|
|
}
|
|
|
|
|
2012-01-14 10:31:40 +00:00
|
|
|
bool Application::IsUnifiedDisplay()
|
2006-10-06 08:58:12 +00:00
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
2015-04-24 12:34:53 +02:00
|
|
|
return pSys == nullptr || pSys->IsUnifiedDisplay();
|
2006-10-06 08:58:12 +00:00
|
|
|
}
|
|
|
|
|
2012-05-30 10:15:27 +01:00
|
|
|
unsigned int Application::GetDisplayBuiltInScreen()
|
2006-10-06 08:58:12 +00:00
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
2012-05-30 10:15:27 +01:00
|
|
|
return pSys ? pSys->GetDisplayBuiltInScreen() : 0;
|
2006-10-06 08:58:12 +00:00
|
|
|
}
|
|
|
|
|
2012-12-11 14:59:39 +02:00
|
|
|
unsigned int Application::GetDisplayExternalScreen()
|
|
|
|
{
|
|
|
|
// This is really unpleasant, in theory we could have multiple
|
|
|
|
// external displays etc.
|
|
|
|
int nExternal(0);
|
|
|
|
switch (GetDisplayBuiltInScreen())
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
nExternal = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
nExternal = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// When the built-in display is neither 0 nor 1
|
|
|
|
// then place the full-screen presentation on the
|
|
|
|
// first available screen.
|
|
|
|
nExternal = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nExternal;
|
|
|
|
}
|
|
|
|
|
2006-07-26 08:11:18 +00:00
|
|
|
Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen )
|
|
|
|
{
|
|
|
|
SalSystem* pSys = ImplGetSalSystem();
|
|
|
|
return pSys ? pSys->GetDisplayScreenPosSizePixel( nScreen ) : Rectangle();
|
|
|
|
}
|
|
|
|
|
2007-04-26 09:35:36 +00:00
|
|
|
namespace {
|
|
|
|
unsigned long calcDistSquare( const Point& i_rPoint, const Rectangle& i_rRect )
|
|
|
|
{
|
|
|
|
const Point aRectCenter( (i_rRect.Left() + i_rRect.Right())/2,
|
|
|
|
(i_rRect.Top() + i_rRect.Bottom())/ 2 );
|
|
|
|
const long nDX = aRectCenter.X() - i_rPoint.X();
|
|
|
|
const long nDY = aRectCenter.Y() - i_rPoint.Y();
|
|
|
|
return nDX*nDX + nDY*nDY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Application::GetBestScreen( const Rectangle& i_rRect )
|
|
|
|
{
|
2012-01-14 10:31:40 +00:00
|
|
|
if( !IsUnifiedDisplay() )
|
2012-05-30 10:15:27 +01:00
|
|
|
return GetDisplayBuiltInScreen();
|
2007-04-26 09:35:36 +00:00
|
|
|
|
|
|
|
const unsigned int nScreens = GetScreenCount();
|
|
|
|
unsigned int nBestMatchScreen = 0;
|
|
|
|
unsigned long nOverlap = 0;
|
|
|
|
for( unsigned int i = 0; i < nScreens; i++ )
|
|
|
|
{
|
|
|
|
const Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) );
|
|
|
|
// if a screen contains the rectangle completely it is obviously the best screen
|
|
|
|
if( aCurScreenRect.IsInside( i_rRect ) )
|
|
|
|
return i;
|
|
|
|
// next the screen which contains most of the area of the rect is the best
|
|
|
|
Rectangle aIntersection( aCurScreenRect.GetIntersection( i_rRect ) );
|
|
|
|
if( ! aIntersection.IsEmpty() )
|
|
|
|
{
|
|
|
|
const unsigned long nCurOverlap( aIntersection.GetWidth() * aIntersection.GetHeight() );
|
|
|
|
if( nCurOverlap > nOverlap )
|
|
|
|
{
|
|
|
|
nOverlap = nCurOverlap;
|
|
|
|
nBestMatchScreen = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( nOverlap > 0 )
|
|
|
|
return nBestMatchScreen;
|
|
|
|
|
|
|
|
// finally the screen which center is nearest to the rect is the best
|
|
|
|
const Point aCenter( (i_rRect.Left() + i_rRect.Right())/2,
|
|
|
|
(i_rRect.Top() + i_rRect.Bottom())/2 );
|
|
|
|
unsigned long nDist = ULONG_MAX;
|
|
|
|
for( unsigned int i = 0; i < nScreens; i++ )
|
|
|
|
{
|
|
|
|
const Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) );
|
|
|
|
const unsigned long nCurDist( calcDistSquare( aCenter, aCurScreenRect ) );
|
|
|
|
if( nCurDist < nDist )
|
|
|
|
{
|
|
|
|
nBestMatchScreen = i;
|
|
|
|
nDist = nCurDist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nBestMatchScreen;
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::InsertAccel( Accelerator* pAccel )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( !pSVData->maAppData.mpAccelMgr )
|
|
|
|
pSVData->maAppData.mpAccelMgr = new ImplAccelManager();
|
|
|
|
return pSVData->maAppData.mpAccelMgr->InsertAccel( pAccel );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::RemoveAccel( Accelerator* pAccel )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpAccelMgr )
|
|
|
|
pSVData->maAppData.mpAccelMgr->RemoveAccel( pAccel );
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::SetHelp( Help* pHelp )
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.mpHelp = pHelp;
|
|
|
|
}
|
|
|
|
|
|
|
|
Help* Application::GetHelp()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mpHelp;
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
void Application::EnableAutoHelpId( bool bEnabled )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplGetSVData()->maHelpData.mbAutoHelpId = bEnabled;
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsAutoHelpIdEnabled()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplGetSVData()->maHelpData.mbAutoHelpId;
|
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
void Application::EnableAutoMnemonic( bool bEnabled )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-10-18 12:58:20 +00:00
|
|
|
AllSettings aSettings = GetSettings();
|
|
|
|
StyleSettings aStyle = aSettings.GetStyleSettings();
|
|
|
|
aStyle.SetAutoMnemonic( bEnabled );
|
|
|
|
aSettings.SetStyleSettings( aStyle );
|
|
|
|
SetSettings( aSettings );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsAutoMnemonicEnabled()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-10-18 12:58:20 +00:00
|
|
|
return GetSettings().GetStyleSettings().GetAutoMnemonic();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Application::SetDialogScaleX( short nScale )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->maAppData.mnDialogScaleX = nScale;
|
|
|
|
pSVData->maGDIData.mnAppFontX = pSVData->maGDIData.mnRealAppFontX;
|
|
|
|
if ( nScale )
|
|
|
|
pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*nScale)/100;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
void Application::SetDefDialogParent( vcl::Window* pWindow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplGetSVData()->maWinData.mpDefDialogParent = pWindow;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* Application::GetDefDialogParent()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-10-22 08:39:05 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
// #103442# find some useful dialog parent if there
|
|
|
|
// was no default set
|
|
|
|
// NOTE: currently even the default is not used
|
2015-03-09 14:29:30 +02:00
|
|
|
if( false && pSVData->maWinData.mpDefDialogParent.get() != NULL )
|
2002-10-22 08:39:05 +00:00
|
|
|
return pSVData->maWinData.mpDefDialogParent;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// always use the topmost parent of the candidate
|
|
|
|
// window to avoid using dialogs or floaters
|
|
|
|
// as DefDialogParent
|
|
|
|
|
|
|
|
// current focus frame
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window *pWin = NULL;
|
2006-05-05 07:59:51 +00:00
|
|
|
if( (pWin = pSVData->maWinData.mpFocusWin) != NULL )
|
2002-10-22 08:39:05 +00:00
|
|
|
{
|
2005-11-01 11:58:43 +00:00
|
|
|
while( pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent )
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpParent;
|
2005-11-01 11:58:43 +00:00
|
|
|
|
2014-02-13 10:21:23 +02:00
|
|
|
// check for corrupted window hierarchy, #122232#, may be we now crash somewhere else
|
|
|
|
if( !pWin->mpWindowImpl )
|
2005-11-01 11:58:43 +00:00
|
|
|
{
|
2014-02-13 10:21:23 +02:00
|
|
|
OSL_FAIL( "Window hierarchy corrupted!" );
|
|
|
|
pSVData->maWinData.mpFocusWin = NULL; // avoid further access
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-11-01 11:58:43 +00:00
|
|
|
|
2014-02-13 10:21:23 +02:00
|
|
|
if( (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
|
|
|
|
{
|
2013-03-03 15:24:09 +01:00
|
|
|
return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
|
2006-05-05 07:59:51 +00:00
|
|
|
}
|
2002-10-22 08:39:05 +00:00
|
|
|
}
|
2003-04-11 16:27:47 +00:00
|
|
|
// last active application frame
|
2006-06-19 18:14:25 +00:00
|
|
|
if( NULL != (pWin = pSVData->maWinData.mpActiveApplicationFrame) )
|
2003-04-11 16:27:47 +00:00
|
|
|
{
|
2005-01-13 17:38:27 +00:00
|
|
|
return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
|
2003-04-11 16:27:47 +00:00
|
|
|
}
|
2002-10-22 08:39:05 +00:00
|
|
|
else
|
|
|
|
{
|
2003-04-11 16:27:47 +00:00
|
|
|
// first visible top window (may be totally wrong....)
|
2002-10-22 08:39:05 +00:00
|
|
|
pWin = pSVData->maWinData.mpFirstFrame;
|
|
|
|
while( pWin )
|
|
|
|
{
|
2006-05-05 07:59:51 +00:00
|
|
|
if( pWin->ImplGetWindow()->IsTopWindow() &&
|
|
|
|
pWin->mpWindowImpl->mbReallyVisible &&
|
|
|
|
(pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0
|
|
|
|
)
|
2002-10-22 08:39:05 +00:00
|
|
|
{
|
2005-01-13 17:38:27 +00:00
|
|
|
while( pWin->mpWindowImpl->mpParent )
|
|
|
|
pWin = pWin->mpWindowImpl->mpParent;
|
|
|
|
return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
|
2002-10-22 08:39:05 +00:00
|
|
|
}
|
2005-01-13 17:38:27 +00:00
|
|
|
pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
|
2002-10-22 08:39:05 +00:00
|
|
|
}
|
|
|
|
// use the desktop
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-06 20:27:29 +01:00
|
|
|
Application::DialogCancelMode Application::GetDialogCancelMode()
|
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.meDialogCancel;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::SetDialogCancelMode( DialogCancelMode mode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-12-06 20:27:29 +01:00
|
|
|
ImplGetSVData()->maAppData.meDialogCancel = mode;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsDialogCancelEnabled()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-12-06 20:27:29 +01:00
|
|
|
return ImplGetSVData()->maAppData.meDialogCancel != DIALOG_CANCEL_OFF;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 14:57:27 +02:00
|
|
|
void Application::SetSystemWindowMode( SystemWindowFlags nMode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.mnSysWinMode = nMode;
|
|
|
|
}
|
|
|
|
|
2015-01-08 14:57:27 +02:00
|
|
|
SystemWindowFlags Application::GetSystemWindowMode()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return ImplGetSVData()->maAppData.mnSysWinMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > Application::GetVCLToolkit()
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xT;
|
2014-02-21 12:53:51 +01:00
|
|
|
UnoWrapperBase* pWrapper = Application::GetUnoWrapper( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pWrapper )
|
|
|
|
xT = pWrapper->GetVCLToolkit();
|
|
|
|
return xT;
|
|
|
|
}
|
|
|
|
|
2012-04-17 23:53:34 +03:00
|
|
|
#ifdef DISABLE_DYNLOADING
|
|
|
|
|
|
|
|
extern "C" { UnoWrapperBase* CreateUnoWrapper(); }
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2007-10-15 12:07:17 +00:00
|
|
|
extern "C" { static void SAL_CALL thisModule() {} }
|
|
|
|
|
2012-04-17 23:53:34 +03:00
|
|
|
#endif
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
UnoWrapperBase* Application::GetUnoWrapper( bool bCreateIfNotExist )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-15 10:33:48 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2013-05-09 05:59:52 +09:00
|
|
|
static bool bAlreadyTriedToCreate = false;
|
2001-03-15 10:33:48 +00:00
|
|
|
if ( !pSVData->mpUnoWrapper && bCreateIfNotExist && !bAlreadyTriedToCreate )
|
|
|
|
{
|
2012-04-17 23:53:34 +03:00
|
|
|
#ifndef DISABLE_DYNLOADING
|
2014-10-02 11:15:56 +01:00
|
|
|
osl::Module aTkLib;
|
2015-01-08 21:14:04 +01:00
|
|
|
OUString aLibName(TK_DLL_NAME);
|
2014-10-02 11:15:56 +01:00
|
|
|
aTkLib.loadRelative(&thisModule, aLibName, SAL_LOADMODULE_DEFAULT);
|
|
|
|
if (aTkLib.is())
|
2001-03-15 10:33:48 +00:00
|
|
|
{
|
2015-01-19 15:10:10 +01:00
|
|
|
FN_TkCreateUnoWrapper fnCreateWrapper = reinterpret_cast<FN_TkCreateUnoWrapper>(aTkLib.getFunctionSymbol("CreateUnoWrapper"));
|
2001-03-15 10:33:48 +00:00
|
|
|
if ( fnCreateWrapper )
|
|
|
|
{
|
|
|
|
pSVData->mpUnoWrapper = fnCreateWrapper();
|
|
|
|
}
|
2014-10-06 11:28:37 +03:00
|
|
|
aTkLib.release();
|
2001-03-15 10:33:48 +00:00
|
|
|
}
|
|
|
|
DBG_ASSERT( pSVData->mpUnoWrapper, "UnoWrapper could not be created!" );
|
2012-04-17 23:53:34 +03:00
|
|
|
#else
|
|
|
|
pSVData->mpUnoWrapper = CreateUnoWrapper();
|
|
|
|
#endif
|
2013-05-09 05:59:52 +09:00
|
|
|
bAlreadyTriedToCreate = true;
|
2001-03-15 10:33:48 +00:00
|
|
|
}
|
|
|
|
return pSVData->mpUnoWrapper;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Application::SetUnoWrapper( UnoWrapperBase* pWrapper )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2013-04-15 05:10:29 +02:00
|
|
|
DBG_ASSERT( !pSVData->mpUnoWrapper, "SetUnoWrapper: Wrapper already exists" );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->mpUnoWrapper = pWrapper;
|
|
|
|
}
|
|
|
|
|
2001-02-01 13:08:06 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > Application::GetDisplayConnection()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2006-10-13 07:30:41 +00:00
|
|
|
|
|
|
|
if( !pSVData->mxDisplayConnection.is() )
|
2010-12-13 13:42:14 +01:00
|
|
|
{
|
2015-04-28 23:09:13 +03:00
|
|
|
pSVData->mxDisplayConnection.set( new vcl::DisplayConnection );
|
2010-12-13 13:42:14 +01:00
|
|
|
pSVData->mxDisplayConnection->start();
|
|
|
|
}
|
2006-10-13 07:30:41 +00:00
|
|
|
|
2010-12-13 13:42:14 +01:00
|
|
|
return pSVData->mxDisplayConnection.get();
|
2001-02-01 13:08:06 +00:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::SetFilterHdl( const Link<>& rLink )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplGetSVData()->maGDIData.mpGrfConverter->SetFilterHdl( rLink );
|
|
|
|
}
|
|
|
|
|
2014-08-23 22:22:32 +03:00
|
|
|
bool ImplCallHotKey( const vcl::KeyCode& rKeyCode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
|
|
|
|
while ( pHotKeyData )
|
|
|
|
{
|
2014-10-31 07:59:33 +02:00
|
|
|
if ( pHotKeyData->maKeyCode == rKeyCode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pHotKeyData->maLink.Call( pHotKeyData->mpUserData );
|
2013-05-09 05:59:52 +09:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pHotKeyData = pHotKeyData->mpNext;
|
|
|
|
}
|
|
|
|
|
2013-05-09 05:59:52 +09:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ImplFreeHotKeyData()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplHotKey* pTempHotKeyData;
|
|
|
|
ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
|
|
|
|
while ( pHotKeyData )
|
|
|
|
{
|
|
|
|
pTempHotKeyData = pHotKeyData->mpNext;
|
|
|
|
delete pHotKeyData;
|
|
|
|
pHotKeyData = pTempHotKeyData;
|
|
|
|
}
|
|
|
|
|
|
|
|
pSVData->maAppData.mpFirstHotKey = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImplFreeEventHookData()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplEventHook* pTempEventHookData;
|
|
|
|
ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
|
|
|
|
while ( pEventHookData )
|
|
|
|
{
|
|
|
|
pTempEventHookData = pEventHookData->mpNext;
|
|
|
|
delete pEventHookData;
|
|
|
|
pEventHookData = pTempEventHookData;
|
|
|
|
}
|
|
|
|
|
|
|
|
pSVData->maAppData.mpFirstEventHook = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
long Application::CallEventHooks( NotifyEvent& rEvt )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
long nRet = 0;
|
|
|
|
ImplEventHook* pTempEventHookData;
|
|
|
|
ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
|
|
|
|
while ( pEventHookData )
|
|
|
|
{
|
|
|
|
pTempEventHookData = pEventHookData->mpNext;
|
|
|
|
nRet = pEventHookData->mpProc( rEvt, pEventHookData->mpUserData );
|
|
|
|
if ( nRet )
|
|
|
|
break;
|
|
|
|
pEventHookData = pTempEventHookData;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2006-04-07 14:29:41 +00:00
|
|
|
const LocaleDataWrapper& Application::GetAppLocaleDataWrapper()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-04-07 14:29:41 +00:00
|
|
|
return GetSettings().GetLocaleDataWrapper();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-12-06 20:27:29 +01:00
|
|
|
void Application::EnableHeadlessMode( bool dialogsAreFatal )
|
2000-10-23 05:44:59 +00:00
|
|
|
{
|
2011-12-06 20:27:29 +01:00
|
|
|
SetDialogCancelMode(
|
|
|
|
dialogsAreFatal ? DIALOG_CANCEL_FATAL : DIALOG_CANCEL_SILENT );
|
2000-10-23 05:44:59 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
bool Application::IsHeadlessModeEnabled()
|
2000-10-23 05:44:59 +00:00
|
|
|
{
|
|
|
|
return IsDialogCancelEnabled();
|
|
|
|
}
|
|
|
|
|
2013-06-04 18:29:42 +01:00
|
|
|
static bool bConsoleOnly = false;
|
|
|
|
|
|
|
|
bool Application::IsConsoleOnly()
|
|
|
|
{
|
|
|
|
return bConsoleOnly;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Application::EnableConsoleOnly()
|
|
|
|
{
|
2015-03-28 15:40:56 +02:00
|
|
|
EnableHeadlessMode(true);
|
2013-06-04 18:29:42 +01:00
|
|
|
bConsoleOnly = true;
|
|
|
|
}
|
|
|
|
|
2013-08-05 15:56:03 +02:00
|
|
|
void Application::ShowNativeErrorBox(const OUString& sTitle ,
|
|
|
|
const OUString& sMessage)
|
2008-07-08 07:13:31 +00:00
|
|
|
{
|
2010-04-06 16:53:43 +02:00
|
|
|
int btn = ImplGetSalSystem()->ShowNativeMessageBox (
|
2008-07-08 07:13:31 +00:00
|
|
|
sTitle,
|
|
|
|
sMessage,
|
|
|
|
SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK,
|
2012-09-18 12:40:57 +02:00
|
|
|
SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, false);
|
2010-04-06 16:53:43 +02:00
|
|
|
if (btn != SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK) {
|
2011-09-20 10:18:12 +02:00
|
|
|
OSL_TRACE("ShowNativeMessageBox returned %d", btn);
|
2010-04-06 16:53:43 +02:00
|
|
|
}
|
2008-07-08 07:13:31 +00:00
|
|
|
}
|
|
|
|
|
2002-11-26 14:37:09 +00:00
|
|
|
bool Application::CanToggleImeStatusWindow()
|
2001-11-27 08:49:18 +00:00
|
|
|
{
|
2003-11-18 13:31:58 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( ! pSVData->mpImeStatus )
|
|
|
|
pSVData->mpImeStatus = pSVData->mpDefInst->CreateI18NImeStatus();
|
|
|
|
return pSVData->mpImeStatus->canToggle();
|
2002-11-26 14:37:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Application::ShowImeStatusWindow(bool bShow)
|
|
|
|
{
|
|
|
|
ImplGetSVData()->maAppData.meShowImeStatusWindow = bShow
|
|
|
|
? ImplSVAppData::ImeStatusWindowMode_SHOW
|
|
|
|
: ImplSVAppData::ImeStatusWindowMode_HIDE;
|
2003-11-18 13:31:58 +00:00
|
|
|
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if( ! pSVData->mpImeStatus )
|
|
|
|
pSVData->mpImeStatus = pSVData->mpDefInst->CreateI18NImeStatus();
|
|
|
|
pSVData->mpImeStatus->toggle();
|
2001-11-27 08:49:18 +00:00
|
|
|
}
|
|
|
|
|
2002-11-26 14:37:09 +00:00
|
|
|
bool Application::GetShowImeStatusWindowDefault()
|
|
|
|
{
|
|
|
|
rtl_TextEncodingInfo aInfo;
|
|
|
|
aInfo.StructSize = sizeof aInfo;
|
|
|
|
return rtl_getTextEncodingInfo(osl_getThreadTextEncoding(), &aInfo)
|
|
|
|
&& aInfo.MaximumCharSize > 1;
|
|
|
|
}
|
2001-11-27 08:49:18 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& Application::GetDesktopEnvironment()
|
2004-05-10 11:57:57 +00:00
|
|
|
{
|
2014-06-28 14:19:30 +01:00
|
|
|
if (IsHeadlessModeEnabled())
|
|
|
|
{
|
|
|
|
static OUString aNone("none");
|
|
|
|
return aNone;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return SalGetDesktopEnvironment();
|
2004-05-10 11:57:57 +00:00
|
|
|
}
|
|
|
|
|
2013-07-28 13:53:02 +02:00
|
|
|
void Application::AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService)
|
2009-10-01 09:16:17 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2013-07-28 13:53:02 +02:00
|
|
|
pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType, rDocumentService);
|
2009-10-01 09:16:17 +00:00
|
|
|
}
|
|
|
|
|
2013-11-26 15:05:51 +01:00
|
|
|
bool InitAccessBridge()
|
2003-04-11 16:27:47 +00:00
|
|
|
{
|
2013-11-26 15:05:51 +01:00
|
|
|
// Disable MSAA bridge on UNIX
|
2006-06-19 18:14:25 +00:00
|
|
|
#if defined UNX
|
2013-09-27 23:21:12 +02:00
|
|
|
return true;
|
2006-06-19 18:14:25 +00:00
|
|
|
#else
|
2013-11-26 15:05:51 +01:00
|
|
|
bool bRet = ImplInitAccessBridge();
|
2006-05-05 09:51:27 +00:00
|
|
|
|
2013-11-26 15:05:51 +01:00
|
|
|
if( !bRet )
|
2003-04-11 16:27:47 +00:00
|
|
|
{
|
|
|
|
// disable accessibility if the user chooses to continue
|
|
|
|
AllSettings aSettings = Application::GetSettings();
|
|
|
|
MiscSettings aMisc = aSettings.GetMiscSettings();
|
2014-02-24 01:53:13 +11:00
|
|
|
aMisc.SetEnableATToolSupport( false );
|
2003-04-11 16:27:47 +00:00
|
|
|
aSettings.SetMiscSettings( aMisc );
|
|
|
|
Application::SetSettings( aSettings );
|
|
|
|
}
|
|
|
|
return bRet;
|
2013-09-27 23:21:12 +02:00
|
|
|
#endif // !UNX
|
2003-04-11 16:27:47 +00:00
|
|
|
}
|
2004-01-06 12:13:36 +00:00
|
|
|
|
2013-02-27 10:45:45 +02:00
|
|
|
// MT: AppEvent was in oldsv.cxx, but is still needed...
|
2006-06-19 18:14:25 +00:00
|
|
|
void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
|
2004-01-06 12:13:36 +00:00
|
|
|
{
|
|
|
|
}
|
2010-10-14 08:27:31 +02:00
|
|
|
|
2011-11-04 21:04:18 +00:00
|
|
|
bool Application::hasNativeFileSelection()
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return pSVData->mpDefInst->hasNativeFileSelection();
|
|
|
|
}
|
|
|
|
|
2011-11-04 14:40:18 +00:00
|
|
|
Reference< ui::dialogs::XFilePicker2 >
|
2014-01-08 09:08:08 +01:00
|
|
|
Application::createFilePicker( const Reference< uno::XComponentContext >& xSM )
|
2011-11-04 14:40:18 +00:00
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
2014-01-08 09:08:08 +01:00
|
|
|
return pSVData->mpDefInst->createFilePicker( xSM );
|
2011-11-04 14:40:18 +00:00
|
|
|
}
|
|
|
|
|
2012-11-27 10:39:28 +01:00
|
|
|
Reference< ui::dialogs::XFolderPicker2 >
|
2011-11-04 14:40:18 +00:00
|
|
|
Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM )
|
|
|
|
{
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
return pSVData->mpDefInst->createFolderPicker( xSM );
|
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void Application::setDeInitHook(Link<> const & hook) {
|
2014-06-04 08:45:54 +02:00
|
|
|
ImplSVData * pSVData = ImplGetSVData();
|
|
|
|
assert(!pSVData->maDeInitHook.IsSet());
|
|
|
|
pSVData->maDeInitHook = hook;
|
|
|
|
// Fake this for VCLXToolkit ctor instantiated from
|
|
|
|
// postprocess/CppunitTest_services.mk:
|
|
|
|
pSVData->maAppData.mbInAppMain = true;
|
|
|
|
}
|
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
ImplDelData::ImplDelData( vcl::Window* pWindow ) :
|
|
|
|
mpNext( NULL ),
|
|
|
|
mpWindow( NULL ),
|
|
|
|
mbDel( false )
|
|
|
|
{
|
|
|
|
if( pWindow ) AttachToWindow( pWindow );
|
|
|
|
}
|
|
|
|
|
2014-05-11 14:07:37 +10:00
|
|
|
// helper method to allow inline constructor even for pWindow!=NULL case
|
2014-09-23 11:20:40 +02:00
|
|
|
void ImplDelData::AttachToWindow( const vcl::Window* pWindow )
|
2014-05-11 14:07:37 +10:00
|
|
|
{
|
|
|
|
if( pWindow )
|
2015-02-14 21:11:52 +00:00
|
|
|
{
|
|
|
|
if( pWindow->IsDisposed() )
|
|
|
|
mbDel = true;
|
|
|
|
else
|
|
|
|
const_cast<vcl::Window*>(pWindow)->ImplAddDel( this );
|
|
|
|
}
|
2014-05-11 14:07:37 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
// define dtor for ImplDelData
|
|
|
|
ImplDelData::~ImplDelData()
|
|
|
|
{
|
|
|
|
// #112873# auto remove of ImplDelData
|
|
|
|
// due to this code actively calling ImplRemoveDel() is not mandatory anymore
|
|
|
|
if( !mbDel && mpWindow )
|
|
|
|
{
|
|
|
|
// the window still exists but we were not removed
|
2015-05-29 12:05:03 +02:00
|
|
|
mpWindow.get()->ImplRemoveDel( this );
|
2014-05-11 14:07:37 +10:00
|
|
|
mpWindow = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|