diff -x CVS -urN ooo_SRC680_m172_src.orig/canvas/source/java/aqua/WindowAdapter.java ooo_SRC680_m172_src.aquavcl01/canvas/source/java/aqua/WindowAdapter.java --- ooo_SRC680_m172_src.orig/canvas/source/java/aqua/WindowAdapter.java 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/canvas/source/java/aqua/WindowAdapter.java 2006-01-31 01:07:05.000000000 +0100 @@ -0,0 +1,175 @@ +// UNO +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.AnyConverter; +import com.sun.star.lang.XInitialization; +import com.sun.star.lib.uno.helper.WeakBase; + +// OOo AWT +import com.sun.star.awt.*; + +// system-dependent stuff +import sun.awt.*; + +//Apple specifics +import apple.awt.*; + + +public class WindowAdapter +// defacto implementing the interface, but not deriving from it, since +// we're no real XInterface here +// implements com.sun.star.awt.XWindow +{ + public java.awt.Frame frame; + private boolean fullscreen; + + public WindowAdapter( int windowHandle, + boolean _fullscreen ) + { + fullscreen = false; + + if( _fullscreen ) + { + // create a normal Java frame, and set it into fullscreen mode + frame = new javax.swing.JFrame( "Presentation" ); + frame.setUndecorated( true ); + frame.setVisible( true ); + + java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); + if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) + { + CanvasUtils.printLog( "WindowAdapter(Aqua): entering fullscreen mode" ); + graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame ); + fullscreen = true; + } + else + { + CanvasUtils.printLog( "WindowAdapter(Aqua): fullscreen not supported" ); + } + + graphics.dispose(); + } + else + { + // we're initialized with the operating system window handle + // as the parameter. We then generate a dummy Java frame with + // that window as the parent, to fake a root window for the + // Java implementation. + + // now, we're getting slightly system dependent here. + String os = (String) System.getProperty("os.name"); + + // create the embedded frame + if( os.startsWith("Mac OS X") ) + frame = new apple.awt.CEmbeddedFrame( windowHandle ); + else + throw new com.sun.star.uno.RuntimeException(); + + +// frame = new javax.swing.JFrame( "Test window" ); + +// // resize it according to the given bounds +// frame.setBounds( boundRect ); +// frame.setVisible( true ); + } + } + + //---------------------------------------------------------------------------------- + + public void dispose() + { + if( fullscreen ) + { + java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); + if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) + { + CanvasUtils.printLog( "WindowAdapter(Aqua): leaving fullscreen mode" ); + graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null ); + } + graphics.dispose(); + } + + if( frame != null ) + frame.dispose(); + } + + //---------------------------------------------------------------------------------- + + // + // XWindow interface + // ================= + // + public void setPosSize( int X, int Y, int Width, int Height, short Flags ) + { + frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) ); + } + + public com.sun.star.awt.Rectangle getPosSize( ) + { + java.awt.Rectangle bounds = frame.getBounds(); + + return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height ); + } + + public void setVisible( boolean visible ) + { + frame.setVisible( visible ); + } + + public void setEnable( boolean enable ) + { + frame.setEnabled( enable ); + } + + public void setFocus() + { + } + + public void addWindowListener( XWindowListener xListener ) + { + } + + public void removeWindowListener( XWindowListener xListener ) + { + } + + public void addFocusListener( XFocusListener xListener ) + { + } + + public void removeFocusListener( XFocusListener xListener ) + { + } + + public void addKeyListener( XKeyListener xListener ) + { + } + + public void removeKeyListener( XKeyListener xListener ) + { + } + + public void addMouseListener( XMouseListener xListener ) + { + } + + public void removeMouseListener( XMouseListener xListener ) + { + } + + public void addMouseMotionListener( XMouseMotionListener xListener ) + { + } + + public void removeMouseMotionListener( XMouseMotionListener xListener ) + { + } + + public void addPaintListener( XPaintListener xListener ) + { + } + + public void removePaintListener( XPaintListener xListener ) + { + } +} diff -x CVS -urN ooo_SRC680_m172_src.orig/canvas/source/java/makefile.mk ooo_SRC680_m172_src.aquavcl01/canvas/source/java/makefile.mk --- ooo_SRC680_m172_src.orig/canvas/source/java/makefile.mk 2005-09-08 01:13:12.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/canvas/source/java/makefile.mk 2006-01-31 01:07:05.000000000 +0100 @@ -68,15 +68,19 @@ BezierPolyPolygon.java \ SpriteRunner.java -.IF "$(GUIBASE)"!="unx" +.IF "$(GUIBASE)"=="unx" -JAVAFILES += win/WindowAdapter.java +JAVAFILES += x11/WindowAdapter.java -.ELSE # "$(GUIBASE)"!="unx" +.ELIF "$(GUIBASE)"=="aqua" -JAVAFILES += x11/WindowAdapter.java +JAVAFILES += aqua/WindowAdapter.java + +.ELSE + +JAVAFILES += win/WindowAdapter.java -.ENDIF # "$(GUIBASE)"!="unx" +.ENDIF # "$(GUIBASE)"=="unx" JARFILES = jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) diff -x CVS -urN ooo_SRC680_m172_src.orig/dtrans/source/aqua/aqua_clipboard.hxx ooo_SRC680_m172_src.aquavcl01/dtrans/source/aqua/aqua_clipboard.hxx --- ooo_SRC680_m172_src.orig/dtrans/source/aqua/aqua_clipboard.hxx 2005-09-08 20:08:25.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/dtrans/source/aqua/aqua_clipboard.hxx 2006-03-12 20:50:48.000000000 +0100 @@ -36,8 +36,8 @@ #ifndef _AQUA_CLIPBOARD_HXX_ #define _AQUA_CLIPBOARD_HXX_ -#ifndef _RTL_USTRING_ -#include +#ifndef _RTL_USTRING_HXX_ +#include #endif #ifndef _SAL_TYPES_H_ diff -x CVS -urN ooo_SRC680_m172_src.orig/dtrans/source/aqua/dtransaqua.xml ooo_SRC680_m172_src.aquavcl01/dtrans/source/aqua/dtransaqua.xml --- ooo_SRC680_m172_src.orig/dtrans/source/aqua/dtransaqua.xml 2003-03-25 15:05:32.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/dtrans/source/aqua/dtransaqua.xml 2005-11-27 11:12:33.000000000 +0100 @@ -1,55 +1,48 @@ - - - - - - Tino Rachui - - com.sun.star.comp.datatransfer.clipboard - - - The win32 implementation of the datatransfer service. - - - sysdtrans - - com.sun.star.loader.SharedLibrary - - c++ - - - - com.sun.star.datatransfer.clipboard.SystemClipboard - - ... - - cppuhelper - cppu - sal - - cppuhelper - cppu2 - sal2 - - com.sun.star.datatransfer.clipboard.XClipboardEx - com.sun.star.datatransfer.XTransferable - com.sun.star.datatransfer.XTransferableEx - com.sun.star.datatransfer.clipboard.XClipboardOwner - com.sun.star.datatransfer.clipboard.XClipboardListener - com.sun.star.datatransfer.clipboard.XClipboardNotifier - com.sun.star.datatransfer.XTransferDataAccess - com.sun.star.lang.XComponent - com.sun.star.lang.XMultiServiceFactory - com.sun.star.lang.XSingleServiceFactory - com.sun.star.lang.XServiceInfo - com.sun.star.lang.XTypeProvider - com.sun.star.lang.IllegalArgumentException - com.sun.star.uno.TypeClass - com.sun.star.uno.XWeak - com.sun.star.uno.XAggregation - com.sun.star.registry.XRegistryKey - com.sun.star.container.XSet - - - + + + + dtransaqua + + Tino Rachui + com.sun.star.comp.datatransfer.aqua + + The aqua implementation of the datatransfer service. + + com.sun.star.loader.SharedLibrary + c++ + + com.sun.star.datatransfer.clipboard.SystemClipboard + ... + com.sun.star.datatransfer.clipboard.XClipboardEx + com.sun.star.datatransfer.XTransferable + com.sun.star.datatransfer.clipboard.RenderingCapabilities + com.sun.star.datatransfer.clipboard.XClipboardOwner + com.sun.star.datatransfer.clipboard.XClipboardListener + com.sun.star.datatransfer.clipboard.XClipboardNotifier + com.sun.star.datatransfer.dnd.XDropTargetDropContext + com.sun.star.datatransfer.dnd.XDropTargetDragContext + com.sun.star.datatransfer.dnd.XDropTarget + com.sun.star.datatransfer.dnd.DNDConstants + com.sun.star.datatransfer.dnd.XDragSource + com.sun.star.datatransfer.dnd.XDragSourceContext + com.sun.star.awt.XDisplayConnection + com.sun.star.lang.DisposedException + com.sun.star.lang.IllegalArgumentException + com.sun.star.lang.XComponent + com.sun.star.lang.XMultiServiceFactory + com.sun.star.lang.XSingleServiceFactory + com.sun.star.lang.XServiceInfo + com.sun.star.lang.XTypeProvider + com.sun.star.uno.TypeClass + com.sun.star.uno.XWeak + com.sun.star.uno.XAggregation + com.sun.star.registry.XRegistryKey + com.sun.star.container.XSet + + cppuhelper + cppu + sal + cppuhelper + cppu2 + sal2 + diff -x CVS -urN ooo_SRC680_m172_src.orig/dtrans/source/aqua/test_aquacb.cxx ooo_SRC680_m172_src.aquavcl01/dtrans/source/aqua/test_aquacb.cxx --- ooo_SRC680_m172_src.orig/dtrans/source/aqua/test_aquacb.cxx 2005-09-08 20:09:21.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/dtrans/source/aqua/test_aquacb.cxx 2006-03-12 20:55:20.000000000 +0100 @@ -63,8 +63,8 @@ #include #endif -#ifndef _RTL_USTRING_ -#include +#ifndef _RTL_USTRING_HXX_ +#include #endif #ifndef _SAL_TYPES_H_ diff -x CVS -urN ooo_SRC680_m172_src.orig/dtrans/source/cnttype/mcnttfactory.hxx ooo_SRC680_m172_src.aquavcl01/dtrans/source/cnttype/mcnttfactory.hxx --- ooo_SRC680_m172_src.orig/dtrans/source/cnttype/mcnttfactory.hxx 2005-09-08 20:10:09.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/dtrans/source/cnttype/mcnttfactory.hxx 2006-03-12 20:52:37.000000000 +0100 @@ -41,8 +41,8 @@ // includes //------------------------------------------------------------------------ -#ifndef _RTL_USTRING_ -#include +#ifndef _RTL_USTRING_HXX_ +#include #endif #ifndef _SAL_TYPES_H_ diff -x CVS -urN ooo_SRC680_m172_src.orig/dtrans/source/cnttype/mcnttype.hxx ooo_SRC680_m172_src.aquavcl01/dtrans/source/cnttype/mcnttype.hxx --- ooo_SRC680_m172_src.orig/dtrans/source/cnttype/mcnttype.hxx 2005-09-08 20:10:44.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/dtrans/source/cnttype/mcnttype.hxx 2006-03-12 20:53:34.000000000 +0100 @@ -45,8 +45,8 @@ #include #endif -#ifndef _RTL_USTRING_ -#include +#ifndef _RTL_USTRING_HXX_ +#include #endif #ifndef _SAL_TYPES_H_ diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/prj/build.lst ooo_SRC680_m172_src.aquavcl01/extensions/prj/build.lst --- ooo_SRC680_m172_src.orig/extensions/prj/build.lst 2006-02-09 14:48:31.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/prj/build.lst 2006-03-10 15:21:33.000000000 +0100 @@ -11,10 +11,11 @@ ex extensions\source\resource nmake - all ex_resrc NULL ex extensions\source\installation nmake - w ex_inst NULL ex extensions\source\installation\office\protchk nmake - all ex_pchk NULL +ex extensions\source\plugin\aqua nmake - u ex_plaqua ex_plbase NULL ex extensions\source\plugin\base nmake - all ex_plbase NULL ex extensions\source\plugin\win nmake - w ex_plwin ex_plbase NULL ex extensions\source\plugin\unx nmake - u ex_plunx NULL -ex extensions\source\plugin\util nmake - all ex_plutil ex_plbase ex_plunx.u ex_plwin.w NULL +ex extensions\source\plugin\util nmake - all ex_plutil ex_plbase ex_plunx.u ex_plwin.w ex_plaqua.u NULL ex extensions\source\scanner nmake - all ex_scan ex_resrc NULL ex extensions\source\svg nmake - all ex_svg ex_scan NULL ex extensions\source\packer nmake - all ex_pck NULL diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/aqua/macmgr.cxx ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/aqua/macmgr.cxx --- ooo_SRC680_m172_src.orig/extensions/source/plugin/aqua/macmgr.cxx 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/aqua/macmgr.cxx 2006-01-31 01:36:15.000000000 +0100 @@ -0,0 +1,238 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace rtl; +using namespace std; +using namespace com::sun::star::uno; +using namespace com::sun::star::plugin; + +// Unix specific implementation +static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rDescriptions ) +{ +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "Trying plugin %s ... ", rPath.GetBuffer() ); +#endif + + xub_StrLen nPos = rPath.SearchBackward( '/' ); + if( nPos == STRING_NOTFOUND ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "no absolute path to plugin\n" ); +#endif + return false; + } + + ByteString aBaseName = rPath.Copy( nPos+1 ); + if( aBaseName.Equals( "libnullplugin.so" ) ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "don't like %s\n", aBaseName.GetBuffer() ); +#endif + return false; + } + + struct stat aStat; + if( stat( rPath.GetBuffer(), &aStat ) || ! S_ISREG( aStat.st_mode ) ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "%s is not a regular file\n", rPath.GetBuffer() ); +#endif + return false; + } + + + rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); + + ByteString aCommand( "pluginapp.bin \"" ); + aCommand.Append( rPath ); + aCommand.Append( '"' ); + + FILE* pResult = popen( aCommand.GetBuffer(), "r" ); + int nDescriptions = 0; + if( pResult ) + { + OStringBuffer aMIME; + char buf[256]; + while( fgets( buf, sizeof( buf ), pResult ) ) + { + for( int i = 0; i < sizeof(buf) && buf[i]; ++i ) + { + if( buf[i] == '\n' ) + buf[i] = ';'; + } + aMIME.append( buf ); + } + pclose( pResult ); + + if( aMIME.getLength() > 0 ) + { + OString aLine = aMIME.makeStringAndClear(); + + sal_Int32 nIndex = 0; + while( nIndex != -1 ) + { + OString aType = aLine.getToken( 0, ';', nIndex ); + + sal_Int32 nTypeIndex = 0; + OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); + OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); + if( nTypeIndex < 0 ) // ensure at least three tokens + continue; + OString aDesc = aType.getToken( 0, ':', nTypeIndex ); + + // create extension list string + sal_Int32 nExtIndex = 0; + OStringBuffer aExtension; + while( nExtIndex != -1 ) + { + OString aExt = aExtLine.getToken( 0, ',', nExtIndex); + if( aExt.indexOf( "*." ) != 0 ) + aExtension.append( "*." ); + aExtension.append( aExt ); + if( nExtIndex != -1 ) + aExtension.append( ';' ); + } + + PluginDescription* pNew = new PluginDescription; + // set plugin name (path to library) + pNew->PluginName = OStringToOUString( rPath, aEncoding ); + // set mimetype + pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); + // set extension line + pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); + // set description + pNew->Description= OStringToOUString( aDesc, aEncoding ); + rDescriptions.push_back( pNew ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "Mimetype: %s\nExtension: %s\n" + "Description: %s\n", + OUStringToOString( pNew->Mimetype, aEncoding ).getStr(), + OUStringToOString( pNew->Extension, aEncoding ).getStr(), + OUStringToOString( pNew->Description, aEncoding ).getStr() + ); +#endif + } + } +#if OSL_DEBUG_LEVEL > 1 + else + fprintf( stderr, "result of \"%s\" contains no mimtype\n", + aCommand.GetBuffer() ); +#endif + } +#if OSL_DEBUG_LEVEL > 1 + else + fprintf( stderr, "command \"%s\" failed\n", aCommand.GetBuffer() ); +#endif + return nDescriptions > 0; +} + +Sequence XPluginManager_Impl::getPluginDescriptions() throw() +{ + static Sequence aDescriptions; + static BOOL bHavePlugins = FALSE; + if( ! bHavePlugins ) + { + rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); + list aPlugins; + int i; + + // unix: search for plugins in /usr/lib/netscape/plugins, + // ~/.netscape/plugins und NPX_PLUGIN_PATH + // additionally: search in PluginsPath + static const char* pHome = getenv( "HOME" ); + static const char* pNPXPluginPath = getenv( "NPX_PLUGIN_PATH" ); + + ByteString aSearchPath( "/usr/lib/netscape/plugins" ); + if( pHome ) + { + aSearchPath.Append( ':' ); + aSearchPath.Append( pHome ); + aSearchPath += "/.netscape/plugins"; + } + if( pNPXPluginPath ) + { + aSearchPath.Append( ':' ); + aSearchPath += pNPXPluginPath; + } + + const Sequence< ::rtl::OUString >& rPaths( PluginManager::getAdditionalSearchPaths() ); + for( i = 0; i < rPaths.getLength(); i++ ) + { + aSearchPath += ":"; + aSearchPath += ByteString( String( rPaths.getConstArray()[i] ), aEncoding ); + } + + + long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ]; + int nPaths = aSearchPath.GetTokenCount( ':' ); + for( i = 0; i < nPaths; i++ ) + { + ByteString aPath( aSearchPath.GetToken( i, ':' ) ); + if( aPath.Len() ) + { + DIR* pDIR = opendir( aPath.GetBuffer() ); + struct dirent* pDirEnt = NULL; + while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt ) + { + char* pBaseName = ((struct dirent*)aBuffer)->d_name; + if( pBaseName[0] != '.' || + pBaseName[1] != '.' || + pBaseName[2] != 0 ) + { + ByteString aFileName( aPath ); + aFileName += "/"; + aFileName += pBaseName; + CheckPlugin( aFileName, aPlugins ); + } + } + if( pDIR ) + closedir( pDIR ); + } + } + + // try ~/.mozilla/pluginreg.dat + ByteString aMozPluginreg( pHome ); + aMozPluginreg.Append( "/.mozilla/pluginreg.dat" ); + FILE* fp = fopen( aMozPluginreg.GetBuffer(), "r" ); + if( fp ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "parsing %s\n", aMozPluginreg.GetBuffer() ); +#endif + char aLine[1024]; + while( fgets( aLine, sizeof( aLine ), fp ) ) + { + int nLineLen = strlen( aLine ); + int nDotPos; + for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- ) + ; + if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' ) + CheckPlugin( ByteString( aLine, nDotPos ), aPlugins ); + } + fclose( fp ); + } + + // create return value + aDescriptions = Sequence( aPlugins.size() ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "found %d plugins\n", aPlugins.size() ); +#endif + list::iterator iter; + for( iter = aPlugins.begin(), i=0; iter != aPlugins.end(); ++iter ,i++ ) + { + aDescriptions.getArray()[ i ] = **iter; + delete *iter; + } + aPlugins.clear(); + bHavePlugins = TRUE; + } + return aDescriptions; +} + diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/aqua/makefile.mk ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/aqua/makefile.mk --- ooo_SRC680_m172_src.orig/extensions/source/plugin/aqua/makefile.mk 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/aqua/makefile.mk 2006-03-16 22:28:00.000000000 +0100 @@ -0,0 +1,43 @@ +PRJ=..$/..$/.. + +PRJNAME=plugin +TARGET=plaqua +#ENABLE_EXCEPTIONS=TRUE +#TARGETTYPE=CUI + +.INCLUDE : ..$/util$/makefile.pmk + +.IF "$(GUIBASE)"!="aqua" +dummy: + @echo "Nothing to build for GUIBASE $(GUIBASE)." + +.ELSE + +# --- Files -------------------------------------------------------- + +INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin +.IF "$(SOLAR_JAVA)" != "" +INCPRE+=-I$(SOLARINCDIR)$/mozilla$/java +INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr +CDEFS+=-DOJI +.ENDIF + +SLOFILES=\ + $(SLO)$/macmgr.obj \ + $(SLO)$/sysplug.obj + +#APP1TARGET=pluginapp.bin +#APP1OBJS=$(OBJFILES) +#APP1STDLIBS=\ +# $(TOOLSLIB) \ +# $(VOSLIB) \ +# $(SALLIB) + +#APP1DEF= $(MISC)$/$(TARGET).def + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +.ENDIF # $(GUIBASE)==aqua diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/aqua/sysplug.cxx ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/aqua/sysplug.cxx --- ooo_SRC680_m172_src.orig/extensions/source/plugin/aqua/sysplug.cxx 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/aqua/sysplug.cxx 2006-01-31 01:36:15.000000000 +0100 @@ -0,0 +1,186 @@ +#include + +#include +#include +#include +#include + +#include + +int MacPluginComm::nConnCounter = 0; + +MacPluginComm::MacPluginComm( + const String& mimetype, + const String& library, + WindowRef aParent, + int nDescriptor1, + int nDescriptor2 + ) : +PluginComm( ::rtl::OUStringToOString( library, osl_getThreadTextEncoding() ) )/*, +PluginConnector( nDescriptor2 )*/ +{ + //char pDesc[32]; +// char pWindow[32]; +// sprintf( pWindow, "%d", aParent ); +// sprintf( pDesc, "%d", nDescriptor1 ); +// ByteString aLib( library, osl_getThreadTextEncoding() ); +// +// char* pArgs[5]; +// pArgs[0] = "pluginapp.bin"; +// pArgs[1] = pDesc; +// pArgs[2] = const_cast(aLib.GetBuffer()); +// pArgs[3] = pWindow; +// pArgs[4] = NULL; +// +//#if OSL_DEBUG_LEVEL > 1 +// m_nCommPID = 10; +// fprintf( stderr, "Try to launch: %s %s %s %s, descriptors are %d, %d\n", pArgs[0], pArgs[1], pArgs[2], pArgs[3], nDescriptor1, nDescriptor2 ); +//#endif +// +// if( ! ( m_nCommPID = fork() ) ) +// { +// execvp( pArgs[0], pArgs ); +// fprintf( stderr, "Error: could not exec %s\n", pArgs[0] ); +// _exit(255); +// } +// +// if( m_nCommPID != -1 ) +// { +// // wait for pluginapp.bin to start up +// if( ! WaitForMessage( 5000 ) ) +// { +// fprintf( stderr, "Timeout on command: %s %s %s %s\n", pArgs[0], pArgs[1], pArgs[2], pArgs[3] ); +// invalidate(); +// } +// else +// { +// MediatorMessage* pMessage = GetNextMessage( TRUE ); +// Respond( pMessage->m_nID, +// "init ack",8, +// NULL ); +// delete pMessage; +// NPP_Initialize(); +// } +// } +} + +MacPluginComm::~MacPluginComm() +{ + NPP_Shutdown(); + if( m_nCommPID != -1 && m_nCommPID != 0 ) + { + int status = 16777216; + pid_t nExit = waitpid( m_nCommPID, &status, WUNTRACED ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "child %d (plugin app child %d) exited with status %d\n", nExit, m_nCommPID, WEXITSTATUS(status) ); +#endif + } +} + +NPError MacPluginComm::NPP_Destroy( NPP instance, + NPSavedData** save ) +{ + return 0; +} + +NPError MacPluginComm::NPP_DestroyStream( NPP instance, + NPStream* stream, + NPError reason ) +{ + return 0; +} + +jref MacPluginComm::NPP_GetJavaClass() +{ + return 0; +} + +NPError MacPluginComm::NPP_Initialize() +{ + return 0; +} + +NPError MacPluginComm::NPP_New( NPMIMEType pluginType, + NPP instance, + uint16 mode, + int16 argc, + char* argn[], + char* argv[], + NPSavedData *saved ) +{ + return 0; +} + +NPError MacPluginComm::NPP_NewStream( NPP instance, + NPMIMEType type, + NPStream* stream, + NPBool seekable, + uint16* stype ) +{ + return 0; +} + +void MacPluginComm::NPP_Print( NPP instance, + NPPrint* platformPrint ) +{ + +} + +NPError MacPluginComm::NPP_SetWindow( NPP instance, + NPWindow* window ) +{ + return 0; +} + +void MacPluginComm::NPP_Shutdown() +{ + +} + +void MacPluginComm::NPP_StreamAsFile( NPP instance, + NPStream* stream, + const char* fname ) +{ + +} + +void MacPluginComm::NPP_URLNotify( NPP instance, + const char* url, + NPReason reason, + void* notifyData ) +{ + +} + +int32 MacPluginComm::NPP_Write( NPP instance, + NPStream* stream, + int32 offset, + int32 len, + void* buffer ) +{ + return 0; +} + +int32 MacPluginComm::NPP_WriteReady( NPP instance, + NPStream* stream ) +{ + return 0; +} + +char* MacPluginComm::NPP_GetMIMEDescription() +{ + return ""; +} + +NPError MacPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void* value ) +{ + return 0; +} + +NPError MacPluginComm::NPP_SetValue( NPP instance, + NPNVariable variable, + void *value) +{ + return 0; +} + diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/base/xplugin.cxx ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/base/xplugin.cxx --- ooo_SRC680_m172_src.orig/extensions/source/plugin/base/xplugin.cxx 2006-03-16 14:00:37.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/base/xplugin.cxx 2006-04-18 09:10:50.000000000 +0200 @@ -58,6 +58,11 @@ #ifdef UNX #include #include +#ifdef QUARTZ +#include +#include +#include +#endif //QUARTZ #endif #if OSL_DEBUG_LEVEL > 1 @@ -523,7 +528,7 @@ } } const SystemEnvData* pEnvData = getSysChildSysData(); -#ifdef UNX +#if defined( UNX ) && !(defined(QUARTZ)) XSync( (Display*)pEnvData->pDisplay, False ); #endif if( ! getPluginComm() ) @@ -535,12 +540,21 @@ PluginComm* pComm = NULL; int sv[2]; if( !socketpair( AF_UNIX, SOCK_STREAM, 0, sv ) ) +#ifdef QUARTZ + pComm = new MacPluginComm( m_aDescription.Mimetype, + m_aDescription.PluginName, + (WindowRef)pEnvData->aWindow, + sv[0], + sv[1] + ); +#else pComm = new UnxPluginComm( m_aDescription.Mimetype, m_aDescription.PluginName, (XLIB_Window)pEnvData->aWindow, sv[0], sv[1] ); +#endif //QUARTZ #elif (defined WNT || defined OS2) PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype, m_aDescription.PluginName, @@ -562,13 +576,17 @@ (char**)(m_nArgs ? m_pArgv : NULL), NULL ); -#ifdef UNX +#if defined( UNX ) && !defined(QUARTZ) XSync( (Display*)pEnvData->pDisplay, False ); #endif #ifdef UNX m_aNPWindow.window = (void*)pEnvData->aWindow; +#if !defined(QUARTZ) m_aNPWindow.ws_info = NULL; #else + m_aNPWindow.type = NPWindowTypeWindow; +#endif //QUARTZ +#else m_aNPWindow.window = (void*)pEnvData->hWnd; #endif com::sun::star::awt::Rectangle aPosSize = getPosSize(); diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx --- ooo_SRC680_m172_src.orig/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx 2006-02-03 21:43:39.000000000 +0100 @@ -0,0 +1,70 @@ +#ifndef __PLUGIN_INC_MACPLUG_HXX +#define __PLUGIN_INC_MACPLUG_HXX + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#define GENERATINGCFM 0 +#include + +#include +//#include +//#include +//#include +#include + +//================================================================================================== +class MacPluginComm : public PluginComm +{ +private: + static int nConnCounter; + + pid_t m_nCommPID; +public: + MacPluginComm( const String& mimetype, + const String& library, + WindowRef aParent, + int nDescriptor1, + int nDescriptor2 + ); + virtual ~MacPluginComm(); + + virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ); + virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, + NPError reason ); + virtual jref NPP_GetJavaClass(); + virtual NPError NPP_Initialize(); + virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, + uint16 mode, int16 argc, + char* argn[], char* argv[], NPSavedData *saved ); + virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, + NPStream* stream, + NPBool seekable, uint16* stype ); + virtual void NPP_Print( NPP instance, NPPrint* platformPrint ); + virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ); + virtual void NPP_Shutdown(); + virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, + const char* fname ); + virtual void NPP_URLNotify( NPP instance, const char* url, NPReason reason, + void* notifyData ); + virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset, + int32 len, void* buffer ); + virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ); + virtual char* NPP_GetMIMEDescription(); + virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ); + virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, + void *value); +}; + + +#endif + + diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/inc/plugin/impl.hxx ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/inc/plugin/impl.hxx --- ooo_SRC680_m172_src.orig/extensions/source/plugin/inc/plugin/impl.hxx 2005-09-08 21:52:49.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/inc/plugin/impl.hxx 2006-01-31 01:36:16.000000000 +0100 @@ -140,9 +140,13 @@ #include #endif -#ifdef UNX +#if defined(UNX) +#if defined(QUARTZ) +#include +#else #include #endif +#endif #include #include diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/unx/makefile.mk ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/unx/makefile.mk --- ooo_SRC680_m172_src.orig/extensions/source/plugin/unx/makefile.mk 2006-03-08 15:16:38.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/unx/makefile.mk 2006-03-10 15:26:26.000000000 +0100 @@ -40,6 +40,12 @@ .INCLUDE : ..$/util$/makefile.pmk +.IF "$(GUIBASE)"=="aqua" +dummy: + @echo "Nothing to build for GUIBASE aqua." + +.ELSE + # --- Files -------------------------------------------------------- INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin @@ -84,6 +90,8 @@ .ENDIF # $(WITH_MOZILLA) != "NO" +.ENDIF # $(GUIBASE)==aqua + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff -x CVS -urN ooo_SRC680_m172_src.orig/extensions/source/plugin/util/makefile.mk ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/util/makefile.mk --- ooo_SRC680_m172_src.orig/extensions/source/plugin/util/makefile.mk 2006-03-08 15:16:55.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/extensions/source/plugin/util/makefile.mk 2006-03-10 15:26:33.000000000 +0100 @@ -52,7 +52,11 @@ $(SHL1LINKLIB) .IF "$(GUI)" == "UNX" +.IF "$(GUIBASE)"=="aqua" +SHL1LINKLIB = $(SLB)$/plaqua.lib +.ELSE SHL1LINKLIB = $(SLB)$/plunx.lib +.ENDIF # $(GUIBASE)==aqua .IF "$(OS)" == "SOLARIS" SHL1OWNLIBS = -lsocket .ENDIF # SOLARIS @@ -94,7 +98,7 @@ $(CPPULIB) \ $(SALLIB) -.IF "$(OS)"=="MACOSX" +.IF "$(OS)"=="MACOSX" && "$(GUIBASE)"=="unx" SHL1STDLIBS+= -lX11 .ENDIF Files ooo_SRC680_m172_src.orig/freetype/download/freetype-2.1.10.tar.gz and ooo_SRC680_m172_src.aquavcl01/freetype/download/freetype-2.1.10.tar.gz differ diff -x CVS -urN ooo_SRC680_m172_src.orig/freetype/makefile.mk ooo_SRC680_m172_src.aquavcl01/freetype/makefile.mk --- ooo_SRC680_m172_src.orig/freetype/makefile.mk 2005-10-13 18:49:16.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/freetype/makefile.mk 2006-01-31 01:43:50.000000000 +0100 @@ -46,22 +46,31 @@ # the X11 port because there are some header conflicts # and linktime conflicts as well. It is simply less of # a headache to use the one provided. -.IF "$(SYSTEM_FREETYPE)" == "YES" || "$(OS)" == "MACOSX" +.IF "$(SYSTEM_FREETYPE)" == "YES" dummy: @echo "An already available installation of freetype should exist on your system." @echo "Therefore the version provided here does not need to be built in addition." .ELSE # --- Files -------------------------------------------------------- +.IF "$(OS)"=="MACOSX" +TARFILE_NAME=freetype-2.1.10 +PATCH_FILE_NAME= +.ELSE TARFILE_NAME=freetype-2.1.4 - PATCH_FILE_NAME=freetype-2.1.4.patch +.ENDIF CONFIGURE_DIR= .IF "$(GUI)"=="UNX" #relative to CONFIGURE_DIR +.IF "$(OS)"=="MACOSX" +CONFIGURE_ACTION=./configure +CONFIGURE_FLAGS=--with-pic --without-zlib +.ELSE CONFIGURE_ACTION=$(GNUMAKE) CONFIGURE_FLAGS=setup CFG="--with-pic --without-zlib" +.ENDIF BUILD_DIR=$(CONFIGURE_DIR) BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS) @@ -81,6 +90,9 @@ include$/freetype$/f*.h \ include$/freetype$/tt*.h \ include$/ft2build.h +.IF "$(OS)"=="MACOSX" +OUT2INC+=include$/freetype$/t1tables.h +.ENDIF OUTDIR2INC= \ include$/freetype$/internal \ diff -x CVS -urN ooo_SRC680_m172_src.orig/padmin/source/makefile.mk ooo_SRC680_m172_src.aquavcl01/padmin/source/makefile.mk --- ooo_SRC680_m172_src.orig/padmin/source/makefile.mk 2005-09-08 18:25:28.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/padmin/source/makefile.mk 2006-01-31 01:48:58.000000000 +0100 @@ -33,6 +33,13 @@ # #************************************************************************* +.IF "$(GUIBASE)"=="aqua" + +dummy: + @echo "Nothing to build for GUIBASE aqua." + +.ELSE + PRJ=.. PRJNAME=padmin TARGET=padmin @@ -111,3 +118,5 @@ .INCLUDE : target.mk +.ENDIF #aqua + diff -x CVS -urN ooo_SRC680_m172_src.orig/scp2/source/ooo/file_library_ooo.scp ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/file_library_ooo.scp --- ooo_SRC680_m172_src.orig/scp2/source/ooo/file_library_ooo.scp 2006-05-09 12:31:48.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/file_library_ooo.scp 2006-06-17 15:25:41.000000000 +0200 @@ -1538,7 +1538,7 @@ #endif End -#ifdef UNX +#if defined(UNX) && !defined(QUARTZ) File gid_File_Lib_Psp Name = LIBNAME(psp); TXT_FILE_BODY; @@ -1870,7 +1870,7 @@ STD_LIB_FILE( gid_File_Lib_So, so ) STD_UNO_LIB_FILE_PATCH( gid_File_Lib_Sot, sot ) -#ifdef UNX +#if defined(UNX) && !defined(QUARTZ) File gid_File_Lib_Spa Name = LIBNAME(spa); @@ -2006,7 +2006,11 @@ RegistryID = gid_Starregistry_Services_Rdb; Dir = gid_Dir_Program; #ifdef UNX - Name = STRING(CONCAT4(libdtransX11,SUPD,DLLPOSTFIX,UNXSUFFIX)); + #ifdef QUARTZ + Name = STRING(CONCAT4(libdtransaqua,SUPD,DLLPOSTFIX,UNXSUFFIX)); + #else + Name = STRING(CONCAT4(libdtransX11,SUPD,DLLPOSTFIX,UNXSUFFIX)); + #endif #else Name = "sysdtrans.dll"; #endif diff -x CVS -urN ooo_SRC680_m172_src.orig/scp2/source/ooo/file_ooo.scp ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/file_ooo.scp --- ooo_SRC680_m172_src.orig/scp2/source/ooo/file_ooo.scp 2006-06-02 13:31:17.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/file_ooo.scp 2006-06-17 14:46:52.000000000 +0200 @@ -286,7 +286,7 @@ #endif -#if !defined(WITHOUT_MOZILLA) && defined(UNX) +#if !defined(WITHOUT_MOZILLA) && defined(UNX) && !defined(QUARTZ) File gid_File_Bin_Pluginapp BIN_FILE_BODY; @@ -395,7 +395,7 @@ #endif End -#ifdef UNX +#if defined(UNX) && !defined(QUARTZ) File gid_File_Bin_Spadmin_Bin BIN_FILE_BODY; diff -x CVS -urN ooo_SRC680_m172_src.orig/scp2/source/ooo/file_resource_ooo.scp ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/file_resource_ooo.scp --- ooo_SRC680_m172_src.orig/scp2/source/ooo/file_resource_ooo.scp 2006-05-05 10:53:00.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/file_resource_ooo.scp 2006-06-17 15:25:54.000000000 +0200 @@ -122,7 +122,7 @@ STD_RES_FILE_PATCH( gid_File_Res_Sfx, sfx ) -#ifdef UNX +#if defined(UNX) && !defined(QUARTZ) STD_RES_FILE_PATCH( gid_File_Res_Spa, spa ) diff -x CVS -urN ooo_SRC680_m172_src.orig/scp2/source/ooo/shortcut_ooo.scp ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/shortcut_ooo.scp --- ooo_SRC680_m172_src.orig/scp2/source/ooo/shortcut_ooo.scp 2005-09-09 03:42:03.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/scp2/source/ooo/shortcut_ooo.scp 2006-01-31 01:57:23.000000000 +0100 @@ -397,7 +397,7 @@ #endif -#ifdef UNX +#if defined(UNX) && !defined(QUARTZ) Shortcut gid_Shortcut_Spadmin_Program FileID = gid_File_Bin_Soffice; diff -x CVS -urN ooo_SRC680_m172_src.orig/sj2/source/jscpp/sjapplet_impl.cxx ooo_SRC680_m172_src.aquavcl01/sj2/source/jscpp/sjapplet_impl.cxx --- ooo_SRC680_m172_src.orig/sj2/source/jscpp/sjapplet_impl.cxx 2005-10-13 19:05:18.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/sj2/source/jscpp/sjapplet_impl.cxx 2006-01-31 02:00:22.000000000 +0100 @@ -55,7 +55,7 @@ #include #include -#ifdef UNX +#if defined(UNX) && !defined(QUARTZ) #define Time xlib_time #define Window xlib_window #define Font xlib_font @@ -128,7 +128,9 @@ // ensure that all operations for the window contained in pEnvData // have been processed by the Xserver since java will access that // window by a separate connection to the Xserver +#if !defined(QUARTZ) XSync( (Display*)pEnvData->pDisplay, False); +#endif try { //java < 1.5 jclass jcToolkit = pEnv->FindClass("java/awt/Toolkit"); testJavaException(pEnv); diff -x CVS -urN ooo_SRC680_m172_src.orig/solenv/inc/postmac.h ooo_SRC680_m172_src.aquavcl01/solenv/inc/postmac.h --- ooo_SRC680_m172_src.orig/solenv/inc/postmac.h 2005-09-08 11:36:31.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/solenv/inc/postmac.h 2006-02-21 19:15:36.000000000 +0100 @@ -50,7 +50,7 @@ #undef LSize #undef ModalDialog #undef SetCursor -#undef ShowWindow +//#undef ShowWindow #undef StringPtr #undef DirInfo #undef BOOL diff -x CVS -urN ooo_SRC680_m172_src.orig/solenv/inc/premac.h ooo_SRC680_m172_src.aquavcl01/solenv/inc/premac.h --- ooo_SRC680_m172_src.orig/solenv/inc/premac.h 2005-09-08 11:37:32.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/solenv/inc/premac.h 2006-02-21 19:15:36.000000000 +0100 @@ -50,7 +50,7 @@ #define LSize MacOSLSize #define ModalDialog MacOSModalDialog #define SetCursor MacOSSetCursor -#define ShowWindow MacOSShowWindow +//#define ShowWindow MacOSShowWindow #define StringPtr MacOSStringPtr #define DirInfo MacOSDirInfo #define BOOL MacOSBOOL diff -x CVS -urN ooo_SRC680_m172_src.orig/solenv/inc/rules.mk ooo_SRC680_m172_src.aquavcl01/solenv/inc/rules.mk --- ooo_SRC680_m172_src.orig/solenv/inc/rules.mk 2006-03-08 14:59:48.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/solenv/inc/rules.mk 2006-03-10 15:10:33.000000000 +0100 @@ -301,6 +301,63 @@ noout=>& $(NULLDEV) .ENDIF +# Objective-C++ files +$(OBJ)$/%.obj : %.mm + @echo ------------------------------ + @echo Making: $@ +.IF "$(OS)"=="MACOSX" +.IF "$(TEST)"!="" + $(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) -E $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $*.mm +.ELSE + @$(RM) $@ $(@:s/.obj/.o/) + $(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $*.mm + +if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@ +.ENDIF +.ELSE "$(OS)"=="MACOSX" + @echo "No recipe for compiling Objective-C++ files is available for this platform" +.ENDIF "$(OS)"=="MACOSX" + +# Objective-C++ files +$(OBJ)$/%.obj : $(MISC)$/%.mm + @echo ------------------------------ + @echo Making: $@ +.IF "$(OS)"=="MACOSX" + @$(RM) $@ $(@:s/.obj/.o/) + $(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $(MISC)$/$*.mm + +if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@ +.ELSE "$(OS)"=="MACOSX" + @echo "No recipe for compiling Objective-C++ files is available for this platform" +.ENDIF "$(OS)"=="MACOSX" + +# Objective-C++ files +$(SLO)$/%.obj : $(MISC)$/%.mm + @echo ------------------------------ + @echo Making: $@ +.IF "$(OS)"=="MACOSX" + @$(RM) $@ $(@:s/.obj/.o/) + $(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)$/$*.o $(MISC)$/$*.mm + +if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@ +.ELSE "$(OS)"=="MACOSX" + @echo "No recipe for compiling Objective-C++ files is available for this platform" +.ENDIF "$(OS)"=="MACOSX" + +# Objective-C++ files +$(SLO)$/%.obj : %.mm + @echo ------------------------------ + @echo Making: $@ +.IF "$(OS)"=="MACOSX" + @$(RM) $@ $(@:s/.obj/.o/) + $(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)$/$*.o $*.mm + +if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@ +.ELSE "$(OS)"=="MACOSX" + @echo "No recipe for compiling Objective-C++ files is available for this platform" +.ENDIF "$(OS)"=="MACOSX" + +# dependencies c / c++ +.IF "$(verbose)"=="" +noout=>& $(NULLDEV) +.ENDIF + $(MISC)$/s_%.dpcc : %.c @echo ------------------------------ $(noout) @echo Making: $@ $(noout) @@ -481,6 +538,60 @@ @+echo LAZY_DEPS=were_used_to_generate >> $@ .ENDIF # "$(LAZY_DEPS)"=="" +# dependencies objective-c++ + +$(MISC)$/s_%.dpcc : %.mm + @echo ------------------------------ $(noout) + @echo Making: $@ $(noout) + @+-$(RM) $@ >& $(NULLDEV) + @$(MAKEDEPEND) -f - -p$(SLO)$/ $(MKDEPFLAGS) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $< > $@ +.IF "$(LAZY_DEPS)"=="" + @+echo $@ : $(SLO)$/$(<:b).obj >> $@ +.ELSE # "$(LAZY_DEPS)"=="" + @+echo LAZY_DEPS=were_used_to_generate >> $@ +.ENDIF # "$(LAZY_DEPS)"=="" + +$(MISC)$/o_%.dpcc : %.mm + @echo ------------------------------ $(noout) + @echo Making: $@ $(noout) + @+-$(RM) $@ >& $(NULLDEV) + @$(MAKEDEPEND) -f - -p$(OBJ)$/ $(MKDEPFLAGS) $(CDEFS) $(CDEFSOBJ) $(CDEFSMT) $< > $@ +.IF "$(LAZY_DEPS)"=="" + @+echo $@ : $(OBJ)$/$(<:b).obj >> $@ +.ELSE # "$(LAZY_DEPS)"=="" + @+echo LAZY_DEPS=were_used_to_generate >> $@ +.ENDIF # "$(LAZY_DEPS)"=="" + +$(MISC)$/s_%.dpcc : $(MISC)$/%.mm + @echo ------------------------------ $(noout) + @echo Making: $@ $(noout) + @+-$(RM) $@ >& $(NULLDEV) +.IF "$(GUI)"=="UNX" + @$(MAKEDEPEND) -f - -p$(SLO)$/ $(MKDEPFLAGS) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $< | sed s\#$(MISC)$/\#\# > $@ +.ELSE # "$(GUI)"=="UNX" + @$(MAKEDEPEND) -f - -p$(SLO)$/ $(MKDEPFLAGS) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $< | $(SED) s/$(MISC:s/\/\\/)\\// > $@ +.ENDIF # "$(GUI)"=="UNX" +.IF "$(LAZY_DEPS)"=="" + @+echo $@ : $(SLO)$/$(<:b).obj >> $@ +.ELSE # "$(LAZY_DEPS)"=="" + @+echo LAZY_DEPS=were_used_to_generate >> $@ +.ENDIF # "$(LAZY_DEPS)"=="" + +$(MISC)$/o_%.dpcc : $(MISC)$/%.mm + @echo ------------------------------ $(noout) + @echo Making: $@ $(noout) + @+-$(RM) $@ >& $(NULLDEV) +.IF "$(GUI)"=="UNX" + @$(MAKEDEPEND) -f - -p$(OBJ)$/ $(MKDEPFLAGS) $(CDEFS) $(CDEFSOBJ) $(CDEFSMT) $< | sed s\#$(MISC)$/\#\# > $@ +.ELSE # "$(GUI)"=="UNX" + @$(MAKEDEPEND) -f - -p$(OBJ)$/ $(MKDEPFLAGS) $(CDEFS) $(CDEFSOBJ) $(CDEFSMT) $< | $(SED) s/$(MISC:s/\/\\/)\\// > $@ +.ENDIF # "$(GUI)"=="UNX" +.IF "$(LAZY_DEPS)"=="" + @+echo $@ : $(OBJ)$/$(<:b).obj >> $@ +.ELSE # "$(LAZY_DEPS)"=="" + @+echo LAZY_DEPS=were_used_to_generate >> $@ +.ENDIF # "$(LAZY_DEPS)"=="" + # dependency dummy for *.s files $(MISC)$/s_%.dpcc : %.s diff -x CVS -urN ooo_SRC680_m172_src.orig/solenv/inc/unxmacx.mk ooo_SRC680_m172_src.aquavcl01/solenv/inc/unxmacx.mk --- ooo_SRC680_m172_src.orig/solenv/inc/unxmacx.mk 2006-03-08 15:13:02.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/solenv/inc/unxmacx.mk 2006-03-11 18:20:54.000000000 +0100 @@ -97,7 +97,9 @@ CFLAGSCC=-pipe -fsigned-char -malign-natural $(ARCH_FLAGS) # Normal Objective C compilation flags -OBJCFLAGS=-no-precomp +#OBJCFLAGS=-no-precomp +OBJCFLAGS=-fobjc-exceptions +OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions # Comp Flags for files that need exceptions enabled (C and C++) CFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs @@ -200,10 +202,16 @@ STDSLOCUI= STDLIBGUIST=-lm -STDLIBCUIST=-lX11 -lpthread CPPRUNTIME -lm +.IF "$(GUIBASE)" == "aqua" + STDLIBCUIST=-lpthread CPPRUNTIME -lm + STDLIBCUIMT=CPPRUNTIME -lm + STDSHLGUIMT=-lpthread CPPRUNTIME -lm +.ELSE + STDLIBCUIST=-lX11 -lpthread CPPRUNTIME -lm + STDLIBCUIMT=-lX11 CPPRUNTIME -lm + STDSHLGUIMT=-lX11 -lXext -lpthread CPPRUNTIME -lm +.ENDIF STDLIBGUIMT=-lpthread CPPRUNTIME -lm -STDLIBCUIMT=-lX11 CPPRUNTIME -lm -STDSHLGUIMT=-lX11 -lXext -lpthread CPPRUNTIME -lm STDSHLCUIMT=-lpthread CPPRUNTIME -lm LIBMGR=ar diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/aquavclevents.hxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/aquavclevents.hxx --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/aquavclevents.hxx 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/aquavclevents.hxx 2006-04-27 22:48:10.000000000 +0200 @@ -0,0 +1,38 @@ +#ifndef INCLUDED_AQUAVCLEVENTS_HXX +#define INCLUDED_AQUAVCLEVENTS_HXX + +#include +#include +#include + +/* Definition of custom OpenOffice.org events. + + Avoid conflict with Apple defined event class and type + definitions by using uppercase letters. Lowercase + letter definitions are reserved for Apple! + */ +enum { + cOOoSalUserEventClass = 'OOUE' +}; + +enum { + cOOoSalEventUser = 'UEVT', + cOOoSalEventTimer = 'EVTT', + cOOoSalEventData = 'EVTD', + cOOoSalEventParamTypePtr = 'EPPT' +}; + +/* Definition of all neccessary EventTypeSpec's */ + +const EventTypeSpec cWindowBoundsChangedEvent = { kEventClassWindow, kEventWindowBoundsChanged }; +const EventTypeSpec cWindowCloseEvent = { kEventClassWindow, kEventWindowClose }; +const EventTypeSpec cOOoSalUserEvent = { cOOoSalUserEventClass, cOOoSalEventUser }; +const EventTypeSpec cOOoSalTimerEvent = { cOOoSalUserEventClass, cOOoSalEventTimer }; +const EventTypeSpec cWindowActivatedEvent = { kEventClassWindow, kEventWindowActivated }; +const EventTypeSpec cWindowPaintEvent = { kEventClassWindow, kEventWindowPaint }; +const EventTypeSpec cWindowDrawContentEvent = { kEventClassWindow, kEventWindowDrawContent }; +const EventTypeSpec cMouseUpDownEvent[] = { { kEventClassMouse, kEventMouseDown }, { kEventClassMouse, kEventMouseUp } }; +const EventTypeSpec cWindowResizeStarted = { kEventClassWindow, kEventWindowResizeStarted }; +const EventTypeSpec cWindowResizeCompleted = { kEventClassWindow, kEventWindowResizeCompleted }; + +#endif // INCLUDED_AQUAVCLEVENTS_HXX diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/aquavcltypes.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/aquavcltypes.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/aquavcltypes.h 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/aquavcltypes.h 2006-02-27 22:33:52.000000000 +0100 @@ -0,0 +1,11 @@ +#ifndef _AQUAVCLTYPES_H +#define _AQUAVCLTYPES_H + +#include +#include +#include + +typedef WindowRef CarbonWindowRef; +typedef ControlRef CarbonViewRef; + +#endif _AQUAVCLTYPES_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salbmp.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salbmp.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salbmp.h 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salbmp.h 2005-11-27 10:48:14.000000000 +0100 @@ -0,0 +1,131 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library 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 for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALBMP_H +#define _SV_SALBMP_H + +#ifndef _GEN_HXX +#include +#endif + +#ifndef _SV_SV_H +#include +#endif + +#ifndef _SV_SALBTYPE_HXX +#include +#endif + +#ifndef _SV_SALDATA_HXX +#include +#endif + +#ifndef _SV_SALINST_HXX +#include +#endif + +#ifndef _SV_SALCONST_H +#include +#endif + +#ifndef _SV_SALVD_HXX +#include +#endif + +#ifndef _SV_SALCOLORUTILS_HXX +#include +#endif + +#ifndef _SV_SALPIXMAPUTILS_HXX +#include +#endif + +#ifndef _SV_SALRECTANGLEUTILS_HXX +#include +#endif + +#ifndef _SV_SALBMP_HXX +#include +#endif + +#ifndef _SV_SALGDI_H +#include +#endif + +// -------------- +// - SalBitmap - +// -------------- + +struct BitmapBuffer; +class BitmapColor; +class BitmapPalette; +class AquaSalVirtualDevice; +class AquaSalGraphics; + +class AquaSalBitmap : public SalBitmap +{ +private: + + AquaSalVirtualDevice *mpVirDev; + PixMapHandle mhPixMap; + Size mnSize; + USHORT mnBitCount; + +public: + + AquaSalBitmap(); + ~AquaSalBitmap(); + +public: + + bool Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); + bool Create( const SalBitmap& rSalBmp ); + bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); + bool Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ); + + void Destroy(); + + Size GetSize() const { return mnSize; } + USHORT GetBitCount() const { return mnBitCount; } + + BitmapBuffer *AcquireBuffer( bool bReadOnly ); + void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); + + AquaSalGraphics *GetGraphics(); + void ReleaseGraphics( SalGraphics* pGraphics ); + bool GetSystemData( BitmapSystemData& rData ); +}; + +#endif // _SV_SALBMP_HXX diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salbmp.hxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salbmp.hxx --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salbmp.hxx 2005-09-09 12:32:25.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salbmp.hxx 1970-01-01 01:00:00.000000000 +0100 @@ -1,122 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_SALBMP_HXX -#define _SV_SALBMP_HXX - -#ifndef _GEN_HXX - #include -#endif - -#ifndef _SV_SV_H - #include -#endif - -#ifndef _SV_SALBTYPE_HXX - #include -#endif - -#ifndef _SV_SALDATA_HXX - #include -#endif - -#ifndef _SV_SALINST_HXX - #include -#endif - -#ifndef _SV_SALCONST_H - #include -#endif - -#ifndef _SV_SALVD_HXX - #include -#endif - -#ifndef _SV_SALCOLORUTILS_HXX - #include -#endif - -#ifndef _SV_SALPIXMAPUTILS_HXX - #include -#endif - -#ifndef _SV_SALRECTANGLEUTILS_HXX - #include -#endif - -// -------------- -// - SalBitmap - -// -------------- - -struct BitmapBuffer; -class BitmapColor; -class BitmapPalette; -class SalVirtualDevice; -class SalGraphics; - -class SalBitmap -{ - private: - - SalVirtualDevice *mpVirDev; - PixMapHandle mhPixMap; - Size mnSize; - USHORT mnBitCount; - - public: - - SalBitmap(); - ~SalBitmap(); - - public: - - BOOL Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - BOOL Create( const SalBitmap& rSalBmp ); - BOOL Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ); - BOOL Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ); - - void Destroy(); - - Size GetSize() const { return mnSize; } - USHORT GetBitCount() const { return mnBitCount; } - - BitmapBuffer *AcquireBuffer( BOOL bReadOnly ); - void ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly ); - - SalGraphics *GetGraphics(); - void ReleaseGraphics( SalGraphics* pGraphics ); -}; - -#endif // _SV_SALBMP_HXX diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/saldata.hxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/saldata.hxx --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/saldata.hxx 2005-09-09 12:33:28.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/saldata.hxx 2006-03-19 22:37:06.000000000 +0100 @@ -37,43 +37,30 @@ #define _SV_SALDATA_HXX #ifndef _SV_SV_H - #include +#include #endif -#ifdef __cplusplus - - #ifndef _SV_SVDATA_HXX - #include - #endif - -#endif // __cplusplus - -#ifndef _SV_SALWTYPE_HXX - #include +#ifndef _SV_SVDATA_HXX +#include #endif -#ifndef _SV_VCLWINDOW_H - #include +#ifndef _SV_SALWTYPE_HXX +#include #endif -#ifdef __cplusplus - - class SalInstance; - class SalObject; - class SalFrame; - class SalVirtualDevice; - class SalPrinter; - - class FontList; - -#else // __cplusplus - - #define SalInstance void - #define SalVirtualDevice void - #define SalPrinter void - #define FontList void +class SalInstance; +class SalObject; +class SalFrame; +class SalVirtualDevice; +class SalPrinter; + +class FontList; + +// ------------------ +// - Some constants - +// ------------------ -#endif // __cplusplus +#define SAL_CLIPRECT_COUNT 16 // ----------- // - SalData - @@ -90,24 +77,14 @@ FontList *mpFontList; // Mac OS font list }; -#ifdef __cplusplus - - inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } - - inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } - inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; } - -#else // __cplusplus - - // C wrapper functions around SetSalData, GetSalData, and GetAppSalData - - void SalSetSalData( struct SalData* pData ); - - struct SalData *SalGetSalData(); - struct SalData *SalGetAppSalData(); - - BOOL SalGetAppQuit(); - -#endif // __cplusplus +inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } +inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } +inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; } + +// --- Prototypes --- + +BOOL ImplSalYieldMutexTryToAcquire(); +void ImplSalYieldMutexAcquire(); +void ImplSalYieldMutexRelease(); #endif // _SV_SALDATA_HXX diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salframe.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salframe.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salframe.h 2005-09-09 12:33:56.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salframe.h 2006-04-27 22:47:01.000000000 +0200 @@ -36,32 +36,154 @@ #ifndef _SV_SALFRAME_H #define _SV_SALFRAME_H +#include + #ifndef _SV_SV_H #include #endif -#ifndef _SV_VCLWINDOW_H -#include -#endif #ifndef _SV_SYSDATA_HXX #include #endif +#include +#include +#include +#include + +class AquaSalGraphics; +class AquaSalFrame; +class AquaSalTimer; +class AquaSalInstance; + +typedef struct SalFrame::SalPointerState SalPointerState; + // ---------------- -// - SalFrameData - +// - AquaSalFrame - // ---------------- -struct SalFrameData +class AquaSalFrame : public SalFrame { - VCLWINDOW mhWnd; // Window handle - SalGraphics* mpGraphics; // current frame graphics - SalFrame* mpNextFrame; // pointer to next frame - SalFrame* mpParent; // pointer to parent frame +public: + CarbonWindowRef mrWindow; // Window handle + AquaSalGraphics* mpGraphics; // current frame graphics + AquaSalFrame* mpNextFrame; // pointer to next frame + AquaSalFrame* mpParent; // pointer to parent frame void* mpInst; // instance handle for callback SALFRAMEPROC mpProc; // callback proc long mnWidth; // client width in pixels long mnHeight; // client height in pixels - BOOL mbGraphics; // is Graphics used? -}; + int mnMinWidth; // min. client width in pixeln + int mnMinHeight; // min. client height in pixeln + int mnMaxWidth; // max. client width in pixeln + int mnMaxHeight; // max. client height in pixeln + BOOL mbGraphics; // is Graphics used? + AquaSalInstance* mpSalInstance; + +public: + AquaSalFrame(); + + /** Constructor + + Creates a system window and connects this frame with it. + + @throws std::runtime_error in case window creation fails + */ + AquaSalFrame(SalFrame* pParent, ULONG salFrameStyle, AquaSalInstance* pSalInstance); + + virtual ~AquaSalFrame(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual BOOL PostEvent( void* pData ); + BOOL PostTimerEvent( AquaSalTimer *pTimer ); + virtual void SetTitle( const XubString& rTitle ); + virtual void SetIcon( USHORT nIcon ); + virtual void SetMenu( SalMenu* pSalMenu ); + virtual void DrawMenuBar(); + virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); + virtual void Enable( 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 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 ); + virtual void StartPresentation( BOOL bStart ); + virtual void SetAlwaysOnTop( BOOL bOnTop ); + virtual void ToTop( USHORT nFlags ); + virtual void SetPointer( PointerStyle ePointerStyle ); + virtual void CaptureMouse( BOOL bMouse ); + virtual void SetPointerPos( long nX, long nY ); + 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 LanguageType GetInputLanguage(); + virtual SalBitmap* SnapShot(); + virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep( SoundType eSoundType ); + virtual const SystemEnvData* GetSystemData() const; + virtual SalPointerState GetPointerState(); + virtual void SetParent( SalFrame* pNewParent ); + virtual bool SetPluginParent( SystemParentData* pNewParent ); + virtual void SetExtendedFrameStyle( SalExtStyle ); + virtual void SetBackgroundBitmap( SalBitmap* ); + + virtual void SetClientSize( long nWidth, long nHeight ); + void UpdateFrameGeometry(); + + private: // methods + + /** Create a new system window. + The newly create window will be associated whith this frame. + + @param pParent + the parent of the window may be NULL + + @param nSalFrameStyle + the style of the new window + + @throws std::runtime_error in case window creation fails + */ + void CreateNewSystemWindow(CarbonWindowRef pParent, ULONG nSalFrameStyle); + + void InsertThisIntoFrameList(); + void RemoveThisFromFrameList(); + BOOL ImplPostUserEvent( UInt32 eventKind, void *pData ); + + /** Install a window event handler + + The window event handler and the corresponding Universal Procedure Pointer (UPP) pointer + need to be save during destruction of the frame instance we have to unregister all installed + event handlers and dispose the UPP. + + @param upp + a universal procedure pointer + + @param nEvents + number of events to register + + @param eventSpec + the event specification + + @return the status of the registration see Carbon Event Manager reference for details + */ + OSStatus InstallAndRegisterEventHandler(EventHandlerUPP upp, size_t nEvents, const EventTypeSpec* eventSpec); + void DeinstallAndUnregisterAllEventHandler(); + + private: // data + + typedef std::pair SysWindowEventHandlerData_t; + typedef std::vector SysWindowEventHandlerDataContainer_t; + SysWindowEventHandlerDataContainer_t mSysWindowEventHandlerDataContainer; +}; + #endif // _SV_SALFRAME_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salgdi.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salgdi.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salgdi.h 2005-09-09 12:34:10.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salgdi.h 2006-04-25 21:38:19.000000000 +0200 @@ -41,78 +41,311 @@ #include #ifndef _SV_SV_H - #include +#include #endif -#ifndef _SV_VCLWINDOW_H - #include +#ifndef _SV_OUTFONT_HXX +#include #endif -// ------------------- -// - Structures - -// ------------------- - -struct SalGraphicsData -{ - // NSView and NSWindow - - VCLVIEW mhDC; // VCLVIEW - - // QuickDraw graph port, offscreen graphic world, and graphic device handle - - CGrafPtr mpCGrafPort; // QD color graphics port - GWorldPtr mpGWorld; // QD offscreen GWorld - GDHandle mhGDevice; // QD GDevice - - // Graph port pixels, state and flags - - BOOL mbGWorldPixelsLocked; // GWorld pixels locked? - BOOL mbGWorldPixelsCopy; // GWorld pixels was a copy of the original? - BOOL mbGWorldPixelsNew; // GWorld pixels is brand new? - GWorldFlags mnGWorldFlags; // GWorld pixels status flags - PixMapHandle mhGWorldPixMap; // GWorld pixels - - // Clip region - - BOOL mbClipRgnChanged; // Did the clip region change? - RgnHandle mhClipRgn; // Clip Region Handle - - // Font attributes - - short mnFontID; // Mac FontFamilyId - short mnFontSize; // Mac Font Size - RGBColor maFontColor; // Text Color - Style mnFontStyle; // Mac Font Style - - // Pen attributes and status - - BOOL mbPenTransparent; // Is pen transparent? - SInt32 mnPenMode; // Pen Mode - RGBColor maPenColor; // Pen Color +#ifndef _SV_SALGDI_HXX +#include +#endif - // Port's pen attributes +#ifndef _AQUAVCLTYPES_H +#include +#endif - SInt32 mnPortPenMode; // Port's pen mode - MacOSPoint maPortPenSize; // Port's pen size; - MacOSPoint maPortPenLocation; // Port's pen location - PixPatHandle mhPortPenPattern; // Port's pen pattern +#include +//#include +class AquaSalBitmap; - // Brush attributes and status +// mac specific physically available font face +class ImplMacFontData : public ImplFontData +{ +public: + rtl_TextEncoding meScript; + FontFamily meFamily; + FontType meType; + AquaSalSystem mpSysData; + + +public: + ImplMacFontData( const ImplDevFontAttributes&, + int nFontHeight, int macCharSet, + int nPitchAndFamily ); + ~ImplMacFontData(); + + virtual ImplFontData* Clone() const; + virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; + // void UpdateFromHDC( HDC ); + + bool HasChar( sal_uInt32 cChar ) const; + +// int GetCharSet() const { return meWinCharSet; } +// int GetPitchAndFamily() const { return mnPitchAndFamily; } +// bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; } +// bool SupportsKorean() const { return mbHasKoreanRange; } +// bool SupportsCJK() const { return mbHasCJKSupport; } +// bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } +// bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } + + ImplFontCharMap* GetImplFontCharMap(); + +private: +// bool mbDisableGlyphApi; +// bool mbHasKoreanRange; +// bool mbHasCJKSupport; +// +// ImplFontCharMap* mpUnicodeMap; +// +// // TODO: get rid of the members below needed to work with the Win9x non-unicode API +// int* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) +// int mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried +// int meWinCharSet; +// int mnPitchAndFamily; +// bool mbAliasSymbolsHigh; +// bool mbAliasSymbolsLow; + +private: +// void ReadCmapTable( HDC ); +// void ReadOs2Table( HDC ); + +#ifdef GNG_VERT_HACK +// void ReadGsubTable( HDC ) const; + + typedef std::hash_set IntHashSet; + mutable IntHashSet maGsubTable; + mutable bool mbGsubRead; +public: +// bool HasGSUBstitutions( HDC ) const; +// bool IsGSUBstituted( sal_Unicode ) const; +#endif // GNG_VERT_HACK +}; - BOOL mbBrushTransparent; // Is brush transparent? - RGBColor maBrushColor; // Brush Color - // Miscellaneous status flags +// ------------------- +// - AquaSalGraphics - +// ------------------- - BOOL mbPrinter; // Is a printer available? - BOOL mbVirDev; // Is a virtual device available? - BOOL mbWindow; // Is a window availble? - BOOL mbScreen; // Is this screen compatiable? - OSStatus mnOSStatus; // The current MacOS error +class AquaSalGraphics : public SalGraphics +{ +protected: + CarbonViewRef mrView; // VCLVIEW + + CGContextRef mrContext; // graphics context for Quartz 2D + CarbonWindowRef mrWindow; // Window if this is a Window graphics + + CGMutablePathRef mrClippingPath; // path representing current clip region + CGRect* mpStdClippingRect; // array for collecting clipping rectangles + CGRect* mpClippingRect; // used if more clipping rects are used than mpStdClippingRect can handle + CGRect* mpNextClippingRect; // points to next free slot in clipping rect array + long mnClippingRectCount; // number of clipping rects in current region + + // Drawing colors + CGColorSpaceRef mrRGBColorSpace; // the RGB color space + float mpLineColor[4]; // pen color RGBA + float mpFillColor[4]; // brush color RGBA + + SInt32 mnPenMode; // Pen Mode + + // Graphics types + bool mbPrinter; // is this a printer graphics + bool mbVirDev; // is this a virtual device graphics + bool mbWindow; // is this a window graphics + bool mbScreen; // is this graphics screen compatible + +public: + AquaSalGraphics(); + virtual ~AquaSalGraphics(); + + bool IsPenTransparent() const { return (mpLineColor[3] == 0.0); } + bool IsBrushTransparent() const { return (mpFillColor[3] == 0.0); } + + void SetWindowGraphics( CarbonViewRef rView, CarbonWindowRef rWindow, bool bScreenCompatible ); + void SetPrinterGraphics( CarbonViewRef rView, bool bScreenCompatible ); + void SetVirDevGraphics( CarbonViewRef rView, bool bSCreenCompatible ); + + bool IsWindowGraphics() const { return mbWindow; } + bool IsPrinterGraphics() const { return mbPrinter; } + bool IsVirDevGraphics() const { return mbVirDev; } + bool IsScreenCompatible() const { return mbScreen; } + +protected: + bool BeginGraphics(); // sets up graphics context, required for any drawing operation + bool EndGraphics(); // flushes and releases graphics context + + virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ); + 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 drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); + virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, USHORT nFlags ); + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); + virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ); + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nTransparentColor ); + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap ); + virtual void drawMask( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nMaskColor ); + + virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); + virtual SalColor getPixel( long nX, long nY ); + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags); + virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); + + virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); + + // native widget rendering methods that require mirroring + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + rtl::OUString aCaption ); + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + SalControlHandle& rControlHandle, rtl::OUString aCaption ); + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + const ImplControlValue& aValue, SalControlHandle& rControlHandle, rtl::OUString aCaption, + Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + +public: + // public SalGraphics methods, the interface to teh independent vcl part + + // get device resolution + virtual void GetResolution( long& rDPIX, long& rDPIY ); + // get resolution for fonts (an implementations specific adjustment, + // ideally would be the same as the Resolution) + virtual void GetScreenFontResolution( long& rDPIX, long& rDPIY ); + // get the depth of the device + virtual USHORT GetBitCount(); + // get the width of the device + virtual long GetGraphicsWidth() const; + + // set the clip region to empty + virtual void ResetClipRegion(); + // begin setting the clip region, add rectangles to the + // region with the UnionClipRegion call + virtual void BeginSetClipRegion( ULONG nCount ); + // all rectangles were added and the clip region should be set now + virtual void EndSetClipRegion(); + + // set the line color to transparent (= don't draw lines) + virtual void SetLineColor(); + // set the line color to a specific color + virtual void SetLineColor( SalColor nSalColor ); + // set the fill color to transparent (= don't fill) + virtual void SetFillColor(); + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( SalColor nSalColor ); + // enable/disable XOR drawing + virtual void SetXORMode( BOOL bSet ); + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ); + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ); + // set the text color to a specific color + virtual void SetTextColor( SalColor nSalColor ); + // set the font + virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); + // get the current font's etrics + virtual void GetFontMetric( ImplFontMetricData* ); + // get kernign pairs of the current font + // return only PairCount if (pKernPairs == NULL) + virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); + // get the repertoire of the current font + virtual ImplFontCharMap* GetImplFontCharMap() const; + // graphics must fill supplied font list + virtual void GetDevFontList( ImplDevFontList* ); + // graphics should call ImplAddDevFontSubstitute on supplied + // OutputDevice for all its device specific preferred font substitutions + virtual void GetDevFontSubstList( OutputDevice* ); + virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); + // CreateFontSubset: a method to get a subset of glyhps of a font + // inside a new valid font file + // returns TRUE if creation of subset was successfull + // parameters: rToFile: contains a osl file URL to write the subset to + // pFont: describes from which font to create a subset + // pGlyphIDs: the glyph ids to be extracted + // pEncoding: the character code corresponding to each glyph + // pWidths: the advance widths of the correspoding glyphs (in PS font units) + // nGlyphs: the number of glyphs + // rInfo: additional outgoing information + // implementation note: encoding 0 with glyph id 0 should be added implicitly + // as "undefined character" + virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, + ImplFontData* pFont, + long* pGlyphIDs, + sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter + ); + + // GetFontEncodingVector: a method to get the encoding map Unicode + // to font encoded character; this is only used for type1 fonts and + // may return NULL in case of unknown encoding vector + // if ppNonEncoded is set and non encoded characters (that is type1 + // glyphs with only a name) exist it is set to the corresponding + // map for non encoded glyphs; the encoding vector contains -1 + // as encoding for these cases + virtual const std::map< sal_Unicode, sal_Int32 >* GetFontEncodingVector( ImplFontData* pFont, const std::map< sal_Unicode, rtl::OString >** ppNonEncoded ); + + // GetEmbedFontData: gets the font data for a font marked + // embeddable by GetDevFontList or NULL in case of error + // parameters: pFont: describes the font in question + // pWidths: the widths of all glyphs from char code 0 to 255 + // pWidths MUST support at least 256 members; + // rInfo: additional outgoing information + // pDataLen: out parameter, contains the byte length of the returned buffer + virtual const void* GetEmbedFontData( ImplFontData* pFont, + const sal_Unicode* pUnicodes, + sal_Int32* pWidths, + FontSubsetInfo& rInfo, + long* pDataLen ); + // frees the font data again + virtual void FreeEmbedFontData( const void* pData, long nDataLen ); + + virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); + virtual BOOL GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ); + + virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); + virtual void DrawServerFontLayout( const ServerFontLayout& ); + + // Query the platform layer for control support + virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + virtual USHORT SetFont( ImplFontSelectData* pFont ); + + virtual long GetCharWidth( sal_Unicode nChar1, sal_Unicode nChar2, long* pWidthAry ); + + virtual ULONG GetFontCodeRanges( sal_uInt32* pCodePairs ) const; + + virtual void DrawText( long nX, long nY, const xub_Unicode *pStr, xub_StrLen nLen ); + + virtual void DrawTextArray( long nX, long nY, const xub_Unicode* pStr, xub_StrLen nLen, const long* pDXAry ); + + virtual BOOL GetGlyphBoundRect( xub_Unicode cChar, long* pX, long* pY, long* pWidth, long* pHeight ); }; -typedef struct SalGraphicsData SalGraphicsData; -typedef SalGraphicsData *SalGraphicsDataPtr; -typedef SalGraphicsDataPtr *SalGraphicsDataHandle; - #endif // _SV_SALGDI_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salgdiutils.hxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salgdiutils.hxx --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salgdiutils.hxx 2005-09-09 12:34:27.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salgdiutils.hxx 1970-01-01 01:00:00.000000000 +0100 @@ -1,113 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_SALGDIUTILS_HXX -#define _SV_SALGDIUTILS_HXX - -#include -#include -#include - -#ifndef _SV_SALGDI_HXX - #include -#endif - -#ifndef _SV_SALCONST_H - #include -#endif - -#ifndef _SV_SALGDI_H - #include -#endif - -#ifndef _SV_VCLGRAPHICS_H - #include -#endif - -#ifndef _SV_SALCOLORUTILS_HXX - #include -#endif - -// ------------------------------------------------------------------ - -short SelectCopyMode ( const SalGraphicsDataPtr pSalGraphicsData ); - -// ------------------------------------------------------------------ - -RgnHandle GetPolygonRgn ( const unsigned long nPolyCount, - const unsigned long *pPoints, - PCONSTSALPOINT *ppPtAry, - OSStatus *rQDStatus - ); - -// ------------------------------------------------------------------ - -OSStatus GetGDeviceBitDepth ( unsigned short *rGDeviceBitDepth ); - -OSStatus GetGDeviceResolution ( long *rGDeviceHRes, - long *rGDeviceVRes - ); - -// ------------------------------------------------------------------ - -BOOL LockGraphics ( SalGraphics *rSalGraphics ); - -BOOL UnlockGraphics ( SalGraphics *rSalGraphics ); - -// ------------------------------------------------------------------ - -BOOL BeginGraphics ( SalGraphicsDataPtr rSalGraphicsData ); - -BOOL EndGraphics ( SalGraphicsDataPtr rSalGraphicsData ); - -// ------------------------------------------------------------------ - -void InitBrush ( SalGraphicsDataPtr rSalGraphicsData ); - -void InitFont ( SalGraphicsDataPtr rSalGraphicsData ); - -void InitGWorld ( SalGraphicsDataPtr rSalGraphicsData ); - -void InitPen ( SalGraphicsDataPtr rSalGraphicsData ); - -void InitQD ( SalGraphicsDataPtr rSalGraphicsData ); - -void InitRegions ( SalGraphicsDataPtr rSalGraphicsData ); - -void InitStatusFlags ( SalGraphicsDataPtr rSalGraphicsData ); - -// ------------------------------------------------------------------ - -#endif // _SV_SALGDIUTILS_HXX diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salinst.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salinst.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salinst.h 2005-09-09 12:34:41.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salinst.h 2006-04-27 22:47:01.000000000 +0200 @@ -46,9 +46,12 @@ #include #endif -#ifndef _SV_VCLWINDOW_H -#include -#endif +#include +#include +#include +#include +#include +#include #ifdef __cplusplus @@ -82,12 +85,99 @@ // - SalInstanceData - // ------------------- -struct SalInstanceData +//struct SalInstanceData +//{ +//public: +//}; + +// ------------------ +// - AquaSalInstance - +// ------------------ + +class AquaSalInstance : public SalInstance { public: void* mpFilterInst; void* mpFilterCallback; SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex +public: + AquaSalInstance(); + virtual ~AquaSalInstance(); + + virtual SalSystem* CreateSystem(); + virtual void DestroySystem(SalSystem*); + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); + virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); + virtual void DestroyFrame( SalFrame* pFrame ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData ); + virtual void DestroyObject( SalObject* pObject ); + virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, + USHORT nBitCount, const SystemGraphicsData *pData ); + virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); + + virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ); + virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ); + virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ); + virtual void DestroyPrinter( SalPrinter* pPrinter ); + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ); + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ); + virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ); + virtual String GetDefaultPrinter(); + virtual SalSound* CreateSalSound(); + virtual SalTimer* CreateSalTimer(); + virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics ); + virtual SalI18NImeStatus* CreateI18NImeStatus(); + virtual SalSystem* CreateSalSystem(); + virtual SalBitmap* CreateSalBitmap(); + virtual vos::IMutex* GetYieldMutex(); + virtual ULONG ReleaseYieldMutex(); + virtual void AcquireYieldMutex( ULONG nCount ); + virtual void Yield( BOOL bWait ); + virtual bool AnyInput( USHORT nType ); + virtual SalMenu* CreateMenu( BOOL bMenuBar ); + virtual void DestroyMenu( SalMenu* ); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual void DestroyMenuItem( SalMenuItem* ); + virtual SalSession* CreateSalSession(); + virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); + virtual void SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + virtual void SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ); + + static void TimerEventHandler(EventLoopTimerRef inTimer, void* pData); + + public: + /* During window resizing the standard event handler does + not dispatch VCL timer messages which (for some strange + reasons) trigger VCL painting. So when live resizing of + windows is enabled the window content will not be painted + at all especially when the user doesn't move the mouse + anymore but still holds the left mouse button pressed on + the resize area. + So to get timer messages delivered nevertheless we setup + a message loop timer. Events fired by this timer will also + be delivered during window resizing. + */ + void StartForceDispatchingPaintEvents(); + void StopForceDispatchingPaintEvents(); + EventLoopTimerRef mEventLoopTimerRef; + bool mbForceDispatchPaintEvents; + + friend class AquaSalFrame; }; +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + // Invokes [VCLApplication run] + void VCLApplication_Run( BOOL bWait ); + +#ifdef __cplusplus +} +#endif // __cplusplus + + + #endif // _SV_SALINST_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salobj.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salobj.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salobj.h 2005-09-09 12:35:10.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salobj.h 2005-11-27 10:48:16.000000000 +0100 @@ -44,16 +44,57 @@ #include #endif +#include + +class AquaSalFrame; +class AquaSalObject; + + // ----------------- // - SalObjectData - // ----------------- struct SalObjectData { - SalFrame* mpFrame; // parent frame - SalObject* mpNextObject; // pointer to next object +}; + +class AquaSalObject : public SalObject +{ +public: + AquaSalFrame* mpFrame; // parent frame + AquaSalObject* mpNextObject; // pointer to next object void* mpInst; // instance handle for callback SALOBJECTPROC mpProc; // callback proc + + +// HWND mhWnd; // Window handle +// HWND mhWndChild; // Child Window handle +// HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte +// SystemChildData maSysData; // SystemEnvData +// RGNDATA* mpClipRgnData; // ClipRegion-Data +// RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data +// RECT* mpNextClipRect; // Naechstes ClipRegion-Rect +// BOOL mbFirstClipRect; // Flag for first cliprect to insert +// WinSalObject* mpNextObject; // pointer to next object + + + AquaSalObject(); + virtual ~AquaSalObject(); + + virtual void ResetClipRegion(); + virtual USHORT GetClipRegionType(); + virtual void BeginSetClipRegion( 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 GrabFocus(); + virtual void SetBackground(); + virtual void SetBackground( SalColor nSalColor ); + virtual const SystemEnvData* GetSystemData() const; + + virtual void SetCallback( void* pInst, SALOBJECTPROC pProc ); }; #endif // _SV_SALOBJ_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salogl.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salogl.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salogl.h 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salogl.h 2006-02-27 22:33:53.000000000 +0100 @@ -0,0 +1,118 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library 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 for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALOGL_H +#define _SV_SALOGL_H + +//#if defined EXPLICITLY_INCLUDE_GLX_H +//#include +//#define GL_H +//#include +//#include +//#else +//typedef void* GLXContext; +//typedef XID GLXDrawable; +//// needed GLX_ constants +//#define GLX_USE_GL 1 +//#define GLX_DOUBLEBUFFER 5 +//#endif + +#ifndef _SV_SALOGL_HXX +#include +#endif + +#ifndef _OSL_MODULE_H +#include +#endif + +// ------------- +// - SalOpenGL - +// ------------- + +class SalGraphics; + +class AquaSalOpenGL : public SalOpenGL +{ +private: + static CarbonViewRef mhOGLLastDC; + static ULONG mnOGLState; + + // static oslModule mpGLLib; +// static GLXContext maGLXContext; +// static ULONG mnOGLState; +// static Display* mpDisplay; +// static XVisualInfo* mpVisualInfo; +// static BOOL mbHaveGLVisual; +// +// static BOOL ImplInit(); +// +// static GLXContext (*pCreateContext)( Display *, XVisualInfo *, GLXContext, Bool ); +// static void (*pDestroyContext)( Display *, GLXContext ); +// static GLXContext (*pGetCurrentContext)( ); +// static Bool (*pMakeCurrent)( Display *, GLXDrawable, GLXContext ); +// static void (*pSwapBuffers)( Display*, GLXDrawable ); +// static int (*pGetConfig)( Display*, XVisualInfo*, int, int* ); +// static void (*pFlush)(); +// +// Drawable maDrawable; +// +// static void* resolveSymbol( const char* pSym ); +public: + + AquaSalOpenGL( SalGraphics* pGraphics ); + ~AquaSalOpenGL(); + +// static void Release(); +// static void ReleaseLib(); +// static void MakeVisualWeights( +// Display *pDisplay, +// XVisualInfo* pInfos, +// int* pWeights, +// int nVisuals +// ); + + // overload all pure virtual methods + virtual bool IsValid(); + virtual void* GetOGLFnc( const char * ); + virtual void OGLEntry( SalGraphics* pGraphics ); + virtual void OGLExit( SalGraphics* pGraphics ); + virtual void StartScene( SalGraphics* pGraphics ); + virtual void StopScene(); + virtual BOOL Create(); + virtual void Release(); + +}; + +#endif // _SV_SALOGL_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salogl.hxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salogl.hxx --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salogl.hxx 2005-09-09 12:35:24.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salogl.hxx 2006-02-27 22:33:53.000000000 +0100 @@ -69,7 +69,7 @@ class SalOpenGL { private: - static VCLVIEW mhOGLLastDC; + static CarbonViewRef mhOGLLastDC; static ULONG mnOGLState; public: diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salprn.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salprn.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salprn.h 2005-09-09 12:36:03.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salprn.h 2006-02-27 22:33:54.000000000 +0100 @@ -40,6 +40,9 @@ #include #endif +#ifndef _AQUAVCLTYPES_H +#include +#endif class SalGraphics; class SalInfoPrinter; @@ -84,7 +87,7 @@ ByteString maDriverNameA; // printer driver name ByteString maDeviceNameA; // printer device name ByteString maPortNameA; // printer port name - VCLVIEW mhDC; // printer hdc + CarbonViewRef mhDC; // printer hdc BOOL mbGraphics; // is Graphics used BOOL mbAnsi; }; @@ -99,4 +102,78 @@ SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter }; +// --------------------- +// - AquaSalInfoPrinter - +// --------------------- + +class AquaSalGraphics; + +class AquaSalInfoPrinter : public SalInfoPrinter +{ +public: + AquaSalGraphics* mpGraphics; // current Printer graphics + XubString maDriverName; // printer driver name + XubString maDeviceName; // printer device name + XubString maPortName; // printer port name + ByteString maDriverNameA; // printer driver name + ByteString maDeviceNameA; // printer device name + ByteString maPortNameA; // printer port name +// HDC mhDC; // printer hdc + BOOL mbGraphics; // is Graphics used + BOOL mbAnsi; + +public: + AquaSalInfoPrinter(); + virtual ~AquaSalInfoPrinter(); + + 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 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 void InitPaperFormats( const ImplJobSetup* pSetupData ); + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); + virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ); +}; + +// ----------------- +// - AquaSalPrinter - +// ----------------- + +class AquaSalPrinter : public SalPrinter +{ +public: + AquaSalGraphics* mpGraphics; // current Printer graphics + AquaSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter + AquaSalPrinter* mpNextPrinter; // next printing printer +// HDC mhDC; // printer hdc + ULONG mnError; // Error Code + ULONG mnCopies; // Kopien + BOOL mbCollate; // Sortierte Kopien + BOOL mbAbort; // Job Aborted + +public: + AquaSalPrinter(); + virtual ~AquaSalPrinter(); + + virtual BOOL StartJob( const XubString* pFileName, + const XubString& rJobName, + const XubString& rAppName, + ULONG nCopies, BOOL bCollate, + ImplJobSetup* pSetupData ); + virtual BOOL EndJob(); + virtual BOOL AbortJob(); + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ); + virtual BOOL EndPage(); + virtual ULONG GetErrorCode(); +}; + + #endif // _SV_SALPRN_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salsound.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salsound.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salsound.h 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salsound.h 2005-11-27 10:48:19.000000000 +0100 @@ -0,0 +1,109 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library 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 for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALSOUND_H +#define _SV_SALSOUND_H + +//#ifndef _SV_WINCOMP_HXX +//#include +//#endif + +#ifndef _GEN_HXX +#include +#endif +#ifndef _STRING_HXX +#include +#endif + +#ifndef _SV_SV_H +#include +#endif + +#include + +#ifndef _SV_SALFRAME_HXX +#include +#endif +#ifndef _SV_SALSTYPE_HXX +#include +#endif +#ifndef _SV_SALSOUND_HXX +#include +#endif + +// ------------ +// - SalSound - +// ------------ + +class AquaSalSound : public SalSound +{ +private: +// static oslModule mhMCILib; + static ULONG mnSoundState; + SALSOUNDPROC mpProc; +// static void* mpMCIFnc; +// ULONG mnStartTime; +// ULONG mnPlayLen; +// HWND mhSoundWnd; +// UINT mnDeviceId; + bool mbLoop; + bool mbPaused; + +public: + void ImplSetError( int nMciErr ); + void ImplNotify( SoundNotification eNotification, ULONG nError ); + +public: + AquaSalSound(); + virtual ~AquaSalSound(); + + virtual bool IsValid(); + virtual bool Init( const String& rSoundName, + ULONG& rSoundLen ); + virtual void Play( ULONG nStartTime, ULONG nPlayTime, bool bLoop ); + virtual void Stop(); + virtual void Pause(); + virtual void Continue(); + virtual bool IsLoopMode() const; + virtual bool IsPlaying() const; + virtual bool IsPaused() const; + + + bool ImplCreate(); + void ImplDestroy(); + static void Release(); +}; + +#endif // _SV_SALSOUND_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salsys.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salsys.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salsys.h 2005-09-09 12:36:47.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salsys.h 2005-11-27 10:48:20.000000000 +0100 @@ -40,13 +40,35 @@ #include #endif +#include + +#include // ----------------- // - SalSystemData - // ----------------- -struct SalSystemData +//struct SalSystemData +//{ +//}; + +class VCL_DLLPUBLIC AquaSalSystem : public SalSystem { +public: + AquaSalSystem() {} + virtual ~AquaSalSystem(); + + // overload pure virtual methods + virtual bool GetSalSystemDisplayInfo( DisplayInfo& rInfo ); + virtual int ShowNativeDialog( const String& rTitle, + const String& rMessage, + const std::list< String >& rButtons, + int nDefButton ); + virtual int ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton); }; + #endif // _SV_SALSYS_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/saltimer.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/saltimer.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/saltimer.h 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/saltimer.h 2006-03-02 01:31:02.000000000 +0100 @@ -0,0 +1,68 @@ +/************************************************************************* +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile$ +* +* $Revision$ +* +* last change: $Author$ $Date$ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library 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 for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ + +#ifndef _SV_SALTIMER_H +#define _SV_SALTIMER_H + +#include +#include +#include + +#ifndef _SV_SALTIMER_HXX +#include +#endif + +class AquaSalTimer : public SalTimer +{ +private: + TMTask mTask; // the timer task + BOOL mbInstalled; // timer task is in queue + long mMS; // current timer interval in msec + BOOL InstallTask(); // installs timer task and returns status + +public: + AquaSalTimer(); + virtual ~AquaSalTimer(); + + // overload all pure virtual methods + void Start( ULONG nMS ); + void Stop(); + + // restarts active tasks using the current timeout + // optional with different timeout (when nMS is != 0) + void ReStart( ULONG nMS = 0 ); +}; + +#endif diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/salvd.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salvd.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/salvd.h 2005-09-09 12:37:00.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/salvd.h 2006-04-25 21:39:35.000000000 +0200 @@ -56,6 +56,9 @@ #include #endif +#include +#include + #if PRAGMA_ONCE #pragma once #endif @@ -70,11 +73,6 @@ struct SalVirDevData { - SalGraphics *mpGraphics; // current VirDev graphics - USHORT mnBitCount; // GWorld pixel depth - long mnWidth; // GWorld width - long mnHeight; // GWorld height - BOOL mbGraphics; // is Graphics used? }; typedef struct SalVirDevData SalVirDevData; @@ -83,6 +81,40 @@ // ======================================================================= +class AquaSalGraphics; + +// ----------------- +// - SalVirDevData - +// ----------------- + +class AquaSalVirtualDevice : public SalVirtualDevice +{ +public: + AquaSalGraphics *mpGraphics; // current VirDev graphics + USHORT mnBitCount; // pixel depth + long mnWidth; // width + long mnHeight; // height + BOOL mbGraphics; // is Graphics used? + + +// HDC mhDC; // HDC or 0 for Cache Device +// HBITMAP mhBmp; // Memory Bitmap +// HBITMAP mhDefBmp; // Default Bitmap +// WinSalGraphics* mpGraphics; // current VirDev graphics +// WinSalVirtualDevice* mpNext; // next VirDev +// USHORT mnBitCount; // BitCount (0 or 1) +// BOOL mbGraphics; // is Graphics used +// BOOL mbForeignDC; // uses a foreign DC instead of a bitmap + + AquaSalVirtualDevice(); + virtual ~AquaSalVirtualDevice(); + + virtual SalGraphics* GetGraphics(); + virtual void ReleaseGraphics( SalGraphics* pGraphics ); + virtual BOOL SetSize( long nNewDX, long nNewDY ); + virtual void GetSize( long& rWidth, long& rHeight ); +}; + // ======================================================================= #endif // _SV_SALVD_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLApplication.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLApplication.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLApplication.h 2005-09-09 12:30:10.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLApplication.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLAPPLICATION_H -#define _SV_VCLAPPLICATION_H - -#ifndef _SV_SV_H -#include -#endif - -#ifndef __cplusplus - -#include -#import -#include - -// ------------------ -// - VCLApplication - -// ------------------ - -@interface VCLApplication : NSApplication -- (MacOSBOOL)applicationShouldTerminate: (NSApplication *)sender; -- (void)sendEvent: (NSEvent *)anEvent; -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Invokes [VCLApplication sharedApplication] -void VCLApplication_SharedApplication(); - -// Invokes [VCLApplication run] -void VCLApplication_Run( BOOL bWait ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLAPPLICATION_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLAutoreleasePool.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLAutoreleasePool.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLAutoreleasePool.h 2005-09-09 12:30:28.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLAutoreleasePool.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,71 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLAUTORELEASEPOOL_H -#define _SV_VCLAUTORELEASEPOOL_H - -typedef void *VCLAUTORELEASEPOOL; - -#ifndef __cplusplus - -#include -#import -#include - -// ---------------------- -// - VCLAutoreleasePool - -// ---------------------- - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Invokes [[VCLAutoreleasePool new] init] -VCLAUTORELEASEPOOL VCLAutoreleasePool_Init(); - -// Invokes [VCLAutoreleasePool release] -void VCLAutoreleasePool_Release( VCLAUTORELEASEPOOL hReleasepool ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLAUTORELEASEPOOL_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLEvent.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLEvent.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLEvent.h 2005-09-09 12:30:41.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLEvent.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,73 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLEVENT_H -#define _SV_VCLEVENT_H - -#ifndef _SV_SV_H -#include -#endif - -#ifndef __cplusplus - -#include -#import -#include - -// ----------- -// - VCLEvent - -// ----------- - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Start sending NSPeriodic events -void VCLEvent_StartPeriodicEvents( ULONG nDelay ); - -// Stop sending NSPeriodic events -void VCLEvent_StopPeriodicEvents(); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLEVENT_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLGraphics.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLGraphics.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLGraphics.h 2005-09-09 12:30:57.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLGraphics.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,100 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLGRAPHICS_H -#define _SV_VCLGRAPHICS_H - -typedef void *VCLGRAPHICS; - -#ifndef _SV_SV_H -#include -#endif - -#ifndef _SV_VCLVIEW_H -#include -#endif -#ifndef _SV_VCLWINDOW_H -#include -#endif - -#include -#include -#include - -#ifndef __cplusplus - -#include -#import -#include - -// --------------- -// - VCLGraphics - -// --------------- - -@interface VCLGraphics : NSObject - -// Get, and lock, a QuickDraw View - -+ (CGrafPtr)LockFocusCGrafPort: (VCLView *)hView; - -// Close, and unlock, a QuickDraw View - -+ (void)UnLockFocusCGrafPort: (VCLView *)hView; - -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Get, and lock, a QuickDraw View - -CGrafPtr VCLGraphics_LockFocusCGrafPort ( VCLVIEW hView ); - -// Close, and unlock, a QuickDraw View - -void VCLGraphics_UnLockFocusCGrafPort ( VCLVIEW hView ); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLGRAPHICS_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLView.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLView.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLView.h 2005-09-09 12:31:11.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLView.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLVIEW_H -#define _SV_VCLVIEW_H - -typedef void *VCLVIEW; - -#ifndef __cplusplus - -#include -#import -#include - -// ----------- -// - VCLView - -// ----------- - -@interface VCLView : NSQuickDrawView -{ -int qdRgnResized; -} -- init; -- (void)drawRect: (NSRect)aRect; -- (void)lockFocus; -- (MacOSBOOL)isOpaque; -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLVIEW_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLWindow.h ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLWindow.h --- ooo_SRC680_m172_src.orig/vcl/aqua/inc/VCLWindow.h 2005-09-09 12:31:48.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/inc/VCLWindow.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,117 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef _SV_VCLWINDOW_H -#define _SV_VCLWINDOW_H - -typedef void *VCLWINDOW; - -#ifndef _SV_SALFRAME_HXX -#include -#endif - -#ifndef _SV_VCLVIEW_H -#include -#endif - -#ifndef __cplusplus - -#include -#import -#include - -// ------------- -// - VCLWindow - -// ------------- - -@interface VCLWindow : NSWindow -{ -@public - // Important: these data members must be explicitly set before using this - // class. Otherwise, none of the rest of the methods in this class will - // work properly. - SalFrame *mpSalFrame; - struct SalFrameData *mpSalFrameData; -} -- (void)setContentSize: (NSSize)aSize; -- (void)windowDidBecomeKey: (NSNotification *)aNotification; -- (void)windowDidResignKey: (NSNotification *)aNotification; -- (MacOSBOOL)windowShouldClose: (id)sender; -- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)proposedFrameSize; -@end - -#endif // ! __cplusplus - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -// Instantiate a native VCLWindow. -VCLWINDOW VCLWindow_New( ULONG nSalFrameStyle, VCLWINDOW hParentWindow, - SalFrame *pFrame, struct SalFrameData *pFrameData ); - -// Get VCLWindow contentView -VCLVIEW VCLWindow_ContentView( VCLWINDOW hWindow ); - -// Display VCLWindow -void VCLWindow_Show( VCLWINDOW hWindow ); - -// Hide VCLWindow -void VCLWindow_Close( VCLWINDOW hWindow ); - -// Release a native VCLWindow -void VCLWindow_Release( VCLWINDOW hWindow ); - -// Set the title for VCLWindow -void VCLWindow_SetTitle( VCLWINDOW hWindow, const char *pTitle ); - -// Set the size of a VCLWindow -void VCLWindow_SetSize( VCLWINDOW hWindow, long nWidth, long nHeight ); - -// Post an NSApplicationDefined event to the event queue -BOOL VCLWindow_PostEvent( VCLWINDOW hWindow, void *pData ); - -// Sound a beep -void VCLWindow_Beep(); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _SV_VCLWINDOW_H diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/makefile.mk ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/makefile.mk --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/makefile.mk 2005-09-09 12:38:32.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/makefile.mk 2006-03-08 22:35:07.000000000 +0100 @@ -38,6 +38,7 @@ PRJNAME=vcl TARGET=salapp .INCLUDE : $(PRJ)$/util$/makefile.pmk +ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- @@ -55,19 +56,16 @@ .ELSE # "$(GUIBASE)"!="aqua" -OBJFILES= $(OBJ)$/salmain.obj \ - $(OBJ)$/VCLApplication.obj \ - $(OBJ)$/VCLAutoreleasePool.obj +#CFLAGS+=-x objective-c++ + +OBJFILES= $(OBJ)$/salmain.obj SLOFILES= $(SLO)$/salinst.obj \ $(SLO)$/saldata.obj \ $(SLO)$/saltimer.obj \ $(SLO)$/salsound.obj \ $(SLO)$/salsys.obj \ - $(SLO)$/salmain.obj \ - $(SLO)$/VCLApplication.obj \ - $(SLO)$/VCLAutoreleasePool.obj \ - $(SLO)$/VCLEvent.obj + $(SLO)$/salmain.obj EXCEPTIONSFILES=$(SLO)$/salmain.obj \ $(OBJ)$/salmain.obj diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salinst.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salinst.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salinst.cxx 2005-09-09 12:39:02.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salinst.cxx 2006-04-27 22:47:02.000000000 +0200 @@ -41,32 +41,49 @@ #ifndef _SV_SALINST_HXX #include #endif -#ifndef _SV_SALFRAME_HXX -#include +#ifndef _SV_SALINST_H +#include +#endif +#ifndef _SV_SALFRAME_H +#include #endif #ifndef _SV_SALOBJ_HXX #include #endif +#include +#ifndef _SV_SALOBJ_H +#include +#endif #ifndef _SV_SALSYS_HXX #include #endif +#ifndef _SV_SALSYS_H +#include +#endif #ifndef _SV_SALVD_HXX #include #endif +#ifndef _SV_SALVD_H +#include +#endif #ifndef _SV_DIALOG_HXX #include #endif -#ifndef _SV_VCLAPPLICATION_H -#include -#endif -#ifndef _SV_VCLAUTORELEASEPOOL_H -#include -#endif #ifndef _FSYS_HXX #include #endif +#ifndef _SV_SALIMESTATUS_HXX +#include +#endif + +#include +#include -static VCLAUTORELEASEPOOL hMainAutoreleasePool = NULL; +#include + +#include + +using namespace std; // ======================================================================= @@ -91,6 +108,14 @@ // ----------------------------------------------------------------------- +const ::rtl::OUString& SalGetDesktopEnvironment() +{ + static OUString aDesktopEnvironment(RTL_CONSTASCII_USTRINGPARAM( "MacOSX" )); + return aDesktopEnvironment; +} + +// ----------------------------------------------------------------------- + void DeInitSalData() { SalData *pSalData = GetSalData(); @@ -108,80 +133,59 @@ void InitSalMain() { - // [ed] 5/14/02 We need to use _NSGetEnviron() here and can't use the straight - // environ. This is due to two-level-namespaces not enjoying having funky - // global hack symbols lying around. -#ifdef QUARTZ - char **environ; - char *stackNULL=NULL; - if(_NSGetEnviron()) - environ=*_NSGetEnviron(); - else - environ=&stackNULL; -#else - extern char **environ; -#endif - - char **pEnviron; - - // Get full executable path. We cna't use __progname as that only holds - // the name of the executable and not the path. The full executable path - // is listed after the first NULL in *environ. - pEnviron = environ; - while ( *pEnviron++ ) - ; - - // Need to include the absolute path for this executable in the PATH - // and STAR_RESOURCEPATH environment variables so that the resource manager - // can find resource files and in the DYLD_LIBRARY_PATH environment - // variable so that the dynamic library loader can find shared libraries - ByteString aPath( getenv( "PATH" ) ); - ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); - ByteString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) ); - ByteString aCmdPath( *pEnviron ); - ByteString aTmpPath; - // Get absolute path of command's directory - if ( aCmdPath.Len() ) { - DirEntry aCmdDirEntry( aCmdPath ); - aCmdDirEntry.ToAbs(); - aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); - } - // Assign to PATH environment variable - if ( aCmdPath.Len() ) - { - aTmpPath = ByteString( "PATH=" ); - aTmpPath += aCmdPath; - if ( aPath.Len() ) - aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); - aTmpPath += aPath; - putenv( aTmpPath.GetBuffer() ); - } - // Assign to STAR_RESOURCEPATH environment variable - if ( aCmdPath.Len() ) - { - aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); - aTmpPath += aCmdPath; - if ( aResPath.Len() ) - aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); - aTmpPath += aResPath; - putenv( aTmpPath.GetBuffer() ); - } - // Assign to DYLD_LIBRARY_PATH environment variable - if ( aCmdPath.Len() ) - { - aTmpPath = ByteString( "DYLD_LIBRARY_PATH=" ); - aTmpPath += aCmdPath; - if ( aLibPath.Len() ) - aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); - aTmpPath += aLibPath; - putenv( aTmpPath.GetBuffer() ); - } - - // Setup up autorelease pool for Objective-C objects - hMainAutoreleasePool = VCLAutoreleasePool_Init(); - - // Initialize application's connection to the window server - VCLApplication_SharedApplication(); + rtl_uString *urlWorkDir = NULL; + rtl_uString *sysWorkDir = NULL; + + oslProcessError err1 = osl_getProcessWorkingDir(&urlWorkDir); + + if (err1 == osl_Process_E_None) + { + oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir, &sysWorkDir); + if (err2 == osl_File_E_None) + { + ByteString aPath( getenv( "PATH" ) ); + ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); + ByteString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) ); + ByteString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() ); + ByteString aTmpPath; + // Get absolute path of command's directory + if ( aCmdPath.Len() ) { + DirEntry aCmdDirEntry( aCmdPath ); + aCmdDirEntry.ToAbs(); + aCmdPath = ByteString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); + } + // Assign to PATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "PATH=" ); + aTmpPath += aCmdPath; + if ( aPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + // Assign to STAR_RESOURCEPATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); + aTmpPath += aCmdPath; + if ( aResPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aResPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + // Assign to DYLD_LIBRARY_PATH environment variable + if ( aCmdPath.Len() ) + { + aTmpPath = ByteString( "DYLD_LIBRARY_PATH=" ); + aTmpPath += aCmdPath; + if ( aLibPath.Len() ) + aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aTmpPath += aLibPath; + putenv( (char*)aTmpPath.GetBuffer() ); + } + } + } } // ----------------------------------------------------------------------- @@ -189,7 +193,7 @@ void DeInitSalMain() { // Release autorelease pool - VCLAutoreleasePool_Release( hMainAutoreleasePool ); + //VCLAutoreleasePool_Release( hMainAutoreleasePool ); } @@ -198,8 +202,8 @@ void SetFilterCallback( void* pCallback, void* pInst ) { SalData *pSalData = GetSalData(); - pSalData->mpFirstInstance->maInstData.mpFilterCallback = pCallback; - pSalData->mpFirstInstance->maInstData.mpFilterInst = pInst; + //[fheckl]pSalData->mpFirstInstance->mpFilterCallback = pCallback; + //[fheckl]pSalData->mpFirstInstance->mpFilterInst = pInst; } // ======================================================================= @@ -234,23 +238,56 @@ { mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier(); mnCount++; - return True; + return sal_True; } else - return False; + return sal_False; +} + +// ----------------------------------------------------------------------- + +// some convenience functions regarding the yield mutex, aka solar mutex + +BOOL ImplSalYieldMutexTryToAcquire() +{ + AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + return pInst->mpSalYieldMutex->tryToAcquire(); + else + return FALSE; +} + +void ImplSalYieldMutexAcquire() +{ + AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + pInst->mpSalYieldMutex->acquire(); +} + +void ImplSalYieldMutexRelease() +{ + AquaSalInstance* pInst = (AquaSalInstance*) GetSalData()->mpFirstInstance; + if ( pInst ) + { + //GdiFlush(); + pInst->mpSalYieldMutex->release(); + } } // ======================================================================= SalInstance* CreateSalInstance() { - SalData* pSalData = GetSalData(); - SalInstance* pInst = new SalInstance; + SalData* pSalData = GetSalData(); + AquaSalInstance* pInst = new AquaSalInstance; + + EventLoopTimerUPP eventLoopTimer = NewEventLoopTimerUPP(AquaSalInstance::TimerEventHandler); + OSStatus rc = InstallEventLoopTimer(GetMainEventLoop(), 1, 0, eventLoopTimer, pInst, &pInst->mEventLoopTimerRef); + + // init instance (only one instance in this version !!!) + pSalData->mpFirstInstance = pInst; - // init instance (only one instance in this version !!!) - pSalData->mpFirstInstance = pInst; - - return pInst; + return pInst; } // ----------------------------------------------------------------------- @@ -262,34 +299,66 @@ // ----------------------------------------------------------------------- -SalInstance::SalInstance() +AquaSalInstance::AquaSalInstance() { - maInstData.mpFilterCallback = NULL; - maInstData.mpFilterInst = NULL; - maInstData.mpSalYieldMutex = new SalYieldMutex; - maInstData.mpSalYieldMutex->acquire(); + mpFilterCallback = NULL; + mpFilterInst = NULL; + mpSalYieldMutex = new SalYieldMutex; + mEventLoopTimerRef = NULL; + mbForceDispatchPaintEvents = false; + mpSalYieldMutex->acquire(); } // ----------------------------------------------------------------------- -SalInstance::~SalInstance() +AquaSalInstance::~AquaSalInstance() { - maInstData.mpSalYieldMutex->release(); - delete maInstData.mpSalYieldMutex; + mpSalYieldMutex->release(); + delete mpSalYieldMutex; } // ----------------------------------------------------------------------- -vos::IMutex* SalInstance::GetYieldMutex() +void AquaSalInstance::TimerEventHandler(EventLoopTimerRef inTimer, void* pData) { - return maInstData.mpSalYieldMutex; + AquaSalInstance* pInst = reinterpret_cast(pData); + + if (pInst->mbForceDispatchPaintEvents) + { + ULONG nCount = 0; + + // Release all locks so that we don't deadlock when we pull pending + // events from the event queue + nCount = pInst->ReleaseYieldMutex(); + + EventRef theEvent; + EventTargetRef theTarget = GetEventDispatcherTarget(); + + if (ReceiveNextEvent(1, &cOOoSalTimerEvent, 0, true, &theEvent) == noErr) + { + SendEventToEventTarget(theEvent, theTarget); + ReleaseEvent(theEvent); + } + + // Reset all locks + pInst->AcquireYieldMutex(nCount); + + SetEventLoopTimerNextFireTime(inTimer, 1); // restart timer + } +} + +// ----------------------------------------------------------------------- + +vos::IMutex* AquaSalInstance::GetYieldMutex() +{ + return mpSalYieldMutex; } // ----------------------------------------------------------------------- -ULONG SalInstance::ReleaseYieldMutex() +ULONG AquaSalInstance::ReleaseYieldMutex() { - SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex; + SalYieldMutex* pYieldMutex = mpSalYieldMutex; if ( pYieldMutex->GetThreadId() == NAMESPACE_VOS(OThread)::getCurrentIdentifier() ) { @@ -309,9 +378,9 @@ // ----------------------------------------------------------------------- -void SalInstance::AcquireYieldMutex( ULONG nCount ) +void AquaSalInstance::AcquireYieldMutex( ULONG nCount ) { - SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex; + SalYieldMutex* pYieldMutex = mpSalYieldMutex; while ( nCount ) { pYieldMutex->acquire(); @@ -321,67 +390,89 @@ // ----------------------------------------------------------------------- -void SalInstance::Yield( BOOL bWait ) +void AquaSalInstance::StartForceDispatchingPaintEvents() { - ULONG nCount = 0; + SetEventLoopTimerNextFireTime(mEventLoopTimerRef, 1); + mbForceDispatchPaintEvents = true; +} + +void AquaSalInstance::StopForceDispatchingPaintEvents() +{ + mbForceDispatchPaintEvents = false; +} + +void AquaSalInstance::Yield( BOOL bWait ) +{ + ULONG nCount = 0; + + // Release all locks so that we don't deadlock when we pull pending + // events from the event queue + nCount = ReleaseYieldMutex(); - // Release all locks so that we don't deadlock when we pull pending - // events from the event queue - nCount = ReleaseYieldMutex(); + EventRef theEvent; + EventTargetRef theTarget = GetEventDispatcherTarget(); + EventTimeout timeout = bWait ? kEventDurationForever : 0; - // Pull pending events from the event queue and dispatch them. - VCLApplication_Run( bWait ); + if (ReceiveNextEvent(0, NULL, timeout, true, &theEvent) == noErr) + { + //ImplSalYieldMutexAcquire(); + SendEventToEventTarget(theEvent, theTarget); + //ImplSalYieldMutexRelease(); + ReleaseEvent(theEvent); + } // Reset all locks - AcquireYieldMutex( nCount ); + AcquireYieldMutex( nCount ); } // ----------------------------------------------------------------------- -BOOL SalInstance::AnyInput( USHORT nType ) +bool AquaSalInstance::AnyInput( USHORT nType ) { return FALSE; } // ----------------------------------------------------------------------- -SalFrame* SalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) +SalFrame* AquaSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) { return NULL; } // ----------------------------------------------------------------------- -SalFrame* SalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) +SalFrame* AquaSalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) { - SalFrame *pFrame = new SalFrame; + SalFrame* pFrame = NULL; - pFrame->maFrameData.mpParent = pParent; - - // Create the native window - pFrame->maFrameData.mhWnd = VCLWindow_New( nSalFrameStyle, NULL, - pFrame, &(pFrame->maFrameData) ); - - return pFrame; + try + { + pFrame = new AquaSalFrame(pParent, nSalFrameStyle, this); + } + catch(runtime_error&) + { + // frame creation failed + } + return pFrame; } // ----------------------------------------------------------------------- -void SalInstance::DestroyFrame( SalFrame* pFrame ) +void AquaSalInstance::DestroyFrame( SalFrame* pFrame ) { delete pFrame; } // ----------------------------------------------------------------------- -SalObject* SalInstance::CreateObject( SalFrame* pParent ) +SalObject* AquaSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* pWindowData ) { - SalObject *pObject = NULL; + AquaSalObject *pObject = NULL; if ( pParent ) { - pObject = new SalObject; - pObject->maObjectData.mpFrame = pParent; + pObject = new AquaSalObject(); + pObject->mpFrame = (AquaSalFrame*)pParent; } return pObject; @@ -389,74 +480,74 @@ // ----------------------------------------------------------------------- -void SalInstance::DestroyObject( SalObject* pObject ) +void AquaSalInstance::DestroyObject( SalObject* pObject ) { delete ( pObject ); } // ----------------------------------------------------------------------- -SalVirtualDevice* SalInstance::CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, USHORT nBitCount ) +SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, USHORT nBitCount, const SystemGraphicsData *pData ) { - SalVirtualDevice *pVirDev = new SalVirtualDevice; + AquaSalVirtualDevice *pVirDev = new AquaSalVirtualDevice; // Cache values for when SalVirtualDevice::GetGraphics() is invoked - pVirDev->maVirDevData.mnBitCount = nBitCount; - pVirDev->maVirDevData.mnWidth = nDX; - pVirDev->maVirDevData.mnHeight = nDY; + pVirDev->mnBitCount = nBitCount; + pVirDev->mnWidth = nDX; + pVirDev->mnHeight = nDY; return pVirDev; } // ----------------------------------------------------------------------- -void SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) +void AquaSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) { delete pDevice; } // ----------------------------------------------------------------------- -SalPrinter* SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) +SalPrinter* AquaSalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) { return NULL; } // ----------------------------------------------------------------------- -void SalInstance::DestroyPrinter( SalPrinter* pPrinter ) +void AquaSalInstance::DestroyPrinter( SalPrinter* pPrinter ) { } // ----------------------------------------------------------------------- -void SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) +void AquaSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) { } // ----------------------------------------------------------------------- -void SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) +void AquaSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) { } // ----------------------------------------------------------------------- -void SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) +void AquaSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) { } // ----------------------------------------------------------------------- -XubString SalInstance::GetDefaultPrinter() +XubString AquaSalInstance::GetDefaultPrinter() { return XubString(); } // ----------------------------------------------------------------------- -SalInfoPrinter* SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, +SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) { return NULL; @@ -464,41 +555,136 @@ // ----------------------------------------------------------------------- -void SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) +void AquaSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) { } // ----------------------------------------------------------------------- -SalSystem* SalInstance::CreateSystem() +SalSystem* AquaSalInstance::CreateSystem() { - return new SalSystem(); + return new AquaSalSystem(); } // ----------------------------------------------------------------------- -void SalInstance::DestroySystem( SalSystem* pSystem ) +void AquaSalInstance::DestroySystem( SalSystem* pSystem ) { delete pSystem; } // ----------------------------------------------------------------------- -void SalInstance::SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) +void AquaSalInstance::SetEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) { } // ----------------------------------------------------------------------- -void SalInstance::SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) +void AquaSalInstance::SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) ) { } // ----------------------------------------------------------------------- -void* SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) +void* AquaSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) { rReturnedBytes = 1; rReturnedType = AsciiCString; - return ""; + return (void*)""; +} + + + + + + + + + + + + + + + + + + + +SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +{ + return NULL; +} + +void AquaSalInstance::DestroyMenu( SalMenu* ) +{ + +} + +SalMenuItem* AquaSalInstance::CreateMenuItem( const SalItemParams* pItemData ) +{ + +} + +void AquaSalInstance::DestroyMenuItem( SalMenuItem* ) +{ + +} + +SalSound* AquaSalInstance::CreateSalSound() +{ + return new AquaSalSound(); +} + +SalTimer* AquaSalInstance::CreateSalTimer() +{ + return new AquaSalTimer(); +} + +SalOpenGL* AquaSalInstance::CreateSalOpenGL( SalGraphics* pGraphics ) +{ + return new AquaSalOpenGL( pGraphics ); +} + +SalSystem* AquaSalInstance::CreateSalSystem() +{ + return new AquaSalSystem(); +} + +SalBitmap* AquaSalInstance::CreateSalBitmap() +{ + return new AquaSalBitmap(); } + +SalSession* AquaSalInstance::CreateSalSession() +{ + return NULL; +} + +class MacImeStatus : public SalI18NImeStatus +{ +public: + MacImeStatus() {} + virtual ~MacImeStatus() {} + + // asks whether there is a status window available + // to toggle into menubar + virtual bool canToggle() { return false; } + virtual void toggle() {} +}; + +SalI18NImeStatus* AquaSalInstance::CreateI18NImeStatus() +{ + return new MacImeStatus(); +} + + + + +////////////////////////////////////////////////////////////// +void VCLApplication_Run( BOOL bWait ) +{ + RunApplicationEventLoop(); +} + diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salmain.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salmain.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salmain.cxx 2005-09-09 12:39:18.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salmain.cxx 2006-04-27 22:47:02.000000000 +0200 @@ -33,10 +33,11 @@ * ************************************************************************/ +#include #include #ifndef _SAL_MAIN_H_ -#include "sal/main.h" +#include #endif #ifndef _SV_SALINST_HXX diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salsound.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salsound.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salsound.cxx 2005-09-09 12:39:32.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salsound.cxx 2005-11-27 10:48:34.000000000 +0100 @@ -33,19 +33,19 @@ * ************************************************************************/ -#ifndef _SV_SALSOUND_HXX -#include +#ifndef _SV_SALSOUND_H +#include #endif // ======================================================================== // Initialize static data members -ULONG SalSound::mnSoundState = SOUND_STATE_UNLOADED; +ULONG AquaSalSound::mnSoundState = SOUND_STATE_UNLOADED; // ======================================================================== -SalSound::SalSound() : +AquaSalSound::AquaSalSound() : mpProc ( NULL ), mbLoop ( FALSE ), mbPaused ( FALSE ) @@ -54,52 +54,85 @@ // ------------------------------------------------------------------------ -SalSound::~SalSound() +AquaSalSound::~AquaSalSound() { Stop(); } // ------------------------------------------------------------------------ -BOOL SalSound::Create() -{ - return FALSE; -} +//BOOL AquaSalSound::Create() +//{ +// return FALSE; +//} // ------------------------------------------------------------------------ -void SalSound::Release() +void AquaSalSound::Release() { } // ------------------------------------------------------------------------ -BOOL SalSound::Init( SalFrame* pFrame, const XubString& rSoundName, ULONG& rSoundLen ) +bool AquaSalSound::Init( /*SalFrame* pFrame,*/ const String& rSoundName, ULONG& rSoundLen ) { return FALSE; } // ------------------------------------------------------------------------ -BOOL SalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ) +//BOOL AquaSalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ) +//{ +// return FALSE; +//} + +// ------------------------------------------------------------------------ + +void AquaSalSound::Play( ULONG nStartTime, ULONG nPlayLen, bool bLoop ) { - return FALSE; } // ------------------------------------------------------------------------ -void SalSound::Play( ULONG nStartTime, ULONG nPlayLen, BOOL bLoop ) +void AquaSalSound::Stop() { } // ------------------------------------------------------------------------ -void SalSound::Stop() +void AquaSalSound::Pause() { } -// ------------------------------------------------------------------------ -void SalSound::Pause() + + + + + + + +bool AquaSalSound::IsValid() { + return false; } + +void AquaSalSound::Continue() +{ + +} + +bool AquaSalSound::IsLoopMode() const +{ + return false; +} + +bool AquaSalSound::IsPlaying() const +{ + return false; +} + +bool AquaSalSound::IsPaused() const +{ + return false; +} \ No newline at end of file diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salsys.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salsys.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/salsys.cxx 2005-09-09 12:39:53.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/salsys.cxx 2005-11-27 10:48:34.000000000 +0100 @@ -36,33 +36,62 @@ #ifndef _SV_SALSYS_HXX #include #endif +#ifndef _SV_SALSYS_H +#include +#endif // ======================================================================= -SalSystem::SalSystem() -{ -} +//AquaSalSystem::AquaSalSystem() +//{ +//} // ----------------------------------------------------------------------- -SalSystem::~SalSystem() +AquaSalSystem::~AquaSalSystem() { } // ----------------------------------------------------------------------- -BOOL SalSystem::StartProcess( SalFrame* pFrame, - const XubString& rFileName, - const XubString& rParam, - const XubString& rWorkDir ) +//bool AquaSalSystem::StartProcess( SalFrame* pFrame, +// const XubString& rFileName, +// const XubString& rParam, +// const XubString& rWorkDir ) +//{ +// return FALSE; +//} + +// ----------------------------------------------------------------------- + +//BOOL AquaSalSystem::AddRecentDoc( SalFrame*, const XubString& rFileName ) +//{ +// return FALSE; +//} + + + + + + +int AquaSalSystem::ShowNativeDialog( const String& rTitle, + const String& rMessage, + const std::list< String >& rButtons, + int nDefButton ) { - return FALSE; + return 0; } -// ----------------------------------------------------------------------- +bool AquaSalSystem::GetSalSystemDisplayInfo( DisplayInfo& rInfo ) +{ + return false; +} -BOOL SalSystem::AddRecentDoc( SalFrame*, const XubString& rFileName ) +int AquaSalSystem::ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton) { - return FALSE; + return 0; } diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/saltimer.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/saltimer.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/saltimer.cxx 2005-09-09 12:40:07.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/saltimer.cxx 2006-04-27 22:47:02.000000000 +0200 @@ -33,34 +33,122 @@ * ************************************************************************/ -#ifndef _SV_SALTIMER_HXX -#include +#ifndef _SV_SALTIMER_H +#include #endif #ifndef _SV_SALDATA_HXX #include #endif -#ifndef _SV_VCLEVENT_H -#include +#ifndef _SV_SALFRAME_H +#include #endif // ======================================================================= -void SalTimer::Start( ULONG nMS ) + +#define USEMAINTHREAD 1 + +void AquaSalTimerProc ( TMTaskPtr tmTaskPtr ) { - VCLEvent_StartPeriodicEvents( nMS ); -} + ImplSVData* pSVData = ImplGetSVData(); + + AquaSalTimer *pSalTimer = (AquaSalTimer*) pSVData->mpSalTimer; + if( pSalTimer ) + { +#ifdef USEMAINTHREAD + // send event to main thread + SalData* pSalData = GetSalData(); + AquaSalFrame *pFrame = dynamic_cast(pSalData->mpFirstFrame); + + if( pFrame ) + pFrame->PostTimerEvent( pSalTimer ); + // fire again using current timeout as this is a single shot timer + pSalTimer->ReStart(); +#else + // call back directly from timer thread + if( ImplSalYieldMutexTryToAcquire() ) + { + pSalTimer->CallCallback(); + ImplSalYieldMutexRelease(); + + // fire again using current timeout as this is a single shot timer + pSalTimer->ReStart(); + } + else + { + // could not acquire solar mutex, so + // fire again with a short delay (10ms) + //fprintf(stderr, "TIMER: solar mutex not free\n"); + pSalTimer->ReStart( 10 ); + } + +#endif + } +} // ----------------------------------------------------------------------- -void SalTimer::Stop() +AquaSalTimer::AquaSalTimer( ) { - VCLEvent_StopPeriodicEvents(); + mbInstalled = FALSE; + mMS = 0; + mTask.tmAddr = NewTimerUPP( AquaSalTimerProc ); +} + +AquaSalTimer::~AquaSalTimer() +{ + if( mbInstalled ) + RemoveTimeTask( (QElemPtr) &mTask ); + DisposeTimerUPP( mTask.tmAddr ); } // ----------------------------------------------------------------------- -void SalTimer::SetCallback( SALTIMERPROC pProc ) +void AquaSalTimer::Start( ULONG nMS ) { - SalData* pSalData = GetSalData(); - pSalData->mpTimerProc = pProc; + // cancel current timer + if( mbInstalled ) + RemoveTimeTask( (QElemPtr) &mTask ); + + // store new timeout + mMS = nMS; + + // install the timer task + mbInstalled = InstallTask(); + + // fire + if( mbInstalled ) + PrimeTimeTask( (QElemPtr) &mTask, mMS ); } + +void AquaSalTimer::ReStart( ULONG nMS ) +{ + if( mbInstalled ) + // use current timeout if nMS == 0 + PrimeTimeTask( (QElemPtr) &mTask, nMS ? nMS : mMS ); +} + +void AquaSalTimer::Stop() +{ + if( mbInstalled ) + { + RemoveTimeTask( (QElemPtr) &mTask ); + mbInstalled = FALSE; + } +} + +BOOL AquaSalTimer::InstallTask() +{ + // install the timer task + mTask.tmWakeUp = 0; + mTask.tmCount = 0; + if( InstallTimeTask( (QElemPtr) &mTask ) == noErr ) + return TRUE; + else + { + fprintf(stderr, "Could not install timer task!\n"); + return FALSE; + } +} + +// ----------------------------------------------------------------------- diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/VCLApplication.m ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/VCLApplication.m --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/VCLApplication.m 2005-09-09 12:37:46.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/VCLApplication.m 1970-01-01 01:00:00.000000000 +0100 @@ -1,400 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import -#import -#import -#import -#import -#include -#import -#include - -#define _SV_VCLAPPLICATION_M - -// -------------------- -// - Static functions - -// -------------------- - -static BOOL SalHandleMouseEvent( NSEvent *pEvent ) -{ - VCLWindow *pFrame = [pEvent window]; - NSEventType nEventType = [pEvent type]; - struct SalMouseEvent aMouseEvt; - NSPoint aPoint = [pEvent locationInWindow]; - NSRect aFrameRect = [(VCLWindow *)pFrame frame]; - NSRect aContentRect = [[(VCLWindow *)pFrame contentView] frame]; - NSRect aResizeRect; - unsigned int nModifiers = [pEvent modifierFlags]; - USHORT nEvent = 0; - - // Test if the point is in the window's contentView. If not, we don't - // handle it here. - if ( ! NSPointInRect( aPoint, aContentRect ) ) - { - return FALSE; - } - - // Test if the point is in the window's resize box. If so, allow the - // default event handler to handle it. - if ( [pFrame styleMask] & NSResizableWindowMask ) - { - aResizeRect.origin.x = aFrameRect.size.width - kThemeMetricResizeControlHeight; - aResizeRect.origin.y = 0; - aResizeRect.size.width = kThemeMetricResizeControlHeight; - aResizeRect.size.height = kThemeMetricResizeControlHeight; - if ( NSPointInRect( aPoint, aResizeRect ) ) - return FALSE; - } - - // Convert mouse coordinates from window's coordinate space that - // contentView's coordinate space since we will be drawing in the - // contentView. - aPoint.x -= aContentRect.origin.x; - aPoint.y -= aContentRect.origin.y; - - // Initialize SalMouseEvent structure - aMouseEvt.mnTime = (ULONG)([pEvent timestamp] * 1000); - aMouseEvt.mnCode = 0; - aMouseEvt.mnX = (long)(aPoint.x); - // Need to adjust the Y coordinate since 0 is at the bottom of the window - // in aPoint - aMouseEvt.mnY = (long)(aContentRect.size.height - (aPoint.y)); - aMouseEvt.mnButton = 0; - - // Get the modifiers for the event - if ( nModifiers & NSShiftKeyMask ) - aMouseEvt.mnCode |= KEY_SHIFT; - if ( nModifiers & NSCommandKeyMask ) - aMouseEvt.mnCode |= KEY_MOD1; - if ( nModifiers & NSAlternateKeyMask ) - aMouseEvt.mnCode |= KEY_MOD2; - - // Determine with button has been pressed - switch ( nEventType ) - { - case NSLeftMouseDown: - case NSLeftMouseUp: - case NSLeftMouseDragged: - // If the Alt key is pressed, treat event as a right button - // event and ignore the Alt key. We need this since many Apple - // machines have only a one-button mouse. We can't use the Command - // key because that is reserved for drag-copy operations. - if ( aMouseEvt.mnCode & KEY_MOD2 ) - { - aMouseEvt.mnCode |= MOUSE_RIGHT; - aMouseEvt.mnCode &= ~KEY_MOD2 ; - } - else - aMouseEvt.mnCode |= MOUSE_LEFT; - break; - case NSRightMouseDown: - case NSRightMouseUp: - case NSRightMouseDragged: - aMouseEvt.mnCode |= MOUSE_RIGHT; - break; - default: - break; - } - - // Get the button for this event - if ( aMouseEvt.mnCode & MOUSE_LEFT ) - aMouseEvt.mnButton = MOUSE_LEFT; - if ( aMouseEvt.mnCode & MOUSE_RIGHT ) - aMouseEvt.mnButton = MOUSE_RIGHT; - - // Pass the event to this window's callback function - switch ( nEventType ) - { - case NSLeftMouseDown: - case NSRightMouseDown: - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - case NSLeftMouseUp: - case NSRightMouseUp: - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - case NSMouseMoved: - case NSMouseEntered: - case NSLeftMouseDragged: - case NSRightMouseDragged: - nEvent = SALEVENT_MOUSEMOVE; - break; - case NSMouseExited: - nEvent = SALEVENT_MOUSELEAVE; - break; - default: - return FALSE; - break; - } - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, nEvent, &aMouseEvt ); - - return FALSE; -} - -static BOOL SalHandleKeyEvent( NSEvent *pEvent ) -{ - VCLWindow *pFrame = [pEvent window]; - NSEventType nEventType = [pEvent type]; - NSString *pKey = nil; - struct SalKeyEvent aKeyEvt; - unsigned int nModifiers = [pEvent modifierFlags]; - USHORT nEvent = 0; - - // Initialize SalKeyEvent structure - aKeyEvt.mnTime = (ULONG)[pEvent timestamp]; - aKeyEvt.mnCode = 0; - aKeyEvt.mnCharCode = 0; - aKeyEvt.mnRepeat = 0; - - // Get the modifiers for the event - if ( nModifiers & NSShiftKeyMask ) - aKeyEvt.mnCode |= KEY_SHIFT; - if ( nModifiers & NSCommandKeyMask ) - aKeyEvt.mnCode |= KEY_MOD1; - if ( nModifiers & NSAlternateKeyMask ) - aKeyEvt.mnCode |= KEY_MOD2; - - if ( nEventType == NSKeyDown || nEventType == NSKeyUp ) - { - // Get the Unicode character for the event - pKey = [pEvent characters]; - if ( [pKey length] ) - aKeyEvt.mnCharCode = (USHORT)[pKey characterAtIndex: 0]; - else - return TRUE; - - // Add alphanumeric and special characters to modifiers - if ( ( aKeyEvt.mnCharCode >= '0' ) && ( aKeyEvt.mnCharCode <= '9' ) ) - aKeyEvt.mnCode |= KEYGROUP_NUM + aKeyEvt.mnCharCode - '0'; - else if ( ( aKeyEvt.mnCharCode >= 'A' ) && ( aKeyEvt.mnCharCode <= 'Z' ) ) - aKeyEvt.mnCode |= KEYGROUP_ALPHA + aKeyEvt.mnCharCode - 'A'; - else if ( ( aKeyEvt.mnCharCode >= 'a' ) && ( aKeyEvt.mnCharCode <= 'z' ) ) - aKeyEvt.mnCode |= KEYGROUP_ALPHA + aKeyEvt.mnCharCode - 'a'; - else if ( aKeyEvt.mnCharCode == 0x0D ) // RETURN - aKeyEvt.mnCode |= KEY_RETURN; - else if ( aKeyEvt.mnCharCode == 0x1B ) // ESCAPE - aKeyEvt.mnCode |= KEY_ESCAPE; - else if ( aKeyEvt.mnCharCode == 0x09 ) // TAB - aKeyEvt.mnCode |= KEY_TAB; - else if ( aKeyEvt.mnCharCode == 0x20 ) // SPACE - aKeyEvt.mnCode |= KEY_SPACE; - } - // Check if this is a system key equivalent (e.g. Command-Q) - if ( nModifiers == NSCommandKeyMask ) - { - // Only handle event if it is a Key Down event, not a Key Up event - if (nEventType == NSKeyDown ) - { - if (aKeyEvt.mnCharCode == 'q') - { - [NSApp terminate: NSApp]; - return TRUE; - } - if (aKeyEvt.mnCharCode == 'h') - { - [NSApp hide: NSApp]; - return TRUE; - } - } - } - - // Pass the event to this window's callback function - switch ( nEventType ) - { - case NSKeyDown: - nEvent = SALEVENT_KEYINPUT; - break; - case NSKeyUp: - nEvent = SALEVENT_KEYUP; - break; - case NSFlagsChanged: - nEvent = SALEVENT_KEYMODCHANGE; - break; - default: - return FALSE; - break; - } - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, nEvent, &aKeyEvt ); - - return TRUE; -} - -static BOOL SalHandlePeriodicEvent( NSEvent *pEvent ) -{ - NSArray *pWindows = nil; - VCLWindow *pFrame = nil; - unsigned int nFrame = 0; - struct SalData *pSalData = NULL; - - pSalData = SalGetSalData(); - - // Call the timer callback to paint - if ( pSalData->mpTimerProc ) - { - pSalData->mpTimerProc(); - - // Force update of all windows so that the window border is painted - pWindows = [NSApp windows]; - for ( nFrame = 0; nFrame < [pWindows count]; nFrame++ ) - { - pFrame = (VCLWindow *)[pWindows objectAtIndex: nFrame]; - if ( [pFrame isVisible] ) - [pFrame display]; - } - } - - return TRUE; -} - -// ------------------ -// - VCLApplication - -// ------------------ - -@implementation VCLApplication - -- (MacOSBOOL)applicationShouldTerminate: (NSApplication *)sender -{ - VCLWindow *pFrame = [NSApp keyWindow]; - - // Pass the event to this window's callback function. - if ( pFrame && pFrame->mpSalFrameData->mpProc ) - { - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, SALEVENT_SHUTDOWN, NULL ); - } - - // Always return FALSE as the event handler above should have taken - // care of starting the termination process - return FALSE; -} - -- (void)sendEvent: (NSEvent *)anEvent -{ - VCLWindow *pFrame = [anEvent window]; - BOOL bHandled = FALSE; - - // Check if this is an event that we should handle. If so, translate and - // pass the event to the platform independent event handlers. - switch ( [anEvent type] ) - { - case NSLeftMouseDown: - case NSLeftMouseUp: - case NSRightMouseDown: - case NSRightMouseUp: - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSMouseEntered: - case NSMouseExited: - if ( [pFrame isVisible] && SalHandleMouseEvent( anEvent ) ) - bHandled = TRUE; - break; - case NSCursorUpdate: - break; - case NSKeyDown: - case NSKeyUp: - case NSFlagsChanged: - if ( [pFrame isVisible] && SalHandleKeyEvent( anEvent ) ) - bHandled = TRUE; - break; - case NSApplicationDefined: - // Pass the event to this window's callback function. - if ( pFrame && pFrame->mpSalFrameData->mpProc ) - pFrame->mpSalFrameData->mpProc( pFrame->mpSalFrameData->mpInst, - pFrame->mpSalFrame, SALEVENT_USEREVENT, - (void *)[anEvent data1] ); - bHandled = TRUE; - break; - case NSScrollWheel: - break; - case NSPeriodic: - bHandled = SalHandlePeriodicEvent( anEvent ); - break; - case NSAppKitDefined: - case NSSystemDefined: - break; - default: - break; - } - - // If the event has not been handled, pass it to [NSApplication sendEvent:] - if ( !bHandled ) - [super sendEvent: anEvent]; -} - -@end - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -void VCLApplication_SharedApplication() -{ - [VCLApplication sharedApplication]; - [NSApp setDelegate: NSApp]; - - // We need to invoke the following code since we don't use [NSApp run] - [NSApp finishLaunching]; -} - -void VCLApplication_Run( BOOL bWait ) -{ - NSEvent *pEvent; - NSDate *pDate = [NSDate date]; - - // Manually pull events from the event queue and dispatch them to - // [NSApp sendEvent:]. Although this is the same thing that [NSApp run] - // does, the VCL platform independent expects events to be pulled instead - // of pushed from the system event queue. - for ( ; ; ) - { - pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: pDate - inMode: NSDefaultRunLoopMode dequeue: YES]; - - if ( pEvent ) - { - [NSApp sendEvent: pEvent]; - - // Invoke update on all of the windows. This is done in [NSApp run] - // hence it is included here. - [NSApp updateWindows]; - } - else - break; - } -} diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/VCLAutoreleasePool.m ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/VCLAutoreleasePool.m --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/VCLAutoreleasePool.m 2005-09-09 12:38:03.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/VCLAutoreleasePool.m 1970-01-01 01:00:00.000000000 +0100 @@ -1,59 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import - -#define _SV_VCLAUTORELEASEPOOL_M - -// ---------------------- -// - VCLAutoreleasePool - -// ---------------------- - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -VCLAUTORELEASEPOOL VCLAutoreleasePool_Init() -{ - return [[NSAutoreleasePool alloc] init]; -} - -void VCLAutoreleasePool_Release( VCLAUTORELEASEPOOL hReleasepool ) -{ - if ( (NSAutoreleasePool *)hReleasepool == nil ) - return; - - [(NSAutoreleasePool *)hReleasepool release]; -} diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/app/VCLEvent.m ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/VCLEvent.m --- ooo_SRC680_m172_src.orig/vcl/aqua/source/app/VCLEvent.m 2005-09-09 12:38:17.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/app/VCLEvent.m 1970-01-01 01:00:00.000000000 +0100 @@ -1,62 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import - -#define _SV_VCLEVENT_M - -// ----------- -// - VCLEvent - -// ----------- - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -void VCLEvent_StartPeriodicEvents( ULONG nDelay ) -{ - NSTimeInterval nSeconds = (NSTimeInterval)nDelay / 1000; - - // Need to stop period event processing before invoking the start. This - // prevents exceptions from being thrown and allows us to change the - // interval. - [NSEvent stopPeriodicEvents]; - [NSEvent startPeriodicEventsAfterDelay: nSeconds withPeriod: nSeconds]; -} - -void VCLEvent_StopPeriodicEvents() -{ - [NSEvent stopPeriodicEvents]; -} diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/makefile.mk ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/makefile.mk --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/makefile.mk 2005-09-09 12:40:51.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/makefile.mk 2006-02-16 22:36:35.000000000 +0100 @@ -63,7 +63,6 @@ $(SLO)$/salatsuifontutils.obj \ $(SLO)$/salfontutils.obj \ $(SLO)$/salgdi.obj \ - $(SLO)$/VCLGraphics.obj \ $(SLO)$/salvd.obj \ $(SLO)$/salprn.obj \ $(SLO)$/salbmp.obj \ diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salatsuifontutils.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salatsuifontutils.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salatsuifontutils.cxx 2005-09-09 12:41:07.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salatsuifontutils.cxx 2005-11-27 10:48:35.000000000 +0100 @@ -149,9 +149,9 @@ ByteCount nFontFamilyNameLength = 0; FontNamesPtr pFontFamilyNames = NULL; FontNameCode nFontFamilyNameCode = kFontFamilyName; - FontLanguageCode nFontFamilyLanguageCode = kFontNoLanguage; - FontPlatformCode nFontFamilyPlatformCode = kFontNoPlatform; - FontScriptCode nFontFamilyScriptCode = kFontNoScript; + FontLanguageCode nFontFamilyLanguageCode = kFontNoLanguageCode; + FontPlatformCode nFontFamilyPlatformCode = kFontNoPlatformCode; + FontScriptCode nFontFamilyScriptCode = kFontNoScriptCode; ItemCount nFontFamilyIndex = 0; OSStatus nStatus = noErr; MacOSPtr pFontFamilyName = NULL; @@ -1053,9 +1053,9 @@ { FontNameEncodingRecord aBestFontNameEncoding; FontNameCode *pFontNameCode = NULL; - FontPlatformCode nFontNamePlatformCode = kFontNoPlatform; - FontScriptCode nFontNameScriptCode = kFontNoScript; - FontLanguageCode nFontNameLanguageCode = kFontNoLanguage; + FontPlatformCode nFontNamePlatformCode = kFontNoPlatformCode; + FontScriptCode nFontNameScriptCode = kFontNoScriptCode; + FontLanguageCode nFontNameLanguageCode = kFontNoLanguageCode; ItemCount nBestFontIndex = ULONG_MAX; ItemCount nNextFontIndex = 0; ItemCount nFontNamesCount = 0; diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salbmp.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salbmp.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salbmp.cxx 2005-09-09 12:41:21.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salbmp.cxx 2006-03-19 12:53:18.000000000 +0100 @@ -33,15 +33,17 @@ * ************************************************************************/ -#ifndef _SV_SALBMP_HXX - #include +#ifndef _SV_SALBMP_H + #include #endif +#include + // ======================================================================= // ======================================================================= -SalBitmap::SalBitmap() : +AquaSalBitmap::AquaSalBitmap() : mpVirDev( 0 ), mnBitCount( 0 ) { @@ -49,169 +51,47 @@ // ------------------------------------------------------------------ -SalBitmap::~SalBitmap() +AquaSalBitmap::~AquaSalBitmap() { Destroy(); } // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const Size& rSize, - USHORT nBitCount, - const BitmapPalette& rBitmapPalette - ) +bool AquaSalBitmap::Create( const Size& rSize, + USHORT nBitCount, + const BitmapPalette& rBitmapPalette + ) { - ImplSVData *pSVData = ImplGetSVData(); - BOOL bSalBitmapCreated = FALSE; - - if ( pSVData != NULL ) - { - const long nHeight = rSize.Height(); - const long nWidth = rSize.Width(); - - Destroy(); - - if ( ( nHeight > 0 ) && ( nWidth > 0 ) ) - { - // Create a SalVirtualDevice - - mpVirDev - = pSVData->mpDefInst->CreateVirtualDevice( NULL, - nWidth, - nHeight, - nBitCount - ); - - if ( mpVirDev != NULL ) - { - // Get the SalGraphics which contains the - // GWorld we will draw to - - SalGraphics *pGraphics = GetGraphics(); - - if ( pGraphics != NULL ) - { - const CGrafPtr pCGraf = pGraphics->maGraphicsData.mpCGrafPort; - - if ( pCGraf != NULL ) - { - mhPixMap = GetCGrafPortPixMap( rSize, - nBitCount, - rBitmapPalette, - pCGraf - ); - - if ( ( mhPixMap != NULL ) && ( *mhPixMap != NULL ) ) - { - mnBitCount = GetPixDepth( mhPixMap); - mnSize = rSize; - - bSalBitmapCreated = TRUE; - } // if - - // Release the SalGraphics so that others can get a - // handle to it in future GetGraphics() calls - } // if - - ReleaseGraphics( pGraphics ); - } // if - } // if - } // if - } // if - - return bSalBitmapCreated; -} // SalBitmap::Create + return false; +} // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const SalBitmap& rSalBmp ) +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp ) { return Create( rSalBmp, rSalBmp.GetBitCount() ); -} // SalBitmap::Create +} // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const SalBitmap& rSalBmp, +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) { - USHORT nSalBmpBitCount = 0; - BOOL bSalBitmapCreated = FALSE; - - if ( pGraphics != NULL ) - { - const CGrafPtr pCGraf = pGraphics->maGraphicsData.mpCGrafPort; - - if ( pCGraf != NULL ) - { - mhPixMap = GetCGrafPortPixMap( rSalBmp.GetSize(), - rSalBmp.GetBitCount(), - BitmapPalette(), - pCGraf - ); - - if ( ( mhPixMap != NULL ) && ( *mhPixMap != NULL ) ) - { - nSalBmpBitCount = GetPixDepth( mhPixMap ); - } // if - } // if - } // if - - if ( nSalBmpBitCount == 0 ) - { - nSalBmpBitCount = rSalBmp.GetBitCount(); - } // if - - bSalBitmapCreated = Create( rSalBmp, nSalBmpBitCount ); - - return bSalBitmapCreated; -} // SalBitmap::Create + return false; +} // ------------------------------------------------------------------ -BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ) +bool AquaSalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount ) { - BOOL bSalBitmapCreated = FALSE; - - if ( Create( rSalBmp.mnSize, nNewBitCount, BitmapPalette() ) ) - { - // Copy pixels from rSalBmp.mpVirDev to mpVirDev - - SalGraphics *pDstGraphics = GetGraphics(); - - if ( pDstGraphics != NULL ) - { - SalGraphics *pSrcGraphics = rSalBmp.GetGraphics(); - - if ( ( pSrcGraphics != NULL ) - && ( pSrcGraphics->maGraphicsData.mpCGrafPort != NULL ) - ) - { - SalTwoRect aTwoRect; - - // Get size of graphics to copy from - - GetTwoRectFromSalBmp( rSalBmp, &aTwoRect ); - - // Copy bits from source graphics - - pDstGraphics->CopyBits( &aTwoRect, pSrcGraphics ); - - rSalBmp.ReleaseGraphics( pSrcGraphics ); - - bSalBitmapCreated = TRUE; - } // if - - ReleaseGraphics( pDstGraphics ); - } // if - } // if - - return bSalBitmapCreated; -} // SalBitmap::Create + return false; +} // ------------------------------------------------------------------ -void SalBitmap::Destroy() +void AquaSalBitmap::Destroy() { ImplSVData *pSVData = ImplGetSVData(); @@ -225,264 +105,51 @@ mhPixMap = NULL; mnSize = Size(); mnBitCount = 0; - } // if -} // SalBitmap::Destroy + } +} // ------------------------------------------------------------------ -BitmapBuffer* SalBitmap::AcquireBuffer( BOOL bReadOnly ) +BitmapBuffer* AquaSalBitmap::AcquireBuffer( bool bReadOnly ) { BitmapBuffer *pBuffer = NULL; - if ( mpVirDev != NULL ) - { - pBuffer = new BitmapBuffer(); - - if ( ( pBuffer != NULL ) - && ( mhPixMap != NULL ) - && ( *mhPixMap != NULL ) - ) - { - GWorldFlags nPixMapFlags = noErr; - - nPixMapFlags = GetPixelsState( mhPixMap ); - - if ( nPixMapFlags == noErr ) - { - if ( LockPixels( mhPixMap ) ) - { - SetBitmapBufferColorFormat( mhPixMap, pBuffer ); - - if ( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) ) - { - pBuffer->mnWidth = mpVirDev->maVirDevData.mnWidth; - pBuffer->mnHeight = mpVirDev->maVirDevData.mnHeight; - pBuffer->mnScanlineSize = GetPixRowBytes( mhPixMap ); - pBuffer->mpBits = (BYTE *)GetPixBaseAddr( mhPixMap ); - pBuffer->mnBitCount = GetPixDepth( mhPixMap); - - // If the pixel depth is <= 8, we need to map QD's - // internal color table to the platform independent - // BitmapPalette color table - - if ( pBuffer->mnBitCount <= kEightBitColor ) - { - CTabHandle hCTab = (**mhPixMap).pmTable; - - if ( ( hCTab != NULL ) && ( *hCTab != NULL ) ) - { - SInt8 nCTabFlags = noErr; - - nCTabFlags = HGetState( (Handle)hCTab ); - - if ( nCTabFlags == noErr ) - { - USHORT nCTabSize = 0; - USHORT nCTabIndex = 0; - BitmapPalette &rBitmapPalette = pBuffer->maPalette; - - HLock( (Handle)hCTab ); - - // Map each color in the QuickDraw color - // table to a BitmapColor - - nCTabSize = (**hCTab).ctSize + 1; - - rBitmapPalette.SetEntryCount( nCTabSize ); - - for ( nCTabIndex = 0; - nCTabIndex < nCTabSize; - nCTabIndex++ - ) - { - BitmapColor &rBitmapColor = rBitmapPalette[nCTabIndex]; - const RGBColor aRGBColor = (**hCTab).ctTable[nCTabIndex].rgb; - - RGBColor2BitmapColor( &aRGBColor, rBitmapColor ); - } // for - - HSetState( (Handle)hCTab, nCTabFlags ); - } // if - } // if - } // if - } // if - else - { - delete pBuffer; - - pBuffer = NULL; - } // else - - SetPixelsState( mhPixMap, nPixMapFlags ); - } // if - } // if - } // if - } // if - return pBuffer; -} // SalBitmap::AcquireBuffer +} // ------------------------------------------------------------------ -void SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly ) +void AquaSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) { - if ( mpVirDev != NULL ) - { - // Get the SalGraphics which contains the GWorld - // we used as the buffer - - SalGraphics *pGraphics = GetGraphics(); - - if ( ( pGraphics != NULL ) - && ( pGraphics->maGraphicsData.mpCGrafPort != NULL ) - ) - { - // Release the SalGraphics so that others can get a - // handle to it in future calls to GetGraphics() - - ReleaseGraphics( pGraphics ); - - pGraphics = NULL; - } // if - } // if - - if ( pBuffer != NULL ) - { - if ( !bReadOnly ) - { - if ( ( mhPixMap != NULL ) && (*mhPixMap != NULL ) ) - { - GWorldFlags nPixMapFlags = noErr; - - nPixMapFlags = GetPixelsState( mhPixMap ); - - if ( nPixMapFlags == noErr ) - { - if ( LockPixels( mhPixMap ) ) - { - if ( !!pBuffer->maPalette ) - { - CTabHandle hCTab = (**mhPixMap).pmTable; - - if ( ( hCTab != NULL ) && ( *hCTab != NULL ) ) - { - SInt8 nCTabFlags = noErr; - - nCTabFlags = HGetState( (Handle)hCTab ); - - if ( nCTabFlags == noErr ) - { - const BitmapPalette &rBitmapPalette = pBuffer->maPalette; - short nCTabSize = 0; - short nCTabMinSize = 0; - short nCTabIndex; - - HLock( (Handle)hCTab ); - - nCTabSize = (**hCTab).ctSize + 1; - nCTabMinSize = GetMinColorCount( nCTabSize, rBitmapPalette ); - - for( nCTabIndex = 0; - nCTabIndex < nCTabMinSize; - nCTabIndex++ - ) - { - const BitmapColor &rBitmapPaletteColor = rBitmapPalette[nCTabIndex]; - - (**hCTab).ctTable[nCTabIndex].value = nCTabIndex; - - (**hCTab).ctTable[nCTabIndex].rgb - = BitmapColor2RGBColor( rBitmapPaletteColor ); - } // for - - CTabChanged( hCTab ); - - HSetState( (Handle)hCTab, nCTabFlags ); - } // if - } // if - } // if - else - { - GDPtr pGDevice = NULL; - - pGDevice = *GetGDevice(); - - if ( pGDevice != NULL ) - { - PixMapPtr pPixMap = *pGDevice->gdPMap; - - if ( pPixMap != NULL ) - { - CTabPtr pCTable = *pPixMap->pmTable; - - if ( pCTable != NULL ) - { - ITabPtr pITable = *pGDevice->gdITable; - - if ( pITable != NULL ) - { - // Is the inverse color table up-to-date? - - if ( pITable->iTabSeed != pCTable->ctSeed ) - { - // Update our inverse color table - - MakeITable( pPixMap->pmTable, - pGDevice->gdITable, - pGDevice->gdResPref - ); - - pGDevice = *GetGDevice(); - pCTable = *pPixMap->pmTable; - } // if - } // if - - (**mhPixMap).pmTable = pPixMap->pmTable; - } // if - else - { - (**mhPixMap).pmTable = NULL; - } // else - } // if - } // if - } // else - - SetPixelsState( mhPixMap, nPixMapFlags ); - } // if - } //if - } // if - } // if - - delete pBuffer; - - pBuffer = NULL; - } // if -} // SalBitmap::ReleaseBuffer +} // ------------------------------------------------------------------ -SalGraphics* SalBitmap::GetGraphics() +AquaSalGraphics* AquaSalBitmap::GetGraphics() { if ( mpVirDev != NULL ) { - return mpVirDev->GetGraphics(); - } // if + return (AquaSalGraphics*)mpVirDev->GetGraphics(); + } else { return NULL; - } // else -} // SalBitmap::GetGraphics + } +} // ------------------------------------------------------------------ -void SalBitmap::ReleaseGraphics( SalGraphics* pGraphics ) +void AquaSalBitmap::ReleaseGraphics( SalGraphics* pGraphics ) { if ( mpVirDev != NULL ) { mpVirDev->ReleaseGraphics( pGraphics ); - } // if -} // SalBitmap::ReleaseGraphics + } +} // ======================================================================= -// ======================================================================= +bool AquaSalBitmap::GetSystemData( BitmapSystemData& rData ) +{ + return false; +} diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salcolorutils.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salcolorutils.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salcolorutils.cxx 2005-09-09 12:41:36.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salcolorutils.cxx 2005-11-27 10:48:36.000000000 +0100 @@ -36,6 +36,7 @@ #ifndef _SV_SALCOLORUTILS_HXX #include #endif +#include // ======================================================================= diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salfontutils.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salfontutils.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salfontutils.cxx 2005-09-09 12:41:50.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salfontutils.cxx 2005-11-27 10:48:36.000000000 +0100 @@ -45,164 +45,320 @@ #include #endif +#include + // ======================================================================= // ======================================================================= -static rtl_Script GetRTLScriptFromFontScriptCode( const FontNameEncodingPtr pFontNameEncoding ) +static rtl_TextEncoding GetRTLScriptFromFontScriptCode( const FontNameEncodingPtr pFontNameEncoding ) { FontScriptCode nFontScriptCode = pFontNameEncoding->mnFontScriptCode; FontPlatformCode nFontPlatformCode = pFontNameEncoding->mnFontPlatformCode; - rtl_Script nFontRTLScript = SCRIPT_DONTKNOW; + rtl_TextEncoding nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; if ( nFontPlatformCode == kFontUnicodePlatform ) { - nFontRTLScript = SCRIPT_UNICODE; + nFontRTLScript = RTL_TEXTENCODING_UNICODE; } // if else { switch( nFontScriptCode ) { case kFontRomanScript: - nFontRTLScript = SCRIPT_LATIN; + nFontRTLScript = RTL_TEXTENCODING_APPLE_ROMAN; break; case kFontJapaneseScript: - nFontRTLScript = SCRIPT_JAPANESE; + nFontRTLScript = RTL_TEXTENCODING_APPLE_JAPANESE; break; case kFontTraditionalChineseScript: - nFontRTLScript = SCRIPT_CHINESE_TRADITIONAL; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CHINTRAD; break; case kFontKoreanScript: - nFontRTLScript = SCRIPT_KOREAN; + nFontRTLScript = RTL_TEXTENCODING_APPLE_KOREAN; break; case kFontArabicScript: - nFontRTLScript = SCRIPT_ARABIC; + nFontRTLScript = RTL_TEXTENCODING_APPLE_ARABIC; break; case kFontHebrewScript: - nFontRTLScript = SCRIPT_HEBREW; + nFontRTLScript = RTL_TEXTENCODING_APPLE_HEBREW; break; case kFontGreekScript: - nFontRTLScript = SCRIPT_GREEK; + nFontRTLScript = RTL_TEXTENCODING_APPLE_GREEK; break; case kFontCyrillicScript: - nFontRTLScript = SCRIPT_CYRILLIC; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CYRILLIC; break; case kFontRSymbolScript: - nFontRTLScript = SCRIPT_SYMBOL; + nFontRTLScript = RTL_TEXTENCODING_SYMBOL; break; case kFontDevanagariScript: - nFontRTLScript = SCRIPT_DEVANAGARI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_DEVANAGARI; break; case kFontGurmukhiScript: - nFontRTLScript = SCRIPT_GURMUKHI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_GURMUKHI; break; case kFontGujaratiScript: - nFontRTLScript = SCRIPT_GUJARATI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_GUJARATI; break; case kFontOriyaScript: - nFontRTLScript = SCRIPT_ORIYA; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontBengaliScript: - nFontRTLScript = SCRIPT_BENGALI; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontTamilScript: - nFontRTLScript = SCRIPT_TAMIL; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontTeluguScript: - nFontRTLScript = SCRIPT_TELUGU; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontKannadaScript: - nFontRTLScript = SCRIPT_KANNADA; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontMalayalamScript: - nFontRTLScript = SCRIPT_MALAYALAM; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontSinhaleseScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontBurmeseScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontKhmerScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontThaiScript: - nFontRTLScript = SCRIPT_THAI; + nFontRTLScript = RTL_TEXTENCODING_APPLE_THAI; break; case kFontLaotianScript: - nFontRTLScript = SCRIPT_LAO; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontGeorgianScript: - nFontRTLScript = SCRIPT_GEORGIEN; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontArmenianScript: - nFontRTLScript = SCRIPT_ARMENIAN; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontSimpleChineseScript: - nFontRTLScript = SCRIPT_CHINESE_SIMPLIFIED; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CHINSIMP; break; case kFontTibetanScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontMongolianScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontGeezScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontEastEuropeanRomanScript: - nFontRTLScript = SCRIPT_EASTEUROPE; + nFontRTLScript = RTL_TEXTENCODING_APPLE_CENTEURO; break; case kFontVietnameseScript: - nFontRTLScript = SCRIPT_VIETNAMESE; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontExtendedArabicScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; case kFontUninterpretedScript: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; default: - nFontRTLScript = SCRIPT_DONTKNOW; + nFontRTLScript = RTL_TEXTENCODING_DONTKNOW; break; } // switch } // else return nFontRTLScript; } // GetRTLScriptFromFontScriptCode +//static rtl_Script GetRTLScriptFromFontScriptCode( const FontNameEncodingPtr pFontNameEncoding ) +//{ +// FontScriptCode nFontScriptCode = pFontNameEncoding->mnFontScriptCode; +// FontPlatformCode nFontPlatformCode = pFontNameEncoding->mnFontPlatformCode; +// rtl_Script nFontRTLScript = SCRIPT_DONTKNOW; +// +// if ( nFontPlatformCode == kFontUnicodePlatform ) +// { +// nFontRTLScript = SCRIPT_UNICODE; +// } // if +// else +// { +// switch( nFontScriptCode ) +// { +// case kFontRomanScript: +// nFontRTLScript = SCRIPT_LATIN; +// break; +// +// case kFontJapaneseScript: +// nFontRTLScript = SCRIPT_JAPANESE; +// break; +// +// case kFontTraditionalChineseScript: +// nFontRTLScript = SCRIPT_CHINESE_TRADITIONAL; +// break; +// +// case kFontKoreanScript: +// nFontRTLScript = SCRIPT_KOREAN; +// break; +// +// case kFontArabicScript: +// nFontRTLScript = SCRIPT_ARABIC; +// break; +// +// case kFontHebrewScript: +// nFontRTLScript = SCRIPT_HEBREW; +// break; +// +// case kFontGreekScript: +// nFontRTLScript = SCRIPT_GREEK; +// break; +// +// case kFontCyrillicScript: +// nFontRTLScript = SCRIPT_CYRILLIC; +// break; +// +// case kFontRSymbolScript: +// nFontRTLScript = SCRIPT_SYMBOL; +// break; +// +// case kFontDevanagariScript: +// nFontRTLScript = SCRIPT_DEVANAGARI; +// break; +// +// case kFontGurmukhiScript: +// nFontRTLScript = SCRIPT_GURMUKHI; +// break; +// +// case kFontGujaratiScript: +// nFontRTLScript = SCRIPT_GUJARATI; +// break; +// +// case kFontOriyaScript: +// nFontRTLScript = SCRIPT_ORIYA; +// break; +// +// case kFontBengaliScript: +// nFontRTLScript = SCRIPT_BENGALI; +// break; +// +// case kFontTamilScript: +// nFontRTLScript = SCRIPT_TAMIL; +// break; +// +// case kFontTeluguScript: +// nFontRTLScript = SCRIPT_TELUGU; +// break; +// +// case kFontKannadaScript: +// nFontRTLScript = SCRIPT_KANNADA; +// break; +// +// case kFontMalayalamScript: +// nFontRTLScript = SCRIPT_MALAYALAM; +// break; +// +// case kFontSinhaleseScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontBurmeseScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontKhmerScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontThaiScript: +// nFontRTLScript = SCRIPT_THAI; +// break; +// +// case kFontLaotianScript: +// nFontRTLScript = SCRIPT_LAO; +// break; +// +// case kFontGeorgianScript: +// nFontRTLScript = SCRIPT_GEORGIEN; +// break; +// +// case kFontArmenianScript: +// nFontRTLScript = SCRIPT_ARMENIAN; +// break; +// +// case kFontSimpleChineseScript: +// nFontRTLScript = SCRIPT_CHINESE_SIMPLIFIED; +// break; +// +// case kFontTibetanScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontMongolianScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontGeezScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontEastEuropeanRomanScript: +// nFontRTLScript = SCRIPT_EASTEUROPE; +// break; +// +// case kFontVietnameseScript: +// nFontRTLScript = SCRIPT_VIETNAMESE; +// break; +// +// case kFontExtendedArabicScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// case kFontUninterpretedScript: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// +// default: +// nFontRTLScript = SCRIPT_DONTKNOW; +// break; +// } // switch +// } // else +// +// return nFontRTLScript; +//} // GetRTLScriptFromFontScriptCode // ----------------------------------------------------------------------- @@ -306,18 +462,19 @@ if ( hFontList != NULL ) { short nItem = 1; - ImplFontData *pData = NULL; - ImplFontData *pCompare = NULL; + ImplDevFontAttributes pAttributes; + ImplMacFontData *pData = NULL; + ImplMacFontData *pCompare = NULL; ULONG nInsertPos = 0; char pFontFamilyName[kFontFamilyNameLength]; char pFontStyleName[kFontStyleNameLength]; - for ( nItem = 1; - nItem <= nFontListLength; + for ( nItem = 0; + nItem < nFontListLength; nItem++ ) { - pData = new ImplFontData; + pData = new ImplMacFontData(pAttributes,0,0,0); memset( pFontFamilyName, 0, kFontFamilyNameMemSize ); memset( pFontStyleName, 0, kFontStyleNameMemSize ); @@ -353,11 +510,12 @@ pData->meWeight = GetFontWeightFromFontNamesRecord( hFontList[ nItem ] ); - pData->mpSysData = NULL; // System-Data (only GSL) - pData->mnWidth = 0; // Font width in pixels - pData->mnHeight = 0; // Font height in pixels + //pData->mpSysData = (AquaSalSystem*)NULL; // System-Data (only GSL) +// pData->mnWidth = 0; // Font width in pixels +// pData->mnHeight = 0; // Font height in pixels +// pData->SetBitmapSize(0,0); pData->meFamily = FAMILY_DONTKNOW; // Font family - pData->meCharSet = 0; // Font character set +// pData->meCharSet = 0; // Font character set pData->mePitch = PITCH_DONTKNOW; // Font pitch pData->meWidthType = WIDTH_NORMAL; // Font weight type pData->meWeight = WEIGHT_NORMAL; // Font weight @@ -367,11 +525,11 @@ pData->mbDevice = TRUE; // Device font pData->mnQuality = 0; // Font quality - nInsertPos = nItem - 1; + nInsertPos = nItem /*- 1*/; while ( nInsertPos ) { - pCompare = pList->GetObject( nInsertPos - 1 ); + pCompare = (ImplMacFontData*)pList->GetObject( nInsertPos - 1 ); if ( pCompare->maName > pData->maName ) { diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salgdi.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salgdi.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salgdi.cxx 2005-09-09 12:42:09.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salgdi.cxx 2006-06-22 09:23:22.000000000 +0200 @@ -34,648 +34,335 @@ ************************************************************************/ #ifndef _SV_SALCONST_H - #include +#include #endif #ifndef _SV_SALGDI_H - #include +#include #endif #ifndef _SV_SALBMP_HXX - #include +#include #endif -#ifndef _SV_VCLGRAPHICS_H - #include +#ifndef _SV_SALBMP_H +#include #endif #ifndef _SV_SALCOLORUTILS_HXX - #include +#include #endif #ifndef _SV_SALFONTUTILS_HXX - #include -#endif - -#ifndef _SV_SALGDIUTILS_HXX - #include +#include #endif #ifndef _SV_SALRECTANGLEUTILS_HXX - #include +#include #endif -// ======================================================================= +#include // ======================================================================= -SalGraphics::SalGraphics() +ImplMacFontData::ImplMacFontData(const ImplDevFontAttributes& rDFA, + int nFontHeight=0, int macCharSet=0, + int nPitchAndFamily=0) : +ImplFontData(rDFA,0) { - // QuickDraw graph port, offscreen graphic world, and graphic device handle - - InitQD( &maGraphicsData ); - - // GWorld attributes - - InitGWorld( &maGraphicsData ); - - // Regions within a current port - - InitRegions( &maGraphicsData ); - - // Font attributes - - InitFont( &maGraphicsData ); - - // Pen attributes and status - - InitPen( &maGraphicsData ); - - // Brush attributes and status - - InitBrush( &maGraphicsData ); - - // Miscellaneous status flags - - InitStatusFlags( &maGraphicsData ); - -} // SalGraphics Class Constructor - -// ----------------------------------------------------------------------- + +} -SalGraphics::~SalGraphics() +ImplMacFontData::~ImplMacFontData() { - // Release memory taken up by clip region, off-screen - // graph world, and colour graph port - - if ( ( ( maGraphicsData.mbGWorldPixelsCopy == TRUE ) - || ( maGraphicsData.mbGWorldPixelsNew == TRUE ) - ) - && ( maGraphicsData.mhGWorldPixMap != NULL ) - ) - { - DisposePixMap( maGraphicsData.mhGWorldPixMap ); - - maGraphicsData.mhGWorldPixMap = NULL; - } // if - - if ( maGraphicsData.mhClipRgn != NULL ) - { - DisposeRgn( maGraphicsData.mhClipRgn ); - - maGraphicsData.mhClipRgn = NULL; - } // if - - if ( maGraphicsData.mpGWorld != NULL ) - { - DisposeGWorld( maGraphicsData.mpGWorld ); - - maGraphicsData.mpGWorld = NULL; - } // if - - if ( maGraphicsData.mpCGrafPort != NULL ) - { - DisposeGWorld( maGraphicsData.mpCGrafPort ); + +} - maGraphicsData.mpCGrafPort = NULL; - } // if - - // Initialize the rest of the fields to zero - - memset( &maGraphicsData, 0, sizeof(SalGraphicsData) ); -} // SalGraphics Class Destructor +ImplFontData* ImplMacFontData::Clone() const +{ + return NULL; +} -// ======================================================================= +ImplFontEntry* ImplMacFontData::CreateFontInstance( ImplFontSelectData& rFSD ) const +{ + ImplFontEntry* pEntry = new ImplFontEntry( rFSD ); + return pEntry; +} // ======================================================================= -void SalGraphics::GetResolution( long& rDPIX, - long& rDPIY - ) +AquaSalGraphics::AquaSalGraphics() { - long nHRes = 0; - long nVRes = 0; - - maGraphicsData.mnOSStatus = GetGDeviceResolution( &nHRes, &nVRes ); - - if ( maGraphicsData.mnOSStatus == noErr ) - { - rDPIX = nHRes; - rDPIY = nVRes; - } // if -} // SalGraphics::GetResolution + mrView = NULL; + mrWindow = NULL; + mrContext = NULL; + + mrRGBColorSpace = CGColorSpaceCreateDeviceRGB(); + + mrClippingPath = NULL; + mpStdClippingRect = NULL; + mpClippingRect = NULL; + mpNextClippingRect = NULL; + mnClippingRectCount = 0; + + // init colors + for(int i=0; i<3; i++) + { + mpFillColor[i] = 0.0; // white + mpLineColor[i] = 1.0; // black + } + mpFillColor[3] = mpLineColor[3] = 1.0; // opaque colors + + mnPenMode = patCopy; + + mbPrinter = false; + mbVirDev = false; + mbWindow = false; + mbScreen = false; +} // ----------------------------------------------------------------------- -void SalGraphics::GetScreenFontResolution( long& rDPIX, - long& rDPIY - ) -{ - long nHRes = 0; - long nVRes = 0; - - maGraphicsData.mnOSStatus = GetGDeviceResolution( &nHRes, &nVRes ); +AquaSalGraphics::~AquaSalGraphics() +{ + CGColorSpaceRelease( mrRGBColorSpace ); + CGPathRelease( mrClippingPath ); + + delete [] mpStdClippingRect; +} - if ( maGraphicsData.mnOSStatus == noErr ) - { - rDPIX = nHRes; - rDPIY = nVRes; - } // if -} // SalGraphics::GetScreenFontResolution - -// ----------------------------------------------------------------------- +// ======================================================================= -USHORT SalGraphics::GetBitCount() +void AquaSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) { - unsigned short nBitDepth = 0; - - maGraphicsData.mnOSStatus = GetGDeviceBitDepth( &nBitDepth ); - - return nBitDepth; -} // SalGraphics::GetBitCount + // FIXME: get correct resolution from system + rDPIX = 72; // assume unscaled mode (72dpi) + rDPIY = 72; +} // ----------------------------------------------------------------------- -void SalGraphics::ResetClipRegion() +void AquaSalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY ) { - if ( !maGraphicsData.mbWindow ) - { - if ( maGraphicsData.mhClipRgn != NULL ) - { - DisposeRgn( maGraphicsData.mhClipRgn ); - - maGraphicsData.mhClipRgn = NULL; - } // if - } // if - else - { - Rect aClipRect; - short nLeft = 0; - short nTop = 0; - short nRight = 0; - short nBottom = 0; - - if ( maGraphicsData.mhClipRgn == NULL ) - { - maGraphicsData.mhClipRgn = NewRgn(); - } // if - - GetPortBounds( maGraphicsData.mpCGrafPort, &aClipRect); - - nRight = aClipRect.right - aClipRect.left; - nBottom = aClipRect.bottom - aClipRect.top; - - MacSetRectRgn ( maGraphicsData.mhClipRgn, - nLeft, - nTop, - nRight, - nBottom - ); - } // else - - maGraphicsData.mbClipRgnChanged = TRUE; -} // SalGraphics::ResetClipRegion + // FIXME: get correct resolution from system + rDPIX = 72; // assume unscaled mode (72dpi) + rDPIY = 72; +} // ----------------------------------------------------------------------- -void SalGraphics::BeginSetClipRegion( ULONG nRectCount ) +USHORT AquaSalGraphics::GetBitCount() { - if ( maGraphicsData.mhClipRgn != NULL ) - { - DisposeRgn( maGraphicsData.mhClipRgn ); - - maGraphicsData.mhClipRgn = NULL; - } // if -} // SalGraphics::BeginSetClipRegion + return 24; +} // ----------------------------------------------------------------------- -BOOL SalGraphics::UnionClipRegion( long nX, - long nY, - long nWidth, - long nHeight - ) +void AquaSalGraphics::ResetClipRegion() { - RgnHandle hClipRegion = NULL; - BOOL bClipRegionsJoined = FALSE; - - hClipRegion = NewRgn(); - - if ( hClipRegion != NULL ) - { - short nLeft = nX; - short nTop = nY; - short nRight = nX+nWidth; - short nBottom = nY+nHeight; - - MacSetRectRgn ( hClipRegion, - nLeft, - nTop, - nRight, - nBottom - ); + // release old path and indicate no clipping + CGPathRelease( mrClippingPath ); + mrClippingPath = NULL; +} - if ( maGraphicsData.mhClipRgn != NULL ) - { - MacUnionRgn ( maGraphicsData.mhClipRgn, - hClipRegion, - maGraphicsData.mhClipRgn - ); +// ----------------------------------------------------------------------- - maGraphicsData.mnOSStatus = QDErr(); +void AquaSalGraphics::BeginSetClipRegion( ULONG nRectCount ) +{ + // release old path + if( mrClippingPath ) + { + CGPathRelease( mrClippingPath ); + mrClippingPath = NULL; + } + + // allocate rect array or use existing + if( nRectCount < SAL_CLIPRECT_COUNT ) + { + if( !mpStdClippingRect ) + mpStdClippingRect = new CGRect[SAL_CLIPRECT_COUNT]; + mpClippingRect = mpStdClippingRect; + } + else + mpClippingRect = new CGRect[nRectCount]; + + // initialize index and count + mpNextClippingRect = mpClippingRect; + mnClippingRectCount = nRectCount; +} - DisposeRgn( hClipRegion ); - } // if - else - { - maGraphicsData.mhClipRgn = hClipRegion; - } // else +// ----------------------------------------------------------------------- - if ( maGraphicsData.mnOSStatus == noErr ) - { - bClipRegionsJoined = TRUE; - } // if - } // if - - return bClipRegionsJoined; -} // SalGraphics::UnionClipRegion +BOOL AquaSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) +{ + if( nWidth && nHeight ) + { + *mpNextClippingRect++ = CGRectMake (nX, nY, nWidth, nHeight); + } + else + // do not add useless clipping rects but correct the count + mnClippingRectCount--; + + return TRUE; +} // ----------------------------------------------------------------------- -void SalGraphics::EndSetClipRegion() +void AquaSalGraphics::EndSetClipRegion() { - maGraphicsData.mbClipRgnChanged = TRUE; - - if ( maGraphicsData.mhClipRgn == NULL ) - { - ResetClipRegion(); - } -} // SalGraphics::EndSetClipRegion + if( mnClippingRectCount ) + { + mrClippingPath = CGPathCreateMutable(); + if( mnClippingRectCount == 1 ) + CGPathAddRect( mrClippingPath, NULL, *mpClippingRect ); + else + CGPathAddRects( mrClippingPath, NULL, mpClippingRect, mnClippingRectCount ); + mnClippingRectCount = 0; + } + if ( mpClippingRect != mpStdClippingRect ) + { + delete [] mpClippingRect; + mpClippingRect = NULL; + } +} // ----------------------------------------------------------------------- -void SalGraphics::SetLineColor() +void AquaSalGraphics::SetLineColor() { - maGraphicsData.mbPenTransparent = TRUE; -} // SalGraphics::SetLineColor + mpLineColor[3] = 0.0; // set alpha component to 0 +} // ----------------------------------------------------------------------- -void SalGraphics::SetLineColor( SalColor nSalColor ) +void AquaSalGraphics::SetLineColor( SalColor nSalColor ) { - maGraphicsData.mbPenTransparent = FALSE; - maGraphicsData.maPenColor = SALColor2RGBColor( nSalColor ); -} // SalGraphics::SetLineColor + mpLineColor[0] = (float) SALCOLOR_RED(nSalColor) / 255.0; + mpLineColor[1] = (float) SALCOLOR_GREEN(nSalColor) / 255.0; + mpLineColor[2] = (float) SALCOLOR_BLUE(nSalColor) / 255.0; + mpLineColor[3] = 1.0; // opaque +} // ----------------------------------------------------------------------- -void SalGraphics::SetFillColor() +void AquaSalGraphics::SetFillColor() { - maGraphicsData.mbBrushTransparent = TRUE; -} // SalGraphics::SetFillColor + mpFillColor[3] = 0.0; // set alpha component to 0 +} // ----------------------------------------------------------------------- -void SalGraphics::SetFillColor( SalColor nSalColor ) +void AquaSalGraphics::SetFillColor( SalColor nSalColor ) { - RGBColor aRGBColor; - - aRGBColor = SALColor2RGBColor( nSalColor ); - - maGraphicsData.maBrushColor = aRGBColor; - maGraphicsData.mbBrushTransparent = FALSE; -} // SalGraphics::SetFillColor + mpFillColor[0] = (float) SALCOLOR_RED(nSalColor) / 255.0; + mpFillColor[1] = (float) SALCOLOR_GREEN(nSalColor) / 255.0; + mpFillColor[2] = (float) SALCOLOR_BLUE(nSalColor) / 255.0; + mpFillColor[3] = 1.0; // opaque +} // ----------------------------------------------------------------------- -void SalGraphics::SetXORMode( BOOL bSet ) +void AquaSalGraphics::SetXORMode( BOOL bSet ) { - if ( bSet == TRUE ) - { - maGraphicsData.mnPenMode = patXor; - } // if - else - { - maGraphicsData.mnPenMode = patCopy; - } // else -} // SalGraphics::SetXORMode +} // ----------------------------------------------------------------------- -void SalGraphics::SetROPLineColor( SalROPColor nROPColor ) +void AquaSalGraphics::SetROPLineColor( SalROPColor nROPColor ) { - SalColor nSalColor = GetROPSalColor( nROPColor ); - - SetLineColor( nSalColor ); -} // SalGraphics::SetROPLineColor +} // ----------------------------------------------------------------------- -void SalGraphics::SetROPFillColor( SalROPColor nROPColor ) +void AquaSalGraphics::SetROPFillColor( SalROPColor nROPColor ) { - SalColor nSalColor = GetROPSalColor( nROPColor ); - - SetFillColor( nSalColor ); -} // SalGraphics::SetROPFillColor +} // ----------------------------------------------------------------------- -void SalGraphics::DrawPixel( long nX, - long nY - ) +void AquaSalGraphics::drawPixel( long nX, long nY ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics() ) { - RGBColor aPixelRGBColor = maGraphicsData.maPenColor; - - SetCPixel( nX, nY, &aPixelRGBColor ); - - EndGraphics( &maGraphicsData ); - } // if -} // SalGraphics::DrawPixel + EndGraphics(); + } +} // ----------------------------------------------------------------------- -void SalGraphics::DrawPixel( long nX, - long nY, - SalColor nSalColor - ) +void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics() ) { - RGBColor aPixelRGBColor; - - aPixelRGBColor = SALColor2RGBColor( nSalColor ); - - SetCPixel( nX, nY, &aPixelRGBColor ); - - EndGraphics( &maGraphicsData ); - } // if -} // SalGraphics::DrawPixel + EndGraphics(); + } +} // ----------------------------------------------------------------------- -void SalGraphics::DrawLine( long nX1, - long nY1, - long nX2, - long nY2 - ) +void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics() ) { - MoveTo( nX1, nY1 ); - - if ( maGraphicsData.mbPenTransparent == TRUE ) - { - SetBlackForeColor(); - } // if - else - { - RGBColor aPenColor = maGraphicsData.maPenColor; - - RGBForeColor( &aPenColor ); - } // else - - MacLineTo( nX2, nY2 ); - - EndGraphics( &maGraphicsData ); - } // if -} // SalGraphics::DrawLine + CGContextBeginPath( mrContext ); + CGContextMoveToPoint( mrContext, nX1, nY1 ); + CGContextAddLineToPoint( mrContext, nX2, nY2 ); + CGContextDrawPath( mrContext, kCGPathStroke ); + + EndGraphics(); + } +} // ----------------------------------------------------------------------- -void SalGraphics::DrawRect( long nX, - long nY, - long nWidth, - long nHeight - ) +void AquaSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) { - if ( BeginGraphics( &maGraphicsData ) ) + if ( BeginGraphics() ) { - long nEndX = 0; - long nEndY = 0; - RGBColor aBrushColor = maGraphicsData.maBrushColor; - Rect aRect; - - // [ed] 12/1/01 Parameter checks. Limit all of the parameters to fit within - // the current port bounds - - Rect portBounds; - GetPortBounds(maGraphicsData.mpCGrafPort, &portBounds); - - if(nX < portBounds.left) - nX=portBounds.left; - - if(nY < portBounds.top) - nY=portBounds.top; - - if((nHeight > (portBounds.bottom-portBounds.top)-(nY-portBounds.top)) || (nHeight < 0)) - nHeight=portBounds.bottom-portBounds.top-(nY-portBounds.top)-1; - - if((nWidth > (portBounds.right-portBounds.left-(nX-portBounds.left))) || (nHeight < 0)) - nWidth=portBounds.right-portBounds.left-(nX-portBounds.left)-1; - - // Compute the second set of (nX,nY) coordinates - - nEndX = nX + nWidth; - nEndY = nY + nHeight; - - RGBForeColor( &aBrushColor ); - - MoveTo( nX, nY ); - - MacSetRect( &aRect, nX, nY, nEndX, nEndY ); - - if ( maGraphicsData.mbBrushTransparent == TRUE ) - { - MacFrameRect( &aRect ); - } // if + if ( IsBrushTransparent() ) + CGContextStrokeRect (mrContext, CGRectMake (nX, nY, nWidth, nHeight)); else - { - PaintRect( &aRect ); - } // else + CGContextFillRect (mrContext, CGRectMake (nX, nY, nWidth, nHeight)); - EndGraphics( &maGraphicsData ); - } // if -} // SalGraphics::DrawRect + EndGraphics(); + } +} // ----------------------------------------------------------------------- -void SalGraphics::DrawPolyLine( ULONG nPoints, - const SalPoint *pPtAry - ) +void AquaSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) { - if ( ( nPoints > 1 ) && ( pPtAry != NULL ) ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - long nPolyEdges = 0; - PolyHandle hPolygon = NULL; - - SetBlackForeColor(); - - // Construct a polygon - - hPolygon = OpenPoly(); - - if ( hPolygon != NULL ) - { - MoveTo( pPtAry[0].mnX, pPtAry[0].mnY ); - - for ( nPolyEdges = 1; - nPolyEdges < nPoints; - nPolyEdges++ - ) - { - MacLineTo( pPtAry[nPolyEdges].mnX, - pPtAry[nPolyEdges].mnY - ); - } // for - - MacLineTo( pPtAry[0].mnX, - pPtAry[0].mnY - ); - } // if - - ClosePoly(); - - // Did a QD error occur whilst constructing a polygon? - - maGraphicsData.mnOSStatus = QDErr(); - - if ( ( maGraphicsData.mnOSStatus == noErr ) - && ( hPolygon != NULL ) - ) - { - FramePoly( hPolygon ); - - KillPoly( hPolygon ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawPolyLine +} // ----------------------------------------------------------------------- -void SalGraphics::DrawPolygon( ULONG nPoints, - const SalPoint *pPtAry - ) +void AquaSalGraphics::drawPolygon( ULONG nPoints, const SalPoint *pPtAry ) { - if ( ( nPoints > 1 ) && ( pPtAry != NULL ) ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - long nPolyEdges = 0; - PolyHandle hPolygon = NULL; - RGBColor aPolyColor = maGraphicsData.maBrushColor; - - RGBForeColor( &aPolyColor ); - - // Construct a polygon - - hPolygon = OpenPoly(); - - if ( hPolygon != NULL ) - { - MoveTo( pPtAry[0].mnX, pPtAry[0].mnY ); - - for ( nPolyEdges = 1; - nPolyEdges < nPoints; - nPolyEdges++ - ) - { - MacLineTo( pPtAry[nPolyEdges].mnX, - pPtAry[nPolyEdges].mnY - ); - } // for - - MacLineTo( pPtAry[0].mnX, - pPtAry[0].mnY - ); - } // if - - ClosePoly(); - - // Did a QD error occur whilst constructing a polygon? - - maGraphicsData.mnOSStatus = QDErr(); - - if ( ( maGraphicsData.mnOSStatus == noErr ) - && ( hPolygon != NULL ) - ) - { - PaintPoly( hPolygon ); - - KillPoly( hPolygon ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawPolygon +} // ----------------------------------------------------------------------- -void SalGraphics::DrawPolyPolygon( ULONG nPoly, - const ULONG *pPoints, - PCONSTSALPOINT *ppPtAry - ) +void AquaSalGraphics::drawPolyPolygon( ULONG nPoly, const ULONG *pPoints, PCONSTSALPOINT *ppPtAry ) { - if ( ( nPoly > 1 ) && ( ppPtAry != NULL ) && ( ppPtAry != NULL ) ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - RgnHandle hPolyRgn = NULL; - RGBColor aPolyColor = maGraphicsData.maBrushColor; - OSStatus nOSStatus = noErr; - - RGBForeColor( &aPolyColor ); - - // Construct a polygon region - - hPolyRgn = GetPolygonRgn( nPoly, - pPoints, - ppPtAry, - &nOSStatus - ); - - if ( ( hPolyRgn != NULL ) && ( nOSStatus == noErr ) ) - { - MacPaintRgn( hPolyRgn ); - - DisposeRgn( hPolyRgn ); - - nOSStatus = QDErr(); - - hPolyRgn = NULL; - } // if - - maGraphicsData.mnOSStatus = nOSStatus; - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawPolyPolygon +} // ----------------------------------------------------------------------- -sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool AquaSalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { return sal_False; } // ----------------------------------------------------------------------- -sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool AquaSalGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { return sal_False; } // ----------------------------------------------------------------------- -sal_Bool SalGraphics::DrawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, +sal_Bool AquaSalGraphics::drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) { return sal_False; @@ -683,582 +370,96 @@ // ----------------------------------------------------------------------- -void SalGraphics::CopyBits( const SalTwoRect *pPosAry, - SalGraphics *pSrcGraphics - ) +void AquaSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGraphics ) { - if ( ( pPosAry != NULL ) && ( pSrcGraphics != NULL ) ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); - - if ( pDstBitMap != NULL ) - { - Rect aSrcRect; - Rect aDstRect; - Rect aPortBoundsRect; - RgnHandle hMaskRgn = NULL; // Mask Region for QD CopyBits - short nCopyMode = 0; - - SalTwoRect2QDSrcRect( pPosAry, &aSrcRect ); - - SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); - - CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - - nCopyMode = SelectCopyMode( &maGraphicsData ); - - // Now we can call QD CopyBits to copy the bits from source rectangle - // to the destination rectangle - - if ( LockGraphics( pSrcGraphics ) ) - { - const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); - - if ( pSrcBitMap != NULL ) - { - ::CopyBits ( pSrcBitMap, - pDstBitMap, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // if - - UnlockGraphics( pSrcGraphics ); - } // if - else - { - ::CopyBits ( pDstBitMap, - pDstBitMap, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // else - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::CopyBits +} // ----------------------------------------------------------------------- -void SalGraphics::CopyArea( long nDstX, - long nDstY, - long nSrcX, - long nSrcY, - long nSrcWidth, - long nSrcHeight, - USHORT nFlags - ) +void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, USHORT nFlags ) { - if ( BeginGraphics( &maGraphicsData ) ) - { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); - - if ( pDstBitMap != NULL ) - { - short nCopyMode = 0; - long nDstWidth = nSrcWidth; - long nDstHeight = nSrcHeight; - RgnHandle hMaskRgn = NULL; // Mask Region for QD CopyBits - Rect aSrcRect; - Rect aDstRect; - Rect aPortBoundsRect; - - GetQDRect( nSrcX, nSrcY, nSrcWidth, nSrcHeight, &aSrcRect ); - - GetQDRect( nDstX, nDstY, nDstWidth, nDstHeight, &aDstRect ); - - GetPortBounds( maGraphicsData.mpCGrafPort, &aPortBoundsRect ); - - CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - - nCopyMode = SelectCopyMode( &maGraphicsData ); - - // Now we can call QD CopyBits to copy the bits from source rectangle - // to the destination rectangle - - ::CopyBits ( pDstBitMap, - pDstBitMap, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // if - - EndGraphics( &maGraphicsData ); - } // if -} // SalGraphics::CopyArea +} // ----------------------------------------------------------------------- -void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap - ) +void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ) { - if ( pPosAry != NULL ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); - - if ( LockGraphics( pSrcGraphics ) ) - { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); - - if ( pDstBitMap != NULL ) - { - const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); - - if ( pSrcBitMap != NULL ) - { - Rect aSrcRect; - Rect aDstRect; - Rect aPortBoundsRect; - RgnHandle hMaskRgn = NULL; // Mask Region for QD CopyBits - short nCopyMode = 0; - - SalTwoRect2QDSrcRect( pPosAry, &aSrcRect ); - - SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); - - CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - - nCopyMode = SelectCopyMode( &maGraphicsData ); - - // Now we can call QD CopyBits to copy the bits from source rectangle - // to the destination rectangle - - ::CopyBits ( pSrcBitMap, - pDstBitMap, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // if - } // if - - UnlockGraphics( pSrcGraphics ); - - rSalBitmap.ReleaseGraphics( pSrcGraphics ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawBitmap +} // ----------------------------------------------------------------------- -void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nTransparentColor - ) +void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,SalColor nTransparentColor ) { - if ( pPosAry != NULL ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); - - if ( LockGraphics( pSrcGraphics ) ) - { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); - - if ( pDstBitMap != NULL ) - { - const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); - - if ( pSrcBitMap != NULL ) - { - Rect aSrcRect; - Rect aDstRect; - Rect aPortBoundsRect; - RGBColor aBackColor; - RgnHandle hMaskRgn = NULL; // Mask Region for QD CopyBits - short nCopyMode = transparent; - - SalTwoRect2QDSrcRect( pPosAry, &aSrcRect ); - - SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); - - CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - - aBackColor = SALColor2RGBColor( nTransparentColor ); - - RGBBackColor( &aBackColor ); - - // Now we can call QD CopyBits to copy the bits from - // source rectangle to the destination rectangle - - ::CopyBits ( pSrcBitMap, - pDstBitMap, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // if - } // if - - UnlockGraphics( pSrcGraphics ); - - rSalBitmap.ReleaseGraphics( pSrcGraphics ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawBitmap +} // ----------------------------------------------------------------------- -void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap - ) +void AquaSalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap ) { - if ( pPosAry != NULL ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); - - if ( LockGraphics( pSrcGraphics ) ) - { - SalGraphics *pMskGraphics = rTransparentBitmap.GetGraphics(); - - if ( LockGraphics( pMskGraphics ) ) - { - const BitMap *pDstBitMap = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); - - if ( pDstBitMap != NULL ) - { - const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); - - if ( pSrcBitMap != NULL ) - { - const BitMap *pMskBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); - - if ( pMskBitMap != NULL ) - { - Rect aSrcRect; - Rect aDstRect; - Rect aPortBoundsRect; - RgnHandle hMaskRgn = NULL; // Mask Region for QD CopyBits - short nCopyMode = 0; - - SalTwoRect2QDSrcRect( pPosAry, &aSrcRect ); - - SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, - &aPortBoundsRect - ); - - CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - - nCopyMode = SelectCopyMode( &maGraphicsData ); - - // Now we can call QD CopyDeepMask to copy the bits from - // source rectangle to the destination rectangle using the - // the mask bits - - ::CopyDeepMask( pSrcBitMap, - pMskBitMap, - pDstBitMap, - &aSrcRect, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // if - } // if - } // if - - UnlockGraphics( pMskGraphics ); - - rSalBitmap.ReleaseGraphics( pMskGraphics ); - } // if - - UnlockGraphics( pSrcGraphics ); - - rSalBitmap.ReleaseGraphics( pSrcGraphics ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } //if -} // SalGraphics::DrawBitmap +} // ----------------------------------------------------------------------- -void SalGraphics::DrawMask( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nMaskColor - ) +void AquaSalGraphics::drawMask( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nMaskColor ) { - if ( pPosAry != NULL ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - SalGraphics *pSrcGraphics = rSalBitmap.GetGraphics(); - - if ( LockGraphics( pSrcGraphics ) ) - { - const BitMap *pDstBitMap - = GetPortBitMapForCopyBits( maGraphicsData.mpCGrafPort ); - - if ( pDstBitMap != NULL ) - { - const BitMap *pSrcBitMap - = GetPortBitMapForCopyBits( pSrcGraphics->maGraphicsData.mpCGrafPort ); - - if ( pSrcBitMap != NULL ) - { - Rect aSrcRect; - Rect aDstRect; - Rect aPortBoundsRect; - RGBColor aMaskBackColor; - RgnHandle hMaskRgn = NULL; // Mask Region for QD CopyBits - short nCopyMode = 0; - - SalTwoRect2QDSrcRect( pPosAry, &aSrcRect ); - - SalTwoRect2QDDstRect( pPosAry, &aDstRect ); - - GetPortBounds( pSrcGraphics->maGraphicsData.mpCGrafPort, &aPortBoundsRect ); - - CheckRectBounds( &aPortBoundsRect, &aSrcRect, &aDstRect ); - - aMaskBackColor = SALColor2RGBColor( nMaskColor ); - - RGBBackColor( &aMaskBackColor ); - - nCopyMode = SelectCopyMode( &maGraphicsData ); - - // Now we can call QD CopyDeepMask to copy the bits from - // source rectangle to the destination rectangle using the - // the mask bits - - ::CopyDeepMask( pSrcBitMap, - pSrcBitMap, - pDstBitMap, - &aSrcRect, - &aSrcRect, - &aDstRect, - nCopyMode, - hMaskRgn - ); - } // if - } // if - - UnlockGraphics( pSrcGraphics ); - - rSalBitmap.ReleaseGraphics( pSrcGraphics ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawMask +} // ----------------------------------------------------------------------- -SalBitmap* SalGraphics::GetBitmap( long nX, - long nY, - long nDX, - long nDY - ) +SalBitmap* AquaSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) { - fprintf( stderr, - "<> SalGraphics::GetBitmap not yet implemented!\n" - ); + fprintf( stderr, "<> SalGraphics::GetBitmap not yet implemented!\n" ); return NULL; -} // SalGraphics::GetBitmap +} // ----------------------------------------------------------------------- -SalColor SalGraphics::GetPixel( long nX, - long nY - ) +SalColor AquaSalGraphics::getPixel( long nX, long nY ) { - RGBColor aRGBColor; SalColor nSalColor = 0; - short aHorizontalCoor = (short)nX; - short aVerticalCoor = (short)nY; - - GetCPixel( aHorizontalCoor, aVerticalCoor, &aRGBColor ); - - nSalColor = RGBColor2SALColor ( &aRGBColor ); - return nSalColor; -} // SalGraphics::GetPixel +} // ----------------------------------------------------------------------- -void SalGraphics::Invert( long nX, - long nY, - long nWidth, - long nHeight, - SalInvert nFlags - ) +void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) { - // Implementation not yet complete - - if ( BeginGraphics( &maGraphicsData ) ) - { - short left = (short)nX; - short top = (short)nY; - short right = (short)nX + (short)nWidth; - short bottom = (short)nY + (short)nHeight; - Rect aRect; - - MacSetRect( &aRect, left, top, right, bottom ); - - ::MacInvertRect( &aRect ); - - EndGraphics( &maGraphicsData ); - } // if -} // SalGraphics::Invert +} // ----------------------------------------------------------------------- -void SalGraphics::Invert( ULONG nPoints, - const SalPoint* pPtAry, - SalInvert nSalFlags - ) +void AquaSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) { - // Implementation not yet complete - - if ( ( pPtAry != NULL ) && ( nPoints > 1 ) ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - unsigned long nPolyEdges = nPoints; - unsigned long nPolyEdgeIndex = 0; - short nX = 0; - short nY = 0; - short nPenMode = patXor; - RgnHandle hPolyRgn = NULL; - CGrafPtr pCGrafPort = maGraphicsData.mpCGrafPort; - Pattern aPenPatGray; - - hPolyRgn = NewRgn (); - - if ( hPolyRgn != NULL ) - { - GetQDGlobalsGray( &aPenPatGray ); - - PenPat( &aPenPatGray ); - - SetPortPenMode( pCGrafPort, nPenMode ); - - // Begin region construction - - OpenRgn(); - - // Begin polygon regin construction - - MoveTo( pPtAry[0].mnX, pPtAry[0].mnY ); - - for ( nPolyEdgeIndex = 1; - nPolyEdgeIndex < nPolyEdges; - nPolyEdgeIndex++ - ) - { - MacLineTo( pPtAry[nPolyEdgeIndex].mnX, - pPtAry[nPolyEdgeIndex].mnY - ); - } // for - - MacLineTo( pPtAry[0].mnX, pPtAry[0].mnY ); - - // End polygon region construction - - CloseRgn( hPolyRgn ); - - // End region construction - - maGraphicsData.mnOSStatus = QDErr(); - - if ( maGraphicsData.mnOSStatus == noErr ) - { - MacInvertRgn( hPolyRgn ); - - DisposeRgn( hPolyRgn ); - - hPolyRgn = NULL; - } // if - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::Invert +} // ----------------------------------------------------------------------- -BOOL SalGraphics::DrawEPS( long nX, - long nY, - long nWidth, - long nHeight, - void* pPtr, - ULONG nSize - ) +BOOL AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) { - fprintf( stderr, - "<> SalGraphics::DrawEPS not yet implemented!\n" - ); + fprintf( stderr, "<> SalGraphics::DrawEPS not yet implemented!\n" ); return FALSE; -} // SalGraphics::DrawEPS +} // ----------------------------------------------------------------------- -void SalGraphics::SetTextColor( SalColor nSalColor ) +void AquaSalGraphics::SetTextColor( SalColor nSalColor ) { - maGraphicsData.maFontColor = SALColor2RGBColor( nSalColor ); -} // SalGraphics::SetTextColor +} // ----------------------------------------------------------------------- -USHORT SalGraphics::SetFont( ImplFontSelectData* pFont ) +USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pFont ) { - fprintf( stderr, - "<> SalGraphics::SetFont not yet implemented!\n" - ); + fprintf( stderr, "<> SalGraphics::SetFont not yet implemented!\n" ); return 0; -} // SalGraphics::SetFont +} // ----------------------------------------------------------------------- -long SalGraphics::GetCharWidth( sal_Unicode nChar1, - sal_Unicode nChar2, - long* pWidthAry - ) +long AquaSalGraphics::GetCharWidth( sal_Unicode nChar1, sal_Unicode nChar2, long* pWidthAry ) { // Stub code @@ -1280,179 +481,285 @@ ); return 1; -} // SalGraphics::GetCharWidth +} // ----------------------------------------------------------------------- -void SalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) +void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) { + static int first=1; // Stub Code pMetric->mnAscent = 10; pMetric->mnDescent = 10; - fprintf( stderr, - "<> SalGraphics::GetFontMetric not yet implemented!\n" - ); -} // SalGraphics::GetFontMetric + if(first) + { + first = 0; + fprintf( stderr, "<> SalGraphics::GetFontMetric not yet implemented!\n"); + } +} // ----------------------------------------------------------------------- -ULONG SalGraphics::GetKernPairs( ULONG nPairs, - ImplKernPairData* pKernPairs - ) +ULONG AquaSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) { fprintf( stderr, "<> SalGraphics::GetKernPairs not yet implemented!\n" ); return 0; -} // SalGraphics::GetKernPairs +} // ----------------------------------------------------------------------- -ULONG SalGraphics::GetFontCodeRanges( sal_uInt32* pCodePairs ) const +ULONG AquaSalGraphics::GetFontCodeRanges( sal_uInt32* pCodePairs ) const { - // TODO: try to get the necessary info from Aqua return 0; -} // SalGraphics::GetFontCodeRanges +} // ----------------------------------------------------------------------- -void SalGraphics::GetDevFontList( ImplDevFontList *pList ) +void AquaSalGraphics::GetDevFontList( ImplDevFontList *pList ) { - if ( pList != NULL ) + if ( pList != NULL ) { SalData *pSalData = GetSalData(); if ( pSalData != NULL ) { FontList *pMacFontList = NULL; - ImplFontData *pDevFontData = NULL; - ImplFontData *pSysFontData = NULL; - - if ( pSalData->mpFontList != NULL ) + ImplMacFontData *pDevFontData = NULL; + ImplMacFontData *pSysFontData = NULL; + + if ( pSalData->mpFontList == NULL ) { pSalData->mpFontList = GetMacFontList(); - + pMacFontList = pSalData->mpFontList; - pSysFontData = pMacFontList->First(); - + pSysFontData = (ImplMacFontData*)pMacFontList->First(); + while ( pSysFontData != NULL ) { - pDevFontData = new ImplFontData; - - pDevFontData->mpSysData = pSysFontData; + ImplDevFontAttributes pAttributes; + pDevFontData = new ImplMacFontData(pAttributes,0,0,0); + + // pDevFontData->mpSysData = pSysFontData; pDevFontData->maName = pSysFontData->maName; pDevFontData->maStyleName = pSysFontData->maStyleName; - pDevFontData->mnWidth = pSysFontData->mnWidth; - pDevFontData->mnHeight = pSysFontData->mnHeight; + // pDevFontData->mnWidth = pSysFontData->mnWidth; + // pDevFontData->mnHeight = pSysFontData->mnHeight; pDevFontData->meFamily = pSysFontData->meFamily; - pDevFontData->meCharSet = pSysFontData->meCharSet; + // pDevFontData->meCharSet = pSysFontData->meCharSet; pDevFontData->meScript = pSysFontData->meScript; pDevFontData->mePitch = pSysFontData->mePitch; pDevFontData->meWidthType = pSysFontData->meWidthType; pDevFontData->meWeight = pSysFontData->meWeight; pDevFontData->meItalic = pSysFontData->meItalic; pDevFontData->meType = pSysFontData->meType; - pDevFontData->mnVerticalOrientation = pSysFontData->mnVerticalOrientation; + // pDevFontData->mnVerticalOrientation = pSysFontData->mnVerticalOrientation; pDevFontData->mbOrientation = pSysFontData->mbOrientation; pDevFontData->mbDevice = pSysFontData->mbDevice; pDevFontData->mnQuality = pSysFontData->mnQuality; - + pList->Add( pDevFontData ); - - pSysFontData = pMacFontList->Next(); - } // while - } // if - } // if - } // if -} // SalGraphics::GetDevFontList + + pSysFontData = (ImplMacFontData*)pMacFontList->Next(); + } + } + } + } +} // ----------------------------------------------------------------------- -void SalGraphics::DrawText( long nX, - long nY, - const xub_Unicode *pStr, - xub_StrLen nLen - ) +void AquaSalGraphics::DrawText( long nX, long nY, const xub_Unicode *pStr, xub_StrLen nLen ) { - // The implementation is not yet complete - - if ( ( pStr != NULL ) && ( nLen > 0 ) ) - { - if ( BeginGraphics( &maGraphicsData ) ) - { - ByteString aByteString( pStr, - nLen, - gsl_getSystemTextEncoding() - ); - - const char *pTextBuffer = aByteString.GetBuffer(); - - if ( pTextBuffer != NULL ) - { - short nFirstByte = 0; - short nByteCount = nLen; - const RGBColor aFontForeColor = maGraphicsData.maFontColor; - - RGBForeColor( &aFontForeColor ); - - MoveTo( nX, nY ); - - ::MacDrawText( pTextBuffer, nFirstByte, nByteCount ); - } // if - - EndGraphics( &maGraphicsData ); - } // if - } // if -} // SalGraphics::DrawText +} // ----------------------------------------------------------------------- -void SalGraphics::DrawTextArray( long nX, - long nY, - const xub_Unicode* pStr, - xub_StrLen nLen, - const long* pDXAry - ) +void AquaSalGraphics::DrawTextArray( long nX, long nY, const xub_Unicode* pStr, xub_StrLen nLen, const long* pDXAry ) { fprintf( stderr, "<> SalGraphics::DrawTextArray not yet implemented!\n" ); -} // SalGraphics::DrawTextArray +} // ----------------------------------------------------------------------- -BOOL SalGraphics::GetGlyphBoundRect( xub_Unicode cChar, - long* pX, - long* pY, - long* pWidth, - long* pHeight - ) +BOOL AquaSalGraphics::GetGlyphBoundRect( xub_Unicode cChar, long* pX, long* pY, long* pWidth, long* pHeight ) { fprintf( stderr, "<> SalGraphics::GetGlyphBoundRect not yet implemented!\n" ); return FALSE; -} // SalGraphics::GetGlyphBoundRect +} + +// ----------------------------------------------------------------------- + +SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ) +{ + return sal_False; +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ) +{ + return sal_False; +} // ----------------------------------------------------------------------- -ULONG SalGraphics::GetGlyphOutline( xub_Unicode cChar, - USHORT** ppPolySizes, - SalPoint** ppPoints, - BYTE** ppFlags +BOOL AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, + ImplFontData* pFont, + long* pGlyphIDs, + sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter ) { - fprintf( stderr, - "<> SalGraphics::GetGlyphOutline not yet implemented!\n" - ); + return sal_False; +} - return 0; -} // SalGraphics::GetGlyphOutline +// ----------------------------------------------------------------------- -// ======================================================================= +const void* AquaSalGraphics::GetEmbedFontData( ImplFontData* pFont, + const sal_Unicode* pUnicodes, + sal_Int32* pWidths, + FontSubsetInfo& rInfo, + long* pDataLen ) +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +long AquaSalGraphics::GetGraphicsWidth() const +{ + return 0; +} + +// ----------------------------------------------------------------------- + +void AquaSalGraphics::FreeEmbedFontData( const void* pData, long nDataLen ) +{ + +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& ) +{ + return sal_False; +} + +// ----------------------------------------------------------------------- + +void AquaSalGraphics::GetDevFontSubstList( OutputDevice* ) +{ + +} + +// ----------------------------------------------------------------------- + +void AquaSalGraphics::DrawServerFontLayout( const ServerFontLayout& ) +{ + +} + +// ----------------------------------------------------------------------- + +const std::map< sal_Unicode, sal_Int32 >* AquaSalGraphics::GetFontEncodingVector( ImplFontData* pFont, + const std::map< sal_Unicode, + rtl::OString >** ppNonEncoded ) +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +USHORT AquaSalGraphics::SetFont( ImplFontSelectData*, int nFallbackLevel ) +{ + return 0; +} + +// ----------------------------------------------------------------------- + +ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const +{ + return NULL; +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::drawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + SalControlHandle& rControlHandle, + rtl::OUString aCaption ) +{ + return sal_False; +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + SalControlHandle& rControlHandle, + BOOL& rIsInside ) +{ + +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + SalControlHandle& rControlHandle, + rtl::OUString aCaption ) +{ + return sal_False; +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + SalControlHandle& rControlHandle, + rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ) +{ + return sal_False; +} + +// ----------------------------------------------------------------------- + +BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +{ + return sal_False; +} + +// ----------------------------------------------------------------------- -// ======================================================================= diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salgdiutils.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salgdiutils.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salgdiutils.cxx 2005-09-09 12:42:31.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salgdiutils.cxx 2006-06-22 09:24:16.000000000 +0200 @@ -33,551 +33,104 @@ * ************************************************************************/ -#ifndef _SV_SALGDIUTILS_HXX - #include +#ifndef _SV_SALGDI_H +#include #endif -// ======================================================================= +// ---------------------------------------------------------------------- -// ======================================================================= - -short SelectCopyMode ( const SalGraphicsDataPtr pSalGraphicsData ) -{ - short nCopyMode = 0; - - if ( pSalGraphicsData->mnPenMode == patCopy ) - { - nCopyMode = srcCopy; - } // if - else - { - nCopyMode = srcXor; - } // else - - return nCopyMode; -} // SelectCopyMode - -// ======================================================================= - -// ======================================================================= - -RgnHandle GetPolygonRgn ( const unsigned long nPolyCount, - const unsigned long *pPoints, - PCONSTSALPOINT *ppPtAry, - OSStatus *rQDStatus - ) +void AquaSalGraphics::SetWindowGraphics( CarbonViewRef rView, CarbonWindowRef rWindow, bool bScreenCompatible ) { - RgnHandle hSrcRgnA = NULL; - - hSrcRgnA = NewRgn(); - - if ( hSrcRgnA != NULL ) - { - RgnHandle hSrcRgnB = NULL; - - hSrcRgnB = NewRgn(); - - if ( hSrcRgnB != NULL ) - { - unsigned short nPolyEdgeIndex = 0; - unsigned short nPolyIndex = 0; - unsigned short nPolyEdges = 0; - - for ( nPolyIndex = 0; - nPolyIndex < nPolyCount; - nPolyIndex++ - ) - { - const SalPoint *pPtAry = ppPtAry[nPolyIndex]; - - nPolyEdges = pPoints[nPolyIndex]; - - // Begin region construction - - OpenRgn(); - - // Begin polygon construction - - MoveTo( pPtAry[0].mnX, pPtAry[0].mnY ); - - for ( nPolyEdgeIndex = 1; - nPolyEdgeIndex < nPolyEdges; - nPolyEdgeIndex++ - ) - { - MacLineTo( pPtAry[nPolyEdgeIndex].mnX, - pPtAry[nPolyEdgeIndex].mnY - ); - } // for - - MacLineTo( pPtAry[0].mnX, pPtAry[0].mnY ); - - // End polygon construction - - CloseRgn( hSrcRgnB ); - - // End region construction - - *rQDStatus = QDErr(); - - if ( *rQDStatus == noErr ) - { - if ( nPolyIndex == 0 ) - { - MacCopyRgn( hSrcRgnB, hSrcRgnA ); - } // if - else - { - MacXorRgn( hSrcRgnA, hSrcRgnB, hSrcRgnA ); - } // else - } // if - } // for - - DisposeRgn( hSrcRgnB ); - - *rQDStatus = QDErr(); - - if ( *rQDStatus != noErr ) - { - DisposeRgn( hSrcRgnA ); - - hSrcRgnA = NULL; - } - - hSrcRgnB = NULL; - } // if - } // if - - return hSrcRgnA; -} // GetPolygonRgn - -// ======================================================================= - -// ======================================================================= - -OSStatus GetGDeviceBitDepth ( unsigned short *rGDeviceBitDepth ) -{ - GDPtr pGDevice = NULL; - OSStatus nOSStatus = noErr; - - pGDevice = *GetGDevice ( ); - - nOSStatus = QDErr(); - - if ( ( pGDevice != NULL ) && ( nOSStatus == noErr ) ) - { - *rGDeviceBitDepth = GetPixDepth( pGDevice->gdPMap ); - } // if - - return nOSStatus; -} // GetGDeviceBitDepth - -// ----------------------------------------------------------------------- - -OSStatus GetGDeviceResolution ( long *rGDeviceHRes, - long *rGDeviceVRes - ) -{ - GDPtr pGDevice = NULL; - OSStatus nOSStatus = noErr; - - pGDevice = *GetGDevice ( ); - - nOSStatus = QDErr(); - - if ( ( pGDevice != NULL ) && ( nOSStatus == noErr ) ) - { - long nGDeviceTop = pGDevice->gdRect.top; - long nGDeviceLeft = pGDevice->gdRect.left; - long nGDeviceBottom = pGDevice->gdRect.bottom; - long nGDeviceRight = pGDevice->gdRect.right; - - // From the current GDevice get its horizontal resolution - - *rGDeviceHRes = abs( nGDeviceRight - nGDeviceLeft ); - - // From the current GDevice get its vertical resolution - - *rGDeviceVRes = abs( nGDeviceBottom - nGDeviceTop ); - } // if - - return nOSStatus; -} // GetGDeviceResolution - -// ======================================================================= - -// ======================================================================= - -BOOL LockGraphics ( SalGraphics *rSalGraphics ) -{ - BOOL bCGrafPortLocked = FALSE; - - // [ed] 12/16/01 Don't lock QDView grafports. - - if ( ( rSalGraphics != NULL ) - && ( rSalGraphics->maGraphicsData.mpCGrafPort != NULL ) - && ( rSalGraphics->maGraphicsData.mbWindow != TRUE) - ) - { - rSalGraphics->maGraphicsData.mnOSStatus - = LockPortBits( rSalGraphics->maGraphicsData.mpCGrafPort ); - - if ( rSalGraphics->maGraphicsData.mnOSStatus == noErr ) - { - rSalGraphics->maGraphicsData.mhGWorldPixMap - = GetPortPixMap( rSalGraphics->maGraphicsData.mpCGrafPort ); - - rSalGraphics->maGraphicsData.mnOSStatus = QDErr(); - - bCGrafPortLocked = TRUE; - } // if - } // if - - return bCGrafPortLocked; -} // LockGraphics - -// ----------------------------------------------------------------------- - -BOOL UnlockGraphics ( SalGraphics *rSalGraphics ) -{ - BOOL bCGrafPortUnlocked = FALSE; - - if ( ( rSalGraphics->maGraphicsData.mpCGrafPort != NULL ) - && ( rSalGraphics->maGraphicsData.mnOSStatus == noErr ) - ) - { - rSalGraphics->maGraphicsData.mnOSStatus - = UnlockPortBits( rSalGraphics->maGraphicsData.mpCGrafPort ); - - bCGrafPortUnlocked = TRUE; - } // if - - return bCGrafPortUnlocked; -} // UnlockGraphics - -// ======================================================================= - -// ======================================================================= - -BOOL BeginGraphics ( SalGraphicsDataPtr rSalGraphicsData ) -{ - BOOL bStartGraphics = FALSE; - - // Previous to entering this function, was there a QD error? - - if ( rSalGraphicsData->mnOSStatus == noErr ) - { - // Get the graph port and lock focus on it - - if ( rSalGraphicsData->mbWindow == TRUE ) - { - rSalGraphicsData->mpCGrafPort - = VCLGraphics_LockFocusCGrafPort( rSalGraphicsData->mhDC ); - } // if - - // [ed] 12/3/01 Check to make sure we've got a valid graph port - - if(rSalGraphicsData->mpCGrafPort && !IsValidPort(rSalGraphicsData->mpCGrafPort)) - { - fprintf(stderr, "Invalid port in BeginGraphics()\n"); + mrView = rView; + mrWindow = rWindow; + mbScreen = bScreenCompatible; + + mbWindow = true; + mbPrinter = false; + mbVirDev = false; +} + +void AquaSalGraphics::SetPrinterGraphics( CarbonViewRef rView, bool bScreenCompatible ) +{ + mrView = rView; + mbScreen = bScreenCompatible; + + mbWindow = false; + mbPrinter = true; + mbVirDev = false; +} + +void AquaSalGraphics::SetVirDevGraphics( CarbonViewRef rView, bool bScreenCompatible ) +{ + mrView = rView; + mbScreen = bScreenCompatible; + + mbWindow = false; + mbPrinter = false; + mbVirDev = true; +} + +// ---------------------------------------------------------------------- + +bool AquaSalGraphics::BeginGraphics () +{ + if( mrWindow != NULL ) + { + SetPortWindowPort (mrWindow); + if( noErr == QDBeginCGContext (GetWindowPort (mrWindow), &mrContext)) + { + // switch to HIView coordinate system, i.e. (0,0) is top-left + Rect windowBounds; + GetWindowPortBounds ( mrWindow, &windowBounds); + /* + fprintf(stderr, "windowPortBounds: left: %d top: %d width: %d height: %d\n", + windowBounds.left, windowBounds.top, + windowBounds.right - windowBounds.left, + windowBounds.bottom - windowBounds.top); + */ + CGContextTranslateCTM (mrContext, 0, windowBounds.bottom - windowBounds.top); + CGContextScaleCTM (mrContext, 1.0, -1.0); + + // set up clipping area + if( mrClippingPath ) + { + CGContextBeginPath( mrContext ); // discard any existing path + CGContextAddPath( mrContext, mrClippingPath ); // set the current path to the clipping path + CGContextClip( mrContext ); // use it for clipping + } + + // set RGB colorspace and line and fill colors + CGContextSetFillColorSpace( mrContext, mrRGBColorSpace ); + CGContextSetFillColor( mrContext, mpFillColor ); + CGContextSetStrokeColorSpace( mrContext, mrRGBColorSpace ); + CGContextSetStrokeColor( mrContext, mpLineColor ); + + return true; } - - if ( ( rSalGraphicsData->mpCGrafPort != NULL ) && IsValidPort(rSalGraphicsData->mpCGrafPort)) + else { - // Get the port's pen attributes - - GetPortPenPixPat( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mhPortPenPattern - ); - - GetPortPenSize( rSalGraphicsData->mpCGrafPort, - &(rSalGraphicsData->maPortPenSize) - ); - - GetPortPenLocation( rSalGraphicsData->mpCGrafPort, - &(rSalGraphicsData->maPortPenLocation) - ); - - rSalGraphicsData->mnPortPenMode - = GetPortPenMode( rSalGraphicsData->mpCGrafPort ); - - // Set the port pen mode to its new value - - SetPortPenMode( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mnPenMode - ); - - // Set to the current offscreen world for Mac OS X - // only as everything is written to GWorld here - - SetGWorld( rSalGraphicsData->mpCGrafPort, NULL ); - - // Was there a QD error when we set the GWorld? - - rSalGraphicsData->mnOSStatus = QDErr(); - - if ( rSalGraphicsData->mnOSStatus == noErr ) - { - // Get the PixMap associated with this particular CGrafPort - - rSalGraphicsData->mhGWorldPixMap - = GetPortPixMap( rSalGraphicsData->mpCGrafPort ); - - rSalGraphicsData->mnOSStatus = QDErr(); - - if ( ( rSalGraphicsData->mnOSStatus == noErr ) - && ( rSalGraphicsData->mhGWorldPixMap != NULL ) - ) - { - // Get the current PixMap state, i.e., - // is it the memory associated with this - // PixMap is marked to be moved? - - rSalGraphicsData->mnGWorldFlags - = GetPixelsState( rSalGraphicsData->mhGWorldPixMap ); - - if ( rSalGraphicsData->mnGWorldFlags == noErr ) - { - // if the PixMap is a relocatable block, - // then mark it as locked. - - // [ed] 12/16/01 Don't lock pixels of QDViews - - if ( !rSalGraphicsData->mbWindow && - LockPixels( rSalGraphicsData->mhGWorldPixMap ) ) - { - rSalGraphicsData->mbGWorldPixelsLocked = TRUE; - } // if - else - { - rSalGraphicsData->mbGWorldPixelsLocked = FALSE; - } // else - - // Set background color to white on this GWorld - - SetWhiteBackColor(); - - // Set foreground color to black on this GWorld - - SetBlackForeColor(); - - // If we get here then we may safely start drawing - // to our GWorld - - bStartGraphics = TRUE; - - // Now begin to set the clip region - - if ( ( rSalGraphicsData->mbClipRgnChanged == TRUE ) - && ( rSalGraphicsData->mhClipRgn != NULL ) - ) - { - // Set to the clip region - - SetClip( rSalGraphicsData->mhClipRgn ); - - // Was there an error after setting the clip region? - - rSalGraphicsData->mnOSStatus = QDErr(); - - // Set the new status flag for our port - - rSalGraphicsData->mbClipRgnChanged = FALSE; - } // if - } // if - else - { - // [ed] 12/13/01 GWord graphics error flags set - - fprintf(stderr, "GWorld graphics flags indicate error in BeginGraphics()\n"); - } - } // if - else - { - // [ed] 12/13/01 GWorld graphics has no PixMap handle - - fprintf(stderr, "Valid GWorld, but no pixmap in BeginGraphics()\n"); - } - } // if - else - { - // [ed] 12/13/01 Error checking - - fprintf(stderr, "QuickDraw error in BeginGraphics()\n"); - } - } // if - } // if - - return bStartGraphics; -} // BeginGraphics - -// ----------------------------------------------------------------------- - -BOOL EndGraphics ( SalGraphicsDataPtr rSalGraphicsData ) -{ - BOOL bEndGraphics = FALSE; - - // Previous to entering this function, was there a QD error? - - if ( rSalGraphicsData->mnOSStatus == noErr ) + //fprintf(stderr, "QDBeginCGContext() error\n"); + return false; + } + } + else { - // Unlock our CGrafPort - - if ( ( rSalGraphicsData->mhGWorldPixMap != NULL ) - && ( rSalGraphicsData->mnGWorldFlags == noErr ) - && ( rSalGraphicsData->mbGWorldPixelsLocked ) - ) - { - // Set pixel state to its original state - // thus unlocking the PixMap - - SetPixelsState( rSalGraphicsData->mhGWorldPixMap, - rSalGraphicsData->mnGWorldFlags - ); - - rSalGraphicsData->mnOSStatus = QDErr(); - rSalGraphicsData->mbGWorldPixelsLocked = FALSE; - } // if - - // Reset the port's pen to its original attributes - - /* - - [ed] 12/19/01 Apparently the pen pattern handle we retrieved - in BeginGraphics() is invalid by this point on OS 10.1. - By not attempting to revert the pen pattern, we can avoid - seg faulting the next time we draw into the port. - - +++ Is it necessary to reset the pen pattern? - - SetPortPenPixPat( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mhPortPenPattern - ); - */ - - SetPortPenSize( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->maPortPenSize - ); - - SetPortPenMode( rSalGraphicsData->mpCGrafPort, - rSalGraphicsData->mnPortPenMode - ); - - // When we get here then the QD port must have changed(?) - // [ed] 12/19/01 This will commit the changes to reset the pen size - // and pen mode. - - PortChanged( rSalGraphicsData->mpCGrafPort ); - - // [ed] 6/1/02 Always flush the buffer, regardless of whether we're in - // a debug or non-debug build. - - // [ed] 12/19/01 Flush the QuickDraw buffer immediately. This helps - // with VCL debugging. - - if(QDIsPortBuffered(rSalGraphicsData->mpCGrafPort)) - QDFlushPortBuffer( rSalGraphicsData->mpCGrafPort, NULL ); - - // Unlock focus on the current NSView - - if ( rSalGraphicsData->mbWindow == TRUE ) - { - VCLGraphics_UnLockFocusCGrafPort( rSalGraphicsData->mhDC ); - } // if - - // Was there an error after flushing the QuickDraw buffer - - rSalGraphicsData->mnOSStatus = QDErr(); - - // Set the new status flag for clip region - - rSalGraphicsData->mbClipRgnChanged = FALSE; - - // If we get here then we have safely written to our GWorld - - bEndGraphics = TRUE; - } // if - - return bEndGraphics; -} // EndGraphics - -// ======================================================================= - -// ======================================================================= - -void InitBrush ( SalGraphicsDataPtr rSalGraphicsData ) -{ - rSalGraphicsData->mbBrushTransparent = FALSE; - rSalGraphicsData->maBrushColor = GetBlackColor(); -} // InitBrush - -// ----------------------------------------------------------------------- - -void InitFont ( SalGraphicsDataPtr rSalGraphicsData ) -{ - rSalGraphicsData->maFontColor = GetBlackColor(); - rSalGraphicsData->mnFontID = kFontIDGeneva; - rSalGraphicsData->mnFontSize = 10; - rSalGraphicsData->mnFontStyle = normal; -} // InitFont - -// ----------------------------------------------------------------------- - -void InitGWorld ( SalGraphicsDataPtr rSalGraphicsData ) -{ - rSalGraphicsData->mbGWorldPixelsLocked = FALSE; - rSalGraphicsData->mbGWorldPixelsCopy = FALSE; - rSalGraphicsData->mbGWorldPixelsNew = FALSE; - rSalGraphicsData->mnGWorldFlags = noErr; - rSalGraphicsData->mhGWorldPixMap = NULL; -} // InitGWorld - -// ----------------------------------------------------------------------- - -void InitPen ( SalGraphicsDataPtr rSalGraphicsData ) -{ - long nMacOSPointSize = sizeof(MacOSPoint); - - rSalGraphicsData->maPenColor = GetBlackColor(); - rSalGraphicsData->mnPenMode = patCopy; - rSalGraphicsData->mbPenTransparent = FALSE; - - rSalGraphicsData->mnPortPenMode = patCopy; - rSalGraphicsData->mhPortPenPattern = NULL; - - memset( &(rSalGraphicsData->maPortPenSize), 0, nMacOSPointSize ); - memset( &(rSalGraphicsData->maPortPenLocation), 0, nMacOSPointSize ); -} // InitPen + //fprintf(stderr, "BeginGraphics: mhWindow == NULL !\n"); + return false; + } +} // ----------------------------------------------------------------------- -void InitQD ( SalGraphicsDataPtr rSalGraphicsData ) +bool AquaSalGraphics::EndGraphics () { - rSalGraphicsData->mhDC = NULL; - rSalGraphicsData->mpCGrafPort = NULL; - rSalGraphicsData->mpGWorld = NULL; -} // InitQD - -// ----------------------------------------------------------------------- - -void InitRegions ( SalGraphicsDataPtr rSalGraphicsData ) -{ - rSalGraphicsData->mhClipRgn = NULL; - rSalGraphicsData->mbClipRgnChanged = FALSE; -} // InitRegions + if( mrContext != NULL && mrWindow != NULL ) + { + CGContextSynchronize(mrContext); + QDEndCGContext (GetWindowPort(mrWindow), &mrContext); + } + return true; +} // ----------------------------------------------------------------------- -void InitStatusFlags ( SalGraphicsDataPtr rSalGraphicsData ) -{ - rSalGraphicsData->mbPrinter = FALSE; - rSalGraphicsData->mbVirDev = FALSE; - rSalGraphicsData->mbWindow = FALSE; - rSalGraphicsData->mbScreen = FALSE; - rSalGraphicsData->mnOSStatus = noErr; -} // InitStatusFlags - -// ======================================================================= - -// ======================================================================= - diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salmathutils.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salmathutils.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salmathutils.cxx 2005-09-09 12:42:46.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salmathutils.cxx 2005-11-27 10:48:38.000000000 +0100 @@ -37,6 +37,8 @@ #include #endif +#include + // ======================================================================= // ======================================================================= diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salogl.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salogl.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salogl.cxx 2005-09-09 12:43:03.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salogl.cxx 2006-02-27 22:33:54.000000000 +0100 @@ -36,57 +36,85 @@ #ifndef _SV_SALGDI_HXX #include #endif +#ifndef _SV_SALGDI_H +#include +#endif #ifndef _SV_SALOGL_HXX #include #endif +#ifndef _SV_SALOGL_H +#include +#endif // ======================================================================== // Initialize static data members -VCLVIEW SalOpenGL::mhOGLLastDC = 0; -ULONG SalOpenGL::mnOGLState = OGL_STATE_UNLOADED; +CarbonViewRef AquaSalOpenGL::mhOGLLastDC = 0; +ULONG AquaSalOpenGL::mnOGLState = OGL_STATE_UNLOADED; // ======================================================================== -SalOpenGL::SalOpenGL( SalGraphics* pGraphics ) +AquaSalOpenGL::AquaSalOpenGL( SalGraphics* pGraphics ) { } // ------------------------------------------------------------------------ -SalOpenGL::~SalOpenGL() +AquaSalOpenGL::~AquaSalOpenGL() { } // ------------------------------------------------------------------------ -BOOL SalOpenGL::Create() +BOOL AquaSalOpenGL::Create() { return FALSE; } // ------------------------------------------------------------------------ -void SalOpenGL::Release() +void AquaSalOpenGL::Release() { } // ------------------------------------------------------------------------ -void *SalOpenGL::GetOGLFnc( const char* pFncName ) +void *AquaSalOpenGL::GetOGLFnc( const char* pFncName ) { return NULL; } // ------------------------------------------------------------------------ -void SalOpenGL::OGLEntry( SalGraphics* pGraphics ) +void AquaSalOpenGL::OGLEntry( SalGraphics* pGraphics ) { } // ------------------------------------------------------------------------ -void SalOpenGL::OGLExit( SalGraphics* pGraphics ) +void AquaSalOpenGL::OGLExit( SalGraphics* pGraphics ) +{ +} + + + + + + + + +void AquaSalOpenGL::StartScene( SalGraphics* pGraphics ) +{ + +} + +bool AquaSalOpenGL::IsValid() +{ + +} + +void AquaSalOpenGL::StopScene() { + } diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salprn.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salprn.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salprn.cxx 2005-09-09 12:43:38.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salprn.cxx 2005-11-27 10:48:38.000000000 +0100 @@ -42,78 +42,81 @@ #ifndef _SV_SALPRN_HXX #include #endif +#ifndef _SV_SALPRN_H +#include +#endif // ======================================================================= -SalInfoPrinter::SalInfoPrinter() +AquaSalInfoPrinter::AquaSalInfoPrinter() { } // ----------------------------------------------------------------------- -SalInfoPrinter::~SalInfoPrinter() +AquaSalInfoPrinter::~AquaSalInfoPrinter() { } // ----------------------------------------------------------------------- -SalGraphics* SalInfoPrinter::GetGraphics() +SalGraphics* AquaSalInfoPrinter::GetGraphics() { return NULL; } // ----------------------------------------------------------------------- -void SalInfoPrinter::ReleaseGraphics( SalGraphics* ) +void AquaSalInfoPrinter::ReleaseGraphics( SalGraphics* ) { } // ----------------------------------------------------------------------- -BOOL SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) +BOOL AquaSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) { return FALSE; } // ----------------------------------------------------------------------- -BOOL SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) +BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) { return FALSE; } // ----------------------------------------------------------------------- -BOOL SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) +BOOL AquaSalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) { return FALSE; } // ----------------------------------------------------------------------- -ULONG SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) +ULONG AquaSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) { return 0; } // ----------------------------------------------------------------------- -XubString SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ) +XubString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ) { return XubString(); } // ----------------------------------------------------------------------- -ULONG SalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ) +ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ) { return 0; } // ----------------------------------------------------------------------- -void SalInfoPrinter::GetPageInfo( const ImplJobSetup*, +void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*, long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) @@ -122,19 +125,19 @@ // ======================================================================= -SalPrinter::SalPrinter() +AquaSalPrinter::AquaSalPrinter() { } // ----------------------------------------------------------------------- -SalPrinter::~SalPrinter() +AquaSalPrinter::~AquaSalPrinter() { } // ----------------------------------------------------------------------- -BOOL SalPrinter::StartJob( const XubString* pFileName, +BOOL AquaSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, ULONG nCopies, BOOL bCollate, @@ -145,35 +148,54 @@ // ----------------------------------------------------------------------- -BOOL SalPrinter::EndJob() +BOOL AquaSalPrinter::EndJob() { return TRUE; } // ----------------------------------------------------------------------- -BOOL SalPrinter::AbortJob() +BOOL AquaSalPrinter::AbortJob() { return TRUE; } // ----------------------------------------------------------------------- -SalGraphics* SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) +SalGraphics* AquaSalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) { return NULL; } // ----------------------------------------------------------------------- -BOOL SalPrinter::EndPage() +BOOL AquaSalPrinter::EndPage() { return TRUE; } // ----------------------------------------------------------------------- -ULONG SalPrinter::GetErrorCode() +ULONG AquaSalPrinter::GetErrorCode() { return 0; } + +//////////////////////////// +////// IMPLEMENT US ///// +//////////////////////////// + +DuplexMode AquaSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pSetupData ) +{ + return DUPLEX_UNKNOWN; +} + +void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) +{ + +} + +int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) +{ + return 0; +} \ No newline at end of file diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salvd.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salvd.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/salvd.cxx 2005-09-09 12:44:08.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/salvd.cxx 2006-06-22 09:25:23.000000000 +0200 @@ -34,230 +34,90 @@ ************************************************************************/ #ifndef _SV_SALVD_HXX - #include +#include +#endif +#ifndef _SV_SALVD_H +#include #endif // ======================================================================= -// ======================================================================= - -static BOOL InitVirtualDeviceGWorld ( SalVirDevDataPtr rSalVirDevData ) +static BOOL InitVirtualDeviceGWorld ( AquaSalVirtualDevice *pSalVirDev ) { BOOL bVirtualDeviceGWorldInited = FALSE; - if ( ( rSalVirDevData != NULL ) - && ( rSalVirDevData->mpGraphics != NULL ) - ) - { - Rect aBoundsRect; - short nRectLeft = 0; - short nRectTop = 0; - short nRectRight = rSalVirDevData->mnWidth; - short nRectBottom = rSalVirDevData->mnHeight; - short nPixelDepth = rSalVirDevData->mnBitCount; - GWorldPtr pGWorld = NULL; - CTabHandle hCTable = NULL; - GDHandle hGDevice = NULL; - GWorldFlags nFlags = 0; // [ed] 12/1/01 Allow offscreen gworlds - OSStatus nOSStatus = noErr; - - // Set the dimensions of the GWorldPtr - - MacSetRect( &aBoundsRect, nRectLeft, nRectTop, nRectRight, nRectBottom ); - - // Create the offscreen graphics context - - nOSStatus = NewGWorld( &pGWorld, - nPixelDepth, - &aBoundsRect, - hCTable, - hGDevice, - nFlags - ); - - // If NewGWorld failed, try again with different flags - - if ( nOSStatus != noErr ) - { - nFlags = noErr; - - nOSStatus = NewGWorld( &pGWorld, - nPixelDepth, - &aBoundsRect, - hCTable, - hGDevice, - nFlags - ); - } // if - - if ( ( nOSStatus == noErr ) - && ( pGWorld != NULL ) - ) - { - // Lock the virtual GWorld's port bits - - rSalVirDevData->mpGraphics->maGraphicsData.mnOSStatus - = LockPortBits( pGWorld ); - - if ( rSalVirDevData->mpGraphics->maGraphicsData.mnOSStatus == noErr ) - { - // Initialize the virtual graph port - - rSalVirDevData->mpGraphics->maGraphicsData.mpCGrafPort - = pGWorld; - - rSalVirDevData->mpGraphics->maGraphicsData.mpGWorld - = pGWorld; - - // Initialize virtual port's GWorld attributes - - rSalVirDevData->mpGraphics->maGraphicsData.mhGWorldPixMap - = GetGWorldPixMap( pGWorld ); - - // Unlock virtual GWorld's port bits - - UnlockPortBits( pGWorld ); - } // if - - // Initialize virtual port's GWorld attributes - - rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsLocked = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsCopy = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbGWorldPixelsNew = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mnGWorldFlags = noErr; - - // Initialize the virtual port's brush attributes - - rSalVirDevData->mpGraphics->maGraphicsData.mbBrushTransparent = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.maBrushColor = GetBlackColor( ); - - // Initialize the virtual port's font attributes - - rSalVirDevData->mpGraphics->maGraphicsData.maFontColor = GetBlackColor( ); - rSalVirDevData->mpGraphics->maGraphicsData.mnFontID = kFontIDGeneva; - rSalVirDevData->mpGraphics->maGraphicsData.mnFontSize = 10; - rSalVirDevData->mpGraphics->maGraphicsData.mnFontStyle = normal; - - // Initialize virtual port's clip regions - - rSalVirDevData->mpGraphics->maGraphicsData.mhClipRgn = NULL; - rSalVirDevData->mpGraphics->maGraphicsData.mbClipRgnChanged = FALSE; - - // Initilaize virtual port's status flags - - rSalVirDevData->mpGraphics->maGraphicsData.mbPrinter = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbVirDev = TRUE; - rSalVirDevData->mpGraphics->maGraphicsData.mbWindow = FALSE; - rSalVirDevData->mpGraphics->maGraphicsData.mbScreen = TRUE; - - bVirtualDeviceGWorldInited = TRUE; - } // if - } // if - return bVirtualDeviceGWorldInited; -} //InitVirtualDeviceGWorld - -// ======================================================================= +} // ======================================================================= -SalVirtualDevice::SalVirtualDevice() +AquaSalVirtualDevice::AquaSalVirtualDevice() { - maVirDevData.mpGraphics = NULL; - maVirDevData.mnBitCount = 0; - maVirDevData.mnWidth = 0; - maVirDevData.mnHeight = 0; - maVirDevData.mbGraphics = FALSE; -} // Constructor + mpGraphics = NULL; + mnBitCount = 0; + mnWidth = 0; + mnHeight = 0; + mbGraphics = FALSE; +} // ----------------------------------------------------------------------- -SalVirtualDevice::~SalVirtualDevice() +AquaSalVirtualDevice::~AquaSalVirtualDevice() { - if ( maVirDevData.mpGraphics != NULL ) + if ( mpGraphics != NULL ) { - // Delete exisiting clip regions, offscreen graphic world, - // and its associated colour graph port - - delete maVirDevData.mpGraphics; - } // if -} // Destructor + delete mpGraphics; + } +} // ----------------------------------------------------------------------- -SalGraphics* SalVirtualDevice::GetGraphics() +SalGraphics* AquaSalVirtualDevice::GetGraphics() { - if ( maVirDevData.mbGraphics ) + if ( mbGraphics ) { return NULL; - } // if + } - if ( !maVirDevData.mpGraphics ) + if ( !mpGraphics ) { - maVirDevData.mpGraphics = new SalGraphics; + mpGraphics = new AquaSalGraphics; - maVirDevData.mbGraphics = InitVirtualDeviceGWorld( &maVirDevData ); + mbGraphics = InitVirtualDeviceGWorld( this ); - if ( !maVirDevData.mbGraphics ) + if ( !mbGraphics ) { - delete maVirDevData.mpGraphics; - maVirDevData.mpGraphics = NULL; - } // if - } // if + delete mpGraphics; + mpGraphics = NULL; + } + } - return maVirDevData.mpGraphics; -} // SalVirtualDevice::GetGraphics + return mpGraphics; +} // ----------------------------------------------------------------------- -void SalVirtualDevice::ReleaseGraphics( SalGraphics *pGraphics ) +void AquaSalVirtualDevice::ReleaseGraphics( SalGraphics *pGraphics ) { - maVirDevData.mbGraphics = FALSE; -} // SalVirtualDevice::ReleaseGraphics + mbGraphics = FALSE; +} // ----------------------------------------------------------------------- -BOOL SalVirtualDevice::SetSize( long nDX, long nDY ) +BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY ) { BOOL bSizeSet = FALSE; - - // If we have already created a graphics context, dispose of it, - // by deleting exisiting clip regions, offscreen graphic worlds, - // and its associated colour graph port - - if ( ( ( maVirDevData.mpGraphics->maGraphicsData.mbGWorldPixelsCopy == TRUE ) - || ( maVirDevData.mpGraphics->maGraphicsData.mbGWorldPixelsNew == TRUE ) - ) - && ( maVirDevData.mpGraphics->maGraphicsData.mhGWorldPixMap != NULL ) - ) - { - DisposePixMap( maVirDevData.mpGraphics->maGraphicsData.mhGWorldPixMap ); - } // if - - if ( maVirDevData.mpGraphics->maGraphicsData.mhClipRgn != NULL ) - { - DisposeRgn( maVirDevData.mpGraphics->maGraphicsData.mhClipRgn ); - } // if - - if ( maVirDevData.mpGraphics->maGraphicsData.mpCGrafPort != NULL ) - { - DisposeGWorld( maVirDevData.mpGraphics->maGraphicsData.mpCGrafPort ); - - maVirDevData.mpGraphics->maGraphicsData.mpGWorld = NULL; - maVirDevData.mpGraphics->maGraphicsData.mpCGrafPort = NULL; - } // if - - // Create the offscreen graphics context - - maVirDevData.mnWidth = nDX; - maVirDevData.mnHeight = nDY; - - bSizeSet = InitVirtualDeviceGWorld( &maVirDevData ); - + mnWidth = nDX; + mnHeight = nDY; return bSizeSet; -} // SalVirtualDevice::SetSize +} -// ======================================================================= +// ----------------------------------------------------------------------- -// ======================================================================= +void AquaSalVirtualDevice::GetSize( long& rWidth, long& rHeight ) +{ + // FIXME: implement... + rWidth = mnWidth; + rHeight = mnHeight; +} diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/VCLGraphics.m ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/VCLGraphics.m --- ooo_SRC680_m172_src.orig/vcl/aqua/source/gdi/VCLGraphics.m 2005-09-09 12:40:23.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/gdi/VCLGraphics.m 1970-01-01 01:00:00.000000000 +0100 @@ -1,156 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#define _SV_VCLGRAPHICS_M - -#import - -// ======================================================================= - -// ======================================================================= - -// ----------------------------------------------------------------------- -// -// VCLGraphics -// -// ----------------------------------------------------------------------- - -@implementation VCLGraphics - -// ----------------------------------------------------------------------- -// -// Get, and lock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -+ (CGrafPtr)LockFocusCGrafPort: (VCLView *)hView -{ - if ( hView != nil ) - { - if ( [hView isKindOfClass: [NSQuickDrawView class]] ) - { - CGrafPtr pCGrafPort=NULL; - RGBColor oldFore, newFore; - Rect r; - NSRect viewBounds; - - [hView lockFocus]; - - // [ed] 12/12/01 The Carbon GrafPort only is valid as long as the view has - // the focus, so we need to be sure to execute lockFocus before assigning - // the port. - - pCGrafPort = [(NSQuickDrawView *)hView qdPort]; - - return pCGrafPort; - } - else - { - // [ed] 12/12/01 Error checking - - fprintf(stderr, "Non nil hView in LockFocusCGrafPort(), but not a quickdrawview\n"); - } // if - } - else - { - // [ed] 12/12/01 Error checking - - fprintf(stderr, "Nil hView in LockFocusCGrafPort()\n"); - } // if - - return NULL; -} // LockFocusCGrafPort - -// ----------------------------------------------------------------------- -// -// Close, and unlock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -+ (void)UnLockFocusCGrafPort: (VCLView *)hView -{ - if ( hView != nil ) - { - if ( [hView isKindOfClass: [NSQuickDrawView class]] ) - { - [hView unlockFocus]; - } // if - } // if -} // UnLockFocusCGrafPort - -@end - -// ======================================================================= - -// ======================================================================= - -// ----------------------------------------------------------------------- -// -// C wrapper functions -// -// ----------------------------------------------------------------------- - -// ----------------------------------------------------------------------- -// -// Get, and lock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -CGrafPtr VCLGraphics_LockFocusCGrafPort ( VCLVIEW hView ) -{ - if ( (VCLView *)hView == nil ) - return NULL; - - return [ VCLGraphics LockFocusCGrafPort: (VCLView *)hView ]; -} // VCLGraphics_LockFocusCGrafPort - -// ----------------------------------------------------------------------- -// -// Close, and unlock, a QuickDraw View -// -// ----------------------------------------------------------------------- - -void VCLGraphics_UnLockFocusCGrafPort ( VCLVIEW hView ) -{ - if ( (VCLView *)hView == nil ) - return; - - [ VCLGraphics UnLockFocusCGrafPort: (VCLView *)hView ]; -} // VCLGraphics_UnLockFocusCGrafPort - -// ======================================================================= - -// ======================================================================= - diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/window/makefile.mk ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/makefile.mk --- ooo_SRC680_m172_src.orig/vcl/aqua/source/window/makefile.mk 2005-09-09 12:45:06.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/makefile.mk 2006-02-16 22:36:37.000000000 +0100 @@ -59,9 +59,7 @@ SLOFILES= \ $(SLO)/salframe.obj \ - $(SLO)/salobj.obj \ - $(SLO)/VCLView.obj \ - $(SLO)/VCLWindow.obj + $(SLO)/salobj.obj .ENDIF # "$(GUIBASE)"!="aqua" diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/window/salframe.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/salframe.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/window/salframe.cxx 2005-09-09 12:45:20.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/salframe.cxx 2006-06-25 21:27:54.000000000 +0200 @@ -41,319 +41,1033 @@ #ifndef _SV_SALGDI_HXX #include #endif -#ifndef _SV_SALFRAME_HXX -#include +#ifndef _SV_SALGDI_H +#include #endif -#ifndef _SV_VCLWINDOW_H -#include +#ifndef _SV_SALFRAME_H +#include #endif -#ifndef _SV_VCLGRAPHICS_H -#include +#ifndef _SV_SALTIMER_H +#include #endif +#ifndef _SV_SALINST_H +#include +#endif + +#include + +#include +#include + +using namespace std; // ======================================================================= static long ImplSalFrameCallbackDummy( void*, SalFrame*, USHORT, const void* ) { + fprintf(stderr, ">*>_> %s\n",__func__); return 0; } // ======================================================================= -SalFrame::SalFrame() -{ - SalData* pSalData = GetSalData(); - - maFrameData.mhWnd = NULL; - maFrameData.mpGraphics = NULL; - maFrameData.mpInst = NULL; - maFrameData.mpProc = ImplSalFrameCallbackDummy; - maFrameData.mnWidth = 0; - maFrameData.mnHeight = 0; - maFrameData.mbGraphics = FALSE; +AquaSalFrame::AquaSalFrame() : + mrWindow(NULL), + mpGraphics(NULL), + mpParent(NULL), + mpInst(NULL), + mpProc(ImplSalFrameCallbackDummy), + mnWidth(0), + mnHeight(0), + mnMinWidth(0), + mnMinHeight(0), + mnMaxWidth(0), + mnMaxHeight(0), + mbGraphics(FALSE) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + InsertThisIntoFrameList(); +} + +AquaSalFrame::AquaSalFrame(SalFrame* pParent, ULONG salFrameStyle, AquaSalInstance* pSalInstance) : + mpGraphics(NULL), + mpParent(NULL), + mpInst(NULL), + mpProc(ImplSalFrameCallbackDummy), + mnWidth(0), + mnHeight(0), + mnMinWidth(0), + mnMinHeight(0), + mnMaxWidth(0), + mnMaxHeight(0), + mbGraphics(FALSE), + mpSalInstance(pSalInstance) +{ + InsertThisIntoFrameList(); + mpParent = dynamic_cast(pParent); + BOOST_ASSERT((pParent && pFrame->mpParent) || (pParent == NULL) && "Parent frame is no AquaSalFrame!"); + CreateNewSystemWindow(mpParent ? mpParent->mrWindow : NULL, salFrameStyle); +} - // insert frame in framelist - maFrameData.mpNextFrame = pSalData->mpFirstFrame; +void AquaSalFrame::InsertThisIntoFrameList() +{ + SalData* pSalData = GetSalData(); + mpNextFrame = dynamic_cast(pSalData->mpFirstFrame); pSalData->mpFirstFrame = this; } -// ----------------------------------------------------------------------- - -SalFrame::~SalFrame() +void AquaSalFrame::RemoveThisFromFrameList() { SalData* pSalData = GetSalData(); - if ( maFrameData.mpGraphics ) - delete maFrameData.mpGraphics; - - if ( maFrameData.mhWnd ) - VCLWindow_Release( maFrameData.mhWnd ); - - // remove frame from framelist - if ( this == pSalData->mpFirstFrame ) - pSalData->mpFirstFrame = maFrameData.mpNextFrame; + if (this == pSalData->mpFirstFrame) + pSalData->mpFirstFrame = mpNextFrame; else { - SalFrame* pTempFrame = pSalData->mpFirstFrame; - while ( pTempFrame->maFrameData.mpNextFrame != this ) - pTempFrame = pTempFrame->maFrameData.mpNextFrame; + AquaSalFrame* pTempFrame = (AquaSalFrame*)pSalData->mpFirstFrame; + while (pTempFrame->mpNextFrame != this) + pTempFrame = (AquaSalFrame*)pTempFrame->mpNextFrame; - pTempFrame->maFrameData.mpNextFrame = maFrameData.mpNextFrame; + pTempFrame->mpNextFrame = mpNextFrame; } } // ----------------------------------------------------------------------- -SalGraphics* SalFrame::GetGraphics() +AquaSalFrame::~AquaSalFrame() +{ + fprintf(stderr, ">*>_> %s\n",__func__); + + if ( mpGraphics ) + delete mpGraphics; + + if (mrWindow) + { + HideWindow(mrWindow); + DeinstallAndUnregisterAllEventHandler(); + ReleaseWindow(mrWindow); + } + + RemoveThisFromFrameList(); +} + +// ----------------------------------------------------------------------- + +SalGraphics* AquaSalFrame::GetGraphics() { - if ( maFrameData.mbGraphics ) + if ( mbGraphics ) return NULL; - if ( !maFrameData.mpGraphics ) + if ( !mpGraphics ) { - VCLVIEW hView = NULL; - SalFrame *pFrame = this; + CarbonViewRef hView = NULL; + AquaSalFrame *pFrame = this; // Search for the parent SalFrame that has a native window and // use that window to get an NSView - while ( !pFrame->maFrameData.mhWnd ) { - pFrame = pFrame->maFrameData.mpParent; + + while ( !pFrame->mrWindow ) { + pFrame = (AquaSalFrame*)pFrame->mpParent; if ( !pFrame ) break; } - hView = VCLWindow_ContentView( pFrame->maFrameData.mhWnd ); - - if ( hView ) + + // create root control if it does not exist + // however, this is currently not used + OSErr err = GetRootControl( pFrame->mrWindow, &hView ); + if( err == errNoRootControl ) + err = CreateRootControl( pFrame->mrWindow, &hView ); + + if( err == noErr ) { - maFrameData.mpGraphics = new SalGraphics; - maFrameData.mpGraphics->maGraphicsData.mhDC = hView; - maFrameData.mpGraphics->maGraphicsData.mbPrinter = FALSE; - maFrameData.mpGraphics->maGraphicsData.mbVirDev = FALSE; - maFrameData.mpGraphics->maGraphicsData.mbWindow = TRUE; - maFrameData.mpGraphics->maGraphicsData.mbScreen = TRUE; + mpGraphics = new AquaSalGraphics; + mpGraphics->SetWindowGraphics( hView, mrWindow, true ); + mbGraphics = TRUE; } + else + fprintf(stderr, "could not get graphics (get/create root control returned %d)\n", err); } - maFrameData.mbGraphics = TRUE; - - return maFrameData.mpGraphics; + return mpGraphics; } // ----------------------------------------------------------------------- -void SalFrame::ReleaseGraphics( SalGraphics *pGraphics ) +void AquaSalFrame::ReleaseGraphics( SalGraphics *pGraphics ) { - maFrameData.mbGraphics = FALSE; + fprintf(stderr, ">*>_> %s\n",__func__); + mbGraphics = FALSE; } // ----------------------------------------------------------------------- -BOOL SalFrame::PostEvent( void *pData ) +BOOL AquaSalFrame::ImplPostUserEvent( UInt32 eventKind, void *pData ) { - VCLWINDOW hWindow = NULL; - SalFrame *pFrame = this; - + //fprintf(stderr, "implpost user event\n"); + // Search for the parent SalFrame that has a native window and // use that window to post the event to - while ( !pFrame->maFrameData.mhWnd ) { - pFrame = pFrame->maFrameData.mpParent; - if ( !pFrame ) + AquaSalFrame *pFrame = this; + while (!pFrame->mrWindow) + { + pFrame = pFrame->mpParent; + if (!pFrame) break; } - return VCLWindow_PostEvent( pFrame->maFrameData.mhWnd, pData ); + + bool bret = false; + + if (pFrame) + { + EventRef eventRef; + if (CreateEvent(NULL, cOOoSalUserEventClass, eventKind, 0, kEventAttributeNone, &eventRef) == noErr) + { + EventTargetRef eventTargetRef = GetWindowEventTarget(pFrame->mrWindow); + if (SetEventParameter(eventRef, kEventParamPostTarget, typeEventTargetRef, sizeof(EventTargetRef), &eventTargetRef) == noErr && + SetEventParameter(eventRef, cOOoSalEventData, cOOoSalEventParamTypePtr, sizeof(pData), &pData) == noErr && + PostEventToQueue(GetMainEventQueue(), eventRef, kEventPriorityStandard) == noErr) + { + bret = true; + } + ReleaseEvent(eventRef); + } + } + return bret; } -// ----------------------------------------------------------------------- +BOOL AquaSalFrame::PostEvent( void *pData ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + return ImplPostUserEvent( cOOoSalEventUser, pData ); +} -void SalFrame::SetTitle( const XubString& rTitle ) +BOOL AquaSalFrame::PostTimerEvent( AquaSalTimer *pTimer ) { - ByteString aByteTitle( rTitle, gsl_getSystemTextEncoding() ); - char *pTitle = (char *)aByteTitle.GetBuffer(); + //fprintf(stderr, ">*>_> %s\n",__func__); + return ImplPostUserEvent( cOOoSalEventTimer, (void*) pTimer ); +} - if ( maFrameData.mhWnd ) - VCLWindow_SetTitle( maFrameData.mhWnd, pTitle ); +// ----------------------------------------------------------------------- +void AquaSalFrame::SetTitle(const XubString& rTitle) +{ + BOOST_ASSERT(mrWindow && "Precondition violated, no window associated with frame"); + ByteString aByteTitle(rTitle, gsl_getSystemTextEncoding()); + char *pTitle = (char *)aByteTitle.GetBuffer(); + CFStringRef pString = CFStringCreateWithCString(kCFAllocatorDefault,pTitle,kCFStringEncodingUTF8); + SetWindowTitleWithCFString(mrWindow, pString); + CFRelease(pString); } // ----------------------------------------------------------------------- -void SalFrame::SetIcon( USHORT nIcon ) +void AquaSalFrame::SetIcon( USHORT nIcon ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::Show( BOOL bVisible ) +void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) { - if ( bVisible ) - { - if ( maFrameData.mhWnd ) - VCLWindow_Show( maFrameData.mhWnd ); - } // if - else - { - if ( maFrameData.mhWnd ) - { - VCLWindow_Close( maFrameData.mhWnd ); - if ( maFrameData.mpParent ) - maFrameData.mpParent->Show( TRUE ); - } - } // else -} // SalFrame::Show + BOOST_ASSERT(mrWindow && "Precondition violation - no window associated with frame yet"); + + if(bVisible) + { + ShowWindow(mrWindow); + if(!bNoActivate) + SelectWindow(mrWindow); //ActivateWindow(mrWindow, true); + } + else + HideWindow(mrWindow); +} // ----------------------------------------------------------------------- -void SalFrame::Enable( BOOL bEnable ) +void AquaSalFrame::Enable( BOOL bEnable ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetMinClientSize( long nWidth, long nHeight ) +void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight ) { + fprintf(stderr, ">*>_> %s\n",__func__); + mnMinWidth = nWidth; + mnMinHeight = nHeight; } // ----------------------------------------------------------------------- -void SalFrame::SetClientSize( long nWidth, long nHeight ) +void AquaSalFrame::SetClientSize( long nWidth, long nHeight ) { - maFrameData.mnWidth = nWidth; - maFrameData.mnHeight = nHeight; + fprintf(stderr, ">*>_> %s\n",__func__); + mnWidth = nWidth; + mnHeight = nHeight; // If this is a native window, resize it - if ( maFrameData.mhWnd ) - VCLWindow_SetSize( maFrameData.mhWnd, nWidth, nHeight ); + if ( mrWindow ) + { + Rect bounds; + GetWindowBounds( mrWindow, kWindowContentRgn, &bounds ); + bounds.right = bounds.left + nWidth; + bounds.bottom = bounds.top + nHeight; + SetWindowBounds( mrWindow, kWindowContentRgn, &bounds ); + } } // ----------------------------------------------------------------------- -void SalFrame::GetClientSize( long& rWidth, long& rHeight ) +void AquaSalFrame::GetClientSize( long& rWidth, long& rHeight ) { - rWidth = maFrameData.mnWidth; - rHeight = maFrameData.mnHeight; + fprintf(stderr, ">*>_> %s\n",__func__); + rWidth = mnWidth; + rHeight = mnHeight; } // ----------------------------------------------------------------------- -void SalFrame::SetWindowState( const SalFrameState* pState ) +void AquaSalFrame::SetWindowState( const SalFrameState* pState ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -BOOL SalFrame::GetWindowState( SalFrameState* pState ) +BOOL AquaSalFrame::GetWindowState( SalFrameState* pState ) { + fprintf(stderr, ">*>_> %s\n",__func__); return FALSE; } // ----------------------------------------------------------------------- -void SalFrame::ShowFullScreen( BOOL bFullScreen ) +void AquaSalFrame::ShowFullScreen( BOOL bFullScreen ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::StartPresentation( BOOL bStart ) +void AquaSalFrame::StartPresentation( BOOL bStart ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetAlwaysOnTop( BOOL bOnTop ) +void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::ToTop( USHORT nFlags ) +void AquaSalFrame::ToTop(USHORT nFlags) { - if ( maFrameData.mhWnd ) - VCLWindow_Show( maFrameData.mhWnd ); + BOOST_ASSERT(mrWindow && "Precondition violation - no window associated with frame yet"); + Show(true, false); } // ----------------------------------------------------------------------- -void SalFrame::SetPointer( PointerStyle ePointerStyle ) +void AquaSalFrame::SetPointer( PointerStyle ePointerStyle ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::CaptureMouse( BOOL bCapture ) +void AquaSalFrame::CaptureMouse( BOOL bCapture ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetPointerPos( long nX, long nY ) +void AquaSalFrame::SetPointerPos( long nX, long nY ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::Flush() +void AquaSalFrame::Flush() { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::Sync() +void AquaSalFrame::Sync() { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::SetInputContext( SalInputContext* pContext ) +void AquaSalFrame::SetInputContext( SalInputContext* pContext ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -void SalFrame::EndExtTextInput( USHORT nFlags ) +void AquaSalFrame::EndExtTextInput( USHORT nFlags ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -XubString SalFrame::GetKeyName( USHORT nKeyCode ) +XubString AquaSalFrame::GetKeyName( USHORT nKeyCode ) { + fprintf(stderr, ">*>_> %s\n",__func__); return XubString(); } // ----------------------------------------------------------------------- -XubString SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) +XubString AquaSalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) { + fprintf(stderr, ">*>_> %s\n",__func__); return GetKeyName( nKeyCode ); } // ----------------------------------------------------------------------- -void SalFrame::UpdateSettings( AllSettings& rSettings ) +void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) { + fprintf(stderr, ">*>_> %s\n",__func__); } // ----------------------------------------------------------------------- -const SystemEnvData* SalFrame::GetSystemData() const +const SystemEnvData* AquaSalFrame::GetSystemData() const { + fprintf(stderr, ">*>_> %s\n",__func__); return NULL; } // ----------------------------------------------------------------------- -void SalFrame::Beep( SoundType eSoundType ) +void AquaSalFrame::Beep( SoundType eSoundType ) { - VCLWindow_Beep(); + SysBeep(1); } // ----------------------------------------------------------------------- -void SalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc ) +void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHORT nFlags) { - maFrameData.mpInst = pInst; - if ( pProc ) - maFrameData.mpProc = pProc; - else - maFrameData.mpProc = ImplSalFrameCallbackDummy; + /* + fprintf(stderr, "SetPosSize: nX: %d nY: %d nWidth: %d nHeight: %d, set_x: %s, set_y: %s, set_width: %s, set_height: %s\n", + nX, nY, nWidth, nHeight, + (nFlags&SAL_FRAME_POSSIZE_X) ? "yes" : "no", + (nFlags&SAL_FRAME_POSSIZE_Y) ? "yes" : "no", + (nFlags&SAL_FRAME_POSSIZE_WIDTH) ? "yes" : "no", + (nFlags&SAL_FRAME_POSSIZE_HEIGHT) ? "yes" : "no" ); + + fprintf(stderr, "maGeometry: left: %d top: %d right: %d bottom: %d\n", + maGeometry.nLeftDecoration, maGeometry.nTopDecoration, + maGeometry.nRightDecoration, maGeometry.nBottomDecoration ); + */ + USHORT nEvent = 0; + + if (IsWindowCollapsed(mrWindow)) + CollapseWindow(mrWindow, false); // expand the window + + if (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) + nEvent = SALEVENT_MOVE; + + if (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) + nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE; + + Rect currentWindowRect; + GetWindowBounds(mrWindow, kWindowStructureRgn, ¤tWindowRect); + + Rect currentContentRect; + GetWindowBounds(mrWindow, kWindowContentRgn, ¤tContentRect); + + // position is always relative to parent frame + Rect parentContentRect; + if( mpParent ) + GetWindowBounds(mpParent->mrWindow, kWindowContentRgn, &parentContentRect); + else + // use screen if no parent + GetAvailableWindowPositioningBounds(GetMainDevice(), &parentContentRect); + + // use old window pos if no new pos requested + if (!(nFlags & SAL_FRAME_POSSIZE_X)) + nX = currentWindowRect.left; + else + nX += parentContentRect.left; + + if (!(nFlags & SAL_FRAME_POSSIZE_Y)) + nY = currentWindowRect.top; + else + nY += parentContentRect.top; + + // use old window width if no new width requested + if (!(nFlags & SAL_FRAME_POSSIZE_WIDTH)) + nWidth = currentContentRect.right - currentContentRect.left; + + // always add the decoration as nWidth concerns only the content rect + nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration; + + // use old window height if no new height requested + if (!(nFlags & SAL_FRAME_POSSIZE_HEIGHT)) + nHeight = currentContentRect.bottom - currentContentRect.top; + + // always add the decoration as nHeight concerns only the content rect + nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration; + + Rect newWindowRect; + SetRect(&newWindowRect, nX, nY, nX + nWidth, nY + nHeight); + + /* + fprintf(stderr, "SetPosSize: Old rect (x: %d, y: %d, w: %d, h: %d)\n", + currentWindowRect.left, currentWindowRect.top, currentWindowRect.right - currentWindowRect.left, currentWindowRect.bottom - currentWindowRect.top); + fprintf(stderr, "SetPosSize: New rect (x: %d, y: %d, w: %d, h: %d)\n", nX, nY, nWidth, nHeight); + */ + SetWindowBounds(mrWindow, kWindowStructureRgn, &newWindowRect); + + UpdateFrameGeometry(); + + if (nEvent) + CallCallback(nEvent, NULL); +} + +void AquaSalFrame::DrawMenuBar() +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::GetWorkArea( Rectangle& rRect ) +{ + Rect aRect; + GetAvailableWindowPositioningBounds(GetMainDevice(), &aRect); + + rRect.nTop = aRect.top; + rRect.nLeft = aRect.left; + rRect.nRight = aRect.right; + rRect.nBottom = aRect.bottom; +} + +SalPointerState AquaSalFrame::GetPointerState() +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement + SalPointerState state; + return state; +} + +bool AquaSalFrame::SetPluginParent( SystemParentData* pNewParent ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement + return sal_False; +} + +BOOL AquaSalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + // not supported yet + return FALSE; +} + +LanguageType AquaSalFrame::GetInputLanguage() +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement + return LANGUAGE_DONTKNOW; +} + +void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + mnMaxWidth = nWidth; + mnMaxHeight = nHeight; +} + +void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement +} + +void AquaSalFrame::SetBackgroundBitmap( SalBitmap* ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement +} + +SalBitmap* AquaSalFrame::SnapShot() +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement + return NULL; +} + +SalFrame* AquaSalFrame::GetParent() const +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement + return mpParent; +} + +void AquaSalFrame::SetParent( SalFrame* pNewParent ) +{ + fprintf(stderr, ">*>_> %s\n",__func__); + //TODO: implement + mpParent = (AquaSalFrame*)pNewParent; +} + +void DbgPrintFrameGeometry(Rect fullWndRect, Rect cntRect, Rect titleBarRect, SalFrameGeometry salGeo) +{ + fprintf(stderr, "=======================================\n"); + fprintf(stderr, "Full window rect (l: %d, t: %d, b: %d, r: %d)\n", fullWndRect.left, fullWndRect.top, fullWndRect.bottom, fullWndRect.right); + fprintf(stderr, "Content rect (l: %d, t: %d, b: %d, r: %d)\n", cntRect.left, cntRect.top, cntRect.bottom, cntRect.right); + fprintf(stderr, "Title bar rect (l: %d, t: %d, b: %d, r: %d)\n", titleBarRect.left, titleBarRect.top, titleBarRect.bottom, titleBarRect.right); + fprintf(stderr, "nX: %d, nY: %d, nWidth: %d, nHeight: %d, LeftDeco %d, RightDeco %d, TopDeco %d, BottomDeco %d\n", salGeo.nX, salGeo.nY, salGeo.nWidth, salGeo.nHeight, salGeo.nLeftDecoration, salGeo.nRightDecoration, salGeo.nTopDecoration, salGeo.nBottomDecoration); + fprintf(stderr, "=======================================\n"); +} + +void AquaSalFrame::UpdateFrameGeometry() +{ + memset(&maGeometry, 0, sizeof(SalFrameGeometry)); + + if (IsWindowCollapsed(mrWindow)) + return; + + Rect fullWindowRect; + GetWindowBounds(mrWindow, kWindowStructureRgn, &fullWindowRect); + + Rect contentRect; + GetWindowBounds(mrWindow, kWindowContentRgn, &contentRect); + + maGeometry.nX = contentRect.left; + maGeometry.nY = contentRect.top; + + maGeometry.nLeftDecoration = contentRect.left - fullWindowRect.left; + maGeometry.nRightDecoration = fullWindowRect.right - contentRect.right; + + maGeometry.nTopDecoration = contentRect.top - fullWindowRect.top; + maGeometry.nBottomDecoration = fullWindowRect.bottom - contentRect.bottom; + + Rect titleBarRect; + GetWindowBounds(mrWindow, kWindowTitleBarRgn, &titleBarRect); + + int width = fullWindowRect.right - fullWindowRect.left - maGeometry.nRightDecoration - maGeometry.nLeftDecoration; + int height = fullWindowRect.bottom - fullWindowRect.top - maGeometry.nBottomDecoration - maGeometry.nTopDecoration; + + maGeometry.nWidth = width < 0 ? 0 : width; + maGeometry.nHeight = height < 0 ? 0 : height; + + //DbgPrintFrameGeometry(fullWindowRect, contentRect, titleBarRect, maGeometry); +} + +OSStatus HandleWindowCloseEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == kEventClassWindow && GetEventKind(inEvent) == kEventWindowClose && "Only WindowClose event expected"); + + ImplSalYieldMutexAcquire(); + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + pSalFrame->CallCallback(SALEVENT_CLOSE, 0); + ImplSalYieldMutexRelease(); + return noErr; +} + +OSStatus HandleWindowBoundsChangedEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + fprintf(stdout, "Bounds changed event\n"); + + BOOST_ASSERT(GetEventClass(inEvent) == kEventClassWindow && GetEventKind(inEvent) == kEventWindowBoundsChanged && "Only WindowBoundsChanged event expected"); + + //fprintf(stderr, "received resize event\n"); + + // HACK: + // during live resize our own event loop will not be active so private timer events + // that were posted into the event queue will not be handled + // it seems that all event scheduling takes place in the standard + // event handlers in this case + // calling SalInstance::Yield() will allow to dispatch events from the queue and repaints will + // occur during live reisze + SalData* pSalData = GetSalData(); + pSalData->mpFirstInstance->Yield( FALSE ); + + ImplSalYieldMutexAcquire(); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + pSalFrame->UpdateFrameGeometry(); + + // compose sal resize event + Rect windowBounds; + GetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &windowBounds); + + long windowWidth = windowBounds.right - windowBounds.left; + long windowHeight = windowBounds.bottom - windowBounds.top; + + // Get the size of the window's content area + if (windowWidth != pSalFrame->mnWidth || windowHeight != pSalFrame->mnHeight) + { + // Cache the new size + pSalFrame->mnWidth = windowWidth; + pSalFrame->mnHeight = windowHeight; + + + pSalFrame->CallCallback( SALEVENT_RESIZE, NULL); + } + + ImplSalYieldMutexRelease(); + + return noErr; +} + +OSStatus HandleOOoSalUserEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == cOOoSalUserEventClass && "Only SalUserEvents expected"); + + //fprintf(stderr, "received user event\n"); + + ImplSalYieldMutexAcquire(); + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + void* pData = NULL; + + GetEventParameter(inEvent, cOOoSalEventData, cOOoSalEventParamTypePtr, NULL, sizeof(pData), NULL, &pData); + + pSalFrame->CallCallback(SALEVENT_USEREVENT, pData); + + ImplSalYieldMutexRelease(); + + return noErr; +} +OSStatus HandleOOoSalTimerEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == cOOoSalUserEventClass && "Only SalUserEvents expected"); + + //fprintf(stderr, "received timer event\n"); + + ImplSalYieldMutexAcquire(); + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + void* pData = NULL; + + GetEventParameter(inEvent, cOOoSalEventData, cOOoSalEventParamTypePtr, NULL, sizeof(pData), NULL, &pData); + + AquaSalTimer *pTimer = reinterpret_cast(pData); + pTimer->CallCallback(); + + ImplSalYieldMutexRelease(); + + return noErr; +} + +OSStatus HandleWindowActivatedEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + return eventNotHandledErr; +} + +OSStatus HandleWindowPaintEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + fprintf(stderr, "received full paint event\n"); + ImplSalYieldMutexAcquire(); + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + Rect contentBounds; + GetWindowBounds( pSalFrame->mrWindow, kWindowContentRgn, &contentBounds ); + + SalPaintEvent aPaintEvt; + aPaintEvt.mnBoundX = 0; + aPaintEvt.mnBoundY = 0; + aPaintEvt.mnBoundWidth = contentBounds.right - contentBounds.left; + aPaintEvt.mnBoundHeight = contentBounds.bottom - contentBounds.top; + + fprintf(stderr, "Full paint event: (%d, %d, %d, %d)\n", + aPaintEvt.mnBoundX, aPaintEvt.mnBoundY, + aPaintEvt.mnBoundWidth, aPaintEvt.mnBoundHeight); + + pSalFrame->CallCallback(SALEVENT_PAINT, &aPaintEvt); + ImplSalYieldMutexRelease(); + + return noErr; +} + +OSStatus HandleWindowDrawContentEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + //fprintf(stderr, "received draw content event\n"); + ImplSalYieldMutexAcquire(); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + RgnHandle rgn = NewRgn(); + Rect portBounds; + GetPortVisibleRegion(GetWindowPort(pSalFrame->mrWindow), rgn); + GetRegionBounds( rgn, &portBounds ); + DisposeRgn( rgn ); + + SalPaintEvent aPaintEvt; + aPaintEvt.mnBoundX = portBounds.left; + aPaintEvt.mnBoundY = portBounds.top; + aPaintEvt.mnBoundWidth = portBounds.right - portBounds.left; + aPaintEvt.mnBoundHeight = portBounds.bottom - portBounds.top; + + fprintf(stderr, "Paint event: (%d, %d, %d, %d)\n", + aPaintEvt.mnBoundX, aPaintEvt.mnBoundY, + aPaintEvt.mnBoundWidth, aPaintEvt.mnBoundHeight); + + pSalFrame->CallCallback(SALEVENT_PAINT, &aPaintEvt); + ImplSalYieldMutexRelease(); + + return noErr; +} + +OSStatus HandleWindowResizeStarted(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData) +{ + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + pSalFrame->mpSalInstance->StartForceDispatchingPaintEvents(); + return noErr; +} + +OSStatus HandleWindowResizeCompleted(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData) +{ + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + pSalFrame->mpSalInstance->StopForceDispatchingPaintEvents(); + return noErr; +} + +OSStatus HandleMouseUpDownEvent(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData) +{ + BOOST_ASSERT(GetEventClass(inEvent) == kEventClassMouse && (GetEventKind(inEvent) == kEventMouseDown || GetEventKind(inEvent) == kEventMouseUp) && "Mouse up or mouse down events expected"); + + //fprintf(stderr, "received Mouse up/down event\n"); + + ImplSalYieldMutexAcquire(); + + AquaSalFrame* pSalFrame = reinterpret_cast(inUserData); + + // use window bounds to convert from screen to window coordinates + Rect bounds; + GetWindowBounds( pSalFrame->mrWindow, kWindowContentRgn, &bounds ); + + // get mouse coordinates in screen space + MacOSPoint aPt; + GetEventParameter(inEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(aPt), NULL, &aPt); + + SalMouseEvent aMouseEvt; + aMouseEvt.mnX = aPt.h - bounds.left; + aMouseEvt.mnY = aPt.v - bounds.top; + + aMouseEvt.mnCode = 0; + aMouseEvt.mnTime = static_cast(GetEventTime(inEvent) * 1000); + + // Which modifier keys pressed? + // + // Please note: + // The system automatically preserves the state of the modifier keys during + // mouse down for the corresponding MousUp event + UInt32 modifierKeys; + GetEventParameter(inEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifierKeys), NULL, &modifierKeys); + + if (modifierKeys & shiftKey) + aMouseEvt.mnCode |= KEY_SHIFT; + if (modifierKeys & controlKey) + aMouseEvt.mnCode |= KEY_MOD1; + if (modifierKeys & optionKey) + aMouseEvt.mnCode |= KEY_MOD2; + + // Which mouse button pressed? + EventMouseButton aButtonEvt; + GetEventParameter(inEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(aButtonEvt), NULL, &aButtonEvt); + + switch (aButtonEvt) + { + case kEventMouseButtonPrimary: + aMouseEvt.mnButton = MOUSE_LEFT; + aMouseEvt.mnCode |= MOUSE_LEFT; + break; + + case kEventMouseButtonSecondary: + aMouseEvt.mnButton = MOUSE_MIDDLE; + aMouseEvt.mnCode |= MOUSE_MIDDLE; + break; + + case kEventMouseButtonTertiary: + aMouseEvt.mnButton = MOUSE_RIGHT; + aMouseEvt.mnCode |= MOUSE_RIGHT; + break; + } + + pSalFrame->CallCallback(GetEventKind(inEvent) == kEventMouseDown ? + SALEVENT_MOUSEBUTTONDOWN : SALEVENT_MOUSEBUTTONUP, + &aMouseEvt); + ImplSalYieldMutexRelease(); + + // Note: we have to return eventNotHandledErr otherwise + // the window will not be activated and stay in the background + return eventNotHandledErr; +} + +OSStatus GetOptimalWindowSize(Rect* rect); + +void DbgWhichSalFrameStyle(ULONG style) +{ + fprintf(stderr, "==============================\n"); + + if (style & SAL_FRAME_STYLE_DEFAULT) + fprintf(stderr, "SAL_FRAME_STYLE_DEFAULT\n"); + if (style & SAL_FRAME_STYLE_MOVEABLE) + fprintf(stderr, "SAL_FRAME_STYLE_MOVEABLE\n"); + if (style & SAL_FRAME_STYLE_SIZEABLE) + fprintf(stderr, "SAL_FRAME_STYLE_SIZEABLE\n"); + if (style & SAL_FRAME_STYLE_CLOSEABLE) + fprintf(stderr, "SAL_FRAME_STYLE_CLOSEABLE\n"); + if (style & SAL_FRAME_STYLE_NOSHADOW) + fprintf(stderr, "SAL_FRAME_STYLE_NOSHADOW\n"); + if (style & SAL_FRAME_STYLE_TOOLTIP) + fprintf(stderr, "SAL_FRAME_STYLE_TOOLTIP\n"); + if (style & SAL_FRAME_STYLE_OWNERDRAWDECORATION) + fprintf(stderr, "SAL_FRAME_STYLE_OWNERDRAWDECORATION\n"); + if (style & SAL_FRAME_STYLE_DIALOG) + fprintf(stderr, "SAL_FRAME_STYLE_DIALOG\n"); + if (style & SAL_FRAME_STYLE_CHILD) + fprintf(stderr, "SAL_FRAME_STYLE_CHILD\n"); + if (style & SAL_FRAME_STYLE_FLOAT) + fprintf(stderr, "SAL_FRAME_STYLE_FLOAT\n"); + if (style & SAL_FRAME_STYLE_TOOLWINDOW) + fprintf(stderr, "SAL_FRAME_STYLE_TOOLWINDOW\n"); + if (style & SAL_FRAME_STYLE_INTRO) + fprintf(stderr, "SAL_FRAME_STYLE_INTRO\n"); + + fprintf(stderr, "==============================\n"); +} + +void AquaSalFrame::CreateNewSystemWindow(CarbonWindowRef pParent, ULONG nSalFrameStyle) +{ + DbgWhichSalFrameStyle(nSalFrameStyle); + + // in order to receive windowupdate events we must not use compositing (kWindowCompositingAttribute)! + + // initialize with useful defaults + unsigned int nWindowAttributes = kWindowStandardHandlerAttribute; + WindowClass windowClass = kDocumentWindowClass; + + if (nSalFrameStyle & SAL_FRAME_STYLE_CHILD) + { + BOOST_ASSERT(false && "Not yet implemented! How to handle child windows on Mac OS X?"); + } + else // none-child windows + { + if (nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT) + nWindowAttributes |= kWindowStandardDocumentAttributes; + + if( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) + windowClass = kFloatingWindowClass; + if (nSalFrameStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) + windowClass = kToolbarWindowClass; + if (nSalFrameStyle & SAL_FRAME_STYLE_TOOLTIP) + windowClass = kHelpWindowClass; + + // check moveable, sizeable, closeable + if( !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) ) // window without decoration + //nWindowAttributes |= kWindowNoTitleBarAttribute; // requires Mac OS X 10.4, may be choose another windows class like toolbar window + windowClass = kToolbarWindowClass; + else + { + // close box requires a titlebar + if( nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE ) + nWindowAttributes |= kWindowCloseBoxAttribute; + else + nWindowAttributes &= ~kWindowCloseBoxAttribute; + } + + if( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE ) + { + nWindowAttributes |= (kWindowResizableAttribute | kWindowLiveResizeAttribute); + if( (nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) && (windowClass == kDocumentWindowClass)) + nWindowAttributes |= (kWindowCollapseBoxAttribute | kWindowFullZoomAttribute); // requires titlebar (moveable) and not allowed for floating windows + } + else + nWindowAttributes &= ~(kWindowResizableAttribute | kWindowLiveResizeAttribute | kWindowCollapseBoxAttribute | kWindowFullZoomAttribute); + } + + Rect aContentRect; + GetOptimalWindowSize(&aContentRect); + + // Directly connect the frame with the window in contrast to Win32 where frame and + // window will be connected in the WM_CREATE message handler + OSStatus rc = CreateNewWindow(windowClass, nWindowAttributes, &aContentRect, &mrWindow); + + if (rc != noErr) + throw runtime_error("System window creation failed"); + + UpdateFrameGeometry(); + + // Cache the size of the content area of the window + mnHeight = aContentRect.bottom - aContentRect.top; + mnWidth = aContentRect.right - aContentRect.left; + + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowCloseEvent), 1, &cWindowCloseEvent); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowBoundsChangedEvent), 1, &cWindowBoundsChangedEvent); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleOOoSalUserEvent), 1, &cOOoSalUserEvent); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleOOoSalTimerEvent), 1, &cOOoSalTimerEvent); + + // do not register for paint events as this would result in no draw content events during resize anymore + // draw content events, however, are more effective as they do not require a full window repaint + //InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowPaintEvent), 1, &windowPaintEvent); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowDrawContentEvent), 1, &cWindowDrawContentEvent); + + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowActivatedEvent), 1, &cWindowActivatedEvent); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleMouseUpDownEvent), GetEventTypeCount(cMouseUpDownEvent), cMouseUpDownEvent); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowResizeStarted), 1, &cWindowResizeStarted); + InstallAndRegisterEventHandler(NewEventHandlerUPP(HandleWindowResizeCompleted), 1, &cWindowResizeCompleted); +} + +OSStatus AquaSalFrame::InstallAndRegisterEventHandler(EventHandlerUPP upp, size_t nEvents, const EventTypeSpec* eventSpec) +{ + EventHandlerRef evtHandler; + OSStatus rc = InstallWindowEventHandler(mrWindow, upp, nEvents, eventSpec, this, &evtHandler); + + if (rc == noErr) + mSysWindowEventHandlerDataContainer.push_back(make_pair(upp, evtHandler)); + + return rc; +} + +void AquaSalFrame::DeinstallAndUnregisterAllEventHandler() +{ + SysWindowEventHandlerDataContainer_t::iterator iter = mSysWindowEventHandlerDataContainer.begin(); + SysWindowEventHandlerDataContainer_t::iterator iter_end = mSysWindowEventHandlerDataContainer.end(); + for (/*NOP*/; iter != iter_end; ++iter) + { + DisposeEventHandlerUPP((*iter).first); + RemoveEventHandler((*iter).second); + } + mSysWindowEventHandlerDataContainer.clear(); +} + +OSStatus GetOptimalWindowSize(Rect* rect) +{ + OSStatus err = noErr; + GDHandle hDisplay; + + BOOST_ASSERT(rect != NULL && "Precondition violated"); + + /* + for (hDisplay = DMGetFirstScreenDevice(TRUE); hDisplay != 0; hDisplay = DMGetNextScreenDevice(hDisplay, TRUE)){} + err = GetAvailableWindowPositioningBounds(hDisplay,rect); + */ + rect->top = 100; + rect->left = 100; + rect->bottom = 500; + rect->right = 500; + return err; } diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/window/salobj.cxx ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/salobj.cxx --- ooo_SRC680_m172_src.orig/vcl/aqua/source/window/salobj.cxx 2005-09-09 12:45:37.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/salobj.cxx 2005-11-27 10:48:41.000000000 +0100 @@ -38,8 +38,8 @@ #ifndef _SV_SALDATA_HXX #include #endif -#ifndef _SV_SALOBJ_HXX -#include +#ifndef _SV_SALOBJ_H +#include #endif // ======================================================================= @@ -51,118 +51,118 @@ // ======================================================================= -SalObject::SalObject() +AquaSalObject::AquaSalObject() { SalData* pSalData = GetSalData(); - maObjectData.mpFrame = NULL; - maObjectData.mpInst = NULL; - maObjectData.mpProc = ImplSalObjectCallbackDummy; + mpFrame = NULL; + mpInst = NULL; + mpProc = ImplSalObjectCallbackDummy; // Insert object in objectlist - maObjectData.mpNextObject = pSalData->mpFirstObject; + mpNextObject = (AquaSalObject*)pSalData->mpFirstObject; pSalData->mpFirstObject = this; } // ----------------------------------------------------------------------- -SalObject::~SalObject() +AquaSalObject::~AquaSalObject() { SalData* pSalData = GetSalData(); // remove frame from framelist if ( this == pSalData->mpFirstObject ) - pSalData->mpFirstObject = maObjectData.mpNextObject; + pSalData->mpFirstObject = mpNextObject; else { - SalObject* pTempObject = pSalData->mpFirstObject; - while ( pTempObject->maObjectData.mpNextObject != this ) - pTempObject = pTempObject->maObjectData.mpNextObject; - pTempObject->maObjectData.mpNextObject = maObjectData.mpNextObject; + AquaSalObject* pTempObject = (AquaSalObject*)pSalData->mpFirstObject; + while ( pTempObject->mpNextObject != this ) + pTempObject = pTempObject->mpNextObject; + pTempObject->mpNextObject = mpNextObject; } } // ----------------------------------------------------------------------- -void SalObject::ResetClipRegion() +void AquaSalObject::ResetClipRegion() { } // ----------------------------------------------------------------------- -USHORT SalObject::GetClipRegionType() +USHORT AquaSalObject::GetClipRegionType() { return SAL_OBJECT_CLIP_INCLUDERECTS; } // ----------------------------------------------------------------------- -void SalObject::BeginSetClipRegion( ULONG nRectCount ) +void AquaSalObject::BeginSetClipRegion( ULONG nRectCount ) { } // ----------------------------------------------------------------------- -void SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) +void AquaSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) { } // ----------------------------------------------------------------------- -void SalObject::EndSetClipRegion() +void AquaSalObject::EndSetClipRegion() { } // ----------------------------------------------------------------------- -void SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) +void AquaSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) { } // ----------------------------------------------------------------------- -void SalObject::Show( BOOL bVisible ) +void AquaSalObject::Show( BOOL bVisible ) { } // ----------------------------------------------------------------------- -void SalObject::Enable( BOOL bEnable ) +void AquaSalObject::Enable( BOOL bEnable ) { } // ----------------------------------------------------------------------- -void SalObject::GrabFocus() +void AquaSalObject::GrabFocus() { } // ----------------------------------------------------------------------- -void SalObject::SetBackground() +void AquaSalObject::SetBackground() { } // ----------------------------------------------------------------------- -void SalObject::SetBackground( SalColor nSalColor ) +void AquaSalObject::SetBackground( SalColor nSalColor ) { } // ----------------------------------------------------------------------- -const SystemEnvData* SalObject::GetSystemData() const +const SystemEnvData* AquaSalObject::GetSystemData() const { return NULL; } // ----------------------------------------------------------------------- -void SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) +void AquaSalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) { - maObjectData.mpInst = pInst; + mpInst = pInst; if ( pProc ) - maObjectData.mpProc = pProc; + mpProc = pProc; else - maObjectData.mpProc = ImplSalObjectCallbackDummy; + mpProc = ImplSalObjectCallbackDummy; } diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/window/VCLView.m ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/VCLView.m --- ooo_SRC680_m172_src.orig/vcl/aqua/source/window/VCLView.m 2005-09-09 12:44:38.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/VCLView.m 1970-01-01 01:00:00.000000000 +0100 @@ -1,100 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import -#import - -#define _SV_VCLVIEW_M - -// ------------- -// - VCLView - -// ------------- - -@implementation VCLView - -- (void)drawRect: (NSRect)aRect -{ -} - -- init -{ - qdRgnResized=0; - return self; -} - -- (void)lockFocus -{ - [super lockFocus]; - - // [ed] 12/15/01 If we haven't done so yet, adjust the visRgn and clipRgn of the port - // to match the view. OS 10.1 changed the default behaviour of the clipping of - // NSQDViews and they now require initialization. - - if(!qdRgnResized) - { - RgnHandle tempRgn; - Rect r; - - r.left=0; - r.top=0; - r.right=[self bounds].size.width; - r.bottom=[self bounds].size.height; - - SetPort([self qdPort]); - - tempRgn=NewRgn(); - RectRgn(tempRgn, &r); - - ClipRect(&r); - SetPortVisibleRegion([self qdPort], tempRgn); - PortChanged([self qdPort]); - - DisposeRgn(tempRgn); - qdRgnResized=1; - } -} - -- (MacOSBOOL)isOpaque -{ - // Set background to white to avoid flickering when timer paints - return YES; -} - -@end - -// ----------------------- -// - C wrapper functions - -// ----------------------- - diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/aqua/source/window/VCLWindow.m ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/VCLWindow.m --- ooo_SRC680_m172_src.orig/vcl/aqua/source/window/VCLWindow.m 2005-09-09 12:44:52.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/aqua/source/window/VCLWindow.m 1970-01-01 01:00:00.000000000 +0100 @@ -1,329 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile$ - * - * $Revision$ - * - * last change: $Author$ $Date$ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#import - -#define _SV_VCLWINDOW_M - -// ------------- -// - VCLWindow - -// ------------- - -@implementation VCLWindow - -- (void)setContentSize: (NSSize)aSize -{ - NSRect aFrameRect = [self frame]; - NSRect aContentRect; - struct SalPaintEvent aPaintEvt; - - // Get the current size of the content view - aContentRect = [VCLWindow contentRectForFrameRect: aFrameRect - styleMask: [self styleMask]]; - - if ( aSize.width != aContentRect.size.width || - aSize.height != aContentRect.size.height ) - { - // Cache the new size - mpSalFrameData->mnWidth = aSize.width; - mpSalFrameData->mnHeight = aSize.height; - - // Pass the event to this window's callback function. We need to force - // a resize before we post a paint event, otherwise only the old content - // view area will only be painted. - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_RESIZE, NULL); - - // Initialize SalKeyEvent structure - aPaintEvt.mnBoundX = 0; - aPaintEvt.mnBoundY = 0; - aPaintEvt.mnBoundWidth = aSize.width; - aPaintEvt.mnBoundHeight = aSize.height; - - // Pass the event to this window's callback function - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_PAINT, &aPaintEvt ); - } - - // Invoke the superclass to set the size of the window - [super setContentSize: aSize]; -} - -- (void)windowDidBecomeKey: (NSNotification *)aNotification -{ - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_GETFOCUS, NULL ); -} - -- (void)windowDidResignKey: (NSNotification *)aNotification -{ - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_LOSEFOCUS, NULL ); -} - -- (MacOSBOOL)windowShouldClose: (id)sender -{ - // Pass the event to this window's callback function. - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_CLOSE, NULL ); - - // Always return FALSE as the event handler above should have taken - // care of closing the window - return FALSE; -} - -- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)proposedFrameSize -{ - NSRect aFrameRect; - NSRect aContentRect; - NSEvent *pEvent; - struct SalPaintEvent aPaintEvt; - - // Get the size of the window's content area - aFrameRect = NSMakeRect( 0, 0, proposedFrameSize.width, - proposedFrameSize.height ); - aContentRect = [VCLWindow contentRectForFrameRect: aFrameRect - styleMask: [self styleMask]]; - - if ( aContentRect.size.width != mpSalFrameData->mnWidth || - aContentRect.size.height != mpSalFrameData->mnHeight ) - { - // Cache the new size - mpSalFrameData->mnWidth = aContentRect.size.width; - mpSalFrameData->mnHeight = aContentRect.size.height; - - // Pass the event to this window's callback function. - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_RESIZE, NULL); - - // Initialize SalKeyEvent structure - aPaintEvt.mnBoundX = 0; - aPaintEvt.mnBoundY = 0; - aPaintEvt.mnBoundWidth = aContentRect.size.width; - aPaintEvt.mnBoundHeight = aContentRect.size.height; - - // Pass the event to this window's callback function - mpSalFrameData->mpProc( mpSalFrameData->mpInst, mpSalFrame, - SALEVENT_PAINT, &aPaintEvt ); - - // We need to poll for the next NSPeriodic event that is posted - // by the paint event that we posted, otherwise no repainting will - // happen until after the last windowWillResize notification has - // been issued. If the NSPeriodic event has not been posted yet, - // don't worry about it as we will catch it the next time through. - if ( [self isVisible] ) - { - pEvent = [NSApp nextEventMatchingMask: NSPeriodicMask - untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES]; - if ( pEvent ) - [NSApp sendEvent: pEvent]; - } - } - - return proposedFrameSize; -} - -@end - -// ----------------------- -// - C wrapper functions - -// ----------------------- - -VCLWINDOW VCLWindow_New( ULONG nSalFrameStyle, VCLWINDOW hParentWindow, - SalFrame *pFrame, struct SalFrameData *pFrameData ) -{ - VCLWindow *hWindow = nil; - unsigned int nMask = 0; - NSRect aContentRect; - NSNotificationCenter *pNotifyCenter = [NSNotificationCenter defaultCenter]; - - if (nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE) { - nMask |= NSResizableWindowMask; - } - if (nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) { - nMask |= NSClosableWindowMask; - } - if (nSalFrameStyle & SAL_FRAME_STYLE_MINABLE) { - nMask |= NSMiniaturizableWindowMask; - } - if (nSalFrameStyle & SAL_FRAME_STYLE_BORDER) { - nMask |= NSTitledWindowMask; - } - - // Special settings for a generic window (i.e. one with a title bar) - if( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT ) { - // Make sure there is a title bar - nMask |= NSTitledWindowMask; - aContentRect = [[NSScreen mainScreen] visibleFrame]; - } - // Generate a window without a title bar - else if( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) - { - // Make sure that we turn off all title bar related items - nMask &= ~NSClosableWindowMask; - nMask &= ~NSMiniaturizableWindowMask; - nMask &= ~NSTitledWindowMask; - - // Need to determine the correct default size for this case - aContentRect = NSMakeRect(0, 0, 200, 300); - } - // All other windows - else - { - // Make sure there is a title bar - nMask |= NSTitledWindowMask; - aContentRect = NSMakeRect(0, 0, 500, 400); - } - - // Create a native window - hWindow = [[VCLWindow new] initWithContentRect: aContentRect - styleMask: nMask backing: NSBackingStoreBuffered defer: YES]; - - // We need to attach the required SalFrameData struct pointer - hWindow->mpSalFrame = pFrame; - hWindow->mpSalFrameData = pFrameData; - - // Cache the size of the content area of the window - hWindow->mpSalFrameData->mnHeight = aContentRect.size.height; - hWindow->mpSalFrameData->mnWidth = aContentRect.size.width; - - // We need to set the window as its own Delegate to capture - // resizing events - [hWindow setDelegate: hWindow]; - - // We need to replace the window's contentView with an VCLView so - // that we can paint using QuickDraw - [hWindow setContentView: [[[VCLView new] init] initWithFrame: [hWindow frame]]]; - - // Turn on optimized drawing since we have no overlapping views - [hWindow useOptimizedDrawing: YES]; - - // Turn on mouse entered and exited events - [[hWindow contentView] addTrackingRect: aContentRect owner: hWindow - userData: nil assumeInside: NO]; - - return hWindow; -} - -VCLVIEW VCLWindow_ContentView( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return NULL; - - return [(VCLWindow *)hWindow contentView]; -} - -void VCLWindow_Show( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // If being shown for the first time, center it - if ( ! [(VCLWindow *)hWindow isVisible] ) - [(VCLWindow *)hWindow center]; - - // Bring the window to the front - [(VCLWindow *)hWindow makeKeyAndOrderFront: NSApp]; - - // Turn on tracking of mouse move events. Note that we can't do this until - // after [VCLWindow makeKeyAndOrderFront:] is invoked. Otherwise, this call - // does nothing. - [(VCLWindow *)hWindow setAcceptsMouseMovedEvents: YES]; -} - -void VCLWindow_Close( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // Hide the window - [(VCLWindow *)hWindow orderOut: (VCLWindow *)hWindow]; -} - -void VCLWindow_Release( VCLWINDOW hWindow ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // Closing releases the window - [(VCLWindow *)hWindow close]; -} - -void VCLWindow_SetTitle( VCLWINDOW hWindow, const char *pTitle ) -{ - NSString *pString = nil; - - if ( (VCLWindow *)hWindow == nil ) - return; - - pString = [NSString stringWithCString: pTitle]; - [(VCLWindow *)hWindow setTitle: pString]; -} - -void VCLWindow_SetSize( VCLWINDOW hWindow, long nWidth, long nHeight ) -{ - if ( (VCLWindow *)hWindow == nil ) - return; - - // Set the native window size - [(VCLWindow *)hWindow setContentSize: NSMakeSize(nWidth, nHeight)]; -} - -BOOL VCLWindow_PostEvent( VCLWINDOW hWindow, void *pData ) -{ - NSEvent *pEvent = nil; - NSDate *pDate = nil; - - if ( (VCLWindow *)hWindow == nil ) - return FALSE; - - // Construct an event - pDate = [NSDate date]; - pEvent = [NSEvent otherEventWithType: NSApplicationDefined - location: NSMakePoint(0, 0) modifierFlags: 0 - timestamp: [pDate timeIntervalSince1970] - windowNumber: [(VCLWindow *)hWindow windowNumber] - context: nil subtype: 0 data1: (int)pData data2: 0]; - - // Post the event - [(VCLWindow *)hWindow postEvent: pEvent atStart: NO]; - - return TRUE; -} - -void VCLWindow_Beep( VCLWINDOW hWindow ) -{ - NSBeep(); -} diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/inc/salbtype.hxx ooo_SRC680_m172_src.aquavcl01/vcl/inc/salbtype.hxx --- ooo_SRC680_m172_src.orig/vcl/inc/salbtype.hxx 2006-01-27 14:49:55.000000000 +0100 +++ ooo_SRC680_m172_src.aquavcl01/vcl/inc/salbtype.hxx 2006-02-20 14:17:12.000000000 +0100 @@ -89,7 +89,7 @@ #define BMP_FORMAT_8BIT_PAL 0x00000010UL #define BMP_FORMAT_8BIT_TC_MASK 0x00000020UL -// #define BMP_FORMAT_16BIT_TC_MASK 0x00000040UL +#define BMP_FORMAT_16BIT_TC_MASK 0x00000040UL #define BMP_FORMAT_24BIT_TC_BGR 0x00000080UL #define BMP_FORMAT_24BIT_TC_RGB 0x00000100UL diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/prj/build.lst ooo_SRC680_m172_src.aquavcl01/vcl/prj/build.lst --- ooo_SRC680_m172_src.orig/vcl/prj/build.lst 2006-05-24 16:22:35.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/prj/build.lst 2006-06-18 20:22:14.000000000 +0200 @@ -30,5 +30,5 @@ vc vcl\mac\source\gdi nmake - m vc__gdim NULL vc vcl\mac\source\window nmake - m vc__winm NULL vc vcl\mac\source\src nmake - m vc__srcm NULL -vc vcl\util nmake - all vc_util vc__plug.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__gdim.m vc__gdiu.u vc__gdiw.w vc__srcm.m vc__srcu.u vc__srcw.w vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__du.u vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs NULL +vc vcl\util nmake - all vc_util vc__plug.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__srcm.m vc__srcu.u vc__srcw.w vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__du.u vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs NULL vc vcl\workben nmake - all vc_wrkb vc_util NULL diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/source/app/settings.cxx ooo_SRC680_m172_src.aquavcl01/vcl/source/app/settings.cxx --- ooo_SRC680_m172_src.orig/vcl/source/app/settings.cxx 2006-05-04 17:10:37.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/source/app/settings.cxx 2006-06-17 15:12:00.000000000 +0200 @@ -76,8 +76,10 @@ #endif #ifdef UNX +#if !defined(QUARTZ) #include #include +#endif #include #include #endif diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/source/app/svmainhook.cxx ooo_SRC680_m172_src.aquavcl01/vcl/source/app/svmainhook.cxx --- ooo_SRC680_m172_src.orig/vcl/source/app/svmainhook.cxx 2005-10-13 11:36:48.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/source/app/svmainhook.cxx 2006-06-25 16:34:11.000000000 +0200 @@ -37,7 +37,7 @@ #include #endif -#ifndef MACOSX +#if not defined(MACOSX) || defined(QUARTZ) // only Mac OS X / X11 needs this trick, the Aqua version has its own native event loop BOOL ImplSVMainHook( BOOL *pbInit ) { diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/util/makefile.mk ooo_SRC680_m172_src.aquavcl01/vcl/util/makefile.mk --- ooo_SRC680_m172_src.orig/vcl/util/makefile.mk 2006-05-05 13:01:49.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/util/makefile.mk 2006-06-17 15:21:07.000000000 +0200 @@ -150,7 +150,7 @@ $(SLB)$/helper.lib -.IF "$(GUI)" == "UNX" +.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" LIB1FILES+=$(SLB)$/salplug.lib .ELSE LIB1FILES+= \ @@ -236,10 +236,12 @@ .ENDIF .IF "$(GUIBASE)"=="aqua" -SHL1STDLIBS += -framework Cocoa +SHL1STDLIBS += -framework Cocoa -framework Carbon .ENDIF +.IF "$(GUIBASE)"!="aqua" SHL1STDLIBS += -lX11 +.ENDIF .IF "$(OS)"=="MACOSX" SHL1STDLIBS += -framework Foundation -framework CoreFoundation @@ -264,7 +266,6 @@ # libs for generic plugin SHL2STDLIBS=\ $(VCLLIB)\ - -lpsp$(VERSION)$(DLLPOSTFIX)\ $(SOTLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ @@ -275,11 +276,17 @@ $(VOSLIB) \ $(SALLIB) +.IF "$(GUIBASE)"!="aqua" +SHL2STDLIBS+=-lpsp$(VERSION)$(DLLPOSTFIX) +.ENDIF + # prepare linking of Xinerama .IF "$(USE_XINERAMA)" != "NO" .IF "$(OS)"=="MACOSX" +.IF "$(GUIBASE)"!="aqua" XINERAMALIBS=-lXinerama +.ENDIF #aqua .ELSE .IF "$(OS)" != "SOLARIS" .IF "$(XINERAMA_LINK)" == "dynamic" @@ -301,6 +308,9 @@ .IF "$(ENABLE_PASF)" != "" .IF "$(OS)"=="MACOSX" SHL2STDLIBS += -framework CoreAudio -framework AudioToolbox +.IF "$(GUIBASE)"=="aqua" +SHL2STDLIBS += -framework Cocoa -framework Carbon +.ENDIF # aqua .ENDIF SHL2STDLIBS += -lsndfile -lportaudio .ENDIF # ENABLE_PASF @@ -329,8 +339,10 @@ # dummy plugin LIB3TARGET=$(SLB)$/idummy_plug_ +.IF "$(GUIBASE)"!="aqua" LIB3FILES= \ $(SLB)$/dapp.lib +.ENDIF SHL3TARGET=vclplug_dummy$(UPD)$(DLLPOSTFIX) SHL3IMPLIB=idummy_plug_ SHL3LIBS=$(LIB3TARGET) @@ -339,7 +351,6 @@ # libs for dummy plugin SHL3STDLIBS=\ $(VCLLIB)\ - -lpsp$(VERSION)$(DLLPOSTFIX)\ $(SOTLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ @@ -350,6 +361,10 @@ $(VOSLIB) \ $(SALLIB) +.IF "$(GUIBASE)"!="aqua" +SHL3STDLIBS += -lpsp$(VERSION)$(DLLPOSTFIX) +.ENDIF + # gtk plugin .IF "$(ENABLE_GTK)" != "" PKGCONFIG_MODULES=gtk+-2.0 gthread-2.0 @@ -376,7 +391,7 @@ SHL4STDLIBS+=-l$(SHL2TARGET) -.IF "$(OS)"=="FREEBSD" || "$(OS)"=="MACOSX" +.IF "$(OS)"=="FREEBSD" || "$(OS)"=="MACOSX" SHL4STDLIBS+=$(SHL3STDLIBS) -lX11 .ELSE SHL4STDLIBS+=$(SHL3STDLIBS) -lX11 -ldl diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/workben/makefile.mk ooo_SRC680_m172_src.aquavcl01/vcl/workben/makefile.mk --- ooo_SRC680_m172_src.orig/vcl/workben/makefile.mk 2005-09-09 16:09:34.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/workben/makefile.mk 2006-03-10 16:15:44.000000000 +0100 @@ -38,7 +38,8 @@ PRJNAME=SV TARGET=svdem LIBTARGET=NO -TARGETTYPE=GUI +#TARGETTYPE=GUI +NO_DEFAULT_STL=TRUE # --- Settings ----------------------------------------------------- diff -x CVS -urN ooo_SRC680_m172_src.orig/vcl/workben/svdem.cxx ooo_SRC680_m172_src.aquavcl01/vcl/workben/svdem.cxx --- ooo_SRC680_m172_src.orig/vcl/workben/svdem.cxx 2005-09-09 16:10:00.000000000 +0200 +++ ooo_SRC680_m172_src.aquavcl01/vcl/workben/svdem.cxx 2006-03-10 16:15:44.000000000 +0100 @@ -40,11 +40,16 @@ #include #include #include +#include +#include #include #include #include +#include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; // ----------------------------------------------------------------------- @@ -86,10 +91,22 @@ void Main() { + /* + IntroWindow splash; + splash.Show(); + sleep(5); + splash.Hide(); + */ + MyWin aMainWin( NULL, WB_APP | WB_STDWORK ); aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - Workbench" ) ) ); aMainWin.Show(); + /* + InfoBox ib(NULL, String((sal_Char*)"Test", sizeof("Test"))); + ib.Execute(); + */ + Application::Execute(); } @@ -111,14 +128,16 @@ void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) { - WorkWindow::MouseButtonDown( rMEvt ); + Rectangle aRect(0,0,4,4); + aRect.SetPos( rMEvt.GetPosPixel() ); + SetFillColor(Color(COL_RED)); + DrawRect( aRect ); } // ----------------------------------------------------------------------- void MyWin::MouseButtonUp( const MouseEvent& rMEvt ) { - WorkWindow::MouseButtonUp( rMEvt ); } // ----------------------------------------------------------------------- @@ -139,7 +158,21 @@ void MyWin::Paint( const Rectangle& rRect ) { - WorkWindow::Paint( rRect ); + fprintf(stderr, "MyWin::Paint(%d,%d,%d,%d)\n", rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight()); + + Size aSz(GetSizePixel()); + Point aPt; + Rectangle r(aPt, aSz); + + SetFillColor(Color(COL_BLUE)); + SetLineColor(Color(COL_YELLOW)); + + DrawRect( r ); + int i; + for(int i=0; i