diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:36:44 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:36:44 +0000 |
commit | 2fe52b62203d436dd31e19ed3fcb92d7332e810c (patch) | |
tree | 5ce1557f3dc14e01e55d7af217cbfc42e82817da /fpicker | |
parent | 47d87cc3069535336da91d8702b92e3948f9e8e1 (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.hxx | 55 | ||||
-rw-r--r-- | fpicker/source/aqua/NSString_OOoAdditions.mm | 85 | ||||
-rw-r--r-- | fpicker/source/aqua/NSURL_OOoAdditions.hxx | 57 | ||||
-rw-r--r-- | fpicker/source/aqua/NSURL_OOoAdditions.mm | 90 |
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 0000000000..d95b69a073 --- /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 0000000000..8dcc663159 --- /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 0000000000..a64cfb99b0 --- /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 0000000000..a7e35edd78 --- /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 |