vcl/inc/unx/gtk/gtkgdi.hxx | 17 -- vcl/unx/gtk/app/gtkdata.cxx | 1 vcl/unx/gtk/gdi/gtkprintwrapper.cxx | 21 ++ vcl/unx/gtk/window/gtksalframe.cxx | 5 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 18 +- vcl/unx/kde/UnxCommandThread.cxx | 72 ++++---- vcl/unx/kde/UnxCommandThread.hxx | 1 vcl/unx/kde/UnxFilePicker.cxx | 215 +++++++++++++------------- vcl/unx/kde/UnxFilePicker.hxx | 3 vcl/unx/kde/fpicker/kdecommandthread.cxx | 90 +++++----- vcl/unx/kde/fpicker/kdecommandthread.hxx | 1 vcl/unx/kde/fpicker/kdefilepicker.cxx | 130 ++++++++------- vcl/unx/kde/fpicker/kdefilepicker.hxx | 4 vcl/unx/kde/salnativewidgets-kde.cxx | 76 ++++----- 14 files changed, 344 insertions(+), 310 deletions(-)
New commits: commit 79776356d9597f3c0e06f8e81019909bdbb1a560 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri May 8 11:56:28 2015 +0200 loplugin:staticmethods Change-Id: Ie3629a14c7a15a0f5f93a4bfc663a2bb52a8735d diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 2805ef6..68c6cf7 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -80,36 +80,35 @@ private: static GtkStyleContext *mpListboxStyle; static GtkStyleContext *mpNoteBookStyle; - void getStyleContext(GtkStyleContext** style, GtkWidget* widget); - Rectangle NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect ); - Rectangle NWGetSpinButtonRect( ControlPart nPart, Rectangle aAreaRect); - Rectangle NWGetComboBoxButtonRect( ControlType nType, ControlPart nPart, Rectangle aAreaRect ); + static Rectangle NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect ); + static Rectangle NWGetSpinButtonRect( ControlPart nPart, Rectangle aAreaRect); + static Rectangle NWGetComboBoxButtonRect( ControlType nType, ControlPart nPart, Rectangle aAreaRect ); - void PaintScrollbar(GtkStyleContext *context, + static void PaintScrollbar(GtkStyleContext *context, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, ControlPart nPart, const ImplControlValue& aValue ); - void PaintOneSpinButton( GtkStyleContext *context, + static void PaintOneSpinButton( GtkStyleContext *context, cairo_t *cr, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState ); - void PaintSpinButton(GtkStyleContext *context, + static void PaintSpinButton(GtkStyleContext *context, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, ControlPart nPart, const ImplControlValue& aValue ); - void PaintCombobox( GtkStyleContext *context, + static void PaintCombobox( GtkStyleContext *context, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, ControlPart nPart, const ImplControlValue& aValue ); - void PaintCheckOrRadio(GtkStyleContext *context, + static void PaintCheckOrRadio(GtkStyleContext *context, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType); diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index d1f594f..0d5aea0 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -169,6 +169,7 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, return aFilterReturn; #else + (void) this; // loplugin:staticmethods (void) sys_event; //FIXME: implement filterGdkEvent ... return GDK_FILTER_CONTINUE; diff --git a/vcl/unx/gtk/gdi/gtkprintwrapper.cxx b/vcl/unx/gtk/gdi/gtkprintwrapper.cxx index 809ddae..1db42c8 100644 --- a/vcl/unx/gtk/gdi/gtkprintwrapper.cxx +++ b/vcl/unx/gtk/gdi/gtkprintwrapper.cxx @@ -112,6 +112,7 @@ bool GtkPrintWrapper::supportsPrinting() const && m_print_unix_dialog_set_settings ; #else + (void) this; // loplugin:staticmethods return true; #endif } @@ -125,6 +126,7 @@ bool GtkPrintWrapper::supportsPrintSelection() const && m_print_unix_dialog_set_has_selection ; #else + (void) this; // loplugin:staticmethods return true; #endif } @@ -135,6 +137,7 @@ GtkPageSetup* GtkPrintWrapper::page_setup_new() const assert(m_page_setup_new); return (*m_page_setup_new)(); #else + (void) this; // loplugin:staticmethods return gtk_page_setup_new(); #endif } @@ -145,6 +148,7 @@ GtkPrintJob* GtkPrintWrapper::print_job_new(const gchar* title, GtkPrinter* prin assert(m_print_job_new); return (*m_print_job_new)(title, printer, settings, page_setup); #else + (void) this; // loplugin:staticmethods return gtk_print_job_new(title, printer, settings, page_setup); #endif } @@ -155,6 +159,7 @@ void GtkPrintWrapper::print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc c assert(m_print_job_send); (*m_print_job_send)(job, callback, user_data, dnotify); #else + (void) this; // loplugin:staticmethods gtk_print_job_send(job, callback, user_data, dnotify); #endif } @@ -165,6 +170,7 @@ gboolean GtkPrintWrapper::print_job_set_source_file(GtkPrintJob* job, const gcha assert(m_print_job_set_source_file); return (*m_print_job_set_source_file)(job, filename, error); #else + (void) this; // loplugin:staticmethods return gtk_print_job_set_source_file(job, filename, error); #endif } @@ -175,6 +181,7 @@ const gchar* GtkPrintWrapper::print_settings_get(GtkPrintSettings* settings, con assert(m_print_settings_get); return (*m_print_settings_get)(settings, key); #else + (void) this; // loplugin:staticmethods return gtk_print_settings_get(settings, key); #endif } @@ -185,6 +192,7 @@ gboolean GtkPrintWrapper::print_settings_get_collate(GtkPrintSettings* settings) assert(m_print_settings_get_collate); return (*m_print_settings_get_collate)(settings); #else + (void) this; // loplugin:staticmethods return gtk_print_settings_get_collate(settings); #endif } @@ -195,6 +203,7 @@ void GtkPrintWrapper::print_settings_set_collate(GtkPrintSettings* settings, gbo assert(m_print_settings_set_collate); (*m_print_settings_set_collate)(settings, collate); #else + (void) this; // loplugin:staticmethods gtk_print_settings_set_collate(settings, collate); #endif } @@ -205,6 +214,7 @@ gint GtkPrintWrapper::print_settings_get_n_copies(GtkPrintSettings* settings) co assert(m_print_settings_get_n_copies); return (*m_print_settings_get_n_copies)(settings); #else + (void) this; // loplugin:staticmethods return gtk_print_settings_get_n_copies(settings); #endif } @@ -215,6 +225,7 @@ void GtkPrintWrapper::print_settings_set_n_copies(GtkPrintSettings* settings, gi assert(m_print_settings_set_n_copies); (*m_print_settings_set_n_copies)(settings, num_copies); #else + (void) this; // loplugin:staticmethods gtk_print_settings_set_n_copies(settings, num_copies); #endif } @@ -225,6 +236,7 @@ GtkPageRange* GtkPrintWrapper::print_settings_get_page_ranges(GtkPrintSettings* assert(m_print_settings_get_page_ranges); return (*m_print_settings_get_page_ranges)(settings, num_ranges); #else + (void) this; // loplugin:staticmethods return gtk_print_settings_get_page_ranges(settings, num_ranges); #endif } @@ -235,6 +247,7 @@ void GtkPrintWrapper::print_settings_set_print_pages(GtkPrintSettings* settings, assert(m_print_settings_set_print_pages); (*m_print_settings_set_print_pages)(settings, pages); #else + (void) this; // loplugin:staticmethods gtk_print_settings_set_print_pages(settings, pages); #endif } @@ -245,6 +258,7 @@ GtkWidget* GtkPrintWrapper::print_unix_dialog_new(const gchar* title, GtkWindow* assert(m_print_unix_dialog_new); return (*m_print_unix_dialog_new)(title, parent); #else + (void) this; // loplugin:staticmethods return gtk_print_unix_dialog_new(title, parent); #endif } @@ -255,6 +269,7 @@ void GtkPrintWrapper::print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialo assert(m_print_unix_dialog_add_custom_tab); (*m_print_unix_dialog_add_custom_tab)(dialog, child, tab_label); #else + (void) this; // loplugin:staticmethods gtk_print_unix_dialog_add_custom_tab(dialog, child, tab_label); #endif } @@ -265,6 +280,7 @@ GtkPrinter* GtkPrintWrapper::print_unix_dialog_get_selected_printer(GtkPrintUnix assert(m_print_unix_dialog_get_selected_printer); return (*m_print_unix_dialog_get_selected_printer)(dialog); #else + (void) this; // loplugin:staticmethods return gtk_print_unix_dialog_get_selected_printer(dialog); #endif } @@ -275,6 +291,7 @@ void GtkPrintWrapper::print_unix_dialog_set_manual_capabilities(GtkPrintUnixDial assert(m_print_unix_dialog_set_manual_capabilities); (*m_print_unix_dialog_set_manual_capabilities)(dialog, capabilities); #else + (void) this; // loplugin:staticmethods gtk_print_unix_dialog_set_manual_capabilities(dialog, capabilities); #endif } @@ -285,6 +302,7 @@ GtkPrintSettings* GtkPrintWrapper::print_unix_dialog_get_settings(GtkPrintUnixDi assert(m_print_unix_dialog_get_settings); return (*m_print_unix_dialog_get_settings)(dialog); #else + (void) this; // loplugin:staticmethods return gtk_print_unix_dialog_get_settings(dialog); #endif } @@ -295,6 +313,7 @@ void GtkPrintWrapper::print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, assert(m_print_unix_dialog_set_settings); (*m_print_unix_dialog_set_settings)(dialog, settings); #else + (void) this; // loplugin:staticmethods gtk_print_unix_dialog_set_settings(dialog, settings); #endif } @@ -305,6 +324,7 @@ void GtkPrintWrapper::print_unix_dialog_set_support_selection(GtkPrintUnixDialog assert(m_print_unix_dialog_set_support_selection); (*m_print_unix_dialog_set_support_selection)(dialog, support_selection); #else + (void) this; // loplugin:staticmethods gtk_print_unix_dialog_set_support_selection(dialog, support_selection); #endif } @@ -315,6 +335,7 @@ void GtkPrintWrapper::print_unix_dialog_set_has_selection(GtkPrintUnixDialog* di assert(m_print_unix_dialog_set_has_selection); (*m_print_unix_dialog_set_has_selection)(dialog, has_selection); #else + (void) this; // loplugin:staticmethods gtk_print_unix_dialog_set_has_selection(dialog, has_selection); #endif } diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 26825f2..af28a12 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -840,6 +840,8 @@ void GtkSalFrame::EnsureAppMenuWatch() } //ensure_dbus_setup( this ); +#else + (void) this; // loplugin:staticmethods #endif } @@ -1493,6 +1495,7 @@ void GtkSalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode ) False, NoEventMask, &aEvent ); GetGenericData()->ErrorTrapPop(); #else + (void) this; // loplugin:staticmethods (void)i_nTimeCode; //FIXME: no askForXEmbedFocus for gtk3 yet #endif @@ -2782,6 +2785,7 @@ void GtkSalFrame::grabPointer( bool bGrab, bool bOwnerEvents ) } } #else + (void) this; // loplugin:staticmethods (void)bGrab; (void) bOwnerEvents; //FIXME: No GrabPointer implementation for gtk3 ... #endif @@ -2803,6 +2807,7 @@ void GtkSalFrame::grabKeyboard( bool bGrab ) } } #else + (void) this; // loplugin:staticmethods (void)bGrab; //FIXME: No GrabKeyboard implementation for gtk3 ... #endif diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index f8fcb1d..4ea7e9c 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1673,6 +1673,17 @@ void GtkSalGraphics::WidgetQueueDraw() const static GtkWidget* gCacheWindow; static GtkWidget* gDumbContainer; +namespace { + +void getStyleContext(GtkStyleContext** style, GtkWidget* widget) +{ + gtk_container_add(GTK_CONTAINER(gDumbContainer), widget); + *style = gtk_widget_get_style_context(widget); + g_object_ref(*style); +} + +} + void GtkData::initNWF() { ImplSVData* pSVData = ImplGetSVData(); @@ -1688,13 +1699,6 @@ void GtkData::deInitNWF() gtk_widget_destroy(gCacheWindow); } -void GtkSalGraphics::getStyleContext(GtkStyleContext** style, GtkWidget* widget) -{ - gtk_container_add(GTK_CONTAINER(gDumbContainer), widget); - *style = gtk_widget_get_style_context(widget); - g_object_ref(*style); -} - GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) : SvpSalGraphics(), mpFrame( pFrame ), diff --git a/vcl/unx/kde/UnxCommandThread.cxx b/vcl/unx/kde/UnxCommandThread.cxx index 84bc2d8a..46ff51c 100644 --- a/vcl/unx/kde/UnxCommandThread.cxx +++ b/vcl/unx/kde/UnxCommandThread.cxx @@ -29,6 +29,44 @@ using namespace ::com::sun::star; +namespace { + +::std::list< OUString > tokenize( const OUString &rCommand ) +{ + ::std::list< OUString > aList; + OUStringBuffer aBuffer( 1024 ); + + const sal_Unicode *pUnicode = rCommand.getStr(); + const sal_Unicode *pEnd = pUnicode + rCommand.getLength(); + bool bQuoted = false; + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + { + ++pUnicode; + if ( pUnicode != pEnd ) + { + if ( *pUnicode == 'n' ) + aBuffer.appendAscii( "\n", 1 ); + else + aBuffer.append( *pUnicode ); + } + } + else if ( *pUnicode == '"' ) + bQuoted = !bQuoted; + else if ( *pUnicode == ' ' && !bQuoted ) + aList.push_back( aBuffer.makeStringAndClear() ); + else + aBuffer.append( *pUnicode ); + } + aList.push_back( aBuffer.makeStringAndClear() ); + + return aList; +} + +} + // UnxFilePickerCommandThread UnxFilePickerCommandThread::UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD ) @@ -268,38 +306,4 @@ void SAL_CALL UnxFilePickerCommandThread::handleCommand( const OUString &rComman } } -::std::list< OUString > SAL_CALL UnxFilePickerCommandThread::tokenize( const OUString &rCommand ) -{ - ::std::list< OUString > aList; - OUStringBuffer aBuffer( 1024 ); - - const sal_Unicode *pUnicode = rCommand.getStr(); - const sal_Unicode *pEnd = pUnicode + rCommand.getLength(); - bool bQuoted = false; - - for ( ; pUnicode != pEnd; ++pUnicode ) - { - if ( *pUnicode == '\\' ) - { - ++pUnicode; - if ( pUnicode != pEnd ) - { - if ( *pUnicode == 'n' ) - aBuffer.appendAscii( "\n", 1 ); - else - aBuffer.append( *pUnicode ); - } - } - else if ( *pUnicode == '"' ) - bQuoted = !bQuoted; - else if ( *pUnicode == ' ' && !bQuoted ) - aList.push_back( aBuffer.makeStringAndClear() ); - else - aBuffer.append( *pUnicode ); - } - aList.push_back( aBuffer.makeStringAndClear() ); - - return aList; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde/UnxCommandThread.hxx b/vcl/unx/kde/UnxCommandThread.hxx index 413d52a..c2571c5 100644 --- a/vcl/unx/kde/UnxCommandThread.hxx +++ b/vcl/unx/kde/UnxCommandThread.hxx @@ -118,7 +118,6 @@ protected: virtual void SAL_CALL run() SAL_OVERRIDE; virtual void SAL_CALL handleCommand( const OUString &rCommand/*, bool &rQuit*/ ); - ::std::list< OUString > SAL_CALL tokenize( const OUString &rCommand ); }; #endif // INCLUDED_VCL_UNX_KDE_UNXCOMMANDTHREAD_HXX diff --git a/vcl/unx/kde/UnxFilePicker.cxx b/vcl/unx/kde/UnxFilePicker.cxx index a82252e..faeb4e0 100644 --- a/vcl/unx/kde/UnxFilePicker.cxx +++ b/vcl/unx/kde/UnxFilePicker.cxx @@ -76,6 +76,114 @@ namespace #endif // ENABLE_TDE return aRet; } + +void appendEscaped( OUStringBuffer &rBuffer, const OUString &rString ) +{ + const sal_Unicode *pUnicode = rString.getStr(); + const sal_Unicode *pEnd = pUnicode + rString.getLength(); + + rBuffer.appendAscii( "\"" , 1 ); + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + rBuffer.appendAscii( "\\\\", 2 ); + else if ( *pUnicode == '"' ) + rBuffer.appendAscii( "\\\"", 2 ); + else if ( *pUnicode == '\n' ) + rBuffer.appendAscii( "\\n", 2 ); + else + rBuffer.append( *pUnicode ); + } + + rBuffer.appendAscii( "\"", 1 ); +} + +bool controlIdInfo( sal_Int16 nControlId, OUString &rType, sal_Int32 &rTitleId ) +{ + typedef struct { + sal_Int16 nId; + const OUString *pType; + sal_Int32 nTitle; + } ElementToName; + + const OUString aCheckBox( "checkbox" ); + const OUString aControl( "control" ); + const OUString aEdit( "edit" ); + const OUString aLabel( "label" ); + const OUString aListBox( "listbox" ); + const OUString aPushButton( "pushbutton" ); + + const ElementToName *pPtr; + const ElementToName pArray[] = + { + { CommonFilePickerElementIds::PUSHBUTTON_OK, &aPushButton, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::PUSHBUTTON_CANCEL, &aPushButton, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::LISTBOX_FILTER, &aListBox, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::CONTROL_FILEVIEW, &aControl, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::EDIT_FILEURL, &aEdit, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::LISTBOX_FILTER_LABEL, &aLabel, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::EDIT_FILEURL_LABEL, &aLabel, 0/*FIXME?*/ }, + + { ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &aCheckBox, STR_SVT_FILEPICKER_AUTO_EXTENSION }, + { ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, &aCheckBox, STR_SVT_FILEPICKER_PASSWORD }, + { ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, &aCheckBox, STR_SVT_FILEPICKER_FILTER_OPTIONS }, + { ExtendedFilePickerElementIds::CHECKBOX_READONLY, &aCheckBox, STR_SVT_FILEPICKER_READONLY }, + { ExtendedFilePickerElementIds::CHECKBOX_LINK, &aCheckBox, STR_SVT_FILEPICKER_INSERT_AS_LINK }, + { ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, &aCheckBox, STR_SVT_FILEPICKER_SHOW_PREVIEW }, + { ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, &aPushButton, STR_SVT_FILEPICKER_PLAY }, + { ExtendedFilePickerElementIds::LISTBOX_VERSION, &aListBox, STR_SVT_FILEPICKER_VERSION }, + { ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_TEMPLATES }, + { ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, + { ExtendedFilePickerElementIds::CHECKBOX_SELECTION, &aCheckBox, STR_SVT_FILEPICKER_SELECTION }, + { 0, 0, 0 } + }; + + for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlId ); ++pPtr ) + ; + + if ( pPtr->nId == nControlId ) + { + rType = *(pPtr->pType); + rTitleId = pPtr->nTitle; + + return true; + } + + return false; +} + +bool controlActionInfo( sal_Int16 nControlAction, OUString &rType ) +{ + typedef struct { + sal_Int16 nId; + const OUString pType; + } ElementToName; + + const ElementToName *pPtr; + const ElementToName pArray[] = + { + { ControlActions::ADD_ITEM, OUString( "addItem" ) }, + { ControlActions::ADD_ITEMS, OUString( "addItems" ) }, + { ControlActions::DELETE_ITEM, OUString( "deleteItem" ) }, + { ControlActions::DELETE_ITEMS, OUString( "deleteItems" ) }, + { ControlActions::SET_SELECT_ITEM, OUString( "setSelectedItem" ) }, + { ControlActions::GET_ITEMS, OUString( "getItems" ) }, + { ControlActions::GET_SELECTED_ITEM, OUString( "getSelectedItem" ) }, + { ControlActions::GET_SELECTED_ITEM_INDEX, OUString( "getSelectedItemIndex" ) }, + { ControlActions::SET_HELP_URL, OUString( "setHelpURL" ) }, + { ControlActions::GET_HELP_URL, OUString( "getHelpURL" ) }, + { 0, OUString( "noAction" ) } + }; + + for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlAction ); ++pPtr ) + ; + + rType = pPtr->pType; + + return true; +} + } // UnxFilePicker @@ -785,113 +893,6 @@ void UnxFilePicker::sendCommand( const OUString &rCommand, ::osl::Condition &rCo rCondition.wait(); } -void UnxFilePicker::appendEscaped( OUStringBuffer &rBuffer, const OUString &rString ) -{ - const sal_Unicode *pUnicode = rString.getStr(); - const sal_Unicode *pEnd = pUnicode + rString.getLength(); - - rBuffer.appendAscii( "\"" , 1 ); - - for ( ; pUnicode != pEnd; ++pUnicode ) - { - if ( *pUnicode == '\\' ) - rBuffer.appendAscii( "\\\\", 2 ); - else if ( *pUnicode == '"' ) - rBuffer.appendAscii( "\\\"", 2 ); - else if ( *pUnicode == '\n' ) - rBuffer.appendAscii( "\\n", 2 ); - else - rBuffer.append( *pUnicode ); - } - - rBuffer.appendAscii( "\"", 1 ); -} - -bool UnxFilePicker::controlIdInfo( sal_Int16 nControlId, OUString &rType, sal_Int32 &rTitleId ) -{ - typedef struct { - sal_Int16 nId; - const OUString *pType; - sal_Int32 nTitle; - } ElementToName; - - const OUString aCheckBox( "checkbox" ); - const OUString aControl( "control" ); - const OUString aEdit( "edit" ); - const OUString aLabel( "label" ); - const OUString aListBox( "listbox" ); - const OUString aPushButton( "pushbutton" ); - - const ElementToName *pPtr; - const ElementToName pArray[] = - { - { CommonFilePickerElementIds::PUSHBUTTON_OK, &aPushButton, 0/*FIXME?*/ }, - { CommonFilePickerElementIds::PUSHBUTTON_CANCEL, &aPushButton, 0/*FIXME?*/ }, - { CommonFilePickerElementIds::LISTBOX_FILTER, &aListBox, 0/*FIXME?*/ }, - { CommonFilePickerElementIds::CONTROL_FILEVIEW, &aControl, 0/*FIXME?*/ }, - { CommonFilePickerElementIds::EDIT_FILEURL, &aEdit, 0/*FIXME?*/ }, - { CommonFilePickerElementIds::LISTBOX_FILTER_LABEL, &aLabel, 0/*FIXME?*/ }, - { CommonFilePickerElementIds::EDIT_FILEURL_LABEL, &aLabel, 0/*FIXME?*/ }, - - { ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &aCheckBox, STR_SVT_FILEPICKER_AUTO_EXTENSION }, - { ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, &aCheckBox, STR_SVT_FILEPICKER_PASSWORD }, - { ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, &aCheckBox, STR_SVT_FILEPICKER_FILTER_OPTIONS }, - { ExtendedFilePickerElementIds::CHECKBOX_READONLY, &aCheckBox, STR_SVT_FILEPICKER_READONLY }, - { ExtendedFilePickerElementIds::CHECKBOX_LINK, &aCheckBox, STR_SVT_FILEPICKER_INSERT_AS_LINK }, - { ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, &aCheckBox, STR_SVT_FILEPICKER_SHOW_PREVIEW }, - { ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, &aPushButton, STR_SVT_FILEPICKER_PLAY }, - { ExtendedFilePickerElementIds::LISTBOX_VERSION, &aListBox, STR_SVT_FILEPICKER_VERSION }, - { ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_TEMPLATES }, - { ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, - { ExtendedFilePickerElementIds::CHECKBOX_SELECTION, &aCheckBox, STR_SVT_FILEPICKER_SELECTION }, - { 0, 0, 0 } - }; - - for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlId ); ++pPtr ) - ; - - if ( pPtr->nId == nControlId ) - { - rType = *(pPtr->pType); - rTitleId = pPtr->nTitle; - - return true; - } - - return false; -} - -bool UnxFilePicker::controlActionInfo( sal_Int16 nControlAction, OUString &rType ) -{ - typedef struct { - sal_Int16 nId; - const OUString pType; - } ElementToName; - - const ElementToName *pPtr; - const ElementToName pArray[] = - { - { ControlActions::ADD_ITEM, OUString( "addItem" ) }, - { ControlActions::ADD_ITEMS, OUString( "addItems" ) }, - { ControlActions::DELETE_ITEM, OUString( "deleteItem" ) }, - { ControlActions::DELETE_ITEMS, OUString( "deleteItems" ) }, - { ControlActions::SET_SELECT_ITEM, OUString( "setSelectedItem" ) }, - { ControlActions::GET_ITEMS, OUString( "getItems" ) }, - { ControlActions::GET_SELECTED_ITEM, OUString( "getSelectedItem" ) }, - { ControlActions::GET_SELECTED_ITEM_INDEX, OUString( "getSelectedItemIndex" ) }, - { ControlActions::SET_HELP_URL, OUString( "setHelpURL" ) }, - { ControlActions::GET_HELP_URL, OUString( "getHelpURL" ) }, - { 0, OUString( "noAction" ) } - }; - - for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlAction ); ++pPtr ) - ; - - rType = pPtr->pType; - - return true; -} - void UnxFilePicker::sendAppendControlCommand( sal_Int16 nControlId ) { OUString aType; diff --git a/vcl/unx/kde/UnxFilePicker.hxx b/vcl/unx/kde/UnxFilePicker.hxx index d32db2d..edf8be9 100644 --- a/vcl/unx/kde/UnxFilePicker.hxx +++ b/vcl/unx/kde/UnxFilePicker.hxx @@ -158,11 +158,8 @@ protected: void sendCommand( const OUString &rCommand ); // Synchronized sendCommand void sendCommand( const OUString &rCommand, ::osl::Condition &rCondition ); - void appendEscaped( OUStringBuffer &rBuffer, const OUString &rString ); private: - bool controlIdInfo( sal_Int16 nControlId, OUString &rType, sal_Int32 &rTitleId ); - bool controlActionInfo( sal_Int16 nControlId, OUString &rType ); void sendAppendControlCommand( sal_Int16 nControlId ); }; diff --git a/vcl/unx/kde/fpicker/kdecommandthread.cxx b/vcl/unx/kde/fpicker/kdecommandthread.cxx index ea47116..6f44117 100644 --- a/vcl/unx/kde/fpicker/kdecommandthread.cxx +++ b/vcl/unx/kde/fpicker/kdecommandthread.cxx @@ -73,6 +73,53 @@ KDECommandEvent::KDECommandEvent( const QString &qCommand, QStringList *pStringL // CommandThread +namespace { + +QStringList* tokenize( const QString &rString ) +{ + // Commands look like: + // command arg1 arg2 arg3 ... + // Args may be enclosed in '"', if they contain spaces. + + QStringList *pList = new QStringList(); + + QString qBuffer; + qBuffer.reserve( 1024 ); + + const QChar *pUnicode = rString.unicode(); + const QChar *pEnd = pUnicode + rString.length(); + bool bQuoted = false; + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + { + ++pUnicode; + if ( pUnicode != pEnd ) + { + if ( *pUnicode == 'n' ) + qBuffer.append( '\n' ); + else + qBuffer.append( *pUnicode ); + } + } + else if ( *pUnicode == '"' ) + bQuoted = !bQuoted; + else if ( *pUnicode == ' ' && !bQuoted ) + { + pList->push_back( qBuffer ); + qBuffer.setLength( 0 ); + } + else + qBuffer.append( *pUnicode ); + } + pList->push_back( qBuffer ); + + return pList; +} + +} + KDECommandThread::KDECommandThread( QWidget *pObject ) : m_pObject( pObject ) { @@ -134,47 +181,4 @@ void KDECommandThread::handleCommand( const QString &rString, bool &bQuit ) QApplication::postEvent( m_pObject, new KDECommandEvent( qCommand, pTokens ) ); } -QStringList* KDECommandThread::tokenize( const QString &rString ) -{ - // Commands look like: - // command arg1 arg2 arg3 ... - // Args may be enclosed in '"', if they contain spaces. - - QStringList *pList = new QStringList(); - - QString qBuffer; - qBuffer.reserve( 1024 ); - - const QChar *pUnicode = rString.unicode(); - const QChar *pEnd = pUnicode + rString.length(); - bool bQuoted = false; - - for ( ; pUnicode != pEnd; ++pUnicode ) - { - if ( *pUnicode == '\\' ) - { - ++pUnicode; - if ( pUnicode != pEnd ) - { - if ( *pUnicode == 'n' ) - qBuffer.append( '\n' ); - else - qBuffer.append( *pUnicode ); - } - } - else if ( *pUnicode == '"' ) - bQuoted = !bQuoted; - else if ( *pUnicode == ' ' && !bQuoted ) - { - pList->push_back( qBuffer ); - qBuffer.setLength( 0 ); - } - else - qBuffer.append( *pUnicode ); - } - pList->push_back( qBuffer ); - - return pList; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde/fpicker/kdecommandthread.hxx b/vcl/unx/kde/fpicker/kdecommandthread.hxx index 55f45ee..b795b18 100644 --- a/vcl/unx/kde/fpicker/kdecommandthread.hxx +++ b/vcl/unx/kde/fpicker/kdecommandthread.hxx @@ -95,7 +95,6 @@ public: protected: void handleCommand( const QString &rString, bool &bQuit ); - QStringList* tokenize( const QString &rString ); }; #endif // INCLUDED_VCL_UNX_KDE_FPICKER_KDECOMMANDTHREAD_HXX diff --git a/vcl/unx/kde/fpicker/kdefilepicker.cxx b/vcl/unx/kde/fpicker/kdefilepicker.cxx index 6b27ae4..757433a 100644 --- a/vcl/unx/kde/fpicker/kdefilepicker.cxx +++ b/vcl/unx/kde/fpicker/kdefilepicker.cxx @@ -89,6 +89,73 @@ #include <algorithm> #include <iostream> +namespace { + +bool isSupportedProtocol( const QString &rProtocol ) +{ + // TODO Get this information directly from OOo + const char * pOOoProtocols[] = { "", "smb", "ftp", "http", "file", "mailto", + "vnd.sun.star.webdav", "news", "private", "vnd.sun.star.help", + "https", "slot", "macro", "javascript", "imap", "pop3", "data", + "cid", "out", "vnd.sun.star.wfs", "vnd.sun.star.hier", "vim", + ".uno", ".component", "vnd.sun.star.pkg", "ldap", "db", + "vnd.sun.star.cmd", "vnd.sun.star.script", + "telnet", + NULL }; + + for ( const char **pIndex = pOOoProtocols; *pIndex != NULL; ++pIndex ) + { + if ( rProtocol == *pIndex ) + return true; + } + + // TODO gnome-vfs bits here + + return false; +} + +void sendCommand( const QString &rCommand ) +{ +#if OSL_DEBUG_LEVEL > 1 + ::std::cerr << "kdefilepicker sent: " << rCommand.latin1() << ::std::endl; +#endif + + //m_aOutputStream << rCommand << endl; + ::std::cout << rCommand.utf8() << ::std::endl; +} + +void appendEscaped( QString &rBuffer, const QString &rString ) +{ + const QChar *pUnicode = rString.unicode(); + const QChar *pEnd = pUnicode + rString.length(); + + rBuffer.append( '"' ); + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + rBuffer.append( "\\\\" ); + else if ( *pUnicode == '"' ) + rBuffer.append( "\\\"" ); + else if ( *pUnicode == '\n' ) + rBuffer.append( "\\\n" ); + else + rBuffer.append( *pUnicode ); + } + rBuffer.append( '"' ); +} + +QString escapeString( const QString &rString ) +{ + QString qString; + qString.reserve( 2*rString.length() + 2 ); // every char escaped + quotes + + appendEscaped( qString, rString ); + + return qString; +} + +} + // KDEFileDialog KDEFileDialog::KDEFileDialog( const QString &startDir, const QString &filter, @@ -593,29 +660,6 @@ QString KDEFileDialog::addExtension( const QString &rFileName ) const return rFileName + qExtension; } -bool KDEFileDialog::isSupportedProtocol( const QString &rProtocol ) const -{ - // TODO Get this information directly from OOo - const char * pOOoProtocols[] = { "", "smb", "ftp", "http", "file", "mailto", - "vnd.sun.star.webdav", "news", "private", "vnd.sun.star.help", - "https", "slot", "macro", "javascript", "imap", "pop3", "data", - "cid", "out", "vnd.sun.star.wfs", "vnd.sun.star.hier", "vim", - ".uno", ".component", "vnd.sun.star.pkg", "ldap", "db", - "vnd.sun.star.cmd", "vnd.sun.star.script", - "telnet", - NULL }; - - for ( const char **pIndex = pOOoProtocols; *pIndex != NULL; ++pIndex ) - { - if ( rProtocol == *pIndex ) - return true; - } - - // TODO gnome-vfs bits here - - return false; -} - KURL KDEFileDialog::mostLocalURL( const KURL &rURL ) const { #if KDE_IS_VERSION(3,5,0) @@ -686,16 +730,6 @@ void KDEFileDialog::selectionChangedCommand() } } -void KDEFileDialog::sendCommand( const QString &rCommand ) -{ -#if OSL_DEBUG_LEVEL > 1 - ::std::cerr << "kdefilepicker sent: " << rCommand.latin1() << ::std::endl; -#endif - - //m_aOutputStream << rCommand << endl; - ::std::cout << rCommand.utf8() << ::std::endl; -} - void KDEFileDialog::appendURL( QString &rBuffer, const KURL &rURL ) { // From Martin Kretzschmar: @@ -718,36 +752,6 @@ void KDEFileDialog::appendURL( QString &rBuffer, const KURL &rURL ) appendEscaped( rBuffer, qUrlStr ); } -void KDEFileDialog::appendEscaped( QString &rBuffer, const QString &rString ) -{ - const QChar *pUnicode = rString.unicode(); - const QChar *pEnd = pUnicode + rString.length(); - - rBuffer.append( '"' ); - for ( ; pUnicode != pEnd; ++pUnicode ) - { - if ( *pUnicode == '\\' ) - rBuffer.append( "\\\\" ); - else if ( *pUnicode == '"' ) - rBuffer.append( "\\\"" ); - else if ( *pUnicode == '\n' ) - rBuffer.append( "\\\n" ); - else - rBuffer.append( *pUnicode ); - } - rBuffer.append( '"' ); -} - -QString KDEFileDialog::escapeString( const QString &rString ) -{ - QString qString; - qString.reserve( 2*rString.length() + 2 ); // every char escaped + quotes - - appendEscaped( qString, rString ); - - return qString; -} - void KDEFileFilterComboHack::setCurrentFilter( const QString& filter ) { setCurrentText( filter ); diff --git a/vcl/unx/kde/fpicker/kdefilepicker.hxx b/vcl/unx/kde/fpicker/kdefilepicker.hxx index 819d0ec..4392d1e 100644 --- a/vcl/unx/kde/fpicker/kdefilepicker.hxx +++ b/vcl/unx/kde/fpicker/kdefilepicker.hxx @@ -107,7 +107,6 @@ protected: void setIsExecuting( bool bIsExecuting ) { m_bIsExecuting = bIsExecuting; } bool isExecuting() const { return m_bIsExecuting; } - bool isSupportedProtocol( const QString &rProtocol ) const; KURL mostLocalURL( const KURL &rURL ) const; QString localCopy( const QString &rFileName ) const; @@ -125,10 +124,7 @@ protected slots: void selectionChangedCommand(); protected: - void sendCommand( const QString &rCommand ); void appendURL( QString &rBuffer, const KURL &rURL ); - void appendEscaped( QString &rBuffer, const QString &rString ); - QString escapeString( const QString &rString ); }; class KDEFileFilterComboHack : public KFileFilterCombo diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 180e595..627a155 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -79,6 +79,44 @@ using namespace ::com::sun::star; +namespace { + +/** Style conversion function. + + Conversion function between VCL ControlState together with ImplControlValue + and Qt state flags. + + @param nState + State of the widget (default, focused, ...) as defined in Native Widget + Framework. + + @param aValue + Value held by the widget (on, off, ...) +*/ +QStyle::SFlags vclStateValue2SFlags( ControlState nState, + const ImplControlValue& aValue ) +{ + QStyle::SFlags nStyle = + ( (nState & ControlState::DEFAULT)? QStyle::Style_ButtonDefault: QStyle::Style_Default ) | + ( (nState & ControlState::ENABLED)? QStyle::Style_Enabled: QStyle::Style_Default ) | + ( (nState & ControlState::FOCUSED)? QStyle::Style_HasFocus: QStyle::Style_Default ) | + ( (nState & ControlState::PRESSED)? QStyle::Style_Down: QStyle::Style_Raised ) | + ( (nState & ControlState::SELECTED)? QStyle::Style_Selected : QStyle::Style_Default ) | + ( (nState & ControlState::ROLLOVER)? QStyle::Style_MouseOver: QStyle::Style_Default ); + //TODO ( (nState & ControlState::HIDDEN)? QStyle::Style_: QStyle::Style_Default ) | + + switch ( aValue.getTristateVal() ) + { + case BUTTONVALUE_ON: nStyle |= QStyle::Style_On; break; + case BUTTONVALUE_OFF: nStyle |= QStyle::Style_Off; break; + case BUTTONVALUE_MIXED: nStyle |= QStyle::Style_NoChange; break; + default: break; + } + + return nStyle; +} + +} /** Qt implementation of X11Pixmap @@ -417,21 +455,6 @@ class WidgetPainter // TODO other widgets - protected: - /** Style conversion function. - - Conversion function between VCL ControlState together with - ImplControlValue and Qt state flags. - - @param nState - State of the widget (default, focused, ...) as defined in Native - Widget Framework. - - @param aValue - Value held by the widget (on, off, ...) - */ - QStyle::SFlags vclStateValue2SFlags( ControlState nState, const ImplControlValue& aValue ); - public: /** Convert VCL Rectangle to QRect. @@ -1197,29 +1220,6 @@ QProgressBar *WidgetPainter::progressBar( const Rectangle& rControlRegion ) return m_pProgressBar; } -QStyle::SFlags WidgetPainter::vclStateValue2SFlags( ControlState nState, - const ImplControlValue& aValue ) -{ - QStyle::SFlags nStyle = - ( (nState & ControlState::DEFAULT)? QStyle::Style_ButtonDefault: QStyle::Style_Default ) | - ( (nState & ControlState::ENABLED)? QStyle::Style_Enabled: QStyle::Style_Default ) | - ( (nState & ControlState::FOCUSED)? QStyle::Style_HasFocus: QStyle::Style_Default ) | - ( (nState & ControlState::PRESSED)? QStyle::Style_Down: QStyle::Style_Raised ) | - ( (nState & ControlState::SELECTED)? QStyle::Style_Selected : QStyle::Style_Default ) | - ( (nState & ControlState::ROLLOVER)? QStyle::Style_MouseOver: QStyle::Style_Default ); - //TODO ( (nState & ControlState::HIDDEN)? QStyle::Style_: QStyle::Style_Default ) | - - switch ( aValue.getTristateVal() ) - { - case BUTTONVALUE_ON: nStyle |= QStyle::Style_On; break; - case BUTTONVALUE_OFF: nStyle |= QStyle::Style_Off; break; - case BUTTONVALUE_MIXED: nStyle |= QStyle::Style_NoChange; break; - default: break; - } - - return nStyle; -} - QRect WidgetPainter::region2QRect( const Rectangle& rControlRegion ) { return QRect( QPoint( rControlRegion.Left(), rControlRegion.Top() ), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits