[Libreoffice-commits] core.git: fpicker/source

Stephan Bergmann sbergman at redhat.com
Sat May 9 10:48:58 PDT 2015


 fpicker/source/aqua/ControlHelper.hxx |    4 
 fpicker/source/aqua/ControlHelper.mm  |  182 +++++++++++++++++-----------------
 fpicker/source/aqua/FilterHelper.hxx  |    3 
 fpicker/source/aqua/FilterHelper.mm   |   24 ++--
 4 files changed, 105 insertions(+), 108 deletions(-)

New commits:
commit d1b7aa568ac949d55f6512add9c9ec369c3ef1db
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat May 9 19:48:29 2015 +0200

    loplugin:staticmethods
    
    Change-Id: I37053f37f074c49b8bc6fcaa82f66a2e52064cb1

diff --git a/fpicker/source/aqua/ControlHelper.hxx b/fpicker/source/aqua/ControlHelper.hxx
index eae0c02..c564c18 100644
--- a/fpicker/source/aqua/ControlHelper.hxx
+++ b/fpicker/source/aqua/ControlHelper.hxx
@@ -169,14 +169,12 @@ private:
     // private methods
 
     void HandleSetListValue(const NSControl* pControl, const sal_Int16 nControlAction, const uno::Any& rValue);
-    uno::Any HandleGetListValue(const NSControl* pControl, const sal_Int16 nControlAction) const;
 
     void         createControls();
     void         createFilterControl();
     void         createUserPane();
-    NSTextField* createLabelWithString(NSString* label);
 
-    int          getControlElementName(const Class clazz, const int nControlId) const;
+    static int   getControlElementName(const Class clazz, const int nControlId);
     NSControl*   getControl( const sal_Int16 nControlId ) const;
     static int   getVerticalDistance(const NSControl* first, const NSControl* second);
 
diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm
index 80e706f..8e0c294 100644
--- a/fpicker/source/aqua/ControlHelper.mm
+++ b/fpicker/source/aqua/ControlHelper.mm
@@ -40,6 +40,97 @@ using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
 using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
 using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
 
+namespace {
+
+uno::Any HandleGetListValue(const NSControl* pControl, const sal_Int16 nControlAction)
+{
+    DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlAction", nControlAction);
+
+    uno::Any aAny;
+
+    if ([pControl class] != [NSPopUpButton class]) {
+        SAL_INFO("fpicker.aqua","not a popup button");
+        DBG_PRINT_EXIT(CLASS_NAME, __func__);
+        return aAny;
+    }
+
+    NSPopUpButton *pButton = (NSPopUpButton*)pControl;
+    NSMenu *rMenu = [pButton menu];
+    if (nil == rMenu) {
+        SAL_INFO("fpicker.aqua","button has no menu");
+        DBG_PRINT_EXIT(CLASS_NAME, __func__);
+        return aAny;
+    }
+
+    switch (nControlAction)
+    {
+        case ControlActions::GET_ITEMS:
+        {
+            SAL_INFO("fpicker.aqua","GET_ITEMS");
+            uno::Sequence< OUString > aItemList;
+
+            int nItems = [rMenu numberOfItems];
+            if (nItems > 0) {
+                aItemList.realloc(nItems);
+            }
+            for (int i = 0; i < nItems; i++) {
+                NSString* sCFItem = [pButton itemTitleAtIndex:i];
+                if (nil != sCFItem) {
+                    aItemList[i] = [sCFItem OUString];
+                    SAL_INFO("fpicker.aqua","Return value[" << (i - 1) << "]: " << OUStringToOString(aItemList[i - 1], RTL_TEXTENCODING_UTF8).getStr());
+                }
+            }
+
+            aAny <<= aItemList;
+        }
+            break;
+        case ControlActions::GET_SELECTED_ITEM:
+        {
+            SAL_INFO("fpicker.aqua","GET_SELECTED_ITEM");
+            NSString* sCFItem = [pButton titleOfSelectedItem];
+            if (nil != sCFItem) {
+                OUString sString = [sCFItem OUString];
+                SAL_INFO("fpicker.aqua","Return value: " << OUStringToOString(sString, RTL_TEXTENCODING_UTF8).getStr());
+                aAny <<= sString;
+            }
+        }
+            break;
+        case ControlActions::GET_SELECTED_ITEM_INDEX:
+        {
+            SAL_INFO("fpicker.aqua","GET_SELECTED_ITEM_INDEX");
+            sal_Int32 nActive = [pButton indexOfSelectedItem];
+            SAL_INFO("fpicker.aqua","Return value: " << nActive);
+            aAny <<= nActive;
+        }
+            break;
+        default:
+            SAL_INFO("fpicker.aqua","undocumented/unimplemented ControlAction for a list");
+            break;
+    }
+
+    DBG_PRINT_EXIT(CLASS_NAME, __func__);
+
+    return aAny;
+}
+
+NSTextField* createLabelWithString(NSString* labelString) {
+    DBG_PRINT_ENTRY(CLASS_NAME, __func__, "label", labelString);
+
+    NSTextField *textField = [NSTextField new];
+    [textField setEditable:NO];
+    [textField setSelectable:NO];
+    [textField setDrawsBackground:NO];
+    [textField setBordered:NO];
+    SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.9 setTitle
+    [[textField cell] setTitle:labelString];
+    SAL_WNODEPRECATED_DECLARATIONS_POP
+
+    DBG_PRINT_EXIT(CLASS_NAME, __func__);
+    return textField;
+}
+
+}
+
 #pragma mark Constructor / Destructor
 
 // Constructor / Destructor
@@ -551,7 +642,7 @@ case elem: \
     DBG_PRINT_EXIT(CLASS_NAME, __func__, nReturn); \
     return nReturn
 
-int ControlHelper::getControlElementName(const Class aClazz, const int nControlId) const
+int ControlHelper::getControlElementName(const Class aClazz, const int nControlId)
 {
     DBG_PRINT_ENTRY(CLASS_NAME, __func__, "aClazz", [[aClazz description] UTF8String], "controlId", nControlId);
 
@@ -668,79 +759,6 @@ void ControlHelper::HandleSetListValue(const NSControl* pControl, const sal_Int1
     DBG_PRINT_EXIT(CLASS_NAME, __func__);
 }
 
-
-uno::Any ControlHelper::HandleGetListValue(const NSControl* pControl, const sal_Int16 nControlAction) const
-{
-    DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlAction", nControlAction);
-
-    uno::Any aAny;
-
-    if ([pControl class] != [NSPopUpButton class]) {
-        SAL_INFO("fpicker.aqua","not a popup button");
-        DBG_PRINT_EXIT(CLASS_NAME, __func__);
-        return aAny;
-    }
-
-    NSPopUpButton *pButton = (NSPopUpButton*)pControl;
-    NSMenu *rMenu = [pButton menu];
-    if (nil == rMenu) {
-        SAL_INFO("fpicker.aqua","button has no menu");
-        DBG_PRINT_EXIT(CLASS_NAME, __func__);
-        return aAny;
-    }
-
-    switch (nControlAction)
-    {
-        case ControlActions::GET_ITEMS:
-        {
-            SAL_INFO("fpicker.aqua","GET_ITEMS");
-            uno::Sequence< OUString > aItemList;
-
-            int nItems = [rMenu numberOfItems];
-            if (nItems > 0) {
-                aItemList.realloc(nItems);
-            }
-            for (int i = 0; i < nItems; i++) {
-                NSString* sCFItem = [pButton itemTitleAtIndex:i];
-                if (nil != sCFItem) {
-                    aItemList[i] = [sCFItem OUString];
-                    SAL_INFO("fpicker.aqua","Return value[" << (i - 1) << "]: " << OUStringToOString(aItemList[i - 1], RTL_TEXTENCODING_UTF8).getStr());
-                }
-            }
-
-            aAny <<= aItemList;
-        }
-            break;
-        case ControlActions::GET_SELECTED_ITEM:
-        {
-            SAL_INFO("fpicker.aqua","GET_SELECTED_ITEM");
-            NSString* sCFItem = [pButton titleOfSelectedItem];
-            if (nil != sCFItem) {
-                OUString sString = [sCFItem OUString];
-                SAL_INFO("fpicker.aqua","Return value: " << OUStringToOString(sString, RTL_TEXTENCODING_UTF8).getStr());
-                aAny <<= sString;
-            }
-        }
-            break;
-        case ControlActions::GET_SELECTED_ITEM_INDEX:
-        {
-            SAL_INFO("fpicker.aqua","GET_SELECTED_ITEM_INDEX");
-            sal_Int32 nActive = [pButton indexOfSelectedItem];
-            SAL_INFO("fpicker.aqua","Return value: " << nActive);
-            aAny <<= nActive;
-        }
-            break;
-        default:
-            SAL_INFO("fpicker.aqua","undocumented/unimplemented ControlAction for a list");
-            break;
-    }
-
-    DBG_PRINT_EXIT(CLASS_NAME, __func__);
-
-    return aAny;
-}
-
-
 // cf. offapi/com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.idl
 NSControl* ControlHelper::getControl( const sal_Int16 nControlId ) const
 {
@@ -948,22 +966,6 @@ void ControlHelper::createFilterControl() {
     DBG_PRINT_EXIT(CLASS_NAME, __func__);
 }
 
-NSTextField* ControlHelper::createLabelWithString(NSString* labelString) {
-    DBG_PRINT_ENTRY(CLASS_NAME, __func__, "label", labelString);
-
-    NSTextField *textField = [NSTextField new];
-    [textField setEditable:NO];
-    [textField setSelectable:NO];
-    [textField setDrawsBackground:NO];
-    [textField setBordered:NO];
-    SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.9 setTitle
-    [[textField cell] setTitle:labelString];
-    SAL_WNODEPRECATED_DECLARATIONS_POP
-
-    DBG_PRINT_EXIT(CLASS_NAME, __func__);
-    return textField;
-}
-
 int ControlHelper::getVerticalDistance(const NSControl* first, const NSControl* second)
 {
     if (first == nil) {
diff --git a/fpicker/source/aqua/FilterHelper.hxx b/fpicker/source/aqua/FilterHelper.hxx
index e5e939d..7c30d53 100644
--- a/fpicker/source/aqua/FilterHelper.hxx
+++ b/fpicker/source/aqua/FilterHelper.hxx
@@ -116,9 +116,6 @@ private:
     bool FilterNameExists( const UnoFilterList& _rGroupedFilters );
 
     void ensureFilterList( const OUString& _rInitialCurrentFilter );
-
-    void fillSuffixList(OUStringList& aSuffixList, const OUString& suffixString);
-
 };
 
 #endif // INCLUDED_FPICKER_SOURCE_AQUA_FILTERHELPER_HXX
diff --git a/fpicker/source/aqua/FilterHelper.mm b/fpicker/source/aqua/FilterHelper.mm
index 69d8f9c..e37378d 100644
--- a/fpicker/source/aqua/FilterHelper.mm
+++ b/fpicker/source/aqua/FilterHelper.mm
@@ -30,6 +30,18 @@
 
 #include "FilterHelper.hxx"
 
+namespace {
+
+void fillSuffixList(OUStringList& aSuffixList, const ::rtl::OUString& suffixString) {
+    sal_Int32 nIndex = 0;
+    do {
+        rtl::OUString aToken = suffixString.getToken( 0, ';', nIndex );
+        aSuffixList.push_back(aToken.copy(1));
+    } while ( nIndex >= 0 );
+}
+
+}
+
 #pragma mark DEFINES
 #define CLASS_NAME "FilterEntry"
 
@@ -468,18 +480,6 @@ void FilterHelper::SetFilterAtIndex(unsigned index) {
     DBG_PRINT_EXIT(CLASS_NAME, __func__);
 }
 
-void FilterHelper::fillSuffixList(OUStringList& aSuffixList, const ::rtl::OUString& suffixString) {
-    DBG_PRINT_ENTRY(CLASS_NAME, __func__, "aSuffixList", suffixString);
-
-    sal_Int32 nIndex = 0;
-    do {
-        rtl::OUString aToken = suffixString.getToken( 0, ';', nIndex );
-        aSuffixList.push_back(aToken.copy(1));
-    } while ( nIndex >= 0 );
-
-    DBG_PRINT_EXIT(CLASS_NAME, __func__);
-}
-
 int FilterHelper::getCurrentFilterIndex() {
     DBG_PRINT_ENTRY(CLASS_NAME, __func__);
 


More information about the Libreoffice-commits mailing list