summaryrefslogtreecommitdiff
path: root/vcl/unx/generic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 10:18:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 12:13:42 +0100
commit5b74eb68113d3721e1a3f9fa40024bf9b2a15f0c (patch)
tree1c959ccc7769fd8530a16cc904b5424d04faa208 /vcl/unx/generic
parentb4aa631867638b993fda98b1c4fcfc47e5c6a1aa (diff)
loplugin:flatten in vcl
Change-Id: I3527477277a9ae96eaf9fd068232f672da7c28c3 Reviewed-on: https://gerrit.libreoffice.org/44753 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r--vcl/unx/generic/app/saldata.cxx35
-rw-r--r--vcl/unx/generic/app/saldisp.cxx91
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx78
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx116
-rw-r--r--vcl/unx/generic/print/common_gfx.cxx133
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx45
-rw-r--r--vcl/unx/generic/window/salframe.cxx173
7 files changed, 340 insertions, 331 deletions
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index bd336bf7ff57..29b434eb6be8 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -440,23 +440,24 @@ void SalXLib::Init()
OString aDisplay;
m_pDisplay = OpenX11Display(aDisplay);
- if ( !m_pDisplay )
- {
- OUString aProgramFileURL;
- osl_getExecutableFile( &aProgramFileURL.pData );
- OUString aProgramSystemPath;
- osl_getSystemPathFromFileURL (aProgramFileURL.pData, &aProgramSystemPath.pData);
- OString aProgramName = OUStringToOString(
- aProgramSystemPath,
- osl_getThreadTextEncoding() );
- std::fprintf( stderr, "%s X11 error: Can't open display: %s\n",
- aProgramName.getStr(), aDisplay.getStr());
- std::fprintf( stderr, " Set DISPLAY environment variable, use -display option\n");
- std::fprintf( stderr, " or check permissions of your X-Server\n");
- std::fprintf( stderr, " (See \"man X\" resp. \"man xhost\" for details)\n");
- std::fflush( stderr );
- exit(0);
- }
+ if ( m_pDisplay )
+ return;
+
+ OUString aProgramFileURL;
+ osl_getExecutableFile( &aProgramFileURL.pData );
+ OUString aProgramSystemPath;
+ osl_getSystemPathFromFileURL (aProgramFileURL.pData, &aProgramSystemPath.pData);
+ OString aProgramName = OUStringToOString(
+ aProgramSystemPath,
+ osl_getThreadTextEncoding() );
+ std::fprintf( stderr, "%s X11 error: Can't open display: %s\n",
+ aProgramName.getStr(), aDisplay.getStr());
+ std::fprintf( stderr, " Set DISPLAY environment variable, use -display option\n");
+ std::fprintf( stderr, " or check permissions of your X-Server\n");
+ std::fprintf( stderr, " (See \"man X\" resp. \"man xhost\" for details)\n");
+ std::fflush( stderr );
+ exit(0);
+
}
extern "C" {
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 8904dbd94907..a0330bb7c1d8 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -2525,51 +2525,52 @@ SalColormap::SalColormap( const SalDisplay *pDisplay, Colormap hColormap,
m_nUsed = 1 << m_aVisual.GetDepth();
- if( m_aVisual.GetClass() == PseudoColor )
- {
- int r, g, b;
-
- // black, white, gray, ~gray = 4
- GetXPixels( aColor, 0xC0, 0xC0, 0xC0 );
-
- // light colors: 3 * 2 = 6
-
- GetXPixels( aColor, 0x00, 0x00, 0xFF );
- GetXPixels( aColor, 0x00, 0xFF, 0x00 );
- GetXPixels( aColor, 0x00, 0xFF, 0xFF );
-
- // standard colors: 7 * 2 = 14
- GetXPixels( aColor, 0x00, 0x00, 0x80 );
- GetXPixels( aColor, 0x00, 0x80, 0x00 );
- GetXPixels( aColor, 0x00, 0x80, 0x80 );
- GetXPixels( aColor, 0x80, 0x00, 0x00 );
- GetXPixels( aColor, 0x80, 0x00, 0x80 );
- GetXPixels( aColor, 0x80, 0x80, 0x00 );
- GetXPixels( aColor, 0x80, 0x80, 0x80 );
- GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blue 7
-
- // cube: 6*6*6 - 8 = 208
- for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF
- for( g = 0; g < 0x100; g += 0x33 )
- for( b = 0; b < 0x100; b += 0x33 )
- GetXPixels( aColor, r, g, b );
-
- // gray: 16 - 6 = 10
- for( g = 0x11; g < 0xFF; g += 0x11 )
- GetXPixels( aColor, g, g, g );
-
- // green: 16 - 6 = 10
- for( g = 0x11; g < 0xFF; g += 0x11 )
- GetXPixels( aColor, 0, g, 0 );
-
- // red: 16 - 6 = 10
- for( r = 0x11; r < 0xFF; r += 0x11 )
- GetXPixels( aColor, r, 0, 0 );
-
- // blue: 16 - 6 = 10
- for( b = 0x11; b < 0xFF; b += 0x11 )
- GetXPixels( aColor, 0, 0, b );
- }
+ if( m_aVisual.GetClass() != PseudoColor )
+ return;
+
+ int r, g, b;
+
+ // black, white, gray, ~gray = 4
+ GetXPixels( aColor, 0xC0, 0xC0, 0xC0 );
+
+ // light colors: 3 * 2 = 6
+
+ GetXPixels( aColor, 0x00, 0x00, 0xFF );
+ GetXPixels( aColor, 0x00, 0xFF, 0x00 );
+ GetXPixels( aColor, 0x00, 0xFF, 0xFF );
+
+ // standard colors: 7 * 2 = 14
+ GetXPixels( aColor, 0x00, 0x00, 0x80 );
+ GetXPixels( aColor, 0x00, 0x80, 0x00 );
+ GetXPixels( aColor, 0x00, 0x80, 0x80 );
+ GetXPixels( aColor, 0x80, 0x00, 0x00 );
+ GetXPixels( aColor, 0x80, 0x00, 0x80 );
+ GetXPixels( aColor, 0x80, 0x80, 0x00 );
+ GetXPixels( aColor, 0x80, 0x80, 0x80 );
+ GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blue 7
+
+ // cube: 6*6*6 - 8 = 208
+ for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF
+ for( g = 0; g < 0x100; g += 0x33 )
+ for( b = 0; b < 0x100; b += 0x33 )
+ GetXPixels( aColor, r, g, b );
+
+ // gray: 16 - 6 = 10
+ for( g = 0x11; g < 0xFF; g += 0x11 )
+ GetXPixels( aColor, g, g, g );
+
+ // green: 16 - 6 = 10
+ for( g = 0x11; g < 0xFF; g += 0x11 )
+ GetXPixels( aColor, 0, g, 0 );
+
+ // red: 16 - 6 = 10
+ for( r = 0x11; r < 0xFF; r += 0x11 )
+ GetXPixels( aColor, r, 0, 0 );
+
+ // blue: 16 - 6 = 10
+ for( b = 0x11; b < 0xFF; b += 0x11 )
+ GetXPixels( aColor, 0, 0, b );
+
}
// MonoChrome
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index e9eddc605a8c..a124cd0e05d6 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -2163,26 +2163,27 @@ void WMAdaptor::switchToWorkArea( int nWorkArea ) const
if( ! getWMshouldSwitchWorkspace() )
return;
- if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
- {
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.window = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() );
- aEvent.xclient.message_type = m_aWMAtoms[ NET_CURRENT_DESKTOP ];
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = nWorkArea;
- aEvent.xclient.data.l[1] = 0;
- aEvent.xclient.data.l[2] = 0;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent
- );
- }
+ if( !m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
+ return;
+
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.window = m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() );
+ aEvent.xclient.message_type = m_aWMAtoms[ NET_CURRENT_DESKTOP ];
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = nWorkArea;
+ aEvent.xclient.data.l[1] = 0;
+ aEvent.xclient.data.l[2] = 0;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( m_pSalDisplay->GetDefaultXScreen() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+
}
/*
@@ -2277,26 +2278,27 @@ void WMAdaptor::answerPing( X11SalFrame const * i_pFrame, XClientMessageEvent co
void WMAdaptor::activateWindow( X11SalFrame *pFrame, Time nTimestamp )
{
- if (pFrame->bMapped_)
- {
- XEvent aEvent;
+ if (!pFrame->bMapped_)
+ return;
- aEvent.xclient.type = ClientMessage;
- aEvent.xclient.window = pFrame->GetShellWindow();
- aEvent.xclient.message_type = m_aWMAtoms[ NET_ACTIVE_WINDOW ];
- aEvent.xclient.format = 32;
- aEvent.xclient.data.l[0] = 1;
- aEvent.xclient.data.l[1] = nTimestamp;
- aEvent.xclient.data.l[2] = None;
- aEvent.xclient.data.l[3] = 0;
- aEvent.xclient.data.l[4] = 0;
+ XEvent aEvent;
+
+ aEvent.xclient.type = ClientMessage;
+ aEvent.xclient.window = pFrame->GetShellWindow();
+ aEvent.xclient.message_type = m_aWMAtoms[ NET_ACTIVE_WINDOW ];
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = 1;
+ aEvent.xclient.data.l[1] = nTimestamp;
+ aEvent.xclient.data.l[2] = None;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent );
- XSendEvent( m_pDisplay,
- m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ),
- False,
- SubstructureNotifyMask | SubstructureRedirectMask,
- &aEvent );
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index 90e620090cc8..b85a144ccacb 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -3475,33 +3475,34 @@ void SelectionManager::transferablesFlavorsChanged()
pTypes[i] = *type_it;
XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes );
- if( m_aCurrentDropWindow != None && m_nCurrentProtocolVersion >= 0 )
- {
- // send synthetic leave and enter events
+ if( m_aCurrentDropWindow == None || m_nCurrentProtocolVersion < 0 )
+ return;
- XEvent aEvent;
+ // send synthetic leave and enter events
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.format = 32;
- aEvent.xclient.window = m_aDropWindow;
- aEvent.xclient.data.l[0] = m_aWindow;
+ XEvent aEvent;
- aEvent.xclient.message_type = m_nXdndLeave;
- aEvent.xclient.data.l[1] = 0;
- XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.window = m_aDropWindow;
+ aEvent.xclient.data.l[0] = m_aWindow;
- aEvent.xclient.message_type = m_nXdndEnter;
- aEvent.xclient.data.l[1] = m_nCurrentProtocolVersion << 24;
- memset( aEvent.xclient.data.l + 2, 0, sizeof( long )*3 );
- // fill in data types
- if( nTypes > 3 )
- aEvent.xclient.data.l[1] |= 1;
- for( int j = 0; j < nTypes && j < 3; j++ )
- aEvent.xclient.data.l[j+2] = pTypes[j];
+ aEvent.xclient.message_type = m_nXdndLeave;
+ aEvent.xclient.data.l[1] = 0;
+ XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
+
+ aEvent.xclient.message_type = m_nXdndEnter;
+ aEvent.xclient.data.l[1] = m_nCurrentProtocolVersion << 24;
+ memset( aEvent.xclient.data.l + 2, 0, sizeof( long )*3 );
+ // fill in data types
+ if( nTypes > 3 )
+ aEvent.xclient.data.l[1] |= 1;
+ for( int j = 0; j < nTypes && j < 3; j++ )
+ aEvent.xclient.data.l[j+2] = pTypes[j];
+
+ XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
- XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
- }
}
/*
@@ -3892,44 +3893,45 @@ void SelectionManager::deregisterDropTarget( ::Window aWindow )
osl::ClearableMutexGuard aGuard(m_aMutex);
m_aDropTargets.erase( aWindow );
- if( aWindow == m_aDragSourceWindow && m_aDragRunning.check() )
+ if( aWindow != m_aDragSourceWindow || !m_aDragRunning.check() )
+ return;
+
+ // abort drag
+ std::unordered_map< ::Window, DropTargetEntry >::const_iterator it =
+ m_aDropTargets.find( m_aDropWindow );
+ if( it != m_aDropTargets.end() )
{
- // abort drag
- std::unordered_map< ::Window, DropTargetEntry >::const_iterator it =
- m_aDropTargets.find( m_aDropWindow );
- if( it != m_aDropTargets.end() )
- {
- DropTargetEvent dte;
- dte.Source = static_cast< OWeakObject* >( it->second.m_pTarget );
- aGuard.clear();
- it->second.m_pTarget->dragExit( dte );
- }
- else if( m_aDropProxy != None && m_nCurrentProtocolVersion >= 0 )
- {
- // send XdndLeave
- XEvent aEvent;
- aEvent.type = ClientMessage;
- aEvent.xclient.display = m_pDisplay;
- aEvent.xclient.format = 32;
- aEvent.xclient.message_type = m_nXdndLeave;
- aEvent.xclient.window = m_aDropWindow;
- aEvent.xclient.data.l[0] = m_aWindow;
- memset( aEvent.xclient.data.l+1, 0, sizeof(long)*4);
- m_aDropWindow = m_aDropProxy = None;
- XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
- }
- // notify the listener
- DragSourceDropEvent dsde;
- dsde.Source = static_cast< OWeakObject* >(this);
- dsde.DragSourceContext = new DragSourceContext( m_aDropWindow, *this );
- dsde.DragSource = static_cast< XDragSource* >(this);
- dsde.DropAction = DNDConstants::ACTION_NONE;
- dsde.DropSuccess = false;
- css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
- m_xDragSourceListener.clear();
+ DropTargetEvent dte;
+ dte.Source = static_cast< OWeakObject* >( it->second.m_pTarget );
aGuard.clear();
- xListener->dragDropEnd( dsde );
+ it->second.m_pTarget->dragExit( dte );
+ }
+ else if( m_aDropProxy != None && m_nCurrentProtocolVersion >= 0 )
+ {
+ // send XdndLeave
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = m_pDisplay;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.message_type = m_nXdndLeave;
+ aEvent.xclient.window = m_aDropWindow;
+ aEvent.xclient.data.l[0] = m_aWindow;
+ memset( aEvent.xclient.data.l+1, 0, sizeof(long)*4);
+ m_aDropWindow = m_aDropProxy = None;
+ XSendEvent( m_pDisplay, m_aDropProxy, False, NoEventMask, &aEvent );
}
+ // notify the listener
+ DragSourceDropEvent dsde;
+ dsde.Source = static_cast< OWeakObject* >(this);
+ dsde.DragSourceContext = new DragSourceContext( m_aDropWindow, *this );
+ dsde.DragSource = static_cast< XDragSource* >(this);
+ dsde.DropAction = DNDConstants::ACTION_NONE;
+ dsde.DropSuccess = false;
+ css::uno::Reference< XDragSourceListener > xListener( m_xDragSourceListener );
+ m_xDragSourceListener.clear();
+ aGuard.clear();
+ xListener->dragDropEnd( dsde );
+
}
/*
diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx
index d16cbbf6c0ce..2dcea675dcf1 100644
--- a/vcl/unx/generic/print/common_gfx.cxx
+++ b/vcl/unx/generic/print/common_gfx.cxx
@@ -721,77 +721,78 @@ void
PrinterGfx::PSSetFont ()
{
GraphicsStatus& rCurrent( currentState() );
- if( maVirtualStatus.maFont != rCurrent.maFont ||
- maVirtualStatus.mnTextHeight != rCurrent.mnTextHeight ||
- maVirtualStatus.maEncoding != rCurrent.maEncoding ||
- maVirtualStatus.mnTextWidth != rCurrent.mnTextWidth ||
- maVirtualStatus.mbArtBold != rCurrent.mbArtBold ||
- maVirtualStatus.mbArtItalic != rCurrent.mbArtItalic
+ if( !(maVirtualStatus.maFont != rCurrent.maFont ||
+ maVirtualStatus.mnTextHeight != rCurrent.mnTextHeight ||
+ maVirtualStatus.maEncoding != rCurrent.maEncoding ||
+ maVirtualStatus.mnTextWidth != rCurrent.mnTextWidth ||
+ maVirtualStatus.mbArtBold != rCurrent.mbArtBold ||
+ maVirtualStatus.mbArtItalic != rCurrent.mbArtItalic)
)
- {
- rCurrent.maFont = maVirtualStatus.maFont;
- rCurrent.maEncoding = maVirtualStatus.maEncoding;
- rCurrent.mnTextWidth = maVirtualStatus.mnTextWidth;
- rCurrent.mnTextHeight = maVirtualStatus.mnTextHeight;
- rCurrent.mbArtItalic = maVirtualStatus.mbArtItalic;
- rCurrent.mbArtBold = maVirtualStatus.mbArtBold;
-
- sal_Int32 nTextHeight = rCurrent.mnTextHeight;
- sal_Int32 nTextWidth = rCurrent.mnTextWidth ? rCurrent.mnTextWidth
- : rCurrent.mnTextHeight;
-
- sal_Char pSetFont [256];
- sal_Int32 nChar = 0;
+ return;
- // postscript based fonts need reencoding
- if ( ( rCurrent.maEncoding == RTL_TEXTENCODING_MS_1252)
- || ( rCurrent.maEncoding == RTL_TEXTENCODING_ISO_8859_1)
- || ( rCurrent.maEncoding >= RTL_TEXTENCODING_USER_START
- && rCurrent.maEncoding <= RTL_TEXTENCODING_USER_END)
- )
- {
- OString aReencodedFont =
- psp::GlyphSet::GetReencodedFontName (rCurrent.maEncoding,
- rCurrent.maFont);
-
- nChar += psp::appendStr ("(", pSetFont + nChar);
- nChar += psp::appendStr (aReencodedFont.getStr(),
- pSetFont + nChar);
- nChar += psp::appendStr (") cvn findfont ",
- pSetFont + nChar);
- }
- else
- // tt based fonts mustn't reencode, the encoding is implied by the fontname
- // same for symbol type1 fonts, don't try to touch them
- {
- nChar += psp::appendStr ("(", pSetFont + nChar);
- nChar += psp::appendStr (rCurrent.maFont.getStr(),
- pSetFont + nChar);
- nChar += psp::appendStr (") cvn findfont ",
- pSetFont + nChar);
- }
+ rCurrent.maFont = maVirtualStatus.maFont;
+ rCurrent.maEncoding = maVirtualStatus.maEncoding;
+ rCurrent.mnTextWidth = maVirtualStatus.mnTextWidth;
+ rCurrent.mnTextHeight = maVirtualStatus.mnTextHeight;
+ rCurrent.mbArtItalic = maVirtualStatus.mbArtItalic;
+ rCurrent.mbArtBold = maVirtualStatus.mbArtBold;
- if( ! rCurrent.mbArtItalic )
- {
- nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
- nChar += psp::appendStr (" ", pSetFont + nChar);
- nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
- nChar += psp::appendStr (" matrix scale makefont setfont\n", pSetFont + nChar);
- }
- else // skew 15 degrees to right
- {
- nChar += psp::appendStr ( " [", pSetFont + nChar);
- nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
- nChar += psp::appendStr (" 0 ", pSetFont + nChar);
- nChar += psp::getValueOfDouble (pSetFont + nChar, 0.27*(double)nTextWidth, 3 );
- nChar += psp::appendStr ( " ", pSetFont + nChar);
- nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
-
- nChar += psp::appendStr (" 0 0] makefont setfont\n", pSetFont + nChar);
- }
+ sal_Int32 nTextHeight = rCurrent.mnTextHeight;
+ sal_Int32 nTextWidth = rCurrent.mnTextWidth ? rCurrent.mnTextWidth
+ : rCurrent.mnTextHeight;
- WritePS (mpPageBody, pSetFont, nChar);
+ sal_Char pSetFont [256];
+ sal_Int32 nChar = 0;
+
+ // postscript based fonts need reencoding
+ if ( ( rCurrent.maEncoding == RTL_TEXTENCODING_MS_1252)
+ || ( rCurrent.maEncoding == RTL_TEXTENCODING_ISO_8859_1)
+ || ( rCurrent.maEncoding >= RTL_TEXTENCODING_USER_START
+ && rCurrent.maEncoding <= RTL_TEXTENCODING_USER_END)
+ )
+ {
+ OString aReencodedFont =
+ psp::GlyphSet::GetReencodedFontName (rCurrent.maEncoding,
+ rCurrent.maFont);
+
+ nChar += psp::appendStr ("(", pSetFont + nChar);
+ nChar += psp::appendStr (aReencodedFont.getStr(),
+ pSetFont + nChar);
+ nChar += psp::appendStr (") cvn findfont ",
+ pSetFont + nChar);
}
+ else
+ // tt based fonts mustn't reencode, the encoding is implied by the fontname
+ // same for symbol type1 fonts, don't try to touch them
+ {
+ nChar += psp::appendStr ("(", pSetFont + nChar);
+ nChar += psp::appendStr (rCurrent.maFont.getStr(),
+ pSetFont + nChar);
+ nChar += psp::appendStr (") cvn findfont ",
+ pSetFont + nChar);
+ }
+
+ if( ! rCurrent.mbArtItalic )
+ {
+ nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
+ nChar += psp::appendStr (" ", pSetFont + nChar);
+ nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
+ nChar += psp::appendStr (" matrix scale makefont setfont\n", pSetFont + nChar);
+ }
+ else // skew 15 degrees to right
+ {
+ nChar += psp::appendStr ( " [", pSetFont + nChar);
+ nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
+ nChar += psp::appendStr (" 0 ", pSetFont + nChar);
+ nChar += psp::getValueOfDouble (pSetFont + nChar, 0.27*(double)nTextWidth, 3 );
+ nChar += psp::appendStr ( " ", pSetFont + nChar);
+ nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
+
+ nChar += psp::appendStr (" 0 0] makefont setfont\n", pSetFont + nChar);
+ }
+
+ WritePS (mpPageBody, pSetFont, nChar);
+
}
void
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 275ca8f38d22..f13f62b39ff2 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -711,32 +711,33 @@ void PspSalInfoPrinter::GetPageInfo(
JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData );
// get the selected page size
- if( aData.m_pParser )
- {
+ if( !aData.m_pParser )
+return;
- OUString aPaper;
- int width, height;
- int left = 0, top = 0, right = 0, bottom = 0;
- int nDPI = aData.m_aContext.getRenderResolution();
- if( aData.m_eOrientation == psp::orientation::Portrait )
- {
- aData.m_aContext.getPageSize( aPaper, width, height );
- aData.m_pParser->getMargins( aPaper, left, right, top, bottom );
- }
- else
- {
- aData.m_aContext.getPageSize( aPaper, height, width );
- aData.m_pParser->getMargins( aPaper, top, bottom, right, left );
- }
+ OUString aPaper;
+ int width, height;
+ int left = 0, top = 0, right = 0, bottom = 0;
+ int nDPI = aData.m_aContext.getRenderResolution();
- rPageWidth = width * nDPI / 72;
- rPageHeight = height * nDPI / 72;
- rPageOffX = left * nDPI / 72;
- rPageOffY = top * nDPI / 72;
- rOutWidth = ( width - left - right ) * nDPI / 72;
- rOutHeight = ( height - top - bottom ) * nDPI / 72;
+ if( aData.m_eOrientation == psp::orientation::Portrait )
+ {
+ aData.m_aContext.getPageSize( aPaper, width, height );
+ aData.m_pParser->getMargins( aPaper, left, right, top, bottom );
}
+ else
+ {
+ aData.m_aContext.getPageSize( aPaper, height, width );
+ aData.m_pParser->getMargins( aPaper, top, bottom, right, left );
+ }
+
+ rPageWidth = width * nDPI / 72;
+ rPageHeight = height * nDPI / 72;
+ rPageOffX = left * nDPI / 72;
+ rPageOffY = top * nDPI / 72;
+ rOutWidth = ( width - left - right ) * nDPI / 72;
+ rOutHeight = ( height - top - bottom ) * nDPI / 72;
+
}
sal_uInt16 PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 4d539934f464..10516bec1158 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1036,107 +1036,108 @@ void X11SalFrame::updateGraphics( bool bClear )
void X11SalFrame::SetIcon( sal_uInt16 nIcon )
{
- if ( ! IsChildWindow() )
- {
- // 0 == default icon -> #1
- if ( nIcon == 0 )
- nIcon = 1;
+ if ( IsChildWindow() )
+ return;
- mnIconID = nIcon;
+ // 0 == default icon -> #1
+ if ( nIcon == 0 )
+ nIcon = 1;
- XIconSize *pIconSize = nullptr;
- int nSizes = 0;
- int iconSize = 32;
- if ( XGetIconSizes( GetXDisplay(), GetDisplay()->GetRootWindow( m_nXScreen ), &pIconSize, &nSizes ) )
- {
-#if OSL_DEBUG_LEVEL > 1
- fprintf(stderr, "X11SalFrame::SetIcon(): found %d IconSizes:\n", nSizes);
-#endif
-
- int i;
- for( i=0; i<nSizes; i++)
- {
- // select largest supported icon
- if( pIconSize[i].max_width > iconSize )
- {
- iconSize = pIconSize[i].max_width;
- }
+ mnIconID = nIcon;
+ XIconSize *pIconSize = nullptr;
+ int nSizes = 0;
+ int iconSize = 32;
+ if ( XGetIconSizes( GetXDisplay(), GetDisplay()->GetRootWindow( m_nXScreen ), &pIconSize, &nSizes ) )
+ {
#if OSL_DEBUG_LEVEL > 1
- fprintf(stderr, "min: %d, %d\nmax: %d, %d\ninc: %d, %d\n\n",
- pIconSize[i].min_width, pIconSize[i].min_height,
- pIconSize[i].max_width, pIconSize[i].max_height,
- pIconSize[i].width_inc, pIconSize[i].height_inc);
+ fprintf(stderr, "X11SalFrame::SetIcon(): found %d IconSizes:\n", nSizes);
#endif
- }
- XFree( pIconSize );
- }
- else
+ int i;
+ for( i=0; i<nSizes; i++)
{
- const OUString& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() );
- if( rWM == "KWin" ) // assume KDE is running
- iconSize = 48;
- static bool bGnomeIconSize = false;
- static bool bGnomeChecked = false;
- if( ! bGnomeChecked )
+ // select largest supported icon
+ if( pIconSize[i].max_width > iconSize )
{
- bGnomeChecked=true;
- int nCount = 0;
- Atom* pProps = XListProperties( GetXDisplay(),
- GetDisplay()->GetRootWindow( m_nXScreen ),
- &nCount );
- for( int i = 0; i < nCount && !bGnomeIconSize; i++ )
- {
- char* pName = XGetAtomName( GetXDisplay(), pProps[i] );
- if( pName )
- {
- if( !strcmp( pName, "GNOME_PANEL_DESKTOP_AREA" ) )
- bGnomeIconSize = true;
- XFree( pName );
- }
- }
- if( pProps )
- XFree( pProps );
+ iconSize = pIconSize[i].max_width;
}
- if( bGnomeIconSize )
- iconSize = 48;
- }
- XWMHints Hints;
- Hints.flags = 0;
- XWMHints *pHints = XGetWMHints( GetXDisplay(), GetShellWindow() );
- if( pHints )
- {
- memcpy(&Hints, pHints, sizeof( XWMHints ));
- XFree( pHints );
+#if OSL_DEBUG_LEVEL > 1
+ fprintf(stderr, "min: %d, %d\nmax: %d, %d\ninc: %d, %d\n\n",
+ pIconSize[i].min_width, pIconSize[i].min_height,
+ pIconSize[i].max_width, pIconSize[i].max_height,
+ pIconSize[i].width_inc, pIconSize[i].height_inc);
+#endif
}
- pHints = &Hints;
- NetWmIconData netwm_icon;
- bool bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
- nIcon, iconSize,
- pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
- if ( !bOk )
- {
- // load default icon (0)
- bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
- 0, iconSize,
- pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
- }
- if( bOk )
+ XFree( pIconSize );
+ }
+ else
+ {
+ const OUString& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() );
+ if( rWM == "KWin" ) // assume KDE is running
+ iconSize = 48;
+ static bool bGnomeIconSize = false;
+ static bool bGnomeChecked = false;
+ if( ! bGnomeChecked )
{
- pHints->flags |= IconPixmapHint;
- if( pHints->icon_mask )
- pHints->flags |= IconMaskHint;
-
- XSetWMHints( GetXDisplay(), GetShellWindow(), pHints );
- if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ))
- XChangeProperty( GetXDisplay(), mhWindow,
- GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ),
- XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(netwm_icon.data()), netwm_icon.size());
+ bGnomeChecked=true;
+ int nCount = 0;
+ Atom* pProps = XListProperties( GetXDisplay(),
+ GetDisplay()->GetRootWindow( m_nXScreen ),
+ &nCount );
+ for( int i = 0; i < nCount && !bGnomeIconSize; i++ )
+ {
+ char* pName = XGetAtomName( GetXDisplay(), pProps[i] );
+ if( pName )
+ {
+ if( !strcmp( pName, "GNOME_PANEL_DESKTOP_AREA" ) )
+ bGnomeIconSize = true;
+ XFree( pName );
+ }
+ }
+ if( pProps )
+ XFree( pProps );
}
+ if( bGnomeIconSize )
+ iconSize = 48;
+ }
+
+ XWMHints Hints;
+ Hints.flags = 0;
+ XWMHints *pHints = XGetWMHints( GetXDisplay(), GetShellWindow() );
+ if( pHints )
+ {
+ memcpy(&Hints, pHints, sizeof( XWMHints ));
+ XFree( pHints );
}
+ pHints = &Hints;
+
+ NetWmIconData netwm_icon;
+ bool bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
+ nIcon, iconSize,
+ pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
+ if ( !bOk )
+ {
+ // load default icon (0)
+ bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
+ 0, iconSize,
+ pHints->icon_pixmap, pHints->icon_mask, netwm_icon );
+ }
+ if( bOk )
+ {
+ pHints->flags |= IconPixmapHint;
+ if( pHints->icon_mask )
+ pHints->flags |= IconMaskHint;
+
+ XSetWMHints( GetXDisplay(), GetShellWindow(), pHints );
+ if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ))
+ XChangeProperty( GetXDisplay(), mhWindow,
+ GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ),
+ XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(netwm_icon.data()), netwm_icon.size());
+ }
+
}
void X11SalFrame::SetMaxClientSize( long nWidth, long nHeight )