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
This commit is contained in:
parent
1bcf4b5cab
commit
ff54bf0601
4 changed files with 287 additions and 0 deletions
55
fpicker/source/aqua/NSString_OOoAdditions.hxx
Normal file
55
fpicker/source/aqua/NSString_OOoAdditions.hxx
Normal file
|
@ -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_
|
85
fpicker/source/aqua/NSString_OOoAdditions.mm
Normal file
85
fpicker/source/aqua/NSString_OOoAdditions.mm
Normal file
|
@ -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
|
57
fpicker/source/aqua/NSURL_OOoAdditions.hxx
Normal file
57
fpicker/source/aqua/NSURL_OOoAdditions.hxx
Normal file
|
@ -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
|
90
fpicker/source/aqua/NSURL_OOoAdditions.mm
Normal file
90
fpicker/source/aqua/NSURL_OOoAdditions.mm
Normal file
|
@ -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
|
Loading…
Reference in a new issue