summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-12-16 14:13:32 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-12-16 14:13:32 +0000
commita49dd6e1a4ff5e931c0e062958829442d864db72 (patch)
tree53c84fe6805b0ef57e7cea0b95fe645519bf1fb3 /shell
parente640bf3c6d47ead0b1249c87ed828d0730533c94 (diff)
parentab33e14647ada2a32624fa39ec0ddbbbdc694df5 (diff)
tl74: merge with DEV300 m60
Diffstat (limited to 'shell')
-rw-r--r--shell/inc/internal/basereader.hxx2
-rw-r--r--shell/inc/internal/contentreader.hxx3
-rw-r--r--shell/inc/internal/metainforeader.hxx3
-rw-r--r--shell/inc/internal/propsheets.hxx1
-rw-r--r--shell/inc/internal/types.hxx3
-rw-r--r--shell/inc/internal/zipfile.hxx11
-rw-r--r--shell/prj/build.lst1
-rwxr-xr-xshell/source/all/makefile.mk2
-rw-r--r--shell/source/all/ooofilereader/basereader.cxx9
-rw-r--r--shell/source/all/ooofilereader/contentreader.cxx23
-rw-r--r--shell/source/all/ooofilereader/makefile.mk3
-rw-r--r--shell/source/all/ooofilereader/metainforeader.cxx42
-rw-r--r--shell/source/all/zipfile/makefile.mk7
-rw-r--r--shell/source/all/zipfile/zipfile.cxx22
-rw-r--r--shell/source/aqua/sysshell/makefile.mk1
-rw-r--r--shell/source/aqua/sysshell/systemshell.cxx36
-rw-r--r--shell/source/backends/kde4be/exports.map10
-rw-r--r--shell/source/backends/kde4be/kde4backend.cxx158
-rw-r--r--shell/source/backends/kde4be/kde4backend.hxx123
-rw-r--r--shell/source/backends/kde4be/kde4be.xml35
-rw-r--r--shell/source/backends/kde4be/kde4be1-ucd.txt6
-rw-r--r--shell/source/backends/kde4be/kde4becdef.cxx143
-rw-r--r--shell/source/backends/kde4be/kde4commonlayer.cxx157
-rw-r--r--shell/source/backends/kde4be/kde4commonlayer.hxx51
-rw-r--r--shell/source/backends/kde4be/kde4inetlayer.cxx255
-rw-r--r--shell/source/backends/kde4be/kde4inetlayer.hxx59
-rw-r--r--shell/source/backends/kde4be/kde4pathslayer.cxx124
-rw-r--r--shell/source/backends/kde4be/kde4pathslayer.hxx82
-rw-r--r--shell/source/backends/kde4be/kde4vcllayer.cxx115
-rw-r--r--shell/source/backends/kde4be/kde4vcllayer.hxx53
-rw-r--r--shell/source/backends/kde4be/makefile.mk94
-rw-r--r--shell/source/backends/macbe/makefile.mk3
-rw-r--r--shell/source/unix/exec/shellexec.cxx21
-rw-r--r--shell/source/unix/misc/makefile.mk2
-rw-r--r--shell/source/unix/misc/open-url.c40
-rw-r--r--shell/source/unix/misc/senddoc.c40
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/makefile.mk16
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx212
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx33
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx1
-rw-r--r--shell/source/win32/shlxthandler/propsheets/propsheets.cxx28
-rw-r--r--shell/source/win32/shlxthandler/util/makefile.mk1
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx1
-rw-r--r--shell/source/win32/simplemail/smplmailclient.cxx12
44 files changed, 1949 insertions, 95 deletions
diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx
index 47f7a9b82c40..4da8b7fa95be 100644
--- a/shell/inc/internal/basereader.hxx
+++ b/shell/inc/internal/basereader.hxx
@@ -50,6 +50,8 @@ public:
protected: // protected because its only an implementation relevant class
CBaseReader( const std::string& DocumentName );
+ CBaseReader( void* stream, zlib_filefunc_def* fa );
+
virtual void start_document();
virtual void end_document();
diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx
index 41491df9fa8b..d8b2d77d28c0 100644
--- a/shell/inc/internal/contentreader.hxx
+++ b/shell/inc/internal/contentreader.hxx
@@ -43,6 +43,9 @@ public:
//CContentReader( const std::string& DocumentName );
CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale );
+ CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
+
+
/** Get the chunkbuffer.
@return
diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx
index 62248beb845f..1e004b5a3727 100644
--- a/shell/inc/internal/metainforeader.hxx
+++ b/shell/inc/internal/metainforeader.hxx
@@ -45,6 +45,9 @@ public:
virtual ~CMetaInfoReader();
CMetaInfoReader( const std::string& DocumentName );
+
+ CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+
/** check if the Tag is in the target meta.xml file.
@param TagName
diff --git a/shell/inc/internal/propsheets.hxx b/shell/inc/internal/propsheets.hxx
index 3b14dc574fe3..0ebafcf0aa3a 100644
--- a/shell/inc/internal/propsheets.hxx
+++ b/shell/inc/internal/propsheets.hxx
@@ -92,7 +92,6 @@ private:
private:
long m_RefCnt;
char m_szFileName[MAX_PATH];
- std::auto_ptr<CMetaInfoReader> m_pMetaInfo;
};
#endif
diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx
index 316a5e716d5b..730263060041 100644
--- a/shell/inc/internal/types.hxx
+++ b/shell/inc/internal/types.hxx
@@ -36,6 +36,9 @@
#include <utility>
#include <vector>
#include <stack>
+#include <external/zlib/zlib.h>
+#include <external/zlib/ioapi.h>
+
typedef std::vector<std::wstring> StringList_t;
diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx
index 81da437544fe..2a860bb4c6cd 100644
--- a/shell/inc/internal/zipfile.hxx
+++ b/shell/inc/internal/zipfile.hxx
@@ -35,7 +35,9 @@
#define _WINDOWS
#endif
-#include <external/zlib/unzip.h>
+
+#include <external/zlib/unzip.h>
+
#include <string>
#include <vector>
@@ -69,6 +71,9 @@ public:
*/
static bool IsZipFile(const std::string& FileName);
+ static bool IsZipFile(void* stream);
+
+
/** Returns wheter the version of the specified zip file may be uncompressed with the
currently used zlib version or not
@@ -86,6 +91,7 @@ public:
*/
static bool IsValidZipFileVersionNumber(const std::string& FileName);
+ static bool IsValidZipFileVersionNumber(void* stream);
public:
@@ -103,6 +109,9 @@ public:
*/
ZipFile(const std::string& FileName);
+ ZipFile(void* stream, zlib_filefunc_def* fa);
+
+
/** Destroys a zip file
*/
~ZipFile();
diff --git a/shell/prj/build.lst b/shell/prj/build.lst
index 01077cbcb87d..7a2e91f973ba 100644
--- a/shell/prj/build.lst
+++ b/shell/prj/build.lst
@@ -31,6 +31,7 @@ sl shell\source\backends\wininetbe nmake - w sl_backends_w
sl shell\source\backends\macbe nmake - u sl_backends_macbe sl_inc NULL
sl shell\source\backends\gconfbe nmake - u sl_backends_gconfbe sl_inc NULL
sl shell\source\backends\kdebe nmake - u sl_backends_kdebe sl_inc NULL
+sl shell\source\backends\kde4be nmake - u sl_backends_kde4be sl_inc NULL
sl shell\source\backends\desktopbe nmake - u sl_backends_desktopbe sl_inc NULL
sl shell\source\win32\shlxthandler\ooofilt nmake - w sl_win32_shlxthandler_ooofilt sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_util.w sl_all sl_inc NULL
sl shell\source\win32\shlxthandler\ooofilt\proxy nmake - w sl_win32_ooofiltproxy sl_inc NULL
diff --git a/shell/source/all/makefile.mk b/shell/source/all/makefile.mk
index 3695abae798c..623aad6d69c1 100755
--- a/shell/source/all/makefile.mk
+++ b/shell/source/all/makefile.mk
@@ -35,6 +35,7 @@ PRJNAME=shell
TARGET=xmlparser
ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -61,6 +62,7 @@ CFLAGS+=-DSYSTEM_EXPAT
.ENDIF
SLOFILES=$(SLO)$/xml_parser.obj
+
.IF "$(BUILD_X64)"!=""
SLOFILES_X64=$(SLO_X64)$/xml_parser.obj
.ENDIF # "$(BUILD_X64)"!=""
diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx
index 8412de36e458..d9be6740f057 100644
--- a/shell/source/all/ooofilereader/basereader.cxx
+++ b/shell/source/all/ooofilereader/basereader.cxx
@@ -50,6 +50,15 @@ m_ZipFile( DocumentName )
//
//------------------------------
+CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
+m_ZipFile( sw , fa )
+{
+}
+
+//------------------------------
+//
+//------------------------------
+
CBaseReader::~CBaseReader()
{
}
diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx
index f1990c741721..111647e70ad6 100644
--- a/shell/source/all/ooofilereader/contentreader.cxx
+++ b/shell/source/all/ooofilereader/contentreader.cxx
@@ -61,6 +61,29 @@ CBaseReader( DocumentName )
}
}
+CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
+CBaseReader( stream, fa )
+{
+try
+ {
+ m_DefaultLocale = DocumentLocale;
+ Initialize( DOC_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+}
+
+
/** destructor.
*/
diff --git a/shell/source/all/ooofilereader/makefile.mk b/shell/source/all/ooofilereader/makefile.mk
index 1e9788cf3f17..b893db45d849 100644
--- a/shell/source/all/ooofilereader/makefile.mk
+++ b/shell/source/all/ooofilereader/makefile.mk
@@ -35,6 +35,7 @@ TARGET=ooofilereader
LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -65,7 +66,7 @@ LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1OBJFILES=$(SLOFILES)
LIB1FILES=$(SLB)$/zipfile.lib\
$(SLB)$/xmlparser.lib
-
+
.IF "$(BUILD_X64)"!=""
SLOFILES_X64=$(SLO_X64)$/basereader.obj\
$(SLO_X64)$/metainforeader.obj\
diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx
index f09d8b3e41d0..cec17b59d3c9 100644
--- a/shell/source/all/ooofilereader/metainforeader.cxx
+++ b/shell/source/all/ooofilereader/metainforeader.cxx
@@ -80,6 +80,48 @@ CBaseReader( DocumentName )
}
}
+CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
+CBaseReader( stream, fa)
+{
+try
+ {
+ m_pKeywords_Builder = new CKeywordsTag( );
+ m_pSimple_Builder = new CSimpleTag( );
+ m_pDummy_Builder = new CDummyTag( );
+
+ //retrieve all infomation that is useful
+ m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG;
+
+ m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG;
+ m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG;
+
+ Initialize( META_CONTENT_NAME );
+ }
+ catch(xml_parser_exception&
+ #if OSL_DEBUG_LEVEL > 0
+ ex
+ #endif
+ )
+ {
+ ENSURE(false, ex.what());
+ }
+ catch(...)
+ {
+ ENSURE(false, "Unknown error");
+ }
+
+}
+
/** destructor.
*/
diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk
index a7f9c95b95cf..9f294ce7aad0 100644
--- a/shell/source/all/zipfile/makefile.mk
+++ b/shell/source/all/zipfile/makefile.mk
@@ -33,6 +33,9 @@ PRJ=..$/..$/..
PRJNAME=shell
TARGET=zipfile
ENABLE_EXCEPTIONS=TRUE
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+
# --- Settings -----------------------------------------------------
@@ -45,8 +48,8 @@ SLOFILES=$(SLO)$/zipfile.obj\
$(SLO)$/zipexcptn.obj
SLOFILES_X64=$(SLO_X64)$/zipfile.obj\
- $(SLO_X64)$/zipexcptn.obj
-
+ $(SLO_X64)$/zipexcptn.obj
+
# --- Targets ------------------------------------------------------
.INCLUDE : set_wntx64.mk
diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx
index b174c7a023e3..06fb6cc934d3 100644
--- a/shell/source/all/zipfile/zipfile.cxx
+++ b/shell/source/all/zipfile/zipfile.cxx
@@ -79,6 +79,12 @@ bool ZipFile::IsZipFile(const std::string& /*FileName*/)
return true;
}
+bool ZipFile::IsZipFile(void* /*stream*/)
+{
+ return true;
+}
+
+
/** Returns wheter the version of the specified zip file may be uncompressed with the
currently used zlib version or not
@@ -99,6 +105,12 @@ bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/)
return true;
}
+bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
+{
+ return true;
+}
+
+
/** Constructs a zip file from a zip file
@precond The given parameter must be a string with length > 0
@@ -119,6 +131,16 @@ ZipFile::ZipFile(const std::string& FileName)
throw IOException(-1);
}
+ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa)
+{
+ fa->opaque = stream;
+ m_uzFile = unzOpen2((const char *)NULL, fa);
+
+ if (0 == m_uzFile)
+ throw IOException(-1);
+}
+
+
/** Destroys a zip file
*/
ZipFile::~ZipFile()
diff --git a/shell/source/aqua/sysshell/makefile.mk b/shell/source/aqua/sysshell/makefile.mk
index a748e00c154e..b3cf3abdec36 100644
--- a/shell/source/aqua/sysshell/makefile.mk
+++ b/shell/source/aqua/sysshell/makefile.mk
@@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
-OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions
CFLAGSCXX+=$(OBJCXXFLAGS)
# --- Files --------------------------------------------------------
diff --git a/shell/source/aqua/sysshell/systemshell.cxx b/shell/source/aqua/sysshell/systemshell.cxx
index a9b4afe1a966..a9535c849f77 100644
--- a/shell/source/aqua/sysshell/systemshell.cxx
+++ b/shell/source/aqua/sysshell/systemshell.cxx
@@ -71,17 +71,49 @@ static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl)
return extUrl;
}
+// #i104525# many versions of OSX have problems with some URLs:
+// when an app requests OSX to add one of these URLs to the "Recent Items" list
+// then this app gets killed (TextEdit, Preview, etc. and also OOo)
+static bool isDangerousUrl( const rtl::OUString& rUrl)
+{
+ // use a heuristic that detects all known cases since there is no official comment
+ // on the exact impact and root cause of the OSX bug
+ const int nLen = rUrl.getLength();
+ const sal_Unicode* p = rUrl.getStr();
+ for( int i = 0; i < nLen-3; ++i, ++p) {
+ if( p[0] != '%')
+ continue;
+ // escaped percent?
+ if( (p[1] == '2') && (p[2] == '5'))
+ return true;
+ // escapes are considered to be UTF-8 encoded
+ // => check for invalid UTF-8 leading byte
+ if( (p[1] != 'f') && (p[1] != 'F'))
+ continue;
+ int cLowNibble = p[2];
+ if( (cLowNibble >= '0') && (cLowNibble <= '9'))
+ return false;
+ if( cLowNibble >= 'a')
+ cLowNibble -= 'a' - 'A';
+ if( (cLowNibble < 'A') || (cLowNibble >= 'C'))
+ return true;
+ }
+
+ return false;
+}
+
namespace SystemShell {
//##############################
- void AddToRecentDocumentList(const rtl::OUString& aFileUrl, const rtl::OUString& aMimeType)
+ void AddToRecentDocumentList(const rtl::OUString& aFileUrl, const rtl::OUString& /*aMimeType*/)
{
// Convert file URL for external use (see above)
rtl::OUString externalUrl = translateToExternalUrl(aFileUrl);
if( 0 == externalUrl.getLength() )
externalUrl = aFileUrl;
- if( externalUrl.getLength() )
+ if( externalUrl.getLength()
+ && !isDangerousUrl( externalUrl))
{
NSString* pString = [[NSString alloc] initWithCharacters: externalUrl.getStr() length: externalUrl.getLength()];
NSURL* pURL = [NSURL URLWithString: pString];
diff --git a/shell/source/backends/kde4be/exports.map b/shell/source/backends/kde4be/exports.map
new file mode 100644
index 000000000000..ba501f9ae076
--- /dev/null
+++ b/shell/source/backends/kde4be/exports.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ GetVersionInfo;
+ component_getImplementationEnvironment;
+ component_getFactory;
+ component_writeInfo;
+
+ local:
+ *;
+};
diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx
new file mode 100644
index 000000000000..7eb093bf7217
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4backend.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4backend.hxx"
+#include "kde4commonlayer.hxx"
+#include "kde4inetlayer.hxx"
+#include "kde4vcllayer.hxx"
+#include "kde4pathslayer.hxx"
+
+//------------------------------------------------------------------------------
+
+KDEBackend* KDEBackend::mInstance= 0;
+
+KDEBackend* KDEBackend::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ if (mInstance == 0)
+ {
+ mInstance = new KDEBackend (xContext);
+ }
+
+ return mInstance;
+}
+
+//------------------------------------------------------------------------------
+
+KDEBackend::KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException)
+ : BackendBase(mMutex), m_xContext(xContext)
+{
+}
+
+//------------------------------------------------------------------------------
+
+KDEBackend::~KDEBackend(void)
+{
+}
+
+//------------------------------------------------------------------------------
+
+uno::Reference<backend::XLayer> SAL_CALL KDEBackend::getLayer(
+ const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */)
+ throw (backend::BackendAccessException, lang::IllegalArgumentException)
+{
+ uno::Reference<backend::XLayer> xLayer;
+
+ if( aComponent.equalsAscii("org.openoffice.Office.Common" ) )
+ {
+ xLayer = new KDECommonLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.Inet" ) )
+ {
+ xLayer = new KDEInetLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.VCL" ) )
+ {
+ xLayer = new KDEVCLLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) )
+ {
+ xLayer = new KDEPathsLayer(m_xContext);
+ }
+
+ return xLayer;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Reference<backend::XUpdatableLayer> SAL_CALL
+KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */)
+ throw (backend::BackendAccessException,lang::NoSupportException,
+ lang::IllegalArgumentException)
+{
+ throw lang::NoSupportException( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ),
+ *this) ;
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEBackend::getBackendName(void)
+{
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDE4Backend") );
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEBackend::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendName() ;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL KDEBackend::getBackendServiceNames(void)
+{
+ uno::Sequence<rtl::OUString> aServices(1) ;
+ aServices[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDE4Backend")) ;
+
+ return aServices ;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
+
+ for(sal_Int32 i = 0; i < svc.getLength(); ++i )
+ if(svc[i] == aServiceName)
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString>
+SAL_CALL KDEBackend::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendServiceNames() ;
+}
+
+// ---------------------------------------------------------------------------------------
diff --git a/shell/source/backends/kde4be/kde4backend.hxx b/shell/source/backends/kde4be/kde4backend.hxx
new file mode 100644
index 000000000000..01599c41a74d
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4backend.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp>
+#include <com/sun/star/configuration/backend/CannotConnectException.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+#ifndef INCLUDED_MAP
+#include <map>
+#define INCLUDED_MAP
+#endif
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+
+
+//------------------------------------------------------------------------------
+typedef cppu::WeakComponentImplHelper2<backend::XSingleLayerStratum,
+ lang::XServiceInfo> BackendBase ;
+
+/**
+ Implements the SingleLayerStratum service for KDE access.
+ */
+class KDEBackend : public BackendBase {
+ public :
+
+ static KDEBackend* createInstance(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName( )
+ throw (uno::RuntimeException) ;
+
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& aServiceName )
+ throw (uno::RuntimeException) ;
+
+ virtual uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames( )
+ throw (uno::RuntimeException) ;
+
+ /**
+ Provides the implementation name.
+
+ @return implementation name
+ */
+ static rtl::OUString SAL_CALL getBackendName(void) ;
+
+ /**
+ Provides the supported services names
+
+ @return service names
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
+
+ //XSingleLayerStratum
+ virtual uno::Reference<backend::XLayer> SAL_CALL
+ getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp )
+ throw (backend::BackendAccessException, lang::IllegalArgumentException) ;
+
+ virtual uno::Reference<backend::XUpdatableLayer> SAL_CALL
+ getUpdatableLayer( const rtl::OUString& aLayerId )
+ throw (backend::BackendAccessException, lang::NoSupportException,
+ lang::IllegalArgumentException) ;
+
+ protected:
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException);
+
+ /** Destructor */
+ ~KDEBackend(void) ;
+
+ private:
+
+ /** Build KDE/OO mapping table */
+ void initializeMappingTable ();
+
+
+ /** The component context */
+ uno::Reference<uno::XComponentContext> m_xContext;
+
+ /** Mutex for reOOurces protection */
+ osl::Mutex mMutex ;
+
+ static KDEBackend* mInstance;
+};
diff --git a/shell/source/backends/kde4be/kde4be.xml b/shell/source/backends/kde4be/kde4be.xml
new file mode 100644
index 000000000000..ea2d9be6dd6b
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4be.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>kde4be</module-name>
+ <component-description>
+ <author> Éric Bischoff </author>
+ <name>com.sun.star.comp.configuration.backend.KDE4Backend</name>
+ <description> The KDE4 configuration backend </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.comp.configuration.backend.KDE4Backend</supported-service>
+ <service-dependency>...</service-dependency>
+ <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
+ <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
+ <type>com.sun.star.configuration.backend.XLayerHandler</type>
+ <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
+ <type>com.sun.star.lang.XMultiComponentFactory</type>
+ <type>com.sun.star.lang.XServiceInfo</type>
+ <type>com.sun.star.lang.XSingleComponentFactory</type>
+ <type>com.sun.star.lang.XTypeProvider</type>
+ <type>com.sun.star.uno.TypeClass</type>
+ <type>com.sun.star.uno.XAggregation</type>
+ <type>com.sun.star.uno.XComponentContext</type>
+ <type>com.sun.star.uno.XCurrentContext</type>
+ <type>com.sun.star.uno.XWeak</type>
+ <type>com.sun.star.registry.XRegistryKey</type>
+ </component-description>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
+ <runtime-module-dependency>cppu3</runtime-module-dependency>
+ <runtime-module-dependency>sal3</runtime-module-dependency>
+</module-description>
diff --git a/shell/source/backends/kde4be/kde4be1-ucd.txt b/shell/source/backends/kde4be/kde4be1-ucd.txt
new file mode 100644
index 000000000000..9671199b26e3
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4be1-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend
+ComponentName=kde4be1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.configuration.backend.KDE4Backend
diff --git a/shell/source/backends/kde4be/kde4becdef.cxx b/shell/source/backends/kde4be/kde4becdef.cxx
new file mode 100644
index 000000000000..da0d22ead22e
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4becdef.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4becdef.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+#include "kde4backend.hxx"
+
+#include <kapplication.h>
+
+#include <cppuhelper/implementationentry.hxx>
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "uno/current_context.hxx"
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+
+//==============================================================================
+
+static uno::Reference<uno::XInterface> SAL_CALL createKDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ try {
+ uno::Reference< uno::XCurrentContext > xCurrentContext(uno::getCurrentContext());
+
+ if (xCurrentContext.is())
+ {
+ uno::Any aValue = xCurrentContext->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) );
+
+ rtl::OUString aDesktopEnvironment;
+ if ( (aValue >>= aDesktopEnvironment) && (aDesktopEnvironment.equalsAscii("KDE")) && (KApplication::kApplication() != NULL) )
+ return * KDEBackend::createInstance(xContext);
+ }
+
+ return uno::Reference<uno::XInterface>();
+
+ } catch (uno::RuntimeException e) {
+ return uno::Reference<uno::XInterface>();
+ }
+
+}
+
+//==============================================================================
+
+static const cppu::ImplementationEntry kImplementations_entries[] =
+{
+ {
+ createKDEBackend,
+ KDEBackend::getBackendName,
+ KDEBackend::getBackendServiceNames,
+ cppu::createSingleComponentFactory,
+ NULL,
+ 0
+ },
+ { NULL, NULL, NULL, NULL, NULL, 0 }
+} ;
+//------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **aEnvTypeName,
+ uno_Environment **) {
+ *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void *,
+ void *pRegistryKey) {
+
+ using namespace ::com::sun::star::registry;
+ if (pRegistryKey)
+ {
+ try
+ {
+ uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + KDEBackend::getBackendName()
+ );
+
+ // Register associated service names
+ uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") )
+ );
+
+ uno::Sequence<rtl::OUString> sServiceNames = KDEBackend::getBackendServiceNames();
+ for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i)
+ xServicesKey->createKey(sServiceNames[i]);
+
+ return sal_True;
+ }
+
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "InvalidRegistryException caught");
+ }
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory(const sal_Char *aImplementationName,
+ void *aServiceManager,
+ void *aRegistryKey) {
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries) ;
+}
+//------------------------------------------------------------------------------
diff --git a/shell/source/backends/kde4be/kde4commonlayer.cxx b/shell/source/backends/kde4be/kde4commonlayer.cxx
new file mode 100644
index 000000000000..1ce844672225
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4commonlayer.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4commonlayer.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4commonlayer.hxx"
+
+#include <kemailsettings.h>
+#include <kglobalsettings.h>
+
+#include <QFont>
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define SPACE ' '
+
+//==============================================================================
+
+KDECommonLayer::KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDECommonLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(3);
+ sal_Int32 nProperties = 0;
+
+ // Email client settings
+ KEMailSettings aEmailSettings;
+ QString aClientProgram;
+ ::rtl::OUString sClientProgram;
+
+ aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ if ( aClientProgram.isEmpty() )
+ aClientProgram = "kmail";
+ else
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+ sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sClientProgram );
+
+ // Source code font settings
+ QFont aFixedFont;
+ QString aFontName;
+ :: rtl::OUString sFontName;
+ short nFontHeight;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ aFontName = aFixedFont.family();
+ sFontName = (const sal_Unicode *) aFontName.utf16();
+ nFontHeight = aFixedFont.pointSize();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sFontName );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontHeight") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "short" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nFontHeight );
+
+ if( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDECommonLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ KEMailSettings aEmailSettings;
+ QString aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+
+ QString aFixedFont = KGlobalSettings::fixedFont().toString();
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ sTimeStamp = (const sal_Unicode *) aClientProgram.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aFixedFont.utf16();
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4commonlayer.hxx b/shell/source/backends/kde4be/kde4commonlayer.hxx
new file mode 100644
index 000000000000..9ce4cd4dc962
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4commonlayer.hxx
@@ -0,0 +1,51 @@
+#pragma once
+
+#include "kde4backend.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Office.Common configuration component.
+ */
+class KDECommonLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDECommonLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/kde4inetlayer.cxx b/shell/source/backends/kde4be/kde4inetlayer.cxx
new file mode 100644
index 000000000000..bc661a093fb7
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4inetlayer.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4inetlayer.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include <kprotocolmanager.h>
+
+#include "kde4inetlayer.hxx"
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define COMMA ','
+#define SEMI_COLON ';'
+
+//==============================================================================
+
+KDEInetLayer::KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEInetLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(8);
+ sal_Int32 nProperties = 0;
+
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+ KProtocolManager::proxyFor( "HTTP" ),
+ KProtocolManager::proxyFor( "FTP" ),
+ KProtocolManager::proxyFor( "HTTPS" ));
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+ KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ),
+ KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ),
+ KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") ));
+ break;
+ default: // No proxy is used
+ setProxy(aPropInfoList, nProperties, 0);
+ }
+
+ if ( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEInetLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ QString aProxyType, aNoProxyFor, aHTTPProxy, aHTTPSProxy, aFTPProxy;
+
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTPS" );
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy:
+ case KProtocolManager::WPADProxy:
+ case KProtocolManager::EnvVarProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") );
+ aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") );
+ aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
+ break;
+ default:
+ aProxyType = '0';
+ }
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ sTimeStamp = (const sal_Unicode *) aProxyType.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aNoProxyFor.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aHTTPProxy.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aHTTPSProxy.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aFTPProxy.utf16();
+
+ return sTimeStamp;
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEInetLayer::setProxy
+ (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties,
+ int nProxyType, const QString &aNoProxy, const QString &aHTTPProxy, const QString &aFTPProxy, const QString &aHTTPSProxy ) const
+{
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( (sal_Int32) nProxyType );
+
+ if (nProxyType == 0) return;
+
+ if ( !aNoProxy.isEmpty() )
+ {
+ QString aNoProxyFor(aNoProxy);
+ ::rtl::OUString sNoProxyFor;
+
+ aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
+ sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sNoProxyFor );
+ }
+
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPSProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aFTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+}
+
diff --git a/shell/source/backends/kde4be/kde4inetlayer.hxx b/shell/source/backends/kde4be/kde4inetlayer.hxx
new file mode 100644
index 000000000000..64d00fec45fc
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4inetlayer.hxx
@@ -0,0 +1,59 @@
+#pragma once
+
+#include <QString>
+
+#include "kde4backend.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Inet configuration component.
+ */
+class KDEInetLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEInetLayer(void) {}
+
+private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+
+ void SAL_CALL setProxy
+ (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties,
+ int nProxyType, const QString &aNoProxyfor = QString(),
+ const QString &aHTTPProxy = QString(), const QString &aFTPProxy = QString(), const QString &aHTTPSProxy = QString()) const;
+};
diff --git a/shell/source/backends/kde4be/kde4pathslayer.cxx b/shell/source/backends/kde4be/kde4pathslayer.cxx
new file mode 100644
index 000000000000..2511d0b57405
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4pathslayer.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4pathslayer.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4pathslayer.hxx"
+
+#include <QString>
+#include <kglobalsettings.h>
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+
+#include <osl/security.hxx>
+#include <osl/file.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define SPACE ' '
+
+//==============================================================================
+
+KDEPathsLayer::KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEPathsLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
+ sal_Int32 nProperties = 0;
+
+ QString aDocumentsDir( KGlobalSettings::documentPath() );
+ rtl::OUString sDocumentsDir;
+ rtl::OUString sDocumentsURL;
+ if ( aDocumentsDir.endsWith(QChar('/')) )
+ aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
+ sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
+ osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL );
+
+ if( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEPathsLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ QString aDocumentsDir;
+ aDocumentsDir = KGlobalSettings::documentPath();
+
+ sTimeStamp += (const sal_Unicode *) aDocumentsDir.utf16();
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4pathslayer.hxx b/shell/source/backends/kde4be/kde4pathslayer.hxx
new file mode 100644
index 000000000000..40d31a73c4f9
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4pathslayer.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4pathslayer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include "kde4backend.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Office.Paths configuration component.
+ */
+class KDEPathsLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEPathsLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/kde4vcllayer.cxx b/shell/source/backends/kde4be/kde4vcllayer.cxx
new file mode 100644
index 000000000000..780c3e4e7ce1
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4vcllayer.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4vcllayer.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4vcllayer.hxx"
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+//==============================================================================
+
+KDEVCLLayer::KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEVCLLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
+
+/*
+ Commenting out, does not make much sense without an accessibility bridge
+===========================================================================
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+// Accessibility tools under Qt for UNIX are available starting with Qt 4.0
+ int nVersionMajor = 0;
+ const char *q = qVersion(); // "3.1.0" for example
+ while ('0' <= *q && *q <= '9')
+ nVersionMajor = nVersionMajor * 10 + *q++ - '0';
+ sal_Bool ATToolSupport = (sal_Bool) (nVersionMajor >= 4);
+#else
+ sal_Bool ATToolSupport = sal_False;
+#endif
+===========================================================================
+ End of commented out section
+*/ sal_Bool ATToolSupport = sal_False;
+
+ aPropInfoList[0].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.VCL/Settings/Accessibility/EnableATToolSupport") );
+ aPropInfoList[0].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[0].Protected = sal_False;
+ aPropInfoList[0].Value = uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) );
+
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEVCLLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ ::rtl::OUString sTimeStamp(
+ RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) );
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4vcllayer.hxx b/shell/source/backends/kde4be/kde4vcllayer.hxx
new file mode 100644
index 000000000000..16036ee89122
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4vcllayer.hxx
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "kde4backend.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/configuration/backend/XLayer.hpp>
+#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.VCL configuration component.
+ */
+class KDEVCLLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEVCLLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk
new file mode 100644
index 000000000000..6f92762e5ae1
--- /dev/null
+++ b/shell/source/backends/kde4be/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.5 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=kde4be
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+COMP1TYPELIST=$(TARGET)
+COMPRDB=$(SOLARBINDIR)$/types.rdb
+UNOUCROUT=$(OUT)$/inc$/$(TARGET)
+INCPRE=$(UNOUCROUT)
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# For some of the included external KDE headers, GCC complains about shadowed
+# symbols in instantiated template code only at the end of a compilation unit,
+# so the only solution is to disable that warning here:
+.IF "$(COM)" == "GCC"
+CFLAGSCXX+=-Wno-shadow
+.ENDIF
+
+UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt
+
+# no "lib" prefix
+DLLPRE =
+
+.IF "$(ENABLE_KDE4)" == "TRUE"
+
+CFLAGS+=$(KDE4_CFLAGS)
+
+# --- Files ---
+
+SLOFILES=\
+ $(SLO)$/kde4backend.obj \
+ $(SLO)$/kde4commonlayer.obj \
+ $(SLO)$/kde4inetlayer.obj \
+ $(SLO)$/kde4vcllayer.obj \
+ $(SLO)$/kde4pathslayer.obj \
+ $(SLO)$/kde4becdef.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(KDE4_LIBS) -lkio
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.ENDIF
+
+# --- Targets ---
+
+.INCLUDE : target.mk
diff --git a/shell/source/backends/macbe/makefile.mk b/shell/source/backends/macbe/makefile.mk
index dd2b166ce1ce..c8f6891d6f87 100644
--- a/shell/source/backends/macbe/makefile.mk
+++ b/shell/source/backends/macbe/makefile.mk
@@ -50,11 +50,10 @@ DLLPRE =
.IF "$(OS)" != "MACOSX"
dummy:
- @echo "Nothing to build for OS $(OS)."
+ @echo "Nothing to build for OS $(OS)."
.ELSE
-OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions
CFLAGSCXX+=$(OBJCXXFLAGS)
SLOFILES= \
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index 315f78c517ff..4ee0f32eb072 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -97,12 +97,10 @@ void escapeForShell( rtl::OStringBuffer & rBuffer, const rtl::OString & rURL)
{
// escape every non alpha numeric characters (excluding a few "known good") by prepending a '\'
sal_Char c = rURL[n];
- if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' )
-#ifdef OS2 // YD we don't need to escape ':', '-', '\\', '_'
- && c != ':' && c != '-' && c != '\\' && c != '_'
-#endif
- && c != '/' && c != '.' )
+#ifndef OS2 // YD shell does not support escaped chars
+ if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '/' && c != '.' )
rBuffer.append( '\\' );
+#endif
rBuffer.append( c );
}
@@ -210,6 +208,19 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
static_cast < XSystemShellExecute * > (this), ENOENT );
}
+#ifdef OS2
+ OStringBuffer aProg = OUStringToOString(aProgram, osl_getThreadTextEncoding());
+ aProg.append("open-url.exe");
+ OString aUrl = OUStringToOString(aURL, osl_getThreadTextEncoding());
+ if ( -1 == spawnl(P_NOWAIT, aProg.getStr(), aProg.getStr(), aUrl.getStr() , NULL) )
+ {
+ int nerr = errno;
+ throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
+ static_cast < XSystemShellExecute * > (this), nerr );
+ }
+ return;
+#endif
+
OString aTmp = OUStringToOString(aProgram, osl_getThreadTextEncoding());
escapeForShell(aBuffer, aTmp);
diff --git a/shell/source/unix/misc/makefile.mk b/shell/source/unix/misc/makefile.mk
index ba2ed56b83ef..8a5ee366223a 100644
--- a/shell/source/unix/misc/makefile.mk
+++ b/shell/source/unix/misc/makefile.mk
@@ -72,7 +72,7 @@ APP1TARGET = gnome-open-url.bin
APP1OBJS = \
$(OBJ)$/gnome-open-url.obj
APP1LIBS =
-.IF "$(OS)"!="FREEBSD"
+.IF "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD"
APP1STDLIBS=-ldl
.ENDIF
diff --git a/shell/source/unix/misc/open-url.c b/shell/source/unix/misc/open-url.c
index 00a2e3bff774..f8e76f26ec5d 100644
--- a/shell/source/unix/misc/open-url.c
+++ b/shell/source/unix/misc/open-url.c
@@ -1,35 +1,27 @@
/*************************************************************************
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * $RCSfile:$
+ * Copyright 2008 by Sun Microsystems, Inc.
*
- * $Revision:$
+ * OpenOffice.org - a multi-platform office productivity suite
*
- * last change: $Author:$
+ * This file is part of OpenOffice.org.
*
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
*
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
*
- * 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
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
*
************************************************************************/
diff --git a/shell/source/unix/misc/senddoc.c b/shell/source/unix/misc/senddoc.c
index e918ba69c86d..bbe96420699d 100644
--- a/shell/source/unix/misc/senddoc.c
+++ b/shell/source/unix/misc/senddoc.c
@@ -1,35 +1,27 @@
/*************************************************************************
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * $RCSfile:$
+ * Copyright 2008 by Sun Microsystems, Inc.
*
- * $Revision:$
+ * OpenOffice.org - a multi-platform office productivity suite
*
- * last change: $Author:$
+ * This file is part of OpenOffice.org.
*
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
*
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
*
- * 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
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
*
************************************************************************/
diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
index 74ecf35ac5fc..22127bc8ddac 100644
--- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk
+++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
@@ -36,6 +36,13 @@ LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
USE_DEFFILE=TRUE
+# Do not use the dynamic STLport library.
+# NO_DEFAULT_STL=YES
+
+# Do not use the uwinapi library
+UWINAPILIB=
+
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -43,11 +50,10 @@ USE_DEFFILE=TRUE
CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
CDEFS+=-D_WIN32_IE=0x501
+# SCPCDEFS+=-D_STLP_USE_STATIC_LIB
# --- Files --------------------------------------------------------
-#UWINAPILIB=
-
SLOFILES=$(SLO)$/ooofilt.obj\
$(SLO)$/propspec.obj
@@ -71,10 +77,12 @@ SHL1STDLIBS+=$(OLE32LIB)\
$(SHELL32LIB)\
$(KERNEL32LIB)\
$(OLDNAMESLIB)
-
+
+# $(LIBSTLPORTST)
+
SHL1LIBS+=$(SLB)$/util.lib\
$(SLB)$/ooofilereader.lib
-
+
SHL1DEPN=
SHL1OBJS=$(SLOFILES)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index e22fb89f94cf..ac8dd676c3b1 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -46,7 +46,7 @@
//--------------------------------------------------------------------------
#include "internal/contentreader.hxx"
#include "internal/metainforeader.hxx"
-#include "internal/utilities.hxx"
+//#include "internal/utilities.hxx"
#include "internal/registry.hxx"
#include "internal/fileextensions.hxx"
@@ -78,6 +78,8 @@
#include <ntquery.h>
#include "assert.h"
#include "ooofilt.hxx"
+#include <objidl.h>
+#include <stdio.h>
#include "propspec.hxx"
#ifdef __MINGW32__
#include <algorithm>
@@ -117,7 +119,9 @@ COooFilter::COooFilter() :
m_fEof(FALSE),
m_ChunkPosition(0),
m_cAttributes(0),
- m_pAttributes(0)
+ m_pAttributes(0),
+ m_pStream(NULL)
+
{
InterlockedIncrement( &g_lInstances );
}
@@ -172,6 +176,8 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface(
pUnkTemp = (IUnknown *)(IPersistFile *)this;
else if ( IID_IPersist == riid )
pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
+ else if (IID_IPersistStream == riid)
+ pUnkTemp = (IUnknown *)(IPersistStream *)this;
else if ( IID_IUnknown == riid )
pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
else
@@ -713,6 +719,101 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/)
// File is opened read-only, so "save" is always finished
return S_OK;
}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Load (IPersistStream::Load)
+//
+// Summary: Initializes an object from the stream where it was previously saved
+//
+// Arguments: pStm
+// [in] Pointer to stream from which object should be loaded
+//
+//
+// Returns: S_OK
+// E_OUTOFMEMORY
+// E_FAIL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
+{
+
+ // These next few lines work around the "Seek pointer" bug found on Vista.
+
+ char buf[20];
+ unsigned long count;
+ HRESULT hr;
+ ULARGE_INTEGER NewPosition;
+ LARGE_INTEGER Move;
+ Move.QuadPart = 0;
+ hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
+ hr = pStm->Read (buf, 20, &count);
+
+ zlib_filefunc_def z_filefunc;
+ fill_stream_filefunc (&z_filefunc);
+ z_filefunc.opaque = (void*)pStm;
+
+ m_pStream = pStm;
+
+ try
+ {
+ if (m_pMetaInfoReader)
+ delete m_pMetaInfoReader;
+ m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
+
+ if (m_pContentReader)
+ delete m_pContentReader;
+ m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
+ }
+ catch (const std::exception&)
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax)
+//
+// Summary: Returns the size in bytes of the stream neede to save the object.
+//
+// Arguments: pcbSize
+// [out] Pointer to a 64 bit unsigned int indicating the size needed
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
+{
+ //
+ return E_NOTIMPL;
+}
+
+//M-------------------------------------------------------------------------
+//
+// Method: COooFilter::Save (IPersistStream::Save)
+//
+// Summary: Save object to specified stream
+//
+// Arguments: pStm
+// [in] Pointer to stream
+//
+// fClearDirty
+// [in] Indicates whether to clear dirty flag
+//
+// Returns: E_NOTIMPL
+//
+//
+//--------------------------------------------------------------------------
+SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
+{
+ //
+ return E_NOTIMPL;
+}
+
//M-------------------------------------------------------------------------
//
// Method: COooFilter::GetCurFile (IPersistFile::GetCurFile)
@@ -1142,9 +1243,19 @@ namespace /* private */
std::string ClsidEntry_Persist = CLSID_GUID_ENTRY;
SubstitutePlaceholder(ClsidEntry_Persist, GUID_PLACEHOLDER, ClsidToString(PersistentGuid));
+
if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist.c_str(), "", "OpenOffice.org Persistent Handler"))
return E_FAIL;
+ // Add missing entry
+ std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
+ SubstitutePlaceholder(ClsidEntry_Persist_Entry,
+ GUID_PLACEHOLDER,
+ ClsidToString(PersistentGuid));
+
+ if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
+
+
std::string ClsidEntry_Persist_Addin = CLSID_GUID_PERSIST_ADDIN_ENTRY;
SubstitutePlaceholder(ClsidEntry_Persist_Addin,
GUID_PLACEHOLDER,
@@ -1393,3 +1504,100 @@ STDAPI DllUnregisterServer()
*/
return S_OK;
}
+
+extern "C" {
+
+ // IStream callback
+ voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {
+ return opaque;
+ }
+
+ uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
+ unsigned long newsize;
+ HRESULT hr;
+
+ hr = ((IStream *)stream)->Read (buf, size, &newsize);
+ if (hr == S_OK){
+ return (unsigned long)newsize;
+ }
+ else {
+ return (uLong)0;
+ }
+ }
+
+ long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ DWORD dwOrigin;
+ Move.QuadPart = (__int64)offset;
+
+ switch (origin) {
+ case SEEK_CUR:
+ dwOrigin = STREAM_SEEK_CUR;
+ break;
+ case SEEK_END:
+ dwOrigin = STREAM_SEEK_END;
+ break;
+ case SEEK_SET:
+ dwOrigin = STREAM_SEEK_SET;
+ break;
+ default:
+ return -1;
+ }
+
+ hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
+ if (hr == S_OK){
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ ULARGE_INTEGER NewPosition;
+ Move.QuadPart = 0;
+ NewPosition.QuadPart = 0;
+
+ hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+ if (hr == S_OK){
+ return (long) NewPosition.QuadPart;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
+ return 0;
+ }
+
+ int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
+ return 0; //RJK - for now
+ }
+
+ uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
+ HRESULT hr;
+ unsigned long writecount;
+ hr = ((IStream*)stream)->Write (buf, size, &writecount);
+ if (hr == S_OK)
+ return (unsigned int)writecount;
+ else
+ return (uLong)0;
+ }
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
+ pzlib_filefunc_def->zopen_file = cb_sopen;
+ pzlib_filefunc_def->zread_file = cb_sread;
+ pzlib_filefunc_def->zwrite_file = cb_swrite;
+ pzlib_filefunc_def->ztell_file = cb_stell;
+ pzlib_filefunc_def->zseek_file = cb_sseek;
+ pzlib_filefunc_def->zclose_file = cb_sclose;
+ pzlib_filefunc_def->zerror_file = cb_serror;
+ }
+}
+
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index f83e8792507f..9f1566b406bd 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -96,8 +96,7 @@ enum FilterState
FilteringContent, // Filtering the content property
FilteringProperty // Filtering the pseudo property
};
-
-class COooFilter : public IFilter, public IPersistFile
+class COooFilter : public IFilter, public IPersistFile, public IPersistStream
{
public:
// From IUnknown
@@ -144,6 +143,18 @@ public:
virtual SCODE STDMETHODCALLTYPE GetCurFile(
LPWSTR * ppszFileName);
+ // From IPersistStream
+ virtual SCODE STDMETHODCALLTYPE Load(
+ IStream *pStm);
+
+ virtual SCODE STDMETHODCALLTYPE Save(
+ IStream *pStm,
+ BOOL fClearDirty);
+
+ virtual SCODE STDMETHODCALLTYPE GetSizeMax(
+ ULARGE_INTEGER *pcbSize);
+
+
private:
friend class COooFilterCF;
@@ -166,6 +177,8 @@ private:
ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk;
ULONG m_cAttributes; // Count of attributes
CFullPropSpec * m_pAttributes; // Attributes to filter
+ IStream * m_pStream;
+
};
//C-------------------------------------------------------------------------
@@ -207,6 +220,22 @@ private:
long m_lRefs; // Reference count
};
+extern "C" {
+
+ voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
+ uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
+ uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
+ long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+ int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
+ int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
+
+}
+
+
+
diff --git a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
index 623bc7be7772..879cf8c0115b 100644
--- a/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/proxy/ooofiltproxy.cxx
@@ -147,7 +147,6 @@ extern "C" HRESULT __stdcall DllCanUnloadNow()
extern "C" HRESULT __stdcall DllRegisterServer()
{
Init();
-
if (Forward_DllRegisterServer)
return Forward_DllRegisterServer();
else
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index b8af5acbde78..171bc287715f 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -177,14 +177,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
{
- try
- {
- m_pMetaInfo = std::auto_ptr<CMetaInfoReader>(new CMetaInfoReader(m_szFileName));
- }
- catch (const std::exception&)
- {
- return E_FAIL;
- }
PROPSHEETPAGE psp;
@@ -317,14 +309,17 @@ BOOL CALLBACK CPropertySheet::PropPageStatisticsProc(HWND hwnd, UINT uiMsg, WPAR
//##################################
void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
{
- SetWindowText(GetDlgItem(hwnd,IDC_TITLE), m_pMetaInfo->getTagData( META_INFO_TITLE ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), m_pMetaInfo->getTagData( META_INFO_AUTHOR ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), m_pMetaInfo->getTagData( META_INFO_SUBJECT ).c_str() );
- SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), m_pMetaInfo->getTagData( META_INFO_KEYWORDS ).c_str() );
+
+ CMetaInfoReader metaInfo(m_szFileName);
+
+ SetWindowText(GetDlgItem(hwnd,IDC_TITLE), metaInfo.getTagData( META_INFO_TITLE ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_AUTHOR), metaInfo.getTagData( META_INFO_AUTHOR ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_SUBJECT), metaInfo.getTagData( META_INFO_SUBJECT ).c_str() );
+ SetWindowText(GetDlgItem(hwnd,IDC_KEYWORDS), metaInfo.getTagData( META_INFO_KEYWORDS ).c_str() );
// comments read from meta.xml use "\n" for return, but this will not displayable in Edit control, add
// "\r" before "\n" to form "\r\n" in order to display return in Edit control.
- std::wstring tempStr = m_pMetaInfo->getTagData( META_INFO_DESCRIPTION ).c_str();
+ std::wstring tempStr = metaInfo.getTagData( META_INFO_DESCRIPTION ).c_str();
std::wstring::size_type itor = tempStr.find ( L"\n" , 0 );
while (itor != std::wstring::npos)
{
@@ -332,6 +327,7 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
itor = tempStr.find(L"\n", itor + 2);
}
SetWindowText(GetDlgItem(hwnd,IDC_COMMENTS), tempStr.c_str());
+
}
//---------------------------------
@@ -339,7 +335,10 @@ void CPropertySheet::InitPropPageSummary(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
*/
void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/)
{
- document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, m_pMetaInfo.get());
+
+ CMetaInfoReader metaInfo(m_szFileName);
+
+ document_statistic_reader_ptr doc_stat_reader = create_document_statistic_reader(m_szFileName, &metaInfo);
statistic_group_list_t sgl;
doc_stat_reader->read(&sgl);
@@ -350,6 +349,7 @@ void CPropertySheet::InitPropPageStatistics(HWND hwnd, LPPROPSHEETPAGE /*lppsp*/
GetResString(IDS_PROPERTY_VALUE));
lv_builder->build(sgl);
+
}
diff --git a/shell/source/win32/shlxthandler/util/makefile.mk b/shell/source/win32/shlxthandler/util/makefile.mk
index f5d912c4b185..c0bec9c36d3b 100644
--- a/shell/source/win32/shlxthandler/util/makefile.mk
+++ b/shell/source/win32/shlxthandler/util/makefile.mk
@@ -35,6 +35,7 @@ TARGET=util
#LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 0598b4d335b7..36c19dd0c500 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -586,5 +586,4 @@ LCID LocaleSetToLCID( const LocaleSet_t & Locale )
return GetSystemDefaultLCID(); //System Default Locale
return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT );
-
}
diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx
index acb113450e7f..82968b747d95 100644
--- a/shell/source/win32/simplemail/smplmailclient.cxx
+++ b/shell/source/win32/simplemail/smplmailclient.cxx
@@ -32,7 +32,7 @@
#include "precompiled_shell.hxx"
#include <osl/diagnose.h>
#include <osl/process.h>
-#include <osl/module.hxx>
+#include <rtl/bootstrap.hxx>
#include "smplmailclient.hxx"
#include "smplmailmsg.hxx"
#include <com/sun/star/system/SimpleMailClientFlags.hpp>
@@ -112,12 +112,10 @@ namespace /* private */
if (senddocUrl.getLength() == 0)
{
- rtl::OUString baseUrl;
- if (!osl::Module::getUrlFromAddress(reinterpret_cast<oslGenericFunction>(getSenddocUrl), baseUrl))
- return rtl::OUString();
-
- senddocUrl = baseUrl.copy(0, baseUrl.lastIndexOf('/') + 1);
- senddocUrl += rtl::OUString::createFromAscii("senddoc.exe");
+ senddocUrl = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "$OOO_BASE_DIR/program/senddoc.exe"));
+ rtl::Bootstrap::expandMacros(senddocUrl); //TODO: detect failure
}
return senddocUrl;
}