summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 15:59:02 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 15:59:02 +0000
commit411e68cc54ae97eebd79ae3a9cb2971b74cb2a9e (patch)
tree59ea2e19910039e1cf1549dde198b827265bab52
parent0d14f932b02c43dd83fa3dfbe25d92755a4d7e26 (diff)
fix: #78939# #78945# convert y
-rw-r--r--svtools/source/misc/ehdl.cxx528
-rw-r--r--svtools/source/misc/ehdl.src74
-rw-r--r--svtools/source/misc/flbytes.cxx466
-rw-r--r--svtools/source/misc/imap.cxx1426
-rw-r--r--svtools/source/misc/imap2.cxx934
-rw-r--r--svtools/source/misc/imap3.cxx128
-rw-r--r--svtools/source/misc/inidef.cxx307
-rw-r--r--svtools/source/misc/iniman.src90
-rw-r--r--svtools/source/misc/iniprop.cxx76
-rw-r--r--svtools/source/misc/ownlist.cxx325
10 files changed, 4354 insertions, 0 deletions
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
new file mode 100644
index 000000000000..1f71e6801352
--- /dev/null
+++ b/svtools/source/misc/ehdl.cxx
@@ -0,0 +1,528 @@
+/*************************************************************************
+ *
+ * $RCSfile: ehdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _VOS_MUTEX_HXX_ //autogen
+#include <vos/mutex.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _TOOLS_RCID_H //autogen
+#include <tools/rcid.h>
+#endif
+#ifndef _SV_WINTYPES_HXX //autogen
+#include <vcl/wintypes.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#if defined(MAC) || defined(OS2)
+#ifndef _SV_SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+#endif
+
+#pragma hdrstop
+
+#include "ehdl.hxx"
+#include "svtdata.hxx"
+#include "svtools.hrc"
+#include "sfxecode.hxx"
+
+//=========================================================================
+
+static USHORT aWndFunc(
+ Window *pWin, // Parent des Dialoges
+ USHORT nFlags,
+ const String &rErr, // Fehlertext
+ const String &rAction) // Actiontext
+
+/* [Beschreibung]
+
+ Bringt eine Fehlerbox auf den Schirm. Je nach nFlags werden
+ Error/ Info usw. Boxen mit den gewuenschten Buttons angezeigt
+
+ Rueckgabewert ist der gedrueckte Button
+
+ */
+
+
+{
+#if 0
+ // OS/2 und Mac haengen bei ModalDialogs in Drop
+ // #38777: TH meint, das man das nicht mehr braucht
+#if defined(MAC) || defined(OS2)
+ if ( Application::IsUICaptured() )
+ {
+ Sound::Beep();
+ return ERRCODE_BUTTON_OK;
+ }
+#endif
+#endif
+
+ NAMESPACE_VOS( OGuard ) aGuard( Application::GetSolarMutex() );
+
+ // aus den Flags die benoetigten WinBits ermitteln
+ WinBits eBits=0;
+ if ( (ERRCODE_BUTTON_CANCEL|ERRCODE_BUTTON_RETRY) == (nFlags & (ERRCODE_BUTTON_CANCEL|ERRCODE_BUTTON_RETRY)) )
+ eBits = WB_RETRY_CANCEL;
+ else if ( ERRCODE_BUTTON_OK_CANCEL == (nFlags & ERRCODE_BUTTON_OK_CANCEL) )
+ eBits = WB_OK_CANCEL;
+ else if ( ERRCODE_BUTTON_OK == (nFlags & ERRCODE_BUTTON_OK) )
+ eBits = WB_OK;
+ else if ( ERRCODE_BUTTON_YES_NO_CANCEL == (nFlags & ERRCODE_BUTTON_YES_NO_CANCEL) )
+ eBits = WB_YES_NO_CANCEL;
+ else if ( ERRCODE_BUTTON_YES_NO == (nFlags & ERRCODE_BUTTON_YES_NO) )
+ eBits = WB_YES_NO;
+
+ switch(nFlags & 0x0f00)
+ {
+ case ERRCODE_BUTTON_DEF_OK:
+ eBits |= WB_DEF_OK;
+ break;
+
+ case ERRCODE_BUTTON_DEF_CANCEL:
+ eBits |= WB_DEF_CANCEL;
+ break;
+
+ case ERRCODE_BUTTON_DEF_YES:
+ eBits |= WB_DEF_YES;
+ break;
+
+ case ERRCODE_BUTTON_DEF_NO:
+ eBits |= WB_DEF_NO;
+ break;
+ }
+
+ String aErr(SvtResId(STR_ERR_HDLMESS));
+ String aAction(rAction);
+ if ( aAction.Len() )
+ aAction += String::CreateFromAscii( ":\n" );
+ aErr.SearchAndReplace(String::CreateFromAscii( "$(ACTION)" ), aAction);
+ aErr.SearchAndReplace(String::CreateFromAscii( "$(ERROR)" ), rErr);
+
+ MessBox* pBox;
+ switch ( nFlags & 0xf000 )
+ {
+ case ERRCODE_MSG_ERROR:
+ pBox = new ErrorBox(pWin, eBits, aErr);
+ break;
+
+ case ERRCODE_MSG_WARNING:
+ pBox = new WarningBox(pWin, eBits, aErr);
+ break;
+
+ case ERRCODE_MSG_INFO:
+ pBox = new InfoBox(pWin, aErr);
+ break;
+
+ case ERRCODE_MSG_QUERY:
+ pBox = new QueryBox(pWin, eBits, aErr);
+ break;
+
+ default:
+ {
+ DBG_ERRORFILE( "no MessBox type");
+ pBox = NULL;
+ return ERRCODE_BUTTON_OK;
+ }
+ }
+
+ USHORT nRet = RET_CANCEL;
+ switch ( pBox->Execute() )
+ {
+ case RET_OK:
+ nRet = ERRCODE_BUTTON_OK;
+ break;
+ case RET_CANCEL:
+ nRet = ERRCODE_BUTTON_CANCEL;
+ break;
+ case RET_RETRY:
+ nRet = ERRCODE_BUTTON_RETRY;
+ break;
+ case RET_YES:
+ nRet = ERRCODE_BUTTON_YES;
+ break;
+ case RET_NO:
+ nRet = ERRCODE_BUTTON_NO;
+ break;
+ default:
+ DBG_ERRORFILE( "Unknown MessBox return value" );
+ break;
+ }
+ delete pBox;
+ return nRet;
+}
+
+//-------------------------------------------------------------------------
+
+SfxErrorHandler::SfxErrorHandler(USHORT nIdP, ULONG lStartP, ULONG lEndP,
+ ResMgr *pMgrP)
+ : nId(nIdP), pMgr(pMgrP), lStart(lStartP), lEnd(lEndP)
+{
+ RegisterDisplay(&aWndFunc);
+}
+
+//-------------------------------------------------------------------------
+
+SfxErrorHandler::~SfxErrorHandler()
+{
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxErrorHandler::CreateString(
+ const ErrorInfo *pErr, String &rStr, USHORT& nFlags) const
+
+/* [Beschreibung]
+
+ Der Fehlerstring fuer die ErrorInfo pErr wird zusammengesetzt.
+
+ */
+
+{
+ ULONG nErrCode = pErr->GetErrorCode() & ERRCODE_ERROR_MASK;
+ if( nErrCode>=lEnd || nErrCode<=lStart )
+ return FALSE;
+ MessageInfo *pMsgInfo=PTR_CAST(MessageInfo,pErr);
+ if(pMsgInfo)
+ {
+ if(GetMessageString(nErrCode, rStr, nFlags))
+ {
+ for (USHORT i = 0; i < rStr.Len();)
+ {
+ i = rStr.SearchAndReplace(String::CreateFromAscii( "$(ARG1)" ),
+ pMsgInfo->GetMessageArg(), i);
+ if (i == STRING_NOTFOUND)
+ break;
+ i += pMsgInfo->GetMessageArg().Len();
+ }
+ return TRUE;
+ }
+ }
+ else if(GetErrorString(nErrCode, rStr, nFlags))
+ {
+ StringErrorInfo *pStringInfo=PTR_CAST(StringErrorInfo,pErr);
+ if(pStringInfo)
+ for (USHORT i = 0; i < rStr.Len();)
+ {
+ i = rStr.SearchAndReplace(String::CreateFromAscii( "$(ARG1)" ),
+ pStringInfo->GetErrorString(), i);
+ if (i == STRING_NOTFOUND)
+ break;
+ i += pStringInfo->GetErrorString().Len();
+ }
+ else
+ {
+ TwoStringErrorInfo * pTwoStringInfo = PTR_CAST(TwoStringErrorInfo,
+ pErr);
+ if (pTwoStringInfo)
+ for (USHORT i = 0; i < rStr.Len();)
+ {
+ USHORT nArg1Pos = rStr.Search(String::CreateFromAscii( "$(ARG1)" ), i);
+ USHORT nArg2Pos = rStr.Search(String::CreateFromAscii( "$(ARG2)" ), i);
+ if (nArg1Pos < nArg2Pos)
+ {
+ rStr.Replace(nArg1Pos, 7, pTwoStringInfo->GetArg1());
+ i = nArg1Pos + pTwoStringInfo->GetArg1().Len();
+ }
+ else if (nArg2Pos < nArg1Pos)
+ {
+ rStr.Replace(nArg2Pos, 7, pTwoStringInfo->GetArg2());
+ i = nArg2Pos + pTwoStringInfo->GetArg2().Len();
+ }
+ else break;
+ }
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//-------------------------------------------------------------------------
+
+class ResString: public String
+
+/* [Beschreibung]
+
+ Hilfsklasse zum Auslesen eines Strings und optionaler ExtraData aus
+ einer String Resource.
+
+ */
+
+{
+ USHORT nFlags;
+ public:
+ USHORT GetFlags() const {return nFlags;}
+ const String & GetString() const {return *this;}
+ ResString( ResId &rId);
+};
+
+//-------------------------------------------------------------------------
+
+ResString::ResString(ResId & rId):
+ String(rId.SetAutoRelease(FALSE)),
+ nFlags(0)
+{
+ ResMgr * pResMgr = Resource::GetResManager();
+ // String ctor temporarily sets global ResManager
+ if (pResMgr->GetRemainSize())
+ nFlags = USHORT(pResMgr->ReadShort());
+ rId.SetAutoRelease(TRUE);
+ pResMgr->PopContext();
+}
+
+//-------------------------------------------------------------------------
+
+struct ErrorResource_Impl : private Resource
+
+/* [Beschreibung]
+
+ Hilfsklasse zum Zugriff auf String SubResourcen einer Resource
+ */
+
+{
+
+ ResId aResId;
+
+ ErrorResource_Impl(ResId& rErrIdP, USHORT nId)
+ : Resource(rErrIdP),aResId(nId){}
+
+ ~ErrorResource_Impl() { FreeResource(); }
+
+ operator ResString(){ return ResString( aResId ); }
+ operator BOOL(){return IsAvailableRes(aResId.SetRT(RSC_STRING));}
+
+};
+
+
+BOOL SfxErrorHandler::GetClassString(ULONG lClassId, String &rStr) const
+
+/* [Beschreibung]
+
+ Erzeugt den String fuer die Klasse des Fehlers. Wird immer aus der
+ Resource des Sfx gelesen
+
+ */
+
+{
+
+ ResId aId(RID_ERRHDL);
+ ErrorResource_Impl aEr(aId, (USHORT)lClassId);
+ if(aEr)
+ {
+ rStr=((ResString)aEr).GetString();
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxErrorHandler::GetMessageString(
+ ULONG lErrId, String &rStr, USHORT &nFlags) const
+
+/* [Beschreibung]
+
+ Erzeugt den String fuer die Ausgabe in einer MessageBox
+
+ */
+
+{
+ BOOL bRet = FALSE;
+ ResId *pResId= new ResId(nId, pMgr);
+ ErrorResource_Impl aEr(*pResId, (USHORT)lErrId);
+ if(aEr)
+ {
+ ResString aErrorString(aEr);
+ USHORT nResFlags = aErrorString.GetFlags();
+ if( nResFlags )
+ nFlags=aErrorString.GetFlags();
+ rStr = aErrorString.GetString();
+ bRet = TRUE;
+ }
+
+ delete pResId;
+ return bRet;
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxErrorHandler::GetErrorString(
+ ULONG lErrId, String &rStr, USHORT &nFlags) const
+
+/* [Beschreibung]
+ Erzeugt den Fehlerstring fuer den eigentlichen Fehler ohne
+ dessen Klasse
+
+ */
+
+{
+ NAMESPACE_VOS( OGuard ) aGuard( Application::GetSolarMutex() );
+
+ BOOL bRet = FALSE;
+ rStr=String(SvtResId(RID_ERRHDL_CLASS));
+ ResId *pResId = new ResId(nId, pMgr);
+
+ {
+ ErrorResource_Impl aEr(*pResId, (USHORT)lErrId);
+ if(aEr)
+ {
+ ResString aErrorString(aEr);
+
+ USHORT nResFlags = aErrorString.GetFlags();
+ if ( nResFlags )
+ nFlags = nResFlags;
+
+ String aErrorRepl(aErrorString.GetString());
+ if(aErrorRepl.Len())
+ aErrorRepl += (nFlags & ERRCODE_MSG_QUERY) ? '?' : '.';
+
+ rStr.SearchAndReplace(String::CreateFromAscii( "$(ERROR)" ),aErrorRepl);
+ bRet = TRUE;
+ }
+ else
+ bRet = FALSE;
+ }
+
+ if( bRet )
+ {
+ String aErrStr;
+ GetClassString(lErrId & ERRCODE_CLASS_MASK,
+ aErrStr);
+ if(aErrStr.Len())
+ aErrStr+=String::CreateFromAscii( ".\n" );
+ rStr.SearchAndReplace(String::CreateFromAscii( "$(CLASS)" ),aErrStr);
+ }
+
+ delete pResId;
+ return bRet;
+}
+
+//-------------------------------------------------------------------------
+
+SfxErrorContext::SfxErrorContext(
+ USHORT nCtxIdP, Window *pWin, USHORT nResIdP, ResMgr *pMgrP)
+: ErrorContext(pWin), nCtxId(nCtxIdP), nResId(nResIdP), pMgr(pMgrP)
+{
+ if( nResId==USHRT_MAX )
+ nResId=RID_ERRCTX;
+}
+
+//-------------------------------------------------------------------------
+
+SfxErrorContext::SfxErrorContext(
+ USHORT nCtxIdP, const String &aArg1P, Window *pWin,
+ USHORT nResIdP, ResMgr *pMgrP)
+: ErrorContext(pWin), nCtxId(nCtxIdP), nResId(nResIdP), pMgr(pMgrP),
+ aArg1(aArg1P)
+{
+ if( nResId==USHRT_MAX )
+ nResId=RID_ERRCTX;
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxErrorContext::GetString(ULONG nErrId, String &rStr)
+
+/* [Beschreibung]
+
+ Baut die Beschreibung eines ErrorContextes auf
+ */
+
+{
+ FASTBOOL bRet = FALSE;
+ ResId* pResId = new ResId( nResId, pMgr );
+ {
+ {
+ NAMESPACE_VOS( OGuard ) aGuard( Application::GetSolarMutex() );
+ ErrorResource_Impl aEr( *pResId, nCtxId );
+ if ( aEr )
+ {
+ rStr = ( (ResString)aEr ).GetString();
+ rStr.SearchAndReplace( String::CreateFromAscii( "$(ARG1)" ), aArg1 );
+ bRet = TRUE;
+ }
+ else
+ {
+ DBG_ERRORFILE( "ErrorContext cannot find the resource" );
+ bRet = FALSE;
+ }
+ }
+
+ if ( bRet )
+ {
+ NAMESPACE_VOS( OGuard ) aGuard( Application::GetSolarMutex() );
+ USHORT nId = ( nErrId & ERRCODE_WARNING_MASK ) ? ERRCTX_WARNING : ERRCTX_ERROR;
+ ResId aSfxResId( RID_ERRCTX );
+ ErrorResource_Impl aEr( aSfxResId, nId );
+ rStr.SearchAndReplace( String::CreateFromAscii( "$(ERR)" ), ( (ResString)aEr ).GetString() );
+ }
+ }
+ delete pResId;
+ return bRet;
+}
+
+
diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src
new file mode 100644
index 000000000000..c0b8edc42f5f
--- /dev/null
+++ b/svtools/source/misc/ehdl.src
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: ehdl.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define __RSC
+#include "svtools.hrc"
+#include "sfxecode.hxx"
+ // pragma ----------------------------------------------------------------
+
+String STR_ERR_HDLMESS
+{
+ Text = "$(ACTION)$(ERROR)" ;
+};
+String RID_ERRHDL_CLASS
+{
+ Text = "$(CLASS)$(ERROR)" ;
+};
diff --git a/svtools/source/misc/flbytes.cxx b/svtools/source/misc/flbytes.cxx
new file mode 100644
index 000000000000..98e4583b7004
--- /dev/null
+++ b/svtools/source/misc/flbytes.cxx
@@ -0,0 +1,466 @@
+/*************************************************************************
+ *
+ * $RCSfile: flbytes.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _FLBYTES_HXX
+#include <flbytes.hxx>
+#endif
+
+#ifndef _SVSTDARR_ULONGS_DECL
+#define _SVSTDARR_ULONGS
+#include <svstdarr.hxx>
+#undef _SVSTDARR_ULONGS
+#endif
+
+namespace unnamed_svtools_flbytes {} using namespace unnamed_svtools_flbytes;
+ // unnamed namespaces don't work well yet
+
+//============================================================================
+namespace unnamed_svtools_flbytes {
+
+inline ULONG MyMin( long a, long b )
+{
+ return Max( long( Min( a , b ) ), 0L );
+}
+
+}
+
+//============================================================================
+//
+// SvFillLockBytes
+//
+//============================================================================
+
+TYPEINIT1(SvFillLockBytes, SvLockBytes);
+
+//============================================================================
+SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes )
+ : xLockBytes( pLockBytes ),
+ nFilledSize( 0 ),
+ bTerminated( FALSE )
+{
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount,
+ ULONG *pRead ) const
+{
+ if( bTerminated )
+ return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead );
+ else
+ {
+ ULONG nWanted = nPos + nCount;
+ if( IsSynchronMode() )
+ {
+ while( nWanted > nFilledSize && !bTerminated )
+ Application::Yield();
+ return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead );
+ }
+ else
+ {
+ ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos );
+ ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead );
+ return ( !nCount || nRead == nCount || nErr ) ?
+ nErr : ERRCODE_IO_PENDING;
+ }
+ }
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer,
+ ULONG nCount, ULONG *pWritten )
+{
+ if( bTerminated )
+ return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten );
+ else
+ {
+ ULONG nWanted = nPos + nCount;
+ if( IsSynchronMode() )
+ {
+ while( nWanted > nFilledSize && !bTerminated )
+ Application::Yield();
+ return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten );
+ }
+ else
+ {
+ ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos );
+ ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten );
+ return ( !nCount || nRead == nCount || nErr ) ?
+ nErr : ERRCODE_IO_PENDING;
+ }
+ }
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::Flush() const
+{
+ return xLockBytes->Flush( );
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::SetSize( ULONG nSize )
+{
+ return xLockBytes->SetSize( nSize );
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType)
+{
+ return xLockBytes->LockRegion( nPos, nCount, eType );
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::UnlockRegion(
+ ULONG nPos, ULONG nCount, LockType eType)
+{
+ return xLockBytes->UnlockRegion( nPos, nCount, eType );
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::Stat(
+ SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const
+{
+ return xLockBytes->Stat( pStat, eFlag );
+}
+
+//============================================================================
+ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten )
+{
+ ErrCode nRet = xLockBytes->WriteAt(
+ nFilledSize, pBuffer, nCount, pWritten );
+ nFilledSize += *pWritten;
+ return nRet;
+}
+
+//============================================================================
+void SvFillLockBytes::Terminate()
+{
+ bTerminated = TRUE;
+}
+
+//============================================================================
+SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* )
+
+//============================================================================
+//
+// SvSyncLockBytes
+//
+//============================================================================
+
+TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes);
+
+//============================================================================
+// virtual
+ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
+ ULONG * pRead) const
+{
+ for (ULONG nReadTotal = 0;;)
+ {
+ ULONG nReadCount = 0;
+ ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount,
+ &nReadCount);
+ nReadTotal += nReadCount;
+ if (nError != ERRCODE_IO_PENDING || !IsSynchronMode())
+ {
+ if (pRead)
+ *pRead = nReadTotal;
+ return nError;
+ }
+ nPos += nReadCount;
+ pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount;
+ nCount -= nReadCount;
+ Application::Yield();
+ }
+}
+
+//============================================================================
+// virtual
+ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer,
+ ULONG nCount, ULONG * pWritten)
+{
+ for (ULONG nWrittenTotal = 0;;)
+ {
+ ULONG nWrittenCount = 0;
+ ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount,
+ &nWrittenCount);
+ nWrittenTotal += nWrittenCount;
+ if (nError != ERRCODE_IO_PENDING || !IsSynchronMode())
+ {
+ if (pWritten)
+ *pWritten = nWrittenTotal;
+ return nError;
+ }
+ nPos += nWrittenCount;
+ pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount;
+ nCount -= nWrittenCount;
+ Application::Yield();
+ }
+}
+
+//============================================================================
+//
+// SvCompositeLockBytes
+//
+//============================================================================
+
+struct SvCompositeLockBytes_Impl
+{
+ SvLockBytesMemberList aLockBytes;
+ SvULongs aPositions;
+ SvULongs aOffsets;
+ BOOL bPending;
+ ULONG RelativeOffset( ULONG nPos ) const;
+ ErrCode ReadWrite_Impl(
+ ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed,
+ BOOL bRead );
+ SvCompositeLockBytes_Impl() : bPending( FALSE ){}
+};
+
+//============================================================================
+ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const
+{
+ const SvULongs& rPositions = aPositions;
+ const SvULongs& rOffsets = aOffsets;
+
+ USHORT nMinPos = 0;
+ USHORT nListCount = rPositions.Count();
+
+ // Erster Lockbytes, der bearbeitet werden muss
+ while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos )
+ nMinPos ++;
+ ULONG nSectionStart = rPositions[ nMinPos ];
+ if( nSectionStart > nPos )
+ return ULONG_MAX;
+ return rOffsets[ nMinPos ] + nPos - nSectionStart;
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl(
+ ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed,
+ BOOL bRead )
+{
+ ErrCode nErr = ERRCODE_NONE;
+ SvULongs& rPositions = aPositions;
+ SvULongs& rOffsets = aOffsets;
+ SvLockBytesMemberList& rLockBytes = aLockBytes;
+
+ ULONG nBytes = nCount;
+ USHORT nListCount = rPositions.Count();
+ USHORT nMinPos = 0;
+
+ // Erster Lockbytes, der bearbeitet werden muss
+ while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos )
+ nMinPos ++;
+ ULONG nSectionStart = rPositions[ nMinPos ];
+
+ if( nSectionStart > nPos )
+ {
+ // Es wird aus fuehrendem Leerbereich gearbeitet
+ *pProcessed = 0;
+ return ERRCODE_IO_CANTREAD;
+ }
+
+ ULONG nDone;
+ while( nMinPos < nListCount )
+ {
+ ULONG nToProcess;
+ ULONG nSectionStop;
+ if( nMinPos + 1 < nListCount )
+ {
+ nSectionStop = rPositions[ nMinPos + 1 ];
+ nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes );
+ }
+ else
+ {
+ nToProcess = nBytes;
+ nSectionStop = 0;
+ }
+ ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ];
+ SvLockBytes* pLB = rLockBytes.GetObject( nMinPos );
+ if( bRead )
+ nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone );
+ else
+ nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone );
+ nBytes -= nDone;
+ if( nErr || nDone < nToProcess || !nBytes )
+ {
+ *pProcessed = nCount - nBytes;
+ // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und
+ // bPending gesetzt ist, Pending zurueck
+ if( !nDone && nMinPos == nListCount - 1 )
+ return bPending ? ERRCODE_IO_PENDING : nErr;
+ else return nErr;
+ }
+ pBuffer = static_cast< sal_Char * >(pBuffer) + nDone;
+ nPos += nDone;
+ nSectionStart = nSectionStop;
+ nMinPos++;
+ }
+ return nErr;
+}
+
+//============================================================================
+TYPEINIT1(SvCompositeLockBytes, SvLockBytes);
+
+//============================================================================
+SvCompositeLockBytes::SvCompositeLockBytes()
+ : pImpl( new SvCompositeLockBytes_Impl )
+{
+}
+
+//============================================================================
+SvCompositeLockBytes::~SvCompositeLockBytes()
+{
+ delete pImpl;
+}
+
+//============================================================================
+void SvCompositeLockBytes::SetIsPending( BOOL bSet )
+{
+ pImpl->bPending = bSet;
+}
+
+//============================================================================
+ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const
+{
+ return pImpl->RelativeOffset( nPos );
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::ReadAt(
+ ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const
+{
+ return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE );
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::WriteAt(
+ ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten )
+{
+ return pImpl->ReadWrite_Impl(
+ nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE );
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::Flush() const
+{
+ SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes;
+ ErrCode nErr = ERRCODE_NONE;
+ for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; )
+ nErr = rLockBytes.GetObject( nCount )->Flush();
+ return nErr;
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::SetSize( ULONG nSize )
+{
+ DBG_ERROR( "not implemented" );
+ return ERRCODE_IO_NOTSUPPORTED;
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType )
+{
+ DBG_ERROR( "not implemented" );
+ return ERRCODE_IO_NOTSUPPORTED;
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::UnlockRegion(
+ ULONG nPos, ULONG nCount, LockType )
+{
+ DBG_ERROR( "not implemented" );
+ return ERRCODE_IO_NOTSUPPORTED;
+}
+
+//============================================================================
+ErrCode SvCompositeLockBytes::Stat(
+ SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const
+{
+ USHORT nMax = pImpl->aPositions.Count() - 1;
+
+ SvLockBytesStat aStat;
+ ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag );
+ pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize;
+
+ return nErr;
+}
+
+//============================================================================
+void SvCompositeLockBytes::Append(
+ SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset )
+{
+ USHORT nCount = pImpl->aOffsets.Count();
+ pImpl->aLockBytes.Insert( pLockBytes, nCount );
+ pImpl->aPositions.Insert( nPos, nCount );
+ pImpl->aOffsets.Insert( nOffset, nCount );
+}
+
+//============================================================================
+SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const
+{
+ return pImpl->aLockBytes.Count() ?
+ pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0;
+}
+
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
new file mode 100644
index 000000000000..9e77fdecd60d
--- /dev/null
+++ b/svtools/source/misc/imap.cxx
@@ -0,0 +1,1426 @@
+/*************************************************************************
+ *
+ * $RCSfile: imap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <math.h>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/window.hxx>
+
+#include "urihelper.hxx"
+#include "imap.hxx"
+#include "imapobj.hxx"
+#include "imapcirc.hxx"
+#include "imaprect.hxx"
+#include "imappoly.hxx"
+
+
+DBG_NAME( ImageMap );
+
+
+#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).X()=((aPT).X()*(aFracX).GetNumerator())/(aFracX).GetDenominator(); \
+ (aPT).Y()=((aPT).Y()*(aFracY).GetNumerator())/(aFracY).GetDenominator();
+
+
+/******************************************************************************/
+
+UINT16 IMapObject::nActualTextEncoding = (UINT16) RTL_TEXTENCODING_DONTKNOW;
+
+/******************************************************************************/
+
+
+#ifdef WIN
+#pragma optimize ( "", off )
+#endif
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapObject::IMapObject( const String& rURL, const String& rDescription, BOOL bURLActive ) :
+ aURL ( rURL ),
+ aDescription ( rDescription ),
+ bActive ( bURLActive )
+{
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapObject::IMapObject( const String& rURL, const String& rDescription,
+ const String& rTarget, BOOL bURLActive ) :
+ aURL ( rURL ),
+ aDescription ( rDescription ),
+ aTarget ( rTarget ),
+ bActive ( bURLActive )
+{
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapObject::IMapObject( const String& rURL, const String& rDescription,
+ const String& rTarget, const String& rName, BOOL bURLActive ) :
+ aURL ( rURL ),
+ aDescription ( rDescription ),
+ aTarget ( rTarget ),
+ aName ( rName ),
+ bActive ( bURLActive )
+{
+}
+
+
+/******************************************************************************
+|*
+|* Freigabe des internen Speichers
+|*
+\******************************************************************************/
+
+UINT16 IMapObject::GetVersion() const
+{
+ return IMAP_OBJ_VERSION;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+SvStream& operator<<( SvStream& rOStm, const IMapObject& rObj )
+{
+ IMapCompat* pCompat;
+ const rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
+
+ rOStm << rObj.GetType();
+ rOStm << rObj.GetVersion();
+ rOStm << ( (UINT16) eEncoding );
+
+ const ByteString aRelURL( INetURLObject::AbsToRel( rObj.aURL, INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ), eEncoding );
+ rOStm.WriteByteString( aRelURL );
+ rOStm.WriteByteString( ByteString( rObj.aDescription, eEncoding ) );
+ rOStm << rObj.bActive;
+ rOStm.WriteByteString( ByteString( rObj.aTarget, eEncoding ) );
+
+ pCompat = new IMapCompat( rOStm, STREAM_WRITE );
+
+ rObj.WriteIMapObject( rOStm );
+ rObj.aEventList.Write( rOStm ); // V4
+ rOStm.WriteByteString( ByteString( rObj.aName, eEncoding ) ); // V5
+
+ delete pCompat;
+
+ return rOStm;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Import
+|*
+\******************************************************************************/
+
+SvStream& operator>>( SvStream& rIStm, IMapObject& rObj )
+{
+ IMapCompat* pCompat;
+ rtl_TextEncoding nTextEncoding;
+ ByteString aString;
+
+ // Typ und Version ueberlesen wir
+ rIStm.SeekRel( 2 );
+ rIStm >> rObj.nReadVersion;
+ rIStm >> nTextEncoding;
+ rIStm.ReadByteString( aString ); rObj.aURL = String( aString.GetBuffer(), nTextEncoding );
+ rIStm.ReadByteString( aString ); rObj.aDescription = String( aString.GetBuffer(), nTextEncoding );
+ rIStm >> rObj.bActive;
+ rIStm.ReadByteString( aString ); rObj.aTarget = String( aString.GetBuffer(), nTextEncoding );
+
+ // URL absolut machen
+ rObj.aURL = URIHelper::SmartRelToAbs( rObj.aURL, FALSE, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS );
+ pCompat = new IMapCompat( rIStm, STREAM_READ );
+
+ rObj.ReadIMapObject( rIStm );
+
+ // ab Version 4 lesen wir eine EventListe
+ if ( rObj.nReadVersion >= 0x0004 )
+ {
+ rObj.aEventList.Read(rIStm);
+
+ // ab Version 5 kann ein Objektname vorhanden sein
+ if ( rObj.nReadVersion >= 0x0005 )
+ {
+ rIStm.ReadByteString( aString ); rObj.aName = String( aString.GetBuffer(), nTextEncoding );
+ }
+ }
+
+ delete pCompat;
+
+ return rIStm;
+}
+
+
+/******************************************************************************
+|*
+|* Konvertierung der logischen Koordianten in Pixel
+|*
+\******************************************************************************/
+
+Point IMapObject::GetPixelPoint( const Point& rLogPoint )
+{
+ return Application::GetDefaultDevice()->LogicToPixel( rLogPoint, MapMode( MAP_100TH_MM ) );
+}
+
+
+/******************************************************************************
+|*
+|* Konvertierung der logischen Koordianten in Pixel
+|*
+\******************************************************************************/
+
+Point IMapObject::GetLogPoint( const Point& rPixelPoint )
+{
+ return Application::GetDefaultDevice()->PixelToLogic( rPixelPoint, MapMode( MAP_100TH_MM ) );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+BOOL IMapObject::IsEqual( const IMapObject& rEqObj )
+{
+ return ( ( aURL == rEqObj.aURL ) &&
+ ( aDescription == rEqObj.aDescription ) &&
+ ( aTarget == rEqObj.aTarget ) &&
+ ( aName == rEqObj.aName ) &&
+ ( bActive == rEqObj.bActive ) );
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapRectangleObject::IMapRectangleObject( const Rectangle& rRect,
+ const String& rURL,
+ const String& rDescription,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, bURLActive )
+{
+ ImpConstruct( rRect, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapRectangleObject::IMapRectangleObject( const Rectangle& rRect,
+ const String& rURL,
+ const String& rDescription,
+ const String& rTarget,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, rTarget, bURLActive )
+{
+ ImpConstruct( rRect, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapRectangleObject::IMapRectangleObject( const Rectangle& rRect,
+ const String& rURL,
+ const String& rDescription,
+ const String& rTarget,
+ const String& rName,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, rTarget, rName, bURLActive )
+{
+ ImpConstruct( rRect, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapRectangleObject::ImpConstruct( const Rectangle& rRect, BOOL bPixel )
+{
+ if ( bPixel )
+ aRect = Application::GetDefaultDevice()->PixelToLogic( rRect, MapMode( MAP_100TH_MM ) );
+ else
+ aRect = rRect;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Export
+|*
+\******************************************************************************/
+
+void IMapRectangleObject::WriteIMapObject( SvStream& rOStm ) const
+{
+ rOStm << aRect;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Import
+|*
+\******************************************************************************/
+
+void IMapRectangleObject::ReadIMapObject( SvStream& rIStm )
+{
+ rIStm >> aRect;
+}
+
+
+/******************************************************************************
+|*
+|* Typ-Rueckgabe
+|*
+\******************************************************************************/
+
+UINT16 IMapRectangleObject::GetType() const
+{
+ return IMAP_OBJ_RECTANGLE;
+}
+
+
+/******************************************************************************
+|*
+|* Hit-Test
+|*
+\******************************************************************************/
+
+BOOL IMapRectangleObject::IsHit( const Point& rPoint ) const
+{
+ return aRect.IsInside( rPoint );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Rectangle IMapRectangleObject::GetRectangle( BOOL bPixelCoords ) const
+{
+ Rectangle aNewRect;
+
+ if ( bPixelCoords )
+ aNewRect = Application::GetDefaultDevice()->LogicToPixel( aRect, MapMode( MAP_100TH_MM ) );
+ else
+ aNewRect = aRect;
+
+ return aNewRect;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapRectangleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
+{
+ Point aTL( aRect.TopLeft() );
+ Point aBR( aRect.BottomRight() );
+
+ if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
+ {
+ SCALEPOINT( aTL, rFracX, rFracY );
+ SCALEPOINT( aBR, rFracX, rFracY );
+ }
+
+ aRect = Rectangle( aTL, aBR );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+BOOL IMapRectangleObject::IsEqual( const IMapRectangleObject& rEqObj )
+{
+ return ( IMapObject::IsEqual( rEqObj ) && ( aRect == rEqObj.aRect ) );
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapCircleObject::IMapCircleObject( const Point& rCenter, ULONG nCircleRadius,
+ const String& rURL,
+ const String& rDescription,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, bURLActive )
+{
+ ImpConstruct( rCenter, nCircleRadius, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapCircleObject::IMapCircleObject( const Point& rCenter, ULONG nCircleRadius,
+ const String& rURL,
+ const String& rDescription,
+ const String& rTarget,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, rTarget, bURLActive )
+{
+ ImpConstruct( rCenter, nCircleRadius, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapCircleObject::IMapCircleObject( const Point& rCenter, ULONG nCircleRadius,
+ const String& rURL,
+ const String& rDescription,
+ const String& rTarget,
+ const String& rName,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, rTarget, rName, bURLActive )
+{
+ ImpConstruct( rCenter, nCircleRadius, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapCircleObject::ImpConstruct( const Point& rCenter, ULONG nRad, BOOL bPixel )
+{
+ if ( bPixel )
+ {
+ MapMode aMap100( MAP_100TH_MM );
+
+ aCenter = Application::GetDefaultDevice()->PixelToLogic( rCenter, aMap100 );
+ nRadius = Application::GetDefaultDevice()->PixelToLogic( Size( nRad, 0 ), aMap100 ).Width();
+ }
+ else
+ {
+ aCenter = rCenter;
+ nRadius = nRad;
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Export
+|*
+\******************************************************************************/
+
+void IMapCircleObject::WriteIMapObject( SvStream& rOStm ) const
+{
+ UINT32 nTmp = nRadius;
+
+ rOStm << aCenter;
+ rOStm << nTmp;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Import
+|*
+\******************************************************************************/
+
+void IMapCircleObject::ReadIMapObject( SvStream& rIStm )
+{
+ UINT32 nTmp;
+
+ rIStm >> aCenter;
+ rIStm >> nTmp;
+
+ nRadius = nTmp;
+}
+
+
+/******************************************************************************
+|*
+|* Typ-Rueckgabe
+|*
+\******************************************************************************/
+
+UINT16 IMapCircleObject::GetType() const
+{
+ return IMAP_OBJ_CIRCLE;
+}
+
+
+/******************************************************************************
+|*
+|* Hit-Test
+|*
+\******************************************************************************/
+
+BOOL IMapCircleObject::IsHit( const Point& rPoint ) const
+{
+ const Point aPoint( aCenter - rPoint );
+ BOOL bRet = FALSE;
+
+ if ( (ULONG) sqrt( (double) aPoint.X() * aPoint.X() +
+ aPoint.Y() * aPoint.Y() ) <= nRadius )
+ {
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Point IMapCircleObject::GetCenter( BOOL bPixelCoords ) const
+{
+ Point aNewPoint;
+
+ if ( bPixelCoords )
+ aNewPoint = Application::GetDefaultDevice()->LogicToPixel( aCenter, MapMode( MAP_100TH_MM ) );
+ else
+ aNewPoint = aCenter;
+
+ return aNewPoint;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+ULONG IMapCircleObject::GetRadius( BOOL bPixelCoords ) const
+{
+ ULONG nNewRadius;
+
+ if ( bPixelCoords )
+ nNewRadius = Application::GetDefaultDevice()->LogicToPixel( Size( nRadius, 0 ), MapMode( MAP_100TH_MM ) ).Width();
+ else
+ nNewRadius = nRadius;
+
+ return nNewRadius;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Rectangle IMapCircleObject::GetBoundRect() const
+{
+ long nWidth = nRadius << 1;
+
+ return Rectangle( Point( aCenter.X() - nRadius, aCenter.Y() - nRadius ),
+ Size( nWidth, nWidth ) );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
+{
+ Fraction aAverage( rFracX );
+
+ aAverage += rFracY;
+ aAverage *= Fraction( 1, 2 );
+
+ if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
+ {
+ SCALEPOINT( aCenter, rFracX, rFracY );
+ }
+
+ nRadius = ( nRadius * aAverage.GetNumerator() ) / aAverage.GetDenominator();
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+BOOL IMapCircleObject::IsEqual( const IMapCircleObject& rEqObj )
+{
+ return ( IMapObject::IsEqual( rEqObj ) &&
+ ( aCenter == rEqObj.aCenter ) &&
+ ( nRadius == rEqObj.nRadius ) );
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapPolygonObject::IMapPolygonObject( const Polygon& rPoly,
+ const String& rURL,
+ const String& rDescription,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, bURLActive ),
+ bEllipse ( FALSE )
+{
+ ImpConstruct( rPoly, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapPolygonObject::IMapPolygonObject( const Polygon& rPoly,
+ const String& rURL,
+ const String& rDescription,
+ const String& rTarget,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, rTarget, bURLActive ),
+ bEllipse ( FALSE )
+{
+ ImpConstruct( rPoly, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapPolygonObject::IMapPolygonObject( const Polygon& rPoly,
+ const String& rURL,
+ const String& rDescription,
+ const String& rTarget,
+ const String& rName,
+ BOOL bURLActive,
+ BOOL bPixelCoords ) :
+ IMapObject ( rURL, rDescription, rTarget, rName, bURLActive ),
+ bEllipse ( FALSE )
+{
+ ImpConstruct( rPoly, bPixelCoords );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::ImpConstruct( const Polygon& rPoly, BOOL bPixel )
+{
+ if ( bPixel )
+ aPoly = Application::GetDefaultDevice()->PixelToLogic( rPoly, MapMode( MAP_100TH_MM ) );
+ else
+ aPoly = rPoly;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Export
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::WriteIMapObject( SvStream& rOStm ) const
+{
+ rOStm << aPoly;
+ rOStm << bEllipse; // >= Version 2
+ rOStm << aEllipse; // >= Version 2
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Import
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::ReadIMapObject( SvStream& rIStm )
+{
+ rIStm >> aPoly;
+
+ // Version >= 2 hat zusaetzlich Ellipsen-Information
+ if ( nReadVersion >= 2 )
+ {
+ rIStm >> bEllipse;
+ rIStm >> aEllipse;
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Typ-Rueckgabe
+|*
+\******************************************************************************/
+
+UINT16 IMapPolygonObject::GetType() const
+{
+ return IMAP_OBJ_POLYGON;
+}
+
+
+/******************************************************************************
+|*
+|* Hit-Test
+|*
+\******************************************************************************/
+
+BOOL IMapPolygonObject::IsHit( const Point& rPoint ) const
+{
+ return aPoly.IsInside( rPoint );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Polygon IMapPolygonObject::GetPolygon( BOOL bPixelCoords ) const
+{
+ Polygon aNewPoly;
+
+ if ( bPixelCoords )
+ aNewPoly = Application::GetDefaultDevice()->LogicToPixel( aPoly, MapMode( MAP_100TH_MM ) );
+ else
+ aNewPoly = aPoly;
+
+ return aNewPoly;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::SetExtraEllipse( const Rectangle& rEllipse )
+{
+ if ( aPoly.GetSize() )
+ {
+ bEllipse = TRUE;
+ aEllipse = rEllipse;
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
+{
+ USHORT nCount = aPoly.GetSize();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ Point aScaledPt( aPoly[ i ] );
+
+ if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
+ {
+ SCALEPOINT( aScaledPt, rFracX, rFracY );
+ }
+
+ aPoly[ i ] = aScaledPt;
+ }
+
+ if ( bEllipse )
+ {
+ Point aTL( aEllipse.TopLeft() );
+ Point aBR( aEllipse.BottomRight() );
+
+ if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
+ {
+ SCALEPOINT( aTL, rFracX, rFracY );
+ SCALEPOINT( aBR, rFracX, rFracY );
+ }
+
+ aEllipse = Rectangle( aTL, aBR );
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+BOOL IMapPolygonObject::IsEqual( const IMapPolygonObject& rEqObj )
+{
+ BOOL bRet = FALSE;
+
+ if ( IMapObject::IsEqual( rEqObj ) )
+ {
+ const Polygon& rEqPoly = rEqObj.aPoly;
+ const USHORT nCount = aPoly.GetSize();
+ const USHORT nEqCount = rEqPoly.GetSize();
+ BOOL bDifferent = FALSE;
+
+ if ( nCount == nEqCount )
+ {
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ if ( aPoly[ i ] != rEqPoly[ i ] )
+ {
+ bDifferent = TRUE;
+ break;
+ }
+ }
+
+ if ( !bDifferent )
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+ImageMap::ImageMap( const String& rName ) :
+ aName ( rName )
+{
+}
+
+
+/******************************************************************************
+|*
+|* Copy-Ctor
+|*
+\******************************************************************************/
+
+ImageMap::ImageMap( const ImageMap& rImageMap )
+{
+ DBG_CTOR( ImageMap, NULL );
+
+ USHORT nCount = rImageMap.GetIMapObjectCount();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ IMapObject* pCopyObj = rImageMap.GetIMapObject( i );
+
+ switch( pCopyObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND );
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND );
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND );
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ aName = rImageMap.aName;
+}
+
+
+/******************************************************************************
+|*
+|* Dtor
+|*
+\******************************************************************************/
+
+ImageMap::~ImageMap()
+{
+ DBG_DTOR( ImageMap, NULL );
+
+ ClearImageMap();
+}
+
+
+/******************************************************************************
+|*
+|* Freigabe des internen Speichers
+|*
+\******************************************************************************/
+
+void ImageMap::ClearImageMap()
+{
+ IMapObject* pObj = (IMapObject*) maList.First();
+
+ while ( pObj )
+ {
+ delete pObj;
+ pObj = (IMapObject*) maList.Next();
+ }
+
+ maList.Clear();
+
+ aName = String();
+}
+
+
+/******************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\******************************************************************************/
+
+ImageMap& ImageMap::operator=( const ImageMap& rImageMap )
+{
+ USHORT nCount = rImageMap.GetIMapObjectCount();
+
+ ClearImageMap();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ IMapObject* pCopyObj = rImageMap.GetIMapObject( i );
+
+ switch( pCopyObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND );
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND );
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND );
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ aName = rImageMap.aName;
+
+ return *this;
+}
+
+
+/******************************************************************************
+|*
+|* Vergleichsoperator I
+|*
+\******************************************************************************/
+
+BOOL ImageMap::operator==( const ImageMap& rImageMap )
+{
+ const USHORT nCount = (USHORT) maList.Count();
+ const USHORT nEqCount = rImageMap.GetIMapObjectCount();
+ BOOL bRet = FALSE;
+
+ if ( nCount == nEqCount )
+ {
+ BOOL bDifferent = ( aName != rImageMap.aName );
+
+ for ( USHORT i = 0; ( i < nCount ) && !bDifferent; i++ )
+ {
+ IMapObject* pObj = (IMapObject*) maList.GetObject( i );
+ IMapObject* pEqObj = rImageMap.GetIMapObject( i );
+
+ if ( pObj->GetType() == pEqObj->GetType() )
+ {
+ switch( pObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ {
+ if ( !( (IMapRectangleObject*) pObj )->IsEqual( *(IMapRectangleObject*) pEqObj ) )
+ bDifferent = TRUE;
+ }
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ {
+ if ( !( (IMapCircleObject*) pObj )->IsEqual( *(IMapCircleObject*) pEqObj ) )
+ bDifferent = TRUE;
+ }
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ {
+ if ( !( (IMapPolygonObject*) pObj )->IsEqual( *(IMapPolygonObject*) pEqObj ) )
+ bDifferent = TRUE;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ bDifferent = TRUE;
+ }
+
+ if ( !bDifferent )
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+
+/******************************************************************************
+|*
+|* Vergleichsoperator II
+|*
+\******************************************************************************/
+
+BOOL ImageMap::operator!=( const ImageMap& rImageMap )
+{
+ return !( *this == rImageMap );
+}
+
+
+/******************************************************************************
+|*
+|* Freigabe des internen Speichers
+|*
+\******************************************************************************/
+
+UINT16 ImageMap::GetVersion() const
+{
+ return IMAGE_MAP_VERSION;
+}
+
+
+/******************************************************************************
+|*
+|* Einfuegen eines neuen Objekts
+|*
+\******************************************************************************/
+
+void ImageMap::InsertIMapObject( const IMapObject& rIMapObject )
+{
+ switch( rIMapObject.GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ maList.Insert( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ), LIST_APPEND );
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ maList.Insert( new IMapCircleObject( (IMapCircleObject&) rIMapObject ), LIST_APPEND );
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ maList.Insert( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ), LIST_APPEND );
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Hit-Test
+|*
+\******************************************************************************/
+
+IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
+ const Size& rDisplaySize,
+ const Point& rRelHitPoint,
+ ULONG nFlags )
+{
+ Point aRelPoint( rTotalSize.Width() * rRelHitPoint.X() / rDisplaySize.Width(),
+ rTotalSize.Height() * rRelHitPoint.Y() / rDisplaySize.Height() );
+
+ // Falls Flags zur Spiegelung etc. angegeben sind, wird
+ // der zu pruefende Punkt vor der Pruefung entspr. transformiert
+ if ( nFlags )
+ {
+ if ( nFlags & IMAP_MIRROR_HORZ )
+ aRelPoint.X() = rTotalSize.Width() - aRelPoint.X();
+
+ if ( nFlags & IMAP_MIRROR_VERT )
+ aRelPoint.Y() = rTotalSize.Height() - aRelPoint.Y();
+ }
+
+ // Alle Objekte durchlaufen und HitTest ausfuehren
+ IMapObject* pObj = (IMapObject*) maList.First();
+ while ( pObj )
+ {
+ if ( pObj->IsHit( aRelPoint ) )
+ break;
+
+ pObj = (IMapObject*) maList.Next();
+ }
+
+ return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Rectangle ImageMap::GetBoundRect() const
+{
+ Rectangle aBoundRect;
+ ULONG nCount = maList.Count();
+
+ for ( ULONG i = 0; i < nCount; i++ )
+ aBoundRect.Union( ( (IMapObject*) maList.GetObject( i ) )->GetBoundRect() );
+
+ return aBoundRect;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY )
+{
+ USHORT nCount = (USHORT) maList.Count();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ IMapObject* pObj = GetIMapObject( i );
+
+ switch( pObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ ( (IMapRectangleObject*) pObj )->Scale( rFracX, rFracY );
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ ( (IMapCircleObject*) pObj )->Scale( rFracX, rFracY );
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ ( (IMapPolygonObject*) pObj )->Scale( rFracX, rFracY );
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Objekte nacheinander wegschreiben
+|*
+\******************************************************************************/
+
+void ImageMap::ImpWriteImageMap( SvStream& rOStm ) const
+{
+ IMapObject* pObj;
+ USHORT nCount = (USHORT) maList.Count();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ pObj = (IMapObject*) maList.GetObject( i );
+ rOStm << *pObj;
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Objekte nacheinander lesen
+|*
+\******************************************************************************/
+
+void ImageMap::ImpReadImageMap( SvStream& rIStm, USHORT nCount )
+{
+ // neue Objekte einlesen
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ UINT16 nType;
+
+ rIStm >> nType;
+ rIStm.SeekRel( -2 );
+
+ switch( nType )
+ {
+ case ( IMAP_OBJ_RECTANGLE ):
+ {
+ IMapRectangleObject* pObj = new IMapRectangleObject;
+ rIStm >> *pObj;
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ break;
+
+ case ( IMAP_OBJ_CIRCLE ):
+ {
+ IMapCircleObject* pObj = new IMapCircleObject;
+ rIStm >> *pObj;
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ break;
+
+ case ( IMAP_OBJ_POLYGON ):
+ {
+ IMapPolygonObject* pObj = new IMapPolygonObject;
+ rIStm >> *pObj;
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Binaer speichern
+|*
+\******************************************************************************/
+
+SvStream& operator<<( SvStream& rOStm, const ImageMap& rImageMap )
+{
+ IMapCompat* pCompat;
+ String aName( rImageMap.GetName() );
+ String aDummy;
+ USHORT nOldFormat = rOStm.GetNumberFormatInt();
+ UINT16 nCount = (UINT16) rImageMap.GetIMapObjectCount();
+ const rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
+
+ rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // MagicCode schreiben
+ rOStm << IMAPMAGIC;
+ rOStm << rImageMap.GetVersion();
+ rOStm.WriteByteString( ByteString( aName, eEncoding ) );
+ rOStm.WriteByteString( ByteString( aDummy, eEncoding ) );
+ rOStm << nCount;
+ rOStm.WriteByteString( ByteString( aName, eEncoding ) );
+
+ pCompat = new IMapCompat( rOStm, STREAM_WRITE );
+
+ // hier kann in neueren Versionen eingefuegt werden
+
+ delete pCompat;
+
+ rImageMap.ImpWriteImageMap( rOStm );
+
+ rOStm.SetNumberFormatInt( nOldFormat );
+
+ return rOStm;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer laden
+|*
+\******************************************************************************/
+
+SvStream& operator>>( SvStream& rIStm, ImageMap& rImageMap )
+{
+ ByteString aString;
+ char cMagic[6];
+ USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ UINT16 nCount;
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rIStm.Read( cMagic, sizeof( cMagic ) );
+
+ if ( !memcmp( cMagic, IMAPMAGIC, sizeof( cMagic ) ) )
+ {
+ IMapCompat* pCompat;
+
+ // alten Inhalt loeschen
+ rImageMap.ClearImageMap();
+
+ // Version ueberlesen wir
+ rIStm.SeekRel( 2 );
+
+ rIStm.ReadByteString( aString ); rImageMap.aName = String( aString, gsl_getSystemTextEncoding() );
+ rIStm.ReadByteString( aString ); // Dummy
+ rIStm >> nCount;
+ rIStm.ReadByteString( aString ); // Dummy
+
+ pCompat = new IMapCompat( rIStm, STREAM_READ );
+
+ // hier kann in neueren Versionen gelesen werden
+
+ delete pCompat;
+ rImageMap.ImpReadImageMap( rIStm, nCount );
+
+ }
+ else
+ rIStm.SetError( SVSTREAM_GENERALERROR );
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+
+ return rIStm;
+}
+
+
+#ifdef WIN
+#pragma optimize ( "", on )
+#endif
+
+
diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx
new file mode 100644
index 000000000000..61acdadbc1a3
--- /dev/null
+++ b/svtools/source/misc/imap2.cxx
@@ -0,0 +1,934 @@
+/*************************************************************************
+ *
+ * $RCSfile: imap2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WIN
+#include <sysdep.hxx>
+#endif
+#include <string.h>
+#include <math.h>
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _URLOBJ_HXX //autogen
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+#ifndef _CLIP_HXX //autogen
+#include <vcl/clip.hxx>
+#endif
+#ifndef _DRAG_HXX //autogen
+#include <vcl/drag.hxx>
+#endif
+#ifndef _SOT_FORMATS_HXX //autogen
+#include <sot/formats.hxx>
+#endif
+
+#include "imap.hxx"
+#include "imap.hxx"
+#include "imapobj.hxx"
+#include "imaprect.hxx"
+#include "imapcirc.hxx"
+#include "imappoly.hxx"
+
+#define OUT_DEV() (Application::GetDefaultDevice())
+#define NOTEOL(c) ((c)!='\0')
+
+
+TYPEINIT1_AUTOFACTORY( ImageMap, SvDataCopyStream );
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapObject::AppendCERNCoords( const Point& rPoint100, ByteString& rStr ) const
+{
+ const Point aPixPt( OUT_DEV()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) );
+
+ rStr += '(';
+ rStr += ByteString::CreateFromInt32( aPixPt.X() );
+ rStr += ',';
+ rStr += ByteString::CreateFromInt32( aPixPt.Y() );
+ rStr += ") ";
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapObject::AppendNCSACoords( const Point& rPoint100, ByteString& rStr ) const
+{
+ const Point aPixPt( OUT_DEV()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) );
+
+ rStr += ByteString::CreateFromInt32( aPixPt.X() );
+ rStr += ',';
+ rStr += ByteString::CreateFromInt32( aPixPt.Y() );
+ rStr += ' ';
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapObject::AppendCERNURL( ByteString& rStr ) const
+{
+ rStr += ByteString( INetURLObject::AbsToRel( aURL,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ), gsl_getSystemTextEncoding() );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapObject::AppendNCSAURL( ByteString& rStr ) const
+{
+ rStr += ByteString( INetURLObject::AbsToRel( aURL,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ), gsl_getSystemTextEncoding() );
+ rStr += ' ';
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapRectangleObject::WriteCERN( SvStream& rOStm ) const
+{
+ ByteString aStr( "rectangle " );
+
+ AppendCERNCoords( aRect.TopLeft(), aStr );
+ AppendCERNCoords( aRect.BottomRight(), aStr );
+ AppendCERNURL( aStr );
+
+ rOStm.WriteLine( aStr );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapRectangleObject::WriteNCSA( SvStream& rOStm ) const
+{
+ ByteString aStr( "rect " );
+
+ AppendNCSAURL( aStr );
+ AppendNCSACoords( aRect.TopLeft(), aStr );
+ AppendNCSACoords( aRect.BottomRight(), aStr );
+
+ rOStm.WriteLine( aStr );
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapCircleObject::WriteCERN( SvStream& rOStm ) const
+{
+ ByteString aStr( "circle " );
+
+ AppendCERNCoords( aCenter, aStr );
+ aStr += nRadius;
+ aStr += ' ';
+ AppendCERNURL( aStr );
+
+ rOStm.WriteLine( aStr );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapCircleObject::WriteNCSA( SvStream& rOStm ) const
+{
+ ByteString aStr( "circle " );
+
+ AppendNCSAURL( aStr );
+ AppendNCSACoords( aCenter, aStr );
+ AppendNCSACoords( aCenter + Point( nRadius, 0 ), aStr );
+
+ rOStm.WriteLine( aStr );
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::WriteCERN( SvStream& rOStm ) const
+{
+ ByteString aStr( "polygon " );
+ const USHORT nCount = aPoly.GetSize();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ AppendCERNCoords( aPoly[ i ], aStr );
+
+ AppendCERNURL( aStr );
+
+ rOStm.WriteLine( aStr );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void IMapPolygonObject::WriteNCSA( SvStream& rOStm ) const
+{
+ ByteString aStr( "poly " );
+ const USHORT nCount = Min( aPoly.GetSize(), (USHORT) 100 );
+
+ AppendNCSAURL( aStr );
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ AppendNCSACoords( aPoly[ i ], aStr );
+
+ rOStm.WriteLine( aStr );
+}
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::Write( SvStream& rOStm, ULONG nFormat ) const
+{
+ switch( nFormat )
+ {
+ case( IMAP_FORMAT_BIN ) : rOStm << *this; break;
+ case( IMAP_FORMAT_CERN ) : ImpWriteCERN( rOStm ); break;
+ case( IMAP_FORMAT_NCSA ) : ImpWriteNCSA( rOStm ); break;
+
+ default:
+ break;
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::ImpWriteCERN( SvStream& rOStm ) const
+{
+ IMapObject* pObj;
+ USHORT nCount = (USHORT) maList.Count();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ pObj = GetIMapObject( i );
+
+ switch( pObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ ( (IMapRectangleObject*) pObj )->WriteCERN( rOStm );
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ ( (IMapCircleObject*) pObj )->WriteCERN( rOStm );
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ ( (IMapPolygonObject*) pObj )->WriteCERN( rOStm);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::ImpWriteNCSA( SvStream& rOStm ) const
+{
+ IMapObject* pObj;
+ USHORT nCount = (USHORT) maList.Count();
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ pObj = GetIMapObject( i );
+
+ switch( pObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ ( (IMapRectangleObject*) pObj )->WriteNCSA( rOStm );
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ ( (IMapCircleObject*) pObj )->WriteNCSA( rOStm );
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ ( (IMapPolygonObject*) pObj )->WriteNCSA( rOStm);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+ULONG ImageMap::Read( SvStream& rIStm, ULONG nFormat )
+{
+ ULONG nRet = IMAP_ERR_FORMAT;
+
+ if ( nFormat == IMAP_FORMAT_DETECT )
+ nFormat = ImpDetectFormat( rIStm );
+
+ switch ( nFormat )
+ {
+ case ( IMAP_FORMAT_BIN ) : rIStm >> *this; break;
+ case ( IMAP_FORMAT_CERN ) : nRet = ImpReadCERN( rIStm ); break;
+ case ( IMAP_FORMAT_NCSA ) : nRet = ImpReadNCSA( rIStm ); break;
+
+ default:
+ break;
+ }
+
+ if ( !rIStm.GetError() )
+ nRet = IMAP_ERR_OK;
+
+ return nRet;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+ULONG ImageMap::ImpReadCERN( SvStream& rIStm )
+{
+ ByteString aStr;
+
+ // alten Inhalt loeschen
+ ClearImageMap();
+
+ while ( rIStm.ReadLine( aStr ) )
+ ImpReadCERNLine( aStr );
+
+ return IMAP_ERR_OK;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::ImpReadCERNLine( const ByteString& rLine )
+{
+ ByteString aStr( rLine );
+ ByteString aToken;
+ BOOL bRet = FALSE;
+
+ aStr.EraseLeadingChars( ' ' );
+ aStr.EraseLeadingChars( '\t' );
+ aStr.EraseAllChars( ';' );
+ aStr.ToLowerAscii();
+
+ const char* pStr = aStr.GetBuffer();
+ char cChar = *pStr++;
+
+ // Anweisung finden
+ while( ( cChar >= 'a' ) && ( cChar <= 'z' ) && NOTEOL( cChar ) )
+ {
+ aToken += cChar;
+ cChar = *pStr++;
+ }
+
+ if ( NOTEOL( cChar ) )
+ {
+ if ( ( aToken == "rectangle" ) || ( aToken == "rect" ) )
+ {
+ const Point aTopLeft( ImpReadCERNCoords( &pStr ) );
+ const Point aBottomRight( ImpReadCERNCoords( &pStr ) );
+ const String aURL( ImpReadCERNURL( &pStr ) );
+ const Rectangle aRect( aTopLeft, aBottomRight );
+
+ IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String() );
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ else if ( ( aToken == "circle" ) || ( aToken == "circ" ) )
+ {
+ const Point aCenter( ImpReadCERNCoords( &pStr ) );
+ const long nRadius = ImpReadCERNRadius( &pStr );
+ const String aURL( ImpReadCERNURL( &pStr ) );
+
+ IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String() );
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ else if ( ( aToken == "polygon" ) || ( aToken == "poly" ) )
+ {
+ const USHORT nCount = aStr.GetTokenCount( '(' ) - 1;
+ Polygon aPoly( nCount );
+ String aURL;
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ aPoly[ i ] = ImpReadCERNCoords( &pStr );
+
+ aURL = ImpReadCERNURL( &pStr );
+
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String() );
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Point ImageMap::ImpReadCERNCoords( const char** ppStr )
+{
+ String aStrX;
+ String aStrY;
+ Point aPt;
+ char cChar = *(*ppStr)++;
+
+ while( NOTEOL( cChar ) && ( ( cChar < '0' ) || ( cChar > '9' ) ) )
+ cChar = *(*ppStr)++;
+
+ if ( NOTEOL( cChar ) )
+ {
+ while( NOTEOL( cChar ) && ( cChar >= '0' ) && ( cChar <= '9' ) )
+ {
+ aStrX += cChar;
+ cChar = *(*ppStr)++;
+ }
+
+ if ( NOTEOL( cChar ) )
+ {
+ while( NOTEOL( cChar ) && ( ( cChar < '0' ) || ( cChar > '9' ) ) )
+ cChar = *(*ppStr)++;
+
+ while( NOTEOL( cChar ) && ( cChar >= '0' ) && ( cChar <= '9' ) )
+ {
+ aStrY += cChar;
+ cChar = *(*ppStr)++;
+ }
+
+ if ( NOTEOL( cChar ) )
+ while( NOTEOL( cChar ) && ( cChar != ')' ) )
+ cChar = *(*ppStr)++;
+
+ aPt = Point( aStrX.ToInt32(), aStrY.ToInt32() );
+ }
+ }
+
+ return aPt;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+long ImageMap::ImpReadCERNRadius( const char** ppStr )
+{
+ String aStr;
+ char cChar = *(*ppStr)++;
+
+ while( NOTEOL( cChar ) && ( ( cChar < '0' ) || ( cChar > '9' ) ) )
+ cChar = *(*ppStr)++;
+
+ if ( NOTEOL( cChar ) )
+ {
+ while( NOTEOL( cChar ) && ( cChar >= '0' ) && ( cChar <= '9' ) )
+ {
+ aStr += cChar;
+ cChar = *(*ppStr)++;
+ }
+ }
+
+ return aStr.ToInt32();
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+String ImageMap::ImpReadCERNURL( const char** ppStr )
+{
+ String aStr( String::CreateFromAscii( *ppStr ) );
+
+ aStr.EraseLeadingChars( ' ' );
+ aStr.EraseLeadingChars( '\t' );
+ aStr.EraseTrailingChars( ' ' );
+ aStr.EraseTrailingChars( '\t' );
+
+ return INetURLObject::RelToAbs( aStr );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+ULONG ImageMap::ImpReadNCSA( SvStream& rIStm )
+{
+ ByteString aStr;
+
+ // alten Inhalt loeschen
+ ClearImageMap();
+
+ while ( rIStm.ReadLine( aStr ) )
+ ImpReadNCSALine( aStr );
+
+ return IMAP_ERR_OK;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::ImpReadNCSALine( const ByteString& rLine )
+{
+ ByteString aStr( rLine );
+ ByteString aToken;
+ BOOL bRet = FALSE;
+
+ aStr.EraseLeadingChars( ' ' );
+ aStr.EraseLeadingChars( '\t' );
+ aStr.EraseAllChars( ';' );
+ aStr.ToLowerAscii();
+
+ const char* pStr = aStr.GetBuffer();
+ char cChar = *pStr++;
+
+ // Anweisung finden
+ while( ( cChar >= 'a' ) && ( cChar <= 'z' ) && NOTEOL( cChar ) )
+ {
+ aToken += cChar;
+ cChar = *pStr++;
+ }
+
+ if ( NOTEOL( cChar ) )
+ {
+ if ( aToken == "rect" )
+ {
+ const String aURL( ImpReadNCSAURL( &pStr ) );
+ const Point aTopLeft( ImpReadNCSACoords( &pStr ) );
+ const Point aBottomRight( ImpReadNCSACoords( &pStr ) );
+ const Rectangle aRect( aTopLeft, aBottomRight );
+
+ IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String() );
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ else if ( aToken == "circle" )
+ {
+ const String aURL( ImpReadNCSAURL( &pStr ) );
+ const Point aCenter( ImpReadNCSACoords( &pStr ) );
+ const Point aDX( aCenter - ImpReadNCSACoords( &pStr ) );
+ long nRadius = (long) sqrt( (double) aDX.X() * aDX.X() +
+ (double) aDX.Y() * aDX.Y() );
+
+ IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String() );
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ else if ( aToken == "poly" )
+ {
+ const USHORT nCount = aStr.GetTokenCount( ',' ) - 1;
+ const String aURL( ImpReadNCSAURL( &pStr ) );
+ Polygon aPoly( nCount );
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ aPoly[ i ] = ImpReadNCSACoords( &pStr );
+
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String() );
+ maList.Insert( pObj, LIST_APPEND );
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+String ImageMap::ImpReadNCSAURL( const char** ppStr )
+{
+ String aStr;
+ char cChar = *(*ppStr)++;
+
+ while( NOTEOL( cChar ) && ( ( cChar == ' ' ) || ( cChar == '\t' ) ) )
+ cChar = *(*ppStr)++;
+
+ if ( NOTEOL( cChar ) )
+ {
+ while( NOTEOL( cChar ) && ( cChar != ' ' ) && ( cChar != '\t' ) )
+ {
+ aStr += cChar;
+ cChar = *(*ppStr)++;
+ }
+ }
+
+ return INetURLObject::RelToAbs( aStr );
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+Point ImageMap::ImpReadNCSACoords( const char** ppStr )
+{
+ String aStrX;
+ String aStrY;
+ Point aPt;
+ char cChar = *(*ppStr)++;
+
+ while( NOTEOL( cChar ) && ( ( cChar < '0' ) || ( cChar > '9' ) ) )
+ cChar = *(*ppStr)++;
+
+ if ( NOTEOL( cChar ) )
+ {
+ while( NOTEOL( cChar ) && ( cChar >= '0' ) && ( cChar <= '9' ) )
+ {
+ aStrX += cChar;
+ cChar = *(*ppStr)++;
+ }
+
+ if ( NOTEOL( cChar ) )
+ {
+ while( NOTEOL( cChar ) && ( ( cChar < '0' ) || ( cChar > '9' ) ) )
+ cChar = *(*ppStr)++;
+
+ while( NOTEOL( cChar ) && ( cChar >= '0' ) && ( cChar <= '9' ) )
+ {
+ aStrY += cChar;
+ cChar = *(*ppStr)++;
+ }
+
+ aPt = Point( aStrX.ToInt32(), aStrY.ToInt32() );
+ }
+ }
+
+ return aPt;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+ULONG ImageMap::ImpDetectFormat( SvStream& rIStm )
+{
+ ULONG nPos = rIStm.Tell();
+ ULONG nRet = IMAP_FORMAT_BIN;
+ char cMagic[6];
+
+ rIStm.Read( cMagic, sizeof( cMagic ) );
+
+ // Falls wir kein internes Format haben,
+ // untersuchen wir das Format
+ if ( memcmp( cMagic, IMAPMAGIC, sizeof( cMagic ) ) )
+ {
+ ByteString aStr;
+ long nCount = 128;
+
+ rIStm.Seek( nPos );
+ while ( rIStm.ReadLine( aStr ) && nCount-- )
+ {
+ aStr.ToLowerAscii();
+
+ if ( ( aStr.Search( "rect" ) != STRING_NOTFOUND ) ||
+ ( aStr.Search( "circ" ) != STRING_NOTFOUND ) ||
+ ( aStr.Search( "poly" ) != STRING_NOTFOUND ) )
+ {
+ if ( ( aStr.Search( '(' ) != STRING_NOTFOUND ) &&
+ ( aStr.Search( ')' ) != STRING_NOTFOUND ) )
+ {
+ nRet = IMAP_FORMAT_CERN;
+ }
+ else
+ nRet = IMAP_FORMAT_NCSA;
+
+ break;
+ }
+ }
+ }
+
+ rIStm.Seek( nPos );
+
+ return nRet;
+}
+
+
+/*************************************************************************
+|*
+|* ImageMap::ClipboardHasFormat()
+|*
+\************************************************************************/
+
+BOOL ImageMap::ClipboardHasFormat()
+{
+ return Clipboard::HasFormat( SOT_FORMATSTR_ID_SVIM );
+}
+
+
+/*************************************************************************
+|*
+|* ImageMap::DragServerHasFormat()
+|*
+\************************************************************************/
+
+BOOL ImageMap::DragServerHasFormat( USHORT nItem )
+{
+ return DragServer::HasFormat( nItem, SOT_FORMATSTR_ID_SVIM );
+}
+
+
+/*************************************************************************
+|*
+|* ImageMap::Copy()
+|*
+\************************************************************************/
+
+BOOL ImageMap::Copy() const
+{
+ BOOL bRet = FALSE;
+
+ if ( maList.Count() )
+ {
+ SvMemoryStream aMemStm( 0x1000, 0x1000 );
+ aMemStm << *this;
+
+ const char* pData = (const char*) aMemStm.GetData();
+
+ if ( pData && Clipboard::CopyData( pData, aMemStm.GetSize(),
+ SOT_FORMATSTR_ID_SVIM ) )
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|* ImageMap::Paste()
+|*
+\************************************************************************/
+
+BOOL ImageMap::Paste()
+{
+ BOOL bRet = FALSE;
+
+ if ( Clipboard::HasFormat( SOT_FORMATSTR_ID_SVIM ) )
+ {
+ const ULONG nLen = Clipboard::GetDataLen( SOT_FORMATSTR_ID_SVIM );
+
+ if ( nLen )
+ {
+#ifdef WIN
+ HGLOBAL hData = GlobalAlloc( GHND, nLen );
+ BYTE huge* pData = hData ? (BYTE huge*) GlobalLock( hData ) : NULL;
+#else
+ BYTE* pData = new BYTE[ nLen ];
+#endif
+ if ( pData )
+ {
+ SvMemoryStream aMemStm;
+
+ if ( Clipboard::PasteData( pData, nLen, SOT_FORMATSTR_ID_SVIM ) )
+ {
+ aMemStm.SetBuffer( (char*) pData, nLen, FALSE, nLen );
+ aMemStm >> *this;
+ if ( !aMemStm.GetError() )
+ bRet = TRUE;
+ }
+#ifdef WIN
+ GlobalUnlock( hData );
+ GlobalFree( hData );
+#else
+ delete[] pData;
+#endif
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::Load( SvStream& rIStm )
+{
+ rIStm >> *this;
+}
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::Save( SvStream& rOStm )
+{
+ rOStm << *this;
+}
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+void ImageMap::Assign( const SvDataCopyStream& rCopyStream )
+{
+ *this = (const ImageMap& ) rCopyStream;
+}
+
+
diff --git a/svtools/source/misc/imap3.cxx b/svtools/source/misc/imap3.cxx
new file mode 100644
index 000000000000..a54796cba696
--- /dev/null
+++ b/svtools/source/misc/imap3.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: imap3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "imap.hxx"
+
+#include <tools/debug.hxx>
+
+
+/******************************************************************************
+|*
+|* Ctor
+|*
+\******************************************************************************/
+
+IMapCompat::IMapCompat( SvStream& rStm, const USHORT nStreamMode ) :
+ pRWStm ( &rStm ),
+ nStmMode ( nStreamMode )
+{
+ DBG_ASSERT( nStreamMode == STREAM_READ || nStreamMode == STREAM_WRITE, "Wrong Mode!" );
+
+ if ( !pRWStm->GetError() )
+ {
+ if ( nStmMode == STREAM_WRITE )
+ {
+ nCompatPos = pRWStm->Tell();
+ pRWStm->SeekRel( 4 );
+ nTotalSize = nCompatPos + 4;
+ }
+ else
+ {
+ UINT32 nTotalSizeTmp;
+ *pRWStm >> nTotalSizeTmp;
+ nTotalSize = nTotalSizeTmp;
+ nCompatPos = pRWStm->Tell();
+ }
+ }
+}
+
+
+/******************************************************************************
+|*
+|* Dtor
+|*
+\******************************************************************************/
+
+IMapCompat::~IMapCompat()
+{
+ if ( !pRWStm->GetError() )
+ {
+ if ( nStmMode == STREAM_WRITE )
+ {
+ const ULONG nEndPos = pRWStm->Tell();
+
+ pRWStm->Seek( nCompatPos );
+ *pRWStm << (UINT32) ( nEndPos - nTotalSize );
+ pRWStm->Seek( nEndPos );
+ }
+ else
+ {
+ const ULONG nReadSize = pRWStm->Tell() - nCompatPos;
+
+ if ( nTotalSize > nReadSize )
+ pRWStm->SeekRel( nTotalSize - nReadSize );
+ }
+ }
+}
+
+
+
diff --git a/svtools/source/misc/inidef.cxx b/svtools/source/misc/inidef.cxx
new file mode 100644
index 000000000000..7ddc82e4c935
--- /dev/null
+++ b/svtools/source/misc/inidef.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * $RCSfile: inidef.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _INTN_HXX //autogen
+#include <tools/intn.hxx>
+#endif
+#ifndef _SYSTEM_HXX //autogen
+#include <vcl/system.hxx>
+#endif
+#include "inetdef.hxx"
+#include "inidef.hxx"
+
+//========================================================================
+
+class SfxStdIniDef_Impl: public SfxIniDefaulter
+{
+public:
+ SfxStdIniDef_Impl( SfxIniDefaultManager *pDefMgr )
+ : SfxIniDefaulter( pDefMgr )
+ {}
+ virtual BOOL QueryDefault( String &rValue, const SfxIniEntry &rEntry );
+};
+
+//-------------------------------------------------------------------------
+
+BOOL SfxStdIniDef_Impl::QueryDefault( String &rValue, const SfxIniEntry &rEntry )
+{
+ switch ( rEntry.GetKey() )
+ {
+ case SFX_KEY_BROWSERRESTORE:
+ {
+ rValue = "1";
+ return TRUE;
+ }
+
+ case SFX_KEY_INET_HOME:
+ {
+ if ( System::GetLanguage() == LANGUAGE_GERMAN )
+ rValue = "http://www.stardivision.de";
+ else
+ rValue = "http://www.stardivision.com";
+ return TRUE;
+ }
+
+ case SFX_KEY_INET_MEMCACHE:
+ rValue = "4";
+ return TRUE;
+
+ case SFX_KEY_INET_DISKCACHE:
+ rValue = "2048";
+ return TRUE;
+
+ case SFX_KEY_INET_CACHEEXPIRATION:
+ rValue = "3";
+ return TRUE;
+
+ case SFX_KEY_INET_MAXHTTPCONS:
+ rValue = "4";
+ return TRUE;
+
+ case SFX_KEY_INET_MAXFTPCONS:
+ rValue = "2";
+ return TRUE;
+
+// case SFX_KEY_INET_JAVAMINHEAP:
+// rValue = "256";
+// return TRUE;
+
+// case SFX_KEY_INET_JAVAMAXHEAP:
+// rValue = "";
+// return TRUE;
+
+ case SFX_KEY_INET_USERAGENT:
+ rValue = INET_DEF_CALLERNAME;
+ return TRUE;
+
+ case SFX_KEY_INET_EXE_JAVASCRIPT:
+#ifdef SOLAR_JAVA
+ rValue = "0"; // noch "0", solange es noch soviel Bugs gibt
+#else
+ rValue = "0"; // immer "0"
+#endif
+ return TRUE;
+
+ case SFX_KEY_INET_EXE_PLUGIN:
+ rValue = "1";
+ return TRUE;
+
+/* case SFX_KEY_INET_JAVA_ENABLE:
+#ifdef SOLAR_JAVA
+ rValue = "1";
+#else
+ rValue = "0";
+#endif
+ return TRUE; */
+
+// case SFX_KEY_INET_NETACCESS:
+// rValue = "2";
+// return TRUE;
+
+ case SFX_KEY_INET_CHANNELS:
+ rValue = "1";
+ return TRUE;
+
+ case SFX_KEY_BASIC_ENABLE:
+ rValue = "1";
+ return TRUE;
+
+ case SFX_KEY_INET_COOKIES:
+ rValue = "1";
+ return TRUE;
+
+ case SFX_KEY_ICONGRID:
+ rValue = "100;70;0";
+ return TRUE;
+
+ case SFX_KEY_METAFILEPRINT:
+ rValue = "1";
+ return TRUE;
+ }
+
+ return SfxIniDefaulter::QueryDefault( rValue, rEntry );
+}
+
+//=========================================================================
+
+SfxIniDefaultManager::SfxIniDefaultManager()
+: _pList( new SfxIniDefaulterList )
+{
+ new SfxStdIniDef_Impl( this );
+}
+
+//-------------------------------------------------------------------------
+
+SfxIniDefaultManager::~SfxIniDefaultManager()
+{
+ if ( _pList )
+ {
+ for ( USHORT n = _pList->Count(); n--; )
+ delete _pList->GetObject(n);
+ delete _pList;
+ }
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxIniDefaultManager::QueryDefault
+(
+ String& rValue, /* out: Default-Wert f"ur 'rEntry'
+ (Default ist Leerstring) */
+ const SfxIniEntry& rEntry // in: Beschreibung des Eintrags
+)
+
+/* [Beschreibung]
+
+ "Uber diese interne Methode besorgt sich der <SfxIniManager> den
+ Default f"ur einen in 'rEntry' beschriebenen Eintrag.
+*/
+
+{
+ for ( USHORT n = _pList->Count(); n--; )
+ if ( _pList->GetObject(n)->QueryDefault( rValue, rEntry ) )
+ return TRUE;
+ return FALSE;
+}
+
+//=========================================================================
+
+SfxIniDefaulter::SfxIniDefaulter( SfxIniDefaultManager *pManager )
+
+/* [Beschreibung]
+
+ Der Ctor dieser Klasse meldet die neue Instanz automatisch am
+ <SfxiniDefaultManager> 'pManager' an.
+*/
+
+: _pManager( pManager )
+
+{
+ pManager->Insert( this );
+}
+
+//-------------------------------------------------------------------------
+
+SfxIniDefaulter::~SfxIniDefaulter()
+
+/* [Beschreibung]
+
+ Der Dtor dieser Klasse meldet die neue Instanz automatisch am
+ <SfxiniDefaultManager> ab, der im Ctor angegeben wurde.
+*/
+
+{
+ _pManager->Remove( this );
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxIniDefaulter::QueryDefault
+(
+ String& rValue, /* out: Default-Wert f"ur 'rEntry'
+ (Default ist Leerstring) */
+ const SfxIniEntry& rEntry // in: Beschreibung des Eintrags
+)
+
+/* [Beschreibung]
+
+ Diese virtuelle Methode mu\s "uberladen werden. Sie soll dann in
+ 'rValue' einen Default-Wert f"ur den in 'rEntry' beschriebenen
+ ini-Eintrag setzen, falls ihr dieser bekannt ist.
+
+
+ [Returnwert]
+
+ TRUE In 'rValue' befindet sich der Default-Wert.
+
+ FALSE F"ur diesen Eintrag ist kein Default-Wert bekannt.
+
+*/
+
+{
+ return FALSE;
+};
+
+//========================================================================
+
+SfxIniEntry::SfxIniEntry
+(
+ const String& aGroup,
+ const String& aKey,
+ SfxIniGroup eGroup,
+ SfxIniKey eKey,
+ USHORT nIndex
+)
+: _aGroup( aGroup ),
+ _aKey( aKey ),
+ _eGroup( eGroup ),
+ _eKey( eKey ),
+ _nIndex( nIndex )
+{
+}
+
+
diff --git a/svtools/source/misc/iniman.src b/svtools/source/misc/iniman.src
new file mode 100644
index 000000000000..5170adb2bec2
--- /dev/null
+++ b/svtools/source/misc/iniman.src
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * $RCSfile: iniman.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "svtools.hrc"
+
+ErrorBox ERRBOX_CHECK_PLZ
+{
+ BUTTONS = WB_OK ;
+ Message = "Die eingegebene Postleitzahl ist ungltig.\nSie muss mit einer Ziffer oder einem Buchstabe anfangen und\ndarf nur Ziffern, Buchstaben, Leerzeichen und Trennstriche enthalten.";
+ Message [ English ] = "Die eingegebene Postleitzahl ist ungltig.\nSie mu mit einer Ziffer oder einem Buchstabe anfangen und\ndarf nur Ziffern, Buchstaben, Leerzeichen und Trennstriche enthalten.";
+ Message[ italian ] = "Il C.A.P. specificato non valido.\nDeve iniziare con un numero o con una lettera e\npu contenere soltanto numeri, lettere, spazi vuoti e trattini.";
+ Message[ portuguese_brazilian ] = "Die eingegebene Postleitzahl ist ungltig.\nSie mu mit einer Ziffer oder einem Buchstabe anfangen und\ndarf nur Ziffern, Buchstaben, Leerzeichen und Trennstriche enthalten.";
+ Message[ portuguese ] = "O cdigo postal especificado est incorrecto.\nEste tem que comear por um algarismo ou uma letra e s pode conter algarismos, letras, espaos em branco e hfens.";
+ Message[ danish ] = "Det angivne postnummer er ugyldigt.\nDet skal begynde med et tal eller bogstav og\nm kun indeholde tal, bogstaver, mellemrum og bindestreger.";
+ Message[ french ] = "Le code postal indiqu est incorrect.\nIl doit commencer par un chiffre ou une lettre et\ncontenir uniquement des chiffres, lettres, espaces ou traits d'union.";
+ Message[ swedish ] = "Det angivna postnumret r ogiltigt.\nDet mste brja med en siffra eller en bokstav och\nfr bara innehlla siffror, bokstver, mellanslag och bindestreck.";
+ Message[ dutch ] = "Deze postcode is ongeldig.\nMoet beginnen met een cijfer of een letter en\nmag alleen cijfers, letters, spaties en verbindingsstreepjes bevatten.";
+ Message[ spanish ] = "El cdigo postal indicado no es vlido.\nDebe comenzar con un nmero o una letra y\nsolo puede contener nmeros, letras, espacios y guiones.";
+ Message[ english_us ] = "The ZIP code specified is invalid.\nA ZIP code should begin with a number (or in some cases a letter) and\ncan only contain numbers, letters, spaces and dashes.";
+ Message[ chinese_simplified ] = "Ч\nһֻһĸͷ\nֻܹ֣ĸոַ";
+ Message[ russian ] = " .\n \n , , .";
+ Message[ polish ] = "Wpisany kod pocztowy jest nieprawidowy.\nMusi si on zaczyna cyfr lub liter i \nmoe zawiera tylko cyfry, litery, spacje i kreski.";
+ Message[ japanese ] = "͂X֔ԍ͕sK؂łB\n܂͕Ŏn߂Ȃ΂Ȃ܂\nƕƽ߰ޯ̂ݎgpł܂B";
+ Message[ arabic ] = " .\n ݡ\n ݡ ɡ .";
+ Message[ chinese_traditional ] = "zJlϸLġC\nlϸѤ@ӼƦrΤ@Ӧr}lA\nӥBuOƦrArAŮMsršC";
+ Message[ greek ] = " .\n \n , , .";
+ Message[ korean ] = "Է ȣ ȿ ʽϴ.\nȣ ڳ ĺ ؾ ϸ \nڳ ĺ, ̽ ׸ ÷θ ̷ մϴ.";
+ Message[ turkish ] = "Girilen posta kodu geerli deil.\nPosta kodu bir rakam ya da harf ile balamal ve yalnzca\nrakam, harf, boluk ve ayrma izgileri iermeli.";
+ Message[ language_user1 ] = " ";
+};
+
+
diff --git a/svtools/source/misc/iniprop.cxx b/svtools/source/misc/iniprop.cxx
new file mode 100644
index 000000000000..64f350005450
--- /dev/null
+++ b/svtools/source/misc/iniprop.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: iniprop.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "iniprop.hxx"
+
+//-------------------------------------------------------------------------
+
+TYPEINIT1(SfxAppIniManagerProperty, ApplicationProperty);
+
+//-------------------------------------------------------------------------
+
+SfxAppIniManagerProperty::~SfxAppIniManagerProperty()
+{
+}
+
+
diff --git a/svtools/source/misc/ownlist.cxx b/svtools/source/misc/ownlist.cxx
new file mode 100644
index 000000000000..b97614503928
--- /dev/null
+++ b/svtools/source/misc/ownlist.cxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * $RCSfile: ownlist.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <ctype.h>
+#include <stdio.h>
+
+#include <ownlist.hxx>
+
+//=========================================================================
+//============== SvCommandList ============================================
+//=========================================================================
+PRV_SV_IMPL_OWNER_LIST(SvCommandList,SvCommand)
+
+
+static String parseString(const String & rCmd, USHORT * pIndex)
+{
+ String result;
+
+ if(rCmd.GetChar( *pIndex ) == '\"') {
+ (*pIndex) ++;
+
+ USHORT begin = *pIndex;
+
+ while(*pIndex < rCmd.Len() && rCmd.GetChar((*pIndex) ++) != '\"');
+
+ result = String(rCmd.Copy(begin, *pIndex - begin - 1));
+ }
+
+ return result;
+}
+
+static String parseWord(const String & rCmd, USHORT * pIndex)
+{
+ USHORT begin = *pIndex;
+
+ while(*pIndex < rCmd.Len() && !isspace(rCmd.GetChar(*pIndex)) && rCmd.GetChar(*pIndex) != '=')
+ (*pIndex) ++;
+
+ return String(rCmd.Copy(begin, *pIndex - begin));
+}
+
+static void eatSpace(const String & rCmd, USHORT * pIndex)
+{
+ while(*pIndex < rCmd.Len() && isspace(rCmd.GetChar(*pIndex)))
+ (*pIndex) ++;
+}
+
+
+//=========================================================================
+BOOL SvCommandList::AppendCommands
+(
+ const String & rCmd, /* Dieser Text wird in Kommandos umgesetzt */
+ USHORT * pEaten /* Anzahl der Zeichen, die gelesen wurden */
+)
+/* [Beschreibung]
+
+ Es wird eine Text geparsed und die einzelnen Kommandos werden an
+ die Liste angeh"angt.
+
+ [R"uckgabewert]
+
+ BOOL TRUE, der Text wurde korrekt geparsed.
+ FALSE, der Text wurde nicht korrekt geparsed.
+*/
+{
+ USHORT index = 0;
+ while(index < rCmd.Len())
+ {
+
+ eatSpace(rCmd, &index);
+ String name = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
+
+ eatSpace(rCmd, &index);
+ String value;
+ if(index < rCmd.Len() && rCmd.GetChar(index) == '=')
+ {
+ index ++;
+
+ eatSpace(rCmd, &index);
+ value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
+ }
+
+ SvCommand * pCmd = new SvCommand(name, value);
+ aTypes.Insert(pCmd, LIST_APPEND);
+ }
+
+ *pEaten = index;
+
+// USHORT nPos = 0;
+// while( nPos < rCmd.Len() )
+// {
+// // ein Zeichen ? Dann faengt hier eine Option an
+// if( isalpha( rCmd[nPos] ) )
+// {
+// String aValue;
+// USHORT nStt = nPos;
+// register char c;
+
+// while( nPos < rCmd.Len() &&
+// ( isalnum(c=rCmd[nPos]) || '-'==c || '.'==c ) )
+// nPos++;
+
+// String aToken( rCmd.Copy( nStt, nPos-nStt ) );
+
+// while( nPos < rCmd.Len() &&
+// ( !String::IsPrintable( (c=rCmd[nPos]),
+// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) )
+// nPos++;
+
+// // hat die Option auch einen Wert?
+// if( nPos!=rCmd.Len() && '='==c )
+// {
+// nPos++;
+
+// while( nPos < rCmd.Len() &&
+// ( !String::IsPrintable( (c=rCmd[nPos]),
+// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) )
+// nPos++;
+
+// if( nPos != rCmd.Len() )
+// {
+// USHORT nLen = 0;
+// nStt = nPos;
+// if( '"' == c )
+// {
+// nPos++; nStt++;
+// while( nPos < rCmd.Len() &&
+// '"' != rCmd[nPos] )
+// nPos++, nLen++;
+// if( nPos!=rCmd.Len() )
+// nPos++;
+// }
+// else
+// // hier sind wir etwas laxer als der
+// // Standard und erlauben alles druckbare
+// while( nPos < rCmd.Len() &&
+// String::IsPrintable( (c=rCmd[nPos]),
+// RTL_TEXTENCODING_MS_1252 ) &&
+// !isspace( c ) )
+// nPos++, nLen++;
+
+// if( nLen )
+// aValue = rCmd( nStt, nLen );
+// }
+// }
+
+// SvCommand * pCmd = new SvCommand( aToken, aValue );
+// aTypes.Insert( pCmd, LIST_APPEND );
+// }
+// else
+// // white space un unerwartete Zeichen ignorieren wie
+// nPos++;
+// }
+// *pEaten = nPos;
+ return TRUE;
+}
+
+//=========================================================================
+String SvCommandList::GetCommands() const
+/* [Beschreibung]
+
+ Die Kommandos in der Liste werden als Text hintereinander, durch ein
+ Leerzeichen getrennt geschrieben. Der Text muss nicht genauso
+ aussehen wie der in <SvCommandList::AppendCommands()> "ubergebene.
+
+ [R"uckgabewert]
+
+ String Die Kommandos werden zur"uckgegeben.
+*/
+{
+ String aRet;
+ for( ULONG i = 0; i < aTypes.Count(); i++ )
+ {
+ if( i != 0 )
+ aRet += ' ';
+ SvCommand * pCmd = (SvCommand *)aTypes.GetObject( i );
+ aRet += pCmd->GetCommand();
+ if( pCmd->GetArgument().Len() )
+ {
+ aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "=\"" ) );
+ aRet += pCmd->GetArgument();
+ aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) );
+ }
+ }
+ return aRet;
+}
+
+//=========================================================================
+SvCommand & SvCommandList::Append
+(
+ const String & rCommand, /* das Kommando */
+ const String & rArg /* dasArgument des Kommandos */
+)
+/* [Beschreibung]
+
+ Es wird eine Objekt vom Typ SvCommand erzeugt und an die Liste
+ angeh"angt.
+
+ [R"uckgabewert]
+
+ SvCommand & Das erteugte Objekt wird zur"uckgegeben.
+*/
+{
+ SvCommand * pCmd = new SvCommand( rCommand, rArg );
+ aTypes.Insert( pCmd, LIST_APPEND );
+ return *pCmd;
+}
+
+//=========================================================================
+SvStream & operator >>
+(
+ SvStream & rStm, /* Stream aus dem gelesen wird */
+ SvCommandList & rThis /* Die zu f"ullende Liste */
+)
+/* [Beschreibung]
+
+ Die Liste mit ihren Elementen wird gelesen. Das Format ist:
+ 1. Anzahl der Elemente
+ 2. Alle Elemente
+
+ [R"uckgabewert]
+
+ SvStream & Der "ubergebene Stream.
+*/
+{
+ UINT32 nCount = 0;
+ rStm >> nCount;
+ if( !rStm.GetError() )
+ {
+ while( nCount-- )
+ {
+ SvCommand * pCmd = new SvCommand();
+ rStm >> *pCmd;
+ rThis.aTypes.Insert( pCmd, LIST_APPEND );
+ }
+ }
+ return rStm;
+}
+
+//=========================================================================
+SvStream & operator <<
+(
+ SvStream & rStm, /* Stream in den geschrieben wird */
+ const SvCommandList & rThis /* Die zu schreibende Liste */
+)
+/* [Beschreibung]
+
+ Die Liste mit ihren Elementen wir geschrieben. Das Format ist:
+ 1. Anzahl der Elemente
+ 2. Alle Elemente
+
+ [R"uckgabewert]
+
+ SvStream & Der "ubergebene Stream.
+*/
+{
+ UINT32 nCount = rThis.aTypes.Count();
+ rStm << nCount;
+
+ for( UINT32 i = 0; i < nCount; i++ )
+ {
+ SvCommand * pCmd = (SvCommand *)rThis.aTypes.GetObject( i );
+ rStm << *pCmd;
+ }
+ return rStm;
+}
+
+