From 6b2736fed5bb3c5e7949be2baa4a50c9a9c9b3e2 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 8 Oct 2010 11:48:35 +0200 Subject: vcl116: #i114958# implement DBG_TESTSOALRMUTEX on all platforms --- vcl/aqua/inc/salinst.h | 1 + vcl/aqua/source/app/salinst.cxx | 16 ++++++++++++ vcl/inc/vcl/salinst.hxx | 2 ++ vcl/os2/inc/salinst.h | 1 + vcl/os2/source/app/salinst.cxx | 12 ++++----- vcl/source/app/dbggui.cxx | 57 ++++++++++++++++++++--------------------- vcl/unx/headless/svpinst.cxx | 13 ++++++++++ vcl/unx/headless/svpinst.hxx | 1 + vcl/unx/inc/salinst.h | 1 + vcl/unx/source/app/salinst.cxx | 18 +++++++++++++ vcl/win/inc/salinst.h | 2 ++ vcl/win/source/app/salinst.cxx | 12 ++++----- 12 files changed, 93 insertions(+), 43 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index 0bceb99d1d0e..2d42925fc2fd 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -134,6 +134,7 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); virtual SalMenu* CreateMenu( BOOL bMenuBar ); diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index cce018ac6229..2e71b557bd2a 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -567,6 +567,22 @@ void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- +bool AquaSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + bool AquaSalInstance::isNSAppThread() const { return vos::OThread::getCurrentIdentifier() == maMainThread; diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 9b92bf95e3fe..026e6264a27c 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -133,6 +133,8 @@ public: virtual vos::IMutex* GetYieldMutex() = 0; virtual ULONG ReleaseYieldMutex() = 0; virtual void AcquireYieldMutex( ULONG nCount ) = 0; + // return true, if yield mutex is owned by this thread, else false + virtual bool CheckYieldMutex() = 0; // wait next event and dispatch // must returned by UserEvent (SalFrame::PostEvent) diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h index 0948f605c286..536712d37836 100644 --- a/vcl/os2/inc/salinst.h +++ b/vcl/os2/inc/salinst.h @@ -85,6 +85,7 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); virtual void Yield( bool, bool ); virtual bool AnyInput( USHORT nType ); virtual SalMenu* CreateMenu( BOOL bMenuBar ); diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index b08a9769ccf4..df564f36ee0a 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -298,10 +298,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- -#ifdef DBG_UTIL - -void ImplDbgTestSolarMutex() +bool Os2SalInstance::CheckYieldMutex() { + bool bRet = true; SalData* pSalData = GetSalData(); ULONG nCurThreadId = GetCurrentThreadId(); if ( pSalData->mnAppThreadId != nCurThreadId ) @@ -311,7 +310,7 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" ); + bRet = false; } } } @@ -322,14 +321,13 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked in the main thread" ); + bRet = false; } } } + return bRet; } -#endif - // ======================================================================= void InitSalData() diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index dd9a5b4a15ee..b48db1d6ee97 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -37,32 +37,33 @@ #include #include -#include -#include +#include "vcl/svdata.hxx" +#include "svsys.h" #ifdef WNT #undef min #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include +#include "tools/debug.hxx" +#include "vcl/svdata.hxx" +#include "vcl/svapp.hxx" +#include "vcl/event.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/button.hxx" +#include "vcl/edit.hxx" +#include "vcl/fixed.hxx" +#include "vcl/group.hxx" +#include "vcl/field.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/sound.hxx" +#include "vcl/threadex.hxx" +#include "vcl/dbggui.hxx" +#include "com/sun/star/i18n/XCharacterClassification.hpp" + +#include "vcl/unohelp.hxx" +#include "vcl/unohelp2.hxx" +#include "vos/mutex.hxx" +#include "vcl/salinst.hxx" #include #include @@ -1963,9 +1964,11 @@ void DbgPrintWindow( const char* pLine ) // ======================================================================= -#ifdef WNT -void ImplDbgTestSolarMutex(); -#endif +void ImplDbgTestSolarMutex() +{ + bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex(); + OSL_ENSURE( bCheck, "SolarMutex not locked" ); +} // ======================================================================= @@ -1973,9 +1976,7 @@ void DbgGUIInit() { DbgSetPrintMsgBox( DbgPrintMsgBox ); DbgSetPrintWindow( DbgPrintWindow ); -#ifdef WNT DbgSetTestSolarMutex( ImplDbgTestSolarMutex ); -#endif } // ----------------------------------------------------------------------- @@ -1984,9 +1985,7 @@ void DbgGUIDeInit() { DbgSetPrintMsgBox( NULL ); DbgSetPrintWindow( NULL ); -#ifdef WNT DbgSetTestSolarMutex( NULL ); -#endif DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin; if ( pDbgWindow ) diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 5c3be54f9ddc..5f94a7ebf375 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -327,6 +327,19 @@ void SvpSalInstance::AcquireYieldMutex( ULONG nCount ) } } +bool SvpSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + if ( m_aYieldMutex.GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { // first, check for already queued events. diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index d931a2735ff9..bf323e6e0317 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -176,6 +176,7 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); // wait next event and dispatch // must returned by UserEvent (SalFrame::PostEvent) diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h index 8f4719f098f0..69e7c21fd923 100644 --- a/vcl/unx/inc/salinst.h +++ b/vcl/unx/inc/salinst.h @@ -102,6 +102,7 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 49a9cceb8617..88af0b70ef7e 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -259,6 +259,24 @@ void X11SalInstance::AcquireYieldMutex( ULONG nCount ) } } +// ----------------------------------------------------------------------- + +bool X11SalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != + vos::OThread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + void X11SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { GetX11SalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); } diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h index f3005e3ad30b..95aad02b3678 100644 --- a/vcl/win/inc/salinst.h +++ b/vcl/win/inc/salinst.h @@ -77,6 +77,8 @@ public: virtual vos::IMutex* GetYieldMutex(); virtual ULONG ReleaseYieldMutex(); virtual void AcquireYieldMutex( ULONG nCount ); + virtual bool CheckYieldMutex(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); virtual SalMenu* CreateMenu( BOOL bMenuBar ); diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 97dbb5285cca..419723ee6442 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -323,10 +323,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- -#ifdef DBG_UTIL - -void ImplDbgTestSolarMutex() +bool WinSalInstance::CheckYieldMutex() { + bool bRet = true; SalData* pSalData = GetSalData(); DWORD nCurThreadId = GetCurrentThreadId(); if ( pSalData->mnAppThreadId != nCurThreadId ) @@ -336,7 +335,7 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" ); + bRet = false; } } } @@ -347,14 +346,13 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked in the main thread" ); + bRet = false; } } } + return bRet; } -#endif - // ======================================================================= void SalData::initKeyCodeMap() -- cgit From 95433a2374cae162aa2856b7c52a76d44ebd4509 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 8 Oct 2010 17:33:55 +0200 Subject: vcl116: #i114993# fix assertion, native menu cleanup --- vcl/aqua/inc/salinst.h | 2 +- vcl/aqua/source/window/salmenu.cxx | 3 +- vcl/inc/vcl/salinst.hxx | 9 +-- vcl/os2/inc/salinst.h | 4 -- vcl/os2/source/window/makefile.mk | 2 +- vcl/os2/source/window/salmenu.cxx | 132 ------------------------------------- vcl/source/app/salvtables.cxx | 21 ++++++ vcl/source/window/menu.cxx | 2 +- vcl/unx/headless/svpinst.cxx | 18 ----- vcl/unx/headless/svpinst.hxx | 6 -- vcl/unx/inc/salinst.h | 4 -- vcl/unx/source/window/makefile.mk | 2 +- vcl/unx/source/window/salmenu.cxx | 132 ------------------------------------- vcl/win/inc/salinst.h | 2 +- vcl/win/source/window/salmenu.cxx | 2 +- 15 files changed, 34 insertions(+), 307 deletions(-) delete mode 100644 vcl/os2/source/window/salmenu.cxx delete mode 100644 vcl/unx/source/window/salmenu.cxx mode change 100644 => 100755 vcl/win/inc/salinst.h mode change 100644 => 100755 vcl/win/source/window/salmenu.cxx (limited to 'vcl') diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index 2d42925fc2fd..4b0385844eed 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -137,7 +137,7 @@ public: virtual bool CheckYieldMutex(); virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); + virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* pVCLMenu ); virtual void DestroyMenu( SalMenu* ); virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); virtual void DestroyMenuItem( SalMenuItem* ); diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index ed3086d8506f..139f875dcb55 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -203,11 +203,12 @@ static void initAppMenu() // ======================================================================= -SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar, Menu* pVCLMenu ) { initAppMenu(); AquaSalMenu *pAquaSalMenu = new AquaSalMenu( bMenuBar ); + pAquaSalMenu->mpVCLMenu = pVCLMenu; return pAquaSalMenu; } diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx index 026e6264a27c..71b820803473 100644 --- a/vcl/inc/vcl/salinst.hxx +++ b/vcl/inc/vcl/salinst.hxx @@ -60,6 +60,7 @@ struct SalItemParams; class SalSession; struct SystemGraphicsData; struct SystemWindowData; +class Menu; namespace vos { class IMutex; } @@ -143,10 +144,10 @@ public: virtual bool AnyInput( USHORT nType ) = 0; // Menues - virtual SalMenu* CreateMenu( BOOL bMenuBar ) = 0; - virtual void DestroyMenu( SalMenu* pMenu) = 0; - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ) = 0; - virtual void DestroyMenuItem( SalMenuItem* pItem ) = 0; + virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* pMenu ); + virtual void DestroyMenu( SalMenu* pMenu); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual void DestroyMenuItem( SalMenuItem* pItem ); // may return NULL to disable session management virtual SalSession* CreateSalSession() = 0; diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h index 536712d37836..7826a62e1f9b 100644 --- a/vcl/os2/inc/salinst.h +++ b/vcl/os2/inc/salinst.h @@ -88,10 +88,6 @@ public: virtual bool CheckYieldMutex(); virtual void Yield( bool, bool ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); - virtual void DestroyMenu( SalMenu* ); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); - virtual void DestroyMenuItem( SalMenuItem* ); virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); diff --git a/vcl/os2/source/window/makefile.mk b/vcl/os2/source/window/makefile.mk index f4a6ad0cb870..560d35880b21 100644 --- a/vcl/os2/source/window/makefile.mk +++ b/vcl/os2/source/window/makefile.mk @@ -40,7 +40,7 @@ CXXFILES__YD= salframe.cxx \ salobj.cxx SLOFILES= $(SLO)$/salframe.obj \ - $(SLO)$/salobj.obj $(SLO)$/salmenu.obj + $(SLO)$/salobj.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/os2/source/window/salmenu.cxx b/vcl/os2/source/window/salmenu.cxx deleted file mode 100644 index 339ab5dbfadb..000000000000 --- a/vcl/os2/source/window/salmenu.cxx +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_DOS -#define INCL_PM -#define INCL_WIN -#include -#include -#include -#include - - -// ======================================================================= - -// Os2SalInst factory methods - -SalMenu* Os2SalInstance::CreateMenu( BOOL bMenuBar ) -{ - return NULL; // no support for native menues -} - -void Os2SalInstance::DestroyMenu( SalMenu* pSalMenu ) -{ - delete pSalMenu; -} - - -SalMenuItem* Os2SalInstance::CreateMenuItem( const SalItemParams* pItemData ) -{ - return NULL; // no support for native menues -} - -void Os2SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem ) -{ - delete pSalMenuItem; -} - - -// ======================================================================= - - -/* - * Os2SalMenu - */ - - -Os2SalMenu::~Os2SalMenu() -{ -} - -BOOL Os2SalMenu::VisibleMenuBar() -{ - return FALSE; -} - -void Os2SalMenu::SetFrame( const SalFrame *pFrame ) -{ -} - -void Os2SalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) -{ -} - -void Os2SalMenu::RemoveItem( unsigned nPos ) -{ -} - -void Os2SalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) -{ -} - -void Os2SalMenu::CheckItem( unsigned nPos, BOOL bCheck ) -{ -} - -void Os2SalMenu::EnableItem( unsigned nPos, BOOL bEnable ) -{ -} - -void Os2SalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) -{ -} - -void Os2SalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ) -{ -} - -void Os2SalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) -{ -} - -void Os2SalMenu::GetSystemMenuData( SystemMenuData* pData ) -{ -} - -// ======================================================================= - -/* - * SalMenuItem - */ - - -Os2SalMenuItem::~Os2SalMenuItem() -{ -} - -// ------------------------------------------------------------------- - diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9a2404d36740..35f5599d5e55 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -74,6 +74,27 @@ void SalInstance::FillFontPathList( std::list< rtl::OString >& ) // do nothing } +SalMenu* SalInstance::CreateMenu( BOOL, Menu* ) +{ + // default: no native menus + return NULL; +} + +void SalInstance::DestroyMenu( SalMenu* pMenu ) +{ + OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" ); +} + +SalMenuItem* SalInstance::CreateMenuItem( const SalItemParams* ) +{ + return NULL; +} + +void SalInstance::DestroyMenuItem( SalMenuItem* pItem ) +{ + OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" ); +} + SalTimer::~SalTimer() { } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index e77eacb2fddf..bf0a9c45845d 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -980,7 +980,7 @@ void Menu::ImplInit() mpLayoutData = NULL; mpFirstDel = NULL; // Dtor notification list // Native-support: returns NULL if not supported - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar ); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar, this ); } Menu* Menu::ImplGetStartedFrom() const diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 5f94a7ebf375..fc788b2a0530 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -432,24 +432,6 @@ bool SvpSalInstance::AnyInput( USHORT nType ) return false; } -SalMenu* SvpSalInstance::CreateMenu( BOOL ) -{ - return NULL; -} - -void SvpSalInstance::DestroyMenu( SalMenu* ) -{ -} - -SalMenuItem* SvpSalInstance::CreateMenuItem( const SalItemParams* ) -{ - return NULL; -} - -void SvpSalInstance::DestroyMenuItem( SalMenuItem* ) -{ -} - SalSession* SvpSalInstance::CreateSalSession() { return NULL; diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index bf323e6e0317..02d5e3fa9494 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -184,12 +184,6 @@ public: virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - // Menues - virtual SalMenu* CreateMenu( BOOL bMenuBar ); - virtual void DestroyMenu( SalMenu* pMenu); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); - virtual void DestroyMenuItem( SalMenuItem* pItem ); - // may return NULL to disable session management virtual SalSession* CreateSalSession(); diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h index 69e7c21fd923..133f0bf6037f 100644 --- a/vcl/unx/inc/salinst.h +++ b/vcl/unx/inc/salinst.h @@ -106,10 +106,6 @@ public: virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); - virtual void DestroyMenu( SalMenu* pMenu); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); - virtual void DestroyMenuItem( SalMenuItem* pItem ); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); diff --git a/vcl/unx/source/window/makefile.mk b/vcl/unx/source/window/makefile.mk index 808b712903f3..c5cd95ba6b1c 100644 --- a/vcl/unx/source/window/makefile.mk +++ b/vcl/unx/source/window/makefile.mk @@ -48,7 +48,7 @@ dummy: .ELSE # "$(GUIBASE)"!="unx" SLOFILES= \ - $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj $(SLO)/salmenu.obj + $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj .ENDIF # "$(GUIBASE)"!="unx" diff --git a/vcl/unx/source/window/salmenu.cxx b/vcl/unx/source/window/salmenu.cxx deleted file mode 100644 index 0739b6cd5352..000000000000 --- a/vcl/unx/source/window/salmenu.cxx +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - - -#include -#include -#include - - -// ======================================================================= - -// X11SalInst factory methods - -SalMenu* X11SalInstance::CreateMenu( BOOL /*bMenuBar*/ ) -{ - return NULL; // no support for native menues -} - -void X11SalInstance::DestroyMenu( SalMenu* pSalMenu ) -{ - delete pSalMenu; -} - - -SalMenuItem* X11SalInstance::CreateMenuItem( const SalItemParams* ) -{ - return NULL; // no support for native menues -} - -void X11SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem ) -{ - delete pSalMenuItem; -} - - -// ======================================================================= - - -/* - * X11SalMenu - */ - - -X11SalMenu::~X11SalMenu() -{ -} - -BOOL X11SalMenu::VisibleMenuBar() -{ - return FALSE; -} - -void X11SalMenu::SetFrame( const SalFrame* ) -{ -} - -void X11SalMenu::InsertItem( SalMenuItem*, unsigned ) -{ -} - -void X11SalMenu::RemoveItem( unsigned ) -{ -} - -void X11SalMenu::SetSubMenu( SalMenuItem*, SalMenu*, unsigned ) -{ -} - -void X11SalMenu::CheckItem( unsigned, BOOL ) -{ -} - -void X11SalMenu::EnableItem( unsigned, BOOL ) -{ -} - -void X11SalMenu::SetItemImage( unsigned, SalMenuItem*, const Image& ) -{ -} - -void X11SalMenu::SetItemText( unsigned, SalMenuItem*, const XubString& ) -{ -} - -void X11SalMenu::SetAccelerator( unsigned, SalMenuItem*, const KeyCode&, const XubString& ) -{ -} - -void X11SalMenu::GetSystemMenuData( SystemMenuData* ) -{ -} - -// ======================================================================= - -/* - * SalMenuItem - */ - - -X11SalMenuItem::~X11SalMenuItem() -{ -} - -// ------------------------------------------------------------------- - diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h old mode 100644 new mode 100755 index 95aad02b3678..1ab59f8f7f9f --- a/vcl/win/inc/salinst.h +++ b/vcl/win/inc/salinst.h @@ -81,7 +81,7 @@ public: virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( USHORT nType ); - virtual SalMenu* CreateMenu( BOOL bMenuBar ); + virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* ); virtual void DestroyMenu( SalMenu* ); virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); virtual void DestroyMenuItem( SalMenuItem* ); diff --git a/vcl/win/source/window/salmenu.cxx b/vcl/win/source/window/salmenu.cxx old mode 100644 new mode 100755 index 1eb75969ea38..47da911b012e --- a/vcl/win/source/window/salmenu.cxx +++ b/vcl/win/source/window/salmenu.cxx @@ -59,7 +59,7 @@ BOOL SalData::IsKnownMenuHandle( HMENU hMenu ) // WinSalInst factory methods -SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar, Menu* ) { WinSalMenu *pSalMenu = new WinSalMenu(); -- cgit From 8774aa843b359e65869db27cdb3a65e057190b3b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 8 Oct 2010 15:28:29 +0200 Subject: vcl116: #i114958# callbacks should lock SolarMutex --- vcl/aqua/source/app/vclnsapp.mm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vcl') diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index f33599fa086e..ff2b4226bfa0 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -358,6 +358,8 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { + YIELD_GUARD; + SalData* pSalData = GetSalData(); #if 1 // currently do some really bad hack if( ! pSalData->maFrames.empty() ) @@ -421,6 +423,8 @@ -(void)systemColorsChanged: (NSNotification*) pNotification { + YIELD_GUARD; + const SalData* pSalData = GetSalData(); if( !pSalData->maFrames.empty() ) pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL ); @@ -428,6 +432,8 @@ -(void)screenParametersChanged: (NSNotification*) pNotification { + YIELD_GUARD; + SalData* pSalData = GetSalData(); std::list< AquaSalFrame* >::iterator it; for( it = pSalData->maFrames.begin(); it != pSalData->maFrames.end(); ++it ) -- cgit From 81001da846b0c6871a9dfaf0ced32a72eeebebbe Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 8 Oct 2010 15:47:05 +0200 Subject: vcl116: #i97830# limit maximum menu width --- vcl/source/window/menu.cxx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index bf0a9c45845d..446c541826a5 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2480,6 +2480,16 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( !bIsMenuBar ) { + // popup menus should not be wider than half the screen + // except on rather small screens + // TODO: move GetScreenNumber from SystemWindow to Window ? + // currently we rely on internal privileges + unsigned int nScreenNumber = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nScreenNumber; + Rectangle aDispRect( Application::GetScreenPosSizePixel( nScreenNumber ) ); + long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800; + if( nMaxWidth > nScreenWidth/2 ) + nMaxWidth = nScreenWidth/2; + USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text nCheckPos = (USHORT)nExtra; if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) @@ -2763,7 +2773,19 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pWin->GetSettings().GetStyleSettings().GetMenuColor(); pWin->SetBackground( Wallpaper( aBg ) ); } - pWin->DrawCtrlText( aTmpPos, pData->aText, 0, pData->aText.Len(), nStyle, pVector, pDisplayText ); + // how much space is there for the text ? + long nMaxItemTextWidth = aOutSz.Width() - aTmpPos.X() - nExtra - nOuterSpace; + if( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) + { + XubString aAccText = pData->aAccelKey.GetName(); + nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 4*nExtra; + } + if( !bIsMenuBar && pData->pSubMenu ) + { + nMaxItemTextWidth -= nFontHeight + nExtra; + } + String aItemText( pWin->GetEllipsisString( pData->aText, nMaxItemTextWidth ) ); + pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText ); if( bSetTmpBackground ) pWin->SetBackground(); } -- cgit From 00693d9b8e7486818437a79fb8d80261a9e4909d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 11 Oct 2010 14:33:33 +0200 Subject: vcl116: #i112525# do not prepend segment extension to html data for outgoing data --- vcl/aqua/source/dtrans/DataFlavorMapping.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index e0a95a532bf8..01f989cbc1c1 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -575,11 +575,19 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe if (isByteSequenceType(data.getValueType())) { + /* + the HTMLFormatDataProvider prepends segment information to HTML + this is useful for exchange with MS Word (which brings this stuff from Windows) + but annoying for other applications. Since this extension is not a standard datatype + on the Mac, let us not provide but provide normal HTML + if ([systemFlavor caseInsensitiveCompare: NSHTMLPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new HTMLFormatDataProvider(data)); } - else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) + else + */ + if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) { dp = DataProviderPtr_t(new BMPDataProvider(data, PICTImageFileType)); } -- cgit From 942b5b879aca633e1a90e139b48a73df987e6133 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 11 Oct 2010 16:19:35 +0200 Subject: vcl116: #i114405# add more n-Up options --- vcl/inc/vcl/print.hxx | 2 +- vcl/inc/vcl/svids.hrc | 6 ++++-- vcl/source/gdi/print3.cxx | 8 ++++++++ vcl/source/src/print.src | 8 +++++--- vcl/source/window/printdlg.cxx | 18 ++++++++++++++---- 5 files changed, 32 insertions(+), 10 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index be7633f13d53..8bfa9c8454e0 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -400,7 +400,7 @@ protected: PrinterController( const boost::shared_ptr& ); public: enum NupOrderType - { LRTB, TBLR }; + { LRTB, TBLR, TBRL, RLTB }; struct MultiPageSetup { // all metrics in 100th mm diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index 059ed1524b7c..bebd50e5dd5c 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -122,8 +122,10 @@ #define SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT 1 #define SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE 2 -#define SV_PRINT_PRT_NUP_ORDER_LRTD 0 -#define SV_PRINT_PRT_NUP_ORDER_TDLR 1 +#define SV_PRINT_PRT_NUP_ORDER_LRTB 0 +#define SV_PRINT_PRT_NUP_ORDER_TBLR 1 +#define SV_PRINT_PRT_NUP_ORDER_TBRL 2 +#define SV_PRINT_PRT_NUP_ORDER_RLTB 3 #define SV_PRINT_TAB_JOB 2 #define SV_PRINT_PRINTERS_FL 1 diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index d8581cc3fa7a..ab16d1b24c07 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1031,6 +1031,14 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte nCellX = (nSubPage / rMPS.nRows); nCellY = (nSubPage % rMPS.nRows); break; + case PrinterController::RLTB: + nCellX = rMPS.nColumns - 1 - (nSubPage % rMPS.nColumns); + nCellY = (nSubPage / rMPS.nColumns); + break; + case PrinterController::TBRL: + nCellX = rMPS.nColumns - 1 - (nSubPage / rMPS.nRows); + nCellY = (nSubPage % rMPS.nRows); + break; } // scale the metafile down to a sub page size double fScaleX = double(aSubPageSize.Width())/double(aPageSize.aSize.Width()); diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 010cae338e0e..1d1dffc04652 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -281,14 +281,16 @@ ModalDialog SV_DLG_PRINT ListBox SV_PRINT_PRT_NUP_ORDER_BOX { Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 10, 20 ); + Size = MAP_APPFONT( 10, 50 ); DropDown = TRUE; Border = TRUE; CurPos = 0; StringList [en-US] = { - < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >; - < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >; + < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTB; >; + < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TBLR; >; + < "top to bottom, then left"; SV_PRINT_PRT_NUP_ORDER_TBRL; >; + < "right to left, then down"; SV_PRINT_PRT_NUP_ORDER_RLTB; >; }; HelpText [en-US] = "Select order in which pages are to be printed."; }; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index a0be94674328..cbecfd0e3f55 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -364,12 +364,18 @@ void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect ) int nX = 0, nY = 0; switch( mnOrderMode ) { - case SV_PRINT_PRT_NUP_ORDER_LRTD: + case SV_PRINT_PRT_NUP_ORDER_LRTB: nX = (i % mnColumns); nY = (i / mnColumns); break; - case SV_PRINT_PRT_NUP_ORDER_TDLR: + case SV_PRINT_PRT_NUP_ORDER_TBLR: nX = (i / mnRows); nY = (i % mnRows); break; + case SV_PRINT_PRT_NUP_ORDER_RLTB: + nX = mnColumns - 1 - (i % mnColumns); nY = (i / mnColumns); + break; + case SV_PRINT_PRT_NUP_ORDER_TBRL: + nX = mnColumns - 1 - (i / mnRows); nY = (i % mnRows); + break; } Size aTextSize( GetTextWidth( aPageText ), nTextHeight ); int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2; @@ -2078,10 +2084,14 @@ void PrintDialog::updateNup() int nOrderMode = int(sal_IntPtr(maNUpPage.maNupOrderBox.GetEntryData( maNUpPage.maNupOrderBox.GetSelectEntryPos() ))); - if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTD ) + if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTB ) aMPS.nOrder = PrinterController::LRTB; - else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TDLR ) + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBLR ) aMPS.nOrder = PrinterController::TBLR; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_RLTB ) + aMPS.nOrder = PrinterController::RLTB; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBRL ) + aMPS.nOrder = PrinterController::TBRL; int nOrientationMode = int(sal_IntPtr(maNUpPage.maNupOrientationBox.GetEntryData( maNUpPage.maNupOrientationBox.GetSelectEntryPos() ))); -- cgit From 944cba365af8ed98e66289e87f2298a2bf8f139c Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 11 Oct 2010 16:41:16 +0200 Subject: vcl116: #i101255# remove autocompletion cycling with tab --- vcl/source/control/edit.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vcl') diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a692cbea0260..5091a4722845 100755 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1801,6 +1801,9 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) } break; + /* #i101255# disable autocomplete tab forward/backward + users expect tab/shif-tab to move the focus to other controls + not suddenly to cycle the autocompletion case KEY_TAB: { if ( !mbReadOnly && maAutocompleteHdl.IsSet() && @@ -1822,6 +1825,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) } } break; + */ default: { -- cgit From 98087850c7505fe334ca23bd7c6cc7ac070552c4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 11 Oct 2010 17:45:01 +0200 Subject: vcl116: #i114958# callbacks should lock SolarMutex --- vcl/aqua/source/window/salmenu.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vcl') diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index 139f875dcb55..82102f2e7095 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -79,10 +79,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL; -(void)showPreferences: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_PREFERENCES]; } -(void)showAbout: (id) sender { + YIELD_GUARD; + [self showDialog: SHOWDIALOG_ID_ABOUT]; } @end -- cgit From 1f383597bff1ba5527745d1f60f1462bd0b172f1 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Oct 2010 15:15:54 +0200 Subject: vcl116: improve MatrixArranger --- vcl/inc/vcl/arrange.hxx | 7 ++++- vcl/source/window/arrange.cxx | 69 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 6 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx index 83568609f87b..f98197231be9 100644 --- a/vcl/inc/vcl/arrange.hxx +++ b/vcl/inc/vcl/arrange.hxx @@ -385,7 +385,12 @@ namespace vcl sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY ) { return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); } - Size getOptimalSize( WindowSizeType, std::vector& o_rColumnWidths, std::vector& o_rRowHeights ) const; + static void distributeExtraSize( std::vector& io_rSizes, const std::vector& i_rPrios, long i_nExtraWidth ); + + Size getOptimalSize( WindowSizeType, + std::vector& o_rColumnWidths, std::vector& o_rRowHeights, + std::vector& o_rColumnPrio, std::vector& o_rRowPrio + ) const; protected: virtual Element* getElement( size_t i_nIndex ) { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; } diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx index dad48235f8fb..9749299d4d6b 100644 --- a/vcl/source/window/arrange.cxx +++ b/vcl/source/window/arrange.cxx @@ -728,7 +728,10 @@ MatrixArranger::~MatrixArranger() { } -Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector& o_rColumnWidths, std::vector& o_rRowHeights ) const +Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, + std::vector& o_rColumnWidths, std::vector& o_rRowHeights, + std::vector& o_rColumnPrio, std::vector& o_rRowPrio + ) const { Size aMatrixSize( 2*m_nOuterBorder, 2*m_nOuterBorder ); @@ -746,6 +749,8 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector& // now allocate row and column depth vectors o_rColumnWidths = std::vector< long >( nColumns, 0 ); o_rRowHeights = std::vector< long >( nRows, 0 ); + o_rColumnPrio = std::vector< sal_Int32 >( nColumns, 0 ); + o_rRowPrio = std::vector< sal_Int32 >( nRows, 0 ); // get sizes an allocate them into rows/columns for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin(); @@ -756,6 +761,10 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector& o_rColumnWidths[ it->m_nX ] = aSize.Width(); if( aSize.Height() > o_rRowHeights[ it->m_nY ] ) o_rRowHeights[ it->m_nY ] = aSize.Height(); + if( it->m_nExpandPriority > o_rColumnPrio[ it->m_nX ] ) + o_rColumnPrio[ it->m_nX ] = it->m_nExpandPriority; + if( it->m_nExpandPriority > o_rRowPrio[ it->m_nY ] ) + o_rRowPrio[ it->m_nY ] = it->m_nExpandPriority; } // add up sizes @@ -775,9 +784,48 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector& Size MatrixArranger::getOptimalSize( WindowSizeType i_eType ) const { std::vector aColumnWidths, aRowHeights; - return getOptimalSize( i_eType, aColumnWidths, aRowHeights ); + std::vector aColumnPrio, aRowPrio; + return getOptimalSize( i_eType, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ); } +void MatrixArranger::distributeExtraSize( std::vector& io_rSizes, const std::vector& i_rPrios, long i_nExtraWidth ) +{ + if( ! io_rSizes.empty() && io_rSizes.size() == i_rPrios.size() ) // sanity check + { + // find all elements with the highest expand priority + size_t nElements = io_rSizes.size(); + std::vector< size_t > aIndices; + sal_Int32 nHighPrio = 0; + for( size_t i = 0; i < nElements; i++ ) + { + sal_Int32 nCurPrio = i_rPrios[ i ]; + if( nCurPrio > nHighPrio ) + { + aIndices.clear(); + nHighPrio = nCurPrio; + } + if( nCurPrio == nHighPrio ) + aIndices.push_back( i ); + } + + // distribute extra space evenly among collected elements + nElements = aIndices.size(); + if( nElements > 0 ) + { + long nDelta = i_nExtraWidth / nElements; + for( size_t i = 0; i < nElements; i++ ) + { + io_rSizes[ aIndices[i] ] += nDelta; + i_nExtraWidth -= nDelta; + } + // add the last pixels to the last row element + if( i_nExtraWidth > 0 && nElements > 0 ) + io_rSizes[aIndices.back()] += i_nExtraWidth; + } + } +} + + void MatrixArranger::resize() { // assure that we have at least one row and column @@ -786,19 +834,30 @@ void MatrixArranger::resize() // check if we can get optimal size, else fallback to minimal size std::vector aColumnWidths, aRowHeights; - Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights ) ); + std::vector aColumnPrio, aRowPrio; + Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ) ); if( aOptSize.Height() > m_aManagedArea.GetHeight() || aOptSize.Width() > m_aManagedArea.GetWidth() ) { std::vector aMinColumnWidths, aMinRowHeights; - getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights ); + getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights, aColumnPrio, aRowPrio ); if( aOptSize.Height() > m_aManagedArea.GetHeight() ) aRowHeights = aMinRowHeights; if( aOptSize.Width() > m_aManagedArea.GetWidth() ) aColumnWidths = aMinColumnWidths; } - // FIXME: distribute extra space available + // distribute extra space available + long nExtraSize = m_aManagedArea.GetWidth(); + for( size_t i = 0; i < aColumnWidths.size(); ++i ) + nExtraSize -= aColumnWidths[i] + m_nBorderX; + if( nExtraSize > 0 ) + distributeExtraSize( aColumnWidths, aColumnPrio, nExtraSize ); + nExtraSize = m_aManagedArea.GetHeight(); + for( size_t i = 0; i < aRowHeights.size(); ++i ) + nExtraSize -= aRowHeights[i] + m_nBorderY; + if( nExtraSize > 0 ) + distributeExtraSize( aRowHeights, aRowPrio, nExtraSize ); // prepare offsets std::vector aColumnX( aColumnWidths.size() ); -- cgit From cf5c2817b084f506e33ec4b9294300d6d686aae6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Oct 2010 17:01:05 +0200 Subject: vcl116: #i107331# allow vertical FixedLine with text, allow centered text in FixedLine --- vcl/source/control/fixed.cxx | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 37406293d7cf..f73cf008a5e5 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -27,13 +27,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include -#include -#include -#include -#include +#include "vcl/decoview.hxx" +#include "vcl/event.hxx" +#include "vcl/fixed.hxx" +#include "vcl/controldata.hxx" +#include "vcl/window.h" -#include +#include "tools/rc.h" // ======================================================================= @@ -501,7 +501,7 @@ void FixedLine::ImplDraw( bool bLayout ) String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DecorationView aDecoView( this ); - if ( !aText.Len() || (nWinStyle & WB_VERT) ) + if ( !aText.Len() ) { if( !pVector ) { @@ -520,11 +520,34 @@ void FixedLine::ImplDraw( bool bLayout ) } } } + else if( (nWinStyle & WB_VERT) ) + { + long nWidth = GetTextWidth( aText ); + Push( PUSH_FONT ); + Font aFont( GetFont() ); + aFont.SetOrientation( 900 ); + SetFont( aFont ); + Point aStartPt( aOutSize.Width()/2, aOutSize.Height()-1 ); + if( (nWinStyle & WB_VCENTER) ) + aStartPt.Y() -= (aOutSize.Height() - nWidth)/2; + Point aTextPt( aStartPt ); + aTextPt.X() -= GetTextHeight()/2; + DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText ); + Pop(); + if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ), + Point( aStartPt.X(), aStartPt.Y() + FIXEDLINE_TEXT_BORDER ) ); + if( aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER > 0 ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER ), + Point( aStartPt.X(), 0 ) ); + } else { USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + if( (nWinStyle & WB_CENTER) ) + nStyle |= TEXT_DRAW_CENTER; if ( !IsEnabled() ) nStyle |= TEXT_DRAW_DISABLE; @@ -539,6 +562,8 @@ void FixedLine::ImplDraw( bool bLayout ) { long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2); aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false ); + if( aRect.Left() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ), false ); } } } -- cgit From bc7459fcc84df81d72786da9dca64a10eaecfe7b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Oct 2010 17:02:42 +0200 Subject: vcl116: #i107331# show papersize in print preview --- vcl/inc/vcl/prndlg.hxx | 2 ++ vcl/source/window/printdlg.cxx | 58 +++++++++++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 12 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index fdaf06c9854e..d53354c40b4a 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -59,6 +59,8 @@ namespace vcl VirtualDevice maPageVDev; rtl::OUString maReplacementString; rtl::OUString maToolTipString; + FixedLine maHorzDim; + FixedLine maVertDim; bool useHCColorReplacement() const; public: diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index cbecfd0e3f55..9505204a943f 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -69,6 +69,8 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re , maOrigSize( 10, 10 ) , maPageVDev( *this ) , maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) ) + , maHorzDim( this, WB_HORZ | WB_CENTER ) + , maVertDim( this, WB_VERT | WB_VCENTER ) { SetPaintTransparent( TRUE ); SetBackground(); @@ -76,6 +78,11 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); else maPageVDev.SetBackground( Color( COL_WHITE ) ); + maHorzDim.Show(); + maVertDim.Show(); + + maHorzDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) ); + maVertDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) ); } PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() @@ -162,9 +169,10 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC void PrintDialog::PrintPreviewWindow::Resize() { Size aNewSize( GetSizePixel() ); + long nTextHeight = maHorzDim.GetTextHeight(); // leave small space for decoration - aNewSize.Width() -= 2; - aNewSize.Height() -= 2; + aNewSize.Width() -= nTextHeight + 2; + aNewSize.Height() -= nTextHeight + 2; Size aScaledSize; double fScale = 1.0; @@ -206,16 +214,28 @@ void PrintDialog::PrintPreviewWindow::Resize() } maPageVDev.SetOutputSizePixel( aScaledSize, FALSE ); + + // position dimension lines + Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2, + nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 ); + maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ), + Size( maPreviewSize.Width(), nTextHeight ) ); + maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ), + Size( nTextHeight, maPreviewSize.Height() ) ); + } void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { + long nTextHeight = maHorzDim.GetTextHeight(); Size aSize( GetSizePixel() ); + aSize.Width() -= nTextHeight; + aSize.Height() -= nTextHeight; if( maReplacementString.getLength() != 0 ) { // replacement is active Push(); - Rectangle aTextRect( Point( 0, 0 ), aSize ); + Rectangle aTextRect( Point( nTextHeight, nTextHeight ), aSize ); DecorationView aVw( this ); aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP ); aTextRect.Left() += 2; @@ -233,8 +253,8 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { GDIMetaFile aMtf( maMtf ); - Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2, - (aSize.Height() - maPreviewSize.Height()) / 2 ); + Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2 + nTextHeight, + (aSize.Height() - maPreviewSize.Height()) / 2 + nTextHeight ); Size aVDevSize( maPageVDev.GetOutputSizePixel() ); const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); @@ -294,13 +314,6 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi { rtl::OUStringBuffer aBuf( 256 ); aBuf.append( maToolTipString ); - #if OSL_DEBUG_LEVEL > 0 - aBuf.appendAscii( "\n---\nPageSize: " ); - aBuf.append( sal_Int32( i_rOrigSize.Width()/100) ); - aBuf.appendAscii( "mm x " ); - aBuf.append( sal_Int32( i_rOrigSize.Height()/100) ); - aBuf.appendAscii( "mm" ); - #endif SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; if( useHCColorReplacement() ) @@ -312,6 +325,27 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi maReplacementString = i_rReplacement; maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY ); maPageVDev.EnableOutput( TRUE ); + + // use correct measurements + const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() ); + MapUnit eUnit = MAP_MM; + int nDigits = 0; + if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) + { + eUnit = MAP_100TH_INCH; + nDigits = 2; + } + Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MAP_100TH_MM ), MapMode( eUnit ) ) ); + String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); + aBuf.append( aNumText ); + aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + maHorzDim.SetText( aBuf.makeStringAndClear() ); + + aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); + aBuf.append( aNumText ); + aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" ); + maVertDim.SetText( aBuf.makeStringAndClear() ); + Resize(); Invalidate(); } -- cgit From b3a56e9917faf102332e03f520458533ef8abdab Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Oct 2010 17:52:43 +0200 Subject: vcl116: #i115035# use correct bounding box for action (thanks aw!) --- vcl/source/gdi/print2.cxx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index d560b0b6e7cc..7e422521cbbb 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -404,9 +404,22 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_LINE_ACTION: + { + const MetaLineAction& rMetaLineAction = static_cast(rAct); + aActionBounds = Rectangle( rMetaLineAction.GetStartPoint(), rMetaLineAction.GetEndPoint() ); + const long nLineWidth(rMetaLineAction.GetLineInfo().GetWidth()); + if(nLineWidth) + { + const long nHalfLineWidth((nLineWidth + 1) / 2); + aActionBounds.Left() -= nHalfLineWidth; + aActionBounds.Top() -= nHalfLineWidth; + aActionBounds.Right() += nHalfLineWidth; + aActionBounds.Bottom() += nHalfLineWidth; + } aActionBounds = Rectangle( static_cast(rAct).GetStartPoint(), static_cast(rAct).GetEndPoint() ); break; + } case META_RECT_ACTION: aActionBounds = static_cast(rAct).GetRect(); @@ -446,8 +459,20 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic break; case META_POLYLINE_ACTION: - aActionBounds = static_cast(rAct).GetPolygon().GetBoundRect(); + { + const MetaPolyLineAction& rMetaPolyLineAction = static_cast(rAct); + aActionBounds = rMetaPolyLineAction.GetPolygon().GetBoundRect(); + const long nLineWidth(rMetaPolyLineAction.GetLineInfo().GetWidth()); + if(nLineWidth) + { + const long nHalfLineWidth((nLineWidth + 1) / 2); + aActionBounds.Left() -= nHalfLineWidth; + aActionBounds.Top() -= nHalfLineWidth; + aActionBounds.Right() += nHalfLineWidth; + aActionBounds.Bottom() += nHalfLineWidth; + } break; + } case META_POLYGON_ACTION: aActionBounds = static_cast(rAct).GetPolygon().GetBoundRect(); -- cgit From e380dd2f96f67875ee54481a3a08a4253563f78b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Oct 2010 18:16:53 +0200 Subject: vcl116: #i115035# fix a snafu (thanks dr !) --- vcl/source/gdi/print2.cxx | 2 -- 1 file changed, 2 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 7e422521cbbb..25ba80003fd7 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -416,8 +416,6 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic aActionBounds.Right() += nHalfLineWidth; aActionBounds.Bottom() += nHalfLineWidth; } - aActionBounds = Rectangle( static_cast(rAct).GetStartPoint(), - static_cast(rAct).GetEndPoint() ); break; } -- cgit From f1adee81a62c6f29216b614ed7701c6bd3c1ad87 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Oct 2010 18:17:55 +0200 Subject: vcl116: fix a warning --- vcl/source/app/salvtables.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 35f5599d5e55..2a04389d8f44 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -82,6 +82,7 @@ SalMenu* SalInstance::CreateMenu( BOOL, Menu* ) void SalInstance::DestroyMenu( SalMenu* pMenu ) { + (void)pMenu; OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" ); } @@ -92,6 +93,7 @@ SalMenuItem* SalInstance::CreateMenuItem( const SalItemParams* ) void SalInstance::DestroyMenuItem( SalMenuItem* pItem ) { + (void)pItem; OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" ); } -- cgit From 805ad9aa72f6514323da49939f6f6f3e48b87f43 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 13 Oct 2010 14:05:18 +0200 Subject: vcl116: #i114476# implement maximize/minimize states in SetWindowSate --- vcl/aqua/source/window/salframe.cxx | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index ce4370c57b9f..4530778c5775 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -578,12 +578,27 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) VCLToCocoa( aStateRect ); aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask]; - // relase and acquire mutex again since this call can block waiting for an internal lock + [mpWindow setFrame: aStateRect display: NO]; + if( pState->mnState == SAL_FRAMESTATE_MINIMIZED ) + [mpWindow miniaturize: NSApp]; + else if( [mpWindow isMiniaturized] ) + [mpWindow deminiaturize: NSApp]; + + + /* ZOOMED is not really maximized (actually it toggles between a user set size and + the program specified one), but comes closest since the default behavior is + "maximized" if the user did not intervene + */ + if( pState->mnState == SAL_FRAMESTATE_MAXIMIZED ) { - [mpWindow setFrame: aStateRect display: NO]; + if(! [mpWindow isZoomed]) + [mpWindow zoom: NSApp]; + } + else + { + if( [mpWindow isZoomed] ) + [mpWindow zoom: NSApp]; } - - // FIXME: HTH maximized state ? // get new geometry UpdateFrameGeometry(); @@ -641,8 +656,6 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) pState->mnWidth = long(aStateRect.size.width); pState->mnHeight = long(aStateRect.size.height); - // FIXME: HTH maximized state ? - if( [mpWindow isMiniaturized] ) pState->mnState = SAL_FRAMESTATE_MINIMIZED; else if( ! [mpWindow isZoomed] ) -- cgit From 2ea636f801f173f6f23f5da918fedb370e796294 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 13 Oct 2010 17:05:37 +0200 Subject: vcl116: #157567# print an error message on a completly broken system --- vcl/inc/vcl/svids.hrc | 3 +- vcl/source/gdi/outdev3.cxx | 109 ++++++++++++++++++++++++--------------------- vcl/source/src/stdtext.src | 5 +++ 3 files changed, 64 insertions(+), 53 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index bebd50e5dd5c..e915644aa8ec 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -214,7 +214,8 @@ #define SV_ACCESSERROR_JAVA_NOT_CONFIGURED 10507 #define SV_ACCESSERROR_JAVA_DISABLED 10508 #define SV_ACCESSERROR_TURNAROUND_MSG 10509 -#define SV_ACCESSERROR_LAST SV_ACCESSERROR_TURNAROUND_MSG +#define SV_ACCESSERROR_NO_FONTS 10510 +#define SV_ACCESSERROR_LAST SV_ACCESSERROR_NO_FONTS #define SV_SHORTCUT_HELP 10600 #define SV_SHORTCUT_CONTEXTHELP 10601 diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 34d86b842ba2..c712c94bc5c6 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -27,62 +27,55 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include -#include -#ifndef _SV_SVSYS_HXX -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _OSL_FILE_H -#include -#endif +#include "i18npool/mslangid.hxx" + +#include "svsys.h" +#include "vcl/salgdi.hxx" +#include "vcl/sallayout.hxx" +#include "rtl/tencinfo.h" +#include "tools/debug.hxx" +#include "vcl/svdata.hxx" +#include "vcl/metric.hxx" +#include "vcl/impfont.hxx" +#include "vcl/metaact.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/outdata.hxx" +#include "vcl/outfont.hxx" +#include "basegfx/polygon/b2dpolygon.hxx" +#include "basegfx/polygon/b2dpolypolygon.hxx" +#include "basegfx/matrix/b2dhommatrix.hxx" +#include "tools/poly.hxx" +#include "vcl/outdev.h" +#include "vcl/virdev.hxx" +#include "vcl/print.hxx" +#include "vcl/event.hxx" +#include "vcl/window.h" +#include "vcl/window.hxx" +#include "vcl/svapp.hxx" +#include "vcl/bmpacc.hxx" +#include "unotools/fontcvt.hxx" +#include "vcl/outdev.hxx" +#include "vcl/edit.hxx" +#include "unotools/fontcfg.hxx" +#include "vcl/sysdata.hxx" +#include "vcl/textlayout.hxx" +#include "vcl/svids.hrc" +#include "osl/file.h" #ifdef ENABLE_GRAPHITE -#include -#endif -#ifdef USE_BUILTIN_RASTERIZER -#include +#include "vcl/graphite_features.hxx" #endif +#include "vcl/glyphcache.hxx" -#include -#include -#include -#include +#include "vcl/unohelp.hxx" +#include "pdfwriter_impl.hxx" +#include "vcl/controllayout.hxx" +#include "rtl/logfile.hxx" -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HDL_ -#include -#endif -#include -#include -#include +#include "com/sun/star/beans/PropertyValues.hpp" +#include "com/sun/star/i18n/XBreakIterator.hpp" +#include "com/sun/star/i18n/WordType.hpp" +#include "com/sun/star/linguistic2/XLinguServiceManager.hpp" #if defined UNX #define GLYPH_FONT_HEIGHT 128 @@ -92,7 +85,7 @@ #define GLYPH_FONT_HEIGHT 256 #endif -#include +#include "sal/alloca.h" #include #include @@ -2927,6 +2920,18 @@ void OutputDevice::ImplInitFontList() const mpGraphics->GetDevFontList( mpFontList ); } } + if( meOutDevType == OUTDEV_WINDOW && ! mpFontList->Count() ) + { + String aError( RTL_CONSTASCII_USTRINGPARAM( "Application error: no fonts and no vcl resource found on your system" ) ); + ResMgr* pMgr = ImplGetResMgr(); + if( pMgr ) + { + String aResStr( ResId( SV_ACCESSERROR_NO_FONTS, *pMgr ) ); + if( aResStr.Len() ) + aError = aResStr; + } + Application::Abort( aError ); + } } // ======================================================================= diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src index 2c6574220a5f..1b95f7bb1d72 100644 --- a/vcl/source/src/stdtext.src +++ b/vcl/source/src/stdtext.src @@ -101,6 +101,11 @@ String SV_ACCESSERROR_TURNAROUND_MSG Text [ en-US ] = "The Java Access Bridge could not be started."; }; +String SV_ACCESSERROR_NO_FONTS +{ + Text [ en-US ] = "No fonts could be found on the system."; +}; + String SV_STDTEXT_ABOUT { Text [ en-US ] = "About %PRODUCTNAME"; -- cgit From a19e8e4701bb6e27d60b192d9b8f180a5ac2f05f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 13 Oct 2010 19:18:14 +0200 Subject: vcl116: #i88218# cleanup, make field unit strings more robust --- vcl/inc/vcl/svdata.hxx | 35 +++++++----- vcl/source/app/svdata.cxx | 127 ++++++++++++++++++++++++++++++------------- vcl/source/control/field.cxx | 41 +++++++------- 3 files changed, 132 insertions(+), 71 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index fe69b0c0b4d4..c8a15605946e 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -28,20 +28,19 @@ #ifndef _SV_SVDATA_HXX #define _SV_SVDATA_HXX -#ifndef _VOS_THREAD_HXX -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "vos/thread.hxx" +#include "tools/string.hxx" +#include "tools/gen.hxx" +#include "tools/shl.hxx" +#include "tools/link.hxx" +#include "tools/fldunit.hxx" +#include "vcl/vclevent.hxx" +#include "vcl/sv.h" +#include "tools/color.hxx" +#include "tools/debug.hxx" +#include "vcl/dllapi.h" +#include "com/sun/star/uno/Reference.hxx" +#include "unotools/options.hxx" namespace com { namespace sun { @@ -248,6 +247,8 @@ struct ImplSVWinData // - ImplSVCtrlData - // ------------------ +typedef std::vector< std::pair< String, FieldUnit > > FieldUnitStringList; + struct ImplSVCtrlData { ImageList* mpCheckImgList; // ImageList for CheckBoxes @@ -271,6 +272,8 @@ struct ImplSVCtrlData ULONG mnLastRadioFColor; // Letzte FaceColor fuer RadioImage ULONG mnLastRadioWColor; // Letzte WindowColor fuer RadioImage ULONG mnLastRadioLColor; // Letzte LightColor fuer RadioImage + FieldUnitStringList* mpFieldUnitStrings; // list with field units + FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed }; @@ -394,6 +397,10 @@ inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); } bool ImplInitAccessBridge( BOOL bAllowCancel, BOOL &rCancelled ); +FieldUnitStringList* ImplGetFieldUnits(); +FieldUnitStringList* ImplGetCleanedFieldUnits(); + + // ----------------------------------------------------------------------- // ----------------- diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index f8b0d1d3379f..21241f3876d9 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -27,47 +27,49 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" + #include -#ifndef _SV_SVSYS_HXX -#include -#endif -#include -#include - -#ifndef _VOS_MUTEX_HXX -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for Button::GetStandardText -#include // for DockingManager -#include -#include -#include -#include -#include -#include -#include - -#include +#include "rtl/instance.hxx" +#include "osl/process.h" +#include "osl/file.hxx" + +#include "svsys.h" + +#include "tools/debug.hxx" +#include "tools/resary.hxx" + +#include "vcl/salinst.hxx" +#include "vcl/salframe.hxx" +#include "vcl/configsettings.hxx" +#include "vcl/svdata.hxx" +#include "vcl/window.h" +#include "vcl/svapp.hxx" +#include "vcl/wrkwin.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/unohelp.hxx" +#include "vcl/button.hxx" // for Button::GetStandardText +#include "vcl/dockwin.hxx" // for DockingManager +#include "vcl/salimestatus.hxx" +#include "vcl/salsys.hxx" +#include "vcl/svids.hrc" + +#include "unotools/fontcfg.hxx" + +#include "vos/mutex.hxx" + +#include "cppuhelper/implbase1.hxx" +#include "uno/current_context.hxx" + +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/awt/XExtendedToolkit.hpp" +#include "com/sun/star/java/JavaNotConfiguredException.hpp" +#include "com/sun/star/java/JavaVMCreationFailureException.hpp" +#include "com/sun/star/java/MissingJavaRuntimeException.hpp" +#include "com/sun/star/java/JavaDisabledException.hpp" #include -#include -#include -#include using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -163,6 +165,11 @@ void ImplDeInitSVData() delete pSVData->maAppData.mpMSFTempFileName; pSVData->maAppData.mpMSFTempFileName = NULL; } + + if( pSVData->maCtrlData.mpFieldUnitStrings ) + delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL; + if( pSVData->maCtrlData.mpCleanUnitStrings ) + delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL; } // ----------------------------------------------------------------------- @@ -240,6 +247,52 @@ ResId VclResId( sal_Int32 nId ) return ResId( nId, *pMgr ); } +FieldUnitStringList* ImplGetFieldUnits() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maCtrlData.mpFieldUnitStrings ) + { + ResMgr* pResMgr = ImplGetResMgr(); + if( pResMgr ) + { + ResStringArray aUnits( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + sal_uInt32 nUnits = aUnits.Count(); + pSVData->maCtrlData.mpFieldUnitStrings = new FieldUnitStringList(); + pSVData->maCtrlData.mpFieldUnitStrings->reserve( nUnits ); + for( sal_uInt32 i = 0; i < nUnits; i++ ) + { + std::pair< String, FieldUnit > aElement( aUnits.GetString(i), static_cast(aUnits.GetValue(i)) ); + pSVData->maCtrlData.mpFieldUnitStrings->push_back( aElement ); + } + } + } + return pSVData->maCtrlData.mpFieldUnitStrings; +} + +FieldUnitStringList* ImplGetCleanedFieldUnits() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maCtrlData.mpCleanUnitStrings ) + { + FieldUnitStringList* pUnits = ImplGetFieldUnits(); + if( pUnits ) + { + size_t nUnits = pUnits->size(); + pSVData->maCtrlData.mpCleanUnitStrings = new FieldUnitStringList(); + pSVData->maCtrlData.mpCleanUnitStrings->reserve( nUnits ); + for( size_t i = 0; i < nUnits; i++ ) + { + String aUnit( (*pUnits)[i].first ); + aUnit.EraseAllChars( sal_Unicode( ' ' ) ); + aUnit.ToLowerAscii(); + std::pair< String, FieldUnit > aElement( aUnit, (*pUnits)[i].second ); + pSVData->maCtrlData.mpCleanUnitStrings->push_back( aElement ); + } + } + } + return pSVData->maCtrlData.mpCleanUnitStrings; +} + DockingManager* ImplGetDockingManager() { ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 6c2b06783984..4c4e3c870429 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -52,8 +52,6 @@ using namespace ::com::sun::star; -static ResStringArray *strAllUnits = NULL; - // ----------------------------------------------------------------------- #define FORMAT_NUMERIC 1 @@ -1131,34 +1129,37 @@ static XubString ImplMetricGetUnitText( const XubString& rStr ) // #104355# support localized mesaurements -static String ImplMetricToString( FieldUnit rUnit ) +static const String& ImplMetricToString( FieldUnit rUnit ) { - if( !strAllUnits ) + FieldUnitStringList* pList = ImplGetFieldUnits(); + if( pList ) { - ResMgr* pResMgr = ImplGetResMgr(); - strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + // return unit's default string (ie, the first one ) + for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) + { + if ( it->second == rUnit ) + return it->first; + } } - // return unit's default string (ie, the first one ) - for( USHORT i=0; i < strAllUnits->Count(); i++ ) - if( (FieldUnit) strAllUnits->GetValue( i ) == rUnit ) - return strAllUnits->GetString( i ); - return String(); + return String::EmptyString(); } static FieldUnit ImplStringToMetric( const String &rMetricString ) { - if( !strAllUnits ) + FieldUnitStringList* pList = ImplGetCleanedFieldUnits(); + if( pList ) { - ResMgr* pResMgr = ImplGetResMgr(); - strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) ); + // return FieldUnit + String aStr( rMetricString ); + aStr.ToLowerAscii(); + aStr.EraseAllChars( sal_Unicode( ' ' ) ); + for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it ) + { + if ( it->first.Equals( aStr ) ) + return it->second; + } } - // return FieldUnit - String aStr( rMetricString ); - aStr.ToLowerAscii(); - for( USHORT i=0; i < strAllUnits->Count(); i++ ) - if ( strAllUnits->GetString( i ).Equals( aStr ) ) - return (FieldUnit) strAllUnits->GetValue( i ); return FUNIT_NONE; } -- cgit From 405f7ff73987a2f03b4eb89a6c8e433085311848 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 14 Oct 2010 14:07:00 +0200 Subject: vcl116: #i115053# save work in EndJob if there is no page in the job --- vcl/unx/source/printergfx/printerjob.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vcl') diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx index 5e18849b8dfe..1eeffb813175 100644 --- a/vcl/unx/source/printergfx/printerjob.cxx +++ b/vcl/unx/source/printergfx/printerjob.cxx @@ -495,6 +495,10 @@ PrinterJob::StartJob ( sal_Bool PrinterJob::EndJob () { + // no pages ? that really means no print job + if( maPageList.empty() ) + return sal_False; + // write document setup (done here because it // includes the accumulated fonts if( mpJobHeader ) -- cgit From 674bf4426ecedc72d5f2c5b804e07e7f1aaec714 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 14 Oct 2010 14:26:33 +0200 Subject: vcl116: #i115053# spelling --- vcl/unx/source/printer/printerinfomanager.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx index e1d499c40ca5..15d525fddd32 100644 --- a/vcl/unx/source/printer/printerinfomanager.cxx +++ b/vcl/unx/source/printer/printerinfomanager.cxx @@ -624,7 +624,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter static PrinterInfo aEmptyInfo; ::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter ); - DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistant printers" ); + DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistent printers" ); return it != m_aPrinters.end() ? it->second.m_aInfo : aEmptyInfo; } -- cgit From c3f2933f4f5cab7206826df037aa009a31c70bf3 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 14 Oct 2010 16:29:26 +0200 Subject: vcl116: #i112421# use gdk default monitor if available (thanks cmc!) --- vcl/unx/gtk/app/gtkdata.cxx | 23 ++++++++++++++++++++++- vcl/unx/inc/plugins/gtk/gtkdata.hxx | 4 ++++ vcl/unx/inc/saldisp.hxx | 3 ++- vcl/unx/source/app/saldisp.cxx | 5 +++-- vcl/unx/source/app/salsys.cxx | 2 +- 5 files changed, 32 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 322530b881cc..978163214d0c 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -217,11 +217,12 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { gint nMonitors = gdk_screen_get_n_monitors(pScreen); m_aXineramaScreens = std::vector(); + m_aXineramaScreenIndexMap = std::vector(nMonitors); for (gint i = 0; i < nMonitors; ++i) { GdkRectangle dest; gdk_screen_get_monitor_geometry(pScreen, i, &dest); - addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); + m_aXineramaScreenIndexMap[i] = addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); } m_bXinerama = m_aXineramaScreens.size() > 1; if( ! m_aFrames.empty() ) @@ -235,6 +236,26 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) } } +extern "C" +{ + typedef gint(* screen_get_primary_monitor)(GdkScreen *screen); +} + +int GtkSalDisplay::GetDefaultMonitorNumber() const +{ + int n = 0; + GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); +#if GTK_CHECK_VERSION(2,20,0) + n = m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)]; +#else + static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor = + (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); + if (sym_gdk_screen_get_primary_monitor) + n = sym_gdk_screen_get_primary_monitor( pScreen ); +#endif + return n; +} + void GtkSalDisplay::initScreen( int nScreen ) const { if( nScreen < 0 || nScreen >= static_cast(m_aScreens.size()) ) diff --git a/vcl/unx/inc/plugins/gtk/gtkdata.hxx b/vcl/unx/inc/plugins/gtk/gtkdata.hxx index d4dec957a6b3..b650cffbae8b 100644 --- a/vcl/unx/inc/plugins/gtk/gtkdata.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkdata.hxx @@ -59,6 +59,8 @@ class GtkSalDisplay : public SalDisplay GdkDisplay* m_pGdkDisplay; GdkCursor *m_aCursors[ POINTER_COUNT ]; bool m_bStartupCompleted; + std::vector< int > m_aXineramaScreenIndexMap; + GdkCursor* getFromXPM( const char *pBitmap, const char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ); public: @@ -73,6 +75,8 @@ public: virtual long Dispatch( XEvent *pEvent ); virtual void initScreen( int nScreen ) const; + virtual int GetDefaultMonitorNumber() const; + static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, GdkEvent* event, gpointer data ); diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 3734cbec6ef7..99c9bea699d6 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -405,7 +405,7 @@ protected: int processRandREvent( XEvent* ); void doDestruct(); - void addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); + int addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); public: static SalDisplay *GetSalDisplay( Display* display ); static BOOL BestVisual( Display *pDisp, @@ -475,6 +475,7 @@ public: XLIB_Window GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; } Display *GetDisplay() const { return pDisp_; } int GetDefaultScreenNumber() const { return m_nDefaultScreen; } + virtual int GetDefaultMonitorNumber() const { return 0; } const Size& GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; } srv_vendor_t GetServerVendor() const { return meServerVendor; } void SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); } diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index acf8c91ab5db..354c4d433d42 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2592,7 +2592,7 @@ void SalDisplay::PrintInfo() const sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) ); } -void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) +int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) { // see if any frame buffers are at the same coordinates // this can happen with weird configuration e.g. on @@ -2608,10 +2608,11 @@ void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, l { m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) ); } - return; + return (int)n; } } m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) ); + return (int)m_aXineramaScreens.size()-1; } void SalDisplay::InitXinerama() diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx index 1ccb214df4ed..84c9dba32e40 100644 --- a/vcl/unx/source/app/salsys.cxx +++ b/vcl/unx/source/app/salsys.cxx @@ -71,7 +71,7 @@ bool X11SalSystem::IsMultiDisplay() unsigned int X11SalSystem::GetDefaultDisplayNumber() { SalDisplay* pSalDisp = GetX11SalData()->GetDisplay(); - return pSalDisp->GetDefaultScreenNumber(); + return pSalDisp->IsXinerama() ? pSalDisp->GetDefaultMonitorNumber() : pSalDisp->GetDefaultScreenNumber(); } Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) -- cgit From 101233881d7d912f53614aac83b9c72f7e97e420 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 14 Oct 2010 17:41:02 +0200 Subject: vcl116: #i112421# use correct index (thanks cmc!) --- vcl/unx/gtk/app/gtkdata.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index 978163214d0c..f308822df147 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -251,7 +251,7 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor = (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" ); if (sym_gdk_screen_get_primary_monitor) - n = sym_gdk_screen_get_primary_monitor( pScreen ); + n = m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor( pScreen )]; #endif return n; } -- cgit From 941255437471ad9bdf266c5bd5e3c22b5ab65cfc Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 15 Oct 2010 14:41:43 +0200 Subject: vcl116: #i113839# twiddling again with the transparency values in DrawSelectionBackground --- vcl/source/window/window.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 vcl/source/window/window.cxx (limited to 'vcl') diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx old mode 100644 new mode 100755 index adedbde4c0f2..ee53b3f79aec --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9401,7 +9401,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, if( bDark ) aSelectionFillCol = COL_BLACK; else - nPercent = bRoundEdges ? 90 : 80; // just checked (light) + nPercent = 80; // just checked (light) } else { @@ -9416,7 +9416,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 50 : 20; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark ) } else if( bChecked || highlight == 1 ) { @@ -9429,7 +9429,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 70 : 35; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark ) } else { @@ -9445,7 +9445,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, nPercent = 0; } else - nPercent = bRoundEdges ? 80 : 70; // selected ( dark ) + nPercent = 70; // selected ( dark ) } } -- cgit From 60b0e5e5a338a896230a84f03f91cac58be8d4cb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 20 Oct 2010 14:04:39 +0200 Subject: #i90800# export GetMirroredChar via UNO service --- vcl/source/components/factory.cxx | 10 +++ vcl/source/components/makefile.mk | 7 +- vcl/source/components/stringmirror.cxx | 123 +++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 vcl/source/components/stringmirror.cxx (limited to 'vcl') diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index c4debea79001..7cfdecbfdb00 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -62,6 +62,10 @@ extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames( extern OUString SAL_CALL FontIdentificator_getImplementationName(); extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & ); +extern Sequence< OUString > SAL_CALL StringMirror_getSupportedServiceNames(); +extern OUString SAL_CALL StringMirror_getImplementationName(); +extern Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory > & ); + extern Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames(); extern OUString SAL_CALL Clipboard_getImplementationName(); extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & ); @@ -116,6 +120,12 @@ extern "C" { xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance, vcl::FontIdentificator_getSupportedServiceNames() ); } + else if( vcl::StringMirror_getImplementationName().equalsAscii( pImplementationName ) ) + { + xFactory = ::cppu::createSingleFactory( + xMgr, vcl::StringMirror_getImplementationName(), vcl::StringMirror_createInstance, + vcl::StringMirror_getSupportedServiceNames() ); + } else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) { xFactory = vcl::Clipboard_createFactory( xMgr ); diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk index e30975dbc099..982687104c01 100644 --- a/vcl/source/components/makefile.mk +++ b/vcl/source/components/makefile.mk @@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/display.obj \ - $(SLO)$/dtranscomp.obj \ - $(SLO)$/fontident.obj \ +SLOFILES= $(SLO)$/display.obj \ + $(SLO)$/dtranscomp.obj \ + $(SLO)$/fontident.obj \ + $(SLO)$/stringmirror.obj \ $(SLO)$/factory.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx new file mode 100644 index 000000000000..31839cdae320 --- /dev/null +++ b/vcl/source/components/stringmirror.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/util/XStringMapping.hpp" + +#include "cppuhelper/implbase2.hxx" +#include "rtl/ustrbuf.hxx" +#include "vcl/svapp.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; + +// ----------------------------------------------------------------------- + +namespace vcl +{ + +class StringMirror : public ::cppu::WeakAggImplHelper2< XStringMapping, XServiceInfo > +{ +public: + StringMirror() + {} + + virtual ~StringMirror() + {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const OUString& ) throw (RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + + // XStringMapping + virtual sal_Bool SAL_CALL mapStrings( Sequence< OUString >& io_rStrings ) throw (RuntimeException) + { + sal_Int32 nItems = io_rStrings.getLength(); + for( sal_Int32 i = 0; i < nItems; i++ ) + { + rtl::OUString& rStr( io_rStrings.getArray()[i] ); + + sal_Int32 nLen = rStr.getLength(); + rtl::OUStringBuffer aMirror( nLen ); + for(sal_Int32 i = nLen - 1; i >= 0; i--) + { + sal_Unicode cChar = rStr[ i ]; + aMirror.append(sal_Unicode(GetMirroredChar(cChar))); + } + rStr = aMirror.makeStringAndClear(); + } + return sal_True; + } +}; + +Sequence< OUString > StringMirror_getSupportedServiceNames() +{ + static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.StringMirror" ) ); + static Sequence< OUString > aServiceNames( &aServiceName, 1 ); + return aServiceNames; +} + +OUString StringMirror_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::StringMirror" ) ); +} + +Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory >& ) +{ + return static_cast< ::cppu::OWeakObject * >( new StringMirror ); +} + + +// XServiceInfo +OUString SAL_CALL StringMirror::getImplementationName() throw (RuntimeException) +{ + return StringMirror_getImplementationName(); +} + +sal_Bool SAL_CALL StringMirror::supportsService( const OUString& i_rServiceName ) throw (RuntimeException) +{ + Sequence< OUString > aSN( StringMirror_getSupportedServiceNames() ); + for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ ) + { + if( aSN[nService] == i_rServiceName ) + return sal_True; + } + return sal_False; +} + +Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (RuntimeException) +{ + return StringMirror_getSupportedServiceNames(); +} + +} // namespace vcl -- cgit From eb184102ce6608d30804b0665afc8b94deeef7d4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 20 Oct 2010 18:49:46 +0200 Subject: fix a warning --- vcl/source/components/stringmirror.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vcl') diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx index 31839cdae320..78806914a7c4 100644 --- a/vcl/source/components/stringmirror.cxx +++ b/vcl/source/components/stringmirror.cxx @@ -63,9 +63,9 @@ public: virtual sal_Bool SAL_CALL mapStrings( Sequence< OUString >& io_rStrings ) throw (RuntimeException) { sal_Int32 nItems = io_rStrings.getLength(); - for( sal_Int32 i = 0; i < nItems; i++ ) + for( sal_Int32 n = 0; n < nItems; n++ ) { - rtl::OUString& rStr( io_rStrings.getArray()[i] ); + rtl::OUString& rStr( io_rStrings.getArray()[n] ); sal_Int32 nLen = rStr.getLength(); rtl::OUStringBuffer aMirror( nLen ); -- cgit From 68c2ef528c118806f2306794de085ba05b81cfbb Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 22 Oct 2010 12:22:38 +0200 Subject: #i115131# ignore fonts worse than outline fonts --- vcl/unx/source/fontmanager/fontconfig.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vcl') diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index ecb4aa54549b..c5d35faaded8 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -468,6 +468,11 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) FcPatternDestroy( pTestPattern ); if( eFcResult != FcResultMatch ) continue; + // #i115131# double check results and eventually ignore them + FcBool bOutline = FcFalse; + FcResult eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline ); + if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) + continue; // insert best found pattern for the dupe-search pattern // TODO: skip inserting patterns that are already known in the target fontset FcPatternReference( pBetterPattern ); @@ -773,7 +778,10 @@ int PrintFontManager::countFontconfigFonts( std::hash_mapgetAtom( ATOM_FAMILYNAME, OStringToOUString( OString( (sal_Char*)family ), RTL_TEXTENCODING_UTF8 ), sal_True ); PrintFont* pUpdate = aFonts.front(); -- cgit From c1019a76eb0b2e83af8755fa623b42c925140c6d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 22 Oct 2010 14:25:53 +0200 Subject: ooo33gsl12: #i115107# do not call getNativeControlRegion during paint on gtk --- vcl/inc/vcl/svdata.hxx | 4 ++++ vcl/source/app/svdata.cxx | 1 - vcl/source/control/spinfld.cxx | 5 +++-- vcl/source/window/brdwin.cxx | 6 ++++-- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 3 +++ 5 files changed, 14 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index 5cc8f32d7ac9..9787b1f6e58c 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -318,6 +318,10 @@ struct ImplSVNWFData // window background before drawing the native // checkbox bool mbScrollbarJumpPage; // true for "jump to here" behavior + bool mbCanDrawWidgetAnySize; // set to true currently on gtk + // signals that widgets can be drawn in any size and + // brdwin.cxx ImplSmallBorderWindowView::DrawWindow + // should not do GetNativeControlRegion }; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index f8b0d1d3379f..f1065c07ca24 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -112,7 +112,6 @@ void ImplInitSVData() // init global instance data memset( pImplSVData, 0, sizeof( ImplSVData ) ); pImplSVData->maHelpData.mbAutoHelpId = sal_True; - pImplSVData->maHelpData.mbAutoHelpId = sal_True; pImplSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); // find out whether we are running in the testtool diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 754270e9012f..c51ac834f1b4 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -114,8 +114,9 @@ BOOL ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonVa Size aSize( pBorder->GetOutputSizePixel() ); // the size of the border window, i.e., the whole control Rectangle aBound, aContent; Rectangle aNatRgn( aPt, aSize ); - if( pBorder->GetNativeControlRegion(CTRL_SPINBOX, PART_ENTIRE_CONTROL, - aNatRgn, 0, rSpinbuttonValue, rtl::OUString(), aBound, aContent) ) + if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && + pBorder->GetNativeControlRegion( CTRL_SPINBOX, PART_ENTIRE_CONTROL, + aNatRgn, 0, rSpinbuttonValue, rtl::OUString(), aBound, aContent) ) { aSize = aContent.GetSize(); } diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index b221d1f7d928..2ff7d0a687e7 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1348,8 +1348,10 @@ void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, co Rectangle aBoundingRgn( aPoint, Size( mnWidth, mnHeight ) ); Rectangle aContentRgn( aCtrlRegion ); - if(pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, - nState, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn )) + if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && + pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, + nState, aControlValue, rtl::OUString(), + aBoundingRgn, aContentRgn )) { aCtrlRegion=aContentRgn; } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index ec92c20b54b5..58ab3771213f 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -411,6 +411,9 @@ void GtkData::initNWF( void ) // open first menu on F10 pSVData->maNWFData.mbOpenMenuOnF10 = true; + // omit GetNativeControl while painting (see brdwin.cxx) + pSVData->maNWFData.mbCanDrawWidgetAnySize = true; + int nScreens = GetX11SalData()->GetDisplay()->GetScreenCount(); gWidgetData = std::vector( nScreens ); for( int i = 0; i < nScreens; i++ ) -- cgit From a420a92b26cb536f6329d176f7349c63e7cfa4d8 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 25 Oct 2010 17:41:04 +0200 Subject: vcl116: #i96684# optionally do not switch workspaces of WM --- vcl/unx/inc/wmadaptor.hxx | 6 ++++- vcl/unx/source/app/wmadaptor.cxx | 58 ++++++++++++++++++++++++++++++---------- 2 files changed, 49 insertions(+), 15 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index cbedede2cc99..e8620db29c6f 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -165,6 +165,8 @@ protected: bool m_bLegacyPartialFullscreen; int m_nWinGravity; int m_nInitWinGravity; + bool m_bWMshouldSwitchWorkspace; + bool m_bWMshouldSwitchWorkspaceInit; WMAdaptor( SalDisplay * ) ; @@ -177,6 +179,7 @@ protected: */ virtual bool isValid() const; + bool getWMshouldSwitchWorkspace() const; public: virtual ~WMAdaptor(); @@ -214,8 +217,9 @@ public: /* * attemp to switch the desktop to a certain workarea + * if bConsiderWM is true, then on some WMs the call will not result in any action */ - void switchToWorkArea( int nWorkArea ) const; + void switchToWorkArea( int nWorkArea, bool bConsiderWM = true ) const; /* * sets window title diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index aa2e4c84ef24..f816c5d1426e 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -31,21 +31,22 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include "sal/alloca.h" +#include "wmadaptor.hxx" +#include "saldisp.hxx" +#include "saldata.hxx" +#include "salframe.h" +#include "vcl/salgdi.hxx" +#include "osl/thread.h" +#include "rtl/locale.h" +#include "osl/process.h" +#include "vcl/configsettings.hxx" + +#include "tools/prex.h" #include #include #include -#include +#include "tools/postx.h" #if OSL_DEBUG_LEVEL > 1 #include @@ -238,7 +239,9 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : m_bEnableAlwaysOnTopWorks( false ), m_bLegacyPartialFullscreen( false ), m_nWinGravity( StaticGravity ), - m_nInitWinGravity( StaticGravity ) + m_nInitWinGravity( StaticGravity ), + m_bWMshouldSwitchWorkspace( true ), + m_bWMshouldSwitchWorkspaceInit( false ) { Atom aRealType = None; int nFormat = 8; @@ -965,6 +968,30 @@ bool WMAdaptor::getNetWmName() return bNetWM; } +bool WMAdaptor::getWMshouldSwitchWorkspace() const +{ + if( ! m_bWMshouldSwitchWorkspaceInit ) + { + WMAdaptor * pWMA = const_cast(this); + + pWMA->m_bWMshouldSwitchWorkspace = true; + vcl::SettingsConfigItem* pItem = vcl::SettingsConfigItem::get(); + rtl::OUString aSetting( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WM" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShouldSwitchWorkspace" ) ) ) ); + if( aSetting.getLength() == 0 ) + { + if( m_aWMName.EqualsAscii( "awesome" ) ) + { + pWMA->m_bWMshouldSwitchWorkspace = false; + } + } + else + pWMA->m_bWMshouldSwitchWorkspace = aSetting.toBoolean(); + pWMA->m_bWMshouldSwitchWorkspaceInit = true; + } + return m_bWMshouldSwitchWorkspace; +} + /* * WMAdaptor::isValid() */ @@ -2338,8 +2365,11 @@ int WMAdaptor::getWindowWorkArea( XLIB_Window aWindow ) const * WMAdaptor::getCurrentWorkArea */ // fixme: multi screen case -void WMAdaptor::switchToWorkArea( int nWorkArea ) const +void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const { + if( bConsiderWM && ! getWMshouldSwitchWorkspace() ) + return; + if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] ) { XEvent aEvent; -- cgit From 42c20c4a7d4360a1e2664ea16113dcd19675495f Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 26 Oct 2010 10:50:27 +0200 Subject: #i115204# avoid problem on systems with older fontconfig libs --- vcl/unx/source/fontmanager/fontconfig.cxx | 41 +++++++++++++++++++------------ 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index c5d35faaded8..434263db352e 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -454,25 +454,33 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) for( int i = 0; i < pOrig->nfont; ++i ) { FcPattern* pOrigPattern = pOrig->fonts[i]; - // create a pattern to find eventually better alternatives - FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern ); - FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue ); - // TODO: use pattern->ImplFontAttr->pattern to filter out - // all attribute that are not interesting for finding dupes - FcPatternDel( pTestPattern, FC_FONTVERSION ); - FcPatternDel( pTestPattern, FC_CHARSET ); - FcPatternDel( pTestPattern, FC_FILE ); - // find the font face for the dupe-search pattern - FcResult eFcResult = FcResultMatch; - FcPattern* pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult ); - FcPatternDestroy( pTestPattern ); - if( eFcResult != FcResultMatch ) - continue; - // #i115131# double check results and eventually ignore them + // #i115131# ignore non-outline fonts FcBool bOutline = FcFalse; - FcResult eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline ); + FcResult eOutRes = FcPatternGetBool( pOrigPattern, FC_OUTLINE, 0, &bOutline ); if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) continue; + // create a pattern to find eventually better alternatives + FcPattern* pBetterPattern = pOrigPattern; + if( m_nFcVersion > 20400 ) // #i115204# avoid trouble with old FC versions + { + FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern ); + FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue ); + // TODO: ignore all attributes that are not interesting for finding dupes + // e.g. by using pattern->ImplFontAttr->pattern conversion + FcPatternDel( pTestPattern, FC_FONTVERSION ); + FcPatternDel( pTestPattern, FC_CHARSET ); + FcPatternDel( pTestPattern, FC_FILE ); + // find the font face for the dupe-search pattern + FcResult eFcResult = FcResultMatch; + pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult ); + FcPatternDestroy( pTestPattern ); + if( eFcResult != FcResultMatch ) + continue; + // #i115131# double check results and eventually ignore them + eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline ); + if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) + continue; + } // insert best found pattern for the dupe-search pattern // TODO: skip inserting patterns that are already known in the target fontset FcPatternReference( pBetterPattern ); @@ -1111,6 +1119,7 @@ bool PrintFontManager::getFontOptions( ImplFontOptions& rOptions) const { #ifndef ENABLE_FONTCONFIG + (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions; return false; #else // ENABLE_FONTCONFIG FontCfgWrapper& rWrapper = FontCfgWrapper::get(); -- cgit From 78b10685ef7c732c6b781bdef36754a2ebe8c485 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 26 Oct 2010 18:54:36 +0200 Subject: USE_BUILTIN_RASTERIZER needs to be taken into account on Windows after all --- vcl/source/gdi/outdev3.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index fcb5d2bf88d5..05b8022118ed 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -65,7 +65,9 @@ #ifdef ENABLE_GRAPHITE #include "vcl/graphite_features.hxx" #endif +#ifdef USE_BUILTIN_RASTERIZER #include "vcl/glyphcache.hxx" +#endif #include "vcl/unohelp.hxx" #include "pdfwriter_impl.hxx" -- cgit From edab85623d2fa18a5ba030c2eb2c6cc8260f162d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 28 Oct 2010 18:30:47 +0200 Subject: vcl116: #i97830# take accelerator sign (tilde) into account when checking for ellipsis string --- vcl/source/window/menu.cxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'vcl') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 446c541826a5..ceb9f12242c0 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2583,6 +2583,26 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec } } +static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_nMaxWidth ) +{ + xub_StrLen nPos = STRING_NOTFOUND; + String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) ); + aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth ); + // re-insert mnemonic + if( nPos != STRING_NOTFOUND ) + { + if( nPos < aNonMnem.Len() && i_rLong.GetChar(nPos+1) == aNonMnem.GetChar(nPos) ) + { + rtl::OUStringBuffer aBuf( i_rLong.Len() ); + aBuf.append( aNonMnem.GetBuffer(), nPos ); + aBuf.append( sal_Unicode('~') ); + aBuf.append( aNonMnem.GetBuffer()+nPos ); + aNonMnem = aBuf.makeStringAndClear(); + } + } + return aNonMnem; +} + void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pThisItemOnly, BOOL bHighlighted, bool bLayout ) const { // Fuer Symbole: nFontHeight x nFontHeight @@ -2778,13 +2798,13 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* if( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) { XubString aAccText = pData->aAccelKey.GetName(); - nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 4*nExtra; + nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 3*nExtra; } if( !bIsMenuBar && pData->pSubMenu ) { nMaxItemTextWidth -= nFontHeight + nExtra; } - String aItemText( pWin->GetEllipsisString( pData->aText, nMaxItemTextWidth ) ); + String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth ) ); pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText ); if( bSetTmpBackground ) pWin->SetBackground(); -- cgit From 62a759ce1ee86124eb62cdabf86e226aab470a0a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 29 Oct 2010 18:59:15 +0200 Subject: vcl116: #i97830# new ellipsis text style for menus --- vcl/inc/vcl/outdev.hxx | 5 ++++- vcl/source/gdi/outdev3.cxx | 15 ++++++++++++++- vcl/source/window/menu.cxx | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index f787df3692ce..12c4202af144 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -185,6 +185,9 @@ struct KerningPair #define TEXT_DRAW_MULTILINE ((USHORT)0x1000) #define TEXT_DRAW_WORDBREAK ((USHORT)0x2000) #define TEXT_DRAW_NEWSELLIPSIS ((USHORT)0x4000) +// in the long run we should make text style flags longer +// but at the moment we can get away with this 2 bit field for ellipsis style +#define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS) #define TEXT_DRAW_WORDBREAK_HYPHENATION (((USHORT)0x8000) | TEXT_DRAW_WORDBREAK) @@ -1114,7 +1117,7 @@ public: /** Added return value to see if EPS could be painted directly. Theoreticaly, handing over a matrix would be needed to handle - painting rotated EPS files (e.g. contained mín Metafiles). This + painting rotated EPS files (e.g. contained in Metafiles). This would then need to be supported for Mac and PS printers, but that's too much for now, wrote #i107046# for this */ bool DrawEPS( const Point& rPt, const Size& rSz, diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 05b8022118ed..f4ea98484c33 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6841,7 +6841,20 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c if ( nIndex != STRING_LEN ) { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS ) + { + String aTmpStr( aStr ); + xub_StrLen nEraseChars = 4; + while( nEraseChars < aStr.Len() && _rLayout.GetTextWidth( aTmpStr, 0, aTmpStr.Len() ) > nMaxWidth ) + { + aTmpStr = aStr; + xub_StrLen i = (aTmpStr.Len() - nEraseChars)/2; + aTmpStr.Erase( i, nEraseChars++ ); + aTmpStr.InsertAscii( "...", i ); + } + aStr = aTmpStr; + } + else if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) { aStr.Erase( nIndex ); if ( nIndex > 1 ) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ceb9f12242c0..76bfd63036a0 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2587,7 +2587,7 @@ static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_ { xub_StrLen nPos = STRING_NOTFOUND; String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) ); - aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth ); + aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS ); // re-insert mnemonic if( nPos != STRING_NOTFOUND ) { @@ -2802,7 +2802,7 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* } if( !bIsMenuBar && pData->pSubMenu ) { - nMaxItemTextWidth -= nFontHeight + nExtra; + nMaxItemTextWidth -= nFontHeight - nExtra; } String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth ) ); pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText ); -- cgit