summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-03-05 15:36:44 +0000
committerKurt Zenker <kz@openoffice.org>2008-03-05 15:36:44 +0000
commitff54bf0601077c0468dc13ab5967684144eb3835 (patch)
tree524d3542731d8d3bd3688ff70de76b0ce76decac /fpicker
parent1bcf4b5cab91f86f782a9242730441530b912d7b (diff)
INTEGRATION: CWS aquafilepicker02_DEV300 (1.1.2); FILE ADDED
2008/01/14 08:23:24 fheckl 1.1.2.2: Code cleanup and some implementation details 2008/01/02 18:25:58 fheckl 1.1.2.1: issue #80399 more Cocoa
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/aqua/NSString_OOoAdditions.hxx55
-rw-r--r--fpicker/source/aqua/NSString_OOoAdditions.mm85
-rw-r--r--fpicker/source/aqua/NSURL_OOoAdditions.hxx57
-rw-r--r--fpicker/source/aqua/NSURL_OOoAdditions.mm90
4 files changed, 287 insertions, 0 deletions
diff --git a/fpicker/source/aqua/NSString_OOoAdditions.hxx b/fpicker/source/aqua/NSString_OOoAdditions.hxx
new file mode 100644
index 000000000000..d95b69a0735f
--- /dev/null
+++ b/fpicker/source/aqua/NSString_OOoAdditions.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: NSString_OOoAdditions.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2008-03-05 16:36:07 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _NSSTRING_OOOADDITIONS_HXX_
+#define _NSSTRING_OOOADDITIONS_HXX_
+
+#include <premac.h>
+#import <Cocoa/Cocoa.h>
+#include <postmac.h>
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+// #include <sal/types.h>
+
+//for Cocoa types
+@interface NSString (OOoAdditions)
++ (id) stringWithOUString:(const rtl::OUString&)ouString;
+- (id) initWithOUString:(const rtl::OUString&)ouString;
+- (rtl::OUString) OUString;
+@end
+
+#endif // _NSSTRING_OOOADDITIONS_HXX_
diff --git a/fpicker/source/aqua/NSString_OOoAdditions.mm b/fpicker/source/aqua/NSString_OOoAdditions.mm
new file mode 100644
index 000000000000..8dcc66315974
--- /dev/null
+++ b/fpicker/source/aqua/NSString_OOoAdditions.mm
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: NSString_OOoAdditions.mm,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2008-03-05 16:36:21 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _CFSTRINGUTILITIES_HXX_
+#include "CFStringUtilities.hxx"
+#endif
+
+#include "NSString_OOoAdditions.hxx"
+
+#define CLASS_NAME "NSString"
+
+@implementation NSString (OOoAdditions)
+
++ (id) stringWithOUString:(const rtl::OUString&)ouString
+{
+ DBG_PRINT_ENTRY(CLASS_NAME, __func__, "ouString", ouString);
+
+ NSString *string = [[NSString alloc] initWithOUString:ouString];
+
+ DBG_PRINT_EXIT(CLASS_NAME, __func__, string);
+ return [string autorelease];
+}
+
+- (id) initWithOUString:(const rtl::OUString&)ouString
+{
+ DBG_PRINT_ENTRY(CLASS_NAME, __func__, "ouString", ouString);
+ if ((self = [super init])) {
+ self = [self initWithCharacters:ouString.getStr() length:ouString.getLength()];
+
+ DBG_PRINT_EXIT(CLASS_NAME, __func__, self);
+
+ return self;
+ }
+
+ DBG_PRINT_EXIT(CLASS_NAME, __func__, self);
+ return nil;
+}
+
+- (rtl::OUString) OUString
+{
+ unsigned int nFileNameLength = [self length];
+
+ UniChar unichars[nFileNameLength+1];
+
+ //'close' the string buffer correctly
+ unichars[nFileNameLength] = '\0';
+
+ [self getCharacters:unichars];
+
+ return rtl::OUString(unichars);
+}
+
+@end
diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.hxx b/fpicker/source/aqua/NSURL_OOoAdditions.hxx
new file mode 100644
index 000000000000..a64cfb99b06d
--- /dev/null
+++ b/fpicker/source/aqua/NSURL_OOoAdditions.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: NSURL_OOoAdditions.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2008-03-05 16:36:33 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _NSURL_OOOADDITIONS_HXX_
+#define _NSURL_OOOADDITIONS_HXX_
+
+#include <premac.h>
+#include <Foundation/Foundation.h>
+#include <postmac.h>
+
+#ifndef _CFSTRINGUTILITIES_HXX_
+#include "CFStringUtilities.hxx"
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+// #include <sal/types.h>
+
+@interface NSURL (OOoAdditions)
+- (rtl::OUString) OUStringForInfo:(InfoType)info;
+@end
+
+#endif \ No newline at end of file
diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm
new file mode 100644
index 000000000000..a7e35edd7846
--- /dev/null
+++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: NSURL_OOoAdditions.mm,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: kz $ $Date: 2008-03-05 16:36:44 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _NSSTRING_OOOADDITIONS_HXX_
+#include "NSString_OOoAdditions.hxx"
+#endif
+
+#include "NSURL_OOoAdditions.hxx"
+
+@implementation NSURL (OOoAdditions)
+- (rtl::OUString) OUStringForInfo:(InfoType)info
+{
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ NSString *sURLString = nil;
+
+ switch(info) {
+ case FULLPATH:
+ OSL_TRACE("Extracting the full path of an item");
+ sURLString = [self absoluteString];
+ [sURLString retain];
+ break;
+ case FILENAME:
+ OSL_TRACE("Extracting the file name of an item");
+ NSString *path = [self path];
+ if (path == nil) {
+ sURLString = @"";
+ }
+ else {
+ sURLString = [path lastPathComponent];
+ }
+ [sURLString retain];
+ break;
+ case PATHWITHOUTLASTCOMPONENT:
+ OSL_TRACE("Extracting the last but one component of an item's path");
+ path = [self absoluteString];
+ if (path == nil) {
+ sURLString = @"";
+ }
+ else {
+ NSString* lastComponent = [path lastPathComponent];
+ unsigned int lastLength = [lastComponent length];
+ sURLString = [path substringToIndex:([path length] - lastLength)];
+ }
+ [sURLString retain];
+ break;
+ default:
+ break;
+ }
+
+ rtl::OUString sResult = [sURLString OUString];
+ [sURLString release];
+
+ [pool release];
+
+ return sResult;
+}
+@end