[Libreoffice-commits] .: 4 commits - sc/qa sc/source svl/CppunitTest_svl_lngmisc.mk svl/qa unotest/inc unotest/prj unotest/source vcl/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Sat Nov 26 23:33:23 PST 2011
sc/qa/unit/macros-test.cxx | 37 -------
sc/source/ui/inc/namedefdlg.hxx | 2
svl/CppunitTest_svl_lngmisc.mk | 33 +++++-
svl/qa/unit/test_lngmisc.cxx | 30 ++++++
unotest/inc/unotest/macros_test.hxx | 54 +++++++++++
unotest/prj/d.lst | 1
unotest/source/cpp/macros_test.cxx | 60 ++++++++++++
unotest/source/cpp/makefile.mk | 1
vcl/source/window/accel.cxx | 24 ++--
vcl/source/window/accmgr.cxx | 60 ++++++------
vcl/source/window/menu.cxx | 175 ++++++++++++++++++------------------
11 files changed, 310 insertions(+), 167 deletions(-)
New commits:
commit c97b6bde2e9eeac9acad7739e3d72372c0bf0670
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 27 08:26:47 2011 +0100
add missing licence headers
diff --git a/svl/CppunitTest_svl_lngmisc.mk b/svl/CppunitTest_svl_lngmisc.mk
index 89c211b..fc5dd45 100644
--- a/svl/CppunitTest_svl_lngmisc.mk
+++ b/svl/CppunitTest_svl_lngmisc.mk
@@ -1,3 +1,31 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*****************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2011 August Sodora <augsod at gmail.com> (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*****************************************************************************
+
$(eval $(call gb_CppunitTest_CppunitTest,svl_lngmisc))
$(eval $(call gb_CppunitTest_add_exception_objects,svl_lngmisc, \
@@ -29,8 +57,9 @@ $(eval $(call gb_CppunitTest_add_linked_libs,svl_lngmisc, \
endif
$(eval $(call gb_CppunitTest_set_include,svl_lngmisc,\
--I$(realpath $(SRCDIR)/svl/source/inc) \
--I$(realpath $(SRCDIR)/svl/inc) \
-$$(INCLUDE) \
--I$(OUTDIR)/inc \
-))
\ No newline at end of file
+ -I$(realpath $(SRCDIR)/svl/source/inc) \
+ -I$(realpath $(SRCDIR)/svl/inc) \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+))
+# vim: set noet sw=4 ts=4:
diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx
index 561fde3..8aa9db4 100644
--- a/svl/qa/unit/test_lngmisc.cxx
+++ b/svl/qa/unit/test_lngmisc.cxx
@@ -1,3 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 August Sodora <augsod at gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
#include "sal/config.h"
#include "sal/precppunit.hxx"
@@ -164,3 +192,5 @@ namespace
CPPUNIT_TEST_SUITE_REGISTRATION(LngMiscTest);
}
CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b89d67ce53c3827c8d4ed7f9fdb1b6f4428b11bf
Author: Luc Castermans <luc.castermans at gmail.com>
Date: Fri Nov 25 23:13:14 2011 +0100
translated comments from German to English
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index 3fb5aab..9538774 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -50,7 +50,7 @@ typedef ::std::vector< ImplAccelEntry* > ImplAccelList;
class ImplAccelData
{
public:
- ImplAccelTable maKeyTable; // Fuer KeyCodes, die mit einem Code erzeugt wurden
+ ImplAccelTable maKeyTable; // for keycodes, generated with a code
ImplAccelList maIdList; // Id-List
};
@@ -69,7 +69,7 @@ sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId,
size_t nCount = pList->size();
sal_uInt16 nCompareId;
- // Abpruefen, ob der erste Key groesser als der Vergleichskey ist
+ // check if first key is larger then the key to compare
if ( !nCount || (nId < (*pList)[ 0 ]->mnId) )
{
if ( pIndex )
@@ -77,7 +77,7 @@ sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId,
return ACCELENTRY_NOTFOUND;
}
- // Binaeres Suchen
+ // Binairy search
nLow = 0;
nHigh = nCount-1;
do
@@ -188,12 +188,12 @@ ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const
void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
{
- // Tabellen kopieren
+ // copy table
for ( size_t i = 0, n = rAccelData.maIdList.size(); i < n; ++i )
{
ImplAccelEntry* pEntry = new ImplAccelEntry( *rAccelData.maIdList[ i ] );
- // Folge-Accelerator, dann auch kopieren
+ // sequence accelerator, then copy also
if ( pEntry->mpAccel )
{
pEntry->mpAccel = new Accelerator( *(pEntry->mpAccel) );
@@ -211,7 +211,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
void Accelerator::ImplDeleteData()
{
- // Accelerator-Eintraege ueber die Id-Tabelle loeschen
+ // delete accelerator-entries using the id-table
for ( size_t i = 0, n = mpData->maIdList.size(); i < n; ++i ) {
ImplAccelEntry* pEntry = mpData->maIdList[ i ];
if ( pEntry->mpAutoAccel ) {
@@ -254,7 +254,7 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode,
return;
}
- // Neuen Eintrag holen und fuellen
+ // fetch and fill new entries
ImplAccelEntry* pEntry = new ImplAccelEntry;
pEntry->mnId = nItemId;
pEntry->maKeyCode = rKeyCode;
@@ -262,7 +262,7 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode,
pEntry->mpAutoAccel = pAutoAccel;
pEntry->mbEnabled = bEnable;
- // Ab in die Tabellen
+ // now into the tables
sal_uLong nCode = rKeyCode.GetFullKeyCode();
if ( !nCode )
{
@@ -337,7 +337,7 @@ Accelerator::~Accelerator()
{
DBG_DTOR( Accelerator, NULL );
- // AccelManager benachrichtigen, das Accelrator geloescht wurde
+ // inform AccelManager about deleting the Accelerator
if ( mpDel )
*mpDel = sal_True;
@@ -392,7 +392,7 @@ void Accelerator::InsertItem( const ResId& rResId )
if ( nObjMask & ACCELITEM_KEY )
{
- // es wird ein neuer Kontext aufgespannt
+ // new context was created
RSHEADER_TYPE * pKeyCodeRes = (RSHEADER_TYPE *)GetClassRes();
ResId aResId( pKeyCodeRes, *rResId.GetResMgr());
aKeyCode = KeyCode( aResId );
@@ -463,14 +463,14 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel )
DBG_CHKTHIS( Accelerator, NULL );
DBG_CHKOBJ( &rAccel, Accelerator, NULL );
- // Neue Daten zuweisen
+ // assign new data
maHelpStr = rAccel.maHelpStr;
maCurKeyCode = KeyCode();
mnCurId = 0;
mnCurRepeat = 0;
mbIsCancel = sal_False;
- // Tabellen loeschen und kopieren
+ // delete and copy tables
ImplDeleteData();
mpData->maKeyTable.Clear();
ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
index a14530a..85f10fb 100644
--- a/vcl/source/window/accmgr.cxx
+++ b/vcl/source/window/accmgr.cxx
@@ -69,7 +69,7 @@ sal_Bool ImplAccelManager::InsertAccel( Accelerator* pAccel )
void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
{
- // Haben wir ueberhaupt eine Liste ?
+ // do we have a list ?
if ( !mpAccelList )
return;
@@ -90,7 +90,7 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
}
}
- // Raus damit
+ // throw it away
for ( ImplAccelList::iterator it = mpAccelList->begin();
it < mpAccelList->end();
++it
@@ -106,11 +106,11 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
void ImplAccelManager::EndSequence( sal_Bool bCancel )
{
- // Sind wir ueberhaupt in einer Sequenz ?
+ // are we in a list ?
if ( !mpSequenceList )
return;
- // Alle Deactivate-Handler der Acceleratoren in der Sequenz rufen
+ // call all deactivate-handler of the accelerators in the list
for ( size_t i = 0, n = mpSequenceList->size(); i < n; ++i )
{
Accelerator* pTempAccel = (*mpSequenceList)[ i ];
@@ -125,7 +125,7 @@ void ImplAccelManager::EndSequence( sal_Bool bCancel )
}
}
- // Sequenz-Liste loeschen
+ // delete sequence-list
delete mpSequenceList;
mpSequenceList = NULL;
}
@@ -136,53 +136,53 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
{
Accelerator* pAccel;
- // Haben wir ueberhaupt Acceleratoren ??
+ // do we have accelerators ??
if ( !mpAccelList )
return sal_False;
if ( mpAccelList->empty() )
return sal_False;
- // Sind wir in einer Sequenz ?
+ // are we in a sequence ?
if ( mpSequenceList )
{
pAccel = mpSequenceList->empty() ? NULL : (*mpSequenceList)[ 0 ];
DBG_CHKOBJ( pAccel, Accelerator, NULL );
- // Nicht Gefunden ?
+ // not found ?
if ( !pAccel )
{
- // Sequenz abbrechen
+ // abort sequence
FlushAccel();
return sal_False;
}
- // Ist der Eintrag da drin ?
+ // can the entry be found ?
ImplAccelEntry* pEntry = pAccel->ImplGetAccelData( rKeyCode );
if ( pEntry )
{
Accelerator* pNextAccel = pEntry->mpAccel;
- // Ist da ein Accelerator hinter ?
+ // is an accelerator coupled ?
if ( pNextAccel )
{
DBG_CHKOBJ( pNextAccel, Accelerator, NULL );
mpSequenceList->insert( mpSequenceList->begin(), pNextAccel );
- // Activate-Handler vom Neuen rufen
+ // call Activate-Handler of the new one
pNextAccel->Activate();
return sal_True;
}
else
{
- // Hat ihn schon !
+ // it is there already !
if ( pEntry->mbEnabled )
{
- // Sequence beenden (Deactivate-Handler vorher rufen)
+ // stop sequence (first call deactivate-handler)
EndSequence();
- // Dem Accelerator das aktuelle Item setzen
- // und Handler rufen
+ // set accelerator of the actuel item
+ // and call the handler
sal_Bool bDel = sal_False;
pAccel->maCurKeyCode = rKeyCode;
pAccel->mnCurId = pEntry->mnId;
@@ -190,7 +190,7 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
pAccel->mpDel = &bDel;
pAccel->Select();
- // Hat Accel den Aufruf ueberlebt
+ // did the accelerator survive the call
if ( !bDel )
{
DBG_CHKOBJ( pAccel, Accelerator, NULL );
@@ -204,8 +204,8 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
}
else
{
- // Sequenz abbrechen, weil Acceleraor disabled
- // Taste wird weitergeleitet (ans System)
+ // stop sequence as the accelerator was disbled
+ // transfer the key (to the system)
FlushAccel();
return sal_False;
}
@@ -213,50 +213,50 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
}
else
{
- // Sequenz abbrechen wegen falscher Taste
+ // wrong key => stop sequence
FlushAccel();
return sal_False;
}
}
- // Durch die Liste der Acceleratoren wuehlen
+ // step through the list of accelerators
for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i )
{
pAccel = (*mpAccelList)[ i ];
DBG_CHKOBJ( pAccel, Accelerator, NULL );
- // Ist der Eintrag da drin ?
+ // is the entry contained ?
ImplAccelEntry* pEntry = pAccel->ImplGetAccelData( rKeyCode );
if ( pEntry )
{
Accelerator* pNextAccel = pEntry->mpAccel;
- // Ist da ein Accelerator hinter ?
+ // is an accelerator assigned ?
if ( pNextAccel )
{
DBG_CHKOBJ( pNextAccel, Accelerator, NULL );
- // Sequenz-Liste erzeugen
+ // create sequence list
mpSequenceList = new ImplAccelList;
mpSequenceList->insert( mpSequenceList->begin(), pAccel );
mpSequenceList->insert( mpSequenceList->begin(), pNextAccel );
- // Activate-Handler vom Neuen rufen
+ // call activate-Handler of the new one
pNextAccel->Activate();
return sal_True;
}
else
{
- // Hat ihn schon !
+ // already assigned !
if ( pEntry->mbEnabled )
{
- // Activate/Deactivate-Handler vorher rufen
+ // first call activate/aeactivate-Handler
pAccel->Activate();
pAccel->Deactivate();
- // Dem Accelerator das aktuelle Item setzen
- // und Handler rufen
+ // define accelerator of the actual item
+ // and call the handler
sal_Bool bDel = sal_False;
pAccel->maCurKeyCode = rKeyCode;
pAccel->mnCurId = pEntry->mnId;
@@ -264,7 +264,7 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
pAccel->mpDel = &bDel;
pAccel->Select();
- // Hat Accel den Aufruf ueberlebt
+ // if the accelerator did survive the call
if ( !bDel )
{
DBG_CHKOBJ( pAccel, Accelerator, NULL );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8e64814..5c8295d 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -125,8 +125,8 @@ struct MenuItemData
sal_uInt16 nId; // SV Id
MenuItemType eType; // MenuItem-Type
MenuItemBits nBits; // MenuItem-Bits
- Menu* pSubMenu; // Pointer auf das SubMenu
- Menu* pAutoSubMenu; // Pointer auf SubMenu aus Resource
+ Menu* pSubMenu; // Pointer to SubMenu
+ Menu* pAutoSubMenu; // Pointer to SubMenu from Resource
XubString aText; // Menu-Text
XubString aHelpText; // Help-String
XubString aTipHelpText; // TipHelp-String (eg, expanded filenames)
@@ -142,7 +142,7 @@ struct MenuItemData
sal_Bool bIsTemporary; // Temporary inserted ('No selection possible')
sal_Bool bMirrorMode;
long nItemImageAngle;
- Size aSz; // nur temporaer gueltig
+ Size aSz; // only temporarily valid
XubString aAccessibleName; // accessible name
XubString aAccessibleDescription; // accessible description
@@ -476,7 +476,7 @@ private:
Timer aScrollTimer;
sal_uLong nSaveFocusId;
// long nStartY;
- sal_uInt16 nHighlightedItem; // gehighlightetes/selektiertes Item
+ sal_uInt16 nHighlightedItem; // highlighted/selected Item
sal_uInt16 nMBDownPos;
sal_uInt16 nScrollerHeight;
sal_uInt16 nFirstEntry;
@@ -660,11 +660,11 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
}
-// Eine Basicklasse fuer beide (wegen pActivePopup, Timer, ...) waere nett,
-// aber dann musste eine 'Container'-Klasse gemacht werden, da von
-// unterschiedlichen Windows abgeleitet...
-// In den meisten Funktionen muessen dann sowieso Sonderbehandlungen fuer
-// MenuBar, PopupMenu gemacht werden, also doch zwei verschiedene Klassen.
+// a basic class for both (due to pActivePopup, Timer,...) would be nice,
+// but a container class should have been created then, as they
+// would be derived from different windows
+// In most functions we would have to create exceptions for
+// menubar, popupmenu, hence we made two classes
class MenuBarWindow : public Window
{
@@ -770,7 +770,7 @@ static void ImplAddNWFSeparator( Window *pThis, const MenubarValue& rMenubarValu
static void ImplSetMenuItemData( MenuItemData* pData )
{
- // Daten umsetzen
+ // convert data
if ( !pData->aImage )
pData->eType = MENUITEM_STRING;
else if ( !pData->aText.Len() )
@@ -839,12 +839,12 @@ static sal_Bool ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, sal_uInt1
}
else if ( rHEvt.GetMode() & (HELPMODE_CONTEXT | HELPMODE_EXTENDED) )
{
- // Ist eine Hilfe in die Applikation selektiert
+ // is help in the application selected
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
- // Ist eine ID vorhanden, dann Hilfe mit der ID aufrufen, sonst
- // den Hilfe-Index
+ // is an id available, then call help with the id, otherwise
+ // use help-index
String aCommand = pMenu->GetItemCommand( nId );
rtl::OString aHelpId( pMenu->GetHelpId( nId ) );
if( ! aHelpId.getLength() )
@@ -999,7 +999,7 @@ void Menu::ImplLoadRes( const ResId& rResId )
if( nObjMask & RSC_MENU_ITEMS )
{
sal_uLong nObjFollows = ReadLongRes();
- // MenuItems einfuegen
+ // insert menu items
for( sal_uLong i = 0; i < nObjFollows; i++ )
{
InsertItem( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) );
@@ -1009,7 +1009,7 @@ void Menu::ImplLoadRes( const ResId& rResId )
if( nObjMask & RSC_MENU_TEXT )
{
- if( bIsMenuBar ) // Kein Titel im Menubar
+ if( bIsMenuBar ) // no title in menubar
ReadStringRes();
else
aTitleText = ReadStringRes();
@@ -1129,9 +1129,9 @@ void Menu::ImplSelect()
CheckItem( nSelectedId, !bChecked );
}
- // Select rufen
+ // call select
ImplSVData* pSVData = ImplGetSVData();
- pSVData->maAppData.mpActivePopupMenu = NULL; // Falls neues Execute im Select()
+ pSVData->maAppData.mpActivePopupMenu = NULL; // if new execute in select()
Application::PostUserEvent( nEventId, LINK( this, Menu, ImplCallSelect ) );
}
@@ -1296,7 +1296,7 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos )
if ( nObjMask & RSC_MENUITEM_TEXT )
aText = ReadStringRes();
- // Item erzeugen
+ // create item
if ( nObjMask & RSC_MENUITEM_BITMAP )
{
if ( !bSep )
@@ -1463,7 +1463,7 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 n
PopupMenu* pSubMenu = rMenu.GetPopupMenu( nId );
if ( pSubMenu )
{
- // AutoKopie anlegen
+ // create auto-copy
if ( nMode == 1 )
{
PopupMenu* pNewMenu = new PopupMenu( *pSubMenu );
@@ -1701,7 +1701,7 @@ void Menu::CheckItem( sal_uInt16 nItemId, sal_Bool bCheck )
if ( !pData || pData->bChecked == bCheck )
return;
- // Wenn RadioCheck, dann vorherigen unchecken
+ // if radio-check, then uncheck previous
if ( bCheck && (pData->nBits & MIB_AUTOCHECK) &&
(pData->nBits & MIB_RADIOCHECK) )
{
@@ -2099,10 +2099,10 @@ rtl::OString Menu::GetHelpId( sal_uInt16 nItemId ) const
Menu& Menu::operator=( const Menu& rMenu )
{
- // Aufraeumen
+ // clean up
Clear();
- // Items kopieren
+ // copy items
sal_uInt16 nCount = rMenu.GetItemCount();
for ( sal_uInt16 i = 0; i < nCount; i++ )
ImplCopyItem( this, rMenu, i, MENU_APPEND, 1 );
@@ -2170,8 +2170,8 @@ sal_Bool Menu::ImplIsVisible( sal_uInt16 nPos ) const
}
}
- // Fuer den Menubar nicht erlaubt, weil ich nicht mitbekomme
- // ob dadurch ein Eintrag verschwindet oder wieder da ist.
+ // not allowed for menubar, as I do not know
+ // whether a menu-entry will disappear or will appear
if ( bVisible && !bIsMenuBar && ( nMenuFlags & MENU_FLAG_HIDEDISABLEDENTRIES ) &&
!( nMenuFlags & MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ) )
{
@@ -2180,7 +2180,7 @@ sal_Bool Menu::ImplIsVisible( sal_uInt16 nPos ) const
else if ( pData->eType != MENUITEM_SEPARATOR ) // separators handled above
{
// bVisible = pData->bEnabled && ( !pData->pSubMenu || pData->pSubMenu->HasValidEntries( sal_True ) );
- bVisible = pData->bEnabled; // SubMenus nicht pruefen, weil sie ggf. erst im Activate() gefuellt werden.
+ bVisible = pData->bEnabled; // do not check submenus as they might be filled at Activate().
}
}
@@ -2372,7 +2372,7 @@ Size Menu::ImplCalcSize( Window* pWin )
{
// | Checked| Image| Text| Accel/Popup|
- // Fuer Symbole: nFontHeight x nFontHeight
+ // for symbols: nFontHeight x nFontHeight
long nFontHeight = pWin->GetTextHeight();
long nExtra = nFontHeight/4;
@@ -2502,7 +2502,7 @@ Size Menu::ImplCalcSize( Window* pWin )
pData->aSz.Height() = Max( Max( nFontHeight, pData->aSz.Height() ), nMinMenuItemHeight );
}
- pData->aSz.Height() += EXTRAITEMHEIGHT; // Etwas mehr Abstand:
+ pData->aSz.Height() += EXTRAITEMHEIGHT; // little bit more distance
if ( !bIsMenuBar )
aSz.Height() += (long)pData->aSz.Height();
@@ -2640,7 +2640,7 @@ static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_
void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemData* pThisItemOnly, sal_Bool bHighlighted, bool bLayout ) const
{
- // Fuer Symbole: nFontHeight x nFontHeight
+ // for symbols: nFontHeight x nFontHeight
long nFontHeight = pWin->GetTextHeight();
long nExtra = nFontHeight/4;
@@ -2688,10 +2688,11 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa
sal_uInt16 nTextStyle = 0;
sal_uInt16 nSymbolStyle = 0;
sal_uInt16 nImageStyle = 0;
- // SubMenus ohne Items werden nicht mehr disablte dargestellt,
- // wenn keine Items enthalten sind, da die Anwendung selber
- // darauf achten muss. Ansonsten gibt es Faelle, wo beim
- // asyncronen laden die Eintraege disablte dargestellt werden.
+
+ // submenus without items are not disabled when no items are
+ // contained. The application itself should check for this!
+ // Otherwise it could happen entries are disabled due to
+ // asynchronous loading
if ( !pData->bEnabled )
{
nTextStyle |= TEXT_DRAW_DISABLE;
@@ -3387,7 +3388,7 @@ sal_Bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMen
( ImplGetSalMenu() && ImplGetSalMenu()->VisibleMenuBar() ) )
return bDone;
- // Enabled-Abfragen, falls diese Methode von einem anderen Fenster gerufen wurde...
+ // check for enabled, if this method is called from another window...
Window* pWin = ImplGetWindow();
if ( pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && ! pWin->IsInModalMode() )
bDone = ((MenuBarWindow*)pWin)->ImplHandleKeyEvent( rKEvent, bFromMenu );
@@ -3666,13 +3667,13 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong
nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE;
- // Kann beim Debuggen hilfreich sein.
+ // could be usefull during debugging.
// nPopupModeFlags |= FLOATWIN_POPUPMODE_NOFOCUSCLOSE;
ImplDelData aDelData;
pW->ImplAddDel( &aDelData );
- bInCallback = sal_True; // hier schon setzen, falls Activate ueberladen
+ bInCallback = sal_True; // set it here, if Activate overloaded
Activate();
bInCallback = sal_False;
@@ -3687,7 +3688,7 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong
if ( !GetItemCount() )
return 0;
- // Das Flag MENU_FLAG_HIDEDISABLEDENTRIES wird vererbt.
+ // The flag MENU_FLAG_HIDEDISABLEDENTRIES is inherited.
if ( pSFrom )
{
if ( pSFrom->nMenuFlags & MENU_FLAG_HIDEDISABLEDENTRIES )
@@ -3823,8 +3824,8 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong
else
return 0;
- // Focus wieder herstellen (kann schon im Select wieder
- // hergestellt wurden sein
+ // Restore focus (could already have been
+ // restored in Select)
nFocusId = pWin->GetFocusId();
if ( nFocusId )
{
@@ -3833,7 +3834,7 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong
}
pWin->ImplEndPopupMode( 0, nFocusId );
- if ( nSelectedId ) // Dann abraeumen... ( sonst macht TH das )
+ if ( nSelectedId ) // then clean up .. ( otherwise done by TH )
{
PopupMenu* pSub = pWin->GetActivePopup();
while ( pSub )
@@ -3846,11 +3847,11 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong
pWindow->doLazyDelete();
pWindow = NULL;
- // Steht noch ein Select aus?
+ // is there still Select?
Menu* pSelect = ImplFindSelectMenu();
if ( pSelect )
{
- // Beim Popup-Menu muss das Select vor dem Verlassen von Execute gerufen werden!
+ // Select should be called prior to leaving execute in a popup menu!
Application::RemoveUserEvent( pSelect->nEventId );
pSelect->nEventId = 0;
pSelect->Select();
@@ -4104,7 +4105,7 @@ void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, sal_Bool bM
sal_Bool bPopupArea = sal_True;
if ( pItemData->nBits & MIB_POPUPSELECT )
{
- // Nur wenn ueber dem Pfeil geklickt wurde...
+ // only when clicked over the arrow...
Size aSz = GetOutputSizePixel();
long nFontHeight = GetTextHeight();
bPopupArea = ( rMEvt.GetPosPixel().X() >= ( aSz.Width() - nFontHeight - nFontHeight/4 ) );
@@ -4178,12 +4179,12 @@ IMPL_LINK( MenuFloatingWindow, PopupEnd, FloatingWindow*, EMPTYARG )
{
if( pMenu )
{
- // Wenn dies Fenster von TH geschlossen wurde, hat noch ein anderes
- // Menu dieses Fenster als pActivePopup.
+ // if the window was closed by TH, there is another menu
+ // which has this window as pActivePopup
if ( pMenu->pStartedFrom )
{
- // Das pWin am 'Parent' kann aber schon 0 sein, falls die Kette von
- // vorne abgeraeumt wurde und jetzt die EndPopup-Events eintrudeln
+ // pWin from parent could be 0, if the list is
+ // cleaned from the start, now clean up the endpopup-events
if ( pMenu->pStartedFrom->bIsMenuBar )
{
MenuBarWindow* p = (MenuBarWindow*) pMenu->pStartedFrom->ImplGetWindow();
@@ -4246,7 +4247,7 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
aItemBottomRight.X() += MySize.Width();
aItemBottomRight.Y() += pData->aSz.Height();
- // Popups leicht versetzen:
+ // shift the popups a little
aItemTopLeft.X() += 2;
aItemBottomRight.X() -= 2;
if ( nHighlightedItem )
@@ -4258,10 +4259,10 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
aItemTopLeft.Y() -= nT;
}
- // pTest: Wegen Abstuerzen durch Reschedule() im Aufruf von Activate()
- // Ausserdem wird damit auch verhindert, dass SubMenus angezeigt werden,
- // die lange im Activate Rescheduled haben und jetzt schon nicht mehr
- // angezeigt werden sollen.
+ // pTest: crash due to Reschedule() in call of Activate()
+ // Also it is prevented that submenus are displayed which
+ // were for long in Activate Rescheduled and which should not be
+ // displayed now.
Menu* pTest = pActivePopup;
sal_uLong nOldFlags = GetPopupModeFlags();
SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
@@ -4328,8 +4329,8 @@ void MenuFloatingWindow::Execute()
void MenuFloatingWindow::StopExecute( sal_uLong nFocusId )
{
- // Focus wieder herstellen
- // (kann schon im Select wieder hergestellt wurden sein)
+ // restore focus
+ // (could have been restored in Select)
if ( nSaveFocusId )
{
Window::EndSaveFocus( nFocusId, sal_False );
@@ -4363,8 +4364,8 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
if ( pActivePopup->bInCallback )
pActivePopup->bCanceled = sal_True;
- // Vor allen Aktionen schon pActivePopup = 0, falls z.B.
- // PopupModeEndHdl des zu zerstoerenden Popups mal synchron gerufen wird.
+ // For all actions pActivePopup = 0, if e.g.
+ // PopupModeEndHdl the popups to destroy were called synchronous
PopupMenu* pPopup = pActivePopup;
pActivePopup = NULL;
pPopup->bInCallback = sal_True;
@@ -4396,7 +4397,7 @@ void MenuFloatingWindow::EndExecute()
}
}
- // Wenn von woanders gestartet, dann ab dort aufraumen:
+ // if started else where, cleanup there as well
MenuFloatingWindow* pCleanUpFrom = this;
MenuFloatingWindow* pWin = this;
while ( pWin && !pWin->bInExecute &&
@@ -4407,7 +4408,7 @@ void MenuFloatingWindow::EndExecute()
if ( pWin )
pCleanUpFrom = pWin;
- // Dies Fenster wird gleich zerstoert => Daten lokal merken...
+ // this window will be destroyed => store date locally...
Menu* pM = pMenu;
sal_uInt16 nItem = nHighlightedItem;
@@ -4440,9 +4441,9 @@ void MenuFloatingWindow::EndExecute( sal_uInt16 nId )
void MenuFloatingWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
- // TH macht ein ToTop auf dieses Fenster, aber das aktive Popup
- // soll oben bleiben...
- // due to focus chage this would close all menues -> don't do it (#94123)
+ // TH creates a ToTop on this window, but the active popup
+ // should stay on top...
+ // due to focus change this would close all menues -> don't do it (#94123)
//if ( pActivePopup && pActivePopup->ImplGetWindow() && !pActivePopup->ImplGetFloatingWindow()->pActivePopup )
// pActivePopup->ImplGetFloatingWindow()->ToTop( TOTOP_NOGRABFOCUS );
@@ -4454,8 +4455,8 @@ void MenuFloatingWindow::MouseButtonDown( const MouseEvent& rMEvt )
void MenuFloatingWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
MenuItemData* pData = pMenu ? pMenu->GetItemList()->GetDataFromPos( nHighlightedItem ) : NULL;
- // nMBDownPos in lokaler Variable merken und gleich zuruecksetzen,
- // weil nach EndExecute zu spaet
+ // nMBDownPos store in local variable and reset immediately,
+ // as it will be too late after EndExecute
sal_uInt16 _nMBDownPos = nMBDownPos;
nMBDownPos = ITEMPOS_INVALID;
if ( pData && pData->bEnabled && ( pData->eType != MENUITEM_SEPARATOR ) )
@@ -4466,7 +4467,7 @@ void MenuFloatingWindow::MouseButtonUp( const MouseEvent& rMEvt )
}
else if ( ( pData->nBits & MIB_POPUPSELECT ) && ( nHighlightedItem == _nMBDownPos ) && ( rMEvt.GetClicks() == 2 ) )
{
- // Nicht wenn ueber dem Pfeil geklickt wurde...
+ // not when clicked over the arrow...
Size aSz = GetOutputSizePixel();
long nFontHeight = GetTextHeight();
if ( rMEvt.GetPosPixel().X() < ( aSz.Width() - nFontHeight - nFontHeight/4 ) )
@@ -4591,7 +4592,7 @@ void MenuFloatingWindow::ImplScroll( const Point& rMousePos )
if ( nDelta )
{
- aScrollTimer.Stop(); // Falls durch MouseMove gescrollt.
+ aScrollTimer.Stop(); // if scrolled through MouseMove.
long nTimeout;
if ( nDelta < 3 )
nTimeout = 200;
@@ -4609,12 +4610,12 @@ void MenuFloatingWindow::ImplScroll( const Point& rMousePos )
}
void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bStartPopupTimer )
{
- // #57934# ggf. das aktive Popup sofort schliessen, damit TH's Hintergrundsicherung funktioniert.
- // #65750# Dann verzichten wir lieber auf den schmalen Streifen Hintergrundsicherung.
- // Sonst lassen sich die Menus schlecht bedienen.
-// MenuItemData* pNextData = pMenu->pItemList->GetDataFromPos( n );
-// if ( pActivePopup && pNextData && ( pActivePopup != pNextData->pSubMenu ) )
-// KillActivePopup();
+ // #57934# ggf. immediately close the active, as TH's backgroundstorage works.
+ // #65750# we prefer to refrain from the background storage of small lines.
+ // otherwise the menus are difficult to operate.
+ // MenuItemData* pNextData = pMenu->pItemList->GetDataFromPos( n );
+ // if ( pActivePopup && pNextData && ( pActivePopup != pNextData->pSubMenu ) )
+ // KillActivePopup();
aSubmenuCloseTimer.Stop();
if( ! pMenu )
@@ -4864,7 +4865,7 @@ void MenuFloatingWindow::ImplCursorUpDown( sal_Bool bUp, sal_Bool bHomeEnd )
if ( ( pData->bEnabled || !rSettings.GetSkipDisabledInMenus() )
&& ( pData->eType != MENUITEM_SEPARATOR ) && pMenu->ImplIsVisible( n ) && pMenu->ImplIsSelectable( n ) )
{
- // Selektion noch im sichtbaren Bereich?
+ // Is selection in visible area?
if ( IsScrollMenu() )
{
ChangeHighlightItem( ITEMPOS_INVALID, sal_False );
@@ -5034,7 +5035,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
}
else
{
- // Bei ungueltigen Tasten Beepen, aber nicht bei HELP und F-Tasten
+ // Beep for invalid keys, except for HELP and F-keys
if ( !rKEvent.GetKeyCode().IsMod2() && ( nCode != KEY_HELP ) && ( rKEvent.GetKeyCode().GetGroup() != KEYGROUP_FKEYS ) )
Sound::Beep();
FloatingWindow::KeyInput( rKEvent );
@@ -5364,22 +5365,22 @@ void MenuBarWindow::ImplCreatePopup( sal_Bool bPreSelectFirst )
Point aItemBottomRight( aItemTopLeft );
aItemBottomRight.X() += pData->aSz.Width();
- // Im Vollbild-Modus hat die MenuBar ggf. die Hoehe 0:
- // Nicht immer einfach die Window-Hoehe nehmen, weil ItemHeight < WindowHeight.
+ // the menu bar could have height 0 in fullscreen mode:
+ // so do not use always WindowHeight, as ItemHeight < WindowHeight.
if ( GetSizePixel().Height() )
{
// #107747# give menuitems the height of the menubar
aItemBottomRight.Y() += GetOutputSizePixel().Height()-1;
}
- // ImplExecute ist doch nicht modal...
+ // ImplExecute is not modal...
// #99071# do not grab the focus, otherwise it will be restored to the menubar
// when the frame is reactivated later
//GrabFocus();
pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_DOWN, pMenu, bPreSelectFirst );
if ( pActivePopup )
{
- // Hat kein Window, wenn vorher abgebrochen oder keine Eintraege
+ // does not have a window, if aborted before or if there are no entries
if ( pActivePopup->ImplGetFloatingWindow() )
pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
else
@@ -5404,7 +5405,7 @@ void MenuBarWindow::KillActivePopup()
pActivePopup->bInCallback = sal_True;
pActivePopup->Deactivate();
pActivePopup->bInCallback = sal_False;
- // Abfrage auf pActivePopup, falls im Deactivate abgeschossen...
+ // check for pActivePopup, if stopped by deactivate...
if ( pActivePopup && pActivePopup->ImplGetWindow() )
{
pActivePopup->ImplGetFloatingWindow()->StopExecute();
@@ -5446,7 +5447,7 @@ void MenuBarWindow::MouseButtonUp( const MouseEvent& )
void MenuBarWindow::MouseMove( const MouseEvent& rMEvt )
{
- // Im Move nur Highlighten, wenn schon eins gehighlightet.
+ // only highlight during Move if if was already highlighted.
if ( rMEvt.IsSynthetic() || rMEvt.IsLeaveWindow() || rMEvt.IsEnterWindow() || ( nHighlightedItem == ITEMPOS_INVALID ) )
return;
@@ -5467,12 +5468,12 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sa
if( ! pMenu )
return;
- // #57934# ggf. das aktive Popup sofort schliessen, damit TH's Hintergrundsicherung funktioniert.
+ // #57934# close active popup if applicable, as TH's background storage works.
MenuItemData* pNextData = pMenu->pItemList->GetDataFromPos( n );
if ( pActivePopup && pActivePopup->ImplGetWindow() && ( !pNextData || ( pActivePopup != pNextData->pSubMenu ) ) )
- KillActivePopup(); // pActivePopup ggf. ohne pWin, wenn in Activate() Rescheduled wurde
+ KillActivePopup(); // pActivePopup when applicable without pWin, if Rescheduled in Activate()
- // Activate am MenuBar immer nur einmal pro Vorgang...
+ // activate menubar only ones per cycle...
sal_Bool bJustActivated = sal_False;
if ( ( nHighlightedItem == ITEMPOS_INVALID ) && ( n != ITEMPOS_INVALID ) )
{
@@ -5504,7 +5505,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sa
}
else
bStayActive = sal_False;
- pMenu->bInCallback = sal_True; // hier schon setzen, falls Activate ueberladen
+ pMenu->bInCallback = sal_True; // set here if Activate overloaded
pMenu->Activate();
pMenu->bInCallback = sal_False;
bJustActivated = sal_True;
@@ -5540,7 +5541,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sa
if( mbAutoPopup )
ImplCreatePopup( bSelectEntry );
- // #58935# #73659# Focus, wenn kein Popup drunter haengt...
+ // #58935# #73659# Focus, if no popup underneath...
if ( bJustActivated && !pActivePopup )
GrabFocus();
}
@@ -5659,7 +5660,7 @@ sal_Bool MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bF
return sal_False;
if ( pMenu->bInCallback )
- return sal_True; // schlucken
+ return sal_True; // swallow
sal_Bool bDone = sal_False;
sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
@@ -5812,8 +5813,8 @@ sal_Bool MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bF
}
else
{
- // Wegen Systemmenu und anderen System-HotKeys, nur
- // eigenstaendige Character-Kombinationen auswerten
+ // only validate own character combinations due
+ // to systemmenu's and other system-hotkeyes
sal_uInt16 nKeyCode = rKEvent.GetKeyCode().GetCode();
if ( ((nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z)) )
Sound::Beep();
@@ -5952,7 +5953,7 @@ void MenuBarWindow::ImplLayoutChanged()
if( pMenu )
{
ImplInitMenuWindow( this, sal_True, sal_True );
- // Falls sich der Font geaendert hat.
+ // if the font was changed.
long nHeight = pMenu->ImplCalcSize( this ).Height();
// depending on the native implementation or the displayable flag
commit 6c8f7589de3da0018c3136aeb6ba3a2f5aa91aa7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 27 08:01:49 2011 +0100
create a base class for macros_test
For tests that need file import you can now choose between FiltersTest
or MacrosTest as base class.
FiltersTest imports through SfxObjectShell and does not have any ui
MacrosTest imports through Desktop::LoadComponentFromURL and initializes
the ui, therefore it needs to run headless
diff --git a/sc/qa/unit/macros-test.cxx b/sc/qa/unit/macros-test.cxx
index 207c939..969978a 100644
--- a/sc/qa/unit/macros-test.cxx
+++ b/sc/qa/unit/macros-test.cxx
@@ -29,17 +29,11 @@
*/
#include <sal/config.h>
-#include <unotest/filters-test.hxx>
#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
-#include <com/sun/star/frame/XDesktop.hpp>
-
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/document/MacroExecMode.hpp>
-
#include <sfx2/app.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
@@ -80,13 +74,11 @@ FileFormat aFileFormats[] = {
/* Implementation of Macros test */
-class ScMacrosTest : public test::BootstrapFixture
+class ScMacrosTest : public test::BootstrapFixture, public unotest::MacrosTest
{
public:
ScMacrosTest();
- uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const rtl::OUString& rURL);
-
void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath);
virtual void setUp();
@@ -106,27 +98,10 @@ public:
private:
uno::Reference<uno::XInterface> m_xCalcComponent;
- uno::Reference<frame::XDesktop> mxDesktop;
- ::rtl::OUString m_aBaseString;
+ rtl::OUString m_aBaseString;
};
-uno::Reference< com::sun::star::lang::XComponent > ScMacrosTest::loadFromDesktop(const rtl::OUString& rURL)
-{
- uno::Reference< com::sun::star::frame::XComponentLoader> xLoader = uno::Reference< com::sun::star::frame::XComponentLoader >( mxDesktop, UNO_QUERY );
- com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > args(1);
- args[0].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode"));
- args[0].Handle = -1;
- args[0].Value <<=
- com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
- args[0].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
- uno::Reference< com::sun::star::lang::XComponent> xComponent= xLoader->loadComponentFromURL(rURL, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), 0, args);
- CPPUNIT_ASSERT_MESSAGE("loading failed", xComponent.is());
- return xComponent;
-}
-
-
void ScMacrosTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath)
{
rtl::OUString aSep(RTL_CONSTASCII_USTRINGPARAM("/"));
@@ -170,11 +145,7 @@ void ScMacrosTest::testStarBasic()
xDocSh->DoClose();
}
-struct TestMacroInfo
-{
- rtl::OUString sFileBaseName;
- rtl::OUString sMacroUrl;
-};
+
void ScMacrosTest::testVba()
{
TestMacroInfo testInfo[] = {
diff --git a/unotest/inc/unotest/macros_test.hxx b/unotest/inc/unotest/macros_test.hxx
new file mode 100644
index 0000000..e95705f
--- /dev/null
+++ b/unotest/inc/unotest/macros_test.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <rtl/ustring.hxx>
+#include "unotest/detail/unotestdllapi.hxx"
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+
+struct TestMacroInfo
+{
+ rtl::OUString sFileBaseName;
+ rtl::OUString sMacroUrl;
+};
+
+namespace unotest {
+
+class OOO_DLLPUBLIC_UNOTEST MacrosTest
+{
+public:
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const rtl::OUString& rURL);
+
+protected:
+ com::sun::star::uno::Reference< com::sun::star::frame::XDesktop> mxDesktop;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotest/prj/d.lst b/unotest/prj/d.lst
index 37fbe17..c333491 100644
--- a/unotest/prj/d.lst
+++ b/unotest/prj/d.lst
@@ -12,6 +12,7 @@ mkdir: %_DEST%\inc\unotest\detail
..\inc\unotest\detail\unotestdllapi.hxx %_DEST%\inc\unotest\detail\unotestdllapi.hxx
..\inc\unotest\bootstrapfixturebase.hxx %_DEST%\inc\unotest\bootstrapfixturebase.hxx
..\inc\unotest\filters-test.hxx %_DEST%\inc\unotest\filters-test.hxx
+..\inc\unotest\macros_test.hxx %_DEST%\inc\unotest\macros_test.hxx
..\inc\unotest\gettestargument.hxx %_DEST%\inc\unotest\gettestargument.hxx
..\inc\unotest\officeconnection.hxx %_DEST%\inc\unotest\officeconnection.hxx
..\inc\unotest\toabsolutefileurl.hxx %_DEST%\inc\unotest\toabsolutefileurl.hxx
diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx
new file mode 100644
index 0000000..10be894
--- /dev/null
+++ b/unotest/source/cpp/macros_test.cxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "unotest/macros_test.hxx"
+
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/document/MacroExecMode.hpp>
+
+#include <sal/config.h>
+#include "sal/precppunit.hxx"
+#include "cppunit/TestAssert.h"
+#include <rtl/ustrbuf.hxx>
+
+using namespace com::sun::star;
+
+namespace unotest {
+
+uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const rtl::OUString& rURL)
+{
+ uno::Reference< com::sun::star::frame::XComponentLoader> xLoader = uno::Reference< com::sun::star::frame::XComponentLoader >( mxDesktop, uno::UNO_QUERY );
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > args(1);
+ args[0].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode"));
+ args[0].Handle = -1;
+ args[0].Value <<=
+ com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
+ args[0].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ uno::Reference< com::sun::star::lang::XComponent> xComponent= xLoader->loadComponentFromURL(rURL, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), 0, args);
+ CPPUNIT_ASSERT_MESSAGE("loading failed", xComponent.is());
+ return xComponent;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotest/source/cpp/makefile.mk b/unotest/source/cpp/makefile.mk
index 928a8b2..be4fe52 100644
--- a/unotest/source/cpp/makefile.mk
+++ b/unotest/source/cpp/makefile.mk
@@ -42,6 +42,7 @@ SLOFILES = \
$(SLO)/filters-test.obj \
$(SLO)/getargument.obj \
$(SLO)/gettestargument.obj \
+ $(SLO)/macros_test.obj \
$(SLO)/officeconnection.obj \
$(SLO)/toabsolutefileurl.obj \
$(SLO)/uniquepipename.obj
commit 9fceb2fc1054013f93654bd2d62a85d996727bf4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 27 07:57:49 2011 +0100
missing virtual constructor
diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx
index 94d9ada..f983e12 100644
--- a/sc/source/ui/inc/namedefdlg.hxx
+++ b/sc/source/ui/inc/namedefdlg.hxx
@@ -100,6 +100,8 @@ public:
ScViewData* pViewData, std::map<rtl::OUString, ScRangeName*> aRangeMap,
const ScAddress& aCursorPos, const bool bUndo);
+ virtual ~ScNameDefDlg() {};
+
virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
virtual sal_Bool IsRefInputMode() const;
More information about the Libreoffice-commits
mailing list