summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/app/i18n_cb.cxx18
-rw-r--r--vcl/unx/generic/app/i18n_ic.cxx12
-rw-r--r--vcl/unx/generic/app/i18n_im.cxx2
-rw-r--r--vcl/unx/generic/app/i18n_keysym.cxx3
-rw-r--r--vcl/unx/generic/app/i18n_status.cxx4
-rw-r--r--vcl/unx/generic/app/i18n_wrp.cxx2
-rw-r--r--vcl/unx/generic/app/i18n_xkb.cxx2
-rw-r--r--vcl/unx/generic/app/keysymnames.cxx118
-rw-r--r--vcl/unx/generic/app/randrwrapper.cxx3
-rw-r--r--vcl/unx/generic/app/saldata.cxx30
-rw-r--r--vcl/unx/generic/app/saldisp.cxx244
-rw-r--r--vcl/unx/generic/app/salinst.cxx25
-rw-r--r--vcl/unx/generic/app/salsys.cxx3
-rw-r--r--vcl/unx/generic/app/saltimer.cxx2
-rw-r--r--vcl/unx/generic/app/sm.cxx25
-rw-r--r--vcl/unx/generic/app/soicon.cxx2
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx17
-rw-r--r--vcl/unx/generic/desktopdetect/desktopdetector.cxx47
-rw-r--r--vcl/unx/generic/dtrans/X11_clipboard.cxx15
-rw-r--r--vcl/unx/generic/dtrans/X11_clipboard.hxx7
-rw-r--r--vcl/unx/generic/dtrans/X11_dndcontext.cxx3
-rw-r--r--vcl/unx/generic/dtrans/X11_dndcontext.hxx3
-rw-r--r--vcl/unx/generic/dtrans/X11_droptarget.cxx7
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx326
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.hxx21
-rw-r--r--vcl/unx/generic/dtrans/X11_service.cxx19
-rw-r--r--vcl/unx/generic/dtrans/X11_transferable.cxx14
-rw-r--r--vcl/unx/generic/dtrans/X11_transferable.hxx5
-rw-r--r--vcl/unx/generic/dtrans/bmp.cxx7
-rw-r--r--vcl/unx/generic/dtrans/bmp.hxx3
-rw-r--r--vcl/unx/generic/dtrans/config.cxx9
-rw-r--r--vcl/unx/generic/dtrans/copydata_curs.h5
-rw-r--r--vcl/unx/generic/dtrans/copydata_mask.h5
-rw-r--r--vcl/unx/generic/dtrans/linkdata_curs.h5
-rw-r--r--vcl/unx/generic/dtrans/linkdata_mask.h5
-rw-r--r--vcl/unx/generic/dtrans/movedata_curs.h5
-rw-r--r--vcl/unx/generic/dtrans/movedata_mask.h5
-rw-r--r--vcl/unx/generic/dtrans/nodrop_curs.h5
-rw-r--r--vcl/unx/generic/dtrans/nodrop_mask.h5
-rwxr-xr-xvcl/unx/generic/fontmanager/afm_hash.cpp245
-rwxr-xr-xvcl/unx/generic/fontmanager/afm_keyword_list6
-rw-r--r--vcl/unx/generic/fontmanager/fontcache.cxx8
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx402
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx210
-rw-r--r--vcl/unx/generic/fontmanager/helper.cxx11
-rw-r--r--vcl/unx/generic/fontmanager/parseAFM.cxx95
-rw-r--r--vcl/unx/generic/fontmanager/parseAFM.hxx3
-rw-r--r--vcl/unx/generic/gdi/cdeint.cxx13
-rw-r--r--vcl/unx/generic/gdi/dtint.cxx6
-rw-r--r--vcl/unx/generic/gdi/dtsetenum.hxx3
-rw-r--r--vcl/unx/generic/gdi/gcach_xpeer.cxx2
-rw-r--r--vcl/unx/generic/gdi/gcach_xpeer.hxx3
-rw-r--r--vcl/unx/generic/gdi/pspgraphics.cxx64
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx76
-rw-r--r--vcl/unx/generic/gdi/salcvt.cxx2
-rw-r--r--vcl/unx/generic/gdi/salcvt.hxx2
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx92
-rw-r--r--vcl/unx/generic/gdi/salgdi2.cxx37
-rw-r--r--vcl/unx/generic/gdi/salgdi3.cxx129
-rw-r--r--vcl/unx/generic/gdi/salprnpsp.cxx85
-rw-r--r--vcl/unx/generic/gdi/salvd.cxx16
-rw-r--r--vcl/unx/generic/gdi/xrender_peer.cxx11
-rw-r--r--vcl/unx/generic/gdi/xrender_peer.hxx13
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx28
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx38
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx119
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx61
-rw-r--r--vcl/unx/generic/printergfx/bitmap_gfx.cxx3
-rw-r--r--vcl/unx/generic/printergfx/common_gfx.cxx27
-rw-r--r--vcl/unx/generic/printergfx/glyphset.cxx15
-rw-r--r--vcl/unx/generic/printergfx/glyphset.hxx8
-rw-r--r--vcl/unx/generic/printergfx/printerjob.cxx44
-rw-r--r--vcl/unx/generic/printergfx/psputil.cxx5
-rw-r--r--vcl/unx/generic/printergfx/psputil.hxx2
-rw-r--r--vcl/unx/generic/printergfx/text_gfx.cxx13
-rw-r--r--vcl/unx/generic/window/FWS.cxx4
-rw-r--r--vcl/unx/generic/window/FWS.hxx2
-rw-r--r--vcl/unx/generic/window/salframe.cxx185
-rw-r--r--vcl/unx/generic/window/salobj.cxx6
-rw-r--r--vcl/unx/gtk/a11y/atkaction.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atkbridge.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkcomponent.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atkeditabletext.cxx6
-rw-r--r--vcl/unx/gtk/a11y/atkfactory.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkfactory.hxx3
-rw-r--r--vcl/unx/gtk/a11y/atkhypertext.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atkimage.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atklistener.cxx9
-rw-r--r--vcl/unx/gtk/a11y/atklistener.hxx2
-rw-r--r--vcl/unx/gtk/a11y/atkregistry.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkregistry.hxx3
-rw-r--r--vcl/unx/gtk/a11y/atkselection.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atktable.cxx5
-rw-r--r--vcl/unx/gtk/a11y/atktext.cxx17
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx100
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.hxx6
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx78
-rw-r--r--vcl/unx/gtk/a11y/atkutil.hxx3
-rw-r--r--vcl/unx/gtk/a11y/atkvalue.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atkwindow.cxx6
-rw-r--r--vcl/unx/gtk/a11y/atkwindow.hxx3
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx72
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.hxx3
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx43
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx51
-rw-r--r--vcl/unx/gtk/app/gtksys.cxx25
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx184
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx208
-rw-r--r--vcl/unx/gtk/window/gtkobject.cxx16
-rw-r--r--vcl/unx/headless/svpbmp.cxx7
-rw-r--r--vcl/unx/headless/svpbmp.hxx6
-rw-r--r--vcl/unx/headless/svpdummies.cxx2
-rw-r--r--vcl/unx/headless/svpdummies.hxx3
-rw-r--r--vcl/unx/headless/svpelement.cxx11
-rw-r--r--vcl/unx/headless/svpelement.hxx3
-rw-r--r--vcl/unx/headless/svpframe.cxx13
-rw-r--r--vcl/unx/headless/svpframe.hxx6
-rw-r--r--vcl/unx/headless/svpgdi.cxx8
-rw-r--r--vcl/unx/headless/svpgdi.hxx5
-rw-r--r--vcl/unx/headless/svpinst.cxx22
-rw-r--r--vcl/unx/headless/svpinst.hxx20
-rw-r--r--vcl/unx/headless/svpprn.cxx745
-rw-r--r--vcl/unx/headless/svpprn.hxx76
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx33
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx5
-rw-r--r--vcl/unx/headless/svptext.cxx17
-rw-r--r--vcl/unx/headless/svpvd.cxx2
-rw-r--r--vcl/unx/headless/svpvd.hxx3
-rw-r--r--vcl/unx/inc/kde_headers.h98
-rw-r--r--vcl/unx/kde/kdedata.cxx34
-rw-r--r--vcl/unx/kde/salnativewidgets-kde.cxx20
-rw-r--r--vcl/unx/kde4/KDEData.cxx3
-rw-r--r--vcl/unx/kde4/KDEData.hxx3
-rw-r--r--vcl/unx/kde4/KDESalDisplay.cxx52
-rw-r--r--vcl/unx/kde4/KDESalDisplay.hxx19
-rw-r--r--vcl/unx/kde4/KDESalFrame.cxx26
-rw-r--r--vcl/unx/kde4/KDESalFrame.hxx3
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx379
-rw-r--r--vcl/unx/kde4/KDESalGraphics.hxx4
-rw-r--r--vcl/unx/kde4/KDESalInstance.cxx3
-rw-r--r--vcl/unx/kde4/KDESalInstance.hxx3
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx294
-rw-r--r--vcl/unx/kde4/KDEXLib.hxx51
-rw-r--r--vcl/unx/kde4/VCLKDEApplication.cxx6
-rw-r--r--vcl/unx/kde4/VCLKDEApplication.hxx7
-rw-r--r--vcl/unx/kde4/main.cxx3
147 files changed, 3040 insertions, 2958 deletions
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index 341c1263ac9e..92429e63c91e 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -127,7 +128,6 @@ Preedit_DeleteText(preedit_text_t *ptext, int from, int howmuch)
ptext->nLength -= howmuch;
}
else
- // if ( to > pText->nLength )
{
// XXX this indicates an error, are we out of sync ?
fprintf(stderr, "Preedit_DeleteText( from=%i to=%i length=%i )\n",
@@ -327,13 +327,6 @@ Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<sal_uIn
if (nfeedback & XIMTertiary) // same as 2ery
nval |= SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
- /*
- // visibility feedback not supported now
- if ( (nfeedback & XIMVisibleToForward)
- || (nfeedback & XIMVisibleToBackward)
- || (nfeedback & XIMVisibleCenter) )
- { }
- */
}
// copy in list
psalattr[npos] = nval;
@@ -354,7 +347,7 @@ PreeditDrawCallback(XIC ic, XPointer client_data,
|| pPreeditData->pFrame == NULL )
return;
- // #88564# Solaris 7 deletes the preedit buffer after commit
+ // Solaris 7 deletes the preedit buffer after commit
// since the next call to preeditstart will have the same effect just skip this.
// if (pPreeditData->eState == ePreeditStatusStartPending && call_data->text == NULL)
// return;
@@ -510,8 +503,7 @@ PreeditCaretCallback ( XIC, XPointer,XIMPreeditCaretCallbackStruct* )
Bool
IsControlCode(sal_Unicode nChar)
{
- if ( nChar <= 0x1F // C0 controls
- /* || (0x80 <= nChar && nChar <= 0x9F) C1 controls */ )
+ if ( nChar <= 0x1F /* C0 controls */ )
return True;
else
return False;
@@ -525,7 +517,7 @@ CommitStringCallback( XIC ic, XPointer client_data, XPointer call_data )
XIMUnicodeText *cbtext = (XIMUnicodeText *)call_data;
sal_Unicode *p_unicode_data = (sal_Unicode*)cbtext->string.utf16_char;
- // #86964# filter unexpected pure control events
+ // filter unexpected pure control events
if (cbtext->length == 1 && IsControlCode(p_unicode_data[0]) )
{
if( pPreeditData->pFrame )
@@ -662,3 +654,5 @@ IM_IMDestroyCallback (XIM, XPointer client_data, XPointer)
if (pMethod != NULL)
pMethod->HandleDestroyIM();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index 73de37538d61..8a8b5d620cb6 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -332,7 +333,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
if ( mnPreeditStyle != XIMPreeditNone )
{
-#if defined LINUX || defined FREEBSD || defined NETBSD
+#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY
if ( mpPreeditAttributes != NULL )
#endif
mpAttributes = XVaAddToNestedList( mpAttributes,
@@ -340,7 +341,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
}
if ( mnStatusStyle != XIMStatusNone )
{
-#if defined LINUX || defined FREEBSD || defined NETBSD
+#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY
if ( mpStatusAttributes != NULL )
#endif
mpAttributes = XVaAddToNestedList( mpAttributes,
@@ -557,14 +558,14 @@ SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const
Bool
SalI18N_InputContext::SupportInputMethodStyle( XIMStyles *pIMStyles )
{
- int nBestScore = 0;
- int nActualScore = 0;
-
mnPreeditStyle = 0;
mnStatusStyle = 0;
if ( pIMStyles != NULL )
{
+ int nBestScore = 0;
+ int nActualScore = 0;
+
// check whether the XIM supports one of the desired styles
// only a single preedit and a single status style must occure
// in a inpuut method style. Hideki said so, so i trust him
@@ -779,3 +780,4 @@ SalI18N_InputContext::EndExtTextInput( sal_uInt16 /*nFlags*/ )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx
index 176212f681d5..5d30d74455ae 100644
--- a/vcl/unx/generic/app/i18n_im.cxx
+++ b/vcl/unx/generic/app/i18n_im.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -617,3 +618,4 @@ SalI18N_InputMethod::AddConnectionWatch(Display *pDisplay, void *pConnectionHand
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_keysym.cxx b/vcl/unx/generic/app/i18n_keysym.cxx
index 122a88517baf..2e2005f1a874 100644
--- a/vcl/unx/generic/app/i18n_keysym.cxx
+++ b/vcl/unx/generic/app/i18n_keysym.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -363,3 +364,5 @@ KeysymToUnicode (KeySym nKeySym)
return 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 04ffe8bd8d71..8cae9d12eedd 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -55,7 +56,6 @@
#include <svdata.hxx>
using namespace vcl;
-using namespace rtl;
namespace vcl {
@@ -731,3 +731,5 @@ SalI18NImeStatus* X11SalInstance::CreateI18NImeStatus()
{
return new X11ImeStatus();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_wrp.cxx b/vcl/unx/generic/app/i18n_wrp.cxx
index ff56f0ed0647..981dc390e278 100644
--- a/vcl/unx/generic/app/i18n_wrp.cxx
+++ b/vcl/unx/generic/app/i18n_wrp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -258,3 +259,4 @@ Status XvaCloseIM(XIM)
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx
index 5587bbf02339..cb93f48b6bd7 100644
--- a/vcl/unx/generic/app/i18n_xkb.cxx
+++ b/vcl/unx/generic/app/i18n_xkb.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -161,3 +162,4 @@ SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32,sal_uInt32,sal_uInt32
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx
index 73d4b2a2e7eb..0615a2d44450 100644
--- a/vcl/unx/generic/app/keysymnames.cxx
+++ b/vcl/unx/generic/app/keysymnames.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(AIX)
#include <tools/prex.h>
#include <X11/XKBlib.h>
#include <tools/postx.h>
@@ -36,6 +37,7 @@
#include <unx/saldisp.hxx>
#include <X11/keysym.h>
+#include <sal/macros.h>
#if !defined (SunXK_Undo)
#define SunXK_Undo 0x0000FF65 // XK_Undo
@@ -359,70 +361,70 @@ namespace vcl_sal {
static const struct KeyboardReplacements aKeyboards[] =
{
#ifdef SOLARIS
- { "Germany5", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) },
- { "Germany4", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) },
- { "France5", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "France6", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "France_x86", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "Italy5", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy5-Hobo", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy4", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy6", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Italy_x86", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
- { "Netherland4", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland5", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland5-Hobo", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland6", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Netherland_x86", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Norway5", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway5-Hobo", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway4", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway6", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Norway_x86", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
- { "Portugal5", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal5-Hobo", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal4", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal6", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Portugal_x86", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Spain5", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain5-Hobo", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain4", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain6", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spain_x86", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Sweden5", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden5-Hobo", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden4", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden6", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Sweden_x86", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
+ { "Germany5", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) },
+ { "Germany4", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) },
+ { "France5", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "France6", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "France_x86", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "Italy5", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy5-Hobo", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy4", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy6", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Italy_x86", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
+ { "Netherland4", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland5", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland5-Hobo", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland6", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Netherland_x86", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Norway5", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway5-Hobo", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway4", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway6", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Norway_x86", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
+ { "Portugal5", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal5-Hobo", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal4", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal6", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Portugal_x86", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Spain5", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain5-Hobo", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain4", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain6", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spain_x86", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Sweden5", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden5-Hobo", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden4", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden6", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Sweden_x86", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
#endif
- { "U.S. English", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) },
- { "United Kingdom", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) },
+ { "U.S. English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) },
+ { "United Kingdom", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) },
// Germany, German
- { "German", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]) },
- { "France", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
- { "French", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]) },
+ { "German", aImplReplacements_German, SAL_N_ELEMENTS(aImplReplacements_German) },
+ { "France", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
+ { "French", aImplReplacements_French, SAL_N_ELEMENTS(aImplReplacements_French) },
// Italy, Italian
- { "Ital", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]) },
+ { "Ital", aImplReplacements_Italian, SAL_N_ELEMENTS(aImplReplacements_Italian) },
// Norway, Norwegian
- { "Norw", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]) },
+ { "Norw", aImplReplacements_Norwegian, SAL_N_ELEMENTS(aImplReplacements_Norwegian) },
// Portugal, Portuguese
- { "Portu", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]) },
- { "Spain", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
- { "Spanish", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]) },
+ { "Portu", aImplReplacements_Portuguese, SAL_N_ELEMENTS(aImplReplacements_Portuguese) },
+ { "Spain", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
+ { "Spanish", aImplReplacements_Spanish, SAL_N_ELEMENTS(aImplReplacements_Spanish) },
// Sweden, Swedish
- { "Swed", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]) },
- { "Netherland", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
- { "Dutch", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]) },
+ { "Swed", aImplReplacements_Swedish, SAL_N_ELEMENTS(aImplReplacements_Swedish) },
+ { "Netherland", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
+ { "Dutch", aImplReplacements_Dutch, SAL_N_ELEMENTS(aImplReplacements_Dutch) },
// Turkish, Turkey
- { "Turk", aImplReplacements_Turkish, sizeof(aImplReplacements_Turkish)/sizeof(aImplReplacements_Turkish[0]) },
+ { "Turk", aImplReplacements_Turkish, SAL_N_ELEMENTS(aImplReplacements_Turkish) },
// Russian, Russia
- { "Russia", aImplReplacements_Russian, sizeof(aImplReplacements_Russian)/sizeof(aImplReplacements_Russian[0]) },
- { "English", aImplReplacements_English, sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) }
+ { "Russia", aImplReplacements_Russian, SAL_N_ELEMENTS(aImplReplacements_Russian) },
+ { "English", aImplReplacements_English, SAL_N_ELEMENTS(aImplReplacements_English) }
};
String getKeysymReplacementName( const char* pKeyboard, KeySym nSymbol )
{
- for( unsigned int n = 0; n < sizeof(aKeyboards)/sizeof(aKeyboards[0]); n++ )
+ for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ )
{
if( ! strncasecmp( pKeyboard, aKeyboards[n].pKeyboardName, strlen( aKeyboards[n].pKeyboardName ) ) )
{
@@ -436,7 +438,7 @@ namespace vcl_sal {
}
// try english fallbacks
const struct KeysymNameReplacement* pRepl = aImplReplacements_English;
- for( int m = sizeof(aImplReplacements_English)/sizeof(aImplReplacements_English[0]) ; m ; )
+ for( int m = SAL_N_ELEMENTS(aImplReplacements_English); m ; )
{
if( nSymbol == pRepl[--m].aSymbol )
return String( pRepl[m].pName, RTL_TEXTENCODING_UTF8 );
@@ -597,11 +599,11 @@ static const keyboard_layout type6_layout[] =
#include <stdio.h>
#endif
-const char* SalDisplay::GetKeyboardName( sal_Bool bRefresh )
+const char* SalDisplay::GetKeyboardName( bool bRefresh )
{
if( bRefresh || ! m_aKeyboardName.Len() )
{
-#ifdef SOLARIS
+#if defined(SOLARIS)
if( IsLocal() )
{
int kbd = open( "/dev/kbd", O_RDONLY );
@@ -640,7 +642,7 @@ const char* SalDisplay::GetKeyboardName( sal_Bool bRefresh )
close(kbd);
}
}
-#else
+#elif !defined(AIX)
int opcode, event, error;
int major = XkbMajorVersion, minor = XkbMinorVersion;
if( XkbQueryExtension( GetDisplay(), &opcode, &event,&error, &major, &minor ) )
@@ -686,3 +688,5 @@ const char* SalDisplay::GetKeyboardName( sal_Bool bRefresh )
}
return m_aKeyboardName.GetBuffer();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx
index e7f37c00e2ca..316bde14a83a 100644
--- a/vcl/unx/generic/app/randrwrapper.cxx
+++ b/vcl/unx/generic/app/randrwrapper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -358,3 +359,5 @@ int SalDisplay::processRandREvent( XEvent* pEvent )
#endif
return nRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index ec8db9509bf6..233582c07f6e 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -57,8 +58,8 @@
#include <unistd.h>
#endif
-#include <vos/process.hxx>
-#include <vos/mutex.hxx>
+#include <osl/process.h>
+#include <osl/mutex.hxx>
#include "unx/Xproto.h"
#include "unx/saldisp.hxx"
@@ -71,7 +72,6 @@
#include <osl/signal.h>
#include <osl/thread.h>
-#include <osl/process.h>
#include <rtl/strbuf.hxx>
#include <rtl/bootstrap.hxx>
@@ -274,7 +274,13 @@ X11SalData::X11SalData()
m_pPlugin = NULL;
hMainThread_ = pthread_self();
- osl_getLocalHostname( &maLocalHostName.pData );
+}
+
+const rtl::OUString& X11SalData::GetLocalHostName()
+{
+ if (!maLocalHostName.getLength())
+ osl_getLocalHostname( &maLocalHostName.pData );
+ return maLocalHostName;
}
X11SalData::~X11SalData()
@@ -402,16 +408,16 @@ void SalXLib::Init()
Display *pDisp = NULL;
// is there a -display command line parameter?
- vos::OExtCommandLine aCommandLine;
- sal_uInt32 nParams = aCommandLine.getCommandArgCount();
+
+ sal_uInt32 nParams = osl_getCommandArgCount();
rtl::OUString aParam;
rtl::OString aDisplay;
for (sal_uInt16 i=0; i<nParams; i++)
{
- aCommandLine.getCommandArg(i, aParam);
- if (aParam.equalsAscii("-display"))
+ osl_getCommandArg(i, &aParam.pData);
+ if (aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("-display")))
{
- aCommandLine.getCommandArg(i+1, aParam);
+ osl_getCommandArg(i+1, &aParam.pData);
aDisplay = rtl::OUStringToOString(
aParam, osl_getThreadTextEncoding());
@@ -467,7 +473,7 @@ void SalXLib::Init()
SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
XSync( pDisp, False );
- pKbdExtension->UseExtension( ! HasXErrorOccured() );
+ pKbdExtension->UseExtension( ! HasXErrorOccurred() );
PopXErrorLevel();
pSalDisplay->SetKbdExtension( pKbdExtension );
@@ -537,7 +543,7 @@ void SalXLib::XError( Display *pDisplay, XErrorEvent *pEvent )
static Bool bOnce = False;
if ( !bOnce )
{
- std::fprintf(stderr, "X-Error occured in a request for X_OpenFont\n");
+ std::fprintf(stderr, "X-Error occurred in a request for X_OpenFont\n");
EmitFontpathWarning();
bOnce = True ;
@@ -865,3 +871,5 @@ rtl::OString X11SalData::getFrameResName( SalExtStyle nStyle )
return aBuf.makeStringAndClear();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 5a228676e722..5f94db2f1b37 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -41,7 +42,7 @@
#include <ctype.h>
#include <string.h>
-#if defined(SOLARIS)
+#if defined(SOLARIS) || defined(AIX)
#include <sal/alloca.h>
#include <osl/module.h>
#endif
@@ -54,7 +55,7 @@
#define XK_KOREAN
#endif
#include <X11/keysym.h>
-
+#include <X11/XKBlib.h>
#include <X11/Xatom.h>
#ifdef USE_XINERAMA
@@ -87,9 +88,7 @@ Status XineramaGetInfo(Display*, int, XRectangle*, unsigned char*, int*);
#include <vcl/keycodes.hxx>
#include <vcl/salbtype.hxx>
#include <unx/salbmp.h>
-#ifndef _OSL_THREADMUTEX_H_
#include <osl/mutex.h>
-#endif
#include <unx/salobj.h>
#include <unx/sm.hxx>
#include <unx/wmadaptor.hxx>
@@ -98,9 +97,10 @@ Status XineramaGetInfo(Display*, int, XRectangle*, unsigned char*, int*);
#include <osl/socket.h>
#include <poll.h>
-using namespace rtl;
using namespace vcl_sal;
+using ::rtl::OUString;
+
// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define PSEUDOCOLOR12
@@ -607,10 +607,12 @@ fd
if( ! pDisplay->IsDisplay() )
return 0;
- vos::IMutex* pSalInstYieldMutex =
- GetSalData()->m_pInstance->GetYieldMutex();
- ::vos::OGuard aGuard( *pSalInstYieldMutex );
- return pDisplay->IsEvent();
+ int result;
+
+ GetSalData()->m_pInstance->GetYieldMutex()->acquire();
+ result = pDisplay->IsEvent();
+ GetSalData()->m_pInstance->GetYieldMutex()->release();
+ return result;
}
static int DisplayQueue( int
#ifdef DBG_UTIL
@@ -620,11 +622,14 @@ fd
{
DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd,
"wrong fd in DisplayHasEvent" );
- vos::IMutex* pSalInstYieldMutex =
- GetSalData()->m_pInstance->GetYieldMutex();
- ::vos::OGuard aGuard( *pSalInstYieldMutex );
- return XEventsQueued( pDisplay->GetDisplay(),
+ int result;
+
+ GetSalData()->m_pInstance->GetYieldMutex()->acquire();
+ result = XEventsQueued( pDisplay->GetDisplay(),
QueuedAfterReading );
+ GetSalData()->m_pInstance->GetYieldMutex()->release();
+
+ return result;
}
static int DisplayYield( int
#ifdef DBG_UTIL
@@ -634,10 +639,10 @@ fd
{
DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd,
"wrong fd in DisplayHasEvent" );
- vos::IMutex* pSalInstYieldMutex =
- GetSalData()->m_pInstance->GetYieldMutex();
- ::vos::OGuard aGuard( *pSalInstYieldMutex );
+
+ GetSalData()->m_pInstance->GetYieldMutex()->acquire();
pDisplay->Yield();
+ GetSalData()->m_pInstance->GetYieldMutex()->release();
return sal_True;
}
@@ -724,10 +729,10 @@ void SalDisplay::initScreen( int nScreen ) const
1
);
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding()));
const char* argv[2];
argv[0] = "/bin/sh";
- argv[1] = aExec.GetBuffer();
+ argv[1] = aExec.getStr();
XSetCommand( pDisp_, rSD.m_aRefWindow, const_cast<char**>(argv), 2 );
XSelectInput( pDisp_, rSD.m_aRefWindow, PropertyChangeMask );
@@ -772,8 +777,7 @@ void SalDisplay::initScreen( int nScreen ) const
XSetFunction( pDisp_, rSD.m_aAndInvertedGC, GXandInverted );
XSetFunction( pDisp_, rSD.m_aAndGC, GXand );
- // #44556# PowerPC Solaris 2.5 (XSun 3500) Bug: GXor = GXnop
- //XSetFunction( pDisp_, pOrGC_, GXor );
+ // PowerPC Solaris 2.5 (XSun 3500) Bug: GXor = GXnop
XSetFunction( pDisp_, rSD.m_aOrGC, GXxor );
if( 1 == rSD.m_aVisual.GetDepth() )
@@ -792,7 +796,7 @@ void SalDisplay::initScreen( int nScreen ) const
}
rSD.m_hInvert50 = XCreateBitmapFromData( pDisp_,
rSD.m_aRefWindow,
- invert50_bits,
+ reinterpret_cast<const char*>(invert50_bits),
invert50_width,
invert50_height );
}
@@ -881,7 +885,8 @@ void SalDisplay::Init()
sscanf( pProperties, "%li", &nProperties_ );
else
{
-#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD
+#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || \
+ defined NETBSD || defined OPENBSD || defined DRAGONFLY
nProperties_ |= PROPERTY_FEATURE_Maximize;
#endif
// Server Bugs & Properties
@@ -907,7 +912,8 @@ void SalDisplay::Init()
if( GetServerVendor() == vendor_xfree )
{
nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor;
-#if defined LINUX || defined FREEBSD
+#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || \
+ defined DRAGONFLY
// otherwm and olwm are a kind of default, which are not detected
// carefully. if we are running linux (i.e. not netbsd) on an xfree
// display, fvwm is most probable the wm to choose, confusing with mwm
@@ -1028,6 +1034,77 @@ void SalDisplay::Beep() const
// Keyboard
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+namespace {
+
+bool InitXkb(Display* dpy)
+{
+ int nOpcode, nEvent, nError;
+ int nXkbMajor = XkbMajorVersion;
+ int nXkbMinor = XkbMinorVersion;
+
+ if (!XkbLibraryVersion(&nXkbMajor, &nXkbMinor))
+ return false;
+
+ return XkbQueryExtension(
+ dpy, &nOpcode, &nEvent, &nError, &nXkbMajor, &nXkbMinor);
+}
+
+unsigned int GetKeySymMask(Display* dpy, KeySym nKeySym)
+{
+ int nMask = 0;
+ XModifierKeymap* pXmkMap = XGetModifierMapping(dpy);
+ KeyCode nKeyCode = XKeysymToKeycode(dpy, nKeySym);
+ if (nKeyCode == NoSymbol)
+ return 0;
+
+ for (int i = 0; i < 8; ++i)
+ {
+ KeyCode nThisKeyCode = pXmkMap->modifiermap[pXmkMap->max_keypermod*i];
+ if (nThisKeyCode == nKeyCode)
+ nMask = 1 << i;
+ }
+ XFreeModifiermap(pXmkMap);
+ return nMask;
+}
+
+}
+
+void SalDisplay::SimulateKeyPress( sal_uInt16 nKeyCode )
+{
+ if (nKeyCode == KEY_CAPSLOCK)
+ {
+ Display* dpy = GetDisplay();
+ if (!InitXkb(dpy))
+ return;
+
+ unsigned int nMask = GetKeySymMask(dpy, XK_Caps_Lock);
+ XkbStateRec xkbState;
+ XkbGetState(dpy, XkbUseCoreKbd, &xkbState);
+ unsigned int nCapsLockState = xkbState.locked_mods & nMask;
+ if (nCapsLockState)
+ XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, 0);
+ else
+ XkbLockModifiers (dpy, XkbUseCoreKbd, nMask, nMask);
+ }
+}
+
+sal_uInt16 SalDisplay::GetIndicatorState() const
+{
+ unsigned int _state = 0;
+ sal_uInt16 nState = 0;
+ XkbGetIndicatorState(pDisp_, XkbUseCoreKbd, &_state);
+
+ if ((_state & 0x00000001))
+ nState |= INDICATOR_CAPSLOCK;
+ if ((_state & 0x00000002))
+ nState |= INDICATOR_NUMLOCK;
+ if ((_state & 0x00000004))
+ nState |= INDICATOR_SCROLLLOCK;
+
+ return nState;
+}
+
String SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const
{
String aRet;
@@ -1099,6 +1176,7 @@ void SalDisplay::ModifierMapping()
XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
{
String aStrMap;
+ String aCustomKeyName;
if( nKeyCode & KEY_MOD1 )
aStrMap += GetKeyNameFromKeySym( nCtrlKeySym_ );
@@ -1250,6 +1328,15 @@ XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
case KEY_QUOTELEFT:
nKeySym = XK_grave;
break;
+ case KEY_BRACKETLEFT:
+ aCustomKeyName = '[';
+ break;
+ case KEY_BRACKETRIGHT:
+ aCustomKeyName = ']';
+ break;
+ case KEY_SEMICOLON:
+ aCustomKeyName = ';';
+ break;
default:
nKeySym = 0;
@@ -1268,6 +1355,14 @@ XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
else
aStrMap.Erase();
}
+ else if (aCustomKeyName.Len())
+ {
+ // For semicolumn, bracket left and bracket right, it's better to use
+ // their keys than their names. (fdo#32891)
+ if (aStrMap.Len())
+ aStrMap += '+';
+ aStrMap += aCustomKeyName;
+ }
else
aStrMap.Erase();
@@ -1504,13 +1599,6 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
case XK_Menu:
nKey = KEY_CONTEXTMENU;
break;
-/*
- case XK_Break:
- case XK_Select:
- case XK_Execute:
- case XK_Print:
- case XK_Cancel:
-*/
}
}
else if( IsISOKey( keysym ) ) // XK_ISO_
@@ -1580,9 +1668,18 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
nKey = KEY_QUOTELEFT;
*pcPrintable = '`';
break;
-// case XK_Linefeed:
-// *pcPrintable = '\n';
-// break;
+ case XK_bracketleft:
+ nKey = KEY_BRACKETLEFT;
+ *pcPrintable = '[';
+ break;
+ case XK_bracketright:
+ nKey = KEY_BRACKETRIGHT;
+ *pcPrintable = ']';
+ break;
+ case XK_semicolon:
+ nKey = KEY_SEMICOLON;
+ *pcPrintable = ';';
+ break;
// - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000
case 0x1000FF02: // apXK_Copy
nKey = KEY_COPY;
@@ -1704,7 +1801,7 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent,
/* unhandled error */
break;
case XLookupKeySym:
- /* #72223# this is a strange one: on exceed sometimes
+ /* this is a strange one: on exceed sometimes
* no printable is returned for the first char entered,
* just to retry lookup solves the problem. The problem
* is not yet fully understood, so restrict 2nd lookup
@@ -1751,7 +1848,7 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent,
#define MAKE_BITMAP( name ) \
XCreateBitmapFromData( pDisp_, \
DefaultRootWindow( pDisp_ ), \
- name##_bits, \
+ reinterpret_cast<const char*>(name##_bits), \
name##_width, \
name##_height )
@@ -2061,7 +2158,7 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle )
MAKE_CURSOR( vertcurs_ );
break;
- // --> FME 2004-07-30 #i32329# Enhanced table selection
+ // #i32329# Enhanced table selection
case POINTER_TAB_SELECT_S:
MAKE_CURSOR( tblsels_ );
break;
@@ -2077,16 +2174,14 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle )
case POINTER_TAB_SELECT_SW:
MAKE_CURSOR( tblselsw_ );
break;
- // <--
- // --> FME 2004-08-16 #i20119# Paintbrush tool
+ // #i20119# Paintbrush tool
case POINTER_PAINTBRUSH :
MAKE_CURSOR( paintbrush_ );
break;
- // <--
default:
- DBG_ERROR("pointer not implemented");
+ OSL_FAIL("pointer not implemented");
aCur = XCreateFontCursor( pDisp_, XC_arrow );
break;
}
@@ -2113,10 +2208,13 @@ XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle )
int SalDisplay::CaptureMouse( SalFrame *pCapture )
{
+ static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" );
+
if( !pCapture )
{
m_pCapture = NULL;
- XUngrabPointer( GetDisplay(), CurrentTime );
+ if( !pEnv || !*pEnv )
+ XUngrabPointer( GetDisplay(), CurrentTime );
XFlush( GetDisplay() );
return 0;
}
@@ -2125,20 +2223,23 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture )
// FIXME: get rid of X11SalFrame
const SystemEnvData* pEnvData = pCapture->GetSystemData();
- int ret = XGrabPointer( GetDisplay(),
- (XLIB_Window)pEnvData->aWindow,
- False,
- PointerMotionMask| ButtonPressMask|ButtonReleaseMask,
- GrabModeAsync,
- GrabModeAsync,
- None,
- static_cast<X11SalFrame*>(pCapture)->GetCursor(),
- CurrentTime );
-
- if( ret != GrabSuccess )
- {
- DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n");
- return -1;
+ if( !pEnv || !*pEnv )
+ {
+ int ret = XGrabPointer( GetDisplay(),
+ (XLIB_Window)pEnvData->aWindow,
+ False,
+ PointerMotionMask| ButtonPressMask|ButtonReleaseMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ None,
+ static_cast<X11SalFrame*>(pCapture)->GetCursor(),
+ CurrentTime );
+
+ if( ret != GrabSuccess )
+ {
+ DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n");
+ return -1;
+ }
}
m_pCapture = pCapture;
@@ -2246,7 +2347,7 @@ void SalX11Display::Yield()
XEvent aEvent;
DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
- vos::OThread::getCurrentIdentifier(),
+ osl::Thread::getCurrentIdentifier(),
"will crash soon since solar mutex not locked in SalDisplay::Yield" );
XNextEvent( pDisp_, &aEvent );
@@ -2254,13 +2355,13 @@ void SalX11Display::Yield()
Dispatch( &aEvent );
#ifdef DBG_UTIL
- if( pXLib_->HasXErrorOccured() )
+ if( pXLib_->HasXErrorOccurred() )
{
XFlush( pDisp_ );
PrintEvent( "SalDisplay::Yield (WasXError)", &aEvent );
}
#endif
- pXLib_->ResetXErrorOccured();
+ pXLib_->ResetXErrorOccurred();
}
long SalX11Display::Dispatch( XEvent *pEvent )
@@ -2325,7 +2426,7 @@ long SalX11Display::Dispatch( XEvent *pEvent )
if( MappingModifier == pEvent->xmapping.request )
ModifierMapping();
if( MappingKeyboard == pEvent->xmapping.request ) // refresh mapping
- GetKeyboardName( sal_True );
+ GetKeyboardName( true );
}
break;
case ButtonPress:
@@ -2584,7 +2685,7 @@ void SalDisplay::PrintInfo() const
sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) );
}
-int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight )
+void SalDisplay::addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight )
{
// see if any frame buffers are at the same coordinates
// this can happen with weird configuration e.g. on
@@ -2598,13 +2699,14 @@ int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, lo
if( m_aXineramaScreens[n].GetWidth() < i_nWidth ||
m_aXineramaScreens[n].GetHeight() < i_nHeight )
{
+ m_aXineramaScreenIndexMap[i] = n;
m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) );
}
- return (int)n;
+ return;
}
}
+ m_aXineramaScreenIndexMap[i] = m_aXineramaScreens.size();
m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) );
- return (int)m_aXineramaScreens.size()-1;
}
void SalDisplay::InitXinerama()
@@ -2630,8 +2732,9 @@ void SalDisplay::InitXinerama()
{
m_bXinerama = true;
m_aXineramaScreens = std::vector<Rectangle>();
+ m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers);
for( int i = 0; i < nFramebuffers; i++ )
- addXineramaScreenUnique( pFramebuffers[i].x,
+ addXineramaScreenUnique( i, pFramebuffers[i].x,
pFramebuffers[i].y,
pFramebuffers[i].width,
pFramebuffers[i].height );
@@ -2647,9 +2750,10 @@ if( XineramaIsActive( pDisp_ ) )
if( nFramebuffers > 1 )
{
m_aXineramaScreens = std::vector<Rectangle>();
+ m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers);
for( int i = 0; i < nFramebuffers; i++ )
{
- addXineramaScreenUnique( pScreens[i].x_org,
+ addXineramaScreenUnique( i, pScreens[i].x_org,
pScreens[i].y_org,
pScreens[i].width,
pScreens[i].height );
@@ -2690,7 +2794,7 @@ void SalDisplay::deregisterFrame( SalFrame* pFrame )
osl_releaseMutex( hEventGuard_ );
}
else {
- DBG_ERROR( "SalDisplay::deregisterFrame !acquireMutex\n" );
+ OSL_FAIL( "SalDisplay::deregisterFrame !acquireMutex\n" );
}
m_aFrames.remove( pFrame );
@@ -3007,17 +3111,12 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap, int nS
GetXPixels( aColor, 0xC0, 0xC0, 0xC0 );
// light colors: 3 * 2 = 6
-// GetXPixels( aColor, 0x00, 0x00, 0x00 );
+
GetXPixels( aColor, 0x00, 0x00, 0xFF );
GetXPixels( aColor, 0x00, 0xFF, 0x00 );
GetXPixels( aColor, 0x00, 0xFF, 0xFF );
-// GetXPixels( aColor, 0xFF, 0x00, 0x00 );
-// GetXPixels( aColor, 0xFF, 0x00, 0xFF );
-// GetXPixels( aColor, 0xFF, 0xFF, 0x00 );
-// GetXPixels( aColor, 0xFF, 0xFF, 0xFF );
// standard colors: 7 * 2 = 14
-// GetXPixels( aColor, 0x00, 0x00, 0x00 );
GetXPixels( aColor, 0x00, 0x00, 0x80 );
GetXPixels( aColor, 0x00, 0x80, 0x00 );
GetXPixels( aColor, 0x00, 0x80, 0x80 );
@@ -3025,7 +3124,7 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap, int nS
GetXPixels( aColor, 0x80, 0x00, 0x80 );
GetXPixels( aColor, 0x80, 0x80, 0x00 );
GetXPixels( aColor, 0x80, 0x80, 0x80 );
- GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blau 7
+ GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blue 7
// cube: 6*6*6 - 8 = 208
for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF
@@ -3433,3 +3532,4 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const
+ ((b+8)/17) ];
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 3b57544ebad0..7233225f4d9b 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,6 +51,7 @@
#include "vcl/helper.hxx"
#include "salwtype.hxx"
+#include <sal/macros.h>
// -------------------------------------------------------------------------
//
@@ -66,27 +68,27 @@ SalYieldMutex::SalYieldMutex()
void SalYieldMutex::acquire()
{
- OMutex::acquire();
- mnThreadId = vos::OThread::getCurrentIdentifier();
+ SolarMutexObject::acquire();
+ mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
}
void SalYieldMutex::release()
{
- if ( mnThreadId == vos::OThread::getCurrentIdentifier() )
+ if ( mnThreadId == osl::Thread::getCurrentIdentifier() )
{
if ( mnCount == 1 )
mnThreadId = 0;
mnCount--;
}
- OMutex::release();
+ SolarMutexObject::release();
}
sal_Bool SalYieldMutex::tryToAcquire()
{
- if ( OMutex::tryToAcquire() )
+ if ( SolarMutexObject::tryToAcquire() )
{
- mnThreadId = vos::OThread::getCurrentIdentifier();
+ mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
return True;
}
@@ -221,7 +223,7 @@ bool X11SalInstance::AnyInput(sal_uInt16 nType)
return bRet;
}
-vos::IMutex* X11SalInstance::GetYieldMutex()
+osl::SolarMutex* X11SalInstance::GetYieldMutex()
{
return mpSalYieldMutex;
}
@@ -232,7 +234,7 @@ sal_uLong X11SalInstance::ReleaseYieldMutex()
{
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
if ( pYieldMutex->GetThreadId() ==
- vos::OThread::getCurrentIdentifier() )
+ osl::Thread::getCurrentIdentifier() )
{
sal_uLong nCount = pYieldMutex->GetAcquireCount();
sal_uLong n = nCount;
@@ -267,8 +269,7 @@ bool X11SalInstance::CheckYieldMutex()
bool bRet = true;
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
- if ( pYieldMutex->GetThreadId() !=
- vos::OThread::getCurrentIdentifier() )
+ if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier() )
{
bRet = false;
}
@@ -319,7 +320,7 @@ static void getServerDirectories( std::list< rtl::OString >& o_rFontPaths )
};
::std::list< ByteString > aLines;
- for( unsigned int i = 0; i < sizeof(pCommands)/sizeof(pCommands[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCommands); i++ )
{
FILE* pPipe = popen( pCommands[i], "r" );
aLines.clear();
@@ -450,3 +451,5 @@ void X11SalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, cons
if (add_to_recently_used_file_list)
add_to_recently_used_file_list(rFileUrl, rMimeType);
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/salsys.cxx b/vcl/unx/generic/app/salsys.cxx
index 672b3e53e672..c5f7174e3d4c 100644
--- a/vcl/unx/generic/app/salsys.cxx
+++ b/vcl/unx/generic/app/salsys.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -224,3 +225,5 @@ int X11SalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMess
return nResult != -1 ? nButtonIds[ nResult ] : 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/saltimer.cxx b/vcl/unx/generic/app/saltimer.cxx
index af8b2df4124b..98d6ccde5943 100644
--- a/vcl/unx/generic/app/saltimer.cxx
+++ b/vcl/unx/generic/app/saltimer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -94,3 +95,4 @@ void X11SalTimer::Start( sal_uLong nMS )
GetX11SalData()->GetLib()->StartTimer( nMS );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx
index c8090270d611..ac2682df4510 100644
--- a/vcl/unx/generic/app/sm.cxx
+++ b/vcl/unx/generic/app/sm.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -82,6 +83,7 @@ SalSession* X11SalInstance::CreateSalSession()
{
if( ! pOneInstance )
pOneInstance = new IceSalSession();
+ SessionManagerClient::open();
return pOneInstance;
}
@@ -211,7 +213,7 @@ static void BuildSmPropertyList()
{
if( ! pSmProps )
{
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding()));
nSmProps = 5;
pSmProps = new SmProp[ nSmProps ];
@@ -220,22 +222,22 @@ static void BuildSmPropertyList()
pSmProps[ 0 ].type = const_cast<char*>(SmLISTofARRAY8);
pSmProps[ 0 ].num_vals = 1;
pSmProps[ 0 ].vals = new SmPropValue;
- pSmProps[ 0 ].vals->length = aExec.Len()+1;
- pSmProps[ 0 ].vals->value = strdup( aExec.GetBuffer() );
+ pSmProps[ 0 ].vals->length = aExec.getLength()+1;
+ pSmProps[ 0 ].vals->value = strdup( aExec.getStr() );
pSmProps[ 1 ].name = const_cast<char*>(SmProgram);
pSmProps[ 1 ].type = const_cast<char*>(SmARRAY8);
pSmProps[ 1 ].num_vals = 1;
pSmProps[ 1 ].vals = new SmPropValue;
- pSmProps[ 1 ].vals->length = aExec.Len()+1;
- pSmProps[ 1 ].vals->value = strdup( aExec.GetBuffer() );
+ pSmProps[ 1 ].vals->length = aExec.getLength()+1;
+ pSmProps[ 1 ].vals->value = strdup( aExec.getStr() );
pSmProps[ 2 ].name = const_cast<char*>(SmRestartCommand);
pSmProps[ 2 ].type = const_cast<char*>(SmLISTofARRAY8);
pSmProps[ 2 ].num_vals = 3;
pSmProps[ 2 ].vals = new SmPropValue[3];
- pSmProps[ 2 ].vals[0].length = aExec.Len()+1;
- pSmProps[ 2 ].vals[0].value = strdup( aExec.GetBuffer() );
+ pSmProps[ 2 ].vals[0].length = aExec.getLength()+1;
+ pSmProps[ 2 ].vals[0].value = strdup( aExec.getStr() );
ByteString aRestartOption( "-session=" );
aRestartOption.Append( SessionManagerClient::getSessionID() );
pSmProps[ 2 ].vals[1].length = aRestartOption.Len()+1;
@@ -377,7 +379,8 @@ void SessionManagerClient::SaveYourselfProc(
SessionManagerClient::saveDone();
return;
}
- Application::PostUserEvent( STATIC_LINK( (void*)(shutdown ? 0xffffffff : 0x0), SessionManagerClient, SaveYourselfHdl ) );
+ sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0;
+ Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) );
SMprintf( "waiting for save yourself event to be processed\n" );
#endif
}
@@ -559,13 +562,13 @@ void SessionManagerClient::interactionDone( bool bCancelShutdown )
}
-String SessionManagerClient::getExecName()
+rtl::OUString SessionManagerClient::getExecName()
{
rtl::OUString aExec, aSysExec;
osl_getExecutableFile( &aExec.pData );
osl_getSystemPathFromFileURL( aExec.pData, &aSysExec.pData );
- int nPos = aSysExec.indexOf( rtl::OUString::createFromAscii( ".bin" ) );
+ int nPos = aSysExec.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".bin")) );
if( nPos != -1 )
aSysExec = aSysExec.copy( 0, nPos );
return aSysExec;
@@ -799,3 +802,5 @@ void ICEConnectionObserver::ICEWatchProc(
SMprintf( "Display connection is %d\n", ConnectionNumber( GetX11SalData()->GetDisplay()->GetDisplay() ) );
#endif
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/soicon.cxx b/vcl/unx/generic/app/soicon.cxx
index bb41299c376d..1557b064977e 100644
--- a/vcl/unx/generic/app/soicon.cxx
+++ b/vcl/unx/generic/app/soicon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -114,3 +115,4 @@ sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,sal_uInt16 nIcon
return sal_True;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index 90b2e5426bdf..ad9b5ee22d6c 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,7 +38,7 @@
#include "osl/thread.h"
#include "osl/process.h"
-
+#include <sal/macros.h>
#include "vcl/configsettings.hxx"
#include "unx/wmadaptor.hxx"
@@ -500,7 +501,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
bsearch( &aSearch,
aProtocolTab,
- sizeof( aProtocolTab )/sizeof( aProtocolTab[0] ),
+ SAL_N_ELEMENTS( aProtocolTab ),
sizeof( struct WMAdaptorProtocol ),
compareProtocol );
if( pMatch )
@@ -675,7 +676,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
&& aRealType == XA_CARDINAL
&& nFormat == 32
&& nItems != 0
- && ! m_pSalDisplay->GetXLib()->HasXErrorOccured()
+ && ! m_pSalDisplay->GetXLib()->HasXErrorOccurred()
)
{
aCheckWindow = *(XLIB_Window*)pProperty;
@@ -756,7 +757,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
WMAdaptorProtocol* pMatch = (WMAdaptorProtocol*)
bsearch( &aSearch,
aProtocolTab,
- sizeof( aProtocolTab )/sizeof( aProtocolTab[0] ),
+ SAL_N_ELEMENTS( aProtocolTab ),
sizeof( struct WMAdaptorProtocol ),
compareProtocol );
if( pMatch )
@@ -878,7 +879,7 @@ bool WMAdaptor::getNetWmName()
&& aRealType == XA_WINDOW
&& nFormat == 32
&& nItems != 0
- && ! m_pSalDisplay->GetXLib()->HasXErrorOccured()
+ && ! m_pSalDisplay->GetXLib()->HasXErrorOccurred()
)
{
aCheckWindow = *(XLIB_Window*)pProperty;
@@ -1037,7 +1038,7 @@ bool GnomeWMAdaptor::isValid() const
void WMAdaptor::initAtoms()
{
// get basic atoms
- for( unsigned int i = 0; i < sizeof( aAtomTab )/sizeof( aAtomTab[0] ); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAtomTab ); i++ )
m_aWMAtoms[ aAtomTab[i].nProtocol ] = XInternAtom( m_pDisplay, aAtomTab[i].pProtocol, False );
m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ] = XInternAtom( m_pDisplay, "_NET_SUPPORTING_WM_CHECK", True );
m_aWMAtoms[ NET_WM_NAME ] = XInternAtom( m_pDisplay, "_NET_WM_NAME", True );
@@ -1090,7 +1091,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
if( aCountry.getLength() )
{
- aLocaleString += ::rtl::OUString::createFromAscii( "_" );
+ aLocaleString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_"));
aLocaleString += aCountry;
}
if( aVariant.getLength() )
@@ -2546,3 +2547,5 @@ void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent
XFlush( m_pDisplay );
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
index 777e5aa921d3..568507822c1e 100644
--- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -41,9 +42,10 @@
#include "vclpluginapi.h"
#include <unistd.h>
+#include <string.h>
-using namespace rtl;
-
+using ::rtl::OUString;
+using ::rtl::OString;
enum {
DESKTOP_NONE = 0,
DESKTOP_UNKNOWN,
@@ -278,23 +280,32 @@ DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment()
{
// get display to connect to
const char* pDisplayStr = getenv( "DISPLAY" );
- int nParams = osl_getCommandArgCount();
- OUString aParam;
- OString aBParm;
- for( int i = 0; i < nParams; i++ )
+
+ const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" );
+
+ if (pUsePlugin && (strcmp(pUsePlugin, "svp") == 0))
+ pDisplayStr = NULL;
+ else
{
- osl_getCommandArg( i, &aParam.pData );
- if( aParam.equalsAscii( "-headless" ) )
- {
- pDisplayStr = NULL;
- break;
- }
- if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) )
+ int nParams = osl_getCommandArgCount();
+ OUString aParam;
+ OString aBParm;
+ for( int i = 0; i < nParams; i++ )
{
- osl_getCommandArg( i+1, &aParam.pData );
- aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() );
- pDisplayStr = aBParm.getStr();
- break;
+ osl_getCommandArg( i, &aParam.pData );
+ if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" ) ) ||
+ aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--headless" ) ) )
+ {
+ pDisplayStr = NULL;
+ break;
+ }
+ if( i < nParams-1 && (aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--display" ) )) )
+ {
+ osl_getCommandArg( i+1, &aParam.pData );
+ aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() );
+ pDisplayStr = aBParm.getStr();
+ break;
+ }
}
}
@@ -341,3 +352,5 @@ DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment()
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx
index a08a9481b8e8..4f1934397397 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.cxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,9 +53,10 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::awt;
using namespace cppu;
using namespace osl;
-using namespace rtl;
using namespace x11;
+using ::rtl::OUString;
+
X11Clipboard::X11Clipboard( SelectionManager& rManager, Atom aSelection ) :
::cppu::WeakComponentImplHelper4<
::com::sun::star::datatransfer::clipboard::XClipboardEx,
@@ -78,7 +80,7 @@ X11Clipboard::X11Clipboard( SelectionManager& rManager, Atom aSelection ) :
else
{
m_rSelectionManager.registerHandler( XA_PRIMARY, *this );
- m_rSelectionManager.registerHandler( m_rSelectionManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ), *this );
+ m_rSelectionManager.registerHandler( m_rSelectionManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ), *this );
}
}
@@ -96,7 +98,7 @@ X11Clipboard::~X11Clipboard()
else
{
m_rSelectionManager.deregisterHandler( XA_PRIMARY );
- m_rSelectionManager.deregisterHandler( m_rSelectionManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ) );
+ m_rSelectionManager.deregisterHandler( m_rSelectionManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ) );
}
}
@@ -107,7 +109,7 @@ void X11Clipboard::fireChangedContentsEvent()
{
ClearableMutexGuard aGuard( m_rSelectionManager.getMutex() );
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "X11Clipboard::fireChangedContentsEvent for %s (%d listeners)\n",
+ fprintf( stderr, "X11Clipboard::fireChangedContentsEvent for %s (%" SAL_PRI_SIZET "u listeners)\n",
OUStringToOString( m_rSelectionManager.getString( m_aSelection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), m_aListeners.size() );
#endif
::std::list< Reference< XClipboardListener > > listeners( m_aListeners );
@@ -181,7 +183,7 @@ void SAL_CALL X11Clipboard::setContents(
else
{
m_rSelectionManager.requestOwnership( XA_PRIMARY );
- m_rSelectionManager.requestOwnership( m_rSelectionManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ) );
+ m_rSelectionManager.requestOwnership( m_rSelectionManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ) );
}
// notify old owner on loss of ownership
@@ -260,7 +262,7 @@ Reference< XInterface > X11Clipboard::getReference() throw()
OUString SAL_CALL X11Clipboard::getImplementationName( )
throw(RuntimeException)
{
- return OUString::createFromAscii(X11_CLIPBOARD_IMPLEMENTATION_NAME);
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(X11_CLIPBOARD_IMPLEMENTATION_NAME));
}
// ------------------------------------------------------------------------
@@ -291,3 +293,4 @@ Sequence< OUString > SAL_CALL X11Clipboard::getSupportedServiceNames( )
return X11Clipboard_getSupportedServiceNames();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.hxx b/vcl/unx/generic/dtrans/X11_clipboard.hxx
index 2c0ee2d95c0d..73240d8715e6 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.hxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,13 +31,9 @@
#include <X11_selection.hxx>
-#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDEX_HPP_
#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
-#endif
-#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDNOTIFIER_HPP_
#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
-#endif
#include <cppuhelper/compbase4.hxx>
// ------------------------------------------------------------------------
@@ -149,3 +146,5 @@ namespace x11 {
} // namepspace
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_dndcontext.cxx b/vcl/unx/generic/dtrans/X11_dndcontext.cxx
index e6fc3dd8a532..988dce430a51 100644
--- a/vcl/unx/generic/dtrans/X11_dndcontext.cxx
+++ b/vcl/unx/generic/dtrans/X11_dndcontext.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -136,3 +137,5 @@ void DragSourceContext::transferablesFlavorsChanged() throw()
{
m_rManager.transferablesFlavorsChanged();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_dndcontext.hxx b/vcl/unx/generic/dtrans/X11_dndcontext.hxx
index d8ef87444a7a..bca708eb24c7 100644
--- a/vcl/unx/generic/dtrans/X11_dndcontext.hxx
+++ b/vcl/unx/generic/dtrans/X11_dndcontext.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -102,3 +103,5 @@ namespace x11 {
} // namespace
#endif // _DTRANS_X11_DNDCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_droptarget.cxx b/vcl/unx/generic/dtrans/X11_droptarget.cxx
index 5db23329abd8..d72c5c4c7eeb 100644
--- a/vcl/unx/generic/dtrans/X11_droptarget.cxx
+++ b/vcl/unx/generic/dtrans/X11_droptarget.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,12 +32,13 @@
#include <X11_selection.hxx>
using namespace x11;
-using namespace rtl;
using namespace com::sun::star::lang;
using namespace com::sun::star::awt;
using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::dnd;
+using ::rtl::OUString;
+
DropTarget::DropTarget() :
::cppu::WeakComponentImplHelper3<
XDropTarget,
@@ -202,7 +204,7 @@ void DropTarget::dragOver( const DropTargetDragEvent& dtde ) throw()
OUString DropTarget::getImplementationName() throw()
{
- return OUString::createFromAscii(XDND_DROPTARGET_IMPLEMENTATION_NAME);
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(XDND_DROPTARGET_IMPLEMENTATION_NAME));
}
// ------------------------------------------------------------------------
@@ -226,3 +228,4 @@ Sequence< OUString > DropTarget::getSupportedServiceNames() throw()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index e7b0e754e395..facc134b3b56 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -41,12 +42,13 @@
#include <X11/keysym.h>
#include <X11/Xutil.h>
#include "tools/postx.h"
-#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD)
+#if defined(LINUX) || defined(NETBSD) || defined (FREEBSD) || defined(OPENBSD)
#include <sys/poll.h>
#else
#include <poll.h>
#endif
#include <sal/alloca.h>
+#include <sal/macros.h>
#include <X11_selection.hxx>
#include <X11_clipboard.hxx>
@@ -72,7 +74,7 @@
#include <osl/process.h>
#include <comphelper/processfactory.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#define DRAG_EVENT_MASK ButtonPressMask |\
ButtonReleaseMask |\
@@ -93,11 +95,13 @@ using namespace com::sun::star::awt;
using namespace com::sun::star::uno;
using namespace com::sun::star::frame;
using namespace cppu;
-using namespace osl;
-using namespace rtl;
using namespace x11;
+using ::rtl::OUString;
+using ::rtl::OUStringHash;
+using ::rtl::OStringToOUString;
+
// stubs to satisfy solaris compiler's rather rigid linking warning
extern "C"
{
@@ -214,9 +218,9 @@ rtl_TextEncoding x11::getTextPlainEncoding( const OUString& rMimeType )
// ------------------------------------------------------------------------
-::std::hash_map< OUString, SelectionManager*, OUStringHash >& SelectionManager::getInstances()
+::boost::unordered_map< OUString, SelectionManager*, OUStringHash >& SelectionManager::getInstances()
{
- static ::std::hash_map< OUString, SelectionManager*, OUStringHash > aInstances;
+ static ::boost::unordered_map< OUString, SelectionManager*, OUStringHash > aInstances;
return aInstances;
}
@@ -292,7 +296,7 @@ SelectionManager::SelectionManager() :
m_aDragRunning.reset();
}
-XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY )
+XLIB_Cursor SelectionManager::createCursor( const unsigned char* pPointerData, const unsigned char* pMaskData, int width, int height, int hotX, int hotY )
{
Pixmap aPointer;
Pixmap aMask;
@@ -309,13 +313,13 @@ XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char
aPointer =
XCreateBitmapFromData( m_pDisplay,
m_aWindow,
- pPointerData,
+ reinterpret_cast<const char*>(pPointerData),
width,
height );
aMask
= XCreateBitmapFromData( m_pDisplay,
m_aWindow,
- pMaskData,
+ reinterpret_cast<const char*>(pMaskData),
width,
height );
XLIB_Cursor aCursor =
@@ -331,7 +335,7 @@ XLIB_Cursor SelectionManager::createCursor( const char* pPointerData, const char
void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::com::sun::star::uno::Exception)
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
if( ! m_xDisplayConnection.is() )
{
@@ -351,16 +355,6 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c
arguments.getConstArray()[0] >>= m_xDisplayConnection;
if( ! m_xDisplayConnection.is() )
{
-#if 0
- // for the time being try to live without XDisplayConnection
- // for the sake of clipboard service
- // clipboard service should be initialized with a XDisplayConnection
- // in the future
- Exception aExc;
- aExc.Message = OUString::createFromAscii( "initialize me with a valid XDisplayConnection" );
- aExc.Context = static_cast< OWeakObject* >(this);
- throw aExc;
-#endif
}
else
m_xDisplayConnection->addEventHandler( Any(), this, ~0 );
@@ -393,39 +387,38 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c
XSynchronize( m_pDisplay, True );
#endif
// clipboard selection
- m_nCLIPBOARDAtom = getAtom( OUString::createFromAscii( "CLIPBOARD" ) );
+ m_nCLIPBOARDAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) );
// special targets
- m_nTARGETSAtom = getAtom( OUString::createFromAscii( "TARGETS" ) );
- m_nTIMESTAMPAtom = getAtom( OUString::createFromAscii( "TIMESTAMP" ) );
- m_nTEXTAtom = getAtom( OUString::createFromAscii( "TEXT" ) );
- m_nINCRAtom = getAtom( OUString::createFromAscii( "INCR" ) );
- m_nCOMPOUNDAtom = getAtom( OUString::createFromAscii( "COMPOUND_TEXT" ) );
- m_nMULTIPLEAtom = getAtom( OUString::createFromAscii( "MULTIPLE" ) );
- m_nUTF16Atom = getAtom( OUString::createFromAscii( "ISO10646-1" ) );
-// m_nUTF16Atom = getAtom( OUString::createFromAscii( "text/plain;charset=ISO-10646-UCS-2" ) );
- m_nImageBmpAtom = getAtom( OUString::createFromAscii( "image/bmp" ) );
+ m_nTARGETSAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("TARGETS")) );
+ m_nTIMESTAMPAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")) );
+ m_nTEXTAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("TEXT")) );
+ m_nINCRAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("INCR")) );
+ m_nCOMPOUNDAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("COMPOUND_TEXT")) );
+ m_nMULTIPLEAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("MULTIPLE")) );
+ m_nUTF16Atom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("ISO10646-1")) );
+ m_nImageBmpAtom = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("image/bmp")) );
// Atoms for Xdnd protocol
- m_nXdndAware = getAtom( OUString::createFromAscii( "XdndAware" ) );
- m_nXdndEnter = getAtom( OUString::createFromAscii( "XdndEnter" ) );
- m_nXdndLeave = getAtom( OUString::createFromAscii( "XdndLeave" ) );
- m_nXdndPosition = getAtom( OUString::createFromAscii( "XdndPosition" ) );
- m_nXdndStatus = getAtom( OUString::createFromAscii( "XdndStatus" ) );
- m_nXdndDrop = getAtom( OUString::createFromAscii( "XdndDrop" ) );
- m_nXdndFinished = getAtom( OUString::createFromAscii( "XdndFinished" ) );
- m_nXdndSelection = getAtom( OUString::createFromAscii( "XdndSelection" ) );
- m_nXdndTypeList = getAtom( OUString::createFromAscii( "XdndTypeList" ) );
- m_nXdndProxy = getAtom( OUString::createFromAscii( "XdndProxy" ) );
- m_nXdndActionCopy = getAtom( OUString::createFromAscii( "XdndActionCopy" ) );
- m_nXdndActionMove = getAtom( OUString::createFromAscii( "XdndActionMove" ) );
- m_nXdndActionLink = getAtom( OUString::createFromAscii( "XdndActionLink" ) );
- m_nXdndActionAsk = getAtom( OUString::createFromAscii( "XdndActionAsk" ) );
- m_nXdndActionPrivate= getAtom( OUString::createFromAscii( "XdndActionPrivate" ) );
+ m_nXdndAware = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndAware")) );
+ m_nXdndEnter = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndEnter")) );
+ m_nXdndLeave = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndLeave")) );
+ m_nXdndPosition = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndPosition")) );
+ m_nXdndStatus = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndStatus")) );
+ m_nXdndDrop = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndDrop")) );
+ m_nXdndFinished = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndFinished")) );
+ m_nXdndSelection = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndSelection")) );
+ m_nXdndTypeList = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndTypeList")) );
+ m_nXdndProxy = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndProxy")) );
+ m_nXdndActionCopy = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionCopy")) );
+ m_nXdndActionMove = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionMove")) );
+ m_nXdndActionLink = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionLink")) );
+ m_nXdndActionAsk = getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionAsk")) );
+ m_nXdndActionPrivate= getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("XdndActionPrivate")) );
// initialize map with member none
- m_aAtomToString[ 0 ]= OUString::createFromAscii( "None" );
- m_aAtomToString[ XA_PRIMARY ] = OUString::createFromAscii( "PRIMARY" );
+ m_aAtomToString[ 0 ]= OUString(RTL_CONSTASCII_USTRINGPARAM("None"));
+ m_aAtomToString[ XA_PRIMARY ] = OUString(RTL_CONSTASCII_USTRINGPARAM("PRIMARY"));
// create a (invisible) message window
m_aWindow = XCreateSimpleWindow( m_pDisplay, DefaultRootWindow( m_pDisplay ),
@@ -493,9 +486,9 @@ SelectionManager::~SelectionManager()
fprintf( stderr, "SelectionManager::~SelectionManager (%s)\n", m_pDisplay ? DisplayString(m_pDisplay) : "no display" );
#endif
{
- MutexGuard aGuard( *Mutex::getGlobalMutex() );
+ osl::MutexGuard aGuard( *osl::Mutex::getGlobalMutex() );
- ::std::hash_map< OUString, SelectionManager*, OUStringHash >::iterator it;
+ ::boost::unordered_map< OUString, SelectionManager*, OUStringHash >::iterator it;
for( it = getInstances().begin(); it != getInstances().end(); ++it )
if( it->second == this )
{
@@ -519,7 +512,7 @@ SelectionManager::~SelectionManager()
// thread handle is freed in dragDoDispatch()
}
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "shutting down SelectionManager\n" );
@@ -560,7 +553,7 @@ SelectionManager::~SelectionManager()
SelectionAdaptor* SelectionManager::getAdaptor( Atom selection )
{
- ::std::hash_map< Atom, Selection* >::iterator it =
+ ::boost::unordered_map< Atom, Selection* >::iterator it =
m_aSelections.find( selection );
return it != m_aSelections.end() ? it->second->m_pAdaptor : NULL;
}
@@ -569,7 +562,7 @@ SelectionAdaptor* SelectionManager::getAdaptor( Atom selection )
OUString SelectionManager::convertFromCompound( const char* pText, int nLen )
{
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
OUString aRet;
if( nLen < 0 )
nLen = strlen( pText );
@@ -600,7 +593,7 @@ OUString SelectionManager::convertFromCompound( const char* pText, int nLen )
OString SelectionManager::convertToCompound( const OUString& rText )
{
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
XTextProperty aProp;
aProp.value = NULL;
aProp.encoding = XA_STRING;
@@ -620,7 +613,7 @@ OString SelectionManager::convertToCompound( const OUString& rText )
aRet = (char*)aProp.value;
XFree( aProp.value );
#ifdef SOLARIS
- /* #97070#
+ /*
* for currently unknown reasons XmbTextListToTextProperty on Solaris returns
* no data in ISO8859-n encodings (at least for n = 1, 15)
* in these encodings the directly converted text does the
@@ -693,7 +686,7 @@ bool SelectionManager::convertData(
aEncoding = getTextPlainEncoding( aFlavor.MimeType );
if( aEncoding != RTL_TEXTENCODING_DONTKNOW || bCompoundText )
{
- aFlavor.MimeType = OUString::createFromAscii( "text/plain;charset=utf-16" );
+ aFlavor.MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16"));
aFlavor.DataType = getCppuType( (OUString *) 0 );
if( xTransferable->isDataFlavorSupported( aFlavor ) )
{
@@ -720,14 +713,14 @@ bool SelectionManager::convertData(
SelectionManager& SelectionManager::get( const OUString& rDisplayName )
{
- MutexGuard aGuard( *Mutex::getGlobalMutex() );
+ osl::MutexGuard aGuard( *osl::Mutex::getGlobalMutex() );
OUString aDisplayName( rDisplayName );
if( ! aDisplayName.getLength() )
aDisplayName = OStringToOUString( getenv( "DISPLAY" ), RTL_TEXTENCODING_ISO_8859_1 );
SelectionManager* pInstance = NULL;
- ::std::hash_map< OUString, SelectionManager*, OUStringHash >::iterator it = getInstances().find( aDisplayName );
+ ::boost::unordered_map< OUString, SelectionManager*, OUStringHash >::iterator it = getInstances().find( aDisplayName );
if( it != getInstances().end() )
pInstance = it->second;
else pInstance = getInstances()[ aDisplayName ] = new SelectionManager();
@@ -739,9 +732,9 @@ SelectionManager& SelectionManager::get( const OUString& rDisplayName )
const OUString& SelectionManager::getString( Atom aAtom )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
- ::std::hash_map< Atom, OUString >::const_iterator it;
+ ::boost::unordered_map< Atom, OUString >::const_iterator it;
if( ( it = m_aAtomToString.find( aAtom ) ) == m_aAtomToString.end() )
{
static OUString aEmpty;
@@ -760,9 +753,9 @@ const OUString& SelectionManager::getString( Atom aAtom )
Atom SelectionManager::getAtom( const OUString& rString )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
- ::std::hash_map< OUString, Atom, OUStringHash >::const_iterator it;
+ ::boost::unordered_map< OUString, Atom, OUStringHash >::const_iterator it;
if( ( it = m_aStringToAtom.find( rString ) ) == m_aStringToAtom.end() )
{
static Atom nNoDisplayAtoms = 1;
@@ -780,7 +773,7 @@ bool SelectionManager::requestOwnership( Atom selection )
bool bSuccess = false;
if( m_pDisplay && m_aWindow )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
SelectionAdaptor* pAdaptor = getAdaptor( selection );
if( pAdaptor )
@@ -822,9 +815,7 @@ bool SelectionManager::requestOwnership( Atom selection )
void SelectionManager::convertTypeToNative( const OUString& rType, Atom selection, int& rFormat, ::std::list< Atom >& rConversions, bool bPushFront )
{
NativeTypeEntry* pTab = selection == m_nXdndSelection ? aXdndConversionTab : aNativeConversionTab;
- int nTabEntries = selection == m_nXdndSelection
- ? sizeof(aXdndConversionTab)/sizeof(aXdndConversionTab[0]) :
- sizeof(aNativeConversionTab)/sizeof(aNativeConversionTab[0]);
+ int nTabEntries = selection == m_nXdndSelection ? SAL_N_ELEMENTS(aXdndConversionTab) : SAL_N_ELEMENTS(aNativeConversionTab);
OString aType( OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ) );
rFormat = 0;
@@ -887,7 +878,7 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes,
rOutTypeList.push_front( XA_STRING );
rOutTypeList.push_front( m_nCOMPOUNDAtom );
}
- convertTypeToNative( OUString::createFromAscii( "text/plain;charset=utf-8" ), targetselection, nFormat, rOutTypeList, true );
+ convertTypeToNative( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-8")), targetselection, nFormat, rOutTypeList, true );
}
if( targetselection != m_nXdndSelection )
rOutTypeList.push_back( m_nMULTIPLEAtom );
@@ -897,10 +888,8 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes,
OUString SelectionManager::convertTypeFromNative( Atom nType, Atom selection, int& rFormat )
{
- NativeTypeEntry* pTab = selection == m_nXdndSelection ? aXdndConversionTab : aNativeConversionTab;
- int nTabEntries = selection == m_nXdndSelection
- ? sizeof(aXdndConversionTab)/sizeof(aXdndConversionTab[0]) :
- sizeof(aNativeConversionTab)/sizeof(aNativeConversionTab[0]);
+ NativeTypeEntry* pTab = (selection == m_nXdndSelection) ? aXdndConversionTab : aNativeConversionTab;
+ int nTabEntries = (selection == m_nXdndSelection) ? SAL_N_ELEMENTS(aXdndConversionTab) : SAL_N_ELEMENTS(aNativeConversionTab);
for( int i = 0; i < nTabEntries; i++ )
{
@@ -920,8 +909,8 @@ OUString SelectionManager::convertTypeFromNative( Atom nType, Atom selection, in
bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData )
{
- ResettableMutexGuard aGuard(m_aMutex);
- ::std::hash_map< Atom, Selection* >::iterator it;
+ osl::ResettableMutexGuard aGuard(m_aMutex);
+ ::boost::unordered_map< Atom, Selection* >::iterator it;
bool bSuccess = false;
#if OSL_DEBUG_LEVEL > 1
@@ -1059,12 +1048,11 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rType, Sequence< sal_Int8 >& rData )
{
- int nFormat;
bool bSuccess = false;
- ::std::hash_map< Atom, Selection* >::iterator it;
+ ::boost::unordered_map< Atom, Selection* >::iterator it;
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
it = m_aSelections.find( selection );
if( it == m_aSelections.end() )
@@ -1160,7 +1148,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
Atom pTypes[4] = { XA_PIXMAP, XA_PIXMAP,
XA_COLORMAP, XA_COLORMAP };
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
XChangeProperty( m_pDisplay,
m_aWindow,
@@ -1178,7 +1166,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
Atom* pReturnedTypes = (Atom*)aData.getArray();
if( pReturnedTypes[0] == XA_PIXMAP && pReturnedTypes[1] == XA_PIXMAP )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
Atom type = None;
int format = 0;
@@ -1226,7 +1214,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
// convert data if possible
if( aPixmap != None )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
sal_Int32 nOutSize = 0;
sal_uInt8* pBytes = X11_getBmpFromPixmap( m_pDisplay, aPixmap, aColormap, nOutSize );
@@ -1243,6 +1231,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
if( ! bSuccess )
{
+ int nFormat;
::std::list< Atom > aTypes;
convertTypeToNative( rType, selection, nFormat, aTypes );
::std::list< Atom >::const_iterator type_it;
@@ -1257,7 +1246,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
bSuccess = getPasteData( selection, nSelectedType, rData );
}
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "getPasteData for selection %s and data type %s returns %s, returned sequence has length %ld\n",
+ fprintf( stderr, "getPasteData for selection %s and data type %s returns %s, returned sequence has length %" SAL_PRIdINT32 "\n",
OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
bSuccess ? "true" : "false",
@@ -1271,9 +1260,9 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >& rTypes )
{
- ::std::hash_map< Atom, Selection* >::iterator it;
+ ::boost::unordered_map< Atom, Selection* >::iterator it;
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
it = m_aSelections.find( selection );
if( it != m_aSelections.end() &&
@@ -1304,7 +1293,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
{
const unsigned int atomcount = 256;
// more than three types; look in property
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
Atom nType;
int nFormat;
@@ -1422,7 +1411,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
Sequence< DataFlavor > aTemp( nNewFlavors );
for( i = 0; i < nNewFlavors-1; i++ )
aTemp.getArray()[i+1] = rTypes.getConstArray()[i];
- aTemp.getArray()[0].MimeType = OUString::createFromAscii( "text/plain;charset=utf-16" );
+ aTemp.getArray()[0].MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16"));
aTemp.getArray()[0].DataType = getCppuType( (OUString*)0 );
rTypes = aTemp;
@@ -1435,7 +1424,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
}
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
it = m_aSelections.find( selection );
if( it != m_aSelections.end() )
@@ -1462,7 +1451,6 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
}
#if OSL_DEBUG_LEVEL > 1
-// if( selection != m_nCLIPBOARDAtom )
{
fprintf( stderr, "SelectionManager::getPasteDataTypes( %s ) = %s\n", OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), bSuccess ? "true" : "false" );
for( int i = 0; i < rTypes.getLength(); i++ )
@@ -1477,7 +1465,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
PixmapHolder* SelectionManager::getPixmapHolder( Atom selection )
{
- std::hash_map< Atom, Selection* >::const_iterator it = m_aSelections.find( selection );
+ boost::unordered_map< Atom, Selection* >::const_iterator it = m_aSelections.find( selection );
if( it == m_aSelections.end() )
return NULL;
if( ! it->second->m_pPixmap )
@@ -1497,7 +1485,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
Atom property,
Atom selection )
{
- ResettableMutexGuard aGuard( m_aMutex );
+ osl::ResettableMutexGuard aGuard( m_aMutex );
// handle targets related to image/bmp
if( target == XA_COLORMAP || target == XA_PIXMAP || target == XA_BITMAP || target == XA_VISUALID )
@@ -1543,7 +1531,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
try
{
Any aResult =
- m_xBitmapConverter->invoke( OUString::createFromAscii( "convert-bitmap-depth" ),
+ m_xBitmapConverter->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")),
aArgs, aOutIndex, aOutArgs );
if( aResult >>= xBM )
aData = xBM->getDIB();
@@ -1599,10 +1587,10 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
{
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "using INCR protocol\n" );
- std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >::const_iterator win_it = m_aIncrementals.find( requestor );
+ boost::unordered_map< XLIB_Window, boost::unordered_map< Atom, IncrementalTransfer > >::const_iterator win_it = m_aIncrementals.find( requestor );
if( win_it != m_aIncrementals.end() )
{
- std::hash_map< Atom, IncrementalTransfer >::const_iterator inc_it = win_it->second.find( property );
+ boost::unordered_map< Atom, IncrementalTransfer >::const_iterator inc_it = win_it->second.find( property );
if( inc_it != win_it->second.end() )
{
const IncrementalTransfer& rInc = inc_it->second;
@@ -1657,7 +1645,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest )
{
- ResettableMutexGuard aGuard( m_aMutex );
+ osl::ResettableMutexGuard aGuard( m_aMutex );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "handleSelectionRequest for selection %s and target %s\n",
OUStringToOString( getString( rRequest.selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
@@ -1865,7 +1853,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify )
{
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
// data we requested arrived
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "handleReceivePropertyNotify for property %s\n",
@@ -1873,7 +1861,7 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify )
#endif
bool bHandled = false;
- ::std::hash_map< Atom, Selection* >::iterator it =
+ ::boost::unordered_map< Atom, Selection* >::iterator it =
m_aSelections.find( rNotify.atom );
if( it != m_aSelections.end() &&
rNotify.state == PropertyNewValue &&
@@ -1984,7 +1972,7 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent& rNotify )
bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify )
{
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
// ready for next part of a IncrementalTransfer
#if OSL_DEBUG_LEVEL > 1
@@ -1998,13 +1986,13 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify )
// feed incrementals
if( rNotify.state == PropertyDelete )
{
- std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >::iterator it;
+ boost::unordered_map< XLIB_Window, boost::unordered_map< Atom, IncrementalTransfer > >::iterator it;
it = m_aIncrementals.find( rNotify.window );
if( it != m_aIncrementals.end() )
{
bHandled = true;
int nCurrentTime = time( NULL );
- std::hash_map< Atom, IncrementalTransfer >::iterator inc_it;
+ boost::unordered_map< Atom, IncrementalTransfer >::iterator inc_it;
// throw out aborted transfers
std::list< Atom > aTimeouts;
for( inc_it = it->second.begin(); inc_it != it->second.end(); ++inc_it )
@@ -2084,14 +2072,14 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent& rNotify )
bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify )
{
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
bool bHandled = false;
// notification about success/failure of one of our conversion requests
#if OSL_DEBUG_LEVEL > 1
OUString aSelection( getString( rNotify.selection ) );
- OUString aProperty( OUString::createFromAscii( "None" ) );
+ OUString aProperty(RTL_CONSTASCII_USTRINGPARAM("None"));
if( rNotify.property )
aProperty = getString( rNotify.property );
fprintf( stderr, "handleSelectionNotify for selection %s and property %s (0x%lx)\n",
@@ -2102,7 +2090,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify )
if( rNotify.requestor != m_aWindow && rNotify.requestor != m_aCurrentDropWindow )
fprintf( stderr, "Warning: selection notify for unknown window 0x%lx\n", rNotify.requestor );
#endif
- ::std::hash_map< Atom, Selection* >::iterator it =
+ ::boost::unordered_map< Atom, Selection* >::iterator it =
m_aSelections.find( rNotify.selection );
if (
(rNotify.requestor == m_aWindow || rNotify.requestor == m_aCurrentDropWindow) &&
@@ -2177,7 +2165,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify )
bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
{
- ResettableMutexGuard aGuard(m_aMutex);
+ osl::ResettableMutexGuard aGuard(m_aMutex);
// handle drop related events
XLIB_Window aSource = rMessage.data.l[0];
@@ -2185,7 +2173,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
bool bHandled = false;
- ::std::hash_map< XLIB_Window, DropTargetEntry >::iterator it =
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >::iterator it =
m_aDropTargets.find( aTarget );
#if OSL_DEBUG_LEVEL > 1
@@ -2210,7 +2198,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
m_bDropWaitingForCompletion && m_aDropEnterEvent.data.l[0] )
{
bHandled = true;
- OSL_ENSURE( 0, "someone forgot to call dropComplete ?" );
+ OSL_FAIL( "someone forgot to call dropComplete ?" );
// some listener forgot to call dropComplete in the last operation
// let us end it now and accept the new enter event
aGuard.clear();
@@ -2359,7 +2347,7 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, XLIB_Time )
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
if( aDropWindow == m_aCurrentDropWindow )
{
@@ -2416,7 +2404,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow,
m_bDropWaitingForCompletion = false;
}
else
- OSL_ASSERT( "dropComplete from invalid DropTargetDropContext" );
+ OSL_FAIL( "dropComplete from invalid DropTargetDropContext" );
}
/*
@@ -2427,7 +2415,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow,
void SelectionManager::sendDragStatus( Atom nDropAction )
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
if( m_xDragSourceListener.is() )
{
@@ -2556,12 +2544,12 @@ bool SelectionManager::updateDragAction( int modifierState )
void SelectionManager::sendDropPosition( bool bForce, XLIB_Time eventTime )
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
if( m_bDropSent )
return;
- ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
if( it != m_aDropTargets.end() )
{
@@ -2619,12 +2607,12 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
if( ! m_xDragSourceListener.is() )
return false;
- ResettableMutexGuard aGuard(m_aMutex);
+ osl::ResettableMutexGuard aGuard(m_aMutex);
bool bHandled = false;
// for shortcut
- ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
#if OSL_DEBUG_LEVEL > 1
switch( rMessage.type )
@@ -2633,7 +2621,6 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
fprintf( stderr, "handleDragEvent: %s\n", OUStringToOString( getString( rMessage.xclient.message_type ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
break;
case MotionNotify:
-// fprintf( stderr, "handleDragEvent: MotionNotify\n" );
break;
case EnterNotify:
fprintf( stderr, "handleDragEvent: EnterNotify\n" );
@@ -3076,7 +3063,7 @@ int SelectionManager::getXdndVersion( XLIB_Window aWindow, XLIB_Window& rProxy )
void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot )
{
- ResettableMutexGuard aGuard( m_aMutex );
+ osl::ResettableMutexGuard aGuard( m_aMutex );
css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
@@ -3126,7 +3113,7 @@ void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot )
dsde.DropAction = nNewProtocolVersion >= 0 ? m_nUserDragAction : DNDConstants::ACTION_COPY;
dsde.UserAction = nNewProtocolVersion >= 0 ? m_nUserDragAction : DNDConstants::ACTION_COPY;
- ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it;
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it;
if( aNewCurrentWindow != m_aDropWindow )
{
#if OSL_DEBUG_LEVEL > 1
@@ -3271,7 +3258,7 @@ void SelectionManager::startDrag(
SalFrame* pCaptureFrame = NULL;
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
// first get the current pointer position and the window that
// the pointer is located in. since said window should be one
@@ -3281,7 +3268,7 @@ void SelectionManager::startDrag(
int root_x, root_y, win_x, win_y;
unsigned int mask;
- ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it;
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it;
it = m_aDropTargets.begin();
while( it != m_aDropTargets.end() )
{
@@ -3347,7 +3334,7 @@ void SelectionManager::startDrag(
*/
if( nPointerGrabSuccess != GrabSuccess )
{
- vos::IMutex& rSolarMutex( Application::GetSolarMutex() );
+ osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() );
if( rSolarMutex.tryToAcquire() )
{
pCaptureFrame = GetX11SalData()->GetDisplay()->GetCaptureFrame();
@@ -3388,12 +3375,12 @@ void SelectionManager::startDrag(
listener->dragDropEnd( aDragFailedEvent );
if( pCaptureFrame )
{
- vos::IMutex& rSolarMutex( Application::GetSolarMutex() );
+ osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() );
if( rSolarMutex.tryToAcquire() )
GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame );
#if OSL_DEBUG_LEVEL > 0
else
- OSL_ENSURE( 0, "failed to acquire SolarMutex to reset capture frame" );
+ OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" );
#endif
}
return;
@@ -3477,12 +3464,12 @@ void SelectionManager::startDrag(
if( pCaptureFrame )
{
- vos::IMutex& rSolarMutex( Application::GetSolarMutex() );
+ osl::SolarMutex& rSolarMutex( Application::GetSolarMutex() );
if( rSolarMutex.tryToAcquire() )
GetX11SalData()->GetDisplay()->CaptureMouse( pCaptureFrame );
#if OSL_DEBUG_LEVEL > 0
else
- OSL_ENSURE( 0, "failed to acquire SolarMutex to reset capture frame" );
+ OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" );
#endif
}
@@ -3521,7 +3508,7 @@ void SelectionManager::dragDoDispatch()
fprintf( stderr, "end executeDrag dispatching\n" );
#endif
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
css::uno::Reference< XTransferable > xTransferable( m_xDragSourceTransferable );
@@ -3581,7 +3568,7 @@ sal_Int32 SelectionManager::getCurrentCursor()
void SelectionManager::setCursor( sal_Int32 cursor, XLIB_Window aDropWindow, XLIB_Time )
{
- MutexGuard aGuard( m_aMutex );
+ osl::MutexGuard aGuard( m_aMutex );
if( aDropWindow == m_aDropWindow && XLIB_Cursor(cursor) != m_aCurrentCursor )
{
if( m_xDragSourceListener.is() && ! m_bDropSent )
@@ -3603,7 +3590,7 @@ void SelectionManager::setImage( sal_Int32, XLIB_Window, XLIB_Time )
void SelectionManager::transferablesFlavorsChanged()
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
m_aDragFlavors = m_xDragSourceTransferable->getTransferDataFlavors();
int i;
@@ -3661,7 +3648,7 @@ bool SelectionManager::handleXEvent( XEvent& rEvent )
* to get client messages it is essential not to dispatch
* events twice that we get on both connections
*
- * #95201# between dispatching ButtonPress and startDrag
+ * between dispatching ButtonPress and startDrag
* the user can already have released the mouse. The ButtonRelease
* will then be dispatched in VCLs queue and never turn up here.
* Which is not so good, since startDrag will XGrabPointer and
@@ -3679,14 +3666,14 @@ bool SelectionManager::handleXEvent( XEvent& rEvent )
{
case SelectionClear:
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "SelectionClear for selection %s\n",
OUStringToOString( getString( rEvent.xselectionclear.selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
);
#endif
SelectionAdaptor* pAdaptor = getAdaptor( rEvent.xselectionclear.selection );
- std::hash_map< Atom, Selection* >::iterator it( m_aSelections.find( rEvent.xselectionclear.selection ) );
+ boost::unordered_map< Atom, Selection* >::iterator it( m_aSelections.find( rEvent.xselectionclear.selection ) );
if( it != m_aSelections.end() )
it->second->m_bOwner = false;
aGuard.clear();
@@ -3742,41 +3729,29 @@ bool SelectionManager::handleXEvent( XEvent& rEvent )
void SelectionManager::dispatchEvent( int millisec )
{
- pollfd aPollFD;
- XEvent event;
-
- // query socket handle to poll on
- aPollFD.fd = ConnectionNumber( m_pDisplay );
- aPollFD.events = POLLIN;
- aPollFD.revents = 0;
-
- // wait for activity (outside the xlib)
- if( poll( &aPollFD, 1, millisec ) > 0 )
+ // acquire the mutex to prevent other threads
+ // from using the same X connection
+ osl::ResettableMutexGuard aGuard(m_aMutex);
+
+ if( !XPending( m_pDisplay ))
+ { // wait for any events if none are already queued
+ pollfd aPollFD;
+ aPollFD.fd = XConnectionNumber( m_pDisplay );
+ aPollFD.events = POLLIN;
+ aPollFD.revents = 0;
+ // release mutex for the time of waiting for possible data
+ aGuard.clear();
+ if( poll( &aPollFD, 1, millisec ) <= 0 )
+ return;
+ aGuard.reset();
+ }
+ while( XPending( m_pDisplay ))
{
- // now acquire the mutex to prevent other threads
- // from using the same X connection
- ResettableMutexGuard aGuard(m_aMutex);
-
- // prevent that another thread already ate the input
- // this can happen if e.g. another thread does
- // an X request getting a response. the response
- // would be removed from the queue and we would end up
- // with an empty socket here
- if( poll( &aPollFD, 1, 0 ) > 0 )
- {
- int nPending = 1;
- while( nPending )
- {
- nPending = XPending( m_pDisplay );
- if( nPending )
- {
- XNextEvent( m_pDisplay, &event );
- aGuard.clear();
- handleXEvent( event );
- aGuard.reset();
- }
- }
- }
+ XEvent event;
+ XNextEvent( m_pDisplay, &event );
+ aGuard.clear();
+ handleXEvent( event );
+ aGuard.reset();
}
}
@@ -3797,7 +3772,7 @@ void SelectionManager::run( void* pThis )
css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
if( xFact.is() )
{
- css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY );
+ css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
if( xDesktop.is() )
xDesktop->addTerminateListener(This);
}
@@ -3811,10 +3786,10 @@ void SelectionManager::run( void* pThis )
if( (aNow.tv_sec - aLast.tv_sec) > 0 )
{
- ClearableMutexGuard aGuard(This->m_aMutex);
+ osl::ClearableMutexGuard aGuard(This->m_aMutex);
std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList;
- for( std::hash_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it )
+ for( boost::unordered_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it )
{
if( it->first != This->m_nXdndSelection && ! it->second->m_bOwner )
{
@@ -3844,7 +3819,7 @@ void SelectionManager::run( void* pThis )
void SelectionManager::shutdown() throw()
{
- ResettableMutexGuard aGuard(m_aMutex);
+ osl::ResettableMutexGuard aGuard(m_aMutex);
if( m_bShutDown )
{
return;
@@ -3872,7 +3847,7 @@ void SelectionManager::shutdown() throw()
aGuard.clear();
while (osl_isThreadRunning(m_aThread))
{
- vos::OGuard guard2(Application::GetSolarMutex());
+ SolarMutexGuard guard2;
Application::Reschedule();
}
osl_joinWithThread( m_aThread );
@@ -3904,7 +3879,7 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw()
if( nTimestamp != CurrentTime )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
m_nSelectionTimestamp = nTimestamp;
}
@@ -3952,7 +3927,7 @@ void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang:
void SelectionManager::registerHandler( Atom selection, SelectionAdaptor& rAdaptor )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
Selection* pNewSelection = new Selection();
pNewSelection->m_pAdaptor = &rAdaptor;
@@ -3964,9 +3939,9 @@ void SelectionManager::registerHandler( Atom selection, SelectionAdaptor& rAdapt
void SelectionManager::deregisterHandler( Atom selection )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
- ::std::hash_map< Atom, Selection* >::iterator it =
+ ::boost::unordered_map< Atom, Selection* >::iterator it =
m_aSelections.find( selection );
if( it != m_aSelections.end() )
{
@@ -3992,13 +3967,13 @@ extern "C"
void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTarget )
{
- MutexGuard aGuard(m_aMutex);
+ osl::MutexGuard aGuard(m_aMutex);
// sanity check
- ::std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( aWindow );
if( it != m_aDropTargets.end() )
- OSL_ASSERT( "attempt to register window as drop target twice" );
+ OSL_FAIL( "attempt to register window as drop target twice" );
else if( aWindow && m_pDisplay )
{
DropTargetEntry aEntry( pTarget );
@@ -4029,20 +4004,20 @@ void SelectionManager::registerDropTarget( XLIB_Window aWindow, DropTarget* pTar
m_aDropTargets[ aWindow ] = aEntry;
}
else
- OSL_ASSERT( "attempt to register None as drop target" );
+ OSL_FAIL( "attempt to register None as drop target" );
}
// ------------------------------------------------------------------------
void SelectionManager::deregisterDropTarget( XLIB_Window aWindow )
{
- ClearableMutexGuard aGuard(m_aMutex);
+ osl::ClearableMutexGuard aGuard(m_aMutex);
m_aDropTargets.erase( aWindow );
if( aWindow == m_aDragSourceWindow && m_aDragRunning.check() )
{
// abort drag
- std::hash_map< XLIB_Window, DropTargetEntry >::const_iterator it =
+ boost::unordered_map< XLIB_Window, DropTargetEntry >::const_iterator it =
m_aDropTargets.find( m_aDropWindow );
if( it != m_aDropTargets.end() )
{
@@ -4189,7 +4164,7 @@ void SelectionManagerHolder::startDrag(
OUString SelectionManagerHolder::getImplementationName() throw()
{
- return OUString::createFromAscii(XDND_IMPLEMENTATION_NAME);
+ return OUString(RTL_CONSTASCII_USTRINGPARAM(XDND_IMPLEMENTATION_NAME));
}
// ------------------------------------------------------------------------
@@ -4215,3 +4190,4 @@ Sequence< OUString > SelectionManagerHolder::getSupportedServiceNames() throw()
// ------------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx b/vcl/unx/generic/dtrans/X11_selection.hxx
index 34a50819bfed..42158e99802b 100644
--- a/vcl/unx/generic/dtrans/X11_selection.hxx
+++ b/vcl/unx/generic/dtrans/X11_selection.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,11 +41,9 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <osl/thread.h>
-#ifndef _OSL_CONDITION_HXX_
#include <osl/conditn.hxx>
-#endif
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <list>
#include "tools/prex.h"
@@ -164,7 +163,7 @@ namespace x11 {
>,
public SelectionAdaptor
{
- static ::std::hash_map< ::rtl::OUString, SelectionManager*, ::rtl::OUStringHash >& getInstances();
+ static ::boost::unordered_map< ::rtl::OUString, SelectionManager*, ::rtl::OUStringHash >& getInstances();
// for INCR type selection transfer
// INCR protocol is used if the data cannot
@@ -336,7 +335,7 @@ namespace x11 {
// drag and drop
int m_nCurrentProtocolVersion;
- ::std::hash_map< XLIB_Window, DropTargetEntry >
+ ::boost::unordered_map< XLIB_Window, DropTargetEntry >
m_aDropTargets;
@@ -367,16 +366,16 @@ namespace x11 {
Atom m_nXdndActionPrivate;
// caching for atoms
- ::std::hash_map< Atom, ::rtl::OUString >
+ ::boost::unordered_map< Atom, ::rtl::OUString >
m_aAtomToString;
- ::std::hash_map< ::rtl::OUString, Atom, ::rtl::OUStringHash >
+ ::boost::unordered_map< ::rtl::OUString, Atom, ::rtl::OUStringHash >
m_aStringToAtom;
// the registered selections
- ::std::hash_map< Atom, Selection* >
+ ::boost::unordered_map< Atom, Selection* >
m_aSelections;
// IncrementalTransfers in progress
- std::hash_map< XLIB_Window, std::hash_map< Atom, IncrementalTransfer > >
+ boost::unordered_map< XLIB_Window, boost::unordered_map< Atom, IncrementalTransfer > >
m_aIncrementals;
// do not use X11 multithreading capabilities
@@ -404,7 +403,7 @@ namespace x11 {
void sendDropPosition( bool bForce, XLIB_Time eventXLIB_Time );
bool updateDragAction( int modifierState );
int getXdndVersion( XLIB_Window aXLIB_Window, XLIB_Window& rProxy );
- XLIB_Cursor createCursor( const char* pPointerData, const char* pMaskData, int width, int height, int hotX, int hotY );
+ XLIB_Cursor createCursor( const unsigned char* pPointerData, const unsigned char* pMaskData, int width, int height, int hotX, int hotY );
// coordinates on root XLIB_Window
void updateDragWindow( int nX, int nY, XLIB_Window aRoot );
@@ -530,3 +529,5 @@ namespace x11 {
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx
index fa7fc6a65589..bdfdd4bb7a91 100644
--- a/vcl/unx/generic/dtrans/X11_service.cxx
+++ b/vcl/unx/generic/dtrans/X11_service.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,31 +46,32 @@ namespace css = com::sun::star;
}
-using namespace rtl;
using namespace cppu;
using namespace com::sun::star::lang;
using namespace com::sun::star::datatransfer::clipboard;
using namespace com::sun::star::awt;
using namespace x11;
+using ::rtl::OUString;
+
Sequence< OUString > SAL_CALL x11::X11Clipboard_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard");
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard"));
return aRet;
}
Sequence< OUString > SAL_CALL x11::Xdnd_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DragSource");
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DragSource"));
return aRet;
}
Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.dnd.X11DropTarget");
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DropTarget"));
return aRet;
}
@@ -77,7 +79,7 @@ Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames()
css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
{
- static std::hash_map< OUString, ::std::hash_map< Atom, css::uno::Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances;
+ static boost::unordered_map< OUString, ::boost::unordered_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances;
OUString aDisplayName;
Atom nSelection;
@@ -110,11 +112,11 @@ css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequenc
else
{
// default atom is clipboard selection
- nSelection = rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) );
+ nSelection = rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) );
}
- ::std::hash_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] );
- ::std::hash_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection );
+ ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] );
+ ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection );
if( it != rMap.end() )
return it->second;
@@ -139,3 +141,4 @@ css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_transferable.cxx b/vcl/unx/generic/dtrans/X11_transferable.cxx
index 16518f0b2864..076da0917a40 100644
--- a/vcl/unx/generic/dtrans/X11_transferable.cxx
+++ b/vcl/unx/generic/dtrans/X11_transferable.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,11 +43,11 @@ using namespace com::sun::star::io;
using namespace com::sun::star::uno;
using namespace cppu;
using namespace osl;
-using namespace rtl;
-
using namespace x11;
+using ::rtl::OUString;
+
X11Transferable::X11Transferable(
SelectionManager& rManager,
@@ -74,13 +75,13 @@ Any SAL_CALL X11Transferable::getTransferData( const DataFlavor& rFlavor )
Sequence< sal_Int8 > aData;
bool bSuccess = m_rManager.getPasteData( m_aSelection ? m_aSelection : XA_PRIMARY, rFlavor.MimeType, aData );
if( ! bSuccess && m_aSelection == 0 )
- bSuccess = m_rManager.getPasteData( m_rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ), rFlavor.MimeType, aData );
+ bSuccess = m_rManager.getPasteData( m_rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ), rFlavor.MimeType, aData );
if( ! bSuccess )
{
throw UnsupportedFlavorException( rFlavor.MimeType, static_cast < XTransferable * > ( this ) );
}
- if( rFlavor.MimeType.equalsIgnoreAsciiCase( OUString::createFromAscii( "text/plain;charset=utf-16" ) ) )
+ if( rFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")) ) )
{
int nLen = aData.getLength()/2;
if( ((sal_Unicode*)aData.getConstArray())[nLen-1] == 0 )
@@ -106,7 +107,7 @@ Sequence< DataFlavor > SAL_CALL X11Transferable::getTransferDataFlavors()
Sequence< DataFlavor > aFlavorList;
bool bSuccess = m_rManager.getPasteDataTypes( m_aSelection ? m_aSelection : XA_PRIMARY, aFlavorList );
if( ! bSuccess && m_aSelection == 0 )
- bSuccess = m_rManager.getPasteDataTypes( m_rManager.getAtom( OUString::createFromAscii( "CLIPBOARD" ) ), aFlavorList );
+ bSuccess = m_rManager.getPasteDataTypes( m_rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ), aFlavorList );
return aFlavorList;
}
@@ -118,7 +119,7 @@ sal_Bool SAL_CALL X11Transferable::isDataFlavorSupported( const DataFlavor& aFla
{
if( aFlavor.DataType != getCppuType( (Sequence< sal_Int8 >*)0 ) )
{
- if( ! aFlavor.MimeType.equalsIgnoreAsciiCase( OUString::createFromAscii( "text/plain;charset=utf-16" ) ) &&
+ if( ! aFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")) ) &&
aFlavor.DataType == getCppuType( (OUString*)0 ) )
return false;
}
@@ -132,3 +133,4 @@ sal_Bool SAL_CALL X11Transferable::isDataFlavorSupported( const DataFlavor& aFla
return sal_False;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_transferable.hxx b/vcl/unx/generic/dtrans/X11_transferable.hxx
index 65f7d1fdc475..683faa0a7f87 100644
--- a/vcl/unx/generic/dtrans/X11_transferable.hxx
+++ b/vcl/unx/generic/dtrans/X11_transferable.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,9 +32,7 @@
#include <X11_selection.hxx>
#include <com/sun/star/datatransfer/XTransferable.hpp>
-#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HDL_
#include <com/sun/star/lang/XEventListener.hpp>
-#endif
#include <cppuhelper/implbase1.hxx>
namespace x11 {
@@ -70,3 +69,5 @@ namespace x11 {
} // namespace
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx
index 1ccd04eba725..57ad8ecf8a4d 100644
--- a/vcl/unx/generic/dtrans/bmp.cxx
+++ b/vcl/unx/generic/dtrans/bmp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,12 +36,12 @@
#include <bmp.hxx>
#include <X11_selection.hxx>
+#include <sal/macros.h>
using namespace x11;
using namespace com::sun::star::uno;
using namespace com::sun::star::script;
using namespace com::sun::star::awt;
-using namespace rtl;
/*
* helper functions
@@ -423,7 +424,7 @@ PixmapHolder::PixmapHolder( Display* pDisplay ) :
{ "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" };
fprintf( stderr, "PixmapHolder visual: id = 0x%lx, class = %s (%d), depth=%d; color map = 0x%lx\n",
m_aInfo.visualid,
- (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < sizeof(pClasses)/sizeof(pClasses[0])) ? pClasses[m_aInfo.c_class] : "<unknown>",
+ (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < SAL_N_ELEMENTS(pClasses)) ? pClasses[m_aInfo.c_class] : "<unknown>",
m_aInfo.c_class,
m_aInfo.depth,
m_aColormap );
@@ -737,3 +738,5 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData )
return m_aPixmap;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/bmp.hxx b/vcl/unx/generic/dtrans/bmp.hxx
index b59b4417ca69..6d2e76bae0bb 100644
--- a/vcl/unx/generic/dtrans/bmp.hxx
+++ b/vcl/unx/generic/dtrans/bmp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -103,3 +104,5 @@ public:
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx
index 001da3900bb7..5f711da47434 100644
--- a/vcl/unx/generic/dtrans/config.cxx
+++ b/vcl/unx/generic/dtrans/config.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -56,9 +57,10 @@ public:
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
-using namespace rtl;
using namespace x11;
+using ::rtl::OUString;
+
sal_Int32 SelectionManager::getSelectionTimeout()
{
if( m_nSelectionTimeout < 1 )
@@ -66,7 +68,7 @@ sal_Int32 SelectionManager::getSelectionTimeout()
DtransX11ConfigItem aCfg;
m_nSelectionTimeout = aCfg.getSelectionTimeout();
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "initialized selection timeout to %ld seconds\n", m_nSelectionTimeout );
+ fprintf( stderr, "initialized selection timeout to %" SAL_PRIdINT32 " seconds\n", m_nSelectionTimeout );
#endif
}
return m_nSelectionTimeout;
@@ -87,7 +89,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
aKeys.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SELECTION_PROPERTY ) );
Sequence< Any > aValues = GetProperties( aKeys );
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "found %ld properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
+ fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
#endif
Any* pValue = aValues.getArray();
for( int i = 0; i < aValues.getLength(); i++, pValue++ )
@@ -146,3 +148,4 @@ void DtransX11ConfigItem::Notify( const Sequence< OUString >& /*rPropertyNames*/
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/copydata_curs.h b/vcl/unx/generic/dtrans/copydata_curs.h
index e3d0e3e76530..a882a541a6d7 100644
--- a/vcl/unx/generic/dtrans/copydata_curs.h
+++ b/vcl/unx/generic/dtrans/copydata_curs.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define copydata_curs_height 32
#define copydata_curs_x_hot 1
#define copydata_curs_y_hot 1
-static char copydata_curs_bits[] = {
+static unsigned char copydata_curs_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
@@ -40,3 +41,5 @@ static char copydata_curs_bits[] = {
0xa8, 0xf2, 0x1e, 0x00, 0x50, 0x35, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00,
0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/copydata_mask.h b/vcl/unx/generic/dtrans/copydata_mask.h
index f25b0863d807..9cd73b08d106 100644
--- a/vcl/unx/generic/dtrans/copydata_mask.h
+++ b/vcl/unx/generic/dtrans/copydata_mask.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define copydata_mask_height 32
#define copydata_mask_x_hot 1
#define copydata_mask_y_hot 1
-static char copydata_mask_bits[] = {
+static unsigned char copydata_mask_bits[] = {
0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
@@ -40,3 +41,5 @@ static char copydata_mask_bits[] = {
0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00,
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/linkdata_curs.h b/vcl/unx/generic/dtrans/linkdata_curs.h
index c60edc3b99d0..054ef55ef2bb 100644
--- a/vcl/unx/generic/dtrans/linkdata_curs.h
+++ b/vcl/unx/generic/dtrans/linkdata_curs.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define linkdata_curs_height 32
#define linkdata_curs_x_hot 1
#define linkdata_curs_y_hot 1
-static char linkdata_curs_bits[] = {
+static unsigned char linkdata_curs_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
@@ -40,3 +41,5 @@ static char linkdata_curs_bits[] = {
0xa8, 0x72, 0x18, 0x00, 0x50, 0x35, 0x1a, 0x00, 0x00, 0x30, 0x1f, 0x00,
0x00, 0xb0, 0x1f, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/linkdata_mask.h b/vcl/unx/generic/dtrans/linkdata_mask.h
index cf0f89f63b1b..429c603066dc 100644
--- a/vcl/unx/generic/dtrans/linkdata_mask.h
+++ b/vcl/unx/generic/dtrans/linkdata_mask.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define linkdata_mask_height 32
#define linkdata_mask_x_hot 1
#define linkdata_mask_y_hot 1
-static char linkdata_mask_bits[] = {
+static unsigned char linkdata_mask_bits[] = {
0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
@@ -40,3 +41,5 @@ static char linkdata_mask_bits[] = {
0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00,
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/movedata_curs.h b/vcl/unx/generic/dtrans/movedata_curs.h
index b79412bc3f41..642bbd176e4b 100644
--- a/vcl/unx/generic/dtrans/movedata_curs.h
+++ b/vcl/unx/generic/dtrans/movedata_curs.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define movedata_curs_height 32
#define movedata_curs_x_hot 1
#define movedata_curs_y_hot 1
-static char movedata_curs_bits[] = {
+static unsigned char movedata_curs_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
@@ -40,3 +41,5 @@ static char movedata_curs_bits[] = {
0xa8, 0xaa, 0x00, 0x00, 0x50, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/movedata_mask.h b/vcl/unx/generic/dtrans/movedata_mask.h
index e25d0837d8dc..f06c80f1728c 100644
--- a/vcl/unx/generic/dtrans/movedata_mask.h
+++ b/vcl/unx/generic/dtrans/movedata_mask.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define movedata_mask_height 32
#define movedata_mask_x_hot 1
#define movedata_mask_y_hot 1
-static char movedata_mask_bits[] = {
+static unsigned char movedata_mask_bits[] = {
0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
@@ -40,3 +41,5 @@ static char movedata_mask_bits[] = {
0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/nodrop_curs.h b/vcl/unx/generic/dtrans/nodrop_curs.h
index 8e208e32f293..5c501d3876c4 100644
--- a/vcl/unx/generic/dtrans/nodrop_curs.h
+++ b/vcl/unx/generic/dtrans/nodrop_curs.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define nodrop_curs_height 32
#define nodrop_curs_x_hot 9
#define nodrop_curs_y_hot 9
-static char nodrop_curs_bits[] = {
+static unsigned char nodrop_curs_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00,
0xf8, 0x7f, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0x1c, 0xfc, 0x00, 0x00,
0x1e, 0xfe, 0x01, 0x00, 0x0e, 0xdf, 0x01, 0x00, 0x8e, 0xcf, 0x01, 0x00,
@@ -40,3 +41,5 @@ static char nodrop_curs_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/nodrop_mask.h b/vcl/unx/generic/dtrans/nodrop_mask.h
index 7cbecef2c60f..bd315dc28df1 100644
--- a/vcl/unx/generic/dtrans/nodrop_mask.h
+++ b/vcl/unx/generic/dtrans/nodrop_mask.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,7 @@
#define nodrop_mask_height 32
#define nodrop_mask_x_hot 9
#define nodrop_mask_y_hot 9
-static char nodrop_mask_bits[] = {
+static unsigned char nodrop_mask_bits[] = {
0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00,
0xfc, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x7e, 0xfe, 0x01, 0x00,
0x3f, 0xff, 0x03, 0x00, 0x9f, 0xff, 0x03, 0x00, 0xdf, 0xff, 0x03, 0x00,
@@ -40,3 +41,5 @@ static char nodrop_mask_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/afm_hash.cpp b/vcl/unx/generic/fontmanager/afm_hash.cpp
deleted file mode 100755
index de01d8cd0434..000000000000
--- a/vcl/unx/generic/fontmanager/afm_hash.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/* C++ code produced by gperf version 3.0.1 */
-/* Command-line: gperf -C -t -l -L C++ -m 20 -Z AfmKeywordHash afm_keyword_list */
-/* Computed positions: -k'1,4,6,$' */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "afm_keyword_list"
-struct hash_entry { const char* name; enum parseKey eKey; };
-
-#define TOTAL_KEYWORDS 56
-#define MIN_WORD_LENGTH 1
-#define MAX_WORD_LENGTH 18
-#define MIN_HASH_VALUE 1
-#define MAX_HASH_VALUE 57
-/* maximum key range = 57, duplicates = 0 */
-
-class AfmKeywordHash
-{
-private:
- static inline unsigned int hash (const char *str, unsigned int len);
-public:
- static const struct hash_entry *in_word_set (const char *str, unsigned int len);
-};
-
-inline unsigned int
-AfmKeywordHash::hash (register const char *str, register unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 28, 1, 0, 9, 0,
- 19, 58, 2, 10, 58, 0, 28, 0, 20, 58,
- 44, 58, 58, 0, 16, 10, 24, 2, 3, 58,
- 58, 58, 58, 58, 58, 58, 58, 6, 58, 0,
- 19, 0, 58, 25, 14, 6, 58, 58, 17, 11,
- 0, 17, 39, 58, 0, 0, 10, 58, 58, 58,
- 13, 4, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58
- };
- register int hval = len;
-
- switch (hval)
- {
- default:
- hval += asso_values[(unsigned char)str[5]];
- /*FALLTHROUGH*/
- case 5:
- case 4:
- hval += asso_values[(unsigned char)str[3]];
- /*FALLTHROUGH*/
- case 3:
- case 2:
- case 1:
- hval += asso_values[(unsigned char)str[0]];
- break;
- }
- return hval + asso_values[(unsigned char)str[len - 1]];
-}
-
-const struct hash_entry *
-AfmKeywordHash::in_word_set (register const char *str, register unsigned int len)
-{
- static const unsigned char lengthtable[] =
- {
- 0, 1, 2, 1, 2, 1, 3, 2, 3, 5, 10, 11, 12, 2,
- 14, 15, 16, 11, 9, 13, 14, 12, 12, 14, 13, 9, 7, 9,
- 7, 9, 14, 5, 6, 14, 12, 16, 10, 14, 11, 10, 7, 1,
- 12, 8, 17, 18, 2, 3, 7, 1, 8, 8, 13, 6, 6, 8,
- 0, 1
- };
- static const struct hash_entry wordlist[] =
- {
- {"",NOPE},
-#line 6 "afm_keyword_list"
- {"C",CODE},
-#line 7 "afm_keyword_list"
- {"CC",COMPCHAR},
-#line 5 "afm_keyword_list"
- {"B",CHARBBOX},
-#line 8 "afm_keyword_list"
- {"CH",CODEHEX},
-#line 54 "afm_keyword_list"
- {"W",XYWIDTH},
-#line 33 "afm_keyword_list"
- {"KPX",KERNPAIRXAMT},
-#line 56 "afm_keyword_list"
- {"WX",XWIDTH},
-#line 55 "afm_keyword_list"
- {"W0X",X0WIDTH},
-#line 47 "afm_keyword_list"
- {"StdHW",STDHW},
-#line 12 "afm_keyword_list"
- {"Characters",CHARACTERS},
-#line 36 "afm_keyword_list"
- {"MetricsSets",METRICSSETS},
-#line 23 "afm_keyword_list"
- {"EndKernPairs",ENDKERNPAIRS},
-#line 16 "afm_keyword_list"
- {"Em",EM},
-#line 45 "afm_keyword_list"
- {"StartKernPairs",STARTKERNPAIRS},
-#line 41 "afm_keyword_list"
- {"StartComposites",STARTCOMPOSITES},
-#line 40 "afm_keyword_list"
- {"StartCharMetrics",STARTCHARMETRICS},
-#line 22 "afm_keyword_list"
- {"EndKernData",ENDKERNDATA},
-#line 14 "afm_keyword_list"
- {"Descender",DESCENDER},
-#line 44 "afm_keyword_list"
- {"StartKernData",STARTKERNDATA},
-#line 18 "afm_keyword_list"
- {"EndCharMetrics",ENDCHARMETRICS},
-#line 20 "afm_keyword_list"
- {"EndDirection",ENDDIRECTION},
-#line 11 "afm_keyword_list"
- {"CharacterSet",CHARACTERSET},
-#line 42 "afm_keyword_list"
- {"StartDirection",STARTDIRECTION},
-#line 19 "afm_keyword_list"
- {"EndComposites",ENDCOMPOSITES},
-#line 49 "afm_keyword_list"
- {"TrackKern",TRACKKERN},
-#line 15 "afm_keyword_list"
- {"Descent",DESCENT},
-#line 9 "afm_keyword_list"
- {"CapHeight",CAPHEIGHT},
-#line 13 "afm_keyword_list"
- {"Comment",COMMENT},
-#line 10 "afm_keyword_list"
- {"CharWidth",CHARWIDTH},
-#line 46 "afm_keyword_list"
- {"StartTrackKern",STARTTRACKKERN},
-#line 48 "afm_keyword_list"
- {"StdVW",STDVW},
-#line 38 "afm_keyword_list"
- {"Notice",NOTICE},
-#line 21 "afm_keyword_list"
- {"EndFontMetrics",ENDFONTMETRICS},
-#line 24 "afm_keyword_list"
- {"EndTrackKern",ENDTRACKKERN},
-#line 43 "afm_keyword_list"
- {"StartFontMetrics",STARTFONTMETRICS},
-#line 29 "afm_keyword_list"
- {"IsBaseFont",ISBASEFONT},
-#line 17 "afm_keyword_list"
- {"EncodingScheme",ENCODINGSCHEME},
-#line 31 "afm_keyword_list"
- {"ItalicAngle",ITALICANGLE},
-#line 25 "afm_keyword_list"
- {"FamilyName",FAMILYNAME},
-#line 58 "afm_keyword_list"
- {"XHeight",XHEIGHT},
-#line 37 "afm_keyword_list"
- {"N",CHARNAME},
-#line 30 "afm_keyword_list"
- {"IsFixedPitch",ISFIXEDPITCH},
-#line 27 "afm_keyword_list"
- {"FontName",FONTNAME},
-#line 50 "afm_keyword_list"
- {"UnderlinePosition",UNDERLINEPOSITION},
-#line 51 "afm_keyword_list"
- {"UnderlineThickness",UNDERLINETHICKNESS},
-#line 32 "afm_keyword_list"
- {"KP",KERNPAIR},
-#line 39 "afm_keyword_list"
- {"PCC",COMPCHARPIECE},
-#line 53 "afm_keyword_list"
- {"Version",VERSION},
-#line 52 "afm_keyword_list"
- {"V",VVECTOR},
-#line 28 "afm_keyword_list"
- {"FullName",FULLNAME},
-#line 26 "afm_keyword_list"
- {"FontBBox",FONTBBOX},
-#line 35 "afm_keyword_list"
- {"MappingScheme",MAPPINGSCHEME},
-#line 57 "afm_keyword_list"
- {"Weight",WEIGHT},
-#line 4 "afm_keyword_list"
- {"Ascent",ASCENT},
-#line 3 "afm_keyword_list"
- {"Ascender",ASCENDER},
- {"",NOPE},
-#line 34 "afm_keyword_list"
- {"L",LIGATURE}
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- if (len == lengthtable[key])
- {
- register const char *s = wordlist[key].name;
-
- if (*str == *s && !memcmp (str + 1, s + 1, len - 1))
- return &wordlist[key];
- }
- }
- return 0;
-}
diff --git a/vcl/unx/generic/fontmanager/afm_keyword_list b/vcl/unx/generic/fontmanager/afm_keyword_list
index 263d76bca4d3..c9bb13467e3e 100755
--- a/vcl/unx/generic/fontmanager/afm_keyword_list
+++ b/vcl/unx/generic/fontmanager/afm_keyword_list
@@ -1,4 +1,8 @@
-struct hash_entry { char* name; enum parseKey eKey; };
+%language=C++
+%global-table
+%null-strings
+%struct-type
+struct hash_entry { const char* name; enum parseKey eKey; };
%%
Ascender,ASCENDER
Ascent,ASCENT
diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx
index 639e394f0edd..96953ab9fc24 100644
--- a/vcl/unx/generic/fontmanager/fontcache.cxx
+++ b/vcl/unx/generic/fontmanager/fontcache.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,10 +51,13 @@
#define CACHE_MAGIC "PspFontCacheFile format 4"
using namespace std;
-using namespace rtl;
using namespace psp;
using namespace utl;
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OUStringToOString;
+
/*
* static helpers
*/
@@ -809,3 +813,5 @@ void FontCache::markEmptyDir( int nDirID, bool bNoFiles )
m_aCache[nDirID].m_bNoFiles = bNoFiles;
m_bDoFlush = true;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index be7904c55959..fe595290160a 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -48,6 +49,12 @@ using namespace psp;
#ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97
#define FC_FAMILYLANG "familylang"
#endif
+ #ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_CAPABILITY "capability"
+ #endif
+ #ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97
+ #define FC_STYLELANG "stylelang"
+ #endif
#ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91
#define FC_HINT_STYLE "hintstyle"
#define FC_HINT_NONE 0
@@ -55,6 +62,12 @@ using namespace psp;
#define FC_HINT_MEDIUM 2
#define FC_HINT_FULL 3
#endif
+ #ifndef FC_FT_FACE
+ #define FC_FT_FACE "ftface"
+ #endif
+ #ifndef FC_EMBOLDEN
+ #define FC_EMBOLDEN "embolden"
+ #endif
#else
typedef void FcConfig;
typedef void FcObjectSet;
@@ -89,7 +102,14 @@ using namespace psp;
#include <algorithm>
using namespace osl;
-using namespace rtl;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OString;
+
+namespace
+{
+ typedef std::pair<FcChar8*, FcChar8*> lang_and_element;
+}
class FontCfgWrapper
{
@@ -98,13 +118,14 @@ class FontCfgWrapper
int m_nFcVersion;
FcBool (*m_pFcInit)();
+ void (*m_pFcFini)();
int (*m_pFcGetVersion)();
FcConfig* (*m_pFcConfigGetCurrent)();
FcObjectSet* (*m_pFcObjectSetVaBuild)(const char*,va_list);
void (*m_pFcObjectSetDestroy)(FcObjectSet* pSet);
FcPattern* (*m_pFcPatternCreate)();
void (*m_pFcPatternDestroy)(FcPattern*);
- FcFontSet* (*m_pFcFontList)(FcConfig*,FcPattern*,FcObjectSet*);
+ FcBool (*m_pFcPatternEqual)(const FcPattern*,const FcPattern*);
FcFontSet* (*m_pFcConfigGetFonts)(FcConfig*,FcSetName);
FcFontSet* (*m_pFcFontSetCreate)();
FcCharSet* (*m_pFcCharSetCreate)();
@@ -136,6 +157,7 @@ class FontCfgWrapper
FcBool (*m_pFcPatternDel)(FcPattern*,const char*);
FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32);
+ FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face);
oslGenericFunction loadSymbol( const char* );
void addFontSet( FcSetName );
@@ -155,6 +177,12 @@ public:
FcBool FcInit()
{ return m_pFcInit(); }
+ void FcFini()
+ {
+ //To-Do: get gtk vclplug smoketest to pass
+ //if (m_pFcFini) m_pFcFini();
+ }
+
int FcGetVersion()
{ return m_pFcGetVersion(); }
@@ -177,10 +205,10 @@ public:
{ return m_pFcPatternCreate(); }
void FcPatternDestroy( FcPattern* pPattern )
- { m_pFcPatternDestroy( pPattern ); }
+ { if (m_pFcPatternDestroy) m_pFcPatternDestroy( pPattern ); }
- FcFontSet* FcFontList( FcConfig* pConfig, FcPattern* pPattern, FcObjectSet* pSet )
- { return m_pFcFontList( pConfig, pPattern, pSet ); }
+ FcBool FcPatternEqual( const FcPattern* pPatternA, const FcPattern *pPatternB )
+ { return m_pFcPatternEqual( pPatternA, pPatternB ); }
FcFontSet* FcConfigGetFonts( FcConfig* pConfig, FcSetName eSet)
{ return m_pFcConfigGetFonts( pConfig, eSet ); }
@@ -256,11 +284,20 @@ public:
FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 )
{ return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
-
-public: // TODO: cleanup
- FcResult FamilyFromPattern(FcPattern* pPattern, FcChar8 **family);
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized;
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aLocalizedToCanonical;
+ FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue )
+ {
+ return m_pFcPatternAddFTFace
+ ? m_pFcPatternAddFTFace( pPattern, pObject, nValue )
+ : false;
+ }
+public:
+ FcResult LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **family,
+ const char *elementtype, const char *elementlangtype);
+//to-do, make private and add some cleanish accessor methods
+ boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized;
+ boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aLocalizedToCanonical;
+private:
+ void cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements);
};
oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
@@ -296,6 +333,8 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcInit = (FcBool(*)())
loadSymbol( "FcInit" );
+ m_pFcFini = (void(*)())
+ loadSymbol( "FcFini" );
m_pFcGetVersion = (int(*)())
loadSymbol( "FcGetVersion" );
m_pFcConfigGetCurrent = (FcConfig *(*)())
@@ -308,8 +347,8 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcPatternCreate" );
m_pFcPatternDestroy = (void(*)(FcPattern*))
loadSymbol( "FcPatternDestroy" );
- m_pFcFontList = (FcFontSet*(*)(FcConfig*,FcPattern*,FcObjectSet*))
- loadSymbol( "FcFontList" );
+ m_pFcPatternEqual = (FcBool(*)(const FcPattern*,const FcPattern*))
+ loadSymbol( "FcPatternEqual" );
m_pFcConfigGetFonts = (FcFontSet*(*)(FcConfig*,FcSetName))
loadSymbol( "FcConfigGetFonts" );
m_pFcFontSetCreate = (FcFontSet*(*)())
@@ -370,6 +409,8 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32))
loadSymbol( "FcFreeTypeCharIndex" );
+ m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face))
+ loadSymbol( "FcPatternAddFTFace" );
m_nFcVersion = FcGetVersion();
#if (OSL_DEBUG_LEVEL > 1)
@@ -392,7 +433,7 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcObjectSetDestroy &&
m_pFcPatternCreate &&
m_pFcPatternDestroy &&
- m_pFcFontList &&
+ m_pFcPatternEqual &&
m_pFcConfigGetFonts &&
m_pFcFontSetCreate &&
m_pFcCharSetCreate &&
@@ -450,41 +491,17 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
if( !pOrig )
return;
- // filter the font sets to remove obsolete or duplicate faces
+ // filter the font sets to remove obsolete faces
for( int i = 0; i < pOrig->nfont; ++i )
{
- FcPattern* pOrigPattern = pOrig->fonts[i];
+ FcPattern* pPattern = pOrig->fonts[i];
// #i115131# ignore non-outline fonts
FcBool bOutline = FcFalse;
- FcResult eOutRes = FcPatternGetBool( pOrigPattern, FC_OUTLINE, 0, &bOutline );
+ FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, &bOutline );
if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
continue;
- // create a pattern to find eventually better alternatives
- FcPattern* pBetterPattern = pOrigPattern;
- if( m_nFcVersion > 20400 ) // #i115204# avoid trouble with old FC versions
- {
- FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern );
- FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue );
- // TODO: ignore all attributes that are not interesting for finding dupes
- // e.g. by using pattern->ImplFontAttr->pattern conversion
- FcPatternDel( pTestPattern, FC_FONTVERSION );
- FcPatternDel( pTestPattern, FC_CHARSET );
- FcPatternDel( pTestPattern, FC_FILE );
- // find the font face for the dupe-search pattern
- FcResult eFcResult = FcResultMatch;
- pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult );
- FcPatternDestroy( pTestPattern );
- if( eFcResult != FcResultMatch )
- continue;
- // #i115131# double check results and eventually ignore them
- eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline );
- if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
- continue;
- }
- // insert best found pattern for the dupe-search pattern
- // TODO: skip inserting patterns that are already known in the target fontset
- FcPatternReference( pBetterPattern );
- FcFontSetAdd( m_pOutlineSet, pBetterPattern );
+ FcPatternReference( pPattern );
+ FcFontSetAdd( m_pOutlineSet, pPattern );
}
// TODO?: FcFontSetDestroy( pOrig );
@@ -493,6 +510,90 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
#endif
}
+#ifdef ENABLE_FONTCONFIG
+namespace
+{
+ int compareFontNames(FontCfgWrapper& rWrapper, const FcPattern *a, const FcPattern *b)
+ {
+ FcChar8 *pNameA=NULL, *pNameB=NULL;
+
+ bool bHaveA = rWrapper.FcPatternGetString(a, FC_FAMILY, 0, &pNameA) == FcResultMatch;
+ bool bHaveB = rWrapper.FcPatternGetString(b, FC_FAMILY, 0, &pNameB) == FcResultMatch;
+
+ if (bHaveA && bHaveB)
+ return strcmp((const char*)pNameA, (const char*)pNameB);
+
+ return bHaveA - bHaveB;
+ }
+
+ //Sort fonts so that fonts with the same family name are side-by-side, with
+ //those with higher version numbers first
+ class SortFont : public ::std::binary_function< const FcPattern*, const FcPattern*, bool >
+ {
+ private:
+ FontCfgWrapper& m_rWrapper;
+ public:
+ SortFont(FontCfgWrapper& rWrapper) : m_rWrapper(rWrapper) {}
+
+ bool operator()(const FcPattern *a, const FcPattern *b)
+ {
+ int comp = compareFontNames(m_rWrapper, a, b);
+ if (comp != 0)
+ return comp < 0;
+
+ int nVersionA=0, nVersionB=0;
+
+ bool bHaveA = m_rWrapper.FcPatternGetInteger(a, FC_FONTVERSION, 0, &nVersionA) == FcResultMatch;
+ bool bHaveB = m_rWrapper.FcPatternGetInteger(b, FC_FONTVERSION, 0, &nVersionB) == FcResultMatch;
+
+ if (bHaveA && bHaveB)
+ return nVersionA > nVersionB;
+
+ return bHaveA - bHaveA;
+ }
+ };
+
+ //See fdo#30729 for where an old opensymbol installed system-wide can
+ //clobber the new opensymbol installed locally
+ //
+ //See if this font is a duplicate with equal attributes which has already been
+ //inserted, or if it an older version of an inserted fonts. Depends on FcFontSet
+ //on being sorted with SortFont
+ bool isPreviouslyDuplicateOrObsoleted(FontCfgWrapper& rWrapper, FcFontSet *pFSet, int i)
+ {
+ if (i == 0)
+ return false;
+
+ const FcPattern *a = pFSet->fonts[i];
+ const FcPattern *b = pFSet->fonts[i-1];
+
+ if (compareFontNames(rWrapper, a, b) != 0)
+ return false;
+
+ FcPattern* pTestPatternA = rWrapper.FcPatternDuplicate(a);
+ rWrapper.FcPatternDel(pTestPatternA, FC_FILE);
+ rWrapper.FcPatternDel(pTestPatternA, FC_CHARSET);
+ rWrapper.FcPatternDel(pTestPatternA, FC_CAPABILITY);
+ rWrapper.FcPatternDel(pTestPatternA, FC_FONTVERSION);
+
+ FcPattern* pTestPatternB = rWrapper.FcPatternDuplicate(b);
+ rWrapper.FcPatternDel(pTestPatternB, FC_FILE);
+ rWrapper.FcPatternDel(pTestPatternB, FC_CHARSET);
+ rWrapper.FcPatternDel(pTestPatternB, FC_CAPABILITY);
+ rWrapper.FcPatternDel(pTestPatternB, FC_FONTVERSION);
+
+ bool bIsDup = false;
+ if (rWrapper.FcPatternEqual(pTestPatternA, pTestPatternB))
+ bIsDup = true;
+
+ rWrapper.FcPatternDestroy(pTestPatternB);
+ rWrapper.FcPatternDestroy(pTestPatternA);
+
+ return bIsDup;
+ }
+}
+#endif
+
FcFontSet* FontCfgWrapper::getFontSet()
{
#ifdef ENABLE_FONTCONFIG
@@ -500,8 +601,10 @@ FcFontSet* FontCfgWrapper::getFontSet()
{
m_pOutlineSet = FcFontSetCreate();
addFontSet( FcSetSystem );
- if( m_nFcVersion > 20400 ) // #i85462# prevent crashes
+ if( m_nFcVersion > 20400 ) // #i85462# prevent crashes
addFontSet( FcSetApplication );
+
+ ::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont(*this));
}
#endif
@@ -512,6 +615,7 @@ FontCfgWrapper::~FontCfgWrapper()
{
if( m_pOutlineSet )
FcFontSetDestroy( m_pOutlineSet );
+ FcFini();
if( m_pLib )
osl_unloadModule( (oslModule)m_pLib );
}
@@ -537,27 +641,25 @@ void FontCfgWrapper::release()
#ifdef ENABLE_FONTCONFIG
namespace
{
- typedef std::pair<FcChar8*, FcChar8*> lang_and_family;
-
class localizedsorter
{
rtl::OLocale maLoc;
public:
localizedsorter(rtl_Locale* pLoc) : maLoc(pLoc) {}
- FcChar8* bestname(const std::vector<lang_and_family> &families);
+ FcChar8* bestname(const std::vector<lang_and_element> &elements);
};
- FcChar8* localizedsorter::bestname(const std::vector<lang_and_family> &families)
+ FcChar8* localizedsorter::bestname(const std::vector<lang_and_element> &elements)
{
- FcChar8* candidate = families.begin()->second;
+ FcChar8* candidate = elements.begin()->second;
rtl::OString sLangMatch(rtl::OUStringToOString(maLoc.getLanguage().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8));
- rtl::OString sFullMatch = sLangMatch;
+ rtl::OString sFullMatch = sLangMatch;
sFullMatch += OString('-');
sFullMatch += rtl::OUStringToOString(maLoc.getCountry().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8);
- std::vector<lang_and_family>::const_iterator aEnd = families.end();
+ std::vector<lang_and_element>::const_iterator aEnd = elements.end();
bool alreadyclosematch = false;
- for( std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter )
+ for( std::vector<lang_and_element>::const_iterator aIter = elements.begin(); aIter != aEnd; ++aIter )
{
const char *pLang = (const char*)aIter->first;
if( rtl_str_compare( pLang, sFullMatch.getStr() ) == 0)
@@ -567,7 +669,10 @@ namespace
break;
}
else if( alreadyclosematch )
- continue;
+ {
+ // override candidate only if there is a perfect match
+ continue;
+ }
else if( rtl_str_compare( pLang, sLangMatch.getStr()) == 0)
{
// just the language matches
@@ -576,7 +681,7 @@ namespace
}
else if( rtl_str_compare( pLang, "en") == 0)
{
- // fallback to the english family name
+ // fallback to the english element name
candidate = aIter->second;
}
}
@@ -584,27 +689,42 @@ namespace
}
}
-FcResult FontCfgWrapper::FamilyFromPattern(FcPattern* pPattern, FcChar8 **family)
+//Set up maps to quickly map between a fonts best UI name and all the rest of its names, and vice versa
+void FontCfgWrapper::cacheLocalizedFontNames(FcChar8 *origfontname, FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements)
{
- FcChar8 *origfamily;
- FcResult eFamilyRes = FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily );
- *family = origfamily;
+ std::vector<lang_and_element>::const_iterator aEnd = lang_and_elements.end();
+ for (std::vector<lang_and_element>::const_iterator aIter = lang_and_elements.begin(); aIter != aEnd; ++aIter)
+ {
+ const char *candidate = (const char*)(aIter->second);
+ if (rtl_str_compare(candidate, (const char*)bestfontname) != 0)
+ m_aFontNameToLocalized[OString(candidate)] = OString((const char*)bestfontname);
+ }
+ if (rtl_str_compare((const char*)origfontname, (const char*)bestfontname) != 0)
+ m_aLocalizedToCanonical[OString((const char*)bestfontname)] = OString((const char*)origfontname);
+}
+
+FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **element,
+ const char *elementtype, const char *elementlangtype)
+{ /* e. g.: ^ FC_FAMILY ^ FC_FAMILYLANG */
+ FcChar8 *origelement;
+ FcResult eElementRes = FcPatternGetString( pPattern, elementtype, 0, &origelement );
+ *element = origelement;
- if( eFamilyRes == FcResultMatch)
+ if( eElementRes == FcResultMatch)
{
- FcChar8* familylang = NULL;
- if (FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch)
+ FcChar8* elementlang = NULL;
+ if (FcPatternGetString( pPattern, elementlangtype, 0, &elementlang ) == FcResultMatch)
{
- std::vector< lang_and_family > lang_and_families;
- lang_and_families.push_back(lang_and_family(familylang, *family));
+ std::vector< lang_and_element > lang_and_elements;
+ lang_and_elements.push_back(lang_and_element(elementlang, *element));
int k = 1;
while (1)
{
- if (FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch)
+ if (FcPatternGetString( pPattern, elementlangtype, k, &elementlang ) != FcResultMatch)
break;
- if (FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch)
+ if (FcPatternGetString( pPattern, elementtype, k, element ) != FcResultMatch)
break;
- lang_and_families.push_back(lang_and_family(familylang, *family));
+ lang_and_elements.push_back(lang_and_element(elementlang, *element));
++k;
}
@@ -612,21 +732,15 @@ FcResult FontCfgWrapper::FamilyFromPattern(FcPattern* pPattern, FcChar8 **family
rtl_Locale* pLoc;
osl_getProcessLocale(&pLoc);
localizedsorter aSorter(pLoc);
- *family = aSorter.bestname(lang_and_families);
+ *element = aSorter.bestname(lang_and_elements);
- std::vector<lang_and_family>::const_iterator aEnd = lang_and_families.end();
- for (std::vector<lang_and_family>::const_iterator aIter = lang_and_families.begin(); aIter != aEnd; ++aIter)
- {
- const char *candidate = (const char*)(aIter->second);
- if (rtl_str_compare(candidate, (const char*)(*family)) != 0)
- m_aFontNameToLocalized[OString(candidate)] = OString((const char*)(*family));
- }
- if (rtl_str_compare((const char*)origfamily, (const char*)(*family)) != 0)
- m_aLocalizedToCanonical[OString((const char*)(*family))] = OString((const char*)origfamily);
+ //if this element is a fontname, map the other names to this best-name
+ if (rtl_str_compare(elementtype, FC_FAMILY) == 0)
+ cacheLocalizedFontNames(origelement, *element, lang_and_elements);
}
}
- return eFamilyRes;
+ return eElementRes;
}
/*
@@ -706,7 +820,7 @@ namespace
}
}
-int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths )
+int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths )
{
int nFonts = 0;
@@ -732,8 +846,8 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
FcBool outline = false;
FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file );
- FcResult eFamilyRes = rWrapper.FamilyFromPattern( pFSet->fonts[i], &family );
- FcResult eStyleRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_STYLE, 0, &style );
+ FcResult eFamilyRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &family, FC_FAMILY, FC_FAMILYLANG );
+ FcResult eStyleRes = rWrapper.LocalizedElementFromPattern( pFSet->fonts[i], &style, FC_STYLE, FC_STYLELANG );
FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant );
FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight );
FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing );
@@ -762,6 +876,14 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
if( eOutRes == FcResultMatch && ! outline )
continue;
+ if (isPreviouslyDuplicateOrObsoleted(rWrapper, pFSet, i))
+ {
+#if OSL_DEBUG_LEVEL > 2
+ fprintf(stderr, "Ditching %s as duplicate/obsolete\n", file);
+#endif
+ continue;
+ }
+
// see if this font is already cached
// update attributes
std::list< PrintFont* > aFonts;
@@ -833,14 +955,6 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
// set family name
if( pUpdate->m_nFamilyName != nFamilyName )
{
-#if 0 // fontconfig prefers nameid=16 for the family name which is all fine
- // but Writer suffers from #i79878#
- // the only reasonable workaround for now is to use the classic nameid=1
- pUpdate->m_aAliases.remove( pUpdate->m_nFamilyName );
- pUpdate->m_aAliases.push_back( pUpdate->m_nFamilyName );
- pUpdate->m_aAliases.remove( nFamilyName );
- pUpdate->m_nFamilyName = nFamilyName;
-#endif
}
if( eWeightRes == FcResultMatch )
pUpdate->m_eWeight = convertWeight(weight);
@@ -1020,9 +1134,15 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
const FcChar8* pTargetNameUtf8 = (FcChar8*)aTargetName.getStr();
rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 );
- const FcChar8* pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr();
if( rLangAttrib.getLength() )
+ {
+ const FcChar8* pLangAttribUtf8;
+ if (rLangAttrib.equalsIgnoreAsciiCase(OString(RTL_CONSTASCII_STRINGPARAM("pa-in"))))
+ pLangAttribUtf8 = (FcChar8*)"pa";
+ else
+ pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr();
rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 );
+ }
// Add required Unicode characters, if any
if ( rMissingCodes.getLength() )
@@ -1071,7 +1191,7 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
if( eFileRes == FcResultMatch )
{
OString sFamily((sal_Char*)family);
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily);
+ boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily);
if (aI != rWrapper.m_aFontNameToLocalized.end())
sFamily = aI->second;
aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
@@ -1114,24 +1234,47 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
return aName;
}
-bool PrintFontManager::getFontOptions(
- const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*),
- ImplFontOptions& rOptions) const
+class FontConfigFontOptions : public ImplFontOptions
+{
+public:
+ FontConfigFontOptions() : mpPattern(0) {}
+ ~FontConfigFontOptions()
+ {
+ FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+ if( rWrapper.isValid() )
+ rWrapper.FcPatternDestroy( mpPattern );
+ }
+ virtual void *GetPattern(void * face, bool bEmbolden) const
+ {
+ FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+ if( rWrapper.isValid() )
+ {
+ rWrapper.FcPatternAddFTFace(mpPattern, FC_FT_FACE, static_cast<FT_Face>(face));
+ rWrapper.FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse);
+ }
+ return mpPattern;
+ }
+ FcPattern* mpPattern;
+};
+
+ImplFontOptions* PrintFontManager::getFontOptions(
+ const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const
{
#ifndef ENABLE_FONTCONFIG
(void)rInfo;(void)nSize;(void)subcallback;(void)rOptions;
- return false;
+ return NULL;
#else // ENABLE_FONTCONFIG
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
if( ! rWrapper.isValid() )
- return false;
+ return NULL;
+ FontConfigFontOptions* pOptions = NULL;
FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
FcPattern* pPattern = rWrapper.FcPatternCreate();
OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily);
+ boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily);
if (aI != rWrapper.m_aLocalizedToCanonical.end())
sFamily = aI->second;
if( sFamily.getLength() )
@@ -1152,49 +1295,43 @@ bool PrintFontManager::getFontOptions(
FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
if( pResult )
{
- FcFontSet* pSet = rWrapper.FcFontSetCreate();
- rWrapper.FcFontSetAdd( pSet, pResult );
- if( pSet->nfont > 0 )
+ FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pResult,
+ FC_EMBEDDED_BITMAP, 0, &embitmap);
+ FcResult eAntialias = rWrapper.FcPatternGetBool(pResult,
+ FC_ANTIALIAS, 0, &antialias);
+ FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult,
+ FC_AUTOHINT, 0, &autohint);
+ FcResult eHinting = rWrapper.FcPatternGetBool(pResult,
+ FC_HINTING, 0, &hinting);
+ /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult,
+ FC_HINT_STYLE, 0, &hintstyle);
+
+ pOptions = new FontConfigFontOptions;
+
+ pOptions->mpPattern = pResult;
+
+ if( eEmbeddedBitmap == FcResultMatch )
+ pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE;
+ if( eAntialias == FcResultMatch )
+ pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE;
+ if( eAutoHint == FcResultMatch )
+ pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE;
+ if( eHinting == FcResultMatch )
+ pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE;
+ switch (hintstyle)
{
- FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pSet->fonts[0],
- FC_EMBEDDED_BITMAP, 0, &embitmap);
- FcResult eAntialias = rWrapper.FcPatternGetBool(pSet->fonts[0],
- FC_ANTIALIAS, 0, &antialias);
- FcResult eAutoHint = rWrapper.FcPatternGetBool(pSet->fonts[0],
- FC_AUTOHINT, 0, &autohint);
- FcResult eHinting = rWrapper.FcPatternGetBool(pSet->fonts[0],
- FC_HINTING, 0, &hinting);
- /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger( pSet->fonts[0],
- FC_HINT_STYLE, 0, &hintstyle);
-
- if( eEmbeddedBitmap == FcResultMatch )
- rOptions.meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE;
- if( eAntialias == FcResultMatch )
- rOptions.meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE;
- if( eAutoHint == FcResultMatch )
- rOptions.meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE;
- if( eHinting == FcResultMatch )
- rOptions.meHinting = hinting ? HINTING_TRUE : HINTING_FALSE;
- switch (hintstyle)
- {
- case FC_HINT_NONE: rOptions.meHintStyle = HINT_NONE; break;
- case FC_HINT_SLIGHT: rOptions.meHintStyle = HINT_SLIGHT; break;
- case FC_HINT_MEDIUM: rOptions.meHintStyle = HINT_MEDIUM; break;
- default: // fall through
- case FC_HINT_FULL: rOptions.meHintStyle = HINT_FULL; break;
- }
+ case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break;
+ case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break;
+ case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break;
+ default: // fall through
+ case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break;
}
- // info: destroying the pSet destroys pResult implicitly
- // since pResult was "added" to pSet
- rWrapper.FcFontSetDestroy( pSet );
}
// cleanup
rWrapper.FcPatternDestroy( pPattern );
- // TODO: return true only if non-default font options are set
- const bool bOK = (pResult != NULL);
- return bOK;
+ return pOptions;
#endif
}
@@ -1272,7 +1409,7 @@ bool PrintFontManager::initFontconfig()
return false;
}
-int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& )
+int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& )
{
return 0;
}
@@ -1304,3 +1441,4 @@ rtl::OUString PrintFontManager::Substitute( const rtl::OUString&,
#endif // ENABLE_FONTCONFIG
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 8b9ba153e7e3..5b7ef936d5ca 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -57,6 +58,8 @@
#include "rtl/ustrbuf.hxx"
#include "rtl/strbuf.hxx"
+#include <sal/macros.h>
+
#include "i18npool/mslangid.hxx"
@@ -71,7 +74,7 @@
#include "sal/alloca.h"
#include <set>
-#include <hash_set>
+#include <boost/unordered_set.hpp>
#include <algorithm>
#include "adobeenc.tab" // get encoding table for AFM metrics
@@ -96,11 +99,19 @@ using namespace vcl;
using namespace utl;
using namespace psp;
using namespace osl;
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OStringHash;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringBuffer;
+using ::rtl::OUStringHash;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringToOString;
+
/*
* static helpers
*/
@@ -489,8 +500,8 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr
if( pImplTTFont->nkern && pImplTTFont->kerntype == KT_MICROSOFT )
{
// create a glyph -> character mapping
- ::std::hash_map< sal_uInt16, sal_Unicode > aGlyphMap;
- ::std::hash_map< sal_uInt16, sal_Unicode >::iterator left, right;
+ ::boost::unordered_map< sal_uInt16, sal_Unicode > aGlyphMap;
+ ::boost::unordered_map< sal_uInt16, sal_Unicode >::iterator left, right;
for( i = 21; i < 0xfffd; i++ )
{
sal_uInt16 nGlyph = MapChar( pTTFont, (sal_Unicode)i, 0 ); // kerning for horz only
@@ -589,8 +600,8 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr
if( pImplTTFont->nkern && pImplTTFont->kerntype == KT_APPLE_NEW )
{
// create a glyph -> character mapping
- ::std::hash_map< sal_uInt16, sal_Unicode > aGlyphMap;
- ::std::hash_map< sal_uInt16, sal_Unicode >::iterator left, right;
+ ::boost::unordered_map< sal_uInt16, sal_Unicode > aGlyphMap;
+ ::boost::unordered_map< sal_uInt16, sal_Unicode >::iterator left, right;
for( i = 21; i < 0xfffd; i++ )
{
sal_uInt16 nGlyph = MapChar( pTTFont, (sal_Unicode)i, 0 ); // kerning for horz only
@@ -707,7 +718,7 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr
}
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "found %d/%d kern pairs for %s\n",
+ fprintf( stderr, "found %" SAL_PRI_SIZET "u/%" SAL_PRI_SIZET "u kern pairs for %s\n",
m_pMetrics->m_aXKernPairs.size(),
m_pMetrics->m_aYKernPairs.size(),
OUStringToOString( pProvider->getString( ATOM_FAMILYNAME, m_nFamilyName ), RTL_TEXTENCODING_MS_1252 ).getStr() );
@@ -733,7 +744,7 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr
*/
static bool familyNameOverride( const OUString& i_rPSname, OUString& o_rFamilyName )
{
- static std::hash_map< OUString, OUString, OUStringHash > aPSNameToFamily( 16 );
+ static boost::unordered_map< OUString, OUString, OUStringHash > aPSNameToFamily( 16 );
if( aPSNameToFamily.empty() ) // initialization
{
aPSNameToFamily[ OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica-Narrow" ) ) ] =
@@ -745,7 +756,7 @@ static bool familyNameOverride( const OUString& i_rPSname, OUString& o_rFamilyNa
aPSNameToFamily[ OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica-Narrow-Oblique" ) ) ] =
OUString( RTL_CONSTASCII_USTRINGPARAM( "Helvetica Narrow" ) );
}
- std::hash_map<OUString,OUString,OUStringHash>::const_iterator it =
+ boost::unordered_map<OUString,OUString,OUStringHash>::const_iterator it =
aPSNameToFamily.find( i_rPSname );
bool bReplaced = (it != aPSNameToFamily.end() );
if( bReplaced )
@@ -757,7 +768,6 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
{
PrintFontManager& rManager( PrintFontManager::get() );
- int i;
FontInfo* pInfo = NULL;
parseFile( rFileName.getStr(), &pInfo, P_ALL );
if( ! pInfo || ! pInfo->numOfChars )
@@ -858,7 +868,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
RTL_TEXTENCODING_JIS_X_0208
};
- for( unsigned int enc = 0; enc < sizeof( aEncs )/sizeof(aEncs[0]) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ )
+ for( unsigned int enc = 0; enc < SAL_N_ELEMENTS( aEncs ) && m_aEncoding == RTL_TEXTENCODING_DONTKNOW; enc++ )
{
sal_Int32 nIndex = 0, nOffset = 1;
do
@@ -971,6 +981,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
// note: this only works with single byte encodings
sal_Unicode* pUnicodes = (sal_Unicode*)alloca( pInfo->numOfChars * sizeof(sal_Unicode));
CharMetricInfo* pChar = pInfo->cmi;
+ int i;
for( i = 0; i < pInfo->numOfChars; i++, pChar++ )
{
@@ -1085,8 +1096,8 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult
}
else if( pChar->code != -1 )
{
- ::std::pair< ::std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator,
- ::std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator >
+ ::std::pair< ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator,
+ ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator >
aCodes = rManager.getUnicodeFromAdobeCode( pChar->code );
while( aCodes.first != aCodes.second )
{
@@ -1169,13 +1180,14 @@ OString PrintFontManager::s_aEmptyOString;
*/
PrintFontManager& PrintFontManager::get()
{
- static PrintFontManager* theManager = NULL;
- if( ! theManager )
+ static PrintFontManager* pManager = NULL;
+ if( ! pManager )
{
- theManager = new PrintFontManager();
- theManager->initialize();
+ static PrintFontManager theManager;
+ pManager = &theManager;
+ pManager->initialize();
}
- return *theManager;
+ return *pManager;
}
// -------------------------------------------------------------------------
@@ -1191,24 +1203,15 @@ PrintFontManager::PrintFontManager() :
m_pFontCache( NULL ),
m_bFontconfigSuccess( false )
{
- for( unsigned int i = 0; i < sizeof( aAdobeCodes )/sizeof( aAdobeCodes[0] ); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAdobeCodes ); i++ )
{
- m_aUnicodeToAdobename.insert( ::std::hash_multimap< sal_Unicode, ::rtl::OString >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].pAdobename ) );
- m_aAdobenameToUnicode.insert( ::std::hash_multimap< ::rtl::OString, sal_Unicode, ::rtl::OStringHash >::value_type( aAdobeCodes[i].pAdobename, aAdobeCodes[i].aUnicode ) );
- if( aAdobeCodes[i].aAdobeStandardCode )
- {
- m_aUnicodeToAdobecode.insert( ::std::hash_multimap< sal_Unicode, sal_uInt8 >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].aAdobeStandardCode ) );
- m_aAdobecodeToUnicode.insert( ::std::hash_multimap< sal_uInt8, sal_Unicode >::value_type( aAdobeCodes[i].aAdobeStandardCode, aAdobeCodes[i].aUnicode ) );
- }
-#if 0
- m_aUnicodeToAdobename[ aAdobeCodes[i].aUnicode ] = aAdobeCodes[i].pAdobename;
- m_aAdobenameToUnicode[ aAdobeCodes[i].pAdobename ] = aAdobeCodes[i].aUnicode;
+ m_aUnicodeToAdobename.insert( ::boost::unordered_multimap< sal_Unicode, ::rtl::OString >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].pAdobename ) );
+ m_aAdobenameToUnicode.insert( ::boost::unordered_multimap< ::rtl::OString, sal_Unicode, ::rtl::OStringHash >::value_type( aAdobeCodes[i].pAdobename, aAdobeCodes[i].aUnicode ) );
if( aAdobeCodes[i].aAdobeStandardCode )
{
- m_aUnicodeToAdobecode[ aAdobeCodes[i].aUnicode ] = aAdobeCodes[i].aAdobeStandardCode;
- m_aAdobecodeToUnicode[ aAdobeCodes[i].aAdobeStandardCode ] = aAdobeCodes[i].aUnicode;
+ m_aUnicodeToAdobecode.insert( ::boost::unordered_multimap< sal_Unicode, sal_uInt8 >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].aAdobeStandardCode ) );
+ m_aAdobecodeToUnicode.insert( ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::value_type( aAdobeCodes[i].aAdobeStandardCode, aAdobeCodes[i].aUnicode ) );
}
-#endif
}
}
@@ -1217,7 +1220,7 @@ PrintFontManager::PrintFontManager() :
PrintFontManager::~PrintFontManager()
{
deinitFontconfig();
- for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
+ for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
delete (*it).second;
delete m_pAtoms;
if( m_pFontCache )
@@ -1228,7 +1231,7 @@ PrintFontManager::~PrintFontManager()
const OString& PrintFontManager::getDirectory( int nAtom ) const
{
- ::std::hash_map< int, OString >::const_iterator it( m_aAtomToDir.find( nAtom ) );
+ ::boost::unordered_map< int, OString >::const_iterator it( m_aAtomToDir.find( nAtom ) );
return it != m_aAtomToDir.end() ? it->second : s_aEmptyOString;
}
@@ -1237,7 +1240,7 @@ const OString& PrintFontManager::getDirectory( int nAtom ) const
int PrintFontManager::getDirectoryAtom( const OString& rDirectory, bool bCreate )
{
int nAtom = 0;
- ::std::hash_map< OString, int, OStringHash >::const_iterator it
+ ::boost::unordered_map< OString, int, OStringHash >::const_iterator it
( m_aDirToAtom.find( rDirectory ) );
if( it != m_aDirToAtom.end() )
nAtom = it->second;
@@ -1301,7 +1304,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
// first look for an adjacent file
static const char* pSuffix[] = { ".afm", ".AFM" };
- for( unsigned int i = 0; i < sizeof(pSuffix)/sizeof(pSuffix[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pSuffix); i++ )
{
ByteString aName( rFontFile );
aName.Erase( aName.Len()-4 );
@@ -1421,7 +1424,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co
fontID PrintFontManager::findFontBuiltinID( int nPSNameAtom ) const
{
fontID nID = 0;
- ::std::hash_map< fontID, PrintFont* >::const_iterator it;
+ ::boost::unordered_map< fontID, PrintFont* >::const_iterator it;
for( it = m_aFonts.begin(); nID == 0 && it != m_aFonts.end(); ++it )
{
if( it->second->m_eType == fonttype::Builtin &&
@@ -1437,12 +1440,12 @@ fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile )
{
fontID nID = 0;
- ::std::hash_map< OString, ::std::set< fontID >, OStringHash >::const_iterator set_it = m_aFontFileToFontID.find( rFontFile );
+ ::boost::unordered_map< OString, ::std::set< fontID >, OStringHash >::const_iterator set_it = m_aFontFileToFontID.find( rFontFile );
if( set_it != m_aFontFileToFontID.end() )
{
for( ::std::set< fontID >::const_iterator font_it = set_it->second.begin(); font_it != set_it->second.end() && ! nID; ++font_it )
{
- ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find( *font_it );
+ ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find( *font_it );
if( it != m_aFonts.end() )
{
switch( it->second->m_eType )
@@ -1804,6 +1807,29 @@ OUString PrintFontManager::convertTrueTypeName( void* pRecord ) const
return aValue;
}
+//fdo#33349.There exists an archaic Berling Antiqua font which has a "Times New
+//Roman" name field in it. We don't want the "Times New Roman" name to take
+//precedence in this case. We take Berling Antiqua as a higher priority name,
+//and erase the "Times New Roman" name
+namespace
+{
+ bool isBadTNR(const OUString &rName, ::std::set< OUString >& rSet)
+ {
+ bool bRet = false;
+ if (rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Berling Antiqua")))
+ {
+ ::std::set< OUString >::iterator aEnd = rSet.end();
+ ::std::set< OUString >::iterator aI = rSet.find(OUString(RTL_CONSTASCII_USTRINGPARAM("Times New Roman")));
+ if (aI != aEnd)
+ {
+ bRet = true;
+ rSet.erase(aI);
+ }
+ }
+ return bRet;
+ }
+}
+
// -------------------------------------------------------------------------
void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OUString >& rNames ) const
@@ -1841,7 +1867,7 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OU
}
OUString aName = convertTrueTypeName( pNameRecords + i );
aSet.insert( aName );
- if( nMatch > nLastMatch )
+ if( nMatch > nLastMatch || isBadTNR(aName, aSet) )
{
nLastMatch = nMatch;
aFamily = aName;
@@ -2104,7 +2130,7 @@ void PrintFontManager::initialize()
// initialize may be called twice in the future
{
- for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
+ for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
delete (*it).second;
m_nNextFontID = 1;
m_aFonts.clear();
@@ -2156,7 +2182,7 @@ void PrintFontManager::initialize()
}
// protect against duplicate paths
- std::hash_map< OString, int, OStringHash > visited_dirs;
+ boost::unordered_map< OString, int, OStringHash > visited_dirs;
// now that all global and local font dirs are known to fontconfig
// check that there are fonts actually managed by fontconfig
@@ -2222,7 +2248,7 @@ void PrintFontManager::initialize()
if( pDIR )
{
// read fonts.dir if possible
- ::std::hash_map< OString, ::std::list<OString>, OStringHash > aFontsDir;
+ ::boost::unordered_map< OString, ::std::list<OString>, OStringHash > aFontsDir;
int nDirID = getDirectoryAtom( aPath, true );
// #i38367# no fonts.dir in our own directories anymore
std::list< int >::const_iterator priv_dir;
@@ -2270,7 +2296,7 @@ void PrintFontManager::initialize()
if( findFontFileID( nDirID, aFileName ) == 0 )
{
::std::list<OString> aXLFDs;
- ::std::hash_map< OString, ::std::list<OString>, OStringHash >::const_iterator it =
+ ::boost::unordered_map< OString, ::std::list<OString>, OStringHash >::const_iterator it =
aFontsDir.find( aFileName );
if( it != aFontsDir.end() )
aXLFDs = (*it).second;
@@ -2401,10 +2427,10 @@ void PrintFontManager::initialize()
#endif
// part three - fill in family styles
- ::std::hash_map< fontID, PrintFont* >::iterator font_it;
+ ::boost::unordered_map< fontID, PrintFont* >::iterator font_it;
for (font_it = m_aFonts.begin(); font_it != m_aFonts.end(); ++font_it)
{
- ::std::hash_map< int, family::type >::const_iterator it =
+ ::boost::unordered_map< int, family::type >::const_iterator it =
m_aFamilyTypes.find( font_it->second->m_nFamilyName );
if (it != m_aFamilyTypes.end())
continue;
@@ -2416,7 +2442,7 @@ void PrintFontManager::initialize()
#if OSL_DEBUG_LEVEL > 1
aStep3 = times( &tms );
- fprintf( stderr, "PrintFontManager::initialize: collected %d fonts (%d builtin, %d cached)\n", m_aFonts.size(), nBuiltinFonts, nCached );
+ fprintf( stderr, "PrintFontManager::initialize: collected %" SAL_PRI_SIZET "u fonts (%d builtin, %d cached)\n", m_aFonts.size(), nBuiltinFonts, nCached );
double fTick = (double)sysconf( _SC_CLK_TCK );
fprintf( stderr, "Step 1 took %lf seconds\n", (double)(aStep1 - aStart)/fTick );
fprintf( stderr, "Step 2 took %lf seconds\n", (double)(aStep2 - aStep1)/fTick );
@@ -2502,7 +2528,7 @@ namespace {
void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDParser* pParser, bool bUseOverrideMetrics )
{
rFontIDs.clear();
- std::hash_map< fontID, PrintFont* >::const_iterator it;
+ boost::unordered_map< fontID, PrintFont* >::const_iterator it;
/*
* Note: there are two easy steps making this faster:
@@ -2524,7 +2550,7 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa
if( pParser )
{
std::set<int> aBuiltinPSNames;
- std::hash_set< BuiltinFontIdentifier,
+ boost::unordered_set< BuiltinFontIdentifier,
BuiltinFontIdentifierHash
> aBuiltinFonts;
@@ -2535,7 +2561,7 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa
for( std::vector<fontID>::const_iterator over = m_aOverrideFonts.begin();
over != m_aOverrideFonts.end(); ++over )
{
- std::hash_map<fontID,PrintFont*>::const_iterator font_it = m_aFonts.find( *over );
+ boost::unordered_map<fontID,PrintFont*>::const_iterator font_it = m_aFonts.find( *over );
DBG_ASSERT( font_it != m_aFonts.end(), "override to nonexistant font" );
if( font_it != m_aFonts.end() )
aOverridePSNames[ font_it->second->m_nPSName ] = *over;
@@ -2625,7 +2651,7 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa
void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& rInfo ) const
{
- ::std::hash_map< int, family::type >::const_iterator style_it =
+ ::boost::unordered_map< int, family::type >::const_iterator style_it =
m_aFamilyTypes.find( pFont->m_nFamilyName );
rInfo.m_eType = pFont->m_eType;
rInfo.m_aFamilyName = m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName );
@@ -2809,7 +2835,7 @@ family::type PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily )
rtl::OString aFamily = rtl::OUStringToOString( rFamily, RTL_TEXTENCODING_ASCII_US );
sal_uInt32 nLower = 0;
- sal_uInt32 nUpper = sizeof(pFamilyMatch) / sizeof(pFamilyMatch[0]);
+ sal_uInt32 nUpper = SAL_N_ELEMENTS(pFamilyMatch);
while( nLower < nUpper )
{
@@ -2842,7 +2868,7 @@ family::type PrintFontManager::getFontFamilyType( fontID nFontID ) const
if( !pFont )
return family::Unknown;
- ::std::hash_map< int, family::type >::const_iterator it =
+ ::boost::unordered_map< int, family::type >::const_iterator it =
m_aFamilyTypes.find( pFont->m_nFamilyName );
return (it != m_aFamilyTypes.end()) ? it->second : family::Unknown;
}
@@ -2896,7 +2922,7 @@ OString PrintFontManager::getFontFile( PrintFont* pFont ) const
if( pFont && pFont->m_eType == fonttype::Type1 )
{
Type1FontFile* pPSFont = static_cast< Type1FontFile* >(pFont);
- ::std::hash_map< int, OString >::const_iterator it = m_aAtomToDir.find( pPSFont->m_nDirectory );
+ ::boost::unordered_map< int, OString >::const_iterator it = m_aAtomToDir.find( pPSFont->m_nDirectory );
aPath = it->second;
aPath += "/";
aPath += pPSFont->m_aFontFile;
@@ -2904,7 +2930,7 @@ OString PrintFontManager::getFontFile( PrintFont* pFont ) const
else if( pFont && pFont->m_eType == fonttype::TrueType )
{
TrueTypeFontFile* pTTFont = static_cast< TrueTypeFontFile* >(pFont);
- ::std::hash_map< int, OString >::const_iterator it = m_aAtomToDir.find( pTTFont->m_nDirectory );
+ ::boost::unordered_map< int, OString >::const_iterator it = m_aAtomToDir.find( pTTFont->m_nDirectory );
aPath = it->second;
aPath += "/";
aPath += pTTFont->m_aFontFile;
@@ -3018,7 +3044,7 @@ void PrintFontManager::hasVerticalSubstitutions( fontID nFontID,
if( ! pFont->m_pMetrics ||
! ( pFont->m_pMetrics->m_aPages[ code >> 11 ] & ( 1 << ( ( code >> 8 ) & 7 ) ) ) )
pFont->queryMetricPage( code >> 8, m_pAtoms );
- ::std::hash_map< sal_Unicode, bool >::const_iterator it = pFont->m_pMetrics->m_bVerticalSubstitutions.find( code );
+ ::boost::unordered_map< sal_Unicode, bool >::const_iterator it = pFont->m_pMetrics->m_bVerticalSubstitutions.find( code );
pHasSubst[i] = it != pFont->m_pMetrics->m_bVerticalSubstitutions.end();
}
}
@@ -3123,7 +3149,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i
{
int effectiveCode = pString[i];
effectiveCode |= bVertical ? 1 << 16 : 0;
- ::std::hash_map< int, CharacterMetric >::const_iterator it =
+ ::boost::unordered_map< int, CharacterMetric >::const_iterator it =
pFont->m_pMetrics->m_aMetrics.find( effectiveCode );
// if no vertical metrics are available assume rotated horizontal metrics
if( bVertical && (it == pFont->m_pMetrics->m_aMetrics.end()) )
@@ -3168,7 +3194,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal
{
int effectiveCode = code;
effectiveCode |= bVertical ? 1 << 16 : 0;
- ::std::hash_map< int, CharacterMetric >::const_iterator it =
+ ::boost::unordered_map< int, CharacterMetric >::const_iterator it =
pFont->m_pMetrics->m_aMetrics.find( effectiveCode );
// if no vertical metrics are available assume rotated horizontal metrics
if( bVertical && (it == pFont->m_pMetrics->m_aMetrics.end()) )
@@ -3327,7 +3353,7 @@ int PrintFontManager::importFonts( const ::std::list< OString >& rFiles, bool bL
{
// remove all fonts for the same file
// discarding their font ids
- ::std::hash_map< fontID, PrintFont* >::iterator current, next;
+ ::boost::unordered_map< fontID, PrintFont* >::iterator current, next;
current = m_aFonts.begin();
OString aFileName( OUStringToOString( aTo.GetName(), aEncoding ) );
while( current != m_aFonts.end() )
@@ -3483,7 +3509,7 @@ bool PrintFontManager::getFileDuplicates( fontID nFont, ::std::list< fontID >& r
if( ! aFile.getLength() )
return false;
- for( ::std::hash_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
+ for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
{
if( nFont != it->first )
{
@@ -3506,7 +3532,7 @@ bool PrintFontManager::removeFonts( const ::std::list< fontID >& rFonts )
::std::list< fontID > aDuplicates;
for( ::std::list< fontID >::const_iterator it = rFonts.begin(); it != rFonts.end(); ++it )
{
- ::std::hash_map< fontID, PrintFont* >::const_iterator haveFont = m_aFonts.find( *it );
+ ::boost::unordered_map< fontID, PrintFont* >::const_iterator haveFont = m_aFonts.find( *it );
if( haveFont == m_aFonts.end() )
continue;
@@ -3842,7 +3868,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
rUnicodeEnc.clear();
rWidths.clear();
rWidths.reserve( pFont->m_pMetrics->m_aMetrics.size() );
- for( std::hash_map< int, CharacterMetric >::const_iterator it =
+ for( boost::unordered_map< int, CharacterMetric >::const_iterator it =
pFont->m_pMetrics->m_aMetrics.begin();
it != pFont->m_pMetrics->m_aMetrics.end(); ++it )
{
@@ -3879,8 +3905,8 @@ const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( font
std::list< OString > PrintFontManager::getAdobeNameFromUnicode( sal_Unicode aChar ) const
{
- std::pair< std::hash_multimap< sal_Unicode, rtl::OString >::const_iterator,
- std::hash_multimap< sal_Unicode, rtl::OString >::const_iterator > range
+ std::pair< boost::unordered_multimap< sal_Unicode, rtl::OString >::const_iterator,
+ boost::unordered_multimap< sal_Unicode, rtl::OString >::const_iterator > range
= m_aUnicodeToAdobename.equal_range( aChar );
std::list< OString > aRet;
@@ -3900,8 +3926,8 @@ std::list< OString > PrintFontManager::getAdobeNameFromUnicode( sal_Unicode aCha
// -------------------------------------------------------------------------
std::list< sal_Unicode > PrintFontManager::getUnicodeFromAdobeName( const rtl::OString& rName ) const
{
- std::pair< std::hash_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator,
- std::hash_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator > range
+ std::pair< boost::unordered_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator,
+ boost::unordered_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >::const_iterator > range
= m_aAdobenameToUnicode.equal_range( rName );
std::list< sal_Unicode > aRet;
@@ -3976,53 +4002,53 @@ bool PrintFontManager::readOverrideMetrics()
const NamedValue* pProps = aMetrics.getConstArray();
for( sal_Int32 n = 0; n < nProps; n++ )
{
- if( pProps[n].Name.equalsAscii( "FamilyName" ) )
+ if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FamilyName" ) ) )
pFont->m_nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME,
getString(pProps[n].Value),
sal_True );
- else if( pProps[n].Name.equalsAscii( "PSName" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PSName" ) ) )
pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME,
getString(pProps[n].Value),
sal_True );
- else if( pProps[n].Name.equalsAscii( "StyleName" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StyleName" ) ) )
pFont->m_aStyleName = getString(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "Italic" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Italic" ) ) )
pFont->m_eItalic = static_cast<italic::type>(getInt(pProps[n].Value));
- else if( pProps[n].Name.equalsAscii( "Width" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) )
pFont->m_eWidth = static_cast<width::type>(getInt(pProps[n].Value));
- else if( pProps[n].Name.equalsAscii( "Weight" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Weight" ) ) )
pFont->m_eWeight = static_cast<weight::type>(getInt(pProps[n].Value));
- else if( pProps[n].Name.equalsAscii( "Pitch" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Pitch" ) ) )
pFont->m_ePitch = static_cast<pitch::type>(getInt(pProps[n].Value));
- else if( pProps[n].Name.equalsAscii( "Encoding" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Encoding" ) ) )
pFont->m_aEncoding = static_cast<rtl_TextEncoding>(getInt(pProps[n].Value));
- else if( pProps[n].Name.equalsAscii( "FontEncodingOnly" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FontEncodingOnly" ) ) )
pFont->m_bFontEncodingOnly = getBool(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "GlobalMetricXWidth" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricXWidth" ) ) )
pFont->m_aGlobalMetricX.width = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "GlobalMetricXHeight" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricXHeight" ) ) )
pFont->m_aGlobalMetricX.height = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "GlobalMetricYWidth" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricYWidth" ) ) )
pFont->m_aGlobalMetricY.width = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "GlobalMetricYHeight" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GlobalMetricYHeight" ) ) )
pFont->m_aGlobalMetricY.height = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "Ascend" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Ascend" ) ) )
pFont->m_nAscend = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "Descend" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Descend" ) ) )
pFont->m_nDescend = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "Leading" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Leading" ) ) )
pFont->m_nLeading = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "XMin" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XMin" ) ) )
pFont->m_nXMin = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "YMin" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "YMin" ) ) )
pFont->m_nYMin = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "XMax" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XMax" ) ) )
pFont->m_nXMax = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "YMax" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "YMax" ) ) )
pFont->m_nYMax = getInt(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "VerticalSubstitutes" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VerticalSubstitutes" ) ) )
pFont->m_bHaveVerticalSubstitutedGlyphs = getBool(pProps[n].Value);
- else if( pProps[n].Name.equalsAscii( "EncodingVector" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncodingVector" ) ) )
{
Sequence< NamedValue > aEncoding;
pProps[n].Value >>= aEncoding;
@@ -4035,7 +4061,7 @@ bool PrintFontManager::readOverrideMetrics()
pFont->m_aEncodingVector[ cCode ] = nGlyph;
}
}
- else if( pProps[n].Name.equalsAscii( "NonEncoded" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NonEncoded" ) ) )
{
Sequence< NamedValue > aEncoding;
pProps[n].Value >>= aEncoding;
@@ -4048,7 +4074,7 @@ bool PrintFontManager::readOverrideMetrics()
pFont->m_aNonEncoded[ cCode ] = OUStringToOString(aGlyphName,RTL_TEXTENCODING_ASCII_US);
}
}
- else if( pProps[n].Name.equalsAscii( "CharacterMetrics" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharacterMetrics" ) ) )
{
// fill pFont->m_pMetrics->m_aMetrics
// expect triples of int: int -> CharacterMetric.{ width, height }
@@ -4062,7 +4088,7 @@ bool PrintFontManager::readOverrideMetrics()
pFont->m_pMetrics->m_aMetrics[ pInts[m] ].height = static_cast<short int>(pInts[m+2]);
}
}
- else if( pProps[n].Name.equalsAscii( "XKernPairs" ) )
+ else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "XKernPairs" ) ) )
{
// fill pFont->m_pMetrics->m_aXKernPairs
// expection name: <unicode1><unicode2> value: ((height << 16)| width)
@@ -4102,3 +4128,5 @@ bool PrintFontManager::readOverrideMetrics()
return true;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx
index 05213a52597c..4b0d327a9a03 100644
--- a/vcl/unx/generic/fontmanager/helper.cxx
+++ b/vcl/unx/generic/fontmanager/helper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -41,7 +42,12 @@
#include "osl/process.h"
#include "rtl/bootstrap.hxx"
-using namespace rtl;
+using ::rtl::Bootstrap;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OString;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringToOString;
namespace psp {
@@ -276,11 +282,11 @@ bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile )
if( buffer[0] != 0x80 ) // test for pfb m_agic number
{
// this migt be a pfa font already
- sal_uInt64 nWrite = 0;
if( ! rInFile.read( buffer+6, 9, nRead ) && nRead == 9 &&
( ! std::strncmp( (char*)buffer, "%!FontType1-", 12 ) ||
! std::strncmp( (char*)buffer, "%!PS-AdobeFont-", 15 ) ) )
{
+ sal_uInt64 nWrite = 0;
if( rOutFile.write( buffer, 15, nWrite ) || nWrite != 15 )
bSuccess = false;
while( bSuccess &&
@@ -402,3 +408,4 @@ void psp::splitPath( OString& rPath, OString& rDir, OString& rBase )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/parseAFM.cxx b/vcl/unx/generic/fontmanager/parseAFM.cxx
index e1a33b4d1b5d..242537c8e699 100644
--- a/vcl/unx/generic/fontmanager/parseAFM.cxx
+++ b/vcl/unx/generic/fontmanager/parseAFM.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved.
*
@@ -548,95 +549,6 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi )
} /* parseGlobals */
-#if 0
-/************************* initializeArray ************************/
-
-/* Unmapped character codes are (at Adobe Systems) assigned the
- * width of the space character (if one exists) else they get the
- * value of 250 ems. This function initializes all entries in the
- * char widths array to have this value. Then any mapped character
- * codes will be replaced with the width of the appropriate character
- * when parsing the character metric section.
-
- * This function parses the Character Metrics Section looking
- * for a space character (by comparing character names). If found,
- * the width of the space character will be used to initialize the
- * values in the array of character widths.
- *
- * Before returning, the position of the read/write pointer of the
- * FileInputStream is reset to be where it was upon entering this function.
- */
-
-static int initializeArray( FileInputStream* fp, register int* cwi)
-{
- bool cont = true, found = false;
- unsigned int opos = fp->tell();
- int code = 0, width = 0, i = 0, error = 0, tokenlen;
- register char *keyword;
-
- while (cont)
- {
- keyword = token(fp,tokenlen);
- if (keyword == NULL)
- {
- error = earlyEOF;
- break; /* get out of loop */
- }
- switch(recognize(keyword,tokenlen))
- {
- case COMMENT:
- keyword = linetoken(fp);
- break;
- case CODE:
- if ((keyword = token(fp,tokenlen)) != NULL)
- code = atoi(keyword);
- break;
- case CODEHEX:
- if ((keyword = token(fp,tokenlen)) != NULL)
- sscanf(keyword,"<%x>", &code);
- break;
- case XWIDTH:
- if ((keyword = token(fp,tokenlen)) != NULL)
- width = atoi(keyword);
- break;
- case X0WIDTH:
- (void) token(fp,tokenlen);
- break;
- case CHARNAME:
- if ((keyword = token(fp,tokenlen)) != NULL)
- if (MATCH(keyword, Space))
- {
- cont = false;
- found = true;
- }
- break;
- case ENDCHARMETRICS:
- cont = false;
- break;
- case ENDFONTMETRICS:
- cont = false;
- error = normalEOF;
- break;
- case NOPE:
- default:
- error = parseError;
- break;
- } /* switch */
- } /* while */
-
- if (!found)
- width = 250;
-
- for (i = 0; i < 256; ++i)
- cwi[i] = width;
-
- fp->seek(opos);
-
- return(error);
-
-} /* initializeArray */
-#endif
-
/************************* parseCharWidths **************************/
/* This function is called by "parseFile". It will parse the AFM file
@@ -1509,7 +1421,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags)
void
freeFontInfo (FontInfo *fi)
{
- int i, j;
+ int i;
if (fi->gfi)
{
@@ -1563,6 +1475,7 @@ freeFontInfo (FontInfo *fi)
for (i = 0; i < fi->numOfComps; i++)
{
free (fi->ccd[i].ccName);
+ int j;
for (j = 0; j < fi->ccd[i].numOfPieces; j++)
free (fi->ccd[i].pieces[j].pccName);
@@ -1575,3 +1488,5 @@ freeFontInfo (FontInfo *fi)
}
} // namspace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/fontmanager/parseAFM.hxx b/vcl/unx/generic/fontmanager/parseAFM.hxx
index cfebde696c14..0c390bd8cf8d 100644
--- a/vcl/unx/generic/fontmanager/parseAFM.hxx
+++ b/vcl/unx/generic/fontmanager/parseAFM.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved.
*
@@ -332,3 +333,5 @@ int parseFile( const char* pFilename, FontInfo **fi, FLAGS flags );
void freeFontInfo(FontInfo *fi);
} // namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/cdeint.cxx b/vcl/unx/generic/gdi/cdeint.cxx
index af635f38e9bc..a6a37a178c48 100644
--- a/vcl/unx/generic/gdi/cdeint.cxx
+++ b/vcl/unx/generic/gdi/cdeint.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -75,7 +76,6 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
int nStringCount;
XTextProperty aTextProperty;
aTextProperty.value = 0;
- int i;
static Atom nResMgrAtom = XInternAtom( mpDisplay, "RESOURCE_MANAGER", False );
@@ -91,6 +91,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
// *n*ColorPalette: palettefile
ByteString aLines;
+ int i;
for( i=0; i < nStringCount; i++ )
aLines += ppStringList[i];
for( i = aLines.GetTokenCount( '\n' )-1; i >= 0; i-- )
@@ -127,7 +128,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
;
int nNumber = aLine.Copy( ++nPos ).ToInt32();
- DBG_TRACE2( "found palette %d in resource \"%s\"", nNumber, aLine.GetBuffer() );
+ OSL_TRACE( "found palette %d in resource \"%s\"", nNumber, aLine.GetBuffer() );
// found no documentation what this number actually means;
// might be the screen number. 0 seems to be the right one
@@ -135,7 +136,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
if( nNumber )
continue;
- DBG_TRACE1( "Palette file is \"%s\".\n", aPaletteFile.GetBuffer() );
+ OSL_TRACE( "Palette file is \"%s\".\n", aPaletteFile.GetBuffer() );
String aPath( aHomeDir );
aPath.AppendAscii( "/.dt/palettes/" );
@@ -157,7 +158,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
aStream.ReadLine( aBuffer );
// format is "#RRRRGGGGBBBB"
- DBG_TRACE1( "\t\"%s\".\n", aBuffer.GetBuffer() );
+ OSL_TRACE( "\t\"%s\".\n", aBuffer.GetBuffer() );
if( aBuffer.Len() )
{
@@ -171,7 +172,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
| ( getHexDigit( pArr[8] ) << 4 )
);
- DBG_TRACE1( "\t\t%lx\n", aColors[nIndex].GetColor() );
+ OSL_TRACE( "\t\t%lx\n", aColors[nIndex].GetColor() );
}
}
@@ -242,3 +243,5 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings )
}
rSettings.SetStyleSettings( aStyleSettings );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/dtint.cxx b/vcl/unx/generic/gdi/dtint.cxx
index d14389cd0438..df1826df90f5 100644
--- a/vcl/unx/generic/gdi/dtint.cxx
+++ b/vcl/unx/generic/gdi/dtint.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -63,9 +64,10 @@
#endif
-using namespace rtl;
using namespace vcl_sal;
+using ::rtl::OUString;
+
String DtIntegrator::aHomeDir;
DtIntegrator::DtIntegrator() :
@@ -137,3 +139,5 @@ void DtIntegrator::GetSystemLook( AllSettings& rSettings )
aStyleSettings.SetCursorBlinkTime( 500 );
rSettings.SetStyleSettings( aStyleSettings );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/dtsetenum.hxx b/vcl/unx/generic/gdi/dtsetenum.hxx
index 5406ac870a43..7973758d9f0d 100644
--- a/vcl/unx/generic/gdi/dtsetenum.hxx
+++ b/vcl/unx/generic/gdi/dtsetenum.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -144,3 +145,5 @@ enum DtSetEnum
};
#endif // _VCL_DTSETENUM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index 3cd828c24065..9da147dbec9c 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -681,3 +682,4 @@ void X11SalGraphics::releaseGlyphPeer()
// ===========================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.hxx b/vcl/unx/generic/gdi/gcach_xpeer.hxx
index a65c75174858..412c47f82de2 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.hxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -90,3 +91,5 @@ private:
};
#endif // _SV_GCACH_XPEER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/pspgraphics.cxx b/vcl/unx/generic/gdi/pspgraphics.cxx
index e68568a81aa9..65c4c0ab41da 100644
--- a/vcl/unx/generic/gdi/pspgraphics.cxx
+++ b/vcl/unx/generic/gdi/pspgraphics.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,7 +59,9 @@
#endif
using namespace psp;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OString;
// ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer ---------------
@@ -145,7 +148,7 @@ SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) :
mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_MASK; break;
default:
- DBG_ERROR("Error: SalPrinterBmp::SalPrinterBmp() unknown bitmap format");
+ OSL_FAIL("Error: SalPrinterBmp::SalPrinterBmp() unknown bitmap format");
break;
}
}
@@ -190,7 +193,7 @@ SalPrinterBmp::GetDepth () const
default:
nDepth = 1;
- DBG_ERROR ("Error: unsupported bitmap depth in SalPrinterBmp::GetDepth()");
+ OSL_FAIL("Error: unsupported bitmap depth in SalPrinterBmp::GetDepth()");
break;
}
@@ -281,7 +284,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY )
}
}
-sal_uInt16 PspGraphics::GetBitCount()
+sal_uInt16 PspGraphics::GetBitCount() const
{
return m_pPrinterGfx->GetBitCount();
}
@@ -447,12 +450,12 @@ sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void
void PspGraphics::copyBits( const SalTwoRect*,
SalGraphics* )
{
- DBG_ERROR( "Error: PrinterGfx::CopyBits() not implemented" );
+ OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" );
}
void PspGraphics::copyArea ( long,long,long,long,long,long,sal_uInt16 )
{
- DBG_ERROR( "Error: PrinterGfx::CopyArea() not implemented" );
+ OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" );
}
void PspGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap )
@@ -474,21 +477,21 @@ void PspGraphics::drawBitmap( const SalTwoRect*,
const SalBitmap&,
const SalBitmap& )
{
- DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
+ OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
}
void PspGraphics::drawBitmap( const SalTwoRect*,
const SalBitmap&,
SalColor )
{
- DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent color");
+ OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent color");
}
void PspGraphics::drawMask( const SalTwoRect*,
const SalBitmap &,
SalColor )
{
- DBG_ERROR("Error: PrinterGfx::DrawMask() not implemented");
+ OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented");
}
SalBitmap* PspGraphics::getBitmap( long, long, long, long )
@@ -499,13 +502,13 @@ SalBitmap* PspGraphics::getBitmap( long, long, long, long )
SalColor PspGraphics::getPixel( long, long )
{
- DBG_ERROR ("Warning: PrinterGfx::GetPixel() not implemented");
+ OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented");
return 0;
}
void PspGraphics::invert(long,long,long,long,SalInvert)
{
- DBG_ERROR ("Warning: PrinterGfx::Invert() not implemented");
+ OSL_FAIL("Warning: PrinterGfx::Invert() not implemented");
}
//==========================================================================
@@ -722,14 +725,6 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx
#ifdef ENABLE_GRAPHITE
else if (pGrLayout)
{
- #if 0 // HACK: disabled for now due to #i114460#, see #desc12 there
- // TODO: get rid of glyph->string mapping altogether for printing
- // TODO: fix GraphiteServerFontLayout's returned aCharPosAry
- // TODO: fix PrinterGfx's caching?
- pText = pGrLayout->getTextPtr();
- nMinCharPos = pGrLayout->getMinCharPos();
- nMaxCharPos = pGrLayout->getMaxCharPos();
- #endif
}
#endif
}
@@ -786,6 +781,13 @@ const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const
return pIFCMap;
}
+bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+{
+ if (!m_pServerFont[0])
+ return false;
+ return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities);
+}
+
sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel )
{
// release all fonts that are to be overridden
@@ -884,7 +886,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
const psp::PrinterInfo& rInfo = psp::PrinterInfoManager::get().getPrinterInfo( m_pJobData->m_aPrinterName );
if( rInfo.m_bPerformFontSubstitution )
{
- for( std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it )
+ for( boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it )
pOutDev->ImplAddDevFontSubstitute( it->first, it->second, FONT_SUBSTITUTE_ALWAYS );
}
}
@@ -989,13 +991,9 @@ SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel
{
#ifdef ENABLE_GRAPHITE
// Is this a Graphite font?
- if (GraphiteFontAdaptor::IsGraphiteEnabledFont(*m_pServerFont[nFallbackLevel]))
+ if (GraphiteServerFontLayout::IsGraphiteEnabledFont(m_pServerFont[nFallbackLevel]))
{
- sal_Int32 xdpi, ydpi;
- GetResolution(xdpi, ydpi);
- GraphiteFontAdaptor * pGrfont = new GraphiteFontAdaptor( *m_pServerFont[nFallbackLevel], xdpi, ydpi);
- if (!pGrfont) return NULL;
- pLayout = new GraphiteServerFontLayout(pGrfont);
+ pLayout = new GraphiteServerFontLayout(*m_pServerFont[nFallbackLevel]);
}
else
#endif
@@ -1199,7 +1197,7 @@ FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth)
case psp::width::UltraExpanded: return WIDTH_ULTRA_EXPANDED;
case psp::width::Unknown: return WIDTH_DONTKNOW;
default:
- DBG_ERROR( "unknown width mapping" );
+ OSL_FAIL( "unknown width mapping" );
break;
}
return WIDTH_DONTKNOW;
@@ -1221,7 +1219,7 @@ FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight)
case psp::weight::Black: return WEIGHT_BLACK;
case psp::weight::Unknown: return WEIGHT_DONTKNOW;
default:
- DBG_ERROR( "unknown weight mapping" );
+ OSL_FAIL( "unknown weight mapping" );
break;
}
return WEIGHT_DONTKNOW;
@@ -1235,7 +1233,7 @@ FontPitch PspGraphics::ToFontPitch (psp::pitch::type ePitch)
case psp::pitch::Variable: return PITCH_VARIABLE;
case psp::pitch::Unknown: return PITCH_DONTKNOW;
default:
- DBG_ERROR( "unknown pitch mapping" );
+ OSL_FAIL( "unknown pitch mapping" );
break;
}
return PITCH_DONTKNOW;
@@ -1250,7 +1248,7 @@ FontItalic PspGraphics::ToFontItalic (psp::italic::type eItalic)
case psp::italic::Italic: return ITALIC_NORMAL;
case psp::italic::Unknown: return ITALIC_DONTKNOW;
default:
- DBG_ERROR( "unknown italic mapping" );
+ OSL_FAIL( "unknown italic mapping" );
break;
}
return ITALIC_DONTKNOW;
@@ -1268,7 +1266,7 @@ FontFamily PspGraphics::ToFontFamily (psp::family::type eFamily)
case psp::family::System: return FAMILY_SYSTEM;
case psp::family::Unknown: return FAMILY_DONTKNOW;
default:
- DBG_ERROR( "unknown family mapping" );
+ OSL_FAIL( "unknown family mapping" );
break;
}
return FAMILY_DONTKNOW;
@@ -1478,7 +1476,7 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
aRes.hDrawable = 0;
- aRes.pRenderFormat = 0;
+ aRes.pXRenderFormat = 0;
return aRes;
}
@@ -1502,3 +1500,5 @@ bool PspGraphics::supportsOperation( OutDevSupportType ) const
{
return false;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 732ae465df52..0c3babc48fdb 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,6 +41,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/salbtype.hxx>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <tools/prex.h>
#include "unx/Xproto.h"
@@ -73,7 +75,8 @@ sal_uLong X11SalBitmap::mnCacheInstCount = 0;
X11SalBitmap::X11SalBitmap() :
mpDIB( NULL ),
- mpDDB( NULL )
+ mpDDB( NULL ),
+ mbGrey( false )
{
}
@@ -193,7 +196,8 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
int nScreen,
long nDrawableDepth,
long nX, long nY,
- long nWidth, long nHeight )
+ long nWidth, long nHeight,
+ bool bGrey )
{
BitmapBuffer* pDIB = NULL;
@@ -210,7 +214,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
// so better catch the XError
pXLib->PushXErrorLevel( true );
XImage* pImage = XGetImage( pXDisp, aDrawable, nX, nY, nWidth, nHeight, AllPlanes, ZPixmap );
- bool bWasError = pXLib->HasXErrorOccured() && pXLib->GetLastXErrorRequestCode() == X_GetImage;
+ bool bWasError = pXLib->HasXErrorOccurred() && pXLib->GetLastXErrorRequestCode() == X_GetImage;
pXLib->PopXErrorLevel();
if( ! bWasError && pImage && pImage->data )
@@ -304,6 +308,21 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable,
rPal[ 0 ] = Color( COL_BLACK );
rPal[ 1 ] = Color( COL_WHITE );
}
+ else if( pImage->depth == 8 && bGrey )
+ {
+ rPal.SetEntryCount( 256 );
+ pDstPal = &rPal;
+
+ for( sal_uInt16 i = 0; i < 256; i++ )
+ {
+ BitmapColor& rBmpCol = rPal[ i ];
+
+ rBmpCol.SetRed( i );
+ rBmpCol.SetGreen( i );
+ rBmpCol.SetBlue( i );
+ }
+
+ }
else if( aSrcBuf.mnBitCount <= 8 )
{
const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
@@ -347,7 +366,8 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
mpDDB->ImplGetDepth(),
0, 0,
mpDDB->ImplGetWidth(),
- mpDDB->ImplGetHeight() );
+ mpDDB->ImplGetHeight(),
+ mbGrey );
}
if( mpDIB && mpDIB->mnWidth && mpDIB->mnHeight )
@@ -430,6 +450,20 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long
(*pPal)[ 0 ] = Color( COL_BLACK );
(*pPal)[ 1 ] = Color( COL_WHITE );
}
+ else if( pImage->depth == 8 && mbGrey )
+ {
+ pPal = new BitmapPalette( 256 );
+
+ for( sal_uInt16 i = 0; i < 256; i++ )
+ {
+ BitmapColor& rBmpCol = (*pPal)[ i ];
+
+ rBmpCol.SetRed( i );
+ rBmpCol.SetGreen( i );
+ rBmpCol.SetBlue( i );
+ }
+
+ }
else if( pImage->depth <= 8 )
{
const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
@@ -594,7 +628,8 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Drawable aDrawable,
mpDDB->ImplGetDepth(),
0, 0,
mpDDB->ImplGetWidth(),
- mpDDB->ImplGetHeight() );
+ mpDDB->ImplGetHeight(),
+ mbGrey );
}
delete mpDDB, const_cast<X11SalBitmap*>(this)->mpDDB = NULL;
@@ -747,6 +782,33 @@ bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 )
// -----------------------------------------------------------------------------
+bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY );
+ if( xFastPropertySet.get() ) {
+ sal_Int32 depth;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args;
+
+ if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
+ long pixmapHandle;
+ if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
+
+ mbGrey = bMask;
+ bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() );
+ bool bFreePixmap;
+ if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap )
+ XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle );
+
+ return bSuccess;
+ }
+ }
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
void X11SalBitmap::Destroy()
{
if( mpDIB )
@@ -801,7 +863,7 @@ BitmapBuffer* X11SalBitmap::AcquireBuffer( bool )
mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(),
mpDDB->ImplGetScreen(),
mpDDB->ImplGetDepth(),
- 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight() );
+ 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey );
}
return mpDIB;
@@ -1094,3 +1156,5 @@ void ImplSalBitmapCache::ImplClear()
maBmpList.Clear();
mnTotalSize = 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salcvt.cxx b/vcl/unx/generic/gdi/salcvt.cxx
index c699cdb12335..f757f3fc0ab3 100644
--- a/vcl/unx/generic/gdi/salcvt.cxx
+++ b/vcl/unx/generic/gdi/salcvt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -339,3 +340,4 @@ SalConverterCache::ConvertStringUTF16( const sal_Unicode *pText, int nTextLen,
return nSize;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salcvt.hxx b/vcl/unx/generic/gdi/salcvt.hxx
index 6d0e3bf9650c..896ae4f30b36 100644
--- a/vcl/unx/generic/gdi/salcvt.hxx
+++ b/vcl/unx/generic/gdi/salcvt.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -91,3 +92,4 @@ class SalConverterCache {
#endif /* SAL_CONVERTER_CACHE_HXX_ */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 39205ab2e321..b1b8d337430d 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -102,8 +103,8 @@ X11SalGraphics::X11SalGraphics()
m_pVDev = NULL;
m_pDeleteColormap = NULL;
hDrawable_ = None;
- m_aRenderPicture = 0;
- m_pRenderFormat = NULL;
+ m_aXRenderPicture = 0;
+ m_pXRenderFormat = NULL;
mpClipRegion = NULL;
pPaintRegion_ = NULL;
@@ -184,8 +185,8 @@ void X11SalGraphics::freeResources()
if( m_pDeleteColormap )
delete m_pDeleteColormap, m_pColormap = m_pDeleteColormap = NULL;
- if( m_aRenderPicture )
- XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0;
+ if( m_aXRenderPicture )
+ XRenderPeer::GetInstance().FreePicture( m_aXRenderPicture ), m_aXRenderPicture = 0;
bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false;
}
@@ -206,10 +207,10 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
hDrawable_ = aDrawable;
SetXRenderFormat( NULL );
- if( m_aRenderPicture )
+ if( m_aXRenderPicture )
{
- XRenderPeer::GetInstance().FreePicture( m_aRenderPicture );
- m_aRenderPicture = 0;
+ XRenderPeer::GetInstance().FreePicture( m_aXRenderPicture );
+ m_aXRenderPicture = 0;
}
if( hDrawable_ )
@@ -222,22 +223,10 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen )
{
-#if 0 // TODO: use SetDrawable() instead
- m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen);
- hDrawable_ = aTarget;
- m_nScreen = nScreen;
- SetXRenderFormat( NULL );
- if( m_aRenderPicture )
- XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0;
- nPenPixel_ = GetPixel( nPenColor_ );
- nTextPixel_ = GetPixel( nTextColor_ );
- nBrushPixel_ = GetPixel( nBrushColor_ );
-#else
m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen);
m_nScreen = nScreen;
SetDrawable( aTarget, nScreen );
-#endif
bWindow_ = sal_True;
m_pFrame = pFrame;
@@ -258,10 +247,8 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const
int n = 0;
XLIB_Region Regions[3];
- if( mpClipRegion /* && !XEmptyRegion( mpClipRegion ) */ )
+ if( mpClipRegion )
Regions[n++] = mpClipRegion;
-// if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ )
-// Regions[n++] = pPaintRegion_;
if( pXReg && !XEmptyRegion( pXReg ) )
Regions[n++] = pXReg;
@@ -274,8 +261,7 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const
{
XLIB_Region pTmpRegion = XCreateRegion();
XIntersectRegion( Regions[0], Regions[1], pTmpRegion );
-// if( 3 == n )
-// XIntersectRegion( Regions[2], pTmpRegion, pTmpRegion );
+
XSetRegion( pDisplay, pGC, pTmpRegion );
XDestroyRegion( pTmpRegion );
}
@@ -320,7 +306,6 @@ GC X11SalGraphics::SelectBrush()
if( !pBrushGC_ )
{
XGCValues values;
- // values.subwindow_mode = IncludeInferiors;
values.subwindow_mode = ClipByChildren;
values.fill_rule = EvenOddRule; // Pict import/ Gradient
values.graphics_exposures = False;
@@ -530,19 +515,16 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons
{
// different x- and y- resolutions are usually artifacts of
// a wrongly calculated screen size.
- //if( (13*rDPIX >= 10*rDPIY) && (13*rDPIY >= 10*rDPIX) ) //+-30%
- {
#ifdef DEBUG
- printf("Forcing Resolution from %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 " to %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 "\n",
- rDPIX,rDPIY,rDPIY,rDPIY);
+ printf("Forcing Resolution from %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 " to %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 "\n",
+ rDPIX,rDPIY,rDPIY,rDPIY);
#endif
- rDPIX = rDPIY; // y-resolution is more trustworthy
- }
+ rDPIX = rDPIY; // y-resolution is more trustworthy
}
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-sal_uInt16 X11SalGraphics::GetBitCount() // const
+sal_uInt16 X11SalGraphics::GetBitCount() const
{
return GetVisual().GetDepth();
}
@@ -1017,41 +999,32 @@ XID X11SalGraphics::GetXRenderPicture()
{
XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !m_aRenderPicture )
+ if( !m_aXRenderPicture )
{
// check xrender support for matching visual
- // find a XRenderPictFormat compatible with the Drawable
- XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat());
- if( !pVisualFormat )
- {
- Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
- pVisualFormat = rRenderPeer.FindVisualFormat( pVisual );
- if( !pVisualFormat )
- return 0;
- // cache the XRenderPictFormat
- SetXRenderFormat( static_cast<void*>(pVisualFormat) );
- }
-
+ XRenderPictFormat* pXRenderFormat = GetXRenderFormat();
+ if( !pXRenderFormat )
+ return 0;
// get the matching xrender target for drawable
- m_aRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
+ m_aXRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pXRenderFormat, 0, NULL );
}
-#if 0
- // setup clipping so the callers don't have to do it themselves
- // TODO: avoid clipping if already set correctly
- if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
- rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
- else
-#endif
{
// reset clip region
// TODO: avoid clip reset if already done
XRenderPictureAttributes aAttr;
aAttr.clip_mask = None;
- rRenderPeer.ChangePicture( m_aRenderPicture, CPClipMask, &aAttr );
+ rRenderPeer.ChangePicture( m_aXRenderPicture, CPClipMask, &aAttr );
}
- return m_aRenderPicture;
+ return m_aXRenderPicture;
+}
+
+XRenderPictFormat* X11SalGraphics::GetXRenderFormat() const
+{
+ if( m_pXRenderFormat == NULL )
+ m_pXRenderFormat = XRenderPeer::GetInstance().FindVisualFormat( GetVisual().visual );
+ return m_pXRenderFormat;
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -1063,11 +1036,11 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
aRes.nSize = sizeof(aRes);
aRes.pDisplay = GetXDisplay();
aRes.hDrawable = hDrawable_;
- aRes.pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
+ aRes.pVisual = GetVisual().visual;
aRes.nScreen = m_nScreen;
- aRes.nDepth = GetDisplay()->GetVisual( m_nScreen ).GetDepth();
- aRes.aColormap = GetDisplay()->GetColormap( m_nScreen ).GetXColormap();
- aRes.pRenderFormat = m_pRenderFormat;
+ aRes.nDepth = GetBitCount();
+ aRes.aColormap = GetColormap().GetXColormap();
+ aRes.pXRenderFormat = m_pXRenderFormat;
return aRes;
}
@@ -1271,3 +1244,4 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index 314797946ecf..49dd7174d583 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,26 +46,12 @@
#include "printergfx.hxx"
#include "vcl/bmpacc.hxx"
+#include "vcl/outdata.hxx"
#undef SALGDI2_TESTTRANS
// -=-= debugging =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#if 0
-
-static void sal_PrintImage( char *s, XImage*p )
-{
- fprintf( stderr, "%s %d %d %d\n", s, p->depth, p->width, p->height );
- int nW = Min( 64, p->width*p->bits_per_pixel >> 3 );
- for( int i = 0; i < Min( 16, p->height ); i++ )
- {
- for( int j = 0; j < nW; j++ )
- fprintf( stderr, "%02X", (UINT8)p->data[i*p->bytes_per_line+j] );
- fprintf( stderr, "\n" );
- }
-}
-
-#endif // DBG_UTIL
// -----------------------------------------------------------------------------
@@ -643,7 +630,22 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa
{
// set foreground/background values for 1Bit bitmaps
XGetGCValues( pXDisp, aGC, nValues, &aOldVal );
- aNewVal.foreground = rColMap.GetWhitePixel(), aNewVal.background = rColMap.GetBlackPixel();
+
+ aNewVal.foreground = rColMap.GetWhitePixel();
+ aNewVal.background = rColMap.GetBlackPixel();
+
+ //fdo#33455 handle 1 bit depth pngs with palette entries
+ //to set fore/back colors
+ if (const BitmapBuffer* pBitmapBuffer = const_cast<SalBitmap&>(rSalBitmap).AcquireBuffer(true))
+ {
+ const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
+ if (rPalette.GetEntryCount() == 2)
+ {
+ aNewVal.foreground = rColMap.GetPixel(ImplColorToSal(rPalette[0]));
+ aNewVal.background = rColMap.GetPixel(ImplColorToSal(rPalette[1]));
+ }
+ }
+
XChangeGC( pXDisp, aGC, nValues, &aNewVal );
}
@@ -943,7 +945,7 @@ void X11SalGraphics::drawBitmap( const SalTwoRect*,
const SalBitmap&,
SalColor )
{
- DBG_ERROR( "::DrawBitmap with transparent color not supported" );
+ OSL_FAIL( "::DrawBitmap with transparent color not supported" );
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -1149,3 +1151,4 @@ bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const
return bRet;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index fc278dd250eb..c60bf49fff0e 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,6 +54,8 @@
#include "i18npool/mslangid.hxx"
+#include <boost/unordered_set.hpp>
+
#include <vcl/sysdata.hxx>
#include "printergfx.hxx"
#include "vcl/fontmanager.hxx"
@@ -75,7 +78,6 @@
#include "outdev.h"
-#include <hash_set>
#ifdef ENABLE_GRAPHITE
#include <graphite_layout.hxx>
@@ -108,8 +110,7 @@ struct _XRegion
BOX *rects;
BOX extents;
};
-using namespace rtl;
-
+using ::rtl::OUString;
// ===========================================================================
// PspKernInfo allows on-demand-querying of psprint provided kerning info (#i29881#)
@@ -134,8 +135,6 @@ void PspKernInfo::Initialize() const
if( rKernPairs.empty() )
return;
- // feed psprint's kerning list into a lookup-friendly container
- maUnicodeKernPairs.resize( rKernPairs.size() );
PspKernPairs::const_iterator it = rKernPairs.begin();
for(; it != rKernPairs.end(); ++it )
{
@@ -181,21 +180,6 @@ X11SalGraphics::GetFontGC()
bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLevel )
{
-#ifdef HDU_DEBUG
- ByteString aReqName( "NULL" );
- if( pEntry )
- aReqName = ByteString( pEntry->maName, RTL_TEXTENCODING_UTF8 );
- ByteString aUseName( "NULL" );
- if( pEntry && pEntry->mpFontData )
- aUseName = ByteString( pEntry->mpFontData->GetFamilyName(), RTL_TEXTENCODING_UTF8 );
- fprintf( stderr, "SetFont(lvl=%d,\"%s\", %d*%d, naa=%d,b=%d,i=%d) => \"%s\"\n",
- nFallbackLevel, aReqName.GetBuffer(),
- !pEntry?-1:pEntry->mnWidth, !pEntry?-1:pEntry->mnHeight,
- !pEntry?-1:pEntry->mbNonAntialiased,
- !pEntry?-1:pEntry->meWeight, !pEntry?-1:pEntry->meItalic,
- aUseName.GetBuffer() );
-#endif
-
// release all no longer needed font resources
for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
{
@@ -245,22 +229,21 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
return false;
}
+ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize);
+
void ImplServerFontEntry::HandleFontOptions( void )
{
- bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& );
-
if( !mpServerFont )
return;
if( !mbGotFontOptions )
{
// get and cache the font options
mbGotFontOptions = true;
- mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
- maFontSelData.mnHeight, maFontOptions );
+ mpFontOptions.reset(GetFCFontOptions( *maFontSelData.mpFontData,
+ maFontSelData.mnHeight ));
}
// apply the font options
- if( mbValidFontOptions )
- mpServerFont->SetFontOptions( maFontOptions );
+ mpServerFont->SetFontOptions( mpFontOptions );
}
//--------------------------------------------------------------------------
@@ -279,6 +262,7 @@ private:
void (*mp_clip)(cairo_t*);
void (*mp_rectangle)(cairo_t*, double, double, double, double);
cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int);
+ cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(void*);
void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *);
void (*mp_font_face_destroy)(cairo_font_face_t *);
void (*mp_matrix_init_identity)(cairo_matrix_t *);
@@ -290,7 +274,7 @@ private:
void (*mp_set_font_options)(cairo_t *, const void *);
void (*mp_ft_font_options_substitute)(const void*, void*);
- bool canEmbolden() const { return false; }
+ bool canEmbolden() const { return mp_ft_font_face_create_for_pattern != NULL; }
CairoWrapper();
public:
@@ -308,6 +292,12 @@ public:
{ (*mp_rectangle)(cr, x, y, width, height); }
cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags)
{ return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); }
+ cairo_font_face_t* ft_font_face_create_for_pattern(void *pattern)
+ {
+ return mp_ft_font_face_create_for_pattern
+ ? (*mp_ft_font_face_create_for_pattern)(pattern)
+ : NULL;
+ }
void set_font_face(cairo_t *cr, cairo_font_face_t *font_face)
{ (*mp_set_font_face)(cr, font_face); }
void font_face_destroy(cairo_font_face_t *font_face)
@@ -381,6 +371,8 @@ CairoWrapper::CairoWrapper()
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" );
mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" );
+ mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(void*))
+ osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" );
mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" );
mp_font_face_destroy = (void (*)(cairo_font_face_t *))
@@ -458,9 +450,9 @@ CairoFontsCache::~CairoFontsCache()
}
}
-void CairoFontsCache::CacheFont(void *pFont, void* pId)
+void CairoFontsCache::CacheFont(void *pFont, const CairoFontsCache::CacheId &rId)
{
- maLRUFonts.push_front( std::pair<void*, void *>(pFont, pId) );
+ maLRUFonts.push_front( std::pair<void*, CairoFontsCache::CacheId>(pFont, rId) );
if (maLRUFonts.size() > 8)
{
CairoWrapper &rCairo = CairoWrapper::get();
@@ -469,11 +461,11 @@ void CairoFontsCache::CacheFont(void *pFont, void* pId)
}
}
-void* CairoFontsCache::FindCachedFont(void *pId)
+void* CairoFontsCache::FindCachedFont(const CairoFontsCache::CacheId &rId)
{
LRUFonts::iterator aEnd = maLRUFonts.end();
for (LRUFonts::iterator aI = maLRUFonts.begin(); aI != aEnd; ++aI)
- if (aI->second == pId)
+ if (aI->second == rId)
return aI->first;
return NULL;
}
@@ -498,15 +490,7 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
return;
// find a XRenderPictFormat compatible with the Drawable
- XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat());
- if( !pVisualFormat )
- {
- Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
- pVisualFormat = XRenderPeer::GetInstance().FindVisualFormat( pVisual );
- // cache the XRenderPictFormat
- SetXRenderFormat( static_cast<void*>(pVisualFormat) );
- }
-
+ XRenderPictFormat* pVisualFormat = GetXRenderFormat();
DBG_ASSERT( pVisualFormat!=NULL, "no matching XRenderPictFormat for text" );
if( !pVisualFormat )
return;
@@ -552,12 +536,21 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
cairo_font_face_t* font_face = NULL;
- void *pId = rFont.GetFtFace();
- font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(pId);
+ void* pFace = rFont.GetFtFace();
+ CairoFontsCache::CacheId aId;
+ aId.mpFace = pFace;
+ aId.mpOptions = rFont.GetFontOptions().get();
+ aId.mbEmbolden = rFont.NeedsArtificialBold();
+ font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(aId);
if (!font_face)
{
- font_face = rCairo.ft_font_face_create_for_ft_face(pId, rFont.GetLoadFlags());
- m_aCairoFontsCache.CacheFont(font_face, pId);
+ const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
+ void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL;
+ if (pPattern)
+ font_face = rCairo.ft_font_face_create_for_pattern(pPattern);
+ if (!font_face)
+ font_face = rCairo.ft_font_face_create_for_ft_face(pFace, rFont.GetLoadFlags());
+ m_aCairoFontsCache.CacheFont(font_face, aId);
}
rCairo.set_font_face(cr, font_face);
@@ -962,6 +955,13 @@ const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const
return pIFCMap;
}
+bool X11SalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rGetImplFontCapabilities) const
+{
+ if (!mpServerFont[0])
+ return false;
+ return mpServerFont[0]->GetFontCapabilities(rGetImplFontCapabilities);
+}
+
// ----------------------------------------------------------------------------
//
// SalGraphics
@@ -1101,8 +1101,7 @@ void cairosubcallback( void* pPattern )
rCairo.ft_font_options_substitute( pFontOptions, pPattern );
}
-bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
- ImplFontOptions& rFontOptions)
+ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize)
{
// TODO: get rid of these insane enum-conversions
// e.g. by using the classic vclenum values inside VCL
@@ -1199,8 +1198,7 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
}
const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
- bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions);
- return bOK;
+ return rPFM.getFontOptions(aInfo, nSize, cairosubcallback);
}
// ----------------------------------------------------------------------------
@@ -1243,7 +1241,7 @@ X11SalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs )
sal_Bool X11SalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect )
{
int nLevel = nGlyphIndex >> GF_FONTSHIFT;
- if( nLevel >= MAX_FALLBACK )
+ if( nLevel < 0 || nLevel >= MAX_FALLBACK )
return sal_False;
ServerFont* pSF = mpServerFont[ nLevel ];
@@ -1288,16 +1286,9 @@ SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
#ifdef ENABLE_GRAPHITE
// Is this a Graphite font?
if (!bDisableGraphite_ &&
- GraphiteFontAdaptor::IsGraphiteEnabledFont(*mpServerFont[nFallbackLevel]))
+ GraphiteServerFontLayout::IsGraphiteEnabledFont(mpServerFont[nFallbackLevel]))
{
- sal_Int32 xdpi, ydpi;
-
- xdpi = GetDisplay()->GetResolution().A();
- ydpi = GetDisplay()->GetResolution().B();
-
- GraphiteFontAdaptor * pGrfont = new GraphiteFontAdaptor( *mpServerFont[nFallbackLevel], xdpi, ydpi);
- if (!pGrfont) return NULL;
- pLayout = new GraphiteServerFontLayout(pGrfont);
+ pLayout = new GraphiteServerFontLayout(*mpServerFont[nFallbackLevel]);
}
else
#endif
@@ -1419,6 +1410,11 @@ class FcPreMatchSubstititution
{
public:
bool FindFontSubstitute( ImplFontSelectData& ) const;
+
+private:
+ typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >
+ CachedFontMapType;
+ mutable CachedFontMapType maCachedFontMap;
};
class FcGlyphFallbackSubstititution
@@ -1614,12 +1610,20 @@ bool FcPreMatchSubstititution::FindFontSubstitute( ImplFontSelectData &rFontSelD
|| 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
return false;
+ CachedFontMapType::const_iterator itr = maCachedFontMap.find(rFontSelData.maTargetName);
+ if (itr != maCachedFontMap.end())
+ {
+ // Cached substitution pair
+ rFontSelData.maSearchName = itr->second;
+ return true;
+ }
+
rtl::OUString aDummy;
const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy );
- // TODO: cache the font substitution suggestion
- // FC doing it would be preferable because it knows the invariables
- // e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans
- // whereas we would have to check for every size or attribute
+
+ maCachedFontMap.insert(
+ CachedFontMapType::value_type(rFontSelData.maTargetName, aOut.maSearchName));
+
if( !aOut.maSearchName.Len() )
return false;
@@ -1688,3 +1692,4 @@ bool FcGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFon
// ===========================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salprnpsp.cxx b/vcl/unx/generic/gdi/salprnpsp.cxx
index 0a278cab971f..009621a9e22e 100644
--- a/vcl/unx/generic/gdi/salprnpsp.cxx
+++ b/vcl/unx/generic/gdi/salprnpsp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -65,10 +66,15 @@
#include "print.h"
#include "salptype.hxx"
+#include <com/sun/star/beans/PropertyValue.hpp>
+
using namespace psp;
-using namespace rtl;
using namespace com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringHash;
+using ::rtl::OUStringToOString;
+
/*
* static helpers
*/
@@ -400,7 +406,7 @@ SalInfoPrinter* X11SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn
// set/clear backwards compatibility flag
bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
+ boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
if( compat_it != pJobSetup->maValueMap.end() )
@@ -637,7 +643,7 @@ sal_Bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup )
{
// set/clear backwards compatibility flag
bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
+ boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
if( compat_it != pJobSetup->maValueMap.end() )
@@ -676,17 +682,6 @@ sal_Bool PspSalInfoPrinter::SetData(
// merge papersize if necessary
if( nSetDataFlags & SAL_JOBSET_PAPERSIZE )
{
- int nWidth, nHeight;
- if( pJobSetup->meOrientation == ORIENTATION_PORTRAIT )
- {
- nWidth = pJobSetup->mnPaperWidth;
- nHeight = pJobSetup->mnPaperHeight;
- }
- else
- {
- nWidth = pJobSetup->mnPaperHeight;
- nHeight = pJobSetup->mnPaperWidth;
- }
String aPaper;
if( pJobSetup->mePaperFormat == PAPER_USER )
@@ -964,7 +959,7 @@ sal_Bool PspSalPrinter::StartJob(
bool bDirect,
ImplJobSetup* pJobSetup )
{
- vcl_sal::PrinterUpdate::jobStarted();
+ GetSalData()->m_pInstance->jobStartedPrinterUpdate();
m_bFax = false;
m_bPdf = false;
@@ -995,8 +990,8 @@ sal_Bool PspSalPrinter::StartJob(
m_aTmpFile = getTmpName();
nMode = S_IRUSR | S_IWUSR;
- ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
- it = pJobSetup->maValueMap.find( ::rtl::OUString::createFromAscii( "FAX#" ) );
+ ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
+ it = pJobSetup->maValueMap.find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAX#")) );
if( it != pJobSetup->maValueMap.end() )
m_aFaxNr = it->second;
@@ -1025,7 +1020,7 @@ sal_Bool PspSalPrinter::StartJob(
// set/clear backwards compatibility flag
bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
+ boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
if( compat_it != pJobSetup->maValueMap.end() )
@@ -1066,7 +1061,7 @@ sal_Bool PspSalPrinter::EndJob()
}
}
}
- vcl_sal::PrinterUpdate::jobEnded();
+ GetSalData()->m_pInstance->jobEndedPrinterUpdate();
return bSuccess;
}
@@ -1075,7 +1070,7 @@ sal_Bool PspSalPrinter::EndJob()
sal_Bool PspSalPrinter::AbortJob()
{
sal_Bool bAbort = m_aPrintJob.AbortJob() ? sal_True : sal_False;
- vcl_sal::PrinterUpdate::jobEnded();
+ GetSalData()->m_pInstance->jobEndedPrinterUpdate();
return bAbort;
}
@@ -1382,15 +1377,30 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo
}
+namespace x11
+{
+ class PrinterUpdate
+ {
+ static Timer* pPrinterUpdateTimer;
+ static int nActiveJobs;
+
+ static void doUpdate();
+ DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
+ public:
+ static void update(X11SalInstance &rInstance);
+ static void jobStarted() { nActiveJobs++; }
+ static void jobEnded();
+ };
+}
/*
- * vcl::PrinterUpdate
+ * x11::PrinterUpdate
*/
-Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL;
-int vcl_sal::PrinterUpdate::nActiveJobs = 0;
+Timer* x11::PrinterUpdate::pPrinterUpdateTimer = NULL;
+int x11::PrinterUpdate::nActiveJobs = 0;
-void vcl_sal::PrinterUpdate::doUpdate()
+void x11::PrinterUpdate::doUpdate()
{
::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() );
if( rManager.checkPrintersChanged( false ) )
@@ -1405,7 +1415,7 @@ void vcl_sal::PrinterUpdate::doUpdate()
// -----------------------------------------------------------------------
-IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, EMPTYARG )
+IMPL_STATIC_LINK_NOINSTANCE( x11::PrinterUpdate, UpdateTimerHdl, void*, EMPTYARG )
{
if( nActiveJobs < 1 )
{
@@ -1421,12 +1431,12 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, EMPT
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::update()
+void x11::PrinterUpdate::update(X11SalInstance &rInstance)
{
if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() )
return;
- if( ! static_cast< X11SalInstance* >(GetSalData()->m_pInstance)->isPrinterInit() )
+ if( ! rInstance.isPrinterInit() )
{
// #i45389# start background printer detection
psp::PrinterInfoManager::get();
@@ -1439,14 +1449,24 @@ void vcl_sal::PrinterUpdate::update()
{
pPrinterUpdateTimer = new Timer();
pPrinterUpdateTimer->SetTimeout( 500 );
- pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) );
+ pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, x11::PrinterUpdate, UpdateTimerHdl ) );
pPrinterUpdateTimer->Start();
}
}
+void X11SalInstance::updatePrinterUpdate()
+{
+ x11::PrinterUpdate::update(*this);
+}
+
+void X11SalInstance::jobStartedPrinterUpdate()
+{
+ x11::PrinterUpdate::jobStarted();
+}
+
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::jobEnded()
+void x11::PrinterUpdate::jobEnded()
{
nActiveJobs--;
if( nActiveJobs < 1 )
@@ -1460,3 +1480,10 @@ void vcl_sal::PrinterUpdate::jobEnded()
}
}
}
+
+void X11SalInstance::jobEndedPrinterUpdate()
+{
+ x11::PrinterUpdate::jobEnded();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 9f18ba6388ea..0bb34519bd8f 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -69,7 +70,8 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
}
nDX = (long)w;
nDY = (long)h;
- if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable, pData->pRenderFormat ) )
+ if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable,
+ static_cast< XRenderPictFormat* >( pData->pXRenderFormat )) )
{
delete pVDev;
return NULL;
@@ -137,7 +139,7 @@ sal_Bool X11SalVirtualDevice::Init( SalDisplay *pDisplay,
sal_uInt16 nBitCount,
int nScreen,
Pixmap hDrawable,
- void* pRenderFormatVoid )
+ XRenderPictFormat* pXRenderFormat )
{
SalColormap* pColormap = NULL;
bool bDeleteColormap = false;
@@ -145,11 +147,10 @@ sal_Bool X11SalVirtualDevice::Init( SalDisplay *pDisplay,
pDisplay_ = pDisplay;
pGraphics_ = new X11SalGraphics();
m_nScreen = nScreen;
- if( pRenderFormatVoid ) {
- XRenderPictFormat *pRenderFormat = ( XRenderPictFormat* )pRenderFormatVoid;
- pGraphics_->SetXRenderFormat( pRenderFormat );
- if( pRenderFormat->colormap )
- pColormap = new SalColormap( pDisplay, pRenderFormat->colormap, m_nScreen );
+ if( pXRenderFormat ) {
+ pGraphics_->SetXRenderFormat( pXRenderFormat );
+ if( pXRenderFormat->colormap )
+ pColormap = new SalColormap( pDisplay, pXRenderFormat->colormap, m_nScreen );
else
pColormap = new SalColormap( nBitCount );
bDeleteColormap = true;
@@ -272,3 +273,4 @@ void X11SalVirtualDevice::GetSize( long& rWidth, long& rHeight )
rHeight = GetHeight();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/xrender_peer.cxx b/vcl/unx/generic/gdi/xrender_peer.cxx
index 32e656bcbf5f..eda3254958f0 100644
--- a/vcl/unx/generic/gdi/xrender_peer.cxx
+++ b/vcl/unx/generic/gdi/xrender_peer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,6 +38,8 @@
#include <unx/saldata.hxx>
#include <unx/saldisp.hxx>
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
#include <xrender_peer.hxx>
using namespace rtl;
@@ -166,16 +169,10 @@ void XRenderPeer::InitRenderLib()
int,int,unsigned int,unsigned int))pFunc;
pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderCompositeTrapezoids" );
-#if 0 // not having trapezoid support is supported
- if( !pFunc ) return;
-#endif
mpXRenderCompositeTrapezoids = (void(*)(Display*,int,Picture,Picture,
const XRenderPictFormat*,int,int,const XTrapezoid*,int))pFunc;
pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderAddTraps" );
-#if 0 // not having trapezoid support is supported
- if( !pFunc ) return;
-#endif
mpXRenderAddTraps = (void(*)(Display*,Picture,int,int,const _XTrap*,int))pFunc;
#endif // XRENDER_LINK
@@ -245,3 +242,5 @@ sal_uInt32 XRenderPeer::InitRenderText()
}
// ---------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/xrender_peer.hxx b/vcl/unx/generic/gdi/xrender_peer.hxx
index 89dccfcef40b..f9417bb2be95 100644
--- a/vcl/unx/generic/gdi/xrender_peer.hxx
+++ b/vcl/unx/generic/gdi/xrender_peer.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -277,16 +278,6 @@ inline void XRenderPeer::FreeGlyph( GlyphSet aGS, Glyph nGlyphId ) const
// #108209# disabled because of crash potential,
// the glyph leak is not too bad because they will
// be cleaned up when the glyphset is released
-#if 0 // TODO: reenable when it works without problems
- if( mnRenderVersion >= 0x05 )
- {
-#ifdef XRENDER_LINK
- XRenderFreeGlyphs( mpDisplay, aGS, &nGlyphId, 1 );
-#else
- (*mpXRenderFreeGlyphs)( mpDisplay, aGS, &nGlyphId, 1 );
-#endif
- }
-#endif
}
inline void XRenderPeer::CompositeString32( Picture aSrc, Picture aDst,
@@ -385,3 +376,5 @@ inline XRenderColor GetXRenderColor( const SalColor& rSalColor, double fTranspar
//=====================================================================
#endif // _SV_XRENDER_PEER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 00058bf24461..476ea135e570 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,8 +41,8 @@
#include <cstdio>
#include <unistd.h>
-using namespace rtl;
-
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
extern "C" {
typedef SalInstance*(*salFactoryProc)( oslModule pModule);
}
@@ -93,7 +94,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
* So make sure libgtk+ & co are still mapped into memory when
* atk-bridge's atexit handler gets called.
*/
- if( rModuleBase.equalsAscii("gtk") )
+ if( rModuleBase.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("gtk")) )
{
pCloseModule = NULL;
}
@@ -101,7 +102,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
* #i109007# KDE3 seems to have the same problem; an atexit cleanup
* handler, which cannot be resolved anymore if the plugin is already unloaded.
*/
- else if( rModuleBase.equalsAscii("kde") )
+ else if( rModuleBase.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("kde")) )
{
pCloseModule = NULL;
}
@@ -212,8 +213,11 @@ static SalInstance* check_headless_plugin()
for( int i = 0; i < nParams; i++ )
{
osl_getCommandArg( i, &aParam.pData );
- if( aParam.equalsAscii( "-headless" ) )
+ if( aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("-headless")) ||
+ aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("--headless")) )
+ {
return tryInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "svp" ) ) );
+ }
}
return NULL;
}
@@ -232,9 +236,11 @@ SalInstance *CreateSalInstance()
if( ! pInst )
pInst = autodetect_plugin();
- // fallback to gen
- if( ! pInst )
- pInst = tryInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "gen" ) ) );
+ // fallback, try everything
+ const char* pPlugin[] = { "gtk", "kde", "gen", 0 };
+
+ for ( int i = 0; !pInst && pPlugin[ i ]; ++i )
+ pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) );
if( ! pInst )
{
@@ -279,8 +285,8 @@ void SalAbort( const XubString& rErrorText )
if( !rErrorText.Len() )
std::fprintf( stderr, "Application Error" );
else
- std::fprintf( stderr, ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
- abort();
+ std::fprintf( stderr, "%s", ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
+ exit(-1);
}
const OUString& SalGetDesktopEnvironment()
@@ -299,3 +305,5 @@ SalData::~SalData()
{
psp::PrinterInfoManager::release();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 97fe10f4d7ce..a850ec14bb28 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -138,7 +139,13 @@ public:
using namespace psp;
using namespace osl;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OUStringToOString;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringHash;
+using ::rtl::OString;
/*
* CUPSWrapper class
@@ -439,7 +446,6 @@ void CUPSManager::runDests()
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "starting cupsGetDests\n" );
#endif
- int nDests = 0;
cups_dest_t* pDests = NULL;
// #i86306# prepare against really broken CUPS installations / missing servers
@@ -459,7 +465,7 @@ void CUPSManager::runDests()
// prepare against a signal during FcInit or FcConfigGetCurrent
if( sigsetjmp( aViolationBuffer, ~0 ) == 0 )
{
- nDests = m_pCUPSWrapper->cupsGetDests( &pDests );
+ int nDests = m_pCUPSWrapper->cupsGetDests( &pDests );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "came out of cupsGetDests\n" );
#endif
@@ -593,7 +599,7 @@ void CUPSManager::initialize()
// behaviour
aPrinter.m_aInfo.m_pParser = NULL;
aPrinter.m_aInfo.m_aContext.setParser( NULL );
- std::hash_map< OUString, PPDContext, OUStringHash >::const_iterator c_it = m_aDefaultContexts.find( aPrinterName );
+ boost::unordered_map< OUString, PPDContext, OUStringHash >::const_iterator c_it = m_aDefaultContexts.find( aPrinterName );
if( c_it != m_aDefaultContexts.end() )
{
aPrinter.m_aInfo.m_pParser = c_it->second.getParser();
@@ -611,7 +617,7 @@ void CUPSManager::initialize()
// remove everything that is not a CUPS printer and not
// a special purpose printer (PDF, Fax)
std::list< OUString > aRemovePrinters;
- for( std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.begin();
+ for( boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.begin();
it != m_aPrinters.end(); ++it )
{
if( m_aCUPSDestMap.find( it->first ) != m_aCUPSDestMap.end() )
@@ -698,7 +704,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
{
if( m_nDests && m_pDests && ! isCUPSDisabled() )
{
- std::hash_map< OUString, int, OUStringHash >::iterator dest_it =
+ boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
m_aCUPSDestMap.find( aPrinter );
if( dest_it != m_aCUPSDestMap.end() )
{
@@ -794,13 +800,13 @@ void CUPSManager::setupJobContextData(
)
{
#ifdef ENABLE_CUPS
- std::hash_map< OUString, int, OUStringHash >::iterator dest_it =
+ boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
m_aCUPSDestMap.find( rData.m_aPrinterName );
if( dest_it == m_aCUPSDestMap.end() )
return PrinterInfoManager::setupJobContextData( rData );
- std::hash_map< OUString, Printer, OUStringHash >::iterator p_it =
+ boost::unordered_map< OUString, Printer, OUStringHash >::iterator p_it =
m_aPrinters.find( rData.m_aPrinterName );
if( p_it == m_aPrinters.end() ) // huh ?
{
@@ -869,7 +875,6 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner
{
rNumOptions = 0;
*rOptions = NULL;
- int i;
// emit features ordered to OrderDependency
// ignore features that are set to default
@@ -877,6 +882,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner
// sanity check
if( rJob.m_pParser == rJob.m_aContext.getParser() && rJob.m_pParser )
{
+ int i;
int nKeys = rJob.m_aContext.countValuesModified();
::std::vector< const PPDKey* > aKeys( nKeys );
for( i = 0; i < nKeys; i++ )
@@ -919,7 +925,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
osl::MutexGuard aGuard( m_aCUPSMutex );
- std::hash_map< OUString, int, OUStringHash >::iterator dest_it =
+ boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
m_aCUPSDestMap.find( rPrintername );
if( dest_it == m_aCUPSDestMap.end() )
{
@@ -928,7 +934,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
}
#ifdef ENABLE_CUPS
- std::hash_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile );
+ boost::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile );
if( it != m_aSpoolFiles.end() )
{
fclose( pFile );
@@ -1055,7 +1061,7 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName )
{
bool bSuccess = false;
#ifdef ENABLE_CUPS
- std::hash_map< OUString, int, OUStringHash >::iterator nit =
+ boost::unordered_map< OUString, int, OUStringHash >::iterator nit =
m_aCUPSDestMap.find( rName );
if( nit != m_aCUPSDestMap.end() && m_aCUPSMutex.tryToAcquire() )
{
@@ -1081,10 +1087,10 @@ bool CUPSManager::writePrinterConfig()
bool bDestModified = false;
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
- for( std::hash_map< OUString, Printer, OUStringHash >::iterator prt =
+ for( boost::unordered_map< OUString, Printer, OUStringHash >::iterator prt =
m_aPrinters.begin(); prt != m_aPrinters.end(); ++prt )
{
- std::hash_map< OUString, int, OUStringHash >::iterator nit =
+ boost::unordered_map< OUString, int, OUStringHash >::iterator nit =
m_aCUPSDestMap.find( prt->first );
if( nit == m_aCUPSDestMap.end() )
continue;
@@ -1140,7 +1146,7 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
const char* pRet = NULL;
#ifdef ENABLE_CUPS
- OUString aLib = OUString::createFromAscii( _XSALSET_LIBNAME );
+ OUString aLib(RTL_CONSTASCII_USTRINGPARAM( _XSALSET_LIBNAME ));
oslModule pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
if( pLib )
{
@@ -1171,3 +1177,5 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
return pRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 811f93bcb826..0982b219bade 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,7 +37,6 @@
#include "sal/alloca.h"
using namespace psp;
-using namespace rtl;
JobData& JobData::operator=(const JobData& rRight)
{
@@ -263,3 +263,5 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 9a85d02db894..30d4598568d2 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include "vcl/ppdparser.hxx"
#include "vcl/strhelper.hxx"
@@ -48,6 +49,8 @@
#include "osl/thread.h"
#include "rtl/strbuf.hxx"
#include "rtl/ustrbuf.hxx"
+#include "rtl/instance.hxx"
+#include <sal/macros.h>
#include "com/sun/star/lang/Locale.hpp"
@@ -77,8 +80,8 @@ namespace psp
}
};
- typedef std::hash_map< com::sun::star::lang::Locale, rtl::OUString, LocaleHash, LocaleEqual > translation_map;
- typedef std::hash_map< rtl::OUString, translation_map, rtl::OUStringHash > key_translation_map;
+ typedef boost::unordered_map< com::sun::star::lang::Locale, rtl::OUString, LocaleHash, LocaleEqual > translation_map;
+ typedef boost::unordered_map< rtl::OUString, translation_map, rtl::OUStringHash > key_translation_map;
key_translation_map m_aTranslations;
public:
@@ -243,10 +246,34 @@ namespace psp
}
return aResult;
}
+
+ class PPDCache
+ {
+ public:
+ std::list< PPDParser* > aAllParsers;
+ boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >* pAllPPDFiles;
+ PPDCache()
+ : pAllPPDFiles(NULL)
+ {}
+ ~PPDCache()
+ {
+ while( aAllParsers.begin() != aAllParsers.end() )
+ {
+ delete aAllParsers.front();
+ aAllParsers.pop_front();
+ }
+ delete pAllPPDFiles;
+ pAllPPDFiles = NULL;
+ }
+ };
}
using namespace psp;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringHash;
+
#undef DBG_ASSERT
#if defined DBG_UTIL || (OSL_DEBUG_LEVEL > 1)
@@ -256,8 +283,10 @@ using namespace rtl;
#define DBG_ASSERT( x, y )
#endif
-std::list< PPDParser* > PPDParser::aAllParsers;
-std::hash_map< OUString, OUString, OUStringHash >* PPDParser::pAllPPDFiles = NULL;
+namespace
+{
+ struct thePPDCache : public rtl::Static<PPDCache, thePPDCache> {};
+}
class PPDDecompressStream
{
@@ -402,7 +431,9 @@ void PPDParser::scanPPDDir( const String& rDir )
} const pSuffixes[] =
{ { ".PS", 3 }, { ".PPD", 4 }, { ".PS.GZ", 6 }, { ".PPD.GZ", 7 } };
- const int nSuffixes = sizeof(pSuffixes)/sizeof(pSuffixes[0]);
+ const int nSuffixes = SAL_N_ELEMENTS(pSuffixes);
+
+ PPDCache &rPPDCache = thePPDCache::get();
osl::Directory aDir( rDir );
if ( aDir.open() == osl::FileBase::E_None )
@@ -437,7 +468,7 @@ void PPDParser::scanPPDDir( const String& rDir )
{
if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) )
{
- (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
+ (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
break;
}
}
@@ -456,10 +487,11 @@ void PPDParser::scanPPDDir( const String& rDir )
void PPDParser::initPPDFiles()
{
- if( pAllPPDFiles )
+ PPDCache &rPPDCache = thePPDCache::get();
+ if( rPPDCache.pAllPPDFiles )
return;
- pAllPPDFiles = new std::hash_map< OUString, OUString, OUStringHash >();
+ rPPDCache.pAllPPDFiles = new boost::unordered_map< OUString, OUString, OUStringHash >();
// check installation directories
std::list< OUString > aPathList;
@@ -469,7 +501,7 @@ void PPDParser::initPPDFiles()
INetURLObject aPPDDir( *ppd_it, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
scanPPDDir( aPPDDir.GetMainURL( INetURLObject::NO_DECODE ) );
}
- if( pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == pAllPPDFiles->end() )
+ if( rPPDCache.pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == rPPDCache.pAllPPDFiles->end() )
{
// last try: search in directory of executable (mainly for setup)
OUString aExe;
@@ -482,7 +514,7 @@ void PPDParser::initPPDFiles()
#endif
scanPPDDir( aDir.GetMainURL( INetURLObject::NO_DECODE ) );
#ifdef DEBUG
- fprintf( stderr, "SGENPRT %s\n", pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == pAllPPDFiles->end() ? "not found" : "found" );
+ fprintf( stderr, "SGENPRT %s\n", rPPDCache.pAllPPDFiles->find( OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ) == rPPDCache.pAllPPDFiles->end() ? "not found" : "found" );
#endif
}
}
@@ -490,17 +522,19 @@ void PPDParser::initPPDFiles()
void PPDParser::getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers, bool bRefresh )
{
+ PPDCache &rPPDCache = thePPDCache::get();
+
if( bRefresh )
{
- delete pAllPPDFiles;
- pAllPPDFiles = NULL;
+ delete rPPDCache.pAllPPDFiles;
+ rPPDCache.pAllPPDFiles = NULL;
}
initPPDFiles();
o_rDrivers.clear();
- std::hash_map< OUString, OUString, OUStringHash >::const_iterator it;
- for( it = pAllPPDFiles->begin(); it != pAllPPDFiles->end(); ++it )
+ boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator it;
+ for( it = rPPDCache.pAllPPDFiles->begin(); it != rPPDCache.pAllPPDFiles->end(); ++it )
o_rDrivers.push_back( it->first );
}
@@ -511,7 +545,8 @@ String PPDParser::getPPDFile( const String& rFile )
PPDDecompressStream aStream( aPPD.PathToFileName() );
if( ! aStream.IsOpen() )
{
- std::hash_map< OUString, OUString, OUStringHash >::const_iterator it;
+ boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator it;
+ PPDCache &rPPDCache = thePPDCache::get();
bool bRetry = true;
do
@@ -525,23 +560,23 @@ String PPDParser::getPPDFile( const String& rFile )
aBase = aBase.copy( nLastIndex+1 );
do
{
- it = pAllPPDFiles->find( aBase );
+ it = rPPDCache.pAllPPDFiles->find( aBase );
nLastIndex = aBase.lastIndexOf( sal_Unicode( '.' ) );
if( nLastIndex > 0 )
aBase = aBase.copy( 0, nLastIndex );
- } while( it == pAllPPDFiles->end() && nLastIndex > 0 );
+ } while( it == rPPDCache.pAllPPDFiles->end() && nLastIndex > 0 );
- if( it == pAllPPDFiles->end() && bRetry )
+ if( it == rPPDCache.pAllPPDFiles->end() && bRetry )
{
// a new file ? rehash
- delete pAllPPDFiles; pAllPPDFiles = NULL;
+ delete rPPDCache.pAllPPDFiles; rPPDCache.pAllPPDFiles = NULL;
bRetry = false;
// note this is optimized for office start where
// no new files occur and initPPDFiles is called only once
}
- } while( ! pAllPPDFiles );
+ } while( ! rPPDCache.pAllPPDFiles );
- if( it != pAllPPDFiles->end() )
+ if( it != rPPDCache.pAllPPDFiles->end() )
aStream.Open( it->second );
}
@@ -625,7 +660,8 @@ const PPDParser* PPDParser::getParser( const String& rFile )
return NULL;
}
- for( ::std::list< PPDParser* >::const_iterator it = aAllParsers.begin(); it != aAllParsers.end(); ++it )
+ PPDCache &rPPDCache = thePPDCache::get();
+ for( ::std::list< PPDParser* >::const_iterator it = rPPDCache.aAllParsers.begin(); it != rPPDCache.aAllParsers.end(); ++it )
if( (*it)->m_aFile == aFile )
return *it;
@@ -644,24 +680,13 @@ const PPDParser* PPDParser::getParser( const String& rFile )
{
// this may actually be the SGENPRT parser,
// so ensure uniquness here
- aAllParsers.remove( pNewParser );
+ rPPDCache.aAllParsers.remove( pNewParser );
// insert new parser to list
- aAllParsers.push_front( pNewParser );
+ rPPDCache.aAllParsers.push_front( pNewParser );
}
return pNewParser;
}
-void PPDParser::freeAll()
-{
- while( aAllParsers.begin() != aAllParsers.end() )
- {
- delete aAllParsers.front();
- aAllParsers.pop_front();
- }
- delete pAllPPDFiles;
- pAllPPDFiles = NULL;
-}
-
PPDParser::PPDParser( const String& rFile ) :
m_aFile( rFile ),
m_bType42Capable( false ),
@@ -750,9 +775,8 @@ PPDParser::PPDParser( const String& rFile ) :
case PPDKey::AnySetup: pSetupType = "AnySetup";break;
default: break;
};
- fprintf( stderr, "\t\"%s\" (\"%s\") (%d values) OrderDependency: %d %s\n",
+ fprintf( stderr, "\t\"%s\" (%d values) OrderDependency: %d %s\n",
BSTRING( pKey->getKey() ).GetBuffer(),
- BSTRING( pKey->m_aUITranslation ).GetBuffer(),
pKey->countValues(),
pKey->m_nOrderDependency,
pSetupType );
@@ -772,12 +796,10 @@ PPDParser::PPDParser( const String& rFile ) :
case eNo: pVType = "no";break;
default: break;
};
- fprintf( stderr, "option: \"%s\" (\"%s\"), value: type %s \"%s\" (\"%s\")\n",
+ fprintf( stderr, "option: \"%s\", value: type %s \"%s\"\n",
BSTRING( pValue->m_aOption ).GetBuffer(),
- BSTRING( pValue->m_aOptionTranslation ).GetBuffer(),
pVType,
- BSTRING( pValue->m_aValue ).GetBuffer(),
- BSTRING( pValue->m_aValueTranslation ).GetBuffer() );
+ BSTRING( pValue->m_aValue ).GetBuffer() );
}
}
fprintf( stderr, "constraints: (%d found)\n", m_aConstraints.size() );
@@ -1270,7 +1292,7 @@ void PPDParser::parseConstraint( const ByteString& rLine )
}
else
// constraint for nonexistent keys; this happens
- // e.g. in HP4PLUS3 (#75636#)
+ // e.g. in HP4PLUS3
bFailed = true;
}
}
@@ -1318,13 +1340,9 @@ bool PPDParser::getMargins(
ImLLy = StringToDouble( GetCommandLineToken( 1, aArea ) );
ImURx = StringToDouble( GetCommandLineToken( 2, aArea ) );
ImURy = StringToDouble( GetCommandLineToken( 3, aArea ) );
-// sscanf( m_pImageableAreas->getValue( nImArea )->m_aValue.GetStr(),
-// "%lg%lg%lg%lg", &ImLLx, &ImLLy, &ImURx, &ImURy );
aArea = m_pPaperDimensions->getValue( nPDim )->m_aValue;
PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) );
PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) );
-// sscanf( m_pPaperDimensions->getValue( nPDim )->m_aValue.GetStr(),
-// "%lg%lg", &PDWidth, &PDHeight );
rLeft = (int)(ImLLx + 0.5);
rLower = (int)(ImLLy + 0.5);
rUpper = (int)(PDHeight - ImURy + 0.5);
@@ -1493,13 +1511,14 @@ void PPDParser::getResolutionFromString(
const String& rString,
int& rXRes, int& rYRes ) const
{
- int nPos = 0, nDPIPos;
+ int nDPIPos;
rXRes = rYRes = 300;
nDPIPos = rString.SearchAscii( "dpi" );
if( nDPIPos != STRING_NOTFOUND )
{
+ int nPos = 0;
if( ( nPos = rString.Search( 'x' ) ) != STRING_NOTFOUND )
{
rXRes = rString.Copy( 0, nPos ).ToInt32();
@@ -2164,3 +2183,5 @@ void PPDContext::getPageSize( String& rPaper, int& rWidth, int& rHeight ) const
}
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 7108d7fb2a5c..4a7374c41b7b 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,22 +47,29 @@
#include "i18npool/paper.hxx"
#include "rtl/strbuf.hxx"
+#include <sal/macros.h>
#include "osl/thread.hxx"
#include "osl/mutex.hxx"
#include "osl/process.h"
+#include <boost/scoped_ptr.hpp>
+
// filename of configuration files
#define PRINT_FILENAME "psprint.conf"
// the group of the global defaults
#define GLOBAL_DEFAULTS_GROUP "__Global_Printer_Defaults__"
-#include <hash_set>
+#include <boost/unordered_set.hpp>
using namespace psp;
-using namespace rtl;
using namespace osl;
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OStringToOUString;
+using ::rtl::OUStringHash;
+
namespace psp
{
class SystemQueueInfo : public Thread
@@ -103,9 +111,9 @@ PrinterInfoManager& PrinterInfoManager::get()
pSalData->m_pPIManager = new PrinterInfoManager();
pSalData->m_pPIManager->initialize();
- #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pSalData->m_pPIManager->getType() );
- #endif
+#endif
}
return *pSalData->m_pPIManager;
@@ -339,7 +347,7 @@ void PrinterInfoManager::initialize()
}
}
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "global settings: fontsubst = %s, %d substitutes\n", m_aGlobalDefaults.m_bPerformFontSubstitution ? "true" : "false", (int)m_aGlobalDefaults.m_aFontSubstitutes.size() );
+ fprintf( stderr, "global settings: fontsubst = %s, %" SAL_PRI_SIZET "u substitutes\n", m_aGlobalDefaults.m_bPerformFontSubstitution ? "true" : "false", m_aGlobalDefaults.m_aFontSubstitutes.size() );
#endif
}
}
@@ -551,7 +559,7 @@ void PrinterInfoManager::initialize()
FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), aPrinter.m_aFile );
aPrinter.m_bModified = false;
aPrinter.m_aGroup = aConfig.GetGroupName( nGroup );
- std::hash_map< OUString, Printer, OUStringHash >::const_iterator find_it =
+ boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator find_it =
m_aPrinters.find( aPrinterName );
if( find_it != m_aPrinters.end() )
{
@@ -630,7 +638,7 @@ void PrinterInfoManager::initialize()
void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const
{
- ::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it;
+ ::boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator it;
rList.clear();
for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
rList.push_back( it->first );
@@ -641,7 +649,7 @@ void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const
const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter ) const
{
static PrinterInfo aEmptyInfo;
- ::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter );
+ ::boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter );
DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistent printers" );
@@ -652,7 +660,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter
void PrinterInfoManager::changePrinterInfo( const OUString& rPrinter, const PrinterInfo& rNewInfo )
{
- ::std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinter );
+ ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinter );
DBG_ASSERT( it != m_aPrinters.end(), "Do not change nonexistant printers" );
@@ -683,9 +691,9 @@ static bool checkWriteability( const OUString& rUniPath )
bool PrinterInfoManager::writePrinterConfig()
{
// find at least one writeable config
- ::std::hash_map< OUString, Config*, OUStringHash > files;
- ::std::hash_map< OUString, int, OUStringHash > rofiles;
- ::std::hash_map< OUString, Config*, OUStringHash >::iterator file_it;
+ ::boost::unordered_map< OUString, Config*, OUStringHash > files;
+ ::boost::unordered_map< OUString, int, OUStringHash > rofiles;
+ ::boost::unordered_map< OUString, Config*, OUStringHash >::iterator file_it;
for( ::std::list< WatchFile >::const_iterator wit = m_aWatchFiles.begin(); wit != m_aWatchFiles.end(); ++wit )
{
@@ -703,7 +711,7 @@ bool PrinterInfoManager::writePrinterConfig()
pGlobal->SetGroup( GLOBAL_DEFAULTS_GROUP );
pGlobal->WriteKey( "DisableCUPS", m_bDisableCUPS ? "true" : "false" );
- ::std::hash_map< OUString, Printer, OUStringHash >::iterator it;
+ ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it;
for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
{
if( ! it->second.m_bModified )
@@ -806,7 +814,7 @@ bool PrinterInfoManager::writePrinterConfig()
// write font substitution table
pConfig->WriteKey( "PerformFontSubstitution", it->second.m_aInfo.m_bPerformFontSubstitution ? "true" : "false" );
- for( ::std::hash_map< OUString, OUString, OUStringHash >::const_iterator subst = it->second.m_aInfo.m_aFontSubstitutes.begin();
+ for( ::boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator subst = it->second.m_aInfo.m_aFontSubstitutes.begin();
subst != it->second.m_aInfo.m_aFontSubstitutes.end(); ++subst )
{
ByteString aKey( "SubstFont_" );
@@ -886,7 +894,7 @@ bool PrinterInfoManager::removePrinter( const OUString& rPrinterName, bool bChec
{
bool bSuccess = true;
- ::std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName );
+ ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName );
if( it != m_aPrinters.end() )
{
if( it->second.m_aFile.getLength() )
@@ -940,7 +948,7 @@ bool PrinterInfoManager::setDefaultPrinter( const OUString& rPrinterName )
{
bool bSuccess = false;
- ::std::hash_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName );
+ ::boost::unordered_map< OUString, Printer, OUStringHash >::iterator it = m_aPrinters.find( rPrinterName );
if( it != m_aPrinters.end() )
{
bSuccess = true;
@@ -971,7 +979,7 @@ void PrinterInfoManager::fillFontSubstitutions( PrinterInfo& rInfo ) const
return;
::std::list< FastPrintFontInfo > aFonts;
- ::std::hash_map< OUString, ::std::list< FastPrintFontInfo >, OUStringHash > aPrinterFonts;
+ ::boost::unordered_map< OUString, ::std::list< FastPrintFontInfo >, OUStringHash > aPrinterFonts;
rFontManager.getFontListWithFastInfo( aFonts, rInfo.m_pParser );
// get builtin fonts
@@ -981,8 +989,8 @@ void PrinterInfoManager::fillFontSubstitutions( PrinterInfo& rInfo ) const
aPrinterFonts[ it->m_aFamilyName.toAsciiLowerCase() ].push_back( *it );
// map lower case, so build a local copy of the font substitutions
- ::std::hash_map< OUString, OUString, OUStringHash > aSubstitutions;
- ::std::hash_map< OUString, OUString, OUStringHash >::const_iterator subst;
+ ::boost::unordered_map< OUString, OUString, OUStringHash > aSubstitutions;
+ ::boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator subst;
for( subst = rInfo.m_aFontSubstitutes.begin(); subst != rInfo.m_aFontSubstitutes.end(); ++subst )
{
OUString aFamily( subst->first.toAsciiLowerCase() );
@@ -1123,7 +1131,7 @@ int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUStri
void PrinterInfoManager::setupJobContextData( JobData& rData )
{
- std::hash_map< OUString, Printer, OUStringHash >::iterator it =
+ boost::unordered_map< OUString, Printer, OUStringHash >::iterator it =
m_aPrinters.find( rData.m_aPrinterName );
if( it != m_aPrinters.end() )
{
@@ -1230,15 +1238,15 @@ struct SystemCommandParameters
tokenHandler pHandler;
};
-#if ! (defined(LINUX) || defined(NETBSD) || defined(FREEBSD))
+#if ! (defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD))
static void lpgetSysQueueTokenHandler(
const std::list< rtl::OString >& i_rLines,
std::list< PrinterInfoManager::SystemPrintQueue >& o_rQueues,
const SystemCommandParameters* )
{
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
- std::hash_set< OUString, OUStringHash > aUniqueSet;
- std::hash_set< OUString, OUStringHash > aOnlySet;
+ boost::unordered_set< OUString, OUStringHash > aUniqueSet;
+ boost::unordered_set< OUString, OUStringHash > aOnlySet;
aUniqueSet.insert( OUString( RTL_CONSTASCII_USTRINGPARAM( "_all" ) ) );
aUniqueSet.insert( OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) );
@@ -1334,7 +1342,7 @@ static void standardSysQueueTokenHandler(
const SystemCommandParameters* i_pParms)
{
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
- std::hash_set< OUString, OUStringHash > aUniqueSet;
+ boost::unordered_set< OUString, OUStringHash > aUniqueSet;
rtl::OString aForeToken( i_pParms->pForeToken );
rtl::OString aAftToken( i_pParms->pAftToken );
/* Normal Unix print queue discovery, also used for Darwin 5 LPR printing
@@ -1375,7 +1383,7 @@ static void standardSysQueueTokenHandler(
static const struct SystemCommandParameters aParms[] =
{
- #if defined(LINUX) || defined(NETBSD) || defined(FREEBSD)
+ #if defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD)
{ "/usr/sbin/lpc status", "lpr -P \"(PRINTER)\"", "", ":", 0, standardSysQueueTokenHandler },
{ "lpc status", "lpr -P \"(PRINTER)\"", "", ":", 0, standardSysQueueTokenHandler },
{ "LANG=C;LC_ALL=C;export LANG LC_ALL;lpstat -s", "lp -d \"(PRINTER)\"", "system for ", ": ", 1, standardSysQueueTokenHandler }
@@ -1394,7 +1402,7 @@ void SystemQueueInfo::run()
std::list< rtl::OString > aLines;
/* Discover which command we can use to get a list of all printer queues */
- for( unsigned int i = 0; i < sizeof(aParms)/sizeof(aParms[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(aParms); i++ )
{
aLines.clear();
rtl::OStringBuffer aCmdLine( 128 );
@@ -1427,3 +1435,4 @@ void SystemQueueInfo::run()
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/bitmap_gfx.cxx b/vcl/unx/generic/printergfx/bitmap_gfx.cxx
index 9275db1e469f..0c139678f8ab 100644
--- a/vcl/unx/generic/printergfx/bitmap_gfx.cxx
+++ b/vcl/unx/generic/printergfx/bitmap_gfx.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -730,3 +731,5 @@ PrinterGfx::DrawPS2TrueColorImage (const PrinterBmp& rBitmap, const Rectangle& r
}
} /* namespace psp */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx
index 6ebf79cfac73..7cae4586bf6e 100644
--- a/vcl/unx/generic/printergfx/common_gfx.cxx
+++ b/vcl/unx/generic/printergfx/common_gfx.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -71,9 +72,9 @@ PrinterGfx::Init (PrinterJob &rPrinterJob)
rPrinterJob.GetScale (mfScaleX, mfScaleY);
const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rPrinterJob.GetPrinterName() ) );
if( mpFontSubstitutes )
- delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes);
+ delete const_cast< ::boost::unordered_map<fontID,fontID>* >(mpFontSubstitutes);
if( rInfo.m_bPerformFontSubstitution )
- mpFontSubstitutes = new ::std::hash_map< fontID, fontID >( rInfo.m_aFontSubstitutions );
+ mpFontSubstitutes = new ::boost::unordered_map< fontID, fontID >( rInfo.m_aFontSubstitutions );
else
mpFontSubstitutes = NULL;
mbUploadPS42Fonts = rInfo.m_pParser ? ( rInfo.m_pParser->isType42Capable() ? sal_True : sal_False ) : sal_False;
@@ -95,9 +96,9 @@ PrinterGfx::Init (const JobData& rData)
mfScaleY = (double)72.0 / (double)mnDpi;
const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rData.m_aPrinterName ) );
if( mpFontSubstitutes )
- delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes);
+ delete const_cast< ::boost::unordered_map<fontID,fontID>* >(mpFontSubstitutes);
if( rInfo.m_bPerformFontSubstitution )
- mpFontSubstitutes = new ::std::hash_map< fontID, fontID >( rInfo.m_aFontSubstitutions );
+ mpFontSubstitutes = new ::boost::unordered_map< fontID, fontID >( rInfo.m_aFontSubstitutions );
else
mpFontSubstitutes = NULL;
mbUploadPS42Fonts = rInfo.m_pParser ? ( rInfo.m_pParser->isType42Capable() ? sal_True : sal_False ) : sal_False;
@@ -143,7 +144,7 @@ PrinterGfx::PrinterGfx() :
PrinterGfx::~PrinterGfx()
{
/*
- * #95810# the original reasoning why mpFontSubstitutes is a pointer was
+ * the original reasoning why mpFontSubstitutes is a pointer was
* that applications should release all PrinterGfx when printers change
* because they are really invalid; the corresponding printers may have
* changed their settings or even not exist anymore.
@@ -151,7 +152,7 @@ PrinterGfx::~PrinterGfx()
* Alas, this is not always done real time. So we keep a local copy of
* the font substitutes now in case of bad timing.
*/
- delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes);
+ delete const_cast< ::boost::unordered_map<fontID,fontID>* >(mpFontSubstitutes);
}
void
@@ -565,7 +566,7 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const sa
}
else
{
- DBG_ERROR( "PrinterGfx::DrawPolyLineBezier: Strange output" );
+ OSL_FAIL( "PrinterGfx::DrawPolyLineBezier: Strange output" );
}
i+=3;
}
@@ -611,7 +612,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const sal
}
else
{
- DBG_ERROR( "PrinterGfx::DrawPolygonBezier: Strange output" );
+ OSL_FAIL( "PrinterGfx::DrawPolygonBezier: Strange output" );
}
i+=3;
}
@@ -645,7 +646,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints,
for (unsigned int i=0; i<nPoly;i++)
{
sal_uInt32 nPoints = pPoints[i];
- // #112689# sanity check
+ // sanity check
if( nPoints == 0 || pPtAry[i] == NULL )
continue;
@@ -675,7 +676,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints,
}
else
{
- DBG_ERROR( "PrinterGfx::DrawPolyPolygonBezier: Strange output" );
+ OSL_FAIL( "PrinterGfx::DrawPolyPolygonBezier: Strange output" );
}
j+=3;
}
@@ -998,7 +999,7 @@ PrinterGfx::PSBinPath (const Point& rCurrent, Point& rOld,
case 4: cCmd |= 0x01; break;
case 6: cCmd |= 0x02; break;
case 8: cCmd |= 0x03; break;
- default: DBG_ERROR ("invalid x precision in binary path");
+ default: OSL_FAIL("invalid x precision in binary path");
}
switch (nXPrec)
{
@@ -1006,7 +1007,7 @@ PrinterGfx::PSBinPath (const Point& rCurrent, Point& rOld,
case 4: cCmd |= 0x04; break;
case 6: cCmd |= 0x08; break;
case 8: cCmd |= 0x0c; break;
- default: DBG_ERROR ("invalid y precision in binary path");
+ default: OSL_FAIL("invalid y precision in binary path");
}
cCmd += 'A';
pPath[0] = cCmd;
@@ -1282,3 +1283,5 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize
}
return bSuccess;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/glyphset.cxx b/vcl/unx/generic/printergfx/glyphset.cxx
index 9b0f5fb99c43..967c9f2a175f 100644
--- a/vcl/unx/generic/printergfx/glyphset.cxx
+++ b/vcl/unx/generic/printergfx/glyphset.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,7 +51,11 @@
using namespace vcl;
using namespace psp;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringToOString;
GlyphSet::GlyphSet ()
: mnFontID (-1),
@@ -712,7 +717,7 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx)
// loop thru all the font subsets
sal_Int32 nGlyphSetID = 0;
char_list_t::iterator aGlyphSet;
- for (aGlyphSet = maCharList.begin(); aGlyphSet != maCharList.end(); aGlyphSet++)
+ for (aGlyphSet = maCharList.begin(); aGlyphSet != maCharList.end(); ++aGlyphSet)
{
++nGlyphSetID;
@@ -872,7 +877,7 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
// loop thru all the chars in the subset
char_map_t::const_iterator aChar;
sal_Int32 n = 0;
- for (aChar = (*aCharSet).begin(); aChar != (*aCharSet).end(); aChar++)
+ for (aChar = (*aCharSet).begin(); aChar != (*aCharSet).end(); ++aChar)
{
pUChars [n] = (*aChar).first;
pEncoding [n] = (*aChar).second;
@@ -904,7 +909,7 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
// loop thru all the glyphs in the subset
glyph_map_t::const_iterator aGlyph;
sal_Int32 n = 0;
- for (aGlyph = (*aGlyphSet).begin(); aGlyph != (*aGlyphSet).end(); aGlyph++)
+ for (aGlyph = (*aGlyphSet).begin(); aGlyph != (*aGlyphSet).end(); ++aGlyph)
{
pTTGlyphMapping [n] = (*aGlyph).first;
pEncoding [n] = (*aGlyph).second;
@@ -940,3 +945,5 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
return sal_True;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/glyphset.hxx b/vcl/unx/generic/printergfx/glyphset.hxx
index 320e8e071955..c8b009c91155 100644
--- a/vcl/unx/generic/printergfx/glyphset.hxx
+++ b/vcl/unx/generic/printergfx/glyphset.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,7 +38,7 @@
#include "tools/gen.hxx"
#include <list>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
namespace psp {
@@ -55,9 +56,9 @@ private:
rtl_TextEncoding mnBaseEncoding;
bool mbUseFontEncoding;
- typedef std::hash_map< sal_Unicode, sal_uInt8 > char_map_t;
+ typedef boost::unordered_map< sal_Unicode, sal_uInt8 > char_map_t;
typedef std::list< char_map_t > char_list_t;
- typedef std::hash_map< sal_uInt32, sal_uInt8 > glyph_map_t;
+ typedef boost::unordered_map< sal_uInt32, sal_uInt8 > glyph_map_t;
typedef std::list< glyph_map_t > glyph_list_t;
char_list_t maCharList;
@@ -133,3 +134,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/printerjob.cxx b/vcl/unx/generic/printergfx/printerjob.cxx
index 351d1af9b41d..827b5c7cf269 100644
--- a/vcl/unx/generic/printergfx/printerjob.cxx
+++ b/vcl/unx/generic/printergfx/printerjob.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,12 +51,17 @@
#include "osl/thread.h"
#include "sal/alloca.h"
+#include <sal/macros.h>
#include <algorithm>
#include <vector>
using namespace psp;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
// forward declaration
@@ -108,10 +114,10 @@ PrinterJob::CreateSpoolFile (const rtl::OUString& rName, const rtl::OUString& rE
nError = osl::File::getFileURLFromSystemPath( aFile, aFileURL );
if (nError != osl::File::E_None)
return NULL;
- aFileURL = maSpoolDirName + rtl::OUString::createFromAscii ("/") + aFileURL;
+ aFileURL = maSpoolDirName + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("/")) + aFileURL;
pFile = new osl::File (aFileURL);
- nError = pFile->open (OpenFlag_Read | OpenFlag_Write | OpenFlag_Create);
+ nError = pFile->open (osl_File_OpenFlag_Read | osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
if (nError != osl::File::E_None)
{
delete pFile;
@@ -273,7 +279,7 @@ removeSpoolDir (const rtl::OUString& rSpoolDir)
{
// Conversion did not work, as this is quite a dangerous action,
// we should abort here ....
- OSL_ENSURE( 0, "psprint: couldn't remove spool directory" );
+ OSL_FAIL( "psprint: couldn't remove spool directory" );
return;
}
rtl::OString aSysPathByte =
@@ -285,7 +291,7 @@ removeSpoolDir (const rtl::OUString& rSpoolDir)
nChar += psp::appendStr (aSysPathByte.getStr(), pSystem + nChar);
if (system (pSystem) == -1)
- OSL_ENSURE( 0, "psprint: couldn't remove spool directory" );
+ OSL_FAIL( "psprint: couldn't remove spool directory" );
}
/* creates a spool directory with a "pidgin random" value based on
@@ -325,12 +331,12 @@ createSpoolDir ()
PrinterJob::~PrinterJob ()
{
std::list< osl::File* >::iterator pPage;
- for (pPage = maPageList.begin(); pPage != maPageList.end(); pPage++)
+ for (pPage = maPageList.begin(); pPage != maPageList.end(); ++pPage)
{
//(*pPage)->remove();
delete *pPage;
}
- for (pPage = maHeaderList.begin(); pPage != maHeaderList.end(); pPage++)
+ for (pPage = maHeaderList.begin(); pPage != maHeaderList.end(); ++pPage)
{
//(*pPage)->remove();
delete *pPage;
@@ -396,9 +402,9 @@ PrinterJob::StartJob (
maSpoolDirName = createSpoolDir ();
maJobTitle = rJobName;
- rtl::OUString aExt = rtl::OUString::createFromAscii (".ps");
- mpJobHeader = CreateSpoolFile (rtl::OUString::createFromAscii("psp_head"), aExt);
- mpJobTrailer = CreateSpoolFile (rtl::OUString::createFromAscii("psp_tail"), aExt);
+ rtl::OUString aExt(RTL_CONSTASCII_USTRINGPARAM (".ps"));
+ mpJobHeader = CreateSpoolFile (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_head")), aExt);
+ mpJobTrailer = CreateSpoolFile (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_tail")), aExt);
if( ! (mpJobHeader && mpJobTrailer) ) // existing files are removed in destructor
return sal_False;
@@ -428,7 +434,7 @@ PrinterJob::StartJob (
sal_Char pCreationDate [256];
WritePS (mpJobHeader, "%%CreationDate: (");
getLocalTime(pCreationDate);
- for( unsigned int i = 0; i < sizeof(pCreationDate)/sizeof(pCreationDate[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCreationDate); i++ )
{
if( pCreationDate[i] == '\n' )
{
@@ -578,11 +584,11 @@ PrinterJob::EndJob ()
std::list< osl::File* >::iterator pPageHead;
for (pPageBody = maPageList.begin(), pPageHead = maHeaderList.begin();
pPageBody != maPageList.end() && pPageHead != maHeaderList.end();
- pPageBody++, pPageHead++)
+ ++pPageBody, ++pPageHead)
{
if( *pPageHead )
{
- osl::File::RC nError = (*pPageHead)->open(OpenFlag_Read);
+ osl::File::RC nError = (*pPageHead)->open(osl_File_OpenFlag_Read);
if (nError == osl::File::E_None)
{
AppendPS (pDestFILE, *pPageHead, pBuffer);
@@ -593,7 +599,7 @@ PrinterJob::EndJob ()
bSuccess = sal_False;
if( *pPageBody )
{
- osl::File::RC nError = (*pPageBody)->open(OpenFlag_Read);
+ osl::File::RC nError = (*pPageBody)->open(osl_File_OpenFlag_Read);
if (nError == osl::File::E_None)
{
AppendPS (pDestFILE, *pPageBody, pBuffer);
@@ -671,12 +677,12 @@ PrinterJob::StartPage (const JobData& rJobSetup)
InitPaperSize (rJobSetup);
rtl::OUString aPageNo = rtl::OUString::valueOf ((sal_Int32)maPageList.size()+1); // sequential page number must start with 1
- rtl::OUString aExt = aPageNo + rtl::OUString::createFromAscii (".ps");
+ rtl::OUString aExt = aPageNo + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM (".ps"));
osl::File* pPageHeader = CreateSpoolFile (
- rtl::OUString::createFromAscii("psp_pghead"), aExt);
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_pghead")), aExt);
osl::File* pPageBody = CreateSpoolFile (
- rtl::OUString::createFromAscii("psp_pgbody"), aExt);
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("psp_pgbody")), aExt);
maHeaderList.push_back (pPageHeader);
maPageList.push_back (pPageBody);
@@ -809,7 +815,6 @@ static bool writeFeature( osl::File* pFile, const PPDKey* pKey, const PPDValue*
bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool bDocumentSetup )
{
bool bSuccess = true;
- int i;
// emit features ordered to OrderDependency
// ignore features that are set to default
@@ -820,6 +825,7 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b
( m_aLastJobData.m_pParser == rJob.m_pParser || m_aLastJobData.m_pParser == NULL )
)
{
+ int i;
int nKeys = rJob.m_aContext.countValuesModified();
::std::vector< const PPDKey* > aKeys( nKeys );
for( i = 0; i < nKeys; i++ )
@@ -1202,3 +1208,5 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob )
return bSuccess && bFeatureSuccess;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/psputil.cxx b/vcl/unx/generic/printergfx/psputil.cxx
index 370114be47cb..9a5de44960e6 100644
--- a/vcl/unx/generic/printergfx/psputil.cxx
+++ b/vcl/unx/generic/printergfx/psputil.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -94,7 +95,7 @@ getAlignedHexValueOf (sal_Int32 nValue, sal_Char* pBuffer)
case '5' : pBuffer[0] = 'D'; break;
case '6' : pBuffer[0] = 'E'; break;
case '7' : pBuffer[0] = 'F'; break;
- default: DBG_ERROR("Already a signed value");
+ default: OSL_FAIL("Already a signed value");
}
}
@@ -266,3 +267,5 @@ GetConverterFactory ()
} /* namespace psp */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/psputil.hxx b/vcl/unx/generic/printergfx/psputil.hxx
index d4af41bb95ed..878fd9c7791a 100644
--- a/vcl/unx/generic/printergfx/psputil.hxx
+++ b/vcl/unx/generic/printergfx/psputil.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -76,3 +77,4 @@ ConverterFactory* GetConverterFactory ();
#endif /* _PSPRINT_PRINTERUTIL_HXX_ */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printergfx/text_gfx.cxx b/vcl/unx/generic/printergfx/text_gfx.cxx
index 7934821d4d70..263e0b4c7995 100644
--- a/vcl/unx/generic/printergfx/text_gfx.cxx
+++ b/vcl/unx/generic/printergfx/text_gfx.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -178,7 +179,7 @@ void PrinterGfx::drawGlyphs(
// draw the string
// search for a glyph set matching the set font
std::list< GlyphSet >::iterator aIter;
- for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); aIter++)
+ for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter)
if ( ((*aIter).GetFontID() == mnFontID)
&& ((*aIter).IsVertical() == mbTextVertical))
{
@@ -621,7 +622,7 @@ PrinterGfx::drawText(
// search for a glyph set matching the set font
std::list< GlyphSet >::iterator aIter;
- for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); aIter++)
+ for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter)
if ( ((*aIter).GetFontID() == mnFontID)
&& ((*aIter).IsVertical() == mbTextVertical))
{
@@ -702,7 +703,7 @@ PrinterGfx::getFontSubstitute () const
{
if( mpFontSubstitutes )
{
- ::std::hash_map< fontID, fontID >::const_iterator it =
+ ::boost::unordered_map< fontID, fontID >::const_iterator it =
mpFontSubstitutes->find( mnFontID );
if( it != mpFontSubstitutes->end() )
return it->second;
@@ -746,7 +747,7 @@ const ::std::list< KernPair >& PrinterGfx::getKernPairs( bool bVertical ) const
fontID nFont = mnFontID;
if( mpFontSubstitutes )
{
- ::std::hash_map< fontID, fontID >::const_iterator it =
+ ::boost::unordered_map< fontID, fontID >::const_iterator it =
mpFontSubstitutes->find( mnFontID );
if( it != mpFontSubstitutes->end() )
nFont = it->second;
@@ -812,7 +813,7 @@ PrinterGfx::writeResources( osl::File* pFile, std::list< rtl::OString >& rSuppli
WritePS (pFile, aPostScriptName.getStr());
WritePS (pFile, "\n");
- osl::File::RC nError = aFontFile.open (OpenFlag_Read);
+ osl::File::RC nError = aFontFile.open(osl_File_OpenFlag_Read);
if (nError == osl::File::E_None)
{
convertPfbToPfa (aFontFile, *pFile);
@@ -860,3 +861,5 @@ void PrinterGfx::setStrictSO52Compatibility( bool bCompat)
{
mbStrictSO52Compatibility = bCompat;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/window/FWS.cxx b/vcl/unx/generic/window/FWS.cxx
index 4683864fd116..a90f76af90c2 100644
--- a/vcl/unx/generic/window/FWS.cxx
+++ b/vcl/unx/generic/window/FWS.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -190,7 +191,7 @@ WMSupportsFWS (Display *display, int screen)
*
* newHandler() -
*
- * Handle X errors (temporarily) to record the occurance of BadWindow
+ * Handle X errors (temporarily) to record the occurrence of BadWindow
* errors without crashing. Used to detect the FWS_COMM_WINDOW root window
* property containing an old or obsolete window id.
*
@@ -278,3 +279,4 @@ AddFwsProtocols (Display *display, Window window)
(unsigned char *) fwsProtocols, nProtos);
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/window/FWS.hxx b/vcl/unx/generic/window/FWS.hxx
index a687870ede4a..36b4b16a9214 100644
--- a/vcl/unx/generic/window/FWS.hxx
+++ b/vcl/unx/generic/window/FWS.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -62,3 +63,4 @@ AddFwsProtocols (Display *display, Window window);
#endif // _FOREIGN_WINDOW_SYSTEM_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index c0348beb6a34..1fdfc02c3916 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -48,7 +49,7 @@
#include <X11/keysym.h>
#include "FWS.hxx"
#include <X11/extensions/shape.h>
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(AIX)
#include <X11/extensions/dpms.h>
#endif
#include <tools/postx.h>
@@ -71,6 +72,7 @@
#include "salinst.hxx"
#include "sallayout.hxx"
+#include <sal/macros.h>
#include <com/sun/star/uno/Exception.hpp>
#include <algorithm>
@@ -181,7 +183,7 @@ void X11SalFrame::setXEmbedInfo()
32,
PropModeReplace,
reinterpret_cast<unsigned char*>(aInfo),
- sizeof(aInfo)/sizeof(aInfo[0]) );
+ SAL_N_ELEMENTS(aInfo) );
}
}
@@ -498,7 +500,7 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData*
nAttrMask,
&Attributes );
// FIXME: see above: fake shell window for now to own window
- if( /*! IsSysChildWindow() &&*/ pParentData == NULL )
+ if( pParentData == NULL )
{
mhShellWindow = mhWindow;
}
@@ -542,11 +544,11 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData*
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_TAKE_FOCUS );
XSetWMProtocols( GetXDisplay(), GetShellWindow(), a, n );
- XClassHint* pClass = XAllocClassHint();
- pClass->res_name = const_cast<char*>(X11SalData::getFrameResName());
- pClass->res_class = const_cast<char*>(X11SalData::getFrameClassName());
- XSetClassHint( GetXDisplay(), GetShellWindow(), pClass );
- XFree( pClass );
+ // force wm class hint
+ mnExtStyle = ~0;
+ if (mpParent)
+ m_sWMClass = mpParent->m_sWMClass;
+ SetExtendedFrameStyle( 0 );
XSizeHints* pHints = XAllocSizeHints();
pHints->flags = PWinGravity | PPosition;
@@ -679,7 +681,6 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, sal_uLong nSalFrameStyle, SystemPar
nKeyCode_ = 0;
nKeyState_ = 0;
nCompose_ = -1;
- mbKeyMenu = false;
mbSendExtKeyModChange = false;
mnExtKeyMod = 0;
@@ -849,13 +850,7 @@ void X11SalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
if( nStyle != mnExtStyle && ! IsChildWindow() )
{
mnExtStyle = nStyle;
-
- XClassHint* pClass = XAllocClassHint();
- rtl::OString aResHint = X11SalData::getFrameResName( mnExtStyle );
- pClass->res_name = const_cast<char*>(aResHint.getStr());
- pClass->res_class = const_cast<char*>(X11SalData::getFrameClassName());
- XSetClassHint( GetXDisplay(), GetShellWindow(), pClass );
- XFree( pClass );
+ updateWMClass();
}
}
@@ -1158,8 +1153,6 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
setXEmbedInfo();
if( bVisible )
{
- SessionManagerClient::open(); // will simply return after the first time
-
mbInShow = sal_True;
if( ! (nStyle_ & SAL_FRAME_STYLE_INTRO) )
{
@@ -1182,7 +1175,6 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
GetDisplay()->getWMAdaptor()->frameIsMapping( this );
/*
- * #95097#
* Actually this is rather exotic and currently happens only in conjunction
* with the basic dialogue editor,
* which shows a frame and instantly hides it again. After that the
@@ -1267,7 +1259,6 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
if( IsFloatGrabWindow() )
{
/*
- * #95453#
* Sawfish and twm can be switched to enter-exit focus behaviour. In this case
* we must grab the pointer else the dumb WM will put the focus to the
* override-redirect float window. The application window will be deactivated
@@ -1318,7 +1309,7 @@ void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
nShowState_ = SHOWSTATE_NORMAL;
/*
- * #98107# plugged windows don't necessarily get the
+ * plugged windows don't necessarily get the
* focus on show because the parent may already be mapped
* and have the focus. So try to set the focus
* to the child on Show(sal_True)
@@ -2192,6 +2183,33 @@ void X11SalFrame::SetScreenNumber( unsigned int nNewScreen )
}
}
+void X11SalFrame::SetApplicationID( const rtl::OUString &rWMClass )
+{
+ if( rWMClass != m_sWMClass && ! IsChildWindow() )
+ {
+ m_sWMClass = rWMClass;
+ updateWMClass();
+ std::list< X11SalFrame* >::const_iterator it;
+ for( it = maChildren.begin(); it != maChildren.end(); ++it )
+ (*it)->SetApplicationID(rWMClass);
+ }
+}
+
+void X11SalFrame::updateWMClass()
+{
+ XClassHint* pClass = XAllocClassHint();
+ rtl::OString aResName = X11SalData::getFrameResName( mnExtStyle );
+ pClass->res_name = const_cast<char*>(aResName.getStr());
+
+ rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US);
+ const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName();
+
+ pClass->res_class = const_cast<char*>(pResClass);
+ XSetClassHint( GetXDisplay(), GetShellWindow(), pClass );
+ XFree( pClass );
+}
+
+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void X11SalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen )
@@ -2362,7 +2380,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart )
// needs static here to save DPMS settings
int dummy;
static bool DPMSExtensionAvailable =
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(AIX)
(DPMSQueryExtension(GetXDisplay(), &dummy, &dummy) != 0);
static sal_Bool DPMSEnabled = false;
#else
@@ -2397,7 +2415,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart )
// get the DPMS state right before the start
if (DPMSExtensionAvailable)
{
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(AIX)
CARD16 state; // card16 is defined in Xdm.h
DPMSInfo( GetXDisplay(),
&state,
@@ -2416,7 +2434,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart )
prefer_blanking,
allow_exposures );
}
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(AIX)
if( DPMSEnabled )
{
if ( DPMSExtensionAvailable )
@@ -2430,7 +2448,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart )
}
#endif
}
- else // if( !bStart ) // end of show
+ else
{
if( nScreenSaversTimeout_ )
{
@@ -2441,7 +2459,7 @@ void X11SalFrame::StartPresentation( sal_Bool bStart )
allow_exposures );
nScreenSaversTimeout_ = 0;
}
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(AIX)
if ( DPMSEnabled )
{
if ( DPMSExtensionAvailable )
@@ -2472,7 +2490,7 @@ void X11SalFrame::SetPointer( PointerStyle ePointerStyle )
void X11SalFrame::SetPointerPos(long nX, long nY)
{
- /* #87921# when the application tries to center the mouse in the dialog the
+ /* when the application tries to center the mouse in the dialog the
* window isn't mapped already. So use coordinates relative to the root window.
*/
unsigned int nWindowLeft = maGeometry.nX + nX;
@@ -2851,6 +2869,18 @@ SalFrame::SalPointerState X11SalFrame::GetPointerState()
return aState;
}
+SalFrame::SalIndicatorState X11SalFrame::GetIndicatorState()
+{
+ SalIndicatorState aState;
+ aState.mnState = GetX11SalData()->GetDisplay()->GetIndicatorState();
+ return aState;
+}
+
+void X11SalFrame::SimulateKeyPress( sal_uInt16 nKeyCode )
+{
+ GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode);
+}
+
long X11SalFrame::HandleMouseEvent( XEvent *pEvent )
{
SalMouseEvent aMouseEvt;
@@ -2898,8 +2928,6 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent )
if( LeaveNotify == pEvent->type || EnterNotify == pEvent->type )
{
/*
- * #89075# #89335#
- *
* some WMs (and/or) applications have a passive grab on
* mouse buttons (XGrabButton). This leads to enter/leave notifies
* with mouse buttons pressed in the state mask before the actual
@@ -2908,7 +2936,6 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent )
* decides that a pressed button in a MouseMove belongs to
* a drag operation which leads to doing things differently.
*
- * #95901#
* ignore Enter/LeaveNotify resulting from grabs so that
* help windows do not disappear just after appearing
*
@@ -3365,29 +3392,10 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
int nRet = CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt );
- // emulate KEY_MENU
- if ( ( (nKeySym == XK_Alt_L) || (nKeySym == XK_Alt_R) ) &&
- ( (nModCode & ~(KEY_MOD3|KEY_MOD2)) == 0 ) )
- {
- if( pEvent->type == XLIB_KeyPress )
- mbKeyMenu = true;
- else if( mbKeyMenu )
- {
- // simulate KEY_MENU
- aKeyEvt.mnCode = KEY_MENU | nModCode;
- aKeyEvt.mnRepeat = 0;
- aKeyEvt.mnTime = pEvent->time;
- aKeyEvt.mnCharCode = 0;
- nRet = CallCallback( SALEVENT_KEYINPUT, &aKeyEvt );
- nRet = CallCallback( SALEVENT_KEYUP, &aKeyEvt );
- }
- }
- else
- mbKeyMenu = false;
return nRet;
}
- mbSendExtKeyModChange = mbKeyMenu = false;
+ mbSendExtKeyModChange = false;
// try to figure out the vcl code for the keysym
// #i52338# use the unmodified KeySym if there is none for the real KeySym
@@ -3551,17 +3559,17 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
{
- // #107739# ReflectionX in Windows mode changes focus while mouse is grabbed
+ // ReflectionX in Windows mode changes focus while mouse is grabbed
if( nVisibleFloats > 0 && GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii( "ReflectionX Windows" ) )
return 1;
- /* #55691# ignore focusout resulting from keyboard grabs
+ /* ignore focusout resulting from keyboard grabs
* we do not grab it and are not interested when
* someone else does CDE e.g. does a XGrabKey on arrow keys
- * #73179# handle focus events with mode NotifyWhileGrabbed
+ * handle focus events with mode NotifyWhileGrabbed
* because with CDE alt-tab focus changing we do not get
* normal focus events
- * #71791# cast focus event to the input context, otherwise the
+ * cast focus event to the input context, otherwise the
* status window does not follow the application frame
*/
@@ -3590,7 +3598,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
if( FocusIn == pEvent->type )
{
- vcl_sal::PrinterUpdate::update();
+ GetSalData()->m_pInstance->updatePrinterUpdate();
mbInputFocus = True;
ImplSVData* pSVData = ImplGetSVData();
@@ -3609,7 +3617,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
else
{
mbInputFocus = False;
- mbSendExtKeyModChange = mbKeyMenu = false;
+ mbSendExtKeyModChange = false;
mnExtKeyMod = 0;
return CallCallback( SALEVENT_LOSEFOCUS, 0 );
}
@@ -3725,9 +3733,37 @@ void X11SalFrame::RestackChildren()
}
}
+static Bool size_event_predicate( Display*, XEvent* event, XPointer arg )
+{
+ if( event->type != ConfigureNotify )
+ return False;
+ X11SalFrame* frame = reinterpret_cast< X11SalFrame* >( arg );
+ XConfigureEvent* pEvent = &event->xconfigure;
+ if( pEvent->window != frame->GetShellWindow()
+ && pEvent->window != frame->GetWindow()
+ && pEvent->window != frame->GetForeignParent()
+ && pEvent->window != frame->GetStackingWindow())
+ { // ignored at top of HandleSizeEvent()
+ return False;
+ }
+ if( pEvent->window == frame->GetStackingWindow())
+ return False; // filtered later in HandleSizeEvent()
+ // at this point we know that there is another similar event in the queue
+ frame->setPendingSizeEvent();
+ return False; // but do not process the new event out of order
+}
+
+void X11SalFrame::setPendingSizeEvent()
+{
+ mPendingSizeEvent = true;
+}
+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
long X11SalFrame::HandleSizeEvent( XConfigureEvent *pEvent )
{
+ // NOTE: if you add more tests in this function, make sure to update size_event_predicate()
+ // so that it finds exactly the same events
+
if ( pEvent->window != GetShellWindow()
&& pEvent->window != GetWindow()
&& pEvent->window != GetForeignParent()
@@ -3775,6 +3811,16 @@ long X11SalFrame::HandleSizeEvent( XConfigureEvent *pEvent )
if( SHOWSTATE_UNKNOWN == nShowState_ && bMapped_ )
nShowState_ = SHOWSTATE_NORMAL;
+ // Avoid a race condition where resizing this window to one size and shortly after that
+ // to another size generates first size event with the old size and only after that
+ // with the new size, temporarily making us think the old size is valid (bnc#674806).
+ // So if there is another size event for this window pending, ignore this one.
+ mPendingSizeEvent = false;
+ XEvent dummy;
+ XCheckIfEvent( GetXDisplay(), &dummy, size_event_predicate, reinterpret_cast< XPointer >( this ));
+ if( mPendingSizeEvent )
+ return 1;
+
nWidth_ = pEvent->width;
nHeight_ = pEvent->height;
@@ -3824,7 +3870,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
GetDisplay()->GetXLib()->PushXErrorLevel( true );
/*
- * #89186# don't rely on the new parent from the event.
+ * don't rely on the new parent from the event.
* the event may be "out of date", that is the window manager
* window may not exist anymore. This can happen if someone
* shows a frame and hides it again quickly (not that that would
@@ -3840,12 +3886,12 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
&hDummy,
&Children,
&nChildren );
- if( GetDisplay()->GetXLib()->HasXErrorOccured() )
+ if( GetDisplay()->GetXLib()->HasXErrorOccurred() )
{
hWM_Parent = GetShellWindow();
break;
}
- /* #107048# this sometimes happens if a Show(sal_True) is
+ /* this sometimes happens if a Show(sal_True) is
* immediately followed by Show(sal_False) (which is braindead anyway)
*/
if( hDummy == hWM_Parent )
@@ -3930,7 +3976,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
* so need real geometries here
* (this will fail with virtual roots ?)
*/
- GetDisplay()->GetXLib()->ResetXErrorOccured();
+ GetDisplay()->GetXLib()->ResetXErrorOccurred();
int xp, yp, x, y;
unsigned int wp, w, hp, h, bw, d;
XGetGeometry( GetXDisplay(),
@@ -3942,7 +3988,7 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent )
&hRoot,
&xp, &yp, &wp, &hp, &bw, &d );
bool bResized = false;
- if( ! GetDisplay()->GetXLib()->HasXErrorOccured() )
+ if( ! GetDisplay()->GetXLib()->HasXErrorOccurred() )
{
maGeometry.nRightDecoration = wp - w - maGeometry.nLeftDecoration;
maGeometry.nBottomDecoration = hp - h - maGeometry.nTopDecoration;
@@ -4083,10 +4129,10 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent )
{
if( this == s_pSaveYourselfFrame )
{
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding()));
const char* argv[2];
argv[0] = "/bin/sh";
- argv[1] = const_cast<char*>(aExec.GetBuffer());
+ argv[1] = const_cast<char*>(aExec.getStr());
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
#endif
@@ -4131,10 +4177,10 @@ void X11SalFrame::SaveYourselfDone( SalFrame* pSaveFrame )
// session save was done, inform dtwm
if( s_pSaveYourselfFrame && pSaveFrame )
{
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding()));
const char* argv[2];
argv[0] = "/bin/sh";
- argv[1] = const_cast<char*>(aExec.GetBuffer());
+ argv[1] = const_cast<char*>(aExec.getStr());
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
#endif
@@ -4222,7 +4268,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent )
break;
case ButtonPress:
- // #74406# if we loose the focus in presentation mode
+ // if we loose the focus in presentation mode
// there are good chances that we never get it back
// since the WM ignores us
if( IsOverrideRedirect() )
@@ -4254,7 +4300,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent )
if( nShowState_ == SHOWSTATE_HIDDEN )
{
/*
- * #95097# workaround for (at least) KWin 2.2.2
+ * workaround for (at least) KWin 2.2.2
* which will map windows that were once transient
* even if they are withdrawn when the respective
* document is mapped.
@@ -4293,12 +4339,12 @@ long X11SalFrame::Dispatch( XEvent *pEvent )
}
bool bSetFocus = m_bSetFocusOnMap;
- /* #99570# another workaround for sawfish: if a transient window for the same parent is shown
+ /* another workaround for sawfish: if a transient window for the same parent is shown
* sawfish does not set the focus to it. Applies only for click to focus mode.
*/
if( ! (nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii( "Sawfish" ) )
{
- // #101775# don't set the focus into the IME status window
+ // don't set the focus into the IME status window
// since this will lead to a parent loose-focus, close status,
// reget focus, open status, .... flicker loop
if ( (I18NStatus::get().getStatusFrame() != this) )
@@ -4518,3 +4564,4 @@ void X11SalFrame::EndSetClipRegion()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx
index 49225e2c99ce..124c0f6cadbb 100644
--- a/vcl/unx/generic/window/salobj.cxx
+++ b/vcl/unx/generic/window/salobj.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -151,7 +152,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
pVisual,
CWEventMask|CWColormap, &aAttribs );
XSync( pDisp, False );
- sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccured();
+ sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred();
pSalDisp->GetXLib()->PopXErrorLevel();
if( bWasXError )
{
@@ -178,7 +179,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
pObjData->pAppContext = NULL;
XSync(pDisp, False);
- sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccured();
+ sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred();
pSalDisp->GetXLib()->PopXErrorLevel();
if( bWasXError )
{
@@ -565,3 +566,4 @@ void X11SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ )
{
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx
index 4329dd345d14..39c51cb3b274 100644
--- a/vcl/unx/gtk/a11y/atkaction.cxx
+++ b/vcl/unx/gtk/a11y/atkaction.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -276,3 +277,5 @@ actionIfaceInit (AtkActionIface *iface)
iface->get_localized_name = action_wrapper_get_localized_name;
iface->set_description = action_wrapper_set_description;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 71c05bd16626..da667fe75326 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -76,3 +77,4 @@ void DeInitAtkBridge()
restore_gail_window_vtable();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkcomponent.cxx b/vcl/unx/gtk/a11y/atkcomponent.cxx
index 24cf335ebeb0..37ef152db3c9 100644
--- a/vcl/unx/gtk/a11y/atkcomponent.cxx
+++ b/vcl/unx/gtk/a11y/atkcomponent.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -380,3 +381,5 @@ componentIfaceInit (AtkComponentIface *iface)
iface->set_position = component_wrapper_set_position;
iface->set_size = component_wrapper_set_size;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkeditabletext.cxx b/vcl/unx/gtk/a11y/atkeditabletext.cxx
index c0399145b07c..a330bc66e8ce 100644
--- a/vcl/unx/gtk/a11y/atkeditabletext.cxx
+++ b/vcl/unx/gtk/a11y/atkeditabletext.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,9 +35,6 @@
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
-// #include <functional>
-// #include <hash_map>
-
#include <stdio.h>
#include <string.h>
@@ -200,3 +198,5 @@ editableTextIfaceInit (AtkEditableTextIface *iface)
iface->paste_text = editable_text_wrapper_paste_text;
iface->set_run_attributes = editable_text_wrapper_set_run_attributes;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx
index 9588123f4032..fef6c80767e5 100644
--- a/vcl/unx/gtk/a11y/atkfactory.cxx
+++ b/vcl/unx/gtk/a11y/atkfactory.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -181,3 +182,4 @@ wrapper_factory_get_type (void)
} // extern C
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkfactory.hxx b/vcl/unx/gtk/a11y/atkfactory.hxx
index 82be08cfad1b..acb7b026f3a8 100644
--- a/vcl/unx/gtk/a11y/atkfactory.hxx
+++ b/vcl/unx/gtk/a11y/atkfactory.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,3 +40,5 @@ GType wrapper_factory_get_type (void);
} // extern "C"
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkhypertext.cxx b/vcl/unx/gtk/a11y/atkhypertext.cxx
index 90d735890655..b2c7aca857f4 100644
--- a/vcl/unx/gtk/a11y/atkhypertext.cxx
+++ b/vcl/unx/gtk/a11y/atkhypertext.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -289,3 +290,5 @@ hypertextIfaceInit (AtkHypertextIface *iface)
iface->get_n_links = hypertext_get_n_links;
iface->get_link_index = hypertext_get_link_index;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkimage.cxx b/vcl/unx/gtk/a11y/atkimage.cxx
index b48c59555a29..04263fd72906 100644
--- a/vcl/unx/gtk/a11y/atkimage.cxx
+++ b/vcl/unx/gtk/a11y/atkimage.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -136,3 +137,5 @@ imageIfaceInit (AtkImageIface *iface)
iface->get_image_position = image_get_image_position;
iface->get_image_size = image_get_image_size;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index e02478ac8ad8..3adca0f55279 100644
--- a/vcl/unx/gtk/a11y/atklistener.cxx
+++ b/vcl/unx/gtk/a11y/atklistener.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +29,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+#ifdef AIX
+#define _LINUX_SOURCE_COMPAT
+#include <sys/timer.h>
+#undef _LINUX_SOURCE_COMPAT
+#endif
+
#include <com/sun/star/accessibility/TextSegment.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -535,3 +542,5 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven
break;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atklistener.hxx b/vcl/unx/gtk/a11y/atklistener.hxx
index d2889caa3e24..dbac3599cd4b 100644
--- a/vcl/unx/gtk/a11y/atklistener.hxx
+++ b/vcl/unx/gtk/a11y/atklistener.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -77,3 +78,4 @@ private:
#endif /* _ATK_LISTENER_HXX_ */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkregistry.cxx b/vcl/unx/gtk/a11y/atkregistry.cxx
index 81ec22dc4ce1..396683e5fd8c 100644
--- a/vcl/unx/gtk/a11y/atkregistry.cxx
+++ b/vcl/unx/gtk/a11y/atkregistry.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -69,3 +70,4 @@ ooo_wrapper_registry_remove(XAccessible *pAccessible)
g_hash_table_remove( uno_to_gobject, (gpointer) pAccessible );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkregistry.hxx b/vcl/unx/gtk/a11y/atkregistry.hxx
index f4de3b2e4c1e..b3a59b6db8d0 100644
--- a/vcl/unx/gtk/a11y/atkregistry.hxx
+++ b/vcl/unx/gtk/a11y/atkregistry.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -38,3 +39,5 @@ void ooo_wrapper_registry_add(const ::com::sun::star::uno::Reference< ::com::sun
void ooo_wrapper_registry_remove(::com::sun::star::accessibility::XAccessible *pAccessible);
#endif // __ATK_REGISTRY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkselection.cxx b/vcl/unx/gtk/a11y/atkselection.cxx
index 172faac4c704..127730f0a458 100644
--- a/vcl/unx/gtk/a11y/atkselection.cxx
+++ b/vcl/unx/gtk/a11y/atkselection.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -193,3 +194,5 @@ selectionIfaceInit( AtkSelectionIface *iface)
iface->remove_selection = selection_remove_selection;
iface->select_all_selection = selection_select_all_selection;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx
index 78571ff11c34..dec06cd7005b 100644
--- a/vcl/unx/gtk/a11y/atktable.cxx
+++ b/vcl/unx/gtk/a11y/atktable.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -446,8 +447,6 @@ table_wrapper_get_summary( AtkTable *table )
if( pTable )
{
- // FIXME: Summary ??
-// AtkObject* summary;
return atk_object_wrapper_conditional_ref( pTable->getAccessibleSummary() );
}
}
@@ -719,3 +718,5 @@ tableIfaceInit (AtkTableIface *iface)
iface->get_column_description = table_wrapper_get_column_description;
iface->set_column_description = table_wrapper_set_column_description;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index e6d3276891de..1b21fa66837c 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -454,7 +455,7 @@ text_wrapper_set_caret_offset (AtkText *text,
return FALSE;
}
-// --> OD 2010-03-04 #i92232#
+// #i92232#
AtkAttributeSet*
handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup,
const gint nTextMarkupType,
@@ -530,7 +531,6 @@ handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pText
return pSet;
}
-// <--
static AtkAttributeSet *
text_wrapper_get_run_attributes( AtkText *text,
@@ -551,26 +551,22 @@ text_wrapper_get_run_attributes( AtkText *text,
pTextAttributes->getRunAttributes( offset, uno::Sequence< rtl::OUString > () );
pSet = attribute_set_new_from_property_values( aAttributeList, true, text );
- // --> OD 2009-06-22 #i100938#
+ // #i100938#
// - always provide start_offset and end_offset
-// if( pSet )
- // <--
{
accessibility::TextSegment aTextSegment =
pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
*start_offset = aTextSegment.SegmentStart;
- // --> OD 2009-06-22 #i100938#
+ // #i100938#
// Do _not_ increment the end_offset provide by <accessibility::TextSegment> instance
-// *end_offset = aTextSegment.SegmentEnd + 1; // FIXME: TESTME
*end_offset = aTextSegment.SegmentEnd;
- // <--
bOffsetsAreValid = true;
}
}
// Special handling for misspelled text
- // --> OD 2010-03-01 #i92232#
+ // #i92232#
// - add special handling for tracked changes and refactor the
// corresponding code for handling misspelled text.
accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text );
@@ -603,7 +599,6 @@ text_wrapper_get_run_attributes( AtkText *text,
com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE,
offset, pSet, start_offset, end_offset );
}
- // <--
}
catch(const uno::Exception& e){
@@ -874,3 +869,5 @@ textIfaceInit (AtkTextIface *iface)
iface->get_character_extents = text_wrapper_get_character_extents;
iface->get_offset_at_point = text_wrapper_get_offset_at_point;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 04498810597f..bcf880160224 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -74,12 +75,10 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID;
-// --> OD 2010-03-01 #i92232#
+// #i92232#
static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID;
-// <--
-// --> OD 2010-03-05 #i92233#
+// #i92233#
static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID;
-// <--
/*****************************************************************************/
@@ -109,9 +108,8 @@ enum ExportedAttribute
TEXT_ATTRIBUTE_STRIKETHROUGH,
TEXT_ATTRIBUTE_UNDERLINE,
TEXT_ATTRIBUTE_WEIGHT,
- // --> OD 2010-03-05 #i92233#
+ // #i92233#
TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO,
- // <--
TEXT_ATTRIBUTE_JUSTIFICATION,
TEXT_ATTRIBUTE_BOTTOM_MARGIN,
TEXT_ATTRIBUTE_FIRST_LINE_INDENT,
@@ -176,7 +174,6 @@ get_value( const uno::Sequence< beans::PropertyValue >& rAttributeList,
#define get_bool_value( list, index ) get_value( list, index, Bool2String )
#define get_short_value( list, index ) get_value( list, index, Short2String )
-//#define get_long_value( list, index ) get_value( list, index, Long2String ) pb: not used (warning on linux)
#define get_height_value( list, index ) get_value( list, index, Float2String )
#define get_justification_value( list, index ) get_value( list, index, Adjust2Justification )
#define get_cmm_value( list, index ) get_value( list, index, CMM2UnitString )
@@ -189,36 +186,6 @@ get_value( const uno::Sequence< beans::PropertyValue >& rAttributeList,
#define get_weight_value( list, index ) get_value( list, index, Weight2String )
#define get_language_string( list, index ) get_value( list, index, Locale2String )
-/*
-static gchar*
-dump_value( const uno::Sequence< beans::PropertyValue >& rAttributeList, sal_Int32 nIndex )
-{
- if( nIndex != -1 )
- {
- rtl::OString aName = rtl::OUStringToOString(rAttributeList[nIndex].Name, RTL_TEXTENCODING_UTF8);
-
- if( rAttributeList[nIndex].Value.has<sal_Int16> () )
- OSL_TRACE( "%s = %d (short value)", aName.getStr(),
- rAttributeList[nIndex].Value.get<sal_Int16> () );
-
- else if( rAttributeList[nIndex].Value.has<sal_Int8> () )
- OSL_TRACE( "%s = %d (byte value)", aName.getStr(),
- rAttributeList[nIndex].Value.get<sal_Int8> () );
-
- else if( rAttributeList[nIndex].Value.has<sal_Bool> () )
- OSL_TRACE( "%s = %s (bool value)", aName.getStr(),
- rAttributeList[nIndex].Value.get<sal_Bool> () ? "true" : "false" );
-
- else if( rAttributeList[nIndex].Value.has<rtl::OUString> () )
- OSL_TRACE( "%s = %s", aName.getStr(),
- rtl::OUStringToOString(rAttributeList[nIndex].Value.get<rtl::OUString> (),
- RTL_TEXTENCODING_UTF8).getStr() );
- }
-
- return NULL;
-}
-*/
-
static inline
double toPoint(sal_Int16 n)
{
@@ -229,14 +196,6 @@ double toPoint(sal_Int16 n)
/*****************************************************************************/
-/*
-static gchar*
-NullString(const uno::Any&)
-{
- return NULL;
-}
-*/
-
static bool
InvalidValue( uno::Any&, const gchar * )
{
@@ -265,48 +224,6 @@ String2Float( uno::Any& rAny, const gchar * value )
/*****************************************************************************/
-/*
-static gchar*
-Short2String(const uno::Any& rAny)
-{
- return g_strdup_printf( "%d", rAny.get<sal_Int16>() );
-}
-
-static bool
-String2Short( uno::Any& rAny, const gchar * value )
-{
- sal_Int32 lval;
-
- if( 1 != sscanf( value, "%d", &lval ) )
- return false;
-
- rAny = uno::makeAny( (sal_Int16) lval );
- return true;
-}
-*/
-
-/*****************************************************************************/
-/* pb: not used (warning on linux)
-static gchar*
-Long2String(const uno::Any& rAny)
-{
- return g_strdup_printf( "%ld", rAny.get<sal_Int32>() );
-}
-
-static bool
-String2Long( uno::Any& rAny, const gchar * value )
-{
- sal_Int32 lval;
-
- if( 1 != sscanf( value, "%ld", &lval ) )
- return false;
-
- rAny = uno::makeAny( lval );
- return true;
-}
-*/
-/*****************************************************************************/
-
static accessibility::XAccessibleComponent*
getComponent( AtkText *pText ) throw (uno::RuntimeException)
{
@@ -1092,7 +1009,7 @@ TabStopList2String( const uno::Any& rAny, bool default_tabs )
if( ret )
{
gchar * old_tab_str = ret;
- ret = g_strconcat(old_tab_str, " ", tab_str, NULL /* terminated */);
+ ret = g_strconcat(old_tab_str, " ", tab_str, (const char*)NULL);
g_free( old_tab_str );
}
else
@@ -1305,13 +1222,12 @@ attribute_set_new_from_property_values(
attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops,
get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String));
- // --> OD 2010-03-05 #i92233#
+ // #i92233#
if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio )
atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio");
attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio,
get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String));
- // <--
return attribute_set;
}
@@ -1328,7 +1244,7 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se
return attribute_set;
}
-// --> OD 2010-03-01 #i92232#
+// #i92232#
AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set )
{
if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
@@ -1370,7 +1286,6 @@ AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttribute
return attribute_set;
}
-// <--
/*****************************************************************************/
@@ -1454,3 +1369,4 @@ attribute_set_map_to_property_values(
return true;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx
index 9c7628bf927e..1366fb861955 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.hxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,10 +46,11 @@ attribute_set_map_to_property_values(
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList );
AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set );
-// --> OD 2010-03-01 #i92232#
+// #i92232#
AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set );
AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set );
AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set );
-// <--
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index d3c1afdd2efe..f7e849e44e87 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,16 +29,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+#ifdef AIX
+#define _LINUX_SOURCE_COMPAT
+#include <sys/timer.h>
+#undef _LINUX_SOURCE_COMPAT
+#endif
+
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-// --> OD 2009-04-14 #i93269#
#include <com/sun/star/accessibility/XAccessibleText.hpp>
// <--
#include <cppuhelper/implbase1.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
#include <vcl/svapp.hxx>
@@ -70,7 +76,7 @@ extern "C" {
static gint
atk_wrapper_focus_idle_handler (gpointer data)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
focus_notify_handler = 0;
@@ -85,7 +91,7 @@ atk_wrapper_focus_idle_handler (gpointer data)
fprintf(stderr, "notifying focus event for %p\n", atk_obj);
#endif
atk_focus_tracker_notify(atk_obj);
- // --> OD 2009-04-14 #i93269#
+ // #i93269#
// emit text_caret_moved event for <XAccessibleText> object,
// if cursor is inside the <XAccessibleText> object.
// also emit state-changed:focused event under the same condition.
@@ -112,7 +118,6 @@ atk_wrapper_focus_idle_handler (gpointer data)
}
}
}
- // <--
g_object_unref(atk_obj);
}
}
@@ -189,16 +194,12 @@ public:
void DocumentFocusListener::disposing( const lang::EventObject& aEvent )
throw (uno::RuntimeException)
{
-// fprintf(stderr, "In DocumentFocusListener::disposing (%p)\n", this);
-// fprintf(stderr, "m_aRefList has %d entries\n", m_aRefList.size());
// Unref the object here, but do not remove as listener since the object
// might no longer be in a state that safely allows this.
if( aEvent.Source.is() )
m_aRefList.erase(aEvent.Source);
-// fprintf(stderr, "m_aRefList has %d entries\n", m_aRefList.size());
-
}
/*****************************************************************************/
@@ -235,12 +236,6 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj
break;
case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN:
-/* {
- uno::Reference< accessibility::XAccessible > xAccessible( getAccessible(aEvent) );
- detachRecursive(xAccessible);
- attachRecursive(xAccessible);
- }
-*/
g_warning( "Invalidate all children called\n" );
break;
default:
@@ -497,27 +492,6 @@ static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent)
}
}
-/*****************************************************************************/
-
-/* currently not needed anymore...
-static void create_wrapper_for_children(Window *pWindow)
-{
- if( pWindow && pWindow->IsReallyVisible() )
- {
- uno::Reference< accessibility::XAccessible > xAccessible(pWindow->GetAccessible());
- if( xAccessible.is() )
- {
- uno::Reference< accessibility::XAccessibleContext > xContext(xAccessible->getAccessibleContext());
- if( xContext.is() )
- {
- sal_Int32 nChildren = xContext->getAccessibleChildCount();
- for( sal_Int32 i = 0; i < nChildren; ++i )
- create_wrapper_for_child(xContext, i);
- }
- }
- }
-}
-*/
/*****************************************************************************/
@@ -623,46 +597,30 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent)
long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent)
{
+ try {
switch (pEvent->GetId())
{
case VCLEVENT_WINDOW_SHOW:
-// fprintf(stderr, "got VCLEVENT_WINDOW_SHOW for %p\n",
-// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
case VCLEVENT_WINDOW_HIDE:
-// fprintf(stderr, "got VCLEVENT_WINDOW_HIDE for %p\n",
-// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
case VCLEVENT_WINDOW_CLOSE:
-// fprintf(stderr, "got VCLEVENT_WINDOW_CLOSE for %p\n",
-// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
case VCLEVENT_WINDOW_GETFOCUS:
handle_get_focus(static_cast< ::VclWindowEvent const * >(pEvent));
break;
case VCLEVENT_WINDOW_LOSEFOCUS:
-// fprintf(stderr, "got VCLEVENT_WINDOW_LOSEFOCUS for %p\n",
-// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
case VCLEVENT_WINDOW_MINIMIZE:
-// fprintf(stderr, "got VCLEVENT_WINDOW_MINIMIZE for %p\n",
-// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
case VCLEVENT_WINDOW_NORMALIZE:
-// fprintf(stderr, "got VCLEVENT_WINDOW_NORMALIZE for %p\n",
-// static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
break;
case VCLEVENT_WINDOW_KEYINPUT:
case VCLEVENT_WINDOW_KEYUP:
case VCLEVENT_WINDOW_COMMAND:
case VCLEVENT_WINDOW_MOUSEMOVE:
break;
- /*
- fprintf(stderr, "got VCLEVENT_WINDOW_COMMAND (%d) for %p\n",
- static_cast< ::CommandEvent const * > (
- static_cast< ::VclWindowEvent const * >(pEvent)->GetData())->GetCommand(),
- static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
- */
+
case VCLEVENT_MENU_HIGHLIGHT:
if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent))
{
@@ -696,7 +654,7 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent)
break;
case VCLEVENT_COMBOBOX_SETTEXT:
- // MT 2010/02: This looks quite strange to me. Stumbled over this when fixing #i104290#.
+ // This looks quite strange to me. Stumbled over this when fixing #i104290#.
// This kicked in when leaving the combobox in the toolbar, after that the events worked.
// I guess this was a try to work around missing combobox events, which didn't do the full job, and shouldn't be necessary anymore.
// Fix for #i104290# was done in toolkit/source/awt/vclxaccessiblecomponent, FOCUSED state for compound controls in general.
@@ -704,9 +662,12 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent)
break;
default:
-// OSL_TRACE("got event %d \n", pEvent->GetId());
break;
}
+ } catch(lang::IndexOutOfBoundsException e)
+ {
+ g_warning("Focused object has invalid index in parent");
+ }
return 0;
}
@@ -780,13 +741,13 @@ ooo_atk_util_get_type (void)
static const GTypeInfo typeInfo =
{
- type_query.class_size,
+ static_cast<guint16>(type_query.class_size),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) ooo_atk_util_class_init,
(GClassFinalizeFunc) NULL,
NULL,
- type_query.instance_size,
+ static_cast<guint16>(type_query.instance_size),
0,
(GInstanceInitFunc) NULL,
NULL
@@ -799,3 +760,4 @@ ooo_atk_util_get_type (void)
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkutil.hxx b/vcl/unx/gtk/a11y/atkutil.hxx
index 8c8ddf59c65f..c996b955d8c1 100644
--- a/vcl/unx/gtk/a11y/atkutil.hxx
+++ b/vcl/unx/gtk/a11y/atkutil.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,3 +36,5 @@
GType ooo_atk_util_get_type (void);
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkvalue.cxx b/vcl/unx/gtk/a11y/atkvalue.cxx
index 9b8e9743eb18..19e92cb9d3b1 100644
--- a/vcl/unx/gtk/a11y/atkvalue.cxx
+++ b/vcl/unx/gtk/a11y/atkvalue.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -145,3 +146,5 @@ valueIfaceInit (AtkValueIface *iface)
iface->get_minimum_value = value_wrapper_get_minimum_value;
iface->set_current_value = value_wrapper_set_current_value;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx
index b1e4bde84756..2cedf59eaea2 100644
--- a/vcl/unx/gtk/a11y/atkwindow.cxx
+++ b/vcl/unx/gtk/a11y/atkwindow.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -295,13 +296,13 @@ ooo_window_wrapper_get_type (void)
static const GTypeInfo typeInfo =
{
- type_query.class_size,
+ static_cast<guint16>(type_query.class_size),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) ooo_window_wrapper_class_init,
(GClassFinalizeFunc) NULL,
NULL,
- type_query.instance_size,
+ static_cast<guint16>(type_query.instance_size),
0,
(GInstanceInitFunc) NULL,
NULL
@@ -329,3 +330,4 @@ void restore_gail_window_vtable (void)
atk_class->initialize = window_real_initialize;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkwindow.hxx b/vcl/unx/gtk/a11y/atkwindow.hxx
index 6a9862256999..d0bfe41e1601 100644
--- a/vcl/unx/gtk/a11y/atkwindow.hxx
+++ b/vcl/unx/gtk/a11y/atkwindow.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,3 +37,5 @@ GType ooo_window_wrapper_get_type (void);
void restore_gail_window_vtable (void);
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 10f75309708d..f4e0badab1f4 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -127,12 +128,7 @@ static AtkRelationType mapRelationType( sal_Int16 nRelation )
default:
break;
}
-#if 0
- ATK_RELATION_NODE_CHILD_OF,
- ATK_RELATION_EMBEDS,
- ATK_RELATION_EMBEDDED_BY,
- ATK_RELATION_POPUP_FOR,
-#endif
+
return type;
}
@@ -401,7 +397,7 @@ wrapper_get_n_children( AtkObject *atk_obj )
n = obj->mpContext->getAccessibleChildCount();
}
catch(const uno::Exception& e) {
- OSL_ENSURE(0, "Exception in getAccessibleChildCount()" );
+ OSL_FAIL("Exception in getAccessibleChildCount()" );
}
}
@@ -433,7 +429,7 @@ wrapper_ref_child( AtkObject *atk_obj,
child = atk_object_wrapper_ref( xAccessible );
}
catch(const uno::Exception& e) {
- OSL_ENSURE(0, "Exception in getAccessibleChild");
+ OSL_FAIL("Exception in getAccessibleChild");
}
}
@@ -512,62 +508,6 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
return pSet;
}
-/*****************************************************************************/
-
-#if 0
-struct {
- sal_Int16 value;
- const sal_Char* name;
-} aStateTypeTable[] = {
- { accessibility::AccessibleStateType::INVALID, "INVALID" },
- { accessibility::AccessibleStateType::ACTIVE, "ACTIVE" },
- { accessibility::AccessibleStateType::ARMED, "ARMED" },
- { accessibility::AccessibleStateType::BUSY, "BUSY" },
- { accessibility::AccessibleStateType::CHECKED, "CHECKED" },
- { accessibility::AccessibleStateType::DEFUNC, "DEFUNC" },
- { accessibility::AccessibleStateType::EDITABLE, "EDITABLE" },
- { accessibility::AccessibleStateType::ENABLED, "ENABLED" },
- { accessibility::AccessibleStateType::EXPANDABLE, "EXPANDABLE" },
- { accessibility::AccessibleStateType::EXPANDED, "EXPANDED" },
- { accessibility::AccessibleStateType::FOCUSABLE, "FOCUSABLE" },
- { accessibility::AccessibleStateType::FOCUSED, "FOCUSED" },
- { accessibility::AccessibleStateType::HORIZONTAL, "HORIZONTAL" },
- { accessibility::AccessibleStateType::ICONIFIED, "ICONIFIED" },
- { accessibility::AccessibleStateType::INDETERMINATE, "INDETERMINATE" },
- { accessibility::AccessibleStateType::MANAGES_DESCENDANTS, "MANAGES_DESCENDANTS" },
- { accessibility::AccessibleStateType::MODAL, "MODAL" },
- { accessibility::AccessibleStateType::MULTI_LINE, "MULTI_LINE" },
- { accessibility::AccessibleStateType::MULTI_SELECTABLE, "MULTI_SELECTABLE" },
- { accessibility::AccessibleStateType::OPAQUE, "OPAQUE" },
- { accessibility::AccessibleStateType::PRESSED, "PRESSED" },
- { accessibility::AccessibleStateType::RESIZABLE, "RESIZABLE" },
- { accessibility::AccessibleStateType::SELECTABLE, "SELECTABLE" },
- { accessibility::AccessibleStateType::SELECTED, "SELECTED" },
- { accessibility::AccessibleStateType::SENSITIVE, "SENSITIVE" },
- { accessibility::AccessibleStateType::SHOWING, "SHOWING" },
- { accessibility::AccessibleStateType::SINGLE_LINE, "SINGLE_LINE" },
- { accessibility::AccessibleStateType::STALE, "STALE" },
- { accessibility::AccessibleStateType::TRANSIENT, "TRANSIENT" },
- { accessibility::AccessibleStateType::VERTICAL, "VERTICAL" },
- { accessibility::AccessibleStateType::VISIBLE, "VISIBLE" }
-};
-
-static void printStates(const uno::Sequence<sal_Int16>& rStates)
-{
- sal_Int32 n = rStates.getLength();
- size_t nTypes = sizeof(aStateTypeTable)/sizeof(aStateTypeTable[0]);
- for (sal_Int32 i = 0; i < n; ++i)
- {
- for (size_t j = 0; j < nTypes; ++j)
- {
- if (aStateTypeTable[j].value == rStates[i])
- printf("%s ", aStateTypeTable[j].name);
- }
- }
- printf("\n");
-}
-#endif
-
static AtkStateSet *
wrapper_ref_state_set( AtkObject *atk_obj )
{
@@ -784,8 +724,6 @@ ensureTypeFor( uno::XInterface *pAccessible )
aTypeName += aTypeTable[i].name;
bTypes[i] = TRUE;
}
-// g_message( "Accessible %p has type '%s' (%d)",
-// pAccessible, aTypeTable[i].name, bTypes[i] );
}
GType nType = g_type_from_name( aTypeName );
@@ -951,3 +889,5 @@ void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper)
RELEASE( wrapper->mpTextAttributes )
RELEASE( wrapper->mpValue )
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index 4252c0404833..94a8b1981688 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -123,3 +124,5 @@ OUStringToGChar(const rtl::OUString& rString )
#define OUStringToConstGChar( string ) rtl::OUStringToOString( string, RTL_TEXTENCODING_UTF8 ).getStr()
#endif /* __ATK_WRAPPER_HXX__ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index ffa61bc52c10..ab172a5ef3ef 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -41,7 +42,7 @@
#include <limits.h>
#include <errno.h>
#include <poll.h>
-#ifdef FREEBSD
+#if defined(FREEBSD) || defined(NETBSD)
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
@@ -53,6 +54,7 @@
#include <osl/thread.h>
#include <osl/process.h>
+#include <osl/conditn.h>
#include <tools/debug.hxx>
#include "unx/i18n_im.hxx"
#include "unx/i18n_xkb.hxx"
@@ -62,9 +64,10 @@
#include <vcl/svapp.hxx>
-using namespace rtl;
using namespace vcl_sal;
+using ::rtl::OUString;
+
/***************************************************************************
* class GtkDisplay *
***************************************************************************/
@@ -114,7 +117,7 @@ GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event,
void signalKeysChanged( GdkKeymap*, gpointer data )
{
GtkSalDisplay* pDisp = (GtkSalDisplay*)data;
- pDisp->GetKeyboardName(TRUE);
+ pDisp->GetKeyboardName(true);
}
void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data )
@@ -201,7 +204,7 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen )
}
else
{
- DBG_ERROR( "unknown screen changed size" );
+ OSL_FAIL( "unknown screen changed size" );
}
}
}
@@ -222,7 +225,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
{
GdkRectangle dest;
gdk_screen_get_monitor_geometry(pScreen, i, &dest);
- m_aXineramaScreenIndexMap[i] = addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height );
+ addXineramaScreenUnique( i, dest.x, dest.y, dest.width, dest.height );
}
m_bXinerama = m_aXineramaScreens.size() > 1;
if( ! m_aFrames.empty() )
@@ -230,7 +233,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
}
else
{
- DBG_ERROR( "monitors for non-default screen changed, extend-me" );
+ OSL_FAIL( "monitors for non-default screen changed, extend-me" );
}
}
}
@@ -252,6 +255,17 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const
(screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" );
if (sym_gdk_screen_get_primary_monitor)
n = sym_gdk_screen_get_primary_monitor( pScreen );
+#if GTK_CHECK_VERSION(2,14,0)
+ //gdk_screen_get_primary_monitor unavailable, take the first laptop monitor
+ //as the default
+ gint nMonitors = gdk_screen_get_n_monitors(pScreen);
+ for (gint i = 0; i < nMonitors; ++i)
+ {
+ if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), "LVDS", 4) == 0)
+ return m_aXineramaScreenIndexMap[i];
+ }
+#endif
+ return 0;
#endif
if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() )
n = m_aXineramaScreenIndexMap[n];
@@ -307,17 +321,17 @@ long GtkSalDisplay::Dispatch( XEvent* pEvent )
return GDK_FILTER_CONTINUE;
}
-GdkCursor* GtkSalDisplay::getFromXPM( const char *pBitmap,
- const char *pMask,
+GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap,
+ const unsigned char *pMask,
int nWidth, int nHeight,
int nXHot, int nYHot )
{
GdkScreen *pScreen = gdk_display_get_default_screen( m_pGdkDisplay );
GdkDrawable *pDrawable = GDK_DRAWABLE( gdk_screen_get_root_window (pScreen) );
GdkBitmap *pBitmapPix = gdk_bitmap_create_from_data
- ( pDrawable, pBitmap, nWidth, nHeight );
+ ( pDrawable, reinterpret_cast<const char*>(pBitmap), nWidth, nHeight );
GdkBitmap *pMaskPix = gdk_bitmap_create_from_data
- ( pDrawable, pMask, nWidth, nHeight );
+ ( pDrawable, reinterpret_cast<const char*>(pMask), nWidth, nHeight );
GdkColormap *pColormap = gdk_drawable_get_colormap( pDrawable );
GdkColor aWhite = { 0, 0xffff, 0xffff, 0xffff };
@@ -382,7 +396,7 @@ GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle )
MAP_BUILTIN( POINTER_HSIZEBAR, GDK_SB_H_DOUBLE_ARROW );
MAP_BUILTIN( POINTER_VSIZEBAR, GDK_SB_V_DOUBLE_ARROW );
- MAP_BUILTIN( POINTER_REFHAND, GDK_HAND1 );
+ MAP_BUILTIN( POINTER_REFHAND, GDK_HAND2 );
MAP_BUILTIN( POINTER_HAND, GDK_HAND2 );
MAP_BUILTIN( POINTER_PEN, GDK_PENCIL );
@@ -554,6 +568,7 @@ GtkXLib::~GtkXLib()
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "GtkXLib::~GtkXLib()\n" );
#endif
+ Yield( true, true );
StopTimer();
// sanity check: at this point nobody should be yielding, but wake them
// up anyway before the condition they're waiting on gets destroyed.
@@ -599,7 +614,7 @@ void GtkXLib::Init()
osl_getCommandArg(i, &aParam.pData );
OString aBParam( OUStringToOString( aParam, aEnc ) );
- if( aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" ) )
+ if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--display" ) ) )
{
pCmdLineAry[i+1] = g_strdup( "--display" );
osl_getCommandArg(i+1, &aParam.pData );
@@ -677,7 +692,7 @@ void GtkXLib::Init()
SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
XSync( pDisp, False );
- pKbdExtension->UseExtension( ! HasXErrorOccured() );
+ pKbdExtension->UseExtension( ! HasXErrorOccurred() );
PopXErrorLevel();
m_pGtkSalDisplay->SetKbdExtension( pKbdExtension );
@@ -1019,3 +1034,5 @@ void GtkData::Init()
pXLib_ = new GtkXLib();
pXLib_->Init();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 888e2ed883b9..95547f20d933 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -77,7 +78,7 @@ void GtkHookedYieldMutex::ThreadsLeave()
#if OSL_DEBUG_LEVEL > 1
if( mnThreadId &&
- mnThreadId != vos::OThread::getCurrentIdentifier())
+ mnThreadId != osl::Thread::getCurrentIdentifier())
fprintf( stderr, "\n\n--- A different thread owns the mutex ...---\n\n\n");
#endif
@@ -225,7 +226,7 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r
{
//Non-utf8 locales are a bad idea if trying to work with non-ascii filenames
//Decode %XX components
- rtl::OUString sDecodedUri = Uri::decode(rFileUrl.copy(7), rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
+ rtl::OUString sDecodedUri = rtl::Uri::decode(rFileUrl.copy(7), rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
//Convert back to system locale encoding
rtl::OString sSystemUrl = rtl::OUStringToOString(sDecodedUri, aSystemEnc);
//Encode to an escaped ASCII-encoded URI
@@ -256,32 +257,32 @@ GtkYieldMutex::GtkYieldMutex()
void GtkYieldMutex::acquire()
{
- vos::OThread::TThreadIdentifier aCurrentThread = vos::OThread::getCurrentIdentifier();
+ oslThreadIdentifier aCurrentThread = osl::Thread::getCurrentIdentifier();
// protect member manipulation
- OMutex::acquire();
+ SolarMutexObject::acquire();
if( mnCount > 0 && mnThreadId == aCurrentThread )
{
mnCount++;
- OMutex::release();
+ SolarMutexObject::release();
return;
}
- OMutex::release();
+ SolarMutexObject::release();
// obtain gdk mutex
gdk_threads_enter();
// obtained gdk mutex, now lock count is one by definition
- OMutex::acquire();
+ SolarMutexObject::acquire();
mnCount = 1;
mnThreadId = aCurrentThread;
- OMutex::release();
+ SolarMutexObject::release();
}
void GtkYieldMutex::release()
{
- vos::OThread::TThreadIdentifier aCurrentThread = vos::OThread::getCurrentIdentifier();
+ oslThreadIdentifier aCurrentThread = osl::Thread::getCurrentIdentifier();
// protect member manipulation
- OMutex::acquire();
+ SolarMutexObject::acquire();
// strange things happen, do nothing if we don't own the mutex
if( mnThreadId == aCurrentThread )
{
@@ -292,29 +293,29 @@ void GtkYieldMutex::release()
mnThreadId = 0;
}
}
- OMutex::release();
+ SolarMutexObject::release();
}
sal_Bool GtkYieldMutex::tryToAcquire()
{
- vos::OThread::TThreadIdentifier aCurrentThread = vos::OThread::getCurrentIdentifier();
+ oslThreadIdentifier aCurrentThread = osl::Thread::getCurrentIdentifier();
// protect member manipulation
- OMutex::acquire();
+ SolarMutexObject::acquire();
if( mnCount > 0 )
{
if( mnThreadId == aCurrentThread )
{
mnCount++;
- OMutex::release();
+ SolarMutexObject::release();
return sal_True;
}
else
{
- OMutex::release();
+ SolarMutexObject::release();
return sal_False;
}
}
- OMutex::release();
+ SolarMutexObject::release();
// HACK: gdk_threads_mutex is private, we shouldn't use it.
// how to we do a try_lock without having a gdk_threads_try_enter ?
@@ -322,10 +323,10 @@ sal_Bool GtkYieldMutex::tryToAcquire()
return sal_False;
// obtained gdk mutex, now lock count is one by definition
- OMutex::acquire();
+ SolarMutexObject::acquire();
mnCount = 1;
mnThreadId = aCurrentThread;
- OMutex::release();
+ SolarMutexObject::release();
return sal_True;
}
@@ -338,19 +339,19 @@ int GtkYieldMutex::Grab()
// is now locked again by gtk implicitly
// obtained gdk mutex, now lock count is one by definition
- OMutex::acquire();
+ SolarMutexObject::acquire();
int nRet = mnCount;
if( mnCount == 0 ) // recursive else
- mnThreadId = vos::OThread::getCurrentIdentifier();
+ mnThreadId = osl::Thread::getCurrentIdentifier();
#if OSL_DEBUG_LEVEL > 1
- else if( mnThreadId != vos::OThread::getCurrentIdentifier() )
+ else if( mnThreadId != osl::Thread::getCurrentIdentifier() )
{
fprintf( stderr, "Yield mutex grabbed in different thread !\n" );
abort();
}
#endif
mnCount = 1;
- OMutex::release();
+ SolarMutexObject::release();
return nRet;
}
@@ -358,9 +359,11 @@ void GtkYieldMutex::Ungrab( int nGrabs )
{
// this MUST only be called when leaving the callback
// that locked the mutex with Grab()
- OMutex::acquire();
+ SolarMutexObject::acquire();
mnCount = nGrabs;
if( mnCount == 0 )
mnThreadId = 0;
- OMutex::release();
+ SolarMutexObject::release();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx
index daaf4b27bc5c..2076d39cc229 100644
--- a/vcl/unx/gtk/app/gtksys.cxx
+++ b/vcl/unx/gtk/app/gtksys.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,8 +29,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+#ifdef AIX
+#define _LINUX_SOURCE_COMPAT
+#include <sys/timer.h>
+#undef _LINUX_SOURCE_COMPAT
+#endif
+
#include <unx/svunx.h>
#include <svdata.hxx>
+
#include <vcl/window.hxx>
#include <unx/gtk/gtkinst.hxx>
#include <cstdio>
@@ -46,6 +54,14 @@ GtkSalSystem::~GtkSalSystem()
{
}
+// convert ~ to indicate mnemonic to '_'
+static ByteString MapToGtkAccelerator (const String &rStr)
+{
+ String aRet( rStr );
+ aRet.SearchAndReplaceAscii("~", String::CreateFromAscii("_"));
+ return ByteString( aRet, RTL_TEXTENCODING_UTF8 );
+}
+
int GtkSalSystem::ShowNativeDialog( const String& rTitle,
const String& rMessage,
const std::list< String >& rButtons,
@@ -74,15 +90,16 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle,
int nButton = 0;
for( std::list< String >::const_iterator it = rButtons.begin(); it != rButtons.end(); ++it )
{
- ByteString aLabel( *it, RTL_TEXTENCODING_UTF8 );
-
if( nButton == nDefButton )
{
- gtk_dialog_add_button( GTK_DIALOG( mainwin ), aLabel.GetBuffer(), nButtons );
+ gtk_dialog_add_button( GTK_DIALOG( mainwin ), MapToGtkAccelerator(*it).GetBuffer(), nButtons );
gtk_dialog_set_default_response( GTK_DIALOG( mainwin ), nButtons );
}
else
+ {
+ ByteString aLabel( *it, RTL_TEXTENCODING_UTF8 );
gtk_dialog_add_button( GTK_DIALOG( mainwin ), aLabel.GetBuffer(), nButtons );
+ }
nButtons++;
}
@@ -94,3 +111,5 @@ int GtkSalSystem::ShowNativeDialog( const String& rTitle,
return nResponse;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 3657e3a0d770..ca578dccead9 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,7 +44,7 @@
#include <cmath>
#include <vector>
#include <algorithm>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
typedef struct _cairo_font_options cairo_font_options_t;
@@ -58,8 +59,7 @@ GtkSalGraphics::~GtkSalGraphics()
{
}
-
-using namespace rtl;
+using ::rtl::OUString;
/*************************************
* Cached native widget objects
@@ -101,6 +101,7 @@ struct NWFWidgetData
GtkWidget * gTreeView;
GtkWidget * gHScale;
GtkWidget * gVScale;
+ GtkWidget * gVSeparator;
NWPixmapCacheList* gNWPixmapCacheList;
NWPixmapCache* gCacheTabItems;
@@ -139,6 +140,7 @@ struct NWFWidgetData
gTreeView( NULL ),
gHScale( NULL ),
gVScale( NULL ),
+ gVSeparator ( NULL ),
gNWPixmapCacheList( NULL ),
gCacheTabItems( NULL ),
gCacheTabPages( NULL )
@@ -148,7 +150,7 @@ struct NWFWidgetData
// Keep a hash table of Widgets->default flags so that we can
// easily and quickly reset each to a default state before using
// them
-static std::hash_map<long, guint> gWidgetDefaultFlags;
+static boost::unordered_map<long, guint> gWidgetDefaultFlags;
static std::vector<NWFWidgetData> gWidgetData;
static const GtkBorder aDefDefBorder = { 1, 1, 1, 1 };
@@ -267,7 +269,7 @@ public:
void SetSize( int n)
{ delete [] pData; m_idx = 0; m_size = n; pData = new NWPixmapCacheData[m_size]; }
- int GetSize() { return m_size; }
+ int GetSize() const { return m_size; }
sal_Bool Find( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap** pPixmap );
void Fill( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap* pPixmap );
@@ -402,9 +404,6 @@ void GtkData::initNWF( void )
// draw separate buttons for toolbox dropdown items
pSVData->maNWFData.mbToolboxDropDownSeparate = true;
- // small extra border around menu items
- pSVData->maNWFData.mnMenuFormatExtraBorder = 1;
-
// draw toolbars in separate lines
pSVData->maNWFData.mbDockingAreaSeparateTB = true;
@@ -419,8 +418,15 @@ void GtkData::initNWF( void )
for( int i = 0; i < nScreens; i++ )
gWidgetData[i].gNWPixmapCacheList = new NWPixmapCacheList;
+ // small extra border around menu items
+ NWEnsureGTKMenu( 0 );
+ gint horizontal_padding = 1;
+ gtk_widget_style_get( gWidgetData[0].gMenuItemMenuWidget,
+ "horizontal_padding", &horizontal_padding,
+ (char *)NULL);
+ pSVData->maNWFData.mnMenuFormatExtraBorder = horizontal_padding;
- if( SalGetDesktopEnvironment().equalsAscii( "KDE" ) )
+ if( SalGetDesktopEnvironment().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE")) )
{
// #i97196# ensure a widget exists and the style engine was loaded
NWEnsureGTKButton( 0 );
@@ -561,10 +567,14 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar
|| (nPart==PART_THUMB_HORZ)
|| (nPart==PART_THUMB_VERT)
|| (nPart==PART_BUTTON)
+ || (nPart==PART_SEPARATOR)
)
) ||
((nType == CTRL_MENUBAR) &&
- ( (nPart==PART_ENTIRE_CONTROL) ) ) ||
+ ( (nPart==PART_ENTIRE_CONTROL)
+ || (nPart==PART_MENU_ITEM)
+ )
+ ) ||
((nType == CTRL_TOOLTIP) &&
( (nPart==PART_ENTIRE_CONTROL) ) ) ||
((nType == CTRL_MENU_POPUP) &&
@@ -587,7 +597,6 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar
)
)
return( sal_True );
-
return( sal_False );
}
@@ -859,7 +868,7 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType,
else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) )
{
// don't actually draw anything; gtk treeviews do not draw lines
- returnVal = true;
+ returnVal = TRUE;
}
else if( (nType == CTRL_SLIDER) )
{
@@ -973,6 +982,11 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType,
rNativeBoundingRegion = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion );
rNativeContentRegion = rNativeBoundingRegion;
+ //See fdo#33523, possibly makes sense to do this test for all return values
+ if (!rNativeContentRegion.GetWidth())
+ rNativeContentRegion.Right() = rNativeContentRegion.Left() + 1;
+ if (!rNativeContentRegion.GetHeight())
+ rNativeContentRegion.Bottom() = rNativeContentRegion.Top() + 1;
returnVal = sal_True;
}
if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) )
@@ -1145,7 +1159,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
clipRect.height = it->GetHeight();
// Buttons must paint opaque since some themes have alpha-channel enabled buttons
- gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+ gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&clipRect, m_pWindow, "base", x, y, w, h );
if ( (nState & CTRL_STATE_DEFAULT) && (GTK_BUTTON(gWidgetData[m_nScreen].gBtnWidget)->relief == GTK_RELIEF_NORMAL) )
@@ -1162,29 +1176,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKButton(
&clipRect, gWidgetData[m_nScreen].gBtnWidget, "button", xi, yi, wi, hi );
}
}
-#if 0 // VCL draws focus rects
- // Draw focus rect
- if ( (nState & CTRL_STATE_FOCUSED) && (nState & CTRL_STATE_ENABLED) && bDrawFocus )
- {
- if (interiorFocus)
- {
- x += gWidgetData[m_nScreen].gBtnWidget->style->xthickness + focusPad;
- y += gWidgetData[m_nScreen].gBtnWidget->style->ythickness + focusPad;
- w -= 2 * (gWidgetData[m_nScreen].gBtnWidget->style->xthickness + focusPad);
- h -= 2 * (gWidgetData[m_nScreen].gBtnWidget->style->xthickness + focusPad);
- }
- else
- {
- x -= focusWidth + focusPad;
- y -= focusWidth + focusPad;
- w += 2 * (focusWidth + focusPad);
- h += 2 * (focusWidth + focusPad);
- }
- if ( !interiorFocus )
- gtk_paint_focus( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, stateType, &clipRect,
- gWidgetData[m_nScreen].gBtnWidget, "button", x, y, w, h );
- }
-#endif
return( sal_True );
}
@@ -1478,12 +1469,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
// Make sure the thumb is at least the default width (so we don't get tiny thumbs),
// but if the VCL gives us a size smaller than the theme's default thumb size,
// honor the VCL size
-#if 0
- if ( (thumbRect.GetWidth() < min_slider_length)
- && ((scrollbarRect.GetWidth()-button1BoundRect.GetWidth()-button2BoundRect.GetWidth()) > min_slider_length) )
- thumbRect.SetSize( Size( min_slider_length, thumbRect.GetHeight() ) );
-#endif
-
thumbRect.Right() += magic;
// Center vertically in the track
thumbRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
@@ -1525,14 +1510,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
button22BoundRect.SetSize( Size( slider_width, stepper_size ) );
thumbRect.Right() = thumbRect.Left() + slider_width - 1;
-#if 0
- // Make sure the thumb is at least the default width (so we don't get tiny thumbs),
- // but if the VCL gives us a size smaller than the theme's default thumb size,
- // honor the VCL size
- if ( (thumbRect.GetHeight() < min_slider_length)
- && ((scrollbarRect.GetHeight()-button1BoundRect.GetHeight()-button2BoundRect.GetHeight()) > min_slider_length) )
- thumbRect.SetSize( Size( thumbRect.GetWidth(), min_slider_length ) );
-#endif
thumbRect.Bottom() += magic;
// Center horizontally in the track
@@ -1578,8 +1555,12 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType );
style = GTK_WIDGET( scrollbarWidget )->style;
+ gtk_style_apply_default_background( m_pWindow->style, gdkDrawable, TRUE,
+ GTK_STATE_NORMAL, gdkRect,
+ x, y, w, h );
+
// ----------------- TROUGH
- gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable,
+ gtk_paint_flat_box( m_pWindow->style, gdkDrawable,
GTK_STATE_NORMAL, GTK_SHADOW_NONE, gdkRect,
m_pWindow, "base", x, y,
w, h );
@@ -1852,10 +1833,6 @@ static void NWPaintOneEditBox( int nScreen,
NWEnsureGTKScrolledWindow( nScreen );
NWConvertVCLStateToGTKState( nState, &stateType, &shadowType );
- /* border's shadowType for gtk entries is always GTK_SHADOW_IN (see gtkentry.c)
- shadowType = GTK_SHADOW_IN;
- */
-
switch ( nType )
{
case CTRL_SPINBOX:
@@ -1887,7 +1864,7 @@ static void NWPaintOneEditBox( int nScreen,
}
NWSetWidgetState( widget, nState, stateType );
- gtk_paint_flat_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE,
+ gtk_paint_box( pBGWidget->style, gdkDrawable, stateType, GTK_SHADOW_NONE,
gdkRect, pBGWidget, "entry_bg",
aEditBoxRect.Left(), aEditBoxRect.Top(),
aEditBoxRect.GetWidth(), aEditBoxRect.GetHeight() );
@@ -2140,7 +2117,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
nState, aValue, rCaption );
// Buttons must paint opaque since some themes have alpha-channel enabled buttons
- gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+ gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&clipRect, m_pWindow, "base",
x+(buttonRect.Left() - pixmapRect.Left()),
y+(buttonRect.Top() - pixmapRect.Top()),
@@ -2281,7 +2258,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
// Allow the tab to draw a right border if needed
tabRect.Right() -= 1;
- // #129732# avoid degenerate cases which might lead to crashes
+ // avoid degenerate cases which might lead to crashes
if( tabRect.GetWidth() <= 1 || tabRect.GetHeight() <= 1 )
return false;
}
@@ -2297,9 +2274,6 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
return NWRenderPixmapToScreen( pixmap, pixmapRect );
}
-
-// gtk_widget_set_state( gWidgetData[m_nScreen].gNotebookWidget, stateType );
-
pixmap = gdk_pixmap_new( NULL, pixmapRect.GetWidth(), pixmapRect.GetHeight(),
GetX11SalData()->GetDisplay()->GetVisual( m_nScreen ).GetDepth() );
GdkRectangle paintRect;
@@ -2332,8 +2306,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
if ( nState & CTRL_STATE_SELECTED )
{
- gtk_paint_flat_box( gWidgetData[m_nScreen].gNotebookWidget->style, pixmap, stateType, GTK_SHADOW_NONE, NULL, m_pWindow,
- (char *)"base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 );
+ gtk_paint_flat_box( m_pWindow->style, pixmap, stateType, GTK_SHADOW_NONE, NULL, m_pWindow,
+ "base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 );
}
break;
@@ -2422,7 +2396,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
if ( nPart != PART_WINDOW )
{
// Listboxes must paint opaque since some themes have alpha-channel enabled bodies
- gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
+ gtk_paint_flat_box( m_pWindow->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
&clipRect, m_pWindow, "base", x, y,
pixmapRect.GetWidth(), pixmapRect.GetHeight() );
gtk_paint_box( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect,
@@ -2596,6 +2570,21 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar(
pButtonWidget, "button", x, y, w, h );
}
}
+ else if(nPart == PART_SEPARATOR )
+ {
+ gtk_paint_vline( gWidgetData[m_nScreen].gVSeparator->style,
+ gdkDrawable,
+ GTK_STATE_NORMAL,
+ &clipRect,
+ gWidgetData[m_nScreen].gVSeparator,
+ "vseparator",
+ y + 4, y + h - 8 /* -2 and -4 is a dirty
+ * hack, to fit most gtk
+ * style, but it must be
+ * fixed, FIXME */,
+ x
+ );
+ }
}
return( sal_True );
@@ -2651,7 +2640,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar(
if ( nState & CTRL_STATE_ENABLED )
GTK_WIDGET_SET_FLAGS( gWidgetData[m_nScreen].gMenubarWidget, GTK_SENSITIVE );
- // #118704# for translucent menubar styles paint background first
+ // for translucent menubar styles paint background first
gtk_paint_flat_box( gWidgetData[m_nScreen].gMenubarWidget->style,
gdkDrawable,
GTK_STATE_NORMAL,
@@ -2669,6 +2658,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar(
"menubar",
x, y, w, h );
}
+
else if( nPart == PART_MENU_ITEM )
{
if( nState & (CTRL_STATE_SELECTED|CTRL_STATE_ROLLOVER) )
@@ -2697,9 +2687,10 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu(
const OUString& )
{
// #i50745# gtk does not draw disabled menu entries (and crux theme
- // even crashes), draw them using vcl functionality.
- if( nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) )
- return sal_False;
+ // even crashes) in very old (Fedora Core 4 vintage) gtk's
+ if (gtk_major_version <= 2 && gtk_minor_version <= 8 &&
+ nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) )
+ return sal_True;
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2738,7 +2729,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu(
if( nPart == PART_ENTIRE_CONTROL )
{
- // #118704# for translucent menubar styles paint background first
+ // for translucent menubar styles paint background first
gtk_paint_flat_box( gWidgetData[m_nScreen].gMenuWidget->style,
gdkDrawable,
GTK_STATE_NORMAL,
@@ -3056,43 +3047,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKSlider(
slider_width, slider_length,
eOri );
}
- #if 0
- // paint background
- gtk_paint_flat_box( gWidgetData[m_nScreen].gProgressBar->style,
- pixDrawable,
- GTK_STATE_NORMAL,
- GTK_SHADOW_NONE,
- NULL,
- gWidgetData[m_nScreen].gProgressBar,
- "trough",
- 0, 0, w, h );
- if( nProgressWidth > 0 )
- {
- // paint progress
- if( Application::GetSettings().GetLayoutRTL() )
- {
- gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style,
- pixDrawable,
- GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
- NULL,
- gWidgetData[m_nScreen].gProgressBar,
- "bar",
- w-nProgressWidth, 0, nProgressWidth, h
- );
- }
- else
- {
- gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style,
- pixDrawable,
- GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
- NULL,
- gWidgetData[m_nScreen].gProgressBar,
- "bar",
- 0, 0, nProgressWidth, h
- );
- }
- }
- #endif
+
sal_Bool bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle );
g_object_unref( pixmap );
@@ -3382,6 +3337,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// menu disabled entries handling
aStyleSet.SetSkipDisabledInMenus( sal_True );
+ aStyleSet.SetAcceleratorsInContextMenus( sal_False );
// menu colors
GtkStyle* pMenuStyle = gtk_widget_get_style( gWidgetData[m_nScreen].gMenuWidget );
GtkStyle* pMenuItemStyle = gtk_rc_get_style( gWidgetData[m_nScreen].gMenuItemMenuWidget );
@@ -3507,8 +3463,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetAppFont( aFont );
aStyleSet.SetHelpFont( aFont );
- aStyleSet.SetTitleFont( aFont );
- aStyleSet.SetFloatTitleFont( aFont );
aStyleSet.SetMenuFont( aFont );
aStyleSet.SetToolFont( aFont );
aStyleSet.SetLabelFont( aFont );
@@ -3519,6 +3473,10 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetIconFont( aFont );
aStyleSet.SetGroupFont( aFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSet.SetTitleFont( aFont );
+ aStyleSet.SetFloatTitleFont( aFont );
+
// get cursor blink time
GtkSettings *pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gEditBoxWidget );
gboolean blink = false;
@@ -3539,7 +3497,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
gboolean showmenuicons = true;
pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gImageMenuItem );
g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL );
- aStyleSet.SetUseImagesInMenus( showmenuicons );
+ aStyleSet.SetPreferredUseImagesInMenus( showmenuicons );
// set scrollbar settings
gint slider_width = 14;
@@ -3562,13 +3520,11 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetPreferredSymbolsStyleName( OUString::createFromAscii( pIconThemeName ) );
g_free( pIconThemeName );
- // FIXME: need some way of fetching toolbar icon size.
-// aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_SMALL );
+ aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE );
const cairo_font_options_t* pNewOptions = NULL;
if( GdkScreen* pScreen = gdk_display_get_screen( gdk_display_get_default(), m_nScreen ) )
{
-//#if !GTK_CHECK_VERSION(2,8,1)
#if !GTK_CHECK_VERSION(2,9,0)
static cairo_font_options_t* (*gdk_screen_get_font_options)(GdkScreen*) =
(cairo_font_options_t*(*)(GdkScreen*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" );
@@ -3936,6 +3892,8 @@ static void NWEnsureGTKToolbar( int nScreen )
NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarWidget, nScreen );
gWidgetData[nScreen].gToolbarButtonWidget = gtk_button_new();
gWidgetData[nScreen].gToolbarToggleWidget = gtk_toggle_button_new();
+ gWidgetData[nScreen].gVSeparator = gtk_vseparator_new();
+ NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVSeparator, nScreen );
GtkReliefStyle aRelief = GTK_RELIEF_NORMAL;
gtk_widget_ensure_style( gWidgetData[nScreen].gToolbarWidget );
@@ -4065,3 +4023,5 @@ static void NWEnsureGTKSlider( int nScreen )
NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVScale, nScreen );
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 5f4a2bda25f8..d49d0ae7921d 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,6 +51,7 @@
#include <vcl/bitmapex.hxx>
#include <impbmp.hxx>
#include <svids.hrc>
+#include <sal/macros.h>
#include <algorithm>
@@ -210,6 +212,9 @@ static sal_uInt16 GetKeyCode( guint keyval )
case GDK_asciitilde: nCode = KEY_TILDE; break;
case GDK_leftsinglequotemark:
case GDK_quoteleft: nCode = KEY_QUOTELEFT; break;
+ case GDK_bracketleft: nCode = KEY_BRACKETLEFT; break;
+ case GDK_bracketright: nCode = KEY_BRACKETRIGHT; break;
+ case GDK_semicolon: nCode = KEY_SEMICOLON; break;
// some special cases, also see saldisp.cxx
// - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000
case 0x1000FF02: // apXK_Copy
@@ -413,7 +418,7 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
GtkSalFrame::~GtkSalFrame()
{
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); ++i )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); ++i )
{
if( !m_aGraphics[i].pGraphics )
continue;
@@ -553,7 +558,6 @@ void GtkSalFrame::InitCommon()
// init members
m_pCurrentCursor = NULL;
m_nKeyModifiers = 0;
- m_bSingleAltPress = false;
m_bFullscreen = false;
m_nState = GDK_WINDOW_STATE_WITHDRAWN;
m_nVisibility = GDK_VISIBILITY_FULLY_OBSCURED;
@@ -792,6 +796,8 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
// force wm class hint
m_nExtStyle = ~0;
+ if (m_pParent)
+ m_sWMClass = m_pParent->m_sWMClass;
SetExtendedFrameStyle( 0 );
if( m_pParent && m_pParent->m_pWindow && ! isChild() )
@@ -860,7 +866,6 @@ void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle )
{
/* #i99360# ugly workaround an X11 library bug */
nUserTime= getDisplay()->GetLastUserEventTime( true );
- // nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window);
}
lcl_set_user_time(GTK_WIDGET(m_pWindow)->window, nUserTime);
}
@@ -975,25 +980,10 @@ void GtkSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
if( nStyle != m_nExtStyle && ! isChild() )
{
m_nExtStyle = nStyle;
- if( GTK_WIDGET_REALIZED( m_pWindow ) )
- {
- XClassHint* pClass = XAllocClassHint();
- rtl::OString aResHint = X11SalData::getFrameResName( m_nExtStyle );
- pClass->res_name = const_cast<char*>(aResHint.getStr());
- pClass->res_class = const_cast<char*>(X11SalData::getFrameClassName());
- XSetClassHint( getDisplay()->GetDisplay(),
- GDK_WINDOW_XWINDOW(m_pWindow->window),
- pClass );
- XFree( pClass );
- }
- else
- gtk_window_set_wmclass( GTK_WINDOW(m_pWindow),
- X11SalData::getFrameResName( m_nExtStyle ),
- X11SalData::getFrameClassName() );
+ updateWMClass();
}
}
-
SalGraphics* GtkSalFrame::GetGraphics()
{
if( m_pWindow )
@@ -1121,13 +1111,6 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
sal_uInt16 nOffsets[2] = { SV_ICON_SMALL_START, SV_ICON_LARGE_START };
sal_uInt16 nIndex;
- // Use high contrast icons where appropriate
- if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- nOffsets[0] = SV_ICON_LARGE_HC_START;
- nOffsets[1] = SV_ICON_SMALL_HC_START;
- }
-
for( nIndex = 0; nIndex < sizeof(nOffsets)/ sizeof(sal_uInt16); nIndex++ )
{
// #i44723# workaround gcc temporary problem
@@ -1158,7 +1141,7 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
aMask = AlphaMask( aIcon.GetMask() );
break;
default:
- DBG_ERROR( "unhandled transparent type" );
+ OSL_FAIL( "unhandled transparent type" );
break;
}
}
@@ -1296,7 +1279,6 @@ void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible );
if( bVisible )
{
- SessionManagerClient::open(); // will simply return after the first time
initClientId();
getDisplay()->startupNotificationCompleted();
@@ -1632,8 +1614,6 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState )
sal_uInt16 nPosSizeFlags = 0;
long nX = pState->mnX - (m_pParent ? m_pParent->maGeometry.nX : 0);
long nY = pState->mnY - (m_pParent ? m_pParent->maGeometry.nY : 0);
- long nWidth = pState->mnWidth;
- long nHeight = pState->mnHeight;
if( pState->mnMask & SAL_FRAMESTATE_MASK_X )
nPosSizeFlags |= SAL_FRAME_POSSIZE_X;
else
@@ -1644,12 +1624,8 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState )
nY = maGeometry.nY - (m_pParent ? m_pParent->maGeometry.nY : 0);
if( pState->mnMask & SAL_FRAMESTATE_MASK_WIDTH )
nPosSizeFlags |= SAL_FRAME_POSSIZE_WIDTH;
- else
- nWidth = maGeometry.nWidth;
if( pState->mnMask & SAL_FRAMESTATE_MASK_HEIGHT )
nPosSizeFlags |= SAL_FRAME_POSSIZE_HEIGHT;
- else
- nHeight = maGeometry.nHeight;
SetPosSize( nX, nY, pState->mnWidth, pState->mnHeight, nPosSizeFlags );
}
if( pState->mnMask & SAL_FRAMESTATE_MASK_STATE && ! isChild() )
@@ -1740,7 +1716,7 @@ void GtkSalFrame::moveToScreen( int nScreen )
m_aSystemData.pAppContext = NULL;
m_aSystemData.aShellWindow = m_aSystemData.aWindow;
// update graphics if necessary
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ )
{
if( m_aGraphics[i].bInUse )
m_aGraphics[i].pGraphics->SetDrawable( GDK_WINDOW_XWINDOW(m_pWindow->window), m_nScreen );
@@ -1792,6 +1768,40 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
}
}
+void GtkSalFrame::updateWMClass()
+{
+ rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US);
+ const char *pResClass = aResClass.getLength() ? aResClass.getStr() : X11SalData::getFrameClassName();
+
+ if( GTK_WIDGET_REALIZED( m_pWindow ) )
+ {
+ XClassHint* pClass = XAllocClassHint();
+ rtl::OString aResName = X11SalData::getFrameResName( m_nExtStyle );
+ pClass->res_name = const_cast<char*>(aResName.getStr());
+ pClass->res_class = const_cast<char*>(pResClass);
+ XSetClassHint( getDisplay()->GetDisplay(),
+ GDK_WINDOW_XWINDOW(m_pWindow->window),
+ pClass );
+ XFree( pClass );
+ }
+ else
+ gtk_window_set_wmclass( GTK_WINDOW(m_pWindow),
+ X11SalData::getFrameResName( m_nExtStyle ),
+ pResClass );
+}
+
+void GtkSalFrame::SetApplicationID( const rtl::OUString &rWMClass )
+{
+ if( rWMClass != m_sWMClass && ! isChild() )
+ {
+ m_sWMClass = rWMClass;
+ updateWMClass();
+
+ for( std::list< GtkSalFrame* >::iterator it = m_aChildren.begin(); it != m_aChildren.end(); ++it )
+ (*it)->SetApplicationID(rWMClass);
+ }
+}
+
void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen )
{
if( m_pWindow && ! isChild() )
@@ -2077,7 +2087,6 @@ void GtkSalFrame::ToTop( sal_uInt16 nFlags )
gtk_window_present( GTK_WINDOW(m_pWindow) );
else
{
- // gdk_window_focus( m_pWindow->window, gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window) );
/* #i99360# ugly workaround an X11 library bug */
guint32 nUserTime= getDisplay()->GetLastUserEventTime( true );
gdk_window_focus( m_pWindow->window, nUserTime );
@@ -2124,6 +2133,8 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents )
{
+ static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" );
+
if( m_pWindow )
{
if( bGrab )
@@ -2146,9 +2157,10 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents )
{
const int nMask = ( GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK );
- gdk_pointer_grab( m_pWindow->window, bOwnerEvents,
- (GdkEventMask) nMask, NULL, m_pCurrentCursor,
- GDK_CURRENT_TIME );
+ if( !pEnv || !*pEnv )
+ gdk_pointer_grab( m_pWindow->window, bOwnerEvents,
+ (GdkEventMask) nMask, NULL, m_pCurrentCursor,
+ GDK_CURRENT_TIME );
}
else
{
@@ -2158,23 +2170,25 @@ void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents )
//
// this is of course a bad hack, especially as we cannot
// set the right cursor this way
- XGrabPointer( getDisplay()->GetDisplay(),
- GDK_WINDOW_XWINDOW( m_pWindow->window),
- bOwnerEvents,
- PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
- GrabModeAsync,
- GrabModeAsync,
- None,
- None,
- CurrentTime
- );
+ if( !pEnv || !*pEnv )
+ XGrabPointer( getDisplay()->GetDisplay(),
+ GDK_WINDOW_XWINDOW( m_pWindow->window),
+ bOwnerEvents,
+ PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ None,
+ None,
+ CurrentTime
+ );
}
}
else
{
// Two GdkDisplays may be open
- gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME);
+ if( !pEnv || !*pEnv )
+ gdk_display_pointer_ungrab( getGdkDisplay(), GDK_CURRENT_TIME);
}
}
}
@@ -2195,7 +2209,7 @@ void GtkSalFrame::SetPointerPos( long nX, long nY )
GdkScreen *pScreen = gtk_window_get_screen( GTK_WINDOW(pFrame->m_pWindow) );
GdkDisplay *pDisplay = gdk_screen_get_display( pScreen );
- /* #87921# when the application tries to center the mouse in the dialog the
+ /* when the application tries to center the mouse in the dialog the
* window isn't mapped already. So use coordinates relative to the root window.
*/
unsigned int nWindowLeft = maGeometry.nX + nX;
@@ -2256,6 +2270,18 @@ SalFrame::SalPointerState GtkSalFrame::GetPointerState()
return aState;
}
+SalFrame::SalIndicatorState GtkSalFrame::GetIndicatorState()
+{
+ SalIndicatorState aState;
+ aState.mnState = GetX11SalData()->GetDisplay()->GetIndicatorState();
+ return aState;
+}
+
+void GtkSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode )
+{
+ GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode);
+}
+
void GtkSalFrame::SetInputContext( SalInputContext* pContext )
{
if( ! pContext )
@@ -2389,7 +2415,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc
}
// free xrender resources
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ )
if( m_aGraphics[i].bInUse )
m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen );
@@ -2424,7 +2450,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc
}
// update graphics
- for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aGraphics); i++ )
{
if( m_aGraphics[i].bInUse )
{
@@ -2812,13 +2838,15 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
GTK_YIELD_GRAB();
+ X11SalInstance *pSalInstance =
+ static_cast< X11SalInstance* >(GetSalData()->m_pInstance);
+
// check if printers have changed (analogous to salframe focus handler)
- vcl_sal::PrinterUpdate::update();
+ pSalInstance->updatePrinterUpdate();
if( !pEvent->in )
{
pThis->m_nKeyModifiers = 0;
- pThis->m_bSingleAltPress = false;
pThis->m_bSendModChangeOnRelease = false;
}
@@ -2826,9 +2854,8 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
pThis->m_pIMHandler->focusChanged( pEvent->in );
// ask for changed printers like generic implementation
- if( pEvent->in )
- if( static_cast< X11SalInstance* >(GetSalData()->m_pInstance)->isPrinterInit() )
- vcl_sal::PrinterUpdate::update();
+ if( pEvent->in && pSalInstance->isPrinterInit() )
+ pSalInstance->updatePrinterUpdate();
// FIXME: find out who the hell steals the focus from our frame
// while we have the pointer grabbed, this should not come from
@@ -3022,10 +3049,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
if( pThis->m_pIMHandler )
{
if( pThis->m_pIMHandler->handleKeyEvent( pEvent ) )
- {
- pThis->m_bSingleAltPress = false;
return sal_True;
- }
}
GTK_YIELD_GRAB();
@@ -3112,36 +3136,6 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
pThis->CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt );
- if( ! aDel.isDeleted() )
- {
- // emulate KEY_MENU
- if( ( pEvent->keyval == GDK_Alt_L || pEvent->keyval == GDK_Alt_R ) &&
- ( nModCode & ~(KEY_MOD3|KEY_MOD2)) == 0 )
- {
- if( pEvent->type == GDK_KEY_PRESS )
- pThis->m_bSingleAltPress = true;
-
- else if( pThis->m_bSingleAltPress )
- {
- SalKeyEvent aKeyEvt;
-
- aKeyEvt.mnCode = KEY_MENU | nModCode;
- aKeyEvt.mnRepeat = 0;
- aKeyEvt.mnTime = pEvent->time;
- aKeyEvt.mnCharCode = 0;
-
- // simulate KEY_MENU
- pThis->CallCallback( SALEVENT_KEYINPUT, &aKeyEvt );
- if( ! aDel.isDeleted() )
- {
- pThis->CallCallback( SALEVENT_KEYUP, &aKeyEvt );
- pThis->m_bSingleAltPress = false;
- }
- }
- }
- else
- pThis->m_bSingleAltPress = false;
- }
}
else
{
@@ -3154,10 +3148,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
(pEvent->type == GDK_KEY_PRESS),
false );
if( ! aDel.isDeleted() )
- {
pThis->m_bSendModChangeOnRelease = false;
- pThis->m_bSingleAltPress = false;
- }
}
if( !aDel.isDeleted() && pThis->m_pIMHandler )
@@ -3543,6 +3534,10 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
{
GTK_YIELD_GRAB();
+ const bool bWasPreedit =
+ (pThis->m_aInputEvent.mpTextAttr != 0) ||
+ pThis->m_bPreeditJustChanged;
+
pThis->m_aInputEvent.mnTime = 0;
pThis->m_aInputEvent.mpTextAttr = 0;
pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 );
@@ -3566,9 +3561,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
* or because there never was a preedit.
*/
bool bSingleCommit = false;
- bool bWasPreedit =
- (pThis->m_aInputEvent.mpTextAttr != 0) ||
- pThis->m_bPreeditJustChanged;
if( ! bWasPreedit
&& pThis->m_aInputEvent.maText.Len() == 1
&& ! pThis->m_aPrevKeyPresses.empty()
@@ -3756,11 +3748,18 @@ uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText()
uno::Reference<accessibility::XAccessibleEditableText> xText;
Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin;
if (!pFocusWin)
- return xText;
+ return xText;
- uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible( true ) );
- if (xAccessible.is())
- xText = FindFocus(xAccessible->getAccessibleContext());
+ try
+ {
+ uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible( true ) );
+ if (xAccessible.is())
+ xText = FindFocus(xAccessible->getAccessibleContext());
+ }
+ catch(const uno::Exception& e)
+ {
+ g_warning( "Exception in getting input method surrounding text" );
+ }
return xText;
}
@@ -3792,9 +3791,7 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint
if (xText.is())
{
sal_uInt32 nPosition = xText->getCaretPosition();
- // --> OD 2010-06-04 #i111768# - apply patch from kstribley:
- // range checking
-// xText->deleteText(nPosition + offset, nPosition + offset + nchars);
+ // #i111768# range checking
sal_Int32 nDeletePos = nPosition + offset;
sal_Int32 nDeleteEnd = nDeletePos + nchars;
if (nDeletePos < 0)
@@ -3805,9 +3802,10 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint
nDeleteEnd = xText->getCharacterCount();
xText->deleteText(nDeletePos, nDeleteEnd);
- // <--
return sal_True;
}
return sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/window/gtkobject.cxx b/vcl/unx/gtk/window/gtkobject.cxx
index 68c8f1f1286d..04dcde7ff4e3 100644
--- a/vcl/unx/gtk/window/gtkobject.cxx
+++ b/vcl/unx/gtk/window/gtkobject.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +29,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+#ifdef AIX
+#define _LINUX_SOURCE_COMPAT
+#include <sys/timer.h>
+#undef _LINUX_SOURCE_COMPAT
+#endif
+
#include <unx/gtk/gtkobject.hxx>
#include <unx/gtk/gtkframe.hxx>
#include <unx/gtk/gtkdata.hxx>
@@ -210,7 +217,16 @@ void GtkSalObject::signalDestroy( GtkObject* pObj, gpointer object )
}
}
+void GtkSalObject::SetForwardKey( sal_Bool bEnable )
+{
+ if( bEnable )
+ gtk_widget_add_events( GTK_WIDGET( m_pSocket ), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE );
+ else
+ gtk_widget_set_events( GTK_WIDGET( m_pSocket ), ~(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE) & gtk_widget_get_events( GTK_WIDGET( m_pSocket ) ) );
+}
+
void GtkSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ )
{
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpbmp.cxx b/vcl/unx/headless/svpbmp.cxx
index f96da7b0c12b..2d8309af5eba 100644
--- a/vcl/unx/headless/svpbmp.cxx
+++ b/vcl/unx/headless/svpbmp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -116,6 +117,11 @@ bool SvpSalBitmap::Create( const SalBitmap& /*rSalBmp*/,
return false;
}
+bool SvpSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ )
+{
+ return false;
+}
+
void SvpSalBitmap::Destroy()
{
m_aBitmap.reset();
@@ -321,3 +327,4 @@ bool SvpSalBitmap::GetSystemData( BitmapSystemData& )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpbmp.hxx b/vcl/unx/headless/svpbmp.hxx
index e5a40320bc4c..b3adb3b9951f 100644
--- a/vcl/unx/headless/svpbmp.hxx
+++ b/vcl/unx/headless/svpbmp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,6 +54,9 @@ public:
SalGraphics* pGraphics );
virtual bool Create( const SalBitmap& rSalBmp,
sal_uInt16 nNewBitCount );
+ virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
+ Size& rSize,
+ bool bMask = false );
virtual void Destroy();
virtual Size GetSize() const;
virtual sal_uInt16 GetBitCount() const;
@@ -64,3 +68,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpdummies.cxx b/vcl/unx/headless/svpdummies.cxx
index 162b3c5f755c..3bf1a4da9cc0 100644
--- a/vcl/unx/headless/svpdummies.cxx
+++ b/vcl/unx/headless/svpdummies.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -115,3 +116,4 @@ int SvpSalSystem::ShowNativeMessageBox( const String&,
return 0;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpdummies.hxx b/vcl/unx/headless/svpdummies.hxx
index cec6540adc79..bc46e9b22f70 100644
--- a/vcl/unx/headless/svpdummies.hxx
+++ b/vcl/unx/headless/svpdummies.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -95,3 +96,5 @@ class SvpSalSystem : public SalSystem
#endif // _SVP_SVPDUMMIES_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpelement.cxx b/vcl/unx/headless/svpelement.cxx
index 4041e2f7739a..b6bf4822b576 100644
--- a/vcl/unx/headless/svpelement.cxx
+++ b/vcl/unx/headless/svpelement.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,6 +30,7 @@
#include <basebmp/scanlineformats.hxx>
#include <tools/debug.hxx>
+#include <osl/diagnose.h>
#if defined WITH_SVP_LISTENING
#include <osl/thread.h>
@@ -42,7 +44,7 @@
#include "svpframe.hxx"
#include <list>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <sys/types.h>
#include <sys/socket.h>
@@ -173,14 +175,14 @@ IMPL_LINK( SvpElementContainer, processRequest, void*, pSocket )
rtl::OString aCommand( aBuf.makeStringAndClear() );
if( aCommand.compareTo( "list", 4 ) == 0 )
{
- std::hash_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash > aMap;
+ boost::unordered_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash > aMap;
for( std::list< SvpElement* >::const_iterator it = m_aElements.begin();
it != m_aElements.end(); ++it )
{
std::list<SvpElement*>& rList = aMap[matchType(*it)];
rList.push_back( *it );
}
- for( std::hash_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash>::const_iterator hash_it = aMap.begin();
+ for( boost::unordered_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash>::const_iterator hash_it = aMap.begin();
hash_it != aMap.end(); ++hash_it )
{
aAnswer.append( "ElementType: " );
@@ -282,10 +284,11 @@ sal_uInt32 SvpElement::getBitCountFromScanlineFormat( sal_Int32 nFormat )
nBitCount = 32;
break;
default:
- DBG_ERROR( "unsupported basebmp format" );
+ OSL_FAIL( "unsupported basebmp format" );
break;
}
return nBitCount;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpelement.hxx b/vcl/unx/headless/svpelement.hxx
index 0706e75af9fe..c7f647cf3a03 100644
--- a/vcl/unx/headless/svpelement.hxx
+++ b/vcl/unx/headless/svpelement.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -44,3 +45,5 @@ class SvpElement
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx
index 9fb54cf29ef1..1b8455557fac 100644
--- a/vcl/unx/headless/svpframe.cxx
+++ b/vcl/unx/headless/svpframe.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -415,6 +416,17 @@ SalFrame::SalPointerState SvpSalFrame::GetPointerState()
return aState;
}
+SalFrame::SalIndicatorState SvpSalFrame::GetIndicatorState()
+{
+ SalIndicatorState aState;
+ aState.mnState = 0;
+ return aState;
+}
+
+void SvpSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ )
+{
+}
+
void SvpSalFrame::SetParent( SalFrame* pNewParent )
{
if( m_pParent )
@@ -447,3 +459,4 @@ void SvpSalFrame::EndSetClipRegion()
{
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpframe.hxx b/vcl/unx/headless/svpframe.hxx
index 0e9a78a4562e..e57381780f61 100644
--- a/vcl/unx/headless/svpframe.hxx
+++ b/vcl/unx/headless/svpframe.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -112,6 +113,8 @@ public:
virtual void Beep( SoundType eSoundType );
virtual const SystemEnvData* GetSystemData() const;
virtual SalPointerState GetPointerState();
+ virtual SalIndicatorState GetIndicatorState();
+ virtual void SimulateKeyPress( sal_uInt16 nKeyCode );
virtual void SetParent( SalFrame* pNewParent );
virtual bool SetPluginParent( SystemParentData* pNewParent );
virtual void SetBackgroundBitmap( SalBitmap* pBitmap );
@@ -122,5 +125,8 @@ public:
/*TODO: functional implementation */
virtual void SetScreenNumber( unsigned int nScreen ) { (void)nScreen; }
+ virtual void SetApplicationID(const rtl::OUString &rApplicationID) { (void) rApplicationID; }
};
#endif // _SVP_SVPFRAME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index 3a72e126e4d2..0a7041661d4e 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -63,7 +64,7 @@ rDevice
aBuf.append( "debug" );
mkdir( aBuf.getStr(), 0777 );
aBuf.append( "/" );
- aBuf.append( sal_Int64(reinterpret_cast<sal_uInt32>(rDevice.get())), 16 );
+ aBuf.append( sal_Int64(reinterpret_cast<sal_IntPtr>(rDevice.get())), 16 );
mkdir( aBuf.getStr(), 0777 );
aBuf.append( "/bmp" );
aBuf.append( sal_Int32(dbgStreamNum++) );
@@ -132,7 +133,7 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY )
rDPIX = rDPIY = 96;
}
-sal_uInt16 SvpSalGraphics::GetBitCount()
+sal_uInt16 SvpSalGraphics::GetBitCount() const
{
return SvpElement::getBitCountFromScanlineFormat( m_aDevice->getScanlineFormat() );
}
@@ -570,7 +571,7 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
aRes.hDrawable = 0;
- aRes.pRenderFormat = 0;
+ aRes.pXRenderFormat = 0;
return aRes;
}
@@ -579,3 +580,4 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
return false;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index 217d50940b11..4b6bcb58c9b0 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -65,7 +66,7 @@ public:
// overload all pure virtual methods
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
- virtual sal_uInt16 GetBitCount();
+ virtual sal_uInt16 GetBitCount() const;
virtual long GetGraphicsWidth() const;
virtual void ResetClipRegion();
@@ -87,6 +88,7 @@ public:
virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
virtual const ImplFontCharMap* GetImplFontCharMap() const;
+ virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
virtual void GetDevFontList( ImplDevFontList* );
virtual void GetDevFontSubstList( OutputDevice* );
virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
@@ -169,3 +171,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx
index ebd0ee457bd5..e563e95821f0 100644
--- a/vcl/unx/headless/svpinst.cxx
+++ b/vcl/unx/headless/svpinst.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,6 +44,7 @@
#include <salframe.hxx>
#include <svdata.hxx>
#include <saldatabasic.hxx>
+#include <vcl/solarmutex.hxx>
// plugin factory function
extern "C"
@@ -296,7 +298,7 @@ SalBitmap* SvpSalInstance::CreateSalBitmap()
return new SvpSalBitmap();
}
-vos::IMutex* SvpSalInstance::GetYieldMutex()
+osl::SolarMutex* SvpSalInstance::GetYieldMutex()
{
return &m_aYieldMutex;
}
@@ -304,7 +306,7 @@ vos::IMutex* SvpSalInstance::GetYieldMutex()
sal_uLong SvpSalInstance::ReleaseYieldMutex()
{
if ( m_aYieldMutex.GetThreadId() ==
- vos::OThread::getCurrentIdentifier() )
+ osl::Thread::getCurrentIdentifier() )
{
sal_uLong nCount = m_aYieldMutex.GetAcquireCount();
sal_uLong n = nCount;
@@ -333,8 +335,7 @@ bool SvpSalInstance::CheckYieldMutex()
{
bool bRet = true;
- if ( m_aYieldMutex.GetThreadId() !=
- vos::OThread::getCurrentIdentifier() )
+ if ( m_aYieldMutex.GetThreadId() != ::osl::Thread::getCurrentIdentifier() )
{
bRet = false;
}
@@ -460,27 +461,27 @@ SvpSalYieldMutex::SvpSalYieldMutex()
void SvpSalYieldMutex::acquire()
{
- OMutex::acquire();
- mnThreadId = vos::OThread::getCurrentIdentifier();
+ SolarMutexObject::acquire();
+ mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
}
void SvpSalYieldMutex::release()
{
- if ( mnThreadId == vos::OThread::getCurrentIdentifier() )
+ if ( mnThreadId == osl::Thread::getCurrentIdentifier() )
{
if ( mnCount == 1 )
mnThreadId = 0;
mnCount--;
}
- OMutex::release();
+ SolarMutexObject::release();
}
sal_Bool SvpSalYieldMutex::tryToAcquire()
{
- if ( OMutex::tryToAcquire() )
+ if ( SolarMutexObject::tryToAcquire() )
{
- mnThreadId = vos::OThread::getCurrentIdentifier();
+ mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
return sal_True;
}
@@ -532,3 +533,4 @@ void SvpSalTimer::Start( sal_uLong nMS )
m_pInstance->StartTimer( nMS );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx
index cf6def7f3d8a..6fcafe0c7f66 100644
--- a/vcl/unx/headless/svpinst.hxx
+++ b/vcl/unx/headless/svpinst.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,10 @@
#ifndef _SVP_SALINST_HXX
#define _SVP_SALINST_HXX
-#include <vos/mutex.hxx>
-#include <vos/thread.hxx>
+#include <vcl/solarmutex.hxx>
+#include <osl/mutex.hxx>
+#include <osl/thread.hxx>
#include <salinst.hxx>
#include <salwtype.hxx>
#include <saltimer.hxx>
@@ -47,11 +49,11 @@
// SalYieldMutex
// -------------------------------------------------------------------------
-class SvpSalYieldMutex : public vos::OMutex
+class SvpSalYieldMutex : public ::vcl::SolarMutexObject
{
protected:
sal_uLong mnCount;
- vos::OThread::TThreadIdentifier mnThreadId;
+ oslThreadIdentifier mnThreadId;
public:
SvpSalYieldMutex();
@@ -61,7 +63,7 @@ public:
virtual sal_Bool tryToAcquire();
sal_uLong GetAcquireCount() const { return mnCount; }
- vos::OThread::TThreadIdentifier GetThreadId() const { return mnThreadId; }
+ oslThreadIdentifier GetThreadId() const { return mnThreadId; }
};
// ---------------
@@ -174,7 +176,7 @@ public:
virtual SalBitmap* CreateSalBitmap();
// YieldMutex
- virtual vos::IMutex* GetYieldMutex();
+ virtual osl::SolarMutex* GetYieldMutex();
virtual sal_uLong ReleaseYieldMutex();
virtual void AcquireYieldMutex( sal_uLong nCount );
virtual bool CheckYieldMutex();
@@ -191,6 +193,12 @@ public:
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
+
+ virtual void updatePrinterUpdate();
+ virtual void jobStartedPrinterUpdate();
+ virtual void jobEndedPrinterUpdate();
};
#endif // _SV_SALINST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index 0a5eb0ad0e7b..6f30f2d38969 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,7 +46,9 @@
#include "svpinst.hxx"
using namespace psp;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
/*
* static helpers
@@ -169,144 +172,6 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
}
}
-static bool passFileToCommandLine( const String& rFilename, const String& rCommandLine, bool bRemoveFile = true )
-{
- bool bSuccess = false;
-
- rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
- ByteString aCmdLine( rCommandLine, aEncoding );
- ByteString aFilename( rFilename, aEncoding );
-
- bool bPipe = aCmdLine.Search( "(TMP)" ) != STRING_NOTFOUND ? false : true;
-
- // setup command line for exec
- if( ! bPipe )
- while( aCmdLine.SearchAndReplace( "(TMP)", aFilename ) != STRING_NOTFOUND )
- ;
-
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "%s commandline: \"%s\"\n",
- bPipe ? "piping to" : "executing",
- aCmdLine.GetBuffer() );
- struct stat aStat;
- if( stat( aFilename.GetBuffer(), &aStat ) )
- fprintf( stderr, "stat( %s ) failed\n", aFilename.GetBuffer() );
- fprintf( stderr, "Tmp file %s has modes: 0%03lo\n", aFilename.GetBuffer(), (long)aStat.st_mode );
-#endif
- const char* argv[4];
- if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) )
- argv[ 0 ] = "/bin/sh";
- argv[ 1 ] = "-c";
- argv[ 2 ] = aCmdLine.GetBuffer();
- argv[ 3 ] = 0;
-
- bool bHavePipes = false;
- int pid, fd[2];
-
- if( bPipe )
- bHavePipes = pipe( fd ) ? false : true;
- if( ( pid = fork() ) > 0 )
- {
- if( bPipe && bHavePipes )
- {
- close( fd[0] );
- char aBuffer[ 2048 ];
- FILE* fp = fopen( aFilename.GetBuffer(), "r" );
- while( fp && ! feof( fp ) )
- {
- int nBytes = fread( aBuffer, 1, sizeof( aBuffer ), fp );
- if( nBytes )
- write( fd[ 1 ], aBuffer, nBytes );
- }
- fclose( fp );
- close( fd[ 1 ] );
- }
- int status = 0;
- waitpid( pid, &status, 0 );
- if( ! status )
- bSuccess = true;
- }
- else if( ! pid )
- {
- if( bPipe && bHavePipes )
- {
- close( fd[1] );
- if( fd[0] != STDIN_FILENO ) // not probable, but who knows :)
- dup2( fd[0], STDIN_FILENO );
- }
- execv( argv[0], const_cast<char**>(argv) );
- fprintf( stderr, "failed to execute \"%s\"\n", aCmdLine.GetBuffer() );
- _exit( 1 );
- }
- else
- fprintf( stderr, "failed to fork\n" );
-
- // clean up the mess
- if( bRemoveFile )
- unlink( aFilename.GetBuffer() );
-
- return bSuccess;
-}
-
-static bool sendAFax( const String& rFaxNumber, const String& rFileName, const String& rCommand )
-{
- std::list< OUString > aFaxNumbers;
-
- if( ! rFaxNumber.Len() )
- return false;
-
- sal_Int32 nIndex = 0;
- OUString aFaxes( rFaxNumber );
- OUString aBeginToken( RTL_CONSTASCII_USTRINGPARAM("<Fax#>") );
- OUString aEndToken( RTL_CONSTASCII_USTRINGPARAM("</Fax#>") );
- while( nIndex != -1 )
- {
- nIndex = aFaxes.indexOf( aBeginToken, nIndex );
- if( nIndex != -1 )
- {
- sal_Int32 nBegin = nIndex + aBeginToken.getLength();
- nIndex = aFaxes.indexOf( aEndToken, nIndex );
- if( nIndex != -1 )
- {
- aFaxNumbers.push_back( aFaxes.copy( nBegin, nIndex-nBegin ) );
- nIndex += aEndToken.getLength();
- }
- }
- }
-
- bool bSuccess = true;
- if( aFaxNumbers.begin() != aFaxNumbers.end() )
- {
- while( aFaxNumbers.begin() != aFaxNumbers.end() && bSuccess )
- {
- String aCmdLine( rCommand );
- String aFaxNumber( aFaxNumbers.front() );
- aFaxNumbers.pop_front();
- while( aCmdLine.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "(PHONE)" ) ), aFaxNumber ) != STRING_NOTFOUND )
- ;
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "sending fax to \"%s\"\n", OUStringToOString( aFaxNumber, osl_getThreadTextEncoding() ).getStr() );
-#endif
- bSuccess = passFileToCommandLine( rFileName, aCmdLine, false );
- }
- }
- else
- bSuccess = false;
-
- // clean up temp file
- unlink( ByteString( rFileName, osl_getThreadTextEncoding() ).GetBuffer() );
-
- return bSuccess;
-}
-
-static bool createPdf( const String& rToFile, const String& rFromFile, const String& rCommandLine )
-{
- String aCommandLine( rCommandLine );
- while( aCommandLine.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "(OUTFILE)" ) ), rToFile ) != STRING_NOTFOUND )
- ;
- return passFileToCommandLine( rFromFile, aCommandLine );
-}
-
/*
* SalInstance
*/
@@ -317,7 +182,7 @@ SalInfoPrinter* SvpSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn
ImplJobSetup* pJobSetup )
{
// create and initialize SalInfoPrinter
- PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
+ SvpSalInfoPrinter* pPrinter = new SvpSalInfoPrinter;
if( pJobSetup )
{
@@ -336,7 +201,7 @@ SalInfoPrinter* SvpSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn
// set/clear backwards compatibility flag
bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
+ boost::unordered_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
if( compat_it != pJobSetup->maValueMap.end() )
{
@@ -362,8 +227,8 @@ void SvpSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
SalPrinter* SvpSalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
{
// create and initialize SalPrinter
- PspSalPrinter* pPrinter = new PspSalPrinter( pInfoPrinter );
- pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
+ SvpSalPrinter* pPrinter = new SvpSalPrinter( pInfoPrinter );
+ pPrinter->m_aJobData = static_cast<SvpSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
return pPrinter;
}
@@ -436,574 +301,37 @@ String SvpSalInstance::GetDefaultPrinter()
return rManager.getDefaultPrinter();
}
-// =======================================================================
-
-PspSalInfoPrinter::PspSalInfoPrinter()
-{
- m_pGraphics = NULL;
- m_bPapersInit = false;
-}
-
-// -----------------------------------------------------------------------
-
-PspSalInfoPrinter::~PspSalInfoPrinter()
-{
- if( m_pGraphics )
- {
- delete m_pGraphics;
- m_pGraphics = NULL;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
-{
- m_aPaperFormats.clear();
- m_bPapersInit = true;
-
- if( m_aJobData.m_pParser )
- {
- const PPDKey* pKey = m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
- if( pKey )
- {
- int nValues = pKey->countValues();
- for( int i = 0; i < nValues; i++ )
- {
- const PPDValue* pValue = pKey->getValue( i );
- int nWidth = 0, nHeight = 0;
- m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight );
- PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight ));
- m_aPaperFormats.push_back( aInfo );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
-{
- return 900;
-}
-
-// -----------------------------------------------------------------------
-
-SalGraphics* PspSalInfoPrinter::GetGraphics()
-{
- // return a valid pointer only once
- // the reasoning behind this is that we could have different
- // SalGraphics that can run in multiple threads
- // (future plans)
- SalGraphics* pRet = NULL;
- if( ! m_pGraphics )
- {
- m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, NULL, false, this );
- m_pGraphics->SetLayout( 0 );
- pRet = m_pGraphics;
- }
- return pRet;
-}
-
-// -----------------------------------------------------------------------
-
-void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics )
-{
- if( pGraphics == m_pGraphics )
- {
- delete pGraphics;
- m_pGraphics = NULL;
- }
- return;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool PspSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
-{
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-// This function gets the driver data and puts it into pJobSetup
-// If pJobSetup->mpDriverData is NOT NULL, then the independend
-// data should be merged into the driver data
-// If pJobSetup->mpDriverData IS NULL, then the driver defaults
-// should be merged into the independent data
-sal_Bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup )
-{
- if( pJobSetup->mpDriverData )
- return SetData( ~0, pJobSetup );
-
- copyJobDataToJobSetup( pJobSetup, m_aJobData );
-
- // set/clear backwards compatibility flag
- bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
- pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
- if( compat_it != pJobSetup->maValueMap.end() )
- {
- if( compat_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bStrictSO52Compatibility = true;
- }
- m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
-
- return sal_True;
-}
-
// -----------------------------------------------------------------------
-// This function merges the independ driver data
-// and sets the new independ data in pJobSetup
-// Only the data must be changed, where the bit
-// in nGetDataFlags is set
-sal_Bool PspSalInfoPrinter::SetData(
- sal_uLong nSetDataFlags,
- ImplJobSetup* pJobSetup )
+sal_Bool SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
{
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- if( aData.m_pParser )
- {
- const PPDKey* pKey;
- const PPDValue* pValue;
-
- // merge papersize if necessary
- if( nSetDataFlags & SAL_JOBSET_PAPERSIZE )
- {
- int nWidth, nHeight;
- if( pJobSetup->meOrientation == ORIENTATION_PORTRAIT )
- {
- nWidth = pJobSetup->mnPaperWidth;
- nHeight = pJobSetup->mnPaperHeight;
- }
- else
- {
- nWidth = pJobSetup->mnPaperHeight;
- nHeight = pJobSetup->mnPaperWidth;
- }
- String aPaper;
-
- if( pJobSetup->mePaperFormat == PAPER_USER )
- aPaper = aData.m_pParser->matchPaper(
- TenMuToPt( pJobSetup->mnPaperWidth ),
- TenMuToPt( pJobSetup->mnPaperHeight ) );
- else
- aPaper = rtl::OStringToOUString(PaperInfo::toPSName(pJobSetup->mePaperFormat), RTL_TEXTENCODING_ISO_8859_1);
-
- pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
- pValue = pKey ? pKey->getValue( aPaper ) : NULL;
- if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) )
- return sal_False;
- }
-
- // merge paperbin if necessary
- if( nSetDataFlags & SAL_JOBSET_PAPERBIN )
- {
- pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
- if( pKey )
- {
- int nPaperBin = pJobSetup->mnPaperBin;
- if( nPaperBin == 0xffff )
- pValue = pKey->getDefaultValue();
- else
- pValue = pKey->getValue( pJobSetup->mnPaperBin );
-
- // may fail due to constraints;
- // real paper bin is copied back to jobsetup in that case
- aData.m_aContext.setValue( pKey, pValue );
- }
- // if printer has no InputSlot key simply ignore this setting
- // (e.g. SGENPRT has no InputSlot)
- }
-
- // merge orientation if necessary
- if( nSetDataFlags & SAL_JOBSET_ORIENTATION )
- aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait;
-
- // merge duplex if necessary
- if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE )
- {
- pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
- if( pKey )
- {
- pValue = NULL;
- switch( pJobSetup->meDuplexMode )
- {
- case DUPLEX_OFF:
- pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
- if( pValue == NULL )
- pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) );
- break;
- case DUPLEX_SHORTEDGE:
- pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) );
- break;
- case DUPLEX_LONGEDGE:
- pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) );
- break;
- case DUPLEX_UNKNOWN:
- default:
- pValue = 0;
- break;
- }
- if( ! pValue )
- pValue = pKey->getDefaultValue();
- aData.m_aContext.setValue( pKey, pValue );
- }
- }
-
- m_aJobData = aData;
- copyJobDataToJobSetup( pJobSetup, aData );
- return sal_True;
- }
-
return sal_False;
}
-// -----------------------------------------------------------------------
-
-void PspSalInfoPrinter::GetPageInfo(
- const ImplJobSetup* pJobSetup,
- long& rOutWidth, long& rOutHeight,
- long& rPageOffX, long& rPageOffY,
- long& rPageWidth, long& rPageHeight )
-{
- if( ! pJobSetup )
- return;
-
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- // get the selected page size
- if( aData.m_pParser )
- {
-
- String aPaper;
- int width, height;
- int left = 0, top = 0, right = 0, bottom = 0;
- int nDPI = aData.m_aContext.getRenderResolution();
-
-
- if( aData.m_eOrientation == psp::orientation::Portrait )
- {
- aData.m_aContext.getPageSize( aPaper, width, height );
- aData.m_pParser->getMargins( aPaper, left, right, top, bottom );
- }
- else
- {
- aData.m_aContext.getPageSize( aPaper, height, width );
- aData.m_pParser->getMargins( aPaper, top, bottom, right, left );
- }
-
- rPageWidth = width * nDPI / 72;
- rPageHeight = height * nDPI / 72;
- rPageOffX = left * nDPI / 72;
- rPageOffY = top * nDPI / 72;
- rOutWidth = ( width - left - right ) * nDPI / 72;
- rOutHeight = ( height - top - bottom ) * nDPI / 72;
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_uLong PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
-{
- if( ! pJobSetup )
- return 0;
-
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL;
- return pKey ? pKey->countValues() : 0;
-}
-
-// -----------------------------------------------------------------------
-
-String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_uLong nPaperBin )
-{
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- String aRet;
- if( aData.m_pParser )
- {
- const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL;
- if( nPaperBin == 0xffff || ! pKey )
- aRet = aData.m_pParser->getDefaultInputSlot();
- else
- {
- const PPDValue* pValue = pKey->getValue( nPaperBin );
- if( pValue )
- aRet = aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption );
- }
- }
-
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, sal_uInt16 nType )
-{
- switch( nType )
- {
- case PRINTER_CAPABILITIES_SUPPORTDIALOG:
- return 1;
- case PRINTER_CAPABILITIES_COPIES:
- return 0xffff;
- case PRINTER_CAPABILITIES_COLLATECOPIES:
- {
- // see if the PPD contains a value to set Collate to True
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL;
- const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL;
-
- // PPDs don't mention the number of possible collated copies.
- // so let's guess as many as we want ?
- return pVal ? 0xffff : 0;
- }
- case PRINTER_CAPABILITIES_SETORIENTATION:
- return 1;
- case PRINTER_CAPABILITIES_SETDUPLEX:
- return 1;
- case PRINTER_CAPABILITIES_SETPAPERBIN:
- return 1;
- case PRINTER_CAPABILITIES_SETPAPERSIZE:
- return 1;
- case PRINTER_CAPABILITIES_SETPAPER:
- return 0;
- case PRINTER_CAPABILITIES_FAX:
- {
- PrinterInfoManager& rManager = PrinterInfoManager::get();
- PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) );
- String aFeatures( aInfo.m_aFeatures );
- int nTokenCount = aFeatures.GetTokenCount( ',' );
- for( int i = 0; i < nTokenCount; i++ )
- {
- if( aFeatures.GetToken( i ).CompareToAscii( "fax", 3 ) == COMPARE_EQUAL )
- return 1;
- }
- return 0;
- }
- case PRINTER_CAPABILITIES_PDF:
- {
- PrinterInfoManager& rManager = PrinterInfoManager::get();
- PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) );
- String aFeatures( aInfo.m_aFeatures );
- int nTokenCount = aFeatures.GetTokenCount( ',' );
- for( int i = 0; i < nTokenCount; i++ )
- {
- if( aFeatures.GetToken( i ).CompareToAscii( "pdf=", 4 ) == COMPARE_EQUAL )
- return 1;
- }
- return 0;
- }
- default: break;
- };
- return 0;
-}
-
-// =======================================================================
-
/*
- * SalPrinter
+ * svp::PrinterUpdate
*/
-PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter )
- : m_bFax( false ),
- m_bPdf( false ),
- m_bSwallowFaxNo( false ),
- m_pGraphics( NULL ),
- m_nCopies( 1 ),
- m_bCollate( false ),
- m_pInfoPrinter( pInfoPrinter )
+namespace svp
{
-}
-
-// -----------------------------------------------------------------------
-
-PspSalPrinter::~PspSalPrinter()
-{
-}
-
-// -----------------------------------------------------------------------
-
-static String getTmpName()
-{
- rtl::OUString aTmp, aSys;
- osl_createTempFile( NULL, NULL, &aTmp.pData );
- osl_getSystemPathFromFileURL( aTmp.pData, &aSys.pData );
-
- return aSys;
-}
-
-sal_Bool PspSalPrinter::StartJob(
- const XubString* pFileName,
- const XubString& rJobName,
- const XubString& rAppName,
- sal_uLong nCopies,
- bool bCollate,
- bool /*bDirect*/,
- ImplJobSetup* pJobSetup )
-{
- vcl_sal::PrinterUpdate::jobStarted();
-
- m_bFax = false;
- m_bPdf = false;
- m_aFileName = pFileName ? *pFileName : String();
- m_aTmpFile = String();
- m_nCopies = nCopies;
- m_bCollate = bCollate;
-
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
- if( m_nCopies > 1 )
- {
- // in case user did not do anything (m_nCopies=1)
- // take the default from jobsetup
- m_aJobData.m_nCopies = m_nCopies;
- m_aJobData.setCollate( bCollate );
- }
-
- // check wether this printer is configured as fax
- int nMode = 0;
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- sal_Int32 nIndex = 0;
- while( nIndex != -1 )
+ class PrinterUpdate
{
- OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
- if( ! aToken.compareToAscii( "fax", 3 ) )
- {
- m_bFax = true;
- m_aTmpFile = getTmpName();
- nMode = S_IRUSR | S_IWUSR;
+ static Timer* pPrinterUpdateTimer;
+ static int nActiveJobs;
- ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
- it = pJobSetup->maValueMap.find( ::rtl::OUString::createFromAscii( "FAX#" ) );
- if( it != pJobSetup->maValueMap.end() )
- m_aFaxNr = it->second;
-
- sal_Int32 nPos = 0;
- m_bSwallowFaxNo = ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? true : false;
-
- break;
- }
- if( ! aToken.compareToAscii( "pdf=", 4 ) )
- {
- m_bPdf = true;
- m_aTmpFile = getTmpName();
- nMode = S_IRUSR | S_IWUSR;
-
- if( ! m_aFileName.Len() )
- {
- m_aFileName = getPdfDir( rInfo );
- m_aFileName.Append( '/' );
- m_aFileName.Append( rJobName );
- m_aFileName.AppendAscii( ".pdf" );
- }
- break;
- }
- }
- m_aPrinterGfx.Init( m_aJobData );
-
- // set/clear backwards compatibility flag
- bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
- pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
- if( compat_it != pJobSetup->maValueMap.end() )
- {
- if( compat_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bStrictSO52Compatibility = true;
- }
- m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
-
- return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, false ) ? sal_True : sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool PspSalPrinter::EndJob()
-{
- sal_Bool bSuccess = m_aPrintJob.EndJob();
-
- if( bSuccess )
- {
- // check for fax
- if( m_bFax )
- {
-
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- // sendAFax removes the file after use
- bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand );
- }
- else if( m_bPdf )
- {
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
- }
- }
- vcl_sal::PrinterUpdate::jobEnded();
- return bSuccess;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool PspSalPrinter::AbortJob()
-{
- sal_Bool bAbort = m_aPrintJob.AbortJob() ? sal_True : sal_False;
- vcl_sal::PrinterUpdate::jobEnded();
- return bAbort;
-}
-
-// -----------------------------------------------------------------------
-
-SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, sal_Bool )
-{
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
- m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter );
- m_pGraphics->SetLayout( 0 );
- if( m_nCopies > 1 )
- {
- // in case user did not do anything (m_nCopies=1)
- // take the default from jobsetup
- m_aJobData.m_nCopies = m_nCopies;
- m_aJobData.setCollate( m_nCopies > 1 && m_bCollate );
- }
-
- m_aPrintJob.StartPage( m_aJobData );
- m_aPrinterGfx.Init( m_aPrintJob );
-
- return m_pGraphics;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool PspSalPrinter::EndPage()
-{
- sal_Bool bResult = m_aPrintJob.EndPage();
- m_aPrinterGfx.Clear();
- return bResult ? sal_True : sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uLong PspSalPrinter::GetErrorCode()
-{
- return 0;
+ static void doUpdate();
+ DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
+ public:
+ static void update();
+ static void jobStarted() { nActiveJobs++; }
+ static void jobEnded();
+ };
}
-/*
- * vcl::PrinterUpdate
- */
-
-Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL;
-int vcl_sal::PrinterUpdate::nActiveJobs = 0;
+Timer* svp::PrinterUpdate::pPrinterUpdateTimer = NULL;
+int svp::PrinterUpdate::nActiveJobs = 0;
-void vcl_sal::PrinterUpdate::doUpdate()
+void svp::PrinterUpdate::doUpdate()
{
::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() );
if( rManager.checkPrintersChanged( false ) && SvpSalInstance::s_pDefaultInstance )
@@ -1017,7 +345,7 @@ void vcl_sal::PrinterUpdate::doUpdate()
// -----------------------------------------------------------------------
-IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, )
+IMPL_STATIC_LINK_NOINSTANCE( svp::PrinterUpdate, UpdateTimerHdl, void*, )
{
if( nActiveJobs < 1 )
{
@@ -1033,7 +361,7 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, )
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::update()
+void svp::PrinterUpdate::update()
{
if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() )
return;
@@ -1053,14 +381,19 @@ void vcl_sal::PrinterUpdate::update()
{
pPrinterUpdateTimer = new Timer();
pPrinterUpdateTimer->SetTimeout( 500 );
- pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) );
+ pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, svp::PrinterUpdate, UpdateTimerHdl ) );
pPrinterUpdateTimer->Start();
}
}
+void SvpSalInstance::updatePrinterUpdate()
+{
+ svp::PrinterUpdate::update();
+}
+
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::jobEnded()
+void svp::PrinterUpdate::jobEnded()
{
nActiveJobs--;
if( nActiveJobs < 1 )
@@ -1074,3 +407,15 @@ void vcl_sal::PrinterUpdate::jobEnded()
}
}
}
+
+void SvpSalInstance::jobStartedPrinterUpdate()
+{
+ svp::PrinterUpdate::jobStarted();
+}
+
+void SvpSalInstance::jobEndedPrinterUpdate()
+{
+ svp::PrinterUpdate::jobEnded();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx
index d7064522e2b3..e4625bf70792 100644
--- a/vcl/unx/headless/svpprn.hxx
+++ b/vcl/unx/headless/svpprn.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -38,86 +39,19 @@
class PspGraphics;
-class PspSalInfoPrinter : public SalInfoPrinter
+class SvpSalInfoPrinter : public PspSalInfoPrinter
{
public:
- PspGraphics* m_pGraphics;
- psp::JobData m_aJobData;
- psp::PrinterGfx m_aPrinterGfx;
-
- PspSalInfoPrinter();
- virtual ~PspSalInfoPrinter();
-
- // overload all pure virtual methods
- virtual SalGraphics* GetGraphics();
- virtual void ReleaseGraphics( SalGraphics* pGraphics );
virtual sal_Bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData );
- virtual sal_Bool SetPrinterData( ImplJobSetup* pSetupData );
- virtual sal_Bool SetData( sal_uLong nFlags, ImplJobSetup* pSetupData );
- virtual void GetPageInfo( const ImplJobSetup* pSetupData,
- long& rOutWidth, long& rOutHeight,
- long& rPageOffX, long& rPageOffY,
- long& rPageWidth, long& rPageHeight );
- virtual sal_uLong GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType );
- virtual sal_uLong GetPaperBinCount( const ImplJobSetup* pSetupData );
- virtual String GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin );
- virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
- virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
-};
-
-class PspSalPrinter : public SalPrinter
-{
-public:
- String m_aFileName;
- String m_aTmpFile;
- String m_aFaxNr;
- bool m_bFax:1;
- bool m_bPdf:1;
- bool m_bSwallowFaxNo:1;
- PspGraphics* m_pGraphics;
- psp::PrinterJob m_aPrintJob;
- psp::JobData m_aJobData;
- psp::PrinterGfx m_aPrinterGfx;
- sal_uLong m_nCopies;
- bool m_bCollate;
- SalInfoPrinter* m_pInfoPrinter;
-
- PspSalPrinter( SalInfoPrinter* );
- virtual ~PspSalPrinter();
-
- // overload all pure virtual methods
- using SalPrinter::StartJob;
- virtual sal_Bool StartJob( const XubString* pFileName,
- const XubString& rJobName,
- const XubString& rAppName,
- sal_uLong nCopies,
- bool bCollate,
- bool bDirect,
- ImplJobSetup* pSetupData );
- virtual sal_Bool EndJob();
- virtual sal_Bool AbortJob();
- virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData );
- virtual sal_Bool EndPage();
- virtual sal_uLong GetErrorCode();
};
-class Timer;
-
-namespace vcl_sal {
-class VCLPLUG_SVP_PUBLIC PrinterUpdate
+class SvpSalPrinter : public PspSalPrinter
{
- static Timer* pPrinterUpdateTimer;
- static int nActiveJobs;
-
- static void doUpdate();
- DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
public:
- static void update();
- static void jobStarted() { nActiveJobs++; }
- static void jobEnded();
+ SvpSalPrinter( SalInfoPrinter* pInfoPrinter ) : PspSalPrinter(pInfoPrinter) {}
};
-}
#endif // _SVP_SVPPRN_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index cdd664c7b76a..fb0228c4339e 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,10 +59,10 @@
#include "region.h"
using namespace psp;
-using namespace rtl;
using namespace basebmp;
using namespace basegfx;
-
+using ::rtl::OUString;
+using ::rtl::OString;
// ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer ---------------
class SalPrinterBmp : public psp::PrinterBmp
@@ -206,7 +207,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY )
}
}
-sal_uInt16 PspGraphics::GetBitCount()
+sal_uInt16 PspGraphics::GetBitCount() const
{
return m_pPrinterGfx->GetBitCount();
}
@@ -372,7 +373,7 @@ sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void
void PspGraphics::copyBits( const SalTwoRect* /*pPosAry*/,
SalGraphics* /*pSSrcGraphics*/ )
{
- DBG_ERROR( "Error: PrinterGfx::CopyBits() not implemented" );
+ OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" );
}
void PspGraphics::copyArea ( long /*nDestX*/, long /*nDestY*/,
@@ -380,7 +381,7 @@ void PspGraphics::copyArea ( long /*nDestX*/, long /*nDestY*/,
long /*nSrcWidth*/, long /*nSrcHeight*/,
sal_uInt16 /*nFlags*/ )
{
- DBG_ERROR( "Error: PrinterGfx::CopyArea() not implemented" );
+ OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" );
}
void PspGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap )
@@ -402,21 +403,21 @@ void PspGraphics::drawBitmap( const SalTwoRect* /*pPosAry*/,
const SalBitmap& /*rSalBitmap*/,
const SalBitmap& /*rTransBitmap*/ )
{
- DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
+ OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
}
void PspGraphics::drawBitmap( const SalTwoRect* /*pPosAry*/,
const SalBitmap& /*rSalBitmap*/,
SalColor /*nTransparentColor*/ )
{
- DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent color");
+ OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent color");
}
void PspGraphics::drawMask( const SalTwoRect* /*pPosAry*/,
const SalBitmap& /*rSalBitmap*/,
SalColor /*nMaskColor*/ )
{
- DBG_ERROR("Error: PrinterGfx::DrawMask() not implemented");
+ OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented");
}
SalBitmap* PspGraphics::getBitmap( long /*nX*/, long /*nY*/, long /*nDX*/, long /*nDY*/ )
@@ -427,7 +428,7 @@ SalBitmap* PspGraphics::getBitmap( long /*nX*/, long /*nY*/, long /*nDX*/, long
SalColor PspGraphics::getPixel( long /*nX*/, long /*nY*/ )
{
- DBG_ERROR ("Warning: PrinterGfx::GetPixel() not implemented");
+ OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented");
return 0;
}
@@ -438,7 +439,7 @@ void PspGraphics::invert(
long /*nDY*/,
SalInvert /*nFlags*/ )
{
- DBG_ERROR ("Warning: PrinterGfx::Invert() not implemented");
+ OSL_FAIL("Warning: PrinterGfx::Invert() not implemented");
}
//==========================================================================
@@ -693,6 +694,13 @@ const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const
return pIFCMap;
}
+bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+{
+ if (!m_pServerFont[0])
+ return false;
+ return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities);
+}
+
sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel )
{
// release all fonts that are to be overridden
@@ -785,7 +793,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
const psp::PrinterInfo& rInfo = psp::PrinterInfoManager::get().getPrinterInfo( m_pJobData->m_aPrinterName );
if( rInfo.m_bPerformFontSubstitution )
{
- for( std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it )
+ for( boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator it = rInfo.m_aFontSubstitutes.begin(); it != rInfo.m_aFontSubstitutes.end(); ++it )
AddDevFontSubstitute( pOutDev, it->first, it->second, FONT_SUBSTITUTE_ALWAYS );
}
}
@@ -1360,7 +1368,8 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
aRes.hDrawable = 0;
- aRes.pRenderFormat = 0;
+ aRes.pXRenderFormat = 0;
return aRes;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index 74f2f097a1af..1e6f1b1b1747 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -87,7 +88,7 @@ public:
// overload all pure virtual methods
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
- virtual sal_uInt16 GetBitCount();
+ virtual sal_uInt16 GetBitCount() const;
virtual long GetGraphicsWidth() const;
virtual void ResetClipRegion();
@@ -106,6 +107,7 @@ public:
virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
virtual const ImplFontCharMap* GetImplFontCharMap() const;
+ virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
virtual void GetDevFontList( ImplDevFontList* );
virtual void GetDevFontSubstList( OutputDevice* );
virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
@@ -189,3 +191,4 @@ public:
#endif // _SVP_PSPGRAPHICS_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx
index 243e2b6ec422..40351bc27d07 100644
--- a/vcl/unx/headless/svptext.cxx
+++ b/vcl/unx/headless/svptext.cxx
@@ -1,4 +1,5 @@
-#/*************************************************************************
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -117,7 +118,7 @@ BitmapDeviceSharedPtr SvpGlyphPeer::GetGlyphBmp( ServerFont& rServerFont,
bFound = rServerFont.GetGlyphBitmap8( nGlyphIndex, pGcpHelper->maRawBitmap );
break;
default:
- DBG_ERROR( "SVP GCP::GetGlyphBmp(): illegal scanline format");
+ OSL_FAIL( "SVP GCP::GetGlyphBmp(): illegal scanline format");
// fall back to black&white mask
nBmpFormat = Format::ONE_BIT_LSB_GREY;
bFound = false;
@@ -192,8 +193,6 @@ void PspKernInfo::Initialize() const
if( rKernPairs.empty() )
return;
- // feed psprint's kerning list into a lookup-friendly container
- maUnicodeKernPairs.resize( rKernPairs.size() );
PspKernPairs::const_iterator it = rKernPairs.begin();
for(; it != rKernPairs.end(); ++it )
{
@@ -281,6 +280,14 @@ const ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const
return pIFCMap;
}
+bool SvpSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+{
+ if (!m_pServerFont[0])
+ return false;
+
+ return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities);
+}
+
// ---------------------------------------------------------------------------
void SvpSalGraphics::GetDevFontList( ImplDevFontList* pDevFontList )
@@ -500,3 +507,5 @@ void SvpSalGraphics::DrawServerFontLayout( const ServerFontLayout& rSalLayout )
}
// ===========================================================================
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpvd.cxx b/vcl/unx/headless/svpvd.cxx
index 4afbaefbfe7c..8477da7b3bfc 100644
--- a/vcl/unx/headless/svpvd.cxx
+++ b/vcl/unx/headless/svpvd.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -108,3 +109,4 @@ void SvpSalVirtualDevice::GetSize( long& rWidth, long& rHeight )
rWidth = rHeight = 0;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpvd.hxx b/vcl/unx/headless/svpvd.hxx
index d66a31905c04..211cf36846f9 100644
--- a/vcl/unx/headless/svpvd.hxx
+++ b/vcl/unx/headless/svpvd.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -57,3 +58,5 @@ public:
};
#endif // _SVP_SVPVD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/inc/kde_headers.h b/vcl/unx/inc/kde_headers.h
new file mode 100644
index 000000000000..7ec45fdc383d
--- /dev/null
+++ b/vcl/unx/inc/kde_headers.h
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_VCL_KDE_HEADERS_H
+#define INCLUDED_VCL_KDE_HEADERS_H
+
+/* ********* Suppress warnings if needed */
+#include "sal/config.h"
+
+#include <cstddef>
+
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+
+/* ********* Hack, but needed because of conflicting types... */
+#define Region QtXRegion
+
+
+/* ********* Qt headers */
+#include <qaccessible.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qfont.h>
+#include <qframe.h>
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qmainwindow.h>
+#include <qmenudata.h>
+#include <qpaintdevice.h>
+#include <qpainter.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qrangecontrol.h>
+#include <qstring.h>
+#include <qtabbar.h>
+#include <qtabwidget.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qwidget.h>
+#include <qprogressbar.h>
+
+/* ********* See hack on top of this file */
+#undef Region
+
+
+/* ********* KDE base headers */
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#include <kemailsettings.h>
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kmainwindow.h>
+#include <kmenubar.h>
+#include <kprotocolmanager.h>
+#include <kstartupinfo.h>
+#include <kstyle.h>
+
+
+/* ********* KDE address book connectivity headers */
+#include <kabc/addressbook.h>
+#include <kabc/addressee.h>
+#include <kabc/field.h>
+#include <kabc/stdaddressbook.h>
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index a6badfbea23e..06acbb7cff96 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,7 +30,7 @@
#include "precompiled_vcl.hxx"
#define _SV_SALDATA_CXX
-#include <shell/kde_headers.h>
+#include <kde_headers.h>
#include <unistd.h>
#include <fcntl.h>
@@ -49,12 +50,10 @@
#include <osl/thread.h>
#include <osl/process.h>
#include <osl/module.h>
+#include <osl/mutex.hxx>
#include <tools/debug.hxx>
-#include <vos/process.hxx>
-#include <vos/mutex.hxx>
-
#include "unx/kde/kdedata.hxx"
#include "unx/i18n_im.hxx"
#include "unx/i18n_xkb.hxx"
@@ -101,7 +100,7 @@ SalKDEDisplay::~SalKDEDisplay()
KDEXLib::~KDEXLib()
{
- // #158056# on 64 bit linux using libXRandr.so.2 will crash in
+ // on 64 bit linux using libXRandr.so.2 will crash in
// XCloseDisplay when freeing extension data
// no known work around, therefor currently leak. Hopefully
// this does not make problems since we're shutting down anyway
@@ -125,15 +124,15 @@ void KDEXLib::Init()
pInputMethod->SetLocale();
XrmInitialize();
- KAboutData *kAboutData = new KAboutData( "OpenOffice.org",
- I18N_NOOP( "OpenOffice.org" ),
+ KAboutData *kAboutData = new KAboutData( "LibreOffice",
+ I18N_NOOP( "LibreOffice" ),
"1.1.0",
- I18N_NOOP( "OpenOffice.org with KDE Native Widget Support." ),
+ I18N_NOOP( "LibreOffice with KDE Native Widget Support." ),
KAboutData::License_LGPL,
"(c) 2003, 2004 Novell, Inc",
- I18N_NOOP( "OpenOffice.org is an office suite.\n" ),
- "http://kde.openoffice.org/index.html",
- "dev@kde.openoffice.org");
+ I18N_NOOP( "LibreOffice is an office suite.\n" ),
+ "http://libreoffice.org",
+ "libreoffice@lists.freedesktop.org");
kAboutData->addAuthor( "Jan Holesovsky",
I18N_NOOP( "Original author and maintainer of the KDE NWF." ),
"kendy@artax.karlin.mff.cuni.cz",
@@ -141,17 +140,16 @@ void KDEXLib::Init()
m_nFakeCmdLineArgs = 1;
sal_uInt16 nIdx;
- vos::OExtCommandLine aCommandLine;
- int nParams = aCommandLine.getCommandArgCount();
+ int nParams = osl_getCommandArgCount();
rtl::OString aDisplay;
rtl::OUString aParam, aBin;
for ( nIdx = 0; nIdx < nParams; ++nIdx )
{
- aCommandLine.getCommandArg( nIdx, aParam );
- if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams )
+ osl_getCommandArg( nIdx, &aParam.pData );
+ if ( !m_pFreeCmdLineArgs && aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) && nIdx + 1 < nParams )
{
- aCommandLine.getCommandArg( nIdx + 1, aParam );
+ osl_getCommandArg( nIdx + 1, &aParam.pData );
aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() );
m_nFakeCmdLineArgs = 3;
@@ -193,7 +191,7 @@ void KDEXLib::Init()
SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
XSync( pDisp, False );
- pKbdExtension->UseExtension( ! HasXErrorOccured() );
+ pKbdExtension->UseExtension( ! HasXErrorOccurred() );
PopXErrorLevel();
pSalDisplay->SetKbdExtension( pKbdExtension );
@@ -275,3 +273,5 @@ extern "C" {
return pInstance;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index c9f35b295511..4c4922be8b1e 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,7 +30,7 @@
#include "precompiled_vcl.hxx"
#define _SV_SALNATIVEWIDGETS_KDE_CXX
-#include <shell/kde_headers.h>
+#include <kde_headers.h>
#include <unx/salunx.h>
#include <unx/saldata.hxx>
@@ -390,7 +391,11 @@ WidgetPainter::WidgetPainter( void )
m_pToolBarVert( NULL ),
m_pToolButton( NULL ),
m_pMenuBar( NULL ),
+ m_nMenuBarEnabledItem( 0 ),
+ m_nMenuBarDisabledItem( 0 ),
m_pPopupMenu( NULL ),
+ m_nPopupMenuEnabledItem( 0 ),
+ m_nPopupMenuDisabledItem( 0 ),
m_pProgressBar( NULL )
{
}
@@ -1827,6 +1832,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
StyleSettings aStyleSettings( rSettings.GetStyleSettings() );
bool bSetTitleFont = false;
+ aStyleSettings.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE );
+
// WM settings
KConfig *pConfig = KGlobal::config();
if ( pConfig )
@@ -1936,9 +1943,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetAppFont( aFont );
aStyleSettings.SetHelpFont( aFont );
- if( !bSetTitleFont )
- aStyleSettings.SetTitleFont( aFont );
- aStyleSettings.SetFloatTitleFont( aFont );
aStyleSettings.SetMenuFont( aFont ); // will be changed according to pMenuBar
aStyleSettings.SetToolFont( aFont ); // will be changed according to pToolBar
aStyleSettings.SetLabelFont( aFont );
@@ -1948,6 +1952,12 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetFieldFont( aFont );
aStyleSettings.SetIconFont( aFont );
aStyleSettings.SetGroupFont( aFont );
+
+ aFont.SetWeight( WEIGHT_BOLD );
+ if( !bSetTitleFont )
+ aStyleSettings.SetTitleFont( aFont );
+ aStyleSettings.SetFloatTitleFont( aFont );
+
int flash_time = QApplication::cursorFlashTime();
aStyleSettings.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
@@ -2105,3 +2115,5 @@ void KDEData::deInitNWF()
// We have to destroy the style early
kapp->setStyle( NULL );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx
index dcf1db32068e..97654cf41e76 100644
--- a/vcl/unx/kde4/KDEData.cxx
+++ b/vcl/unx/kde4/KDEData.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,3 +53,5 @@ void KDEData::initNWF()
void KDEData::deInitNWF()
{
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDEData.hxx b/vcl/unx/kde4/KDEData.hxx
index 753deb697e95..db1e12226673 100644
--- a/vcl/unx/kde4/KDEData.hxx
+++ b/vcl/unx/kde4/KDEData.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,3 +41,5 @@ class KDEData : public X11SalData
virtual void initNWF();
virtual void deInitNWF();
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
index 41fa9fedde3f..29292b68f142 100644
--- a/vcl/unx/kde4/KDESalDisplay.cxx
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,10 +29,19 @@
#include "KDESalDisplay.hxx"
#include "KDEXLib.hxx"
+#include "VCLKDEApplication.hxx"
+
+#include <assert.h>
+#include <saldata.hxx>
+
+SalKDEDisplay* SalKDEDisplay::selfptr = NULL;
SalKDEDisplay::SalKDEDisplay( Display* pDisp )
: SalX11Display( pDisp )
{
+ assert( selfptr == NULL );
+ selfptr = this;
+ xim_protocol = XInternAtom( pDisp_, "_XIM_PROTOCOL", False );
}
SalKDEDisplay::~SalKDEDisplay()
@@ -40,6 +50,48 @@ SalKDEDisplay::~SalKDEDisplay()
static_cast<KDEXLib*>(GetXLib())->doStartup();
// clean up own members
doDestruct();
+ selfptr = NULL;
// prevent SalDisplay from closing KApplication's display
pDisp_ = NULL;
}
+
+void SalKDEDisplay::Yield()
+{
+ if( DispatchInternalEvent() )
+ return;
+
+ DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
+ osl::Thread::getCurrentIdentifier(),
+ "will crash soon since solar mutex not locked in SalKDEDisplay::Yield" );
+
+ XEvent event;
+ XNextEvent( pDisp_, &event );
+ if( checkDirectInputEvent( &event ))
+ return;
+ qApp->x11ProcessEvent( &event );
+}
+
+// HACK: When using Qt event loop, input methods (japanese, etc.) will get broken because
+// of XFilterEvent() getting called twice, once by Qt, once by LO (bnc#665112).
+// This function is therefore called before any XEvent is passed to Qt event handling
+// and if it is a keyboard event and no Qt widget is the active window (i.e. we are
+// processing events for some LO window), then feed the event only to LO directly and skip Qt
+// completely. Skipped events are KeyPress, KeyRelease and also _XIM_PROTOCOL client message
+// (seems to be necessary too, hopefully there are not other internal XIM messages that
+// would need this handling).
+bool SalKDEDisplay::checkDirectInputEvent( XEvent* ev )
+{
+ if( ev->xany.type == XLIB_KeyPress || ev->xany.type == KeyRelease
+ || ( ev->xany.type == ClientMessage && ev->xclient.message_type == xim_protocol ))
+ {
+ if( qApp->activeWindow() == NULL )
+ {
+ Dispatch(ev);
+ return true;
+ }
+ }
+ return false;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalDisplay.hxx b/vcl/unx/kde4/KDESalDisplay.hxx
index 8287bbfb9bda..5fd1e4459660 100644
--- a/vcl/unx/kde4/KDESalDisplay.hxx
+++ b/vcl/unx/kde4/KDESalDisplay.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,6 +34,22 @@ class SalKDEDisplay : public SalX11Display
{
public:
SalKDEDisplay( Display* pDisp );
- virtual ~SalKDEDisplay();
+ virtual ~SalKDEDisplay();
+ static SalKDEDisplay* self();
+ inline int userEventsCount() const { return m_aUserEvents.size(); }
+ inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
+ inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
+// virtual long Dispatch( XEvent *event );
+ virtual void Yield();
+ bool checkDirectInputEvent( XEvent* ev );
+ private:
+ Atom xim_protocol;
+ static SalKDEDisplay* selfptr;
};
+inline SalKDEDisplay* SalKDEDisplay::self()
+{
+ return selfptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index 1e96c3e2f7a4..40146434ba84 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -88,14 +89,7 @@ static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
}
#if 0
-/** Helper function to read color from KConfig configuration repository.
-*/
-static Color readColor( KConfigGroup *pGroup, const char *pKey )
-{
- return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
-}
#endif
-
/** Helper function to add information to Font from QFont.
Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
@@ -187,6 +181,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// General settings
QPalette pal = kapp->palette();
+ style.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE );
+
style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
@@ -291,12 +287,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
style.SetAppFont( aFont );
style.SetHelpFont( aFont );
- if( !bSetTitleFont )
- {
- style.SetTitleFont( aFont );
- }
-
- style.SetFloatTitleFont( aFont );
style.SetMenuFont( aFont ); // will be changed according to pMenuBar
//style.SetToolFont( aFont ); //already set above
style.SetLabelFont( aFont );
@@ -307,6 +297,13 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
style.SetIconFont( aFont );
style.SetGroupFont( aFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+ if( !bSetTitleFont )
+ {
+ style.SetTitleFont( aFont );
+ }
+ style.SetFloatTitleFont( aFont );
+
int flash_time = QApplication::cursorFlashTime();
style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
@@ -349,6 +346,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Scroll bar size
style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
+ style.SetMinThumbSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarSliderMin ));
rSettings.SetStyleSettings( style );
}
@@ -406,3 +404,5 @@ SalGraphics* KDESalFrame::GetGraphics()
return NULL;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx
index c5071ce85ffa..7658ea036bb2 100644
--- a/vcl/unx/kde4/KDESalFrame.hxx
+++ b/vcl/unx/kde4/KDESalFrame.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -56,3 +57,5 @@ class KDESalFrame : public X11SalFrame
virtual void UpdateSettings( AllSettings& rSettings );
virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate );
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 9b37bf5e8e2a..04f71bfbed3d 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,6 +40,7 @@
#include <QLabel>
#include <kapplication.h>
+#include <kdebug.h>
#undef Region
@@ -144,41 +146,33 @@ sal_Bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart
if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) )
return true;
+ if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true;
+
return false;
if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true;
// no CTRL_TAB_BODY for KDE
- if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true;
return false;
}
-sal_Bool KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
- const Rectangle&, const Point&,
- sal_Bool& )
-{
- return FALSE;
-}
-
/// helper drawing methods
namespace
{
- void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state )
+ void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state, QRect rect = QRect())
{
option->state |= state;
- option->rect = image->rect();
+ option->rect = !rect.isNull() ? rect : image->rect();
QPainter painter(image);
kapp->style()->drawControl(element, option, &painter);
}
- void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, int nAdjust = 0 )
+ void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, QRect rect = QRect())
{
option->state |= state;
- option->rect = image->rect();
- if( nAdjust )
- option->rect.adjust( nAdjust, nAdjust, -nAdjust, -nAdjust );
+ option->rect = !rect.isNull() ? rect : image->rect();
QPainter painter(image);
kapp->style()->drawPrimitive(element, option, &painter);
@@ -232,18 +226,54 @@ namespace
}
}
+#if QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 )
+#define IMAGE_BASED_PAINTING
+#else
+#undef IMAGE_BASED_PAINTING
+#endif
+
+#ifdef IMAGE_BASED_PAINTING
+// There is a small catch with this function, although hopefully only philosophical.
+// Officially Xlib's Region is an opaque data type, with only functions for manipulating it.
+// However, whoever designed it apparently didn't give it that much thought, as it's impossible
+// to find out what exactly a region actually is (except for really weird ways like XClipBox()
+// and repeated XPointInRegion(), which would be awfully slow). Fortunately, the header file
+// describing the structure actually happens to be installed too, and there's at least one
+// widely used software using it (Compiz). So access the data directly too and assume that
+// everybody who compiles with Qt4 support has Xlib new enough and good enough to support this.
+// In case this doesn't work for somebody, try #include <X11/region.h> instead, or build
+// without IMAGE_BASED_PAINTING (in which case QApplication::setGraphicsSystem( "native" ) may
+// be needed too).
+#include <X11/Xregion.h>
+static QRegion XRegionToQRegion( XLIB_Region xr )
+{
+ QRegion qr;
+ for( int i = 0;
+ i < xr->numRects;
+ ++i )
+ {
+ BOX& b = xr->rects[ i ];
+ qr |= QRect( b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1 ); // x2,y2 is outside, not the bottom-right corner
+ }
+ return qr;
+}
+#endif
+
sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
const Rectangle& rControlRegion, ControlState nControlState,
const ImplControlValue& value,
const OUString& )
{
+ if( lastPopupRect.isValid() && ( type != CTRL_MENU_POPUP || part != PART_MENU_ITEM ))
+ lastPopupRect = QRect();
+
// put not implemented types here
if (type == CTRL_SPINBUTTONS)
{
return false;
}
- sal_Bool returnVal = true;
+ sal_Bool returnVal = true;
QRect widgetRect = region2QRect(rControlRegion);
if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS )
@@ -270,8 +300,7 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
}
m_image->fill(KApplication::palette().color(QPalette::Window).rgb());
-
- XLIB_Region pTempClipRegion = 0;
+ QRegion* clipRegion = NULL;
if (type == CTRL_PUSHBUTTON)
{
@@ -297,35 +326,69 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
}
else if (type == CTRL_MENU_POPUP)
{
- if (part == PART_MENU_ITEM)
+ OSL_ASSERT( part == PART_MENU_ITEM ? lastPopupRect.isValid() : !lastPopupRect.isValid());
+ if( part == PART_MENU_ITEM )
{
QStyleOptionMenuItem option;
draw( QStyle::CE_MenuItem, &option, m_image,
vclStateValue2StateFlag(nControlState, value) );
+ // HACK: LO core first paints the entire popup and only then it paints menu items,
+ // but QMenu::paintEvent() paints popup frame after all items. That means highlighted
+ // items here would paint the highlight over the frame border. Since calls to PART_MENU_ITEM
+ // are always preceded by calls to PART_ENTIRE_CONTROL, just remember the size for the whole
+ // popup (otherwise not possible to get here) and draw the border afterwards.
+ QRect framerect( lastPopupRect.topLeft() - widgetRect.topLeft(),
+ widgetRect.size().expandedTo( lastPopupRect.size()));
+ QStyleOptionFrame frame;
+ draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value ), framerect );
}
- else if (part == PART_MENU_ITEM_CHECK_MARK && (nControlState & CTRL_STATE_PRESSED) )
+ else if( part == PART_MENU_SEPARATOR )
{
- QStyleOptionButton option;
- draw( QStyle::PE_IndicatorMenuCheckMark, &option, m_image,
- vclStateValue2StateFlag(nControlState, value) );
+ QStyleOptionMenuItem option;
+ option.menuItemType = QStyleOptionMenuItem::Separator;
+ // Painting the whole menu item area results in different background
+ // with at least Plastique style, so clip only to the separator itself
+ // (QSize( 2, 2 ) is hardcoded in Qt)
+ option.rect = m_image->rect();
+ QSize size = kapp->style()->sizeFromContents( QStyle::CT_MenuItem, &option, QSize( 2, 2 ));
+ QRect rect = m_image->rect();
+ QPoint center = rect.center();
+ rect.setHeight( size.height());
+ rect.moveCenter( center );
+ // don't paint over popup frame border (like the hack above, but here it can be simpler)
+ int fw = kapp->style()->pixelMetric( QStyle::PM_MenuPanelWidth );
+ clipRegion = new QRegion( rect.translated( widgetRect.topLeft()).adjusted( fw, 0, -fw, 0 ));
+ draw( QStyle::CE_MenuItem, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value), rect );
}
- else if (part == PART_MENU_ITEM_RADIO_MARK && (nControlState & CTRL_STATE_PRESSED) )
+ else if( part == PART_MENU_ITEM_CHECK_MARK || part == PART_MENU_ITEM_RADIO_MARK )
{
- QStyleOptionButton option;
- draw( QStyle::PE_IndicatorRadioButton, &option, m_image,
- vclStateValue2StateFlag(nControlState, value) );
+ QStyleOptionMenuItem option;
+ option.checkType = ( part == PART_MENU_ITEM_CHECK_MARK )
+ ? QStyleOptionMenuItem::NonExclusive : QStyleOptionMenuItem::Exclusive;
+ option.checked = ( nControlState & CTRL_STATE_PRESSED );
+ // widgetRect is now the rectangle for the checkbox/radiobutton itself, but Qt
+ // paints the whole menu item, so translate position (and it'll be clipped);
+ // it is also necessary to fill the background transparently first, as this
+ // is painted after menuitem highlight, otherwise there would be a grey area
+ const MenupopupValue* menuVal = static_cast<const MenupopupValue*>(&value);
+ QRect menuItemRect( region2QRect( menuVal->maItemRect ));
+ QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(),
+ widgetRect.size().expandedTo( menuItemRect.size()));
+ m_image->fill( Qt::transparent );
+ draw( QStyle::CE_MenuItem, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value), rect );
}
- else
+ else if( part == PART_ENTIRE_CONTROL )
{
- #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- QStyleOptionFrameV3 option;
- option.frameShape = QFrame::StyledPanel;
- #else
- QStyleOptionFrameV2 option;
- #endif
- draw( QStyle::PE_FrameMenu, &option, m_image,
- vclStateValue2StateFlag(nControlState, value) );
+ QStyleOptionMenuItem option;
+ draw( QStyle::PE_PanelMenu, &option, m_image, vclStateValue2StateFlag( nControlState, value ));
+ QStyleOptionFrame frame;
+ draw( QStyle::PE_FrameMenu, &frame, m_image, vclStateValue2StateFlag( nControlState, value ));
+ lastPopupRect = widgetRect;
}
+ else
+ returnVal = false;
}
else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) )
{
@@ -351,26 +414,25 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
vclStateValue2StateFlag(nControlState, value) );
}
else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
- {
- const int tw = widgetRect.width();
- widgetRect.setWidth(kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent));
+ { // reduce paint area only to the handle area
+ const int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
+ QRect rect( 0, 0, width, widgetRect.height());
+ clipRegion = new QRegion( widgetRect.x(), widgetRect.y(), width, widgetRect.height());
QStyleOption option;
option.state = QStyle::State_Horizontal;
draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image,
- vclStateValue2StateFlag(nControlState, value) );
-
- widgetRect.setWidth(tw);
+ vclStateValue2StateFlag(nControlState, value), rect );
}
else if (type == CTRL_EDITBOX)
{
QStyleOptionFrameV2 option;
draw( QStyle::PE_PanelLineEdit, &option, m_image,
- vclStateValue2StateFlag(nControlState, value), 2 );
+ vclStateValue2StateFlag(nControlState, value), m_image->rect().adjusted( 2, 2, -2, -2 ));
draw( QStyle::PE_FrameLineEdit, &option, m_image,
- vclStateValue2StateFlag(nControlState, value), 0 );
+ vclStateValue2StateFlag(nControlState, value));
}
else if (type == CTRL_COMBOBOX)
{
@@ -440,6 +502,7 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
//setup parameters from the OO values
option.minimum = sbVal->mnMin;
option.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
+ option.maximum = qMax( option.maximum, option.minimum ); // bnc#619772
option.sliderValue = sbVal->mnCur;
option.sliderPosition = sbVal->mnCur;
option.pageStep = sbVal->mnVisibleSize;
@@ -497,24 +560,8 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
vclStateValue2StateFlag(nControlState, value) );
// draw just the border, see http://qa.openoffice.org/issues/show_bug.cgi?id=107945
- int nFrameWidth = getFrameWidth();
- pTempClipRegion = XCreateRegion();
- XRectangle xRect = { widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height() };
- XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion );
- xRect.x += nFrameWidth;
- xRect.y += nFrameWidth;
-
- // do not crash for too small widgets, see http://qa.openoffice.org/issues/show_bug.cgi?id=112102
- if( xRect.width > 2*nFrameWidth && xRect.height > 2*nFrameWidth )
- {
- xRect.width -= 2*nFrameWidth;
- xRect.height -= 2*nFrameWidth;
-
- XLIB_Region pSubtract = XCreateRegion();
- XUnionRectWithRegion( &xRect, pSubtract, pSubtract );
- XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion );
- XDestroyRegion( pSubtract );
- }
+ int fw = getFrameWidth();
+ clipRegion = new QRegion( QRegion( widgetRect ).subtracted( widgetRect.adjusted( fw, fw, -fw, -fw )));
}
else if (type == CTRL_FIXEDBORDER)
{
@@ -549,6 +596,18 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CC_Slider, &option, m_image, vclStateValue2StateFlag(nControlState, value) );
}
+ else if( type == CTRL_PROGRESS && part == PART_ENTIRE_CONTROL )
+ {
+ QStyleOptionProgressBarV2 option;
+ option.minimum = 0;
+ option.maximum = widgetRect.width();
+ option.progress = value.getNumericVal();
+ option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ option.state = vclStateValue2StateFlag( nControlState, value );
+
+ draw( QStyle::CE_ProgressBar, &option, m_image,
+ vclStateValue2StateFlag(nControlState, value) );
+ }
else
{
returnVal = false;
@@ -556,12 +615,40 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
if (returnVal)
{
- GC gc = GetFontGC();
-
+#ifdef IMAGE_BASED_PAINTING
+ // Create a wrapper QPixmap around the destination pixmap, allowing the use of QPainter.
+ // Using X11SalGraphics::CopyScreenArea() would require using QPixmap and if Qt uses
+ // other graphics system than native, QPixmap::handle() would be 0 (i.e. it wouldn't work),
+ // I have no idea how to create QPixmap with non-null handle() in such case, so go this way.
+ // See XRegionToQRegion() comment for a small catch (although not real hopefully).
+ QPixmap destPixmap = QPixmap::fromX11Pixmap( GetDrawable(), QPixmap::ExplicitlyShared );
+ QPainter paint( &destPixmap );
+ if( clipRegion && mpClipRegion )
+ paint.setClipRegion( clipRegion->intersected( XRegionToQRegion( mpClipRegion )));
+ else if( clipRegion )
+ paint.setClipRegion( *clipRegion );
+ else if( mpClipRegion )
+ paint.setClipRegion( XRegionToQRegion( mpClipRegion ));
+ paint.drawImage( widgetRect.left(), widgetRect.top(), *m_image,
+ 0, 0, widgetRect.width(), widgetRect.height(),
+ Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither );
+#else
+ GC gc = SelectFont();
if( gc )
{
- if( pTempClipRegion )
+ XLIB_Region pTempClipRegion = NULL;
+ if( clipRegion )
{
+ pTempClipRegion = XCreateRegion();
+ foreach( const QRect& r, clipRegion->rects())
+ {
+ XRectangle xr;
+ xr.x = r.x();
+ xr.y = r.y();
+ xr.width = r.width();
+ xr.height = r.height();
+ XUnionRectWithRegion( &xr, pTempClipRegion, pTempClipRegion );
+ }
if( mpClipRegion )
XIntersectRegion( pTempClipRegion, mpClipRegion, pTempClipRegion );
XSetRegion( GetXDisplay(), gc, pTempClipRegion );
@@ -578,14 +665,14 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
XSetRegion( GetXDisplay(), gc, mpClipRegion );
else
XSetClipMask( GetXDisplay(), gc, None );
+ XDestroyRegion( pTempClipRegion );
}
}
else
returnVal = false;
+#endif
}
- if( pTempClipRegion )
- XDestroyRegion( pTempClipRegion );
-
+ delete clipRegion;
return returnVal;
}
@@ -595,7 +682,7 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p
const OUString&,
Rectangle &nativeBoundingRegion, Rectangle &nativeContentRegion )
{
- bool retVal = false;
+ sal_Bool retVal = false;
QRect boundingRect = region2QRect( controlRegion );
QRect contentRect = boundingRect;
@@ -750,16 +837,8 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p
break;
}
case CTRL_MENU_POPUP:
- //just limit the widget of the menu items
- //OO isn't very flexible in all reguards with the menu
- //so we do the best we can
- if (part == PART_MENU_ITEM_CHECK_MARK)
- {
- contentRect.setWidth(contentRect.height());
- retVal = true;
- }
- else if (part == PART_MENU_ITEM_RADIO_MARK)
- {
+ if (part == PART_MENU_ITEM_CHECK_MARK || part == PART_MENU_ITEM_RADIO_MARK)
+ { // core uses this to detect radio/checkbox sizes, so just set a square
contentRect.setWidth(contentRect.height());
retVal = true;
}
@@ -815,79 +894,38 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p
}
break;
}
- default:
- break;
- }
-#if 0
-
-
- // Metrics of the scroll bar
case CTRL_SCROLLBAR:
- //pWidget = pWidgetPainter->scrollBar( rControlRegion,
- //( part == PART_BUTTON_LEFT || part == PART_BUTTON_RIGHT ),
- //ImplControlValue() );
- //aStyleOption.initFrom( pWidget );
-
- switch ( part )
+ {
+ // core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(),
+ // for the rest also provide the track area (i.e. area not taken by buttons)
+ if( part == PART_TRACK_VERT_AREA || part == PART_TRACK_HORZ_AREA )
{
- case PART_BUTTON_LEFT:
- case PART_BUTTON_UP:
- qRect = kapp->style()->subControlRect(
- QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine );
-
- // Workaround for Platinum style scroll bars. It makes the
- // left/up button invisible.
- if ( part == PART_BUTTON_LEFT )
- {
- if ( qRect.left() > kapp->style()->subControlRect(
- QStyle::CC_ScrollBar, &aStyleOption,
- QStyle::SC_ScrollBarSubPage ).left() )
- {
- qRect.setLeft( 0 );
- qRect.setRight( 0 );
- }
- }
- else
- {
- if ( qRect.top() > kapp->style()->subControlRect(
- QStyle::CC_ScrollBar, &aStyleOption,
- QStyle::SC_ScrollBarSubPage ).top() )
- {
- qRect.setTop( 0 );
- qRect.setBottom( 0 );
- }
- }
-
- qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
-
- bReturn = TRUE;
- break;
-
- case PART_BUTTON_RIGHT:
- case PART_BUTTON_DOWN:
- qRect = kapp->style()->subControlRect(
- QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine );
-
- // Workaround for Platinum and 3 button style scroll bars.
- // It makes the right/down button bigger.
- if ( part == PART_BUTTON_RIGHT )
- qRect.setLeft( kapp->style()->subControlRect(
- QStyle::CC_ScrollBar, &aStyleOption,
- QStyle::SC_ScrollBarAddPage ).right() + 1 );
- else
- qRect.setTop( kapp->style()->subControlRect(
- QStyle::CC_ScrollBar, &aStyleOption,
- QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
-
- qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
-
- bReturn = TRUE;
- break;
+ QStyleOptionSlider option;
+ OSL_ASSERT( val.getType() == CTRL_SCROLLBAR );
+ const ScrollbarValue* sbVal = static_cast<const ScrollbarValue *>(&val);
+ option.orientation = ( part == PART_TRACK_HORZ_AREA ) ? Qt::Horizontal : Qt::Vertical;
+ option.minimum = sbVal->mnMin;
+ option.maximum = sbVal->mnMax;
+ option.sliderValue = sbVal->mnCur;
+ option.sliderPosition = sbVal->mnCur;
+ option.pageStep = sbVal->mnVisibleSize;
+ // Adjust coordinates to make the widget appear to be at (0,0), i.e. make
+ // widget and screen coordinates the same. QStyle functions should use screen
+ // coordinates but at least QPlastiqueStyle::subControlRect() is buggy
+ // and sometimes uses widget coordinates.
+ QRect rect = contentRect;
+ rect.moveTo( 0, 0 );
+ option.rect = rect;
+ rect = kapp->style()->subControlRect( QStyle::CC_ScrollBar, &option,
+ QStyle::SC_ScrollBarGroove );
+ rect.translate( contentRect.topLeft()); // reverse the workaround above
+ contentRect = boundingRect = rect;
+ retVal = true;
}
+ }
+ default:
break;
}
-#endif
-
if (retVal)
{
// Bounding region
@@ -903,3 +941,52 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p
return retVal;
}
+
+/** Test whether the position is in the native widget.
+ If the return value is TRUE, bIsInside contains information whether
+ aPos was or was not inside the native widget specified by the
+ nType/nPart combination.
+*/
+sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
+ const Rectangle& rControlRegion, const Point& rPos,
+ sal_Bool& rIsInside )
+{
+ if ( nType == CTRL_SCROLLBAR )
+ {
+ if( nPart != PART_BUTTON_UP && nPart != PART_BUTTON_DOWN
+ && nPart != PART_BUTTON_LEFT && nPart != PART_BUTTON_RIGHT )
+ { // we adjust only for buttons (because some scrollbars have 3 buttons,
+ // and LO core doesn't handle such scrollbars well)
+ return FALSE;
+ }
+ rIsInside = FALSE;
+ bool bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT );
+ QRect rect = region2QRect( rControlRegion );
+ QPoint pos( rPos.X(), rPos.Y());
+ // Adjust coordinates to make the widget appear to be at (0,0), i.e. make
+ // widget and screen coordinates the same. QStyle functions should use screen
+ // coordinates but at least QPlastiqueStyle::subControlRect() is buggy
+ // and sometimes uses widget coordinates.
+ pos -= rect.topLeft();
+ rect.moveTo( 0, 0 );
+ QStyleOptionSlider options;
+ options.orientation = bHorizontal ? Qt::Horizontal : Qt::Vertical;
+ options.rect = rect;
+ // some random sensible values, since we call this code only for scrollbar buttons,
+ // the slider position does not exactly matter
+ options.maximum = 10;
+ options.minimum = 0;
+ options.sliderPosition = options.sliderValue = 4;
+ options.pageStep = 2;
+ QStyle::SubControl control = kapp->style()->hitTestComplexControl( QStyle::CC_ScrollBar, &options, pos );
+ if( nPart == PART_BUTTON_UP || nPart == PART_BUTTON_LEFT )
+ rIsInside = ( control == QStyle::SC_ScrollBarSubLine );
+ else // DOWN, RIGHT
+ rIsInside = ( control == QStyle::SC_ScrollBarAddLine );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx
index ea1deebfc35c..2f4c3f384c75 100644
--- a/vcl/unx/kde4/KDESalGraphics.hxx
+++ b/vcl/unx/kde4/KDESalGraphics.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,6 +40,7 @@
class KDESalGraphics : public X11SalGraphics
{
QImage* m_image;
+ QRect lastPopupRect;
public:
KDESalGraphics();
@@ -111,3 +113,5 @@ class KDESalGraphics : public X11SalGraphics
const rtl::OUString& aCaption,
Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx
index c8d0858279f3..c63d328e29c3 100644
--- a/vcl/unx/kde4/KDESalInstance.cxx
+++ b/vcl/unx/kde4/KDESalInstance.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,3 +34,5 @@ SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, sal_uLong nState )
{
return new KDESalFrame( pParent, nState );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx
index 32f51c4e8c0e..a8efcd4dcde1 100644
--- a/vcl/unx/kde4/KDESalInstance.hxx
+++ b/vcl/unx/kde4/KDESalInstance.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,3 +40,5 @@ class KDESalInstance : public X11SalInstance
virtual ~KDESalInstance() {}
virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 427c9e7576a8..c025d4b28215 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,6 +37,9 @@
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kstartupinfo.h>
+#include <qabstracteventdispatcher.h>
+#include <qclipboard.h>
+#include <qthread.h>
#undef Region
@@ -45,6 +49,7 @@
#include <unx/i18n_xkb.hxx>
#include <unx/saldata.hxx>
+#include <osl/process.h>
#include "KDESalDisplay.hxx"
@@ -52,15 +57,40 @@
#include <stdio.h>
#endif
+#include <stdio.h>
+
+#if QT_VERSION >= QT_VERSION_CHECK( 4, 8, 0 )
+#define QT_UNIX_EVENT_LOOP_SUPPORT
+#ifdef KDE_HAVE_GLIB
+#define GLIB_EVENT_LOOP_SUPPORT
+#endif
+#endif
+
+#ifdef GLIB_EVENT_LOOP_SUPPORT
+#include <glib-2.0/glib.h>
+#endif
+
KDEXLib::KDEXLib() :
SalXLib(), m_bStartupDone(false), m_pApplication(0),
- m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 )
+ m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 ),
+ eventLoopType( LibreOfficeEventLoop )
{
+ // the timers created here means they belong to the main thread
+ connect( &timeoutTimer, SIGNAL( timeout()), this, SLOT( timeoutActivated()));
+ connect( &userEventTimer, SIGNAL( timeout()), this, SLOT( userEventActivated()));
+ // QTimer::start() can be called only in its (here main) thread, so this will
+ // forward between threads if needed
+ connect( this, SIGNAL( startTimeoutTimerSignal()), this, SLOT( startTimeoutTimer()), Qt::QueuedConnection );
+ connect( this, SIGNAL( startUserEventTimerSignal()), this, SLOT( startUserEventTimer()), Qt::QueuedConnection );
+ // this one needs to be blocking, so that the handling in main thread is processed before
+ // the thread emitting the signal continues
+ connect( this, SIGNAL( processYieldSignal( bool, bool )), this, SLOT( processYield( bool, bool )),
+ Qt::BlockingQueuedConnection );
}
KDEXLib::~KDEXLib()
{
- delete (VCLKDEApplication*)m_pApplication;
+ delete m_pApplication;
// free the faked cmdline arguments no longer needed by KApplication
for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
@@ -78,16 +108,16 @@ void KDEXLib::Init()
pInputMethod->SetLocale();
XrmInitialize();
- KAboutData *kAboutData = new KAboutData("OpenOffice.org",
+ KAboutData *kAboutData = new KAboutData("LibreOffice",
"kdelibs4",
- ki18n( "OpenOffice.org" ),
- "3.0.0",
- ki18n( "OpenOffice.org with KDE Native Widget Support." ),
+ ki18n( "LibreOffice" ),
+ "3.3.0",
+ ki18n( "LibreOffice with KDE Native Widget Support." ),
KAboutData::License_LGPL,
ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Novell, Inc"),
- ki18n( "OpenOffice.org is an office suite.\n" ),
- "http://kde.openoffice.org/index.html",
- "dev@kde.openoffice.org" );
+ ki18n( "LibreOffice is an office suite.\n" ),
+ "http://libreoffice.org",
+ "libreoffice@lists.freedesktop.org" );
kAboutData->addAuthor( ki18n( "Jan Holesovsky" ),
ki18n( "Original author and maintainer of the KDE NWF." ),
@@ -102,25 +132,25 @@ void KDEXLib::Init()
//kAboutData->setProgramIconName("OpenOffice");
- m_nFakeCmdLineArgs = 1;
- int nIdx;
- vos::OExtCommandLine aCommandLine;
- int nParams = aCommandLine.getCommandArgCount();
+ m_nFakeCmdLineArgs = 2;
+ sal_uInt16 nIdx;
+
+ int nParams = osl_getCommandArgCount();
rtl::OString aDisplay;
rtl::OUString aParam, aBin;
for ( nIdx = 0; nIdx < nParams; ++nIdx )
{
- aCommandLine.getCommandArg( nIdx, aParam );
- if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams )
+ osl_getCommandArg( nIdx, &aParam.pData );
+ if ( !m_pFreeCmdLineArgs && aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) && nIdx + 1 < nParams )
{
- aCommandLine.getCommandArg( nIdx + 1, aParam );
+ osl_getCommandArg( nIdx + 1, &aParam.pData );
aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() );
- m_nFakeCmdLineArgs = 3;
- m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
- m_pFreeCmdLineArgs[ 1 ] = strdup( "-display" );
- m_pFreeCmdLineArgs[ 2 ] = strdup( aDisplay.getStr() );
+ m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs + 2 ];
+ m_pFreeCmdLineArgs[ m_nFakeCmdLineArgs + 0 ] = strdup( "-display" );
+ m_pFreeCmdLineArgs[ m_nFakeCmdLineArgs + 1 ] = strdup( aDisplay.getStr() );
+ m_nFakeCmdLineArgs += 2;
}
}
if ( !m_pFreeCmdLineArgs )
@@ -130,6 +160,7 @@ void KDEXLib::Init()
osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
rtl::OString aExec = rtl::OUStringToOString( aBin, osl_getThreadTextEncoding() );
m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() );
+ m_pFreeCmdLineArgs[1] = strdup( "--nocrashhandler" );
// make a copy of the string list for freeing it since
// KApplication manipulates the pointers inside the argument vector
@@ -143,12 +174,11 @@ void KDEXLib::Init()
m_pApplication = new VCLKDEApplication();
kapp->disableSessionManagement();
KApplication::setQuitOnLastWindowClosed(false);
+ setupEventLoop();
Display* pDisp = QX11Info::display();
SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
- ((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
-
pInputMethod->CreateMethod( pDisp );
pInputMethod->AddConnectionWatch( pDisp, (void*)this );
pSalDisplay->SetInputMethod( pInputMethod );
@@ -157,12 +187,228 @@ void KDEXLib::Init()
SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
XSync( pDisp, False );
- pKbdExtension->UseExtension( ! HasXErrorOccured() );
+ pKbdExtension->UseExtension( ! HasXErrorOccurred() );
PopXErrorLevel();
pSalDisplay->SetKbdExtension( pKbdExtension );
}
+// When we use Qt event loop, it can actually use its own event loop handling, or wrap
+// the Glib event loop (the latter is the default is Qt is built with Glib support
+// and $QT_NO_GLIB is not set). We mostly do not care which one it is, as QSocketNotifier's
+// and QTimer's can handle it transparently, but it matters for the SolarMutex, which
+// needs to be unlocked shortly before entering the main sleep (e.g. select()) and locked
+// immediatelly after. So we need to know which event loop implementation is used and
+// hook accordingly.
+#ifdef GLIB_EVENT_LOOP_SUPPORT
+static GPollFunc old_gpoll = NULL;
+static gint gpoll_wrapper( GPollFD*, guint, gint );
+#endif
+#ifdef QT_UNIX_EVENT_LOOP_SUPPORT
+static int (*qt_select)(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
+ const struct timeval *orig_timeout);
+static int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
+ const struct timeval *orig_timeout);
+#endif
+
+static bool ( *old_qt_event_filter )( void* );
+static bool qt_event_filter( void* m )
+{
+ if( old_qt_event_filter != NULL && old_qt_event_filter( m ))
+ return true;
+ if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( static_cast< XEvent* >( m )))
+ return true;
+ return false;
+}
+
+void KDEXLib::setupEventLoop()
+{
+ old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter );
+#ifdef GLIB_EVENT_LOOP_SUPPORT
+// Glib is simple, it has g_main_context_set_poll_func() for wrapping the sleep call.
+// The catch is that Qt has a bug that allows triggering timers even when they should
+// not be, leading to crashes caused by QClipboard re-entering the event loop.
+// (http://bugreports.qt.nokia.com/browse/QTBUG-14461), so enable only with Qt>=4.8.0,
+// where it is(?) fixed.
+ if( QAbstractEventDispatcher::instance()->inherits( "QEventDispatcherGlib" ))
+ {
+ eventLoopType = GlibEventLoop;
+ old_gpoll = g_main_context_get_poll_func( NULL );
+ g_main_context_set_poll_func( NULL, gpoll_wrapper );
+ // set QClipboard to use event loop, otherwise the main thread will hold
+ // SolarMutex locked, which will prevent the clipboard thread from answering
+ m_pApplication->clipboard()->setProperty( "useEventLoopWhenWaiting", true );
+ return;
+ }
+#endif
+#ifdef QT_UNIX_EVENT_LOOP_SUPPORT
+// When Qt does not use Glib support, it uses its own Unix event dispatcher.
+// That one has aboutToBlock() and awake() signals, but they are broken (either
+// functionality or semantics), as e.g. awake() is not emitted right after the dispatcher
+// is woken up from sleep again, but only later (which is too late for re-acquiring SolarMutex).
+// This should be fixed with Qt-4.8.0 (?) where support for adding custom select() function
+// has been added too (http://bugreports.qt.nokia.com/browse/QTBUG-16934).
+ if( QAbstractEventDispatcher::instance()->inherits( "QEventDispatcherUNIX" ))
+ {
+ eventLoopType = QtUnixEventLoop;
+ QInternal::callFunction( QInternal::GetUnixSelectFunction, reinterpret_cast< void** >( &qt_select ));
+ QInternal::callFunction( QInternal::SetUnixSelectFunction, reinterpret_cast< void** >( lo_select ));
+ // set QClipboard to use event loop, otherwise the main thread will hold
+ // SolarMutex locked, which will prevent the clipboard thread from answering
+ m_pApplication->clipboard()->setProperty( "useEventLoopWhenWaiting", true );
+ return;
+ }
+#endif
+}
+
+#ifdef GLIB_EVENT_LOOP_SUPPORT
+gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout )
+{
+ YieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
+ return old_gpoll( ufds, nfds, timeout );
+}
+#endif
+
+#ifdef QT_UNIX_EVENT_LOOP_SUPPORT
+int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
+ const struct timeval *orig_timeout)
+{
+ YieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
+ return qt_select( nfds, fdread, fdwrite, fdexcept, orig_timeout );
+}
+#endif
+
+void KDEXLib::Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle )
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ return SalXLib::Insert( fd, data, pending, queued, handle );
+ SocketData sdata;
+ sdata.data = data;
+ sdata.pending = pending;
+ sdata.queued = queued;
+ sdata.handle = handle;
+ // qApp as parent to make sure it uses the main thread event loop
+ sdata.notifier = new QSocketNotifier( fd, QSocketNotifier::Read, qApp );
+ connect( sdata.notifier, SIGNAL( activated( int )), this, SLOT( socketNotifierActivated( int )));
+ socketData[ fd ] = sdata;
+}
+
+void KDEXLib::Remove( int fd )
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ return SalXLib::Remove( fd );
+ SocketData sdata = socketData.take( fd );// according to SalXLib::Remove() this should be safe
+ delete sdata.notifier;
+}
+
+void KDEXLib::socketNotifierActivated( int fd )
+{
+ const SocketData& sdata = socketData[ fd ];
+ sdata.handle( fd, sdata.data );
+}
+
+void KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ {
+ if( qApp->thread() == QThread::currentThread())
+ {
+ // even if we use the LO event loop, still process Qt's events,
+ // otherwise they can remain unhandled for quite a long while
+ processYield( false, bHandleAllCurrentEvents );
+ }
+ return SalXLib::Yield( bWait, bHandleAllCurrentEvents );
+ }
+ // if we are the main thread (which is where the event processing is done),
+ // good, just do it
+ if( qApp->thread() == QThread::currentThread())
+ processYield( bWait, bHandleAllCurrentEvents );
+ else
+ { // if this deadlocks, event processing needs to go into a separate thread
+ // or some other solution needs to be found
+ emit processYieldSignal( bWait, bHandleAllCurrentEvents );
+ }
+}
+
+bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents )
+{
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
+ bool wasEvent = false;
+ for( int cnt = bHandleAllCurrentEvents ? 100 : 1;
+ cnt > 0;
+ --cnt )
+ {
+ if( !dispatcher->processEvents( QEventLoop::AllEvents ))
+ break;
+ wasEvent = true;
+ }
+ if( bWait && !wasEvent )
+ wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents );
+ return wasEvent;
+}
+
+void KDEXLib::StartTimer( sal_uLong nMS )
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ return SalXLib::StartTimer( nMS );
+ timeoutTimer.setInterval( nMS );
+ // QTimer's can be started only in their thread (main thread here)
+ if( qApp->thread() == QThread::currentThread())
+ startTimeoutTimer();
+ else
+ emit startTimeoutTimerSignal();
+}
+
+void KDEXLib::startTimeoutTimer()
+{
+ timeoutTimer.start();
+}
+
+void KDEXLib::StopTimer()
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ return SalXLib::StopTimer();
+ timeoutTimer.stop();
+}
+
+void KDEXLib::timeoutActivated()
+{
+ GetX11SalData()->Timeout();
+ // QTimer is not single shot, so will be restarted immediatelly
+}
+
+void KDEXLib::Wakeup()
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ return SalXLib::Wakeup();
+ QAbstractEventDispatcher::instance( qApp->thread())->wakeUp(); // main thread event loop
+}
+
+void KDEXLib::PostUserEvent()
+{
+ if( eventLoopType == LibreOfficeEventLoop )
+ return SalXLib::PostUserEvent();
+ if( qApp->thread() == QThread::currentThread())
+ startUserEventTimer();
+ else
+ emit startUserEventTimerSignal();
+}
+
+void KDEXLib::startUserEventTimer()
+{
+ userEventTimer.start( 0 );
+}
+
+void KDEXLib::userEventActivated()
+{
+ SalKDEDisplay::self()->EventGuardAcquire();
+ if( SalKDEDisplay::self()->userEventsCount() <= 1 )
+ userEventTimer.stop();
+ SalKDEDisplay::self()->EventGuardRelease();
+ SalKDEDisplay::self()->DispatchInternalEvent();
+ // QTimer is not single shot, so will be restarted immediatelly
+}
+
void KDEXLib::doStartup()
{
if( ! m_bStartupDone )
@@ -174,3 +420,5 @@ void KDEXLib::doStartup()
#endif
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx
index 561f6ee73a78..497a97f3b828 100644
--- a/vcl/unx/kde4/KDEXLib.hxx
+++ b/vcl/unx/kde4/KDEXLib.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,21 +30,65 @@
#include <unx/saldisp.hxx>
-class KDEXLib : public SalXLib
+#include <fixx11h.h>
+
+#include <qhash.h>
+#include <qsocketnotifier.h>
+#include <qtimer.h>
+
+class VCLKDEApplication;
+
+class KDEXLib : public QObject, public SalXLib
{
+ Q_OBJECT
private:
bool m_bStartupDone;
- void* m_pApplication;
+ VCLKDEApplication* m_pApplication;
char** m_pFreeCmdLineArgs;
char** m_pAppCmdLineArgs;
int m_nFakeCmdLineArgs;
+ struct SocketData
+ {
+ void* data;
+ YieldFunc pending;
+ YieldFunc queued;
+ YieldFunc handle;
+ QSocketNotifier* notifier;
+ };
+ QHash< int, SocketData > socketData; // key is fd
+ QTimer timeoutTimer;
+ QTimer userEventTimer;
+ enum { LibreOfficeEventLoop, GlibEventLoop, QtUnixEventLoop } eventLoopType;
+
+ private:
+ void setupEventLoop();
+
+ private slots:
+ void socketNotifierActivated( int fd );
+ void timeoutActivated();
+ void userEventActivated();
+ void startTimeoutTimer();
+ void startUserEventTimer();
+ bool processYield( bool bWait, bool bHandleAllCurrentEvents );
+ signals:
+ void startTimeoutTimerSignal();
+ void startUserEventTimerSignal();
+ void processYieldSignal( bool bWait, bool bHandleAllCurrentEvents );
public:
KDEXLib();
-
virtual ~KDEXLib();
+
virtual void Init();
+ virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
+ virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle );
+ virtual void Remove( int fd );
+ virtual void StartTimer( sal_uLong nMS );
+ virtual void StopTimer();
+ virtual void Wakeup();
+ virtual void PostUserEvent();
void doStartup();
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/VCLKDEApplication.cxx b/vcl/unx/kde4/VCLKDEApplication.cxx
index 94d28d2e698a..9ab88020d119 100644
--- a/vcl/unx/kde4/VCLKDEApplication.cxx
+++ b/vcl/unx/kde4/VCLKDEApplication.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,17 +37,18 @@
VCLKDEApplication::VCLKDEApplication() :
KApplication()
{
- disp = 0;
}
bool VCLKDEApplication::x11EventFilter(XEvent* ev)
{
//if we have a display and the display consumes the event
//do not process the event in qt
- if (disp && disp->Dispatch(ev) > 0)
+ if (SalKDEDisplay::self() && SalKDEDisplay::self()->Dispatch(event) > 0)
{
return true;
}
return false;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx
index 7cbbe38b61df..17a9b6eb0917 100644
--- a/vcl/unx/kde4/VCLKDEApplication.hxx
+++ b/vcl/unx/kde4/VCLKDEApplication.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,8 +36,6 @@
#undef Region
-class SalKDEDisplay;
-
/* #i59042# override KApplications method for session management
* since it will interfere badly with our own.
*/
@@ -48,6 +47,6 @@ class VCLKDEApplication : public KApplication
virtual void commitData(QSessionManager&) {};
virtual bool x11EventFilter(XEvent* event);
-
- SalKDEDisplay* disp;
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx
index 063cdf2bef86..6bc06f3fa880 100644
--- a/vcl/unx/kde4/main.cxx
+++ b/vcl/unx/kde4/main.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -93,3 +94,5 @@ extern "C" {
return pInstance;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */