summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-09-10 22:44:47 +0000
committerKurt Zenker <kz@openoffice.org>2009-09-10 22:44:47 +0000
commitf0ed8716b3b2556cb86e8005be88922c594c1189 (patch)
tree487bfcce6d8b684a059d8b15078d4c2b62ae203a /sfx2
parent270e03fea6602d0b4d4b0e63c9711fed00d6646b (diff)
CWS-TOOLING: integrate CWS os2port06dev300
2009-09-05 22:49:00 +0200 ydario r275858 : #i99588# applied os2port06 diff to DEV300 tree.
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/shutdowniconOs2.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx66
2 files changed, 67 insertions, 1 deletions
diff --git a/sfx2/source/appl/shutdowniconOs2.cxx b/sfx2/source/appl/shutdowniconOs2.cxx
index e527519d1564..6b69b5d0fae8 100644
--- a/sfx2/source/appl/shutdowniconOs2.cxx
+++ b/sfx2/source/appl/shutdowniconOs2.cxx
@@ -51,7 +51,7 @@ using namespace ::osl;
//
// This ObjectID must match the one created in WarpIN scripts!!
//
-#define QUICKSTART_OBJID "OO2B_QUICKSTART"
+#define QUICKSTART_OBJID "OO2_QUICKSTART"
bool ShutdownIcon::IsQuickstarterInstalled()
{
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 89f2fe74e2f9..5a4aed274c30 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -136,6 +136,12 @@
#include "appbaslib.hxx"
#include "appdata.hxx"
+#ifdef OS2
+#include <osl/file.hxx>
+#include <stdio.h>
+#include <sys/ea.h>
+#endif
+
#include "../appl/app.hrc"
extern sal_uInt32 CheckPasswd_Impl( SfxObjectShell*, SfxItemPool&, SfxMedium* );
@@ -1784,6 +1790,66 @@ sal_Bool SfxObjectShell::SaveTo_Impl
catch( Exception& )
{
}
+
+#ifdef OS2
+ {
+#define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer
+ // Header for a single-valued ASCII EA data item
+ typedef struct _EA_ASCII_header {
+ USHORT usAttr; /* value: EAT_ASCII */
+ USHORT usLen; /* length of data */
+ CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */
+ } EA_ASCII_HEADER;
+ char filePath[_MAX_PATH];
+ char fileExt[_MAX_PATH];
+ char docType[_MAX_PATH];
+ int rc;
+ oslFileError eRet;
+ ::rtl::OUString aSystemFileURL;
+ const ::rtl::OUString aFileURL = rMedium.GetName();
+ // close medium
+ rMedium.Close();
+
+ // convert file URL to system path
+ if (osl::FileBase::getSystemPathFromFileURL( aFileURL, aSystemFileURL) == osl::FileBase::E_None) {
+ EA_ASCII_HEADER eaAscii;
+ struct _ea eaType;
+ strcpy( filePath, CHAR_POINTER( aSystemFileURL));
+ strcpy( docType, CHAR_POINTER( rMedium.GetFilter()->GetServiceName()));
+#if OSL_DEBUG_LEVEL>1
+ printf( "file name: %s\n", filePath);
+ printf( "filter name: %s\n", CHAR_POINTER(rMedium.GetFilter()->GetFilterName()));
+ printf( "service name: %s\n", docType);
+#endif
+ // initialize OS/2 EA data structure
+ eaAscii.usAttr = EAT_ASCII;
+ _splitpath ( filePath, NULL, NULL, NULL, fileExt);
+ if (!stricmp( fileExt, ".pdf"))
+ strcpy( eaAscii.szType, "Acrobat Document");
+ else if (!strcmp( docType, "com.sun.star.text.TextDocument"))
+ strcpy( eaAscii.szType, "OpenOfficeOrg Writer Document");
+ else if (!strcmp( docType, "com.sun.star.sheet.SpreadsheetDocument"))
+ strcpy( eaAscii.szType, "OpenOfficeOrg Calc Document");
+ else if (!strcmp( docType, "com.sun.star.presentation.PresentationDocument"))
+ strcpy( eaAscii.szType, "OpenOfficeOrg Impress Document");
+ else if (!strcmp( docType, "com.sun.star.drawing.DrawingDocument"))
+ strcpy( eaAscii.szType, "OpenOfficeOrg Draw Document");
+ else
+ strcpy( eaAscii.szType, "OpenOfficeOrg Document");
+ eaAscii.usLen = strlen( eaAscii.szType);
+ // fill libc EA data structure
+ eaType.flags = 0;
+ eaType.size = sizeof(USHORT)*2 + eaAscii.usLen;
+ eaType.value = &eaAscii;
+ // put EA to file
+ rc = _ea_put( &eaType, filePath, 0, ".TYPE");
+#if OSL_DEBUG_LEVEL>1
+ printf( "ea name: %s, rc %d, errno %d\n", eaAscii.szType, rc, errno);
+#endif
+ }
+ }
+#endif
+
}
return bOk;