diff -urN ooo_SRC680_m173_src.orig/vcl/aqua/inc/salmenu.h ooo_SRC680_m173_src/vcl/aqua/inc/salmenu.h --- ooo_SRC680_m173_src.orig/vcl/aqua/inc/salmenu.h 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m173_src/vcl/aqua/inc/salmenu.h 2006-06-25 16:23:46.000000000 +0200 @@ -0,0 +1,88 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: salmenu.h,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: rt $ $Date: 2005/09/09 12:45:35 $ + * + * 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_SALMENU_H +#define _SV_SALMENU_H + +#ifndef _SV_SV_H +#include +#endif +#ifndef _SV_BITMAP_HXX +#include +#endif + +#ifndef _SV_SALMENU_HXX +#include +#endif + + +class AquaSalMenu : public SalMenu +{ +public: + AquaSalMenu() {} + virtual ~AquaSalMenu(); + + virtual BOOL VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars + // otherwise only menu messages are processed (eg, OLE on Windows) + + virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ); + virtual void RemoveItem( unsigned nPos ); + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ); + virtual void SetFrame( const SalFrame* pFrame ); + virtual void CheckItem( unsigned nPos, BOOL bCheck ); + virtual void EnableItem( unsigned nPos, BOOL bEnable ); + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ); + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage); + virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ); + virtual void GetSystemMenuData( SystemMenuData* pData ); + + MenuRef myMenu; // The Carbon reference to this menu + MenuID myMenuID; // The MenuID of this menu + BOOL bMenuBar; // MenuBar or menu? +}; + +class AquaSalMenuItem : public SalMenuItem +{ +public: + AquaSalMenuItem() {} + virtual ~AquaSalMenuItem(); + + MenuRef myMenu; // The menu in which this menu item is inserted + MenuID myMenuID; // The menu ID of this menu + MenuItemIndex item; // The menu index of this menu item in the myMenu menu +}; + +#endif // _SV_SALMENU_H + diff -urN ooo_SRC680_m173_src.orig/vcl/aqua/source/app/salinst.cxx ooo_SRC680_m173_src/vcl/aqua/source/app/salinst.cxx --- ooo_SRC680_m173_src.orig/vcl/aqua/source/app/salinst.cxx 2006-06-25 16:18:51.000000000 +0200 +++ ooo_SRC680_m173_src/vcl/aqua/source/app/salinst.cxx 2006-06-25 16:23:46.000000000 +0200 @@ -612,26 +612,6 @@ -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(); diff -urN ooo_SRC680_m173_src.orig/vcl/aqua/source/window/makefile.mk ooo_SRC680_m173_src/vcl/aqua/source/window/makefile.mk --- ooo_SRC680_m173_src.orig/vcl/aqua/source/window/makefile.mk 2006-06-25 16:18:51.000000000 +0200 +++ ooo_SRC680_m173_src/vcl/aqua/source/window/makefile.mk 2006-06-25 16:23:46.000000000 +0200 @@ -59,6 +59,7 @@ SLOFILES= \ $(SLO)/salframe.obj \ + $(SLO)/salmenu.obj \ $(SLO)/salobj.obj .ENDIF # "$(GUIBASE)"!="aqua" diff -urN ooo_SRC680_m173_src.orig/vcl/aqua/source/window/salmenu.cxx ooo_SRC680_m173_src/vcl/aqua/source/window/salmenu.cxx --- ooo_SRC680_m173_src.orig/vcl/aqua/source/window/salmenu.cxx 1970-01-01 01:00:00.000000000 +0100 +++ ooo_SRC680_m173_src/vcl/aqua/source/window/salmenu.cxx 2006-06-25 16:23:46.000000000 +0200 @@ -0,0 +1,204 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: salmenu.cxx,v $ + * + * $Revision: 1.6 $ + * + * last change: $Author: rt $ $Date: 2005/09/09 13:51:47 $ + * + * 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_SALDATA_HXX +#include +#endif +#ifndef _SV_SALINST_H +#include +#endif +#ifndef _SV_SALMENU_H +#include +#endif + + +// ======================================================================= + +SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar ) +{ + fprintf(stderr, "PJ: AquaSalInstance::CreateMenu(%d)\n", bMenuBar); + + AquaSalMenu *pSalMenu = new AquaSalMenu(); + pSalMenu->bMenuBar = bMenuBar; + + MenuRef myMenu; + MenuItemIndex item; + const MenuCommand kmyCommandPDFExport = FOUR_CHAR_CODE ('Itm1'); + const MenuCommand kmyCommandQuit = FOUR_CHAR_CODE ('Itm2'); + + if (bMenuBar) { + /* PJ: FIXME: menubar, nothing to do? */ + } + else { + /* PJ: What to do in case of menu? */ + } + + fprintf(stderr, "PJ: returning %p\n", pSalMenu); + return pSalMenu; +} + +void AquaSalInstance::DestroyMenu( SalMenu* pSalMenu ) +{ + /* PJ: FIXME: delete myMenu */ + delete pSalMenu; +} + +SalMenuItem* AquaSalInstance::CreateMenuItem( const SalItemParams* pItemData ) +{ + fprintf(stderr, "PJ: AquaSalInstance::CreateMenuItem()\n"); + + if( !pItemData ) + return NULL; + + AquaSalMenuItem *pSalMenuItem = new AquaSalMenuItem(); + + /* FIXME: implement other menu item types like separators, ... + if( pItemData->eType == MENUITEM_SEPARATOR ) { + fprintf(stderr, "PJ: ---- separator ----\n"); + } else { + fprintf(stderr, "PJ: ---- other menu item type ----\n"); + } + */ + + fprintf(stderr, "PJ: nID = %d\n", pItemData->nId); + fprintf(stderr, "PJ: pMenu = %p\n", pItemData->pMenu); + + //Adding item into menubar? + // FIXME: if so, add menu, otherwise menuitem + fprintf(stderr, "PJ: pMenu->bIsMenuBar = %d\n", pItemData->pMenu->IsMenuBar()); + + // Number of items in the menu being created. + // FIXME: if the count is 0, this is the first item in the menu! + fprintf(stderr, "PJ: GetItemCount(pMenu) = %d\n", pItemData->pMenu->GetItemCount()); + fprintf(stderr, "PJ: aText = %s\n", ByteString(pItemData->aText, RTL_TEXTENCODING_UTF8).GetBuffer()); + + static MenuID myMenuID = 0; + myMenuID++; + + CreateNewMenu(myMenuID, 0, &pSalMenuItem->myMenu); + pSalMenuItem->myMenuID = myMenuID; + fprintf(stderr, "PJ: CreateNewMenu called, myMenu = %p, myMenuID = %d\n", pSalMenuItem->myMenu, pSalMenuItem->myMenuID); + + CFStringRef str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s"), ByteString(pItemData->aText,RTL_TEXTENCODING_UTF8).GetBuffer()); + + SetMenuTitleWithCFString(pSalMenuItem->myMenu, str); + InsertMenu(pSalMenuItem->myMenu, 0); + + fprintf(stderr, "PJ: returning %p\n", pSalMenuItem); + return pSalMenuItem; +} + +void AquaSalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem ) +{ + delete pSalMenuItem; +} + + +// ======================================================================= + + +/* + * AquaSalMenu + */ + + +AquaSalMenu::~AquaSalMenu() +{ +} + +BOOL AquaSalMenu::VisibleMenuBar() +{ + fprintf(stderr, "PJ: VisibleMenuBar called!\n"); + return TRUE; +} + +void AquaSalMenu::SetFrame( const SalFrame *pFrame ) +{ + fprintf(stderr, "PJ: SetFrame called!\n"); +} + +void AquaSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) +{ + fprintf(stderr, "PJ: AquaSalMenu::InsertItem called (%p, %d)\n.", pSalMenuItem, nPos); +} + +void AquaSalMenu::RemoveItem( unsigned nPos ) +{ +} + +void AquaSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) +{ + fprintf(stderr, "PJ: SetSubMenu called!\n"); +} + +void AquaSalMenu::CheckItem( unsigned nPos, BOOL bCheck ) +{ +} + +void AquaSalMenu::EnableItem( unsigned nPos, BOOL bEnable ) +{ +} + +void AquaSalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) +{ +} + +void AquaSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ) +{ + fprintf(stderr, "PJ: SetItemText (rText = %s).\n", rText.GetBuffer()); +} + +void AquaSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) +{ +} + +void AquaSalMenu::GetSystemMenuData( SystemMenuData* pData ) +{ +} + +// ======================================================================= + +/* + * SalMenuItem + */ + + +AquaSalMenuItem::~AquaSalMenuItem() +{ +} + +// ------------------------------------------------------------------- + diff -urN ooo_SRC680_m173_src.orig/vcl/source/window/menu.cxx ooo_SRC680_m173_src/vcl/source/window/menu.cxx --- ooo_SRC680_m173_src.orig/vcl/source/window/menu.cxx 2006-06-25 16:18:50.000000000 +0200 +++ ooo_SRC680_m173_src/vcl/source/window/menu.cxx 2006-06-25 16:23:46.000000000 +0200 @@ -152,6 +152,8 @@ #include +#include + namespace vcl { @@ -290,6 +292,9 @@ const XubString& rStr, const Image& rImage, Menu* pMenu, USHORT nPos ) { + + fprintf(stderr, "PJ: MenuItemList::Insert (..., %s)\n", ByteString(rStr, RTL_TEXTENCODING_UTF8).GetBuffer()); + MenuItemData* pData = new MenuItemData( rStr, rImage ); pData->nId = nId; pData->eType = eType; @@ -1157,6 +1162,8 @@ void Menu::InsertItem( USHORT nItemId, const XubString& rStr, MenuItemBits nItemBits, USHORT nPos ) { + fprintf(stderr, "PJ: Menu::InsertItem(..., %s)\n", ByteString(rStr, RTL_TEXTENCODING_UTF8).GetBuffer()); + DBG_ASSERT( nItemId, "Menu::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == MENU_ITEM_NOTFOUND, "Menu::InsertItem(): ItemId already exists" ); diff -urN ooo_SRC680_m173_src.orig/vcl/source/window/syswin.cxx ooo_SRC680_m173_src/vcl/source/window/syswin.cxx --- ooo_SRC680_m173_src.orig/vcl/source/window/syswin.cxx 2006-06-25 16:18:50.000000000 +0200 +++ ooo_SRC680_m173_src/vcl/source/window/syswin.cxx 2006-06-25 16:23:46.000000000 +0200 @@ -33,6 +33,8 @@ * ************************************************************************/ +#include + #ifndef _DEBUG_HXX #include #endif @@ -906,6 +908,9 @@ void SystemWindow::SetMenuBar( MenuBar* pMenuBar ) { + fprintf(stderr, "PJ: SystemWindow::SetMenuBar entered.\n"); + fprintf(stderr, "PJ: mpMenuBar is %p\n", mpMenuBar); + fprintf(stderr, "PJ: pMenuBar is %p\n", pMenuBar); if ( mpMenuBar != pMenuBar ) { MenuBar* pOldMenuBar = mpMenuBar; @@ -964,6 +969,7 @@ mpImplData->mpTaskPaneList->AddWindow( pNewWindow ); } } + fprintf(stderr, "PJ: SystemWindow::SetMenuBar leaved.\n"); } // ----------------------------------------------------------------------- diff -urN ooo_SRC680_m173_src.orig/vcl/workben/svdem.cxx ooo_SRC680_m173_src/vcl/workben/svdem.cxx --- ooo_SRC680_m173_src.orig/vcl/workben/svdem.cxx 2006-06-25 16:18:54.000000000 +0200 +++ ooo_SRC680_m173_src/vcl/workben/svdem.cxx 2006-06-25 16:23:46.000000000 +0200 @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -87,6 +88,9 @@ void KeyUp( const KeyEvent& rKEvt ); void Paint( const Rectangle& rRect ); void Resize(); + MenuBar aMenuBar; + PopupMenu aFileMenu; + PopupMenu aEditMenu; }; // ----------------------------------------------------------------------- @@ -104,6 +108,42 @@ aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - Workbench" ) ) ); aMainWin.Show(); +#define PJ_DEBUG(STRING) fprintf(stderr, "PJ: --- " STRING " ---\n"); + + PJ_DEBUG("1"); + + // fprintf(stderr, "PJ: String: %s\n", ByteString(XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) , RTL_TEXTENCODING_UTF8 ).GetBuffer()); + + aMainWin.aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) ); + + PJ_DEBUG("2"); + + aMainWin.aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Edit" ) ) ); + + PJ_DEBUG("3"); + + aMainWin.aMenuBar.SetPopupMenu( 1, &aMainWin.aFileMenu ); + + PJ_DEBUG("4"); + aMainWin.aMenuBar.SetPopupMenu( 2, &aMainWin.aEditMenu ); + PJ_DEBUG("5"); + aMainWin.aFileMenu.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Open" ) )); + PJ_DEBUG("6"); + aMainWin.aFileMenu.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Close" ) )); + PJ_DEBUG("7"); + aMainWin.aFileMenu.InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Exit" ) )); + PJ_DEBUG("8"); + + aMainWin.aEditMenu.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Search" ) )); + PJ_DEBUG("9"); + aMainWin.aEditMenu.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Replace" ) )); + + PJ_DEBUG("10"); + + aMainWin.SetMenuBar( &aMainWin.aMenuBar ); + + PJ_DEBUG("11"); + /* InfoBox ib(NULL, String((sal_Char*)"Test", sizeof("Test"))); ib.Execute();