diff options
Diffstat (limited to 'vcl/unx')
107 files changed, 2357 insertions, 5951 deletions
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index d748998df102..57380897c71e 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -572,7 +572,7 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) try { Menu* pMenu = pEvent->GetMenu(); - USHORT nPos = pEvent->GetItemPos(); + sal_uInt16 nPos = pEvent->GetItemPos(); if( pMenu && nPos != 0xFFFF) { diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index c265f79585e8..1b84026dd281 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -79,7 +79,7 @@ init_from_window( AtkObject *accessible, Window *pWindow ) */ case AccessibleRole::WINDOW: { - USHORT type = WINDOW_WINDOW; + sal_uInt16 type = WINDOW_WINDOW; bool parentIsMenuFloatingWindow = false; Window *pParent = pWindow->GetParent(); diff --git a/vcl/unx/gtk/a11y/makefile.mk b/vcl/unx/gtk/a11y/makefile.mk index 14d3014ddf11..30c6d5e7cfb3 100644 --- a/vcl/unx/gtk/a11y/makefile.mk +++ b/vcl/unx/gtk/a11y/makefile.mk @@ -31,10 +31,6 @@ PRJNAME=vcl TARGET=gtka11y ENABLE_EXCEPTIONS=TRUE -# workaround for makedepend hang -MKDEPENDSOLVER= -NO_DEFAULT_STL=YES - # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index da042c00bdfc..bd038cc55966 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -246,14 +246,15 @@ extern "C" int GtkSalDisplay::GetDefaultMonitorNumber() const { + int n = 0; GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen ); #if GTK_CHECK_VERSION(2,20,0) - return m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)]; + n = 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) - return m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor(pScreen)]; + n = sym_gdk_screen_get_primary_monitor( pScreen ); #if GTK_CHECK_VERSION(2,14,0) //gdk_screen_get_primary_monitor unavailable, take the first laptop monitor //as the default @@ -266,6 +267,9 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const #endif return 0; #endif + if( n >= 0 && size_t(n) < m_aXineramaScreenIndexMap.size() ) + n = m_aXineramaScreenIndexMap[n]; + return n; } void GtkSalDisplay::initScreen( int nScreen ) const @@ -539,7 +543,7 @@ public: YieldFunc handle ); virtual void Remove( int fd ); - virtual void StartTimer( ULONG nMS ); + virtual void StartTimer( sal_uLong nMS ); virtual void StopTimer(); virtual void Wakeup(); virtual void PostUserEvent(); @@ -739,7 +743,7 @@ gboolean GtkXLib::timeoutFn(gpointer data) return FALSE; } -void GtkXLib::StartTimer( ULONG nMS ) +void GtkXLib::StartTimer( sal_uLong nMS ) { m_nTimeoutMS = nMS; // for restarting diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index 159820ec3dbd..abaf97c2a00f 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -40,6 +40,8 @@ #include <rtl/strbuf.hxx> +#include <rtl/uri.hxx> + #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> #endif @@ -64,7 +66,7 @@ void GtkHookedYieldMutex::ThreadsEnter() acquire(); if( !aYieldStack.empty() ) { /* Previously called ThreadsLeave() */ - ULONG nCount = aYieldStack.front(); + sal_uLong nCount = aYieldStack.front(); aYieldStack.pop_front(); while( nCount-- > 1 ) acquire(); @@ -187,19 +189,19 @@ GtkInstance::~GtkInstance() DeInitAtkBridge(); } -SalFrame* GtkInstance::CreateFrame( SalFrame* pParent, ULONG nStyle ) +SalFrame* GtkInstance::CreateFrame( SalFrame* pParent, sal_uLong nStyle ) { return new GtkSalFrame( pParent, nStyle ); } -SalFrame* GtkInstance::CreateChildFrame( SystemParentData* pParentData, ULONG ) +SalFrame* GtkInstance::CreateChildFrame( SystemParentData* pParentData, sal_uLong ) { SalFrame* pFrame = new GtkSalFrame( pParentData ); return pFrame; } -SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow ) +SalObject* GtkInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow ) { // there is no method to set a visual for a GtkWidget // so we need the X11SalObject in that case @@ -217,9 +219,25 @@ extern "C" void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) { + rtl::OString sGtkURL; + rtl_TextEncoding aSystemEnc = osl_getThreadTextEncoding(); + if ((aSystemEnc == RTL_TEXTENCODING_UTF8) || (rFileUrl.compareToAscii( "file://", 7 ) != 0)) + sGtkURL = rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8); + else + { + //Non-utf8 locales are a bad idea if trying to work with non-ascii filenames + //Decode %XX components + rtl::OUString sDecodedUri = rtl::Uri::decode(rFileUrl.copy(7), rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8); + //Convert back to system locale encoding + rtl::OString sSystemUrl = rtl::OUStringToOString(sDecodedUri, aSystemEnc); + //Encode to an escaped ASCII-encoded URI + gchar *g_uri = g_filename_to_uri(sSystemUrl.getStr(), NULL, NULL); + sGtkURL = rtl::OString(g_uri); + g_free(g_uri); + } #if GTK_CHECK_VERSION(2,10,0) GtkRecentManager *manager = gtk_recent_manager_get_default (); - gtk_recent_manager_add_item (manager, rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8).getStr()); + gtk_recent_manager_add_item (manager, sGtkURL); (void)rMimeType; #else static getDefaultFnc sym_gtk_recent_manager_get_default = @@ -228,10 +246,7 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r static addItemFnc sym_gtk_recent_manager_add_item = (addItemFnc)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_recent_manager_add_item"); if (sym_gtk_recent_manager_get_default && sym_gtk_recent_manager_add_item) - { - sym_gtk_recent_manager_add_item(sym_gtk_recent_manager_get_default(), - rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8).getStr()); - } + sym_gtk_recent_manager_add_item(sym_gtk_recent_manager_get_default(), sGtkURL); else X11SalInstance::AddToRecentDocumentList(rFileUrl, rMimeType); #endif diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index bb3e878abe06..553ec6c85e0f 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -49,11 +49,11 @@ typedef struct _cairo_font_options cairo_font_options_t; // initialize statics -BOOL GtkSalGraphics::bThemeChanged = TRUE; -BOOL GtkSalGraphics::bNeedPixmapPaint = FALSE; -BOOL GtkSalGraphics::bGlobalNeedPixmapPaint = FALSE; -BOOL GtkSalGraphics::bToolbarGripWorkaround = FALSE; -BOOL GtkSalGraphics::bNeedButtonStyleAsEditBackgroundWorkaround = FALSE; +sal_Bool GtkSalGraphics::bThemeChanged = sal_True; +sal_Bool GtkSalGraphics::bNeedPixmapPaint = sal_False; +sal_Bool GtkSalGraphics::bGlobalNeedPixmapPaint = sal_False; +sal_Bool GtkSalGraphics::bToolbarGripWorkaround = sal_False; +sal_Bool GtkSalGraphics::bNeedButtonStyleAsEditBackgroundWorkaround = sal_False; GtkSalGraphics::~GtkSalGraphics() { @@ -271,7 +271,7 @@ public: { delete [] pData; m_idx = 0; m_size = n; pData = new NWPixmapCacheData[m_size]; } int GetSize() const { return m_size; } - BOOL Find( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap** pPixmap ); + sal_Bool Find( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap** pPixmap ); void Fill( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap* pPixmap ); void ThemeChanged(); @@ -324,7 +324,7 @@ void NWPixmapCache::ThemeChanged() pData[i].SetPixmap( NULL ); } -BOOL NWPixmapCache::Find( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap** pPixmap ) +sal_Bool NWPixmapCache::Find( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap** pPixmap ) { aState &= ~CTRL_CACHING_ALLOWED; // mask clipping flag int i; @@ -337,10 +337,10 @@ BOOL NWPixmapCache::Find( ControlType aType, ControlState aState, const Rectang pData[i].m_pixmap != NULL ) { *pPixmap = pData[i].m_pixmap; - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } void NWPixmapCache::Fill( ControlType aType, ControlState aState, const Rectangle& r_pixmapRect, GdkPixmap* pPixmap ) @@ -485,30 +485,13 @@ void GtkSalGraphics::ResetClipRegion() X11SalGraphics::ResetClipRegion(); } -void GtkSalGraphics::BeginSetClipRegion( ULONG nCount ) -{ - m_aClipRegion.SetNull(); - X11SalGraphics::BeginSetClipRegion( nCount ); -} - -BOOL GtkSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) ); - m_aClipRegion.Union( aRect ); - return X11SalGraphics::unionClipRegion( nX, nY, nWidth, nHeight ); -} - -bool GtkSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -void GtkSalGraphics::EndSetClipRegion() +bool GtkSalGraphics::setClipRegion( const Region& i_rClip ) { + m_aClipRegion = i_rClip; + bool bRet = X11SalGraphics::setClipRegion( m_aClipRegion ); if( m_aClipRegion.IsEmpty() ) m_aClipRegion.SetNull(); - X11SalGraphics::EndSetClipRegion(); + return bRet; } void GtkSalGraphics::copyBits( const SalTwoRect* pPosAry, @@ -539,10 +522,10 @@ void GtkSalGraphics::copyBits( const SalTwoRect* pPosAry, /* * IsNativeControlSupported() * - * Returns TRUE if the platform supports native + * Returns sal_True if the platform supports native * drawing of the control defined by nPart */ -BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { if ( ((nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL)) || @@ -613,25 +596,25 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP ) ) ) - return( TRUE ); - return( FALSE ); + return( sal_True ); + return( sal_False ); } /* * HitTestNativeControl() * - * bIsInside is set to TRUE if aPos is contained within the + * bIsInside is set to sal_True if aPos is contained within the * given part of the control, whose bounding region is * given by rControlRegion (in VCL frame coordinates). * * returns whether bIsInside was really set. */ -BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, +sal_Bool GtkSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, - BOOL& rIsInside ) + sal_Bool& rIsInside ) { if ( ( nType == CTRL_SCROLLBAR ) && ( ( nPart == PART_BUTTON_UP ) || @@ -654,7 +637,7 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, Rectangle aForward; Rectangle aBackward; - rIsInside = FALSE; + rIsInside = sal_False; ControlPart nCounterPart = 0; if ( nPart == PART_BUTTON_UP ) @@ -713,17 +696,17 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, if ( has_forward2 ) rIsInside |= aForward.IsInside( aPos ); } - return ( TRUE ); + return ( sal_True ); } if( IsNativeControlSupported(nType, nPart) ) { rIsInside = rControlRegion.IsInside( aPos ); - return( TRUE ); + return( sal_True ); } else { - return( FALSE ); + return( sal_False ); } } @@ -737,22 +720,16 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, * aValue: An optional value (tristate/numerical/string) * rCaption: A caption or title string (like button text etc) */ -BOOL GtkSalGraphics::drawNativeControl( ControlType nType, +sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ) { - if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) && - aValue.getTristateVal() == BUTTONVALUE_MIXED ) - { - return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption ); - } - - BOOL returnVal = FALSE; + sal_Bool returnVal = sal_False; // get a GC with current clipping region set - SelectFont(); + GetFontGC(); // theme changed ? @@ -762,7 +739,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, for( unsigned int i = 0; i < gWidgetData.size(); i++ ) if( gWidgetData[i].gNWPixmapCacheList ) gWidgetData[i].gNWPixmapCacheList->ThemeChanged(); - GtkSalGraphics::bThemeChanged = FALSE; + GtkSalGraphics::bThemeChanged = sal_False; } Rectangle aCtrlRect( rControlRegion ); @@ -789,7 +766,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, Size( aCtrlRect.GetWidth()+2, aCtrlRect.GetHeight()+2) ); pixmap = NWGetPixmapFromScreen( aPixmapRect ); if( ! pixmap ) - return FALSE; + return sal_False; gdkDrawable = GDK_DRAWABLE( pixmap ); aCtrlRect = Rectangle( Point(1,1), aCtrlRect.GetSize() ); aClip.push_back( aCtrlRect ); @@ -850,7 +827,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, else if ( (nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER) ) { if ( nType == CTRL_TAB_BODY ) - returnVal = TRUE; + returnVal = sal_True; else returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption); } @@ -907,61 +884,6 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, return( returnVal ); } -BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, - ControlPart nPart, - const Rectangle& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - const OUString& rCaption ) -{ - // need to emulate something for mixed state - - // do this via pixmap since some themes don't care for regions - bool bOldNeedPixmapPaint = bNeedPixmapPaint; - bNeedPixmapPaint = true; - - Rectangle aCtrlRect = rControlRegion; - BOOL returnVal = FALSE; - SelectFont(); - - // draw upper half in off state - const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_OFF ); - XLIB_Region aRegion = XCreateRegion(); - XRectangle aXRect = - { - static_cast<short>(aCtrlRect.Left()), - static_cast<short>(aCtrlRect.Top()), - static_cast<unsigned short>(aCtrlRect.GetWidth()), - static_cast<unsigned short>(aCtrlRect.GetHeight()) - }; - const unsigned short nH = aXRect.height/2; - aXRect.height -= nH; - XUnionRectWithRegion( &aXRect, aRegion, aRegion ); - SetClipRegion( pFontGC_, aRegion ); - XDestroyRegion( aRegion ); - - returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption ); - - if( returnVal ) - { - // draw lower half in on state - const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_ON ); - aXRect.y += nH; - aRegion = XCreateRegion(); - XUnionRectWithRegion( &aXRect, aRegion, aRegion ); - SetClipRegion( pFontGC_, aRegion ); - XDestroyRegion( aRegion ); - returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption ); - } - - // clean up - bNeedPixmapPaint = bOldNeedPixmapPaint; - const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_MIXED ); - SetClipRegion( pFontGC_ ); - return returnVal; -} - - /* * DrawNativeControlText() * @@ -972,22 +894,22 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, * aValue: An optional value (tristate/numerical/string) * rCaption: A caption or title string (like button text etc) */ -BOOL GtkSalGraphics::drawNativeControlText( ControlType, +sal_Bool GtkSalGraphics::drawNativeControlText( ControlType, ControlPart, const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) { - return( FALSE ); + return( sal_False ); } /* * GetNativeControlRegion() * - * If the return value is TRUE, rNativeBoundingRegion - * contains the TRUE bounding region covered by the control + * If the return value is sal_True, rNativeBoundingRegion + * contains the true bounding region covered by the control * including any adornment, while rNativeContentRegion contains the area * within the control that can be safely drawn into without drawing over * the borders of the control. @@ -996,7 +918,7 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType, * aValue: An optional value (tristate/numerical/string) * rCaption: A caption or title string (like button text etc) */ -BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, +sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, @@ -1005,7 +927,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { - BOOL returnVal = FALSE; + sal_Bool returnVal = sal_False; if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) && (rControlRegion.GetWidth() > 16) @@ -1015,7 +937,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, nState, aValue, rCaption ); rNativeContentRegion = rControlRegion; - returnVal = TRUE; + returnVal = sal_True; } if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { @@ -1023,7 +945,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; - returnVal = TRUE; + returnVal = sal_True; } if ( (nType==CTRL_SPINBOX) && ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { @@ -1032,7 +954,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; - returnVal = TRUE; + returnVal = sal_True; } if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { @@ -1040,7 +962,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; - returnVal = TRUE; + returnVal = sal_True; } if ( (nType==CTRL_TOOLBAR) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || @@ -1052,7 +974,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, { rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; - returnVal = TRUE; + returnVal = sal_True; } if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) || (nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ) ) @@ -1066,7 +988,6 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, if (!rNativeContentRegion.GetHeight()) rNativeContentRegion.Bottom() = rNativeContentRegion.Top() + 1; - returnVal = TRUE; } if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) ) { @@ -1078,7 +999,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, Size( aMenuBarRect.GetWidth(), aReq.height+1 ) ); rNativeBoundingRegion = aMenuBarRect; rNativeContentRegion = rNativeBoundingRegion; - returnVal = TRUE; + returnVal = sal_True; } if( (nType == CTRL_MENU_POPUP) ) { @@ -1098,7 +1019,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, (rControlRegion.GetHeight()-indicator_size)/2), Size( indicator_size, indicator_size ) ); rNativeContentRegion = aIndicatorRect; - returnVal = TRUE; + returnVal = sal_True; } } if( (nType == CTRL_RADIOBUTTON || nType == CTRL_CHECKBOX) ) @@ -1117,7 +1038,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, (rControlRegion.GetHeight()-indicator_size)/2), Size( indicator_size, indicator_size ) ); rNativeContentRegion = aIndicatorRect; - returnVal = TRUE; + returnVal = sal_True; } if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL ) { @@ -1131,7 +1052,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, Size( aEditRect.GetWidth(), nHeight ) ); rNativeBoundingRegion = aEditRect; rNativeContentRegion = rNativeBoundingRegion; - returnVal = TRUE; + returnVal = sal_True; } if( (nType == CTRL_SLIDER) && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) { @@ -1155,7 +1076,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, aRect.Right() = aRect.Left() + slider_width - 1; } rNativeBoundingRegion = rNativeContentRegion = aRect; - returnVal = TRUE; + returnVal = sal_True; } return( returnVal ); @@ -1165,7 +1086,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, /************************************************************************ * Individual control drawing functions ************************************************************************/ -BOOL GtkSalGraphics::NWPaintGTKButton( +sal_Bool GtkSalGraphics::NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType, ControlPart, const Rectangle& rControlRectangle, @@ -1178,7 +1099,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( gboolean interiorFocus; gint focusWidth; gint focusPad; - BOOL bDrawFocus = TRUE; + sal_Bool bDrawFocus = sal_True; gint x, y, w, h; GtkBorder aDefBorder; GtkBorder* pBorder; @@ -1209,7 +1130,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( // If the button is too small, don't ever draw focus or grab more space if ( (w < 16) || (h < 16) ) - bDrawFocus = FALSE; + bDrawFocus = sal_False; NWSetWidgetState( gWidgetData[m_nScreen].gBtnWidget, nState, stateType ); @@ -1256,7 +1177,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( } } - return( TRUE ); + return( sal_True ); } static Rectangle NWGetButtonArea( int nScreen, @@ -1268,7 +1189,7 @@ static Rectangle NWGetButtonArea( int nScreen, gint focusPad; GtkBorder aDefBorder; GtkBorder * pBorder; - BOOL bDrawFocus = TRUE; + sal_Bool bDrawFocus = sal_True; Rectangle aRect; gint x, y, w, h; @@ -1295,7 +1216,7 @@ static Rectangle NWGetButtonArea( int nScreen, // If the button is too small, don't ever draw focus or grab more space if ( (w < 16) || (h < 16) ) - bDrawFocus = FALSE; + bDrawFocus = sal_False; if ( (nState & CTRL_STATE_DEFAULT) && bDrawFocus ) { @@ -1312,7 +1233,7 @@ static Rectangle NWGetButtonArea( int nScreen, //------------------------------------- -BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, +sal_Bool GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType, ControlPart, const Rectangle& rControlRectangle, const clipList& rClipList, @@ -1322,7 +1243,7 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, { GtkStateType stateType; GtkShadowType shadowType; - BOOL isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON); + sal_Bool isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON); gint x, y; GdkRectangle clipRect; @@ -1350,7 +1271,7 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, // intermediate states between active/inactive. Let's hope that // GtkToggleButtone stays binary compatible. if (!isChecked) - GTK_TOGGLE_BUTTON(gWidgetData[m_nScreen].gRadioWidgetSibling)->active = TRUE; + GTK_TOGGLE_BUTTON(gWidgetData[m_nScreen].gRadioWidgetSibling)->active = sal_True; GTK_TOGGLE_BUTTON(gWidgetData[m_nScreen].gRadioWidget)->active = isChecked; for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it ) @@ -1365,12 +1286,12 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, x, y, indicator_size, indicator_size ); } - return( TRUE ); + return( sal_True ); } //------------------------------------- -BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, +sal_Bool GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType, ControlPart, const Rectangle& rControlRectangle, const clipList& rClipList, @@ -1380,7 +1301,8 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, { GtkStateType stateType; GtkShadowType shadowType; - BOOL isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON) ? TRUE : FALSE; + bool isChecked = (aValue.getTristateVal() == BUTTONVALUE_ON); + bool isInconsistent = (aValue.getTristateVal() == BUTTONVALUE_MIXED); GdkRectangle clipRect; gint x,y; @@ -1395,7 +1317,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, y = rControlRectangle.Top() + (rControlRectangle.GetHeight()-indicator_size)/2; // Set the shadow based on if checked or not so we get a checkmark. - shadowType = isChecked ? GTK_SHADOW_IN : GTK_SHADOW_OUT; + shadowType = isChecked ? GTK_SHADOW_IN : isInconsistent ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_OUT; NWSetWidgetState( gWidgetData[m_nScreen].gCheckWidget, nState, stateType ); GTK_TOGGLE_BUTTON(gWidgetData[m_nScreen].gCheckWidget)->active = isChecked; @@ -1411,7 +1333,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, x, y, indicator_size, indicator_size ); } - return( TRUE ); + return( sal_True ); } //------------------------------------- @@ -1427,7 +1349,7 @@ static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow ) ) ); } -BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, +sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList&, ControlState nState, @@ -1482,7 +1404,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, scrollbarRect = pixmapRect; if ( (scrollbarRect.GetWidth() <= 1) || (scrollbarRect.GetHeight() <= 1) ) - return( TRUE ); + return( sal_True ); // Grab some button style attributes gtk_widget_style_get( gWidgetData[m_nScreen].gScrollHorizWidget, @@ -1594,7 +1516,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, thumbRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 ); } - BOOL has_slider = ( thumbRect.GetWidth() > 0 && thumbRect.GetHeight() > 0 ); + sal_Bool has_slider = ( thumbRect.GetWidth() > 0 && thumbRect.GetHeight() > 0 ); scrollbarValues = gtk_range_get_adjustment( GTK_RANGE(scrollbarWidget) ); if ( scrollbarValues == NULL ) @@ -1619,7 +1541,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, // painting them directly to the window flickers pixmap = NWGetPixmapFromScreen( pixmapRect ); if( ! pixmap ) - return FALSE; + return sal_False; x = y = 0; w = pixmapRect.GetWidth(); @@ -1677,7 +1599,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, // ----------------- ARROW 1 NWCalcArrowRect( button11BoundRect, arrowRect ); gtk_paint_arrow( style, gdkDrawable, stateType, shadowType, - gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button1Type, TRUE, + gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button1Type, sal_True, x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), arrowRect.GetWidth(), arrowRect.GetHeight() ); } @@ -1692,7 +1614,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, // ----------------- ARROW 1 NWCalcArrowRect( button12BoundRect, arrowRect ); gtk_paint_arrow( style, gdkDrawable, stateType, shadowType, - gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button2Type, TRUE, + gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button2Type, sal_True, x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), arrowRect.GetWidth(), arrowRect.GetHeight() ); } @@ -1708,7 +1630,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, // ----------------- ARROW 2 NWCalcArrowRect( button21BoundRect, arrowRect ); gtk_paint_arrow( style, gdkDrawable, stateType, shadowType, - gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button1Type, TRUE, + gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button1Type, sal_True, x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), arrowRect.GetWidth(), arrowRect.GetHeight() ); } @@ -1723,7 +1645,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, // ----------------- ARROW 2 NWCalcArrowRect( button22BoundRect, arrowRect ); gtk_paint_arrow( style, gdkDrawable, stateType, shadowType, - gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button2Type, TRUE, + gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag, button2Type, sal_True, x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), arrowRect.GetWidth(), arrowRect.GetHeight() ); } @@ -1731,11 +1653,11 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, if( !NWRenderPixmapToScreen(pixmap, pixmapRect) ) { g_object_unref( pixmap ); - return( FALSE ); + return( sal_False ); } g_object_unref( pixmap ); - return( TRUE ); + return( sal_True ); } //--- @@ -1823,7 +1745,7 @@ static Rectangle NWGetScrollButtonRect( int nScreen, ControlPart nPart, Rectangl //------------------------------------- -BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, +sal_Bool GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, @@ -1848,7 +1770,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rCaption ); } - return( TRUE ); + return( sal_True ); } @@ -1957,7 +1879,7 @@ static void NWPaintOneEditBox( int nScreen, //------------------------------------- -BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, +sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList&, ControlState nState, @@ -2008,7 +1930,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, pixmap = NWGetPixmapFromScreen( pixmapRect ); if ( !pixmap ) - return( FALSE ); + return( sal_False ); upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); @@ -2044,11 +1966,11 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, if( !NWRenderPixmapToScreen(pixmap, pixmapRect) ) { g_object_unref( pixmap ); - return( FALSE ); + return( sal_False ); } g_object_unref( pixmap ); - return( TRUE ); + return( sal_True ); } //--- @@ -2131,7 +2053,7 @@ static void NWPaintOneSpinButton( int nScreen, arrowRect.setY( buttonRect.Top() + (buttonRect.GetHeight() - arrowRect.GetHeight()) / 2 - 1); gtk_paint_arrow( gWidgetData[nScreen].gSpinButtonWidget->style, pixmap, stateType, GTK_SHADOW_OUT, NULL, gWidgetData[nScreen].gSpinButtonWidget, - "spinbutton", (nPart == PART_BUTTON_UP) ? GTK_ARROW_UP : GTK_ARROW_DOWN, TRUE, + "spinbutton", (nPart == PART_BUTTON_UP) ? GTK_ARROW_UP : GTK_ARROW_DOWN, sal_True, (arrowRect.Left() - aAreaRect.Left()), (arrowRect.Top() - aAreaRect.Top()), arrowRect.GetWidth(), arrowRect.GetHeight() ); } @@ -2139,7 +2061,7 @@ static void NWPaintOneSpinButton( int nScreen, //------------------------------------- -BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, +sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, @@ -2207,12 +2129,12 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, buttonRect.GetWidth(), buttonRect.GetHeight() ); gtk_paint_arrow( gWidgetData[m_nScreen].gArrowWidget->style, gdkDrawable, stateType, shadowType, - &clipRect, gWidgetData[m_nScreen].gArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, + &clipRect, gWidgetData[m_nScreen].gArrowWidget, "arrow", GTK_ARROW_DOWN, sal_True, x+(arrowRect.Left() - pixmapRect.Left()), y+(arrowRect.Top() - pixmapRect.Top()), arrowRect.GetWidth(), arrowRect.GetHeight() ); } - return( TRUE ); + return( sal_True ); } //---- @@ -2272,7 +2194,7 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen, -BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, +sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, const Rectangle& rControlRectangle, const clipList&, ControlState nState, @@ -2403,14 +2325,14 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, else aCachePage.Fill( nType, nState, pixmapRect, pixmap ); - BOOL bSuccess = NWRenderPixmapToScreen(pixmap, pixmapRect); + sal_Bool bSuccess = NWRenderPixmapToScreen(pixmap, pixmapRect); g_object_unref( pixmap ); return bSuccess; } //------------------------------------- -BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, +sal_Bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, @@ -2501,10 +2423,10 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, } } - return( TRUE ); + return( sal_True ); } -BOOL GtkSalGraphics::NWPaintGTKToolbar( +sal_Bool GtkSalGraphics::NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType, ControlPart nPart, const Rectangle& rControlRectangle, @@ -2576,12 +2498,18 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar( { pButtonWidget = gWidgetData[m_nScreen].gToolbarToggleWidget; shadowType = GTK_SHADOW_IN; + stateType = GTK_STATE_ACTIVE; // special case stateType value for depressed toggle buttons // cf. gtk+/gtk/gtktogglebutton.c (gtk_toggle_button_update_state) - if( ! (nState & (CTRL_STATE_PRESSED|CTRL_STATE_ROLLOVER)) ) - stateType = GTK_STATE_ACTIVE; + if( (nState & (CTRL_STATE_ROLLOVER|CTRL_STATE_PRESSED)) ) + { + stateType = GTK_STATE_PRELIGHT; + shadowType = GTK_SHADOW_OUT; + } bPaintButton = true; } + else + stateType = GTK_STATE_PRELIGHT; // only for bPaintButton = true, in which case always rollver is meant NWSetWidgetState( pButtonWidget, nState, stateType ); gtk_widget_ensure_style( pButtonWidget ); @@ -2659,12 +2587,12 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar( } } - return( TRUE ); + return( sal_True ); } //---- -BOOL GtkSalGraphics::NWPaintGTKMenubar( +sal_Bool GtkSalGraphics::NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType, ControlPart nPart, const Rectangle& rControlRectangle, @@ -2747,10 +2675,10 @@ BOOL GtkSalGraphics::NWPaintGTKMenubar( } } - return( TRUE ); + return( sal_True ); } -BOOL GtkSalGraphics::NWPaintGTKPopupMenu( +sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType, ControlPart nPart, const Rectangle& rControlRectangle, @@ -2762,7 +2690,7 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu( // even crashes) in very old (Fedora Core 4 vintage) gtk's if (gtk_major_version <= 2 && gtk_minor_version <= 8 && nPart == PART_MENU_ITEM && ! (nState & CTRL_STATE_ENABLED) ) - return TRUE; + return sal_True; GtkStateType stateType; GtkShadowType shadowType; @@ -2878,10 +2806,10 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu( } } - return( TRUE ); + return( sal_True ); } -BOOL GtkSalGraphics::NWPaintGTKTooltip( +sal_Bool GtkSalGraphics::NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType, ControlPart, const Rectangle& rControlRectangle, @@ -2916,10 +2844,10 @@ BOOL GtkSalGraphics::NWPaintGTKTooltip( x, y, w, h ); } - return( TRUE ); + return( sal_True ); } -BOOL GtkSalGraphics::NWPaintGTKListNode( +sal_Bool GtkSalGraphics::NWPaintGTKListNode( GdkDrawable*, ControlType, ControlPart, const Rectangle& rControlRectangle, @@ -2955,7 +2883,7 @@ BOOL GtkSalGraphics::NWPaintGTKListNode( GdkPixmap* pixmap = NWGetPixmapFromScreen( aRect ); if( ! pixmap ) - return FALSE; + return sal_False; GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap ); gtk_paint_expander( gWidgetData[m_nScreen].gTreeView->style, @@ -2967,13 +2895,13 @@ BOOL GtkSalGraphics::NWPaintGTKListNode( w/2, h/2, eStyle ); - BOOL bRet = NWRenderPixmapToScreen( pixmap, aRect ); + sal_Bool bRet = NWRenderPixmapToScreen( pixmap, aRect ); g_object_unref( pixmap ); return bRet; } -BOOL GtkSalGraphics::NWPaintGTKProgress( +sal_Bool GtkSalGraphics::NWPaintGTKProgress( GdkDrawable*, ControlType, ControlPart, const Rectangle& rControlRectangle, @@ -2991,7 +2919,7 @@ BOOL GtkSalGraphics::NWPaintGTKProgress( GdkPixmap* pixmap = NWGetPixmapFromScreen( Rectangle( Point( 0, 0 ), Size( w, h ) ) ); if( ! pixmap ) - return FALSE; + return sal_False; GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap ); @@ -3031,13 +2959,13 @@ BOOL GtkSalGraphics::NWPaintGTKProgress( } } - BOOL bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle ); + sal_Bool bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle ); g_object_unref( pixmap ); return bRet; } -BOOL GtkSalGraphics::NWPaintGTKSlider( +sal_Bool GtkSalGraphics::NWPaintGTKSlider( GdkDrawable*, ControlType, ControlPart nPart, const Rectangle& rControlRectangle, @@ -3056,7 +2984,7 @@ BOOL GtkSalGraphics::NWPaintGTKSlider( GdkPixmap* pixmap = NWGetPixmapFromScreen( rControlRectangle ); if( ! pixmap ) - return FALSE; + return sal_False; GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap ); GtkWidget* pWidget = (nPart == PART_TRACK_HORZ_AREA) @@ -3121,7 +3049,7 @@ BOOL GtkSalGraphics::NWPaintGTKSlider( } - BOOL bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle ); + sal_Bool bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle ); g_object_unref( pixmap ); return bRet; @@ -3370,9 +3298,9 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) else { Color aColor2 = aStyleSet.GetLightColor(); - Color aCheck( (BYTE)(((USHORT)aBackColor.GetRed()+(USHORT)aColor2.GetRed())/2), - (BYTE)(((USHORT)aBackColor.GetGreen()+(USHORT)aColor2.GetGreen())/2), - (BYTE)(((USHORT)aBackColor.GetBlue()+(USHORT)aColor2.GetBlue())/2) + Color aCheck( (sal_uInt8)(((sal_uInt16)aBackColor.GetRed()+(sal_uInt16)aColor2.GetRed())/2), + (sal_uInt8)(((sal_uInt16)aBackColor.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), + (sal_uInt8)(((sal_uInt16)aBackColor.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) ); aStyleSet.SetCheckedColor( aCheck ); } @@ -3408,7 +3336,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetInactiveTabColor( aSelectedBackColor ); // menu disabled entries handling - aStyleSet.SetSkipDisabledInMenus( TRUE ); + aStyleSet.SetSkipDisabledInMenus( sal_True ); // menu colors GtkStyle* pMenuStyle = gtk_widget_get_style( gWidgetData[m_nScreen].gMenuWidget ); GtkStyle* pMenuItemStyle = gtk_rc_get_style( gWidgetData[m_nScreen].gMenuItemMenuWidget ); @@ -3694,17 +3622,18 @@ GdkPixmap* GtkSalGraphics::NWGetPixmapFromScreen( Rectangle srcRect ) * Copy an alpha pixmap to screen using a gc with clipping ************************************************************************/ -BOOL GtkSalGraphics::NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ) +sal_Bool GtkSalGraphics::NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ) { // The GC can't be null, otherwise we'd have no clip region - if( SelectFont() == NULL ) + GC aFontGC = GetFontGC(); + if( aFontGC == NULL ) { std::fprintf(stderr, "salnativewidgets.cxx: no valid GC\n" ); - return( FALSE ); + return( sal_False ); } if ( !pPixmap ) - return( FALSE ); + return( sal_False ); // Copy the background of the screen into a composite pixmap CopyScreenArea( GetXDisplay(), @@ -3712,10 +3641,10 @@ BOOL GtkSalGraphics::NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRe gdk_screen_get_number( gdk_drawable_get_screen( GDK_DRAWABLE(pPixmap) ) ), gdk_drawable_get_depth( GDK_DRAWABLE(pPixmap) ), GetDrawable(), m_nScreen, GetVisual().GetDepth(), - SelectFont(), + aFontGC, 0, 0, dstRect.GetWidth(), dstRect.GetHeight(), dstRect.Left(), dstRect.Top() ); - return( TRUE ); + return( sal_True ); } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 776e90d8daff..2ae761aaa1a4 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -85,9 +85,9 @@ using namespace com::sun::star; int GtkSalFrame::m_nFloats = 0; -static USHORT GetKeyModCode( guint state ) +static sal_uInt16 GetKeyModCode( guint state ) { - USHORT nCode = 0; + sal_uInt16 nCode = 0; if( (state & GDK_SHIFT_MASK) ) nCode |= KEY_SHIFT; if( (state & GDK_CONTROL_MASK) ) @@ -102,9 +102,9 @@ static USHORT GetKeyModCode( guint state ) return nCode; } -static USHORT GetMouseModCode( guint state ) +static sal_uInt16 GetMouseModCode( guint state ) { - USHORT nCode = GetKeyModCode( state ); + sal_uInt16 nCode = GetKeyModCode( state ); if( (state & GDK_BUTTON1_MASK) ) nCode |= MOUSE_LEFT; if( (state & GDK_BUTTON2_MASK) ) @@ -115,9 +115,9 @@ static USHORT GetMouseModCode( guint state ) return nCode; } -static USHORT GetKeyCode( guint keyval ) +static sal_uInt16 GetKeyCode( guint keyval ) { - USHORT nCode = 0; + sal_uInt16 nCode = 0; if( keyval >= GDK_0 && keyval <= GDK_9 ) nCode = KEY_0 + (keyval-GDK_0); else if( keyval >= GDK_KP_0 && keyval <= GDK_KP_9 ) @@ -302,14 +302,14 @@ static USHORT GetKeyCode( guint keyval ) // in the independent part. struct KeyAlternate { - USHORT nKeyCode; + sal_uInt16 nKeyCode; sal_Unicode nCharCode; KeyAlternate() : nKeyCode( 0 ), nCharCode( 0 ) {} - KeyAlternate( USHORT nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} + KeyAlternate( sal_uInt16 nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} }; inline KeyAlternate -GetAlternateKeyCode( const USHORT nKeyCode ) +GetAlternateKeyCode( const sal_uInt16 nKeyCode ) { KeyAlternate aAlternate; @@ -397,7 +397,7 @@ GtkSalFrame::GraphicsHolder::~GraphicsHolder() delete pGraphics; } -GtkSalFrame::GtkSalFrame( SalFrame* pParent, ULONG nStyle ) +GtkSalFrame::GtkSalFrame( SalFrame* pParent, sal_uLong nStyle ) { m_nScreen = getDisplay()->GetDefaultScreenNumber(); getDisplay()->registerFrame( this ); @@ -572,7 +572,7 @@ void GtkSalFrame::InitCommon() m_ePointerStyle = 0xffff; m_bSetFocusOnMap = false; - gtk_widget_set_app_paintable( m_pWindow, TRUE ); + gtk_widget_set_app_paintable( m_pWindow, sal_True ); gtk_widget_set_double_buffered( m_pWindow, FALSE ); gtk_widget_set_redraw_on_allocate( m_pWindow, FALSE ); gtk_widget_add_events( m_pWindow, @@ -759,7 +759,7 @@ GtkSalFrame *GtkSalFrame::getFromWindow( GtkWindow *pWindow ) return (GtkSalFrame *) g_object_get_data( G_OBJECT( pWindow ), "SalFrame" ); } -void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) +void GtkSalFrame::Init( SalFrame* pParent, sal_uLong nStyle ) { if( nStyle & SAL_FRAME_STYLE_DEFAULT ) // ensure default style { @@ -829,7 +829,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; - lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); + lcl_set_accept_focus( GTK_WINDOW(m_pWindow), sal_False, true ); bNoDecor = true; } else if( (nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) @@ -873,9 +873,9 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? sal_True : FALSE ); if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) ) - lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); + lcl_set_accept_focus( GTK_WINDOW(m_pWindow), sal_False, false ); } } @@ -1019,10 +1019,10 @@ void GtkSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) } } -BOOL GtkSalFrame::PostEvent( void* pData ) +sal_Bool GtkSalFrame::PostEvent( void* pData ) { getDisplay()->SendInternalEvent( this, pData ); - return TRUE; + return sal_True; } void GtkSalFrame::SetTitle( const String& rTitle ) @@ -1032,8 +1032,8 @@ void GtkSalFrame::SetTitle( const String& rTitle ) gtk_window_set_title( GTK_WINDOW(m_pWindow), rtl::OUStringToOString( rTitle, RTL_TEXTENCODING_UTF8 ).getStr() ); } -static inline BYTE * -getRow( BitmapBuffer *pBuffer, ULONG nRow ) +static inline sal_uInt8 * +getRow( BitmapBuffer *pBuffer, sal_uLong nRow ) { if( BMP_SCANLINE_ADJUSTMENT( pBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) return pBuffer->mpBits + nRow * pBuffer->mnScanlineSize; @@ -1047,11 +1047,11 @@ bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) g_return_val_if_fail( pSalBitmap != NULL, NULL ); g_return_val_if_fail( pSalAlpha != NULL, NULL ); - BitmapBuffer *pBitmap = pSalBitmap->AcquireBuffer( TRUE ); + BitmapBuffer *pBitmap = pSalBitmap->AcquireBuffer( sal_True ); g_return_val_if_fail( pBitmap != NULL, NULL ); g_return_val_if_fail( pBitmap->mnBitCount == 24, NULL ); - BitmapBuffer *pAlpha = pSalAlpha->AcquireBuffer( TRUE ); + BitmapBuffer *pAlpha = pSalAlpha->AcquireBuffer( sal_True ); g_return_val_if_fail( pAlpha != NULL, NULL ); g_return_val_if_fail( pAlpha->mnBitCount == 8, NULL ); @@ -1064,8 +1064,8 @@ bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) for( nY = 0; nY < pBitmap->mnHeight; nY++ ) { - BYTE *pData = getRow( pBitmap, nY ); - BYTE *pAlphaData = getRow( pAlpha, nY ); + sal_uInt8 *pData = getRow( pBitmap, nY ); + sal_uInt8 *pAlphaData = getRow( pAlpha, nY ); for( nX = 0; nX < pBitmap->mnWidth; nX++ ) { @@ -1086,18 +1086,18 @@ bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) } } - pSalBitmap->ReleaseBuffer( pBitmap, TRUE ); - pSalAlpha->ReleaseBuffer( pAlpha, TRUE ); + pSalBitmap->ReleaseBuffer( pBitmap, sal_True ); + pSalAlpha->ReleaseBuffer( pAlpha, sal_True ); return gdk_pixbuf_new_from_data( pPixbufData, - GDK_COLORSPACE_RGB, TRUE, 8, + GDK_COLORSPACE_RGB, sal_True, 8, aSize.Width(), aSize.Height(), aSize.Width() * 4, (GdkPixbufDestroyNotify) g_free, NULL ); } -void GtkSalFrame::SetIcon( USHORT nIcon ) +void GtkSalFrame::SetIcon( sal_uInt16 nIcon ) { if( (m_nStyle & (SAL_FRAME_STYLE_PLUG|SAL_FRAME_STYLE_SYSTEMCHILD|SAL_FRAME_STYLE_FLOAT|SAL_FRAME_STYLE_INTRO|SAL_FRAME_STYLE_OWNERDRAWDECORATION)) || ! m_pWindow ) @@ -1109,10 +1109,10 @@ void GtkSalFrame::SetIcon( USHORT nIcon ) GdkPixbuf *pBuf; GList *pIcons = NULL; - USHORT nOffsets[2] = { SV_ICON_SMALL_START, SV_ICON_LARGE_START }; - USHORT nIndex; + sal_uInt16 nOffsets[2] = { SV_ICON_SMALL_START, SV_ICON_LARGE_START }; + sal_uInt16 nIndex; - for( nIndex = 0; nIndex < sizeof(nOffsets)/ sizeof(USHORT); nIndex++ ) + for( nIndex = 0; nIndex < sizeof(nOffsets)/ sizeof(sal_uInt16); nIndex++ ) { // #i44723# workaround gcc temporary problem ResId aResId( nOffsets[nIndex] + nIcon, *ImplGetResMgr() ); @@ -1131,7 +1131,7 @@ void GtkSalFrame::SetIcon( USHORT nIcon ) { case TRANSPARENT_NONE: { - BYTE nTrans = 0; + sal_uInt8 nTrans = 0; aMask = AlphaMask( aBmp.GetSizePixel(), &nTrans ); } break; @@ -1271,7 +1271,7 @@ static void initClientId() } } -void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) +void GtkSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) { if( m_pWindow ) { @@ -1305,7 +1305,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) * showing the float (cannot grab it to the float * before show). */ - m_pParent->grabPointer( TRUE, TRUE ); + m_pParent->grabPointer( sal_True, sal_True ); } guint32 nUserTime = 0; @@ -1352,7 +1352,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) { m_nFloats++; if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 1 ) - grabPointer( TRUE, TRUE ); + grabPointer( sal_True, sal_True ); // #i44068# reset parent's IM context if( m_pParent ) m_pParent->EndExtTextInput(0); @@ -1366,7 +1366,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) { m_nFloats--; if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 0) - grabPointer( FALSE ); + grabPointer( sal_False ); } gtk_widget_hide( m_pWindow ); if( m_pIMHandler ) @@ -1379,7 +1379,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) } } -void GtkSalFrame::Enable( BOOL /*bEnable*/ ) +void GtkSalFrame::Enable( sal_Bool /*bEnable*/ ) { // Not implemented by X11SalFrame either } @@ -1430,6 +1430,12 @@ void GtkSalFrame::setMinMaxSize() aHints |= GDK_HINT_MAX_SIZE; } } + if( m_bFullscreen && m_aMaxSize.Width() && m_aMaxSize.Height() ) + { + aGeo.max_width = m_aMaxSize.Width(); + aGeo.max_height = m_aMaxSize.Height(); + aHints |= GDK_HINT_MAX_SIZE; + } if( aHints ) gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), NULL, @@ -1463,7 +1469,7 @@ void GtkSalFrame::SetMinClientSize( long nWidth, long nHeight ) } } -void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) { if( !m_pWindow || isChild( true, false ) ) return; @@ -1578,7 +1584,7 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState ) if( ! m_pWindow || ! pState || isChild( true, false ) ) return; - const ULONG nMaxGeometryMask = + const sal_uLong nMaxGeometryMask = SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y | SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT | SAL_FRAMESTATE_MASK_MAXIMIZED_X | SAL_FRAMESTATE_MASK_MAXIMIZED_Y | @@ -1606,7 +1612,7 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState ) else if( pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y | SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT ) ) { - USHORT nPosSizeFlags = 0; + sal_uInt16 nPosSizeFlags = 0; long nX = pState->mnX - (m_pParent ? m_pParent->maGeometry.nX : 0); long nY = pState->mnY - (m_pParent ? m_pParent->maGeometry.nY : 0); if( pState->mnMask & SAL_FRAMESTATE_MASK_X ) @@ -1645,7 +1651,7 @@ void GtkSalFrame::SetWindowState( const SalFrameState* pState ) } } -BOOL GtkSalFrame::GetWindowState( SalFrameState* pState ) +sal_Bool GtkSalFrame::GetWindowState( SalFrameState* pState ) { pState->mnState = SAL_FRAMESTATE_NORMAL; pState->mnMask = SAL_FRAMESTATE_MASK_STATE; @@ -1681,7 +1687,7 @@ BOOL GtkSalFrame::GetWindowState( SalFrameState* pState ) SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT; - return TRUE; + return sal_True; } void GtkSalFrame::moveToScreen( int nScreen ) @@ -1745,13 +1751,13 @@ void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen ) Rectangle aNewScreenRect( pDisp->GetXineramaScreens()[nNewScreen] ); bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); if( bVisible ) - Show( FALSE ); + Show( sal_False ); maGeometry.nX = aNewScreenRect.Left() + (maGeometry.nX - aOldScreenRect.Left()); maGeometry.nY = aNewScreenRect.Top() + (maGeometry.nY - aOldScreenRect.Top()); createNewWindow( None, false, m_nScreen ); gtk_window_move( GTK_WINDOW(m_pWindow), maGeometry.nX, maGeometry.nY ); if( bVisible ) - Show( TRUE ); + Show( sal_True ); maGeometry.nScreenNumber = nNewScreen; } else if( sal_Int32(nNewScreen) < pDisp->GetScreenCount() ) @@ -1797,7 +1803,7 @@ void GtkSalFrame::SetApplicationID( const rtl::OUString &rWMClass ) } } -void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) +void GtkSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) { if( m_pWindow && ! isChild() ) { @@ -1811,7 +1817,7 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) Size( maGeometry.nWidth, maGeometry.nHeight ) ); bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); if( bVisible ) - Show( FALSE ); + Show( sal_False ); m_nStyle |= SAL_FRAME_STYLE_PARTIAL_FULLSCREEN; createNewWindow( None, false, m_nScreen ); Rectangle aNewPosSize; @@ -1834,11 +1840,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) { if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), sal_True ); gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); } if( bVisible ) - Show( TRUE ); + Show( sal_True ); } else { @@ -1846,7 +1852,7 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); if( bVisible ) - Show( FALSE ); + Show( sal_False ); m_nStyle &= ~SAL_FRAME_STYLE_PARTIAL_FULLSCREEN; createNewWindow( None, false, m_nScreen ); if( ! m_aRestorePosSize.IsEmpty() ) @@ -1860,7 +1866,7 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) m_aRestorePosSize = Rectangle(); } if( bVisible ) - Show( TRUE ); + Show( sal_True ); } } else @@ -2029,7 +2035,7 @@ dbus_uninhibit_gsm (guint cookie) } #endif -void GtkSalFrame::StartPresentation( BOOL bStart ) +void GtkSalFrame::StartPresentation( sal_Bool bStart ) { Display *pDisplay = GDK_DISPLAY_XDISPLAY( getGdkDisplay() ); @@ -2066,11 +2072,11 @@ void GtkSalFrame::StartPresentation( BOOL bStart ) } } -void GtkSalFrame::SetAlwaysOnTop( BOOL /*bOnTop*/ ) +void GtkSalFrame::SetAlwaysOnTop( sal_Bool /*bOnTop*/ ) { } -void GtkSalFrame::ToTop( USHORT nFlags ) +void GtkSalFrame::ToTop( sal_uInt16 nFlags ) { if( m_pWindow ) { @@ -2120,13 +2126,13 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle ) // #i80791# use grabPointer the same way as CaptureMouse, respective float grab if( getDisplay()->MouseCaptured( this ) ) - grabPointer( TRUE, FALSE ); + grabPointer( sal_True, sal_False ); else if( m_nFloats > 0 ) - grabPointer( TRUE, TRUE ); + grabPointer( sal_True, sal_True ); } } -void GtkSalFrame::grabPointer( BOOL bGrab, BOOL bOwnerEvents ) +void GtkSalFrame::grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents ) { static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" ); @@ -2188,7 +2194,7 @@ void GtkSalFrame::grabPointer( BOOL bGrab, BOOL bOwnerEvents ) } } -void GtkSalFrame::CaptureMouse( BOOL bCapture ) +void GtkSalFrame::CaptureMouse( sal_Bool bCapture ) { getDisplay()->CaptureMouse( bCapture ? this : NULL ); } @@ -2233,12 +2239,12 @@ void GtkSalFrame::Sync() gdk_display_sync( getGdkDisplay() ); } -String GtkSalFrame::GetSymbolKeyName( const String&, USHORT nKeyCode ) +String GtkSalFrame::GetSymbolKeyName( const String&, sal_uInt16 nKeyCode ) { return getDisplay()->GetKeyName( nKeyCode ); } -String GtkSalFrame::GetKeyName( USHORT nKeyCode ) +String GtkSalFrame::GetKeyName( sal_uInt16 nKeyCode ) { return getDisplay()->GetKeyName( nKeyCode ); } @@ -2272,7 +2278,7 @@ SalFrame::SalIndicatorState GtkSalFrame::GetIndicatorState() return aState; } -void GtkSalFrame::SimulateKeyPress( USHORT nKeyCode ) +void GtkSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) { GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode); } @@ -2291,16 +2297,16 @@ void GtkSalFrame::SetInputContext( SalInputContext* pContext ) m_pIMHandler->setInputContext( pContext ); } -void GtkSalFrame::EndExtTextInput( USHORT nFlags ) +void GtkSalFrame::EndExtTextInput( sal_uInt16 nFlags ) { if( m_pIMHandler ) m_pIMHandler->endExtTextInput( nFlags ); } -BOOL GtkSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) +sal_Bool GtkSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) { // not supported yet - return FALSE; + return sal_False; } LanguageType GtkSalFrame::GetInputLanguage() @@ -2378,7 +2384,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc { bool bWasVisible = GTK_WIDGET_MAPPED(m_pWindow); if( bWasVisible ) - Show( FALSE ); + Show( sal_False ); if( nScreen < 0 || nScreen >= getDisplay()->GetScreenCount() ) nScreen = m_nScreen; @@ -2458,7 +2464,7 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc SetTitle( m_aTitle ); if( bWasVisible ) - Show( TRUE ); + Show( sal_True ); std::list< GtkSalFrame* > aChildren = m_aChildren; m_aChildren.clear(); @@ -2482,7 +2488,7 @@ void GtkSalFrame::ResetClipRegion() gdk_window_shape_combine_region( m_pWindow->window, NULL, 0, 0 ); } -void GtkSalFrame::BeginSetClipRegion( ULONG ) +void GtkSalFrame::BeginSetClipRegion( sal_uLong ) { if( m_pRegion ) gdk_region_destroy( m_pRegion ); @@ -2575,7 +2581,7 @@ bool GtkSalFrame::Dispatch( const XEvent* pEvent ) GdkEventFocus aEvent; aEvent.type = GDK_FOCUS_CHANGE; aEvent.window = m_pWindow->window; - aEvent.send_event = TRUE; + aEvent.send_event = sal_True; aEvent.in = (pEvent->xclient.data.l[1] == 1); signalFocus( m_pWindow, &aEvent, this ); } @@ -2629,7 +2635,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer { GtkSalFrame* pThis = (GtkSalFrame*)frame; SalMouseEvent aEvent; - USHORT nEventType = 0; + sal_uInt16 nEventType = 0; switch( pEvent->type ) { case GDK_BUTTON_PRESS: @@ -2639,14 +2645,14 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer nEventType = SALEVENT_MOUSEBUTTONUP; break; default: - return FALSE; + return sal_False; } switch( pEvent->button ) { case 1: aEvent.mnButton = MOUSE_LEFT; break; case 2: aEvent.mnButton = MOUSE_MIDDLE; break; case 3: aEvent.mnButton = MOUSE_RIGHT; break; - default: return FALSE; + default: return sal_False; } aEvent.mnTime = pEvent->time; aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX; @@ -2714,7 +2720,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer } } - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame ) @@ -2722,7 +2728,7 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame GtkSalFrame* pThis = (GtkSalFrame*)frame; GdkEventScroll* pSEvent = (GdkEventScroll*)pEvent; - static ULONG nLines = 0; + static sal_uLong nLines = 0; if( ! nLines ) { char* pEnv = getenv( "SAL_WHEELLINES" ); @@ -2734,8 +2740,8 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame bool bNeg = (pSEvent->direction == GDK_SCROLL_DOWN || pSEvent->direction == GDK_SCROLL_RIGHT ); SalWheelMouseEvent aEvent; aEvent.mnTime = pSEvent->time; - aEvent.mnX = (ULONG)pSEvent->x; - aEvent.mnY = (ULONG)pSEvent->y; + aEvent.mnX = (sal_uLong)pSEvent->x; + aEvent.mnY = (sal_uLong)pSEvent->y; aEvent.mnDelta = bNeg ? -120 : 120; aEvent.mnNotchDelta = bNeg ? -1 : 1; aEvent.mnScrollLines = nLines; @@ -2750,7 +2756,7 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame pThis->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer frame ) @@ -2795,7 +2801,7 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer } } - return TRUE; + return sal_True; } gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpointer frame ) @@ -2811,7 +2817,7 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpoi GTK_YIELD_GRAB(); pThis->CallCallback( (pEvent->type == GDK_ENTER_NOTIFY) ? SALEVENT_MOUSEMOVE : SALEVENT_MOUSELEAVE, &aEvent ); - return TRUE; + return sal_True; } @@ -2824,7 +2830,7 @@ gboolean GtkSalFrame::signalExpose( GtkWidget*, GdkEventExpose* pEvent, gpointer GTK_YIELD_GRAB(); pThis->CallCallback( SALEVENT_PAINT, &aEvent ); - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer frame ) @@ -2861,7 +2867,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f if( m_nFloats == 0 ) pThis->CallCallback( pEvent->in ? SALEVENT_GETFOCUS : SALEVENT_LOSEFOCUS, NULL ); - return FALSE; + return sal_False; } IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG ) @@ -2933,7 +2939,7 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) pThis->CallCallback( SALEVENT_RESIZE, NULL ); - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame ) @@ -2943,7 +2949,7 @@ gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame ) GTK_YIELD_GRAB(); pThis->CallCallback( SALEVENT_RESIZE, NULL ); - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gpointer frame ) @@ -2963,7 +2969,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp */ if( (pThis->m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) && pThis->getDisplay()->GetCaptureFrame() == pThis ) - return FALSE; + return sal_False; // in child case the coordinates are not root coordinates, @@ -3032,7 +3038,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp else if( bSized ) pThis->CallCallback( SALEVENT_RESIZE, NULL ); - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame ) @@ -3044,7 +3050,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame if( pThis->m_pIMHandler ) { if( pThis->m_pIMHandler->handleKeyEvent( pEvent ) ) - return TRUE; + return sal_True; } GTK_YIELD_GRAB(); @@ -3057,7 +3063,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame { SalKeyModEvent aModEvt; - USHORT nModCode = GetKeyModCode( pEvent->state ); + sal_uInt16 nModCode = GetKeyModCode( pEvent->state ); aModEvt.mnModKeyCode = 0; // emit no MODKEYCHANGE events if( pEvent->type == GDK_KEY_PRESS && !pThis->m_nKeyModifiers ) @@ -3070,8 +3076,8 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame pThis->m_nKeyModifiers = 0; } - USHORT nExtModMask = 0; - USHORT nModMask = 0; + sal_uInt16 nExtModMask = 0; + sal_uInt16 nModMask = 0; // pressing just the ctrl key leads to a keysym of XK_Control but // the event state does not contain ControlMask. In the release // event its the other way round: it does contain the Control mask. @@ -3149,7 +3155,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame if( !aDel.isDeleted() && pThis->m_pIMHandler ) pThis->m_pIMHandler->updateIMSpotLocation(); - return TRUE; + return sal_True; } gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) @@ -3159,7 +3165,7 @@ gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) GTK_YIELD_GRAB(); pThis->CallCallback( SALEVENT_CLOSE, NULL ); - return TRUE; + return sal_True; } void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer frame ) @@ -3198,7 +3204,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram { // signalize theme changed for NWF caches // FIXME: should be called only once for a style change - GtkSalGraphics::bThemeChanged = TRUE; + GtkSalGraphics::bThemeChanged = sal_True; } } @@ -3226,7 +3232,7 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame } #endif - return FALSE; + return sal_False; } gboolean GtkSalFrame::signalVisibility( GtkWidget*, GdkEventVisibility* pEvent, gpointer frame ) @@ -3234,7 +3240,7 @@ gboolean GtkSalFrame::signalVisibility( GtkWidget*, GdkEventVisibility* pEvent, GtkSalFrame* pThis = (GtkSalFrame*)frame; pThis->m_nVisibility = pEvent->state; - return FALSE; + return sal_False; } void GtkSalFrame::signalDestroy( GtkObject* pObj, gpointer frame ) @@ -3324,7 +3330,9 @@ void GtkSalFrame::IMHandler::updateIMSpotLocation() aArea.y = aPosEvent.mnY; aArea.width = aPosEvent.mnWidth; aArea.height = aPosEvent.mnHeight; + m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true ); gtk_im_context_set_cursor_location( m_pIMContext, &aArea ); + m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel(); } void GtkSalFrame::IMHandler::setInputContext( SalInputContext* ) @@ -3348,7 +3356,7 @@ void GtkSalFrame::IMHandler::sendEmptyCommit() m_pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, NULL ); } -void GtkSalFrame::IMHandler::endExtTextInput( USHORT /*nFlags*/ ) +void GtkSalFrame::IMHandler::endExtTextInput( sal_uInt16 /*nFlags*/ ) { gtk_im_context_reset ( m_pIMContext ); @@ -3625,7 +3633,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_ pThis->m_aInputEvent.mnDeltaStart = 0; pThis->m_aInputEvent.mbOnlyCursor = False; - pThis->m_aInputFlags = std::vector<USHORT>( std::max( 1, (int)pThis->m_aInputEvent.maText.Len() ), 0 ); + pThis->m_aInputFlags = std::vector<sal_uInt16>( std::max( 1, (int)pThis->m_aInputEvent.maText.Len() ), 0 ); PangoAttrIterator *iter = pango_attr_list_get_iterator (pAttrs); do @@ -3765,15 +3773,15 @@ gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pCon sal_uInt32 nPosition = xText->getCaretPosition(); rtl::OUString sAllText = xText->getText(); if (!sAllText.getLength()) - return FALSE; + return sal_False; rtl::OString sUTF = rtl::OUStringToOString(sAllText, RTL_TEXTENCODING_UTF8); rtl::OUString sCursorText(sAllText, nPosition); gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(), rtl::OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength()); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint offset, gint nchars, @@ -3795,10 +3803,10 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint nDeleteEnd = xText->getCharacterCount(); xText->deleteText(nDeletePos, nDeleteEnd); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/window/gtkobject.cxx b/vcl/unx/gtk/window/gtkobject.cxx index e3d8dd2d2ce0..0853e956b48f 100644 --- a/vcl/unx/gtk/window/gtkobject.cxx +++ b/vcl/unx/gtk/window/gtkobject.cxx @@ -40,7 +40,7 @@ #include <plugins/gtk/gtkdata.hxx> #include <plugins/gtk/gtkinst.hxx> -GtkSalObject::GtkSalObject( GtkSalFrame* pParent, BOOL bShow ) +GtkSalObject::GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow ) : m_pSocket( NULL ), m_pRegion( NULL ) { @@ -111,12 +111,12 @@ void GtkSalObject::ResetClipRegion() gdk_window_shape_combine_region( m_pSocket->window, NULL, 0, 0 ); } -USHORT GtkSalObject::GetClipRegionType() +sal_uInt16 GtkSalObject::GetClipRegionType() { return SAL_OBJECT_CLIP_INCLUDERECTS; } -void GtkSalObject::BeginSetClipRegion( ULONG ) +void GtkSalObject::BeginSetClipRegion( sal_uLong ) { if( m_pRegion ) gdk_region_destroy( m_pRegion ); @@ -151,7 +151,7 @@ void GtkSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) } } -void GtkSalObject::Show( BOOL bVisible ) +void GtkSalObject::Show( sal_Bool bVisible ) { if( m_pSocket ) { @@ -162,7 +162,7 @@ void GtkSalObject::Show( BOOL bVisible ) } } -void GtkSalObject::Enable( BOOL ) +void GtkSalObject::Enable( sal_Bool ) { } @@ -217,7 +217,7 @@ void GtkSalObject::signalDestroy( GtkObject* pObj, gpointer object ) } } -void GtkSalObject::SetForwardKey( BOOL bEnable ) +void GtkSalObject::SetForwardKey( sal_Bool bEnable ) { printf ("GtkSalObject::SetForwardKey\n"); if( bEnable ) @@ -226,4 +226,8 @@ void GtkSalObject::SetForwardKey( BOOL bEnable ) gtk_widget_set_events( GTK_WIDGET( m_pSocket ), ~(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE) & gtk_widget_get_events( GTK_WIDGET( m_pSocket ) ) ); } +void GtkSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpbmp.cxx b/vcl/unx/headless/svpbmp.cxx index 39f74e742550..2d8309af5eba 100644 --- a/vcl/unx/headless/svpbmp.cxx +++ b/vcl/unx/headless/svpbmp.cxx @@ -44,7 +44,7 @@ SvpSalBitmap::~SvpSalBitmap() } bool SvpSalBitmap::Create( const Size& rSize, - USHORT nBitCount, + sal_uInt16 nBitCount, const BitmapPalette& rPalette ) { sal_uInt32 nFormat = SVP_DEFAULT_BITMAP_FORMAT; @@ -112,7 +112,7 @@ bool SvpSalBitmap::Create( const SalBitmap& /*rSalBmp*/, } bool SvpSalBitmap::Create( const SalBitmap& /*rSalBmp*/, - USHORT /*nNewBitCount*/ ) + sal_uInt16 /*nNewBitCount*/ ) { return false; } @@ -139,9 +139,9 @@ Size SvpSalBitmap::GetSize() const return aSize; } -USHORT SvpSalBitmap::GetBitCount() const +sal_uInt16 SvpSalBitmap::GetBitCount() const { - USHORT nDepth = 0; + sal_uInt16 nDepth = 0; if( m_aBitmap.get() ) nDepth = getBitCountFromScanlineFormat( m_aBitmap->getScanlineFormat() ); return nDepth; @@ -153,7 +153,7 @@ BitmapBuffer* SvpSalBitmap::AcquireBuffer( bool ) if( m_aBitmap.get() ) { pBuf = new BitmapBuffer(); - USHORT nBitCount = 1; + sal_uInt16 nBitCount = 1; switch( m_aBitmap->getScanlineFormat() ) { case Format::ONE_BIT_MSB_GREY: @@ -222,7 +222,7 @@ BitmapBuffer* SvpSalBitmap::AcquireBuffer( bool ) pBuf->mnHeight = aSize.getY(); pBuf->mnScanlineSize = m_aBitmap->getScanlineStride(); pBuf->mnBitCount = nBitCount; - pBuf->mpBits = (BYTE*)m_aBitmap->getBuffer().get(); + pBuf->mpBits = (sal_uInt8*)m_aBitmap->getBuffer().get(); if( nBitCount <= 8 ) { if( m_aBitmap->getScanlineFormat() == Format::EIGHT_BIT_GREY || @@ -261,7 +261,7 @@ void SvpSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) { // palette might have changed, clone device (but recycle // memory) - USHORT nBitCount = 0; + sal_uInt16 nBitCount = 0; switch( m_aBitmap->getScanlineFormat() ) { case Format::ONE_BIT_MSB_GREY: diff --git a/vcl/unx/headless/svpbmp.hxx b/vcl/unx/headless/svpbmp.hxx index 5ce5f5bff770..695d7226b0f0 100644 --- a/vcl/unx/headless/svpbmp.hxx +++ b/vcl/unx/headless/svpbmp.hxx @@ -47,19 +47,19 @@ public: // SalBitmap virtual bool Create( const Size& rSize, - USHORT nBitCount, + sal_uInt16 nBitCount, const BitmapPalette& rPal ); virtual bool Create( const SalBitmap& rSalBmp ); virtual bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); virtual bool Create( const SalBitmap& rSalBmp, - USHORT nNewBitCount ); + sal_uInt16 nNewBitCount ); virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask = false ); virtual void Destroy(); virtual Size GetSize() const; - virtual USHORT GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); diff --git a/vcl/unx/headless/svpdummies.cxx b/vcl/unx/headless/svpdummies.cxx index 37c92faf92c9..3bf1a4da9cc0 100644 --- a/vcl/unx/headless/svpdummies.cxx +++ b/vcl/unx/headless/svpdummies.cxx @@ -51,17 +51,18 @@ SvpSalObject::~SvpSalObject() } void SvpSalObject::ResetClipRegion() {} -USHORT SvpSalObject::GetClipRegionType() { return 0; } -void SvpSalObject::BeginSetClipRegion( ULONG ) {} +sal_uInt16 SvpSalObject::GetClipRegionType() { return 0; } +void SvpSalObject::BeginSetClipRegion( sal_uLong ) {} void SvpSalObject::UnionClipRegion( long, long, long, long ) {} void SvpSalObject::EndSetClipRegion() {} void SvpSalObject::SetPosSize( long, long, long, long ) {} -void SvpSalObject::Show( BOOL ) {} -void SvpSalObject::Enable( BOOL ) {} +void SvpSalObject::Show( sal_Bool ) {} +void SvpSalObject::Enable( sal_Bool ) {} void SvpSalObject::GrabFocus() {} void SvpSalObject::SetBackground() {} void SvpSalObject::SetBackground( SalColor ) {} const SystemEnvData* SvpSalObject::GetSystemData() const { return &m_aSystemChildData; } +void SvpSalObject::InterceptChildWindowKeyDown( sal_Bool ) {} // SalI18NImeStatus SvpImeStatus::~SvpImeStatus() {} diff --git a/vcl/unx/headless/svpdummies.hxx b/vcl/unx/headless/svpdummies.hxx index 98cf2f5ebb92..86a9382adb96 100644 --- a/vcl/unx/headless/svpdummies.hxx +++ b/vcl/unx/headless/svpdummies.hxx @@ -45,20 +45,22 @@ public: // overload all pure virtual methods virtual void ResetClipRegion(); - virtual USHORT GetClipRegionType(); - virtual void BeginSetClipRegion( ULONG nRects ); + virtual sal_uInt16 GetClipRegionType(); + virtual void BeginSetClipRegion( sal_uLong nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); virtual void EndSetClipRegion(); virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); - virtual void Show( BOOL bVisible ); - virtual void Enable( BOOL nEnable ); + virtual void Show( sal_Bool bVisible ); + virtual void Enable( sal_Bool nEnable ); virtual void GrabFocus(); virtual void SetBackground(); virtual void SetBackground( SalColor nSalColor ); virtual const SystemEnvData* GetSystemData() const; + + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; class SvpImeStatus : public SalI18NImeStatus diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx index ab86c3d851b2..1b8455557fac 100644 --- a/vcl/unx/headless/svpframe.cxx +++ b/vcl/unx/headless/svpframe.cxx @@ -40,7 +40,7 @@ SvpSalFrame* SvpSalFrame::s_pFocusFrame = NULL; SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance, SalFrame* pParent, - ULONG nSalFrameStyle, + sal_uLong nSalFrameStyle, SystemParentData* ) : m_pInstance( pInstance ), m_pParent( static_cast<SvpSalFrame*>(pParent) ), @@ -147,10 +147,10 @@ void SvpSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) delete pSvpGraphics; } -BOOL SvpSalFrame::PostEvent( void* pData ) +sal_Bool SvpSalFrame::PostEvent( void* pData ) { m_pInstance->PostEvent( this, pData, SALEVENT_USEREVENT ); - return TRUE; + return sal_True; } void SvpSalFrame::PostPaint() const @@ -166,7 +166,7 @@ void SvpSalFrame::SetTitle( const XubString& ) { } -void SvpSalFrame::SetIcon( USHORT ) +void SvpSalFrame::SetIcon( sal_uInt16 ) { } @@ -182,7 +182,7 @@ void SvpSalFrame::SetExtendedFrameStyle( SalExtStyle ) { } -void SvpSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) +void SvpSalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) { if( bVisible && ! m_bVisible ) { @@ -199,7 +199,7 @@ void SvpSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) } } -void SvpSalFrame::Enable( BOOL ) +void SvpSalFrame::Enable( sal_Bool ) { } @@ -215,7 +215,7 @@ void SvpSalFrame::SetMaxClientSize( long nWidth, long nHeight ) m_nMaxHeight = nHeight; } -void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) { if( (nFlags & SAL_FRAME_POSSIZE_X) != 0 ) maGeometry.nX = nX; @@ -312,7 +312,7 @@ void SvpSalFrame::SetWindowState( const SalFrameState *pState ) } } -BOOL SvpSalFrame::GetWindowState( SalFrameState* pState ) +sal_Bool SvpSalFrame::GetWindowState( SalFrameState* pState ) { pState->mnState = SAL_FRAMESTATE_NORMAL; pState->mnX = maGeometry.nX; @@ -321,24 +321,24 @@ BOOL SvpSalFrame::GetWindowState( SalFrameState* pState ) pState->mnHeight = maGeometry.nHeight; pState->mnMask = _FRAMESTATE_MASK_GEOMETRY | SAL_FRAMESTATE_MASK_STATE; - return TRUE; + return sal_True; } -void SvpSalFrame::ShowFullScreen( BOOL, sal_Int32 ) +void SvpSalFrame::ShowFullScreen( sal_Bool, sal_Int32 ) { SetPosSize( 0, 0, VIRTUAL_DESKTOP_WIDTH, VIRTUAL_DESKTOP_HEIGHT, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); } -void SvpSalFrame::StartPresentation( BOOL ) +void SvpSalFrame::StartPresentation( sal_Bool ) { } -void SvpSalFrame::SetAlwaysOnTop( BOOL ) +void SvpSalFrame::SetAlwaysOnTop( sal_Bool ) { } -void SvpSalFrame::ToTop( USHORT ) +void SvpSalFrame::ToTop( sal_uInt16 ) { GetFocus(); } @@ -347,7 +347,7 @@ void SvpSalFrame::SetPointer( PointerStyle ) { } -void SvpSalFrame::CaptureMouse( BOOL ) +void SvpSalFrame::CaptureMouse( sal_Bool ) { } @@ -367,23 +367,23 @@ void SvpSalFrame::SetInputContext( SalInputContext* ) { } -void SvpSalFrame::EndExtTextInput( USHORT ) +void SvpSalFrame::EndExtTextInput( sal_uInt16 ) { } -String SvpSalFrame::GetKeyName( USHORT ) +String SvpSalFrame::GetKeyName( sal_uInt16 ) { return String(); } -String SvpSalFrame::GetSymbolKeyName( const XubString&, USHORT ) +String SvpSalFrame::GetSymbolKeyName( const XubString&, sal_uInt16 ) { return String(); } -BOOL SvpSalFrame::MapUnicodeToKeyCode( sal_Unicode, LanguageType, KeyCode& ) +sal_Bool SvpSalFrame::MapUnicodeToKeyCode( sal_Unicode, LanguageType, KeyCode& ) { - return FALSE; + return sal_False; } LanguageType SvpSalFrame::GetInputLanguage() @@ -423,7 +423,7 @@ SalFrame::SalIndicatorState SvpSalFrame::GetIndicatorState() return aState; } -void SvpSalFrame::SimulateKeyPress( USHORT /*nKeyCode*/ ) +void SvpSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ ) { } @@ -447,7 +447,7 @@ void SvpSalFrame::ResetClipRegion() { } -void SvpSalFrame::BeginSetClipRegion( ULONG ) +void SvpSalFrame::BeginSetClipRegion( sal_uLong ) { } diff --git a/vcl/unx/headless/svpframe.hxx b/vcl/unx/headless/svpframe.hxx index a552eff871b4..be160626957a 100644 --- a/vcl/unx/headless/svpframe.hxx +++ b/vcl/unx/headless/svpframe.hxx @@ -41,9 +41,9 @@ class SvpSalGraphics; class SvpSalFrame : public SalFrame, public SvpElement { SvpSalInstance* m_pInstance; - SvpSalFrame* m_pParent; // pointer to parent frame + SvpSalFrame* m_pParent; // pointer to parent frame std::list< SvpSalFrame* > m_aChildren; // List of child frames - ULONG m_nStyle; + sal_uLong m_nStyle; bool m_bVisible; long m_nMinWidth; long m_nMinHeight; @@ -59,7 +59,7 @@ class SvpSalFrame : public SalFrame, public SvpElement public: SvpSalFrame( SvpSalInstance* pInstance, SalFrame* pParent, - ULONG nSalFrameStyle, + sal_uLong nSalFrameStyle, SystemParentData* pSystemParent = NULL ); virtual ~SvpSalFrame(); @@ -74,39 +74,39 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL PostEvent( void* pData ); + virtual sal_Bool PostEvent( void* pData ); virtual void SetTitle( const XubString& rTitle ); - virtual void SetIcon( USHORT nIcon ); + virtual void SetIcon( sal_uInt16 nIcon ); virtual void SetMenu( SalMenu* pMenu ); virtual void DrawMenuBar(); virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ); - virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); - virtual void Enable( BOOL bEnable ); + virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False ); + virtual void Enable( sal_Bool bEnable ); virtual void SetMinClientSize( long nWidth, long nHeight ); virtual void SetMaxClientSize( long nWidth, long nHeight ); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ); virtual void GetClientSize( long& rWidth, long& rHeight ); virtual void GetWorkArea( Rectangle& rRect ); virtual SalFrame* GetParent() const; virtual void SetWindowState( const SalFrameState* pState ); - virtual BOOL GetWindowState( SalFrameState* pState ); - virtual void ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ); - virtual void StartPresentation( BOOL bStart ); - virtual void SetAlwaysOnTop( BOOL bOnTop ); - virtual void ToTop( USHORT nFlags ); + virtual sal_Bool GetWindowState( SalFrameState* pState ); + virtual void ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ); + virtual void StartPresentation( sal_Bool bStart ); + virtual void SetAlwaysOnTop( sal_Bool bOnTop ); + virtual void ToTop( sal_uInt16 nFlags ); virtual void SetPointer( PointerStyle ePointerStyle ); - virtual void CaptureMouse( BOOL bMouse ); + virtual void CaptureMouse( sal_Bool bMouse ); virtual void SetPointerPos( long nX, long nY ); using SalFrame::Flush; virtual void Flush(); virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); - virtual void EndExtTextInput( USHORT nFlags ); - virtual String GetKeyName( USHORT nKeyCode ); - virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ); - virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); + virtual void EndExtTextInput( sal_uInt16 nFlags ); + virtual String GetKeyName( sal_uInt16 nKeyCode ); + virtual String GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode ); + virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); virtual LanguageType GetInputLanguage(); virtual SalBitmap* SnapShot(); virtual void UpdateSettings( AllSettings& rSettings ); @@ -114,12 +114,12 @@ public: virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); virtual SalIndicatorState GetIndicatorState(); - virtual void SimulateKeyPress( USHORT nKeyCode ); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetBackgroundBitmap( SalBitmap* pBitmap ); virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nRects ); + virtual void BeginSetClipRegion( sal_uLong nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); virtual void EndSetClipRegion(); diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 9f4df0d29775..8c9a4e42a65a 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -30,6 +30,7 @@ #include "svpbmp.hxx" #include <vcl/sysdata.hxx> +#include <vcl/region.h> #include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2irange.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -132,7 +133,7 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) rDPIX = rDPIY = 96; } -USHORT SvpSalGraphics::GetBitCount() const +sal_uInt16 SvpSalGraphics::GetBitCount() const { return SvpElement::getBitCountFromScanlineFormat( m_aDevice->getScanlineFormat() ); } @@ -153,11 +154,16 @@ void SvpSalGraphics::ResetClipRegion() m_aClipMap.reset(); } -void SvpSalGraphics::BeginSetClipRegion( ULONG n ) +bool SvpSalGraphics::setClipRegion( const Region& i_rClip ) { - if( n <= 1 ) + if( i_rClip.IsEmpty() ) + m_aClipMap.reset(); + else if( i_rClip.GetRectCount() == 1 ) { m_aClipMap.reset(); + Rectangle aBoundRect( i_rClip.GetBoundRect() ); + m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice, + basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) ); } else { @@ -165,34 +171,22 @@ void SvpSalGraphics::BeginSetClipRegion( ULONG n ) B2IVector aSize = m_aDevice->getSize(); m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY ); m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) ); - } -} -BOOL SvpSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if( m_aClipMap ) - { - B2DPolyPolygon aFull; - aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ) ); - m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT ); - } - else - { - m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice, - basegfx::B2IRange(nX,nY,nX+nWidth,nY+nHeight) ); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + B2DPolyPolygon aFull; + aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) ); + m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } } - - return TRUE; -} - -bool SvpSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} - -void SvpSalGraphics::EndSetClipRegion() -{ + return true; } void SvpSalGraphics::SetLineColor() @@ -310,13 +304,13 @@ void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) dbgOut( m_aDevice ); } -void SvpSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) +void SvpSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ) { if( m_bUseLineColor && nPoints ) { B2DPolygon aPoly; aPoly.append( B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); - for( ULONG i = 1; i < nPoints; i++ ) + for( sal_uLong i = 1; i < nPoints; i++ ) aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) ); aPoly.setClosed( false ); m_aDevice->drawPolygon( aPoly, m_aLineColor, m_aDrawMode, m_aClipMap ); @@ -324,13 +318,13 @@ void SvpSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) dbgOut( m_aDevice ); } -void SvpSalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) +void SvpSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) { if( ( m_bUseLineColor || m_bUseFillColor ) && nPoints ) { B2DPolygon aPoly; aPoly.append( B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); - for( ULONG i = 1; i < nPoints; i++ ) + for( sal_uLong i = 1; i < nPoints; i++ ) aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) ); if( m_bUseFillColor ) { @@ -361,7 +355,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, PCONSTSALPOINT pPoints = pPtAry[nPolygon]; B2DPolygon aPoly; aPoly.append( B2DPoint( pPoints->mnX, pPoints->mnY ), nPoints ); - for( ULONG i = 1; i < nPoints; i++ ) + for( sal_uInt32 i = 1; i < nPoints; i++ ) aPoly.setB2DPoint( i, B2DPoint( pPoints[i].mnX, pPoints[i].mnY ) ); aPolyPoly.append( aPoly ); @@ -389,16 +383,16 @@ bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTrans return false; } -sal_Bool SvpSalGraphics::drawPolyLineBezier( ULONG, +sal_Bool SvpSalGraphics::drawPolyLineBezier( sal_uLong, const SalPoint*, - const BYTE* ) + const sal_uInt8* ) { return sal_False; } -sal_Bool SvpSalGraphics::drawPolygonBezier( ULONG, +sal_Bool SvpSalGraphics::drawPolygonBezier( sal_uLong, const SalPoint*, - const BYTE* ) + const sal_uInt8* ) { return sal_False; } @@ -406,7 +400,7 @@ sal_Bool SvpSalGraphics::drawPolygonBezier( ULONG, sal_Bool SvpSalGraphics::drawPolyPolygonBezier( sal_uInt32, const sal_uInt32*, const SalPoint* const*, - const BYTE* const* ) + const sal_uInt8* const* ) { return sal_False; } @@ -423,7 +417,7 @@ void SvpSalGraphics::copyArea( long nDestX, long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT /*nFlags*/ ) + sal_uInt16 /*nFlags*/ ) { B2IRange aSrcRect( nSrcX, nSrcY, nSrcX+nSrcWidth, nSrcY+nSrcHeight ); B2IRange aDestRect( nDestX, nDestY, nDestX+nSrcWidth, nDestY+nSrcHeight ); @@ -539,21 +533,21 @@ void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv dbgOut( m_aDevice ); } -void SvpSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert /*nFlags*/ ) +void SvpSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert /*nFlags*/ ) { // FIXME: handle SAL_INVERT_50 and SAL_INVERT_TRACKFRAME B2DPolygon aPoly; aPoly.append( B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); - for( ULONG i = 1; i < nPoints; i++ ) + for( sal_uLong i = 1; i < nPoints; i++ ) aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) ); aPoly.setClosed( true ); m_aDevice->fillPolyPolygon( B2DPolyPolygon(aPoly), basebmp::Color( 0xffffff ), DrawMode_XOR, m_aClipMap ); dbgOut( m_aDevice ); } -BOOL SvpSalGraphics::drawEPS( long, long, long, long, void*, ULONG ) +sal_Bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong ) { - return FALSE; + return sal_False; } SystemFontData SvpSalGraphics::GetSysFontData( int nFallbacklevel ) const diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index b385d3f35b45..0489606e9fce 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -65,20 +65,17 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual USHORT GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nCount ); - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); virtual void SetFillColor(); - virtual void SetFillColor( SalColor nSalColor ); + virtual void SetFillColor( SalColor nSalColor ); virtual void SetXORMode( bool bSet, bool ); @@ -86,15 +83,15 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ); virtual void SetTextColor( SalColor nSalColor ); - virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); + virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); - virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); - virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, + virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData*, sal_Int32* pGlyphIDs, sal_uInt8* pEncoding, @@ -113,8 +110,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -124,21 +121,21 @@ public: virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); - virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); + virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); - virtual sal_Bool drawPolyLineBezier( ULONG nPoints, + virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( ULONG nPoints, + const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); + const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ); + const sal_uInt8* const* pFlgAry ); virtual void copyArea( long nDestX, long nDestY, @@ -146,7 +143,7 @@ public: long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT nFlags ); + sal_uInt16 nFlags ); virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); virtual void drawBitmap( const SalTwoRect* pPosAry, @@ -163,9 +160,9 @@ public: virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); virtual SalColor getPixel( long nX, long nY ); virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ); - virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags ); - virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); + virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ); virtual SystemGraphicsData GetGraphicsData() const; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 10faf81434ba..f4fe1dbdc649 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -39,7 +39,7 @@ #include <vcl/salframe.hxx> #include <vcl/svdata.hxx> -#include <vcl/salatype.hxx> +#include <vcl/apptypes.hxx> #include <vcl/saldatabasic.hxx> #include <vcl/solarmutex.hxx> #include <sal/types.h> @@ -124,7 +124,7 @@ SvpSalInstance::~SvpSalInstance() osl_destroyMutex( m_aEventGuard ); } -void SvpSalInstance::PostEvent( const SalFrame* pFrame, void* pData, USHORT nEvent ) +void SvpSalInstance::PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent ) { if( osl_acquireMutex( m_aEventGuard ) ) { @@ -134,7 +134,7 @@ void SvpSalInstance::PostEvent( const SalFrame* pFrame, void* pData, USHORT nEve Wakeup(); } -void SvpSalInstance::CancelEvent( const SalFrame* pFrame, void* pData, USHORT nEvent ) +void SvpSalInstance::CancelEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent ) { if( osl_acquireMutex( m_aEventGuard ) ) { @@ -194,7 +194,7 @@ inline int operator >= ( const timeval &t1, const timeval &t2 ) return t1.tv_usec >= t2.tv_usec; return t1.tv_sec > t2.tv_sec; } -inline timeval &operator += ( timeval &t1, ULONG t2 ) +inline timeval &operator += ( timeval &t1, sal_uLong t2 ) { t1.tv_sec += t2 / 1000; t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500; @@ -237,12 +237,12 @@ bool SvpSalInstance::CheckTimeout( bool bExecuteTimers ) return bRet; } -SalFrame* SvpSalInstance::CreateChildFrame( SystemParentData* pParent, ULONG nStyle ) +SalFrame* SvpSalInstance::CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) { return new SvpSalFrame( this, NULL, nStyle, pParent ); } -SalFrame* SvpSalInstance::CreateFrame( SalFrame* pParent, ULONG nStyle ) +SalFrame* SvpSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nStyle ) { return new SvpSalFrame( this, pParent, nStyle ); } @@ -252,7 +252,7 @@ void SvpSalInstance::DestroyFrame( SalFrame* pFrame ) delete pFrame; } -SalObject* SvpSalInstance::CreateObject( SalFrame*, SystemWindowData*, BOOL ) +SalObject* SvpSalInstance::CreateObject( SalFrame*, SystemWindowData*, sal_Bool ) { return new SvpSalObject(); } @@ -264,7 +264,7 @@ void SvpSalInstance::DestroyObject( SalObject* pObject ) SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics*, long nDX, long nDY, - USHORT nBitCount, const SystemGraphicsData* ) + sal_uInt16 nBitCount, const SystemGraphicsData* ) { SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice( nBitCount ); pNew->SetSize( nDX, nDY ); @@ -301,13 +301,13 @@ osl::SolarMutex* SvpSalInstance::GetYieldMutex() return &m_aYieldMutex; } -ULONG SvpSalInstance::ReleaseYieldMutex() +sal_uLong SvpSalInstance::ReleaseYieldMutex() { if ( m_aYieldMutex.GetThreadId() == osl::Thread::getCurrentIdentifier() ) { - ULONG nCount = m_aYieldMutex.GetAcquireCount(); - ULONG n = nCount; + sal_uLong nCount = m_aYieldMutex.GetAcquireCount(); + sal_uLong n = nCount; while ( n ) { m_aYieldMutex.release(); @@ -320,7 +320,7 @@ ULONG SvpSalInstance::ReleaseYieldMutex() return 0; } -void SvpSalInstance::AcquireYieldMutex( ULONG nCount ) +void SvpSalInstance::AcquireYieldMutex( sal_uLong nCount ) { while ( nCount ) { @@ -329,13 +329,25 @@ void SvpSalInstance::AcquireYieldMutex( ULONG nCount ) } } +bool SvpSalInstance::CheckYieldMutex() +{ + bool bRet = true; + + if ( m_aYieldMutex.GetThreadId() != ::osl::Thread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { // first, check for already queued events. // release yield mutex std::list< SalUserEvent > aEvents; - ULONG nAcquireCount = ReleaseYieldMutex(); + sal_uLong nAcquireCount = ReleaseYieldMutex(); if( osl_acquireMutex( m_aEventGuard ) ) { if( ! m_aUserEvents.empty() ) @@ -414,31 +426,13 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) } } -bool SvpSalInstance::AnyInput( USHORT nType ) +bool SvpSalInstance::AnyInput( sal_uInt16 nType ) { if( (nType & INPUT_TIMER) != 0 ) return CheckTimeout( false ); 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; @@ -504,7 +498,7 @@ void SvpSalInstance::StopTimer() m_nTimeoutMS = 0; } -void SvpSalInstance::StartTimer( ULONG nMS ) +void SvpSalInstance::StartTimer( sal_uLong nMS ) { timeval Timeout (m_aTimeout); // previous timeout. gettimeofday (&m_aTimeout, 0); @@ -532,7 +526,7 @@ void SvpSalTimer::Stop() m_pInstance->StopTimer(); } -void SvpSalTimer::Start( ULONG nMS ) +void SvpSalTimer::Start( sal_uLong nMS ) { m_pInstance->StartTimer( nMS ); } diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index 622eda072e41..eaffc99978d6 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -52,7 +52,7 @@ class SvpSalYieldMutex : public ::vcl::SolarMutexObject { protected: - ULONG mnCount; + sal_uLong mnCount; oslThreadIdentifier mnThreadId; public: @@ -62,7 +62,7 @@ public: virtual void release(); virtual sal_Bool tryToAcquire(); - ULONG GetAcquireCount() const { return mnCount; } + sal_uLong GetAcquireCount() const { return mnCount; } oslThreadIdentifier GetThreadId() const { return mnThreadId; } }; @@ -78,7 +78,7 @@ public: virtual ~SvpSalTimer(); // overload all pure virtual methods - virtual void Start( ULONG nMS ); + virtual void Start( sal_uLong nMS ); virtual void Stop(); }; @@ -89,7 +89,7 @@ class SvpSalFrame; class SvpSalInstance : public SalInstance { timeval m_aTimeout; - ULONG m_nTimeoutMS; + sal_uLong m_nTimeoutMS; int m_pTimeoutFDS[2]; SvpSalYieldMutex m_aYieldMutex; @@ -98,9 +98,9 @@ class SvpSalInstance : public SalInstance { const SalFrame* m_pFrame; void* m_pData; - USHORT m_nEvent; + sal_uInt16 m_nEvent; - SalUserEvent( const SalFrame* pFrame, void* pData, USHORT nEvent = SALEVENT_USEREVENT ) + SalUserEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT ) : m_pFrame( pFrame ), m_pData( pData ), m_nEvent( nEvent ) @@ -120,10 +120,10 @@ public: SvpSalInstance(); virtual ~SvpSalInstance(); - void PostEvent( const SalFrame* pFrame, void* pData, USHORT nEvent ); - void CancelEvent( const SalFrame* pFrame, void* pData, USHORT nEvent ); + void PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent ); + void CancelEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent ); - void StartTimer( ULONG nMS ); + void StartTimer( sal_uLong nMS ); void StopTimer(); void Wakeup(); @@ -134,12 +134,12 @@ public: bool CheckTimeout( bool bExecuteTimers = true ); // Frame - virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); virtual void DestroyFrame( SalFrame* pFrame ); // Object (System Child Window) - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); virtual void DestroyObject( SalObject* pObject ); // VirtualDevice @@ -148,7 +148,7 @@ public: // pData allows for using a system dependent graphics or device context virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, long nDX, long nDY, - USHORT nBitCount, const SystemGraphicsData *pData = NULL ); + sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ); virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); // Printer @@ -177,20 +177,15 @@ public: // YieldMutex virtual osl::SolarMutex* GetYieldMutex(); - virtual ULONG ReleaseYieldMutex(); - virtual void AcquireYieldMutex( ULONG nCount ); + virtual sal_uLong ReleaseYieldMutex(); + virtual void AcquireYieldMutex( sal_uLong nCount ); + virtual bool CheckYieldMutex(); // wait next event and dispatch // must returned by UserEvent (SalFrame::PostEvent) // and timer 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 ); + virtual bool AnyInput( sal_uInt16 nType ); // may return NULL to disable session management virtual SalSession* CreateSalSession(); diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx index dbbfdd8e312e..35ca451e432c 100644 --- a/vcl/unx/headless/svpprn.cxx +++ b/vcl/unx/headless/svpprn.cxx @@ -162,7 +162,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) if( rData.getStreamBuffer( pBuffer, nBytes ) ) { pJobSetup->mnDriverDataLen = nBytes; - pJobSetup->mpDriverData = (BYTE*)pBuffer; + pJobSetup->mpDriverData = (sal_uInt8*)pBuffer; } else { @@ -302,9 +302,9 @@ String SvpSalInstance::GetDefaultPrinter() // ----------------------------------------------------------------------- -BOOL SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* ) +sal_Bool SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* ) { - return FALSE; + return sal_False; } /* diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx index 17a1d32915d9..52e8fbad4f54 100644 --- a/vcl/unx/headless/svpprn.hxx +++ b/vcl/unx/headless/svpprn.hxx @@ -40,7 +40,7 @@ class PspGraphics; class SvpSalInfoPrinter : public PspSalInfoPrinter { public: - virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); + virtual sal_Bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); }; class SvpSalPrinter : public PspSalPrinter @@ -48,8 +48,8 @@ class SvpSalPrinter : public PspSalPrinter public: SvpSalPrinter( SalInfoPrinter* pInfoPrinter ) : PspSalPrinter(pInfoPrinter) {} - virtual BOOL StartJob( const XubString* pFileName, const XubString& rJobName, - const XubString& rAppName, ULONG nCopies, bool bCollate, + virtual sal_Bool StartJob( const XubString* pFileName, const XubString& rJobName, + const XubString& rAppName, sal_uLong nCopies, bool bCollate, bool /*bDirect*/, ImplJobSetup* pSetupData ) { return SvpSalPrinter::StartJob( pFileName, rJobName, rAppName, nCopies, bCollate, false, pSetupData ); diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index cc2e2c9e20ac..7200019db9d2 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -44,6 +44,7 @@ #include "vcl/svapp.hxx" #include "vcl/salprn.hxx" #include "vcl/sysdata.hxx" +#include "vcl/region.h" #include "basegfx/vector/b2ivector.hxx" #include "basegfx/point/b2ipoint.hxx" @@ -205,7 +206,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -USHORT PspGraphics::GetBitCount() const +sal_uInt16 PspGraphics::GetBitCount() const { return m_pPrinterGfx->GetBitCount(); } @@ -217,28 +218,27 @@ long PspGraphics::GetGraphicsWidth() const void PspGraphics::ResetClipRegion() { - m_pPrinterGfx->ResetClipRegion (); + m_pPrinterGfx->ResetClipRegion(); } -void PspGraphics::BeginSetClipRegion( ULONG n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -BOOL PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (BOOL)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY); -} - -bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + // TODO: support polygonal clipregions here + m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() ); -void PspGraphics::EndSetClipRegion() -{ - m_pPrinterGfx->EndSetClipRegion (); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + m_pPrinterGfx->EndSetClipRegion(); + return true; } void PspGraphics::SetLineColor() @@ -306,12 +306,12 @@ void PspGraphics::drawRect( long nX, long nY, long nDX, long nDY ) m_pPrinterGfx->DrawRect (Rectangle(Point(nX, nY), Size(nDX, nDY))); } -void PspGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) +void PspGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry ) { m_pPrinterGfx->DrawPolyLine (nPoints, (Point*)pPtAry); } -void PspGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) +void PspGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx m_pPrinterGfx->DrawPolygon (nPoints, (Point*)pPtAry); @@ -330,13 +330,13 @@ bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTranspar return false; } -sal_Bool PspGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool PspGraphics::drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { m_pPrinterGfx->DrawPolyLineBezier (nPoints, (Point*)pPtAry, pFlgAry); return sal_True; } -sal_Bool PspGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool PspGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { m_pPrinterGfx->DrawPolygonBezier (nPoints, (Point*)pPtAry, pFlgAry); return sal_True; @@ -345,10 +345,10 @@ sal_Bool PspGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, sal_Bool PspGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ) + const sal_uInt8* const* pFlgAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx - m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (BYTE**)pFlgAry); + m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (sal_uInt8**)pFlgAry); return sal_True; } @@ -358,13 +358,13 @@ bool PspGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon&, double /*fTra return false; } -void PspGraphics::invert( ULONG /*nPoints*/, +void PspGraphics::invert( sal_uLong /*nPoints*/, const SalPoint* /*pPtAry*/, SalInvert /*nFlags*/ ) { DBG_ASSERT( 0, "Error: PrinterGfx::Invert() not implemented" ); } -BOOL PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) +sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) { return m_pPrinterGfx->DrawEPS( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ), pPtr, nSize ); } @@ -378,7 +378,7 @@ void PspGraphics::copyBits( const SalTwoRect* /*pPosAry*/, void PspGraphics::copyArea ( long /*nDestX*/, long /*nDestY*/, long /*nSrcX*/, long /*nSrcY*/, long /*nSrcWidth*/, long /*nSrcHeight*/, - USHORT /*nFlags*/ ) + sal_uInt16 /*nFlags*/ ) { OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" ); } @@ -684,16 +684,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) DrawPrinterLayout( rLayout, *m_pPrinterGfx, true ); } -ImplFontCharMap* PspGraphics::GetImplFontCharMap() const +const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const { - // TODO: get ImplFontCharMap directly from fonts if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const @@ -703,7 +700,7 @@ bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabiliti return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities); } -USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) +sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) { // release all fonts that are to be overridden for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) @@ -828,10 +825,10 @@ void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int ) } } -ULONG PspGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) +sal_uLong PspGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs ) { const ::std::list< ::psp::KernPair >& rPairs( m_pPrinterGfx->getKernPairs() ); - ULONG nHavePairs = rPairs.size(); + sal_uLong nHavePairs = rPairs.size(); if( pKernPairs && nPairs ) { ::std::list< ::psp::KernPair >::const_iterator it; @@ -850,38 +847,38 @@ ULONG PspGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) return nHavePairs; } -BOOL PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); - return TRUE; + return sal_True; } -BOOL PspGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rB2DPolyPoly ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) @@ -906,7 +903,7 @@ SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel //-------------------------------------------------------------------------- -BOOL PspGraphics::CreateFontSubset( +sal_Bool PspGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFont, sal_Int32* pGlyphIDs, @@ -1292,9 +1289,9 @@ bool PspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrLen bool bRet = false; bool bStarted = false; bool bStopped = false; - USHORT nPos; - USHORT nStart = 0; - USHORT nStop = rLen; + sal_uInt16 nPos; + sal_uInt16 nStart = 0; + sal_uInt16 nStop = rLen; String aPhone = rOrig.Copy( nIndex, rLen ); if( ! m_bPhoneCollectionActive ) diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 676e86b32f20..78f36f85295e 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -87,14 +87,11 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual USHORT GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nCount ); - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); @@ -105,15 +102,15 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ); virtual void SetTextColor( SalColor nSalColor ); - virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); + virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); - virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); - virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, + virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData*, sal_Int32* pGlyphIDs, sal_uInt8* pEncoding, @@ -132,8 +129,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -141,23 +138,23 @@ public: virtual void drawPixel( long nX, long nY, SalColor nSalColor ); virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); - virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); + virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); - virtual sal_Bool drawPolyLineBezier( ULONG nPoints, + virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( ULONG nPoints, + const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); + const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ); + const sal_uInt8* const* pFlgAry ); virtual void copyArea( long nDestX, long nDestY, @@ -165,7 +162,7 @@ public: long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT nFlags ); + sal_uInt16 nFlags ); virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); virtual void drawBitmap( const SalTwoRect* pPosAry, @@ -182,9 +179,9 @@ public: virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); virtual SalColor getPixel( long nX, long nY ); virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ); - virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags ); - virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); + virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ); virtual bool filterText( const String& rOrigText, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop ); virtual SystemGraphicsData GetGraphicsData() const; diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx index 07e6497d839a..18e2f4af8c90 100644 --- a/vcl/unx/headless/svptext.cxx +++ b/vcl/unx/headless/svptext.cxx @@ -203,7 +203,7 @@ void PspKernInfo::Initialize() const // =========================================================================== -USHORT SvpSalGraphics::SetFont( ImplFontSelectData* pIFSD, int nFallbackLevel ) +sal_uInt16 SvpSalGraphics::SetFont( ImplFontSelectData* pIFSD, int nFallbackLevel ) { // release all no longer needed font resources for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) @@ -253,15 +253,15 @@ void SvpSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe // --------------------------------------------------------------------------- -ULONG SvpSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) +sal_uLong SvpSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ) { - ULONG nGotPairs = 0; + sal_uLong nGotPairs = 0; if( m_pServerFont[0] != NULL ) { ImplKernPairData* pTmpKernPairs = NULL; nGotPairs = m_pServerFont[0]->GetKernPairs( &pTmpKernPairs ); - for( ULONG i = 0; i < nPairs && i < nGotPairs; ++i ) + for( sal_uLong i = 0; i < nPairs && i < nGotPairs; ++i ) pKernPairs[ i ] = pTmpKernPairs[ i ]; delete[] pTmpKernPairs; } @@ -271,15 +271,13 @@ ULONG SvpSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) // --------------------------------------------------------------------------- -ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const { if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } bool SvpSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const @@ -348,7 +346,7 @@ bool SvpSalGraphics::AddTempDevFont( ImplDevFontList*, // --------------------------------------------------------------------------- -BOOL SvpSalGraphics::CreateFontSubset( +sal_Bool SvpSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFont, sal_Int32* pGlyphIDs, @@ -431,39 +429,39 @@ void SvpSalGraphics::GetGlyphWidths( const ImplFontData* pFont, // --------------------------------------------------------------------------- -BOOL SvpSalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool SvpSalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); - return TRUE; + return sal_True; } // --------------------------------------------------------------------------- -BOOL SvpSalGraphics::GetGlyphOutline( long nGlyphIndex, B2DPolyPolygon& rPolyPoly ) +sal_Bool SvpSalGraphics::GetGlyphOutline( long nGlyphIndex, B2DPolyPolygon& rPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; const ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rPolyPoly ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } // --------------------------------------------------------------------------- diff --git a/vcl/unx/headless/svpvd.cxx b/vcl/unx/headless/svpvd.cxx index 2bf9894a1e23..8477da7b3bfc 100644 --- a/vcl/unx/headless/svpvd.cxx +++ b/vcl/unx/headless/svpvd.cxx @@ -55,7 +55,7 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) delete pGraphics; } -BOOL SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY ) +sal_Bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY ) { B2IVector aDevSize( nNewDX, nNewDY ); if( aDevSize.getX() == 0 ) diff --git a/vcl/unx/headless/svpvd.hxx b/vcl/unx/headless/svpvd.hxx index b30b83642293..c6dde57abd38 100644 --- a/vcl/unx/headless/svpvd.hxx +++ b/vcl/unx/headless/svpvd.hxx @@ -38,12 +38,12 @@ class SvpSalGraphics; class SvpSalVirtualDevice : public SalVirtualDevice, public SvpElement { - USHORT m_nBitCount; + sal_uInt16 m_nBitCount; basebmp::BitmapDeviceSharedPtr m_aDevice; std::list< SvpSalGraphics* > m_aGraphics; public: - SvpSalVirtualDevice( USHORT nBitCount ) : SvpElement(), m_nBitCount(nBitCount) {} + SvpSalVirtualDevice( sal_uInt16 nBitCount ) : SvpElement(), m_nBitCount(nBitCount) {} virtual ~SvpSalVirtualDevice(); // SvpElement @@ -53,7 +53,7 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL SetSize( long nNewDX, long nNewDY ); + virtual sal_Bool SetSize( long nNewDX, long nNewDY ); virtual void GetSize( long& rWidth, long& rHeight ); }; diff --git a/vcl/unx/inc/dtint.hxx b/vcl/unx/inc/dtint.hxx index b6f7aa4b9350..010a0417d89b 100644 --- a/vcl/unx/inc/dtint.hxx +++ b/vcl/unx/inc/dtint.hxx @@ -32,19 +32,12 @@ #include <tools/string.hxx> #include <tools/color.hxx> #include <vcl/font.hxx> +#include "svunx.h" class SalBitmap; class SalDisplay; class AllSettings; -#if !defined(_XLIB_H_) && !defined(_X11_XLIB_H_) -// forwards from X -struct Display; -struct XEvent; -#define Atom UINT32 -#define XLIB_Window UINT32 -#endif - enum DtType { DtGeneric, DtCDE diff --git a/vcl/unx/inc/i18n_cb.hxx b/vcl/unx/inc/i18n_cb.hxx index 358538390a8d..22aee5aeb41a 100644 --- a/vcl/unx/inc/i18n_cb.hxx +++ b/vcl/unx/inc/i18n_cb.hxx @@ -90,7 +90,7 @@ typedef struct { preedit_status_t eState; preedit_text_t aText; SalExtTextInputEvent aInputEv; - std::vector< USHORT > aInputFlags; + std::vector< sal_uInt16 > aInputFlags; } preedit_data_t; #endif /* _SAL_I18N_CALLBACK_HXX */ diff --git a/vcl/unx/inc/i18n_ic.hxx b/vcl/unx/inc/i18n_ic.hxx index e7382ef6ebd8..b038d179f4a2 100644 --- a/vcl/unx/inc/i18n_ic.hxx +++ b/vcl/unx/inc/i18n_ic.hxx @@ -76,7 +76,7 @@ public: void HandleDestroyIM(); int HandleKeyEvent( XKeyEvent *pEvent, SalFrame *pFrame ); // unused - void EndExtTextInput( USHORT nFlags ); // unused + void EndExtTextInput( sal_uInt16 nFlags ); // unused int CommitStringCallback( sal_Unicode* pText, sal_Size nLength ); int CommitKeyEvent( sal_Unicode* pText, sal_Size nLength ); int UpdateSpotLocation(); diff --git a/vcl/unx/inc/i18n_im.hxx b/vcl/unx/inc/i18n_im.hxx index cca69a3de223..92931ec6353e 100644 --- a/vcl/unx/inc/i18n_im.hxx +++ b/vcl/unx/inc/i18n_im.hxx @@ -57,10 +57,6 @@ public: Bool FilterEvent( XEvent *pEvent, XLIB_Window window ); Bool AddConnectionWatch (Display *pDisplay, void *pConnectionHandler); - #ifdef _USE_PRINT_EXTENSION_ - void Invalidate() { mbUseable = False; } - #endif - SalI18N_InputMethod(); ~SalI18N_InputMethod(); }; diff --git a/vcl/unx/inc/kde_headers.h b/vcl/unx/inc/kde_headers.h new file mode 100644 index 000000000000..7ec45fdc383d --- /dev/null +++ b/vcl/unx/inc/kde_headers.h @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_VCL_KDE_HEADERS_H +#define INCLUDED_VCL_KDE_HEADERS_H + +/* ********* Suppress warnings if needed */ +#include "sal/config.h" + +#include <cstddef> + +#if defined __GNUC__ +#pragma GCC system_header +#endif + + +/* ********* Hack, but needed because of conflicting types... */ +#define Region QtXRegion + + +/* ********* Qt headers */ +#include <qaccessible.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qfont.h> +#include <qframe.h> +#include <qlineedit.h> +#include <qlistview.h> +#include <qmainwindow.h> +#include <qmenudata.h> +#include <qpaintdevice.h> +#include <qpainter.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qrangecontrol.h> +#include <qstring.h> +#include <qtabbar.h> +#include <qtabwidget.h> +#include <qtoolbar.h> +#include <qtoolbutton.h> +#include <qwidget.h> +#include <qprogressbar.h> + +/* ********* See hack on top of this file */ +#undef Region + + +/* ********* KDE base headers */ +#include <kaboutdata.h> +#include <kapplication.h> +#include <kcmdlineargs.h> +#include <kconfig.h> +#include <kdeversion.h> +#include <kemailsettings.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <klocale.h> +#include <kmainwindow.h> +#include <kmenubar.h> +#include <kprotocolmanager.h> +#include <kstartupinfo.h> +#include <kstyle.h> + + +/* ********* KDE address book connectivity headers */ +#include <kabc/addressbook.h> +#include <kabc/addressee.h> +#include <kabc/field.h> +#include <kabc/stdaddressbook.h> + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/inc/plugins/gtk/gtkdata.hxx b/vcl/unx/inc/plugins/gtk/gtkdata.hxx index 4f02ea7c5ecf..e4a1bb5e9527 100644 --- a/vcl/unx/inc/plugins/gtk/gtkdata.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkdata.hxx @@ -60,6 +60,8 @@ class GtkSalDisplay : public SalDisplay GdkDisplay* m_pGdkDisplay; GdkCursor *m_aCursors[ POINTER_COUNT ]; bool m_bStartupCompleted; + std::vector< int > m_aXineramaScreenIndexMap; + GdkCursor* getFromXPM( const unsigned char *pBitmap, const unsigned char *pMask, int nWidth, int nHeight, int nXHot, int nYHot ); public: diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index f63f02bcda0f..010844ec3c78 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -136,7 +136,7 @@ class GtkSalFrame : public SalFrame bool m_bFocused; bool m_bPreeditJustChanged; SalExtTextInputEvent m_aInputEvent; - std::vector< USHORT > m_aInputFlags; + std::vector< sal_uInt16 > m_aInputFlags; IMHandler( GtkSalFrame* ); ~IMHandler(); @@ -145,7 +145,7 @@ class GtkSalFrame : public SalFrame void deleteIMContext(); void updateIMSpotLocation(); void setInputContext( SalInputContext* pContext ); - void endExtTextInput( USHORT nFlags ); + void endExtTextInput( sal_uInt16 nFlags ); bool handleKeyEvent( GdkEventKey* pEvent ); void focusChanged( bool bFocusIn ); @@ -169,7 +169,7 @@ class GtkSalFrame : public SalFrame GdkWindow* m_pForeignTopLevel; GdkNativeWindow m_aForeignTopLevelWindow; Pixmap m_hBackgroundPixmap; - ULONG m_nStyle; + sal_uLong m_nStyle; SalExtStyle m_nExtStyle; GtkFixed* m_pFixedContainer; GtkSalFrame* m_pParent; @@ -177,7 +177,7 @@ class GtkSalFrame : public SalFrame GdkWindowState m_nState; SystemEnvData m_aSystemData; GraphicsHolder m_aGraphics[ nMaxGraphics ]; - USHORT m_nKeyModifiers; + sal_uInt16 m_nKeyModifiers; GdkCursor *m_pCurrentCursor; GdkVisibilityState m_nVisibility; PointerStyle m_ePointerStyle; @@ -201,7 +201,7 @@ class GtkSalFrame : public SalFrame GdkRegion* m_pRegion; - void Init( SalFrame* pParent, ULONG nStyle ); + void Init( SalFrame* pParent, sal_uLong nStyle ); void Init( SystemParentData* pSysData ); void InitCommon(); @@ -253,7 +253,7 @@ class GtkSalFrame : public SalFrame bool isChild( bool bPlug = true, bool bSysChild = true ) { - ULONG nMask = 0; + sal_uLong nMask = 0; if( bPlug ) nMask |= SAL_FRAME_STYLE_PLUG; if( bSysChild ) @@ -274,14 +274,14 @@ class GtkSalFrame : public SalFrame DECL_LINK( ImplDelayedFullScreenHdl, void* ); public: - GtkSalFrame( SalFrame* pParent, ULONG nStyle ); + GtkSalFrame( SalFrame* pParent, sal_uLong nStyle ); GtkSalFrame( SystemParentData* pSysData ); // dispatches an event, returns true if dispatched // and false else; if true was returned the event should // be swallowed bool Dispatch( const XEvent* pEvent ); - void grabPointer( BOOL bGrab, BOOL bOwnerEvents = FALSE ); + void grabPointer( sal_Bool bGrab, sal_Bool bOwnerEvents = sal_False ); GtkSalDisplay* getDisplay(); GdkDisplay* getGdkDisplay(); @@ -308,41 +308,41 @@ public: // Event must be destroyed, when Frame is destroyed // When Event is called, SalInstance::Yield() must be returned - virtual BOOL PostEvent( void* pData ); + virtual sal_Bool PostEvent( void* pData ); virtual void SetTitle( const XubString& rTitle ); - virtual void SetIcon( USHORT nIcon ); + virtual void SetIcon( sal_uInt16 nIcon ); virtual void SetMenu( SalMenu *pSalMenu ); virtual void DrawMenuBar(); virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ); // Before the window is visible, a resize event // must be sent with the correct size - virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); - virtual void Enable( BOOL bEnable ); + virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False ); + virtual void Enable( sal_Bool bEnable ); // Set ClientSize and Center the Window to the desktop // and send/post a resize message virtual void SetMinClientSize( long nWidth, long nHeight ); virtual void SetMaxClientSize( long nWidth, long nHeight ); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ); virtual void GetClientSize( long& rWidth, long& rHeight ); virtual void GetWorkArea( Rectangle& rRect ); virtual SalFrame* GetParent() const; virtual void SetWindowState( const SalFrameState* pState ); - virtual BOOL GetWindowState( SalFrameState* pState ); - virtual void ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ); + virtual sal_Bool GetWindowState( SalFrameState* pState ); + virtual void ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ); // Enable/Disable ScreenSaver, SystemAgents, ... - virtual void StartPresentation( BOOL bStart ); + virtual void StartPresentation( sal_Bool bStart ); // Show Window over all other Windows - virtual void SetAlwaysOnTop( BOOL bOnTop ); + virtual void SetAlwaysOnTop( sal_Bool bOnTop ); // Window to top and grab focus - virtual void ToTop( USHORT nFlags ); + virtual void ToTop( sal_uInt16 nFlags ); // this function can call with the same // pointer style virtual void SetPointer( PointerStyle ePointerStyle ); - virtual void CaptureMouse( BOOL bMouse ); + virtual void CaptureMouse( sal_Bool bMouse ); virtual void SetPointerPos( long nX, long nY ); // flush output buffer @@ -352,11 +352,11 @@ public: virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); - virtual void EndExtTextInput( USHORT nFlags ); + virtual void EndExtTextInput( sal_uInt16 nFlags ); - virtual String GetKeyName( USHORT nKeyCode ); - virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ); - virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); + virtual String GetKeyName( sal_uInt16 nKeyCode ); + virtual String GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode ); + virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); // returns the input language used for the last key stroke // may be LANGUAGE_DONTKNOW if not supported by the OS @@ -377,7 +377,7 @@ public: virtual SalIndicatorState GetIndicatorState(); - virtual void SimulateKeyPress( USHORT nKeyCode ); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); // set new parent window virtual void SetParent( SalFrame* pNewParent ); @@ -395,7 +395,7 @@ public: // set clip region to none (-> rectangular windows, normal state) virtual void ResetClipRegion(); // start setting the clipregion consisting of nRects rectangles - virtual void BeginSetClipRegion( ULONG nRects ); + virtual void BeginSetClipRegion( sal_uLong nRects ); // add a rectangle to the clip region virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); // done setting up the clipregion diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 209ba99cd875..4f7d66712ac7 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -56,34 +56,31 @@ public: // will be set when UI theme was changed - static BOOL bThemeChanged; - static BOOL bNeedPixmapPaint; - static BOOL bGlobalNeedPixmapPaint; - static BOOL bToolbarGripWorkaround; - static BOOL bNeedButtonStyleAsEditBackgroundWorkaround; + static sal_Bool bThemeChanged; + static sal_Bool bNeedPixmapPaint; + static sal_Bool bGlobalNeedPixmapPaint; + static sal_Bool bToolbarGripWorkaround; + static sal_Bool bNeedButtonStyleAsEditBackgroundWorkaround; // native widget methods - virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, - const Point& aPos, BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ); + virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + const Point& aPos, sal_Bool& rIsInside ); + virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, + virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); //helper methods for frame's UpdateSettings void updateSettings( AllSettings& rSettings ); + virtual bool setClipRegion( const Region& ); virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nCount ); - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); // some themes set the background pixmap of our window EVERY time // a control is painted; but presentation effects need @@ -96,93 +93,89 @@ protected: typedef std::list< Rectangle > clipList; GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect ); - BOOL NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ); + sal_Bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ); - BOOL NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKScrollbar( ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKScrollbar( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKTabItem( ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKTabItem( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + sal_Bool NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - - BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, - ControlState nState, const ImplControlValue& aValue, - const rtl::OUString& rCaption ); }; #endif // _VCL_GTKGDI_HXX diff --git a/vcl/unx/inc/plugins/gtk/gtkinst.hxx b/vcl/unx/inc/plugins/gtk/gtkinst.hxx index 325bf54f7998..07549776e9cf 100644 --- a/vcl/unx/inc/plugins/gtk/gtkinst.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkinst.hxx @@ -64,7 +64,7 @@ class GtkHookedYieldMutex : public GtkYieldMutex { virtual int Grab() { return 0; }; virtual void Ungrab(int ) {}; - std::list<ULONG> aYieldStack; + std::list<sal_uLong> aYieldStack; public: GtkHookedYieldMutex(); virtual void acquire(); @@ -85,9 +85,9 @@ public: {} virtual ~GtkInstance(); - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); - virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); virtual SalSystem* CreateSalSystem(); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); }; diff --git a/vcl/unx/inc/plugins/gtk/gtkobject.hxx b/vcl/unx/inc/plugins/gtk/gtkobject.hxx index 143f9a2d19a9..72b33b0e5c3b 100644 --- a/vcl/unx/inc/plugins/gtk/gtkobject.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkobject.hxx @@ -45,28 +45,29 @@ class GtkSalObject : public SalObject static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer ); static void signalDestroy( GtkObject*, gpointer ); public: - GtkSalObject( GtkSalFrame* pParent, BOOL bShow = TRUE ); + GtkSalObject( GtkSalFrame* pParent, sal_Bool bShow = sal_True ); virtual ~GtkSalObject(); // overload all pure virtual methods virtual void ResetClipRegion(); - virtual USHORT GetClipRegionType(); - virtual void BeginSetClipRegion( ULONG nRects ); + virtual sal_uInt16 GetClipRegionType(); + virtual void BeginSetClipRegion( sal_uLong nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); virtual void EndSetClipRegion(); virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); - virtual void Show( BOOL bVisible ); - virtual void Enable( BOOL nEnable ); + virtual void Show( sal_Bool bVisible ); + virtual void Enable( sal_Bool nEnable ); virtual void GrabFocus(); virtual void SetBackground(); virtual void SetBackground( SalColor nSalColor ); - virtual void SetForwardKey( BOOL bEnable ); + virtual void SetForwardKey( sal_Bool bEnable ); virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H diff --git a/vcl/unx/inc/plugins/kde/kdedata.hxx b/vcl/unx/inc/plugins/kde/kdedata.hxx index 458685ea58b0..9125b33f1b20 100644 --- a/vcl/unx/inc/plugins/kde/kdedata.hxx +++ b/vcl/unx/inc/plugins/kde/kdedata.hxx @@ -68,14 +68,14 @@ class KDESalFrame : public X11SalFrame GraphicsHolder m_aGraphics[ nMaxGraphics ]; public: - KDESalFrame( SalFrame* pParent, ULONG nStyle ); + KDESalFrame( SalFrame* pParent, sal_uLong ); virtual ~KDESalFrame(); virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); - virtual void Show( BOOL bVisible, BOOL bNoActivate ); + virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate ); }; class KDESalInstance : public X11SalInstance @@ -84,7 +84,7 @@ public: KDESalInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) {} virtual ~KDESalInstance() {} - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); }; class KDEXLib : public SalXLib diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h index 1c7c3d51a785..80d1f5fb92cc 100644 --- a/vcl/unx/inc/pspgraphics.h +++ b/vcl/unx/inc/pspgraphics.h @@ -84,14 +84,11 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual USHORT GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nCount ); - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); @@ -102,15 +99,15 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ); virtual void SetTextColor( SalColor nSalColor ); - virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); + virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); - virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual sal_uLong GetKernPairs( sal_uLong nMaxPairs, ImplKernPairData* ); + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); - virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, + virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData*, sal_Int32* pGlyphIDs, sal_uInt8* pEncoding, @@ -129,8 +126,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -138,30 +135,30 @@ public: virtual void drawPixel( long nX, long nY, SalColor nSalColor ); virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); - virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); + virtual void drawPolyLine( sal_uIntPtr nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); virtual bool drawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin); - virtual sal_Bool drawPolyLineBezier( ULONG nPoints, + virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( ULONG nPoints, + const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); + const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ); + const sal_uInt8* const* pFlgAry ); virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT nFlags ); + sal_uInt16 nFlags ); virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); virtual void drawBitmap( const SalTwoRect* pPosAry, @@ -178,9 +175,9 @@ public: virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); virtual SalColor getPixel( long nX, long nY ); virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ); - virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + virtual void invert( sal_uIntPtr nPoints, const SalPoint* pPtAry, SalInvert nFlags ); - virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); + virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize ); virtual bool filterText( const String& rOrigText, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop ); virtual bool drawAlphaBitmap( const SalTwoRect&, diff --git a/vcl/unx/inc/salbmp.h b/vcl/unx/inc/salbmp.h index 1f2dc420cb72..f72f77b9909f 100644 --- a/vcl/unx/inc/salbmp.h +++ b/vcl/unx/inc/salbmp.h @@ -52,7 +52,7 @@ class VCL_DLLPUBLIC X11SalBitmap : public SalBitmap private: static BitmapBuffer* ImplCreateDIB( const Size& rSize, - USHORT nBitCount, + sal_uInt16 nBitCount, const BitmapPalette& rPal ); static BitmapBuffer* ImplCreateDIB( Drawable aDrawable, int nScreen, @@ -64,7 +64,7 @@ private: public: static ImplSalBitmapCache* mpCache; - static ULONG mnCacheInstCount; + static sal_uIntPtr mnCacheInstCount; static void ImplCreateCache(); static void ImplDestroyCache(); @@ -106,13 +106,13 @@ public: // overload pure virtual methods virtual bool Create( const Size& rSize, - USHORT nBitCount, + sal_uInt16 nBitCount, const BitmapPalette& rPal ); virtual bool Create( const SalBitmap& rSalBmp ); virtual bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); virtual bool Create( const SalBitmap& rSalBmp, - USHORT nNewBitCount ); + sal_uInt16 nNewBitCount ); virtual bool Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask = false ); @@ -120,7 +120,7 @@ public: virtual void Destroy(); virtual Size GetSize() const; - virtual USHORT GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); @@ -167,7 +167,7 @@ public: long ImplGetWidth() const { return maTwoRect.mnDestWidth; } long ImplGetHeight() const { return maTwoRect.mnDestHeight; } long ImplGetDepth() const { return mnDepth; } - ULONG ImplGetMemSize() const { return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); } + sal_uIntPtr ImplGetMemSize() const { return( ( maTwoRect.mnDestWidth * maTwoRect.mnDestHeight * mnDepth ) >> 3 ); } int ImplGetScreen() const { return mnScreen; } bool ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const; @@ -184,14 +184,14 @@ class ImplSalBitmapCache private: List maBmpList; - ULONG mnTotalSize; + sal_uIntPtr mnTotalSize; public: ImplSalBitmapCache(); ~ImplSalBitmapCache(); - void ImplAdd( X11SalBitmap* pBmp, ULONG nMemSize = 0UL, ULONG nFlags = 0UL ); + void ImplAdd( X11SalBitmap* pBmp, sal_uIntPtr nMemSize = 0UL, sal_uIntPtr nFlags = 0UL ); void ImplRemove( X11SalBitmap* pBmp ); void ImplClear(); }; diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx index 9544491137fb..e967b0f7e4d0 100644 --- a/vcl/unx/inc/saldata.hxx +++ b/vcl/unx/inc/saldata.hxx @@ -56,11 +56,12 @@ typedef unsigned int pthread_t; class VCL_DLLPUBLIC X11SalData : public SalData { protected: - BOOL bNoExceptions_; + sal_Bool bNoExceptions_; SalXLib *pXLib_; SalDisplay *m_pSalDisplay; pthread_t hMainThread_; rtl::OUString maLocalHostName; + rtl::OUString maUnicodeAccumulator; public: X11SalData(); @@ -82,11 +83,12 @@ public: inline SalXLib* GetLib() const { return pXLib_; } inline pthread_t GetMainThread() const { return hMainThread_; } - void StartTimer( ULONG nMS ); + void StartTimer( sal_uLong nMS ); inline void StopTimer(); void Timeout() const; const rtl::OUString& GetLocalHostName(); + rtl::OUString& GetUnicodeAccumulator() { return maUnicodeAccumulator; } static int XErrorHdl( Display*, XErrorEvent* ); static int XIOErrorHdl( Display* ); @@ -109,7 +111,7 @@ inline void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const class YieldMutexReleaser { - ULONG m_nYieldCount; + sal_uLong m_nYieldCount; public: inline YieldMutexReleaser(); inline ~YieldMutexReleaser(); diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 64eb16a1b313..895f4513800e 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -149,8 +149,8 @@ public: Pixel GetTCPixel( SalColor nColor ) const; SalColor GetTCColor( Pixel nPixel ) const; - BOOL Convert( int &n0, int &n1, int &n2, int &n3 ); // 32bit - BOOL Convert( int &n0, int &n1, int &n2 ); // 24bit + sal_Bool Convert( int &n0, int &n1, int &n2, int &n3 ); // 32bit + sal_Bool Convert( int &n0, int &n1, int &n2 ); // 24bit }; // -=-= SalColormap =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -160,7 +160,7 @@ class SalColormap Colormap m_hColormap; std::vector<SalColor> m_aPalette; // Pseudocolor SalVisual m_aVisual; - std::vector<USHORT> m_aLookupTable; // Pseudocolor: 12bit reduction + std::vector<sal_uInt16> m_aLookupTable; // Pseudocolor: 12bit reduction Pixel m_nWhitePixel; Pixel m_nBlackPixel; Pixel m_nUsed; // Pseudocolor @@ -173,7 +173,7 @@ public: Colormap hColormap, int nScreen ); SalColormap( const BitmapPalette &rpPalette ); - SalColormap( USHORT nDepth ); + SalColormap( sal_uInt16 nDepth ); SalColormap(); ~SalColormap(); @@ -188,11 +188,11 @@ public: inline int GetClass() const { return m_aVisual.GetClass(); } inline int GetScreenNumber() const { return m_nScreen; } - BOOL GetXPixels( XColor &rColor, + sal_Bool GetXPixels( XColor &rColor, int r, int g, int b ) const; - inline BOOL GetXPixel( XColor &rColor, + inline sal_Bool GetXPixel( XColor &rColor, int r, int g, int b ) const; @@ -209,7 +209,7 @@ class VCL_DLLPUBLIC SalXLib { protected: timeval m_aTimeout; - ULONG m_nTimeoutMS; + sal_uLong m_nTimeoutMS; int m_pTimeoutFDS[2]; bool m_bHaveSystemChildFrames; @@ -251,7 +251,7 @@ public: void PushXErrorLevel( bool bIgnore ); void PopXErrorLevel(); - virtual void StartTimer( ULONG nMS ); + virtual void StartTimer( sal_uLong nMS ); virtual void StopTimer(); bool CheckTimeout( bool bExecuteTimers = true ); @@ -266,15 +266,10 @@ public: class SalI18N_InputMethod; class SalI18N_KeyboardExtension; -class XlfdStorage; -class ExtendedFontStruct; -class ExtendedXlfd; class AttributeProvider; class SalUnicodeConverter; class SalConverterCache; -typedef ::std::vector< ExtendedFontStruct* > SalFontCache; - extern "C" { struct SnDisplay; struct SnLauncheeContext; @@ -331,9 +326,9 @@ public: { SalFrame* m_pFrame; void* m_pData; - USHORT m_nEvent; + sal_uInt16 m_nEvent; - SalUserEvent( SalFrame* pFrame, void* pData, USHORT nEvent = SALEVENT_USEREVENT ) + SalUserEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT ) : m_pFrame( pFrame ), m_pData( pData ), m_nEvent( nEvent ) @@ -346,8 +341,6 @@ protected: SalI18N_KeyboardExtension *mpKbdExtension; AttributeProvider *mpFactory; - XlfdStorage *mpFontList; - const ExtendedXlfd *mpFallbackFactory; Display *pDisp_; // X Display int m_nDefaultScreen; // XDefaultScreen @@ -355,14 +348,14 @@ protected: ScreenData m_aInvalidScreenData; Pair aResolution_; // [dpi] bool mbExactResolution; - ULONG nMaxRequestSize_; // [byte] + sal_uLong nMaxRequestSize_; // [byte] srv_vendor_t meServerVendor; SalWM eWindowManager_; - ULONG nProperties_; // PROPERTY_SUPPORT, BUG, FEATURE - BOOL bLocal_; // Server==Client? Init + sal_uLong nProperties_; // PROPERTY_SUPPORT, BUG, FEATURE + sal_Bool bLocal_; // Server==Client? Init // in SalDisplay::IsLocal() - BOOL mbLocalIsValid; // bLocal_ is valid ? + sal_Bool mbLocalIsValid; // bLocal_ is valid ? // until x bytes oslMutex hEventGuard_; @@ -371,10 +364,8 @@ protected: XLIB_Cursor aPointerCache_[POINTER_COUNT]; SalFrame* m_pCapture; - mutable SalFontCache* m_pFontCache; - // Keyboard - BOOL bNumLockFromXS_; // Num Lock handled by X Server + sal_Bool bNumLockFromXS_; // Num Lock handled by X Server int nNumLockIndex_; // modifier index in modmap int nNumLockMask_; // keyevent state mask for KeySym nShiftKeySym_; // first shift modifier @@ -395,7 +386,6 @@ protected: mutable XLIB_Time m_nLastUserEventTime; // mutable because changed on first access - void DestroyFontCache(); virtual long Dispatch( XEvent *pEvent ) = 0; void InitXinerama(); void InitRandR( XLIB_Window aRoot ) const; @@ -406,7 +396,7 @@ protected: void addXineramaScreenUnique( int i, long i_nX, long i_nY, long i_nWidth, long i_nHeight ); public: static SalDisplay *GetSalDisplay( Display* display ); - static BOOL BestVisual( Display *pDisp, + static sal_Bool BestVisual( Display *pDisp, int nScreen, XVisualInfo &rVI ); @@ -424,30 +414,22 @@ public: void Init(); - void SendInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent = SALEVENT_USEREVENT ); - void CancelInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent ); + void SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT ); + void CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent ); bool DispatchInternalEvent(); void PrintInfo() const; void PrintEvent( const ByteString &rComment, XEvent *pEvent ) const; - XlfdStorage* GetXlfdList() const; - ExtendedFontStruct* - GetFont( const ExtendedXlfd *pFont, - const Size& rPixelSize, sal_Bool bVertical ) const; - const ExtendedXlfd* - GetFallbackFactory() - { return mpFallbackFactory; } - void Beep() const; void ModifierMapping(); - void SimulateKeyPress( USHORT nKeyCode ); - USHORT GetIndicatorState() const; + void SimulateKeyPress( sal_uInt16 nKeyCode ); + sal_uInt16 GetIndicatorState() const; String GetKeyNameFromKeySym( KeySym keysym ) const; - XubString GetKeyName( USHORT nKeyCode ) const; - USHORT GetKeyCode( KeySym keysym, char*pcPrintable ) const; + XubString GetKeyName( sal_uInt16 nKeyCode ) const; + sal_uInt16 GetKeyCode( KeySym keysym, char*pcPrintable ) const; KeySym GetKeySym( XKeyEvent *pEvent, unsigned char *pPrintable, int *pLen, @@ -458,7 +440,7 @@ public: XLIB_Cursor GetPointer( int ePointerStyle ); virtual int CaptureMouse( SalFrame *pCapture ); - BOOL IsLocal(); + sal_Bool IsLocal(); void Remove( XEvent *pEvent ); @@ -479,27 +461,27 @@ public: const Size& GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; } srv_vendor_t GetServerVendor() const { return meServerVendor; } void SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); } - BOOL IsDisplay() const { return !!pXLib_; } + sal_Bool IsDisplay() const { return !!pXLib_; } GC GetMonoGC( int nScreen ) const { return getDataForScreen(nScreen).m_aMonoGC; } GC GetCopyGC( int nScreen ) const { return getDataForScreen(nScreen).m_aCopyGC; } GC GetAndInvertedGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndInvertedGC; } GC GetAndGC( int nScreen ) const { return getDataForScreen(nScreen).m_aAndGC; } GC GetOrGC( int nScreen ) const { return getDataForScreen(nScreen).m_aOrGC; } GC GetStippleGC( int nScreen ) const { return getDataForScreen(nScreen).m_aStippleGC; } - GC GetGC( USHORT nDepth, int nScreen ) const; + GC GetGC( sal_uInt16 nDepth, int nScreen ) const; Pixmap GetInvert50( int nScreen ) const { return getDataForScreen(nScreen).m_hInvert50; } const SalColormap& GetColormap( int nScreen ) const { return getDataForScreen(nScreen).m_aColormap; } const SalVisual& GetVisual( int nScreen ) const { return getDataForScreen(nScreen).m_aVisual; } RenderEntryMap& GetRenderEntries( int nScreen ) const { return getDataForScreen(nScreen).m_aRenderData; } const Pair &GetResolution() const { return aResolution_; } bool GetExactResolution() const { return mbExactResolution; } - ULONG GetProperties() const { return nProperties_; } - ULONG GetMaxRequestSize() const { return nMaxRequestSize_; } + sal_uLong GetProperties() const { return nProperties_; } + sal_uLong GetMaxRequestSize() const { return nMaxRequestSize_; } XLIB_Time GetLastUserEventTime( bool bAlwaysReget = false ) const; bool XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate, long i_nTimeout = 1000 ) const; - BOOL MouseCaptured( const SalFrame *pFrameData ) const + sal_Bool MouseCaptured( const SalFrame *pFrameData ) const { return m_pCapture == pFrameData; } SalFrame* GetCaptureFrame() const { return m_pCapture; } @@ -525,14 +507,14 @@ public: const std::list< SalFrame* >& getFrames() const { return m_aFrames; } - BOOL IsNumLockFromXS() const { return bNumLockFromXS_; } + sal_Bool IsNumLockFromXS() const { return bNumLockFromXS_; } std::list< SalObject* >& getSalObjects() { return m_aSalObjects; } }; // -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -inline GC SalDisplay::GetGC( USHORT nDepth, int nScreen ) const +inline GC SalDisplay::GetGC( sal_uInt16 nDepth, int nScreen ) const { return 1 == nDepth ? GetMonoGC( nScreen ) : getDataForScreen(nScreen).m_aVisual.GetDepth() == nDepth @@ -551,7 +533,7 @@ public: virtual long Dispatch( XEvent *pEvent ); virtual void Yield(); - BOOL IsEvent(); + sal_Bool IsEvent(); }; /*---------------------------------------------------------- diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h index 5ec3f04355a0..0025afce2ad6 100644 --- a/vcl/unx/inc/salframe.h +++ b/vcl/unx/inc/salframe.h @@ -88,23 +88,23 @@ class VCL_DLLPUBLIC X11SalFrame : public SalFrame X11SalGraphics *pFreeGraphics_; // first free frame graphics XLIB_Time nReleaseTime_; // timestamp of last key release - USHORT nKeyCode_; // last key code - USHORT nKeyState_; // last key state + sal_uInt16 nKeyCode_; // last key code + sal_uInt16 nKeyState_; // last key state int nCompose_; // compose state bool mbSendExtKeyModChange; - USHORT mnExtKeyMod; + sal_uInt16 mnExtKeyMod; int nShowState_; // show state int nWidth_; // client width int nHeight_; // client height Rectangle maRestorePosSize; - ULONG nStyle_; + sal_uIntPtr nStyle_; SalExtStyle mnExtStyle; - BOOL bAlwaysOnTop_; - BOOL bViewable_; - BOOL bMapped_; - BOOL mbInShow; - BOOL bDefaultPosition_; // client is centered initially + sal_Bool bAlwaysOnTop_; + sal_Bool bViewable_; + sal_Bool bMapped_; + sal_Bool mbInShow; + sal_Bool bDefaultPosition_; // client is centered initially bool m_bXEmbed; int nVisibility_; int m_nWorkArea; @@ -177,11 +177,11 @@ class VCL_DLLPUBLIC X11SalFrame : public SalFrame void updateWMClass(); public: - X11SalFrame( SalFrame* pParent, ULONG nSalFrameStyle, SystemParentData* pSystemParent = NULL ); + X11SalFrame( SalFrame* pParent, sal_uIntPtr nSalFrameStyle, SystemParentData* pSystemParent = NULL ); virtual ~X11SalFrame(); long Dispatch( XEvent *pEvent ); - void Init( ULONG nSalFrameStyle, int nScreen = -1, + void Init( sal_uIntPtr nSalFrameStyle, int nScreen = -1, SystemParentData* pParentData = NULL, bool bUseGeometry = false ); SalDisplay* GetDisplay() const { return pDisplay_; } @@ -194,10 +194,10 @@ public: XLIB_Window GetStackingWindow() const { return mhStackingWindow; } long ShutDown() const { return CallCallback( SALEVENT_SHUTDOWN, 0 ); } long Close() const { return CallCallback( SALEVENT_CLOSE, 0 ); } - ULONG GetStyle() const { return nStyle_; } + sal_uIntPtr GetStyle() const { return nStyle_; } inline XLIB_Cursor GetCursor() const { return hCursor_; } - inline BOOL IsCaptured() const { return nCaptured_ == 1; } + inline sal_Bool IsCaptured() const { return nCaptured_ == 1; } #if !defined(__synchronous_extinput__) void HandleExtTextEvent (XClientMessageEvent *pEvent); void PostExtTextEvent (sal_uInt16 nExtTextEventType, @@ -213,6 +213,10 @@ public: bool isMapped() const { return bMapped_; } bool hasFocus() const { return mbInputFocus; } + void beginUnicodeSequence(); + bool appendUnicodeSequence( sal_Unicode ); + bool endUnicodeSequence(); + virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); @@ -220,39 +224,39 @@ public: // call with false to setup graphics with window (GetWindow()) virtual void updateGraphics( bool bClear ); - virtual BOOL PostEvent( void* pData ); + virtual sal_Bool PostEvent( void* pData ); virtual void SetTitle( const XubString& rTitle ); - virtual void SetIcon( USHORT nIcon ); + virtual void SetIcon( sal_uInt16 nIcon ); virtual void SetMenu( SalMenu* pMenu ); virtual void DrawMenuBar(); virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ); - virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); - virtual void Enable( BOOL bEnable ); + virtual void Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False ); + virtual void Enable( sal_Bool bEnable ); virtual void SetMinClientSize( long nWidth, long nHeight ); virtual void SetMaxClientSize( long nWidth, long nHeight ); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ); virtual void GetClientSize( long& rWidth, long& rHeight ); virtual void GetWorkArea( Rectangle& rRect ); virtual SalFrame* GetParent() const; virtual void SetWindowState( const SalFrameState* pState ); - virtual BOOL GetWindowState( SalFrameState* pState ); - virtual void ShowFullScreen( BOOL bFullScreen, sal_Int32 nMonitor ); - virtual void StartPresentation( BOOL bStart ); - virtual void SetAlwaysOnTop( BOOL bOnTop ); - virtual void ToTop( USHORT nFlags ); + virtual sal_Bool GetWindowState( SalFrameState* pState ); + virtual void ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nMonitor ); + virtual void StartPresentation( sal_Bool bStart ); + virtual void SetAlwaysOnTop( sal_Bool bOnTop ); + virtual void ToTop( sal_uInt16 nFlags ); virtual void SetPointer( PointerStyle ePointerStyle ); - virtual void CaptureMouse( BOOL bMouse ); + virtual void CaptureMouse( sal_Bool bMouse ); virtual void SetPointerPos( long nX, long nY ); using SalFrame::Flush; virtual void Flush(); virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); - virtual void EndExtTextInput( USHORT nFlags ); - virtual String GetKeyName( USHORT nKeyCode ); - virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ); - virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); + virtual void EndExtTextInput( sal_uInt16 nFlags ); + virtual String GetKeyName( sal_uInt16 nKeyCode ); + virtual String GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode ); + virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); virtual LanguageType GetInputLanguage(); virtual SalBitmap* SnapShot(); virtual void UpdateSettings( AllSettings& rSettings ); @@ -260,7 +264,7 @@ public: virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); virtual SalIndicatorState GetIndicatorState(); - virtual void SimulateKeyPress( USHORT nKeyCode ); + virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetBackgroundBitmap( SalBitmap* pBitmap ); @@ -272,7 +276,7 @@ public: // set clip region to none (-> rectangular windows, normal state) virtual void ResetClipRegion(); // start setting the clipregion consisting of nRects rectangles - virtual void BeginSetClipRegion( ULONG nRects ); + virtual void BeginSetClipRegion( sal_uIntPtr nRects ); // add a rectangle to the clip region virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); // done setting up the clipregion diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index 4a9cd11f394d..ab8607aa523c 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -29,18 +29,15 @@ #ifndef _SV_SALGDI_H #define _SV_SALGDI_H - -// -=-= exports -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -class SalFontCacheItem; - // -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #include "salstd.hxx" #include "vcl/salgdi.hxx" #include "vcl/salgtype.hxx" #include "tools/fract.hxx" #include "vcl/dllapi.h" +#include <vcl/vclenum.hxx> +#include <vcl/sallayout.hxx> #include <deque> -#include "xfont.hxx" // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= struct ImplFontMetricData; @@ -94,21 +91,20 @@ protected: CairoFontsCache m_aCairoFontsCache; XLIB_Region pPaintRegion_; - XLIB_Region pClipRegion_; + XLIB_Region mpClipRegion; GC pPenGC_; // Pen attributes SalColor nPenColor_; Pixel nPenPixel_; GC pFontGC_; // Font attributes - ExtendedFontStructRef mXFont[ MAX_FALLBACK ]; ServerFont* mpServerFont[ MAX_FALLBACK ]; SalColor nTextColor_; Pixel nTextPixel_; - BOOL bFontVertical_; + sal_Bool bFontVertical_; - BOOL bDisableGraphite_; + sal_Bool bDisableGraphite_; GC pBrushGC_; // Brush attributes SalColor nBrushColor_; @@ -123,21 +119,22 @@ protected: GC pStippleGC_; GC pTrackingGC_; - BOOL bWindow_ : 1; // is Window - BOOL bPrinter_ : 1; // is Printer - BOOL bVirDev_ : 1; // is VirDev - BOOL bPenGC_ : 1; // is Pen GC valid - BOOL bFontGC_ : 1; // is Font GC valid - BOOL bBrushGC_ : 1; // is Brush GC valid - BOOL bMonoGC_ : 1; // is Mono GC valid - BOOL bCopyGC_ : 1; // is Copy GC valid - BOOL bInvertGC_ : 1; // is Invert GC valid - BOOL bInvert50GC_ : 1; // is Invert50 GC valid - BOOL bStippleGC_ : 1; // is Stipple GC valid - BOOL bTrackingGC_ : 1; // is Tracking GC valid + sal_Bool bWindow_ : 1; // is Window + sal_Bool bPrinter_ : 1; // is Printer + sal_Bool bVirDev_ : 1; // is VirDev + sal_Bool bPenGC_ : 1; // is Pen GC valid + sal_Bool bFontGC_ : 1; // is Font GC valid + sal_Bool bBrushGC_ : 1; // is Brush GC valid + sal_Bool bMonoGC_ : 1; // is Mono GC valid + sal_Bool bCopyGC_ : 1; // is Copy GC valid + sal_Bool bInvertGC_ : 1; // is Invert GC valid + sal_Bool bInvert50GC_ : 1; // is Invert50 GC valid + sal_Bool bStippleGC_ : 1; // is Stipple GC valid + sal_Bool bTrackingGC_ : 1; // is Tracking GC valid bool bXORMode_ : 1; // is ROP XOR Mode set - BOOL bDitherBrush_ : 1; // is solid or tile + sal_Bool bDitherBrush_ : 1; // is solid or tile + using SalGraphics::SetClipRegion; void SetClipRegion( GC pGC, XLIB_Region pXReg = NULL ) const; @@ -148,12 +145,12 @@ protected: unsigned long nMask = GCGraphicsExposures ); GC SelectPen(); GC SelectBrush(); - void DrawLines( ULONG nPoints, + void DrawLines( sal_uIntPtr nPoints, const SalPolyLine &rPoints, GC pGC, bool bClose ); - BOOL GetDitherPixmap ( SalColor nSalColor ); + sal_Bool GetDitherPixmap ( SalColor nSalColor ); inline GC GetMonoGC( Pixmap hPixmap ); inline GC GetCopyGC(); @@ -186,7 +183,7 @@ protected: const SalBitmap &rTransparentBitmap, SalColor nTransparentColor ); - GC SelectFont(); + GC GetFontGC(); bool setFont( const ImplFontSelectData* pEntry, int nFallbackLevel ); void drawMaskedBitmap( const SalTwoRect* pPosAry, @@ -194,9 +191,6 @@ protected: const SalBitmap& rTransparentBitmap ); protected: - void DrawStringUCS2MB( ExtendedFontStruct& rFont, const Point&, - const sal_Unicode* pStr, int nLength ); - void DrawPrinterString( const SalLayout& ); void DrawServerFontString( const ServerFontLayout& ); @@ -231,15 +225,12 @@ public: // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); - virtual USHORT GetBitCount() const; + virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; virtual long GetGraphicsHeight() const; virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nCount ); - virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); - virtual void EndSetClipRegion(); + virtual bool setClipRegion( const Region& ); virtual void SetLineColor(); virtual void SetLineColor( SalColor nSalColor ); @@ -253,15 +244,15 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ); virtual void SetTextColor( SalColor nSalColor ); - virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); + virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); - virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* ); - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual sal_uLong GetKernPairs( sal_uLong nMaxPairs, ImplKernPairData* ); + virtual const ImplFontCharMap* GetImplFontCharMap() const; virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const; virtual void GetDevFontList( ImplDevFontList* ); virtual void GetDevFontSubstList( OutputDevice* ); virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); - virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, + virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData*, sal_Int32* pGlyphIDs, sal_uInt8* pEncoding, @@ -280,8 +271,8 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); - virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); + virtual sal_Bool GetGlyphBoundRect( long nIndex, Rectangle& ); + virtual sal_Bool GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); virtual void DrawServerFontLayout( const ServerFontLayout& ); virtual bool supportsOperation( OutDevSupportType ) const; @@ -289,9 +280,9 @@ public: virtual void drawPixel( long nX, long nY, SalColor nSalColor ); virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); - void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry, bool bClose ); - virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); + void drawPolyLine( sal_uIntPtr nPoints, const SalPoint* pPtAry, bool bClose ); + virtual void drawPolyLine( sal_uIntPtr nPoints, const SalPoint* pPtAry ); + virtual void drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); @@ -300,16 +291,16 @@ public: virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency ); #if 1 // TODO: remove these obselete methods - virtual sal_Bool drawPolyLineBezier( ULONG nPoints, + virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( ULONG nPoints, + const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, - const BYTE* pFlgAry ); + const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ); + const sal_uInt8* const* pFlgAry ); #endif virtual void copyArea( long nDestX, @@ -318,7 +309,7 @@ public: long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT nFlags ); + sal_uInt16 nFlags ); virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); virtual void drawBitmap( const SalTwoRect* pPosAry, @@ -335,9 +326,9 @@ public: virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); virtual SalColor getPixel( long nX, long nY ); virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ); - virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + virtual void invert( sal_uIntPtr nPoints, const SalPoint* pPtAry, SalInvert nFlags ); - virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); + virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize ); virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, @@ -388,19 +379,8 @@ inline Pixel X11SalGraphics::GetPixel( SalColor nSalColor ) const #ifdef DBG_UTIL #define stderr0( s ) fprintf( stderr, s ) -#define stderr1( s, a ) fprintf( stderr, s, a ) -#define stderr2( s, a, b ) fprintf( stderr, s, a, b ) -#define stderr3( s, a, b, c ) fprintf( stderr, s, a, b, c ) -#define stdass0( b ) (void)( !(b) \ - ? fprintf( stderr, "\"%s\" (%s line %d)\n", \ - #b, __FILE__, __LINE__ ) \ - : 0 ) #else #define stderr0( s ) ; -#define stderr1( s, a ) ; -#define stderr2( s, a, b ) ; -#define stderr3( s, a, b, c ) ; -#define stdass0( b ) ; #endif #endif // _SV_SALGDI_H diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h index 0739902548bd..a571303333b3 100644 --- a/vcl/unx/inc/salinst.h +++ b/vcl/unx/inc/salinst.h @@ -39,7 +39,7 @@ class VCL_DLLPUBLIC SalYieldMutex : public vcl::SolarMutexObject { protected: - ULONG mnCount; + sal_uIntPtr mnCount; oslThreadIdentifier mnThreadId; public: @@ -49,7 +49,7 @@ public: virtual void release(); virtual sal_Bool tryToAcquire(); - ULONG GetAcquireCount() const { return mnCount; } + sal_uIntPtr GetAcquireCount() const { return mnCount; } oslThreadIdentifier GetThreadId() const { return mnThreadId; } }; @@ -67,16 +67,16 @@ public: {} virtual ~X11SalInstance(); - virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uIntPtr nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uIntPtr nStyle ); virtual void DestroyFrame( SalFrame* pFrame ); - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); virtual void DestroyObject( SalObject* pObject ); virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, long nDX, long nDY, - USHORT nBitCount, const SystemGraphicsData *pData = NULL ); + sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ); virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, @@ -97,15 +97,12 @@ public: virtual SalSession* CreateSalSession(); virtual osl::SolarMutex* GetYieldMutex(); - virtual ULONG ReleaseYieldMutex(); - virtual void AcquireYieldMutex( ULONG nCount ); + virtual sal_uIntPtr ReleaseYieldMutex(); + virtual void AcquireYieldMutex( sal_uIntPtr nCount ); + virtual bool CheckYieldMutex(); 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 bool AnyInput( sal_uInt16 nType ); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); diff --git a/vcl/unx/inc/salobj.h b/vcl/unx/inc/salobj.h index 2a09222c365c..577a3675fa3d 100644 --- a/vcl/unx/inc/salobj.h +++ b/vcl/unx/inc/salobj.h @@ -42,16 +42,16 @@ public: SalClipRegion(); ~SalClipRegion(); - void BeginSetClipRegion( ULONG nRects ); + void BeginSetClipRegion( sal_uIntPtr nRects ); void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); XRectangle *EndSetClipRegion() { return ClipRectangleList; } void ResetClipRegion() { numClipRectangles = 0; } - USHORT GetClipRegionType() { + sal_uInt16 GetClipRegionType() { return nClipRegionType; } - void SetClipRegionType( USHORT nType ) { + void SetClipRegionType( sal_uInt16 nType ) { nClipRegionType = nType; } int GetRectangleCount() { return numClipRectangles; } @@ -61,7 +61,7 @@ private: XRectangle* ClipRectangleList; int numClipRectangles; int maxClipRectangles; - USHORT nClipRegionType; + sal_uInt16 nClipRegionType; }; @@ -74,24 +74,24 @@ public: XLIB_Window maSecondary; Colormap maColormap; SalClipRegion maClipRegion; - BOOL mbVisible; + sal_Bool mbVisible; static VCL_DLLPUBLIC long Dispatch( XEvent* pEvent ); - static VCL_DLLPUBLIC X11SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); + static VCL_DLLPUBLIC X11SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); X11SalObject(); virtual ~X11SalObject(); // overload all pure virtual methods virtual void ResetClipRegion(); - virtual USHORT GetClipRegionType(); - virtual void BeginSetClipRegion( ULONG nRects ); + virtual sal_uInt16 GetClipRegionType(); + virtual void BeginSetClipRegion( sal_uIntPtr nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); virtual void EndSetClipRegion(); virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); - virtual void Show( BOOL bVisible ); - virtual void Enable( BOOL nEnable ); + virtual void Show( sal_Bool bVisible ); + virtual void Enable( sal_Bool nEnable ); virtual void GrabFocus(); virtual void SetBackground(); @@ -99,6 +99,7 @@ public: virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h index 97776d931f6a..b39a4034fa4b 100644 --- a/vcl/unx/inc/salprn.h +++ b/vcl/unx/inc/salprn.h @@ -49,16 +49,16 @@ public: // overload all pure virtual methods virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); - virtual BOOL SetPrinterData( ImplJobSetup* pSetupData ); - virtual BOOL SetData( ULONG nFlags, ImplJobSetup* pSetupData ); + virtual sal_Bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); + virtual sal_Bool SetPrinterData( ImplJobSetup* pSetupData ); + virtual sal_Bool SetData( sal_uIntPtr nFlags, ImplJobSetup* pSetupData ); virtual void GetPageInfo( const ImplJobSetup* pSetupData, long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ); - virtual ULONG GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ); - virtual ULONG GetPaperBinCount( const ImplJobSetup* pSetupData ); - virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); + virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ); + virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ); + virtual String GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ); virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); }; @@ -72,11 +72,12 @@ public: bool m_bFax:1; bool m_bPdf:1; bool m_bSwallowFaxNo:1; + bool m_bIsPDFWriterJob:1; PspGraphics* m_pGraphics; psp::PrinterJob m_aPrintJob; psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; - ULONG m_nCopies; + sal_uIntPtr m_nCopies; bool m_bCollate; SalInfoPrinter* m_pInfoPrinter; @@ -85,18 +86,23 @@ public: // overload all pure virtual methods using SalPrinter::StartJob; - virtual BOOL StartJob( const XubString* pFileName, + virtual sal_Bool StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, + sal_uIntPtr nCopies, bool bCollate, bool bDirect, ImplJobSetup* pSetupData ); - virtual BOOL EndJob(); - virtual BOOL AbortJob(); - virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ); - virtual BOOL EndPage(); - virtual ULONG GetErrorCode(); + virtual sal_Bool StartJob( const String*, + const String&, + const String&, + ImplJobSetup*, + vcl::PrinterController& i_rController ); + virtual sal_Bool EndJob(); + virtual sal_Bool AbortJob(); + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData ); + virtual sal_Bool EndPage(); + virtual sal_uIntPtr GetErrorCode(); }; #endif // _SV_SALPRN_H diff --git a/vcl/unx/inc/saltimer.h b/vcl/unx/inc/saltimer.h index 7442f307c2c7..9820ba32d40c 100644 --- a/vcl/unx/inc/saltimer.h +++ b/vcl/unx/inc/saltimer.h @@ -38,7 +38,7 @@ public: virtual ~X11SalTimer(); // overload all pure virtual methods - void Start( ULONG nMS ); + void Start( sal_uIntPtr nMS ); void Stop(); }; diff --git a/vcl/unx/inc/salunx.h b/vcl/unx/inc/salunx.h index c0620d812f63..1c331d06b9e8 100644 --- a/vcl/unx/inc/salunx.h +++ b/vcl/unx/inc/salunx.h @@ -70,7 +70,7 @@ inline int operator == ( const timeval &t1, const timeval &t2 ) { if( t1.tv_sec == t2.tv_sec ) return t1.tv_usec == t2.tv_usec; - return FALSE; + return sal_False; } inline timeval &operator -= ( timeval &t1, const timeval &t2 ) @@ -97,7 +97,7 @@ inline timeval &operator += ( timeval &t1, const timeval &t2 ) return t1; } -inline timeval &operator += ( timeval &t1, ULONG t2 ) +inline timeval &operator += ( timeval &t1, sal_uIntPtr t2 ) { t1.tv_sec += t2 / 1000; t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500; @@ -115,7 +115,7 @@ inline timeval operator + ( const timeval &t1, const timeval &t2 ) return t0 += t2; } -inline timeval operator + ( const timeval &t1, ULONG t2 ) +inline timeval operator + ( const timeval &t1, sal_uIntPtr t2 ) { timeval t0 = t1; return t0 += t2; diff --git a/vcl/unx/inc/salvd.h b/vcl/unx/inc/salvd.h index e1c2b91d1627..9add5c261bbd 100644 --- a/vcl/unx/inc/salvd.h +++ b/vcl/unx/inc/salvd.h @@ -49,17 +49,17 @@ class X11SalVirtualDevice : public SalVirtualDevice int nDX_; int nDY_; - USHORT nDepth_; - BOOL bGraphics_; // is Graphics used - BOOL bExternPixmap_; + sal_uInt16 nDepth_; + sal_Bool bGraphics_; // is Graphics used + sal_Bool bExternPixmap_; public: X11SalVirtualDevice(); virtual ~X11SalVirtualDevice(); - BOOL Init( SalDisplay *pDisplay, + sal_Bool Init( SalDisplay *pDisplay, long nDX, long nDY, - USHORT nBitCount, + sal_uInt16 nBitCount, int nScreen, Pixmap hDrawable = None, XRenderPictFormat* pXRenderFormat = NULL ); @@ -67,9 +67,9 @@ public: inline Display *GetXDisplay() const; inline SalDisplay *GetDisplay() const; - inline BOOL IsDisplay() const; + inline sal_Bool IsDisplay() const; inline Pixmap GetDrawable() const { return hDrawable_; } - inline USHORT GetDepth() const { return nDepth_; } + inline sal_uInt16 GetDepth() const { return nDepth_; } int GetWidth() const { return nDX_; } int GetHeight() const { return nDY_; } int GetScreenNumber() const { return m_nScreen; } @@ -78,7 +78,7 @@ public: virtual void ReleaseGraphics( SalGraphics* pGraphics ); // Set new size, without saving the old contents - virtual BOOL SetSize( long nNewDX, long nNewDY ); + virtual sal_Bool SetSize( long nNewDX, long nNewDY ); virtual void GetSize( long& rWidth, long& rHeight ); }; @@ -93,7 +93,7 @@ inline Display *X11SalVirtualDevice::GetXDisplay() const inline SalDisplay *X11SalVirtualDevice::GetDisplay() const { return pDisplay_; } -inline BOOL X11SalVirtualDevice::IsDisplay() const +inline sal_Bool X11SalVirtualDevice::IsDisplay() const { return pDisplay_->IsDisplay(); } #endif diff --git a/vcl/unx/inc/soicon.hxx b/vcl/unx/inc/soicon.hxx index bf1810640b54..cb3302cb777b 100644 --- a/vcl/unx/inc/soicon.hxx +++ b/vcl/unx/inc/soicon.hxx @@ -32,8 +32,8 @@ class SalDisplay; class SalBitmap; class Bitmap; -BOOL SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen, - USHORT nIcon, USHORT iconSize, +sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen, + sal_uInt16 nIcon, sal_uInt16 iconSize, Pixmap& icon_pixmap, Pixmap& icon_mask ); #endif diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index 23235e479e75..c6ef6d98bca8 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -164,6 +164,8 @@ protected: bool m_bLegacyPartialFullscreen; int m_nWinGravity; int m_nInitWinGravity; + bool m_bWMshouldSwitchWorkspace; + bool m_bWMshouldSwitchWorkspaceInit; WMAdaptor( SalDisplay * ) ; @@ -176,6 +178,7 @@ protected: */ virtual bool isValid() const; + bool getWMshouldSwitchWorkspace() const; public: virtual ~WMAdaptor(); @@ -213,8 +216,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/inc/xfont.hxx b/vcl/unx/inc/xfont.hxx deleted file mode 100644 index 8fc118808ae3..000000000000 --- a/vcl/unx/inc/xfont.hxx +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENDED_FONTSTRUCT_HXX -#define EXTENDED_FONTSTRUCT_HXX - -#ifndef _XLIB_H_ -#include <tools/prex.h> -#include <X11/Xlib.h> -#include <tools/postx.h> -#endif -#include <tools/ref.hxx> -#include <rtl/tencinfo.h> -#include <vcl/vclenum.hxx> -#include <vcl/sallayout.hxx> - -typedef unsigned short sal_MultiByte; - -class ImplFontMetricData; -class ExtendedXlfd; - -struct VerticalTextItem -{ - BOOL mbFixed; - XFontStruct* mpXFontStruct; - const sal_Unicode* mpString; - int mnLength; - int mnTransX; - int mnTransY; - int mnFixedAdvance; - int* mpAdvanceAry; - - VerticalTextItem( XFontStruct* pXFontStruct, - const sal_Unicode* pString, - int nLength, - int nTransX, - int nTransY, - int nFixedAdvance ) - : mbFixed( TRUE ), - mpXFontStruct( pXFontStruct ), - mpString( pString ), - mnLength( nLength ), - mnTransX( nTransX ), - mnTransY( nTransY ), - mnFixedAdvance( nFixedAdvance ) - {} - - VerticalTextItem( XFontStruct* pXFontStruct, - const sal_Unicode* pString, - int nLength, - int nTransX, - int nTransY, - int* pAdvanceAry ) - : mbFixed( FALSE ), - mpXFontStruct( pXFontStruct ), - mpString( pString ), - mnLength( nLength ), - mnTransX( nTransX ), - mnTransY( nTransY ), - mpAdvanceAry( pAdvanceAry ) - {} - - ~VerticalTextItem() - { - if (!mbFixed) - { - delete( mpAdvanceAry ); - } - } -}; - -class ExtendedFontStruct : public SvRefBase -{ - private: - Display* mpDisplay; - Size maPixelSize; - float mfXScale; - float mfYScale; - sal_Size mnDefaultWidth; - sal_Bool mbVertical; - rtl_TextEncoding mnCachedEncoding; - rtl_TextEncoding mnAsciiEncoding; - - ExtendedXlfd* mpXlfd; - XFontStruct** mpXFontStruct; - - // unicode range cache - mutable sal_uInt32* mpRangeCodes; - mutable int mnRangeCount; - - int LoadEncoding( rtl_TextEncoding nEncoding ); - FontPitch GetSpacing( rtl_TextEncoding nEncoding ); - bool GetFontBoundingBox( XCharStruct *pCharStruct, - int *pAscent, int *pDescent ) ; - - sal_Size GetDefaultWidth(); - sal_Size GetCharWidth8( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32 *pWidthArray, - rtl_TextEncoding nEncoding ); - sal_Size GetCharWidthUTF16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32 *pWidthArray ); - sal_Size GetCharWidth16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32 *pWidthArray, ExtendedFontStruct *pFallback ); - public: - ExtendedFontStruct( Display* pDisplay, - const Size& rPixelSize, sal_Bool bVertical, - ExtendedXlfd* pXlfd ); - ~ExtendedFontStruct(); - bool Match( const ExtendedXlfd *pXlfd, - const Size& rPixelSize, sal_Bool bVertical ) const; - XFontStruct* GetFontStruct( rtl_TextEncoding nEncoding ); - XFontStruct* GetFontStruct( sal_Unicode nChar, - rtl_TextEncoding *pEncoding ); - bool ToImplFontMetricData( ImplFontMetricData *pMetric ); - rtl_TextEncoding GetAsciiEncoding( int *pAsciiRange = NULL ) const; - sal_Size GetCharWidth( sal_Unicode, - sal_Int32* pPhysWidth, sal_Int32* pLogWidth ); - int GetFontCodeRanges( sal_uInt32* pCodePairs ) const; - bool HasUnicodeChar( sal_Unicode ) const; -}; - -// Declaration and Implementation for ExtendedFontStructRef: Add RefCounting -// to ExtendedFontStruct (it's not possible to separate decl and impl into -// a separate source file: all ref member functions are inline -SV_DECL_IMPL_REF( ExtendedFontStruct ); - -class X11FontLayout : public GenericSalLayout -{ -public: - X11FontLayout( ExtendedFontStruct& ); - virtual bool LayoutText( ImplLayoutArgs& ); - virtual void AdjustLayout( ImplLayoutArgs& ); - virtual void DrawText( SalGraphics& ) const; - -private: - ExtendedFontStruct& mrFont; -}; - -#endif /* EXTENDED_FONTSTRUCT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 881f63db1ffc..b87e7a0aea5b 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -30,7 +30,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALDATA_CXX -#include <shell/kde_headers.h> +#include <kde_headers.h> #include <unistd.h> #include <fcntl.h> @@ -135,7 +135,7 @@ void KDEXLib::Init() "http://artax.karlin.mff.cuni.cz/~kendy" ); m_nFakeCmdLineArgs = 1; - USHORT nIdx; + sal_uInt16 nIdx; int nParams = osl_getCommandArgCount(); rtl::OString aDisplay; rtl::OUString aParam, aBin; diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 0c7e66ff5282..bf080084ed5b 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -30,7 +30,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALNATIVEWIDGETS_KDE_CXX -#include <shell/kde_headers.h> +#include <kde_headers.h> #include <salunx.h> #include <saldata.hxx> @@ -239,7 +239,7 @@ class WidgetPainter @param gc The graphics context. */ - BOOL drawStyledWidget( QWidget *pWidget, + sal_Bool drawStyledWidget( QWidget *pWidget, ControlState nState, const ImplControlValue& aValue, Display *dpy, XLIB_Window drawable, int nScreen, int nDepth, GC gc, ControlPart nPart = PART_ENTIRE_CONTROL ); @@ -252,7 +252,7 @@ class WidgetPainter @return valid push button. */ - QPushButton *pushButton( const Rectangle& rControlRegion, BOOL bDefault ); + QPushButton *pushButton( const Rectangle& rControlRegion, sal_Bool bDefault ); /** 'Get' method for radio button. @@ -273,7 +273,7 @@ class WidgetPainter @see pushButton(), m_pEditableComboBox */ - QComboBox *comboBox( const Rectangle& rControlRegion, BOOL bEditable ); + QComboBox *comboBox( const Rectangle& rControlRegion, sal_Bool bEditable ); /** 'Get' method for line edit box. @@ -310,13 +310,13 @@ class WidgetPainter @see pushButton() */ QScrollBar *scrollBar( const Rectangle& rControlRegion, - BOOL bHorizontal, const ImplControlValue& aValue ); + sal_Bool bHorizontal, const ImplControlValue& aValue ); /** 'Get' method for tool bar. @see pushButton() */ - QToolBar *toolBar( const Rectangle& rControlRegion, BOOL bHorizontal ); + QToolBar *toolBar( const Rectangle& rControlRegion, sal_Bool bHorizontal ); /** 'Get' method for tool button. @@ -431,13 +431,13 @@ WidgetPainter::~WidgetPainter( void ) delete m_pProgressBar, m_pProgressBar = NULL; } -BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, +sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget, ControlState nState, const ImplControlValue& aValue, Display *dpy, XLIB_Window drawable, int nScreen, int nDepth, GC gc, ControlPart nPart ) { if ( !pWidget ) - return FALSE; + return sal_False; // Normalize the widget QPoint qWidgetPos( pWidget->pos() ); @@ -592,7 +592,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, pTab = m_pTabMiddle; } if ( !pTab ) - return FALSE; + return sal_False; pTab->setRect( qRect ); @@ -780,7 +780,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, pWidget->colorGroup(), nStyle ); } else - return FALSE; + return sal_False; // Bitblt it to the screen X11SalGraphics::CopyScreenArea( dpy, @@ -793,11 +793,11 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, // Restore widget's position pWidget->move( qWidgetPos ); - return TRUE; + return sal_True; } QPushButton *WidgetPainter::pushButton( const Rectangle& rControlRegion, - BOOL bDefault ) + sal_Bool bDefault ) { if ( !m_pPushButton ) m_pPushButton = new QPushButton( NULL, "push_button" ); @@ -892,7 +892,7 @@ QCheckBox *WidgetPainter::checkBox( const Rectangle& rControlRegion ) } QComboBox *WidgetPainter::comboBox( const Rectangle& rControlRegion, - BOOL bEditable ) + sal_Bool bEditable ) { QComboBox *pComboBox = NULL; if ( bEditable ) @@ -1005,7 +1005,7 @@ QListView *WidgetPainter::listView( const Rectangle& rControlRegion ) } QScrollBar *WidgetPainter::scrollBar( const Rectangle& rControlRegion, - BOOL bHorizontal, const ImplControlValue& aValue ) + sal_Bool bHorizontal, const ImplControlValue& aValue ) { if ( !m_pScrollBar ) { @@ -1032,7 +1032,7 @@ QScrollBar *WidgetPainter::scrollBar( const Rectangle& rControlRegion, return m_pScrollBar; } -QToolBar *WidgetPainter::toolBar( const Rectangle& rControlRegion, BOOL bHorizontal ) +QToolBar *WidgetPainter::toolBar( const Rectangle& rControlRegion, sal_Bool bHorizontal ) { if ( !m_pMainWindow ) m_pMainWindow = new QMainWindow( NULL, "main_window" ); @@ -1173,19 +1173,19 @@ class KDESalGraphics : public X11SalGraphics public: KDESalGraphics() {} virtual ~KDESalGraphics() {} - virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, + virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ); + virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, - BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, + sal_Bool& rIsInside ); + virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, + virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, + virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, @@ -1200,10 +1200,10 @@ class KDESalGraphics : public X11SalGraphics @param nPart Specification of the widget's part if it consists of more than one. - @return TRUE if the platform supports native drawing of the widget nType + @return sal_True if the platform supports native drawing of the widget nType defined by nPart. */ -BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +sal_Bool KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { return ( (nType == CTRL_PUSHBUTTON) && (nPart == PART_ENTIRE_CONTROL) ) || @@ -1235,21 +1235,21 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP /** Test whether the position is in the native widget. - If the return value is TRUE, bIsInside contains information whether + If the return value is sal_True, bIsInside contains information whether aPos was or was not inside the native widget specified by the nType/nPart combination. */ -BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, +sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& rPos, - BOOL& rIsInside ) + sal_Bool& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { // make position relative to rControlRegion Point aPos = rPos - rControlRegion.TopLeft(); - rIsInside = FALSE; + rIsInside = sal_False; - BOOL bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT ); + sal_Bool bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT ); QScrollBar *pScrollBar = pWidgetPainter->scrollBar( rControlRegion, bHorizontal, ImplControlValue() ); @@ -1259,10 +1259,10 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarAddLine ); // There are 2 buttons on the right/bottom side of the scrollbar - BOOL bTwoSubButtons = FALSE; + sal_Bool bTwoSubButtons = sal_False; // It is a Platinum style scroll bar - BOOL bPlatinumStyle = FALSE; + sal_Bool bPlatinumStyle = sal_False; // Workaround for Platinum and 3 button style scroll bars. // It makes the right/down button bigger. @@ -1272,9 +1272,9 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarAddPage ).right() + 1 ); if ( qRectAddLine.width() > qRectSubLine.width() ) - bTwoSubButtons = TRUE; + bTwoSubButtons = sal_True; if ( qRectSubLine.left() > kapp->style().querySubControlMetrics( QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarSubPage ).left() ) - bPlatinumStyle = TRUE; + bPlatinumStyle = sal_True; } else { @@ -1282,16 +1282,16 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarAddPage ).bottom() + 1 ); if ( qRectAddLine.height() > qRectSubLine.height() ) - bTwoSubButtons = TRUE; + bTwoSubButtons = sal_True; if ( qRectSubLine.top() > kapp->style().querySubControlMetrics( QStyle::CC_ScrollBar, pScrollBar, QStyle::SC_ScrollBarSubPage ).top() ) - bPlatinumStyle = TRUE; + bPlatinumStyle = sal_True; } switch ( nPart ) { case PART_BUTTON_LEFT: if ( !bPlatinumStyle && qRectSubLine.contains( aPos.getX(), aPos.getY() ) ) - rIsInside = TRUE; + rIsInside = sal_True; else if ( bTwoSubButtons ) { qRectAddLine.setWidth( qRectAddLine.width() / 2 ); @@ -1301,7 +1301,7 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, case PART_BUTTON_UP: if ( !bPlatinumStyle && qRectSubLine.contains( aPos.getX(), aPos.getY() ) ) - rIsInside = TRUE; + rIsInside = sal_True; else if ( bTwoSubButtons ) { qRectAddLine.setHeight( qRectAddLine.height() / 2 ); @@ -1325,13 +1325,13 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, // cases PART_TRACK_HORZ_AREA and PART_TRACK_VERT_AREA default: - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -1346,12 +1346,12 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, @param aCaption A caption or title string (like button text etc.) */ -BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, +sal_Bool KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& ) { - BOOL bReturn = FALSE; + sal_Bool bReturn = sal_False; Display *dpy = GetXDisplay(); XLIB_Window drawable = GetDrawable(); @@ -1381,7 +1381,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, else if ( (nType == CTRL_COMBOBOX) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( - pWidgetPainter->comboBox( rControlRegion, TRUE ), + pWidgetPainter->comboBox( rControlRegion, sal_True ), nState, aValue, dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc ); } @@ -1395,7 +1395,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, else if ( (nType == CTRL_LISTBOX) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( - pWidgetPainter->comboBox( rControlRegion, FALSE ), + pWidgetPainter->comboBox( rControlRegion, sal_False ), nState, aValue, dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc ); } @@ -1488,17 +1488,17 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, @param aCaption A caption or title string (like button text etc.) */ -BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, +sal_Bool KDESalGraphics::drawNativeControlText( ControlType, ControlPart, const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) { - return FALSE; + return sal_False; } /** Check if the bounding regions match. - If the return value is TRUE, rNativeBoundingRegion + If the return value is sal_True, rNativeBoundingRegion contains the true bounding region covered by the control including any adornment, while rNativeContentRegion contains the area within the control that can be safely drawn into without drawing over @@ -1513,13 +1513,13 @@ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, @param aCaption A caption or title string (like button text etc.) */ -BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, +sal_Bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue&, const OUString&, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { - BOOL bReturn = FALSE; + sal_Bool bReturn = sal_False; QRect qBoundingRect = WidgetPainter::region2QRect( rControlRegion ); QRect qRect; @@ -1541,7 +1541,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar QStyle::PM_ButtonDefaultIndicator, pWidget ); qBoundingRect.addCoords( -nIndicatorSize, -nIndicatorSize, nIndicatorSize, nIndicatorSize ); - bReturn = TRUE; + bReturn = sal_True; } break; } @@ -1556,7 +1556,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar qRect.setWidth( kapp->style().pixelMetric( QStyle::PM_ExclusiveIndicatorWidth, pWidget ) ); qRect.setHeight( kapp->style().pixelMetric( QStyle::PM_ExclusiveIndicatorHeight, pWidget ) ); - bReturn = TRUE; + bReturn = sal_True; } break; @@ -1569,7 +1569,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar qRect.setWidth( kapp->style().pixelMetric( QStyle::PM_IndicatorWidth, pWidget ) ); qRect.setHeight( kapp->style().pixelMetric( QStyle::PM_IndicatorHeight, pWidget ) ); - bReturn = TRUE; + bReturn = sal_True; } break; @@ -1586,14 +1586,14 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar QStyle::CC_ComboBox, pWidget, QStyle::SC_ComboBoxEditField ).right() + 1 ); qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); - bReturn = TRUE; + bReturn = sal_True; break; case PART_SUB_EDIT: qRect = kapp->style().querySubControlMetrics( QStyle::CC_ComboBox, pWidget, QStyle::SC_ComboBoxEditField ); qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); - bReturn = TRUE; + bReturn = sal_True; break; } break; @@ -1606,14 +1606,14 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar case PART_BUTTON_UP: qRect = kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget, pWidget, QStyle::SC_SpinWidgetUp ); - bReturn = TRUE; + bReturn = sal_True; qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); break; case PART_BUTTON_DOWN: qRect = kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget, pWidget, QStyle::SC_SpinWidgetDown ); - bReturn = TRUE; + bReturn = sal_True; qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); break; @@ -1621,7 +1621,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar qRect = kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget, pWidget, QStyle::SC_SpinWidgetEditField ); qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); - bReturn = TRUE; + bReturn = sal_True; break; } break; @@ -1663,7 +1663,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); - bReturn = TRUE; + bReturn = sal_True; break; case PART_BUTTON_RIGHT: @@ -1684,7 +1684,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar qRect.moveBy( qBoundingRect.left(), qBoundingRect.top() ); - bReturn = TRUE; + bReturn = sal_True; break; } break; @@ -1711,12 +1711,12 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar // KDESalFrame implementation // ----------------------------------------------------------------------- -KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nStyle ) : +KDESalFrame::KDESalFrame( SalFrame* pParent, sal_uLong nStyle ) : X11SalFrame( pParent, nStyle ) { } -void KDESalFrame::Show( BOOL bVisible, BOOL bNoActivate ) +void KDESalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) { if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) ) { @@ -1931,9 +1931,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) { Color aColor2 = aStyleSettings.GetLightColor(); aStyleSettings. - SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2), - (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2), - (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2) + SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), + (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), + (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) ) ); } @@ -1968,7 +1968,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) qMainWindow.createGUI( "/dev/null" ); // hack // Menu - aStyleSettings.SetSkipDisabledInMenus( TRUE ); + aStyleSettings.SetSkipDisabledInMenus( sal_True ); KMenuBar *pMenuBar = qMainWindow.menuBar(); if ( pMenuBar ) { @@ -2089,7 +2089,7 @@ KDESalFrame::GraphicsHolder::~GraphicsHolder() // ----------------------------------------------------------------------- SalFrame * -KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nStyle ) +KDESalInstance::CreateFrame( SalFrame *pParent, sal_uLong nStyle ) { return new KDESalFrame( pParent, nStyle ); } diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 107a2a2757b8..4aac0e144af0 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -57,7 +57,7 @@ #include <stdio.h> #endif -KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) : +KDESalFrame::KDESalFrame( SalFrame* pParent, sal_uLong nState ) : X11SalFrame( pParent, nState ) { } @@ -275,9 +275,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) { Color aColor2 = style.GetLightColor(); style. - SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2), - (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2), - (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2) + SetCheckedColor( Color( (BYTE)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), + (BYTE)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), + (BYTE)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) ) ); } diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx index 2d9c7f8a7aa0..0ee879f044d4 100644 --- a/vcl/unx/kde4/KDESalFrame.hxx +++ b/vcl/unx/kde4/KDESalFrame.hxx @@ -48,7 +48,7 @@ class KDESalFrame : public X11SalFrame GraphicsHolder m_aGraphics[ nMaxGraphics ]; public: - KDESalFrame( SalFrame* pParent, ULONG nStyle ); + KDESalFrame( SalFrame* pParent, sal_uLong nStyle ); virtual ~KDESalFrame(); virtual SalGraphics* GetGraphics(); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 1a0e547ead04..26c104c90262 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -859,7 +859,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, if( part == PART_BORDER ) { int nFrameWidth = getFrameWidth(); - USHORT nStyle = val.getNumericVal(); + sal_uInt16 nStyle = val.getNumericVal(); if( nStyle & FRAME_DRAW_NODRAW ) { // in this case the question is: how thick would a frame be diff --git a/vcl/unx/kde4/KDESalInstance.cxx b/vcl/unx/kde4/KDESalInstance.cxx index 302d20ca9bc4..c63d328e29c3 100644 --- a/vcl/unx/kde4/KDESalInstance.cxx +++ b/vcl/unx/kde4/KDESalInstance.cxx @@ -30,7 +30,7 @@ #include "KDESalFrame.hxx" -SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState ) +SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, sal_uLong nState ) { return new KDESalFrame( pParent, nState ); } diff --git a/vcl/unx/kde4/KDESalInstance.hxx b/vcl/unx/kde4/KDESalInstance.hxx index c42fea68ddcf..9f35557061bb 100644 --- a/vcl/unx/kde4/KDESalInstance.hxx +++ b/vcl/unx/kde4/KDESalInstance.hxx @@ -38,7 +38,7 @@ class KDESalInstance : public X11SalInstance public: KDESalInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) {} virtual ~KDESalInstance() {} - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 13c39528b3ae..ce4ea14dadb5 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -131,7 +131,7 @@ void KDEXLib::Init() //kAboutData->setProgramIconName("OpenOffice"); m_nFakeCmdLineArgs = 2; - USHORT nIdx; + sal_uInt16 nIdx; int nParams = osl_getCommandArgCount(); rtl::OString aDisplay; @@ -345,7 +345,7 @@ bool KDEXLib::processYield( bool bWait, bool bHandleAllCurrentEvents ) return wasEvent; } -void KDEXLib::StartTimer( ULONG nMS ) +void KDEXLib::StartTimer( sal_uLong nMS ) { if( eventLoopType == LibreOfficeEventLoop ) return SalXLib::StartTimer( nMS ); diff --git a/vcl/unx/kde4/KDEXLib.hxx b/vcl/unx/kde4/KDEXLib.hxx index 21a5a45c4628..72848ed4084c 100644 --- a/vcl/unx/kde4/KDEXLib.hxx +++ b/vcl/unx/kde4/KDEXLib.hxx @@ -83,7 +83,7 @@ class KDEXLib : public QObject, public SalXLib virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ); virtual void Remove( int fd ); - virtual void StartTimer( ULONG nMS ); + virtual void StartTimer( sal_uLong nMS ); virtual void StopTimer(); virtual void Wakeup(); virtual void PostUserEvent(); diff --git a/vcl/unx/source/app/i18n_cb.cxx b/vcl/unx/source/app/i18n_cb.cxx index f8f4f57da043..fbbb6eeabbf1 100644 --- a/vcl/unx/source/app/i18n_cb.cxx +++ b/vcl/unx/source/app/i18n_cb.cxx @@ -282,12 +282,12 @@ Preedit_UpdateAttributes ( preedit_text_t* ptext, XIMFeedback* feedback, // Convert the XIM feedback values into appropriate VCL // SAL_EXTTEXTINPUT_ATTR values // returns an allocate list of attributes, which must be freed by caller -USHORT* -Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<USHORT>& rSalAttr ) +sal_uInt16* +Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<sal_uInt16>& rSalAttr ) { - USHORT *psalattr; - USHORT nval; - USHORT noldval = 0; + sal_uInt16 *psalattr; + sal_uInt16 nval; + sal_uInt16 noldval = 0; XIMFeedback nfeedback; // only work with reasonable length @@ -297,7 +297,7 @@ Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<USHORT> psalattr = &rSalAttr[0]; } else - return (USHORT*)NULL; + return (sal_uInt16*)NULL; for (int npos = 0; npos < nlength; npos++) { diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx index fc43e7b81d0b..9b30ba6a6546 100644 --- a/vcl/unx/source/app/i18n_ic.cxx +++ b/vcl/unx/source/app/i18n_ic.cxx @@ -184,7 +184,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : maClientData.aInputEv.mnCursorPos = 0; maClientData.aInputEv.mnDeltaStart = 0; maClientData.aInputEv.mnCursorFlags = 0; - maClientData.aInputEv.mbOnlyCursor = FALSE; + maClientData.aInputEv.mbOnlyCursor = sal_False; SalI18N_InputMethod *pInputMethod; pInputMethod = GetX11SalData()->GetDisplay()->GetInputMethod(); @@ -760,7 +760,7 @@ SalI18N_InputContext::SetLanguage(LanguageType) } void -SalI18N_InputContext::EndExtTextInput( USHORT /*nFlags*/ ) +SalI18N_InputContext::EndExtTextInput( sal_uInt16 /*nFlags*/ ) { if ( mbUseable && (maContext != NULL) && maClientData.pFrame ) { diff --git a/vcl/unx/source/app/i18n_status.cxx b/vcl/unx/source/app/i18n_status.cxx index b609081cc68c..bfea280dc687 100644 --- a/vcl/unx/source/app/i18n_status.cxx +++ b/vcl/unx/source/app/i18n_status.cxx @@ -102,7 +102,7 @@ class XIMStatusWindow : public StatusWindow // for delayed showing bool m_bDelayedShow; I18NStatus::ShowReason m_eDelayedReason; - ULONG m_nDelayedEvent; + sal_uLong m_nDelayedEvent; // for toggling bool m_bOn; @@ -165,7 +165,7 @@ void XIMStatusWindow::layout() m_aStatusText.SetPosSizePixel( Point( 1, 1 ), aControlSize ); m_aStatusText.SetFont( aFont ); - m_aStatusText.Show( TRUE ); + m_aStatusText.Show( sal_True ); if (m_bAnchoredAtRight && IsVisible()) { @@ -257,7 +257,7 @@ void XIMStatusWindow::setPosition( SalFrame* pParent ) { setText( String() ); m_pLastParent = pParent; - Show( FALSE, SHOW_NOACTIVATE ); + Show( sal_False, SHOW_NOACTIVATE ); } if( IsVisible() ) { @@ -359,7 +359,7 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) : m_aStatusBtn.SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) ); m_aStatusBtn.SetPopupMenu( &m_aMenu ); - m_aStatusBtn.Show( TRUE ); + m_aStatusBtn.Show( sal_True ); const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() ); int i = 1; @@ -384,7 +384,7 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) : else fprintf( stderr, "Warning: could not reposition status window since no frame\n" ); #endif - EnableAlwaysOnTop( TRUE ); + EnableAlwaysOnTop( sal_True ); } IIIMPStatusWindow::~IIIMPStatusWindow() diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx index c2dcb090cfc4..d8d54ddcc081 100644 --- a/vcl/unx/source/app/saldata.cxx +++ b/vcl/unx/source/app/saldata.cxx @@ -410,7 +410,7 @@ void SalXLib::Init() sal_uInt32 nParams = osl_getCommandArgCount(); rtl::OUString aParam; rtl::OString aDisplay; - for (USHORT i=0; i<nParams; i++) + for (sal_uInt16 i=0; i<nParams; i++) { osl_getCommandArg(i, &aParam.pData); if (aParam.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("-display"))) @@ -427,8 +427,8 @@ void SalXLib::Init() * the clipboard build another connection * to the xserver using $DISPLAY */ - rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DISPLAY")); - osl_setEnvironment(envVar.pData, aParam.pData); + rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DISPLAY")); + osl_setEnvironment(envVar.pData, aParam.pData); } break; } diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 4bc379846edf..3ba82446c13e 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -213,7 +213,7 @@ static int sal_significantBits( Pixel nMask ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -static BOOL sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) +static sal_Bool sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) { int nInfos; XVisualInfo aTemplate; @@ -223,25 +223,25 @@ static BOOL sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) pInfos = XGetVisualInfo( pDisplay, VisualIDMask, &aTemplate, &nInfos ); if( !pInfos ) - return FALSE; + return sal_False; rVI = *pInfos; XFree( pInfos ); DBG_ASSERT( rVI.visualid == nVID, "sal_GetVisualInfo: could not get correct visual by visualId" ); - return TRUE; + return sal_True; } // --------------------------------------------------------------------------- // check wether displaystring is in format N.M or N. or just N // with N and M beeing natural numbers -static BOOL +static sal_Bool sal_IsDisplayNumber( const char *pDisplayString ) { if ( ! isdigit(*pDisplayString) ) - return FALSE; + return sal_False; while ( isdigit(*(++pDisplayString)) ) ; /* do nothing */ @@ -255,12 +255,12 @@ sal_IsDisplayNumber( const char *pDisplayString ) } // check whether host1 and host2 point to the same ip address -static BOOL +static sal_Bool sal_EqualHosts( const OUString& Host1, const OUString& Host2) { oslSocketAddr pHostAddr1; oslSocketAddr pHostAddr2; - BOOL bEqualAddress = FALSE; + sal_Bool bEqualAddress = sal_False; if ( Host1.toChar() >= '0' && Host1.toChar() <= '9' ) pHostAddr1 = osl_createInetSocketAddr( Host1.pData, 0 ); @@ -273,7 +273,7 @@ sal_EqualHosts( const OUString& Host1, const OUString& Host2) pHostAddr2 = osl_resolveHostname( Host2.pData ); if( pHostAddr1 && pHostAddr2 ) - bEqualAddress = osl_isEqualSocketAddr( pHostAddr1, pHostAddr2 ) ? TRUE : FALSE; + bEqualAddress = osl_isEqualSocketAddr( pHostAddr1, pHostAddr2 ) ? sal_True : sal_False; if( pHostAddr1 ) osl_destroySocketAddr( pHostAddr1 ); @@ -283,14 +283,14 @@ sal_EqualHosts( const OUString& Host1, const OUString& Host2) return bEqualAddress; } -static BOOL +static sal_Bool sal_IsLocalDisplay( Display *pDisplay ) { const char *pDisplayString = DisplayString( pDisplay ); // no string, no idea if ( pDisplayString == NULL || pDisplayString[ 0 ] == '\0') - return FALSE; + return sal_False; // check for ":x.y" if ( pDisplayString[ 0 ] == ':' ) @@ -314,7 +314,7 @@ sal_IsLocalDisplay( Display *pDisplay ) // compare local hostname to displaystring, both may be ip address or // hostname - BOOL bEqual = FALSE; + sal_Bool bEqual = sal_False; char *pDisplayHost = strdup( pDisplayString ); char *pPtr = strrchr( pDisplayHost, ':' ); @@ -339,14 +339,14 @@ sal_IsLocalDisplay( Display *pDisplay ) // since it is not called very often and sal_IsLocalDisplay() is relative // expensive bLocal_ is initialized on first call -BOOL SalDisplay::IsLocal() +sal_Bool SalDisplay::IsLocal() { if ( ! mbLocalIsValid ) { bLocal_ = sal_IsLocalDisplay( pDisp_ ); - mbLocalIsValid = TRUE; + mbLocalIsValid = sal_True; } - return (BOOL)bLocal_; + return (sal_Bool)bLocal_; } // --------------------------------------------------------------------------- @@ -375,11 +375,6 @@ sal_GetServerVendor( Display *p_display ) { vendor_none, NULL, 0 }, }; -#ifdef _USE_PRINT_EXTENSION_ - if ( ! XSalIsDisplay( p_display ) ) - return vendor_xprinter; -#endif - // handle regular server vendors char *p_name = ServerVendor( p_display ); vendor_t *p_vendor; @@ -411,7 +406,7 @@ static sal_Bool sal_IsTrustedSolaris (Display *p_display) // -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL SalDisplay::BestVisual( Display *pDisplay, +sal_Bool SalDisplay::BestVisual( Display *pDisplay, int nScreen, XVisualInfo &rVI ) { @@ -436,51 +431,51 @@ BOOL SalDisplay::BestVisual( Display *pDisplay, int i; for( i = 0; i < nVisuals; i++ ) { - BOOL bUsable = FALSE; + sal_Bool bUsable = sal_False; int nTrueColor = 1; if ( pVInfos[i].screen != nScreen ) { - bUsable = FALSE; + bUsable = sal_False; } else if( pVInfos[i].c_class == TrueColor ) { nTrueColor = 2048; if( pVInfos[i].depth == 24 ) - bUsable = TRUE; -#ifdef TRUECOLOR8 + bUsable = sal_True; +#ifdef sal_TrueCOLOR8 else if( pVInfos[i].depth == 8 ) { nTrueColor = -1; // strongly discourage 8 bit true color - bUsable = TRUE; + bUsable = sal_True; } #endif -#ifdef TRUECOLOR15 +#ifdef sal_TrueCOLOR15 else if( pVInfos[i].depth == 15 ) - bUsable = TRUE; + bUsable = sal_True; #endif -#ifdef TRUECOLOR16 +#ifdef sal_TrueCOLOR16 else if( pVInfos[i].depth == 16 ) - bUsable = TRUE; + bUsable = sal_True; #endif -#ifdef TRUECOLOR32 +#ifdef sal_TrueCOLOR32 else if( pVInfos[i].depth == 32 ) { nTrueColor = 256; // we do not have use for an alpha channel // better use a 24 or 16 bit truecolor visual if possible - bUsable = TRUE; + bUsable = sal_True; } #endif } else if( pVInfos[i].c_class == PseudoColor ) { if( pVInfos[i].depth <= 8 ) - bUsable = TRUE; + bUsable = sal_True; #ifdef PSEUDOCOLOR12 else if( pVInfos[i].depth == 12 ) - bUsable = TRUE; + bUsable = sal_True; #endif } pWeight[ i ] = bUsable ? nTrueColor*pVInfos[i].depth : -1024; @@ -508,7 +503,6 @@ BOOL SalDisplay::BestVisual( Display *pDisplay, SalDisplay::SalDisplay( Display *display ) : mpInputMethod( NULL ), - mpFallbackFactory ( NULL ), pDisp_( display ), m_pWMAdaptor( NULL ), m_pDtIntegrator( NULL ), @@ -557,7 +551,6 @@ void SalDisplay::doDestruct() m_pDtIntegrator = NULL; X11SalBitmap::ImplDestroyCache(); X11SalGraphics::releaseGlyphPeer(); - DestroyFontCache(); if( IsDisplay() ) { @@ -650,7 +643,7 @@ fd GetSalData()->m_pInstance->GetYieldMutex()->acquire(); pDisplay->Yield(); GetSalData()->m_pInstance->GetYieldMutex()->release(); - return TRUE; + return sal_True; } SalX11Display::SalX11Display( Display *display ) @@ -818,8 +811,6 @@ void SalDisplay::Init() eWindowManager_ = otherwm; nProperties_ = PROPERTY_DEFAULT; hEventGuard_ = NULL; - m_pFontCache = NULL; - mpFontList = (XlfdStorage*)NULL; mpFactory = (AttributeProvider*)NULL; m_pCapture = NULL; m_bXinerama = false; @@ -859,9 +850,9 @@ void SalDisplay::Init() X11SalBitmap::ImplCreateCache(); hEventGuard_ = osl_createMutex(); - bLocal_ = FALSE; /* dont care, initialize later by + bLocal_ = sal_False; /* dont care, initialize later by calling SalDisplay::IsLocal() */ - mbLocalIsValid = FALSE; /* bLocal_ is not yet initialized */ + mbLocalIsValid = sal_False; /* bLocal_ is not yet initialized */ // - - - - - - - - - - Synchronize - - - - - - - - - - - - - if( getenv( "SAL_SYNCHRONIZE" ) ) @@ -1079,7 +1070,7 @@ unsigned int GetKeySymMask(Display* dpy, KeySym nKeySym) } -void SalDisplay::SimulateKeyPress( USHORT nKeyCode ) +void SalDisplay::SimulateKeyPress( sal_uInt16 nKeyCode ) { if (nKeyCode == KEY_CAPSLOCK) { @@ -1098,10 +1089,10 @@ void SalDisplay::SimulateKeyPress( USHORT nKeyCode ) } } -USHORT SalDisplay::GetIndicatorState() const +sal_uInt16 SalDisplay::GetIndicatorState() const { unsigned int _state = 0; - USHORT nState = 0; + sal_uInt16 nState = 0; XkbGetIndicatorState(pDisp_, XkbUseCoreKbd, &_state); if ((_state & 0x00000001)) @@ -1182,7 +1173,7 @@ void SalDisplay::ModifierMapping() } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -XubString SalDisplay::GetKeyName( USHORT nKeyCode ) const +XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const { String aStrMap; String aCustomKeyName; @@ -1383,27 +1374,27 @@ XubString SalDisplay::GetKeyName( USHORT nKeyCode ) const #define IsISOKey( n ) (0x0000FE00==((n)&0xFFFFFF00)) #endif -USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const +sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const { - USHORT nKey = 0; + sal_uInt16 nKey = 0; if( XK_a <= keysym && XK_z >= keysym ) - nKey = (USHORT)(KEY_A + (keysym - XK_a)); + nKey = (sal_uInt16)(KEY_A + (keysym - XK_a)); else if( XK_A <= keysym && XK_Z >= keysym ) - nKey = (USHORT)(KEY_A + (keysym - XK_A)); + nKey = (sal_uInt16)(KEY_A + (keysym - XK_A)); else if( XK_0 <= keysym && XK_9 >= keysym ) - nKey = (USHORT)(KEY_0 + (keysym - XK_0)); + nKey = (sal_uInt16)(KEY_0 + (keysym - XK_0)); else if( IsModifierKey( keysym ) ) ; else if( IsKeypadKey( keysym ) ) { if( (keysym >= XK_KP_0) && (keysym <= XK_KP_9) ) { - nKey = (USHORT)(KEY_0 + (keysym - XK_KP_0)); + nKey = (sal_uInt16)(KEY_0 + (keysym - XK_KP_0)); *pcPrintable = '0' + nKey - KEY_0; } else if( IsPFKey( keysym ) ) - nKey = (USHORT)(KEY_F1 + (keysym - XK_KP_F1)); + nKey = (sal_uInt16)(KEY_F1 + (keysym - XK_KP_F1)); else switch( keysym ) { case XK_KP_Space: @@ -1482,7 +1473,7 @@ USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const if( bNumLockFromXS_ ) { if( keysym >= XK_F1 && keysym <= XK_F26 ) - nKey = (USHORT)(KEY_F1 + keysym - XK_F1); + nKey = (sal_uInt16)(KEY_F1 + keysym - XK_F1); } else switch( keysym ) { @@ -1551,7 +1542,7 @@ USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const break; default: if( keysym >= XK_F1 && keysym <= XK_F26 ) - nKey = (USHORT)(KEY_F1 + keysym - XK_F1); + nKey = (sal_uInt16)(KEY_F1 + keysym - XK_F1); break; } } @@ -2258,7 +2249,7 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture ) // Events // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void SalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent ) +void SalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent ) { if( osl_acquireMutex( hEventGuard_ ) ) { @@ -2274,7 +2265,7 @@ void SalDisplay::SendInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent } } -void SalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, USHORT nEvent ) +void SalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, sal_uInt16 nEvent ) { if( osl_acquireMutex( hEventGuard_ ) ) { @@ -2301,29 +2292,29 @@ void SalDisplay::CancelInternalEvent( SalFrame* pFrame, void* pData, USHORT nEve } } -BOOL SalX11Display::IsEvent() +sal_Bool SalX11Display::IsEvent() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( osl_acquireMutex( hEventGuard_ ) ) { if( m_aUserEvents.begin() != m_aUserEvents.end() ) - bRet = TRUE; + bRet = sal_True; osl_releaseMutex( hEventGuard_ ); } if( bRet || XEventsQueued( pDisp_, QueuedAlready ) ) - return TRUE; + return sal_True; XFlush( pDisp_ ); - return FALSE; + return sal_False; } bool SalDisplay::DispatchInternalEvent() { SalFrame* pFrame = NULL; void* pData = NULL; - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; if( osl_acquireMutex( hEventGuard_ ) ) { @@ -2676,6 +2667,7 @@ void SalDisplay::PrintInfo() const fprintf( stderr, "\tProperties \t0x%lX\n", GetProperties() ); if( eWindowManager_ != otherwm ) fprintf( stderr, "\tWindowmanager \t%d\n", eWindowManager_ ); + fprintf( stderr, "\tWMName \t%s\n", rtl::OUStringToOString( getWMAdaptor()->getWindowManagerName(), osl_getThreadTextEncoding() ).getStr() ); } fprintf( stderr, "Screen\n" ); fprintf( stderr, "\tResolution/Size \t%ld*%ld %ld*%ld %.1lf\"\n", @@ -2957,14 +2949,14 @@ SalVisual::~SalVisual() #define SALCOLOR RGB #define SALCOLORREVERSE BGR -BOOL SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 ) +sal_Bool SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 ) { int n; switch( GetMode() ) { case other: - return FALSE; + return sal_False; case SALCOLOR: break; case SALCOLORREVERSE: @@ -2989,17 +2981,17 @@ BOOL SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 ) fprintf( stderr, "SalVisual::Convert %d\n", GetMode() ); abort(); } - return TRUE; + return sal_True; } -BOOL SalVisual::Convert( int &n0, int &n1, int &n2 ) +sal_Bool SalVisual::Convert( int &n0, int &n1, int &n2 ) { int n; switch( GetMode() ) { case other: - return FALSE; + return sal_False; case SALCOLOR: break; case RBG: @@ -3033,7 +3025,7 @@ BOOL SalVisual::Convert( int &n0, int &n1, int &n2 ) fprintf( stderr, "SalVisual::Convert %d\n", GetMode() ); abort(); } - return TRUE; + return sal_True; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -3200,7 +3192,7 @@ SalColormap::SalColormap() } // TrueColor -SalColormap::SalColormap( USHORT nDepth ) +SalColormap::SalColormap( sal_uInt16 nDepth ) : m_pDisplay( GetX11SalData()->GetDisplay() ), m_hColormap( None ), m_nWhitePixel( (1 << nDepth) - 1 ), @@ -3350,14 +3342,14 @@ void SalColormap::GetPalette() } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -static USHORT sal_Lookup( const std::vector<SalColor>& rPalette, +static sal_uInt16 sal_Lookup( const std::vector<SalColor>& rPalette, int r, int g, int b, Pixel nUsed ) { - USHORT nPixel = 0; + sal_uInt16 nPixel = 0; int nBest = ColorDiff( rPalette[0], r, g, b ); - for( USHORT i = 1; i < nUsed; i++ ) + for( sal_uInt16 i = 1; i < nUsed; i++ ) { int n = ColorDiff( rPalette[i], r, g, b ); @@ -3375,7 +3367,7 @@ static USHORT sal_Lookup( const std::vector<SalColor>& rPalette, void SalColormap::GetLookupTable() { - m_aLookupTable = std::vector<USHORT>(16*16*16); + m_aLookupTable = std::vector<sal_uInt16>(16*16*16); int i = 0; for( int r = 0; r < 256; r += 17 ) @@ -3425,7 +3417,7 @@ SalColor SalColormap::GetColor( Pixel nPixel ) const return MAKE_SALCOLOR( aColor.red>>8, aColor.green>>8, aColor.blue>>8 ); } -inline BOOL SalColormap::GetXPixel( XColor &rColor, +inline sal_Bool SalColormap::GetXPixel( XColor &rColor, int r, int g, int b ) const @@ -3436,15 +3428,15 @@ inline BOOL SalColormap::GetXPixel( XColor &rColor, return XAllocColor( GetXDisplay(), m_hColormap, &rColor ); } -BOOL SalColormap::GetXPixels( XColor &rColor, +sal_Bool SalColormap::GetXPixels( XColor &rColor, int r, int g, int b ) const { if( !GetXPixel( rColor, r, g, b ) ) - return FALSE; + return sal_False; if( rColor.pixel & 1 ) - return TRUE; + return sal_True; return GetXPixel( rColor, r^0xFF, g^0xFF, b^0xFF ); } @@ -3532,9 +3524,9 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const } // Colormatching ueber Palette - USHORT r = SALCOLOR_RED ( nSalColor ); - USHORT g = SALCOLOR_GREEN( nSalColor ); - USHORT b = SALCOLOR_BLUE ( nSalColor ); + sal_uInt16 r = SALCOLOR_RED ( nSalColor ); + sal_uInt16 g = SALCOLOR_GREEN( nSalColor ); + sal_uInt16 b = SALCOLOR_BLUE ( nSalColor ); return m_aLookupTable[ (((r+8)/17) << 8) + (((g+8)/17) << 4) + ((b+8)/17) ]; diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 57f8d891a8a6..9b83ceb45413 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -46,7 +46,7 @@ #include "sm.hxx" #include "vcl/salwtype.hxx" -#include "vcl/salatype.hxx" +#include "vcl/apptypes.hxx" #include "vcl/helper.hxx" #include <tools/solarmutex.hxx> #include "osl/mutex.hxx" @@ -151,8 +151,8 @@ X11SalInstance::~X11SalInstance() struct PredicateReturn { - USHORT nType; - BOOL bRet; + sal_uInt16 nType; + sal_Bool bRet; }; extern "C" { @@ -163,7 +163,7 @@ Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData ) if ( pPre->bRet ) return False; - USHORT nType; + sal_uInt16 nType; switch( pEvent->type ) { @@ -189,29 +189,29 @@ Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData ) } if ( (nType & pPre->nType) || ( ! nType && (pPre->nType & INPUT_OTHER) ) ) - pPre->bRet = TRUE; + pPre->bRet = sal_True; return False; } } -bool X11SalInstance::AnyInput(USHORT nType) +bool X11SalInstance::AnyInput(sal_uInt16 nType) { X11SalData *pSalData = GetX11SalData(); Display *pDisplay = pSalData->GetDisplay()->GetDisplay(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( (nType & INPUT_TIMER) && pSalData->GetDisplay()->GetXLib()->CheckTimeout( false ) ) { - bRet = TRUE; + bRet = sal_True; } else if (XPending(pDisplay) ) { PredicateReturn aInput; XEvent aEvent; - aInput.bRet = FALSE; + aInput.bRet = sal_False; aInput.nType = nType; XCheckIfEvent(pDisplay, &aEvent, ImplPredicateEvent, @@ -229,14 +229,14 @@ osl::SolarMutex* X11SalInstance::GetYieldMutex() // ----------------------------------------------------------------------- -ULONG X11SalInstance::ReleaseYieldMutex() +sal_uLong X11SalInstance::ReleaseYieldMutex() { SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == osl::Thread::getCurrentIdentifier() ) { - ULONG nCount = pYieldMutex->GetAcquireCount(); - ULONG n = nCount; + sal_uLong nCount = pYieldMutex->GetAcquireCount(); + sal_uLong n = nCount; while ( n ) { pYieldMutex->release(); @@ -251,7 +251,7 @@ ULONG X11SalInstance::ReleaseYieldMutex() // ----------------------------------------------------------------------- -void X11SalInstance::AcquireYieldMutex( ULONG nCount ) +void X11SalInstance::AcquireYieldMutex( sal_uLong nCount ) { SalYieldMutex* pYieldMutex = mpSalYieldMutex; while ( nCount ) @@ -261,6 +261,23 @@ void X11SalInstance::AcquireYieldMutex( ULONG nCount ) } } +// ----------------------------------------------------------------------- + +bool X11SalInstance::CheckYieldMutex() +{ + bool bRet = true; + + SalYieldMutex* pYieldMutex = mpSalYieldMutex; + if ( pYieldMutex->GetThreadId() != osl::Thread::getCurrentIdentifier() ) + { + bRet = false; + } + + return bRet; +} + +// ----------------------------------------------------------------------- + void X11SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { GetX11SalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); } @@ -272,14 +289,14 @@ void* X11SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturn return pDisplay ? (void*)pDisplay : (void*)""; } -SalFrame *X11SalInstance::CreateFrame( SalFrame *pParent, ULONG nSalFrameStyle ) +SalFrame *X11SalInstance::CreateFrame( SalFrame *pParent, sal_uLong nSalFrameStyle ) { SalFrame *pFrame = new X11SalFrame( pParent, nSalFrameStyle ); return pFrame; } -SalFrame* X11SalInstance::CreateChildFrame( SystemParentData* pParentData, ULONG nStyle ) +SalFrame* X11SalInstance::CreateChildFrame( SystemParentData* pParentData, sal_uLong nStyle ) { SalFrame* pFrame = new X11SalFrame( NULL, nStyle, pParentData ); diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx index 8024e35cdb12..0b4ca3e84f0e 100644 --- a/vcl/unx/source/app/salsys.cxx +++ b/vcl/unx/source/app/salsys.cxx @@ -153,13 +153,13 @@ int X11SalSystem::ShowNativeDialog( const String& rTitle, const String& rMessage aWarn.SetText( rTitle ); aWarn.Clear(); - USHORT nButton = 0; + sal_uInt16 nButton = 0; for( std::list< String >::const_iterator it = rButtons.begin(); it != rButtons.end(); ++it ) { - aWarn.AddButton( *it, nButton+1, nButton == (USHORT)nDefButton ? BUTTONDIALOG_DEFBUTTON : 0 ); + aWarn.AddButton( *it, nButton+1, nButton == (sal_uInt16)nDefButton ? BUTTONDIALOG_DEFBUTTON : 0 ); nButton++; } - aWarn.SetFocusButton( (USHORT)nDefButton+1 ); + aWarn.SetFocusButton( (sal_uInt16)nDefButton+1 ); nRet = ((int)aWarn.Execute()) - 1; diff --git a/vcl/unx/source/app/saltimer.cxx b/vcl/unx/source/app/saltimer.cxx index b02ced3a6411..885aeb7c38e7 100644 --- a/vcl/unx/source/app/saltimer.cxx +++ b/vcl/unx/source/app/saltimer.cxx @@ -59,7 +59,7 @@ void SalXLib::StopTimer() m_nTimeoutMS = 0; } -void SalXLib::StartTimer( ULONG nMS ) +void SalXLib::StartTimer( sal_uLong nMS ) { timeval Timeout (m_aTimeout); // previous timeout. gettimeofday (&m_aTimeout, 0); @@ -90,7 +90,7 @@ void X11SalTimer::Stop() GetX11SalData()->GetLib()->StopTimer(); } -void X11SalTimer::Start( ULONG nMS ) +void X11SalTimer::Start( sal_uLong nMS ) { GetX11SalData()->GetLib()->StartTimer( nMS ); } diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index 6e2b2a3babfa..6bfd09fc4f5d 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -151,7 +151,7 @@ extern "C" void SAL_CALL ICEConnectionWorker( void* ); class ICEConnectionObserver { friend void SAL_CALL ICEConnectionWorker(void*); - static BOOL bIsWatching; + static sal_Bool bIsWatching; static void ICEWatchProc( IceConn connection, IcePointer client_data, Bool opening, IcePointer* watch_data ); @@ -177,7 +177,7 @@ public: SmcConn SessionManagerClient::aSmcConnection = NULL; ByteString SessionManagerClient::aClientID; -BOOL ICEConnectionObserver::bIsWatching = FALSE; +sal_Bool ICEConnectionObserver::bIsWatching = sal_False; struct pollfd* ICEConnectionObserver::pFilehandles = NULL; IceConn* ICEConnectionObserver::pConnections = NULL; int ICEConnectionObserver::nConnections = 0; @@ -609,7 +609,7 @@ void ICEConnectionObserver::activate() { nWakeupFiles[0] = nWakeupFiles[1] = 0; ICEMutex = osl_createMutex(); - bIsWatching = TRUE; + bIsWatching = sal_True; #ifdef USE_SM_EXTENSION /* * Default handlers call exit, we don't care that strongly if something @@ -627,7 +627,7 @@ void ICEConnectionObserver::deactivate() if( bIsWatching ) { lock(); - bIsWatching = FALSE; + bIsWatching = sal_False; #ifdef USE_SM_EXTENSION IceRemoveConnectionWatch( ICEWatchProc, NULL ); IceSetErrorHandler( origErrorHandler ); diff --git a/vcl/unx/source/app/soicon.cxx b/vcl/unx/source/app/soicon.cxx index 21e4eabedfb8..54240f8eef45 100644 --- a/vcl/unx/source/app/soicon.cxx +++ b/vcl/unx/source/app/soicon.cxx @@ -42,13 +42,13 @@ #include <salbmp.h> #include <vcl/svids.hrc> -BOOL SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,USHORT nIcon, USHORT iconSize, +sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,sal_uInt16 nIcon, sal_uInt16 iconSize, Pixmap& icon_pixmap, Pixmap& icon_mask) { if( ! ImplGetResMgr() ) - return FALSE; + return sal_False; - USHORT nIconSizeOffset; + sal_uInt16 nIconSizeOffset; if( iconSize >= 48 ) nIconSizeOffset = SV_ICON_SIZE48_START; @@ -57,11 +57,11 @@ BOOL SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,USHORT nIcon, USHORT else if( iconSize >= 16 ) nIconSizeOffset = SV_ICON_SIZE16_START; else - return FALSE; + return sal_False; BitmapEx aIcon( ResId(nIconSizeOffset + nIcon, *ImplGetResMgr())); - if( TRUE == aIcon.IsEmpty() ) - return FALSE; + if( sal_True == aIcon.IsEmpty() ) + return sal_False; SalTwoRect aRect; aRect.mnSrcX = 0; aRect.mnSrcY = 0; @@ -109,7 +109,7 @@ BOOL SelectAppIconPixmap( SalDisplay *pDisplay, int nScreen,USHORT nIcon, USHORT XFreeGC( pDisplay->GetDisplay(), aMonoGC ); } - return TRUE; + return sal_True; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index 725ec7d65733..e03f357998ce 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -32,22 +32,23 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#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 "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 <sal/macros.h> +#include "vcl/configsettings.hxx" -#include <tools/prex.h> +#include "tools/prex.h" #include <X11/X.h> #include <X11/Xatom.h> #include <X11/Xresource.h> -#include <tools/postx.h> +#include "tools/postx.h" #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> @@ -240,7 +241,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; @@ -967,6 +970,30 @@ bool WMAdaptor::getNetWmName() return bNetWM; } +bool WMAdaptor::getWMshouldSwitchWorkspace() const +{ + if( ! m_bWMshouldSwitchWorkspaceInit ) + { + WMAdaptor * pWMA = const_cast<WMAdaptor*>(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() */ @@ -2340,8 +2367,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; diff --git a/vcl/unx/source/dtrans/X11_clipboard.hxx b/vcl/unx/source/dtrans/X11_clipboard.hxx index ed493a33ba2e..73240d8715e6 100644 --- a/vcl/unx/source/dtrans/X11_clipboard.hxx +++ b/vcl/unx/source/dtrans/X11_clipboard.hxx @@ -51,12 +51,12 @@ namespace x11 { >, public SelectionAdaptor { - Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; - Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; SelectionManager& m_rSelectionManager; - Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager; - ::std::list< Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; + com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager; + ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; Atom m_aSelection; protected: @@ -97,12 +97,12 @@ namespace x11 { * XClipboard */ - virtual Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() throw(RuntimeException); virtual void SAL_CALL setContents( - const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, - const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) throw(RuntimeException); virtual ::rtl::OUString SAL_CALL getName() @@ -119,27 +119,27 @@ namespace x11 { * XClipboardNotifier */ virtual void SAL_CALL addClipboardListener( - const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) throw(RuntimeException); virtual void SAL_CALL removeClipboardListener( - const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) throw(RuntimeException); /* * SelectionAdaptor */ - virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable(); + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable(); virtual void clearTransferable(); virtual void fireContentsChanged(); - virtual Reference< XInterface > getReference() throw(); + virtual com::sun::star::uno::Reference< XInterface > getReference() throw(); }; // ------------------------------------------------------------------------ Sequence< ::rtl::OUString > SAL_CALL X11Clipboard_getSupportedServiceNames(); - Reference< XInterface > SAL_CALL X11Clipboard_createInstance( - const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); + com::sun::star::uno::Reference< XInterface > SAL_CALL X11Clipboard_createInstance( + const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); // ------------------------------------------------------------------------ diff --git a/vcl/unx/source/dtrans/X11_dndcontext.hxx b/vcl/unx/source/dtrans/X11_dndcontext.hxx index 5c47e6a465a2..bca708eb24c7 100644 --- a/vcl/unx/source/dtrans/X11_dndcontext.hxx +++ b/vcl/unx/source/dtrans/X11_dndcontext.hxx @@ -52,7 +52,7 @@ namespace x11 { XLIB_Window m_aDropWindow; XLIB_Time m_nTimestamp; SelectionManager& m_rManager; - Reference< XInterface > m_xManagerRef; + com::sun::star::uno::Reference< XInterface > m_xManagerRef; public: DropTargetDropContext( XLIB_Window, XLIB_Time, SelectionManager& ); virtual ~DropTargetDropContext(); @@ -71,7 +71,7 @@ namespace x11 { XLIB_Window m_aDropWindow; XLIB_Time m_nTimestamp; SelectionManager& m_rManager; - Reference< XInterface > m_xManagerRef; + com::sun::star::uno::Reference< XInterface > m_xManagerRef; public: DropTargetDragContext( XLIB_Window, XLIB_Time, SelectionManager& ); virtual ~DropTargetDragContext(); @@ -89,7 +89,7 @@ namespace x11 { XLIB_Window m_aDropWindow; XLIB_Time m_nTimestamp; SelectionManager& m_rManager; - Reference< XInterface > m_xManagerRef; + com::sun::star::uno::Reference< XInterface > m_xManagerRef; public: DragSourceContext( XLIB_Window, XLIB_Time, SelectionManager& ); virtual ~DragSourceContext(); diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 06dbcc62282e..23584694cad2 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -82,6 +82,12 @@ EnterWindowMask |\ LeaveWindowMask +namespace { + +namespace css = com::sun::star; + +} + using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer::dnd; using namespace com::sun::star::lang; @@ -283,7 +289,8 @@ SelectionManager::SelectionManager() : m_nXdndActionMove( None ), m_nXdndActionLink( None ), m_nXdndActionAsk( None ), - m_nXdndActionPrivate( None ) + m_nXdndActionPrivate( None ), + m_bShutDown( false ) { m_aDropEnterEvent.data.l[0] = None; m_aDragRunning.reset(); @@ -625,7 +632,7 @@ OString SelectionManager::convertToCompound( const OUString& rText ) // ------------------------------------------------------------------------ bool SelectionManager::convertData( - const Reference< XTransferable >& xTransferable, + const css::uno::Reference< XTransferable >& xTransferable, Atom nType, Atom nSelection, int& rFormat, @@ -1515,7 +1522,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor, #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "trying bitmap conversion\n" ); #endif - Reference<XBitmap> xBM( new BmpTransporter( aData ) ); + css::uno::Reference<XBitmap> xBM( new BmpTransporter( aData ) ); Sequence<Any> aArgs(2), aOutArgs; Sequence<sal_Int16> aOutIndex; aArgs.getArray()[0] = makeAny( xBM ); @@ -1662,7 +1669,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest if( pAdaptor && XGetSelectionOwner( m_pDisplay, rRequest.selection ) == m_aWindow ) { - Reference< XTransferable > xTrans( pAdaptor->getTransferable() ); + css::uno::Reference< XTransferable > xTrans( pAdaptor->getTransferable() ); if( rRequest.target == m_nTARGETSAtom ) { // someone requests our types @@ -1831,7 +1838,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; } - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); if( xListener.is() ) @@ -2352,7 +2359,7 @@ void SelectionManager::dropComplete( sal_Bool bSuccess, XLIB_Window aDropWindow, dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = getUserDragAction(); dsde.DropSuccess = bSuccess; - Reference< XDragSourceListener > xListener = m_xDragSourceListener; + css::uno::Reference< XDragSourceListener > xListener = m_xDragSourceListener; m_xDragSourceListener.clear(); aGuard.clear(); @@ -2436,7 +2443,7 @@ void SelectionManager::sendDragStatus( Atom nDropAction ) dsde.DropAction = m_nSourceActions; dsde.UserAction = getUserDragAction(); - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); // caution: do not change anything after this aGuard.clear(); if( xListener.is() ) @@ -2697,7 +2704,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = m_nTargetAcceptAction; dsde.DropSuccess = m_bDropSuccess; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -2763,7 +2770,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -2889,7 +2896,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) m_nDropTimeout = time( NULL ); // HACK :-) aGuard.clear(); - static_cast< X11Clipboard* >( pAdaptor )->setContents( m_xDragSourceTransferable, Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >() ); + static_cast< X11Clipboard* >( pAdaptor )->setContents( m_xDragSourceTransferable, css::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >() ); aGuard.reset(); bCancel = false; } @@ -2904,7 +2911,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -3058,7 +3065,7 @@ void SelectionManager::updateDragWindow( int nX, int nY, XLIB_Window aRoot ) { osl::ResettableMutexGuard aGuard( m_aMutex ); - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_nLastDragX = nX; m_nLastDragY = nY; @@ -3218,8 +3225,8 @@ void SelectionManager::startDrag( sal_Int8 sourceActions, sal_Int32, sal_Int32, - const Reference< XTransferable >& transferable, - const Reference< XDragSourceListener >& listener + const css::uno::Reference< XTransferable >& transferable, + const css::uno::Reference< XDragSourceListener >& listener ) throw() { #if OSL_DEBUG_LEVEL > 1 @@ -3503,8 +3510,8 @@ void SelectionManager::dragDoDispatch() { osl::ClearableMutexGuard aGuard(m_aMutex); - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); - Reference< XTransferable > xTransferable( m_xDragSourceTransferable ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XTransferable > xTransferable( m_xDragSourceTransferable ); m_xDragSourceListener.clear(); m_xDragSourceTransferable.clear(); @@ -3774,10 +3781,10 @@ void SelectionManager::run( void* pThis ) timeval aLast; gettimeofday( &aLast, 0 ); - Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); + css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); if( xFact.is() ) { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY ); + css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY ); if( xDesktop.is() ) xDesktop->addTerminateListener(This); } @@ -3792,7 +3799,7 @@ void SelectionManager::run( void* pThis ) if( (aNow.tv_sec - aLast.tv_sec) > 0 ) { osl::ClearableMutexGuard aGuard(This->m_aMutex); - std::list< std::pair< SelectionAdaptor*, Reference< XInterface > > > aChangeList; + std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList; for( boost::unordered_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it ) { @@ -3802,7 +3809,7 @@ void SelectionManager::run( void* pThis ) if( aOwner != it->second->m_aLastOwner ) { it->second->m_aLastOwner = aOwner; - std::pair< SelectionAdaptor*, Reference< XInterface > > + std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > aKeep( it->second->m_pAdaptor, it->second->m_pAdaptor->getReference() ); aChangeList.push_back( aKeep ); } @@ -3825,6 +3832,11 @@ void SelectionManager::run( void* pThis ) void SelectionManager::shutdown() throw() { osl::ResettableMutexGuard aGuard(m_aMutex); + if( m_bShutDown ) + { + return; + } + m_bShutDown = true; // stop dispatching if( m_aThread ) { @@ -3914,7 +3926,7 @@ void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang:: void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent ) throw( ::com::sun::star::uno::RuntimeException ) { - Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY ); + css::uno::Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY ); if( xDesktop.is() == sal_True ) xDesktop->removeTerminateListener( this ); #if OSL_DEBUG_LEVEL > 1 @@ -4047,7 +4059,7 @@ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow ) dsde.DragSource = static_cast< XDragSource* >(this); dsde.DropAction = DNDConstants::ACTION_NONE; dsde.DropSuccess = sal_False; - Reference< XDragSourceListener > xListener( m_xDragSourceListener ); + css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener ); m_xDragSourceListener.clear(); aGuard.clear(); xListener->dragDropEnd( dsde ); @@ -4058,7 +4070,7 @@ void SelectionManager::deregisterDropTarget( XLIB_Window aWindow ) * SelectionAdaptor */ -Reference< XTransferable > SelectionManager::getTransferable() throw() +css::uno::Reference< XTransferable > SelectionManager::getTransferable() throw() { return m_xDragSourceTransferable; } @@ -4078,9 +4090,9 @@ void SelectionManager::fireContentsChanged() throw() // ------------------------------------------------------------------------ -Reference< XInterface > SelectionManager::getReference() throw() +css::uno::Reference< XInterface > SelectionManager::getReference() throw() { - return Reference< XInterface >( static_cast<OWeakObject*>(this) ); + return css::uno::Reference< XInterface >( static_cast<OWeakObject*>(this) ); } // ------------------------------------------------------------------------ @@ -4111,7 +4123,7 @@ void SelectionManagerHolder::initialize( const Sequence< Any >& arguments ) thro if( arguments.getLength() > 0 ) { - Reference< XDisplayConnection > xConn; + css::uno::Reference< XDisplayConnection > xConn; arguments.getConstArray()[0] >>= xConn; if( xConn.is() ) { @@ -4146,8 +4158,8 @@ sal_Int32 SelectionManagerHolder::getDefaultCursor( sal_Int8 dragAction ) throw( void SelectionManagerHolder::startDrag( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, - const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener + const css::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, + const css::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener ) throw() { if( m_xRealDragSource.is() ) diff --git a/vcl/unx/source/dtrans/X11_selection.hxx b/vcl/unx/source/dtrans/X11_selection.hxx index 28ff488c5627..42158e99802b 100644 --- a/vcl/unx/source/dtrans/X11_selection.hxx +++ b/vcl/unx/source/dtrans/X11_selection.hxx @@ -65,10 +65,10 @@ namespace x11 { class SelectionAdaptor { public: - virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0; + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() = 0; virtual void clearTransferable() = 0; virtual void fireContentsChanged() = 0; - virtual Reference< XInterface > getReference() = 0; + virtual com::sun::star::uno::Reference< XInterface > getReference() = 0; // returns a reference that will keep the SelectionAdaptor alive until the // refernce is released }; @@ -86,9 +86,9 @@ namespace x11 { sal_Int8 m_nDefaultActions; XLIB_Window m_aTargetWindow; class SelectionManager* m_pSelectionManager; - Reference< ::com::sun::star::datatransfer::dnd::XDragSource > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > m_xSelectionManager; - ::std::list< Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > > + ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > > m_aListeners; DropTarget(); @@ -104,8 +104,8 @@ namespace x11 { virtual void SAL_CALL initialize( const Sequence< Any >& args ) throw ( ::com::sun::star::uno::Exception ); // XDropTarget - virtual void SAL_CALL addDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); - virtual void SAL_CALL removeDropTargetListener( const Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual void SAL_CALL addDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); + virtual void SAL_CALL removeDropTargetListener( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& ) throw(); virtual sal_Bool SAL_CALL isActive() throw(); virtual void SAL_CALL setActive( sal_Bool active ) throw(); virtual sal_Int8 SAL_CALL getDefaultActions() throw(); @@ -126,7 +126,7 @@ namespace x11 { > { ::osl::Mutex m_aMutex; - Reference< ::com::sun::star::datatransfer::dnd::XDragSource > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > m_xRealDragSource; public: SelectionManagerHolder(); @@ -147,8 +147,8 @@ namespace x11 { virtual void SAL_CALL startDrag( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, - const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener ) throw(); }; @@ -259,9 +259,9 @@ namespace x11 { oslThread m_aDragExecuteThread; ::osl::Condition m_aDragRunning; XLIB_Window m_aWindow; - Reference< ::com::sun::star::awt::XDisplayConnection > + com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > m_xDisplayConnection; - Reference< com::sun::star::script::XInvocation > + com::sun::star::uno::Reference< com::sun::star::script::XInvocation > m_xBitmapConverter; sal_Int32 m_nSelectionTimeout; XLIB_Time m_nSelectionTimestamp; @@ -284,7 +284,7 @@ namespace x11 { XLIB_Time m_nDropTime; sal_Int8 m_nLastDropAction; // XTransferable for Xdnd with foreign drag source - Reference< ::com::sun::star::datatransfer::XTransferable > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_xDropTransferable; int m_nLastX, m_nLastY; XLIB_Time m_nDropTimestamp; @@ -302,9 +302,9 @@ namespace x11 { XLIB_Window m_aDropProxy; XLIB_Window m_aDragSourceWindow; // XTransferable for Xdnd when we are drag source - Reference< ::com::sun::star::datatransfer::XTransferable > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_xDragSourceTransferable; - Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > + com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > m_xDragSourceListener; // root coordinates int m_nLastDragX, m_nLastDragY; @@ -382,6 +382,7 @@ namespace x11 { // since this leads to deadlocks in different Xlib implentations // (XFree as well as Xsun) use an own mutex instead ::osl::Mutex m_aMutex; + bool m_bShutDown; SelectionManager(); ~SelectionManager(); @@ -408,7 +409,7 @@ namespace x11 { bool getPasteData( Atom selection, Atom type, Sequence< sal_Int8 >& rData ); // returns true if conversion was successful - bool convertData( const Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, + bool convertData( const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, Atom nType, Atom nSelection, int & rFormat, @@ -493,15 +494,15 @@ namespace x11 { virtual void SAL_CALL startDrag( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, - const Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, - const Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable, + const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener >& listener ) throw(); // SelectionAdaptor for XdndSelection Drag (we are drag source) - virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw(); + virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable() throw(); virtual void clearTransferable() throw(); virtual void fireContentsChanged() throw(); - virtual Reference< XInterface > getReference() throw(); + virtual com::sun::star::uno::Reference< XInterface > getReference() throw(); // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/vcl/unx/source/dtrans/X11_service.cxx b/vcl/unx/source/dtrans/X11_service.cxx index 215fb1a20011..7397f25e2c76 100644 --- a/vcl/unx/source/dtrans/X11_service.cxx +++ b/vcl/unx/source/dtrans/X11_service.cxx @@ -40,6 +40,12 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/compbase1.hxx> +namespace { + +namespace css = com::sun::star; + +} + using namespace cppu; using namespace com::sun::star::lang; using namespace com::sun::star::datatransfer::clipboard; @@ -71,7 +77,7 @@ Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames() // ------------------------------------------------------------------------ -Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) +css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments ) { static boost::unordered_map< OUString, ::boost::unordered_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances; @@ -82,7 +88,7 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& // by SelectionManager.initialize() if no display connection is given. if( arguments.getLength() > 0 ) { - Reference< XDisplayConnection > xConn; + css::uno::Reference< XDisplayConnection > xConn; arguments.getConstArray()[0] >>= xConn; if( xConn.is() ) @@ -109,8 +115,8 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& nSelection = rManager.getAtom( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) ); } - ::boost::unordered_map< Atom, Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); - ::boost::unordered_map< Atom, Reference< XClipboard > >::iterator it = rMap.find( nSelection ); + ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] ); + ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection ); if( it != rMap.end() ) return it->second; @@ -122,16 +128,16 @@ Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& // ------------------------------------------------------------------------ -Reference< XInterface > X11SalInstance::CreateDragSource() +css::uno::Reference< XInterface > X11SalInstance::CreateDragSource() { - return Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); + return css::uno::Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() ); } // ------------------------------------------------------------------------ -Reference< XInterface > X11SalInstance::CreateDropTarget() +css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget() { - return Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); + return css::uno::Reference < XInterface >( ( OWeakObject * ) new DropTarget() ); } diff --git a/vcl/unx/source/dtrans/X11_transferable.hxx b/vcl/unx/source/dtrans/X11_transferable.hxx index cff20e52fe48..683faa0a7f87 100644 --- a/vcl/unx/source/dtrans/X11_transferable.hxx +++ b/vcl/unx/source/dtrans/X11_transferable.hxx @@ -43,10 +43,10 @@ namespace x11 { ::osl::Mutex m_aMutex; SelectionManager& m_rManager; - Reference< XInterface > m_xCreator; + com::sun::star::uno::Reference< XInterface > m_xCreator; Atom m_aSelection; public: - X11Transferable( SelectionManager& rManager, const Reference< XInterface >& xCreator, Atom selection = None ); + X11Transferable( SelectionManager& rManager, const com::sun::star::uno::Reference< XInterface >& xCreator, Atom selection = None ); virtual ~X11Transferable(); /* diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index 602a82430cdb..bcf0e14e9160 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -133,16 +133,20 @@ class FontCfgWrapper FcResult (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*); void (*m_pFcDefaultSubstitute)(FcPattern *); FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*); + FcPattern* (*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*); FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*); FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*); FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool); - FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind); + + FcPattern* (*m_pFcPatternDuplicate)(const FcPattern*); FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int); FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double); FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool); FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*); FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*); + FcBool (*m_pFcPatternDel)(FcPattern*,const char*); + FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32); FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face); @@ -249,8 +253,13 @@ public: { m_pFcDefaultSubstitute( pPattern ); } FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult ) { return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; } + FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult ) + { return m_pFcFontMatch( pConfig, pPattern, pResult ); } FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind ) { return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); } + + FcPattern* FcPatternDuplicate( const FcPattern* pPattern ) const + { return m_pFcPatternDuplicate( pPattern ); } FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue ) { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); } FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue ) @@ -261,6 +270,9 @@ public: { return m_pFcPatternAddBool( pPattern, pObject, nValue ); } FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet) { return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); } + FcBool FcPatternDel(FcPattern* pPattern, const char* object) + { return m_pFcPatternDel( pPattern, object); } + FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 ) { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; } FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue ) @@ -366,8 +378,13 @@ FontCfgWrapper::FontCfgWrapper() loadSymbol( "FcDefaultSubstitute" ); m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*)) loadSymbol( "FcFontSetMatch" ); + m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*)) + loadSymbol( "FcFontMatch" ); m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind)) loadSymbol( "FcConfigSubstitute" ); + + m_pFcPatternDuplicate = (FcPattern*(*)(const FcPattern*)) + loadSymbol( "FcPatternDuplicate" ); m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int)) loadSymbol( "FcPatternAddInteger" ); m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double)) @@ -378,6 +395,9 @@ FontCfgWrapper::FontCfgWrapper() loadSymbol( "FcPatternAddCharSet" ); m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*)) loadSymbol( "FcPatternAddString" ); + m_pFcPatternDel = (FcBool(*)(FcPattern*,const char*)) + loadSymbol( "FcPatternDel" ); + m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32)) loadSymbol( "FcFreeTypeCharIndex" ); m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face)) @@ -422,13 +442,16 @@ FontCfgWrapper::FontCfgWrapper() m_pFcConfigAppFontAddFile && m_pFcConfigAppFontAddDir && m_pFcConfigParseAndLoad && + m_pFcFontMatch && m_pFcDefaultSubstitute && m_pFcConfigSubstitute && + m_pFcPatternDuplicate && m_pFcPatternAddInteger && m_pFcPatternAddDouble && m_pFcPatternAddCharSet && m_pFcPatternAddBool && - m_pFcPatternAddString + m_pFcPatternAddString && + m_pFcPatternDel ) ) { osl_unloadModule( (oslModule)m_pLib ); @@ -459,18 +482,44 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) if( !pOrig ) return; + // filter the font sets to remove obsolete or duplicate faces for( int i = 0; i < pOrig->nfont; ++i ) { - FcBool outline = false; - FcPattern *pOutlinePattern = pOrig->fonts[i]; - FcResult eOutRes = - FcPatternGetBool( pOutlinePattern, FC_OUTLINE, 0, &outline ); - if( (eOutRes != FcResultMatch) || (outline != FcTrue) ) + FcPattern* pOrigPattern = pOrig->fonts[i]; + // #i115131# ignore non-outline fonts + FcBool bOutline = FcFalse; + FcResult eOutRes = FcPatternGetBool( pOrigPattern, FC_OUTLINE, 0, &bOutline ); + if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) continue; - FcPatternReference(pOutlinePattern); - FcFontSetAdd(m_pOutlineSet, pOutlinePattern); + // create a pattern to find eventually better alternatives + FcPattern* pBetterPattern = pOrigPattern; + if( m_nFcVersion > 20400 ) // #i115204# avoid trouble with old FC versions + { + FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern ); + FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue ); + // TODO: ignore all attributes that are not interesting for finding dupes + // e.g. by using pattern->ImplFontAttr->pattern conversion + FcPatternDel( pTestPattern, FC_FONTVERSION ); + FcPatternDel( pTestPattern, FC_CHARSET ); + FcPatternDel( pTestPattern, FC_FILE ); + // find the font face for the dupe-search pattern + FcResult eFcResult = FcResultMatch; + pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult ); + FcPatternDestroy( pTestPattern ); + if( eFcResult != FcResultMatch ) + continue; + // #i115131# double check results and eventually ignore them + eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline ); + if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) + continue; + } + // insert best found pattern for the dupe-search pattern + // TODO: skip inserting patterns that are already known in the target fontset + FcPatternReference( pBetterPattern ); + FcFontSetAdd( m_pOutlineSet, pBetterPattern ); } - // TODO: FcFontSetDestroy( pOrig ); + + // TODO?: FcFontSetDestroy( pOrig ); #else (void)eSetName; // prevent compiler warning about unused parameter #endif @@ -750,7 +799,7 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i ); #endif - OSL_ASSERT(eOutRes != FcResultMatch || outline); +// OSL_ASSERT(eOutRes != FcResultMatch || outline); // only outline fonts are usable to psprint anyway if( eOutRes == FcResultMatch && ! outline ) @@ -780,7 +829,10 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i #endif } if( aFonts.empty() ) + { + // TODO: remove fonts unusable to psprint from fontset continue; + } int nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, OStringToOUString( OString( (sal_Char*)family ), RTL_TEXTENCODING_UTF8 ), sal_True ); PrintFont* pUpdate = aFonts.front(); @@ -1127,6 +1179,7 @@ ImplFontOptions* PrintFontManager::getFontOptions( const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const { #ifndef ENABLE_FONTCONFIG + (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions; return NULL; #else // ENABLE_FONTCONFIG FontCfgWrapper& rWrapper = FontCfgWrapper::get(); diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx index 9292fe12531d..cd5fbda449e0 100644 --- a/vcl/unx/source/fontmanager/fontmanager.cxx +++ b/vcl/unx/source/fontmanager/fontmanager.cxx @@ -90,6 +90,12 @@ #define PRINTER_METRICDIR "fontmetric" +namespace { + +namespace css = com::sun::star; + +} + using namespace vcl; using namespace utl; using namespace psp; @@ -3968,10 +3974,10 @@ bool PrintFontManager::readOverrideMetrics() if( ! m_aOverrideFonts.empty() ) return false; - Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() ); + css::uno::Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() ); if( !xFact.is() ) return false; - Reference< XMaterialHolder > xMat( + css::uno::Reference< XMaterialHolder > xMat( xFact->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.psprint.CompatMetricOverride" ) ) ), UNO_QUERY ); if( !xMat.is() ) diff --git a/vcl/unx/source/gdi/cdeint.cxx b/vcl/unx/source/gdi/cdeint.cxx index 5c7b092d5fd5..fd81e05c0644 100644 --- a/vcl/unx/source/gdi/cdeint.cxx +++ b/vcl/unx/source/gdi/cdeint.cxx @@ -232,9 +232,9 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) { // calculate Checked color Color aColor2 = aStyleSettings.GetLightColor(); - BYTE nRed = (BYTE)(((USHORT)aColors[1].GetRed() + (USHORT)aColor2.GetRed())/2); - BYTE nGreen = (BYTE)(((USHORT)aColors[1].GetGreen() + (USHORT)aColor2.GetGreen())/2); - BYTE nBlue = (BYTE)(((USHORT)aColors[1].GetBlue() + (USHORT)aColor2.GetBlue())/2); + sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)aColors[1].GetRed() + (sal_uInt16)aColor2.GetRed())/2); + sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)aColors[1].GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); + sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)aColors[1].GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); } } diff --git a/vcl/unx/source/gdi/gcach_xpeer.cxx b/vcl/unx/source/gdi/gcach_xpeer.cxx index a0ac583cb39d..8cbf67ffe6dc 100644 --- a/vcl/unx/source/gdi/gcach_xpeer.cxx +++ b/vcl/unx/source/gdi/gcach_xpeer.cxx @@ -466,13 +466,13 @@ Pixmap X11GlyphPeer::GetPixmap( ServerFont& rServerFont, int nGlyphIndex, int nR if( rServerFont.GetGlyphBitmap1( nGlyphIndex, maRawBitmap ) ) { // #94666# circumvent bug in some X11 systems, e.g. XF410.LynxEM.v163 - ULONG nPixmapWidth = 8 * maRawBitmap.mnScanlineSize - 1; + sal_uLong nPixmapWidth = 8 * maRawBitmap.mnScanlineSize - 1; nPixmapWidth = Max( nPixmapWidth, maRawBitmap.mnWidth ); rGlyphData.SetSize( Size( nPixmapWidth, maRawBitmap.mnHeight ) ); rGlyphData.SetOffset( +maRawBitmap.mnXOffset, +maRawBitmap.mnYOffset ); - const ULONG nBytes = maRawBitmap.mnHeight * maRawBitmap.mnScanlineSize; + const sal_uLong nBytes = maRawBitmap.mnHeight * maRawBitmap.mnScanlineSize; if( nBytes > 0 ) { // conversion table LSB<->MSB (for XCreatePixmapFromData) @@ -622,7 +622,7 @@ Glyph X11GlyphPeer::GetGlyphId( ServerFont& rServerFont, int nGlyphIndex ) GlyphSet aGlyphSet = GetGlyphSet( rServerFont, -1 ); aGlyphId = nGlyphIndex & 0x00FFFFFF; - const ULONG nBytes = maRawBitmap.mnScanlineSize * maRawBitmap.mnHeight; + const sal_uLong nBytes = maRawBitmap.mnScanlineSize * maRawBitmap.mnHeight; XRenderPeer::GetInstance().AddGlyph( aGlyphSet, aGlyphId, aGlyphInfo, (char*)maRawBitmap.mpBits, nBytes ); mnBytesUsed += nBytes; diff --git a/vcl/unx/source/gdi/makefile.mk b/vcl/unx/source/gdi/makefile.mk index 8afbcec8224c..ef5a8726fedc 100644 --- a/vcl/unx/source/gdi/makefile.mk +++ b/vcl/unx/source/gdi/makefile.mk @@ -47,42 +47,25 @@ dummy: .ELSE # "$(GUIBASE)"!="unx" SLOFILES= \ - $(SLO)$/dtint.obj \ - $(SLO)$/gcach_xpeer.obj \ - $(SLO)$/pspgraphics.obj \ + $(SLO)$/salgdi2.obj \ $(SLO)$/salbmp.obj \ - $(SLO)$/salcvt.obj \ $(SLO)$/salgdi.obj \ - $(SLO)$/salgdi2.obj \ - $(SLO)$/salgdi3.obj \ $(SLO)$/salvd.obj \ - $(SLO)$/xfont.obj \ - $(SLO)$/xlfd_attr.obj \ - $(SLO)$/xlfd_extd.obj \ - $(SLO)$/xlfd_smpl.obj \ - $(SLO)$/xrender_peer.obj - -EXCEPTIONSFILES=\ $(SLO)$/dtint.obj \ - $(SLO)$/gcach_xpeer.obj \ - $(SLO)$/pspgraphics.obj \ - $(SLO)$/salbmp.obj \ $(SLO)$/salcvt.obj \ + $(SLO)$/salgdi3.obj \ + $(SLO)$/gcach_xpeer.obj \ + $(SLO)$/xrender_peer.obj \ + $(SLO)$/pspgraphics.obj + +EXCEPTIONSFILES=\ $(SLO)$/salgdi.obj \ - $(SLO)$/salgdi2.obj \ + $(SLO)$/salbmp.obj \ $(SLO)$/salgdi3.obj \ - $(SLO)$/salvd.obj \ - $(SLO)$/xfont.obj \ - $(SLO)$/xlfd_attr.obj \ - $(SLO)$/xlfd_extd.obj - -.IF "$(USE_XPRINT)" == "TRUE" -CFLAGS+=-D_USE_PRINT_EXTENSION_=1 -SLOFILES+=$(SLO)$/xprintext.obj -.ELSE + $(SLO)$/salcvt.obj + SLOFILES+=$(SLO)$/salprnpsp.obj EXCEPTIONSFILES+=$(SLO)$/salprnpsp.obj -.ENDIF .IF "$(OS)"=="SOLARIS" SLOFILES+=$(SLO)$/cdeint.obj diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 5fe67ec32e26..a4289496fa14 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -42,6 +42,7 @@ #include "vcl/svapp.hxx" #include "vcl/salprn.hxx" #include "vcl/sysdata.hxx" +#include "vcl/region.h" #include <stdlib.h> #include <unistd.h> @@ -281,7 +282,7 @@ void PspGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) } } -USHORT PspGraphics::GetBitCount() const +sal_uInt16 PspGraphics::GetBitCount() const { return m_pPrinterGfx->GetBitCount(); } @@ -293,28 +294,27 @@ long PspGraphics::GetGraphicsWidth() const void PspGraphics::ResetClipRegion() { - m_pPrinterGfx->ResetClipRegion (); + m_pPrinterGfx->ResetClipRegion(); } -void PspGraphics::BeginSetClipRegion( ULONG n ) +bool PspGraphics::setClipRegion( const Region& i_rClip ) { - m_pPrinterGfx->BeginSetClipRegion(n); -} - -BOOL PspGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) -{ - return (BOOL)m_pPrinterGfx->UnionClipRegion (nX, nY, nDX, nDY); -} - -bool PspGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + // TODO: support polygonal clipregions here + m_pPrinterGfx->BeginSetClipRegion( i_rClip.GetRectCount() ); -void PspGraphics::EndSetClipRegion() -{ - m_pPrinterGfx->EndSetClipRegion (); + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + m_pPrinterGfx->UnionClipRegion( nX, nY, nW, nH ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + m_pPrinterGfx->EndSetClipRegion(); + return true; } void PspGraphics::SetLineColor() @@ -382,12 +382,12 @@ void PspGraphics::drawRect( long nX, long nY, long nDX, long nDY ) m_pPrinterGfx->DrawRect (Rectangle(Point(nX, nY), Size(nDX, nDY))); } -void PspGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) +void PspGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry ) { m_pPrinterGfx->DrawPolyLine (nPoints, (Point*)pPtAry); } -void PspGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) +void PspGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx m_pPrinterGfx->DrawPolygon (nPoints, (Point*)pPtAry); @@ -412,13 +412,13 @@ bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, double /*fTransparen return false; } -sal_Bool PspGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool PspGraphics::drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { m_pPrinterGfx->DrawPolyLineBezier (nPoints, (Point*)pPtAry, pFlgAry); return sal_True; } -sal_Bool PspGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool PspGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ) { m_pPrinterGfx->DrawPolygonBezier (nPoints, (Point*)pPtAry, pFlgAry); return sal_True; @@ -427,20 +427,20 @@ sal_Bool PspGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, sal_Bool PspGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, - const BYTE* const* pFlgAry ) + const sal_uInt8* const* pFlgAry ) { // Point must be equal to SalPoint! see vcl/inc/salgtype.hxx - m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (BYTE**)pFlgAry); + m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, (Point**)pPtAry, (sal_uInt8**)pFlgAry); return sal_True; } -void PspGraphics::invert( ULONG, +void PspGraphics::invert( sal_uLong, const SalPoint*, SalInvert ) { DBG_ASSERT( 0, "Error: PrinterGfx::Invert() not implemented" ); } -BOOL PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) +sal_Bool PspGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) { return m_pPrinterGfx->DrawEPS( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ), pPtr, nSize ); } @@ -451,7 +451,7 @@ void PspGraphics::copyBits( const SalTwoRect*, OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" ); } -void PspGraphics::copyArea ( long,long,long,long,long,long,USHORT ) +void PspGraphics::copyArea ( long,long,long,long,long,long,sal_uInt16 ) { OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" ); } @@ -770,16 +770,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) DrawPrinterLayout( rLayout, *m_pPrinterGfx, true ); } -ImplFontCharMap* PspGraphics::GetImplFontCharMap() const +const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const { - // TODO: get ImplFontCharMap directly from fonts if( !m_pServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const @@ -789,7 +786,7 @@ bool PspGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabiliti return m_pServerFont[0]->GetFontCapabilities(rFontCapabilities); } -USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) +sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) { // release all fonts that are to be overridden for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) @@ -920,10 +917,10 @@ void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int ) } } -ULONG PspGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) +sal_uLong PspGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs ) { const ::std::list< ::psp::KernPair >& rPairs( m_pPrinterGfx->getKernPairs() ); - ULONG nHavePairs = rPairs.size(); + sal_uLong nHavePairs = rPairs.size(); if( pKernPairs && nPairs ) { ::std::list< ::psp::KernPair >::const_iterator it; @@ -942,38 +939,38 @@ ULONG PspGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) return nHavePairs; } -BOOL PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool PspGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); - return TRUE; + return sal_True; } -BOOL PspGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool PspGraphics::GetGlyphOutline( long nGlyphIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = m_pServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rB2DPolyPoly ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) @@ -1008,7 +1005,7 @@ SalLayout* PspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel //-------------------------------------------------------------------------- -BOOL PspGraphics::CreateFontSubset( +sal_Bool PspGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFont, sal_Int32* pGlyphIDs, @@ -1403,9 +1400,9 @@ bool PspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrLen bool bRet = false; bool bStarted = false; bool bStopped = false; - USHORT nPos; - USHORT nStart = 0; - USHORT nStop = rLen; + sal_uInt16 nPos; + sal_uInt16 nStart = 0; + sal_uInt16 nStop = rLen; String aPhone = rOrig.Copy( nIndex, rLen ); if( ! m_bPhoneCollectionActive ) diff --git a/vcl/unx/source/gdi/salbmp.cxx b/vcl/unx/source/gdi/salbmp.cxx index 134a4f80b1a9..c60192b8466e 100644 --- a/vcl/unx/source/gdi/salbmp.cxx +++ b/vcl/unx/source/gdi/salbmp.cxx @@ -66,7 +66,7 @@ SalBitmap* X11SalInstance::CreateSalBitmap() } ImplSalBitmapCache* X11SalBitmap::mpCache = NULL; -ULONG X11SalBitmap::mnCacheInstCount = 0; +sal_uLong X11SalBitmap::mnCacheInstCount = 0; // ----------------------------------------------------------------------------- @@ -112,7 +112,7 @@ void X11SalBitmap::ImplRemovedFromCache() // ----------------------------------------------------------------------------- -BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ) +BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) { DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 16 || nBitCount == 24, "Unsupported BitCount!" ); @@ -131,7 +131,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, if( pDIB ) { - const USHORT nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0; + const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0; pDIB->mnFormat = BMP_FORMAT_BOTTOM_UP; @@ -172,7 +172,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, try { - pDIB->mpBits = new BYTE[ pDIB->mnScanlineSize * pDIB->mnHeight ]; + pDIB->mpBits = new sal_uInt8[ pDIB->mnScanlineSize * pDIB->mnHeight ]; } catch(std::bad_alloc&) { @@ -218,7 +218,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, { const SalTwoRect aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight }; BitmapBuffer aSrcBuf; - ULONG nDstFormat = BMP_FORMAT_BOTTOM_UP; + sal_uLong nDstFormat = BMP_FORMAT_BOTTOM_UP; const BitmapPalette* pDstPal = NULL; aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN; @@ -226,7 +226,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, aSrcBuf.mnHeight = nHeight; aSrcBuf.mnBitCount = pImage->bits_per_pixel; aSrcBuf.mnScanlineSize = pImage->bytes_per_line; - aSrcBuf.mpBits = (BYTE*) pImage->data; + aSrcBuf.mpBits = (sal_uInt8*) pImage->data; pImage->red_mask = pSalDisp->GetVisual( nScreen ).red_mask; pImage->green_mask = pSalDisp->GetVisual( nScreen ).green_mask; @@ -310,7 +310,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, rPal.SetEntryCount( 256 ); pDstPal = &rPal; - for( USHORT i = 0; i < 256; i++ ) + for( sal_uInt16 i = 0; i < 256; i++ ) { BitmapColor& rBmpCol = rPal[ i ]; @@ -323,12 +323,12 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, else if( aSrcBuf.mnBitCount <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); - const USHORT nCols = Min( (ULONG)rColMap.GetUsed(), (ULONG)(1 << nDrawableDepth) ); + const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << nDrawableDepth) ); rPal.SetEntryCount( nCols ); pDstPal = &rPal; - for( USHORT i = 0; i < nCols; i++ ) + for( sal_uInt16 i = 0; i < nCols; i++ ) { const SalColor nColor( rColMap.GetColor( i ) ); BitmapColor& rBmpCol = rPal[ i ]; @@ -383,7 +383,7 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long if( pImage ) { BitmapBuffer* pDstBuf; - ULONG nDstFormat = BMP_FORMAT_TOP_DOWN; + sal_uLong nDstFormat = BMP_FORMAT_TOP_DOWN; BitmapPalette* pPal = NULL; ColorMask* pMask = NULL; @@ -451,7 +451,7 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long { pPal = new BitmapPalette( 256 ); - for( USHORT i = 0; i < 256; i++ ) + for( sal_uInt16 i = 0; i < 256; i++ ) { BitmapColor& rBmpCol = (*pPal)[ i ]; @@ -464,11 +464,11 @@ XImage* X11SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, int nScreen, long else if( pImage->depth <= 8 ) { const SalColormap& rColMap = pSalDisp->GetColormap( nScreen ); - const USHORT nCols = Min( (ULONG)rColMap.GetUsed(), (ULONG)(1 << pImage->depth) ); + const sal_uInt16 nCols = Min( (sal_uLong)rColMap.GetUsed(), (sal_uLong)(1 << pImage->depth) ); pPal = new BitmapPalette( nCols ); - for( USHORT i = 0; i < nCols; i++ ) + for( sal_uInt16 i = 0; i < nCols; i++ ) { const SalColor nColor( rColMap.GetColor( i ) ); BitmapColor& rBmpCol = (*pPal)[ i ]; @@ -718,7 +718,7 @@ void X11SalBitmap::ImplDraw( Drawable aDrawable, // ----------------------------------------------------------------------------- -bool X11SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ) +bool X11SalBitmap::Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) { Destroy(); mpDIB = ImplCreateDIB( rSize, nBitCount, rPal ); @@ -741,7 +741,7 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp ) // TODO: get rid of this when BitmapBuffer gets copy constructor try { - mpDIB->mpBits = new BYTE[ mpDIB->mnScanlineSize * mpDIB->mnHeight ]; + mpDIB->mpBits = new sal_uInt8[ mpDIB->mnScanlineSize * mpDIB->mnHeight ]; } catch( std::bad_alloc& ) { @@ -767,14 +767,14 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp ) bool X11SalBitmap::Create( const SalBitmap&, SalGraphics* ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------------- -bool X11SalBitmap::Create( const SalBitmap&, USHORT ) +bool X11SalBitmap::Create( const SalBitmap&, sal_uInt16 ) { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------------- @@ -837,9 +837,9 @@ Size X11SalBitmap::GetSize() const // ----------------------------------------------------------------------------- -USHORT X11SalBitmap::GetBitCount() const +sal_uInt16 X11SalBitmap::GetBitCount() const { - USHORT nBitCount; + sal_uInt16 nBitCount; if( mpDIB ) nBitCount = mpDIB->mnBitCount; @@ -1016,7 +1016,7 @@ ImplSalDDB::~ImplSalDDB() bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRect ) const { - bool bRet = FALSE; + bool bRet = sal_False; if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) && nScreen == mnScreen) { @@ -1025,7 +1025,7 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe rTwoRect.mnDestWidth == maTwoRect.mnDestWidth && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight ) { // absolutely indentically - bRet = TRUE; + bRet = sal_True; } else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight && maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight && @@ -1033,7 +1033,7 @@ bool ImplSalDDB::ImplMatches( int nScreen, long nDepth, const SalTwoRect& rTwoRe ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) && ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) ) { - bRet = TRUE; + bRet = sal_True; } } @@ -1080,10 +1080,10 @@ void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth, struct ImplBmpObj { X11SalBitmap* mpBmp; - ULONG mnMemSize; - ULONG mnFlags; + sal_uLong mnMemSize; + sal_uLong mnFlags; - ImplBmpObj( X11SalBitmap* pBmp, ULONG nMemSize, ULONG nFlags ) : + ImplBmpObj( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags ) : mpBmp( pBmp ), mnMemSize( nMemSize ), mnFlags( nFlags ) {} }; @@ -1103,14 +1103,14 @@ ImplSalBitmapCache::~ImplSalBitmapCache() // ----------------------------------------------------------------------------- -void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, ULONG nMemSize, ULONG nFlags ) +void ImplSalBitmapCache::ImplAdd( X11SalBitmap* pBmp, sal_uLong nMemSize, sal_uLong nFlags ) { ImplBmpObj* pObj; - bool bFound = FALSE; + bool bFound = sal_False; for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() ) if( pObj->mpBmp == pBmp ) - bFound = TRUE; + bFound = sal_True; mnTotalSize += nMemSize; diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 38c760af2661..4d3141fc9ded 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -41,6 +41,7 @@ #include "vcl/printergfx.hxx" #include "vcl/jobdata.hxx" +#include "vcl/region.h" #include "tools/debug.hxx" @@ -68,21 +69,21 @@ class SalPolyLine XPoint Points_[STATIC_POINTS]; XPoint *pFirst_; public: - inline SalPolyLine( ULONG nPoints ); - inline SalPolyLine( ULONG nPoints, const SalPoint *p ); + inline SalPolyLine( sal_uLong nPoints ); + inline SalPolyLine( sal_uLong nPoints, const SalPoint *p ); inline ~SalPolyLine(); - inline XPoint &operator [] ( ULONG n ) const + inline XPoint &operator [] ( sal_uLong n ) const { return pFirst_[n]; } }; -inline SalPolyLine::SalPolyLine( ULONG nPoints ) +inline SalPolyLine::SalPolyLine( sal_uLong nPoints ) : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ ) {} -inline SalPolyLine::SalPolyLine( ULONG nPoints, const SalPoint *p ) +inline SalPolyLine::SalPolyLine( sal_uLong nPoints, const SalPoint *p ) : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ ) { - for( ULONG i = 0; i < nPoints; i++ ) + for( sal_uLong i = 0; i < nPoints; i++ ) { pFirst_[i].x = (short)p[i].mnX; pFirst_[i].y = (short)p[i].mnY; @@ -105,7 +106,7 @@ X11SalGraphics::X11SalGraphics() m_aXRenderPicture = 0; m_pXRenderFormat = NULL; - pClipRegion_ = NULL; + mpClipRegion = NULL; pPaintRegion_ = NULL; pPenGC_ = NULL; @@ -114,10 +115,7 @@ X11SalGraphics::X11SalGraphics() pFontGC_ = NULL; for( int i = 0; i < MAX_FALLBACK; ++i ) - { - mXFont[i] = NULL; mpServerFont[i] = NULL; - } nTextPixel_ = 0; nTextColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black @@ -125,7 +123,7 @@ X11SalGraphics::X11SalGraphics() #ifdef ENABLE_GRAPHITE // check if graphite fonts have been disabled static const char* pDisableGraphiteStr = getenv( "SAL_DISABLE_GRAPHITE" ); - bDisableGraphite_ = pDisableGraphiteStr ? (pDisableGraphiteStr[0]!='0') : FALSE; + bDisableGraphite_ = pDisableGraphiteStr ? (pDisableGraphiteStr[0]!='0') : sal_False; #endif pBrushGC_ = NULL; @@ -141,20 +139,20 @@ X11SalGraphics::X11SalGraphics() pStippleGC_ = NULL; pTrackingGC_ = NULL; - bWindow_ = FALSE; - bPrinter_ = FALSE; - bVirDev_ = FALSE; - bPenGC_ = FALSE; - bFontGC_ = FALSE; - bBrushGC_ = FALSE; - bMonoGC_ = FALSE; - bCopyGC_ = FALSE; - bInvertGC_ = FALSE; - bInvert50GC_ = FALSE; - bStippleGC_ = FALSE; - bTrackingGC_ = FALSE; - bXORMode_ = FALSE; - bDitherBrush_ = FALSE; + bWindow_ = sal_False; + bPrinter_ = sal_False; + bVirDev_ = sal_False; + bPenGC_ = sal_False; + bFontGC_ = sal_False; + bBrushGC_ = sal_False; + bMonoGC_ = sal_False; + bCopyGC_ = sal_False; + bInvertGC_ = sal_False; + bInvert50GC_ = sal_False; + bStippleGC_ = sal_False; + bTrackingGC_ = sal_False; + bXORMode_ = sal_False; + bDitherBrush_ = sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -171,7 +169,7 @@ void X11SalGraphics::freeResources() Display *pDisplay = GetXDisplay(); DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" ); - if( pClipRegion_ ) XDestroyRegion( pClipRegion_ ), pClipRegion_ = None; + if( mpClipRegion ) XDestroyRegion( mpClipRegion ), mpClipRegion = None; if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None; if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None; @@ -230,7 +228,7 @@ void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen ) m_nScreen = nScreen; SetDrawable( aTarget, nScreen ); - bWindow_ = TRUE; + bWindow_ = sal_True; m_pFrame = pFrame; m_pVDev = NULL; } @@ -249,8 +247,8 @@ void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const int n = 0; XLIB_Region Regions[3]; - if( pClipRegion_ ) - Regions[n++] = pClipRegion_; + if( mpClipRegion ) + Regions[n++] = mpClipRegion; if( pXReg && !XEmptyRegion( pXReg ) ) Regions[n++] = pXReg; @@ -292,7 +290,7 @@ GC X11SalGraphics::SelectPen() XSetForeground( pDisplay, pPenGC_, nPenPixel_ ); XSetFunction ( pDisplay, pPenGC_, bXORMode_ ? GXxor : GXcopy ); SetClipRegion( pPenGC_ ); - bPenGC_ = TRUE; + bPenGC_ = sal_True; } return pPenGC_; @@ -323,13 +321,8 @@ GC X11SalGraphics::SelectBrush() { XSetFillStyle ( pDisplay, pBrushGC_, FillSolid ); XSetForeground( pDisplay, pBrushGC_, nBrushPixel_ ); - #if defined(_USE_PRINT_EXTENSION_) - XSetBackground( pDisplay, pBrushGC_, - WhitePixel(pDisplay, DefaultScreen(pDisplay)) ); - #else if( bPrinter_ ) XSetTile( pDisplay, pBrushGC_, None ); - #endif } else { @@ -344,7 +337,7 @@ GC X11SalGraphics::SelectBrush() XSetFunction ( pDisplay, pBrushGC_, bXORMode_ ? GXxor : GXcopy ); SetClipRegion( pBrushGC_ ); - bBrushGC_ = TRUE; + bBrushGC_ = sal_True; } return pBrushGC_; @@ -376,26 +369,26 @@ GC X11SalGraphics::GetTrackingGC() if( !bTrackingGC_ ) { SetClipRegion( pTrackingGC_ ); - bTrackingGC_ = TRUE; + bTrackingGC_ = sal_True; } return pTrackingGC_; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::DrawLines( ULONG nPoints, +void X11SalGraphics::DrawLines( sal_uLong nPoints, const SalPolyLine &rPoints, GC pGC, bool bClose ) { // errechne wie viele Linien XWindow auf einmal zeichnen kann - ULONG nMaxLines = (GetDisplay()->GetMaxRequestSize() - sizeof(xPolyPointReq)) + sal_uLong nMaxLines = (GetDisplay()->GetMaxRequestSize() - sizeof(xPolyPointReq)) / sizeof(xPoint); if( nMaxLines > nPoints ) nMaxLines = nPoints; // gebe alle Linien aus, die XWindows zeichnen kann. - ULONG n; + sal_uLong n; for( n = 0; nPoints - n > nMaxLines; n += nMaxLines - 1 ) XDrawLines( GetXDisplay(), GetDrawable(), @@ -439,24 +432,24 @@ BOOL X11SalGraphics::GetDitherPixmap( SalColor nSalColor ) // test for correct depth (8bit) if( GetColormap().GetVisual().GetDepth() != 8 ) - return FALSE; + return sal_False; char pBits[64]; char *pBitsPtr = pBits; // Set the pallette-entries for the dithering tile - UINT8 nSalColorRed = SALCOLOR_RED ( nSalColor ); - UINT8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor ); - UINT8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor ); + sal_uInt8 nSalColorRed = SALCOLOR_RED ( nSalColor ); + sal_uInt8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor ); + sal_uInt8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor ); for( int nY = 0; nY < 8; nY++ ) { for( int nX = 0; nX < 8; nX++ ) { short nMagic = nOrdDither8Bit[nY][nX]; - UINT8 nR = P_DELTA * DMAP( nSalColorRed, nMagic ); - UINT8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic ); - UINT8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic ); + sal_uInt8 nR = P_DELTA * DMAP( nSalColorRed, nMagic ); + sal_uInt8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic ); + sal_uInt8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic ); *pBitsPtr++ = GetColormap().GetPixel( MAKE_SALCOLOR( nR, nG, nB ) ); } @@ -496,7 +489,7 @@ BOOL X11SalGraphics::GetDitherPixmap( SalColor nSalColor ) pImage->data = NULL; XDestroyImage( pImage ); - return TRUE; + return sal_True; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -531,7 +524,7 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -USHORT X11SalGraphics::GetBitCount() const +sal_uInt16 X11SalGraphics::GetBitCount() const { return GetVisual().GetDepth(); } @@ -561,73 +554,64 @@ long X11SalGraphics::GetGraphicsHeight() const // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= void X11SalGraphics::ResetClipRegion() { - if( pClipRegion_ ) + if( mpClipRegion ) { - bPenGC_ = FALSE; - bFontGC_ = FALSE; - bBrushGC_ = FALSE; - bMonoGC_ = FALSE; - bCopyGC_ = FALSE; - bInvertGC_ = FALSE; - bInvert50GC_ = FALSE; - bStippleGC_ = FALSE; - bTrackingGC_ = FALSE; - - XDestroyRegion( pClipRegion_ ); - pClipRegion_ = NULL; + bPenGC_ = sal_False; + bFontGC_ = sal_False; + bBrushGC_ = sal_False; + bMonoGC_ = sal_False; + bCopyGC_ = sal_False; + bInvertGC_ = sal_False; + bInvert50GC_ = sal_False; + bStippleGC_ = sal_False; + bTrackingGC_ = sal_False; + + XDestroyRegion( mpClipRegion ); + mpClipRegion = NULL; } } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::BeginSetClipRegion( ULONG ) -{ - if( pClipRegion_ ) - XDestroyRegion( pClipRegion_ ); - pClipRegion_ = XCreateRegion(); -} - -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL X11SalGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY ) +bool X11SalGraphics::setClipRegion( const Region& i_rClip ) { - if (!nDX || !nDY) - return TRUE; - - XRectangle aRect; - aRect.x = (short)nX; - aRect.y = (short)nY; - aRect.width = (unsigned short)nDX; - aRect.height = (unsigned short)nDY; - - XUnionRectWithRegion( &aRect, pClipRegion_, pClipRegion_ ); - - return TRUE; -} + if( mpClipRegion ) + XDestroyRegion( mpClipRegion ); + mpClipRegion = XCreateRegion(); + + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) + { + if ( nW && nH ) + { + XRectangle aRect; + aRect.x = (short)nX; + aRect.y = (short)nY; + aRect.width = (unsigned short)nW; + aRect.height = (unsigned short)nH; -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + XUnionRectWithRegion( &aRect, mpClipRegion, mpClipRegion ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::EndSetClipRegion() -{ - bPenGC_ = FALSE; - bFontGC_ = FALSE; - bBrushGC_ = FALSE; - bMonoGC_ = FALSE; - bCopyGC_ = FALSE; - bInvertGC_ = FALSE; - bInvert50GC_ = FALSE; - bStippleGC_ = FALSE; - bTrackingGC_ = FALSE; - - if( XEmptyRegion( pClipRegion_ ) ) + // done, invalidate GCs + bPenGC_ = sal_False; + bFontGC_ = sal_False; + bBrushGC_ = sal_False; + bMonoGC_ = sal_False; + bCopyGC_ = sal_False; + bInvertGC_ = sal_False; + bInvert50GC_ = sal_False; + bStippleGC_ = sal_False; + bTrackingGC_ = sal_False; + + if( XEmptyRegion( mpClipRegion ) ) { - XDestroyRegion( pClipRegion_ ); - pClipRegion_= NULL; + XDestroyRegion( mpClipRegion ); + mpClipRegion= NULL; } + return true; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -636,7 +620,7 @@ void X11SalGraphics::SetLineColor() if( nPenColor_ != SALCOLOR_NONE ) { nPenColor_ = SALCOLOR_NONE; - bPenGC_ = FALSE; + bPenGC_ = sal_False; } } @@ -647,7 +631,7 @@ void X11SalGraphics::SetLineColor( SalColor nSalColor ) { nPenColor_ = nSalColor; nPenPixel_ = GetPixel( nSalColor ); - bPenGC_ = FALSE; + bPenGC_ = sal_False; } } @@ -656,9 +640,9 @@ void X11SalGraphics::SetFillColor() { if( nBrushColor_ != SALCOLOR_NONE ) { - bDitherBrush_ = FALSE; + bDitherBrush_ = sal_False; nBrushColor_ = SALCOLOR_NONE; - bBrushGC_ = FALSE; + bBrushGC_ = sal_False; } } @@ -667,7 +651,7 @@ void X11SalGraphics::SetFillColor( SalColor nSalColor ) { if( nBrushColor_ != nSalColor ) { - bDitherBrush_ = FALSE; + bDitherBrush_ = sal_False; nBrushColor_ = nSalColor; nBrushPixel_ = GetPixel( nSalColor ); if( TrueColor != GetColormap().GetVisual().GetClass() @@ -689,7 +673,7 @@ void X11SalGraphics::SetFillColor( SalColor nSalColor ) && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0x00 ) // light brown && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) ) bDitherBrush_ = GetDitherPixmap(nSalColor); - bBrushGC_ = FALSE; + bBrushGC_ = sal_False; } } @@ -709,7 +693,7 @@ void X11SalGraphics::SetROPLineColor( SalROPColor nROPColor ) break; } nPenColor_ = GetColormap().GetColor( nPenPixel_ ); - bPenGC_ = FALSE; + bPenGC_ = sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -727,9 +711,9 @@ void X11SalGraphics::SetROPFillColor( SalROPColor nROPColor ) nBrushPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1; break; } - bDitherBrush_ = FALSE; + bDitherBrush_ = sal_False; nBrushColor_ = GetColormap().GetColor( nBrushPixel_ ); - bBrushGC_ = FALSE; + bBrushGC_ = sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -738,14 +722,15 @@ void X11SalGraphics::SetXORMode( bool bSet, bool ) if( !bXORMode_ == bSet ) { bXORMode_ = bSet; - bPenGC_ = FALSE; - bBrushGC_ = FALSE; - bMonoGC_ = FALSE; - bCopyGC_ = FALSE; - bInvertGC_ = FALSE; - bInvert50GC_ = FALSE; - bStippleGC_ = FALSE; - bTrackingGC_ = FALSE; + bPenGC_ = sal_False; + bFontGC_ = sal_False; + bBrushGC_ = sal_False; + bMonoGC_ = sal_False; + bCopyGC_ = sal_False; + bInvertGC_ = sal_False; + bInvert50GC_ = sal_False; + bStippleGC_ = sal_False; + bTrackingGC_ = sal_False; } } @@ -821,13 +806,13 @@ void X11SalGraphics::drawRect( long nX, long nY, long nDX, long nDY ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) +void X11SalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry ) { drawPolyLine( nPoints, pPtAry, false ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry, bool bClose ) +void X11SalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint *pPtAry, bool bClose ) { if( nPenColor_ != 0xFFFFFFFF ) { @@ -838,7 +823,7 @@ void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry, bool b } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) +void X11SalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) { if( nPoints == 0 ) return; @@ -911,7 +896,7 @@ void X11SalGraphics::drawPolyPolygon( sal_uInt32 nPoly, { if( nBrushColor_ != SALCOLOR_NONE ) { - ULONG i, n; + sal_uInt32 i, n; XLIB_Region pXRegA = NULL; for( i = 0; i < nPoly; i++ ) { @@ -938,7 +923,7 @@ void X11SalGraphics::drawPolyPolygon( sal_uInt32 nPoly, GC pGC = SelectBrush(); SetClipRegion( pGC, pXRegA ); // ??? doppelt XDestroyRegion( pXRegA ); - bBrushGC_ = FALSE; + bBrushGC_ = sal_False; XFillRectangle( GetXDisplay(), GetDrawable(), @@ -948,20 +933,20 @@ void X11SalGraphics::drawPolyPolygon( sal_uInt32 nPoly, } if( nPenColor_ != SALCOLOR_NONE ) - for( ULONG i = 0; i < nPoly; i++ ) + for( sal_uInt32 i = 0; i < nPoly; i++ ) drawPolyLine( pPoints[i], pPtAry[i], true ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -sal_Bool X11SalGraphics::drawPolyLineBezier( ULONG, const SalPoint*, const BYTE* ) +sal_Bool X11SalGraphics::drawPolyLineBezier( sal_uLong, const SalPoint*, const BYTE* ) { return sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -sal_Bool X11SalGraphics::drawPolygonBezier( ULONG, const SalPoint*, const BYTE* ) +sal_Bool X11SalGraphics::drawPolygonBezier( sal_uLong, const SalPoint*, const BYTE* ) { return sal_False; } @@ -976,7 +961,7 @@ sal_Bool X11SalGraphics::drawPolyPolygonBezier( sal_uInt32, const sal_uInt32*, // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::invert( ULONG nPoints, +void X11SalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags ) { @@ -1003,9 +988,9 @@ void X11SalGraphics::invert( ULONG nPoints, // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,ULONG ) +BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,sal_uLong ) { - return FALSE; + return sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -1067,22 +1052,22 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // nothing to do for empty polypolygons const int nOrigPolyCount = rOrigPolyPoly.count(); if( nOrigPolyCount <= 0 ) - return TRUE; + return sal_True; // nothing to do if everything is transparent if( (nBrushColor_ == SALCOLOR_NONE) && (nPenColor_ == SALCOLOR_NONE) ) - return TRUE; + return sal_True; // cannot handle pencolor!=brushcolor yet if( (nPenColor_ != SALCOLOR_NONE) && (nPenColor_ != nBrushColor_) ) - return FALSE; + return sal_False; // TODO: remove the env-variable when no longer needed static const char* pRenderEnv = getenv( "SAL_DISABLE_RENDER_POLY" ); if( pRenderEnv ) - return FALSE; + return sal_False; // snap to raster if requested basegfx::B2DPolyPolygon aPolyPoly = rOrigPolyPoly; @@ -1165,8 +1150,8 @@ bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTr // set clipping // TODO: move into GetXRenderPicture? - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); // render the trapezoids const XRenderPictFormat* pMaskFormat = rRenderPeer.GetStandardFormatA8(); @@ -1213,14 +1198,17 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() ); // draw tesselation result - const int nTrapCount = aB2DTrapVector.size(); - if( !nTrapCount ) - return true; - const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency ); + if( ! aB2DTrapVector.empty() ) + { + const int nTrapCount = aB2DTrapVector.size(); + const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency ); - // restore the original brush GC - nBrushColor_ = aKeepBrushColor; - return bDrawOk; + // restore the original brush GC + nBrushColor_ = aKeepBrushColor; + return bDrawOk; + } + else + return true; } // get the area polygon for the line polygon diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx index 7e8b4abc5905..7e3735d8acd6 100644 --- a/vcl/unx/source/gdi/salgdi2.cxx +++ b/vcl/unx/source/gdi/salgdi2.cxx @@ -136,7 +136,7 @@ inline GC X11SalGraphics::GetMonoGC( Pixmap hPixmap ) if( !bMonoGC_ ) { SetClipRegion( pMonoGC_ ); - bMonoGC_ = TRUE; + bMonoGC_ = sal_True; } return pMonoGC_; @@ -153,7 +153,7 @@ inline GC X11SalGraphics::GetCopyGC() if( !bCopyGC_ ) { SetClipRegion( pCopyGC_ ); - bCopyGC_ = TRUE; + bCopyGC_ = sal_True; } return pCopyGC_; } @@ -171,7 +171,7 @@ GC X11SalGraphics::GetInvertGC() if( !bInvertGC_ ) { SetClipRegion( pInvertGC_ ); - bInvertGC_ = TRUE; + bInvertGC_ = sal_True; } return pInvertGC_; } @@ -219,7 +219,7 @@ GC X11SalGraphics::GetInvert50GC() if( !bInvert50GC_ ) { SetClipRegion( pInvert50GC_ ); - bInvert50GC_ = TRUE; + bInvert50GC_ = sal_True; } return pInvert50GC_; } @@ -237,7 +237,7 @@ inline GC X11SalGraphics::GetStippleGC() { XSetFunction( GetXDisplay(), pStippleGC_, bXORMode_ ? GXxor : GXcopy ); SetClipRegion( pStippleGC_ ); - bStippleGC_ = TRUE; + bStippleGC_ = sal_True; } return pStippleGC_; @@ -294,8 +294,8 @@ int X11SalGraphics::Clip( int &nX, && RectangleOut == Clip( pPaintRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) ) return RectangleOut; - if( pClipRegion_ - && RectangleOut == Clip( pClipRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) ) + if( mpClipRegion + && RectangleOut == Clip( mpClipRegion, nX, nY, nDX, nDY, nSrcX, nSrcY ) ) return RectangleOut; int nPaint; @@ -309,9 +309,9 @@ int X11SalGraphics::Clip( int &nX, nPaint = RectangleIn; int nClip; - if( pClipRegion_ ) + if( mpClipRegion ) { - nClip = XRectInRegion( pClipRegion_, nX, nY, nDX, nDY ); + nClip = XRectInRegion( mpClipRegion, nX, nY, nDX, nDY ); if( RectangleOut == nClip ) return RectangleOut; } @@ -594,7 +594,7 @@ void X11SalGraphics::copyBits( const SalTwoRect *pPosAry, void X11SalGraphics::copyArea ( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT ) + sal_uInt16 ) { SalTwoRect aPosAry; @@ -647,11 +647,11 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, DBG_ASSERT( !bPrinter_, "Drawing of transparent bitmaps on printer devices is strictly forbidden" ); // decide if alpha masking or transparency masking is needed - BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rMaskBitmap).AcquireBuffer( TRUE ); + BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rMaskBitmap).AcquireBuffer( sal_True ); if( pAlphaBuffer != NULL ) { int nMaskFormat = pAlphaBuffer->mnFormat; - const_cast<SalBitmap&>(rMaskBitmap).ReleaseBuffer( pAlphaBuffer, TRUE ); + const_cast<SalBitmap&>(rMaskBitmap).ReleaseBuffer( pAlphaBuffer, sal_True ); if( nMaskFormat == BMP_FORMAT_8BIT_PAL ) drawAlphaBitmap( *pPosAry, rSrcBitmap, rMaskBitmap ); } @@ -672,7 +672,7 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry, // figure work mode depth. If this is a VDev Drawable, use its // bitdepth to create pixmaps for, otherwise, XCopyArea will // refuse to work. - const USHORT nDepth( m_pVDev ? + const sal_uInt16 nDepth( m_pVDev ? m_pVDev->GetDepth() : pSalDisp->GetVisual( m_nScreen ).GetDepth() ); Pixmap aFG( XCreatePixmap( pXDisp, aDrawable, pPosAry->mnDestWidth, @@ -731,8 +731,8 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry, DBG_TESTTRANS( aBG ); // #105055# Disable XOR temporarily - BOOL bOldXORMode( bXORMode_ ); - bXORMode_ = FALSE; + sal_Bool bOldXORMode( bXORMode_ ); + bXORMode_ = sal_False; // copy pixmap #2 (result) to background XCopyArea( pXDisp, aBG, aDrawable, GetCopyGC(), @@ -820,7 +820,7 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, // TODO: use SalX11Bitmap functionality and caching for the Alpha Pixmap // problem is that they don't provide an 8bit Pixmap on a non-8bit display - BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rAlphaBmp).AcquireBuffer( TRUE ); + BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rAlphaBmp).AcquireBuffer( sal_True ); // an XImage needs its data top_down // TODO: avoid wrongly oriented images in upper layers! @@ -865,7 +865,7 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, if( pAlphaBits != (char*)pAlphaBuffer->mpBits ) delete[] pAlphaBits; - const_cast<SalBitmap&>(rAlphaBmp).ReleaseBuffer( pAlphaBuffer, TRUE ); + const_cast<SalBitmap&>(rAlphaBmp).ReleaseBuffer( pAlphaBuffer, sal_True ); XRenderPictureAttributes aAttr; aAttr.repeat = true; @@ -874,8 +874,8 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, return false; // set clipping - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); // paint source * mask over destination picture rPeer.CompositePicture( PictOpOver, aSrcPic, aAlphaPic, aDstPic, @@ -1031,7 +1031,7 @@ SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) } X11SalBitmap* pSalBitmap = new X11SalBitmap; - USHORT nBitCount = GetBitCount(); + sal_uInt16 nBitCount = GetBitCount(); if( &GetDisplay()->GetColormap( m_nScreen ) != &GetColormap() ) nBitCount = 1; diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 5dacaf8022d7..342bd99de324 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -47,11 +47,7 @@ #include "salgdi.h" #include "pspgraphics.h" #include "salvd.h" -#include "xfont.hxx" #include <vcl/sysdata.hxx> -#include "xlfd_attr.hxx" -#include "xlfd_smpl.hxx" -#include "xlfd_extd.hxx" #include "salcvt.hxx" #include "vcl/printergfx.hxx" @@ -112,385 +108,6 @@ struct _XRegion BOX extents; }; using ::rtl::OUString; -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -// ---------------------------------------------------------------------------- -// -// manage X11 fonts and self rastered fonts -// -// ---------------------------------------------------------------------------- - -#ifndef _USE_PRINT_EXTENSION_ - -class FontLookup -{ - public: - - struct hash; - struct equal; - typedef ::boost::unordered_set< FontLookup, - FontLookup::hash, - FontLookup::equal > fl_hashset; - - private: - - rtl::OString maName; - FontWeight mnWeight; - FontItalic mnItalic; - sal_Bool mbDisplay; - - public: - - FontLookup ( ::std::list< psp::fontID >::iterator& it, - const psp::PrintFontManager& rMgr ); - FontLookup (const Xlfd& rFont); - FontLookup (const FontLookup &rRef) : - maName (rRef.maName), - mnWeight (rRef.mnWeight), - mnItalic (rRef.mnItalic), - mbDisplay(rRef.mbDisplay) - {} - ~FontLookup () - {} - - static void BuildSet (fl_hashset& rSet); - static bool InSet (const fl_hashset& rSet, const Xlfd& rXfld); - bool InSet (const fl_hashset& rSet) const; - - bool operator== (const FontLookup &rRef) const - { - return (abs(mnWeight - rRef.mnWeight) < 2) - && (mnItalic == rRef.mnItalic) - && (maName == rRef.maName) - && (mbDisplay== rRef.mbDisplay); - } - FontLookup& operator= (const FontLookup &rRef) - { - mnWeight = rRef.mnWeight; - mnItalic = rRef.mnItalic; - maName = rRef.maName; - mbDisplay= rRef.mbDisplay; - - return *this; - } - size_t Hash() const - { - return maName.hashCode (); - } - - struct equal - { - bool operator()(const FontLookup &r1, const FontLookup &r2) const - { - return r1 == r2; - } - }; - struct hash - { - size_t operator()(const FontLookup &rArg) const - { - return rArg.Hash(); - } - }; -}; - -FontLookup::FontLookup ( ::std::list< psp::fontID >::iterator& it, - const psp::PrintFontManager& rMgr ) -{ - psp::FastPrintFontInfo aInfo; - if (rMgr.getFontFastInfo (*it, aInfo)) - { - mnItalic = PspGraphics::ToFontItalic (aInfo.m_eItalic); - mnWeight = PspGraphics::ToFontWeight (aInfo.m_eWeight); - mbDisplay= aInfo.m_eType == psp::fonttype::Builtin - || aInfo.m_eType == psp::fonttype::Unknown ? False : True; - maName = rtl::OUStringToOString - ( aInfo.m_aFamilyName, - RTL_TEXTENCODING_ISO_8859_1).toAsciiLowerCase(); - - sal_Int32 n_length = maName.getLength(); - const sal_Char* p_from = maName.getStr(); - sal_Char* p_to = (sal_Char*)alloca (n_length + 1); - - sal_Int32 i, j; - for (i = 0, j = 0; i < n_length; i++) - { - if ( p_from[i] != ' ' ) - p_to[j++] = p_from[i]; - } - maName = rtl::OString (p_to, j); - if (mnItalic == ITALIC_OBLIQUE) - mnItalic = ITALIC_NORMAL; - } - else - { - mnItalic = ITALIC_DONTKNOW; - mnWeight = WEIGHT_DONTKNOW; - mbDisplay= False; - } -} - -FontLookup::FontLookup (const Xlfd& rFont) -{ - AttributeProvider* pFactory = rFont.mpFactory; - Attribute* pAttr; - - pAttr = pFactory->RetrieveSlant (rFont.mnSlant); - mnItalic = (FontItalic)pAttr->GetValue(); - pAttr = pFactory->RetrieveWeight (rFont.mnWeight); - mnWeight = (FontWeight)pAttr->GetValue(); - pAttr = pFactory->RetrieveFamily (rFont.mnFamily); - maName = pAttr->GetKey(); - - if (mnItalic == ITALIC_OBLIQUE) - mnItalic = ITALIC_NORMAL; - - mbDisplay = True; -} - -void -FontLookup::BuildSet (FontLookup::fl_hashset &rSet) -{ - ::std::list< psp::fontID > aIdList; - - psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - rMgr.getFontList( aIdList, NULL, false ); - - ::std::list< psp::fontID >::iterator it; - for (it = aIdList.begin(); it != aIdList.end(); ++it) - { - FontLookup aItem (it, rMgr); - rSet.insert (aItem); - } -} - -bool -FontLookup::InSet (const FontLookup::fl_hashset& rSet) const -{ - fl_hashset::const_iterator it = rSet.find(*this); - return it == rSet.end() ? false : true; -} - -bool -FontLookup::InSet (const FontLookup::fl_hashset& rSet, const Xlfd& rXlfd) -{ - FontLookup aNeedle (rXlfd); - return aNeedle.InSet (rSet); -} - -#endif - -// ---------------------------------------------------------------------------- -// -// SalDisplay -// -// ---------------------------------------------------------------------------- - -XlfdStorage* -SalDisplay::GetXlfdList() const -{ - if ( mpFontList != NULL ) - { - return mpFontList; - } - else - { - const_cast<SalDisplay*>(this)->mpFactory = new AttributeProvider; - const_cast<SalDisplay*>(this)->mpFontList = new XlfdStorage; - const_cast<SalDisplay*>(this)->mpFallbackFactory = new VirtualXlfd; - - int i, nFontCount; - const int nMaxCount = 64 * 1024 - 1; - Display *pDisplay = GetDisplay(); - char **ppFontList = XListFonts(pDisplay, "-*", nMaxCount, &nFontCount); - - // - // create a list of simple Xlfd font information - // - - Xlfd *pXlfdList = (Xlfd*)malloc( nFontCount * sizeof(Xlfd) ); - int nXlfdCount = 0; - - for ( i = 0; i < nFontCount; i++ ) - { - if ( pXlfdList[ nXlfdCount ].FromString(ppFontList[i], mpFactory) ) - ++nXlfdCount; - } - - XFreeFontNames( ppFontList ); - - mpFactory->AddClassification(); - // add some pretty print description - mpFactory->AddAnnotation(); - // misc feature checking - mpFactory->TagFeature(); - - // sort according to font style - qsort( pXlfdList, nXlfdCount, sizeof(Xlfd), XlfdCompare ); - -#ifndef _USE_PRINT_EXTENSION_ - // create a list of fonts already managed by the fontmanager - FontLookup::fl_hashset aSet; - FontLookup::BuildSet (aSet); -#endif - - // - // create a font list with merged encoding information - // - - BitmapXlfdStorage aBitmapList; - ScalableXlfd *pScalableFont = NULL; - - int nFrom = 0; - for ( i = 0; i < nXlfdCount; i++ ) - { - // exclude openlook glyph and cursor - Attribute *pAttr = mpFactory->RetrieveFamily(pXlfdList[i].mnFamily); - if ( pAttr->HasFeature( XLFD_FEATURE_OL_GLYPH - | XLFD_FEATURE_OL_CURSOR) ) - continue; - // exclude fonts with unknown encoding - if ( pXlfdList[i].GetEncoding() == RTL_TEXTENCODING_DONTKNOW ) - continue; - // exclude "interface system" and "interface user" - if (pAttr->HasFeature( XLFD_FEATURE_APPLICATION_FONT ) ) - continue; - // exclude fonts already managed by fontmanager, anyway keep - // gui fonts: they are candidates for GetInterfaceFont () - if (pXlfdList[i].Fonttype() == eTypeScalable) - ((VirtualXlfd*)mpFallbackFactory)->FilterInterfaceFont (pXlfdList + i); -#ifndef _USE_PRINT_EXTENSION_ - if (FontLookup::InSet (aSet, pXlfdList[i])) - continue; -#endif - Bool bSameOutline = pXlfdList[i].SameFontoutline(pXlfdList + nFrom); - XlfdFonttype eType = pXlfdList[i].Fonttype(); - - // flush the old merged font list if the name doesn't match any more - if ( !bSameOutline ) - { - mpFontList->Add( pScalableFont ); - mpFontList->Add( &aBitmapList ); - pScalableFont = NULL; - aBitmapList.Reset(); - } - - // merge the font or generate a new one - switch( eType ) - { - case eTypeScalable: - if ( pScalableFont == NULL ) - pScalableFont = new ScalableXlfd; - pScalableFont->AddEncoding(pXlfdList + i); - break; - - case eTypeBitmap: - aBitmapList.AddBitmapFont( pXlfdList + i ); - break; - - case eTypeScalableBitmap: - // ignore scaled X11 bitmap fonts because they look too ugly - default: - break; - } - - nFrom = i; - } - - // flush the merged list into the global list - mpFontList->Add( pScalableFont ); - mpFontList->Add( &aBitmapList ); - if (mpFallbackFactory->NumEncodings() > 0) - mpFontList->Add( mpFallbackFactory ); - // cleanup the list of simple font information - if ( pXlfdList != NULL ) - free( pXlfdList ); - - return mpFontList; - } -} - -// --------------------------------------------------------------------------- - -ExtendedFontStruct* -SalDisplay::GetFont( const ExtendedXlfd *pRequestedFont, - const Size& rPixelSize, sal_Bool bVertical ) const -{ - // TODO: either get rid of X11 fonts or get rid of the non-hashmapped cache - if( !m_pFontCache ) - { - m_pFontCache = new SalFontCache(); - } - else - { - ExtendedFontStruct *pItem; - for ( size_t i = 0, n = m_pFontCache->size(); i < n; ++i ) - { - pItem = (*m_pFontCache)[ i ]; - if ( pItem->Match(pRequestedFont, rPixelSize, bVertical) ) - { - if( i > 0 ) - { - m_pFontCache->erase( m_pFontCache->begin() + i ); - m_pFontCache->insert( m_pFontCache->begin(), pItem ); - } - return pItem; - } - } - } - - // before we expand the cache, we look for very old and unused items - if( m_pFontCache->size() >= 64 ) - { - ExtendedFontStruct *pItem; - for ( size_t i = m_pFontCache->size(); i > 0; ) - { - pItem = (*m_pFontCache)[ --i ]; - if( 1 == pItem->GetRefCount() ) - { - m_pFontCache->erase( m_pFontCache->begin() + i ); - pItem->ReleaseRef(); - if( m_pFontCache->size() < 64 ) - break; - } - } - } - - ExtendedFontStruct *pItem = new ExtendedFontStruct( GetDisplay(), - rPixelSize, bVertical, - const_cast<ExtendedXlfd*>(pRequestedFont) ); - m_pFontCache->insert( m_pFontCache->begin(), pItem ); - pItem->AddRef(); - - return pItem; -} - -// --------------------------------------------------------------------------- - -void -SalDisplay::DestroyFontCache() -{ - if( m_pFontCache ) - { - for ( size_t i = 0, n = m_pFontCache->size(); i < n; ++i ) { - delete (*m_pFontCache)[ i ]; - } - } - if( mpFontList ) - { - mpFontList->Dispose(); - delete mpFontList; - } - if ( mpFactory ) - { - delete mpFactory; - } - - m_pFontCache = (SalFontCache*)NULL; - mpFontList = (XlfdStorage*)NULL; - mpFactory = (AttributeProvider*)NULL; -} - // =========================================================================== // PspKernInfo allows on-demand-querying of psprint provided kerning info (#i29881#) @@ -530,7 +147,7 @@ void PspKernInfo::Initialize() const // ---------------------------------------------------------------------------- GC -X11SalGraphics::SelectFont() +X11SalGraphics::GetFontGC() { Display *pDisplay = GetXDisplay(); @@ -541,24 +158,16 @@ X11SalGraphics::SelectFont() values.fill_rule = EvenOddRule; // Pict import/ Gradient values.graphics_exposures = False; values.foreground = nTextPixel_; -#ifdef _USE_PRINT_EXTENSION_ - values.background = xColormap_->GetWhitePixel(); - pFontGC_ = XCreateGC( pDisplay, hDrawable_, - GCSubwindowMode | GCFillRule - | GCGraphicsExposures | GCBackground | GCForeground, - &values ); -#else pFontGC_ = XCreateGC( pDisplay, hDrawable_, GCSubwindowMode | GCFillRule | GCGraphicsExposures | GCForeground, &values ); -#endif } if( !bFontGC_ ) { XSetForeground( pDisplay, pFontGC_, nTextPixel_ ); SetClipRegion( pFontGC_ ); - bFontGC_ = TRUE; + bFontGC_ = sal_True; } return pFontGC_; @@ -571,8 +180,6 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev // release all no longer needed font resources for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) { - mXFont[i] = NULL; // ->ReleaseRef() - if( mpServerFont[i] != NULL ) { // old server side font is no longer referenced @@ -591,18 +198,6 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev if( !pEntry->mpFontData ) return false; - // handle the request for a native X11-font - if( ImplX11FontData::CheckFontData( *pEntry->mpFontData ) ) - { - const ImplX11FontData* pRequestedFont = static_cast<const ImplX11FontData*>( pEntry->mpFontData ); - const ExtendedXlfd& rX11Font = pRequestedFont->GetExtendedXlfd(); - - Size aReqSize( pEntry->mnWidth, pEntry->mnHeight ); - mXFont[ nFallbackLevel ] = GetDisplay()->GetFont( &rX11Font, aReqSize, bFontVertical_ ); - bFontGC_ = FALSE; - return true; - } - // handle the request for a non-native X11-font => use the GlyphCache ServerFont* pServerFont = GlyphCache::GetInstance().CacheFont( *pEntry ); if( pServerFont != NULL ) @@ -650,83 +245,6 @@ void ImplServerFontEntry::HandleFontOptions( void ) //-------------------------------------------------------------------------- -inline sal_Unicode SwapBytes( const sal_Unicode nIn ) -{ - return ((nIn >> 8) & 0x00ff) | ((nIn & 0x00ff) << 8); -} - -// draw string in a specific multibyte encoding -static void -ConvertTextItem16( XTextItem16* pTextItem, rtl_TextEncoding nEncoding ) -{ - if ( (pTextItem == NULL) || (pTextItem->nchars <= 0) ) - return; - - SalConverterCache* pCvt = SalConverterCache::GetInstance(); - // convert the string into the font encoding - sal_Size nSize; - sal_Size nBufferSize = pTextItem->nchars * 2; - sal_Char *pBuffer = (sal_Char*)alloca( nBufferSize ); - - nSize = pCvt->ConvertStringUTF16( (sal_Unicode*)pTextItem->chars, pTextItem->nchars, - pBuffer, nBufferSize, nEncoding); - - sal_Char *pTextChars = (sal_Char*)pTextItem->chars; - unsigned int n = 0, m = 0; - - if ( nEncoding == RTL_TEXTENCODING_GB_2312 - || nEncoding == RTL_TEXTENCODING_GBT_12345 - || nEncoding == RTL_TEXTENCODING_GBK - || nEncoding == RTL_TEXTENCODING_BIG5 ) - { - // GB and Big5 needs special treatment since chars can be single or - // double byte: encoding is - // [ 0x00 - 0x7f ] | [ 0x81 - 0xfe ] [ 0x40 - 0x7e 0x80 - 0xfe ] - while ( n < nSize ) - { - if ( (unsigned char)pBuffer[ n ] < 0x80 ) - { - pTextChars[ m++ ] = 0x0; - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - else - { - pTextChars[ m++ ] = pBuffer[ n++ ]; - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - } - pTextItem->nchars = m / 2; - } - else - if ( pCvt->IsSingleByteEncoding(nEncoding) ) - { - // Single Byte encoding has to be padded - while ( n < nSize ) - { - pTextChars[ m++ ] = 0x0; - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - pTextItem->nchars = nSize; - } - else - { - while ( n < nSize ) - { - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - pTextItem->nchars = nSize / 2; - } - - // XXX FIXME - if ( (nEncoding == RTL_TEXTENCODING_GB_2312) - || (nEncoding == RTL_TEXTENCODING_EUC_KR) ) - { - for (unsigned int n_char = 0; n_char < m; n_char++ ) - pTextChars[ n_char ] &= 0x7F; - } -} - -//-------------------------------------------------------------------------- namespace { class CairoWrapper @@ -993,16 +511,16 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout ) if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions()) rCairo.set_font_options( cr, pOptions); - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - { - for (long i = 0; i < pClipRegion_->numRects; ++i) + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) { + for (long i = 0; i < mpClipRegion->numRects; ++i) + { rCairo.rectangle(cr, - pClipRegion_->rects[i].x1, - pClipRegion_->rects[i].y1, - pClipRegion_->rects[i].x2 - pClipRegion_->rects[i].x1, - pClipRegion_->rects[i].y2 - pClipRegion_->rects[i].y1); - } + mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y1, + mpClipRegion->rects[i].x2 - mpClipRegion->rects[i].x1, + mpClipRegion->rects[i].y2 - mpClipRegion->rects[i].y1); + } rCairo.clip(cr); } @@ -1091,8 +609,8 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout ) // set clipping // TODO: move into GetXRenderPicture()? - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) - rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) + rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion ); ServerFont& rFont = rLayout.GetServerFont(); X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer(); @@ -1175,10 +693,10 @@ bool X11SalGraphics::DrawServerAAForcedString( const ServerFontLayout& rLayout ) else if( m_pVDev ) nWidth = m_pVDev->GetWidth(), nHeight = m_pVDev->GetHeight(); - if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) + if( mpClipRegion && !XEmptyRegion( mpClipRegion ) ) { // get bounding box - XClipBox( pClipRegion_, &aXRect ); + XClipBox( mpClipRegion, &aXRect ); // clip with window if( aXRect.x < 0 ) aXRect.x = 0; @@ -1271,7 +789,7 @@ bool X11SalGraphics::DrawServerAAForcedString( const ServerFontLayout& rLayout ) } // prepare context - GC nGC = SelectFont(); + GC nGC = GetFontGC(); XGCValues aGCVal; XGetGCValues( pDisplay, nGC, GCForeground, &aGCVal ); @@ -1358,7 +876,7 @@ void X11SalGraphics::DrawServerSimpleFontString( const ServerFontLayout& rSalLay X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer(); Display* pDisplay = GetXDisplay(); - GC nGC = SelectFont(); + GC nGC = GetFontGC(); XGCValues aGCVal; aGCVal.fill_style = FillStippled; @@ -1421,71 +939,13 @@ void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) //-------------------------------------------------------------------------- -void X11SalGraphics::DrawStringUCS2MB( ExtendedFontStruct& rFont, - const Point& rPoint, const sal_Unicode* pStr, int nLength ) +const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const { - Display* pDisplay = GetXDisplay(); - GC nGC = SelectFont(); - - if( rFont.GetAsciiEncoding() == RTL_TEXTENCODING_UNICODE ) - { - // plain Unicode, can handle all chars and can be handled straight forward - XFontStruct* pFontStruct = rFont.GetFontStruct( RTL_TEXTENCODING_UNICODE ); - if( !pFontStruct ) - return; - - XSetFont( pDisplay, nGC, pFontStruct->fid ); - - #ifdef OSL_LITENDIAN - sal_Unicode *pBuffer = (sal_Unicode*)alloca( nLength * sizeof(sal_Unicode) ); - for ( int i = 0; i < nLength; i++ ) - pBuffer[ i ] = SwapBytes(pStr[ i ]) ; - #else - sal_Unicode *pBuffer = const_cast<sal_Unicode*>(pStr); - #endif - - XDrawString16( pDisplay, hDrawable_, nGC, rPoint.X(), rPoint.Y(), (XChar2b*)pBuffer, nLength ); - } - else - { - XTextItem16 *pTextItem = (XTextItem16*)alloca( nLength * sizeof(XTextItem16) ); - XChar2b *pMBChar = (XChar2b*)pStr; - int nItem = 0; - - DBG_ASSERT( nLength<=1, "#i49902# DrawStringUCS2MB with nLength>1 => problems with XOrg6.8.[0123]"); - - for( int nChar = 0; nChar < nLength; ++nChar ) - { - rtl_TextEncoding nEnc; - XFontStruct* pFontStruct = rFont.GetFontStruct( pStr[nChar], &nEnc ); - if( !pFontStruct ) - continue; - - pTextItem[ nItem ].chars = pMBChar + nChar; - pTextItem[ nItem ].delta = 0; - pTextItem[ nItem ].font = pFontStruct->fid; - pTextItem[ nItem ].nchars = 1; - - ConvertTextItem16( &pTextItem[ nItem ], nEnc ); - ++nItem; - } - - XDrawText16( pDisplay, hDrawable_, nGC, rPoint.X(), rPoint.Y(), pTextItem, nItem ); - } -} - -//-------------------------------------------------------------------------- - -ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const -{ - // TODO: get ImplFontCharMap directly from fonts if( !mpServerFont[0] ) return NULL; - CmapResult aCmapResult; - if( !mpServerFont[0]->GetFontCodeRanges( aCmapResult ) ) - return NULL; - return new ImplFontCharMap( aCmapResult ); + const ImplFontCharMap* pIFCMap = mpServerFont[0]->GetImplFontCharMap(); + return pIFCMap; } bool X11SalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rGetImplFontCapabilities) const @@ -1501,9 +961,9 @@ bool X11SalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rGetImplFont // // ---------------------------------------------------------------------------- -USHORT X11SalGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) +sal_uInt16 X11SalGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel ) { - USHORT nRetVal = 0; + sal_uInt16 nRetVal = 0; if( !setFont( pEntry, nFallbackLevel ) ) nRetVal |= SAL_SETFONT_BADFONT; if( bPrinter_ || (mpServerFont[ nFallbackLevel ] != NULL) ) @@ -1520,7 +980,7 @@ X11SalGraphics::SetTextColor( SalColor nSalColor ) { nTextColor_ = nSalColor; nTextPixel_ = GetPixel( nSalColor ); - bFontGC_ = FALSE; + bFontGC_ = sal_False; } } @@ -1567,15 +1027,6 @@ void RegisterFontSubstitutors( ImplDevFontList* ); void X11SalGraphics::GetDevFontList( ImplDevFontList *pList ) { - // allow disabling of native X11 fonts - static const char* pEnableX11FontStr = getenv( "SAL_ENABLE_NATIVE_XFONTS" ); - if( pEnableX11FontStr && (pEnableX11FontStr[0] != '0') ) - { - // announce X11 fonts - XlfdStorage* pX11FontList = GetDisplay()->GetXlfdList(); - pX11FontList->AnnounceFonts( pList ); - } - // prepare the GlyphCache using psprint's font infos X11GlyphCache& rGC = X11GlyphCache::GetInstance(); @@ -1756,25 +1207,19 @@ X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric, int nFallbackLevel ) long rDummyFactor; mpServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor ); } - else if( mXFont[nFallbackLevel] != NULL ) - { - mXFont[nFallbackLevel]->ToImplFontMetricData( pMetric ); - if ( bFontVertical_ ) - pMetric->mnOrientation = 0; - } } // --------------------------------------------------------------------------- -ULONG -X11SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) +sal_uLong +X11SalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData *pKernPairs ) { if( ! bPrinter_ ) { if( mpServerFont[0] != NULL ) { ImplKernPairData* pTmpKernPairs; - ULONG nGotPairs = mpServerFont[0]->GetKernPairs( &pTmpKernPairs ); + sal_uLong nGotPairs = mpServerFont[0]->GetKernPairs( &pTmpKernPairs ); for( unsigned int i = 0; i < nPairs && i < nGotPairs; ++i ) pKernPairs[ i ] = pTmpKernPairs[ i ]; delete[] pTmpKernPairs; @@ -1786,40 +1231,40 @@ X11SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs ) // --------------------------------------------------------------------------- -BOOL X11SalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) +sal_Bool X11SalGraphics::GetGlyphBoundRect( long nGlyphIndex, Rectangle& rRect ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = mpServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; const GlyphMetric& rGM = pSF->GetGlyphMetric( nGlyphIndex ); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); - return TRUE; + return sal_True; } // --------------------------------------------------------------------------- -BOOL X11SalGraphics::GetGlyphOutline( long nGlyphIndex, +sal_Bool X11SalGraphics::GetGlyphOutline( long nGlyphIndex, ::basegfx::B2DPolyPolygon& rPolyPoly ) { int nLevel = nGlyphIndex >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) - return FALSE; + return sal_False; ServerFont* pSF = mpServerFont[ nLevel ]; if( !pSF ) - return FALSE; + return sal_False; nGlyphIndex &= ~GF_FONTMASK; if( pSF->GetGlyphOutline( nGlyphIndex, rPolyPoly ) ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } //-------------------------------------------------------------------------- @@ -1842,10 +1287,6 @@ SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe #endif pLayout = new ServerFontLayout( *mpServerFont[ nFallbackLevel ] ); } - else if( mXFont[ nFallbackLevel ] ) - pLayout = new X11FontLayout( *mXFont[ nFallbackLevel ] ); - else - pLayout = NULL; return pLayout; } @@ -1877,7 +1318,7 @@ SystemFontData X11SalGraphics::GetSysFontData( int nFallbacklevel ) const //-------------------------------------------------------------------------- -BOOL X11SalGraphics::CreateFontSubset( +sal_Bool X11SalGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFont, sal_Int32* pGlyphIDs, @@ -1909,7 +1350,6 @@ BOOL X11SalGraphics::CreateFontSubset( const void* X11SalGraphics::GetEmbedFontData( const ImplFontData* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen ) { -#ifndef _USE_PRINT_EXTENSION_ // in this context the pFont->GetFontId() is a valid PSP // font since they are the only ones left after the PDF // export has filtered its list of subsettable fonts (for @@ -1917,25 +1357,19 @@ const void* X11SalGraphics::GetEmbedFontData( const ImplFontData* pFont, const s // be to have the GlyphCache search for the ImplFontData pFont psp::fontID aFont = pFont->GetFontId(); return PspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, rInfo, pDataLen ); -#else - return NULL; -#endif } //-------------------------------------------------------------------------- void X11SalGraphics::FreeEmbedFontData( const void* pData, long nLen ) { -#ifndef _USE_PRINT_EXTENSION_ PspGraphics::DoFreeEmbedFontData( pData, nLen ); -#endif } //-------------------------------------------------------------------------- const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const ImplFontData* pFont, const Ucs2OStrMap** pNonEncoded ) { -#ifndef _USE_PRINT_EXTENSION_ // in this context the pFont->GetFontId() is a valid PSP // font since they are the only ones left after the PDF // export has filtered its list of subsettable fonts (for @@ -1943,9 +1377,6 @@ const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const ImplFontData* pF // be to have the GlyphCache search for the ImplFontData pFont psp::fontID aFont = pFont->GetFontId(); return PspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded ); -#else - return NULL; -#endif } //-------------------------------------------------------------------------- diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx index 6f94b5d90018..9951367d2e70 100644 --- a/vcl/unx/source/gdi/salprnpsp.cxx +++ b/vcl/unx/source/gdi/salprnpsp.cxx @@ -55,6 +55,8 @@ #include "vcl/svapp.hxx" #include "vcl/jobset.h" #include "vcl/print.h" +#include "vcl/print.hxx" +#include "vcl/pdfwriter.hxx" #include "vcl/salptype.hxx" #include "vcl/printerinfomanager.hxx" @@ -62,7 +64,10 @@ #include "osl/module.h" +#include <com/sun/star/beans/PropertyValue.hpp> + using namespace psp; +using namespace com::sun::star; using ::rtl::OUString; using ::rtl::OUStringHash; @@ -214,7 +219,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) if( rData.getStreamBuffer( pBuffer, nBytes ) ) { pJobSetup->mnDriverDataLen = nBytes; - pJobSetup->mpDriverData = (BYTE*)pBuffer; + pJobSetup->mpDriverData = (sal_uInt8*)pBuffer; } else { @@ -589,15 +594,15 @@ void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics ) // ----------------------------------------------------------------------- -BOOL PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) +sal_Bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) { if( ! pFrame || ! pJobSetup ) - return FALSE; + return sal_False; getPaLib(); if( ! pSetupFunction ) - return FALSE; + return sal_False; PrinterInfoManager& rManager = PrinterInfoManager::get(); @@ -617,14 +622,14 @@ BOOL PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) void* pBuffer = NULL; aInfo.getStreamBuffer( pBuffer, nBytes ); pJobSetup->mnDriverDataLen = nBytes; - pJobSetup->mpDriverData = (BYTE*)pBuffer; + pJobSetup->mpDriverData = (sal_uInt8*)pBuffer; // copy everything to job setup copyJobDataToJobSetup( pJobSetup, aInfo ); JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -634,7 +639,7 @@ BOOL PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) // data should be merged into the driver data // If pJobSetup->mpDriverData IS NULL, then the driver defaults // should be merged into the independent data -BOOL PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) +sal_Bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) { // set/clear backwards compatibility flag bool bStrictSO52Compatibility = false; @@ -653,7 +658,7 @@ BOOL PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) copyJobDataToJobSetup( pJobSetup, m_aJobData ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -662,8 +667,8 @@ BOOL PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) // and sets the new independ data in pJobSetup // Only the data must be changed, where the bit // in nGetDataFlags is set -BOOL PspSalInfoPrinter::SetData( - ULONG nSetDataFlags, +sal_Bool PspSalInfoPrinter::SetData( + sal_uLong nSetDataFlags, ImplJobSetup* pJobSetup ) { JobData aData; @@ -701,7 +706,7 @@ BOOL PspSalInfoPrinter::SetData( } if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) ) - return FALSE; + return sal_False; } // merge paperbin if necessary @@ -761,10 +766,10 @@ BOOL PspSalInfoPrinter::SetData( m_aJobData = aData; copyJobDataToJobSetup( pJobSetup, aData ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -813,7 +818,7 @@ void PspSalInfoPrinter::GetPageInfo( // ----------------------------------------------------------------------- -ULONG PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) +sal_uLong PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) { if( ! pJobSetup ) return 0; @@ -827,7 +832,7 @@ ULONG PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) // ----------------------------------------------------------------------- -String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG nPaperBin ) +String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_uLong nPaperBin ) { JobData aData; JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); @@ -836,7 +841,7 @@ String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG if( aData.m_pParser ) { const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL; - if( ! pKey || nPaperBin >= (ULONG)pKey->countValues() ) + if( ! pKey || nPaperBin >= (sal_uLong)pKey->countValues() ) aRet = aData.m_pParser->getDefaultInputSlot(); else { @@ -851,7 +856,7 @@ String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG // ----------------------------------------------------------------------- -ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT nType ) +sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, sal_uInt16 nType ) { switch( nType ) { @@ -885,9 +890,26 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT case PRINTER_CAPABILITIES_FAX: return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "fax" ) ? 1 : 0; case PRINTER_CAPABILITIES_PDF: - return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "pdf" ) ? 1 : 0; + if( PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "pdf" ) ) + return 1; + else + { + // see if the PPD contains a value to set Collate to True + JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ); + if( pJobSetup->mpDriverData ) + JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); + return aData.m_nPDFDevice > 0 ? 1 : 0; + } case PRINTER_CAPABILITIES_EXTERNALDIALOG: return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "external_dialog" ) ? 1 : 0; + case PRINTER_CAPABILITIES_USEPULLMODEL: + { + // see if the PPD contains a value to set Collate to True + JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ); + if( pJobSetup->mpDriverData ) + JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); + return aData.m_nPDFDevice > 0 ? 1 : 0; + } default: break; }; return 0; @@ -903,6 +925,7 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT : m_bFax( false ), m_bPdf( false ), m_bSwallowFaxNo( false ), + m_bIsPDFWriterJob( false ), m_pGraphics( NULL ), m_nCopies( 1 ), m_bCollate( false ), @@ -927,11 +950,11 @@ static String getTmpName() return aSys; } -BOOL PspSalPrinter::StartJob( +sal_Bool PspSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, + sal_uLong nCopies, bool bCollate, bool bDirect, ImplJobSetup* pJobSetup ) @@ -1007,29 +1030,35 @@ BOOL PspSalPrinter::StartJob( } m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility ); - return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? TRUE : FALSE; + return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? sal_True : sal_False; } // ----------------------------------------------------------------------- -BOOL PspSalPrinter::EndJob() +sal_Bool PspSalPrinter::EndJob() { - BOOL bSuccess = m_aPrintJob.EndJob(); - - if( bSuccess ) + sal_Bool bSuccess = sal_False; + if( m_bIsPDFWriterJob ) + bSuccess = sal_True; + else { - // check for fax - if( m_bFax ) - { + bSuccess = m_aPrintJob.EndJob(); - const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); - // sendAFax removes the file after use - bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand ); - } - else if( m_bPdf ) + if( bSuccess ) { - const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); - bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand ); + // check for fax + if( m_bFax ) + { + + const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); + // sendAFax removes the file after use + bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand ); + } + else if( m_bPdf ) + { + const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) ); + bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand ); + } } } GetSalData()->m_pInstance->jobEndedPrinterUpdate(); @@ -1038,16 +1067,16 @@ BOOL PspSalPrinter::EndJob() // ----------------------------------------------------------------------- -BOOL PspSalPrinter::AbortJob() +sal_Bool PspSalPrinter::AbortJob() { - BOOL bAbort = m_aPrintJob.AbortJob() ? TRUE : FALSE; + sal_Bool bAbort = m_aPrintJob.AbortJob() ? sal_True : sal_False; GetSalData()->m_pInstance->jobEndedPrinterUpdate(); return bAbort; } // ----------------------------------------------------------------------- -SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL ) +SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, sal_Bool ) { JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData ); m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter ); @@ -1068,20 +1097,286 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL ) // ----------------------------------------------------------------------- -BOOL PspSalPrinter::EndPage() +sal_Bool PspSalPrinter::EndPage() { sal_Bool bResult = m_aPrintJob.EndPage(); m_aPrinterGfx.Clear(); - return bResult ? TRUE : FALSE; + return bResult ? sal_True : sal_False; } // ----------------------------------------------------------------------- -ULONG PspSalPrinter::GetErrorCode() +sal_uLong PspSalPrinter::GetErrorCode() { return 0; } +// ----------------------------------------------------------------------- + +struct PDFNewJobParameters +{ + Size maPageSize; + sal_uInt16 mnPaperBin; + + PDFNewJobParameters( const Size& i_rSize = Size(), + sal_uInt16 i_nPaperBin = 0xffff ) + : maPageSize( i_rSize ), mnPaperBin( i_nPaperBin ) {} + + bool operator!=(const PDFNewJobParameters& rComp ) const + { + Size aCompLSSize( rComp.maPageSize.Height(), rComp.maPageSize.Width() ); + return + (maPageSize != rComp.maPageSize && maPageSize != aCompLSSize) + || mnPaperBin != rComp.mnPaperBin + ; + } + + bool operator==(const PDFNewJobParameters& rComp) const + { + return ! this->operator!=(rComp); + } +}; + +struct PDFPrintFile +{ + rtl::OUString maTmpURL; + PDFNewJobParameters maParameters; + + PDFPrintFile( const rtl::OUString& i_rURL, const PDFNewJobParameters& i_rNewParameters ) + : maTmpURL( i_rURL ) + , maParameters( i_rNewParameters ) {} +}; + +sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName, + ImplJobSetup* i_pSetupData, vcl::PrinterController& i_rController ) +{ + OSL_TRACE( "StartJob with controller: pFilename = %s", i_pFileName ? rtl::OUStringToOString( *i_pFileName, RTL_TEXTENCODING_UTF8 ).getStr() : "<nil>" ); + // mark for endjob + m_bIsPDFWriterJob = true; + // reset IsLastPage + i_rController.setLastPage( sal_False ); + + // update job data + if( i_pSetupData ) + JobData::constructFromStreamBuffer( i_pSetupData->mpDriverData, i_pSetupData->mnDriverDataLen, m_aJobData ); + + OSL_ASSERT( m_aJobData.m_nPDFDevice > 0 ); + m_aJobData.m_nPDFDevice = 1; + + // possibly create one job for collated output + sal_Bool bSinglePrintJobs = sal_False; + beans::PropertyValue* pSingleValue = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) ); + if( pSingleValue ) + { + pSingleValue->Value >>= bSinglePrintJobs; + } + + int nCopies = i_rController.getPrinter()->GetCopyCount(); + bool bCollate = i_rController.getPrinter()->IsCollateCopy(); + + // notify start of real print job + i_rController.jobStarted(); + + // setup PDFWriter context + vcl::PDFWriter::PDFWriterContext aContext; + aContext.Version = vcl::PDFWriter::PDF_1_4; + aContext.Tagged = false; + aContext.EmbedStandardFonts = true; + aContext.DocumentLocale = Application::GetSettings().GetLocale(); + aContext.ColorMode = i_rController.getPrinter()->GetPrinterOptions().IsConvertToGreyscales() + ? vcl::PDFWriter::DrawGreyscale : vcl::PDFWriter::DrawColor; + + // prepare doc info + aContext.DocumentInfo.Title = i_rJobName; + aContext.DocumentInfo.Creator = i_rAppName; + aContext.DocumentInfo.Producer = i_rAppName; + + // define how we handle metafiles in PDFWriter + vcl::PDFWriter::PlayMetafileContext aMtfContext; + aMtfContext.m_bOnlyLosslessCompression = true; + + boost::shared_ptr<vcl::PDFWriter> pWriter; + std::vector< PDFPrintFile > aPDFFiles; + boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() ); + int nAllPages = i_rController.getFilteredPageCount(); + i_rController.createProgressDialog(); + bool bAborted = false; + PDFNewJobParameters aLastParm; + + aContext.DPIx = pPrinter->ImplGetDPIX(); + aContext.DPIy = pPrinter->ImplGetDPIY(); + for( int nPage = 0; nPage < nAllPages && ! bAborted; nPage++ ) + { + if( nPage == nAllPages-1 ) + i_rController.setLastPage( sal_True ); + + // get the page's metafile + GDIMetaFile aPageFile; + vcl::PrinterController::PageSize aPageSize = i_rController.getFilteredPageFile( nPage, aPageFile ); + if( i_rController.isProgressCanceled() ) + { + bAborted = true; + if( nPage != nAllPages-1 ) + { + i_rController.createProgressDialog(); + i_rController.setLastPage( sal_True ); + i_rController.getFilteredPageFile( nPage, aPageFile ); + } + } + else + { + pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + pPrinter->SetPaperSizeUser( aPageSize.aSize, true ); + PDFNewJobParameters aNewParm( pPrinter->GetPaperSize(), pPrinter->GetPaperBin() ); + + // create PDF writer on demand + // either on first page + // or on paper format change - cups does not support multiple paper formats per job (yet?) + // so we need to start a new job to get a new paper format from the printer + // orientation switches (that is switch of height and width) is handled transparently by CUPS + if( ! pWriter || + (aNewParm != aLastParm && ! i_pFileName ) ) + { + if( pWriter ) + { + pWriter->Emit(); + } + // produce PDF file + OUString aPDFUrl; + if( i_pFileName ) + aPDFUrl = *i_pFileName; + else + osl_createTempFile( NULL, NULL, &aPDFUrl.pData ); + // normalize to file URL + if( aPDFUrl.compareToAscii( "file:", 5 ) != 0 ) + { + // this is not a file URL, but it should + // form it into a osl friendly file URL + rtl::OUString aTmp; + osl_getFileURLFromSystemPath( aPDFUrl.pData, &aTmp.pData ); + aPDFUrl = aTmp; + } + // save current file and paper format + aLastParm = aNewParm; + aPDFFiles.push_back( PDFPrintFile( aPDFUrl, aNewParm ) ); + // update context + aContext.URL = aPDFUrl; + + // create and initialize PDFWriter + #if defined __SUNPRO_CC + #pragma disable_warn + #endif + pWriter.reset( new vcl::PDFWriter( aContext, uno::Reference< beans::XMaterialHolder >() ) ); + #if defined __SUNPRO_CC + #pragma enable_warn + #endif + } + + pWriter->NewPage( TenMuToPt( aNewParm.maPageSize.Width() ), + TenMuToPt( aNewParm.maPageSize.Height() ), + vcl::PDFWriter::Portrait ); + + pWriter->PlayMetafile( aPageFile, aMtfContext, NULL ); + } + } + + // emit the last file + if( pWriter ) + pWriter->Emit(); + + // handle collate, copy count and multiple jobs correctly + int nOuterJobs = 1; + if( bSinglePrintJobs ) + { + nOuterJobs = nCopies; + m_aJobData.m_nCopies = 1; + } + else + { + if( bCollate ) + { + if( aPDFFiles.size() == 1 && pPrinter->HasSupport( SUPPORT_COLLATECOPY ) ) + { + m_aJobData.setCollate( true ); + m_aJobData.m_nCopies = nCopies; + } + else + { + nOuterJobs = nCopies; + m_aJobData.m_nCopies = 1; + } + } + else + { + m_aJobData.setCollate( false ); + m_aJobData.m_nCopies = nCopies; + } + } + + // spool files + if( ! i_pFileName && ! bAborted ) + { + bool bFirstJob = true; + for( int nCurJob = 0; nCurJob < nOuterJobs; nCurJob++ ) + { + for( size_t i = 0; i < aPDFFiles.size(); i++ ) + { + oslFileHandle pFile = NULL; + osl_openFile( aPDFFiles[i].maTmpURL.pData, &pFile, osl_File_OpenFlag_Read ); + if( pFile ) + { + osl_setFilePos( pFile, osl_Pos_Absolut, 0 ); + std::vector< char > buffer( 0x10000, 0 ); + // update job data with current page size + Size aPageSize( aPDFFiles[i].maParameters.maPageSize ); + m_aJobData.setPaper( TenMuToPt( aPageSize.Width() ), TenMuToPt( aPageSize.Height() ) ); + // update job data with current paperbin + m_aJobData.setPaperBin( aPDFFiles[i].maParameters.mnPaperBin ); + + // spool current file + FILE* fp = PrinterInfoManager::get().startSpool( pPrinter->GetName(), i_rController.isDirectPrint() ); + if( fp ) + { + sal_uInt64 nBytesRead = 0; + do + { + osl_readFile( pFile, &buffer[0], buffer.size(), &nBytesRead ); + if( nBytesRead > 0 ) + fwrite( &buffer[0], 1, nBytesRead, fp ); + } while( nBytesRead == buffer.size() ); + rtl::OUStringBuffer aBuf( i_rJobName.Len() + 8 ); + aBuf.append( i_rJobName ); + if( i > 0 || nCurJob > 0 ) + { + aBuf.append( sal_Unicode(' ') ); + aBuf.append( sal_Int32( i + nCurJob * aPDFFiles.size() ) ); + } + PrinterInfoManager::get().endSpool( pPrinter->GetName(), aBuf.makeStringAndClear(), fp, m_aJobData, bFirstJob ); + bFirstJob = false; + } + } + osl_closeFile( pFile ); + } + } + } + + // job has been spooled + i_rController.setJobState( bAborted ? view::PrintableState_JOB_ABORTED : view::PrintableState_JOB_SPOOLED ); + + // clean up the temporary PDF files + if( ! i_pFileName || bAborted ) + { + for( size_t i = 0; i < aPDFFiles.size(); i++ ) + { + osl_removeFile( aPDFFiles[i].maTmpURL.pData ); + OSL_TRACE( "removed print PDF file %s\n", rtl::OUStringToOString( aPDFFiles[i].maTmpURL, RTL_TEXTENCODING_UTF8 ).getStr() ); + } + } + + return sal_True; +} + + namespace x11 { class PrinterUpdate diff --git a/vcl/unx/source/gdi/salvd.cxx b/vcl/unx/source/gdi/salvd.cxx index ce8421f14f49..c6797cc6418c 100644 --- a/vcl/unx/source/gdi/salvd.cxx +++ b/vcl/unx/source/gdi/salvd.cxx @@ -45,7 +45,7 @@ // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, long nDX, long nDY, - USHORT nBitCount, const SystemGraphicsData *pData ) + sal_uInt16 nBitCount, const SystemGraphicsData *pData ) { X11SalVirtualDevice *pVDev = new X11SalVirtualDevice(); if( !nBitCount && pGraphics ) @@ -127,14 +127,14 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap, m_pFrame = NULL; bWindow_ = pDisplay->IsDisplay(); - bVirDev_ = TRUE; + bVirDev_ = sal_True; } // -=-= SalVirDevData / SalVirtualDevice -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL X11SalVirtualDevice::Init( SalDisplay *pDisplay, +sal_Bool X11SalVirtualDevice::Init( SalDisplay *pDisplay, long nDX, long nDY, - USHORT nBitCount, + sal_uInt16 nBitCount, int nScreen, Pixmap hDrawable, XRenderPictFormat* pXRenderFormat ) @@ -171,12 +171,12 @@ BOOL X11SalVirtualDevice::Init( SalDisplay *pDisplay, else { hDrawable_ = hDrawable; - bExternPixmap_ = TRUE; + bExternPixmap_ = sal_True; } pGraphics_->Init( this, pColormap, bDeleteColormap ); - return hDrawable_ != None ? TRUE : FALSE; + return hDrawable_ != None ? sal_True : sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -188,8 +188,8 @@ X11SalVirtualDevice::X11SalVirtualDevice() nDX_ = 0; nDY_ = 0; nDepth_ = 0; - bGraphics_ = FALSE; - bExternPixmap_ = FALSE; + bGraphics_ = sal_False; + bExternPixmap_ = sal_False; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -209,18 +209,18 @@ SalGraphics* X11SalVirtualDevice::GetGraphics() return NULL; if( pGraphics_ ) - bGraphics_ = TRUE; + bGraphics_ = sal_True; return pGraphics_; } void X11SalVirtualDevice::ReleaseGraphics( SalGraphics* ) -{ bGraphics_ = FALSE; } +{ bGraphics_ = sal_False; } -BOOL X11SalVirtualDevice::SetSize( long nDX, long nDY ) +sal_Bool X11SalVirtualDevice::SetSize( long nDX, long nDY ) { if( bExternPixmap_ ) - return FALSE; + return sal_False; // #144688# // the X protocol request CreatePixmap puts an upper bound @@ -230,7 +230,7 @@ BOOL X11SalVirtualDevice::SetSize( long nDX, long nDY ) // 16 bit truncation here without noticing. if( nDX < 0 || nDX > 65535 || nDY < 0 || nDY > 65535 ) - return FALSE; + return sal_False; if( !nDX ) nDX = 1; if( !nDY ) nDY = 1; @@ -249,7 +249,7 @@ BOOL X11SalVirtualDevice::SetSize( long nDX, long nDY ) nDX_ = 1; nDY_ = 1; } - return FALSE; + return sal_False; } if( GetDrawable() ) @@ -262,7 +262,7 @@ BOOL X11SalVirtualDevice::SetSize( long nDX, long nDY ) if( pGraphics_ ) InitGraphics( this ); - return TRUE; + return sal_True; } void X11SalVirtualDevice::GetSize( long& rWidth, long& rHeight ) diff --git a/vcl/unx/source/gdi/xfont.cxx b/vcl/unx/source/gdi/xfont.cxx deleted file mode 100644 index 0408a4ab7511..000000000000 --- a/vcl/unx/source/gdi/xfont.cxx +++ /dev/null @@ -1,763 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - -#include <salunx.h> -#include "xfont.hxx" -#include "xlfd_extd.hxx" -#include "salcvt.hxx" -#include <tools/string.hxx> -#include <vcl/outfont.hxx> -#include <saldisp.hxx> -#include <salgdi.h> - -// for GetMirroredChar -#include <vcl/svapp.hxx> - -#if OSL_DEBUG_LEVEL > 1 -#include <cstdio> -#endif - -#include <algorithm> - -#define VCLASS_ROTATE 0 -#define VCLASS_ROTATE_REVERSE 1 -#define VCLASS_TRANSFORM1 2 -#define VCLASS_TRANSFORM2 3 -#define VCLASS_CJK 4 -#define VCLASS_DONTKNOW 5 -#define VCLASS_FONT_NUM 2 // Other than rotate and rotate_reverse, - // don't have spacial font - -// Select the max size of a font, which is token for real -// This routine is (and should be) called only once, the result should be -// stored in some static variable - -static int GetMaxFontHeight() -{ - static int nMaxFontHeight = 0; - if( nMaxFontHeight <= 0 ) - { - const char *pFontHeight = getenv ("SAL_MAXFONTHEIGHT"); - if( pFontHeight ) - nMaxFontHeight = atoi( pFontHeight ); - static const int DEFAULT_MAXFONTHEIGHT = 250; - if (nMaxFontHeight <= 20) - nMaxFontHeight = DEFAULT_MAXFONTHEIGHT; - } - - return nMaxFontHeight; -} - - -ExtendedFontStruct::ExtendedFontStruct( Display* pDisplay, const Size& rPixelSize, - sal_Bool bVertical, ExtendedXlfd* pXlfd ) : - mpDisplay( pDisplay ), - maPixelSize( rPixelSize ), - mfXScale(1.0), mfYScale(1.0), - mbVertical( bVertical ), - mnCachedEncoding( RTL_TEXTENCODING_DONTKNOW ), - mpXlfd( pXlfd ), - mpRangeCodes(NULL), - mnRangeCount(-1) -{ - if( !maPixelSize.Width() ) - maPixelSize.Width() = maPixelSize.Height(); - mnAsciiEncoding = GetAsciiEncoding (NULL); - mnDefaultWidth = GetDefaultWidth(); - - mpXFontStruct = (XFontStruct**)calloc( mpXlfd->NumEncodings(), - sizeof(XFontStruct*) ); -} - -ExtendedFontStruct::~ExtendedFontStruct() -{ - delete[] mpRangeCodes; - - for ( int nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - if ( mpXFontStruct[nIdx] != NULL ) - XFreeFont( mpDisplay, mpXFontStruct[nIdx] ); - - free(mpXFontStruct); -} - -rtl_TextEncoding -ExtendedFontStruct::GetAsciiEncoding( int *pAsciiRange ) const -{ - return mpXlfd->GetAsciiEncoding( pAsciiRange ); -} - -FontPitch -ExtendedFontStruct::GetSpacing( rtl_TextEncoding nEncoding ) -{ - return mpXlfd->GetPitch( nEncoding ); -} - -static XFontStruct* -LoadXFont (Display* pDisplay, const char* pFontName) -{ - XFontStruct* pFont = XLoadQueryFont (pDisplay, pFontName); - if ((pFont != NULL) && (pFont->fid == 0)) - pFont->fid = XLoadFont(pDisplay, pFontName); - - return pFont; -} - -int -ExtendedFontStruct::LoadEncoding( rtl_TextEncoding nEncoding ) -{ - int nIdx = mpXlfd->GetEncodingIdx( nEncoding ); - if ( (nIdx < 0) || (mpXFontStruct[ nIdx ] != NULL) ) - return nIdx; - - // limit font height that gets requested from the XServer - int nReqPixelHeight = maPixelSize.Height(); - if( nReqPixelHeight > GetMaxFontHeight() ) - nReqPixelHeight = GetMaxFontHeight(); - else if( nReqPixelHeight < 2 ) - nReqPixelHeight = 2; - - // get the X11 font from a matching XLFD - ByteString aFontName; - mpXlfd->ToString( aFontName, nReqPixelHeight, nEncoding ); - mpXFontStruct[ nIdx ] = LoadXFont( mpDisplay, aFontName.GetBuffer() ); - if (mpXFontStruct[nIdx] == NULL) - mpXFontStruct[nIdx] = LoadXFont( mpDisplay, "fixed" ); - - // calculate correction factors to improve matching - // the selected font size to the used bitmap font - int nRealPixelSize = mpXlfd->GetPixelSize(); - if( !nRealPixelSize ) // check for scalable mpXlfd - nRealPixelSize = nReqPixelHeight; - if( nRealPixelSize && (nRealPixelSize != maPixelSize.Width()) ) - mfXScale = (float)maPixelSize.Width() / nRealPixelSize; - if( nRealPixelSize && (nRealPixelSize != maPixelSize.Height()) ) - mfYScale = (float)maPixelSize.Height() / nRealPixelSize; - - return nIdx; -} - -XFontStruct* -ExtendedFontStruct::GetFontStruct( rtl_TextEncoding nEncoding ) -{ - int nIdx = LoadEncoding( nEncoding ); - return nIdx < 0 ? NULL : mpXFontStruct[nIdx] ; -} - -bool -ExtendedFontStruct::GetFontBoundingBox( XCharStruct *pCharStruct, - int *pAscent, int *pDescent ) -{ - pCharStruct->lbearing = 0; - pCharStruct->rbearing = 0; - pCharStruct->width = 0; - pCharStruct->ascent = 0; - pCharStruct->descent = 0; - - *pAscent = 0; - *pDescent = 0; - - int nIdx; - - // check if there is at least one encoding already loaded - bool bEmpty = true; - for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - bEmpty &= (mpXFontStruct[nIdx] == NULL); - if ( bEmpty ) - LoadEncoding( mpXlfd->GetAsciiEncoding() ); - - // get the max bounding box from all font structs - for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - if ( mpXFontStruct[ nIdx ] != NULL ) - { - *pAscent = std::max( mpXFontStruct[nIdx]->ascent, *pAscent ); - *pDescent = std::max( mpXFontStruct[nIdx]->descent, *pDescent ); - - XCharStruct* pMaxBounds = &(mpXFontStruct[nIdx]->max_bounds); - - pCharStruct->lbearing = std::max( pMaxBounds->lbearing, - pCharStruct->lbearing ); - pCharStruct->rbearing = std::max( pMaxBounds->rbearing, - pCharStruct->rbearing ); - pCharStruct->width = std::max( pMaxBounds->width, - pCharStruct->width ); - pCharStruct->ascent = std::max( pMaxBounds->ascent, - pCharStruct->ascent ); - pCharStruct->descent = std::max( pMaxBounds->descent, - pCharStruct->descent ); - } - - // apply correction factors to better match selected size to available size - if( mfYScale != 1.0 ) - { - *pAscent = int(*pAscent * mfYScale); - *pDescent = int(*pDescent * mfYScale); - pCharStruct->ascent = (short int)(pCharStruct->ascent * mfYScale); - pCharStruct->descent = (short int)(pCharStruct->descent * mfYScale); - } - if( mfXScale != 1.0 ) - { - pCharStruct->lbearing = (short int)(pCharStruct->lbearing * mfXScale); - pCharStruct->rbearing = (short int)(pCharStruct->rbearing * mfXScale); - pCharStruct->width = (short int)(pCharStruct->width * mfXScale); - } - - return (pCharStruct->width > 0); -} - -bool -ExtendedFontStruct::ToImplFontMetricData(ImplFontMetricData *pFontMetric) -{ - pFontMetric->mnOrientation = 0; - pFontMetric->mnSlant = 0; - pFontMetric->mbDevice = true; - pFontMetric->mbScalableFont = mpXlfd->IsScalable(); - pFontMetric->mbKernableFont = false; - pFontMetric->mbSymbolFlag= mpXlfd->IsSymbolFont(); - pFontMetric->meFamily = mpXlfd->GetFamilyType(); - pFontMetric->meWeight = mpXlfd->GetWeight(); - pFontMetric->mePitch = mpXlfd->GetPitch(); - pFontMetric->meItalic = mpXlfd->GetSlant(); - - int nAscent, nDescent; - XCharStruct aBoundingBox; - if ( GetFontBoundingBox(&aBoundingBox, &nAscent, &nDescent) ) - { - pFontMetric->mnWidth = aBoundingBox.width; - pFontMetric->mnAscent = aBoundingBox.ascent; - pFontMetric->mnDescent = aBoundingBox.descent; - pFontMetric->mnIntLeading = std::max(0, aBoundingBox.ascent - nAscent - + aBoundingBox.descent - nDescent ); - pFontMetric->mnExtLeading = 0; // TODO!!! - return true; - } - else - { - return false; - } -} - -bool -ExtendedFontStruct::Match( const ExtendedXlfd *pXlfd, - const Size& rPixelSize, sal_Bool bVertical ) const -{ - if( mpXlfd != pXlfd ) - return false; - - if( bVertical != mbVertical ) - return FALSE; - - if( rPixelSize.Height() != maPixelSize.Height() ) - return FALSE; - - long nReqWidth = rPixelSize.Width(); - if( !nReqWidth ) - nReqWidth = rPixelSize.Height(); - if( nReqWidth != maPixelSize.Width() ) - return FALSE; - - return true; -} - -// Get an appropriate x-font that contains a glyph for the given unicode -// code point. -// This routine is designed to be called for each character in a text. -// It first checks the given encoding to optimize for the fact that two -// adjacent characters in a text most probably have the same encoding -// In the first call initialize pEncodingInOut to dontknow, this causes -// EncodingHasChar() to fail and thus bootstraps the encoding, otherwise -// make sure that the initial value of pFontInOut matches the encoding and -// that the encoding is valid for the font. -XFontStruct* -ExtendedFontStruct::GetFontStruct( sal_Unicode nChar, rtl_TextEncoding *pEncoding ) -{ - SalConverterCache *pCvt = SalConverterCache::GetInstance(); - - if ( pCvt->EncodingHasChar(mnAsciiEncoding, nChar) ) - { - *pEncoding = mnAsciiEncoding; - return GetFontStruct (mnAsciiEncoding); - } - else - if ( pCvt->EncodingHasChar(mnCachedEncoding, nChar) ) - { - *pEncoding = mnCachedEncoding; - return GetFontStruct (mnCachedEncoding); - } - else - { - for ( int nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - { - rtl_TextEncoding nEnc = mpXlfd->GetEncoding(nIdx); - if ( (nEnc != mnCachedEncoding) && (nEnc != mnAsciiEncoding) - && pCvt->EncodingHasChar(nEnc, nChar)) - { - mnCachedEncoding = nEnc; - *pEncoding = mnCachedEncoding; - return GetFontStruct (mnCachedEncoding); - } - } - } - - *pEncoding = RTL_TEXTENCODING_DONTKNOW; - return NULL; -} - -// --------------------------------------------------------------------------- -// utility functions to handle xfontstruct information, this is all to -// calculate charwidth information -// --------------------------------------------------------------------------- - -static bool -CharExists( const XCharStruct* pChar ) -{ - if ( pChar == NULL ) - return false; - - return pChar->width - || pChar->ascent || pChar->descent - || pChar->lbearing || pChar->rbearing; -} - -// this relies on non-null per_char information in the fontstruct -static XCharStruct* -GetCharinfo( const XFontStruct *pXFontStruct, sal_MultiByte nChar ) -{ - unsigned int nRow = nChar >> 8; - unsigned int nCol = nChar & 0xFF; - - unsigned int nMinRow = pXFontStruct->min_byte1; - unsigned int nMaxRow = pXFontStruct->max_byte1; - unsigned int nMinCol = pXFontStruct->min_char_or_byte2; - unsigned int nMaxCol = pXFontStruct->max_char_or_byte2; - - if ( nRow >= nMinRow && nRow <= nMaxRow - && nCol >= nMinCol && nCol <= nMaxCol ) - { - return &pXFontStruct->per_char[ - (nRow-nMinRow) * (nMaxCol-nMinCol+1) + (nCol-nMinCol) ]; - } - - return NULL; -} - -static sal_Size -QueryCharWidth16( Display* pDisplay, XLIB_Font nFontID, sal_MultiByte nChar, - sal_Size nDefaultWidth ) -{ - int nDirection, nFontAscent, nFontDescent; - XCharStruct aBoundingBox; - - XQueryTextExtents16( pDisplay, nFontID, (XChar2b*)&nChar, 1, - &nDirection, &nFontAscent, &nFontDescent, &aBoundingBox ); - - return CharExists( &aBoundingBox ) ? aBoundingBox.width : nDefaultWidth; -} - -sal_Size -ExtendedFontStruct::GetDefaultWidth() -{ - return (maPixelSize.Width() + 1) / 2; -} - -// Handle single byte fonts which do not require conversion, this exploits -// the fact that unicode equals latin1 or ansi1252 in the range [0..0xff] and -// is compatible with iso8859-X at least in the range to 0x7f -sal_Size -ExtendedFontStruct::GetCharWidth8( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32* pWidthArray, rtl_TextEncoding nEncoding ) -{ - if ( !(nFrom <= nTo) ) - return 0; - - XFontStruct* pXFontStruct = GetFontStruct( nEncoding ); - if ( pXFontStruct == NULL ) - return 0; - - // query the font metrics - if ( (pXFontStruct->max_bounds.width == pXFontStruct->min_bounds.width) - || (pXFontStruct->per_char == NULL) ) - { - // fixed width font - for ( int nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = pXFontStruct->max_bounds.width; - } - else - { - // variable width font - int nMinChar = pXFontStruct->min_char_or_byte2; - int nMaxChar = pXFontStruct->max_char_or_byte2; - - int nIdx = nFrom; - - for ( ; nIdx < std::min((int)nTo, nMinChar); nIdx++, pWidthArray++ ) - *pWidthArray = mnDefaultWidth; - for ( ; nIdx <= std::min((int)nTo, nMaxChar); nIdx++, pWidthArray++ ) - { - XCharStruct* pChar = &(pXFontStruct->per_char[nIdx - nMinChar]); - *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth; - } - for ( ; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = mnDefaultWidth; - } - - // return amount of handled chars - return nTo - nFrom + 1; -} - -// Handle utf16 encoded fonts, which do not require conversion -sal_Size -ExtendedFontStruct::GetCharWidthUTF16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32* pWidthArray ) -{ - if ( !(nFrom <= nTo) ) - return 0; - - XFontStruct* pXFontStruct = GetFontStruct( RTL_TEXTENCODING_UNICODE ); - FontPitch nSpacing = mpXlfd->GetPitch( RTL_TEXTENCODING_UNICODE ); - - if ( pXFontStruct == NULL ) - return 0; - - // query the font metrics - if ( nSpacing == PITCH_VARIABLE - && pXFontStruct->per_char == NULL) - { - // get per_char information from the server - for ( sal_Int32 nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = QueryCharWidth16( mpDisplay, pXFontStruct->fid, - nIdx, mnDefaultWidth ); - } - else - if ( (pXFontStruct->max_bounds.width == pXFontStruct->min_bounds.width) - || (pXFontStruct->per_char == NULL) ) - { - // really a fixed width font - for ( sal_Int32 nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = pXFontStruct->max_bounds.width; - } - else - { - // get per_char information from the xfontstruct - for ( sal_Int32 nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - { - XCharStruct* pChar = GetCharinfo( pXFontStruct, nIdx ); - *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth; - } - } - - // return amount of handled chars - return nTo - nFrom + 1; -} - -// handle non unicode fonts that are converted into encoding matching the -// font in fontstruct, 8 and 16 bit fonts are handled the same way -sal_Size -ExtendedFontStruct::GetCharWidth16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32* pWidthArray, ExtendedFontStruct *pFallback ) -{ - if ( nFrom > nTo ) - return 0; - - sal_Char pBuffer[64]; - - SalConverterCache *pCvt = SalConverterCache::GetInstance(); - for ( sal_Int32 nIdx = nFrom ; nIdx <= nTo ; nIdx++, pWidthArray++ ) - { - FontPitch nSpacing; - sal_Size nSize; - sal_Unicode nUniIdx = (sal_Unicode)nIdx; - - // get a matching fontstruct - rtl_TextEncoding nEnc; - XFontStruct *pFont; - - if ( (pFont = GetFontStruct(nUniIdx, &nEnc)) != NULL ) - { - nSpacing = GetSpacing( nEnc ); - } - else - if ( (pFallback != NULL) - && ((pFont = pFallback->GetFontStruct(nUniIdx, &nEnc)) != NULL) ) - { - nSpacing = pFallback->GetSpacing( nEnc ); - } - else - if ( (pFallback != NULL) - && ((pFont = pFallback->GetFontStruct(nUniIdx = '?', &nEnc)) != NULL) ) - { - nSpacing = pFallback->GetSpacing( nEnc ); - } - else - { - // TODO What should the default value be? - nSpacing = PITCH_FIXED; - } - - if ( pFont ) - { - nSize = pCvt->ConvertStringUTF16(&nUniIdx, 1, pBuffer, sizeof(pBuffer), nEnc); - // XXX FIXME - if ((nEnc == RTL_TEXTENCODING_GB_2312) || (nEnc == RTL_TEXTENCODING_EUC_KR)) - { - for (unsigned int n_char = 0; n_char < nSize; n_char++ ) - pBuffer[ n_char ] &= 0x7F; - } - } - - // query font metrics - if ( pFont && (nSize == 1 || nSize == 2) ) - { - sal_MultiByte nChar = (nSize == 1) ? (unsigned char)pBuffer[0] : - ((sal_MultiByte)pBuffer[0] << 8) + (sal_MultiByte)pBuffer[1]; - - if ( nSpacing == PITCH_VARIABLE - && pFont->per_char == NULL) - { - // get per_char information from the x-server - *pWidthArray = QueryCharWidth16( mpDisplay, pFont->fid, - nChar, mnDefaultWidth ); - } - else - if ( (pFont->max_bounds.width == pFont->min_bounds.width) - || (pFont->per_char == NULL) ) - { - // fixed width font - *pWidthArray = pFont->max_bounds.width; - } - else - { - // get per_char information from the xfontstruct - XCharStruct* pChar = GetCharinfo( pFont, nChar ); - *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth; - } - } - else - { - // conversion error - *pWidthArray = mnDefaultWidth; - } - } - - // return amount of handled chars - return nTo - nFrom + 1; -} - -sal_Size -ExtendedFontStruct::GetCharWidth( sal_Unicode cChar, sal_Int32 *pPhysicalWidth, - sal_Int32 *pLogicalWidth ) -{ - sal_Size nConverted = 0; - - // dispatch querying of metrics to most promising encoding candidate - int nAsciiRange; - rtl_TextEncoding nEncoding = mpXlfd->GetAsciiEncoding(&nAsciiRange); - if ( nEncoding == RTL_TEXTENCODING_UNICODE ) - { - // if we have a unicode encoded system font than we get the charwidth - // straight forward - nConverted = GetCharWidthUTF16( cChar, cChar, pPhysicalWidth ); - } - else - { - if ( cChar < nAsciiRange ) - { - // optimize the most frequent case, requesting only the latin1 - // chars which are mappable to a single encoding - nConverted = GetCharWidth8( cChar, cChar, pPhysicalWidth, nEncoding ); - } - - // if further requests are pending, then the according unicode - // codepoint has to be dispatched to one of the system fonts and - // converted to this fonts encoding - nConverted += GetCharWidth16( cChar + nConverted, cChar, - pPhysicalWidth + nConverted, NULL ); - } - - // convert physical width to logical width, apply correction factor if needed - *pLogicalWidth = *pPhysicalWidth; - if( mfXScale != 1.0 ) - *pLogicalWidth = sal_Int32(*pLogicalWidth * mfXScale); - - return nConverted; -} - -bool ExtendedFontStruct::HasUnicodeChar( sal_Unicode cChar ) const -{ - // #i18818# return false if there are no known encodings - if( !mnRangeCount ) - return false; - - // init unicode range cache if needed - if( mnRangeCount < 0 ) - { - mnRangeCount = mpXlfd->GetFontCodeRanges( NULL ); - if( !mnRangeCount ) - return false; - mpRangeCodes = new sal_uInt32[ 2*mnRangeCount ]; - mpXlfd->GetFontCodeRanges( mpRangeCodes ); - // TODO: make sure everything is sorted - } - - // binary search in unicode ranges - int nLower = 0; - int nMid = mnRangeCount; - int nUpper = 2 * mnRangeCount - 1; - while( nLower < nUpper ) - { - if( cChar >= mpRangeCodes[ nMid ] ) - nLower = nMid; - else - nUpper = nMid - 1; - nMid = (nLower + nUpper + 1) / 2; - } - if( (nMid == 0) && (cChar < mpRangeCodes[0]) ) - return false; - return (nMid & 1) ? false: true; -} - -int ExtendedFontStruct::GetFontCodeRanges( sal_uInt32* pCodePairs ) const -{ - // make sure unicode range cache is initialized - HasUnicodeChar(0); - - // transfer range pairs if requested - if( pCodePairs ) - { - for( int i = 0; i < 2*mnRangeCount; ++i ) - pCodePairs[i] = mpRangeCodes[i]; - } - - return mnRangeCount; -} - -// ======================================================================= - -X11FontLayout::X11FontLayout( ExtendedFontStruct& rFont ) -: mrFont( rFont ) -{} - -// ----------------------------------------------------------------------- - -bool X11FontLayout::LayoutText( ImplLayoutArgs& rArgs ) -{ - Point aNewPos( 0, 0 ); - bool bRightToLeft; - int nCharPos; - - for( nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); ) - { - sal_UCS4 cChar = rArgs.mpStr[ nCharPos ]; - if( bRightToLeft ) - cChar = GetMirroredChar( cChar ); - int nGlyphIndex = cChar | GF_ISCHAR; - - // check if the font supports the char - if( !mrFont.HasUnicodeChar( cChar ) ) - { - // try to replace the failing char using the same font - const char* pApproxUTF8 = GetAutofallback( cChar ); - cChar = 0; - if( pApproxUTF8 ) - { - String aApproxStr( pApproxUTF8, RTL_TEXTENCODING_UTF8 ); - if( aApproxStr.Len() == 1 ) - { - // TODO: support Autofallback for len>1 - sal_Unicode cApprox = aApproxStr.GetChar( 0 ); - if( mrFont.HasUnicodeChar( cApprox ) ) - nGlyphIndex = (cChar = cApprox) | GF_ISCHAR; - } - } - // request fallback glyph if necessary - if( !cChar ) - { - rArgs.NeedFallback( nCharPos, bRightToLeft ); - if( rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK ) - nGlyphIndex = 0; // drop NotDef fallback glyphs - } - } - - sal_Int32 nPhysGlyphWidth, nLogGlyphWidth; - mrFont.GetCharWidth( cChar, &nPhysGlyphWidth, &nLogGlyphWidth ); - int nGlyphFlags = (nPhysGlyphWidth > 0) ? 0 : GlyphItem::IS_IN_CLUSTER; - if( bRightToLeft ) - nGlyphFlags |= GlyphItem::IS_RTL_GLYPH; - GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nPhysGlyphWidth ); - aGI.mnNewWidth = nLogGlyphWidth; - AppendGlyph( aGI ); - - aNewPos.X() += nLogGlyphWidth; - } - - return (nCharPos >= 0); -} - -// ----------------------------------------------------------------------- - -void X11FontLayout::AdjustLayout( ImplLayoutArgs& rArgs ) -{ - GenericSalLayout::AdjustLayout( rArgs ); - SetOrientation( 0 ); // X11 fonts are to be rotated in upper layers -} - -// ----------------------------------------------------------------------- - -void X11FontLayout::DrawText( SalGraphics& rSalGraphics ) const -{ - static const int MAXGLYPHS = 160; - int nMaxGlyphs = GetOrientation() ? 1 : MAXGLYPHS; - - // workaround for #i49902# similar to #b6228733 with XDrawText items - // => output each item separately for non-unicode font encodings! - // this is done here instead of in DrawStringUCS2MB() because - // it needs the item positions and they are easily available here - if( mrFont.GetAsciiEncoding() != RTL_TEXTENCODING_UNICODE ) - nMaxGlyphs = 1; - - Point aPos; - sal_GlyphId aGlyphAry[ MAXGLYPHS ]; - sal_Unicode pStr[ MAXGLYPHS ]; - for( int nStart=0;;) - { - int nGlyphCount = GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart ); - if( !nGlyphCount ) - break; - - for( int i = 0; i < nGlyphCount; ++i ) - pStr[ i ] = aGlyphAry[ i ] & GF_IDXMASK; - - static_cast<X11SalGraphics&>(rSalGraphics).DrawStringUCS2MB( mrFont, aPos, pStr, nGlyphCount ); - } -} - -// ======================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/gdi/xlfd_attr.cxx b/vcl/unx/source/gdi/xlfd_attr.cxx deleted file mode 100644 index f8b2adab0456..000000000000 --- a/vcl/unx/source/gdi/xlfd_attr.cxx +++ /dev/null @@ -1,698 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include <memory> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sal/alloca.h> -#include <sal/macros.h> -#include "xlfd_attr.hxx" -#include <rtl/tencinfo.h> -#include <vcl/vclenum.hxx> - -// --------------------------------------------------------------------------- -// -// -// Attribute is a container for simple name value pairs -// eg. ( "times", FAMILY_ROMAN ) or ( "demi bold", WEIGHT_SEMIBOLD ) -// enriched with an annotation which is a pretty-printed version of the -// string, i.e. "itc avant garde" would get an annotation of "Itc Avant Garde" -// -// -// --------------------------------------------------------------------------- - -// release the stored string -void -Attribute::Release() -{ - if ( mpAnnotation != NULL ) - delete mpAnnotation; - if ( mpKeyName != NULL ) - delete mpKeyName; - if ( mpName != NULL ) - free( (void*)mpName ); -} - -// get a private copy of the given argument -void -Attribute::SetName( const char *p, int nLen ) -{ - mpName = (char*)malloc( nLen + 1 ); - mnLength = nLen; - memcpy( (void*)mpName, p, mnLength ); - ((char*)mpName)[ mnLength ] = '\0'; -} - -// Compare whether two strings a equal for the first nLen bytes -// i.e. arial == arialnarrow -int -Attribute::Compare( const char *p, int nLen ) -{ - return strncmp( mpName, p, nLen ); -} - -// Get a all lowercase name with all blanks removed -const rtl::OString& -Attribute::GetKey () -{ - static rtl::OString aEmptyStr; - - if (mpKeyName != NULL) - return *mpKeyName; - if (mnLength == 0) - return aEmptyStr; - - sal_Char* pBuffer = (sal_Char*)alloca (mnLength); - - sal_Int32 i, j; - for (i = 0, j = 0; i < mnLength; i++) - { - if ( mpName[i] != ' ' ) - pBuffer[j++] = mpName[i]; - } - mpKeyName = new rtl::OString(pBuffer, j); - - return *mpKeyName; -} - -void -Attribute::InitKey () -{ - mpKeyName = NULL; -} - -// Compare two strings, they have to be equal for nLen bytes, after nLen -// bytes both strings have to be terminated either by '\0' or by '-' -// this is for comparing a string being a substring in a Xlfd with a -// zeroterminated string -Bool -Attribute::ExactMatch( const char *p, int nLen ) -{ - Bool bMatch; - if ( nLen > 0 ) - bMatch = Compare( p, nLen ) == 0; - else - bMatch = True; - if ( bMatch ) - { - char c1 = p[ nLen ]; - char c2 = mpName[ nLen ]; - bMatch = (c1 == '-' || c1 == '\0') && (c2 == '-' || c2 == '\0'); - } - - return bMatch; -} - -void -Attribute::TagFeature( unsigned short nFeature ) -{ - if ( (nFeature & XLFD_FEATURE_NARROW) - && (strstr(mpName, "narrow") != NULL) ) - { - mnFeature |= XLFD_FEATURE_NARROW; - } - - if ( (nFeature & XLFD_FEATURE_OL_CURSOR) - && (strcmp(mpName, "open look cursor") == 0) ) - { - mnFeature |= XLFD_FEATURE_OL_CURSOR; - } - - if ( (nFeature & XLFD_FEATURE_OL_GLYPH) - && (strcmp(mpName, "open look glyph") == 0) ) - { - mnFeature |= XLFD_FEATURE_OL_GLYPH; - } - - if ( (nFeature & XLFD_FEATURE_APPLICATION_FONT) - && ( (strcmp(mpName, "interface user") == 0) - || (strcmp(mpName, "interface system") == 0))) - { - mnFeature |= XLFD_FEATURE_APPLICATION_FONT; - } - - if (nFeature & XLFD_FEATURE_INTERFACE_FONT) - { - // european - if (strcmp(mpName, "arial") == 0) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_HQ | XLFD_FEATURE_MQ); - else - if (strcmp(mpName, "helvetica") == 0) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_HQ); - else - if ( (strcmp(mpName, "lucidux sans") == 0) - || (strcmp(mpName, "luxi sans") == 0)) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_MQ | XLFD_FEATURE_LQ); - else - if (strcmp(mpName, "charter") == 0) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_MQ); - else - // japanese - if ( (strcmp(mpName, "hg mincho l") == 0) /* Solaris: jisx0208 jisx0201 */ - || (strcmp(mpName, "heiseimin") == 0) /* Solaris: jisx0212 */ - || (strcmp(mpName, "minchol") == 0) /* TurboLinux */ - || (strcmp(mpName, "mincho") == 0)) /* Redhat 6.2 JP */ - { - mnFeature |= XLFD_FEATURE_INTERFACE_FONT; - } - else - // chinese - if ( (strcmp(mpName, "kai") == 0) /* Solaris */ - || (strcmp(mpName, "ar pl mingti2l big5") == 0)) /* TurboLinux */ - { - mnFeature |= XLFD_FEATURE_INTERFACE_FONT; - } - else - // korean - if ( (strcmp(mpName, "myeongjo") == 0)) /* Solaris */ - { - mnFeature |= XLFD_FEATURE_INTERFACE_FONT; - } - } - - if ( nFeature & XLFD_FEATURE_REDUNDANTSTYLE ) - { - switch ( mpName[0] ) - { - case '\0': - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 'b': - if ( (strcmp(mpName, "bold") == 0) - || (strcmp(mpName, "bold italic") == 0) - || (strcmp(mpName, "bold sans") == 0) ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 'd': - if ( (strcmp(mpName, "demi") == 0) - || (strcmp(mpName, "demi italic") == 0) ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 'i': - if ( strcmp(mpName, "italic") == 0 ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 's': - if ( (strcmp(mpName, "sans") == 0) - || (strcmp(mpName, "serif") == 0) ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - } - } -} - -// given Attribute classifications, strings have to be in alphabetical -// order, since they are treated by binary search algorithm - -#define InitializeAttributeWith( p, a ) p, sizeof(p) - 1, a, 0, NULL, NULL - -const Attribute pFamilyAttribute[] = { - { InitializeAttributeWith( "arial", FAMILY_SWISS ) }, - { InitializeAttributeWith( "arioso", FAMILY_SCRIPT ) }, - { InitializeAttributeWith( "avant garde", FAMILY_SWISS ) }, - { InitializeAttributeWith( "avantgarde", FAMILY_SWISS ) }, - { InitializeAttributeWith( "bembo", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "bookman", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "conga", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "courier", FAMILY_MODERN ) }, - { InitializeAttributeWith( "curl", FAMILY_SCRIPT ) }, - { InitializeAttributeWith( "fixed", FAMILY_MODERN ) }, - { InitializeAttributeWith( "gill", FAMILY_SWISS ) }, - { InitializeAttributeWith( "helmet", FAMILY_MODERN ) }, - { InitializeAttributeWith( "helvetica", FAMILY_SWISS ) }, - { InitializeAttributeWith( "international", FAMILY_MODERN ) }, - { InitializeAttributeWith( "lucida", FAMILY_SWISS ) }, - { InitializeAttributeWith( "new century schoolbook", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "palatino", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "roman", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "sans serif", FAMILY_SWISS ) }, - { InitializeAttributeWith( "sansserif", FAMILY_SWISS ) }, - { InitializeAttributeWith( "serf", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "serif", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "times", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "utopia", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "zapf chancery", FAMILY_SCRIPT ) }, - { InitializeAttributeWith( "zapfchancery", FAMILY_SCRIPT ) } -}; - -const Attribute pWeightAttribute[] = { - { InitializeAttributeWith( "black", WEIGHT_BLACK ) }, - { InitializeAttributeWith( "bold", WEIGHT_BOLD ) }, - { InitializeAttributeWith( "book", WEIGHT_LIGHT ) }, - { InitializeAttributeWith( "demi", WEIGHT_SEMIBOLD ) }, - { InitializeAttributeWith( "demi bold", WEIGHT_SEMIBOLD ) }, - { InitializeAttributeWith( "demibold", WEIGHT_SEMIBOLD ) }, - { InitializeAttributeWith( "light", WEIGHT_LIGHT ) }, - { InitializeAttributeWith( "medium", WEIGHT_MEDIUM ) }, - { InitializeAttributeWith( "normal", WEIGHT_NORMAL ) }, - { InitializeAttributeWith( "regular", WEIGHT_NORMAL ) }, - { InitializeAttributeWith( "roman", WEIGHT_NORMAL ) }, - { InitializeAttributeWith( "semicondensed", WEIGHT_LIGHT ) }, - { InitializeAttributeWith( "ultrabold", WEIGHT_ULTRABOLD ) } -}; - -const Attribute pSlantAttribute[] = { - { InitializeAttributeWith( "i", ITALIC_NORMAL ) }, - { InitializeAttributeWith( "o", ITALIC_OBLIQUE ) }, - { InitializeAttributeWith( "r", ITALIC_NONE ) } -}; - -const Attribute pSetwidthAttribute[] = { - { InitializeAttributeWith( "bold", WIDTH_SEMI_EXPANDED ) }, - { InitializeAttributeWith( "condensed", WIDTH_CONDENSED ) }, - { InitializeAttributeWith( "double wide", WIDTH_ULTRA_EXPANDED ) }, - { InitializeAttributeWith( "expanded", WIDTH_EXPANDED ) }, - { InitializeAttributeWith( "extracondensed", WIDTH_EXTRA_CONDENSED ) }, - { InitializeAttributeWith( "extraexpanded", WIDTH_EXTRA_EXPANDED ) }, - { InitializeAttributeWith( "medium", WIDTH_NORMAL ) }, - { InitializeAttributeWith( "narrow", WIDTH_CONDENSED ) }, - { InitializeAttributeWith( "normal", WIDTH_NORMAL ) }, - { InitializeAttributeWith( "semicondensed", WIDTH_SEMI_CONDENSED ) }, - { InitializeAttributeWith( "semiexpanded", WIDTH_SEMI_EXPANDED ) }, - { InitializeAttributeWith( "ultracondensed", WIDTH_ULTRA_CONDENSED ) }, - { InitializeAttributeWith( "ultraexpanded", WIDTH_ULTRA_EXPANDED ) }, - { InitializeAttributeWith( "wide", WIDTH_EXPANDED ) } -}; - -const Attribute pEnhancedCharsetAttribute[] = { - { InitializeAttributeWith( "iso8859-1", RTL_TEXTENCODING_MS_1252 ) }, - { InitializeAttributeWith( "iso8859_1", RTL_TEXTENCODING_MS_1252 ) } -}; - -// ------------------------------------------------------------------------- -// -// String handling utility functions -// -// ------------------------------------------------------------------------- - - -void -AppendAttribute( Attribute *pAttribute, ByteString &rString ) -{ - if ( pAttribute == NULL ) - return ; - - int nLength = pAttribute->GetLength(); - char *pBuffer = (char*)alloca( nLength + 1); - - pBuffer[ 0 ] = '-'; - memcpy( pBuffer + 1, pAttribute->GetName(), nLength ); - rString.Append( pBuffer, nLength + 1); -} - -// -// Prettify the font name: make each leading character of a fontname -// uppercase. For example -// times new roman -> Times New Roman -// - -static void -ToUpper( char *pCharacter ) -{ - // replace [a,z] with [A,Z] - if ( (*pCharacter >= 97) && (*pCharacter <= 122) ) - *pCharacter -= 32; -} - -static String* -Capitalize( const char *pStr, int nLength ) -{ - char *pCopy = (char*)alloca( nLength + 1 ); - char *pPtr = pCopy; - memcpy( pPtr, pStr, nLength + 1 ); - - // loop over string data and uppercase first char and all chars - // following a space (other white space would be unexpected here) - char nPreviousChar = ' '; - while ( *pPtr ) - { - if ( nPreviousChar == ' ' ) - ToUpper( pPtr ); - nPreviousChar = *pPtr++; - } - - return new String( pCopy, RTL_TEXTENCODING_ISO_8859_1 ); -} - -String* -AnnotateString( const Attribute& rAttribute ) -{ - return Capitalize(rAttribute.GetName(), rAttribute.GetLength()); -} - -String* -AnnotateSlant( const Attribute& rAttribute ) -{ - const char* pStr = rAttribute.GetName(); - int nLen = rAttribute.GetLength(); - - static const struct { - const char *pFrom; const char *pTo; - } pTranslation[] = { - { "r", "Roman" }, - { "o", "Oblique" }, - { "i", "Italic" }, - { "ri", "Reverse Italic" }, - { "ro", "Reverse Oblique" }, - { "ot", "Other" } - }; - - for ( unsigned int i = 0; i < SAL_N_ELEMENTS(pTranslation); i++ ) - if ( strcmp(pStr, pTranslation[i].pFrom) == 0 ) - { - return new String( pTranslation[i].pTo, - RTL_TEXTENCODING_ISO_8859_1 ); - } - - return Capitalize(pStr, nLen); -} - -String* -AnnotateNone( const Attribute& ) -{ - return new String(); -} - -// --------------------------------------------------------------------------- -// -// -// manage global lists of Attributes -// since XListFonts does never list more than 64K fonts this storage does -// handle array size and indices with unsigned short values for low -// memory consumption -// -// -// --------------------------------------------------------------------------- - -AttributeStorage::AttributeStorage( unsigned short nDefaultValue ) : - mpList( NULL ), - mnSize( 0 ), - mnCount( 0 ), - mnLastmatch( 0 ), - mnDefaultValue( nDefaultValue ) -{ -} - -AttributeStorage::~AttributeStorage() -{ - if ( mpList != NULL ) - { - for ( int i = 0; i < mnCount; i++ ) - mpList[i].Release(); - free( mpList ); - } -} - -#if OSL_DEBUG_LEVEL > 1 -void -AttributeStorage::Dump() -{ - fprintf(stderr, "AttributeStorage: size=%i, used=%i\n", mnSize, mnCount); - for ( int i = 0; i < mnCount; i++ ) - { - ByteString aAnnotation = ByteString( - mpList[i].GetAnnotation(), - RTL_TEXTENCODING_ISO_8859_1 ); - fprintf(stderr, "\t%4i: <%s><len=%i><val=%i><%s>\n", i, mpList[i].GetName(), - mpList[i].GetLength(), mpList[i].GetValue(), - aAnnotation.GetBuffer() ); - } - fprintf(stderr, "\n"); -} -#endif - -Attribute* -AttributeStorage::Retrieve( unsigned short nIndex ) const -{ - return nIndex < mnCount ? &mpList[ nIndex ] : (Attribute*)NULL ; -} - -// pClassification contains a list of name-value pairs. If names in -// the AttributeStorage match those in the pClassification then -// the according value is copied. Matching means match for the length -// of the string in pClassification (i.e. arial matches arialnarrow) -// the strings in pClassification must be in alphabetical order, all -// strings Lowercase -void -AttributeStorage::AddClassification( Attribute *pClassification, - unsigned short nNum ) -{ - for ( int i = 0; i < mnCount; i++ ) - { - unsigned int nLower = 0; - unsigned int nUpper = nNum; - unsigned int nCurrent; - int nComparison = 1; - Attribute *pHaystack = 0, *pNeedle; - - pNeedle = &mpList[ i ]; - - // binary search - while ( nLower < nUpper ) - { - nCurrent = (nLower + nUpper) / 2; - pHaystack = &pClassification[ nCurrent ]; - nComparison = pNeedle->Compare( pHaystack->GetName(), - pHaystack->GetLength() ); - if (nComparison < 0) - nUpper = nCurrent; - else - if (nComparison > 0) - nLower = nCurrent + 1; - else - break; - } - - // if there's a match store the according classification in the - // Attribute storage, otherwise do nothing since defaults are - // already provided in AttributeStorage::Insert() - if ( nComparison == 0 ) - pNeedle->SetValue( pHaystack->GetValue() ); - } -} - -void -AttributeStorage::AddClassification( AttributeClassifierT Classify ) -{ - for ( int i = 0; i < mnCount; i++ ) - { - Attribute& rCurrent = mpList[i] ; - int nValue = Classify( rCurrent.GetName() ); - rCurrent.SetValue( nValue ); - } -} - -void -AttributeStorage::AddAnnotation( AttributeAnnotatorT Annotate ) -{ - for ( int i = 0; i < mnCount; i++ ) - { - String* pAnnotation = Annotate( mpList[i] ); - mpList[i].SetAnnotation( pAnnotation ); - } -} - -void -AttributeStorage::TagFeature( unsigned short nFeature ) -{ - for ( int i = 0; i < mnCount; i++ ) - mpList[i].TagFeature( nFeature ); -} - -// Enlarge the list of Attributes -void -AttributeStorage::Enlarge() -{ - if ( mnSize == 0 ) - { - mnSize = 8; - mpList = (Attribute*) malloc( mnSize * sizeof(Attribute) ); - } - else - { - mnSize = mnSize < 32768 ? (mnSize * 2) : 65535; - Attribute* pTemp; - pTemp = (Attribute*) realloc( mpList, mnSize * sizeof(Attribute) ); - if (pTemp) - { - mpList = pTemp; - } - else - { - throw std::bad_alloc(); - } - } -} - -// nLength is the length as it would be reported by strlen(3) -// for an null-terminated string. if a string is part of a Xlfd -// the field separator '-' is taken as '\0' -// the AttributeStorage itself is NOT sorted to make sure that the -// leased keys are still valid -unsigned short -AttributeStorage::Insert( const char *pString, int nLength ) -{ - // check whether the last match is still equal to the current - // string since XListFonts lists fonts in sets of similar fontnames - if ( mnLastmatch < mnCount ) - { - if ( mpList[mnLastmatch].ExactMatch(pString, nLength) ) - return mnLastmatch; - } - - // otherwise search in list - for ( int i = 0; i < mnCount; i++ ) - { - if ( mpList[i].ExactMatch(pString, nLength) ) - return mnLastmatch = i; - } - - // if still not found we have to Insert the new string - if ( mnSize == mnCount ) - Enlarge(); - mpList[mnCount].SetName( pString, nLength ); - mpList[mnCount].SetValue( mnDefaultValue ); - mpList[mnCount].SetAnnotation( NULL ); - mpList[mnCount].SetFeature( XLFD_FEATURE_NONE ); - mpList[mnCount].InitKey( ); - mnLastmatch = mnCount; - mnCount = mnCount < 65535 ? mnCount + 1 : mnCount; - - return mnLastmatch; -} - - -// --------------------------------------------------------------------------- -// -// -// Attribute provider is a frame for a set of AttributeStorages. -// -// -// --------------------------------------------------------------------------- - -AttributeProvider::AttributeProvider () -{ - mpField[eXLFDFoundry ] = new AttributeStorage(0); - mpField[eXLFDFamilyName ] = new AttributeStorage(FAMILY_DONTKNOW); - mpField[eXLFDWeightName ] = new AttributeStorage(WEIGHT_NORMAL); - mpField[eXLFDSlant ] = new AttributeStorage(ITALIC_NONE); - mpField[eXLFDSetwidthName] = new AttributeStorage(WIDTH_NORMAL); - mpField[eXLFDAddstyleName] = new AttributeStorage(RTL_TEXTENCODING_DONTKNOW); - mpField[eXLFDCharset ] = new AttributeStorage(RTL_TEXTENCODING_DONTKNOW); -} - -AttributeProvider::~AttributeProvider() -{ - for ( int i = 0; i < eXLFDMaxEntry; i++ ) - delete mpField[ i ]; -} - -#if OSL_DEBUG_LEVEL > 1 -void -AttributeProvider::Dump() -{ - for ( int i = 0; i < eXLFDMaxEntry; i++ ) - mpField[ i ]->Dump(); -} -#endif - -extern "C" rtl_TextEncoding -GetTextEncodingFromAddStylename( const sal_Char *pAddStylename ) -{ - int nBufferLength = strlen( pAddStylename ) + 1; - sal_Char *pBuffer = (sal_Char*)alloca( nBufferLength ); - for ( int i = 0; i < nBufferLength; i++ ) - pBuffer[i] = pAddStylename[i] == '_' ? '-' : pAddStylename[i] ; - - return rtl_getTextEncodingFromUnixCharset( pBuffer ); -} - - -// classification information is needed before sorting because of course the -// classification is the sort criteria -void -AttributeProvider::AddClassification() -{ - /* mpField[ eXLFDFoundry ] doesn't need classification */ - mpField[ eXLFDFamilyName ]->AddClassification( - (Attribute*)pFamilyAttribute, - SAL_N_ELEMENTS(pFamilyAttribute) ); - mpField[ eXLFDWeightName ]->AddClassification( - (Attribute*)pWeightAttribute, - SAL_N_ELEMENTS(pWeightAttribute) ); - mpField[ eXLFDSlant ]->AddClassification( - (Attribute*)pSlantAttribute, - SAL_N_ELEMENTS(pSlantAttribute) ); - mpField[ eXLFDSetwidthName ]->AddClassification( - (Attribute*)pSetwidthAttribute, - SAL_N_ELEMENTS(pSetwidthAttribute) ); - mpField[ eXLFDAddstyleName ]->AddClassification( - GetTextEncodingFromAddStylename ); - mpField[ eXLFDCharset ]->AddClassification( - rtl_getTextEncodingFromUnixCharset ); -} - -// add some pretty print description -void -AttributeProvider::AddAnnotation() -{ - mpField[ eXLFDFoundry ]->AddAnnotation( AnnotateNone ); - mpField[ eXLFDFamilyName ]->AddAnnotation( AnnotateString ); - mpField[ eXLFDWeightName ]->AddAnnotation( AnnotateString ); - mpField[ eXLFDSlant ]->AddAnnotation( AnnotateSlant ); - mpField[ eXLFDSetwidthName ]->AddAnnotation( AnnotateString ); - mpField[ eXLFDAddstyleName ]->AddAnnotation( AnnotateNone ); - mpField[ eXLFDCharset ]->AddAnnotation( AnnotateNone ); -} - -// this is the misc or any section: dirty hacks for dirty xlfd usage -void -AttributeProvider::TagFeature() -{ - mpField[ eXLFDFamilyName ]->TagFeature( - XLFD_FEATURE_OL_GLYPH - | XLFD_FEATURE_OL_CURSOR - | XLFD_FEATURE_NARROW - | XLFD_FEATURE_INTERFACE_FONT - | XLFD_FEATURE_APPLICATION_FONT); - - mpField[ eXLFDSetwidthName ]->TagFeature( - XLFD_FEATURE_NARROW ); - - mpField[ eXLFDAddstyleName ]->TagFeature( - XLFD_FEATURE_REDUNDANTSTYLE ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/gdi/xlfd_attr.hxx b/vcl/unx/source/gdi/xlfd_attr.hxx deleted file mode 100644 index 18386a314e4b..000000000000 --- a/vcl/unx/source/gdi/xlfd_attr.hxx +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef XLFD_ATTRIBUTE_HXX -#define XLFD_ATTRIBUTE_HXX - -#include <salunx.h> -#include <tools/string.hxx> - - -struct Attribute { - - const char* mpName; - unsigned short mnLength; - unsigned short mnValue; - unsigned short mnFeature; - String* mpAnnotation; - rtl::OString* mpKeyName; - - const char* GetName() const - { return mpName; } - unsigned short GetValue() const - { return mnValue; } - unsigned short GetLength() const - { return mnLength; } - Bool HasFeature( unsigned short nFeature ) const - { return ((mnFeature & nFeature) != 0); } - const String &GetAnnotation() const - { return *mpAnnotation; } - const rtl::OString& - GetKey(); - void InitKey(); - - void SetName( const char *p, int nLen ); - void SetValue( unsigned short nIn ) - { mnValue = nIn; } - void SetAnnotation( String *pString ) - { mpAnnotation = pString; } - void SetFeature( unsigned short nFeature ) - { mnFeature = nFeature; } - void TagFeature( unsigned short nFeature ); - - int Compare( const char *p, int nLen ); - Bool ExactMatch( const char *p, int nLen ); - void Release(); -}; - - -void -AppendAttribute( Attribute *pAttribute, ByteString &rString ); - - -typedef String*(*AttributeAnnotatorT)(const Attribute &rAttribute); -extern "C" { -typedef rtl_TextEncoding(*AttributeClassifierT)(const char* pStr); -} - -#define XLFD_FEATURE_NONE 0x0000 -#define XLFD_FEATURE_NARROW 0x0001 -#define XLFD_FEATURE_OL_GLYPH 0x0002 -#define XLFD_FEATURE_OL_CURSOR 0x0004 -#define XLFD_FEATURE_REDUNDANTSTYLE 0x0008 -#define XLFD_FEATURE_APPLICATION_FONT 0x0010 - -#define XLFD_FEATURE_INTERFACE_FONT 0x0020 -#define XLFD_FEATURE_LQ 0x0040 -#define XLFD_FEATURE_MQ 0x0080 -#define XLFD_FEATURE_HQ 0x0100 - -// --------------------------------------------------------------------------- -// -// -// manage global lists of Attributes -// since XListFonts does never list more than 64K fonts this storage does -// handle array size and indices with unsigned short values for low -// memory consumption -// -// -// --------------------------------------------------------------------------- - -class AttributeStorage { - - private: - - Attribute* mpList; - unsigned short mnSize; - unsigned short mnCount; - unsigned short mnLastmatch; - unsigned short mnDefaultValue; - - void Enlarge(); - AttributeStorage(); - - public: - - AttributeStorage( unsigned short nDefaultValue ); - ~AttributeStorage(); - unsigned short Insert( const char *pString, int nLength ); - Attribute* Retrieve( unsigned short nIndex ) const ; - void AddClassification( Attribute *pClassification, - unsigned short nNum ); - void AddClassification( AttributeClassifierT Classify ); - void TagFeature( unsigned short nFeature ); - void AddAnnotation( AttributeAnnotatorT Annotate ); - #if OSL_DEBUG_LEVEL > 1 - void Dump(); - #endif -}; - - -// --------------------------------------------------------------------------- -// -// -// Attribute provider is a frame for a set of AttributeStorages. For XLFD -// interpretation and efficient storage, AttributeStorages for foundry, -// family_name, weight_name, slant, setwidth_name, add_style_name and combined -// charset_registry and charset_encoding are used. pixel_size, point_size, -// resolution_x and resolution_y are stored as numbers. please note that this -// does not allow storage of matrix-enhanced fonts. spacing is stored as -// a char, since only the 'm', 'c' and 'p' types are defined. -// -// -// --------------------------------------------------------------------------- - -enum eXLFDAttributeT { - eXLFDFoundry = 0, - eXLFDFamilyName, - eXLFDWeightName, - eXLFDSlant, - eXLFDSetwidthName, - eXLFDAddstyleName, - eXLFDCharset, - eXLFDMaxEntry -}; - -class AttributeProvider { - - private: - - AttributeStorage* mpField[ eXLFDMaxEntry ]; - - AttributeStorage* GetField( eXLFDAttributeT eXLFDField ) - { return mpField[ eXLFDField]; } - public: - - AttributeProvider (); - ~AttributeProvider (); - - void AddClassification(); - void AddAnnotation(); - void TagFeature(); - #if OSL_DEBUG_LEVEL > 1 - void Dump(); - #endif - - // these are just shortcuts or proxies for the most common used - // AttributeStorage functionality - AttributeStorage* GetFoundry() - { return GetField(eXLFDFoundry); } - AttributeStorage* GetFamily() - { return GetField(eXLFDFamilyName); } - AttributeStorage* GetWeight() - { return GetField(eXLFDWeightName); } - AttributeStorage* GetSlant() - { return GetField(eXLFDSlant); } - AttributeStorage* GetSetwidth() - { return GetField(eXLFDSetwidthName); } - AttributeStorage* GetAddstyle() - { return GetField(eXLFDAddstyleName); } - AttributeStorage* GetCharset() - { return GetField(eXLFDCharset); } - - Attribute* RetrieveFoundry( unsigned short nIndex ) - { return GetFoundry()->Retrieve(nIndex); } - Attribute* RetrieveFamily( unsigned short nIndex ) - { return GetFamily()->Retrieve(nIndex); } - Attribute* RetrieveWeight( unsigned short nIndex ) - { return GetWeight()->Retrieve(nIndex); } - Attribute* RetrieveSlant( unsigned short nIndex ) - { return GetSlant()->Retrieve(nIndex); } - Attribute* RetrieveSetwidth( unsigned short nIndex ) - { return GetSetwidth()->Retrieve(nIndex); } - Attribute* RetrieveAddstyle( unsigned short nIndex ) - { return GetAddstyle()->Retrieve(nIndex); } - Attribute* RetrieveCharset( unsigned short nIndex ) - { return GetCharset()->Retrieve(nIndex); } - - unsigned short InsertFoundry( const char *pString, int nLength ) - { return GetFoundry()->Insert(pString, nLength); } - unsigned short InsertFamily( const char *pString, int nLength ) - { return GetFamily()->Insert(pString, nLength); } - unsigned short InsertWeight( const char *pString, int nLength ) - { return GetWeight()->Insert(pString, nLength); } - unsigned short InsertSlant( const char *pString, int nLength ) - { return GetSlant()->Insert(pString, nLength); } - unsigned short InsertSetwidth( const char *pString, int nLength ) - { return GetSetwidth()->Insert(pString, nLength);} - unsigned short InsertAddstyle( const char *pString, int nLength ) - { return GetAddstyle()->Insert(pString, nLength);} - unsigned short InsertCharset( const char *pString, int nLength ) - { return GetCharset()->Insert(pString, nLength); } -}; - -#endif /* XLFD_ATTRIBUTE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/gdi/xlfd_extd.cxx b/vcl/unx/source/gdi/xlfd_extd.cxx deleted file mode 100644 index 6d691de88a79..000000000000 --- a/vcl/unx/source/gdi/xlfd_extd.cxx +++ /dev/null @@ -1,1002 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "xlfd_attr.hxx" -#include "xlfd_smpl.hxx" -#include "xlfd_extd.hxx" -#include <vcl/outfont.hxx> -#include <rtl/alloc.h> - -#include <rtl/tencinfo.h> - -#include <set> - -// -------------------------------------------------------------------------- - -ImplX11FontData::ImplX11FontData( const ExtendedXlfd& rXlfd, int nHeight ) -: ImplFontData( rXlfd, X11IFD_MAGIC ), - mrXlfd( rXlfd ) -{ - mnHeight = nHeight; - mnWidth = 0; -} - -ImplFontEntry* ImplX11FontData::CreateFontInstance( ImplFontSelectData& rFSD ) const -{ - ImplFontEntry* pEntry = new ImplFontEntry( rFSD ); - return pEntry; -} - -sal_IntPtr ImplX11FontData::GetFontId() const -{ - return reinterpret_cast<sal_IntPtr>(&mrXlfd); -} - -// -------------------------------------------------------------------------- -// -// classes for Xlfd handling that contain more than a single encoding. -// Members that may vary through different encodings are stored in -// a mpEncodingInfo member. There are three different classes: -// true scalable fonts (truetype and type1) scalable bitmap fonts -// (the ugly ones) and bitmap fonts. The ExtendedXlfd stores all the members -// that are specific to a font outline -// ( e.g. adobe-times-roman-medium-r-normal- X -p- X ) -// and specifies the interface. -// -// -------------------------------------------------------------------------- - -ExtendedXlfd::EncodingInfo& -ExtendedXlfd::EncodingInfo::operator= ( const Xlfd *pXlfd ) -{ - mcSpacing = pXlfd->mcSpacing; - mnResolutionX = pXlfd->mnResolutionX; - mnResolutionY = pXlfd->mnResolutionY; - mnAddstyle = pXlfd->mnAddstyle; - mnCharset = pXlfd->mnCharset; - mnEncoding = pXlfd->GetEncoding(); - - return *this; -} - -// ------ base class -------------------------------------------------------- - -ExtendedXlfd::ExtendedXlfd( bool bScalable ) -: mbScalable( bScalable ), - mnEncodings( 0 ), - mnEncCapacity( 0 ), - mpEncodingInfo( NULL ) -{ - mbOrientation = false; - mbDevice = false; - mbSubsettable = false; - mbEmbeddable = false; - - mnQuality = -1; -} - -ExtendedXlfd::~ExtendedXlfd() -{ - if ( mnEncodings != 0 ) - rtl_freeMemory( mpEncodingInfo ); -} - -inline void* -Realloc( void *pPtr, sal_Size nSize ) -{ - return rtl_reallocateMemory( pPtr, nSize ); -} - -int -ExtendedXlfd::GetEncodingIdx( rtl_TextEncoding nEncoding ) const -{ - for ( int i = 0; i < mnEncodings; i++ ) - if ( nEncoding == mpEncodingInfo[i].mnEncoding ) - return i; - return -1; -} - -bool -ExtendedXlfd::HasEncoding( rtl_TextEncoding nEncoding ) const -{ - return !(GetEncodingIdx( nEncoding ) < 0) ; -} - -rtl_TextEncoding -ExtendedXlfd::GetEncoding( int i ) const -{ - if ( i < mnEncodings && i >= 0 ) - return mpEncodingInfo[i].mnEncoding; - - return RTL_TEXTENCODING_DONTKNOW; -} - -rtl_TextEncoding -ExtendedXlfd::GetEncoding() const -{ - return mnEncodings == 1 ? mpEncodingInfo[0].mnEncoding : RTL_TEXTENCODING_DONTKNOW; -} - -// query the most unicode / Ascii compatible font: either one of the fonts -// is utf16 encoded or there's a single byte font which is unicode -// compatible for the first 256 chars (latin1) or for at least 128 -// chars (most latin-X encodings, cyrillic encodings) -rtl_TextEncoding -ExtendedXlfd::GetAsciiEncoding( int *pAsciiRange ) const -{ - rtl_TextEncoding nBestEncoding = RTL_TEXTENCODING_DONTKNOW; - int nLargestRange = 0x0000; - - for ( int i = 0; i < mnEncodings && nLargestRange < 0xffff; i++ ) - { - rtl_TextEncoding nCurEncoding = mpEncodingInfo[i].mnEncoding; - switch ( nCurEncoding ) - { - case RTL_TEXTENCODING_UNICODE: - nLargestRange = 0xffff; - nBestEncoding = nCurEncoding; - break; - - case RTL_TEXTENCODING_ISO_8859_1: - case RTL_TEXTENCODING_MS_1252: - nLargestRange = 0x00ff; - nBestEncoding = nCurEncoding; - break; - - case RTL_TEXTENCODING_ISO_8859_2: - case RTL_TEXTENCODING_ISO_8859_4: - case RTL_TEXTENCODING_ISO_8859_5: - case RTL_TEXTENCODING_ISO_8859_6: - case RTL_TEXTENCODING_ISO_8859_7: - case RTL_TEXTENCODING_ISO_8859_8: - case RTL_TEXTENCODING_ISO_8859_9: - case RTL_TEXTENCODING_ISO_8859_13: - case RTL_TEXTENCODING_ISO_8859_15: - case RTL_TEXTENCODING_MS_1251: - case RTL_TEXTENCODING_KOI8_R: - case RTL_TEXTENCODING_JIS_X_0201: - if ( nLargestRange < 0x0080 ) - { - nLargestRange = 0x0080; - nBestEncoding = nCurEncoding; - } - break; - - default: - if ( nLargestRange == 0x0000 ) - { - nBestEncoding = nCurEncoding; - } - break; - } - } - - if ( pAsciiRange != NULL ) - *pAsciiRange = nLargestRange; - - return nBestEncoding; -} - -bool -ExtendedXlfd::AddEncoding( const Xlfd *pXlfd ) -{ - rtl_TextEncoding nEncoding = pXlfd->GetEncoding(); - if ( HasEncoding(nEncoding) ) - return false; - - if ( mnEncodings == 0 ) - { - // bootstrap - mnFoundry = pXlfd->mnFoundry; - mnFamily = pXlfd->mnFamily; - mnWeight = pXlfd->mnWeight; - mnSlant = pXlfd->mnSlant; - mnSetwidth = pXlfd->mnSetwidth; - mpFactory = pXlfd->mpFactory; - - Attribute *pFamilyAttr = mpFactory->RetrieveFamily( mnFamily ); - Attribute *pWeightAttr = mpFactory->RetrieveWeight( mnWeight ); - Attribute *pWidthAttr = mpFactory->RetrieveSetwidth( mnSetwidth ); - Attribute *pSlantAttr = mpFactory->RetrieveSlant( mnSlant ); - - meFamily = GetFamilyType(); - meWeight = GetWeight(); - meItalic = GetSlant(); - meWidthType = GetWidthType(); - mbSymbolFlag= (GetEncoding() == RTL_TEXTENCODING_SYMBOL); - mePitch = GetPitch(); - - maName = pFamilyAttr->GetAnnotation(); - - // the helvetica narrow hack - if ( ! pFamilyAttr->HasFeature(XLFD_FEATURE_NARROW) - && pWidthAttr->HasFeature(XLFD_FEATURE_NARROW) ) - { - static const String aNarrow( RTL_CONSTASCII_USTRINGPARAM(" Narrow") ); - maName += aNarrow; - } - - // stylename = weight + slant + width - // XXX Fix me: there may be a space missing between them - if ( meWeight != WEIGHT_NORMAL ) - maStyleName += pWeightAttr->GetAnnotation(); - if ( meItalic != ITALIC_NONE ) - maStyleName += pSlantAttr->GetAnnotation(); - if ( (meWidthType != WIDTH_NORMAL) - && (! pWidthAttr->HasFeature(XLFD_FEATURE_NARROW)) ) - maStyleName += pWidthAttr->GetAnnotation(); - } - - if( mnEncodings <= mnEncCapacity ) - { - mnEncCapacity += mnEncodings + 4; - mpEncodingInfo = (EncodingInfo*)Realloc( mpEncodingInfo, mnEncCapacity * sizeof(EncodingInfo) ); - } - - mpEncodingInfo[ mnEncodings ] = pXlfd; - mnEncodings += 1; - return true; -} - -void -ExtendedXlfd::ToString( ByteString &rString, - unsigned short /*nPixelSize*/, rtl_TextEncoding /*nEncoding*/ ) const -{ - AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString ); -} - -void -ExtendedXlfd::ToString( ByteString &rString, - unsigned short /*nPixelSize*/, char* /*pMatricsString*/, rtl_TextEncoding /*nEncoding*/ ) const -{ - AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString ); -} - -static FontPitch GetPitchFromX11Pitch( const char cSpacing ) -{ - switch ( cSpacing ) - { - case 'c': // fall through - case 'm': return PITCH_FIXED; - case 'p': return PITCH_VARIABLE; - default: return PITCH_DONTKNOW; - } -} - -// you must not call any of the ExtendedXlfd::GetXXX() functions if the -// ExtendedXlfd is really empty (i.e. mnEncodings is zero) - -FontPitch ExtendedXlfd::GetPitch() const -{ - if( mnEncodings > 1 ) - return PITCH_VARIABLE; - if( mnEncodings == 1 ) - return GetPitchFromX11Pitch( mpEncodingInfo[0].mcSpacing ); - return PITCH_DONTKNOW; -} - -FontPitch ExtendedXlfd::GetPitch( rtl_TextEncoding nEncoding ) const -{ - for ( int nIdx = 0; nIdx < mnEncodings; nIdx++ ) - if ( mpEncodingInfo[nIdx].mnEncoding == nEncoding ) - return GetPitchFromX11Pitch( mpEncodingInfo[nIdx].mcSpacing ); - return PITCH_DONTKNOW; -} - -FontFamily ExtendedXlfd::GetFamilyType() const -{ - Attribute *pFamilyAttr= mpFactory->RetrieveFamily(mnFamily); - return (FontFamily)pFamilyAttr->GetValue(); -} - -FontWeight ExtendedXlfd::GetWeight() const -{ - Attribute *pWeightAttr = mpFactory->RetrieveWeight(mnWeight); - return (FontWeight)pWeightAttr->GetValue(); -} - -FontItalic ExtendedXlfd::GetSlant() const -{ - Attribute *pSlantAttr = mpFactory->RetrieveSlant(mnSlant); - return (FontItalic)pSlantAttr->GetValue(); -} - -FontWidth ExtendedXlfd::GetWidthType() const -{ - Attribute *pWidthAttr = mpFactory->RetrieveSetwidth(mnSetwidth); - return (FontWidth)pWidthAttr->GetValue(); -} - -class CodeRange -{ -public: - CodeRange( int nMin, int nEnd ) : mnMin( nMin ), mnEnd( nEnd ) {} - - sal_uInt32 GetMin() const { return mnMin; } - sal_uInt32 GetEnd() const { return mnEnd; } - - bool operator<( const CodeRange& r ) const - { return (mnMin<r.mnMin) || ((mnMin==r.mnMin) && (mnEnd<r.mnEnd)); } - -private: - sal_uInt32 mnMin, mnEnd; -}; - - -int ExtendedXlfd::GetFontCodeRanges( sal_uInt32* pCodePairs ) const -{ - bool bHasUnicode = false; - bool bHasUnknownEncoding = false; - - // approximate unicode ranges from encodings - typedef std::set<CodeRange> RangeSet; - RangeSet aRangeSet; - - for( unsigned short i = 0; i < mnEncodings; ++i ) - { - // TODO: move encoding -> unicode range mapping to RTL - // NOTE: for now only some are VERY roughly approximated - const rtl_TextEncoding eEncoding = mpEncodingInfo[i].mnEncoding; - switch( mpEncodingInfo[i].mnEncoding ) - { - case RTL_TEXTENCODING_SYMBOL: // postscript symbol encoding - aRangeSet.insert( CodeRange( 0x0020, 0x0100 ) ); // symbol aliasing - aRangeSet.insert( CodeRange( 0xF020, 0xF100 ) ); - break; - - case RTL_TEXTENCODING_ISO_8859_15: - aRangeSet.insert( CodeRange( 0x20AC, 0x20AD ) ); // Euro currency symbol - // fall through - case RTL_TEXTENCODING_APPLE_ROMAN: - case RTL_TEXTENCODING_ISO_8859_1: - case RTL_TEXTENCODING_MS_1252: - case RTL_TEXTENCODING_IBM_437: - case RTL_TEXTENCODING_IBM_852: - aRangeSet.insert( CodeRange( 0x0020, 0x0080 ) ); - aRangeSet.insert( CodeRange( 0x00A0, 0x0100 ) ); - break; - - // Traditional, Simplified, Japanese - case RTL_TEXTENCODING_APPLE_CHINSIMP: - case RTL_TEXTENCODING_APPLE_CHINTRAD: - case RTL_TEXTENCODING_APPLE_JAPANESE: - case RTL_TEXTENCODING_SHIFT_JIS: - case RTL_TEXTENCODING_GB_2312: - case RTL_TEXTENCODING_GBT_12345: - case RTL_TEXTENCODING_GBK: - case RTL_TEXTENCODING_BIG5: - case RTL_TEXTENCODING_EUC_JP: - case RTL_TEXTENCODING_EUC_CN: - case RTL_TEXTENCODING_EUC_TW: - case RTL_TEXTENCODING_ISO_2022_JP: - case RTL_TEXTENCODING_ISO_2022_CN: - case RTL_TEXTENCODING_GB_18030: - case RTL_TEXTENCODING_BIG5_HKSCS: - case RTL_TEXTENCODING_JIS_X_0201: - case RTL_TEXTENCODING_JIS_X_0208: - case RTL_TEXTENCODING_JIS_X_0212: - case RTL_TEXTENCODING_MS_932: - case RTL_TEXTENCODING_MS_936: - case RTL_TEXTENCODING_MS_950: - aRangeSet.insert( CodeRange( 0x3000, 0xA000 ) ); - aRangeSet.insert( CodeRange( 0xF900, 0xFB00 ) ); - break; - - // Korean - case RTL_TEXTENCODING_APPLE_KOREAN: - case RTL_TEXTENCODING_MS_949: - case RTL_TEXTENCODING_MS_1361: - case RTL_TEXTENCODING_EUC_KR: - case RTL_TEXTENCODING_ISO_2022_KR: - aRangeSet.insert( CodeRange( 0x1100, 0x1200 ) ); - aRangeSet.insert( CodeRange( 0x3130, 0x3190 ) ); - aRangeSet.insert( CodeRange( 0xAC00, 0xD7A4 ) ); - break; - - // unknown encoding - case RTL_TEXTENCODING_DONTKNOW: - bHasUnknownEncoding = true; - break; - - // Unicode - case RTL_TEXTENCODING_UNICODE: - case RTL_TEXTENCODING_UTF7: - case RTL_TEXTENCODING_UTF8: - bHasUnicode = true; - break; - - // misc 8bit encodings - default: - if( !rtl_isOctetTextEncoding( eEncoding ) ) - bHasUnknownEncoding = true; - else - { - // use the unicode converter to get the coverage of an 8bit encoding - rtl_TextToUnicodeConverter aConverter = rtl_createTextToUnicodeConverter( eEncoding ); - rtl_UnicodeToTextContext aCvtContext = rtl_createTextToUnicodeContext( aConverter ); - if( !aConverter || !aCvtContext ) - bHasUnknownEncoding = true; - else - { - sal_Char cCharsInp[ 0x100 ]; - for( int j = 0x20; j < 0x080; ++j ) - cCharsInp[ j-0x20 ] = j; - for( int j = 0xA0; j < 0x100; ++j ) - cCharsInp[ j-0x40 ] = j; - - sal_Unicode cCharsOut[ 0x100 ]; - sal_uInt32 nCvtInfo; - sal_Size nSrcCvtBytes; - int nOutLen = rtl_convertTextToUnicode( - aConverter, aCvtContext, - cCharsInp, 0xC0, - cCharsOut, sizeof(cCharsOut)/sizeof(*cCharsOut), - RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE - | RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE, - &nCvtInfo, &nSrcCvtBytes ); - - for( int j = 0; j < nOutLen; ++j ) - aRangeSet.insert( CodeRange( cCharsOut[j], cCharsOut[j]+1 ) ); - - rtl_destroyTextToUnicodeConverter( aCvtContext ); - rtl_destroyTextToUnicodeConverter( aConverter ); - } - } - break; - } - } - - // unicode encoded fonts usually do not cover the entire unicode range - // => only use them to determine coverage when no other encodings are available - if( aRangeSet.empty() && (bHasUnicode || bHasUnknownEncoding) ) - { - if( pCodePairs ) - { - pCodePairs[0] = 0x0020; - pCodePairs[1] = 0xD800; - pCodePairs[2] = 0xE000; - pCodePairs[3] = 0xFFFE; - } - return 2; - } - - if( aRangeSet.empty() ) - return 0; - - // sort and merge the code pairs - sal_uInt32* pDst = pCodePairs; - RangeSet::const_iterator it = aRangeSet.begin(); - for( sal_uInt32 nEnd = 0; it != aRangeSet.end(); ++it ) - { - // check overlap with to previous range - const CodeRange& rSrc = *it; - if( nEnd < rSrc.GetMin() ) - { - nEnd = rSrc.GetEnd(); - if( pCodePairs ) - { - pDst[0] = rSrc.GetMin(); - pDst[1] = rSrc.GetEnd(); - } - pDst += 2; - } - else - { - // merge overlapping ranges - if( nEnd < rSrc.GetEnd() ) - { - nEnd = rSrc.GetEnd(); - if( pCodePairs ) - pDst[-1] = nEnd; - } - } - } - - int nRangeCount = (pDst - pCodePairs) / 2; - return nRangeCount; -} - -// ------ class to handle scalable bitmap fonts ------------------------------ - -ScalableBitmapXlfd::ScalableBitmapXlfd() -: ExtendedXlfd( true ) -{} - -ScalableBitmapXlfd::~ScalableBitmapXlfd() -{} - -void -ScalableBitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += '-'; - rString += ByteString::CreateFromInt32( nPixelSize ); - rString += "-0-"; - rString += ByteString::CreateFromInt32( rInfo.mnResolutionX ); - rString += '-'; - rString += ByteString::CreateFromInt32( rInfo.mnResolutionY ); - rString += '-'; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-0"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -void -ScalableBitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, char *pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* ScalableBitmapXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, 0 ); - pFontData->mnQuality= 0; - return pFontData; -} - -// ------ class to handle true bitmap fonts ---------------------------------- - -void -BitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, char *pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -BitmapXlfd::BitmapXlfd( ) -: ExtendedXlfd( false ) -{} - -BitmapXlfd::~BitmapXlfd( ) -{} - -bool -BitmapXlfd::AddEncoding( const Xlfd *pXlfd ) -{ - if ( mnEncodings == 0 ) - { - mnPixelSize = pXlfd->mnPixelSize; - mnPointSize = pXlfd->mnPointSize; - mnAverageWidth = pXlfd->mnAverageWidth; - } - - return ExtendedXlfd::AddEncoding( pXlfd ); -} - -void -BitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - rString += '-'; - rString += ByteString::CreateFromInt32( mnPixelSize ); - rString += "-*-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* BitmapXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, mnPixelSize ); - pFontData->mnQuality= 100; - return pFontData; -} - -// ------ class to handle true scalable fonts -------------------------------- - -ScalableXlfd::ScalableXlfd() -: ExtendedXlfd( true ) -{} - -ScalableXlfd::~ScalableXlfd() -{} - -void -ScalableXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += '-'; - rString += ByteString::CreateFromInt32( nPixelSize ); - rString += "-0-0-0-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-0"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -void -ScalableXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, char* pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* ScalableXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, 0 ); - pFontData->mnQuality= 200; - return pFontData; -} - -/* ------- virtual fonts for user interface ------------------------------- */ - -VirtualXlfd::ExtEncodingInfo& -VirtualXlfd::ExtEncodingInfo::operator= ( const Xlfd *pXlfd ) -{ - mnFoundry = pXlfd->mnFoundry; - mnFamily = pXlfd->mnFamily; - mnWeight = pXlfd->mnWeight; - mnSlant = pXlfd->mnSlant; - mnSetwidth = pXlfd->mnSetwidth; - - return *this; -} - -VirtualXlfd::VirtualXlfd() -: ExtendedXlfd( true ), - mnExtCapacity(0), - mpExtEncodingInfo(NULL) -{ - mnFoundry = 0; - mnFamily = 0; - mnWeight = 0; - mnSlant = 0; - mnSetwidth = 0; -} - -VirtualXlfd::~VirtualXlfd() -{ - if ( mpExtEncodingInfo != NULL ) - rtl_freeMemory( mpExtEncodingInfo ); -} - -int -VirtualXlfd::GetFontQuality (unsigned short nFamily) -{ - Attribute *pFamily = mpFactory->RetrieveFamily(nFamily); - int nQuality = 0; - - if (pFamily->HasFeature(XLFD_FEATURE_HQ)) - nQuality += 16; - if (pFamily->HasFeature(XLFD_FEATURE_MQ)) - nQuality += 8; - if (pFamily->HasFeature(XLFD_FEATURE_LQ)) - nQuality += 4; - return nQuality; -} - -bool -VirtualXlfd::AddEncoding( const Xlfd *pXlfd ) -{ - // add new font - bool bRC = ExtendedXlfd::AddEncoding( pXlfd ); - - int nIdx; - if( bRC ) - { - // new encoding => append the new pXlfd - nIdx = mnEncodings - 1; - if( nIdx >= mnExtCapacity ) - { - mnExtCapacity = mnEncCapacity; - mpExtEncodingInfo = (ExtEncodingInfo*)Realloc( mpExtEncodingInfo, - mnExtCapacity * sizeof(ExtEncodingInfo) ); - } - } - else - { - // existing encoding => check if the new pXlfd is better - rtl_TextEncoding nEncoding = pXlfd->GetEncoding(); - nIdx = GetEncodingIdx( nEncoding ); - - int nOldQuality = GetFontQuality( mpExtEncodingInfo[nIdx].mnFamily ); - int nNewQuality = GetFontQuality( pXlfd->mnFamily ); - if( nOldQuality >= nNewQuality ) - return false; - } - - mpExtEncodingInfo[ nIdx ] = pXlfd; - return true; -} - -void -VirtualXlfd::FilterInterfaceFont (const Xlfd *pXlfd) -{ - Attribute *pAttr; - AttributeProvider *pFactory = pXlfd->mpFactory; - - if (! pXlfd->Fonttype() == TYPE_SCALABLE) - return; - pAttr = pFactory->RetrieveFamily(pXlfd->mnFamily); - if (! pAttr->HasFeature(XLFD_FEATURE_INTERFACE_FONT)) - return; - pAttr = pFactory->RetrieveSlant(pXlfd->mnSlant); - if (! (FontItalic)pAttr->GetValue() == ITALIC_NONE) - return; - pAttr = pFactory->RetrieveSetwidth(pXlfd->mnSetwidth); - if (pAttr->HasFeature(XLFD_FEATURE_NARROW)) - return; - pAttr = pFactory->RetrieveWeight(pXlfd->mnWeight); - FontWeight eWeight = (FontWeight)pAttr->GetValue(); - if ((eWeight != WEIGHT_NORMAL) && (eWeight != WEIGHT_MEDIUM)) - return; - - AddEncoding (pXlfd); -} - -void -VirtualXlfd::ToString( ByteString &rString, unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtEncodingInfo &rExtInfo = mpExtEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveFoundry(rExtInfo.mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(rExtInfo.mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(rExtInfo.mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(rExtInfo.mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(rExtInfo.mnSetwidth), rString ); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += '-'; - rString += ByteString::CreateFromInt32( nPixelSize ); - rString += "-0-0-0-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-0"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -void -VirtualXlfd::ToString( ByteString &rString, unsigned short nPixelSize, - char* pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtEncodingInfo &rExtInfo = mpExtEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveFoundry(rExtInfo.mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(rExtInfo.mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(rExtInfo.mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(rExtInfo.mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(rExtInfo.mnSetwidth), rString ); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* VirtualXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, 0 ); - - // family name - static const String aFontName( RTL_CONSTASCII_USTRINGPARAM("Interface User") ); - pFontData->maName = aFontName; - // pFontData->maStyleName = aStyleName; - pFontData->meFamily = FAMILY_SWISS; - pFontData->meWeight = WEIGHT_NORMAL; - pFontData->meItalic = ITALIC_NONE; - pFontData->meWidthType = WIDTH_NORMAL; - pFontData->mePitch = PITCH_VARIABLE; - - pFontData->mbSymbolFlag = false; - pFontData->mbOrientation= false; - pFontData->mbDevice = true; - pFontData->mnQuality = 100; - - return pFontData; -} - -// ------ font list ------------------------------------------------------- - -XlfdStorage::XlfdStorage() -{ - maXlfdList.reserve( 256 ); -} - -void -XlfdStorage::Dispose() -{ - XlfdList::const_iterator it = maXlfdList.begin(); - for(; it != maXlfdList.end(); ++it ) - delete *it; - maXlfdList.clear(); -} - -void -XlfdStorage::Reset() -{ - maXlfdList.clear(); -} - -void -XlfdStorage::Add( const ExtendedXlfd* pXlfd ) -{ - if ( pXlfd != NULL ) - maXlfdList.push_back( pXlfd ); -} - -void -XlfdStorage::Add( const XlfdStorage* pXlfd ) -{ - if ( !pXlfd || pXlfd->maXlfdList.empty() ) - return; - - maXlfdList.reserve( maXlfdList.size() + pXlfd->maXlfdList.size() ); - XlfdList::const_iterator it = pXlfd->maXlfdList.begin(); - for(; it != pXlfd->maXlfdList.end(); ++it ) - maXlfdList.push_back( *it ); -} - -void XlfdStorage::AnnounceFonts( ImplDevFontList* pList ) const -{ - XlfdList::const_iterator it = maXlfdList.begin(); - for(; it != maXlfdList.end(); ++it ) - { - const ExtendedXlfd* pXlfd = *it; - ImplFontData* pFontData = pXlfd->GetImplFontData(); - pList->Add( pFontData ); - } -} - -// ------ bitmap font list -------------------------------------------------- - -void -BitmapXlfdStorage::AddBitmapFont( const Xlfd *pXlfd ) -{ - if ( pXlfd == NULL ) - return; - - int nPixelSize = pXlfd->mnPixelSize; - XlfdList::const_iterator it = maXlfdList.begin(); - for(; it != maXlfdList.end(); ++it ) - { - BitmapXlfd* pBitmapXlfd = (BitmapXlfd*)*it; - if( nPixelSize == pBitmapXlfd->GetPixelSize() ) - { - // we need to add an encoding to an existing bitmap font - pBitmapXlfd->AddEncoding( pXlfd ); - return; - } - } - - // we have a new bitmap font - BitmapXlfd* pBitmapXlfd = new BitmapXlfd; - pBitmapXlfd->AddEncoding( pXlfd ); - Add( pBitmapXlfd ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/gdi/xlfd_extd.hxx b/vcl/unx/source/gdi/xlfd_extd.hxx deleted file mode 100644 index 306b9be74967..000000000000 --- a/vcl/unx/source/gdi/xlfd_extd.hxx +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef XLFD_EXTENDED_HXX -#define XLFD_EXTENDED_HXX - -#include <salunx.h> -#include <vcl/vclenum.hxx> -#include <vcl/outfont.hxx> - -#include <vector> - -class Xlfd; -class AttributeProvider; -class ImplDevFontList; -class ByteString; - -// -------------------------------------------------------------------------- -// -// classes for Xlfd handling that contain more than a single encoding. -// Members that may vary through different encodings are stored in -// a mpEncodingInfo member. There are three different classes: -// true scalable fonts (truetype and type1) scalable bitmap fonts -// (the ugly ones) and bitmap fonts. The ExtendedXlfd stores all the members -// that are specific to a font outline -// ( e.g. adobe-times-roman-medium-r-normal- * -p- * ) -// and specifies the interface. -// -// -------------------------------------------------------------------------- - -// base class - -class ExtendedXlfd : public ImplDevFontAttributes -{ - public: - ExtendedXlfd( bool bScalable ); - virtual ~ExtendedXlfd(); - virtual bool AddEncoding( const Xlfd* ); - bool HasEncoding( rtl_TextEncoding ) const; - int GetEncodingIdx( rtl_TextEncoding nEncoding ) const; - unsigned short NumEncodings() const - { return mnEncodings; } - virtual int GetPixelSize() const - { return 0; } - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const ; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - - virtual ImplFontData* GetImplFontData() const = 0; - bool IsScalable() const { return mbScalable; } - virtual FontFamily GetFamilyType() const; - virtual FontWeight GetWeight() const; - virtual FontItalic GetSlant() const; - virtual FontWidth GetWidthType() const; - virtual FontPitch GetPitch() const; - virtual FontPitch GetPitch( rtl_TextEncoding ) const; - rtl_TextEncoding GetAsciiEncoding( int *pAsciiRange = NULL ) const; - rtl_TextEncoding GetEncoding() const; - rtl_TextEncoding GetEncoding( int i ) const; - - int GetFontCodeRanges( sal_uInt32* pCodePairs ) const; - - protected: - AttributeProvider* mpFactory; - - public: - unsigned short mnFoundry; - unsigned short mnFamily; - unsigned short mnWeight; - unsigned short mnSlant; - unsigned short mnSetwidth; - bool mbScalable; - - protected: - unsigned short mnEncodings; - unsigned short mnEncCapacity; - struct EncodingInfo { - unsigned char mcSpacing; - unsigned short mnResolutionX; - unsigned short mnResolutionY; - unsigned short mnAddstyle; - unsigned short mnCharset; - rtl_TextEncoding mnEncoding; - - EncodingInfo& operator= ( const Xlfd *pXlfd ); - } *mpEncodingInfo; -}; - -// class to handle scalable bitmap fonts - -class ScalableBitmapXlfd : public ExtendedXlfd { - - public: - ScalableBitmapXlfd(); - virtual ~ScalableBitmapXlfd(); - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - - virtual ImplFontData* GetImplFontData() const ; -}; - -// class to handle true bitmap fonts - -class ScalableXlfd; - -class BitmapXlfd : public ExtendedXlfd { - - public: - BitmapXlfd(); - ~BitmapXlfd(); - bool AddEncoding( const Xlfd* ); - virtual int GetPixelSize() const - { return mnPixelSize; } - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - virtual ImplFontData* GetImplFontData() const ; - protected: - - unsigned short mnPixelSize; - unsigned short mnPointSize; - unsigned short mnAverageWidth; -}; - -// class to handle true scalable fonts - -class ScalableXlfd : public ExtendedXlfd { - - friend class BitmapXlfd; - - public: - ScalableXlfd(); - virtual ~ScalableXlfd(); - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const; - - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - virtual ImplFontData* GetImplFontData() const ; -}; - -// class to maintain a list of fonts ( bitmap and scalable ) - -class XlfdStorage { - - public: - XlfdStorage(); - - void Dispose(); - void Reset(); - - void Add( const ExtendedXlfd *pXlfd ); - void Add( const XlfdStorage *pXlfd ); - void AnnounceFonts( ImplDevFontList* ) const; - - protected: - - typedef ::std::vector<const ExtendedXlfd*> XlfdList; - XlfdList maXlfdList; -}; - -// list of fonts specific for bitmap fonts - -class BitmapXlfdStorage : public XlfdStorage { - - public: - - void AddBitmapFont( const Xlfd *pXlfd ); -}; - - -/* Virtual font for User Interface */ - -class VirtualXlfd : public ExtendedXlfd -{ - private: - - int GetFontQuality (unsigned short nFamily); - - public: - VirtualXlfd(); - virtual ~VirtualXlfd(); - virtual bool AddEncoding( const Xlfd* ); - void FilterInterfaceFont (const Xlfd *pXlfd); - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const ; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - - virtual ImplFontData* GetImplFontData() const ; - protected: - - unsigned short mnExtCapacity; - struct ExtEncodingInfo { - unsigned short mnFoundry; - unsigned short mnFamily; - unsigned short mnWeight; - unsigned short mnSlant; - unsigned short mnSetwidth; - - ExtEncodingInfo& operator= ( const Xlfd *pXlfd ); - } *mpExtEncodingInfo; - - friend class ExtEncodingInfo; -}; - - -// class to describe a X11 physically available font face - -class ImplX11FontData : public ImplFontData -{ -private: - enum { X11IFD_MAGIC = 0x111FDA1C }; - const ExtendedXlfd& mrXlfd; - -public: - ImplX11FontData( const ExtendedXlfd&, int nHeight ); - const ExtendedXlfd& GetExtendedXlfd() const { return mrXlfd; } - virtual ImplFontData* Clone() const { return new ImplX11FontData( *this ); } - virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; - virtual sal_IntPtr GetFontId() const; - - static bool CheckFontData( const ImplFontData& r ) { return r.CheckMagic( X11IFD_MAGIC ); } -}; - -#endif /* XLFD_EXTENDED_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/gdi/xlfd_smpl.cxx b/vcl/unx/source/gdi/xlfd_smpl.cxx deleted file mode 100644 index d9100a794c72..000000000000 --- a/vcl/unx/source/gdi/xlfd_smpl.cxx +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "xlfd_attr.hxx" -#include "xlfd_smpl.hxx" - -// -------------------------------------------------------------------------- -// -// -// broken down structure equivalent to a Xlfd string -// -// -// -------------------------------------------------------------------------- - -Xlfd::Xlfd() -{ -} - -// XlfdCompare abi has to be qsort(3) compatible, the sorting result must -// guarantee that fonts with SameFontoutline() are successive -// XlfdCompare relies on vFrom->mpFactory eq vTo->mpFactory. Since comparing -// Xlfd's is done by comparing attributes there is no way around this. -extern "C" int -XlfdCompare( const void *vFrom, const void *vTo ) -{ - const Xlfd *pFrom = (Xlfd*)vFrom; - const Xlfd *pTo = (Xlfd*)vTo; - - // Compare outline description - if ( pFrom->mnFoundry != pTo->mnFoundry ) - return (int)pFrom->mnFoundry - (int)pTo->mnFoundry; - if ( pFrom->mnFamily != pTo->mnFamily ) - return (int)pFrom->mnFamily - (int)pTo->mnFamily; - if ( pFrom->mnWeight != pTo->mnWeight ) - return (int)pFrom->mnWeight - (int)pTo->mnWeight; - if ( pFrom->mnSlant != pTo->mnSlant ) - return (int)pFrom->mnSlant - (int)pTo->mnSlant; - if ( pFrom->mnSetwidth != pTo->mnSetwidth ) - return (int)pFrom->mnSetwidth - (int)pTo->mnSetwidth; - - // Addstyle name is futile tricky. it may contain encoding information - // (like "ansi_1251") which Compares equal, or it may contain style - // information (like "serif") which Compares unequal, anyway if the font - // is "interface user" or "interface system" then compare equal anyway to - // build fontsets as large as possible - if ( pFrom->mnAddstyle == pTo->mnAddstyle ) - return 0; - - AttributeProvider *pFactory = pFrom->mpFactory; - Attribute *pFamily = pFactory->RetrieveFamily( pFrom->mnFamily ); - if ( pFamily->HasFeature(XLFD_FEATURE_APPLICATION_FONT) ) - return 0; - - Attribute *pFromAddStyle = pFactory->RetrieveAddstyle( pFrom->mnAddstyle ); - Attribute *pToAddStyle = pFactory->RetrieveAddstyle( pTo->mnAddstyle ); - - // if both addstyles denote encodings or if one denotes an - // encoding and the other denotes a style which really - // duplicates weight and slant information - - int nFromCompare = (pFromAddStyle->GetValue() != RTL_TEXTENCODING_DONTKNOW) - || (pFromAddStyle->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ? - -1 : pFrom->mnAddstyle; - int nToCompare = (pToAddStyle->GetValue() != RTL_TEXTENCODING_DONTKNOW) - || (pToAddStyle->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ? - -1 : pTo->mnAddstyle; - - return nFromCompare - nToCompare; -} - -// check whether two fonts are identical as appearance is concerned -// this does not Compare the actual scaling of two fonts -Bool -Xlfd::SameFontoutline( const Xlfd* pComparedTo ) const -{ - void* pThis = (void*)this; - return XlfdCompare( (void*)pThis, (void*)pComparedTo ) == 0 ; -} - -unsigned short -Xlfd::GetEncoding() const -{ - Attribute *pAddstyle = mpFactory->RetrieveAddstyle( mnAddstyle ); - if ( pAddstyle->GetValue() != RTL_TEXTENCODING_DONTKNOW ) - return pAddstyle->GetValue(); - - Attribute *pEncoding = mpFactory->RetrieveCharset( mnCharset ); - return pEncoding->GetValue(); -} - -XlfdFonttype -Xlfd::Fonttype() const -{ - if ( (mnAverageWidth == 0) && (mnPixelSize == 0) && (mnPointSize == 0) ) - { - return (mnResolutionX == 0) - && (mnResolutionY == 0) ? eTypeScalable : eTypeScalableBitmap; - } - - return eTypeBitmap; -} - -void -Advance( const char** pFrom, const char** pTo ) -{ - const char *pTmp = *pTo; - - for( ; (*pTmp != '\0') && (*pTmp++ != '-'); ) - {} - *pFrom = *pTo; - *pTo = pTmp; -} - -Bool -Xlfd::IsConformant (const char* pXlfd) const -{ - // X FontNameRegistry prefix "-" - if (*pXlfd++ != '-') - return False; - - // All Xlfd FontName fields are defined - int nNumFields = 1; - while (*pXlfd != '\0') - { - if (*pXlfd++ == '-') - nNumFields++; - } - // enough entries ? - if (nNumFields != 14) - return False; - // and the last one is not empty as well ? - if (*(pXlfd - 1) == '-') - return False; - - return True; -} - -// this is the real workhorse function. Since this is called for every font -// in the fontpath it has to be as fast a possible -Bool -Xlfd::FromString( const char* pXlfdstring, AttributeProvider *pFactory ) -{ - if (!IsConformant(pXlfdstring)) - return False; - - const char* pFrom = pXlfdstring + 1; - const char* pTo = pFrom; - mpFactory = pFactory; - - Advance( &pFrom, &pTo ); //-foundry-* - mnFoundry = mpFactory->InsertFoundry( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); // -*-family-* - mnFamily = mpFactory->InsertFamily( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); // -*-*-weight-* - mnWeight = mpFactory->InsertWeight( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-slant-* - mnSlant = mpFactory->InsertSlant( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-setwidth-* - mnSetwidth = mpFactory->InsertSetwidth( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-Addstyle-* - mnAddstyle = mpFactory->InsertAddstyle( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-height-* - mnPixelSize = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-pt height-* - mnPointSize = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-x resolution-* - mnResolutionX = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-y resolution-* - mnResolutionY = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-spacing-* - mcSpacing = pFrom == pTo ? '\0' : *pFrom; - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-average-* - mnAverageWidth = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-*-registry-encoding - const char* pTmp = pFrom; - Advance( &pTmp, &pTo ); - mnCharset = mpFactory->InsertCharset( pFrom, pTo - pFrom ); - - // sanity check whether we have really found a valid XLFD, if not - // throw away the whole font, since we have no idea what parts of - // the XLFD contains the error. - if ( !(pTo > pFrom) ) - return False; - - // a non-empty family name is essential, since otherwise the font - // would match the "default font" #52299# - Attribute* pFamily = mpFactory->RetrieveFamily( mnFamily ); - const char* pFamilyName = pFamily->GetName(); - if ( pFamilyName[0] == '\0' ) - return False; - - // well done - return True; -} - -#if OSL_DEBUG_LEVEL > 1 -// pure debug for now: this is only to inspect/pretty print a Xlfd struct -const char* -Xlfd::ToString( ByteString &rString ) const -{ - AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString ); - AppendAttribute( mpFactory->RetrieveAddstyle(mnAddstyle), rString ); - - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnPixelSize ) ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnPointSize ) ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnResolutionX ) ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnResolutionY ) ); - rString.Append("-"); rString.Append( (char)mcSpacing ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnAverageWidth ) ); - - AppendAttribute( mpFactory->RetrieveCharset(mnCharset), rString ); - - return rString.GetBuffer() ; -} - -void -Xlfd::Dump() const -{ - ByteString aString; - fprintf(stderr, "Xlfd: %s\n", ToString(aString) ); -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/gdi/xlfd_smpl.hxx b/vcl/unx/source/gdi/xlfd_smpl.hxx deleted file mode 100644 index a412d332fd9b..000000000000 --- a/vcl/unx/source/gdi/xlfd_smpl.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef XLFD_SIMPLE_HXX -#define XLFD_SIMPLE_HXX - -#include <salunx.h> -#include <vcl/vclenum.hxx> -#include <tools/string.hxx> - -class AttributeProvider; - -// -------------------------------------------------------------------------- -// -// -// broken down structure equivalent to a Xlfd string -// -// -// -------------------------------------------------------------------------- - -enum XlfdFonttype { - eTypeUnknown = TYPE_DONTKNOW, - eTypeBitmap = TYPE_RASTER, - eTypeScalableBitmap = TYPE_VECTOR, - eTypeScalable = TYPE_SCALABLE -}; - -class Xlfd { - - public: - - unsigned short mnFoundry; - unsigned short mnFamily; - unsigned short mnWeight; - unsigned short mnSlant; - unsigned short mnSetwidth; - unsigned short mnAddstyle; - unsigned short mnPixelSize; - unsigned short mnPointSize; - unsigned short mnResolutionX; - unsigned short mnResolutionY; - unsigned char mcSpacing; - unsigned short mnAverageWidth; - unsigned short mnCharset; - - // all foundry, family, weight ... information referres - // to this factory - AttributeProvider *mpFactory; - - Bool IsConformant( const char* pXlfdstring ) const; - - public: - Xlfd(); - Bool FromString( const char* pXlfdstring, - AttributeProvider *pFactory ); - Bool SameFontoutline( const Xlfd *pComparedTo ) const ; - XlfdFonttype Fonttype() const ; - unsigned short GetEncoding() const ; - #if OSL_DEBUG_LEVEL > 1 - const char* ToString( ByteString &rString ) const ; - void Dump() const; - #endif -}; - -extern "C" int -XlfdCompare( const void *vFrom, const void *vTo ); - -#endif /* XLFD_SIMPLE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index eecb026087e1..c27646cf1fd7 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -37,6 +37,7 @@ #include "vcl/salinst.hxx" #include "saldata.hxx" +#include "vcl/printerinfomanager.hxx" #include <cstdio> #include <unistd.h> @@ -294,12 +295,14 @@ const OUString& SalGetDesktopEnvironment() SalData::SalData() : m_pInstance(NULL), - m_pPlugin(NULL) + m_pPlugin(NULL), + m_pPIManager(NULL) { } SalData::~SalData() { + psp::PrinterInfoManager::release(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/printer/cupsmgr.cxx b/vcl/unx/source/printer/cupsmgr.cxx index 13652ae23924..655181294190 100644 --- a/vcl/unx/source/printer/cupsmgr.cxx +++ b/vcl/unx/source/printer/cupsmgr.cxx @@ -530,12 +530,18 @@ void CUPSManager::initialize() // introduced in dests with 1.2 // this is needed to check for %%IncludeFeature support // (#i65684#, #i65491#) + bool bUsePDF = false; cups_dest_t* pDest = ((cups_dest_t*)m_pDests); const char* pOpt = m_pCUPSWrapper->cupsGetOption( "printer-info", pDest->num_options, pDest->options ); if( pOpt ) + { m_bUseIncludeFeature = true; + bUsePDF = true; + if( m_aGlobalDefaults.m_nPSLevel == 0 && m_aGlobalDefaults.m_nPDFDevice == 0 ) + m_aGlobalDefaults.m_nPDFDevice = 1; + } // do not send include JobPatch; CUPS will insert that itself // TODO: currently unknwon which versions of CUPS insert JobPatches // so currently it is assumed CUPS = don't insert JobPatch files @@ -599,6 +605,8 @@ void CUPSManager::initialize() aPrinter.m_aInfo.m_pParser = c_it->second.getParser(); aPrinter.m_aInfo.m_aContext = c_it->second; } + if( bUsePDF && aPrinter.m_aInfo.m_nPSLevel == 0 && aPrinter.m_aInfo.m_nPDFDevice == 0 ) + aPrinter.m_aInfo.m_nPDFDevice = 1; aPrinter.m_aInfo.m_aDriverName = aBuf.makeStringAndClear(); aPrinter.m_bModified = false; @@ -832,8 +840,15 @@ void CUPSManager::setupJobContextData( FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand ) { + OSL_TRACE( "endSpool: %s, %s", + rtl::OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(), + bQuickCommand ? "true" : "false" ); + if( m_aCUPSDestMap.find( rPrintername ) == m_aCUPSDestMap.end() ) + { + OSL_TRACE( "defer to PrinterInfoManager::startSpool" ); return PrinterInfoManager::startSpool( rPrintername, bQuickCommand ); + } #ifdef ENABLE_CUPS OUString aTmpURL, aTmpFile; @@ -856,7 +871,7 @@ struct less_ppd_key : public ::std::binary_function<double, double, bool> { return left->getOrderDependency() < right->getOrderDependency(); } }; -void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, int& rNumOptions, void** rOptions ) const +void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) const { rNumOptions = 0; *rOptions = NULL; @@ -886,10 +901,26 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, int& rNumOpt } } } + + if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 ) + { + rtl::OString aVal( rtl::OString::valueOf( sal_Int32( rJob.m_nCopies ) ) ); + rNumOptions = m_pCUPSWrapper->cupsAddOption( "copies", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions ); + } + if( ! bBanner ) + { + rNumOptions = m_pCUPSWrapper->cupsAddOption( "job-sheets", "none", rNumOptions, (cups_option_t**)rOptions ); + } } -int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData ) +int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ) { + OSL_TRACE( "endSpool: %s, %s, copy count = %d", + rtl::OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(), + rtl::OUStringToOString( rJobTitle, RTL_TEXTENCODING_UTF8 ).getStr(), + rDocumentJobData.m_nCopies + ); + int nJobID = 0; osl::MutexGuard aGuard( m_aCUPSMutex ); @@ -897,7 +928,10 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it = m_aCUPSDestMap.find( rPrintername ); if( dest_it == m_aCUPSDestMap.end() ) - return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData ); + { + OSL_TRACE( "defer to PrinterInfoManager::endSpool" ); + return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData, bBanner ); + } #ifdef ENABLE_CUPS boost::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile ); @@ -909,7 +943,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit // setup cups options int nNumOptions = 0; cups_option_t* pOptions = NULL; - getOptionsFromDocumentSetup( rDocumentJobData, nNumOptions, (void**)&pOptions ); + getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, (void**)&pOptions ); cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second; nJobID = m_pCUPSWrapper->cupsPrintFile( pDest->name, diff --git a/vcl/unx/source/printer/jobdata.cxx b/vcl/unx/source/printer/jobdata.cxx index ae5dd71c43ed..0982b219bade 100644 --- a/vcl/unx/source/printer/jobdata.cxx +++ b/vcl/unx/source/printer/jobdata.cxx @@ -51,6 +51,7 @@ JobData& JobData::operator=(const JobData& rRight) m_pParser = rRight.m_pParser; m_aContext = rRight.m_aContext; m_nPSLevel = rRight.m_nPSLevel; + m_nPDFDevice = rRight.m_nPDFDevice; m_nColorDevice = rRight.m_nColorDevice; if( ! m_pParser && m_aPrinterName.getLength() ) @@ -83,6 +84,34 @@ void JobData::setCollate( bool bCollate ) } } +bool JobData::setPaper( int i_nWidth, int i_nHeight ) +{ + bool bSuccess = false; + if( m_pParser ) + { + rtl::OUString aPaper( m_pParser->matchPaper( i_nWidth, i_nHeight ) ); + + const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); + const PPDValue* pValue = pKey ? pKey->getValueCaseInsensitive( aPaper ) : NULL; + + bSuccess = pKey && pValue && m_aContext.setValue( pKey, pValue, false ); + } + return bSuccess; +} + +bool JobData::setPaperBin( int i_nPaperBin ) +{ + bool bSuccess = false; + if( m_pParser ) + { + const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ); + const PPDValue* pValue = pKey ? pKey->getValue( i_nPaperBin ) : NULL; + + bSuccess = pKey && pValue && m_aContext.setValue( pKey, pValue, false ); + } + return bSuccess; +} + bool JobData::getStreamBuffer( void*& pData, int& bytes ) { // consistency checks @@ -128,13 +157,17 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes ) aLine += ByteString::CreateFromInt32( m_nPSLevel ); aStream.WriteLine( aLine ); + aLine = "pdfdevice="; + aLine += ByteString::CreateFromInt32( m_nPDFDevice ); + aStream.WriteLine( aLine ); + aLine = "colordevice="; aLine += ByteString::CreateFromInt32( m_nColorDevice ); aStream.WriteLine( aLine ); // now append the PPDContext stream buffer aStream.WriteLine( "PPDContexData" ); - ULONG nBytes; + sal_uLong nBytes; void* pContextBuffer = m_aContext.getStreamableBuffer( nBytes ); if( nBytes ) aStream.Write( pContextBuffer, nBytes ); @@ -158,6 +191,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa bool bColorDepth = false; bool bColorDevice = false; bool bPSLevel = false; + bool bPDFDevice = false; while( ! aStream.IsEof() ) { aStream.ReadLine( aLine ); @@ -202,6 +236,11 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa bPSLevel = true; rJobData.m_nPSLevel = aLine.Copy( 8 ).ToInt32(); } + else if( aLine.CompareTo( "pdfdevice=", 10 ) == COMPARE_EQUAL ) + { + bPDFDevice = true; + rJobData.m_nPDFDevice = aLine.Copy( 10 ).ToInt32(); + } else if( aLine.Equals( "PPDContexData" ) ) { if( bPrinter ) @@ -222,7 +261,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa } } - return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bColorDevice && bColorDepth; + return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx index 22e17aa774d9..30d4598568d2 100644 --- a/vcl/unx/source/printer/ppdparser.cxx +++ b/vcl/unx/source/printer/ppdparser.cxx @@ -340,7 +340,7 @@ void PPDDecompressStream::Open( const rtl::OUString& i_rFile ) mpFileStream->Seek( 0 ); // check for compress'ed or gzip'ed file - ULONG nCompressMethod = 0; + sal_uLong nCompressMethod = 0; if( aLine.Len() > 1 && static_cast<unsigned char>(aLine.GetChar( 0 )) == 0x1f ) { if( static_cast<unsigned char>(aLine.GetChar( 1 )) == 0x8b ) // check for gzip @@ -436,51 +436,53 @@ void PPDParser::scanPPDDir( const String& rDir ) PPDCache &rPPDCache = thePPDCache::get(); osl::Directory aDir( rDir ); - aDir.open(); - osl::DirectoryItem aItem; - - INetURLObject aPPDDir(rDir); - while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) + if ( aDir.open() == osl::FileBase::E_None ) { - osl::FileStatus aStatus( FileStatusMask_FileName ); - if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + osl::DirectoryItem aItem; + + INetURLObject aPPDDir(rDir); + while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) { - rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); - aURLBuf.append( rDir ); - aURLBuf.append( sal_Unicode( '/' ) ); - aURLBuf.append( aStatus.getFileName() ); + osl::FileStatus aStatus( FileStatusMask_FileName ); + if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) + { + rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); + aURLBuf.append( rDir ); + aURLBuf.append( sal_Unicode( '/' ) ); + aURLBuf.append( aStatus.getFileName() ); - rtl::OUString aFileURL, aFileName; - osl::FileStatus::Type eType = osl::FileStatus::Unknown; + rtl::OUString aFileURL, aFileName; + osl::FileStatus::Type eType = osl::FileStatus::Unknown; - if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None ) - { - if( eType == osl::FileStatus::Regular ) + if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None ) { - INetURLObject aPPDFile = aPPDDir; - aPPDFile.Append( aFileName ); - - // match extension - for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ ) + if( eType == osl::FileStatus::Regular ) { - if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen ) + INetURLObject aPPDFile = aPPDDir; + aPPDFile.Append( aFileName ); + + // match extension + for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ ) { - if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) + if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen ) { + if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) ) + { (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName(); - break; + break; + } } } } - } - else if( eType == osl::FileStatus::Directory ) - { - scanPPDDir( aFileURL ); + else if( eType == osl::FileStatus::Directory ) + { + scanPPDDir( aFileURL ); + } } } } + aDir.close(); } - aDir.close(); } void PPDParser::initPPDFiles() @@ -1130,7 +1132,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) m_pTranslator->insertValue( aUniKey, aOption, aValue, aValueTranslation, aTransLocale ); // eventually update query and remove from option list - if( bQuery && pKey->m_bQueryValue == FALSE ) + if( bQuery && pKey->m_bQueryValue == sal_False ) { pKey->m_aQueryValue = *pValue; pKey->m_bQueryValue = true; @@ -1145,7 +1147,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines ) if( aLine.CompareTo( "*Default", 8 ) == COMPARE_EQUAL ) { String aKey( aLine.Copy( 8 ), RTL_TEXTENCODING_MS_1252 ); - USHORT nPos = aKey.Search( ':' ); + sal_uInt16 nPos = aKey.Search( ':' ); if( nPos != STRING_NOTFOUND ) { aKey.Erase( nPos ); @@ -1433,7 +1435,7 @@ String PPDParser::getSlot( int nSlot ) const if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aOption; else if( m_pInputSlots->countValues() > 0 ) - return m_pInputSlots->getValue( (ULONG)0 )->m_aOption; + return m_pInputSlots->getValue( (sal_uLong)0 )->m_aOption; return String(); } @@ -1446,7 +1448,7 @@ String PPDParser::getSlotCommand( int nSlot ) const if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aValue; else if( m_pInputSlots->countValues() > 0 ) - return m_pInputSlots->getValue( (ULONG)0 )->m_aValue; + return m_pInputSlots->getValue( (sal_uLong)0 )->m_aValue; return String(); } @@ -1473,7 +1475,7 @@ String PPDParser::getPaperDimension( int nPaperDimension ) const if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aOption; else if( m_pPaperDimensions->countValues() > 0 ) - return m_pPaperDimensions->getValue( (ULONG)0 )->m_aOption; + return m_pPaperDimensions->getValue( (sal_uLong)0 )->m_aOption; return String(); } @@ -1486,7 +1488,7 @@ String PPDParser::getPaperDimensionCommand( int nPaperDimension ) const if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aValue; else if( m_pPaperDimensions->countValues() > 0 ) - return m_pPaperDimensions->getValue( (ULONG)0 )->m_aValue; + return m_pPaperDimensions->getValue( (sal_uLong)0 )->m_aValue; return String(); } @@ -1595,7 +1597,7 @@ String PPDParser::getDuplex( int nDuplex ) const if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aOption; else if( m_pDuplexTypes->countValues() > 0 ) - return m_pDuplexTypes->getValue( (ULONG)0 )->m_aOption; + return m_pDuplexTypes->getValue( (sal_uLong)0 )->m_aOption; return String(); } @@ -1608,7 +1610,7 @@ String PPDParser::getDuplexCommand( int nDuplex ) const if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aValue; else if( m_pDuplexTypes->countValues() > 0 ) - return m_pDuplexTypes->getValue( (ULONG)0 )->m_aValue; + return m_pDuplexTypes->getValue( (sal_uLong)0 )->m_aValue; return String(); } @@ -2050,7 +2052,7 @@ void PPDContext::getUnconstrainedValues( const PPDKey* pKey, ::std::list< const // ------------------------------------------------------------------- -void* PPDContext::getStreamableBuffer( ULONG& rBytes ) const +void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const { rBytes = 0; if( ! m_aCurrentValues.size() ) @@ -2096,7 +2098,7 @@ void* PPDContext::getStreamableBuffer( ULONG& rBytes ) const // ------------------------------------------------------------------- -void PPDContext::rebuildFromStreamBuffer( void* pBuffer, ULONG nBytes ) +void PPDContext::rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes ) { if( ! m_pParser ) return; diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx index 68223d6fdf8f..e4634ab0c8b5 100644 --- a/vcl/unx/source/printer/printerinfomanager.cxx +++ b/vcl/unx/source/printer/printerinfomanager.cxx @@ -36,6 +36,7 @@ #include "cupsmgr.hxx" #include "vcl/fontmanager.hxx" #include "vcl/strhelper.hxx" +#include "saldata.hxx" #include "tools/urlobj.hxx" #include "tools/stream.hxx" @@ -100,20 +101,28 @@ namespace psp PrinterInfoManager& PrinterInfoManager::get() { - static boost::scoped_ptr<PrinterInfoManager> pManager; + SalData* pSalData = GetSalData(); - if (!pManager) + if( ! pSalData->m_pPIManager ) { - pManager.reset(CUPSManager::tryLoadCUPS()); - if (!pManager) - pManager.reset(new PrinterInfoManager()); - pManager->initialize(); -# if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pManager->getType() ); -# endif + pSalData->m_pPIManager = CUPSManager::tryLoadCUPS(); + if( ! pSalData->m_pPIManager ) + pSalData->m_pPIManager = new PrinterInfoManager(); + + pSalData->m_pPIManager->initialize(); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pSalData->m_pPIManager->getType() ); +#endif } - return *pManager; + return *pSalData->m_pPIManager; +} + +void PrinterInfoManager::release() +{ + SalData* pSalData = GetSalData(); + delete pSalData->m_pPIManager; + pSalData->m_pPIManager = NULL; } // ----------------------------------------------------------------- @@ -136,6 +145,9 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) : PrinterInfoManager::~PrinterInfoManager() { delete m_pQueueInfo; + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "PrinterInfoManager: destroyed Manager of type %d\n", getType() ); + #endif } // ----------------------------------------------------------------- @@ -289,6 +301,10 @@ void PrinterInfoManager::initialize() if( aValue.Len() ) m_aGlobalDefaults.m_nPSLevel = aValue.ToInt32(); + aValue = aConfig.ReadKey( "PDFDevice" ); + if( aValue.Len() ) + m_aGlobalDefaults.m_nPDFDevice = aValue.ToInt32(); + aValue = aConfig.ReadKey( "PerformFontSubstitution" ); if( aValue.Len() ) { @@ -320,7 +336,7 @@ void PrinterInfoManager::initialize() m_aGlobalDefaults.m_aContext. setValue( pKey, aValue.Equals( "*nil" ) ? NULL : pKey->getValue( String( aValue, RTL_TEXTENCODING_ISO_8859_1 ) ), - TRUE ); + sal_True ); } } else if( aKey.Len() > 10 && aKey.CompareTo("SubstFont_", 10 ) == COMPARE_EQUAL ) @@ -500,6 +516,10 @@ void PrinterInfoManager::initialize() if( aValue.Len() ) aPrinter.m_aInfo.m_nPSLevel = aValue.ToInt32(); + aValue = aConfig.ReadKey( "PDFDevice" ); + if( aValue.Len() ) + aPrinter.m_aInfo.m_nPDFDevice = aValue.ToInt32(); + aValue = aConfig.ReadKey( "PerformFontSubstitution" ); if( ! aValue.Equals( "0" ) && ! aValue.EqualsIgnoreCaseAscii( "false" ) ) aPrinter.m_aInfo.m_bPerformFontSubstitution = true; @@ -521,7 +541,7 @@ void PrinterInfoManager::initialize() aPrinter.m_aInfo.m_aContext. setValue( pKey, aValue.Equals( "*nil" ) ? NULL : pKey->getValue( String( aValue, RTL_TEXTENCODING_ISO_8859_1 ) ), - TRUE ); + sal_True ); } } else if( aKey.Len() > 10 && aKey.CompareTo("SubstFont_", 10 ) == COMPARE_EQUAL ) @@ -630,7 +650,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter static PrinterInfo aEmptyInfo; ::boost::unordered_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter ); - DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about 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; } @@ -764,6 +784,7 @@ bool PrinterInfoManager::writePrinterConfig() pConfig->WriteKey( "Copies", ByteString::CreateFromInt32( it->second.m_aInfo.m_nCopies ) ); pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" ); pConfig->WriteKey( "PSLevel", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPSLevel ) ); + pConfig->WriteKey( "PDFDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPDFDevice ) ); pConfig->WriteKey( "ColorDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDevice ) ); pConfig->WriteKey( "ColorDepth", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDepth ) ); aValue = ByteString::CreateFromInt32( it->second.m_aInfo.m_nLeftMarginAdjust ); @@ -851,9 +872,10 @@ bool PrinterInfoManager::addPrinter( const OUString& rPrinterName, const OUStrin m_aPrinters[ rPrinterName ] = aPrinter; bSuccess = true; #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "new printer %s, level = %d, colordevice = %d, depth = %d\n", + fprintf( stderr, "new printer %s, level = %d, pdfdevice = %d, colordevice = %d, depth = %d\n", OUStringToOString( rPrinterName, osl_getThreadTextEncoding() ).getStr(), m_aPrinters[rPrinterName].m_aInfo.m_nPSLevel, + m_aPrinters[rPrinterName].m_aInfo.m_nPDFDevice, m_aPrinters[rPrinterName].m_aInfo.m_nColorDevice, m_aPrinters[rPrinterName].m_aInfo.m_nColorDepth ); #endif @@ -1101,7 +1123,7 @@ FILE* PrinterInfoManager::startSpool( const OUString& rPrintername, bool bQuickC return popen (aShellCommand.getStr(), "w"); } -int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/ ) +int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ ) { return (0 == pclose( pFile )); } @@ -1172,7 +1194,11 @@ SystemQueueInfo::SystemQueueInfo() : SystemQueueInfo::~SystemQueueInfo() { - terminate(); + static const char* pNoSyncDetection = getenv( "SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION" ); + if( ! pNoSyncDetection || !*pNoSyncDetection ) + join(); + else + terminate(); } bool SystemQueueInfo::hasChanged() const diff --git a/vcl/unx/source/printergfx/common_gfx.cxx b/vcl/unx/source/printergfx/common_gfx.cxx index 14d3a98d69b2..fc366aab838f 100644 --- a/vcl/unx/source/printergfx/common_gfx.cxx +++ b/vcl/unx/source/printergfx/common_gfx.cxx @@ -528,9 +528,9 @@ PrinterGfx::DrawPolyPolygon (sal_uInt32 nPoly, const sal_uInt32* pSizes, const P */ void -PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BYTE* pFlgAry) +PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const sal_uInt8* pFlgAry) { - const sal_uInt32 nBezString = 1024; + const sal_uInt32 nBezString= 1024; sal_Char pString[nBezString]; if ( nPoints > 1 && maLineColor.Is() && pPath ) @@ -579,7 +579,7 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BY } void -PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const BYTE* pFlgAry) +PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const sal_uInt8* pFlgAry) { const sal_uInt32 nBezString = 1024; sal_Char pString[nBezString]; @@ -635,7 +635,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const BYT } void -PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, const Point* const * pPtAry, const BYTE* const* pFlgAry) +PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, const Point* const * pPtAry, const sal_uInt8* const* pFlgAry) { const sal_uInt32 nBezString = 1024; sal_Char pString[nBezString]; diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx index 4ca5965e5b34..7df531975c57 100644 --- a/vcl/unx/source/printergfx/printerjob.cxx +++ b/vcl/unx/source/printergfx/printerjob.cxx @@ -347,7 +347,8 @@ PrinterJob::~PrinterJob () delete mpJobTrailer; // XXX should really call osl::remove routines - removeSpoolDir (maSpoolDirName); + if( maSpoolDirName.getLength() ) + removeSpoolDir (maSpoolDirName); // osl::Directory::remove (maSpoolDirName); } @@ -415,7 +416,7 @@ PrinterJob::StartJob ( rtl::OUString aFilterWS; // Creator (this application) - aFilterWS = WhitespaceToSpace( rAppName, FALSE ); + aFilterWS = WhitespaceToSpace( rAppName, sal_False ); WritePS (mpJobHeader, "%%Creator: ("); WritePS (mpJobHeader, aFilterWS); WritePS (mpJobHeader, ")\n"); @@ -453,14 +454,14 @@ PrinterJob::StartJob ( * use the filename, if it contains only ascii * else omit %%Title */ - aFilterWS = WhitespaceToSpace( rJobName, FALSE ); + aFilterWS = WhitespaceToSpace( rJobName, sal_False ); rtl::OUString aTitle( aFilterWS ); if( ! isAscii( aTitle ) ) { sal_Int32 nIndex = 0; while( nIndex != -1 ) aTitle = rFileName.getToken( 0, '/', nIndex ); - aTitle = WhitespaceToSpace( aTitle, FALSE ); + aTitle = WhitespaceToSpace( aTitle, sal_False ); if( ! isAscii( aTitle ) ) aTitle = rtl::OUString(); } @@ -501,6 +502,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 ) @@ -616,7 +621,7 @@ PrinterJob::EndJob () { PrinterInfoManager& rPrinterInfoManager = PrinterInfoManager::get(); if (0 == rPrinterInfoManager.endSpool( m_aLastJobData.m_aPrinterName, - maJobTitle, pDestFILE, m_aDocumentJobData )) + maJobTitle, pDestFILE, m_aDocumentJobData, true )) { bSuccess = sal_False; } 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/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 5068724f7da4..9a5d149f14fd 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -211,7 +211,7 @@ void X11SalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode ) // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pParentData, bool bUseGeometry ) +void X11SalFrame::Init( sal_uLong nSalFrameStyle, int nScreen, SystemParentData* pParentData, bool bUseGeometry ) { if( nScreen < 0 || nScreen >= GetDisplay()->GetScreenCount() ) nScreen = GetDisplay()->GetDefaultScreenNumber(); @@ -484,8 +484,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa } nShowState_ = SHOWSTATE_UNKNOWN; - bViewable_ = TRUE; - bMapped_ = FALSE; + bViewable_ = sal_True; + bMapped_ = sal_False; nVisibility_ = VisibilityFullyObscured; mhWindow = XCreateWindow( GetXDisplay(), aFrameParent, @@ -647,7 +647,7 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -X11SalFrame::X11SalFrame( SalFrame *pParent, ULONG nSalFrameStyle, SystemParentData* pSystemParent ) +X11SalFrame::X11SalFrame( SalFrame *pParent, sal_uLong nSalFrameStyle, SystemParentData* pSystemParent ) { X11SalData* pSalData = GetX11SalData(); @@ -687,16 +687,16 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, ULONG nSalFrameStyle, SystemParentD nHeight_ = 0; nStyle_ = 0; mnExtStyle = 0; - bAlwaysOnTop_ = FALSE; + bAlwaysOnTop_ = sal_False; - // set bViewable_ to TRUE: hack GetClientSize to report something + // set bViewable_ to sal_True: hack GetClientSize to report something // different to 0/0 before first map - bViewable_ = TRUE; - bMapped_ = FALSE; - bDefaultPosition_ = TRUE; + bViewable_ = sal_True; + bMapped_ = sal_False; + bDefaultPosition_ = sal_True; nVisibility_ = VisibilityFullyObscured; m_nWorkArea = 0; - mbInShow = FALSE; + mbInShow = sal_False; m_bXEmbed = false; nScreenSaversTimeout_ = 0; @@ -791,10 +791,10 @@ X11SalFrame::~X11SalFrame() XSelectInput( GetXDisplay(), GetShellWindow(), 0 ); XSelectInput( GetXDisplay(), GetWindow(), 0 ); - ShowFullScreen( FALSE, 0 ); + ShowFullScreen( sal_False, 0 ); if( bMapped_ ) - Show( FALSE ); + Show( sal_False ); if( mpInputContext ) { @@ -951,14 +951,14 @@ void X11SalFrame::updateGraphics( bool bClear ) // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::Enable( BOOL /*bEnable*/ ) +void X11SalFrame::Enable( sal_Bool /*bEnable*/ ) { // NYI: enable/disable frame } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::SetIcon( USHORT nIcon ) +void X11SalFrame::SetIcon( sal_uInt16 nIcon ) { if ( ! IsChildWindow() ) { @@ -1060,7 +1060,7 @@ void X11SalFrame::SetIcon( USHORT nIcon ) } pHints = &Hints; - BOOL bOk = SelectAppIconPixmap( GetDisplay(), m_nScreen, + sal_Bool bOk = SelectAppIconPixmap( GetDisplay(), m_nScreen, nIcon, iconSize, pHints->icon_pixmap, pHints->icon_mask ); if ( !bOk ) @@ -1133,7 +1133,7 @@ void X11SalFrame::SetMinClientSize( long nWidth, long nHeight ) // Show + Pos (x,y,z) + Size (width,height) // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) +void X11SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate ) { if( ( bVisible && bMapped_ ) || ( !bVisible && !bMapped_ ) ) @@ -1151,7 +1151,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) setXEmbedInfo(); if( bVisible ) { - mbInShow = TRUE; + mbInShow = sal_True; if( ! (nStyle_ & SAL_FRAME_STYLE_INTRO) ) { // hide all INTRO frames @@ -1163,12 +1163,12 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) if( pFrame->nStyle_ & SAL_FRAME_STYLE_INTRO ) { if( pFrame->bMapped_ ) - const_cast<X11SalFrame*>(pFrame)->Show( FALSE ); + const_cast<X11SalFrame*>(pFrame)->Show( sal_False ); } } } - // update NET_WM_STATE which may have been deleted due to earlier Show(FALSE) + // update NET_WM_STATE which may have been deleted due to earlier Show(sal_False) if( nShowState_ == SHOWSTATE_HIDDEN ) GetDisplay()->getWMAdaptor()->frameIsMapping( this ); @@ -1177,7 +1177,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) * with the basic dialogue editor, * which shows a frame and instantly hides it again. After that the * editor window is shown and the WM takes this as an opportunity - * to show our hidden transient frame also. So Show( FALSE ) must + * to show our hidden transient frame also. So Show( sal_False ) must * withdraw the frame AND delete the WM_TRANSIENT_FOR property. * In case the frame is shown again, the transient hint must be restored here. */ @@ -1310,7 +1310,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) * plugged windows don't necessarily get the * focus on show because the parent may already be mapped * and have the focus. So try to set the focus - * to the child on Show(TRUE) + * to the child on Show(sal_True) */ if( (nStyle_ & SAL_FRAME_STYLE_PLUG) && ! m_bXEmbed ) XSetInputFocus( GetXDisplay(), @@ -1358,7 +1358,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::ToTop( USHORT nFlags ) +void X11SalFrame::ToTop( sal_uInt16 nFlags ) { if( ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) && ! ( nStyle_ & SAL_FRAME_STYLE_FLOAT ) @@ -1576,7 +1576,7 @@ void X11SalFrame::updateScreenNumber() } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) +void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) { if( nStyle_ & SAL_FRAME_STYLE_PLUG ) return; @@ -1622,7 +1622,7 @@ void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::SetAlwaysOnTop( BOOL bOnTop ) +void X11SalFrame::SetAlwaysOnTop( sal_Bool bOnTop ) { if( ! IsOverrideRedirect() ) { @@ -1803,7 +1803,7 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL X11SalFrame::GetWindowState( SalFrameState* pState ) +sal_Bool X11SalFrame::GetWindowState( SalFrameState* pState ) { if( SHOWSTATE_MINIMIZED == nShowState_ ) pState->mnState = SAL_FRAMESTATE_MINIMIZED; @@ -1842,7 +1842,7 @@ BOOL X11SalFrame::GetWindowState( SalFrameState* pState ) pState->mnMask |= _FRAMESTATE_MASK_MAXIMIZED_GEOMETRY; } - return TRUE; + return sal_True; } // ---------------------------------------------------------------------------- @@ -2161,22 +2161,22 @@ void X11SalFrame::SetScreenNumber( unsigned int nNewScreen ) Rectangle aNewScreenRect( GetDisplay()->GetXineramaScreens()[nNewScreen] ); bool bVisible = bMapped_; if( bVisible ) - Show( FALSE ); + Show( sal_False ); maGeometry.nX = aNewScreenRect.Left() + (maGeometry.nX - aOldScreenRect.Left()); maGeometry.nY = aNewScreenRect.Top() + (maGeometry.nY - aOldScreenRect.Top()); createNewWindow( None, m_nScreen ); if( bVisible ) - Show( TRUE ); + Show( sal_True ); maGeometry.nScreenNumber = nNewScreen; } else if( sal_Int32(nNewScreen) < GetDisplay()->GetScreenCount() ) { bool bVisible = bMapped_; if( bVisible ) - Show( FALSE ); + Show( sal_False ); createNewWindow( None, nNewScreen ); if( bVisible ) - Show( TRUE ); + Show( sal_True ); maGeometry.nScreenNumber = nNewScreen; } } @@ -2210,7 +2210,7 @@ void X11SalFrame::updateWMClass() // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) +void X11SalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nScreen ) { if( GetDisplay()->IsXinerama() && GetDisplay()->GetXineramaScreens().size() > 1 ) { @@ -2228,7 +2228,7 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) nStyle_ |= SAL_FRAME_STYLE_PARTIAL_FULLSCREEN; bool bVisible = bMapped_; if( bVisible ) - Show( FALSE ); + Show( sal_False ); maGeometry.nX = aRect.Left(); maGeometry.nY = aRect.Top(); maGeometry.nWidth = aRect.GetWidth(); @@ -2241,7 +2241,7 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) else GetDisplay()->getWMAdaptor()->showFullScreen( this, true ); if( bVisible ) - Show(TRUE); + Show(sal_True); } else @@ -2252,14 +2252,14 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) Rectangle aRect = maRestorePosSize; maRestorePosSize = Rectangle(); if( bVisible ) - Show( FALSE ); + Show( sal_False ); createNewWindow( None, m_nScreen ); if( !aRect.IsEmpty() ) SetPosSize( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); if( bVisible ) - Show( TRUE ); + Show( sal_True ); } } else @@ -2272,12 +2272,12 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) if( mbFullScreen ) pDisplay_->getWMAdaptor()->showFullScreen( this, false ); if( bVisible ) - Show( FALSE ); + Show( sal_False ); createNewWindow( None, nScreen ); if( mbFullScreen ) pDisplay_->getWMAdaptor()->showFullScreen( this, true ); if( bVisible ) - Show( TRUE ); + Show( sal_True ); } if( mbFullScreen == (bool)bFullScreen ) return; @@ -2362,7 +2362,7 @@ MessageToXAutoLock( Display *p_display, int n_message ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalFrame::StartPresentation( BOOL bStart ) +void X11SalFrame::StartPresentation( sal_Bool bStart ) { I18NStatus::get().show( !bStart, I18NStatus::presentation ); if ( bStart ) @@ -2380,7 +2380,7 @@ void X11SalFrame::StartPresentation( BOOL bStart ) static bool DPMSExtensionAvailable = #if !defined(SOLARIS) && !defined(AIX) (DPMSQueryExtension(GetXDisplay(), &dummy, &dummy) != 0); - static XLIB_BOOL DPMSEnabled = false; + static sal_Bool DPMSEnabled = false; #else false; bool DPMSEnabled = false; @@ -2559,10 +2559,10 @@ X11SalFrame::HandleExtTextEvent (XClientMessageEvent *pEvent) // PostEvent // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -BOOL X11SalFrame::PostEvent( void *pData ) +sal_Bool X11SalFrame::PostEvent( void *pData ) { GetDisplay()->SendInternalEvent( this, pData ); - return TRUE; + return sal_True; } // Title @@ -2634,7 +2634,7 @@ void X11SalFrame::SetInputContext( SalInputContext* pContext ) // ----------------------------------------------------------------------- -void X11SalFrame::EndExtTextInput( USHORT nFlags ) +void X11SalFrame::EndExtTextInput( sal_uInt16 nFlags ) { if (mpInputContext != NULL) mpInputContext->EndExtTextInput( nFlags ); @@ -2642,20 +2642,20 @@ void X11SalFrame::EndExtTextInput( USHORT nFlags ) // ----------------------------------------------------------------------- -XubString X11SalFrame::GetKeyName( USHORT nKeyCode ) +XubString X11SalFrame::GetKeyName( sal_uInt16 nKeyCode ) { return GetDisplay()->GetKeyName( nKeyCode ); } -XubString X11SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) +XubString X11SalFrame::GetSymbolKeyName( const XubString&, sal_uInt16 nKeyCode ) { return GetKeyName( nKeyCode ); } -BOOL X11SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) +sal_Bool X11SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) { // not supported yet - return FALSE; + return sal_False; } LanguageType X11SalFrame::GetInputLanguage() @@ -2683,7 +2683,7 @@ void X11SalFrame::UpdateSettings( AllSettings& rSettings ) pIntegrator->GetSystemLook( rSettings ); } -void X11SalFrame::CaptureMouse( BOOL bCapture ) +void X11SalFrame::CaptureMouse( sal_Bool bCapture ) { nCaptured_ = pDisplay_->CaptureMouse( bCapture ? this : NULL ); } @@ -2714,7 +2714,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) { bool bWasVisible = bMapped_; if( bWasVisible ) - Show( FALSE ); + Show( sal_False ); if( nScreen < 0 || nScreen >= GetDisplay()->GetScreenCount() ) nScreen = m_nScreen; @@ -2783,7 +2783,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) } if( bWasVisible ) - Show( TRUE ); + Show( sal_True ); std::list< X11SalFrame* > aChildren = maChildren; for( std::list< X11SalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it ) @@ -2819,9 +2819,9 @@ void X11SalFrame::Beep( SoundType eSoundType ) // not fully suported // Event Handling // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -static USHORT sal_GetCode( int state ) +static sal_uInt16 sal_GetCode( int state ) { - USHORT nCode = 0; + sal_uInt16 nCode = 0; if( state & Button1Mask ) nCode |= MOUSE_LEFT; @@ -2874,7 +2874,7 @@ SalFrame::SalIndicatorState X11SalFrame::GetIndicatorState() return aState; } -void X11SalFrame::SimulateKeyPress( USHORT nKeyCode ) +void X11SalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) { GetX11SalData()->GetDisplay()->SimulateKeyPress(nKeyCode); } @@ -2882,7 +2882,7 @@ void X11SalFrame::SimulateKeyPress( USHORT nKeyCode ) long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) { SalMouseEvent aMouseEvt; - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; bool bClosePopups = false; if( nVisibleFloats && pEvent->type == EnterNotify ) @@ -3005,7 +3005,7 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) } if( ! bInside ) { - // need not take care of the XUngrabPointer in Show( FALSE ) + // need not take care of the XUngrabPointer in Show( sal_False ) // because XUngrabPointer does not produce errors if pointer // is not grabbed XUngrabPointer( GetXDisplay(), CurrentTime ); @@ -3089,7 +3089,7 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) if( pEvent->type == ButtonRelease ) return 0; - static ULONG nLines = 0; + static sal_uLong nLines = 0; if( ! nLines ) { char* pEnv = getenv( "SAL_WHEELLINES" ); @@ -3151,14 +3151,14 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) // in the independent part. struct KeyAlternate { - USHORT nKeyCode; + sal_uInt16 nKeyCode; sal_Unicode nCharCode; KeyAlternate() : nKeyCode( 0 ), nCharCode( 0 ) {} - KeyAlternate( USHORT nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} + KeyAlternate( sal_uInt16 nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} }; inline KeyAlternate -GetAlternateKeyCode( const USHORT nKeyCode ) +GetAlternateKeyCode( const sal_uInt16 nKeyCode ) { KeyAlternate aAlternate; @@ -3171,6 +3171,100 @@ GetAlternateKeyCode( const USHORT nKeyCode ) return aAlternate; } +void X11SalFrame::beginUnicodeSequence() +{ + rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() ); + DeletionListener aDeleteWatch( this ); + + if( rSeq.getLength() ) + endUnicodeSequence(); + + rSeq = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "u" ) ); + + if( ! aDeleteWatch.isDeleted() ) + { + sal_uInt16 nTextAttr = SAL_EXTTEXTINPUT_ATTR_UNDERLINE; + SalExtTextInputEvent aEv; + aEv.mnTime = 0; + aEv.maText = rSeq; + aEv.mpTextAttr = &nTextAttr; + aEv.mnCursorPos = 0; + aEv.mnDeltaStart = 0; + aEv.mnCursorFlags = 0; + aEv.mbOnlyCursor = sal_False; + + CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&aEv); + } +} + +bool X11SalFrame::appendUnicodeSequence( sal_Unicode c ) +{ + bool bRet = false; + rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() ); + if( rSeq.getLength() > 0 ) + { + // range check + if( (c >= sal_Unicode('0') && c <= sal_Unicode('9')) || + (c >= sal_Unicode('a') && c <= sal_Unicode('f')) || + (c >= sal_Unicode('A') && c <= sal_Unicode('F')) ) + { + rtl::OUStringBuffer aBuf( rSeq.getLength() + 1 ); + aBuf.append( rSeq ); + aBuf.append( c ); + rSeq = aBuf.makeStringAndClear(); + std::vector<sal_uInt16> attribs( rSeq.getLength(), SAL_EXTTEXTINPUT_ATTR_UNDERLINE ); + + SalExtTextInputEvent aEv; + aEv.mnTime = 0; + aEv.maText = rSeq; + aEv.mpTextAttr = &attribs[0]; + aEv.mnCursorPos = 0; + aEv.mnDeltaStart = 0; + aEv.mnCursorFlags = 0; + aEv.mbOnlyCursor = sal_False; + + CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&aEv); + bRet = true; + } + else + bRet = endUnicodeSequence(); + } + else + endUnicodeSequence(); + return bRet; +} + +bool X11SalFrame::endUnicodeSequence() +{ + rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() ); + + DeletionListener aDeleteWatch( this ); + if( rSeq.getLength() > 1 && rSeq.getLength() < 6 ) + { + // cut the "u" + rtl::OUString aNumbers( rSeq.copy( 1 ) ); + sal_Int32 nValue = aNumbers.toInt32( 16 ); + if( nValue >= 32 ) + { + sal_uInt16 nTextAttr = SAL_EXTTEXTINPUT_ATTR_UNDERLINE; + SalExtTextInputEvent aEv; + aEv.mnTime = 0; + aEv.maText = rtl::OUString( sal_Unicode(nValue) ); + aEv.mpTextAttr = &nTextAttr; + aEv.mnCursorPos = 0; + aEv.mnDeltaStart = 0; + aEv.mnCursorFlags = 0; + aEv.mbOnlyCursor = sal_False; + CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&aEv); + } + } + bool bWasInput = rSeq.getLength() > 0; + rSeq = rtl::OUString(); + if( bWasInput && ! aDeleteWatch.isDeleted() ) + CallCallback(SALEVENT_ENDEXTTEXTINPUT, NULL); + return bWasInput; +} + // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) { @@ -3205,8 +3299,8 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) } SalKeyEvent aKeyEvt; - USHORT nKeyCode; - USHORT nModCode = 0; + sal_uInt16 nKeyCode; + sal_uInt16 nModCode = 0; char aDummy; if( pEvent->state & ShiftMask ) @@ -3216,6 +3310,9 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) if( pEvent->state & Mod1Mask ) nModCode |= KEY_MOD2; + if( nModCode != (KEY_SHIFT|KEY_MOD1) ) + endUnicodeSequence(); + if( nKeySym == XK_Shift_L || nKeySym == XK_Shift_R || nKeySym == XK_Control_L || nKeySym == XK_Control_R || nKeySym == XK_Alt_L || nKeySym == XK_Alt_R @@ -3236,8 +3333,8 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) // the event state does not contain ControlMask. In the release // event its the other way round: it does contain the Control mask. // The modifier mode therefore has to be adapted manually. - USHORT nExtModMask = 0; - USHORT nModMask = 0; + sal_uInt16 nExtModMask = 0; + sal_uInt16 nModMask = 0; switch( nKeySym ) { case XK_Control_L: @@ -3320,6 +3417,33 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) if( !nKeyCode && !nLen && !nKeyString) return 0; + DeletionListener aDeleteWatch( this ); + + if( nModCode == (KEY_SHIFT | KEY_MOD1) && pEvent->type == XLIB_KeyPress ) + { + sal_uInt16 nSeqKeyCode = pDisplay_->GetKeyCode( nUnmodifiedKeySym, &aDummy ); + if( nSeqKeyCode == KEY_U ) + { + beginUnicodeSequence(); + return 1; + } + else if( nSeqKeyCode >= KEY_0 && nSeqKeyCode <= KEY_9 ) + { + if( appendUnicodeSequence( sal_Unicode( '0' ) + sal_Unicode(nSeqKeyCode - KEY_0) ) ) + return 1; + } + else if( nSeqKeyCode >= KEY_A && nSeqKeyCode <= KEY_F ) + { + if( appendUnicodeSequence( sal_Unicode( 'a' ) + sal_Unicode(nSeqKeyCode - KEY_A) ) ) + return 1; + } + else + endUnicodeSequence(); + } + + if( aDeleteWatch.isDeleted() ) + return 0; + rtl_TextEncoding nEncoding; if (mpInputContext != NULL && mpInputContext->IsMultiLingual() ) @@ -3378,8 +3502,6 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) nSize = 0; } - DeletionListener aDeleteWatch( this ); - if ( mpInputContext != NULL && mpInputContext->UseContext() && KeyRelease != pEvent->type @@ -3474,9 +3596,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) if( FocusIn == pEvent->type ) { -#ifndef _USE_PRINT_EXTENSION_ GetSalData()->m_pInstance->updatePrinterUpdate(); -#endif mbInputFocus = True; ImplSVData* pSVData = ImplGetSVData(); @@ -3486,7 +3606,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) if ((mpParent != NULL && nStyle_ == 0) && pSVData->maWinData.mpFirstFloat ) { - ULONG nMode = pSVData->maWinData.mpFirstFloat->GetPopupModeFlags(); + sal_uLong nMode = pSVData->maWinData.mpFirstFloat->GetPopupModeFlags(); pSVData->maWinData.mpFirstFloat->SetPopupModeFlags( nMode & ~(FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE)); } @@ -3509,7 +3629,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) long X11SalFrame::HandleExposeEvent( XEvent *pEvent ) { XRectangle aRect = { 0, 0, 0, 0 }; - USHORT nCount = 0; + sal_uInt16 nCount = 0; if( pEvent->type == Expose ) { @@ -3738,9 +3858,9 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) XLIB_Window hWM_Parent; XLIB_Window hRoot, *Children, hDummy; unsigned int nChildren; - BOOL bNone = pDisplay_->GetProperties() + sal_Bool bNone = pDisplay_->GetProperties() & PROPERTY_SUPPORT_WM_Parent_Pixmap_None; - BOOL bAccessParentWindow = ! (pDisplay_->GetProperties() + sal_Bool bAccessParentWindow = ! (pDisplay_->GetProperties() & PROPERTY_FEATURE_TrustedSolaris); static const char* pDisableStackingCheck = getenv( "SAL_DISABLE_STACKING_CHECK" ); @@ -3769,8 +3889,8 @@ long X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) hWM_Parent = GetShellWindow(); break; } - /* this sometimes happens if a Show(TRUE) is - * immediately followed by Show(FALSE) (which is braindead anyway) + /* this sometimes happens if a Show(sal_True) is + * immediately followed by Show(sal_False) (which is braindead anyway) */ if( hDummy == hWM_Parent ) hDummy = hRoot; @@ -4116,7 +4236,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) if( -1 == nCaptured_ ) { - CaptureMouse( TRUE ); + CaptureMouse( sal_True ); #ifdef DBG_UTIL if( -1 != nCaptured_ ) pDisplay_->PrintEvent( "Captured", pEvent ); @@ -4187,9 +4307,9 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) XUnmapWindow( GetXDisplay(), GetShellWindow() ); break; } - bMapped_ = TRUE; - bViewable_ = TRUE; - nRet = TRUE; + bMapped_ = sal_True; + bViewable_ = sal_True; + nRet = sal_True; if ( mpInputContext != NULL ) mpInputContext->Map( this ); CallCallback( SALEVENT_RESIZE, NULL ); @@ -4277,7 +4397,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) RestackChildren(); - mbInShow = FALSE; + mbInShow = sal_False; m_bSetFocusOnMap = false; } break; @@ -4285,9 +4405,9 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) case UnmapNotify: if( pEvent->xunmap.window == GetShellWindow() ) { - bMapped_ = FALSE; - bViewable_ = FALSE; - nRet = TRUE; + bMapped_ = sal_False; + bViewable_ = sal_False; + nRet = sal_True; if ( mpInputContext != NULL ) mpInputContext->Unmap( this ); CallCallback( SALEVENT_RESIZE, NULL ); @@ -4302,7 +4422,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent ) case VisibilityNotify: nVisibility_ = pEvent->xvisibility.state; - nRet = TRUE; + nRet = sal_True; if( bAlwaysOnTop_ && bMapped_ && ! GetDisplay()->getWMAdaptor()->isAlwaysOnTopOK() @@ -4401,7 +4521,7 @@ void X11SalFrame::ResetClipRegion() op, ordering ); } -void X11SalFrame::BeginSetClipRegion( ULONG nRects ) +void X11SalFrame::BeginSetClipRegion( sal_uLong nRects ) { if( m_pClipRectangles ) delete [] m_pClipRectangles; diff --git a/vcl/unx/source/window/salmenu.cxx b/vcl/unx/source/window/salmenu.cxx deleted file mode 100644 index a5622a48ba70..000000000000 --- a/vcl/unx/source/window/salmenu.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - - -#include <saldata.hxx> -#include <salinst.h> -#include <salmenu.h> - - -// ======================================================================= - -// 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() -{ -} - -// ------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/source/window/salobj.cxx b/vcl/unx/source/window/salobj.cxx index 6704077b1ec4..07cbcf115d5e 100644 --- a/vcl/unx/source/window/salobj.cxx +++ b/vcl/unx/source/window/salobj.cxx @@ -52,12 +52,12 @@ // ======================================================================= // SalInstance member to create and destroy a SalObject -SalObject* X11SalInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow ) +SalObject* X11SalInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow ) { return X11SalObject::CreateObject( pParent, pWindowData, bShow ); } -X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow ) +X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow ) { int error_base, event_base; X11SalObject* pObject = new X11SalObject(); @@ -149,7 +149,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pVisual, CWEventMask|CWColormap, &aAttribs ); XSync( pDisp, False ); - BOOL bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred(); + sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred(); pSalDisp->GetXLib()->PopXErrorLevel(); if( bWasXError ) { @@ -176,7 +176,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pObjData->pAppContext = NULL; XSync(pDisp, False); - BOOL bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred(); + sal_Bool bWasXError = pSalDisp->GetXLib()->HasXErrorOccurred(); pSalDisp->GetXLib()->PopXErrorLevel(); if( bWasXError ) { @@ -216,7 +216,7 @@ SalClipRegion::~SalClipRegion() void -SalClipRegion::BeginSetClipRegion( ULONG nRects ) +SalClipRegion::BeginSetClipRegion( sal_uLong nRects ) { if (ClipRectangleList) delete [] ClipRectangleList; @@ -321,7 +321,7 @@ X11SalObject::ResetClipRegion() void -X11SalObject::BeginSetClipRegion( ULONG nRectCount ) +X11SalObject::BeginSetClipRegion( sal_uLong nRectCount ) { maClipRegion.BeginSetClipRegion ( nRectCount ); } @@ -372,7 +372,7 @@ X11SalObject::EndSetClipRegion() } -USHORT +sal_uInt16 X11SalObject::GetClipRegionType() { return maClipRegion.GetClipRegionType(); @@ -396,7 +396,7 @@ X11SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) void -X11SalObject::Show( BOOL bVisible ) +X11SalObject::Show( sal_Bool bVisible ) { if ( ! maSystemChildData.aWindow ) return; @@ -417,7 +417,7 @@ X11SalObject::Show( BOOL bVisible ) // ----------------------------------------------------------------------- -void X11SalObject::Enable( BOOL ) +void X11SalObject::Enable( sal_Bool ) { } @@ -451,9 +451,9 @@ const SystemChildData* X11SalObject::GetSystemData() const return &maSystemChildData; } -static USHORT sal_GetCode( int state ) +static sal_uInt16 sal_GetCode( int state ) { - USHORT nCode = 0; + sal_uInt16 nCode = 0; if( state & Button1Mask ) nCode |= MOUSE_LEFT; @@ -509,7 +509,7 @@ long X11SalObject::Dispatch( XEvent* pEvent ) aEvt.mnTime = pEvent->xbutton.time; aEvt.mnCode = sal_GetCode( pEvent->xbutton.state ); aEvt.mnButton = 0; - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; if( pEvent->type == ButtonPress || pEvent->type == ButtonRelease ) { @@ -534,10 +534,10 @@ long X11SalObject::Dispatch( XEvent* pEvent ) switch( pEvent->type ) { case UnmapNotify: - pObject->mbVisible = FALSE; + pObject->mbVisible = sal_False; return 1; case MapNotify: - pObject->mbVisible = TRUE; + pObject->mbVisible = sal_True; return 1; case ButtonPress: pObject->CallCallback( SALOBJ_EVENT_TOTOP, NULL ); @@ -557,4 +557,10 @@ long X11SalObject::Dispatch( XEvent* pEvent ) return 0; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +// ----------------------------------------------------------------------- + +void X11SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file |