1 diff --git vcl/unx/kde4/KDEData.cxx vcl/unx/kde4/KDEData.cxx
5 +++ vcl/unx/kde4/KDEData.cxx
7 +/*************************************************************************
9 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11 + * Copyright 2009 by Sun Microsystems, Inc.
13 + * OpenOffice.org - a multi-platform office productivity suite
15 + * This file is part of OpenOffice.org.
17 + * OpenOffice.org is free software: you can redistribute it and/or modify
18 + * it under the terms of the GNU Lesser General Public License version 3
19 + * only, as published by the Free Software Foundation.
21 + * OpenOffice.org is distributed in the hope that it will be useful,
22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 + * GNU Lesser General Public License version 3 for more details
25 + * (a copy is included in the LICENSE file that accompanied this code).
27 + * You should have received a copy of the GNU Lesser General Public License
28 + * version 3 along with OpenOffice.org. If not, see
29 + * <http://www.openoffice.org/license.html>
30 + * for a copy of the LGPLv3 License.
32 + ************************************************************************/
34 +#include "KDEData.hxx"
36 +#include "KDEXLib.hxx"
44 + pXLib_ = new KDEXLib();
48 +void KDEData::initNWF()
50 + ImplSVData *pSVData = ImplGetSVData();
52 + // draw toolbars on separate lines
53 + pSVData->maNWFData.mbDockingAreaSeparateTB = true;
56 +void KDEData::deInitNWF()
59 \ No newline at end of file
60 diff --git vcl/unx/kde4/KDEData.hxx vcl/unx/kde4/KDEData.hxx
62 index 0000000..71dedbc
64 +++ vcl/unx/kde4/KDEData.hxx
66 +/*************************************************************************
68 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70 + * Copyright 2009 by Sun Microsystems, Inc.
72 + * OpenOffice.org - a multi-platform office productivity suite
74 + * This file is part of OpenOffice.org.
76 + * OpenOffice.org is free software: you can redistribute it and/or modify
77 + * it under the terms of the GNU Lesser General Public License version 3
78 + * only, as published by the Free Software Foundation.
80 + * OpenOffice.org is distributed in the hope that it will be useful,
81 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
82 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83 + * GNU Lesser General Public License version 3 for more details
84 + * (a copy is included in the LICENSE file that accompanied this code).
86 + * You should have received a copy of the GNU Lesser General Public License
87 + * version 3 along with OpenOffice.org. If not, see
88 + * <http://www.openoffice.org/license.html>
89 + * for a copy of the LGPLv3 License.
91 + ************************************************************************/
95 +#include <saldisp.hxx>
96 +#include <saldata.hxx>
98 +class KDEData : public X11SalData
102 + virtual ~KDEData();
104 + virtual void Init();
105 + virtual void initNWF();
106 + virtual void deInitNWF();
108 \ No newline at end of file
109 diff --git vcl/unx/kde4/KDESalDisplay.cxx vcl/unx/kde4/KDESalDisplay.cxx
111 index 0000000..16f128b
113 +++ vcl/unx/kde4/KDESalDisplay.cxx
115 +/*************************************************************************
117 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
119 + * Copyright 2009 by Sun Microsystems, Inc.
121 + * OpenOffice.org - a multi-platform office productivity suite
123 + * This file is part of OpenOffice.org.
125 + * OpenOffice.org is free software: you can redistribute it and/or modify
126 + * it under the terms of the GNU Lesser General Public License version 3
127 + * only, as published by the Free Software Foundation.
129 + * OpenOffice.org is distributed in the hope that it will be useful,
130 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
131 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132 + * GNU Lesser General Public License version 3 for more details
133 + * (a copy is included in the LICENSE file that accompanied this code).
135 + * You should have received a copy of the GNU Lesser General Public License
136 + * version 3 along with OpenOffice.org. If not, see
137 + * <http://www.openoffice.org/license.html>
138 + * for a copy of the LGPLv3 License.
140 + ************************************************************************/
142 +#include "KDESalDisplay.hxx"
144 +#include "KDEXLib.hxx"
146 +SalKDEDisplay::SalKDEDisplay( Display* pDisp )
147 + : SalX11Display( pDisp )
151 +SalKDEDisplay::~SalKDEDisplay()
153 + // in case never a frame opened
154 + static_cast<KDEXLib*>(GetXLib())->doStartup();
155 + // clean up own members
157 + // prevent SalDisplay from closing KApplication's display
160 \ No newline at end of file
161 diff --git vcl/unx/kde4/KDESalDisplay.hxx vcl/unx/kde4/KDESalDisplay.hxx
163 index 0000000..aa81804
165 +++ vcl/unx/kde4/KDESalDisplay.hxx
167 +/*************************************************************************
169 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
171 + * Copyright 2009 by Sun Microsystems, Inc.
173 + * OpenOffice.org - a multi-platform office productivity suite
175 + * This file is part of OpenOffice.org.
177 + * OpenOffice.org is free software: you can redistribute it and/or modify
178 + * it under the terms of the GNU Lesser General Public License version 3
179 + * only, as published by the Free Software Foundation.
181 + * OpenOffice.org is distributed in the hope that it will be useful,
182 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
183 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184 + * GNU Lesser General Public License version 3 for more details
185 + * (a copy is included in the LICENSE file that accompanied this code).
187 + * You should have received a copy of the GNU Lesser General Public License
188 + * version 3 along with OpenOffice.org. If not, see
189 + * <http://www.openoffice.org/license.html>
190 + * for a copy of the LGPLv3 License.
192 + ************************************************************************/
196 +#include <saldisp.hxx>
198 +class SalKDEDisplay : public SalX11Display
201 + SalKDEDisplay( Display* pDisp );
202 + virtual ~SalKDEDisplay();
204 diff --git vcl/unx/kde4/KDESalFrame.cxx vcl/unx/kde4/KDESalFrame.cxx
206 index 0000000..c8bccc8
208 +++ vcl/unx/kde4/KDESalFrame.cxx
210 +/*************************************************************************
212 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
214 + * Copyright 2009 by Sun Microsystems, Inc.
216 + * OpenOffice.org - a multi-platform office productivity suite
218 + * This file is part of OpenOffice.org.
220 + * OpenOffice.org is free software: you can redistribute it and/or modify
221 + * it under the terms of the GNU Lesser General Public License version 3
222 + * only, as published by the Free Software Foundation.
224 + * OpenOffice.org is distributed in the hope that it will be useful,
225 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
226 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
227 + * GNU Lesser General Public License version 3 for more details
228 + * (a copy is included in the LICENSE file that accompanied this code).
230 + * You should have received a copy of the GNU Lesser General Public License
231 + * version 3 along with OpenOffice.org. If not, see
232 + * <http://www.openoffice.org/license.html>
233 + * for a copy of the LGPLv3 License.
235 + ************************************************************************/
237 +#define Region QtXRegion
242 +#include <kconfig.h>
243 +#include <kglobal.h>
244 +#include <kmenubar.h>
245 +#include <kconfiggroup.h>
246 +#include <kmainwindow.h>
247 +#include <kapplication.h>
248 +#include <ktoolbar.h>
252 +#include "KDESalFrame.hxx"
253 +#include "KDEXLib.hxx"
254 +#include "KDESalGraphics.hxx"
256 +#include <vcl/settings.hxx>
257 +#include <vcl/font.hxx>
258 +#include <tools/color.hxx>
260 +#include <vcl/svdata.hxx>
262 +#include <pspgraphics.h>
264 +#if OSL_DEBUG_LEVEL > 1
268 +KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) :
269 + X11SalFrame( pParent, nState )
273 +void KDESalFrame::Show( BOOL bVisible, BOOL bNoActivate )
275 + if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) )
277 + KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
278 + pXLib->doStartup();
281 + X11SalFrame::Show( bVisible, bNoActivate );
284 +/** Helper function to convert colors.
286 +static Color toColor( const QColor &rColor )
288 + return Color( rColor.red(), rColor.green(), rColor.blue() );
291 +/** Helper function to read untranslated text entry from KConfig configuration repository.
293 +static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
295 + return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
298 +/** Helper function to read color from KConfig configuration repository.
300 +static Color readColor( KConfigGroup *pGroup, const char *pKey )
302 + return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
305 +/** Helper function to add information to Font from QFont.
307 + Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
309 +static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& rLocale )
311 + psp::FastPrintFontInfo aInfo;
312 + QFontInfo qFontInfo( rQFont );
315 + aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 );
318 + aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright );
321 + int nWeight = qFontInfo.weight();
322 + if ( nWeight <= QFont::Light )
323 + aInfo.m_eWeight = psp::weight::Light;
324 + else if ( nWeight <= QFont::Normal )
325 + aInfo.m_eWeight = psp::weight::Normal;
326 + else if ( nWeight <= QFont::DemiBold )
327 + aInfo.m_eWeight = psp::weight::SemiBold;
328 + else if ( nWeight <= QFont::Bold )
329 + aInfo.m_eWeight = psp::weight::Bold;
331 + aInfo.m_eWeight = psp::weight::UltraBold;
334 + int nStretch = rQFont.stretch();
335 + if ( nStretch <= QFont::UltraCondensed )
336 + aInfo.m_eWidth = psp::width::UltraCondensed;
337 + else if ( nStretch <= QFont::ExtraCondensed )
338 + aInfo.m_eWidth = psp::width::ExtraCondensed;
339 + else if ( nStretch <= QFont::Condensed )
340 + aInfo.m_eWidth = psp::width::Condensed;
341 + else if ( nStretch <= QFont::SemiCondensed )
342 + aInfo.m_eWidth = psp::width::SemiCondensed;
343 + else if ( nStretch <= QFont::Unstretched )
344 + aInfo.m_eWidth = psp::width::Normal;
345 + else if ( nStretch <= QFont::SemiExpanded )
346 + aInfo.m_eWidth = psp::width::SemiExpanded;
347 + else if ( nStretch <= QFont::Expanded )
348 + aInfo.m_eWidth = psp::width::Expanded;
349 + else if ( nStretch <= QFont::ExtraExpanded )
350 + aInfo.m_eWidth = psp::width::ExtraExpanded;
352 + aInfo.m_eWidth = psp::width::UltraExpanded;
354 +#if OSL_DEBUG_LEVEL > 1
355 + fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
358 + // match font to e.g. resolve "Sans"
359 + psp::PrintFontManager::get().matchFont( aInfo, rLocale );
361 +#if OSL_DEBUG_LEVEL > 1
362 + fprintf( stderr, "font match %s, name AFTER: \"%s\"\n",
363 + aInfo.m_nID != 0 ? "succeeded" : "failed",
364 + OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
368 + int nPointHeight = qFontInfo.pointSize();
369 + if ( nPointHeight <= 0 )
370 + nPointHeight = rQFont.pointSize();
373 + Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
374 + if( aInfo.m_eWeight != psp::weight::Unknown )
375 + aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
376 + if( aInfo.m_eWidth != psp::width::Unknown )
377 + aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
378 + if( aInfo.m_eItalic != psp::italic::Unknown )
379 + aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
380 + if( aInfo.m_ePitch != psp::pitch::Unknown )
381 + aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) );
386 +/** Implementation of KDE integration's main method.
388 +void KDESalFrame::UpdateSettings( AllSettings& rSettings )
390 + StyleSettings style( rSettings.GetStyleSettings() );
391 + BOOL bSetTitleFont = false;
394 + // General settings
395 + QPalette pal = kapp->palette();
397 + style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
398 + style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
400 + style.SetActiveColor2(toColor(pal.color(QPalette::Active, QPalette::Window)));
401 + style.SetDeactiveColor2(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
403 + style.SetActiveTextColor(toColor(pal.color(QPalette::Active, QPalette::WindowText)));
404 + style.SetDeactiveTextColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
407 + KConfig *pConfig = KGlobal::config().data();
410 + KConfigGroup aGroup = pConfig->group( "WM" );
413 + pKey = "titleFont";
414 + if ( aGroup.hasKey( pKey ) )
416 + Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
417 + style.SetTitleFont( aFont );
418 + bSetTitleFont = true;
421 + aGroup = pConfig->group( "Icons" );
424 + if ( aGroup.hasKey( pKey ) )
425 + style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) );
428 + Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) );
429 + Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) );
430 + Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) );
431 + Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) );
432 + Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) );
433 + Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) );
434 + Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) );
437 + style.SetRadioCheckTextColor( aFore );
438 + style.SetLabelTextColor( aFore );
439 + style.SetInfoTextColor( aFore );
440 + style.SetDialogTextColor( aFore );
441 + style.SetGroupTextColor( aFore );
444 + style.SetFieldTextColor( aText );
445 + style.SetFieldRolloverTextColor( aText );
446 + style.SetWindowTextColor( aText );
447 + style.SetHelpTextColor( aText );
450 + style.SetFieldColor( aBase );
451 + style.SetHelpColor( aBase );
452 + style.SetWindowColor( aBase );
453 + style.SetActiveTabColor( aBase );
456 + style.SetButtonTextColor( aButn );
457 + style.SetButtonRolloverTextColor( aButn );
460 + style.SetDisableColor( aMid );
463 + style.SetWorkspaceColor( aMid );
466 + style.Set3DColors( aBack );
467 + style.SetFaceColor( aBack );
468 + style.SetInactiveTabColor( aBack );
469 + style.SetDialogColor( aBack );
471 + if( aBack == COL_LIGHTGRAY )
472 + style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
475 + Color aColor2 = style.GetLightColor();
477 + SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2),
478 + (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2),
479 + (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2)
484 + style.SetHighlightColor( aHigh );
485 + style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText)) );
488 + Font aFont = toFont( kapp->font(), rSettings.GetUILocale() );
490 + style.SetAppFont( aFont );
491 + style.SetHelpFont( aFont );
493 + if( !bSetTitleFont )
495 + style.SetTitleFont( aFont );
498 + style.SetFloatTitleFont( aFont );
499 + style.SetMenuFont( aFont ); // will be changed according to pMenuBar
500 + style.SetToolFont( aFont ); // will be changed according to pToolBar
501 + style.SetLabelFont( aFont );
502 + style.SetInfoFont( aFont );
503 + style.SetRadioCheckFont( aFont );
504 + style.SetPushButtonFont( aFont );
505 + style.SetFieldFont( aFont );
506 + style.SetIconFont( aFont );
507 + style.SetGroupFont( aFont );
509 + int flash_time = QApplication::cursorFlashTime();
510 + style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
512 + KMainWindow qMainWindow;
515 + style.SetSkipDisabledInMenus( TRUE );
516 + KMenuBar *pMenuBar = qMainWindow.menuBar();
520 + QPalette qMenuCG = pMenuBar->palette();
522 + // Menu text and background color, theme specific
523 + Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
524 + Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
526 + aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText ) );
527 + aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
529 + style.SetMenuTextColor( aMenuFore );
530 + style.SetMenuColor( aMenuBack );
531 + style.SetMenuBarColor( aMenuBack );
533 + style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
535 + style.SetMenuHighlightTextColor( aMenuFore );
537 + // set special menubar higlight text color
538 + if ( kapp->style()->inherits( "HighContrastStyle" ) )
539 + ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
541 + ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
544 + aFont = toFont( pMenuBar->font(), rSettings.GetUILocale() );
545 + style.SetMenuFont( aFont );
549 + KToolBar *pToolBar = qMainWindow.toolBar();
552 + aFont = toFont( pToolBar->font(), rSettings.GetUILocale() );
553 + style.SetToolFont( aFont );
557 + style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
559 + // #i59364# high contrast mode
560 + BOOL bHC = ( style.GetFaceColor().IsDark() ||
561 + style.GetWindowColor().IsDark() );
562 + style.SetHighContrastMode( bHC );
564 + rSettings.SetStyleSettings( style );
568 +void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
570 + for( int i = 0; i < nMaxGraphics; i++ )
572 + if( m_aGraphics[i].pGraphics == pGraphics )
574 + m_aGraphics[i].bInUse = false;
580 +void KDESalFrame::updateGraphics()
582 + for( int i = 0; i < nMaxGraphics; i++ )
584 + if( m_aGraphics[i].bInUse )
585 + m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() );
589 +KDESalFrame::~KDESalFrame()
593 +KDESalFrame::GraphicsHolder::~GraphicsHolder()
598 +SalGraphics* KDESalFrame::GetGraphics()
602 + for( int i = 0; i < nMaxGraphics; i++ )
604 + if( ! m_aGraphics[i].bInUse )
606 + m_aGraphics[i].bInUse = true;
607 + if( ! m_aGraphics[i].pGraphics )
609 + m_aGraphics[i].pGraphics = new KDESalGraphics();
610 + m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
612 + return m_aGraphics[i].pGraphics;
619 \ No newline at end of file
620 diff --git vcl/unx/kde4/KDESalFrame.hxx vcl/unx/kde4/KDESalFrame.hxx
622 index 0000000..da41fd3
624 +++ vcl/unx/kde4/KDESalFrame.hxx
626 +/*************************************************************************
628 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
630 + * Copyright 2009 by Sun Microsystems, Inc.
632 + * OpenOffice.org - a multi-platform office productivity suite
634 + * This file is part of OpenOffice.org.
636 + * OpenOffice.org is free software: you can redistribute it and/or modify
637 + * it under the terms of the GNU Lesser General Public License version 3
638 + * only, as published by the Free Software Foundation.
640 + * OpenOffice.org is distributed in the hope that it will be useful,
641 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
642 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 + * GNU Lesser General Public License version 3 for more details
644 + * (a copy is included in the LICENSE file that accompanied this code).
646 + * You should have received a copy of the GNU Lesser General Public License
647 + * version 3 along with OpenOffice.org. If not, see
648 + * <http://www.openoffice.org/license.html>
649 + * for a copy of the LGPLv3 License.
651 + ************************************************************************/
655 +#include <saldisp.hxx>
656 +#include <salframe.h>
658 +class KDESalFrame : public X11SalFrame
661 + static const int nMaxGraphics = 2;
663 + struct GraphicsHolder
665 + X11SalGraphics* pGraphics;
668 + GraphicsHolder() : pGraphics(0),bInUse( false ) {}
672 + GraphicsHolder m_aGraphics[ nMaxGraphics ];
675 + KDESalFrame( SalFrame* pParent, ULONG nStyle );
676 + virtual ~KDESalFrame();
678 + virtual SalGraphics* GetGraphics();
679 + virtual void ReleaseGraphics( SalGraphics *pGraphics );
680 + virtual void updateGraphics();
681 + virtual void UpdateSettings( AllSettings& rSettings );
682 + virtual void Show( BOOL bVisible, BOOL bNoActivate );
684 \ No newline at end of file
685 diff --git vcl/unx/kde4/KDESalGraphics.cxx vcl/unx/kde4/KDESalGraphics.cxx
687 index 0000000..35b9330
689 +++ vcl/unx/kde4/KDESalGraphics.cxx
691 +/*************************************************************************
693 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
695 + * Copyright 2009 by Sun Microsystems, Inc.
697 + * OpenOffice.org - a multi-platform office productivity suite
699 + * This file is part of OpenOffice.org.
701 + * OpenOffice.org is free software: you can redistribute it and/or modify
702 + * it under the terms of the GNU Lesser General Public License version 3
703 + * only, as published by the Free Software Foundation.
705 + * OpenOffice.org is distributed in the hope that it will be useful,
706 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
707 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
708 + * GNU Lesser General Public License version 3 for more details
709 + * (a copy is included in the LICENSE file that accompanied this code).
711 + * You should have received a copy of the GNU Lesser General Public License
712 + * version 3 along with OpenOffice.org. If not, see
713 + * <http://www.openoffice.org/license.html>
714 + * for a copy of the LGPLv3 License.
716 + ************************************************************************/
718 +// MARKER(update_precomp.py): autogen include statement, do not remove
719 +#include "precompiled_vcl.hxx"
721 +#define _SV_SALNATIVEWIDGETS_KDE_CXX
723 +#define Region QtXRegion
726 +#include <QStyleOption>
729 +#include <kapplication.h>
733 +#include "KDESalGraphics.hxx"
735 +#include <vcl/settings.hxx>
736 +#include <rtl/ustrbuf.hxx>
740 +using namespace ::rtl;
743 + Conversion function between VCL ControlState together with
744 + ImplControlValue and Qt state flags.
745 + @param nControlState State of the widget (default, focused, ...) in Native Widget Framework.
746 + @param aValue Value held by the widget (on, off, ...)
748 +QStyle::State vclStateValue2StateFlag( ControlState nControlState,
749 + const ImplControlValue& aValue )
751 + QStyle::State nState =
752 + ( (nControlState & CTRL_STATE_DEFAULT)? QStyle::State_None: QStyle::State_None ) |
753 + ( (nControlState & CTRL_STATE_ENABLED)? QStyle::State_Enabled: QStyle::State_None ) |
754 + ( (nControlState & CTRL_STATE_FOCUSED)? QStyle::State_HasFocus: QStyle::State_None ) |
755 + ( (nControlState & CTRL_STATE_PRESSED)? QStyle::State_Sunken: QStyle::State_None ) |
756 + ( (nControlState & CTRL_STATE_SELECTED)? QStyle::State_Selected : QStyle::State_None ) |
757 + ( (nControlState & CTRL_STATE_ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None );
758 + //TODO ( (nControlState & CTRL_STATE_HIDDEN)? QStyle::State_: QStyle::State_None ) |
760 + switch ( aValue.getTristateVal() )
762 + case BUTTONVALUE_ON: nState |= QStyle::State_On; break;
763 + case BUTTONVALUE_OFF: nState |= QStyle::State_Off; break;
764 + case BUTTONVALUE_MIXED: nState |= QStyle::State_NoChange; break;
772 + Convert VCL Region to QRect.
773 + @param rControlRegion The region to convert.
774 + @return The bounding box of the region.
776 +QRect region2QRect( const Region& rControlRegion )
778 + Rectangle aRect = rControlRegion.GetBoundRect();
780 + return QRect( QPoint( aRect.Left(), aRect.Top() ),
781 + QPoint( aRect.Right(), aRect.Bottom() ) );
784 +BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
786 + if (type == CTRL_PUSHBUTTON) return true;
788 + if (type == CTRL_MENUBAR) return true;
790 + if (type == CTRL_MENU_POPUP) return true;
792 + if (type == CTRL_EDITBOX) return true;
794 + if (type == CTRL_COMBOBOX) return true;
796 + if (type == CTRL_TOOLBAR) return true;
798 + if (type == CTRL_CHECKBOX) return true;
800 + if (type == CTRL_LISTBOX) return true;
802 + if (type == CTRL_LISTNODE) return true;
804 + if (type == CTRL_FRAME) return true;
806 + if (type == CTRL_SCROLLBAR) return true;
808 + if (type == CTRL_WINDOW_BACKGROUND) return true;
810 + if (type == CTRL_SPINBOX) return true;
812 + if (type == CTRL_SPINBUTTONS) return true;
814 + if (type == CTRL_GROUPBOX) return true;
816 + if (type == CTRL_FIXEDLINE) return true;
818 + if (type == CTRL_FIXEDBORDER) return true;
820 + if (type == CTRL_TOOLTIP) return true;
822 + if (type == CTRL_RADIOBUTTON) return true;
826 + if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
827 + if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true;
828 + // no CTRL_TAB_BODY for KDE
829 + if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true;
835 +BOOL KDESalGraphics::hitTestNativeControl( ControlType type, ControlPart part,
836 + const Region& rControlRegion, const Point& rPos,
837 + SalControlHandle&, BOOL& rIsInside )
842 +BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
843 + const Region& rControlRegion, ControlState nControlState,
844 + const ImplControlValue& value, SalControlHandle&,
847 + BOOL returnVal = true;
849 + Display* dpy = GetXDisplay();
850 + XLIB_Window drawable = GetDrawable();
851 + GC gc = SelectPen();
853 + QRect widgetRect = region2QRect(rControlRegion);
855 + //draw right onto the window
856 + QPixmap pixmap(widgetRect.width(), widgetRect.height());
858 + if (pixmap.isNull())
863 + QPainter painter(&pixmap);
864 + painter.setBackgroundMode(Qt::OpaqueMode);
866 + //copy previous screen contents for proper blending
867 + QPixmap screen = QPixmap::fromX11Pixmap(drawable);
868 + painter.drawPixmap(0,0, screen, widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height());
870 + if (type == CTRL_PUSHBUTTON)
872 + QStyleOptionButton styleOption;
874 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
875 + styleOption.state =vclStateValue2StateFlag( nControlState, value );
877 + kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter);
879 + else if ( (type == CTRL_MENUBAR))
881 + if (part == PART_MENU_ITEM)
883 + QStyleOptionMenuItem styleOption;
885 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
886 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
888 + kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter);
892 + pixmap.fill(KApplication::palette().color(QPalette::Window));
895 + else if (type == CTRL_MENU_POPUP)
897 + if (part == PART_MENU_ITEM)
899 + QStyleOptionMenuItem styleOption;
901 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
902 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
904 + kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
906 + else if (part == PART_MENU_ITEM_CHECK_MARK)
908 + QStyleOptionButton styleOption;
910 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
911 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
913 + if (nControlState & CTRL_STATE_PRESSED)
915 + kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter);
918 + else if (part == PART_MENU_ITEM_RADIO_MARK)
920 + QStyleOptionButton styleOption;
922 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
923 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
925 + if (nControlState & CTRL_STATE_PRESSED)
927 + kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter);
932 + pixmap.fill(KApplication::palette().color(QPalette::Window));
934 + QStyleOptionFrameV3 styleOption;
936 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
937 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
938 + styleOption.frameShape = QFrame::StyledPanel;
940 + kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter);
943 + else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) )
945 + QStyleOptionToolButton styleOption;
947 + styleOption.arrowType = Qt::NoArrow;
948 + styleOption.subControls = QStyle::SC_ToolButton;
950 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
951 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
952 + styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
954 + kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter);
956 + else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) )
958 + QStyleOptionToolBar styleOption;
960 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
961 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
963 + kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter);
965 + else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
967 + QStyleOption styleOption;
969 + int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
971 + styleOption.rect = QRect(0, 0, width, widgetRect.height());
972 + styleOption.state = QStyle::State_Horizontal;
974 + kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter);
976 + else if (type == CTRL_EDITBOX)
978 + pixmap.fill(KApplication::palette().color(QPalette::Window));
980 + //TODO hover?? OO does not seem to do this for line edits
982 + QStyleOptionFrameV3 styleOption;
984 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
986 + //TODO...how does the line edit draw itself internally??
987 + styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4);
988 + kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter);
990 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
991 + kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter);
993 + else if (type == CTRL_COMBOBOX)
995 + pixmap.fill(KApplication::palette().color(QPalette::Window));
997 + QStyleOptionComboBox styleOption;
999 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1000 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1002 + styleOption.editable = true;
1004 + kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
1006 + else if (type == CTRL_LISTBOX)
1008 + QStyleOptionComboBox styleOption;
1010 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1011 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1013 + if (part == PART_SUB_EDIT)
1015 + kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter);
1019 + kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
1022 + else if (type == CTRL_LISTNODE)
1024 + QStyleOption styleOption;
1026 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1027 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1029 + styleOption.state |= QStyle::State_Item;
1030 + styleOption.state |= QStyle::State_Children;
1032 + if (nControlState & CTRL_STATE_PRESSED)
1034 + styleOption.state |= QStyle::State_Open;
1037 + kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter);
1039 + else if (type == CTRL_CHECKBOX)
1041 + QStyleOptionButton styleOption;
1043 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1044 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1046 + kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter);
1048 + else if (type == CTRL_SCROLLBAR)
1050 + pixmap.fill(KApplication::palette().color(QPalette::Window));
1052 + if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
1054 + ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
1056 + QStyleOptionSlider styleOption;
1057 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1059 + //if the scroll bar is active (aka not degenrate...allow for hover events
1060 + if (sbVal->mnVisibleSize < sbVal->mnMax)
1062 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1063 + styleOption.state |= QStyle::State_MouseOver;
1066 + //horizontal or vertical
1067 + if (part == PART_DRAW_BACKGROUND_VERT)
1069 + styleOption.orientation = Qt::Vertical;
1073 + styleOption.state |= QStyle::State_Horizontal;
1076 + //setup parameters from the OO values
1077 + styleOption.minimum = sbVal->mnMin;
1078 + styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
1079 + styleOption.sliderValue = sbVal->mnCur;
1080 + styleOption.sliderPosition = sbVal->mnCur;
1081 + styleOption.pageStep = sbVal->mnVisibleSize;
1083 + //setup the active control...always the slider
1084 + if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER)
1086 + styleOption.activeSubControls = QStyle::SC_ScrollBarSlider;
1089 + kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter);
1092 + else if (type == CTRL_SPINBOX)
1094 + pixmap.fill(KApplication::palette().color(QPalette::Window));
1095 + //SpinbuttonValue* sbVal = static_cast<SpinbuttonValue *> ( value.getOptionalVal() );
1097 + QStyleOptionSpinBox styleOption;
1098 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1099 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1101 + kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
1103 + else if (type == CTRL_SPINBUTTONS)
1105 + pixmap.fill(KApplication::palette().color(QPalette::Window));
1107 + QStyleOptionSpinBox styleOption;
1108 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1109 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1111 + styleOption.subControls = QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
1113 + kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
1115 + else if (type == CTRL_GROUPBOX)
1117 + QStyleOptionGroupBox styleOption;
1118 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1119 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1121 + kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter);
1123 + else if (type == CTRL_RADIOBUTTON)
1125 + QStyleOptionButton styleOption;
1126 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1127 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1129 + kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter);
1131 + else if (type == CTRL_TOOLTIP)
1133 + QStyleOption styleOption;
1134 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1135 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1137 + kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter);
1139 + else if (type == CTRL_FRAME)
1141 + QStyleOptionFrameV3 styleOption;
1142 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1143 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1144 + styleOption.frameShape = QFrame::StyledPanel;
1146 + kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
1148 + else if (type == CTRL_FIXEDBORDER)
1150 + QStyleOptionFrameV3 styleOption;
1151 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1152 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1153 + styleOption.frameShape = QFrame::StyledPanel;
1155 + kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
1157 + else if (type == CTRL_WINDOW_BACKGROUND)
1159 + pixmap.fill(KApplication::palette().color(QPalette::Window));
1161 + else if (type == CTRL_FIXEDLINE)
1163 + QStyleOptionMenuItem styleOption;
1165 + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
1166 + styleOption.state = vclStateValue2StateFlag( nControlState, value );
1167 + styleOption.menuItemType = QStyleOptionMenuItem::Separator;
1168 + styleOption.state |= QStyle::State_Item;
1170 + kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
1174 + returnVal = false;
1179 + X11SalGraphics::CopyScreenArea( dpy,
1180 + pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
1181 + drawable, GetScreenNumber(), GetVisual().GetDepth(), gc,
1182 + 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() );
1188 +BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
1189 + const Region& controlRegion, ControlState controlState,
1190 + const ImplControlValue& val, SalControlHandle&,
1192 + Region &nativeBoundingRegion, Region &nativeContentRegion )
1194 + bool retVal = false;
1196 + QRect boundingRect = region2QRect( controlRegion );
1197 + QRect contentRect = boundingRect;
1198 + QStyleOptionComplex styleOption;
1202 + // Metrics of the push button
1203 + case CTRL_PUSHBUTTON:
1204 + if (part == PART_ENTIRE_CONTROL)
1206 + styleOption.state = vclStateValue2StateFlag(controlState, val);
1208 + if ( controlState & CTRL_STATE_DEFAULT )
1210 + int size = kapp->style()->pixelMetric(
1211 + QStyle::PM_ButtonDefaultIndicator, &styleOption );
1213 + boundingRect.adjust( -size, -size, size, size );
1219 + case CTRL_EDITBOX:
1221 + styleOption.rect = QRect(0, 0, contentRect.width(), contentRect.height());
1222 + styleOption.state = vclStateValue2StateFlag(controlState, val);
1224 + int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) - 1;
1226 + contentRect.adjust( -size, -size, size, size);
1227 + boundingRect = contentRect;
1233 + case CTRL_CHECKBOX:
1234 + if (part == PART_ENTIRE_CONTROL)
1236 + styleOption.state = vclStateValue2StateFlag(controlState, val);
1238 + contentRect.setWidth(kapp->style()->pixelMetric(
1239 + QStyle::PM_IndicatorWidth, &styleOption));
1240 + contentRect.setHeight(kapp->style()->pixelMetric(
1241 + QStyle::PM_IndicatorHeight, &styleOption));
1243 + contentRect.adjust(0, 10, 0, 5);
1245 + boundingRect = contentRect;
1251 + case CTRL_COMBOBOX:
1252 + case CTRL_LISTBOX:
1254 + QStyleOptionComboBox cbo;
1256 + cbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
1257 + cbo.state = vclStateValue2StateFlag(controlState, val);
1261 + case PART_ENTIRE_CONTROL:
1263 + int size = kapp->style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2;
1264 + contentRect.adjust(-size,-size,size,size);
1268 + case PART_BUTTON_DOWN:
1269 + //the entire control can be used as the "down" button
1272 + case PART_SUB_EDIT:
1273 + contentRect = kapp->style()->subControlRect(
1274 + QStyle::CC_ComboBox, &cbo, QStyle::SC_ComboBoxEditField );
1276 + contentRect.translate( boundingRect.left(), boundingRect.top() );
1283 + case CTRL_SPINBOX:
1285 + QStyleOptionSpinBox sbo;
1287 + sbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
1288 + sbo.state = vclStateValue2StateFlag(controlState, val);
1292 + case PART_BUTTON_UP:
1293 + contentRect = kapp->style()->subControlRect(
1294 + QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxUp );
1295 + contentRect.translate( boundingRect.left(), boundingRect.top() );
1297 + boundingRect = QRect();
1300 + case PART_BUTTON_DOWN:
1301 + contentRect = kapp->style()->subControlRect(
1302 + QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxDown );
1304 + contentRect.translate( boundingRect.left(), boundingRect.top() );
1305 + boundingRect = QRect();
1308 + case PART_SUB_EDIT:
1309 + contentRect = kapp->style()->subControlRect(
1310 + QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxEditField );
1312 + contentRect.translate( boundingRect.left(), boundingRect.top() );
1319 + case CTRL_MENU_POPUP:
1320 + //just limit the widget of the menu items
1321 + //OO isn't very flexible in all reguards with the menu
1322 + //so we do the best we can
1323 + if (part == PART_MENU_ITEM_CHECK_MARK)
1325 + contentRect.setWidth(contentRect.height());
1328 + else if (part == PART_MENU_ITEM_RADIO_MARK)
1330 + contentRect.setWidth(contentRect.height());
1336 + if (part == PART_BORDER)
1338 + int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
1339 + //contentRect.adjust(size, size, size, size);
1340 + boundingRect.adjust(-size, -size, size, size);
1346 + case CTRL_RADIOBUTTON:
1348 + const int h = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight);
1349 + const int w = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth);
1351 + contentRect = QRect(boundingRect.left(), boundingRect.top(), w, h);
1361 + // Metrics of the scroll bar
1362 + case CTRL_SCROLLBAR:
1363 + //pWidget = pWidgetPainter->scrollBar( rControlRegion,
1364 + //( part == PART_BUTTON_LEFT || part == PART_BUTTON_RIGHT ),
1365 + //ImplControlValue() );
1366 + //aStyleOption.initFrom( pWidget );
1370 + case PART_BUTTON_LEFT:
1371 + case PART_BUTTON_UP:
1372 + qRect = kapp->style()->subControlRect(
1373 + QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine );
1375 + // Workaround for Platinum style scroll bars. It makes the
1376 + // left/up button invisible.
1377 + if ( part == PART_BUTTON_LEFT )
1379 + if ( qRect.left() > kapp->style()->subControlRect(
1380 + QStyle::CC_ScrollBar, &aStyleOption,
1381 + QStyle::SC_ScrollBarSubPage ).left() )
1383 + qRect.setLeft( 0 );
1384 + qRect.setRight( 0 );
1389 + if ( qRect.top() > kapp->style()->subControlRect(
1390 + QStyle::CC_ScrollBar, &aStyleOption,
1391 + QStyle::SC_ScrollBarSubPage ).top() )
1393 + qRect.setTop( 0 );
1394 + qRect.setBottom( 0 );
1398 + qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
1403 + case PART_BUTTON_RIGHT:
1404 + case PART_BUTTON_DOWN:
1405 + qRect = kapp->style()->subControlRect(
1406 + QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine );
1408 + // Workaround for Platinum and 3 button style scroll bars.
1409 + // It makes the right/down button bigger.
1410 + if ( part == PART_BUTTON_RIGHT )
1411 + qRect.setLeft( kapp->style()->subControlRect(
1412 + QStyle::CC_ScrollBar, &aStyleOption,
1413 + QStyle::SC_ScrollBarAddPage ).right() + 1 );
1415 + qRect.setTop( kapp->style()->subControlRect(
1416 + QStyle::CC_ScrollBar, &aStyleOption,
1417 + QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
1419 + qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
1430 + // Bounding region
1431 + Point aBPoint( boundingRect.x(), boundingRect.y() );
1432 + Size aBSize( boundingRect.width(), boundingRect.height() );
1433 + nativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) );
1435 + // Region of the content
1436 + Point aPoint( contentRect.x(), contentRect.y() );
1437 + Size aSize( contentRect.width(), contentRect.height() );
1438 + nativeContentRegion = Region( Rectangle( aPoint, aSize ) );
1443 diff --git vcl/unx/kde4/KDESalGraphics.hxx vcl/unx/kde4/KDESalGraphics.hxx
1444 new file mode 100644
1445 index 0000000..f6e77d7
1447 +++ vcl/unx/kde4/KDESalGraphics.hxx
1449 +/*************************************************************************
1451 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1453 + * Copyright 2009 by Sun Microsystems, Inc.
1455 + * OpenOffice.org - a multi-platform office productivity suite
1457 + * This file is part of OpenOffice.org.
1459 + * OpenOffice.org is free software: you can redistribute it and/or modify
1460 + * it under the terms of the GNU Lesser General Public License version 3
1461 + * only, as published by the Free Software Foundation.
1463 + * OpenOffice.org is distributed in the hope that it will be useful,
1464 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1465 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1466 + * GNU Lesser General Public License version 3 for more details
1467 + * (a copy is included in the LICENSE file that accompanied this code).
1469 + * You should have received a copy of the GNU Lesser General Public License
1470 + * version 3 along with OpenOffice.org. If not, see
1471 + * <http://www.openoffice.org/license.html>
1472 + * for a copy of the LGPLv3 License.
1474 + ************************************************************************/
1478 +#include <rtl/string.hxx>
1479 +#include <saldisp.hxx>
1480 +#include <salgdi.h>
1482 +/** handles graphics drawings requests and performs the needed drawing operations */
1483 +class KDESalGraphics : public X11SalGraphics
1486 + KDESalGraphics() {}
1487 + virtual ~KDESalGraphics() {}
1490 + What widgets can be drawn the native way.
1491 + @param type Type of the widget.
1492 + @param part Specification of the widget's part if it consists of more than one.
1493 + @return true if the platform supports native drawing of the widget type defined by part.
1495 + virtual BOOL IsNativeControlSupported( ControlType type, ControlPart part );
1497 + /** Test whether the position is in the native widget.
1498 + If the return value is TRUE, bIsInside contains information whether
1499 + aPos was or was not inside the native widget specified by the
1500 + type/part combination.
1502 + virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
1503 + const Region& rControlRegion, const Point& aPos,
1504 + SalControlHandle& rControlHandle, BOOL& rIsInside );
1505 + /** Draw the requested control described by part/nControlState.
1507 + @param rControlRegion
1508 + The bounding region of the complete control in VCL frame coordinates.
1511 + An optional value (tristate/numerical/string).
1513 + @param rControlHandle
1514 + Carries platform dependent data and is maintained by the SalFrame implementation.
1517 + A caption or title string (like button text etc.)
1519 + virtual BOOL drawNativeControl( ControlType type, ControlPart part,
1520 + const Region& rControlRegion, ControlState nControlState,
1521 + const ImplControlValue& aValue, SalControlHandle& rControlHandle,
1522 + const rtl::OUString& aCaption );
1524 + /** Draw text on the widget.
1525 + OPTIONAL. Draws the requested text for the control described by part/nControlState.
1526 + Used if text is not drawn by DrawNativeControl().
1528 + @param rControlRegion The bounding region of the complete control in VCL frame coordinates.
1529 + @param aValue An optional value (tristate/numerical/string)
1530 + @param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation.
1531 + @param aCaption A caption or title string (like button text etc.)
1533 + virtual BOOL drawNativeControlText( ControlType type, ControlPart part,
1534 + const Region& rControlRegion, ControlState nControlState,
1535 + const ImplControlValue& aValue, SalControlHandle& rControlHandle,
1536 + const rtl::OUString& aCaption ) { return false; }
1537 + /** Check if the bounding regions match.
1539 + If the return value is TRUE, rNativeBoundingRegion
1540 + contains the true bounding region covered by the control
1541 + including any adornment, while rNativeContentRegion contains the area
1542 + within the control that can be safely drawn into without drawing over
1543 + the borders of the control.
1545 + @param rControlRegion
1546 + The bounding region of the control in VCL frame coordinates.
1549 + An optional value (tristate/numerical/string)
1551 + @param rControlHandle
1552 + Carries platform dependent data and is maintained by the SalFrame implementation.
1555 + A caption or title string (like button text etc.)
1557 + virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
1558 + const Region& rControlRegion, ControlState nControlState,
1559 + const ImplControlValue& aValue, SalControlHandle& rControlHandle,
1560 + const rtl::OUString& aCaption,
1561 + Region &rNativeBoundingRegion, Region &rNativeContentRegion );
1563 \ No newline at end of file
1564 diff --git vcl/unx/kde4/KDESalInstance.cxx vcl/unx/kde4/KDESalInstance.cxx
1565 new file mode 100644
1566 index 0000000..c65f08e
1568 +++ vcl/unx/kde4/KDESalInstance.cxx
1570 +/*************************************************************************
1572 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1574 + * Copyright 2009 by Sun Microsystems, Inc.
1576 + * OpenOffice.org - a multi-platform office productivity suite
1578 + * This file is part of OpenOffice.org.
1580 + * OpenOffice.org is free software: you can redistribute it and/or modify
1581 + * it under the terms of the GNU Lesser General Public License version 3
1582 + * only, as published by the Free Software Foundation.
1584 + * OpenOffice.org is distributed in the hope that it will be useful,
1585 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1586 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1587 + * GNU Lesser General Public License version 3 for more details
1588 + * (a copy is included in the LICENSE file that accompanied this code).
1590 + * You should have received a copy of the GNU Lesser General Public License
1591 + * version 3 along with OpenOffice.org. If not, see
1592 + * <http://www.openoffice.org/license.html>
1593 + * for a copy of the LGPLv3 License.
1595 + ************************************************************************/
1597 +#include "KDESalInstance.hxx"
1599 +#include "KDESalFrame.hxx"
1601 +SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState )
1603 + return new KDESalFrame( pParent, nState );
1605 \ No newline at end of file
1606 diff --git vcl/unx/kde4/KDESalInstance.hxx vcl/unx/kde4/KDESalInstance.hxx
1607 new file mode 100644
1608 index 0000000..8ca2272
1610 +++ vcl/unx/kde4/KDESalInstance.hxx
1612 +/*************************************************************************
1614 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1616 + * Copyright 2009 by Sun Microsystems, Inc.
1618 + * OpenOffice.org - a multi-platform office productivity suite
1620 + * This file is part of OpenOffice.org.
1622 + * OpenOffice.org is free software: you can redistribute it and/or modify
1623 + * it under the terms of the GNU Lesser General Public License version 3
1624 + * only, as published by the Free Software Foundation.
1626 + * OpenOffice.org is distributed in the hope that it will be useful,
1627 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1628 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1629 + * GNU Lesser General Public License version 3 for more details
1630 + * (a copy is included in the LICENSE file that accompanied this code).
1632 + * You should have received a copy of the GNU Lesser General Public License
1633 + * version 3 along with OpenOffice.org. If not, see
1634 + * <http://www.openoffice.org/license.html>
1635 + * for a copy of the LGPLv3 License.
1637 + ************************************************************************/
1641 +#include <salinst.h>
1643 +class SalYieldMutex;
1646 +class KDESalInstance : public X11SalInstance
1649 + KDESalInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) {}
1650 + virtual ~KDESalInstance() {}
1651 + virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle );
1653 \ No newline at end of file
1654 diff --git vcl/unx/kde4/KDEXLib.cxx vcl/unx/kde4/KDEXLib.cxx
1655 new file mode 100644
1656 index 0000000..1e4e367
1658 +++ vcl/unx/kde4/KDEXLib.cxx
1660 +/*************************************************************************
1662 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1664 + * Copyright 2009 by Sun Microsystems, Inc.
1666 + * OpenOffice.org - a multi-platform office productivity suite
1668 + * This file is part of OpenOffice.org.
1670 + * OpenOffice.org is free software: you can redistribute it and/or modify
1671 + * it under the terms of the GNU Lesser General Public License version 3
1672 + * only, as published by the Free Software Foundation.
1674 + * OpenOffice.org is distributed in the hope that it will be useful,
1675 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1676 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1677 + * GNU Lesser General Public License version 3 for more details
1678 + * (a copy is included in the LICENSE file that accompanied this code).
1680 + * You should have received a copy of the GNU Lesser General Public License
1681 + * version 3 along with OpenOffice.org. If not, see
1682 + * <http://www.openoffice.org/license.html>
1683 + * for a copy of the LGPLv3 License.
1685 + ************************************************************************/
1687 +#include "VCLKDEApplication.hxx"
1689 +#define Region QtXRegion
1691 +#include <kapplication.h>
1692 +#include <klocale.h>
1693 +#include <kaboutdata.h>
1694 +#include <kcmdlineargs.h>
1695 +#include <kstartupinfo.h>
1699 +#include "KDEXLib.hxx"
1701 +#include <i18n_im.hxx>
1702 +#include <i18n_xkb.hxx>
1704 +#include <saldata.hxx>
1705 +#include <vos/process.hxx>
1707 +#include "KDESalDisplay.hxx"
1709 +#if OSL_DEBUG_LEVEL > 1
1713 +KDEXLib::KDEXLib() :
1714 + SalXLib(), m_bStartupDone(false), m_pApplication(0),
1715 + m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 )
1719 +KDEXLib::~KDEXLib()
1721 + delete (VCLKDEApplication*)m_pApplication;
1723 + // free the faked cmdline arguments no longer needed by KApplication
1724 + for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
1726 + free( m_pFreeCmdLineArgs[i] );
1729 + delete [] m_pFreeCmdLineArgs;
1730 + delete [] m_pAppCmdLineArgs;
1733 +void KDEXLib::Init()
1735 + SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
1736 + pInputMethod->SetLocale();
1739 + KAboutData *kAboutData = new KAboutData( "OpenOffice.org",
1741 + ki18n( "OpenOffice.org" ),
1743 + ki18n( "OpenOffice.org with KDE Native Widget Support." ),
1744 + KAboutData::License_LGPL,
1745 + ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"),
1746 + ki18n( "OpenOffice.org is an office suite.\n" ),
1747 + "http://kde.openoffice.org/index.html",
1748 + "dev@kde.openoffice.org" );
1749 + kAboutData->addAuthor( ki18n( "Jan Holesovsky" ),
1750 + ki18n( "Original author and maintainer of the KDE NWF." ),
1751 + "kendy@artax.karlin.mff.cuni.cz",
1752 + "http://artax.karlin.mff.cuni.cz/~kendy" );
1753 + kAboutData->addAuthor( ki18n("Eric Bischoff"),
1754 + ki18n( "Accessibility fixes, porting to KDE 4." ),
1755 + "bischoff@kde.org" );
1757 + m_nFakeCmdLineArgs = 1;
1759 + vos::OExtCommandLine aCommandLine;
1760 + int nParams = aCommandLine.getCommandArgCount();
1761 + rtl::OString aDisplay;
1762 + rtl::OUString aParam, aBin;
1764 + for ( nIdx = 0; nIdx < nParams; ++nIdx )
1766 + aCommandLine.getCommandArg( nIdx, aParam );
1767 + if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams )
1769 + aCommandLine.getCommandArg( nIdx + 1, aParam );
1770 + aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() );
1772 + m_nFakeCmdLineArgs = 3;
1773 + m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
1774 + m_pFreeCmdLineArgs[ 1 ] = strdup( "-display" );
1775 + m_pFreeCmdLineArgs[ 2 ] = strdup( aDisplay.getStr() );
1778 + if ( !m_pFreeCmdLineArgs )
1779 + m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
1781 + osl_getExecutableFile( &aParam.pData );
1782 + osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
1783 + rtl::OString aExec = rtl::OUStringToOString( aBin, osl_getThreadTextEncoding() );
1784 + m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() );
1786 + // make a copy of the string list for freeing it since
1787 + // KApplication manipulates the pointers inside the argument vector
1788 + // note: KApplication bad !
1789 + m_pAppCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
1790 + for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
1791 + m_pAppCmdLineArgs[i] = m_pFreeCmdLineArgs[i];
1793 + KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs, kAboutData );
1795 + m_pApplication = new VCLKDEApplication();
1796 + kapp->disableSessionManagement();
1798 + Display* pDisp = QX11Info::display();
1799 + SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
1801 + ((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
1803 + XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
1804 + XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl );
1806 + pInputMethod->CreateMethod( pDisp );
1807 + pInputMethod->AddConnectionWatch( pDisp, (void*)this );
1808 + pSalDisplay->SetInputMethod( pInputMethod );
1810 + PushXErrorLevel( true );
1811 + SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
1812 + XSync( pDisp, False );
1814 + pKbdExtension->UseExtension( ! HasXErrorOccured() );
1817 + pSalDisplay->SetKbdExtension( pKbdExtension );
1820 +void KDEXLib::doStartup()
1822 + if( ! m_bStartupDone )
1824 + KStartupInfo::appStarted();
1825 + m_bStartupDone = true;
1826 + #if OSL_DEBUG_LEVEL > 1
1827 + fprintf( stderr, "called KStartupInfo::appStarted()\n" );
1831 \ No newline at end of file
1832 diff --git vcl/unx/kde4/KDEXLib.hxx vcl/unx/kde4/KDEXLib.hxx
1833 new file mode 100644
1834 index 0000000..09a6197
1836 +++ vcl/unx/kde4/KDEXLib.hxx
1838 +/*************************************************************************
1840 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1842 + * Copyright 2009 by Sun Microsystems, Inc.
1844 + * OpenOffice.org - a multi-platform office productivity suite
1846 + * This file is part of OpenOffice.org.
1848 + * OpenOffice.org is free software: you can redistribute it and/or modify
1849 + * it under the terms of the GNU Lesser General Public License version 3
1850 + * only, as published by the Free Software Foundation.
1852 + * OpenOffice.org is distributed in the hope that it will be useful,
1853 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1854 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1855 + * GNU Lesser General Public License version 3 for more details
1856 + * (a copy is included in the LICENSE file that accompanied this code).
1858 + * You should have received a copy of the GNU Lesser General Public License
1859 + * version 3 along with OpenOffice.org. If not, see
1860 + * <http://www.openoffice.org/license.html>
1861 + * for a copy of the LGPLv3 License.
1863 + ************************************************************************/
1867 +#include <saldisp.hxx>
1869 +class KDEXLib : public SalXLib
1872 + bool m_bStartupDone;
1873 + void* m_pApplication;
1874 + char** m_pFreeCmdLineArgs;
1875 + char** m_pAppCmdLineArgs;
1876 + int m_nFakeCmdLineArgs;
1881 + virtual ~KDEXLib();
1882 + virtual void Init();
1886 diff --git vcl/unx/kde4/VCLKDEApplication.cxx vcl/unx/kde4/VCLKDEApplication.cxx
1887 new file mode 100644
1888 index 0000000..ff44d1b
1890 +++ vcl/unx/kde4/VCLKDEApplication.cxx
1892 +/*************************************************************************
1894 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1896 + * Copyright 2009 by Sun Microsystems, Inc.
1898 + * OpenOffice.org - a multi-platform office productivity suite
1900 + * This file is part of OpenOffice.org.
1902 + * OpenOffice.org is free software: you can redistribute it and/or modify
1903 + * it under the terms of the GNU Lesser General Public License version 3
1904 + * only, as published by the Free Software Foundation.
1906 + * OpenOffice.org is distributed in the hope that it will be useful,
1907 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1908 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1909 + * GNU Lesser General Public License version 3 for more details
1910 + * (a copy is included in the LICENSE file that accompanied this code).
1912 + * You should have received a copy of the GNU Lesser General Public License
1913 + * version 3 along with OpenOffice.org. If not, see
1914 + * <http://www.openoffice.org/license.html>
1915 + * for a copy of the LGPLv3 License.
1917 + ************************************************************************/
1919 +#include "VCLKDEApplication.hxx"
1921 +#define Region QtXRegion
1925 +#include "KDESalDisplay.hxx"
1927 +VCLKDEApplication::VCLKDEApplication() :
1933 +bool VCLKDEApplication::x11EventFilter(XEvent* event)
1935 + //if we have a display and the display consumes the event
1936 + //do not process the event in qt
1937 + if (disp && disp->Dispatch(event) > 0)
1944 \ No newline at end of file
1945 diff --git vcl/unx/kde4/VCLKDEApplication.hxx vcl/unx/kde4/VCLKDEApplication.hxx
1946 new file mode 100644
1947 index 0000000..e47ecef
1949 +++ vcl/unx/kde4/VCLKDEApplication.hxx
1951 +/*************************************************************************
1953 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1955 + * Copyright 2009 by Sun Microsystems, Inc.
1957 + * OpenOffice.org - a multi-platform office productivity suite
1959 + * This file is part of OpenOffice.org.
1961 + * OpenOffice.org is free software: you can redistribute it and/or modify
1962 + * it under the terms of the GNU Lesser General Public License version 3
1963 + * only, as published by the Free Software Foundation.
1965 + * OpenOffice.org is distributed in the hope that it will be useful,
1966 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1967 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1968 + * GNU Lesser General Public License version 3 for more details
1969 + * (a copy is included in the LICENSE file that accompanied this code).
1971 + * You should have received a copy of the GNU Lesser General Public License
1972 + * version 3 along with OpenOffice.org. If not, see
1973 + * <http://www.openoffice.org/license.html>
1974 + * for a copy of the LGPLv3 License.
1976 + ************************************************************************/
1980 +#define Region QtXRegion
1982 +#include <QSessionManager>
1984 +#include <kapplication.h>
1988 +class SalKDEDisplay;
1990 +/* #i59042# override KApplications method for session management
1991 + * since it will interfere badly with our own.
1993 +class VCLKDEApplication : public KApplication
1996 + VCLKDEApplication();
1998 + virtual void commitData(QSessionManager&) {};
2000 + virtual bool x11EventFilter(XEvent* event);
2002 + SalKDEDisplay* disp;
2004 \ No newline at end of file
2005 diff --git vcl/unx/kde4/main.cxx vcl/unx/kde4/main.cxx
2006 new file mode 100644
2007 index 0000000..848cd09
2009 +++ vcl/unx/kde4/main.cxx
2011 +/*************************************************************************
2013 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2015 + * Copyright 2009 by Sun Microsystems, Inc.
2017 + * OpenOffice.org - a multi-platform office productivity suite
2019 + * This file is part of OpenOffice.org.
2021 + * OpenOffice.org is free software: you can redistribute it and/or modify
2022 + * it under the terms of the GNU Lesser General Public License version 3
2023 + * only, as published by the Free Software Foundation.
2025 + * OpenOffice.org is distributed in the hope that it will be useful,
2026 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2027 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2028 + * GNU Lesser General Public License version 3 for more details
2029 + * (a copy is included in the LICENSE file that accompanied this code).
2031 + * You should have received a copy of the GNU Lesser General Public License
2032 + * version 3 along with OpenOffice.org. If not, see
2033 + * <http://www.openoffice.org/license.html>
2034 + * for a copy of the LGPLv3 License.
2036 + ************************************************************************/
2038 +// MARKER(update_precomp.py): autogen include statement, do not remove
2039 +#include "precompiled_vcl.hxx"
2041 +#define Region QtXRegion
2042 +#include <QApplication>
2045 +#include "KDEData.hxx"
2046 +#include "KDESalInstance.hxx"
2048 +#if OSL_DEBUG_LEVEL > 1
2052 +#include <rtl/string.hxx>
2054 +/// entry point for the KDE4 VCL plugin
2056 + VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule )
2058 +#if QT_VERSION < 0x040000
2059 + // Qt 3.x support needs >= 3.2.2 - any 4.x should be ok
2060 + rtl::OString aVersion( qVersion() );
2061 +#if OSL_DEBUG_LEVEL > 1
2062 + fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() );
2064 + sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0;
2065 + nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32();
2067 + nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32();
2069 + nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32();
2070 + if( nMajor != 3 || nMinor < 2 || (nMinor == 2 && nMicro < 2) )
2072 +#if OSL_DEBUG_LEVEL > 1
2073 + fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro );
2079 + KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
2080 +#if OSL_DEBUG_LEVEL > 1
2081 + fprintf( stderr, "created KDESalInstance 0x%p\n", pInstance );
2084 + // initialize SalData
2085 + KDEData *salData = new KDEData();
2086 + SetSalData(salData);
2087 + salData->m_pInstance = pInstance;
2089 + salData->initNWF();
2094 diff --git vcl/unx/kde4/makefile.mk vcl/unx/kde4/makefile.mk
2095 new file mode 100644
2096 index 0000000..102e268
2098 +++ vcl/unx/kde4/makefile.mk
2100 +#*************************************************************************
2102 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2104 +# Copyright 2008 by Sun Microsystems, Inc.
2106 +# OpenOffice.org - a multi-platform office productivity suite
2108 +# $RCSfile: makefile.mk,v $
2110 +# $Revision: 1.10 $
2112 +# This file is part of OpenOffice.org.
2114 +# OpenOffice.org is free software: you can redistribute it and/or modify
2115 +# it under the terms of the GNU Lesser General Public License version 3
2116 +# only, as published by the Free Software Foundation.
2118 +# OpenOffice.org is distributed in the hope that it will be useful,
2119 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2120 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2121 +# GNU Lesser General Public License version 3 for more details
2122 +# (a copy is included in the LICENSE file that accompanied this code).
2124 +# You should have received a copy of the GNU Lesser General Public License
2125 +# version 3 along with OpenOffice.org. If not, see
2126 +# <http://www.openoffice.org/license.html>
2127 +# for a copy of the LGPLv3 License.
2129 +#*************************************************************************
2135 +.INCLUDE : $(PRJ)$/util$/makefile.pmk
2137 +# workaround for makedepend hang
2140 +# --- Settings -----------------------------------------------------
2142 +.INCLUDE : settings.mk
2143 +.INCLUDE : $(PRJ)$/util$/makefile2.pmk
2145 +# For some of the included external KDE headers, GCC complains about shadowed
2146 +# symbols in instantiated template code only at the end of a compilation unit,
2147 +# so the only solution is to disable that warning here:
2148 +.IF "$(COM)" == "GCC"
2149 +CFLAGSCXX+=-Wno-shadow
2152 +# --- Files --------------------------------------------------------
2154 +.IF "$(GUIBASE)"!="unx"
2157 + @echo "Nothing to build for GUIBASE $(GUIBASE)"
2159 +.ELSE # "$(GUIBASE)"!="unx"
2161 +.IF "$(ENABLE_KDE4)" != ""
2163 +CFLAGS+=$(KDE4_CFLAGS)
2165 +.IF "$(ENABLE_RANDR)" != ""
2170 + $(SLO)$/main.obj \
2171 + $(SLO)$/VCLKDEApplication.obj \
2172 + $(SLO)$/KDEXLib.obj \
2173 + $(SLO)$/KDESalDisplay.obj \
2174 + $(SLO)$/KDESalFrame.obj \
2175 + $(SLO)$/KDESalGraphics.obj \
2176 + $(SLO)$/KDESalInstance.obj \
2177 + $(SLO)$/KDEData.obj
2180 +.ELSE # "$(ENABLE_KDE4)" != ""
2183 + @echo KDE disabled - nothing to build
2185 +.ENDIF # "$(GUIBASE)"!="unx"
2187 +# --- Targets ------------------------------------------------------
2189 +.INCLUDE : target.mk
2191 +.INCLUDE : $(PRJ)$/util$/target.pmk