[ooo-build-commit] Branch 'ooo/master' - 2 commits - comphelper/source vcl/prj vcl/source vcl/unx vcl/util
Jan Holesovsky
kendy at kemper.freedesktop.org
Fri Aug 7 18:23:19 PDT 2009
comphelper/source/misc/mediadescriptor.cxx | 9
vcl/prj/build.lst | 3
vcl/source/control/combobox.cxx | 28
vcl/source/control/lstbox.cxx | 4
vcl/source/window/tabpage.cxx | 2
vcl/unx/kde4/KDEData.cxx | 52 +
vcl/unx/kde4/KDEData.hxx | 42 +
vcl/unx/kde4/KDESalDisplay.cxx | 45 +
vcl/unx/kde4/KDESalDisplay.hxx | 37 +
vcl/unx/kde4/KDESalFrame.cxx | 409 ++++++++++++++
vcl/unx/kde4/KDESalFrame.hxx | 58 ++
vcl/unx/kde4/KDESalGraphics.cxx | 819 +++++++++++++++++++++++++++++
vcl/unx/kde4/KDESalGraphics.hxx | 114 ++++
vcl/unx/kde4/KDESalInstance.cxx | 35 +
vcl/unx/kde4/KDESalInstance.hxx | 41 +
vcl/unx/kde4/KDEXLib.cxx | 171 ++++++
vcl/unx/kde4/KDEXLib.hxx | 48 +
vcl/unx/kde4/VCLKDEApplication.cxx | 52 +
vcl/unx/kde4/VCLKDEApplication.hxx | 53 +
vcl/unx/kde4/main.cxx | 83 ++
vcl/unx/kde4/makefile.mk | 92 +++
vcl/unx/source/plugadapt/salplug.cxx | 137 ++--
vcl/util/makefile.mk | 31 +
23 files changed, 2268 insertions(+), 97 deletions(-)
New commits:
commit c825f3d99f77f386c906ab71f99ec381b5ed2c9f
Author: Release Engineers <releng at openoffice.org>
Date: Fri Aug 7 13:32:06 2009 +0000
CWS-TOOLING: integrate CWS gciteratorfix_DEV300
2009-08-04 10:23:19 +0200 od r274608 : add missing patch flags for libaries swui, msword and xo
2009-08-03 16:42:48 +0200 mav r274586 : #i101899# workaround the wrong error code on MAC
2009-08-03 13:24:44 +0200 tl r274575 : #i103936# fix for grammar checking loop
2009-08-03 12:37:37 +0200 tl r274573 : #i103936# fix for grammar checking loop
2009-08-03 12:10:01 +0200 tl r274572 : #i103936# fix for grammar checking loop
2009-08-03 09:06:49 +0200 tl r274565 : #i103936# fix for grammar checking loop
2009-08-03 09:04:50 +0200 tl r274564 : #i103936# fix for grammar checking loop
2009-07-31 17:52:45 +0200 tl r274545 : #i103936# fix for grammar checking loop
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index c6ee692..edf3c19 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -726,8 +726,13 @@ class StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
css::ucb::InteractiveIOException exIO;
xRequest->getRequest() >>= exIO;
bAbort = (
- (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) ||
- (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
+ (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED )
+ || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION )
+#ifdef MACOSX
+ // this is a workaround for MAC, on this platform if the file is locked
+ // the returned error code looks to be wrong
+ || (exIO.Code == css::ucb::IOErrorCode_GENERAL )
+#endif
);
}
break;
commit da4e7e9629d03d0c0507f7e29114b175bd18966e
Author: Release Engineers <releng at openoffice.org>
Date: Fri Aug 7 10:16:34 2009 +0000
CWS-TOOLING: integrate CWS kde4int
2009-07-15 10:40:52 +0200 pl r273993 : #i103288# configure
2009-07-09 14:57:24 +0200 pl r273867 : #i103284# spin fields
2009-07-09 13:49:13 +0200 pl r273864 : #i103284# min size for dropdown comboboxes
2009-07-09 13:46:11 +0200 pl r273860 : #i103284# min size fro dropdown listboxes
2009-07-09 13:01:48 +0200 pl r273857 : #i103284# fix most radiobuttons and checboxes, also on tabpages
2009-07-08 19:38:12 +0200 pl r273847 : #i103290# clean up, enable KDE4 fpicker
2009-07-08 15:54:06 +0200 pl r273837 : #i103284# background mode opaque doesn't look that good
2009-07-07 19:29:01 +0200 pl r273814 : add kde4 directory and deliverables
2009-07-07 11:18:08 +0200 pl r273786 : make compile with Qt 4.1
2009-07-02 19:20:47 +0200 pl r273673 : #i103290# add: KDE4 file picker (thanks Roman Shtylman)
2009-07-02 19:16:07 +0200 pl r273672 : #i103289# add: KDE4integration (thanks Roman Shtylman)
2009-07-02 19:01:20 +0200 pl r273671 : #i103286# add: KDE4 checks (thanks Roman Shtylman)
2009-07-02 18:58:15 +0200 pl r273670 : #i103286# initial import for KDE4 backend (thanks Roman Shtylman)
2009-07-02 18:08:06 +0200 pl r273668 : #i103284# initial import for KDE4 plugin (thanks Roman Shtylman)
diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst
index aea5211..3af135d 100644
--- a/vcl/prj/build.lst
+++ b/vcl/prj/build.lst
@@ -32,6 +32,7 @@ vc vcl\unx\gtk\window nmake - u vc__gtkw vc_inc NULL
vc vcl\unx\gtk\gdi nmake - u vc__gtkg vc_inc NULL
vc vcl\unx\headless nmake - u vc__hl vc_inc NULL
vc vcl\unx\kde nmake - u vc__kde vc_inc NULL
+vc vcl\unx\kde4 nmake - u vc__kde4 vc_inc NULL
vc vcl\aqua\source\a11y nmake - u vc__aquy vc_inc NULL
vc vcl\aqua\source\app nmake - u vc__appa vc_inc NULL
vc vcl\aqua\source\gdi nmake - u vc__gdia vc_inc NULL
@@ -41,6 +42,6 @@ vc vcl\mac\source\app nmake - m vc__appm vc_inc NULL
vc vcl\mac\source\gdi nmake - m vc__gdim vc_inc NULL
vc vcl\mac\source\window nmake - m vc__winm vc_inc NULL
vc vcl\mac\source\src nmake - m vc__srcm vc_inc NULL
-vc vcl\util nmake - all vc_util vc__plug.u vc__aquy.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL
+vc vcl\util nmake - all vc_util vc__plug.u vc__aquy.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL
vc vcl\util\linksvp nmake - u vc_lsvp vc_util NULL
vc vcl\workben nmake - all vc_wrkb vc_util vc_salmain NULL
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 371ea7b..59caccf 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -142,23 +142,19 @@ void ComboBox::ImplCalcEditHeight()
if ( !IsDropDownBox() )
mnDDHeight += 4;
- // FIXME: currently only on aqua; see if we can use this on other platforms
- if( ImplGetSVData()->maNWFData.mbNoFocusRects )
+ Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 10, 10 ) ) );
+ Region aBoundRegion, aContentRegion;
+ ImplControlValue aControlValue;
+ ControlType aType = IsDropDownBox() ? CTRL_COMBOBOX : CTRL_EDITBOX;
+ if( GetNativeControlRegion( aType, PART_ENTIRE_CONTROL,
+ aCtrlRegion,
+ CTRL_STATE_ENABLED,
+ aControlValue, rtl::OUString(),
+ aBoundRegion, aContentRegion ) )
{
- Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 10, 10 ) ) );
- Region aBoundRegion, aContentRegion;
- ImplControlValue aControlValue;
- ControlType aType = IsDropDownBox() ? CTRL_COMBOBOX : CTRL_EDITBOX;
- if( GetNativeControlRegion( aType, PART_ENTIRE_CONTROL,
- aCtrlRegion,
- CTRL_STATE_ENABLED,
- aControlValue, rtl::OUString(),
- aBoundRegion, aContentRegion ) )
- {
- const long nNCHeight = aBoundRegion.GetBoundRect().GetHeight();
- if( mnDDHeight < nNCHeight )
- mnDDHeight = sal::static_int_cast<USHORT>( nNCHeight );
- }
+ const long nNCHeight = aBoundRegion.GetBoundRect().GetHeight();
+ if( mnDDHeight < nNCHeight )
+ mnDDHeight = sal::static_int_cast<USHORT>( nNCHeight );
}
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 8aeb6c5..9f50be1 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -127,9 +127,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
GetBorder( nLeft, nTop, nRight, nBottom );
mnDDHeight = (USHORT)(GetTextHeight() + nTop + nBottom + 4);
- // FIXME: this is currently only on mac/aqua
- if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
- IsNativeWidgetEnabled() &&
+ if( IsNativeWidgetEnabled() &&
IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) )
{
ImplControlValue aControlValue;
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 2d8e6c8..9417b71 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -121,6 +121,8 @@ void TabPage::StateChanged( StateChangedType nType )
{
if ( GetSettings().GetStyleSettings().GetAutoMnemonic() )
ImplWindowAutoMnemonic( this );
+ // FIXME: no layouting, workaround some clipping issues
+ ImplAdjustNWFSizes();
}
else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
{
diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx
new file mode 100644
index 0000000..971eae6
--- /dev/null
+++ b/vcl/unx/kde4/KDEData.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "KDEData.hxx"
+
+#include "KDEXLib.hxx"
+
+KDEData::~KDEData()
+{
+}
+
+void KDEData::Init()
+{
+ pXLib_ = new KDEXLib();
+ pXLib_->Init();
+}
+
+void KDEData::initNWF()
+{
+ ImplSVData *pSVData = ImplGetSVData();
+
+ // draw toolbars on separate lines
+ pSVData->maNWFData.mbDockingAreaSeparateTB = true;
+}
+
+void KDEData::deInitNWF()
+{
+}
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDEData.hxx b/vcl/unx/kde4/KDEData.hxx
new file mode 100644
index 0000000..d842017
--- /dev/null
+++ b/vcl/unx/kde4/KDEData.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <saldisp.hxx>
+#include <saldata.hxx>
+
+class KDEData : public X11SalData
+{
+ public:
+ KDEData() {}
+ virtual ~KDEData();
+
+ virtual void Init();
+ virtual void initNWF();
+ virtual void deInitNWF();
+};
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
new file mode 100644
index 0000000..16f128b
--- /dev/null
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "KDESalDisplay.hxx"
+
+#include "KDEXLib.hxx"
+
+SalKDEDisplay::SalKDEDisplay( Display* pDisp )
+ : SalX11Display( pDisp )
+{
+}
+
+SalKDEDisplay::~SalKDEDisplay()
+{
+ // in case never a frame opened
+ static_cast<KDEXLib*>(GetXLib())->doStartup();
+ // clean up own members
+ doDestruct();
+ // prevent SalDisplay from closing KApplication's display
+ pDisp_ = NULL;
+}
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDESalDisplay.hxx b/vcl/unx/kde4/KDESalDisplay.hxx
new file mode 100644
index 0000000..13dc036
--- /dev/null
+++ b/vcl/unx/kde4/KDESalDisplay.hxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <saldisp.hxx>
+
+class SalKDEDisplay : public SalX11Display
+{
+ public:
+ SalKDEDisplay( Display* pDisp );
+ virtual ~SalKDEDisplay();
+};
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
new file mode 100644
index 0000000..d22051d
--- /dev/null
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define Region QtXRegion
+
+#include <QColor>
+#include <QStyle>
+
+#include <kconfig.h>
+#include <kglobal.h>
+#include <kmenubar.h>
+#include <kconfiggroup.h>
+#include <kmainwindow.h>
+#include <kapplication.h>
+#include <ktoolbar.h>
+
+#undef Region
+
+#include "KDESalFrame.hxx"
+#include "KDEXLib.hxx"
+#include "KDESalGraphics.hxx"
+
+#include <vcl/settings.hxx>
+#include <vcl/font.hxx>
+#include <tools/color.hxx>
+
+#include <vcl/svdata.hxx>
+
+#include <pspgraphics.h>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <stdio.h>
+#endif
+
+KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) :
+ X11SalFrame( pParent, nState )
+{
+}
+
+void KDESalFrame::Show( BOOL bVisible, BOOL bNoActivate )
+{
+ if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) )
+ {
+ KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
+ pXLib->doStartup();
+ }
+
+ X11SalFrame::Show( bVisible, bNoActivate );
+}
+
+/** Helper function to convert colors.
+*/
+static Color toColor( const QColor &rColor )
+{
+ return Color( rColor.red(), rColor.green(), rColor.blue() );
+}
+
+/** Helper function to read untranslated text entry from KConfig configuration repository.
+*/
+static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
+{
+ return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
+}
+
+/** 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) ) );
+}
+
+/** Helper function to add information to Font from QFont.
+
+ Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
+*/
+static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& rLocale )
+{
+ psp::FastPrintFontInfo aInfo;
+ QFontInfo qFontInfo( rQFont );
+
+ // set family name
+ aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 );
+
+ // set italic
+ aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright );
+
+ // set weight
+ int nWeight = qFontInfo.weight();
+ if ( nWeight <= QFont::Light )
+ aInfo.m_eWeight = psp::weight::Light;
+ else if ( nWeight <= QFont::Normal )
+ aInfo.m_eWeight = psp::weight::Normal;
+ else if ( nWeight <= QFont::DemiBold )
+ aInfo.m_eWeight = psp::weight::SemiBold;
+ else if ( nWeight <= QFont::Bold )
+ aInfo.m_eWeight = psp::weight::Bold;
+ else
+ aInfo.m_eWeight = psp::weight::UltraBold;
+
+ // set width
+ int nStretch = rQFont.stretch();
+ if ( nStretch <= QFont::UltraCondensed )
+ aInfo.m_eWidth = psp::width::UltraCondensed;
+ else if ( nStretch <= QFont::ExtraCondensed )
+ aInfo.m_eWidth = psp::width::ExtraCondensed;
+ else if ( nStretch <= QFont::Condensed )
+ aInfo.m_eWidth = psp::width::Condensed;
+ else if ( nStretch <= QFont::SemiCondensed )
+ aInfo.m_eWidth = psp::width::SemiCondensed;
+ else if ( nStretch <= QFont::Unstretched )
+ aInfo.m_eWidth = psp::width::Normal;
+ else if ( nStretch <= QFont::SemiExpanded )
+ aInfo.m_eWidth = psp::width::SemiExpanded;
+ else if ( nStretch <= QFont::Expanded )
+ aInfo.m_eWidth = psp::width::Expanded;
+ else if ( nStretch <= QFont::ExtraExpanded )
+ aInfo.m_eWidth = psp::width::ExtraExpanded;
+ else
+ aInfo.m_eWidth = psp::width::UltraExpanded;
+
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+#endif
+
+ // match font to e.g. resolve "Sans"
+ psp::PrintFontManager::get().matchFont( aInfo, rLocale );
+
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "font match %s, name AFTER: \"%s\"\n",
+ aInfo.m_nID != 0 ? "succeeded" : "failed",
+ OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+#endif
+
+ // font height
+ int nPointHeight = qFontInfo.pointSize();
+ if ( nPointHeight <= 0 )
+ nPointHeight = rQFont.pointSize();
+
+ // Create the font
+ Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
+ if( aInfo.m_eWeight != psp::weight::Unknown )
+ aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
+ if( aInfo.m_eWidth != psp::width::Unknown )
+ aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
+ if( aInfo.m_eItalic != psp::italic::Unknown )
+ aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
+ if( aInfo.m_ePitch != psp::pitch::Unknown )
+ aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) );
+
+ return aFont;
+}
+
+/** Implementation of KDE integration's main method.
+*/
+void KDESalFrame::UpdateSettings( AllSettings& rSettings )
+{
+ StyleSettings style( rSettings.GetStyleSettings() );
+ BOOL bSetTitleFont = false;
+
+
+ // General settings
+ QPalette pal = kapp->palette();
+
+ style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
+ style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
+
+ style.SetActiveColor2(toColor(pal.color(QPalette::Active, QPalette::Window)));
+ style.SetDeactiveColor2(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
+
+ style.SetActiveTextColor(toColor(pal.color(QPalette::Active, QPalette::WindowText)));
+ style.SetDeactiveTextColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
+
+ // WM settings
+ KConfig *pConfig = KGlobal::config().data();
+ if ( pConfig )
+ {
+ KConfigGroup aGroup = pConfig->group( "WM" );
+ const char *pKey;
+
+ pKey = "titleFont";
+ if ( aGroup.hasKey( pKey ) )
+ {
+ Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
+ style.SetTitleFont( aFont );
+ bSetTitleFont = true;
+ }
+
+ aGroup = pConfig->group( "Icons" );
+
+ pKey = "Theme";
+ if ( aGroup.hasKey( pKey ) )
+ style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) );
+ }
+
+ Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) );
+ Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) );
+ Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) );
+ Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) );
+ Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) );
+ Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) );
+ Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) );
+
+ // Foreground
+ style.SetRadioCheckTextColor( aFore );
+ style.SetLabelTextColor( aFore );
+ style.SetInfoTextColor( aFore );
+ style.SetDialogTextColor( aFore );
+ style.SetGroupTextColor( aFore );
+
+ // Text
+ style.SetFieldTextColor( aText );
+ style.SetFieldRolloverTextColor( aText );
+ style.SetWindowTextColor( aText );
+ style.SetHelpTextColor( aText );
+
+ // Base
+ style.SetFieldColor( aBase );
+ style.SetHelpColor( aBase );
+ style.SetWindowColor( aBase );
+ style.SetActiveTabColor( aBase );
+
+ // Buttons
+ style.SetButtonTextColor( aButn );
+ style.SetButtonRolloverTextColor( aButn );
+
+ // Disable color
+ style.SetDisableColor( aMid );
+
+ // Workspace
+ style.SetWorkspaceColor( aMid );
+
+ // Background
+ style.Set3DColors( aBack );
+ style.SetFaceColor( aBack );
+ style.SetInactiveTabColor( aBack );
+ style.SetDialogColor( aBack );
+
+ if( aBack == COL_LIGHTGRAY )
+ style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
+ else
+ {
+ Color aColor2 = style.GetLightColor();
+ style.
+ SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2),
+ (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2),
+ (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2)
+ ) );
+ }
+
+ // Selection
+ style.SetHighlightColor( aHigh );
+ style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText)) );
+
+ // Font
+ Font aFont = toFont( kapp->font(), rSettings.GetUILocale() );
+
+ 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 ); // will be changed according to pToolBar
+ style.SetLabelFont( aFont );
+ style.SetInfoFont( aFont );
+ style.SetRadioCheckFont( aFont );
+ style.SetPushButtonFont( aFont );
+ style.SetFieldFont( aFont );
+ style.SetIconFont( aFont );
+ style.SetGroupFont( aFont );
+
+ int flash_time = QApplication::cursorFlashTime();
+ style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
+
+ KMainWindow qMainWindow;
+
+ // Menu
+ style.SetSkipDisabledInMenus( TRUE );
+ KMenuBar *pMenuBar = qMainWindow.menuBar();
+ if ( pMenuBar )
+ {
+ // Color
+ QPalette qMenuCG = pMenuBar->palette();
+
+ // Menu text and background color, theme specific
+ Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
+ Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
+
+ aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText ) );
+ aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
+
+ style.SetMenuTextColor( aMenuFore );
+ style.SetMenuColor( aMenuBack );
+ style.SetMenuBarColor( aMenuBack );
+
+ style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
+
+ style.SetMenuHighlightTextColor( aMenuFore );
+
+ // set special menubar higlight text color
+ if ( kapp->style()->inherits( "HighContrastStyle" ) )
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
+ else
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+
+ // Font
+ aFont = toFont( pMenuBar->font(), rSettings.GetUILocale() );
+ style.SetMenuFont( aFont );
+ }
+
+ // Tool bar
+ KToolBar *pToolBar = qMainWindow.toolBar();
+ if ( pToolBar )
+ {
+ aFont = toFont( pToolBar->font(), rSettings.GetUILocale() );
+ style.SetToolFont( aFont );
+ }
+
+ // Scroll bar size
+ style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
+
+ // #i59364# high contrast mode
+ BOOL bHC = ( style.GetFaceColor().IsDark() ||
+ style.GetWindowColor().IsDark() );
+ style.SetHighContrastMode( bHC );
+
+ rSettings.SetStyleSettings( style );
+}
+
+
+void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
+{
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( m_aGraphics[i].pGraphics == pGraphics )
+ {
+ m_aGraphics[i].bInUse = false;
+ break;
+ }
+ }
+}
+
+void KDESalFrame::updateGraphics()
+{
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( m_aGraphics[i].bInUse )
+ m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() );
+ }
+}
+
+KDESalFrame::~KDESalFrame()
+{
+}
+
+KDESalFrame::GraphicsHolder::~GraphicsHolder()
+{
+ delete pGraphics;
+}
+
+SalGraphics* KDESalFrame::GetGraphics()
+{
+ if( GetWindow() )
+ {
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( ! m_aGraphics[i].bInUse )
+ {
+ m_aGraphics[i].bInUse = true;
+ if( ! m_aGraphics[i].pGraphics )
+ {
+ m_aGraphics[i].pGraphics = new KDESalGraphics();
+ m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
+ }
+ return m_aGraphics[i].pGraphics;
+ }
+ }
+ }
+
+ return NULL;
+}
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx
new file mode 100644
index 0000000..e24b824
--- /dev/null
+++ b/vcl/unx/kde4/KDESalFrame.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <saldisp.hxx>
+#include <salframe.h>
+
+class KDESalFrame : public X11SalFrame
+{
+ private:
+ static const int nMaxGraphics = 2;
+
+ struct GraphicsHolder
+ {
+ X11SalGraphics* pGraphics;
+ bool bInUse;
+
+ GraphicsHolder() : pGraphics(0),bInUse( false ) {}
+ ~GraphicsHolder();
+ };
+
+ GraphicsHolder m_aGraphics[ nMaxGraphics ];
+
+ public:
+ KDESalFrame( SalFrame* pParent, ULONG nStyle );
+ virtual ~KDESalFrame();
+
+ virtual SalGraphics* GetGraphics();
+ virtual void ReleaseGraphics( SalGraphics *pGraphics );
+ virtual void updateGraphics();
+ virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Show( BOOL bVisible, BOOL bNoActivate );
+};
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
new file mode 100644
index 0000000..9611526
--- /dev/null
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -0,0 +1,819 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#define _SV_SALNATIVEWIDGETS_KDE_CXX
+
+#define Region QtXRegion
+
+#include <QStyle>
+#include <QStyleOption>
+#include <QPainter>
+
+#include <kapplication.h>
+
+#undef Region
+
+#include "KDESalGraphics.hxx"
+
+#include <vcl/settings.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <stdio.h>
+
+using namespace ::rtl;
+
+/**
+ Conversion function between VCL ControlState together with
+ ImplControlValue and Qt state flags.
+ @param nControlState State of the widget (default, focused, ...) in Native Widget Framework.
+ @param aValue Value held by the widget (on, off, ...)
+*/
+QStyle::State vclStateValue2StateFlag( ControlState nControlState,
+ const ImplControlValue& aValue )
+{
+ QStyle::State nState =
+ ( (nControlState & CTRL_STATE_DEFAULT)? QStyle::State_None: QStyle::State_None ) |
+ ( (nControlState & CTRL_STATE_ENABLED)? QStyle::State_Enabled: QStyle::State_None ) |
+ ( (nControlState & CTRL_STATE_FOCUSED)? QStyle::State_HasFocus: QStyle::State_None ) |
+ ( (nControlState & CTRL_STATE_PRESSED)? QStyle::State_Sunken: QStyle::State_None ) |
+ ( (nControlState & CTRL_STATE_SELECTED)? QStyle::State_Selected : QStyle::State_None ) |
+ ( (nControlState & CTRL_STATE_ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None );
+ //TODO ( (nControlState & CTRL_STATE_HIDDEN)? QStyle::State_: QStyle::State_None ) |
+
+ switch ( aValue.getTristateVal() )
+ {
+ case BUTTONVALUE_ON: nState |= QStyle::State_On; break;
+ case BUTTONVALUE_OFF: nState |= QStyle::State_Off; break;
+ case BUTTONVALUE_MIXED: nState |= QStyle::State_NoChange; break;
+ default: break;
+ }
+
+ return nState;
+}
+
+/**
+ Convert VCL Region to QRect.
+ @param rControlRegion The region to convert.
+ @return The bounding box of the region.
+*/
+QRect region2QRect( const Region& rControlRegion )
+{
+ Rectangle aRect = rControlRegion.GetBoundRect();
+
+ return QRect( QPoint( aRect.Left(), aRect.Top() ),
+ QPoint( aRect.Right(), aRect.Bottom() ) );
+}
+
+BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
+{
+ if (type == CTRL_PUSHBUTTON) return true;
+
+ if (type == CTRL_MENUBAR) return true;
+
+ if (type == CTRL_MENU_POPUP) return true;
+
+ if (type == CTRL_EDITBOX) return true;
+
+ if (type == CTRL_COMBOBOX) return true;
+
+ if (type == CTRL_TOOLBAR) return true;
+
+ if (type == CTRL_CHECKBOX) return true;
+
+ if (type == CTRL_LISTBOX) return true;
+
+ if (type == CTRL_LISTNODE) return true;
+
+ if (type == CTRL_FRAME) return true;
+
+ if (type == CTRL_SCROLLBAR) return true;
+
+ if (type == CTRL_WINDOW_BACKGROUND) return true;
+
+ if (type == CTRL_SPINBOX && (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE) ) return true;
+
+ // no spinbuttons for KDE, paint spinbox complete
+ //if (type == CTRL_SPINBUTTONS) return true;
+
+ if (type == CTRL_GROUPBOX) return true;
+
+ if (type == CTRL_FIXEDLINE) return true;
+
+ if (type == CTRL_FIXEDBORDER) return true;
+
+ if (type == CTRL_TOOLTIP) return true;
+
+ if (type == CTRL_RADIOBUTTON) 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;
+}
+
+
+BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
+ const Region&, const Point&,
+ SalControlHandle&, BOOL& )
+{
+ return FALSE;
+}
+
+BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& value, SalControlHandle&,
+ const OUString& )
+{
+ // put not implemented types here
+ if (type == CTRL_SPINBUTTONS)
+ {
+ return false;
+ }
+
+ BOOL returnVal = true;
+
+ Display* dpy = GetXDisplay();
+ XLIB_Window drawable = GetDrawable();
+ GC gc = SelectPen();
+
+ QRect widgetRect = region2QRect(rControlRegion);
+ if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS )
+ type = CTRL_SPINBUTTONS;
+ if( type == CTRL_SPINBUTTONS )
+ {
+ SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
+ Rectangle aButtonRect( pSpinVal->maUpperRect);
+ aButtonRect.Union( pSpinVal->maLowerRect );;
+ widgetRect = QRect( aButtonRect.Left(), aButtonRect.Top(),
+ aButtonRect.Right(), aButtonRect.Bottom() );
+ }
+
+ //draw right onto the window
+ QPixmap pixmap(widgetRect.width(), widgetRect.height());
+
+ if (pixmap.isNull())
+ {
+ return false;
+ }
+
+ QPainter painter(&pixmap);
+ // painter.setBackgroundMode(Qt::OpaqueMode);
+
+ //copy previous screen contents for proper blending
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ QPixmap screen = QPixmap::fromX11Pixmap(drawable);
+ painter.drawPixmap(0,0, screen, widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height());
+ #else
+ const QX11Info& rX11Info( pixmap.x11Info() );
+ X11SalGraphics::CopyScreenArea( dpy,
+ drawable, GetScreenNumber(), GetBitCount(),
+ pixmap.handle(), rX11Info.screen(), rX11Info.depth(),
+ GetDisplay()->GetCopyGC( GetScreenNumber() ),
+ widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height(),
+ 0, 0 );
+ #endif
+
+ if (type == CTRL_PUSHBUTTON)
+ {
+ QStyleOptionButton styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state =vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter);
+ }
+ else if ( (type == CTRL_MENUBAR))
+ {
+ if (part == PART_MENU_ITEM)
+ {
+ QStyleOptionMenuItem styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter);
+ }
+ else
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+ }
+ }
+ else if (type == CTRL_MENU_POPUP)
+ {
+ if (part == PART_MENU_ITEM)
+ {
+ QStyleOptionMenuItem styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
+ }
+ else if (part == PART_MENU_ITEM_CHECK_MARK)
+ {
+ QStyleOptionButton styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ if (nControlState & CTRL_STATE_PRESSED)
+ {
+ kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter);
+ }
+ }
+ else if (part == PART_MENU_ITEM_RADIO_MARK)
+ {
+ QStyleOptionButton styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ if (nControlState & CTRL_STATE_PRESSED)
+ {
+ kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter);
+ }
+ }
+ else
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ QStyleOptionFrameV3 styleOption;
+ #else
+ QStyleOptionFrameV2 styleOption;
+ #endif
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ styleOption.frameShape = QFrame::StyledPanel;
+ #endif
+
+ kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter);
+ }
+ }
+ else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) )
+ {
+ QStyleOptionToolButton styleOption;
+
+ styleOption.arrowType = Qt::NoArrow;
+ styleOption.subControls = QStyle::SC_ToolButton;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
+
+ kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter);
+ }
+ else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) )
+ {
+ QStyleOptionToolBar styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter);
+ }
+ else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
+ {
+ QStyleOption styleOption;
+
+ int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
+
+ styleOption.rect = QRect(0, 0, width, widgetRect.height());
+ styleOption.state = QStyle::State_Horizontal;
+
+ kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter);
+ }
+ else if (type == CTRL_EDITBOX)
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+
+ //TODO hover?? OO does not seem to do this for line edits
+
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ QStyleOptionFrameV3 styleOption;
+ #else
+ QStyleOptionFrameV2 styleOption;
+ #endif
+
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ //TODO...how does the line edit draw itself internally??
+ styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4);
+ kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter);
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter);
+ }
+ else if (type == CTRL_COMBOBOX)
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+
+ QStyleOptionComboBox styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ styleOption.editable = true;
+
+ kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
+ }
+ else if (type == CTRL_LISTBOX)
+ {
+ QStyleOptionComboBox styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ if (part == PART_SUB_EDIT)
+ {
+ kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter);
+ }
+ else
+ {
+ kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
+ }
+ }
+ else if (type == CTRL_LISTNODE)
+ {
+ QStyleOption styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ styleOption.state |= QStyle::State_Item;
+ styleOption.state |= QStyle::State_Children;
+
+ if (nControlState & CTRL_STATE_PRESSED)
+ {
+ styleOption.state |= QStyle::State_Open;
+ }
+
+ kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter);
+ }
+ else if (type == CTRL_CHECKBOX)
+ {
+ QStyleOptionButton styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter);
+ }
+ else if (type == CTRL_SCROLLBAR)
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+
+ if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
+ {
+ ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
+
+ QStyleOptionSlider styleOption;
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+
+ //if the scroll bar is active (aka not degenrate...allow for hover events
+ if (sbVal->mnVisibleSize < sbVal->mnMax)
+ {
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ styleOption.state |= QStyle::State_MouseOver;
+ }
+
+ //horizontal or vertical
+ if (part == PART_DRAW_BACKGROUND_VERT)
+ {
+ styleOption.orientation = Qt::Vertical;
+ }
+ else
+ {
+ styleOption.state |= QStyle::State_Horizontal;
+ }
+
+ //setup parameters from the OO values
+ styleOption.minimum = sbVal->mnMin;
+ styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
+ styleOption.sliderValue = sbVal->mnCur;
+ styleOption.sliderPosition = sbVal->mnCur;
+ styleOption.pageStep = sbVal->mnVisibleSize;
+
+ //setup the active control...always the slider
+ if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER)
+ {
+ styleOption.activeSubControls = QStyle::SC_ScrollBarSlider;
+ }
+
+ kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter);
+ }
+ }
+ else if (type == CTRL_SPINBOX)
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+
+ QStyleOptionSpinBox styleOption;
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ // determine active control
+ SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
+ if( pSpinVal )
+ {
+ if( (pSpinVal->mnUpperState & CTRL_STATE_PRESSED) )
+ styleOption.activeSubControls |= QStyle::SC_SpinBoxUp;
+ if( (pSpinVal->mnLowerState & CTRL_STATE_PRESSED) )
+ styleOption.activeSubControls |= QStyle::SC_SpinBoxDown;
+ }
+
+ kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
+ }
+ else if (type == CTRL_GROUPBOX)
+ {
+ QStyleOptionGroupBox styleOption;
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter);
+ }
+ else if (type == CTRL_RADIOBUTTON)
+ {
+ QStyleOptionButton styleOption;
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter);
+ }
+ else if (type == CTRL_TOOLTIP)
+ {
+ QStyleOption styleOption;
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+
+ kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter);
+ }
+ else if (type == CTRL_FRAME)
+ {
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ QStyleOptionFrameV3 styleOption;
+ #else
+ QStyleOptionFrameV2 styleOption;
+ #endif
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ styleOption.frameShape = QFrame::StyledPanel;
+ #endif
+
+ kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
+ }
+ else if (type == CTRL_FIXEDBORDER)
+ {
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ QStyleOptionFrameV3 styleOption;
+ #else
+ QStyleOptionFrameV2 styleOption;
+ #endif
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ styleOption.frameShape = QFrame::StyledPanel;
+ #endif
+
+ kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
+ }
+ else if (type == CTRL_WINDOW_BACKGROUND)
+ {
+ pixmap.fill(KApplication::palette().color(QPalette::Window));
+ }
+ else if (type == CTRL_FIXEDLINE)
+ {
+ QStyleOptionMenuItem styleOption;
+
+ styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+ styleOption.state = vclStateValue2StateFlag( nControlState, value );
+ styleOption.menuItemType = QStyleOptionMenuItem::Separator;
+ styleOption.state |= QStyle::State_Item;
+
+ kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
+ }
+ else
+ {
+ returnVal = false;
+ }
+
+ if (returnVal)
+ {
+ X11SalGraphics::CopyScreenArea( dpy,
+ pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
+ drawable, GetScreenNumber(), GetVisual().GetDepth(), gc,
+ 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() );
+ }
+
+ return returnVal;
+}
+
+BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
+ const Region& controlRegion, ControlState controlState,
+ const ImplControlValue& val, SalControlHandle&,
+ const OUString&,
+ Region &nativeBoundingRegion, Region &nativeContentRegion )
+{
+ bool retVal = false;
+
+ QRect boundingRect = region2QRect( controlRegion );
+ QRect contentRect = boundingRect;
+ QStyleOptionComplex styleOption;
+
+ switch ( type )
+ {
+ // Metrics of the push button
+ case CTRL_PUSHBUTTON:
+ if (part == PART_ENTIRE_CONTROL)
+ {
+ styleOption.state = vclStateValue2StateFlag(controlState, val);
+
+ if ( controlState & CTRL_STATE_DEFAULT )
+ {
+ int size = kapp->style()->pixelMetric(
+ QStyle::PM_ButtonDefaultIndicator, &styleOption );
+
+ boundingRect.adjust( -size, -size, size, size );
+
+ retVal = true;
+ }
+ }
+ break;
+ case CTRL_EDITBOX:
+ {
+ styleOption.rect = QRect(0, 0, contentRect.width(), contentRect.height());
+ styleOption.state = vclStateValue2StateFlag(controlState, val);
+
+ int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) - 1;
+
+ contentRect.adjust( -size, -size, size, size);
+ boundingRect = contentRect;
+
+ retVal = true;
+
+ break;
+ }
+ case CTRL_CHECKBOX:
+ if (part == PART_ENTIRE_CONTROL)
+ {
+ styleOption.state = vclStateValue2StateFlag(controlState, val);
+
+ contentRect.setWidth(kapp->style()->pixelMetric(
+ QStyle::PM_IndicatorWidth, &styleOption));
+ contentRect.setHeight(kapp->style()->pixelMetric(
+ QStyle::PM_IndicatorHeight, &styleOption));
+
+ contentRect.adjust(0, 0,
+ 2 * kapp->style()->pixelMetric(
+ QStyle::PM_FocusFrameHMargin, &styleOption),
+ 2 * kapp->style()->pixelMetric(
+ QStyle::PM_FocusFrameVMargin, &styleOption)
+ );
+
+ boundingRect = contentRect;
+
+ retVal = true;
+
+ break;
+ }
+ case CTRL_COMBOBOX:
+ case CTRL_LISTBOX:
+ {
+ QStyleOptionComboBox cbo;
+
+ cbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
+ cbo.state = vclStateValue2StateFlag(controlState, val);
+
+ switch ( part )
+ {
+ case PART_ENTIRE_CONTROL:
+ {
+ int size = kapp->style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2;
+ contentRect.adjust(-size,-size,size,size);
+
+ // find out the minimum size that should be used
+ // assume contents is a text ling
+ int nHeight = kapp->fontMetrics().height();
+ QSize aContentSize( contentRect.width(), nHeight );
+ QSize aMinSize = kapp->style()->
+ sizeFromContents( QStyle::CT_ComboBox, &cbo, aContentSize );
+ if( aMinSize.height() > contentRect.height() )
+ contentRect.adjust( 0, 0, 0, aMinSize.height() - contentRect.height() );
+ boundingRect = contentRect;
+ retVal = true;
+ break;
+ }
+ case PART_BUTTON_DOWN:
+ //the entire control can be used as the "down" button
+ retVal = true;
+ break;
+ case PART_SUB_EDIT:
+ contentRect = kapp->style()->subControlRect(
+ QStyle::CC_ComboBox, &cbo, QStyle::SC_ComboBoxEditField );
+
+ contentRect.translate( boundingRect.left(), boundingRect.top() );
+
+ retVal = true;
+ break;
+ }
+ break;
+ }
+ case CTRL_SPINBOX:
+ {
+ QStyleOptionSpinBox sbo;
+
+ sbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
+ sbo.state = vclStateValue2StateFlag(controlState, val);
+
+ switch ( part )
+ {
+ case PART_BUTTON_UP:
+ contentRect = kapp->style()->subControlRect(
+ QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxUp );
+ contentRect.translate( boundingRect.left(), boundingRect.top() );
+ retVal = true;
+ boundingRect = QRect();
+ break;
+
+ case PART_BUTTON_DOWN:
+ contentRect = kapp->style()->subControlRect(
+ QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxDown );
+ retVal = true;
+ contentRect.translate( boundingRect.left(), boundingRect.top() );
+ boundingRect = QRect();
+ break;
+
+ case PART_SUB_EDIT:
+ contentRect = kapp->style()->subControlRect(
+ QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxEditField );
+ retVal = true;
+ contentRect.translate( boundingRect.left(), boundingRect.top() );
+ break;
+ default:
+ retVal = true;
+ }
+ 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)
+ {
+ contentRect.setWidth(contentRect.height());
+ retVal = true;
+ }
+ break;
+ case CTRL_FRAME:
+ {
+ if (part == PART_BORDER)
+ {
+ int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+ //contentRect.adjust(size, size, size, size);
+ boundingRect.adjust(-size, -size, size, size);
+ retVal = true;
+ }
+
+ break;
+ }
+ case CTRL_RADIOBUTTON:
+ {
+ const int h = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight);
+ const int w = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth);
+
+ contentRect = QRect(boundingRect.left(), boundingRect.top(), w, h);
+ contentRect.adjust(0, 0,
+ 2 * kapp->style()->pixelMetric(
+ QStyle::PM_FocusFrameHMargin, &styleOption),
+ 2 * kapp->style()->pixelMetric(
+ QStyle::PM_FocusFrameVMargin, &styleOption)
+ );
+ boundingRect = contentRect;
+
+ retVal = true;
+ }
+ 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 )
+ {
+ 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;
+ }
+ break;
+ }
+#endif
+
+ if (retVal)
+ {
+ // Bounding region
+ Point aBPoint( boundingRect.x(), boundingRect.y() );
+ Size aBSize( boundingRect.width(), boundingRect.height() );
+ nativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) );
+
+ // Region of the content
+ Point aPoint( contentRect.x(), contentRect.y() );
+ Size aSize( contentRect.width(), contentRect.height() );
+ nativeContentRegion = Region( Rectangle( aPoint, aSize ) );
+ }
+
+ return retVal;
+}
diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx
new file mode 100644
index 0000000..1a6a9c1
--- /dev/null
+++ b/vcl/unx/kde4/KDESalGraphics.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <rtl/string.hxx>
+#include <saldisp.hxx>
+#include <salgdi.h>
+
+/** handles graphics drawings requests and performs the needed drawing operations */
+class KDESalGraphics : public X11SalGraphics
+{
+ public:
+ KDESalGraphics() {}
+ virtual ~KDESalGraphics() {}
+
+ /**
+ What widgets can be drawn the native way.
+ @param type Type of the widget.
+ @param part Specification of the widget's part if it consists of more than one.
+ @return true if the platform supports native drawing of the widget type defined by part.
+ */
+ virtual BOOL IsNativeControlSupported( ControlType type, ControlPart part );
+
+ /** 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
+ type/part combination.
+ */
+ virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
+ const Region& rControlRegion, const Point& aPos,
+ SalControlHandle& rControlHandle, BOOL& rIsInside );
+ /** Draw the requested control described by part/nControlState.
+
+ @param rControlRegion
+ The bounding region of the complete control in VCL frame coordinates.
+
+ @param aValue
+ An optional value (tristate/numerical/string).
+
+ @param rControlHandle
+ Carries platform dependent data and is maintained by the SalFrame implementation.
+
+ @param aCaption
+ A caption or title string (like button text etc.)
+ */
+ virtual BOOL drawNativeControl( ControlType type, ControlPart part,
+ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const rtl::OUString& aCaption );
+
+ /** Draw text on the widget.
+ OPTIONAL. Draws the requested text for the control described by part/nControlState.
+ Used if text is not drawn by DrawNativeControl().
+
+ @param rControlRegion The bounding region of the complete control in VCL frame coordinates.
+ @param aValue An optional value (tristate/numerical/string)
+ @param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation.
+ @param aCaption A caption or title string (like button text etc.)
+ */
+ virtual BOOL drawNativeControlText( ControlType, ControlPart,
+ const Region&, ControlState,
+ const ImplControlValue&, SalControlHandle&,
+ const rtl::OUString& ) { return false; }
+ /** Check if the bounding regions match.
+
+ If the return value is TRUE, rNativeBoundingRegion
+ contains the true bounding region covered by the control
+ including any adornment, while rNativeContentRegion contains the area
+ within the control that can be safely drawn into without drawing over
+ the borders of the control.
+
+ @param rControlRegion
+ The bounding region of the control in VCL frame coordinates.
+
+ @param aValue
+ An optional value (tristate/numerical/string)
+
+ @param rControlHandle
+ Carries platform dependent data and is maintained by the SalFrame implementation.
+
+ @param aCaption
+ A caption or title string (like button text etc.)
+ */
+ virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
+ const Region& rControlRegion, ControlState nControlState,
+ const ImplControlValue& aValue, SalControlHandle& rControlHandle,
+ const rtl::OUString& aCaption,
+ Region &rNativeBoundingRegion, Region &rNativeContentRegion );
+};
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx
new file mode 100644
index 0000000..7b8e863
--- /dev/null
+++ b/vcl/unx/kde4/KDESalInstance.cxx
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "KDESalInstance.hxx"
+
+#include "KDESalFrame.hxx"
+
+SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState )
+{
+ return new KDESalFrame( pParent, nState );
+}
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx
new file mode 100644
index 0000000..c62addc
--- /dev/null
+++ b/vcl/unx/kde4/KDESalInstance.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <salinst.h>
+
+class SalYieldMutex;
+class SalFrame;
+
+class KDESalInstance : public X11SalInstance
+{
+ public:
+ KDESalInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) {}
+ virtual ~KDESalInstance() {}
+ virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle );
+};
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
new file mode 100644
index 0000000..aec7a04
--- /dev/null
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "VCLKDEApplication.hxx"
+
+#define Region QtXRegion
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <kstartupinfo.h>
+
+#undef Region
+
+#include "KDEXLib.hxx"
+
+#include <i18n_im.hxx>
+#include <i18n_xkb.hxx>
+
+#include <saldata.hxx>
+#include <vos/process.hxx>
+
+#include "KDESalDisplay.hxx"
+
+#if OSL_DEBUG_LEVEL > 1
+#include <stdio.h>
+#endif
+
+KDEXLib::KDEXLib() :
+ SalXLib(), m_bStartupDone(false), m_pApplication(0),
+ m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 )
+{
+}
+
+KDEXLib::~KDEXLib()
+{
+ delete (VCLKDEApplication*)m_pApplication;
+
+ // free the faked cmdline arguments no longer needed by KApplication
+ for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
+ {
+ free( m_pFreeCmdLineArgs[i] );
+ }
+
+ delete [] m_pFreeCmdLineArgs;
+ delete [] m_pAppCmdLineArgs;
+}
+
+void KDEXLib::Init()
+{
+ SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
+ pInputMethod->SetLocale();
+ XrmInitialize();
+
+ KAboutData *kAboutData = new KAboutData( "OpenOffice.org",
+ "OpenOffice.org",
+ ki18n( "OpenOffice.org" ),
+ "3.0.0",
+ ki18n( "OpenOffice.org with KDE Native Widget Support." ),
+ KAboutData::License_LGPL,
+ ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"),
+ ki18n( "OpenOffice.org is an office suite.\n" ),
+ "http://kde.openoffice.org/index.html",
+ "dev at kde.openoffice.org" );
+ kAboutData->addAuthor( ki18n( "Jan Holesovsky" ),
+ ki18n( "Original author and maintainer of the KDE NWF." ),
+ "kendy at artax.karlin.mff.cuni.cz",
+ "http://artax.karlin.mff.cuni.cz/~kendy" );
+ kAboutData->addAuthor( ki18n("Eric Bischoff"),
+ ki18n( "Accessibility fixes, porting to KDE 4." ),
+ "bischoff at kde.org" );
+
+ m_nFakeCmdLineArgs = 1;
+ USHORT nIdx;
+ vos::OExtCommandLine aCommandLine;
+ int nParams = aCommandLine.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 )
+ {
+ aCommandLine.getCommandArg( nIdx + 1, aParam );
+ 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() );
+ }
+ }
+ if ( !m_pFreeCmdLineArgs )
+ m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
+
+ osl_getExecutableFile( &aParam.pData );
+ osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
+ rtl::OString aExec = rtl::OUStringToOString( aBin, osl_getThreadTextEncoding() );
+ m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() );
+
+ // make a copy of the string list for freeing it since
+ // KApplication manipulates the pointers inside the argument vector
+ // note: KApplication bad !
+ m_pAppCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
+ for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
+ m_pAppCmdLineArgs[i] = m_pFreeCmdLineArgs[i];
+
+ KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs, kAboutData );
+
+ m_pApplication = new VCLKDEApplication();
+ kapp->disableSessionManagement();
+
+ Display* pDisp = QX11Info::display();
+ SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
+
+ ((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
+
+ XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
+ XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
+
+ pInputMethod->CreateMethod( pDisp );
+ pInputMethod->AddConnectionWatch( pDisp, (void*)this );
+ pSalDisplay->SetInputMethod( pInputMethod );
+
+ PushXErrorLevel( true );
+ SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
+ XSync( pDisp, False );
+
+ pKbdExtension->UseExtension( ! HasXErrorOccured() );
+ PopXErrorLevel();
+
+ pSalDisplay->SetKbdExtension( pKbdExtension );
+}
+
+void KDEXLib::doStartup()
+{
+ if( ! m_bStartupDone )
+ {
+ KStartupInfo::appStarted();
+ m_bStartupDone = true;
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "called KStartupInfo::appStarted()\n" );
+ #endif
+ }
+}
\ No newline at end of file
diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx
new file mode 100644
index 0000000..5f79953
--- /dev/null
+++ b/vcl/unx/kde4/KDEXLib.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <saldisp.hxx>
+
+class KDEXLib : public SalXLib
+{
+ private:
+ bool m_bStartupDone;
+ void* m_pApplication;
+ char** m_pFreeCmdLineArgs;
+ char** m_pAppCmdLineArgs;
+ int m_nFakeCmdLineArgs;
+
+ public:
+ KDEXLib();
+
+ virtual ~KDEXLib();
+ virtual void Init();
+
+ void doStartup();
+};
diff --git a/vcl/unx/kde4/VCLKDEApplication.cxx b/vcl/unx/kde4/VCLKDEApplication.cxx
new file mode 100644
index 0000000..240262e
--- /dev/null
+++ b/vcl/unx/kde4/VCLKDEApplication.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "VCLKDEApplication.hxx"
+
+#define Region QtXRegion
+#include <QEvent>
+#undef Region
+
+#include "KDESalDisplay.hxx"
+
+VCLKDEApplication::VCLKDEApplication() :
+ KApplication()
+{
+ disp = 0;
+}
+
+bool VCLKDEApplication::x11EventFilter(XEvent* event)
+{
+ //if we have a display and the display consumes the event
+ //do not process the event in qt
+ if (disp && disp->Dispatch(event) > 0)
+ {
+ return true;
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/vcl/unx/kde4/VCLKDEApplication.hxx b/vcl/unx/kde4/VCLKDEApplication.hxx
new file mode 100644
index 0000000..ce6441f
--- /dev/null
+++ b/vcl/unx/kde4/VCLKDEApplication.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#define Region QtXRegion
+
+#include <QSessionManager>
+
+#include <kapplication.h>
+
+#undef Region
+
+class SalKDEDisplay;
+
+/* #i59042# override KApplications method for session management
+ * since it will interfere badly with our own.
+ */
+class VCLKDEApplication : public KApplication
+{
+ public:
+ VCLKDEApplication();
+
+ virtual void commitData(QSessionManager&) {};
+
+ virtual bool x11EventFilter(XEvent* event);
+
+ SalKDEDisplay* disp;
+};
\ No newline at end of file
diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx
new file mode 100644
index 0000000..dfcddbf
--- /dev/null
+++ b/vcl/unx/kde4/main.cxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#define Region QtXRegion
+#include <QApplication>
+#undef Region
+
+#include "KDEData.hxx"
+#include "KDESalInstance.hxx"
+
+#if OSL_DEBUG_LEVEL > 1
+#include <stdio.h>
+#endif
+
+#include <rtl/string.hxx>
+
+/// entry point for the KDE4 VCL plugin
+extern "C" {
+ VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule )
+ {
+#if QT_VERSION < 0x050000
+ // Qt 4.x support needs >= 4.1.0
+ rtl::OString aVersion( qVersion() );
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() );
+#endif
+ sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0;
+ nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32();
+ if( nIndex > 0 )
+ nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32();
+ if( nIndex > 0 )
+ nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32();
+ if( nMajor != 4 || nMinor < 1 )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro );
+#endif
+ return NULL;
+ }
+#endif
+
+ KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "created KDESalInstance 0x%p\n", pInstance );
+#endif
+
+ // initialize SalData
+ KDEData *salData = new KDEData();
+ SetSalData(salData);
+ salData->m_pInstance = pInstance;
+ salData->Init();
+ salData->initNWF();
+
+ return pInstance;
+ }
+}
diff --git a/vcl/unx/kde4/makefile.mk b/vcl/unx/kde4/makefile.mk
new file mode 100644
index 0000000..48a2dc8
--- /dev/null
+++ b/vcl/unx/kde4/makefile.mk
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.10 $
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=vcl
+TARGET=kde4plug
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# workaround for makedepend hang
+MKDEPENDSOLVER=
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile2.pmk
+
+# For some of the included external KDE headers, GCC complains about shadowed
+# symbols in instantiated template code only at the end of a compilation unit,
+# so the only solution is to disable that warning here:
+.IF "$(COM)" == "GCC"
+CFLAGSCXX+=-Wno-shadow
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+.IF "$(GUIBASE)"!="unx"
+
+dummy:
+ @echo "Nothing to build for GUIBASE $(GUIBASE)"
+
+.ELSE # "$(GUIBASE)"!="unx"
+
+.IF "$(ENABLE_KDE4)" != ""
+
+CFLAGS+=$(KDE4_CFLAGS)
+
+.IF "$(ENABLE_RANDR)" != ""
+CDEFS+=-DUSE_RANDR
+.ENDIF
+
+SLOFILES=\
+ $(SLO)$/main.obj \
+ $(SLO)$/VCLKDEApplication.obj \
+ $(SLO)$/KDEXLib.obj \
+ $(SLO)$/KDESalDisplay.obj \
+ $(SLO)$/KDESalFrame.obj \
+ $(SLO)$/KDESalGraphics.obj \
+ $(SLO)$/KDESalInstance.obj \
+ $(SLO)$/KDEData.obj
+
+
+.ELSE # "$(ENABLE_KDE4)" != ""
+
+dummy:
+ @echo KDE disabled - nothing to build
+.ENDIF
+.ENDIF # "$(GUIBASE)"!="unx"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index 0eee596..2bb07b2 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -55,13 +55,16 @@ typedef SalInstance*(*salFactoryProc)( oslModule pModule);
static oslModule pCloseModule = NULL;
-#define DESKTOP_NONE 0
-#define DESKTOP_UNKNOWN 1
-#define DESKTOP_GNOME 2
-#define DESKTOP_KDE 3
-#define DESKTOP_CDE 4
+enum {
+ DESKTOP_NONE = 0,
+ DESKTOP_UNKNOWN,
+ DESKTOP_GNOME,
+ DESKTOP_KDE,
+ DESKTOP_KDE4,
+ DESKTOP_CDE
+};
-static const char * desktop_strings[5] = { "none", "unknown", "GNOME", "KDE", "CDE" };
+static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" };
static SalInstance* tryInstance( const OUString& rModuleBase )
{
@@ -225,15 +228,18 @@ extern "C"
typedef int(* XErrorHandler)(Display*,XErrorEvent*);
}
-static OUString getNetWMName( Display* pDisplay )
+static int KDEVersion( Display* pDisplay )
{
- OUString aRet;
+ int nRet = 0;
- Atom nWmCheck = XInternAtom( pDisplay, "_NET_SUPPORTING_WM_CHECK", True );
- Atom nWmName = XInternAtom( pDisplay, "_NET_WM_NAME", True );
- if( nWmName && nWmCheck )
+ Atom nFullSession = XInternAtom( pDisplay, "KDE_FULL_SESSION", True );
+ Atom nKDEVersion = XInternAtom( pDisplay, "KDE_SESSION_VERSION", True );
+
+ if( nFullSession )
{
- XLIB_Window aCheckWin = None;
+ if( !nKDEVersion )
+ return 3;
+
Atom aRealType = None;
int nFormat = 8;
unsigned long nItems = 0;
@@ -241,88 +247,65 @@ static OUString getNetWMName( Display* pDisplay )
unsigned char* pProperty = NULL;
XGetWindowProperty( pDisplay,
DefaultRootWindow( pDisplay ),
- nWmCheck,
+ nKDEVersion,
0, 1,
False,
- XA_WINDOW,
+ AnyPropertyType,
&aRealType,
&nFormat,
&nItems,
&nBytesLeft,
&pProperty );
- if( aRealType == XA_WINDOW && nFormat == 32 && nItems != 0 )
- aCheckWin = *(XLIB_Window*)pProperty;
+ if( !WasXError() && nItems != 0 && pProperty )
+ {
+ nRet = *reinterpret_cast< sal_Int32* >( pProperty );
+ }
if( pProperty )
{
XFree( pProperty );
pProperty = NULL;
}
+ }
+ return nRet;
+}
- // see if that window really exists and has the check property set
- if( aCheckWin != None )
+static bool is_kde_desktop( Display* pDisplay )
+{
+ if ( NULL != getenv( "KDE_FULL_SESSION" ) )
+ {
+ const char *pVer = getenv( "KDE_SESSION_VERSION" );
+ if ( !pVer || pVer[0] == '0' )
{
- // clear error flag
- WasXError();
- // get the property
- XGetWindowProperty( pDisplay,
- aCheckWin,
- nWmCheck,
- 0, 1,
- False,
- XA_WINDOW,
- &aRealType,
- &nFormat,
- &nItems,
- &nBytesLeft,
- &pProperty );
- if( ! WasXError() && aRealType == XA_WINDOW && nFormat == 32 && nItems != 0 && pProperty )
- {
- if( aCheckWin == *(XLIB_Window*)pProperty )
- {
- XFree( pProperty );
- pProperty = NULL;
- XGetWindowProperty( pDisplay,
- aCheckWin,
- nWmName,
- 0, 256,
- False,
- AnyPropertyType,
- &aRealType,
- &nFormat,
- &nItems,
- &nBytesLeft,
- &pProperty );
- if( !WasXError() && nItems != 0 && pProperty && *pProperty )
- {
- if( aRealType == XA_STRING ) // some WM's use this although the should use UTF8_STRING
- {
- aRet = rtl::OStringToOUString( rtl::OString( (sal_Char*)pProperty ), RTL_TEXTENCODING_ISO_8859_1 );
- }
- else
- aRet = rtl::OStringToOUString( rtl::OString( (sal_Char*)pProperty ), RTL_TEXTENCODING_UTF8 );
- }
- }
- }
- if( pProperty )
- {
- XFree( pProperty );
- pProperty = NULL;
- }
+ return true; // does not exist => KDE3
+ }
+
+ rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "3" ) );
+ if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) )
+ {
+ return true;
}
}
- return aRet;
+
+ if ( KDEVersion( pDisplay ) == 3 )
+ return true;
+
+ return false;
}
-static bool is_kde_desktop( Display* pDisplay )
+static bool is_kde4_desktop( Display* pDisplay )
{
if ( NULL != getenv( "KDE_FULL_SESSION" ) )
+ {
+ rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "4" ) );
+
+ const char *pVer = getenv( "KDE_SESSION_VERSION" );
+ if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) )
+ return true;
+ }
+
+ if ( KDEVersion( pDisplay ) == 4 )
return true;
-
- // check for kwin
- rtl::OUString aWM = getNetWMName( pDisplay );
- if( aWM.equalsIgnoreAsciiCaseAscii( "KWin" ) )
- return true;
-
+
return false;
}
@@ -355,6 +338,8 @@ static const char * get_desktop_environment()
pRet = desktop_strings[DESKTOP_CDE];
if ( aOver.equalsIgnoreAsciiCase( "kde" ) )
pRet = desktop_strings[DESKTOP_KDE];
+ if ( aOver.equalsIgnoreAsciiCase( "kde4" ) )
+ pRet = desktop_strings[DESKTOP_KDE4];
if ( aOver.equalsIgnoreAsciiCase( "gnome" ) )
pRet = desktop_strings[DESKTOP_GNOME];
if ( aOver.equalsIgnoreAsciiCase( "none" ) )
@@ -395,7 +380,9 @@ static const char * get_desktop_environment()
{
XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler );
- if ( is_kde_desktop( pDisplay ) )
+ if ( is_kde4_desktop( pDisplay ) )
+ pRet = desktop_strings[DESKTOP_KDE4];
+ else if ( is_kde_desktop( pDisplay ) )
pRet = desktop_strings[DESKTOP_KDE];
else if ( is_gnome_desktop( pDisplay ) )
pRet = desktop_strings[DESKTOP_GNOME];
@@ -428,6 +415,8 @@ static const char* autodetect_plugin()
pRet = "gtk";
else if( desktop == desktop_strings[DESKTOP_KDE] )
pRet = "kde";
+ else if( desktop == desktop_strings[DESKTOP_KDE4] )
+ pRet = "kde4";
else
{
// #i95296# use the much nicer looking gtk plugin
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index 96c2898..63994c1 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -366,7 +366,7 @@ SHL5IMPLIB=ikde_plug_
SHL5LIBS=$(LIB5TARGET)
SHL5DEPN=$(SHL2TARGETN)
# libs for KDE plugin
-SHL5STDLIBS=$(KDE_LIBS)
+SHL5LINKFLAGS+=$(KDE_LIBS)
SHL5STDLIBS+=-l$(SHL2TARGET)
SHL5STDLIBS+=\
$(VCLLIB) \
@@ -382,6 +382,35 @@ SHL5STDLIBS+= $(XRANDR_LIBS)
.ENDIF # "$(ENABLE_KDE)" != ""
+# KDE4 plugin
+.IF "$(ENABLE_KDE4)" != ""
+.IF "$(KDE4_ROOT)"!=""
+EXTRALIBPATHS+=-L$(KDE4_ROOT)$/lib
+.ENDIF
+LIB6TARGET=$(SLB)$/ikde4_plug_
+LIB6FILES=$(SLB)$/kde4plug.lib
+SHL6TARGET=vclplug_kde4$(DLLPOSTFIX)
+SHL6IMPLIB=ikde4_plug_
+SHL6LIBS=$(LIB6TARGET)
+SHL6DEPN=$(SHL2TARGETN)
+# libs for KDE4 plugin
+SHL6LINKFLAGS+=$(KDE4_LIBS)
+SHL6STDLIBS+=-l$(SHL2TARGET)
+SHL6STDLIBS+=\
+ $(VCLLIB) \
+ $(PSPLIB) \
+ $(TOOLSLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+.IF "$(ENABLE_RANDR)" != ""
+.IF "$(XRANDR_DLOPEN)" == "FALSE"
+SHL6STDLIBS+= $(XRANDR_LIBS)
+.ENDIF
+.ENDIF
+
+.ENDIF # "$(ENABLE_KDE4)" != ""
+
.ENDIF # UNX
# --- Allgemein ----------------------------------------------------------
More information about the ooo-build-commit
mailing list