diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-11-02 21:58:35 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-11-02 21:58:35 +0100 |
commit | 543c57eb87cf3f37c36c0f3d8cf669d9acbb9286 (patch) | |
tree | 5a86aaf9e42c8765aa3b61e9a22ce1791d66468a | |
parent | 75fe0e01d9ea7f6c832c75e3d074bea3f17a36ae (diff) | |
parent | 75f77e63189607142d0a90047ac04cd415072174 (diff) |
Merge branch 'master' of git://anongit.freedesktop.org/libreoffice/core
-rw-r--r-- | RepositoryExternal.mk | 6 | ||||
-rw-r--r-- | configure.in | 35 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.cxx | 127 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFilePicker.hxx | 11 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkFolderPicker.cxx | 18 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.cxx | 37 | ||||
-rw-r--r-- | fpicker/source/unx/gnome/SalGtkPicker.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 109 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 87 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin2.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin3.cxx | 38 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 183 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin5.cxx | 22 | ||||
-rwxr-xr-x | set_soenv.in | 1 | ||||
-rwxr-xr-x | solenv/bin/localize | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 95 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkgdi.hxx | 17 | ||||
-rw-r--r-- | vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 949 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/Resource.java.orig | 140 |
19 files changed, 1035 insertions, 854 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 8891d6bfc48f..d7ff86f4b674 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -828,16 +828,16 @@ $(call gb_LinkTarget_add_libs,$(1), \ endef -ifeq ($(SYSTEM_MOZILLA),YES) +ifeq ($(SYSTEM_NSS),YES) define gb_LinkTarget__use_plc4 $(call gb_LinkTarget_set_include,$(1),\ $$(INCLUDE) \ - $(MOZ_NSS_CFLAGS) \ + $(NSS_CFLAGS) \ ) $(call gb_LinkTarget_add_libs,$(1),\ - $(MOZ_NSS_LIBS) \ + $(NSS_LIBS) \ ) endef diff --git a/configure.in b/configure.in index b69aeb63f802..d95dc7c4addf 100644 --- a/configure.in +++ b/configure.in @@ -690,7 +690,7 @@ AC_ARG_WITH(external-thes-dir, AC_ARG_WITH(system-libs, AS_HELP_STRING([--with-system-libs], [Use libraries already on system -- enables all --with-system-* flags except - mozilla and translate-toolkit.]), + mozilla.]), ,) AC_ARG_WITH(system-headers, @@ -757,10 +757,6 @@ AC_ARG_WITH(system-libxml, [Use libxml already on system.]), ,) -AC_ARG_WITH(system-translate-toolkit, - AS_HELP_STRING([--with-system-translate-toolkit], - [Use translate-toolkit already on system.])) - AC_ARG_WITH(system-icu, AS_HELP_STRING([--with-system-icu], [Use icu already on system.])) @@ -5053,35 +5049,6 @@ AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_LIBS) dnl =================================================================== -dnl Check for system translate-toolkit -dnl =================================================================== -AC_MSG_CHECKING([which translate-toolkit to use]) -if test "$with_system_translate_toolkit" = "yes" ; then - AC_MSG_RESULT([system]) - SYSTEM_TRANSLATE_TOOLKIT=YES - - AC_PATH_PROGS(OO2PO, oo2po) - if test -z "$OO2PO"; then - AC_MSG_ERROR([install translate-toolkit or use --without-system-translate-toolkit]) - fi - - AC_PATH_PROGS(PO2OO, po2oo) - if test -z "$PO2OO"; then - AC_MSG_ERROR([install translate-toolkit or use --without-system-translate-toolkit]) - fi - - $PO2OO --help | grep -q '\-\-skipsource' - if test $? -ne 0 ; then - AC_MSG_ERROR([$PO2OO does not support --skipsource; use translate-toolkit >= 1.9 or use --without-system-translate-toolkit]) - fi -else - AC_MSG_RESULT([internal]) - SYSTEM_TRANSLATE_TOOLKIT=NO - BUILD_TYPE="$BUILD_TYPE TRANSLATE_TOOLKIT" -fi -AC_SUBST(SYSTEM_TRANSLATE_TOOLKIT) - -dnl =================================================================== dnl Check for system Berkeley db dnl =================================================================== AC_MSG_CHECKING([which db to use]) diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index 9b5051afb9af..1cac9895c6ca 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -51,6 +51,8 @@ #include <osl/mutex.hxx> #include <SalGtkFilePicker.hxx> +#include <vcl/svapp.hxx> + #include <tools/string.hxx> #include <tools/urlobj.hxx> @@ -98,8 +100,6 @@ namespace static void expandexpanders(GtkContainer *pWidget) { - GdkThreadLock aLock; - GList *pChildren = gtk_container_get_children(pWidget); for( GList *p = pChildren; p; p = p->next ) { @@ -118,8 +118,6 @@ void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *, SalGtkFilePicker *pobjFP) void SalGtkFilePicker::InitialMapping() { - GdkThreadLock aLock; - if (!mbPreviewState ) { gtk_widget_hide( m_pPreview ); @@ -180,8 +178,6 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact CResourceProvider aResProvider; OUString aFilePickerTitle = aResProvider.getResString( FILE_PICKER_TITLE_OPEN ); - GdkThreadLock aLock; - m_pDialog = gtk_file_chooser_dialog_new( OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr(), NULL, @@ -359,12 +355,18 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact void SAL_CALL SalGtkFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + + OSL_ENSURE(!m_xListener.is(), + "SalGtkFilePicker only talks with one listener at a time..."); m_xListener = xListener; } void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + m_xListener.clear(); } @@ -374,6 +376,8 @@ void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<X void SAL_CALL SalGtkFilePicker::disposing( const lang::EventObject& aEvent ) throw( uno::RuntimeException ) { + // no member access => no mutex needed + uno::Reference<XFilePickerListener> xFilePickerListener( aEvent.Source, ::com::sun::star::uno::UNO_QUERY ); if( xFilePickerListener.is() ) @@ -384,19 +388,19 @@ void SAL_CALL SalGtkFilePicker::disposing( const lang::EventObject& aEvent ) thr // FilePicker Event functions //----------------------------------------------------------------------------------------- -void SAL_CALL SalGtkFilePicker::fileSelectionChanged( FilePickerEvent aEvent ) +void SalGtkFilePicker::impl_fileSelectionChanged( FilePickerEvent aEvent ) { OSL_TRACE( "file selection changed"); if (m_xListener.is()) m_xListener->fileSelectionChanged( aEvent ); } -void SAL_CALL SalGtkFilePicker::directoryChanged( FilePickerEvent aEvent ) +void SalGtkFilePicker::impl_directoryChanged( FilePickerEvent aEvent ) { OSL_TRACE("directory changed"); if (m_xListener.is()) m_xListener->directoryChanged( aEvent ); } -void SAL_CALL SalGtkFilePicker::controlStateChanged( FilePickerEvent aEvent ) +void SalGtkFilePicker::impl_controlStateChanged( FilePickerEvent aEvent ) { OSL_TRACE("control state changed"); if (m_xListener.is()) m_xListener->controlStateChanged( aEvent ); @@ -517,8 +521,6 @@ shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false ) static void dialog_remove_buttons( GtkDialog *pDialog ) { - GdkThreadLock aLock; - g_return_if_fail( GTK_IS_DIALOG( pDialog ) ); GList *pChildren = @@ -627,6 +629,8 @@ void SalGtkFilePicker::ensureFilterList( const ::rtl::OUString& _rInitialCurrent void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const rtl::OUString& aFilter ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); if( FilterNameExists( aTitle ) ) @@ -646,6 +650,8 @@ void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const void SAL_CALL SalGtkFilePicker::setCurrentFilter( const rtl::OUString& aTitle ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OSL_TRACE( "Setting current filter to %s\n", @@ -689,8 +695,6 @@ void SalGtkFilePicker::UpdateFilterfromUI() if (!mnHID_FolderChange || !mnHID_SelectionChange) return; - GdkThreadLock aLock; - GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView)); GtkTreeIter iter; GtkTreeModel *model; @@ -712,6 +716,8 @@ void SalGtkFilePicker::UpdateFilterfromUI() rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OSL_TRACE( "GetCURRENTfilter" ); @@ -731,6 +737,8 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeE void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroupTitle*/, const uno::Sequence<beans::StringPair>& aFilters ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->appendFilterGroup( sGroupTitle, aFilters ); @@ -760,9 +768,9 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroup void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER(m_pDialog), bMode ); } @@ -770,9 +778,9 @@ void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( u void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName ) throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); OString aStr = OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ); GtkFileChooserAction eAction = gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) ); @@ -785,16 +793,22 @@ void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName ) void SAL_CALL SalGtkFilePicker::setDisplayDirectory( const rtl::OUString& rDirectory ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + implsetDisplayDirectory(rDirectory); } rtl::OUString SAL_CALL SalGtkFilePicker::getDisplayDirectory() throw( uno::RuntimeException ) { + SolarMutexGuard g; + return implgetDisplayDirectory(); } uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::RuntimeException ) { + // no member access => no mutex needed + uno::Sequence< rtl::OUString > aFiles = getSelectedFiles(); /* The previous multiselection API design was completely broken @@ -807,9 +821,9 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::R uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); GSList* pPathList = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER(m_pDialog) ); @@ -953,16 +967,18 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw void SAL_CALL SalGtkFilePicker::setTitle( const rtl::OUString& rTitle ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + implsetTitle(rTitle); } sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_TRACE( "1: HERE WE ARE"); OSL_ASSERT( m_pDialog != NULL ); - GdkThreadLock aLock; - sal_Int16 retVal = 0; SetFilters(); @@ -1067,7 +1083,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) FilePickerEvent evt; evt.ElementId = PUSHBUTTON_PLAY; OSL_TRACE( "filter_changed, isn't it great %x", this); - controlStateChanged( evt ); + impl_controlStateChanged( evt ); btn = GTK_RESPONSE_NO; } break; @@ -1148,8 +1164,6 @@ namespace { void HackWidthToFirst(GtkComboBox *pWidget) { - GdkThreadLock aLock; - GtkRequisition requisition; gtk_widget_size_request(GTK_WIDGET(pWidget), &requisition); gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1); @@ -1158,8 +1172,6 @@ namespace void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction, const uno::Any& rValue) { - GdkThreadLock aLock; - switch (nControlAction) { case ControlActions::ADD_ITEM: @@ -1234,8 +1246,6 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction) const { - GdkThreadLock aLock; - uno::Any aAny; switch (nControlAction) { @@ -1294,14 +1304,14 @@ uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nC void SAL_CALL SalGtkFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const uno::Any& rValue ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OSL_TRACE( "SETTING VALUE %d", nControlAction ); GType tType; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("enable unknown control %d", nControlId); else if( tType == GTK_TYPE_TOGGLE_BUTTON ) @@ -1322,6 +1332,8 @@ void SAL_CALL SalGtkFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nContr uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); uno::Any aRetval; @@ -1329,8 +1341,6 @@ uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nC GType tType; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("enable unknown control %d", nControlId); else if( tType == GTK_TYPE_TOGGLE_BUTTON ) @@ -1347,12 +1357,12 @@ uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nC void SAL_CALL SalGtkFilePicker::enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); GtkWidget *pWidget; - GdkThreadLock aLock; - if ( nControlId == ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR ) gtk_expander_set_expanded( GTK_EXPANDER( m_pFilterExpander ), bEnable ); else if( ( pWidget = getWidget( nControlId ) ) ) @@ -1375,13 +1385,13 @@ throw( uno::RuntimeException ) void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUString& rLabel ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); GType tType; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) { OSL_TRACE("Set label on unknown control %d", nControlId); @@ -1412,14 +1422,14 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUS rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); GType tType; OString aTxt; GtkWidget *pWidget; - GdkThreadLock aLock; - if( !( pWidget = getWidget( nControlId, &tType ) ) ) OSL_TRACE("Get label on unknown control %d", nControlId); else if( tType == GTK_TYPE_TOGGLE_BUTTON || tType == GTK_TYPE_BUTTON || tType == GTK_TYPE_LABEL ) @@ -1436,6 +1446,8 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId ) uno::Sequence<sal_Int16> SAL_CALL SalGtkFilePicker::getSupportedImageFormats() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO return m_pImpl->getSupportedImageFormats(); @@ -1444,6 +1456,8 @@ uno::Sequence<sal_Int16> SAL_CALL SalGtkFilePicker::getSupportedImageFormats() t sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO return m_pImpl->getTargetColorDepth(); @@ -1452,6 +1466,8 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeEx sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); return m_PreviewImageWidth; @@ -1459,6 +1475,8 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth() throw( uno::RuntimeExce sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); return m_PreviewImageHeight; @@ -1467,6 +1485,8 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight() throw( uno::RuntimeExc void SAL_CALL SalGtkFilePicker::setImage( sal_Int16 /*aImageFormat*/, const uno::Any& /*aImage*/ ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->setImage( aImageFormat, aImage ); @@ -1477,8 +1497,6 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection ) CResourceProvider aResProvider; OUString aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE ); - GdkThreadLock aLock; - GtkTreeIter iter; GtkTreeModel *model; if (gtk_tree_selection_get_selected (selection, &model, &iter)) @@ -1493,7 +1511,7 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection ) OUStringToOString( aLabel, RTL_TEXTENCODING_UTF8 ).getStr()); FilePickerEvent evt; evt.ElementId = LISTBOX_FILTER; - controlStateChanged( evt ); + impl_controlStateChanged( evt ); } void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFilePicker *pobjFP ) @@ -1503,8 +1521,6 @@ void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFileP void SalGtkFilePicker::unselect_type() { - GdkThreadLock aLock; - gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView))); } @@ -1520,21 +1536,21 @@ void SalGtkFilePicker::filter_changed_cb( GtkFileChooser *, GParamSpec *, FilePickerEvent evt; evt.ElementId = LISTBOX_FILTER; OSL_TRACE( "filter_changed, isn't it great %x", pobjFP ); - pobjFP->controlStateChanged( evt ); + pobjFP->impl_controlStateChanged( evt ); } void SalGtkFilePicker::folder_changed_cb( GtkFileChooser *, SalGtkFilePicker *pobjFP ) { FilePickerEvent evt; OSL_TRACE( "folder_changed, isn't it great %x", pobjFP ); - pobjFP->directoryChanged( evt ); + pobjFP->impl_directoryChanged( evt ); } void SalGtkFilePicker::selection_changed_cb( GtkFileChooser *, SalGtkFilePicker *pobjFP ) { FilePickerEvent evt; OSL_TRACE( "selection_changed, isn't it great %x", pobjFP ); - pobjFP->fileSelectionChanged( evt ); + pobjFP->impl_fileSelectionChanged( evt ); } void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFilePicker* pobjFP ) @@ -1570,13 +1586,13 @@ void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFi sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO return m_pImpl->setShowState( bShowState ); if( bShowState != mbPreviewState ) { - GdkThreadLock aLock; - if( bShowState ) { // Show @@ -1604,6 +1620,8 @@ sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( u sal_Bool SAL_CALL SalGtkFilePicker::getShowState() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); return mbPreviewState; @@ -1637,6 +1655,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu GtkFileChooserAction eAction = GTK_FILE_CHOOSER_ACTION_OPEN; const gchar *first_button_text = GTK_STOCK_OPEN; + SolarMutexGuard g; // TODO: extract full semantic from // svtools/source/filepicker/filepicker.cxx (getWinBits) @@ -1721,8 +1740,6 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu 1 ); } - GdkThreadLock aLock; - if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction ) { CResourceProvider aResProvider; @@ -1783,6 +1800,8 @@ void SalGtkFilePicker::preview_toggled_cb( GtkObject *cb, SalGtkFilePicker* pobj void SAL_CALL SalGtkFilePicker::cancel() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->cancel(); @@ -1830,8 +1849,6 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSupportedServiceNames //------------------------------------------------- void SalGtkFilePicker::SetCurFilter( const OUString& rFilter ) { - GdkThreadLock aLock; - // Get all the filters already added GSList *filters = gtk_file_chooser_list_filters ( GTK_FILE_CHOOSER( m_pDialog ) ); bool bFound = false; @@ -1887,8 +1904,6 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType ) { - GdkThreadLock aLock; - GtkFileFilter *filter = gtk_file_filter_new(); OUString aShrunkName = shrinkFilterName( rFilter ); @@ -1962,8 +1977,6 @@ void SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const S void SalGtkFilePicker::SetFilters() { - GdkThreadLock aLock; - if (!m_aInitialFilter.getLength()) m_aInitialFilter = m_aCurrentFilter; @@ -2047,6 +2060,8 @@ void SalGtkFilePicker::SetFilters() SalGtkFilePicker::~SalGtkFilePicker() { + SolarMutexGuard g; + int i; for( i = 0; i < TOGGLE_LAST; i++ ) diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx index b846eb351d76..832e9445c342 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx @@ -108,7 +108,7 @@ class SalGtkFilePicker : virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Int16 SAL_CALL execute( ) + virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException ); //------------------------------------------------------------------------------------ @@ -241,10 +241,6 @@ class SalGtkFilePicker : // FilePicker Event functions //------------------------------------------------------------------------------------ - void SAL_CALL fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - private: // prevent copy and assignment SalGtkFilePicker( const SalGtkFilePicker& ); @@ -258,6 +254,11 @@ class SalGtkFilePicker : // to instanciate own services ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; + void impl_fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + void impl_directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + void impl_controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + + private: ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener; diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx index 328038f5cfc2..52d9c78ba1e0 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -47,6 +47,7 @@ #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> #include <osl/mutex.hxx> +#include <vcl/svapp.hxx> #include "SalGtkFolderPicker.hxx" #include "resourceprovider.hxx" @@ -87,8 +88,6 @@ SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiService { CResourceProvider aResProvider; - GdkThreadLock aLock; - m_pDialog = gtk_file_chooser_dialog_new( OUStringToOString( aResProvider.getResString( FOLDERPICKER_TITLE ), RTL_TEXTENCODING_UTF8 ).getStr(), NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -111,6 +110,8 @@ void SAL_CALL SalGtkFolderPicker::disposing( const lang::EventObject& ) void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDirectory ) throw( lang::IllegalArgumentException, uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); OString aTxt = unicodetouri( aDirectory ); @@ -120,17 +121,15 @@ void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDir OSL_TRACE( "setting path to %s", aTxt.getStr() ); - GdkThreadLock aLock; - gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ), aTxt.getStr() ); } rtl::OUString SAL_CALL SalGtkFolderPicker::getDisplayDirectory() throw( uno::RuntimeException ) { - OSL_ASSERT( m_pDialog != NULL ); + SolarMutexGuard g; - GdkThreadLock aLock; + OSL_ASSERT( m_pDialog != NULL ); gchar* pCurrentFolder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); @@ -159,16 +158,19 @@ void SAL_CALL SalGtkFolderPicker::setDescription( const rtl::OUString& rDescript void SAL_CALL SalGtkFolderPicker::setTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); - GdkThreadLock aLock; gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); } sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_TRACE( "1: HERE WE ARE"); OSL_ASSERT( m_pDialog != NULL ); @@ -205,6 +207,8 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException ) { + SolarMutexGuard g; + OSL_ASSERT( m_pDialog != NULL ); // TODO m_pImpl->cancel(); diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index ee8ac305530f..d52c2c60e37d 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -118,16 +118,17 @@ rtl::OString SalGtkPicker::unicodetouri(const rtl::OUString &rURL) return sURL; } -gboolean canceldialog(RunDialog *pDialog) -{ - pDialog->cancel(); - return false; -} - extern "C" { struct Display; extern GdkDisplay* gdk_x11_lookup_xdisplay (void*xdisplay); + + static gboolean canceldialog(RunDialog *pDialog) + { + GdkThreadLock lock; + pDialog->cancel(); + return false; + } } RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit, @@ -157,8 +158,6 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit } } - GdkThreadLock aLock; - GdkDisplay *pDisplay = aWindowHandle.DisplayPointer ? gdk_x11_lookup_xdisplay(reinterpret_cast<void*>(static_cast<sal_IntPtr>(aWindowHandle.DisplayPointer))) : NULL; GdkWindow* pParent = pDisplay ? gdk_window_lookup_for_display(pDisplay, aWindowHandle.WindowHandle) : NULL; if (!pParent && pDisplay) @@ -173,17 +172,19 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit RunDialog::~RunDialog() { + SolarMutexGuard g; + if (mpCreatedParent) - { - GdkThreadLock aLock; gdk_window_destroy (mpCreatedParent); - } + + g_source_remove_by_user_data (this); } void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) { - GdkThreadLock aLock; + SolarMutexGuard g; + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } @@ -195,13 +196,13 @@ void SAL_CALL RunDialog::queryTermination( const ::com::sun::star::lang::EventOb void SAL_CALL RunDialog::notifyTermination( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) { - GdkThreadLock aLock; + SolarMutexGuard g; + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } void RunDialog::cancel() { - GdkThreadLock aLock; gtk_dialog_response( GTK_DIALOG( mpDialog ), GTK_RESPONSE_CANCEL ); gtk_widget_hide( mpDialog ); } @@ -211,7 +212,6 @@ gint RunDialog::run() if (mxToolkit.is()) mxToolkit->addTopWindowListener(this); - GdkThreadLock aLock; gint nStatus = gtk_dialog_run( GTK_DIALOG( mpDialog ) ); if (mxToolkit.is()) @@ -265,9 +265,10 @@ SalGtkPicker::SalGtkPicker(const uno::Reference<lang::XMultiServiceFactory>& xSe SalGtkPicker::~SalGtkPicker() { + SolarMutexGuard g; + if (m_pDialog) { - GdkThreadLock aLock; gtk_widget_destroy(m_pDialog); } } @@ -284,7 +285,6 @@ void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirec OSL_TRACE( "setting path to %s", aTxt.getStr() ); - GdkThreadLock aLock; gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ), aTxt.getStr() ); } @@ -293,8 +293,6 @@ rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::Runti { OSL_ASSERT( m_pDialog != NULL ); - GdkThreadLock aLock; - gchar* pCurrentFolder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) ); ::rtl::OUString aCurrentFolderName = uritounicode(pCurrentFolder); @@ -309,7 +307,6 @@ void SAL_CALL SalGtkPicker::implsetTitle( const rtl::OUString& aTitle ) throw( u ::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ); - GdkThreadLock aLock; gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); } diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 92b29e728a59..cd9e6553a925 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -128,9 +128,9 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > &rDesktop ); + virtual ~RunDialog(); gint run(); void cancel(); - ~RunDialog(); }; #endif diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 51d2793fb8fd..08e47a332e55 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -40,7 +40,7 @@ #include <vector> #include <memory> -#include <boost/shared_ptr.hpp> +#include <boost/scoped_ptr.hpp> // --------------------------------------------------------------------------- @@ -115,7 +115,7 @@ private: ::sdr::overlay::OverlayObjectList* mpOOHeader; ::sdr::overlay::OverlayObjectList* mpOOShrink; - ::boost::shared_ptr<Rectangle> mpAutoFillRect; + boost::scoped_ptr<Rectangle> mpAutoFillRect; /** * Stores current visible column and row ranges, used to avoid expensive @@ -144,74 +144,72 @@ private: ScFilterListBox* pFilterBox; FloatingWindow* pFilterFloat; - ::std::auto_ptr<ScCheckListMenuWindow> mpDPFieldPopup; - ::std::auto_ptr<ScDPFieldButton> mpFilterButton; + boost::scoped_ptr<ScCheckListMenuWindow> mpDPFieldPopup; + boost::scoped_ptr<ScDPFieldButton> mpFilterButton; - sal_uInt16 nCursorHideCount; + sal_uInt16 nCursorHideCount; - sal_Bool bMarking; + sal_uInt16 nButtonDown; + sal_uInt8 nMouseStatus; + sal_uInt8 nNestedButtonState; // track nested button up/down calls - sal_uInt16 nButtonDown; - sal_Bool bEEMouse; // Edit-Engine hat Maus - sal_uInt8 nMouseStatus; - sal_uInt8 nNestedButtonState; // track nested button up/down calls - - sal_Bool bDPMouse; // DataPilot-D&D (neue Pivottabellen) long nDPField; ScDPObject* pDragDPObj; //! name? - sal_Bool bRFMouse; // RangeFinder-Drag - sal_Bool bRFSize; - sal_uInt16 nRFIndex; + sal_uInt16 nRFIndex; SCsCOL nRFAddX; SCsROW nRFAddY; - sal_uInt16 nPagebreakMouse; // Pagebreak-Modus Drag + sal_uInt16 nPagebreakMouse; // Pagebreak-Modus Drag SCCOLROW nPagebreakBreak; SCCOLROW nPagebreakPrev; ScRange aPagebreakSource; ScRange aPagebreakDrag; - sal_Bool bPagebreakDrawn; - sal_uInt8 nPageScript; + sal_uInt8 nPageScript; long nLastClickX; long nLastClickY; - sal_Bool bDragRect; SCCOL nDragStartX; SCROW nDragStartY; SCCOL nDragEndX; SCROW nDragEndY; InsCellCmd meDragInsertMode; - sal_uInt16 nCurrentPointer; + sal_uInt16 nCurrentPointer; - sal_Bool bIsInScroll; - sal_Bool bIsInPaint; ScDDComboBoxButton aComboButton; Point aCurMousePos; - sal_uInt16 nPaintCount; + sal_uInt16 nPaintCount; Rectangle aRepaintPixel; - sal_Bool bNeedsRepaint; - sal_Bool bAutoMarkVisible; ScAddress aAutoMarkPos; - - sal_Bool bListValButton; ScAddress aListValPos; Rectangle aInvertRect; + bool bEEMouse:1; // Edit-Engine hat Maus + bool bDPMouse:1; // DataPilot-D&D (neue Pivottabellen) + bool bRFMouse:1; // RangeFinder-Drag + bool bRFSize:1; + bool bPagebreakDrawn:1; + bool bDragRect:1; + bool bIsInScroll:1; + bool bIsInPaint:1; + bool bNeedsRepaint:1; + bool bAutoMarkVisible:1; + bool bListValButton:1; + DECL_LINK( PopupModeEndHdl, FloatingWindow* ); DECL_LINK( PopupSpellingHdl, SpellCallbackInfo* ); - sal_Bool TestMouse( const MouseEvent& rMEvt, sal_Bool bAction ); + bool TestMouse( const MouseEvent& rMEvt, bool bAction ); - sal_Bool DoPageFieldSelection( SCCOL nCol, SCROW nRow ); + bool DoPageFieldSelection( SCCOL nCol, SCROW nRow ); bool DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ); void DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ); @@ -233,9 +231,9 @@ private: void PagebreakMove( const MouseEvent& rMEvt, sal_Bool bUp ); - void UpdateDragRect( sal_Bool bShowRange, const Rectangle& rPosRect ); + void UpdateDragRect( bool bShowRange, const Rectangle& rPosRect ); - sal_Bool IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ); + bool IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ); void ExecFilter( sal_uLong nSel, SCCOL nCol, SCROW nRow, const String& aValue, bool bCheckForDates ); void FilterSelect( sal_uLong nSel ); @@ -244,27 +242,27 @@ private: void ExecPageFieldSelect( SCCOL nCol, SCROW nRow, sal_Bool bHasSelection, const String& rStr ); - sal_Bool HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange ); + bool HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange ); - sal_Bool DropScroll( const Point& rMousePos ); + bool DropScroll( const Point& rMousePos ); sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt ); sal_Int8 ExecutePrivateDrop( const ExecuteDropEvent& rEvt ); sal_Int8 DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPosX, SCROW nDestPosY, - const Point& rLogicPos, sal_Int8 nDndAction ); + const Point& rLogicPos, sal_Int8 nDndAction ); void HandleMouseButtonDown( const MouseEvent& rMEvt ); - sal_Bool DrawMouseButtonDown(const MouseEvent& rMEvt); - sal_Bool DrawMouseButtonUp(const MouseEvent& rMEvt); - sal_Bool DrawMouseMove(const MouseEvent& rMEvt); - sal_Bool DrawKeyInput(const KeyEvent& rKEvt); - sal_Bool DrawCommand(const CommandEvent& rCEvt); - sal_Bool DrawHasMarkedObj(); + bool DrawMouseButtonDown(const MouseEvent& rMEvt); + bool DrawMouseButtonUp(const MouseEvent& rMEvt); + bool DrawMouseMove(const MouseEvent& rMEvt); + bool DrawKeyInput(const KeyEvent& rKEvt); + bool DrawCommand(const CommandEvent& rCEvt); + bool DrawHasMarkedObj(); void DrawEndAction(); void DrawMarkDropObj( SdrObject* pObj ); SdrObject* GetEditObject(); - sal_Bool IsMyModel(SdrEditView* pSdrView); + bool IsMyModel(SdrEditView* pSdrView); void DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sal_uLong nLayer ); void DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev ); @@ -273,13 +271,13 @@ private: void DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev ); - sal_Bool GetEditUrl( const Point& rPos, - String* pName=0, String* pUrl=0, String* pTarget=0 ); - sal_Bool GetEditUrlOrError( sal_Bool bSpellErr, const Point& rPos, + bool GetEditUrl( const Point& rPos, String* pName=0, String* pUrl=0, String* pTarget=0 ); + bool GetEditUrlOrError( bool bSpellErr, const Point& rPos, + String* pName=0, String* pUrl=0, String* pTarget=0 ); - sal_Bool HitRangeFinder( const Point& rMouse, sal_Bool& rCorner, sal_uInt16* pIndex = NULL, - SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL ); + bool HitRangeFinder( const Point& rMouse, bool& rCorner, sal_uInt16* pIndex = NULL, + SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL ); sal_uInt16 HitPageBreak( const Point& rMouse, ScRange* pSource = NULL, SCCOLROW* pBreak = NULL, SCCOLROW* pPrev = NULL ); @@ -340,7 +338,7 @@ public: void UpdateFormulas(); - void DoAutoFilterMenue( SCCOL nCol, SCROW nRow, sal_Bool bDataSelect ); + void DoAutoFilterMenue( SCCOL nCol, SCROW nRow, bool bDataSelect ); void DoScenarioMenue( const ScRange& rScenRange ); void LaunchPageFieldMenu( SCCOL nCol, SCROW nRow ); @@ -349,34 +347,31 @@ public: ::com::sun::star::sheet::DataPilotFieldOrientation GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const; void DrawButtons( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, - ScTableInfo& rTabInfo, OutputDevice* pContentDev ); + ScTableInfo& rTabInfo, OutputDevice* pContentDev ); using Window::Draw; void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, - ScUpdateMode eMode = SC_UPDATE_ALL ); - - void InvertSimple( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, - sal_Bool bTestMerge = false, sal_Bool bRepeat = false ); + ScUpdateMode eMode = SC_UPDATE_ALL ); void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); void HideCursor(); void ShowCursor(); - void UpdateAutoFillMark(sal_Bool bMarked, const ScRange& rMarkRange); + void UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange); - void UpdateListValPos( sal_Bool bVisible, const ScAddress& rPos ); + void UpdateListValPos( bool bVisible, const ScAddress& rPos ); - sal_Bool ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKeyboard ); + bool ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard ); void HideNoteMarker(); - MapMode GetDrawMapMode( sal_Bool bForce = false ); + MapMode GetDrawMapMode( bool bForce = false ); void ContinueDrag(); void StopMarking(); void UpdateInputContext(); - void CheckInverted() { if (nPaintCount) bNeedsRepaint = sal_True; } + void CheckInverted() { if (nPaintCount) bNeedsRepaint = true; } void DoInvertRect( const Rectangle& rPixel ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 69c7a52d7c58..195bc87032e5 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -429,28 +429,28 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic mpDPFieldPopup(NULL), mpFilterButton(NULL), nCursorHideCount( 0 ), - bMarking( false ), nButtonDown( 0 ), - bEEMouse( false ), nMouseStatus( SC_GM_NONE ), nNestedButtonState( SC_NESTEDBUTTON_NONE ), - bDPMouse( false ), - bRFMouse( false ), nPagebreakMouse( SC_PD_NONE ), - bPagebreakDrawn( false ), nPageScript( 0 ), - bDragRect( false ), nDragStartX( -1 ), nDragStartY( -1 ), nDragEndX( -1 ), nDragEndY( -1 ), meDragInsertMode( INS_NONE ), nCurrentPointer( 0 ), - bIsInScroll( false ), - bIsInPaint( false ), aComboButton( this ), aCurMousePos( 0,0 ), nPaintCount( 0 ), + bEEMouse( false ), + bDPMouse( false ), + bRFMouse( false ), + bRFSize( false ), + bPagebreakDrawn( false ), + bDragRect( false ), + bIsInScroll( false ), + bIsInPaint( false ), bNeedsRepaint( false ), bAutoMarkVisible( false ), bListValButton( false ) @@ -522,7 +522,7 @@ void ScGridWindow::ClickExtern() } while (false); - if (mpDPFieldPopup.get()) + if (mpDPFieldPopup) { mpDPFieldPopup->close(false); mpDPFieldPopup.reset(); @@ -880,7 +880,7 @@ void ScGridWindow::DoScenarioMenue( const ScRange& rScenRange ) CaptureMouse(); } -void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, sal_Bool bDataSelect ) +void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, bool bDataSelect ) { delete pFilterBox; delete pFilterFloat; @@ -1352,7 +1352,7 @@ void ScGridWindow::MoveMouseStatus( ScGridWindow& rDestWin ) } } -sal_Bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, sal_Bool bAction ) +bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) { // MouseEvent buttons must only be checked if bAction==TRUE // to allow changing the mouse pointer in MouseMove, @@ -1362,16 +1362,16 @@ sal_Bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, sal_Bool bAction ) if ( bAction && !rMEvt.IsLeft() ) return false; - sal_Bool bNewPointer = false; + bool bNewPointer = false; SfxInPlaceClient* pClient = pViewData->GetViewShell()->GetIPClient(); - sal_Bool bOleActive = ( pClient && pClient->IsObjectInPlaceActive() ); + bool bOleActive = ( pClient && pClient->IsObjectInPlaceActive() ); if ( pViewData->IsActive() && !bOleActive ) { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); - sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); // Auto-Fill @@ -1400,7 +1400,7 @@ sal_Bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, sal_Bool bAction ) // where the Marking flag is set and MarkToSimple won't work anymore. pViewData->GetMarkData().MarkToSimple(); } - bNewPointer = sal_True; + bNewPointer = true; } } } @@ -1421,9 +1421,9 @@ sal_Bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, sal_Bool bAction ) aStartPos.X() += 2; aEndPos.X() += 2; } - sal_Bool bTop = ( aMousePos.X() >= aStartPos.X()-3 && aMousePos.X() <= aStartPos.X()+1 && + bool bTop = ( aMousePos.X() >= aStartPos.X()-3 && aMousePos.X() <= aStartPos.X()+1 && aMousePos.Y() >= aStartPos.Y()-3 && aMousePos.Y() <= aStartPos.Y()+1 ); - sal_Bool bBottom = ( aMousePos.X() >= aEndPos.X()-3 && aMousePos.X() <= aEndPos.X()+1 && + bool bBottom = ( aMousePos.X() >= aEndPos.X()-3 && aMousePos.X() <= aEndPos.X()+1 && aMousePos.Y() >= aEndPos.Y()-3 && aMousePos.Y() <= aEndPos.Y()+1 ); if ( bTop || bBottom ) { @@ -1435,7 +1435,7 @@ sal_Bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, sal_Bool bAction ) aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), nMode ); } - bNewPointer = sal_True; + bNewPointer = true; } } } @@ -1589,7 +1589,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt ) GrabFocus(); pScMod->SetInputMode( SC_INPUT_TABLE ); - bEEMouse = sal_True; + bEEMouse = true; bEditMode = pEditView->MouseButtonDown( rMEvt ); return; } @@ -1608,9 +1608,12 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt ) // Reihenfolge passend zum angezeigten Cursor: // RangeFinder, AutoFill, PageBreak, Drawing - if ( HitRangeFinder( rMEvt.GetPosPixel(), bRFSize, &nRFIndex, &nRFAddX, &nRFAddY ) ) + bool bCorner; + bool bFound = HitRangeFinder(rMEvt.GetPosPixel(), bCorner, &nRFIndex, &nRFAddX, &nRFAddY); + bRFSize = bCorner; + if (bFound) { - bRFMouse = sal_True; // die anderen Variablen sind oben initialisiert + bRFMouse = true; // die anderen Variablen sind oben initialisiert if ( pViewData->GetActivePart() != eWhich ) pViewData->GetView()->ActivatePart( eWhich ); //! schon oben immer ??? @@ -1802,7 +1805,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) { if ( pFilterBox && pFilterBox->GetMode() == SC_FILTERBOX_FILTER ) { - if (mpFilterButton.get()) + if (mpFilterButton) { bool bFilterActive = IsAutoFilterActive( pFilterBox->GetCol(), pFilterBox->GetRow(), pViewData->GetTabNo() ); @@ -2255,7 +2258,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) nMouseStatus = SC_GM_NONE; if ( pFilterBox->GetMode() == SC_FILTERBOX_FILTER ) { - if (mpFilterButton.get()) + if (mpFilterButton) { mpFilterButton->setHasHiddenMember(false); mpFilterButton->setPopupPressed(false); @@ -2344,7 +2347,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) // Range-Finder - sal_Bool bCorner; + bool bCorner; if ( HitRangeFinder( rMEvt.GetPosPixel(), bCorner ) ) { if (bCorner) @@ -2514,7 +2517,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt ) } if (bRFMouse) { - RFMouseMove( rMEvt, sal_True ); // richtig abbrechen geht dabei nicht... + RFMouseMove( rMEvt, true ); // richtig abbrechen geht dabei nicht... bRFMouse = false; } if (nPagebreakMouse) @@ -3156,7 +3159,7 @@ void ScGridWindow::UpdateInputContext() // sensitiver Bereich (Pixel) #define SCROLL_SENSITIVE 20 -sal_Bool ScGridWindow::DropScroll( const Point& rMousePos ) +bool ScGridWindow::DropScroll( const Point& rMousePos ) { SCsCOL nDx = 0; SCsROW nDy = 0; @@ -3451,7 +3454,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) nDragStartY = nNewDragY; nDragEndX = nDragStartX+nSizeX-1; nDragEndY = nDragStartY+nSizeY-1; - bDragRect = sal_True; + bDragRect = true; meDragInsertMode = eDragInsertMode; UpdateDragRectOverlay(); @@ -4352,7 +4355,7 @@ void ScGridWindow::UpdateFormulas() // nicht anfangen, verschachtelt zu painten // (dann wuerde zumindest der MapMode nicht mehr stimmen) - bNeedsRepaint = sal_True; // -> am Ende vom Paint nochmal Invalidate auf alles + bNeedsRepaint = true; // -> am Ende vom Paint nochmal Invalidate auf alles aRepaintPixel = Rectangle(); // alles return; } @@ -4414,7 +4417,7 @@ void ScGridWindow::UpdateFormulas() CheckNeedsRepaint(); // #i90362# used to be called via Draw() - still needed here } -void ScGridWindow::UpdateAutoFillMark(sal_Bool bMarked, const ScRange& rMarkRange) +void ScGridWindow::UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange) { if ( bMarked != bAutoMarkVisible || ( bMarked && rMarkRange.aEnd != aAutoMarkPos ) ) { @@ -4428,9 +4431,9 @@ void ScGridWindow::UpdateAutoFillMark(sal_Bool bMarked, const ScRange& rMarkRang } } -void ScGridWindow::UpdateListValPos( sal_Bool bVisible, const ScAddress& rPos ) +void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos ) { - sal_Bool bOldButton = bListValButton; + bool bOldButton = bListValButton; ScAddress aOldPos = aListValPos; bListValButton = bVisible; @@ -4502,10 +4505,10 @@ Point ScGridWindow::GetMousePosPixel() const { return aCurMousePos; } //------------------------------------------------------------------------ -sal_Bool ScGridWindow::HitRangeFinder( const Point& rMouse, sal_Bool& rCorner, +bool ScGridWindow::HitRangeFinder( const Point& rMouse, bool& rCorner, sal_uInt16* pIndex, SCsCOL* pAddX, SCsROW* pAddY ) { - sal_Bool bFound = false; + bool bFound = false; ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pViewData->GetViewShell() ); if (pHdl) { @@ -4531,13 +4534,13 @@ sal_Bool ScGridWindow::HitRangeFinder( const Point& rMouse, sal_Bool& rCorner, aNext.X() += nSizeXPix * nLayoutSign; aNext.Y() += nSizeYPix; - sal_Bool bCornerHor; + bool bCornerHor; if ( bLayoutRTL ) bCornerHor = ( rMouse.X() >= aNext.X() && rMouse.X() <= aNext.X() + 8 ); else bCornerHor = ( rMouse.X() >= aNext.X() - 8 && rMouse.X() <= aNext.X() ); - sal_Bool bCellCorner = ( bCornerHor && + bool bCellCorner = ( bCornerHor && rMouse.Y() >= aNext.Y() - 8 && rMouse.Y() <= aNext.Y() ); // corner is hit only if the mouse is within the cell @@ -4828,13 +4831,13 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, sal_Bool bUp ) //------------------------------------------------------------------------ -sal_Bool ScGridWindow::GetEditUrl( const Point& rPos, - String* pName, String* pUrl, String* pTarget ) +bool ScGridWindow::GetEditUrl( const Point& rPos, + String* pName, String* pUrl, String* pTarget ) { return GetEditUrlOrError( false, rPos, pName, pUrl, pTarget ); } -sal_Bool ScGridWindow::GetEditUrlOrError( sal_Bool bSpellErr, const Point& rPos, +bool ScGridWindow::GetEditUrlOrError( bool bSpellErr, const Point& rPos, String* pName, String* pUrl, String* pTarget ) { //! nPosX/Y mit uebergeben? @@ -5011,14 +5014,14 @@ sal_Bool ScGridWindow::GetEditUrlOrError( sal_Bool bSpellErr, const Point& rPos, return false; } -sal_Bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange ) +bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange ) { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); SCTAB nTabCount = pDoc->GetTableCount(); if ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) ) { - sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); Size aButSize = pViewData->GetScenButSize(); long nBWidth = aButSize.Width(); @@ -5044,7 +5047,7 @@ sal_Bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScen // dadurch keine neuen nicht-ueberdeckten Zellen mit umrandet werden pDoc->ExtendTotalMerge( aRange ); - sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 ); + bool bTextBelow = ( aRange.aStart.Row() == 0 ); Point aButtonPos; if ( bTextBelow ) @@ -5067,7 +5070,7 @@ sal_Bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScen if ( aButRect.IsInside( rPosPixel ) ) { rScenRange = aRange; - return sal_True; + return true; } } } diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index bf983922ce45..8377fdf68c26 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -118,12 +118,12 @@ DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW } // private method for mouse button handling -sal_Bool ScGridWindow::DoPageFieldSelection( SCCOL nCol, SCROW nRow ) +bool ScGridWindow::DoPageFieldSelection( SCCOL nCol, SCROW nRow ) { if (GetDPFieldOrientation( nCol, nRow ) == sheet::DataPilotFieldOrientation_PAGE) { LaunchPageFieldMenu( nCol, nRow ); - return sal_True; + return true; } return false; } @@ -186,7 +186,7 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt long nField = pDPObj->GetHeaderDim( aPos, nOrient ); if ( nField >= 0 ) { - bDPMouse = sal_True; + bDPMouse = true; nDPField = nField; pDragDPObj = pDPObj; @@ -547,7 +547,7 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu() typedef boost::unordered_map<OUString, OUString, OUStringHash> MemNameMapType; typedef boost::unordered_map<OUString, bool, OUStringHash> MemVisibilityType; - if (!mpDPFieldPopup.get()) + if (!mpDPFieldPopup) return; DPFieldPopupData* pDPData = static_cast<DPFieldPopupData*>(mpDPFieldPopup->getExtendedData()); @@ -627,7 +627,7 @@ void ScGridWindow::DPMouseButtonUp( const MouseEvent& rMEvt ) // ----------------------------------------------------------------------- -void ScGridWindow::UpdateDragRect( sal_Bool bShowRange, const Rectangle& rPosRect ) +void ScGridWindow::UpdateDragRect( bool bShowRange, const Rectangle& rPosRect ) { SCCOL nStartX = ( rPosRect.Left() >= 0 ) ? static_cast<SCCOL>(rPosRect.Left()) : SCCOL_MAX; SCROW nStartY = ( rPosRect.Top() >= 0 ) ? static_cast<SCROW>(rPosRect.Top()) : SCROW_MAX; diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index bf3ff4fe59a2..4e3189c4efb9 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -54,9 +54,9 @@ // ----------------------------------------------------------------------- -sal_Bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) +bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) { - sal_Bool bRet = false; + bool bRet = false; FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); if (pDraw && !pViewData->IsRefMode()) { @@ -65,7 +65,7 @@ sal_Bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) if ( pDraw->IsDetectiveHit( aLogicPos ) ) { // auf Detektiv-Pfeilen gar nichts (Doppelklick wird bei ButtonUp ausgewertet) - bRet = sal_True; + bRet = true; } else { @@ -81,15 +81,15 @@ sal_Bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) if ( pDrView && !rMEvt.IsLeft() && !bRet ) { pDrView->BrkAction(); - bRet = sal_True; + bRet = true; } return bRet; } -sal_Bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) +bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) { ScViewFunc* pView = pViewData->GetView(); - sal_Bool bRet = false; + bool bRet = false; FuPoor* pDraw = pView->GetDrawFuncPtr(); if (pDraw && !pViewData->IsRefMode()) { @@ -103,7 +103,7 @@ sal_Bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) ScDrawView* pDrView = pViewData->GetScDrawView(); if ( pDrView ) { - sal_Bool bReplaceAll = sal_True; + bool bReplaceAll = true; pDrView->SetAttrToMarked(*pDrawBrush, bReplaceAll); } @@ -115,13 +115,13 @@ sal_Bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) return bRet; } -sal_Bool ScGridWindow::DrawMouseMove(const MouseEvent& rMEvt) +bool ScGridWindow::DrawMouseMove(const MouseEvent& rMEvt) { FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); if (pDraw && !pViewData->IsRefMode()) { pDraw->SetWindow( this ); - sal_Bool bRet = pDraw->MouseMove( rMEvt ); + bool bRet = pDraw->MouseMove( rMEvt ); if ( bRet ) UpdateStatusPosSize(); return bRet; @@ -146,7 +146,7 @@ void ScGridWindow::DrawEndAction() // ReleaseMouse beim Aufruf } -sal_Bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt) +bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt) { ScDrawView* pDrView = pViewData->GetScDrawView(); FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); @@ -157,30 +157,30 @@ sal_Bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt) if( nUsed == SC_CMD_USED ) nButtonDown = 0; // MouseButtonUp wird verschluckt... if( nUsed || pDrView->IsAction() ) - return sal_True; + return true; } return false; } -sal_Bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) +bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) { ScDrawView* pDrView = pViewData->GetScDrawView(); FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); if (pDrView && pDraw && !pViewData->IsRefMode()) { pDraw->SetWindow( this ); - sal_Bool bOldMarked = pDrView->AreObjectsMarked(); + bool bOldMarked = pDrView->AreObjectsMarked(); if (pDraw->KeyInput( rKEvt )) { - sal_Bool bLeaveDraw = false; - sal_Bool bUsed = sal_True; - sal_Bool bNewMarked = pDrView->AreObjectsMarked(); + bool bLeaveDraw = false; + bool bUsed = true; + bool bNewMarked = pDrView->AreObjectsMarked(); if ( !pViewData->GetView()->IsDrawSelMode() ) if ( !bNewMarked ) { pViewData->GetViewShell()->SetDrawShell( false ); - bLeaveDraw = sal_True; + bLeaveDraw = true; if ( !bOldMarked && rKEvt.GetKeyCode().GetCode() == KEY_DELETE ) bUsed = false; // nichts geloescht @@ -245,7 +245,7 @@ void ScGridWindow::DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pCo } } -MapMode ScGridWindow::GetDrawMapMode( sal_Bool bForce ) +MapMode ScGridWindow::GetDrawMapMode( bool bForce ) { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); @@ -382,7 +382,7 @@ void ScGridWindow::UpdateStatusPosSize() pViewData->GetBindings().SetState(aSet); } -sal_Bool ScGridWindow::DrawHasMarkedObj() +bool ScGridWindow::DrawHasMarkedObj() { ScDrawView* p = pViewData->GetScDrawView(); return p ? p->AreObjectsMarked() : false; diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 03cd63f388f1..9d35f84c5785 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -334,7 +334,7 @@ void ScGridWindow::Paint( const Rectangle& rRect ) } else { - bNeedsRepaint = sal_True; + bNeedsRepaint = true; aRepaintPixel = LogicToPixel(rRect); // nur betroffenen Bereich } return; @@ -343,7 +343,7 @@ void ScGridWindow::Paint( const Rectangle& rRect ) if (bIsInPaint) return; - bIsInPaint = sal_True; + bIsInPaint = true; Rectangle aPixRect = LogicToPixel( rRect ); @@ -1308,7 +1308,7 @@ Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos ) return Rectangle( aPos, aBtnSize ); } -sal_Bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) +bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) { ScDocument* pDoc = pViewData->GetDocument(); ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab ); @@ -1321,8 +1321,8 @@ sal_Bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) OSL_FAIL("Auto-Filter-Button ohne DBData"); } - sal_Bool bSimpleQuery = sal_True; - sal_Bool bColumnFound = false; + bool bSimpleQuery = true; + bool bColumnFound = false; SCSIZE nQuery; if ( !aQueryParam.bInplace ) @@ -1344,179 +1344,6 @@ sal_Bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) return ( bSimpleQuery && bColumnFound ); } -void ScGridWindow::InvertSimple( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, - sal_Bool bTestMerge, sal_Bool bRepeat ) -{ - //! if INVERT_HIGHLIGHT swaps foreground and background (like on Mac), - //! use INVERT_HIGHLIGHT only for cells that have no background color set - //! (here and in ScOutputData::DrawMark) - - PutInOrder( nX1, nX2 ); - PutInOrder( nY1, nY2 ); - - ScMarkData& rMark = pViewData->GetMarkData(); - ScDocument* pDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); - - sal_Bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); - long nLayoutSign = bLayoutRTL ? -1 : 1; - - SCCOL nTestX2 = nX2; - SCROW nTestY2 = nY2; - if (bTestMerge) - pDoc->ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab ); - - SCCOL nPosX = pViewData->GetPosX( eHWhich ); - SCROW nPosY = pViewData->GetPosY( eVWhich ); - if (nTestX2 < nPosX || nTestY2 < nPosY) - return; // unsichtbar - SCCOL nRealX1 = nX1; - if (nX1 < nPosX) - nX1 = nPosX; - if (nY1 < nPosY) - nY1 = nPosY; - - SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); - if (nXRight > MAXCOL) nXRight = MAXCOL; - SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); - if (nYBottom > MAXROW) nYBottom = MAXROW; - - if (nX1 > nXRight || nY1 > nYBottom) - return; // unsichtbar - if (nX2 > nXRight) nX2 = nXRight; - if (nY2 > nYBottom) nY2 = nYBottom; - - MapMode aOld = GetMapMode(); SetMapMode(MAP_PIXEL); // erst nach den return's !!! - - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); - - ScInvertMerger aInvert( this ); - - Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); - long nScrY = aScrPos.Y(); - sal_Bool bWasHidden = false; - for (SCROW nY=nY1; nY<=nY2; nY++) - { - sal_Bool bFirstRow = ( nY == nPosY ); // first visible row? - sal_Bool bDoHidden = false; // versteckte nachholen ? - sal_uInt16 nHeightTwips = pDoc->GetRowHeight( nY,nTab ); - sal_Bool bDoRow = ( nHeightTwips != 0 ); - if (bDoRow) - { - if (bTestMerge) - if (bWasHidden) // auf versteckte zusammengefasste testen - { - bDoHidden = true; - bDoRow = true; - } - - bWasHidden = false; - } - else - { - bWasHidden = sal_True; - if (bTestMerge) - if (nY==nY2) - bDoRow = sal_True; // letzte Zeile aus Block - } - - if ( bDoRow ) - { - SCCOL nLoopEndX = nX2; - if (nX2 < nX1) // Rest von zusammengefasst - { - SCCOL nStartX = nX1; - while ( ((const ScMergeFlagAttr*)pDoc-> - GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG))->IsHorOverlapped() ) - --nStartX; - if (nStartX <= nX2) - nLoopEndX = nX1; - } - - long nEndY = nScrY + ScViewData::ToPixel( nHeightTwips, nPPTY ) - 1; - long nScrX = aScrPos.X(); - for (SCCOL nX=nX1; nX<=nLoopEndX; nX++) - { - long nWidth = ScViewData::ToPixel( pDoc->GetColWidth( nX,nTab ), nPPTX ); - if ( nWidth > 0 ) - { - long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign; - if (bTestMerge) - { - SCROW nThisY = nY; - const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab ); - const ScMergeFlagAttr* pMergeFlag = (const ScMergeFlagAttr*) &pPattern-> - GetItem(ATTR_MERGE_FLAG); - if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) ) - { - while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 && - (pDoc->RowHidden(nThisY-1, nTab) || bFirstRow) ) - { - --nThisY; - pPattern = pDoc->GetPattern( nX, nThisY, nTab ); - pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); - } - } - - // nur Rest von zusammengefasster zu sehen ? - SCCOL nThisX = nX; - if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 ) - { - while ( pMergeFlag->IsHorOverlapped() ) - { - --nThisX; - pPattern = pDoc->GetPattern( nThisX, nThisY, nTab ); - pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); - } - } - - if ( rMark.IsCellMarked( nThisX, nThisY, sal_True ) == bRepeat ) - { - if ( !pMergeFlag->IsOverlapped() ) - { - ScMergeAttr* pMerge = (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE); - if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0) - { - Point aEndPos = pViewData->GetScrPos( - nThisX + pMerge->GetColMerge(), - nThisY + pMerge->GetRowMerge(), eWhich ); - if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY ) - { - aInvert.AddRect( Rectangle( nScrX,nScrY, - aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) ); - } - } - else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY ) - { - aInvert.AddRect( Rectangle( nScrX,nScrY,nEndX,nEndY ) ); - } - } - } - } - else // !bTestMerge - { - if ( rMark.IsCellMarked( nX, nY, sal_True ) == bRepeat && - nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY ) - { - aInvert.AddRect( Rectangle( nScrX,nScrY,nEndX,nEndY ) ); - } - } - - nScrX = nEndX + nLayoutSign; - } - } - nScrY = nEndY + 1; - } - } - - aInvert.Flush(); // before restoring MapMode - - SetMapMode(aOld); - - CheckInverted(); -} - void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { ScMarkData aMultiMark( pViewData->GetMarkData() ); diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx index 6117240dc106..05b50c02c51f 100644 --- a/sc/source/ui/view/gridwin5.cxx +++ b/sc/source/ui/view/gridwin5.cxx @@ -92,16 +92,16 @@ ScHideTextCursor::~ScHideTextCursor() // ----------------------------------------------------------------------- -sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKeyboard ) +bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard ) { - sal_Bool bDone = false; + bool bDone = false; ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); ScAddress aCellPos( nPosX, nPosY, nTab ); String aTrackText; - sal_Bool bLeftEdge = false; + bool bLeftEdge = false; // Change-Tracking @@ -175,7 +175,7 @@ sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKey // bei geloeschten Spalten: Pfeil auf die linke Seite der Zelle if ( pFound->GetType() == SC_CAT_DELETE_COLS ) - bLeftEdge = sal_True; + bLeftEdge = true; DateTime aDT = pFound->GetDateTime(); aTrackText = pFound->GetUser(); @@ -202,14 +202,14 @@ sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKey const ScPostIt* pNote = pDoc->GetNote( aCellPos ); if ( (aTrackText.Len() > 0) || (pNote && !pNote->IsCaptionShown()) ) { - sal_Bool bNew = sal_True; - sal_Bool bFast = false; + bool bNew = true; + bool bFast = false; if ( pNoteMarker ) // schon eine Notiz angezeigt { if ( pNoteMarker->GetDocPos() == aCellPos ) // dieselbe bNew = false; // dann stehenlassen else - bFast = sal_True; // sonst sofort + bFast = true; // sonst sofort // marker which was shown for ctrl-F1 isn't removed by mouse events if ( pNoteMarker->IsByKeyboard() && !bKeyboard ) @@ -218,7 +218,7 @@ sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKey if ( bNew ) { if ( bKeyboard ) - bFast = sal_True; // keyboard also shows the marker immediately + bFast = true; // keyboard also shows the marker immediately delete pNoteMarker; @@ -233,7 +233,7 @@ sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKey /* If caption is shown from right or bottom windows, adjust mapmode to include size of top-left window. */ - MapMode aMapMode = GetDrawMapMode( sal_True ); + MapMode aMapMode = GetDrawMapMode( true ); Size aLeftSize = pLeft->PixelToLogic( pLeft->GetOutputSizePixel(), aMapMode ); Point aOrigin = aMapMode.GetOrigin(); if( (this == pRight) || (this == pDiagonal) ) @@ -247,7 +247,7 @@ sal_Bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, sal_Bool bKey aMapMode, bLeftEdge, bFast, bKeyboard ); } - bDone = sal_True; // something is shown (old or new) + bDone = true; // something is shown (old or new) } return bDone; @@ -412,7 +412,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) Window::RequestHelp( rHEvt ); } -sal_Bool ScGridWindow::IsMyModel(SdrEditView* pSdrView) +bool ScGridWindow::IsMyModel(SdrEditView* pSdrView) { return pSdrView && pSdrView->GetModel() == pViewData->GetDocument()->GetDrawLayer(); diff --git a/set_soenv.in b/set_soenv.in index 6a97b454a1cc..034465360f89 100755 --- a/set_soenv.in +++ b/set_soenv.in @@ -1927,7 +1927,6 @@ ToFile( "WITH_EXTRA_GALLERY", "@WITH_EXTRA_GALLERY@", "e" ); ToFile( "WITH_EXTRA_TEMPLATE", "@WITH_EXTRA_TEMPLATE@", "e" ); ToFile( "WITH_EXTRA_SAMPLE", "@WITH_EXTRA_SAMPLE@", "e" ); ToFile( "WITH_EXTRA_FONT", "@WITH_EXTRA_FONT@", "e" ); -ToFile( "SYSTEM_TRANSLATE_TOOLKIT", "@SYSTEM_TRANSLATE_TOOLKIT@", "e" ); ToFile( "SYSTEM_DB", "@SYSTEM_DB@", "e" ); ToFile( "SYSTEM_DB_CFLAGS", "@SYSTEM_DB_CFLAGS@", "e" ); ToFile( "DB_LIB", "@DB_LIB@", "e" ); diff --git a/solenv/bin/localize b/solenv/bin/localize index fc1ae47b1bd8..7cf035cbc889 100755 --- a/solenv/bin/localize +++ b/solenv/bin/localize @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash if [ x${SOLARENV}x = xx ]; then echo No environment found, please use 'setsolar' exit 1 diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index c5128627cf08..b3d94720d640 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1253,92 +1253,27 @@ void SwDoc::CalculatePagesForPrinting( // #i103700# printing selections should not allow for automatic inserting empty pages bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport ); - Range aPages( 1, nDocPageCount ); - - MultiSelection aMulti( aPages ); - aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); - aMulti.Select( aPages ); - - const SwPageFrm *pStPage = dynamic_cast<const SwPageFrm*>( rLayout.Lower() ); - const SwFrm *pEndPage = pStPage; - - sal_uInt16 nFirstPageNo = 0; - sal_uInt16 nLastPageNo = 0; - - for( sal_uInt16 i = 1; i <= (sal_uInt16)aPages.Max(); ++i ) - { - if( i < (sal_uInt16)aPages.Min() ) - { - if( !pStPage->GetNext() ) - break; - pStPage = (SwPageFrm*)pStPage->GetNext(); - pEndPage= pStPage; - } - else if( i == (sal_uInt16)aPages.Min() ) - { - nFirstPageNo = i; - nLastPageNo = nFirstPageNo; - if( !pStPage->GetNext() || (i == (sal_uInt16)aPages.Max()) ) - break; - pEndPage = pStPage->GetNext(); - } - else if( i > (sal_uInt16)aPages.Min() ) - { - nLastPageNo = i; - if( !pEndPage->GetNext() || (i == (sal_uInt16)aPages.Max()) ) - break; - pEndPage = pEndPage->GetNext(); - } - } + std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); + std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); + rValidPages.clear(); - OSL_ENSURE( nFirstPageNo, "first page not found! Should not happen!" ); - if (nFirstPageNo) + sal_Int32 nPageNum = 1; + const SwPageFrm *pStPage = dynamic_cast<const SwPageFrm*>( rLayout.Lower() ); + while (pStPage && nPageNum <= nDocPageCount) { -// HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit -// geschaffen werden, alle Seiten von Seite x an zu deselektieren. -// Z.B. durch SetTotalRange .... + const bool bPrintThisPage = + ( (bPrintRightPages && pStPage->OnRightPage()) || + (bPrintLeftPages && !pStPage->OnRightPage()) ) && + ( bPrintEmptyPages || pStPage->Frm().Height() ); -// aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), sal_False ); - MultiSelection aTmpMulti( Range( 1, nLastPageNo ) ); - long nTmpIdx = aMulti.FirstSelected(); - static long nEndOfSelection = SFX_ENDOFSELECTION; - while ( nEndOfSelection != nTmpIdx && nTmpIdx <= long(nLastPageNo) ) + if (bPrintThisPage) { - aTmpMulti.Select( nTmpIdx ); - nTmpIdx = aMulti.NextSelected(); + rValidPages.insert( nPageNum ); + rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage ); } - aMulti = aTmpMulti; -// Ende des HACKs - - sal_uInt16 nPageNo = nFirstPageNo; - - std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); - std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); - rValidPages.clear(); - while ( pStPage ) - { - const sal_Bool bRightPg = pStPage->OnRightPage(); - if ( aMulti.IsSelected( nPageNo ) && - ( (bRightPg && bPrintRightPages) || - (!bRightPg && bPrintLeftPages) ) ) - { - // Feature - Print empty pages - if ( bPrintEmptyPages || pStPage->Frm().Height() ) - { - rValidPages.insert( nPageNo ); - rPrinterPaperTrays[ nPageNo ] = lcl_GetPaperBin( pStPage ); - } - } - if ( pStPage == pEndPage ) - { - pStPage = 0; - } - else - { ++nPageNo; - pStPage = (SwPageFrm*)pStPage->GetNext(); - } - } + ++nPageNum; + pStPage = (SwPageFrm*)pStPage->GetNext(); } diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 46047515d8cb..cbf2500400a3 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -72,10 +72,21 @@ private: static GtkStyleContext *mpToolbarStyle; static GtkStyleContext *mpToolButtonStyle; static GtkStyleContext *mpCheckButtonStyle; - void renderAreaToPix( cairo_t* cr, cairo_rectangle_t* rect ); - void drawStyleContext( GtkStyleContext* style, GtkStateFlags flags, - const Rectangle& rControlRegion, bool render_background = true ); + static GtkStyleContext *mpMenuBarStyle; + static GtkStyleContext *mpMenuBarItemStyle; + static GtkStyleContext *mpMenuStyle; + static GtkStyleContext *mpMenuItemStyle; + static GtkStyleContext *mpTooltipStyle; + + void renderAreaToPix( cairo_t* cr, cairo_rectangle_int_t *region ); void getStyleContext( GtkStyleContext** style, GtkWidget* widget ); + Rectangle NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect ); + void PaintScrollbar(GtkStyleContext *context, + cairo_t *cr, + const Rectangle& rControlRectangle, + ControlPart nPart, + const ImplControlValue& aValue ); + static bool style_loaded; }; diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index fb88bc4ceb60..b9100f09269b 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -40,6 +40,11 @@ GtkStyleContext* GtkSalGraphics::mpScrollbarStyle = NULL; GtkStyleContext* GtkSalGraphics::mpToolbarStyle = NULL; GtkStyleContext* GtkSalGraphics::mpToolButtonStyle = NULL; GtkStyleContext* GtkSalGraphics::mpCheckButtonStyle = NULL; +GtkStyleContext* GtkSalGraphics::mpMenuBarStyle = NULL; +GtkStyleContext* GtkSalGraphics::mpMenuBarItemStyle = NULL; +GtkStyleContext* GtkSalGraphics::mpMenuStyle = NULL; +GtkStyleContext* GtkSalGraphics::mpMenuItemStyle = NULL; + bool GtkSalGraphics::style_loaded = false; /************************************************************************ * State conversion @@ -48,99 +53,412 @@ static void NWConvertVCLStateToGTKState( ControlState nVCLState, GtkStateFlags* nGTKState, GtkShadowType* nGTKShadow ) { *nGTKShadow = GTK_SHADOW_OUT; - *nGTKState = GTK_STATE_FLAG_INSENSITIVE; + *nGTKState = GTK_STATE_FLAG_NORMAL; + + if (!( nVCLState & CTRL_STATE_ENABLED )) + *nGTKState = GTK_STATE_FLAG_INSENSITIVE; + + if ( nVCLState & CTRL_STATE_PRESSED ) + { + *nGTKState = (GtkStateFlags) (*nGTKState | GTK_STATE_FLAG_ACTIVE); + *nGTKShadow = GTK_SHADOW_IN; + } + + if ( nVCLState & CTRL_STATE_ROLLOVER ) + *nGTKState = (GtkStateFlags) (*nGTKState | GTK_STATE_FLAG_PRELIGHT); + + if ( nVCLState & CTRL_STATE_SELECTED ) + *nGTKState = (GtkStateFlags) (*nGTKState | GTK_STATE_FLAG_SELECTED); + + if ( nVCLState & CTRL_STATE_FOCUSED ) + *nGTKState = (GtkStateFlags) (*nGTKState | GTK_STATE_FLAG_FOCUSED); +} + +enum { + RENDER_BACKGROUND_AND_FRAME = 1, + RENDER_CHECK = 2, + RENDER_BACKGROUND = 3, + RENDER_LINE = 4, + RENDER_ARROW = 5, + RENDER_RADIO = 6, + RENDER_SCROLLBAR = 7, +}; + +static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow ) +{ + // Size the arrow appropriately + Size aSize( rButton.GetWidth()/2, rButton.GetHeight()/2 ); + rArrow.SetSize( aSize ); + + rArrow.SetPos( Point( + rButton.Left() + ( rButton.GetWidth() - rArrow.GetWidth() ) / 2, + rButton.Top() + ( rButton.GetHeight() - rArrow.GetHeight() ) / 2 + ) ); +} + +Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect ) +{ + gint slider_width; + gint stepper_size; + gint stepper_spacing; + gint trough_border; - if ( nVCLState & CTRL_STATE_ENABLED ) + // Grab some button style attributes + gtk_style_context_get_style( mpScrollbarStyle, + "slider-width", &slider_width, + "stepper-size", &stepper_size, + "trough-border", &trough_border, + "stepper-spacing", &stepper_spacing, (char *)NULL ); + + gboolean has_forward; + gboolean has_forward2; + gboolean has_backward; + gboolean has_backward2; + + gtk_style_context_get_style( mpScrollbarStyle, + "has-forward-stepper", &has_forward, + "has-secondary-forward-stepper", &has_forward2, + "has-backward-stepper", &has_backward, + "has-secondary-backward-stepper", &has_backward2, (char *)NULL ); + gint buttonWidth; + gint buttonHeight; + Rectangle buttonRect; + + gint nFirst = 0; + gint nSecond = 0; + + if ( has_forward ) nSecond += 1; + if ( has_forward2 ) nFirst += 1; + if ( has_backward ) nFirst += 1; + if ( has_backward2 ) nSecond += 1; + + if ( ( nPart == PART_BUTTON_UP ) || ( nPart == PART_BUTTON_DOWN ) ) + { + buttonWidth = slider_width + 2 * trough_border; + buttonHeight = stepper_size + trough_border + stepper_spacing; + } + else + { + buttonWidth = stepper_size + trough_border + stepper_spacing; + buttonHeight = slider_width + 2 * trough_border; + } + + if ( nPart == PART_BUTTON_UP ) + { + buttonHeight *= nFirst; + buttonHeight -= 1; + buttonRect.setX( aAreaRect.Left() ); + buttonRect.setY( aAreaRect.Top() ); + } + else if ( nPart == PART_BUTTON_LEFT ) + { + buttonWidth *= nFirst; + buttonWidth -= 1; + buttonRect.setX( aAreaRect.Left() ); + buttonRect.setY( aAreaRect.Top() ); + } + else if ( nPart == PART_BUTTON_DOWN ) + { + buttonHeight *= nSecond; + buttonRect.setX( aAreaRect.Left() ); + buttonRect.setY( aAreaRect.Top() + aAreaRect.GetHeight() - buttonHeight ); + } + else if ( nPart == PART_BUTTON_RIGHT ) { - if ( nVCLState & CTRL_STATE_PRESSED ) + buttonWidth *= nSecond; + buttonRect.setX( aAreaRect.Left() + aAreaRect.GetWidth() - buttonWidth ); + buttonRect.setY( aAreaRect.Top() ); + } + + buttonRect.SetSize( Size( buttonWidth, buttonHeight ) ); + + return( buttonRect ); +} + +void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context, + cairo_t *cr, + const Rectangle& rControlRectangle, + ControlPart nPart, + const ImplControlValue& aValue ) +{ + OSL_ASSERT( aValue.getType() == CTRL_SCROLLBAR ); + const ScrollbarValue* pScrollbarVal = static_cast<const ScrollbarValue *>(&aValue); + Rectangle scrollbarRect; + GtkStateFlags stateFlags; + GtkShadowType shadowType; + GtkOrientation scrollbarOrientation; + Rectangle thumbRect = pScrollbarVal->maThumbRect; + Rectangle button11BoundRect = pScrollbarVal->maButton1Rect; // backward + Rectangle button22BoundRect = pScrollbarVal->maButton2Rect; // forward + Rectangle button12BoundRect = pScrollbarVal->maButton1Rect; // secondary forward + Rectangle button21BoundRect = pScrollbarVal->maButton2Rect; // secondary backward + gdouble arrow1Angle; // backward + gdouble arrow2Angle; // forward + Rectangle arrowRect; + gint slider_width = 0; + gint stepper_size = 0; + gint stepper_spacing = 0; + gint trough_border = 0; + gint min_slider_length = 0; + gint vShim = 0; + gint hShim = 0; + gint x,y,w,h; + + // make controlvalue rectangles relative to area + thumbRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() ); + button11BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() ); + button22BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() ); + button12BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() ); + button21BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() ); + + // Find the overall bounding rect of the control + scrollbarRect = rControlRectangle; + scrollbarRect.SetSize( Size( scrollbarRect.GetWidth() + 1, + scrollbarRect.GetHeight() + 1 ) ); + + if ( (scrollbarRect.GetWidth() <= 1) || (scrollbarRect.GetHeight() <= 1) ) + return; + + // Grab some button style attributes + gtk_style_context_get_style( mpScrollbarStyle, + "slider_width", &slider_width, + "stepper_size", &stepper_size, + "trough_border", &trough_border, + "stepper_spacing", &stepper_spacing, + "min_slider_length", &min_slider_length, (char *)NULL ); + gboolean has_forward; + gboolean has_forward2; + gboolean has_backward; + gboolean has_backward2; + + gtk_style_context_get_style( mpScrollbarStyle, + "has-forward-stepper", &has_forward, + "has-secondary-forward-stepper", &has_forward2, + "has-backward-stepper", &has_backward, + "has-secondary-backward-stepper", &has_backward2, (char *)NULL ); + gint magic = trough_border ? 1 : 0; + gint nFirst = 0; + + if ( has_backward ) nFirst += 1; + if ( has_forward2 ) nFirst += 1; + + if ( nPart == PART_DRAW_BACKGROUND_HORZ ) + { + unsigned int sliderHeight = slider_width + (trough_border * 2); + vShim = (scrollbarRect.GetHeight() - sliderHeight) / 2; + + scrollbarRect.Move( 0, vShim ); + scrollbarRect.SetSize( Size( scrollbarRect.GetWidth(), sliderHeight ) ); + + scrollbarOrientation = GTK_ORIENTATION_HORIZONTAL; + arrow1Angle = G_PI * 3 / 2; + arrow2Angle = G_PI / 2; + + if ( has_backward ) { - *nGTKState = GTK_STATE_FLAG_ACTIVE; - *nGTKShadow = GTK_SHADOW_IN; + button12BoundRect.Move( stepper_size - trough_border, + (scrollbarRect.GetHeight() - slider_width) / 2 ); } - else if ( nVCLState & CTRL_STATE_ROLLOVER ) + + button11BoundRect.Move( trough_border, (scrollbarRect.GetHeight() - slider_width) / 2 ); + button11BoundRect.SetSize( Size( stepper_size, slider_width ) ); + button12BoundRect.SetSize( Size( stepper_size, slider_width ) ); + + if ( has_backward2 ) { - *nGTKState = GTK_STATE_FLAG_PRELIGHT; - *nGTKShadow = GTK_SHADOW_OUT; + button22BoundRect.Move( stepper_size+(trough_border+1)/2, (scrollbarRect.GetHeight() - slider_width) / 2 ); + button21BoundRect.Move( (trough_border+1)/2, (scrollbarRect.GetHeight() - slider_width) / 2 ); } else { - *nGTKState = GTK_STATE_FLAG_NORMAL; - *nGTKShadow = GTK_SHADOW_OUT; + button22BoundRect.Move( (trough_border+1)/2, (scrollbarRect.GetHeight() - slider_width) / 2 ); } + + button21BoundRect.SetSize( Size( stepper_size, slider_width ) ); + button22BoundRect.SetSize( Size( stepper_size, slider_width ) ); + + thumbRect.Bottom() = thumbRect.Top() + slider_width - 1; + // Make sure the thumb is at least the default width (so we don't get tiny thumbs), + // but if the VCL gives us a size smaller than the theme's default thumb size, + // honor the VCL size + thumbRect.Right() += magic; + // Center vertically in the track + thumbRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 ); } -} + else + { + unsigned int sliderWidth = slider_width + (trough_border * 2); + hShim = (scrollbarRect.GetWidth() - sliderWidth) / 2; + scrollbarRect.Move( hShim, 0 ); + scrollbarRect.SetSize( Size( sliderWidth, scrollbarRect.GetHeight() ) ); -/** - * Draw a GtkStyleContext in the given area, gtk_render_frame and - * gtk_render_background are called. At the end of the method, the - * cairo surface is drawn in the real winet dow area. - * - * @param style the GtkStyleContext you want to draw - * @param flags the state of the context - * @param rControlRegion the real region you want to draw - * @param render_background wether we must clean the area first or not - * (may be disabled for optimization). - **/ -void GtkSalGraphics::drawStyleContext( GtkStyleContext* style, GtkStateFlags flags, - const Rectangle& rControlRegion, bool render_background ) -{ - /* Set up the cairo context and surface to draw the widgets. */ - cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, - rControlRegion.GetWidth() + 2, /* make it a bit larger because some - * themes doesn't like drawing directly - * on the corners (for blur methods for instance). */ - rControlRegion.GetHeight() + 2); - cairo_t* cr = cairo_create(surface); - cairo_rectangle_t rect; - rect.x = rControlRegion.Left() - 1; - rect.y = rControlRegion.Top() - 1; - rect.height = rControlRegion.GetHeight() + 2; - rect.width = rControlRegion.GetWidth() + 2; - - if(render_background) - gtk_render_background(gtk_widget_get_style_context(mpWindow), - cr, - 0, 0, - rControlRegion.GetWidth() + 2, rControlRegion.GetHeight() + 2); - - else if(style == mpToolButtonStyle) + scrollbarOrientation = GTK_ORIENTATION_VERTICAL; + arrow1Angle = 0; + arrow2Angle = G_PI; + + if ( has_backward ) + { + button12BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, + stepper_size + trough_border ); + } + button11BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, trough_border ); + button11BoundRect.SetSize( Size( slider_width, stepper_size ) ); + button12BoundRect.SetSize( Size( slider_width, stepper_size ) ); + + if ( has_backward2 ) + { + button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, stepper_size+(trough_border+1)/2 ); + button21BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, (trough_border+1)/2 ); + } + else + { + button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, (trough_border+1)/2 ); + } + + button21BoundRect.SetSize( Size( slider_width, stepper_size ) ); + button22BoundRect.SetSize( Size( slider_width, stepper_size ) ); + + thumbRect.Right() = thumbRect.Left() + slider_width - 1; + + thumbRect.Bottom() += magic; + // Center horizontally in the track + thumbRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 ); + } + + sal_Bool has_slider = ( thumbRect.GetWidth() > 0 && thumbRect.GetHeight() > 0 ); + x = y = 0; + + w = scrollbarRect.GetWidth(); + h = scrollbarRect.GetHeight(); + + // ----------------- TROUGH + gtk_render_background(context, cr, x, y, w, h); + + gtk_style_context_save(context); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_TROUGH); + gtk_render_background(context, cr, x, y, + scrollbarRect.GetWidth(), scrollbarRect.GetHeight() ); + gtk_render_frame(context, cr, x, y, + scrollbarRect.GetWidth(), scrollbarRect.GetHeight() ); + + gtk_style_context_restore(context); + + // ----------------- THUMB + if ( has_slider ) { - /* For toolbuttons, we need to re-draw the toolbar. We also need to re-draw - * the window background which is under the toolbar. - * - * FIXME: the width and height of the toolbar are hardcoded, it would be better - * if we could get the size, and the coords of the parent before re-drawing. - */ - gtk_render_background(gtk_widget_get_style_context(mpWindow), - cr, - 1, -2, - rControlRegion.GetWidth(), rControlRegion.GetHeight() + 6); - gtk_render_background(mpToolbarStyle, cr, - 1, -4, - rControlRegion.GetWidth(), rControlRegion.GetHeight() + 8); - } - - gtk_style_context_set_state(style, flags); - - if(!(style == mpCheckButtonStyle)) + NWConvertVCLStateToGTKState( pScrollbarVal->mnThumbState, &stateFlags, &shadowType ); + if ( pScrollbarVal->mnThumbState & CTRL_STATE_PRESSED ) + stateFlags = (GtkStateFlags) (stateFlags | GTK_STATE_PRELIGHT); + + gtk_style_context_save(context); + gtk_style_context_set_state(context, stateFlags); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_SLIDER); + + gtk_render_slider(context, cr, + x+hShim+thumbRect.Left(), y+vShim+thumbRect.Top(), + thumbRect.GetWidth(), thumbRect.GetHeight(), scrollbarOrientation); + + gtk_style_context_restore(context); + } + // ----------------- BUTTON 1 // + if ( has_backward ) { - gtk_render_background(style, cr, - 1, 1, - rControlRegion.GetWidth(), rControlRegion.GetHeight()); - gtk_render_frame(style, cr, - 1, 1, - rControlRegion.GetWidth(), rControlRegion.GetHeight()); + NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateFlags, &shadowType ); + + gtk_style_context_save(context); + gtk_style_context_set_state(context, stateFlags); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON); + + gtk_render_background(context, cr, + x+hShim+button11BoundRect.Left(), y+vShim+button11BoundRect.Top(), + button11BoundRect.GetWidth(), button11BoundRect.GetHeight() ); + gtk_render_frame(context, cr, + x+hShim+button11BoundRect.Left(), y+vShim+button11BoundRect.Top(), + button11BoundRect.GetWidth(), button11BoundRect.GetHeight() ); + + // ----------------- ARROW 1 + NWCalcArrowRect( button11BoundRect, arrowRect ); + gtk_render_arrow(context, cr, + arrow1Angle, + x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), + MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) ); + + gtk_style_context_restore(context); } - else + if ( has_forward2 ) { - gtk_render_check(style, cr, - 1, 1, - rControlRegion.GetWidth(), rControlRegion.GetHeight()); + NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateFlags, &shadowType ); + + gtk_style_context_save(context); + gtk_style_context_set_state(context, stateFlags); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON); + + gtk_render_background(context, cr, + x+hShim+button12BoundRect.Left(), y+vShim+button12BoundRect.Top(), + button12BoundRect.GetWidth(), button12BoundRect.GetHeight() ); + gtk_render_frame(context, cr, + x+hShim+button12BoundRect.Left(), y+vShim+button12BoundRect.Top(), + button12BoundRect.GetWidth(), button12BoundRect.GetHeight() ); + + // ----------------- ARROW 1 + NWCalcArrowRect( button12BoundRect, arrowRect ); + gtk_render_arrow(context, cr, + arrow2Angle, + x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), + MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) ); + + gtk_style_context_restore(context); + } + // ----------------- BUTTON 2 + if ( has_backward2 ) + { + NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateFlags, &shadowType ); + + gtk_style_context_save(context); + gtk_style_context_set_state(context, stateFlags); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON); + + gtk_render_background(context, cr, + x+hShim+button21BoundRect.Left(), y+vShim+button21BoundRect.Top(), + button21BoundRect.GetWidth(), button21BoundRect.GetHeight() ); + gtk_render_frame(context, cr, + x+hShim+button21BoundRect.Left(), y+vShim+button21BoundRect.Top(), + button21BoundRect.GetWidth(), button21BoundRect.GetHeight() ); + + // ----------------- ARROW 2 + NWCalcArrowRect( button21BoundRect, arrowRect ); + gtk_render_arrow(context, cr, + arrow1Angle, + x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), + MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) ); + + gtk_style_context_restore(context); + } + if ( has_forward ) + { + NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateFlags, &shadowType ); + + gtk_style_context_save(context); + gtk_style_context_set_state(context, stateFlags); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_BUTTON); + + gtk_render_background(context, cr, + x+hShim+button22BoundRect.Left(), y+vShim+button22BoundRect.Top(), + button22BoundRect.GetWidth(), button22BoundRect.GetHeight() ); + gtk_render_frame(context, cr, + x+hShim+button22BoundRect.Left(), y+vShim+button22BoundRect.Top(), + button22BoundRect.GetWidth(), button22BoundRect.GetHeight() ); + + // ----------------- ARROW 2 + NWCalcArrowRect( button22BoundRect, arrowRect ); + gtk_render_arrow(context, cr, + arrow2Angle, + x+hShim+arrowRect.Left(), y+vShim+arrowRect.Top(), + MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) ); + + gtk_style_context_restore(context); } - - renderAreaToPix(cr, &rect); - cairo_destroy(cr); } sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, @@ -149,58 +467,191 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart { GtkStateFlags flags; GtkShadowType shadow; + gint renderType = RENDER_BACKGROUND_AND_FRAME; + GtkStyleContext *context = NULL; + GtkStyleContext *additionalContext = NULL; + bool renderWindowBackground = true; + const gchar *styleClass = NULL; + NWConvertVCLStateToGTKState(nState, &flags, &shadow); + printf("Draw native for Type: %d, Part %d\n", nType, nPart); + switch(nType) { case CTRL_EDITBOX: - drawStyleContext(mpEntryStyle, flags, rControlRegion); - return sal_True; + context = mpEntryStyle; + break; + case CTRL_MENU_POPUP: + /* FIXME: missing ENTIRE_CONTROL, as it doesn't seem to work */ + switch(nPart) + { + case PART_MENU_ITEM_CHECK_MARK: + styleClass = GTK_STYLE_CLASS_CHECK; + context = mpMenuItemStyle; + renderType = RENDER_CHECK; + renderWindowBackground = false; + break; + case PART_MENU_ITEM_RADIO_MARK: + styleClass = GTK_STYLE_CLASS_RADIO; + context = mpMenuItemStyle; + renderType = RENDER_RADIO; + renderWindowBackground = false; + break; + case PART_MENU_SEPARATOR: + styleClass = GTK_STYLE_CLASS_SEPARATOR; + context = mpMenuItemStyle; + renderType = RENDER_LINE; + additionalContext = mpMenuStyle; + break; + case PART_MENU_SUBMENU_ARROW: + context = mpMenuStyle; + renderType = RENDER_ARROW; + additionalContext = mpMenuStyle; + break; + } + break; case CTRL_TOOLBAR: switch(nPart) { case PART_DRAW_BACKGROUND_HORZ: - drawStyleContext(mpToolbarStyle, flags, rControlRegion); - return sal_True; + context = mpToolbarStyle; + break; case PART_BUTTON: /* For all checkbuttons in the toolbars */ flags = (GtkStateFlags)(flags | ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL)); - drawStyleContext(mpToolButtonStyle, flags, rControlRegion, false); - return sal_True; + context = mpToolButtonStyle; + additionalContext = mpToolbarStyle; + break; + default: + return sal_False; } break; case CTRL_CHECKBOX: - flags = (GtkStateFlags)(flags | ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL)); - drawStyleContext(mpCheckButtonStyle, flags, rControlRegion); - return sal_True; + flags = (GtkStateFlags)(flags | + ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL)); + context = mpCheckButtonStyle; + styleClass = GTK_STYLE_CLASS_CHECK; + renderType = RENDER_CHECK; + renderWindowBackground = false; + break; + case CTRL_RADIOBUTTON: + flags = (GtkStateFlags)(flags | + ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL)); + context = mpCheckButtonStyle; + styleClass = GTK_STYLE_CLASS_RADIO; + renderType = RENDER_RADIO; + renderWindowBackground = false; + break; case CTRL_PUSHBUTTON: - drawStyleContext(mpButtonStyle, flags, rControlRegion); - return sal_True; + context = mpButtonStyle; + break; case CTRL_SCROLLBAR: - drawStyleContext(mpScrollbarStyle, flags, rControlRegion); - return sal_True; + switch(nPart) + { + case PART_DRAW_BACKGROUND_VERT: + case PART_DRAW_BACKGROUND_HORZ: + context = mpScrollbarStyle; + renderType = RENDER_SCROLLBAR; + renderWindowBackground = false; + break; + } + break; + default: + return sal_False; } - return sal_False; + + cairo_rectangle_int_t translatedRegion = { (int) rControlRegion.Left() - 1, (int) rControlRegion.Top() - 1, + (int) rControlRegion.GetWidth() + 2, (int) rControlRegion.GetHeight() + 2 }; + cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, + translatedRegion.width, translatedRegion.height); + cairo_t *cr = cairo_create(surface); + cairo_surface_destroy(surface); + + if (!additionalContext && renderWindowBackground) + additionalContext = gtk_widget_get_style_context(mpWindow); + + if (additionalContext) + { + gtk_style_context_save(additionalContext); + gtk_style_context_set_state(additionalContext, flags); + + gtk_render_background(additionalContext, cr, + 0, 0, + translatedRegion.width, translatedRegion.height); + + gtk_style_context_restore(additionalContext); + } + + gtk_style_context_save(context); + gtk_style_context_set_state(context, flags); + if (styleClass) + gtk_style_context_add_class(context, styleClass); + + switch(renderType) + { + case RENDER_BACKGROUND: + case RENDER_BACKGROUND_AND_FRAME: + gtk_render_background(context, cr, + 1, 1, + rControlRegion.GetWidth(), rControlRegion.GetHeight()); + if (renderType == RENDER_BACKGROUND_AND_FRAME) + gtk_render_frame(context, cr, + 1, 1, + rControlRegion.GetWidth(), rControlRegion.GetHeight()); + break; + case RENDER_CHECK: + gtk_render_check(context, cr, + 1, 1, + rControlRegion.GetWidth(), rControlRegion.GetHeight()); + break; + case RENDER_RADIO: + gtk_render_option(context, cr, + 1, 1, + rControlRegion.GetWidth(), rControlRegion.GetHeight()); + break; + case RENDER_LINE: + gtk_render_line(context, cr, + 4, 1 + rControlRegion.GetHeight() / 2, + rControlRegion.GetWidth() - 6, 1 + rControlRegion.GetHeight() / 2); + break; + case RENDER_ARROW: + gtk_render_arrow(context, cr, + G_PI / 2, 1, 1, + MIN(rControlRegion.GetWidth(), 1 + rControlRegion.GetHeight())); + break; + case RENDER_SCROLLBAR: + PaintScrollbar(context, cr, rControlRegion, nPart, aValue); + break; + default: + break; + } + + gtk_style_context_restore(context); + + renderAreaToPix(cr, &translatedRegion); + cairo_destroy(cr); + + return sal_True; } // FIXME: This is incredibly lame ... but so is cairo's insistance on -exactly- // its own stride - neither more nor less - particularly not more aligned // we like 8byte aligned, it likes 4 - most odd. -void GtkSalGraphics::renderAreaToPix( cairo_t *cr, cairo_rectangle_t *area ) +void GtkSalGraphics::renderAreaToPix( cairo_t *cr, + cairo_rectangle_int_t *region) { if( !mpFrame->m_aFrame.get() ) return; - - basebmp::RawMemorySharedArray data = mpFrame->m_aFrame->getBuffer(); basegfx::B2IVector size = mpFrame->m_aFrame->getSize(); sal_Int32 nStride = mpFrame->m_aFrame->getScanlineStride(); - long ax = area->x; - long ay = area->y; - long awidth = area->width; - long aheight = area->height; + long ax = region->x; + long ay = region->y; + long awidth = region->width; + long aheight = region->height; /* Get tje cairo surface and the data */ cairo_surface_t* surface = cairo_get_target(cr); @@ -208,7 +659,7 @@ void GtkSalGraphics::renderAreaToPix( cairo_t *cr, cairo_rectangle_t *area ) cairo_surface_flush(surface); unsigned char* cairo_data = cairo_image_surface_get_data(surface); g_assert(cairo_data != NULL); - int cairo_stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, area->width); + int cairo_stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, awidth); unsigned char *src = data.get(); src += (int)ay * nStride + (int)ax * 3; @@ -232,40 +683,89 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart { /* TODO: all this funcions needs improvements */ Rectangle aEditRect = rControlRegion; - GtkWidget* widget; - GtkRequisition aReq; - long nHeight; + gint indicator_size, point; + if( nPart == PART_ENTIRE_CONTROL) { switch(nType) { - case CTRL_PUSHBUTTON: - widget = gtk_button_new(); /* FIXME: too slow */ + case CTRL_CHECKBOX: + case CTRL_RADIOBUTTON: + gtk_style_context_get_style( mpCheckButtonStyle, + "indicator-size", &indicator_size, + (char *)NULL ); + + point = MAX(0, rControlRegion.GetHeight() - indicator_size); + aEditRect = Rectangle( Point( 0, point / 2), + Size( indicator_size, indicator_size ) ); + break; + default: + return sal_False; + } + } + else if( (nPart == PART_MENU_ITEM_CHECK_MARK) || + (nPart == PART_MENU_ITEM_RADIO_MARK) ) { + switch (nType) + { + case CTRL_MENU_POPUP: + indicator_size = 0; + + gtk_style_context_get_style( mpMenuItemStyle, + "indicator-size", &indicator_size, + (char *)NULL ); + + point = MAX(0, rControlRegion.GetHeight() - indicator_size); + aEditRect = Rectangle( Point( 0, point / 2), + Size( indicator_size, indicator_size ) ); + } + } + else if (nPart == PART_MENU_SEPARATOR) + { + switch (nType) + { + case CTRL_MENU_POPUP: + gint separator_height, separator_width, wide_separators; + + gtk_style_context_get_style (mpMenuItemStyle, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + "separator-height", &separator_height, + NULL); - gtk_widget_size_request( widget, &aReq ); - nHeight = MAX(aEditRect.GetHeight(), aReq.height+1); aEditRect = Rectangle( aEditRect.TopLeft(), - Size( aEditRect.GetWidth(), nHeight ) ); - rNativeBoundingRegion = aEditRect; - rNativeContentRegion = rNativeBoundingRegion; - gtk_widget_destroy(widget); - return sal_True; - case CTRL_EDITBOX: - widget = gtk_entry_new(); /* FIXME: too slow, must be cached */ - - gtk_widget_size_request( widget, &aReq ); - nHeight = MAX(aEditRect.GetHeight(), aReq.height+1); + Size( aEditRect.GetWidth(), wide_separators ? separator_height : 1 ) ); + } + } + else if (nPart == PART_MENU_SUBMENU_ARROW) + { + switch (nType) + { + case CTRL_MENU_POPUP: + gfloat arrow_scaling, arrow_size; + + arrow_scaling = 0; + gtk_style_context_get_style (mpMenuStyle, + "arrow-scaling", &arrow_scaling, + NULL); + + arrow_size = 11 * arrow_scaling; aEditRect = Rectangle( aEditRect.TopLeft(), - Size( aEditRect.GetWidth(), nHeight ) ); - rNativeBoundingRegion = aEditRect; - rNativeContentRegion = rNativeBoundingRegion; - gtk_widget_destroy(widget); - return sal_True; - default: - return sal_False; + Size( arrow_size, arrow_size ) ); } } - return sal_False; + else if ( (nType==CTRL_SCROLLBAR) && + ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) || + (nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ) ) + { + aEditRect = NWGetScrollButtonRect( nPart, rControlRegion ); + } else { + return sal_False; + } + + rNativeBoundingRegion = aEditRect; + rNativeContentRegion = rNativeBoundingRegion; + + return sal_True; } /************************************************************************ * helper for GtkSalFrame @@ -275,12 +775,18 @@ static inline ::Color getColor( const GdkRGBA& rCol ) return ::Color( (int)(rCol.red * 0xFFFF) >> 8, (int)(rCol.green * 0xFFFF) >> 8, (int)(rCol.blue * 0xFFFF) >> 8 ); } +static inline ::Color getColorFromColor( const GdkColor& rCol ) +{ + return ::Color( rCol.red >> 8, rCol.green >> 8, rCol.blue >> 8 ); +} + void GtkSalGraphics::updateSettings( AllSettings& rSettings ) { GdkScreen* pScreen = gtk_widget_get_screen( mpWindow ); GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow ); GtkSettings* pSettings = gtk_widget_get_settings( mpWindow ); StyleSettings aStyleSet = rSettings.GetStyleSettings(); + GdkRGBA color; // text colors GdkRGBA text_color; @@ -294,17 +800,20 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetInfoTextColor( aTextColor ); aStyleSet.SetWindowTextColor( aTextColor ); aStyleSet.SetFieldTextColor( aTextColor ); + + // mouse over text colors + gtk_style_context_get_color(pStyle, GTK_STATE_FLAG_PRELIGHT, &text_color); + aTextColor = getColor( text_color ); + aStyleSet.SetButtonRolloverTextColor( aTextColor ); + aStyleSet.SetFieldRolloverTextColor( aTextColor ); + #if 0 // Tooltip colors GtkStyle* pTooltipStyle = gtk_widget_get_style( gWidgetData[m_nScreen].gTooltipPopup ); aTextColor = getColor( pTooltipStyle->fg[ GTK_STATE_NORMAL ] ); aStyleSet.SetHelpTextColor( aTextColor ); - - // mouse over text colors - aTextColor = getColor( pStyle->fg[ GTK_STATE_PRELIGHT ] ); - aStyleSet.SetButtonRolloverTextColor( aTextColor ); - aStyleSet.SetFieldRolloverTextColor( aTextColor ); #endif + // background colors GdkRGBA background_color; gtk_style_context_get_background_color(pStyle, GTK_STATE_FLAG_NORMAL, &background_color); @@ -325,39 +834,29 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetHighlightColor( aHighlightColor ); aStyleSet.SetHighlightTextColor( aHighlightTextColor ); -#if 0 - // hyperlink colors - gtk_widget_style_get (m_pWindow, "link-color", &text_color, NULL); - aStyleSet.SetLinkColor(getColor(*text_color)); - gtk_widget_style_get (m_pWindow, "visited-link-color", &link_color, NULL); - aStyleSet.SetVisitedLinkColor(getColor(*link_color)); -#endif -#if 0 - - // Tab colors - aStyleSet.SetActiveTabColor( aBackFieldColor ); // same as the window color. - Color aSelectedBackColor = getColor( pStyle->bg[GTK_STATE_ACTIVE] ); - aStyleSet.SetInactiveTabColor( aSelectedBackColor ); - // menu disabled entries handling aStyleSet.SetSkipDisabledInMenus( sal_True ); aStyleSet.SetAcceleratorsInContextMenus( sal_False ); + // menu colors - GtkStyle* pMenuStyle = gtk_widget_get_style( gWidgetData[m_nScreen].gMenuWidget ); - GtkStyle* pMenuItemStyle = gtk_rc_get_style( gWidgetData[m_nScreen].gMenuItemMenuWidget ); - GtkStyle* pMenubarStyle = gtk_rc_get_style( gWidgetData[m_nScreen].gMenubarWidget ); - GtkStyle* pMenuTextStyle = gtk_rc_get_style( gtk_bin_get_child( GTK_BIN(gWidgetData[m_nScreen].gMenuItemMenuWidget) ) ); + gtk_style_context_get_background_color( mpMenuStyle, GTK_STATE_FLAG_NORMAL, &background_color ); + aBackColor = getColor( background_color ); + aStyleSet.SetMenuColor( aBackColor ); - aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] ); + // menu bar + gtk_style_context_get_background_color( mpMenuBarStyle, GTK_STATE_FLAG_NORMAL, &background_color ); + aBackColor = getColor( background_color ); aStyleSet.SetMenuBarColor( aBackColor ); - aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] ); - aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] ); - aStyleSet.SetMenuColor( aBackColor ); - aStyleSet.SetMenuTextColor( aTextColor ); - aTextColor = getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] ); + gtk_style_context_get_color( mpMenuBarStyle, GTK_STATE_FLAG_NORMAL, &text_color ); + aTextColor = getColor( text_color ); aStyleSet.SetMenuBarTextColor( aTextColor ); + // menu items + gtk_style_context_get_color( mpMenuItemStyle, GTK_STATE_FLAG_NORMAL, &color ); + aTextColor = getColor( color ); + aStyleSet.SetMenuTextColor( aTextColor ); + // Awful hack for menu separators in the Sonar and similar themes. // If the menu color is not too dark, and the menu text color is lighter, // make the "light" color lighter than the menu color and the "shadow" @@ -365,20 +864,50 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) if ( aStyleSet.GetMenuColor().GetLuminance() >= 32 && aStyleSet.GetMenuColor().GetLuminance() <= aStyleSet.GetMenuTextColor().GetLuminance() ) { - Color temp = aStyleSet.GetMenuColor(); - temp.IncreaseLuminance( 8 ); - aStyleSet.SetLightColor( temp ); - temp = aStyleSet.GetMenuColor(); - temp.DecreaseLuminance( 16 ); - aStyleSet.SetShadowColor( temp ); + ::Color temp = aStyleSet.GetMenuColor(); + temp.IncreaseLuminance( 8 ); + aStyleSet.SetLightColor( temp ); + temp = aStyleSet.GetMenuColor(); + temp.DecreaseLuminance( 16 ); + aStyleSet.SetShadowColor( temp ); } - aHighlightColor = getColor( pMenuItemStyle->bg[ GTK_STATE_SELECTED ] ); - aHighlightTextColor = getColor( pMenuTextStyle->fg[ GTK_STATE_PRELIGHT ] ); + gtk_style_context_get_background_color( mpMenuItemStyle, GTK_STATE_FLAG_PRELIGHT, &background_color ); + aHighlightColor = getColor( background_color ); + + gtk_style_context_get_color( mpMenuItemStyle, GTK_STATE_FLAG_PRELIGHT, &color ); + aHighlightTextColor = getColor( color ); if( aHighlightColor == aHighlightTextColor ) - aHighlightTextColor = (aHighlightColor.GetLuminance() < 128) ? Color( COL_WHITE ) : Color( COL_BLACK ); + aHighlightTextColor = (aHighlightColor.GetLuminance() < 128) ? ::Color( COL_WHITE ) : ::Color( COL_BLACK ); aStyleSet.SetMenuHighlightColor( aHighlightColor ); aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor ); + + // hyperlink colors + GdkColor *link_color = NULL; + gtk_style_context_get_style(pStyle, + "link-color", &link_color, + NULL); + if (link_color) { + aStyleSet.SetLinkColor(getColorFromColor(*link_color)); + gdk_color_free(link_color); + } + + link_color = NULL; + gtk_style_context_get_style(pStyle, + "visited-link-color", &link_color, + NULL); + if (link_color) { + aStyleSet.SetVisitedLinkColor(getColorFromColor(*link_color)); + gdk_color_free(link_color); + } + +#if 0 + + // Tab colors + aStyleSet.SetActiveTabColor( aBackFieldColor ); // same as the window color. + Color aSelectedBackColor = getColor( pStyle->bg[GTK_STATE_ACTIVE] ); + aStyleSet.SetInactiveTabColor( aSelectedBackColor ); + #endif // UI font const PangoFontDescription* font = gtk_style_context_get_font(pStyle, GTK_STATE_FLAG_NORMAL); @@ -501,22 +1030,21 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) gboolean showmenuicons = true; g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL ); aStyleSet.SetPreferredUseImagesInMenus( showmenuicons ); -#if 0 + // set scrollbar settings gint slider_width = 14; gint trough_border = 1; gint min_slider_length = 21; // Grab some button style attributes - gtk_widget_style_get( gWidgetData[m_nScreen].gScrollHorizWidget, - "slider-width", &slider_width, - "trough-border", &trough_border, - "min-slider-length", &min_slider_length, - (char *)NULL ); + gtk_style_context_get_style( mpScrollbarStyle, + "slider-width", &slider_width, + "trough-border", &trough_border, + "min-slider-length", &min_slider_length, + (char *)NULL ); gint magic = trough_border ? 1 : 0; aStyleSet.SetScrollBarSize( slider_width + 2*trough_border ); aStyleSet.SetMinThumbSize( min_slider_length - magic ); -#endif // preferred icon style gchar* pIconThemeName = NULL; @@ -545,14 +1073,26 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { - if( (nType == CTRL_PUSHBUTTON && nPart == PART_ENTIRE_CONTROL) - || (nType == CTRL_CHECKBOX && nPart == PART_ENTIRE_CONTROL) - || nType == CTRL_SCROLLBAR - || nType == CTRL_EDITBOX - || (nType == CTRL_TOOLBAR && nPart == PART_ENTIRE_CONTROL) - || (nType == CTRL_TOOLBAR && nPart == PART_BUTTON)/*|| - segfault with recent code, needs investigating nType == CTRL_TOOLBAR*/ ) + if( + (nType == CTRL_PUSHBUTTON && nPart == PART_ENTIRE_CONTROL) || + (nType == CTRL_CHECKBOX && nPart == PART_ENTIRE_CONTROL) || + (nType == CTRL_RADIOBUTTON && nPart == PART_ENTIRE_CONTROL) || + ((nType==CTRL_SCROLLBAR) && + ( (nPart==PART_DRAW_BACKGROUND_HORZ) + || (nPart==PART_DRAW_BACKGROUND_VERT) + || (nPart==PART_ENTIRE_CONTROL) + || (nPart==HAS_THREE_BUTTONS))) || + (nType == CTRL_EDITBOX) || + (nType == CTRL_MENU_POPUP && + (nPart == PART_MENU_ITEM_CHECK_MARK || + nPart == PART_MENU_ITEM_RADIO_MARK || + nPart == PART_MENU_SEPARATOR || + nPart == PART_MENU_SUBMENU_ARROW)) || + (nType == CTRL_TOOLBAR && + (nPart == PART_BUTTON || + nPart == PART_ENTIRE_CONTROL))) return sal_True; + return sal_False; } @@ -571,40 +1111,67 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) mpFrame( pFrame ), mpWindow( pWindow ) { - if(style_loaded) return; + + GtkWidgetPath* path; + style_loaded = true; gtk_init(NULL, NULL); /* Load the GtkStyleContexts, it might be a bit slow, but usually, * gtk apps create a lot of widgets at startup, so, it shouldn't be * too slow */ - GtkWidget* toolbar = gtk_toolbar_new(); - GtkWidget* toolbutton = gtk_button_new(); getStyleContext(&mpEntryStyle, gtk_entry_new()); getStyleContext(&mpButtonStyle, gtk_button_new()); - getStyleContext(&mpToolbarStyle, toolbar); - - gtk_style_context_add_class(mpToolbarStyle, "primary-toolbar"); - gtk_style_context_add_class(mpToolbarStyle, "toolbar"); - getStyleContext(&mpToolButtonStyle, GTK_WIDGET(toolbutton)); + + getStyleContext(&mpToolbarStyle, gtk_toolbar_new()); + gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); + gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_TOOLBAR); + + getStyleContext(&mpToolButtonStyle, gtk_button_new()); /* Create a widget path for our toolbutton widget */ - GtkWidgetPath* path = gtk_widget_path_new (); + path = gtk_widget_path_new(); gtk_widget_path_append_type(path, GTK_TYPE_TOOLBAR); gtk_widget_path_append_type(path, GTK_TYPE_TOOL_BUTTON); gtk_widget_path_append_type(path, GTK_TYPE_BUTTON); - - gtk_widget_path_iter_add_class (path, 0, "primary-toolbar"); - gtk_widget_path_iter_add_class (path, 0, "toolbar"); - gtk_widget_path_iter_add_class (path, 2, "button"); + gtk_widget_path_iter_add_class (path, 0, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); + gtk_widget_path_iter_add_class (path, 0, GTK_STYLE_CLASS_TOOLBAR); + gtk_widget_path_iter_add_class (path, 2, GTK_STYLE_CLASS_BUTTON); gtk_style_context_set_path(mpToolButtonStyle, path); + gtk_widget_path_free (path); getStyleContext(&mpScrollbarStyle, gtk_vscrollbar_new(NULL)); + gtk_style_context_add_class(mpScrollbarStyle, GTK_STYLE_CLASS_SCROLLBAR); + getStyleContext(&mpCheckButtonStyle, gtk_check_button_new()); - gtk_style_context_add_class(mpCheckButtonStyle, "check"); -} + /* Menu */ + getStyleContext(&mpMenuStyle, gtk_menu_new()); + + /* Menu Items */ + path = gtk_widget_path_new(); + gtk_widget_path_append_type(path, GTK_TYPE_MENU); + gtk_widget_path_append_type(path, GTK_TYPE_CHECK_MENU_ITEM); + gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_MENU); + gtk_widget_path_iter_add_class(path, 1, GTK_STYLE_CLASS_MENUITEM); + mpMenuItemStyle = gtk_style_context_new(); + gtk_style_context_set_path(mpMenuItemStyle, path); + gtk_widget_path_free(path); + + /* Menu bar */ + getStyleContext(&mpMenuBarStyle, gtk_menu_bar_new()); + + /* Menu items in a menu bar */ + path = gtk_widget_path_new(); + gtk_widget_path_append_type(path, GTK_TYPE_MENU_BAR); + gtk_widget_path_append_type(path, GTK_TYPE_MENU_ITEM); + gtk_widget_path_iter_add_class(path, 0, GTK_STYLE_CLASS_MENUBAR); + gtk_widget_path_iter_add_class(path, 1, GTK_STYLE_CLASS_MENUITEM); + mpMenuBarItemStyle = gtk_style_context_new(); + gtk_style_context_set_path(mpMenuBarItemStyle, path); + gtk_widget_path_free(path); +} static void print_cairo_region (cairo_region_t *region, const char *msg) { @@ -662,7 +1229,7 @@ void GtkSalGraphics::copyArea( long nDestX, long nDestY, while( m_aClipRegion.GetNextEnumRect( aHnd, aClipRect ) ) { cairo_rectangle_int_t aRect = { (int)aClipRect.Left(), (int)aClipRect.Top(), - (int)aClipRect.Right(), (int)aClipRect.Bottom() }; + (int)aClipRect.GetWidth(), (int)aClipRect.GetHeight() }; cairo_region_union_rectangle( clip_region, &aRect ); } m_aClipRegion.EndEnumRects (aHnd); diff --git a/wizards/com/sun/star/wizards/common/Resource.java.orig b/wizards/com/sun/star/wizards/common/Resource.java.orig deleted file mode 100644 index c7eb3e483db7..000000000000 --- a/wizards/com/sun/star/wizards/common/Resource.java.orig +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.wizards.common; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XNameAccess; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.script.XInvocation; -import com.sun.star.beans.PropertyValue; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; - -public class Resource -{ - - XMultiServiceFactory xMSF; - String Module; - XIndexAccess xStringIndexAccess; - XIndexAccess xStringListIndexAccess; - - /** Creates a new instance of Resource - * @param _xMSF - * @param _Unit - * @param _Module - */ - public Resource(XMultiServiceFactory _xMSF, String _Unit /* unused */, String _Module) - { - this.xMSF = _xMSF; - this.Module = _Module; - try - { - Object[] aArgs = new Object[1]; - aArgs[0] = this.Module; - XInterface xResource = (XInterface) xMSF.createInstanceWithArguments( - "org.libreoffice.resource.ResourceIndexAccess", - aArgs); - if (xResource == null) - throw new Exception("could not initialize ResourceIndexAccess"); - XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface( - XNameAccess.class, - xResource); - if (xNameAccess == null) - throw new Exception("ResourceIndexAccess is no XNameAccess"); - this.xStringIndexAccess = (XIndexAccess)UnoRuntime.queryInterface( - XIndexAccess.class, - xNameAccess.getByName("String")); - this.xStringListIndexAccess = (XIndexAccess)UnoRuntime.queryInterface( - XIndexAccess.class, - xNameAccess.getByName("StringList")); - if(this.xStringListIndexAccess == null) - throw new Exception("could not initialize xStringListIndexAccess"); - if(this.xStringIndexAccess == null) - throw new Exception("could not initialize xStringIndexAccess"); - } - catch (Exception exception) - { - exception.printStackTrace(); - showCommonResourceError(xMSF); - } - } - - public String getResText(int nID) - { - try - { - return (String)this.xStringIndexAccess.getByIndex(nID); - } - catch (Exception exception) - { - exception.printStackTrace(); - throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found"); - } - } - - public PropertyValue[] getStringList(int nID) - { - try - { - return (PropertyValue[])this.xStringListIndexAccess.getByIndex(nID); - } - catch (Exception exception) - { - exception.printStackTrace(); - throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found"); - } - } - - public String[] getResArray(int nID, int iCount) - { - try - { - String[] ResArray = new String[iCount]; - for (int i = 0; i < iCount; i++) - { - ResArray[i] = getResText(nID + i); - } - return ResArray; - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found"); - } - } - - public static void showCommonResourceError(XMultiServiceFactory xMSF) - { - String ProductName = Configuration.getProductName(xMSF); - String sError = "The files required could not be found.\nPlease start the %PRODUCTNAME Setup and choose 'Repair'."; - sError = JavaTools.replaceSubString(sError, ProductName, "%PRODUCTNAME"); - SystemDialog.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sError); - } -} |