diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /tools | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'tools')
67 files changed, 0 insertions, 13309 deletions
diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index cef5f7f5c37b..23acf677eca8 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -23,7 +23,6 @@ $(eval $(call gb_Module_Module,tools)) $(eval $(call gb_Module_add_targets,tools,\ CustomTarget_reversemap \ Library_tl \ - Package_inc \ StaticLibrary_ooopathutils \ )) diff --git a/tools/Package_inc.mk b/tools/Package_inc.mk deleted file mode 100644 index edecc9965d7b..000000000000 --- a/tools/Package_inc.mk +++ /dev/null @@ -1,87 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . -# - -$(eval $(call gb_Package_Package,tools_inc,$(SRCDIR)/tools/inc)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/StringListResource.hxx,tools/StringListResource.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/appendunixshellword.hxx,tools/appendunixshellword.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/b3dtrans.hxx,tools/b3dtrans.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/bigint.hxx,tools/bigint.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/cachestr.hxx,tools/cachestr.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/color.hxx,tools/color.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/config.hxx,tools/config.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/contnr.hxx,tools/contnr.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/date.hxx,tools/date.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/datetime.hxx,tools/datetime.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/debug.hxx,tools/debug.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/diagnose_ex.h,tools/diagnose_ex.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/errcode.hxx,tools/errcode.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/errinf.hxx,tools/errinf.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/extendapplicationenvironment.hxx,tools/extendapplicationenvironment.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/fldunit.hxx,tools/fldunit.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/fontenum.hxx,tools/fontenum.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/fract.hxx,tools/fract.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/gen.hxx,tools/gen.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/getprocessworkingdir.hxx,tools/getprocessworkingdir.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/globname.hxx,tools/globname.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/helpers.hxx,tools/helpers.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetmime.hxx,tools/inetmime.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetmsg.hxx,tools/inetmsg.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/inetstrm.hxx,tools/inetstrm.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/line.hxx,tools/line.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/lineend.hxx,tools/lineend.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/link.hxx,tools/link.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/mapunit.hxx,tools/mapunit.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/mempool.hxx,tools/mempool.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/multisel.hxx,tools/multisel.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/pathutils.hxx,tools/pathutils.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/poly.hxx,tools/poly.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/postsys.h,tools/postsys.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/presys.h,tools/presys.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/pstm.hxx,tools/pstm.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/rc.h,tools/rc.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/rc.hxx,tools/rc.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/rcid.h,tools/rcid.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/ref.hxx,tools/ref.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/resary.hxx,tools/resary.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/resid.hxx,tools/resid.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/resmgr.hxx,tools/resmgr.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/rtti.hxx,tools/rtti.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/shl.hxx,tools/shl.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/simplerm.hxx,tools/simplerm.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/solar.h,tools/solar.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/solarmutex.hxx,tools/solarmutex.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/stream.hxx,tools/stream.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/string.hxx,tools/string.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/svborder.hxx,tools/svborder.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/tempfile.hxx,tools/tempfile.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/tenccvt.hxx,tools/tenccvt.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/time.hxx,tools/time.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/tools.h,tools/tools.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/toolsdllapi.h,tools/toolsdllapi.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/unqidx.hxx,tools/unqidx.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/urlobj.hxx,tools/urlobj.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/vcompat.hxx,tools/vcompat.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/vector2d.hxx,tools/vector2d.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/weakbase.h,tools/weakbase.h)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/weakbase.hxx,tools/weakbase.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/wintypes.hxx,tools/wintypes.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/wldcrd.hxx,tools/wldcrd.hxx)) -$(eval $(call gb_Package_add_file,tools_inc,inc/tools/zcodec.hxx,tools/zcodec.hxx)) - -# vim: set noet sw=4 ts=4: diff --git a/tools/inc/tools/StringListResource.hxx b/tools/inc/tools/StringListResource.hxx deleted file mode 100644 index 52f22e48a8ef..000000000000 --- a/tools/inc/tools/StringListResource.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef TOOLS_STRINGLISTRESOURCE_HXX -#define TOOLS_STRINGLISTRESOURCE_HXX - -#include <vector> -#include <tools/resid.hxx> -#include <tools/rcid.h> -#include <tools/rc.hxx> - -namespace tools -{ - class StringListResource : public Resource - { - public: - StringListResource(const ResId& _aResId,::std::vector< OUString>& _rToFill ) : Resource(_aResId) - { - sal_uInt16 i = 1; - while( IsAvailableRes(ResId(i,*m_pResMgr).SetRT(RSC_STRING)) ) - { - String sStr = String(ResId(i,*m_pResMgr)); - _rToFill.push_back(sStr); - ++i; - } - } - ~StringListResource() - { - FreeResource(); - } - }; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/appendunixshellword.hxx b/tools/inc/tools/appendunixshellword.hxx deleted file mode 100644 index 98fcdf8023a5..000000000000 --- a/tools/inc/tools/appendunixshellword.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_TOOLS_APPENDUNIXSHELLWORD_HXX -#define INCLUDED_TOOLS_APPENDUNIXSHELLWORD_HXX - -#include "sal/config.h" - -#if defined UNX -#include "tools/toolsdllapi.h" - - -namespace tools { - -/** append arbitrary bytes as a properly quoted Unix-style shell word - - @param accumulator - the string buffer to which the word is appended (without any surrounding - whitespace); must not be null - @param text - the text to add -*/ -TOOLS_DLLPUBLIC void appendUnixShellWord( - OStringBuffer * accumulator, OString const & text); - -} -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/b3dtrans.hxx b/tools/inc/tools/b3dtrans.hxx deleted file mode 100644 index c9e65950b1b6..000000000000 --- a/tools/inc/tools/b3dtrans.hxx +++ /dev/null @@ -1,259 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _B3D_B3DTRANS_HXX -#define _B3D_B3DTRANS_HXX - -#define ZBUFFER_DEPTH_RANGE ((double)(256L * 256L * 256L)) - -#include <basegfx/matrix/b3dhommatrix.hxx> -#include <basegfx/range/b3drange.hxx> -#include <tools/gen.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <tools/toolsdllapi.h> - -/// Supported methods for setting the aspect ratio -enum Base3DRatio -{ - Base3DRatioGrow = 1, - Base3DRatioShrink, - Base3DRatioMiddle -}; - -/// Supported projection types -enum Base3DProjectionType -{ - Base3DProjectionTypeParallel = 1, - Base3DProjectionTypePerspective -}; - -/// Transformation sets for 3D output -class TOOLS_DLLPUBLIC B3dTransformationSet -{ -private: - // Object Matrix Object -> World - basegfx::B3DHomMatrix maObjectTrans; - basegfx::B3DHomMatrix maInvObjectTrans; - - // Orientation Matrix - basegfx::B3DHomMatrix maOrientation; - basegfx::B3DHomMatrix maInvOrientation; - - // Projection Matrix - basegfx::B3DHomMatrix maProjection; - basegfx::B3DHomMatrix maInvProjection; - - // Texture Matrices - basegfx::B2DHomMatrix maTexture; - - // Special transformation set for converting Object -> Device - basegfx::B3DHomMatrix maObjectToDevice; - - // Transposed and inversed matrix for vector transformations - basegfx::B3DHomMatrix maInvTransObjectToEye; - - // Transformation for World->View - basegfx::B3DHomMatrix maMatFromWorldToView; - basegfx::B3DHomMatrix maInvMatFromWorldToView; - - // Parameters for ViewportTransformation - basegfx::B3DVector maScale; - basegfx::B3DVector maTranslate; - - // ViewPlane DeviceRectangle (user-defined) - double mfLeftBound; - double mfRightBound; - double mfBottomBound; - double mfTopBound; - - // Near and far clipping planes - double mfNearBound; - double mfFarBound; - - // Aspect ratio of 3D transformation (Y / X) - // default: 1:1 -> 1.0 - // Disable with value 0.0 - double mfRatio; - - // Viewport area in logical coordinates - Rectangle maViewportRectangle; - // Visible area within viewport - Rectangle maVisibleRectangle; - - // Actual coordinates as set by CalcViewport - // of visible viewport area (logical coordinates) - Rectangle maSetBound; - - // Method of keeping defined aspect ratio - // default: Base3DRatioGrow - Base3DRatio meRatio; - - // Flags - unsigned mbPerspective : 1; - unsigned mbWorldToViewValid : 1; - unsigned mbInvTransObjectToEyeValid : 1; - unsigned mbObjectToDeviceValid : 1; - unsigned mbProjectionValid : 1; - -public: - B3dTransformationSet(); - virtual ~B3dTransformationSet(); - - void Reset(); - - // ObjectTrans - const basegfx::B3DHomMatrix& GetObjectTrans() { return maObjectTrans; } - const basegfx::B3DHomMatrix& GetInvObjectTrans() { return maInvObjectTrans; } - - // Orientation - void SetOrientation( - basegfx::B3DPoint aVRP = basegfx::B3DPoint(0.0,0.0,1.0), - basegfx::B3DVector aVPN = basegfx::B3DVector(0.0,0.0,1.0), - basegfx::B3DVector aVUP = basegfx::B3DVector(0.0,1.0,0.0)); - const basegfx::B3DHomMatrix& GetOrientation() { return maOrientation; } - const basegfx::B3DHomMatrix& GetInvOrientation() { return maInvOrientation; } - - // Projection - void SetProjection(const basegfx::B3DHomMatrix& mProject); - const basegfx::B3DHomMatrix& GetProjection(); - - // Texture - const basegfx::B2DHomMatrix& GetTexture() { return maTexture; } - - // aspect ratio accessors and the defined method of keeping defined aspect ratio - double GetRatio() { return mfRatio; } - void SetRatio(double fNew=1.0); - Base3DRatio GetRatioMode() { return meRatio; } - - // Parameters of ViewportTransformation - void SetDeviceRectangle(double fL=-1.0, double fR=1.0, - double fB=-1.0, double fT=1.0, - sal_Bool bBroadCastChange=sal_True); - double GetDeviceRectangleWidth() const { return mfRightBound - mfLeftBound; } - double GetDeviceRectangleHeight() const { return mfTopBound - mfBottomBound; } - double GetFrontClippingPlane() { return mfNearBound; } - double GetBackClippingPlane() { return mfFarBound; } - void SetPerspective(sal_Bool bNew); - sal_Bool GetPerspective() { return mbPerspective; } - void SetViewportRectangle(Rectangle& rRect, Rectangle& rVisible); - void SetViewportRectangle(Rectangle& rRect) { SetViewportRectangle(rRect, rRect); } - const Rectangle& GetViewportRectangle() { return maViewportRectangle; } - void CalcViewport(); - - // Direct accessors for miscellaneous transformations - const basegfx::B3DPoint WorldToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToWorldCoor(const basegfx::B3DPoint& rVec); - - static void Frustum( - basegfx::B3DHomMatrix& rTarget, - double fLeft = -1.0, double fRight = 1.0, - double fBottom = -1.0, double fTop = 1.0, - double fNear = 0.001, double fFar = 1.0); - static void Ortho( - basegfx::B3DHomMatrix& rTarget, - double fLeft = -1.0, double fRight = 1.0, - double fBottom = -1.0, double fTop = 1.0, - double fNear = 0.0, double fFar = 1.0); - static void Orientation( - basegfx::B3DHomMatrix& rTarget, - basegfx::B3DPoint aVRP = basegfx::B3DPoint(0.0,0.0,1.0), - basegfx::B3DVector aVPN = basegfx::B3DVector(0.0,0.0,1.0), - basegfx::B3DVector aVUP = basegfx::B3DVector(0.0,1.0,0.0)); - -protected: - void PostSetObjectTrans(); - void PostSetOrientation(); - void PostSetProjection(); - void PostSetViewport(); - - virtual void DeviceRectangleChange(); -}; - -/** Viewport for B3D - - Uses a simplified model, in which a point is described using a View - Reference Point (VRP). -*/ -class TOOLS_DLLPUBLIC B3dViewport : public B3dTransformationSet -{ -private: - basegfx::B3DPoint aVRP; // View Reference Point - basegfx::B3DVector aVPN; // View Plane Normal - basegfx::B3DVector aVUV; // View Up Vector - -public: - B3dViewport(); - virtual ~B3dViewport(); - - void SetVUV(const basegfx::B3DVector& rNewVUV); - void SetViewportValues( - const basegfx::B3DPoint& rNewVRP, - const basegfx::B3DVector& rNewVPN, - const basegfx::B3DVector& rNewVUV); - - const basegfx::B3DPoint& GetVRP() const { return aVRP; } - const basegfx::B3DVector& GetVPN() const { return aVPN; } - const basegfx::B3DVector& GetVUV() const { return aVUV; } - -protected: - void CalcOrientation(); -}; - -// B3D camera - -class TOOLS_DLLPUBLIC B3dCamera : public B3dViewport -{ -private: - basegfx::B3DPoint aPosition; - basegfx::B3DPoint aCorrectedPosition; - basegfx::B3DVector aLookAt; - double fFocalLength; - double fBankAngle; - - unsigned bUseFocalLength : 1; - -public: - B3dCamera( - const basegfx::B3DPoint& rPos = basegfx::B3DPoint(0.0, 0.0, 1.0), - const basegfx::B3DVector& rLkAt = basegfx::B3DVector(0.0, 0.0, 0.0), - double fFocLen = 35.0, double fBnkAng = 0.0, - sal_Bool bUseFocLen = sal_False); - virtual ~B3dCamera(); - - const basegfx::B3DPoint& GetPosition() const { return aPosition; } - const basegfx::B3DVector& GetLookAt() const { return aLookAt; } - - // Focal length in mm - double GetFocalLength() const { return fFocalLength; } - - double GetBankAngle() const { return fBankAngle; } - - sal_Bool GetUseFocalLength() const { return (sal_Bool)bUseFocalLength; } - -protected: - void CalcNewViewportValues(); - sal_Bool CalcFocalLength(); - - virtual void DeviceRectangleChange(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/bigint.hxx b/tools/inc/tools/bigint.hxx deleted file mode 100644 index d3a2c2f2cff5..000000000000 --- a/tools/inc/tools/bigint.hxx +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _BIGINT_HXX -#define _BIGINT_HXX - -#include <climits> -#include <rtl/ustring.hxx> -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -class SvStream; - -#ifdef _TLBIGINT_INT64 -struct SbxINT64; -struct SbxUINT64; -#endif - -#define MAX_DIGITS 8 - -class Fraction; - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED BigInt -{ -private: - long nVal; - unsigned short nNum[MAX_DIGITS]; - sal_uInt8 nLen : 5; // current length - sal_Bool bIsNeg : 1, // Is Sign negative? - bIsBig : 1, // sal_True == BigInt - bIsSet : 1; // Not "Null" (not "not 0") - - TOOLS_DLLPRIVATE void MakeBigInt(BigInt const &); - TOOLS_DLLPRIVATE void Normalize(); - TOOLS_DLLPRIVATE void Mult(BigInt const &, sal_uInt16); - TOOLS_DLLPRIVATE void Div(sal_uInt16, sal_uInt16 &); - TOOLS_DLLPRIVATE sal_Bool IsLess(BigInt const &) const; - TOOLS_DLLPRIVATE void AddLong(BigInt &, BigInt &); - TOOLS_DLLPRIVATE void SubLong(BigInt &, BigInt &); - TOOLS_DLLPRIVATE void MultLong(BigInt const &, BigInt &) const; - TOOLS_DLLPRIVATE void DivLong(BigInt const &, BigInt &) const; - TOOLS_DLLPRIVATE void ModLong(BigInt const &, BigInt &) const; - TOOLS_DLLPRIVATE sal_Bool ABS_IsLess(BigInt const &) const; - -public: - BigInt(); - BigInt( short nVal ); - BigInt( long nVal ); - BigInt( int nVal ); - BigInt( double nVal ); - BigInt( sal_uInt16 nVal ); - BigInt( sal_uInt32 nVal ); - BigInt( const BigInt& rBigInt ); - BigInt( const OUString& rString ); -#ifdef _TLBIGINT_INT64 - BigInt( const SbxINT64 &r ); - BigInt( const SbxUINT64 &r ); -#endif - - operator short() const; - operator long() const; - operator int() const; - operator double() const; - operator sal_uInt16() const; - operator sal_uIntPtr() const; - - void Set( sal_Bool bSet ) { bIsSet = bSet; } - OUString GetString() const; - - sal_Bool IsSet() const { return bIsSet; } - sal_Bool IsNeg() const; - sal_Bool IsZero() const; - sal_Bool IsOne() const; - sal_Bool IsLong() const { return !bIsBig; } - void Abs(); -#ifdef _TLBIGINT_INT64 - sal_Bool INT64 ( SbxINT64 *p ) const; - sal_Bool UINT64( SbxUINT64 *p ) const; -#endif - - BigInt& operator =( const BigInt& rVal ); - BigInt& operator +=( const BigInt& rVal ); - BigInt& operator -=( const BigInt& rVal ); - BigInt& operator *=( const BigInt& rVal ); - BigInt& operator /=( const BigInt& rVal ); - BigInt& operator %=( const BigInt& rVal ); - - BigInt& operator =( const short nValue ); - BigInt& operator =( const long nValue ); - BigInt& operator =( const int nValue ); - BigInt& operator =( const sal_uInt16 nValue ); - - friend inline BigInt operator +( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline BigInt operator -( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline BigInt operator *( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline BigInt operator /( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline BigInt operator %( const BigInt& rVal1, const BigInt& rVal2 ); - - TOOLS_DLLPUBLIC friend sal_Bool operator==( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline sal_Bool operator!=( const BigInt& rVal1, const BigInt& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator< ( const BigInt& rVal1, const BigInt& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator> ( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline sal_Bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline sal_Bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ); - - friend class Fraction; -}; - -inline BigInt::BigInt() -{ - bIsSet = sal_False; - bIsBig = sal_False; - nVal = 0; -} - -inline BigInt::BigInt( short nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; -} - -inline BigInt::BigInt( long nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; -} - -inline BigInt::BigInt( int nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; -} - -inline BigInt::BigInt( sal_uInt16 nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; -} - -inline BigInt::operator short() const -{ - if ( !bIsBig && nVal >= SHRT_MIN && nVal <= SHRT_MAX ) - return (short)nVal; - else - return 0; -} - -inline BigInt::operator long() const -{ - if ( !bIsBig ) - return nVal; - else - return 0; -} - -inline BigInt::operator int() const -{ - if ( !bIsBig && (nVal == (long)(int)nVal) ) - return (int)nVal; - else - return 0; -} - -inline BigInt::operator sal_uInt16() const -{ - if ( !bIsBig && nVal >= 0 && nVal <= USHRT_MAX ) - return (sal_uInt16)nVal; - else - return 0; -} - -inline BigInt& BigInt::operator =( const short nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; - - return *this; -} - -inline BigInt& BigInt::operator =( const long nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; - - return *this; -} - -inline BigInt& BigInt::operator =( const int nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; - - return *this; -} - -inline BigInt& BigInt::operator =( const sal_uInt16 nValue ) -{ - bIsSet = sal_True; - bIsBig = sal_False; - nVal = nValue; - - return *this; -} - -inline sal_Bool BigInt::IsNeg() const -{ - if ( !bIsBig ) - return (nVal < 0); - else - return (sal_Bool)bIsNeg; -} - -inline sal_Bool BigInt::IsZero() const -{ - if ( bIsBig ) - return sal_False; - else - return (nVal == 0); -} - -inline sal_Bool BigInt::IsOne() const -{ - if ( bIsBig ) - return sal_False; - else - return (nVal == 1); -} - -inline void BigInt::Abs() -{ - if ( bIsBig ) - bIsNeg = sal_False; - else if ( nVal < 0 ) - nVal = -nVal; -} - -inline BigInt operator+( const BigInt &rVal1, const BigInt &rVal2 ) -{ - BigInt aErg( rVal1 ); - aErg += rVal2; - return aErg; -} - -inline BigInt operator-( const BigInt &rVal1, const BigInt &rVal2 ) -{ - BigInt aErg( rVal1 ); - aErg -= rVal2; - return aErg; -} - -inline BigInt operator*( const BigInt &rVal1, const BigInt &rVal2 ) -{ - BigInt aErg( rVal1 ); - aErg *= rVal2; - return aErg; -} - -inline BigInt operator/( const BigInt &rVal1, const BigInt &rVal2 ) -{ - BigInt aErg( rVal1 ); - aErg /= rVal2; - return aErg; -} - -inline BigInt operator%( const BigInt &rVal1, const BigInt &rVal2 ) -{ - BigInt aErg( rVal1 ); - aErg %= rVal2; - return aErg; -} - -inline sal_Bool operator!=( const BigInt& rVal1, const BigInt& rVal2 ) -{ - return !(rVal1 == rVal2); -} - -inline sal_Bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ) -{ - return !( rVal1 > rVal2); -} - -inline sal_Bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ) -{ - return !(rVal1 < rVal2); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/cachestr.hxx b/tools/inc/tools/cachestr.hxx deleted file mode 100644 index 60c31e298cf8..000000000000 --- a/tools/inc/tools/cachestr.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _CACHESTR_HXX -#define _CACHESTR_HXX - -#include <tools/stream.hxx> -#include <tools/string.hxx> -#include "tools/toolsdllapi.h" - -class TempFile; - -class TOOLS_DLLPUBLIC SvCacheStream : public SvStream -{ -private: - String aFileName; - sal_uIntPtr nMaxSize; - int bPersistent; - - SvStream* pSwapStream; - SvStream* pCurrentStream; - TempFile* pTempFile; - - TOOLS_DLLPRIVATE virtual sal_uIntPtr GetData( void* pData, - sal_uIntPtr nSize ); - TOOLS_DLLPRIVATE virtual sal_uIntPtr PutData( const void* pData, - sal_uIntPtr nSize ); - TOOLS_DLLPRIVATE virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); - TOOLS_DLLPRIVATE virtual void FlushData(); - TOOLS_DLLPRIVATE virtual void SetSize( sal_uIntPtr nSize ); - -public: - SvCacheStream( sal_uIntPtr nMaxMemSize = 0 ); - ~SvCacheStream(); - - void SetFilename( const String& rFN ) - { aFileName = rFN; } // call only from FilenameHdl - const String& GetFilename() const { return aFileName; } - - void SwapOut(); - const void* GetBuffer(); - sal_uIntPtr GetSize(); - - sal_Bool IsPersistent() { return bPersistent != 0; } - void SetPersistence( sal_Bool b = sal_True ) { bPersistent = b; } - void SetSwapStream( SvStream *p ) - { pSwapStream = p; } // call only from FilenameHdl -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx deleted file mode 100644 index 911088b9cad1..000000000000 --- a/tools/inc/tools/color.hxx +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_COLOR_HXX -#define _TOOLS_COLOR_HXX - -#include "tools/toolsdllapi.h" - -class SvStream; -class ResId; - -#include <tools/solar.h> -#include <basegfx/color/bcolor.hxx> - -// Color types -typedef sal_uInt32 ColorData; -#define RGB_COLORDATA( r,g,b ) ((ColorData)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16)) -#define TRGB_COLORDATA( t,r,g,b ) ((ColorData)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16)|(((sal_uInt32)((sal_uInt8)(t)))<<24)) -#define COLORDATA_RED( n ) ((sal_uInt8)((n)>>16)) -#define COLORDATA_GREEN( n ) ((sal_uInt8)(((sal_uInt16)(n)) >> 8)) -#define COLORDATA_BLUE( n ) ((sal_uInt8)(n)) -#define COLORDATA_TRANSPARENCY( n ) ((sal_uInt8)((n)>>24)) -#define COLORDATA_RGB( n ) ((ColorData)((n) & 0x00FFFFFF)) - -#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 ) -#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 ) -#define COL_GREEN RGB_COLORDATA( 0x00, 0x80, 0x00 ) -#define COL_CYAN RGB_COLORDATA( 0x00, 0x80, 0x80 ) -#define COL_RED RGB_COLORDATA( 0x80, 0x00, 0x00 ) -#define COL_MAGENTA RGB_COLORDATA( 0x80, 0x00, 0x80 ) -#define COL_BROWN RGB_COLORDATA( 0x80, 0x80, 0x00 ) -#define COL_GRAY RGB_COLORDATA( 0x80, 0x80, 0x80 ) -#define COL_LIGHTGRAY RGB_COLORDATA( 0xC0, 0xC0, 0xC0 ) -#define COL_LIGHTBLUE RGB_COLORDATA( 0x00, 0x00, 0xFF ) -#define COL_LIGHTGREEN RGB_COLORDATA( 0x00, 0xFF, 0x00 ) -#define COL_LIGHTCYAN RGB_COLORDATA( 0x00, 0xFF, 0xFF ) -#define COL_LIGHTRED RGB_COLORDATA( 0xFF, 0x00, 0x00 ) -#define COL_LIGHTMAGENTA RGB_COLORDATA( 0xFF, 0x00, 0xFF ) -#define COL_LIGHTGRAYBLUE RGB_COLORDATA( 0xE0, 0xE0, 0xFF ) -#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 ) -#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF ) -#define COL_TRANSPARENT TRGB_COLORDATA( 0xFF, 0xFF, 0xFF, 0xFF ) -#define COL_AUTO (ColorData)0xFFFFFFFF -#define COL_AUTHOR1_DARK RGB_COLORDATA(198, 146, 0) -#define COL_AUTHOR1_NORMAL RGB_COLORDATA(255, 255, 158) -#define COL_AUTHOR1_LIGHT RGB_COLORDATA(255, 255, 195) -#define COL_AUTHOR2_DARK RGB_COLORDATA(6, 70, 162) -#define COL_AUTHOR2_NORMAL RGB_COLORDATA(216, 232, 255) -#define COL_AUTHOR2_LIGHT RGB_COLORDATA(233, 242, 255) -#define COL_AUTHOR3_DARK RGB_COLORDATA(87, 157, 28) -#define COL_AUTHOR3_NORMAL RGB_COLORDATA(218, 248, 193) -#define COL_AUTHOR3_LIGHT RGB_COLORDATA(226, 250, 207) -#define COL_AUTHOR4_DARK RGB_COLORDATA(105, 43, 157) -#define COL_AUTHOR4_NORMAL RGB_COLORDATA(228, 210, 245) -#define COL_AUTHOR4_LIGHT RGB_COLORDATA(239, 228, 248) -#define COL_AUTHOR5_DARK RGB_COLORDATA(197, 0, 11) -#define COL_AUTHOR5_NORMAL RGB_COLORDATA(254, 205, 208) -#define COL_AUTHOR5_LIGHT RGB_COLORDATA(255, 227, 229) -#define COL_AUTHOR6_DARK RGB_COLORDATA(0, 128, 128) -#define COL_AUTHOR6_NORMAL RGB_COLORDATA(210, 246, 246) -#define COL_AUTHOR6_LIGHT RGB_COLORDATA(230, 250, 250) -#define COL_AUTHOR7_DARK RGB_COLORDATA(140, 132, 0) -#define COL_AUTHOR7_NORMAL RGB_COLORDATA(237, 252, 163) -#define COL_AUTHOR7_LIGHT RGB_COLORDATA(242, 254, 181) -#define COL_AUTHOR8_DARK RGB_COLORDATA(53, 85, 107) -#define COL_AUTHOR8_NORMAL RGB_COLORDATA(211, 222, 232) -#define COL_AUTHOR8_LIGHT RGB_COLORDATA(226, 234, 241) -#define COL_AUTHOR9_DARK RGB_COLORDATA(209, 118, 0) -#define COL_AUTHOR9_NORMAL RGB_COLORDATA(255, 226, 185) -#define COL_AUTHOR9_LIGHT RGB_COLORDATA(255, 231, 199) - -#define COLOR_CHANNEL_MERGE( _def_cDst, _def_cSrc, _def_cSrcTrans ) \ - ((sal_uInt8)((((long)(_def_cDst)-(_def_cSrc))*(_def_cSrcTrans)+(((_def_cSrc)<<8L)|(_def_cDst)))>>8L)) - -// Color - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Color -{ -protected: - ColorData mnColor; - -public: - Color() { mnColor = COL_BLACK; } - Color( ColorData nColor ) { mnColor = nColor; } - Color( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue ) - { mnColor = RGB_COLORDATA( nRed, nGreen, nBlue ); } - Color( sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue ) - { mnColor = TRGB_COLORDATA( nTransparency, nRed, nGreen, nBlue ); } - // This ctor is defined in svtools, not tools! - Color( const ResId& rResId ); - - // constructor to create a tools-Color from ::basegfx::BColor - explicit Color(const ::basegfx::BColor& rBColor) - { - mnColor = RGB_COLORDATA( - sal_uInt8((rBColor.getRed() * 255.0) + 0.5), - sal_uInt8((rBColor.getGreen() * 255.0) + 0.5), - sal_uInt8((rBColor.getBlue() * 255.0) + 0.5)); - } - - void SetRed( sal_uInt8 nRed ); - sal_uInt8 GetRed() const { return COLORDATA_RED( mnColor ); } - void SetGreen( sal_uInt8 nGreen ); - sal_uInt8 GetGreen() const { return COLORDATA_GREEN( mnColor ); } - void SetBlue( sal_uInt8 nBlue ); - sal_uInt8 GetBlue() const { return COLORDATA_BLUE( mnColor ); } - void SetTransparency( sal_uInt8 nTransparency ); - sal_uInt8 GetTransparency() const { return COLORDATA_TRANSPARENCY( mnColor ); } - - void SetColor( ColorData nColor ) { mnColor = nColor; } - ColorData GetColor() const { return mnColor; } - ColorData GetRGBColor() const { return COLORDATA_RGB( mnColor ); } - - sal_uInt8 GetColorError( const Color& rCompareColor ) const; - - sal_uInt8 GetLuminance() const; - void IncreaseLuminance( sal_uInt8 cLumInc ); - void DecreaseLuminance( sal_uInt8 cLumDec ); - - void DecreaseContrast( sal_uInt8 cContDec ); - - void Invert(); - - void Merge( const Color& rMergeColor, sal_uInt8 cTransparency ); - - sal_Bool IsRGBEqual( const Color& rColor ) const; - - // comparison with luminance thresholds - sal_Bool IsDark() const; - sal_Bool IsBright() const; - - // color space conversion tools - // the range for h/s/b is: - // Hue: 0-360 degree - // Saturation: 0-100 % - // Brightness: 0-100 % - static ColorData HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ); - void RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) const; - - sal_Bool operator==( const Color& rColor ) const - { return (mnColor == rColor.mnColor); } - sal_Bool operator!=( const Color& rColor ) const - { return !(Color::operator==( rColor )); } - - SvStream& Read( SvStream& rIStm, sal_Bool bNewFormat = sal_True ); - SvStream& Write( SvStream& rOStm, sal_Bool bNewFormat = sal_True ); - - TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Color& rColor ); - TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Color& rColor ); - - // get ::basegfx::BColor from this color - ::basegfx::BColor getBColor() const { return ::basegfx::BColor(GetRed() / 255.0, GetGreen() / 255.0, GetBlue() / 255.0); } -}; - -inline void Color::SetRed( sal_uInt8 nRed ) -{ - mnColor &= 0xFF00FFFF; - mnColor |= ((sal_uInt32)nRed)<<16; -} - -inline void Color::SetGreen( sal_uInt8 nGreen ) -{ - mnColor &= 0xFFFF00FF; - mnColor |= ((sal_uInt16)nGreen)<<8; -} - -inline void Color::SetBlue( sal_uInt8 nBlue ) -{ - mnColor &= 0xFFFFFF00; - mnColor |= nBlue; -} - -inline void Color::SetTransparency( sal_uInt8 nTransparency ) -{ - mnColor &= 0x00FFFFFF; - mnColor |= ((sal_uInt32)nTransparency)<<24; -} - -inline sal_Bool Color::IsRGBEqual( const Color& rColor ) const -{ - return (COLORDATA_RGB( mnColor ) == COLORDATA_RGB( rColor.mnColor )); -} - -inline sal_uInt8 Color::GetLuminance() const -{ - return( (sal_uInt8) ( ( COLORDATA_BLUE( mnColor ) * 29UL + - COLORDATA_GREEN( mnColor ) * 151UL + - COLORDATA_RED( mnColor ) * 76UL ) >> 8UL ) ); -} - -inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency ) -{ - SetRed( COLOR_CHANNEL_MERGE( COLORDATA_RED( mnColor ), COLORDATA_RED( rMergeColor.mnColor ), cTransparency ) ); - SetGreen( COLOR_CHANNEL_MERGE( COLORDATA_GREEN( mnColor ), COLORDATA_GREEN( rMergeColor.mnColor ), cTransparency ) ); - SetBlue( COLOR_CHANNEL_MERGE( COLORDATA_BLUE( mnColor ), COLORDATA_BLUE( rMergeColor.mnColor ), cTransparency ) ); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/config.hxx b/tools/inc/tools/config.hxx deleted file mode 100644 index 1e73d32b5a33..000000000000 --- a/tools/inc/tools/config.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _CONFIG_HXX -#define _CONFIG_HXX - -#include "tools/toolsdllapi.h" -#include <tools/string.hxx> - -struct ImplConfigData; -struct ImplGroupData; - -class TOOLS_DLLPUBLIC Config -{ -private: - OUString maFileName; - OString maGroupName; - ImplConfigData* mpData; - ImplGroupData* mpActGroup; - sal_uIntPtr mnDataUpdateId; - sal_uInt16 mnLockCount; - sal_Bool mbPersistence; - sal_Bool mbDummy1; - -#ifdef _CONFIG_CXX - TOOLS_DLLPRIVATE sal_Bool ImplUpdateConfig() const; - TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const; -#endif - -public: - Config( const OUString& rFileName ); - ~Config(); - - const OUString& GetPathName() const { return maFileName; } - - void SetGroup(const OString& rGroup); - const OString& GetGroup() const { return maGroupName; } - void DeleteGroup(const OString& rGroup); - OString GetGroupName(sal_uInt16 nGroup) const; - sal_uInt16 GetGroupCount() const; - sal_Bool HasGroup(const OString& rGroup) const; - - OString ReadKey(const OString& rKey) const; - OUString ReadKey(const OString& rKey, rtl_TextEncoding eEncoding) const; - OString ReadKey(const OString& rKey, const OString& rDefault) const; - void WriteKey(const OString& rKey, const OString& rValue); - void DeleteKey(const OString& rKey); - OString GetKeyName(sal_uInt16 nKey) const; - OString ReadKey(sal_uInt16 nKey) const; - sal_uInt16 GetKeyCount() const; - - sal_Bool IsLocked() const { return (mnLockCount != 0); } - void Flush(); - - void EnablePersistence( sal_Bool bPersistence = sal_True ) - { mbPersistence = bPersistence; } - sal_Bool IsPersistenceEnabled() const { return mbPersistence; } - -private: - TOOLS_DLLPRIVATE Config( const Config& rConfig ); - TOOLS_DLLPRIVATE Config& operator = ( const Config& rConfig ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/contnr.hxx b/tools/inc/tools/contnr.hxx deleted file mode 100644 index 5b31f6897d77..000000000000 --- a/tools/inc/tools/contnr.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _CONTNR_HXX -#define _CONTNR_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -#include <limits.h> - -#define CONTAINER_APPEND ULONG_MAX -#define CONTAINER_ENTRY_NOTFOUND ULONG_MAX -#define LIST_APPEND CONTAINER_APPEND - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/date.hxx b/tools/inc/tools/date.hxx deleted file mode 100644 index 22586c4aaf47..000000000000 --- a/tools/inc/tools/date.hxx +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _DATE_HXX -#define _DATE_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -class ResId; - -enum DayOfWeek { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, - SATURDAY, SUNDAY }; - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Date -{ -private: - sal_uInt32 nDate; - -public: - enum DateInitSystem - { - SYSTEM - }; - - // TODO temporary until all uses are inspected and resolved - enum DateInitEmpty - { - EMPTY - }; - - Date( DateInitEmpty) - { nDate = 0; } - Date( DateInitSystem ); - Date( const ResId & rResId ); - Date( sal_uInt32 _nDate ) { Date::nDate = _nDate; } - Date( const Date& rDate ) - { nDate = rDate.nDate; } - Date( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ) - { nDate = ( sal_uInt32( nDay % 100 ) ) + - ( ( sal_uInt32( nMonth % 100 ) ) * 100 ) + - ( ( sal_uInt32( nYear % 10000 ) ) * 10000); } - - void SetDate( sal_uInt32 nNewDate ) { nDate = nNewDate; } - sal_uInt32 GetDate() const { return nDate; } - - void SetDay( sal_uInt16 nNewDay ); - void SetMonth( sal_uInt16 nNewMonth ); - void SetYear( sal_uInt16 nNewYear ); - sal_uInt16 GetDay() const { return (sal_uInt16)(nDate % 100); } - sal_uInt16 GetMonth() const { return (sal_uInt16)((nDate / 100) % 100); } - sal_uInt16 GetYear() const { return (sal_uInt16)(nDate / 10000); } - - /// Internally normalizes a copy of values. - DayOfWeek GetDayOfWeek() const; - - /// Internally normalizes a copy of values. - sal_uInt16 GetDayOfYear() const; - - /** nMinimumNumberOfDaysInWeek: how many days of a week must reside in the - first week of a year. - Internally normalizes a copy of values. */ - sal_uInt16 GetWeekOfYear( DayOfWeek eStartDay = MONDAY, - sal_Int16 nMinimumNumberOfDaysInWeek = 4 ) const; - - /// Internally normalizes a copy of values. - sal_uInt16 GetDaysInMonth() const; - - sal_uInt16 GetDaysInYear() const { return (IsLeapYear()) ? 366 : 365; } - sal_Bool IsLeapYear() const; - - /** If the represented date is valid (1<=month<=12, 1<=day<=(28,29,30,31) - depending on month/year) AND is of the Gregorian calendar (1582-10-15 - <= date) (AND implicitly date <= 9999-12-31 due to internal - representation) */ - sal_Bool IsValidAndGregorian() const; - - /** If the represented date is valid (1<=month<=12, 1<=day<=(28,29,30,31) - depending on month/year) */ - bool IsValidDate() const; - - /** Normalize date, invalid day or month values are adapted such that they - carry over to the next month or/and year, for example 1999-02-32 - becomes 1999-03-04, 1999-13-01 becomes 2000-01-01, 1999-13-42 becomes - 2000-02-11. Truncates at 9999-12-31, 0000-00-x will yield the - normalized value of 0000-01-max(1,(x-31)) - - This may be necessary after Date ctors or if the SetDate(), SetDay(), - SetMonth(), SetYear() methods set individual non-matching values. - Adding/subtracting to/from dates never produces invalid dates. - - @returns TRUE if the date was normalized, i.e. not valid before. - */ - bool Normalize(); - - sal_Bool IsBetween( const Date& rFrom, const Date& rTo ) const - { return ((nDate >= rFrom.nDate) && - (nDate <= rTo.nDate)); } - - sal_Bool operator ==( const Date& rDate ) const - { return (nDate == rDate.nDate); } - sal_Bool operator !=( const Date& rDate ) const - { return (nDate != rDate.nDate); } - sal_Bool operator >( const Date& rDate ) const - { return (nDate > rDate.nDate); } - sal_Bool operator <( const Date& rDate ) const - { return (nDate < rDate.nDate); } - sal_Bool operator >=( const Date& rDate ) const - { return (nDate >= rDate.nDate); } - sal_Bool operator <=( const Date& rDate ) const - { return (nDate <= rDate.nDate); } - - Date& operator =( const Date& rDate ) - { nDate = rDate.nDate; return *this; } - Date& operator +=( long nDays ); - Date& operator -=( long nDays ); - Date& operator ++(); - Date& operator --(); - Date operator ++( int ); - Date operator --( int ); - - TOOLS_DLLPUBLIC friend Date operator +( const Date& rDate, long nDays ); - TOOLS_DLLPUBLIC friend Date operator -( const Date& rDate, long nDays ); - TOOLS_DLLPUBLIC friend long operator -( const Date& rDate1, const Date& rDate2 ); - - /// Internally normalizes values. - static long DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ); - /// Semantically identical to IsValidDate() member method. - static bool IsValidDate( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ); - /// Semantically identical to Normalize() member method. - static bool Normalize( sal_uInt16 & rDay, sal_uInt16 & rMonth, sal_uInt16 & rYear ); - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/datetime.hxx b/tools/inc/tools/datetime.hxx deleted file mode 100644 index 1de0f3d6432c..000000000000 --- a/tools/inc/tools/datetime.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _DATETIME_HXX -#define _DATETIME_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> -#include <tools/date.hxx> -#include <tools/time.hxx> - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED DateTime : public Date, public Time -{ -public: - enum DateTimeInitSystem - { - SYSTEM - }; - - // TODO temporary until all uses are inspected and resolved - enum DateTimeInitEmpty - { - EMPTY - }; - - DateTime( DateTimeInitEmpty ) : Date( Date::EMPTY ), Time( Time::EMPTY ) {} - DateTime( DateTimeInitSystem ) : Date( Date::SYSTEM ), Time( Time::SYSTEM ) {} - DateTime( const DateTime& rDateTime ) : - Date( rDateTime ), Time( rDateTime ) {} - DateTime( const Date& rDate ) : Date( rDate ), Time(0) {} - DateTime( const Time& rTime ) : Date(0), Time( rTime ) {} - DateTime( const Date& rDate, const Time& rTime ) : - Date( rDate ), Time( rTime ) {} - - sal_Bool IsBetween( const DateTime& rFrom, - const DateTime& rTo ) const; - - sal_Bool IsEqualIgnoreNanoSec( const DateTime& rDateTime ) const - { - if ( Date::operator!=( rDateTime ) ) - return sal_False; - return Time::IsEqualIgnoreNanoSec( rDateTime ); - } - - sal_Bool operator ==( const DateTime& rDateTime ) const - { return (Date::operator==( rDateTime ) && - Time::operator==( rDateTime )); } - sal_Bool operator !=( const DateTime& rDateTime ) const - { return (Date::operator!=( rDateTime ) || - Time::operator!=( rDateTime )); } - sal_Bool operator >( const DateTime& rDateTime ) const; - sal_Bool operator <( const DateTime& rDateTime ) const; - sal_Bool operator >=( const DateTime& rDateTime ) const; - sal_Bool operator <=( const DateTime& rDateTime ) const; - - long GetSecFromDateTime( const Date& rDate ) const; - - void ConvertToUTC() { *this -= Time::GetUTCOffset(); } - void ConvertToLocalTime() { *this += Time::GetUTCOffset(); } - - DateTime& operator +=( long nDays ) - { Date::operator+=( nDays ); return *this; } - DateTime& operator -=( long nDays ) - { Date::operator-=( nDays ); return *this; } - DateTime& operator +=( double fTimeInDays ); - DateTime& operator -=( double fTimeInDays ) - { return operator+=( -fTimeInDays ); } - DateTime& operator +=( const Time& rTime ); - DateTime& operator -=( const Time& rTime ); - - TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, long nDays ); - TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, long nDays ); - TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, double fTimeInDays ); - TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, double fTimeInDays ) - { return operator+( rDateTime, -fTimeInDays ); } - TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const Time& rTime ); - TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, const Time& rTime ); - TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); - TOOLS_DLLPUBLIC friend long operator -( const DateTime& rDateTime, const Date& rDate ) - { return (const Date&) rDateTime - rDate; } - - DateTime& operator =( const DateTime& rDateTime ); - - void GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper ); - static DateTime CreateFromWin32FileDateTime( const sal_uInt32 & rLower, const sal_uInt32 & rUpper ); -}; - -inline DateTime& DateTime::operator =( const DateTime& rDateTime ) -{ - Date::operator=( rDateTime ); - Time::operator=( rDateTime ); - return *this; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx deleted file mode 100644 index 54160502257a..000000000000 --- a/tools/inc/tools/debug.hxx +++ /dev/null @@ -1,496 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_DEBUG_HXX -#define _TOOLS_DEBUG_HXX - -#include "tools/toolsdllapi.h" - -#include <sal/detail/log.h> -#include <sal/types.h> -#include <tools/solar.h> - -/** The facilities provided by this header are deprecated. True assertions - (that detect broken program logic) should use standard assert (which aborts - if an assertion fails, and is controlled by the standard NDEBUG macro). - Logging of warnings (e.g., about malformed input) and traces (e.g., about - steps taken while executing some protocol) should use the facilities - provided by sal/log.hxx. - - Because the assertion macro (DBG_ASSERT) has been used for - true assertions as well as to log warnings, it maps to SAL_WARN instead of - standard assert. The warning and error macros (DBG_ASSERTWARNING, - DBG_WARNING, DBG_WARNING1, ..., DBG_WARNING3, DBG_ERRORFILE) all map to - SAL_INFO. -*/ - -#ifdef DBG_UTIL - -typedef void (*DbgPrintLine)( const sal_Char* pLine ); -typedef const sal_Char* (*DbgUsr)(const void* pThis ); -typedef void (*DbgTestSolarMutexProc)(); - -#define DBG_BUF_MAXLEN 16384 - -#define DBG_TEST_XTOR (0x00000FFF) -#define DBG_TEST_XTOR_THIS (0x00000001) -#define DBG_TEST_XTOR_FUNC (0x00000002) -#define DBG_TEST_XTOR_EXIT (0x00000004) -#define DBG_TEST_XTOR_REPORT (0x00000008) -#define DBG_TEST_XTOR_TRACE (0x00000010) - -#define DBG_TEST_PROFILING (0x01000000) -#define DBG_TEST_RESOURCE (0x02000000) -#define DBG_TEST_DIALOG (0x04000000) -#define DBG_TEST_BOLDAPPFONT (0x08000000) - -#define DBG_OUT_NULL 0 -#define DBG_OUT_FILE 1 -#define DBG_OUT_WINDOW 2 -#define DBG_OUT_SHELL 3 -#define DBG_OUT_MSGBOX 4 -#define DBG_OUT_TESTTOOL 5 -#define DBG_OUT_DEBUGGER 6 -#define DBG_OUT_ABORT 7 - -#define DBG_OUT_COUNT 8 - -// user (runtime) defined output channels -#define DBG_OUT_USER_CHANNEL_0 100 - -struct DbgData -{ - sal_uIntPtr nTestFlags; - sal_uIntPtr bOverwrite; - sal_uIntPtr nTraceOut; - sal_uIntPtr nWarningOut; - sal_uIntPtr nErrorOut; - sal_uIntPtr bHookOSLAssert; - sal_Char aDebugName[260]; - sal_Char aInclFilter[512]; - sal_Char aExclFilter[512]; - sal_Char aInclClassFilter[512]; - sal_Char aExclClassFilter[512]; - sal_Char aDbgWinState[50]; // DbgGUIData for VCL -}; - -struct DbgDataType -{ - void* pData; - sal_Char const * pName; -}; - -// Dbg prototypes -#define DBG_FUNC_DEBUGSTART 1 -#define DBG_FUNC_DEBUGEND 2 -#define DBG_FUNC_GLOBALDEBUGEND 3 -#define DBG_FUNC_GETDATA 4 -#define DBG_FUNC_SAVEDATA 5 -#define DBG_FUNC_SETPRINTMSGBOX 6 -#define DBG_FUNC_SETPRINTWINDOW 7 -#define DBG_FUNC_SETPRINTTESTTOOL 8 -#define DBG_FUNC_XTORINFO 10 -#define DBG_FUNC_COREDUMP 12 -#define DBG_FUNC_ALLERROROUT 13 -#define DBG_FUNC_SETTESTSOLARMUTEX 14 -#define DBG_FUNC_TESTSOLARMUTEX 15 -#define DBG_FUNC_PRINTFILE 16 -#define DBG_FUNC_GETPRINTMSGBOX 17 -#define DBG_FUNC_FILTERMESSAGE 18 // new for #i38967 -#define DBG_FUNC_UPDATEOSLHOOK 19 -#define DBG_FUNC_SET_ABORT 20 - -TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL ); - -inline void DbgUpdateOslHook( DbgData* pData ) -{ - DbgFunc( DBG_FUNC_UPDATEOSLHOOK, pData ); -} - -inline void DbgDebugStart() -{ - DbgFunc( DBG_FUNC_DEBUGSTART ); -} - -inline void DbgDebugEnd() -{ - DbgFunc( DBG_FUNC_DEBUGEND ); -} - -inline void DbgGlobalDebugEnd() -{ - DbgFunc( DBG_FUNC_GLOBALDEBUGEND ); -} - -inline void DbgSetPrintMsgBox( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(long)pProc ); -} - -inline DbgPrintLine DbgGetPrintMsgBox() -{ - return (DbgPrintLine)(long)DbgFunc( DBG_FUNC_GETPRINTMSGBOX ); -} - -inline void DbgSetPrintWindow( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(long)pProc ); -} - -inline void DbgSetPrintTestTool( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc ); -} - -inline void DbgSetAbort( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SET_ABORT, (void*)(long)pProc ); -} - -typedef sal_uInt16 DbgChannelId; - -/** registers a user-defined channel for emitting the diagnostic messages - - Note that such a user-defined channel cannot be revoked during the lifetime - of the process. Thus, it's the caller's responsibility to ensure that the - procedure to which ->pProc points remains valid. - - @param pProc - the function for emitting the diagnostic messages - @return - a unique number for this channel, which can be used for ->DbgData::nErrorOut, - ->DbgData::nWarningOut and ->DbgData::nTraceOut - @see DBG_OUT_USER_CHANNEL_0 - - (In theory, this function could replace the other hard-coded channels. Well, at least - the ones for MsgBox, Window, Shell, TestTool. Perhaps in the next life ...) -*/ -TOOLS_DLLPUBLIC DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc ); - -inline sal_Bool DbgFilterMessage( const char* pMsg ) -{ - return (sal_Bool)(long) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg ); -} - -inline int DbgIsAllErrorOut() -{ - return (DbgFunc( DBG_FUNC_ALLERROROUT ) != 0); -} - -inline DbgData* DbgGetData() -{ - return (DbgData*)DbgFunc( DBG_FUNC_GETDATA ); -} - -inline void DbgSaveData( const DbgData& rData ) -{ - DbgFunc( DBG_FUNC_SAVEDATA, (void*)&rData ); -} - -inline sal_uIntPtr DbgIsTraceOut() -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return (pData->nTraceOut != DBG_OUT_NULL); - else - return sal_False; -} - -inline sal_uIntPtr DbgIsWarningOut() -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return (pData->nWarningOut != DBG_OUT_NULL); - else - return sal_False; -} - -inline sal_uIntPtr DbgIsErrorOut() -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return (pData->nErrorOut != DBG_OUT_NULL); - else - return sal_False; -} - -inline sal_uIntPtr DbgGetErrorOut() // Testtool: test whether to collect OSL_ASSERTions as well -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return pData->nErrorOut; - else - return DBG_OUT_NULL; -} - -inline sal_uIntPtr DbgIsAssertWarning() -{ - return DbgIsWarningOut(); -} - -inline sal_uIntPtr DbgIsAssert() -{ - return DbgIsErrorOut(); -} - -inline sal_uIntPtr DbgIsResource() -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return pData->nTestFlags & DBG_TEST_RESOURCE; - else - return sal_False; -} - -inline sal_uIntPtr DbgIsDialog() -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return pData->nTestFlags & DBG_TEST_DIALOG; - else - return sal_False; -} - -inline sal_uIntPtr DbgIsBoldAppFont() -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return pData->nTestFlags & DBG_TEST_BOLDAPPFONT; - else - return sal_False; -} - -inline void DbgXtorInfo( sal_Char* pBuf ) -{ - DbgFunc( DBG_FUNC_XTORINFO, (void*)pBuf ); -} - -inline void DbgCoreDump() -{ - DbgFunc( DBG_FUNC_COREDUMP ); -} - -inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc ) -{ - DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, (void*)(long)pProc ); -} - -inline void DbgTestSolarMutex() -{ - DbgFunc( DBG_FUNC_TESTSOLARMUTEX ); -} - -inline void DbgPrintFile( const sal_Char* pLine ) -{ - DbgFunc( DBG_FUNC_PRINTFILE, (void*)(sal_Char*)pLine ); -} - -// Dbg output -#define DBG_OUT_TRACE 1 -#define DBG_OUT_WARNING 2 -#define DBG_OUT_ERROR 3 - -TOOLS_DLLPUBLIC void DbgOut( const sal_Char* pMsg, sal_uInt16 nOutType = DBG_OUT_TRACE, - const sal_Char* pFile = NULL, sal_uInt16 nLine = 0 ); -TOOLS_DLLPUBLIC void DbgPrintShell(char const * message); -TOOLS_DLLPUBLIC void DbgOutTypef( sal_uInt16 nOutType, const sal_Char* pFStr, ... ); -TOOLS_DLLPUBLIC void DbgOutf( const sal_Char* pFStr, ... ); -TOOLS_DLLPUBLIC void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... ); - -// Dbg test functions - -#define DBG_PROF_START 1 -#define DBG_PROF_STOP 2 -#define DBG_PROF_CONTINUE 3 -#define DBG_PROF_PAUSE 4 - -TOOLS_DLLPUBLIC void DbgProf( sal_uInt16 nAction, DbgDataType* ); - -#define DBG_XTOR_CTOR 1 -#define DBG_XTOR_DTOR 2 -#define DBG_XTOR_CHKTHIS 3 -#define DBG_XTOR_CHKOBJ 4 -#define DBG_XTOR_DTOROBJ 0x8000 - -TOOLS_DLLPUBLIC void DbgXtor( DbgDataType* pDbgData, - sal_uInt16 nAction, const void* pThis, DbgUsr fDbgUsr ); - -class DbgXtorObj -{ -private: - DbgDataType* pDbgData; - const void* pThis; - DbgUsr fDbgUsr; - sal_uInt16 nAction; - -public: - DbgXtorObj( DbgDataType* pData, - sal_uInt16 nAct, const void* pThs, DbgUsr fUsr ) - { - DbgXtor( pData, nAct, pThs, fUsr ); - pDbgData = pData; - nAction = nAct; - pThis = pThs; - fDbgUsr = fUsr; - } - - ~DbgXtorObj() - { - DbgXtor( pDbgData, nAction | DBG_XTOR_DTOROBJ, - pThis, fDbgUsr ); - } -}; - -// (internally used) defines - -#define DBG_FUNC( aName ) DbgName_##aName() -#define DBG_NAME( aName ) static DbgDataType aImpDbgData_##aName = { 0, #aName }; \ - DbgDataType* DBG_FUNC( aName ) { return &aImpDbgData_##aName; } -#define DBG_NAMEEX_VISIBILITY( aName, vis ) vis DbgDataType* DBG_FUNC( aName ); -#define DBG_NAMEEX( aName ) DBG_NAMEEX_VISIBILITY( aName, ) - -// (externally used) defines - -#define DBG_DEBUGSTART() DbgDebugStart() -#define DBG_DEBUGEND() DbgDebugEnd() -#define DBG_GLOBALDEBUGEND() DbgGlobalDebugEnd() - -#define DBG_PROFSTART( aName ) \ - DbgProf( DBG_PROF_START, DBG_FUNC( aName ) ) - -#define DBG_PROFSTOP( aName ) \ - DbgProf( DBG_PROF_STOP, DBG_FUNC( aName ) ) - -#define DBG_PROFCONTINUE( aName ) \ - DbgProf( DBG_PROF_CONTINUE, DBG_FUNC( aName ) ) - -#define DBG_PROFPAUSE( aName ) \ - DbgProf( DBG_PROF_PAUSE, DBG_FUNC( aName ) ) - -#define DBG_CTOR( aName, fTest ) \ - DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \ - DBG_XTOR_CTOR, \ - (const void*)this, \ - fTest ) - -#define DBG_DTOR( aName, fTest ) \ - DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \ - DBG_XTOR_DTOR, \ - (const void*)this, \ - fTest ) - -#define DBG_CHKTHIS( aName, fTest ) \ - DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \ - DBG_XTOR_CHKTHIS, \ - (const void*)this, \ - fTest ) - -#define DBG_CHKOBJ( pObj, aName, fTest ) \ - DbgXtor( DBG_FUNC( aName ), DBG_XTOR_CHKOBJ, \ - (const void*)pObj, (DbgUsr)fTest ) - -#define DBG_ASSERTWARNING( sCon, aWarning ) \ - SAL_DETAIL_INFO_IF_FORMAT(!(sCon), "legacy.tools", aWarning) - -#define DBG_ASSERT( sCon, aError ) \ - SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", aError) - -#define DBG_WARNING( aWarning ) \ - SAL_DETAIL_INFO_IF_FORMAT(true, "legacy.tools", aWarning) -#define DBG_WARNING1( aWarning, x1 ) \ - SAL_DETAIL_INFO_IF_FORMAT(true, "legacy.tools", aWarning, x1) -#define DBG_WARNING2( aWarning, x1, x2 ) \ - SAL_DETAIL_INFO_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2) -#define DBG_WARNING3( aWarning, x1, x2, x3 ) \ - SAL_DETAIL_INFO_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2, x3) - -#define DBG_ERRORFILE( aError ) \ - SAL_DETAIL_INFO_IF_FORMAT(true, "legacy.tools", aError, __FILE__, __LINE__) - -#define DBG_TESTSOLARMUTEX() \ -do \ -{ \ - DbgTestSolarMutex(); \ -} while(0) - -// en-/disable debug defines - -#define DBG_INSTOUTTRACE( nOut ) \ -do \ -{ \ - DbgGetData()->nTraceOut = nOut; \ -} while(0) - -#define DBG_INSTOUTWARNING( nOut ) \ -do \ -{ \ - DbgGetData()->nWarningOut = nOut; \ -} while(0) - -#define DBG_INSTOUTERROR( nOut ) \ -do \ -{ \ - DbgGetData()->nErrorOut = nOut; \ -} while(0) - -#else -// NO DBG_UITL - -struct DbgData; -struct DbgDataType; - -typedef void (*DbgPrintLine)( const sal_Char* pLine ); -typedef const sal_Char* (*DbgUsr)(const void* pThis ); - -#define DBG_DEBUGSTART() ((void)0) -#define DBG_DEBUGEND() ((void)0) -#define DBG_GLOBALDEBUGEND() ((void)0) - -#define DBG_NAME( aName ) -#define DBG_NAMEEX( aName ) -#define DBG_NAMEEX_VISIBILITY( aName, vis ) - -#define DBG_PROFSTART( aName ) ((void)0) -#define DBG_PROFSTOP( aName ) ((void)0) -#define DBG_PROFCONTINUE( aName ) ((void)0) -#define DBG_PROFPAUSE( aName ) ((void)0) - -#define DBG_CTOR( aName, fTest ) ((void)0) -#define DBG_DTOR( aName, fTest ) ((void)0) -#define DBG_CHKTHIS( aName, fTest ) ((void)0) -#define DBG_CHKOBJ( pObj, aName, fTest ) ((void)0) - -#define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0) -#define DBG_ASSERT( sCon, aError ) ((void)0) -#define DBG_WARNING( aWarning ) ((void)0) -#define DBG_WARNING1( aWarning, x1 ) ((void)0) -#define DBG_WARNING2( aWarning, x1, x2 ) ((void)0) -#define DBG_WARNING3( aWarning, x1, x2, x3 ) ((void)0) -#define DBG_ERRORFILE( aError ) ((void)0) - -#define DBG_TESTSOLARMUTEX() ((void)0) - -#define DBG_INSTOUTTRACE( nOut ) ((void)0) -#define DBG_INSTOUTWARNING( nOut ) ((void)0) -#define DBG_INSTOUTERROR( nOut ) ((void)0) - -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h deleted file mode 100644 index 261c0aecaf6d..000000000000 --- a/tools/inc/tools/diagnose_ex.h +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef TOOLS_DIAGNOSE_EX_H -#define TOOLS_DIAGNOSE_EX_H - -#include <osl/diagnose.h> -#include <rtl/ustring.hxx> - -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/lang/IllegalArgumentException.hpp> - -#include <boost/current_function.hpp> - -#define OSL_UNUSED( expression ) \ - (void)(expression) - -#if OSL_DEBUG_LEVEL > 0 - #include <com/sun/star/configuration/CorruptedConfigurationException.hpp> - #include <com/sun/star/task/ErrorCodeIOException.hpp> - #include <cppuhelper/exc_hlp.hxx> - #include <osl/diagnose.h> - #include <osl/thread.h> - #include <boost/current_function.hpp> - #include <typeinfo> - - /** reports a caught UNO exception via OSL diagnostics - - Note that whenever you use this, it might be an indicator that your error - handling is not correct .... - */ - #define DBG_UNHANDLED_EXCEPTION() \ - ::com::sun::star::uno::Any caught( ::cppu::getCaughtException() ); \ - OString sMessage( "caught an exception!" ); \ - sMessage += "\nin function:"; \ - sMessage += BOOST_CURRENT_FUNCTION; \ - sMessage += "\ntype: "; \ - sMessage += OUStringToOString( caught.getValueTypeName(), osl_getThreadTextEncoding() ); \ - ::com::sun::star::uno::Exception exception; \ - caught >>= exception; \ - if ( !exception.Message.isEmpty() ) \ - { \ - sMessage += "\nmessage: "; \ - sMessage += OUStringToOString( exception.Message, osl_getThreadTextEncoding() ); \ - } \ - if ( exception.Context.is() ) \ - { \ - const char* pContext = typeid( *exception.Context.get() ).name(); \ - sMessage += "\ncontext: "; \ - sMessage += pContext; \ - } \ - { \ - ::com::sun::star::configuration::CorruptedConfigurationException \ - specialized; \ - if ( caught >>= specialized ) \ - { \ - sMessage += "\ndetails: "; \ - sMessage += OUStringToOString( \ - specialized.Details, osl_getThreadTextEncoding() ); \ - } \ - } \ - { \ - ::com::sun::star::task::ErrorCodeIOException specialized; \ - if ( caught >>= specialized ) \ - { \ - sMessage += "\ndetails: "; \ - sMessage += OString::valueOf( specialized.ErrCode ); \ - } \ - } \ - sMessage += "\n"; \ - OSL_ENSURE( false, sMessage.getStr() ) - -#else // OSL_DEBUG_LEVEL - #define DBG_UNHANDLED_EXCEPTION() -#endif // OSL_DEBUG_LEVEL - -/** This macro asserts the given condition (in debug mode), and throws - an IllegalArgumentException afterwards. - */ -#define ENSURE_ARG_OR_THROW(c, m) if( !(c) ) { \ - OSL_ENSURE(c, m); \ - throw ::com::sun::star::lang::IllegalArgumentException( \ - OUString(BOOST_CURRENT_FUNCTION) + \ - OUString( ",\n" m ), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(), \ - 0 ); } -#define ENSURE_ARG_OR_THROW2(c, m, ifc, arg) if( !(c) ) { \ - OSL_ENSURE(c, m); \ - throw ::com::sun::star::lang::IllegalArgumentException( \ - OUString(BOOST_CURRENT_FUNCTION) + \ - OUString( ",\n" m ), \ - ifc, \ - arg ); } - -/** This macro asserts the given condition (in debug mode), and throws - an RuntimeException afterwards. - */ -#define ENSURE_OR_THROW(c, m) \ - if( !(c) ){ \ - OSL_ENSURE(c, m); \ - throw ::com::sun::star::uno::RuntimeException( \ - OUString(BOOST_CURRENT_FUNCTION) + \ - OUString( ",\n" m ), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); } - -#define ENSURE_OR_THROW2(c, m, ifc) \ - if( !(c) ) { \ - OSL_ENSURE(c, m); \ - throw ::com::sun::star::uno::RuntimeException( \ - OUString(BOOST_CURRENT_FUNCTION) + \ - OUString( ",\n" m ), \ - ifc ); } - -/** This macro asserts the given condition (in debug mode), and - returns the given value afterwards. - */ -#define ENSURE_OR_RETURN(c, m, r) if( !(c) ) { \ - OSL_ENSURE(c, m); \ - return r; } - -/** This macro asserts the given condition (in debug mode), and - returns false afterwards. - */ -#define ENSURE_OR_RETURN_FALSE(c, m) \ - ENSURE_OR_RETURN(c, m, false) - -/** This macro asserts the given condition (in debug mode), and - returns afterwards, without return value "void". - */ -#define ENSURE_OR_RETURN_VOID( c, m ) \ - if( !(c) ) \ - { \ - OSL_ENSURE( c, m ); \ - return; \ - } - - - -/** This macro asserts the given condition (in debug mode), and - returns afterwards, without return value "void". - */ -#define ENSURE_OR_RETURN_VOID( c, m ) \ - if( !(c) ) \ - { \ - OSL_ENSURE( c, m ); \ - return; \ - } - -/** asserts a given condition (in debug mode), and continues the most-inner - loop if the condition is not met -*/ -#define ENSURE_OR_CONTINUE( c, m ) \ - if ( !(c) ) \ - { \ - OSL_ENSURE( false, m ); \ - continue; \ - } - -/** asserts a given condition (in debug mode), and continues the most-inner - loop if the condition is not met -*/ -#define ENSURE_OR_BREAK( c, m ) \ - if ( !(c) ) \ - { \ - OSL_ENSURE( false, m ); \ - break; \ - } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/errcode.hxx b/tools/inc/tools/errcode.hxx deleted file mode 100644 index 884e9f09748e..000000000000 --- a/tools/inc/tools/errcode.hxx +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _ERRCODE_HXX -#define _ERRCODE_HXX - -#ifndef __RSC -#include <tools/solar.h> -#endif - -/* - -01234567012345670123456701234567 -|| || ||| || | -Warning || || | - | || || || | - Dynamic || || | - | || || | - Subsystemarea| || | - | || | - | || | - | || | - Class| | - | | - | | - | | - Code -*/ - -#define ERRCODE_BUTTON_OK 0x01 -#define ERRCODE_BUTTON_CANCEL 0x02 -#define ERRCODE_BUTTON_RETRY 0x04 -#define ERRCODE_BUTTON_OK_CANCEL 0x03 -#define ERRCODE_BUTTON_OK_RETRY_CANCEL 0x07 -#define ERRCODE_BUTTON_NO 0x08 -#define ERRCODE_BUTTON_YES 0x10 -#define ERRCODE_BUTTON_YES_NO 0x18 -#define ERRCODE_BUTTON_YES_NO_CANCEL 0x1a - -#define ERRCODE_BUTTON_DEF_OK 0x100 -#define ERRCODE_BUTTON_DEF_CANCEL 0x200 -#define ERRCODE_BUTTON_DEF_YES 0x300 -#define ERRCODE_BUTTON_DEF_NO 0x400 - -#define ERRCODE_MSG_ERROR 0x1000 -#define ERRCODE_MSG_WARNING 0x2000 -#define ERRCODE_MSG_INFO 0x3000 -#define ERRCODE_MSG_QUERY 0x4000 - -#define ERRCODE_ERROR_MASK 0x3fffffffUL -#define ERRCODE_WARNING_MASK 0x80000000UL -#define ERRCODE_RES_MASK 0x7fff - -#define ERRCODE_CLASS_SHIFT 8 -#define ERRCODE_AREA_SHIFT 13 -#define ERRCODE_DYNAMIC_SHIFT 26 - -#define ERRCODE_CLASS_MASK (31UL <<ERRCODE_CLASS_SHIFT) - -#define ERRCODE_DYNAMIC_START (1UL <<ERRCODE_DYNAMIC_SHIFT) -#define ERRCODE_DYNAMIC_COUNT 31UL -#define ERRCODE_DYNAMIC_MASK (31UL <<ERRCODE_DYNAMIC_SHIFT) - -#ifdef __RSC - -#define ERRCODE_TOERRID(x) (x & ~ERRCODE_DYNAMIC_MASK) -#define ERRCODE_TOERROR(x) \ - ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK)) - -#else - -typedef sal_uIntPtr ErrCode; - -inline sal_uIntPtr ERRCODE_TOERRID( sal_uIntPtr x ) -{ - return x & ~ERRCODE_DYNAMIC_MASK; -} - -inline sal_uIntPtr ERRCODE_TOERROR( sal_uIntPtr x ) -{ - return ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK)); -} - -#endif - -#define ERRCODE_AREA_TOOLS (0UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SV (1UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SFX (2UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_INET (3UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_IO ERRCODE_AREA_TOOLS - -#define ERRCODE_AREA_LIB1 (8UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SVX ERRCODE_AREA_LIB1 -#define ERRCODE_AREA_SVX_END (ERRCODE_AREA_SO-1) -#define ERRCODE_AREA_SO (9UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SO_END (ERRCODE_AREA_SBX-1) -#define ERRCODE_AREA_SBX (10UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SBX_END ((11UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_DB (11UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_DB_END ((12UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_JAVA (12UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_JAVA_END ((13UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_UUI (13UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_UUI_END ((14UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_LIB2 (14UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_LIB2_END ((15UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_CHAOS (15UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_CHAOS_END ((16UL << ERRCODE_AREA_SHIFT) - 1) - -#define ERRCODE_AREA_APP1 (32UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP2 (40UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP3 (48UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP4 (56UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP5 (64UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP6 (72UL << ERRCODE_AREA_SHIFT) - -#define ERRCODE_AREA_SC ERRCODE_AREA_APP1 -#define ERRCODE_AREA_SC_END (ERRCODE_AREA_APP2-1) - -#define ERRCODE_AREA_SD ERRCODE_AREA_APP2 -#define ERRCODE_AREA_SD_END (ERRCODE_AREA_APP3-1) - -#define ERRCODE_AREA_SW ERRCODE_AREA_APP4 -#define ERRCODE_AREA_SW_END (ERRCODE_AREA_APP5-1) - -#define ERRCODE_AREA_OFA ERRCODE_AREA_APP5 -#define ERRCODE_AREA_OFA_END (ERRCODE_AREA_APP6-1) - -#define ERRCODE_CLASS_NONE (0UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_ABORT (1UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_GENERAL (2UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_NOTEXISTS (3UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_ALREADYEXISTS (4UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_ACCESS (5UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_PATH (6UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_LOCKING (7UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_PARAMETER (8UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_SPACE (9UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_NOTSUPPORTED (10UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_READ (11UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_WRITE (12UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_UNKNOWN (13UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_VERSION (14UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_FORMAT (15UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_CREATE (16UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_IMPORT (17UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_EXPORT (18UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_FILTER (19UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_SO (20UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_SBX (21UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_RUNTIME (22UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_COMPILER (23UL << ERRCODE_CLASS_SHIFT) - -#define ERRCODE_NONE (0UL) -#define ERRCODE_ABORT ERRCODE_IO_ABORT - -#define ERRCODE_IO_MISPLACEDCHAR (1UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTEXISTS (2UL |ERRCODE_CLASS_NOTEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ALREADYEXISTS (3UL |ERRCODE_CLASS_ALREADYEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTADIRECTORY (4UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTAFILE (5UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDDEVICE (6UL |ERRCODE_CLASS_PATH|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ACCESSDENIED (7UL |ERRCODE_CLASS_ACCESS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_LOCKVIOLATION (8UL |ERRCODE_CLASS_LOCKING|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_OUTOFSPACE (9UL |ERRCODE_CLASS_SPACE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ISWILDCARD (11UL|ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTSUPPORTED (12UL|ERRCODE_CLASS_NOTSUPPORTED|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_GENERAL (13UL|ERRCODE_CLASS_GENERAL|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_TOOMANYOPENFILES (14UL|ERRCODE_CLASS_SPACE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTREAD (15UL|ERRCODE_CLASS_READ|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTWRITE (16UL|ERRCODE_CLASS_WRITE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_OUTOFMEMORY (17UL|ERRCODE_CLASS_SPACE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTSEEK (18UL|ERRCODE_CLASS_GENERAL|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTTELL (19UL|ERRCODE_CLASS_GENERAL|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_WRONGVERSION (20UL|ERRCODE_CLASS_VERSION|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_WRONGFORMAT (21UL|ERRCODE_CLASS_FORMAT|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDCHAR (22UL|ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_UNKNOWN (23UL|ERRCODE_CLASS_UNKNOWN|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDACCESS (24UL|ERRCODE_CLASS_ACCESS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTCREATE (25UL|ERRCODE_CLASS_CREATE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDPARAMETER (26UL|ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ABORT (27UL|ERRCODE_CLASS_ABORT|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTEXISTSPATH (28UL |ERRCODE_CLASS_NOTEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_PENDING (29UL |ERRCODE_CLASS_NOTEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_RECURSIVE (30UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NAMETOOLONG (31UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDLENGTH (32UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CURRENTDIR (33UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTSAMEDEVICE (34UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_DEVICENOTREADY (35UL |ERRCODE_CLASS_READ|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_BADCRC (36UL |ERRCODE_CLASS_READ|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_WRITEPROTECTED (37UL |ERRCODE_CLASS_ACCESS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_BROKENPACKAGE (38UL |ERRCODE_CLASS_FORMAT|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT (39UL |ERRCODE_CLASS_FORMAT|\ - ERRCODE_AREA_IO) - -// FsysErrorCodes -#define FSYS_ERR_OK ERRCODE_NONE -#define FSYS_ERR_MISPLACEDCHAR ERRCODE_IO_MISPLACEDCHAR -#define FSYS_ERR_INVALIDCHAR ERRCODE_IO_INVALIDCHAR -#define FSYS_ERR_NOTEXISTS ERRCODE_IO_NOTEXISTS -#define FSYS_ERR_ALREADYEXISTS ERRCODE_IO_ALREADYEXISTS -#define FSYS_ERR_NOTADIRECTORY ERRCODE_IO_NOTADIRECTORY -#define FSYS_ERR_NOTAFILE ERRCODE_IO_NOTAFILE -#define FSYS_ERR_INVALIDDEVICE ERRCODE_IO_INVALIDDEVICE -#define FSYS_ERR_ACCESSDENIED ERRCODE_IO_ACCESSDENIED -#define FSYS_ERR_LOCKVIOLATION ERRCODE_IO_LOCKVIOLATION -#define FSYS_ERR_VOLUMEFULL ERRCODE_IO_OUTOFSPACE -#define FSYS_ERR_ISWILDCARD ERRCODE_IO_ISWILDCARD -#define FSYS_ERR_NOTSUPPORTED ERRCODE_IO_NOTSUPPORTED -#define FSYS_ERR_UNKNOWN ERRCODE_IO_UNKNOWN - -// StreamErrorCodes -#define SVSTREAM_OK ERRCODE_NONE - -#define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL -#define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS -#define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH -#define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES -#define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED -#define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION -#define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION -#define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION - -#define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS -#define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL -#define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE -#define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER - -#define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD -#define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE -#define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK -#define SVSTREAM_TELL_ERROR ERRCODE_IO_CANTTELL - -#define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY - -#define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT -#define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION - -#define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE - -// For the EditEngine: -#define SVSTREAM_ERRBASE_USER ERRCODE_AREA_LIB1 - -#define PRINTER_OK ERRCODE_NONE -#define PRINTER_ABORT ERRCODE_IO_ABORT -#define PRINTER_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY -#define PRINTER_GENERALERROR ERRCODE_IO_GENERAL -#define PRINTER_ACCESSDENIED ERRCODE_IO_ACCESSDENIED - -#define ERRCODE_INET_NAME_RESOLVE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1) -#define ERRCODE_INET_CONNECT (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2) -#define ERRCODE_INET_READ (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 3) -#define ERRCODE_INET_WRITE (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 4) -#define ERRCODE_INET_GENERAL (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE |5) -#define ERRCODE_INET_OFFLINE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ |6) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/errinf.hxx b/tools/inc/tools/errinf.hxx deleted file mode 100644 index 815447b7372f..000000000000 --- a/tools/inc/tools/errinf.hxx +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef __RSC - -#ifndef _EINF_HXX -#define _EINF_HXX - -#include <limits.h> -#include <tools/rtti.hxx> -#include <tools/errcode.hxx> -#include <tools/string.hxx> -#include "tools/toolsdllapi.h" - -class EDcr_Impl; -class ErrHdl_Impl; -class Window; - -class ErrorInfo -{ -private: - sal_uIntPtr lUserId; - -public: - TYPEINFO(); - - ErrorInfo( sal_uIntPtr lArgUserId ) : - lUserId( lArgUserId ){} - virtual ~ErrorInfo(){} - - sal_uIntPtr GetErrorCode() const { return lUserId; } - - static ErrorInfo* GetErrorInfo(sal_uIntPtr); -}; - -class TOOLS_DLLPUBLIC DynamicErrorInfo : public ErrorInfo -{ - friend class EDcr_Impl; - -private: - EDcr_Impl* pImpl; - -public: - TYPEINFO(); - - DynamicErrorInfo(sal_uIntPtr lUserId, sal_uInt16 nMask); - virtual ~DynamicErrorInfo(); - - operator sal_uIntPtr() const; - sal_uInt16 GetDialogMask() const; -}; - -class TOOLS_DLLPUBLIC StringErrorInfo : public DynamicErrorInfo -{ -private: - OUString aString; - -public: - TYPEINFO(); - - StringErrorInfo( sal_uIntPtr lUserId, - const OUString& aStringP, - sal_uInt16 nFlags = 0); - const OUString& GetErrorString() const { return aString; } -}; - -class TOOLS_DLLPUBLIC TwoStringErrorInfo: public DynamicErrorInfo -{ -private: - OUString aArg1; - OUString aArg2; - -public: - TYPEINFO(); - - TwoStringErrorInfo(sal_uIntPtr nUserID, const OUString & rTheArg1, - const OUString & rTheArg2, sal_uInt16 nFlags = 0): - DynamicErrorInfo(nUserID, nFlags), aArg1(rTheArg1), aArg2(rTheArg2) {} - - virtual ~TwoStringErrorInfo() {} - - const OUString& GetArg1() const { return aArg1; } - const OUString& GetArg2() const { return aArg2; } -}; - -class TOOLS_DLLPUBLIC MessageInfo : public DynamicErrorInfo -{ -public: - TYPEINFO(); - - MessageInfo(sal_uIntPtr UserId, sal_uInt16 nFlags = 0) : - DynamicErrorInfo(UserId, nFlags) {} - MessageInfo(sal_uIntPtr UserId, const OUString &rArg, sal_uInt16 nFlags = 0 ) : - DynamicErrorInfo(UserId, nFlags), aArg(rArg) {} - - const OUString& GetMessageArg() const { return aArg; } - -private: - OUString aArg; -}; - -class TOOLS_DLLPUBLIC ErrorContext -{ - friend class ErrorHandler; - -private: - ErrorContext* pNext; - Window* pWin; - -public: - ErrorContext(Window *pWin=0); - virtual ~ErrorContext(); - - virtual sal_Bool GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0; - Window* GetParent() { return pWin; } - - static ErrorContext* GetContext(); -}; - -typedef sal_uInt16 WindowDisplayErrorFunc( - Window *, sal_uInt16 nMask, const OUString &rErr, const OUString &rAction); - -typedef void BasicDisplayErrorFunc( - const OUString &rErr, const OUString &rAction); - -class TOOLS_DLLPUBLIC ErrorHandler -{ - friend class ErrHdl_Impl; - -private: - ErrHdl_Impl* pImpl; - - static sal_uInt16 HandleError_Impl( sal_uIntPtr lId, - sal_uInt16 nFlags, - sal_Bool bJustCreateString, - OUString & rError); -protected: - virtual sal_Bool CreateString( const ErrorInfo *, - OUString &, sal_uInt16& nMask ) const = 0; - -public: - ErrorHandler(); - virtual ~ErrorHandler(); - - static sal_uInt16 HandleError ( sal_uIntPtr lId, sal_uInt16 nMask = USHRT_MAX ); - static sal_Bool GetErrorString( sal_uIntPtr lId, OUString& rStr ); - - static void RegisterDisplay( BasicDisplayErrorFunc* ); - static void RegisterDisplay( WindowDisplayErrorFunc* ); -}; - -class TOOLS_DLLPUBLIC SimpleErrorHandler : private ErrorHandler -{ -protected: - virtual sal_Bool CreateString( const ErrorInfo*, OUString &, - sal_uInt16 &nMask ) const; - -public: - SimpleErrorHandler(); -}; - -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/extendapplicationenvironment.hxx b/tools/inc/tools/extendapplicationenvironment.hxx deleted file mode 100644 index b6ccbf8d5491..000000000000 --- a/tools/inc/tools/extendapplicationenvironment.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_TOOLS_EXTENDAPPLICATIONENVIRONMENT_HXX -#define INCLUDED_TOOLS_EXTENDAPPLICATIONENVIRONMENT_HXX - -#include "sal/config.h" -#include "tools/toolsdllapi.h" - -namespace tools { - -// Extend the environment of the process in a platform specifc way as necessary -// for OOo-related applications; must be called first thing in main: -TOOLS_DLLPUBLIC void extendApplicationEnvironment(); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fldunit.hxx b/tools/inc/tools/fldunit.hxx deleted file mode 100644 index 2b4a9158dfec..000000000000 --- a/tools/inc/tools/fldunit.hxx +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_FLDUNIT_HXX -#define _TOOLS_FLDUNIT_HXX - -enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, - FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, - FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CHAR, FUNIT_LINE, FUNIT_CUSTOM, - FUNIT_PERCENT, FUNIT_100TH_MM }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fontenum.hxx b/tools/inc/tools/fontenum.hxx deleted file mode 100644 index 7a53e931cc1c..000000000000 --- a/tools/inc/tools/fontenum.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_FONTENUM_HXX -#define _TOOLS_FONTENUM_HXX - -#include <sal/types.h> -#include <tools/solar.h> - -#ifndef ENUM_FONTFAMILY_DECLARED -#define ENUM_FONTFAMILY_DECLARED -enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN, - FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTPITCH_DECLARED -#define ENUM_FONTPITCH_DECLARED -enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_TEXTALIGN_DECLARED -#define ENUM_TEXTALIGN_DECLARED -enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTWEIGHT_DECLARED -#define ENUM_FONTWEIGHT_DECLARED -enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT, - WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL, - WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD, - WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTWIDTH_DECLARED -#define ENUM_FONTWIDTH_DECLARED -enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED, - WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL, - WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED, - WIDTH_ULTRA_EXPANDED, - FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTITALIC_DECLARED -#define ENUM_FONTITALIC_DECLARED -enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTUNDERLINE_DECLARED -#define ENUM_FONTUNDERLINE_DECLARED -enum FontUnderline { UNDERLINE_NONE, UNDERLINE_SINGLE, UNDERLINE_DOUBLE, - UNDERLINE_DOTTED, UNDERLINE_DONTKNOW, - UNDERLINE_DASH, UNDERLINE_LONGDASH, - UNDERLINE_DASHDOT, UNDERLINE_DASHDOTDOT, - UNDERLINE_SMALLWAVE, - UNDERLINE_WAVE, UNDERLINE_DOUBLEWAVE, - UNDERLINE_BOLD, UNDERLINE_BOLDDOTTED, - UNDERLINE_BOLDDASH, UNDERLINE_BOLDLONGDASH, - UNDERLINE_BOLDDASHDOT, UNDERLINE_BOLDDASHDOTDOT, - UNDERLINE_BOLDWAVE, - FontUnderline_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTSTRIKEOUT_DECLARED -#define ENUM_FONTSTRIKEOUT_DECLARED -enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE, - STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD, - STRIKEOUT_SLASH, STRIKEOUT_X, - FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTEMPHASISMARK_DECLARED -#define ENUM_FONTEMPHASISMARK_DECLARED - -typedef sal_uInt16 FontEmphasisMark; -#define EMPHASISMARK_NONE ((FontEmphasisMark)0x0000) -#define EMPHASISMARK_DOT ((FontEmphasisMark)0x0001) -#define EMPHASISMARK_CIRCLE ((FontEmphasisMark)0x0002) -#define EMPHASISMARK_DISC ((FontEmphasisMark)0x0003) -#define EMPHASISMARK_ACCENT ((FontEmphasisMark)0x0004) -#define EMPHASISMARK_STYLE ((FontEmphasisMark)0x00FF) -#define EMPHASISMARK_POS_ABOVE ((FontEmphasisMark)0x1000) -#define EMPHASISMARK_POS_BELOW ((FontEmphasisMark)0x2000) - -// Only for compability -#define EMPHASISMARK_DOTS_ABOVE (EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE) -#define EMPHASISMARK_DOTS_BELOW (EMPHASISMARK_DOT | EMPHASISMARK_POS_BELOW) -#define EMPHASISMARK_SIDE_DOTS (EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE) -#define EMPHASISMARK_CIRCLE_ABOVE (EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE) - -#endif - -#ifndef ENUM_FONTTYPE_DECLARED -#define ENUM_FONTTYPE_DECLARED -enum FontType { TYPE_DONTKNOW, TYPE_RASTER, TYPE_VECTOR, TYPE_SCALABLE, - FontType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -#endif - -#ifndef ENUM_FONTEMBEDDEDBITMAP_DECLARED -#define ENUM_FONTEMBEDDEDBITMAP_DECLARED -enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE }; -#endif - -#ifndef ENUM_FONTANTIALIAS_DECLARED -#define ENUM_FONTANTIALIAS_DECLARED -enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE }; -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/fract.hxx b/tools/inc/tools/fract.hxx deleted file mode 100644 index 24c6721f0fa3..000000000000 --- a/tools/inc/tools/fract.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _FRACT_HXX -#define _FRACT_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -class SvStream; - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Fraction -{ -private: - long nNumerator; - long nDenominator; - -public: - Fraction() { nNumerator = 0; nDenominator = 1; } - Fraction( const Fraction & rFrac ); - Fraction( long nNum, long nDen=1 ); - Fraction( double dVal ); - - bool IsValid() const; - - long GetNumerator() const { return nNumerator; } - long GetDenominator() const { return nDenominator; } - - operator long() const; - operator double() const; - - Fraction& operator=( const Fraction& rfrFrac ); - - Fraction& operator+=( const Fraction& rfrFrac ); - Fraction& operator-=( const Fraction& rfrFrac ); - Fraction& operator*=( const Fraction& rfrFrac ); - Fraction& operator/=( const Fraction& rfrFrac ); - - void ReduceInaccurate( unsigned nSignificantBits ); - - friend inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ); - - TOOLS_DLLPUBLIC friend bool operator==( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline bool operator!=( const Fraction& rVal1, const Fraction& rVal2 ); - TOOLS_DLLPUBLIC friend bool operator< ( const Fraction& rVal1, const Fraction& rVal2 ); - TOOLS_DLLPUBLIC friend bool operator> ( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline bool operator<=( const Fraction& rVal1, const Fraction& rVal2 ); - friend inline bool operator>=( const Fraction& rVal1, const Fraction& rVal2 ); - - TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Fraction& rFract ); - TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Fraction& rFract ); -}; - -inline Fraction::Fraction( const Fraction& rFrac ) -{ - nNumerator = rFrac.nNumerator; - nDenominator = rFrac.nDenominator; -} - -inline Fraction& Fraction::operator=( const Fraction& rFrac ) -{ - nNumerator = rFrac.nNumerator; - nDenominator = rFrac.nDenominator; - return *this; -} - -inline bool Fraction::IsValid() const -{ - return (nDenominator > 0); -} - -inline Fraction::operator long() const -{ - if ( nDenominator > 0 ) - return (nNumerator / nDenominator); - else - return 0; -} - -inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 ) -{ - Fraction aErg( rVal1 ); - aErg += rVal2; - return aErg; -} - -inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 ) -{ - Fraction aErg( rVal1 ); - aErg -= rVal2; - return aErg; -} - -inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 ) -{ - Fraction aErg( rVal1 ); - aErg *= rVal2; - return aErg; -} - -inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 ) -{ - Fraction aErg( rVal1 ); - aErg /= rVal2; - return aErg; -} - -inline bool operator !=( const Fraction& rVal1, const Fraction& rVal2 ) -{ - return !(rVal1 == rVal2); -} - -inline bool operator <=( const Fraction& rVal1, const Fraction& rVal2 ) -{ - return !(rVal1 > rVal2); -} - -inline bool operator >=( const Fraction& rVal1, const Fraction& rVal2 ) -{ - return !(rVal1 < rVal2); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx deleted file mode 100644 index c1a1e359bccc..000000000000 --- a/tools/inc/tools/gen.hxx +++ /dev/null @@ -1,692 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _SV_GEN_HXX -#define _SV_GEN_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -#include <limits.h> -#include <ostream> -#include <cstdlib> - -class SvStream; - -// Pair - -class SAL_WARN_UNUSED Pair -{ -public: - Pair(); - Pair( long nA, long nB ); - - long A() const { return nA; } - long B() const { return nB; } - - long& A() { return nA; } - long& B() { return nB; } - - sal_Bool operator == ( const Pair& rPair ) const; - sal_Bool operator != ( const Pair& rPair ) const; - - TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Pair& rPair ); - TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Pair& rPair ); - -protected: - long nA; - long nB; -}; - -inline Pair::Pair() -{ - nA = nB = 0; -} - -inline Pair::Pair( long _nA, long _nB ) -{ - Pair::nA = _nA; - Pair::nB = _nB; -} - -inline sal_Bool Pair::operator == ( const Pair& rPair ) const -{ - return ((nA == rPair.nA) && (nB == rPair.nB)); -} - -inline sal_Bool Pair::operator != ( const Pair& rPair ) const -{ - return ((nA != rPair.nA) || (nB != rPair.nB)); -} - -// Point - -class SAL_WARN_UNUSED Point : public Pair -{ -public: - Point(); - Point( long nX, long nY ); - - long X() const { return nA; } - long Y() const { return nB; } - - long& X() { return nA; } - long& Y() { return nB; } - - void Move( long nHorzMove, long nVertMove ); - sal_Bool IsAbove( const Point& rPoint ) const; - sal_Bool IsBelow( const Point& rPoint ) const; - sal_Bool IsLeft( const Point& rPoint ) const; - sal_Bool IsRight( const Point& rPoint ) const; - - Point& operator += ( const Point& rPoint ); - Point& operator -= ( const Point& rPoint ); - Point& operator *= ( const long nVal ); - Point& operator /= ( const long nVal ); - - friend inline Point operator+( const Point &rVal1, const Point &rVal2 ); - friend inline Point operator-( const Point &rVal1, const Point &rVal2 ); - friend inline Point operator*( const Point &rVal1, const long nVal2 ); - friend inline Point operator/( const Point &rVal1, const long nVal2 ); - - long getX() const { return X(); } - long getY() const { return Y(); } - void setX(long nX) { X() = nX; } - void setY(long nY) { Y() = nY; } -}; - -inline Point::Point() -{ -} - -inline Point::Point( long nX, long nY ) : Pair( nX, nY ) -{ -} - -inline void Point::Move( long nHorzMove, long nVertMove ) -{ - nA += nHorzMove; - nB += nVertMove; -} - -inline sal_Bool Point::IsAbove( const Point& rPoint ) const -{ - return (nB > rPoint.nB); -} - -inline sal_Bool Point::IsBelow( const Point& rPoint ) const -{ - return (nB < rPoint.nB); -} - -inline sal_Bool Point::IsLeft( const Point& rPoint ) const -{ - return (nA < rPoint.nA); -} - -inline sal_Bool Point::IsRight( const Point& rPoint ) const -{ - return (nA > rPoint.nA); -} - -inline Point& Point::operator += ( const Point& rPoint ) -{ - nA += rPoint.nA; - nB += rPoint.nB; - return *this; -} - -inline Point& Point::operator -= ( const Point& rPoint ) -{ - nA -= rPoint.nA; - nB -= rPoint.nB; - return *this; -} - -inline Point& Point::operator *= ( const long nVal ) -{ - nA *= nVal; - nB *= nVal; - return *this; -} - -inline Point& Point::operator /= ( const long nVal ) -{ - nA /= nVal; - nB /= nVal; - return *this; -} - -inline Point operator+( const Point &rVal1, const Point &rVal2 ) -{ - return Point( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB ); -} - -inline Point operator-( const Point &rVal1, const Point &rVal2 ) -{ - return Point( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB ); -} - -inline Point operator*( const Point &rVal1, const long nVal2 ) -{ - return Point( rVal1.nA*nVal2, rVal1.nB*nVal2 ); -} - -inline Point operator/( const Point &rVal1, const long nVal2 ) -{ - return Point( rVal1.nA/nVal2, rVal1.nB/nVal2 ); -} - -template< typename charT, typename traits > -inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Point& point ) -{ - return stream << point.X() << ',' << point.Y(); -} - -// Size - -class SAL_WARN_UNUSED Size : public Pair -{ -public: - Size(); - Size( long nWidth, long nHeight ); - - long Width() const { return nA; } - long Height() const { return nB; } - - long& Width() { return nA; } - long& Height() { return nB; } - - long getWidth() const { return Width(); } - long getHeight() const { return Height(); } - void setWidth(long nWidth) { Width() = nWidth; } - void setHeight(long nHeight) { Height() = nHeight; } -}; - -inline Size::Size() -{ -} - -inline Size::Size( long nWidth, long nHeight ) : - Pair( nWidth, nHeight ) -{ -} - -template< typename charT, typename traits > -inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Size& size ) -{ - return stream << size.Width() << 'x' << size.Height(); -} - -// Range - -#define RANGE_MAX LONG_MAX - -class SAL_WARN_UNUSED Range : public Pair -{ -public: - Range(); - Range( long nMin, long nMax ); - - long Min() const { return nA; } - long Max() const { return nB; } - long Len() const { return nB - nA + 1; } - - long& Min() { return nA; } - long& Max() { return nB; } - - sal_Bool IsInside( long nIs ) const; - - void Justify(); -}; - -inline Range::Range() -{ -} - -inline Range::Range( long nMin, long nMax ) : Pair( nMin, nMax ) -{ -} - -inline sal_Bool Range::IsInside( long nIs ) const -{ - return ((nA <= nIs) && (nIs <= nB )); -} - -inline void Range::Justify() -{ - if ( nA > nB ) - { - long nHelp = nA; - nA = nB; - nB = nHelp; - } -} - -template< typename charT, typename traits > -inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Range& range ) -{ - return stream << range.Min() << '-' << range.Max(); -} - -// Selection - -#define SELECTION_MIN LONG_MIN -#define SELECTION_MAX LONG_MAX - -class SAL_WARN_UNUSED Selection : public Pair -{ -public: - Selection(); - Selection( long nPos ); - Selection( long nMin, long nMax ); - - long Min() const { return nA; } - long Max() const { return nB; } - long Len() const { return nB - nA; } - - long& Min() { return nA; } - long& Max() { return nB; } - - sal_Bool IsInside( long nIs ) const; - - void Justify(); - - sal_Bool operator !() const { return !Len(); } - - long getMin() const { return Min(); } - long getMax() const { return Max(); } - void setMin(long nMin) { Min() = nMin; } - void setMax(long nMax) { Max() = nMax; } -}; - -inline Selection::Selection() -{ -} - -inline Selection::Selection( long nPos ) : Pair( nPos, nPos ) -{ -} - -inline Selection::Selection( long nMin, long nMax ) : - Pair( nMin, nMax ) -{ -} - -inline sal_Bool Selection::IsInside( long nIs ) const -{ - return ((nA <= nIs) && (nIs < nB )); -} - -inline void Selection::Justify() -{ - if ( nA > nB ) - { - long nHelp = nA; - nA = nB; - nB = nHelp; - } -} - -template< typename charT, typename traits > -inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Selection& selection ) -{ - return stream << selection.Min() << '-' << selection.Max(); -} -// Rectangle - -#define RECT_EMPTY ((short)-32767) - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Rectangle -{ -public: - Rectangle(); - Rectangle( const Point& rLT, const Point& rRB ); - Rectangle( long nLeft, long nTop, - long nRight, long nBottom ); - Rectangle( const Point& rLT, const Size& rSize ); - - long Left() const { return nLeft; } - long Right() const { return nRight; } - long Top() const { return nTop; } - long Bottom() const { return nBottom; } - - long& Left() { return nLeft; } - long& Right() { return nRight; } - long& Top() { return nTop; } - long& Bottom() { return nBottom; } - - inline Point TopLeft() const; - inline Point TopRight() const; - inline Point TopCenter() const; - inline Point BottomLeft() const; - inline Point BottomRight() const; - inline Point BottomCenter() const; - inline Point LeftCenter() const; - inline Point RightCenter() const; - inline Point Center() const; - - inline void Move( long nHorzMove, long nVertMove ); - inline void Transpose(); - inline void SetPos( const Point& rPoint ); - void SetSize( const Size& rSize ); - inline Size GetSize() const; - - inline long GetWidth() const; - inline long GetHeight() const; - - Rectangle& Union( const Rectangle& rRect ); - Rectangle& Intersection( const Rectangle& rRect ); - inline Rectangle GetUnion( const Rectangle& rRect ) const; - inline Rectangle GetIntersection( const Rectangle& rRect ) const; - - void Justify(); - - sal_Bool IsInside( const Point& rPOINT ) const; - sal_Bool IsInside( const Rectangle& rRect ) const; - sal_Bool IsOver( const Rectangle& rRect ) const; - - void SetEmpty() { nRight = nBottom = RECT_EMPTY; } - inline sal_Bool IsEmpty() const; - - inline sal_Bool operator == ( const Rectangle& rRect ) const; - inline sal_Bool operator != ( const Rectangle& rRect ) const; - - inline Rectangle& operator += ( const Point& rPt ); - inline Rectangle& operator -= ( const Point& rPt ); - - friend inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt ); - friend inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ); - - TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Rectangle& rRect ); - TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect ); - - // ONE - long getX() const { return nLeft; } - long getY() const { return nTop; } - long getWidth() const { return nRight - nLeft; } - long getHeight() const { return nBottom - nTop; } - void setX( long n ) { nRight += n-nLeft; nLeft = n; } - void setY( long n ) { nBottom += n-nTop; nTop = n; } - void setWidth( long n ) { nRight = nLeft + n; } - void setHeight( long n ) { nBottom = nTop + n; } - -private: - long nLeft; - long nTop; - long nRight; - long nBottom; -}; - -inline Rectangle::Rectangle() -{ - nLeft = nTop = 0; - nRight = nBottom = RECT_EMPTY; -} - -inline Rectangle::Rectangle( const Point& rLT, const Point& rRB ) -{ - nLeft = rLT.X(); - nTop = rLT.Y(); - nRight = rRB.X(); - nBottom = rRB.Y(); -} - -inline Rectangle::Rectangle( long _nLeft, long _nTop, - long _nRight, long _nBottom ) -{ - nLeft = _nLeft; - nTop = _nTop; - nRight = _nRight; - nBottom = _nBottom; -} - -inline Rectangle::Rectangle( const Point& rLT, const Size& rSize ) -{ - nLeft = rLT.X(); - nTop = rLT.Y(); - nRight = rSize.Width() ? nLeft+rSize.Width()-1 : RECT_EMPTY; - nBottom = rSize.Height() ? nTop+rSize.Height()-1 : RECT_EMPTY; -} - -inline sal_Bool Rectangle::IsEmpty() const -{ - return ((nRight == RECT_EMPTY) || (nBottom == RECT_EMPTY)); -} - -inline Point Rectangle::TopLeft() const -{ - return Point( nLeft, nTop ); -} - -inline Point Rectangle::TopRight() const -{ - return Point( (nRight == RECT_EMPTY) ? nLeft : nRight, nTop ); -} - -inline Point Rectangle::BottomLeft() const -{ - return Point( nLeft, (nBottom == RECT_EMPTY) ? nTop : nBottom ); -} - -inline Point Rectangle::BottomRight() const -{ - return Point( (nRight == RECT_EMPTY) ? nLeft : nRight, - (nBottom == RECT_EMPTY) ? nTop : nBottom ); -} - -inline Point Rectangle::TopCenter() const -{ - if ( IsEmpty() ) - return Point( nLeft, nTop ); - else - return Point( std::min( nLeft, nRight ) + std::abs( (nRight - nLeft)/2 ), - std::min( nTop, nBottom) ); -} - -inline Point Rectangle::BottomCenter() const -{ - if ( IsEmpty() ) - return Point( nLeft, nTop ); - else - return Point( std::min( nLeft, nRight ) + std::abs( (nRight - nLeft)/2 ), - std::max( nTop, nBottom) ); -} - -inline Point Rectangle::LeftCenter() const -{ - if ( IsEmpty() ) - return Point( nLeft, nTop ); - else - return Point( std::min( nLeft, nRight ), nTop + (nBottom - nTop)/2 ); -} - -inline Point Rectangle::RightCenter() const -{ - if ( IsEmpty() ) - return Point( nLeft, nTop ); - else - return Point( std::max( nLeft, nRight ), nTop + (nBottom - nTop)/2 ); -} - -inline Point Rectangle::Center() const -{ - if ( IsEmpty() ) - return Point( nLeft, nTop ); - else - return Point( nLeft+(nRight-nLeft)/2 , nTop+(nBottom-nTop)/2 ); -} - -inline void Rectangle::Move( long nHorzMove, long nVertMove ) -{ - nLeft += nHorzMove; - nTop += nVertMove; - if ( nRight != RECT_EMPTY ) - nRight += nHorzMove; - if ( nBottom != RECT_EMPTY ) - nBottom += nVertMove; -} - -void Rectangle::Transpose() -{ - if ( !IsEmpty() ) - { - long swap( nLeft ); - nLeft = nTop; - nTop = swap; - - swap = nRight; - nRight = nBottom; - nBottom = swap; - } -} - -inline void Rectangle::SetPos( const Point& rPoint ) -{ - if ( nRight != RECT_EMPTY ) - nRight += rPoint.X() - nLeft; - if ( nBottom != RECT_EMPTY ) - nBottom += rPoint.Y() - nTop; - nLeft = rPoint.X(); - nTop = rPoint.Y(); -} - -inline long Rectangle::GetWidth() const -{ - long n; - if ( nRight == RECT_EMPTY ) - n = 0; - else - { - n = nRight - nLeft; - if( n < 0 ) - n--; - else - n++; - } - - return n; -} - -inline long Rectangle::GetHeight() const -{ - long n; - if ( nBottom == RECT_EMPTY ) - n = 0; - else - { - n = nBottom - nTop; - if ( n < 0 ) - n--; - else - n++; - } - - return n; -} - -inline Size Rectangle::GetSize() const -{ - return Size( GetWidth(), GetHeight() ); -} - -inline Rectangle Rectangle::GetUnion( const Rectangle& rRect ) const -{ - Rectangle aTmpRect( *this ); - return aTmpRect.Union( rRect ); -} - -inline Rectangle Rectangle::GetIntersection( const Rectangle& rRect ) const -{ - Rectangle aTmpRect( *this ); - return aTmpRect.Intersection( rRect ); -} - -inline sal_Bool Rectangle::operator == ( const Rectangle& rRect ) const -{ - return ((nLeft == rRect.nLeft ) && - (nTop == rRect.nTop ) && - (nRight == rRect.nRight ) && - (nBottom == rRect.nBottom )); -} - -inline sal_Bool Rectangle::operator != ( const Rectangle& rRect ) const -{ - return ((nLeft != rRect.nLeft ) || - (nTop != rRect.nTop ) || - (nRight != rRect.nRight ) || - (nBottom != rRect.nBottom )); -} - -inline Rectangle& Rectangle::operator +=( const Point& rPt ) -{ - nLeft += rPt.X(); - nTop += rPt.Y(); - if ( nRight != RECT_EMPTY ) - nRight += rPt.X(); - if ( nBottom != RECT_EMPTY ) - nBottom += rPt.Y(); - return *this; -} - -inline Rectangle& Rectangle::operator -= ( const Point& rPt ) -{ - nLeft -= rPt.X(); - nTop -= rPt.Y(); - if ( nRight != RECT_EMPTY ) - nRight -= rPt.X(); - if ( nBottom != RECT_EMPTY ) - nBottom -= rPt.Y(); - return *this; -} - -inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt ) -{ - Rectangle aRect( rRect.nLeft + rPt.X(), rRect.nTop + rPt.Y(), - (rRect.nRight == RECT_EMPTY) ? RECT_EMPTY : rRect.nRight + rPt.X(), - (rRect.nBottom == RECT_EMPTY) ? RECT_EMPTY : rRect.nBottom + rPt.Y() ); - return aRect; -} - -inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ) -{ - Rectangle aRect( rRect.nLeft - rPt.X(), - rRect.nTop - rPt.Y(), - (rRect.nRight == RECT_EMPTY) ? RECT_EMPTY : rRect.nRight - rPt.X(), - (rRect.nBottom == RECT_EMPTY) ? RECT_EMPTY : rRect.nBottom - rPt.Y() ); - return aRect; -} - -template< typename charT, typename traits > -inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Rectangle& rectangle ) -{ - if (rectangle.IsEmpty()) - return stream << "EMPTY"; - else - return stream << rectangle.getWidth() << 'x' << rectangle.getHeight() - << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")"; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/getprocessworkingdir.hxx b/tools/inc/tools/getprocessworkingdir.hxx deleted file mode 100644 index f780c86c9a21..000000000000 --- a/tools/inc/tools/getprocessworkingdir.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_TOOLS_GETPROCESSWORKINGDIR_HXX -#define INCLUDED_TOOLS_GETPROCESSWORKINGDIR_HXX - -#include "sal/config.h" -#include "tools/toolsdllapi.h" - - -namespace tools { - -// get the process's current working directory, taking OOO_CWD into account -// -// @param rUrl -// Receives the directory URL (with or without a final slash) upon successful -// return, and the empty string upon unsuccessful return -TOOLS_DLLPUBLIC bool getProcessWorkingDir(OUString& rUrl); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/globname.hxx b/tools/inc/tools/globname.hxx deleted file mode 100644 index 2ea6850801d1..000000000000 --- a/tools/inc/tools/globname.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _GLOBNAME_HXX -#define _GLOBNAME_HXX - -#include <vector> - -#include "tools/toolsdllapi.h" -#include <com/sun/star/uno/Sequence.hxx> -#include <tools/string.hxx> - -struct ImpSvGlobalName -{ - sal_uInt8 szData[ 16 ]; - sal_uInt16 nRefCount; - - enum Empty { EMPTY }; - - ImpSvGlobalName() - { - nRefCount = 0; - } - ImpSvGlobalName( const ImpSvGlobalName & rObj ); - ImpSvGlobalName( Empty ); - - sal_Bool operator == ( const ImpSvGlobalName & rObj ) const; -}; - -#ifdef WNT -struct _GUID; -typedef struct _GUID GUID; -#else -struct GUID; -#endif - -typedef GUID CLSID; -class SvStream; - -class TOOLS_DLLPUBLIC SvGlobalName -{ - ImpSvGlobalName * pImp; - void NewImp(); - -public: - SvGlobalName(); - SvGlobalName( const SvGlobalName & rObj ) - { - pImp = rObj.pImp; - pImp->nRefCount++; - } - SvGlobalName( ImpSvGlobalName * pImpP ) - { - pImp = pImpP; - pImp->nRefCount++; - } - SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, - sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, - sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ); - - // create SvGlobalName from a platform independent representation - SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq ); - - SvGlobalName & operator = ( const SvGlobalName & rObj ); - ~SvGlobalName(); - - TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & ); - TOOLS_DLLPUBLIC friend SvStream & operator << ( SvStream &, const SvGlobalName & ); - - sal_Bool operator < ( const SvGlobalName & rObj ) const; - SvGlobalName & operator += ( sal_uInt32 ); - SvGlobalName & operator ++ () { return operator += ( 1 ); } - - sal_Bool operator == ( const SvGlobalName & rObj ) const; - sal_Bool operator != ( const SvGlobalName & rObj ) const - { return !(*this == rObj); } - - void MakeFromMemory( void * pData ); - sal_Bool MakeId( const String & rId ); - String GetHexName() const; - - SvGlobalName( const CLSID & rId ); - const CLSID & GetCLSID() const { return *(CLSID *)pImp->szData; } - const sal_uInt8* GetBytes() const { return pImp->szData; } - - // platform independent representation of a "GlobalName" - // maybe transported remotely - com::sun::star::uno::Sequence < sal_Int8 > GetByteSequence() const; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/helpers.hxx b/tools/inc/tools/helpers.hxx deleted file mode 100644 index 5a525872ae50..000000000000 --- a/tools/inc/tools/helpers.hxx +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -#ifndef _TOOLS_HELPERS_HXX -#define _TOOLS_HELPERS_HXX - -inline long MinMax( long nVal, long nMin, long nMax ) -{ - return nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin; -} - -inline long AlignedWidth4Bytes( long nWidthBits ) -{ - return ( ( nWidthBits + 31 ) >> 5 ) << 2; -} - -inline long FRound( double fVal ) -{ - return fVal > 0.0 ? static_cast<long>( fVal + 0.5 ) : -static_cast<long>( -fVal + 0.5 ); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetmime.hxx b/tools/inc/tools/inetmime.hxx deleted file mode 100644 index afe4247c6612..000000000000 --- a/tools/inc/tools/inetmime.hxx +++ /dev/null @@ -1,1261 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef TOOLS_INETMIME_HXX -#define TOOLS_INETMIME_HXX - -#include <boost/ptr_container/ptr_vector.hpp> - -#include "tools/toolsdllapi.h" -#include <rtl/alloc.h> -#include <rtl/character.hxx> -#include <rtl/string.hxx> -#include <rtl/strbuf.hxx> -#include <rtl/tencinfo.h> -#include <tools/debug.hxx> -#include <tools/errcode.hxx> -#include <tools/string.hxx> - -class DateTime; -class INetContentTypeParameterList; -class INetMIMECharsetList_Impl; -class INetMIMEOutputSink; - -class TOOLS_DLLPUBLIC INetMIME -{ -public: - enum { SOFT_LINE_LENGTH_LIMIT = 76, - HARD_LINE_LENGTH_LIMIT = 998 }; - - /** The various types of message header field bodies, with respect to - encoding and decoding them. - - @descr At the moment, five different types of header fields suffice - to describe how to encoded and decode any known message header field - body, but need for more types may arise in the future as new header - fields are introduced. - - @descr The following is an exhaustive list of all the header fields - currently known to our implementation. For every header field, it - includes a 'canonic' (with regard to capitalization) name, a grammar - rule for the body (using RFC 822 and RFC 2234 conventions), a list of - relevant sources of information, and the HeaderFieldType value to use - with that header field. The list is based on RFC 2076 and draft- - palme-mailext-headers-02.txt (see also <http://www.dsv.su.se/~jpalme/ - ietf/jp-ietf-home.html#anchor1003783>). - - Approved: address ;RFC 1036; HEADER_FIELD_ADDRESS - bcc: #address ;RFCs 822, 2047; HEADER_FIELD_ADDRESS - cc: 1#address ;RFCs 822, 2047; HEADER_FIELD_ADDRESS - Comments: *text ;RFCs 822, RFC 2047; HEADER_FIELD_TEXT - Content-Base: absoluteURI ;RFC 2110; HEADER_FIELD_TEXT - Content-Description: *text ;RFC 2045, RFC 2047; HEADER_FIELD_TEXT - Content-Disposition: disposition-type *(";" disposition-parm) - ;RFC 1806; HEADER_FIELD_STRUCTURED - Content-ID: msg-id ;RFC 2045, RFC 2047; HEADER_FIELD_MESSAGE_ID - Content-Location: absoluteURI / relativeURI ;RFC 2110; - HEADER_FIELD_TEXT - Content-Transfer-Encoding: mechanism ;RFC 2045, RFC 2047; - HEADER_FIELD_STRUCTURED - Content-Type: type "/" subtype *(";" parameter) ;RFC 2045, RFC 2047; - HEADER_FIELD_STRUCTURED - Control: *text ;RFC 1036; HEADER_FIELD_TEXT - Date: date-time ;RFC 822, RFC 1123, RFC 2047; HEADER_FIELD_STRUCTURED - Distribution: 1#atom ;RFC 1036; HEADER_FIELD_STRUCTURED - Encrypted: 1#2word ;RFC 822, RFC 2047; HEADER_FIELD_STRUCTURED - Expires: date-time ;RFC 1036; HEADER_FIELD_STRUCTURED - Followup-To: 1#(atom *("." atom)) ;RFC 1036; HEADER_FIELD_STRUCTURED - From: mailbox / 1#mailbox ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - In-Reply-To: *(phrase / msg-id) ;RFC 822, RFC 2047; - HEADER_FIELD_ADDRESS - Keywords: #phrase ;RFC 822, RFC 2047; HEADER_FIELD_PHRASE - MIME-Version: 1*DIGIT "." 1*DIGIT ;RFC 2045, RFC 2047; - HEADER_FIELD_STRUCTURED - Message-ID: msg-id ;RFC 822, RFC 2047; HEADER_FIELD_MESSAGE_ID - Newsgroups: 1#(atom *("." atom)) ;RFC 1036, RFC 2047; - HEADER_FIELD_STRUCTURED - Organization: *text ;RFC 1036; HEADER_FIELD_TEXT - Received: ["from" domain] ["by" domain] ["via" atom] *("with" atom) - ["id" msg-id] ["for" addr-spec] ";" date-time ;RFC 822, RFC 1123, - RFC 2047; HEADER_FIELD_STRUCTURED - References: *(phrase / msg-id) ;RFC 822, RFC 2047; - HEADER_FIELD_ADDRESS - Reply-To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Resent-Date: date-time ;RFC 822, RFC 1123, RFC 2047; - HEADER_FIELD_STRUCTURED - Resent-From: mailbox / 1#mailbox ;RFC 822, RFC 2047; - HEADER_FIELD_ADDRESS - Resent-Message-ID: msg-id ;RFC 822, RFC 2047; HEADER_FIELD_MESSAGE_ID - Resent-Reply-To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Resent-Sender: mailbox ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Resent-To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Resent-bcc: #address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Resent-cc: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Return-path: route-addr / ("<" ">") ;RFC 822, RFC 1123, RFC 2047; - HEADER_FIELD_STRUCTURED - Return-Receipt-To: address ;Not Internet standard; - HEADER_FIELD_ADDRES - Sender: mailbox ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - Subject: *text ;RFC 822, RFC 2047; HEADER_FIELD_TEXT - Summary: *text ;RFC 1036; HEADER_FIELD_TEXT - To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS - X-CHAOS-Marked: "YES" / "NO" ;local; HEADER_FIELD_STRUCTURED - X-CHAOS-Read: "YES" / "NO" ;local; HEADER_FIELD_STRUCTURED - X-CHAOS-Recipients: #*("<" atom word ">") ;local; - HEADER_FIELD_STRUCTURED - X-CHAOS-Size: 1*DIGIT ;local; HEADER_FIELD_STRUCTURED - X-Mailer: *text ;Not Internet standard; HEADER_FIELD_TEXT - X-Mozilla-Status: 4HEXDIG ;Mozilla; HEADER_FIELD_STRUCTURED - X-Newsreader: *text ;Not Internet standard; HEADER_FIELD_TEXT - X-Priority: "1" / "2" / "3" / "4" / "5" ;Not Internet standard; - HEADER_FIELD_STRUCTURED - Xref: sub-domain - 1*((atom / string) *("." (atom / string)) ":" msg-number) - ;RFCs 1036, 2047, local; HEADER_FIELD_STRUCTURED - */ - enum HeaderFieldType - { - HEADER_FIELD_TEXT, - HEADER_FIELD_STRUCTURED, - HEADER_FIELD_PHRASE, - HEADER_FIELD_MESSAGE_ID, - HEADER_FIELD_ADDRESS - }; - - /** Check for US-ASCII character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII character (0x00--0x7F). - */ - static inline bool isUSASCII(sal_uInt32 nChar); - - /** Check for ISO 8859-1 character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a ISO 8859-1 character (0x00--0xFF). - */ - static inline bool isISO88591(sal_uInt32 nChar); - - /** Check for US-ASCII control character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII control character (US-ASCII - 0x00--0x1F or 0x7F). - */ - static inline bool isControl(sal_uInt32 nChar); - - /** Check for US-ASCII white space character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII white space character (US-ASCII - 0x09 or 0x20). - */ - static inline bool isWhiteSpace(sal_uInt32 nChar); - - /** Check for US-ASCII visible character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII visible character (US-ASCII - 0x21--0x7E). - */ - static inline bool isVisible(sal_uInt32 nChar); - - /** Check for US-ASCII digit character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII (decimal) digit character (US- - ASCII '0'--'9'). - */ - static inline bool isDigit(sal_uInt32 nChar); - - /** Check for US-ASCII canonic hexadecimal digit character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII canonic (i.e., upper case) - hexadecimal digit character (US-ASCII '0'--'9' or 'A'--'F'). - */ - static inline bool isCanonicHexDigit(sal_uInt32 nChar); - - /** Check for US-ASCII hexadecimal digit character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII hexadecimal digit character (US- - ASCII '0'--'9', 'A'--'F', 'a'--'f'). - */ - static inline bool isHexDigit(sal_uInt32 nChar); - - /** Check for US-ASCII upper case character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII upper case alphabetic character - (US-ASCII 'A'--'Z'). - */ - static inline bool isUpperCase(sal_uInt32 nChar); - - /** Check for US-ASCII lower case character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII lower case alphabetic character - (US-ASCII 'a'--'z'). - */ - static inline bool isLowerCase(sal_uInt32 nChar); - - /** Check for US-ASCII alphabetic character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII alphabetic character (US-ASCII - 'A'--'Z' or 'a'--'z'). - */ - static inline bool isAlpha(sal_uInt32 nChar); - - /** Check for US-ASCII alphanumeric character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII alphanumeric character (US-ASCII - '0'--'9', 'A'--'Z' or 'a'--'z'). - */ - static inline bool isAlphanumeric(sal_uInt32 nChar); - - /** Check for US-ASCII Base 64 digit character. - - @param nChar Some UCS-4 character. - - @return True if nChar is a US-ASCII Base 64 digit character (US-ASCII - 'A'--'Z', 'a'--'z', '0'--'9', '+', or '/'). - */ - static inline bool isBase64Digit(sal_uInt32 nChar); - - /** Check whether some character is valid within an RFC 822 <atom>. - - @param nChar Some UCS-4 character. - - @return True if nChar is valid within an RFC 822 <atom> (US-ASCII - 'A'--'Z', 'a'--'z', '0'--'9', '!', '#', '$', '%', '&', ''', '*', '+', - '-', '/', '=', '?', '^', '_', '`', '{', '|', '}', or '~'). - */ - static bool isAtomChar(sal_uInt32 nChar); - - /** Check whether some character is valid within an RFC 2045 <token>. - - @param nChar Some UCS-4 character. - - @return True if nChar is valid within an RFC 2047 <token> (US-ASCII - 'A'--'Z', 'a'--'z', '0'--'9', '!', '#', '$', '%', '&', ''', '*', '+', - '-', '.', '^', '_', '`', '{', '|', '}', or '~'). - */ - static bool isTokenChar(sal_uInt32 nChar); - - /** Check whether some character is valid within an RFC 2047 <token>. - - @param nChar Some UCS-4 character. - - @return True if nChar is valid within an RFC 2047 <token> (US-ASCII - 'A'--'Z', 'a'--'z', '0'--'9', '!', '#', '$', '%', '&', ''', '*', '+', - '-', '^', '_', '`', '{', '|', '}', or '~'). - */ - static bool isEncodedWordTokenChar(sal_uInt32 nChar); - - /** Check whether some character is valid within an RFC 2060 <atom>. - - @param nChar Some UCS-4 character. - - @return True if nChar is valid within an RFC 2060 <atom> (US-ASCII - 'A'--'Z', 'a'--'z', '0'--'9', '!', '#', '$', '&', ''', '+', ',', '-', - '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '_', '`', - '|', '}', or '~'). - */ - static bool isIMAPAtomChar(sal_uInt32 nChar); - - /** Translate an US-ASCII character to upper case. - - @param nChar Some UCS-4 character. - - @return If nChar is a US-ASCII upper case character (US-ASCII - 'A'--'Z'), return the corresponding US-ASCII lower case character (US- - ASCII 'a'--'z'); otherwise, return nChar unchanged. - */ - static inline sal_uInt32 toUpperCase(sal_uInt32 nChar); - - /** Translate an US-ASCII character to lower case. - - @param nChar Some UCS-4 character. - - @return If nChar is a US-ASCII lower case character (US-ASCII - 'a'--'z'), return the corresponding US-ASCII upper case character (US- - ASCII 'A'--'Z'); otherwise, return nChar unchanged. - */ - static inline sal_uInt32 toLowerCase(sal_uInt32 nChar); - - /** Get the digit weight of a US-ASCII character. - - @param nChar Some UCS-4 character. - - @return If nChar is a US-ASCII (decimal) digit character (US-ASCII - '0'--'9'), return the corresponding weight (0--9); otherwise, - return -1. - */ - static inline int getWeight(sal_uInt32 nChar); - - /** Get the hexadecimal digit weight of a US-ASCII character. - - @param nChar Some UCS-4 character. - - @return If nChar is a US-ASCII hexadecimal digit character (US-ASCII - '0'--'9', 'A'--'F', or 'a'--'f'), return the corresponding weight - (0--15); otherwise, return -1. - */ - static inline int getHexWeight(sal_uInt32 nChar); - - /** Get the Base 64 digit weight of a US-ASCII character. - - @param nChar Some UCS-4 character. - - @return If nChar is a US-ASCII Base 64 digit character (US-ASCII - 'A'--'F', or 'a'--'f', '0'--'9', '+', or '/'), return the - corresponding weight (0--63); if nChar is the US-ASCII Base 64 padding - character (US-ASCII '='), return -1; otherwise, return -2. - */ - static inline int getBase64Weight(sal_uInt32 nChar); - - /** Get a hexadecimal digit encoded as US-ASCII. - - @param nWeight Must be in the range 0--15, inclusive. - - @return The canonic (i.e., upper case) hexadecimal digit - corresponding to nWeight (US-ASCII '0'--'9' or 'A'--'F'). - */ - static sal_uInt32 getHexDigit(int nWeight); - - static inline bool isHighSurrogate(sal_uInt32 nUTF16); - - static inline bool isLowSurrogate(sal_uInt32 nUTF16); - - static inline sal_uInt32 toUTF32(sal_Unicode cHighSurrogate, - sal_Unicode cLowSurrogate); - - /** Check two US-ASCII strings for equality, ignoring case. - - @param pBegin1 Points to the start of the first string, must not be - null. - - @param pEnd1 Points past the end of the first string, must be >= - pBegin1. - - @param pString2 Points to the start of the null terminated second - string, must not be null. - - @return True if the two strings are equal, ignoring the case of US- - ASCII alphabetic characters (US-ASCII 'A'--'Z' and 'a'--'z'). - */ - static bool equalIgnoreCase(const sal_Char * pBegin1, - const sal_Char * pEnd1, - const sal_Char * pString2); - - /** Check two US-ASCII strings for equality, ignoring case. - - @param pBegin1 Points to the start of the first string, must not be - null. - - @param pEnd1 Points past the end of the first string, must be >= - pBegin1. - - @param pString2 Points to the start of the null terminated second - string, must not be null. - - @return True if the two strings are equal, ignoring the case of US- - ASCII alphabetic characters (US-ASCII 'A'--'Z' and 'a'--'z'). - */ - static bool equalIgnoreCase(const sal_Unicode * pBegin1, - const sal_Unicode * pEnd1, - const sal_Char * pString2); - - static inline bool startsWithLineBreak(const sal_Char * pBegin, - const sal_Char * pEnd); - - static inline bool startsWithLineBreak(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - - static inline bool startsWithLineFolding(const sal_Char * pBegin, - const sal_Char * pEnd); - - static inline bool startsWithLineFolding(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - - static bool startsWithLinearWhiteSpace(const sal_Char * pBegin, - const sal_Char * pEnd); - - static const sal_Unicode * skipLinearWhiteSpace(const sal_Unicode * - pBegin, - const sal_Unicode * pEnd); - - static const sal_Unicode * skipComment(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - - static const sal_Unicode * skipLinearWhiteSpaceComment(const sal_Unicode * - pBegin, - const sal_Unicode * - pEnd); - - static inline bool needsQuotedStringEscape(sal_uInt32 nChar); - - static const sal_Char * skipQuotedString(const sal_Char * pBegin, - const sal_Char * pEnd); - - static const sal_Unicode * skipQuotedString(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - - static bool scanUnsigned(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue); - - static const sal_Unicode * scanQuotedBlock(const sal_Unicode * pBegin, - const sal_Unicode * pEnd, - sal_uInt32 nOpening, - sal_uInt32 nClosing, - sal_Size & rLength, - bool & rModify); - - static sal_Unicode const * scanParameters(sal_Unicode const * pBegin, - sal_Unicode const * pEnd, - INetContentTypeParameterList * - pParameters); - - static inline rtl_TextEncoding translateToMIME(rtl_TextEncoding - eEncoding); - - static inline rtl_TextEncoding translateFromMIME(rtl_TextEncoding - eEncoding); - - static const sal_Char * getCharsetName(rtl_TextEncoding eEncoding); - - static rtl_TextEncoding getCharsetEncoding(const sal_Char * pBegin, - const sal_Char * pEnd); - - static inline bool isMIMECharsetEncoding(rtl_TextEncoding eEncoding); - - static INetMIMECharsetList_Impl * - createPreferredCharsetList(rtl_TextEncoding eEncoding); - - static sal_Unicode * convertToUnicode(const sal_Char * pBegin, - const sal_Char * pEnd, - rtl_TextEncoding eEncoding, - sal_Size & rSize); - - static sal_Char * convertFromUnicode(const sal_Unicode * pBegin, - const sal_Unicode * pEnd, - rtl_TextEncoding eEncoding, - sal_Size & rSize); - - /** Get the number of octets required to encode an UCS-4 character using - UTF-8 encoding. - - @param nChar Some UCS-4 character. - - @return The number of octets required (in the range 1--6, inclusive). - */ - static inline int getUTF8OctetCount(sal_uInt32 nChar); - - static inline void writeEscapeSequence(INetMIMEOutputSink & rSink, - sal_uInt32 nChar); - - static void writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar); - - static void writeHeaderFieldBody(INetMIMEOutputSink & rSink, - HeaderFieldType eType, - const OUString& rBody, - rtl_TextEncoding ePreferredEncoding, - bool bInitialSpace = true); - - static bool translateUTF8Char(const sal_Char *& rBegin, - const sal_Char * pEnd, - rtl_TextEncoding eEncoding, - sal_uInt32 & rCharacter); - - static OUString decodeHeaderFieldBody(HeaderFieldType eType, - const OString& rBody); - -// #i70651#: Prevent warnings on Mac OS X. -#ifdef MACOSX -#pragma GCC system_header -#endif - - /** Get the UTF-32 character at the head of a UTF-16 encoded string. - - @param rBegin Points to the start of the UTF-16 encoded string, must - not be null. On exit, it points past the first UTF-32 character's - encoding. - - @param pEnd Points past the end of the UTF-16 encoded string, must be - strictly greater than rBegin. - - @return The UCS-4 character at the head of the UTF-16 encoded string. - If the string does not start with the UTF-16 encoding of a UCS-32 - character, the first UTF-16 value is returned. - */ - static inline sal_uInt32 getUTF32Character(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd); - - /** Put the UTF-16 encoding of a UTF-32 character into a buffer. - - @param pBuffer Points to a buffer, must not be null. - - @param nUTF32 An UTF-32 character, must be in the range 0..0x10FFFF. - - @return A pointer past the UTF-16 characters put into the buffer - (i.e., pBuffer + 1 or pBuffer + 2). - */ - static inline sal_Unicode * putUTF32Character(sal_Unicode * pBuffer, - sal_uInt32 nUTF32); -}; - -// static -inline bool INetMIME::isUSASCII(sal_uInt32 nChar) -{ - return rtl::isAscii(nChar); -} - -// static -inline bool INetMIME::isISO88591(sal_uInt32 nChar) -{ - return nChar <= 0xFF; -} - -// static -inline bool INetMIME::isControl(sal_uInt32 nChar) -{ - return nChar <= 0x1F || nChar == 0x7F; -} - -// static -inline bool INetMIME::isWhiteSpace(sal_uInt32 nChar) -{ - return nChar == '\t' || nChar == ' '; -} - -// static -inline bool INetMIME::isVisible(sal_uInt32 nChar) -{ - return nChar >= '!' && nChar <= '~'; -} - -// static -inline bool INetMIME::isDigit(sal_uInt32 nChar) -{ - return rtl::isAsciiDigit(nChar); -} - -// static -inline bool INetMIME::isCanonicHexDigit(sal_uInt32 nChar) -{ - return rtl::isAsciiCanonicHexDigit(nChar); -} - -// static -inline bool INetMIME::isHexDigit(sal_uInt32 nChar) -{ - return rtl::isAsciiHexDigit(nChar); -} - -// static -inline bool INetMIME::isUpperCase(sal_uInt32 nChar) -{ - return rtl::isAsciiUpperCase(nChar); -} - -// static -inline bool INetMIME::isLowerCase(sal_uInt32 nChar) -{ - return rtl::isAsciiLowerCase(nChar); -} - -// static -inline bool INetMIME::isAlpha(sal_uInt32 nChar) -{ - return rtl::isAsciiAlpha(nChar); -} - -// static -inline bool INetMIME::isAlphanumeric(sal_uInt32 nChar) -{ - return rtl::isAsciiAlphanumeric(nChar); -} - -// static -inline bool INetMIME::isBase64Digit(sal_uInt32 nChar) -{ - return rtl::isAsciiUpperCase(nChar) || rtl::isAsciiLowerCase(nChar) || rtl::isAsciiDigit(nChar) - || nChar == '+' || nChar == '/'; -} - -// static -inline sal_uInt32 INetMIME::toUpperCase(sal_uInt32 nChar) -{ - return rtl::isAsciiLowerCase(nChar) ? nChar - ('a' - 'A') : nChar; -} - -// static -inline sal_uInt32 INetMIME::toLowerCase(sal_uInt32 nChar) -{ - return rtl::isAsciiUpperCase(nChar) ? nChar + ('a' - 'A') : nChar; -} - -// static -inline int INetMIME::getWeight(sal_uInt32 nChar) -{ - return rtl::isAsciiDigit(nChar) ? int(nChar - '0') : -1; -} - -// static -inline int INetMIME::getHexWeight(sal_uInt32 nChar) -{ - return rtl::isAsciiDigit(nChar) ? int(nChar - '0') : - nChar >= 'A' && nChar <= 'F' ? int(nChar - 'A' + 10) : - nChar >= 'a' && nChar <= 'f' ? int(nChar - 'a' + 10) : -1; -} - -// static -inline int INetMIME::getBase64Weight(sal_uInt32 nChar) -{ - return rtl::isAsciiUpperCase(nChar) ? int(nChar - 'A') : - rtl::isAsciiLowerCase(nChar) ? int(nChar - 'a' + 26) : - rtl::isAsciiDigit(nChar) ? int(nChar - '0' + 52) : - nChar == '+' ? 62 : - nChar == '/' ? 63 : - nChar == '=' ? -1 : -2; -} - -// static -inline bool INetMIME::isHighSurrogate(sal_uInt32 nUTF16) -{ - return nUTF16 >= 0xD800 && nUTF16 <= 0xDBFF; -} - -// static -inline bool INetMIME::isLowSurrogate(sal_uInt32 nUTF16) -{ - return nUTF16 >= 0xDC00 && nUTF16 <= 0xDFFF; -} - -// static -inline sal_uInt32 INetMIME::toUTF32(sal_Unicode cHighSurrogate, - sal_Unicode cLowSurrogate) -{ - DBG_ASSERT(isHighSurrogate(cHighSurrogate) - && isLowSurrogate(cLowSurrogate), - "INetMIME::toUTF32(): Bad chars"); - return ((sal_uInt32(cHighSurrogate) & 0x3FF) << 10) - | (sal_uInt32(cLowSurrogate) & 0x3FF); -} - -// static -inline bool INetMIME::startsWithLineBreak(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::startsWithLineBreak(): Bad sequence"); - - return pEnd - pBegin >= 2 && pBegin[0] == 0x0D && pBegin[1] == 0x0A; - // CR, LF -} - -// static -inline bool INetMIME::startsWithLineBreak(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::startsWithLineBreak(): Bad sequence"); - - return pEnd - pBegin >= 2 && pBegin[0] == 0x0D && pBegin[1] == 0x0A; - // CR, LF -} - -// static -inline bool INetMIME::startsWithLineFolding(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::startsWithLineFolding(): Bad sequence"); - - return pEnd - pBegin >= 3 && pBegin[0] == 0x0D && pBegin[1] == 0x0A - && isWhiteSpace(pBegin[2]); // CR, LF -} - -// static -inline bool INetMIME::startsWithLineFolding(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::startsWithLineFolding(): Bad sequence"); - - return pEnd - pBegin >= 3 && pBegin[0] == 0x0D && pBegin[1] == 0x0A - && isWhiteSpace(pBegin[2]); // CR, LF -} - -// static -inline bool INetMIME::startsWithLinearWhiteSpace(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::startsWithLinearWhiteSpace(): Bad sequence"); - - return pBegin != pEnd - && (isWhiteSpace(*pBegin) || startsWithLineFolding(pBegin, pEnd)); -} - -// static -inline bool INetMIME::needsQuotedStringEscape(sal_uInt32 nChar) -{ - return nChar == '"' || nChar == '\\'; -} - -// static -inline rtl_TextEncoding INetMIME::translateToMIME(rtl_TextEncoding eEncoding) -{ -#if defined WNT - return eEncoding == RTL_TEXTENCODING_MS_1252 ? - RTL_TEXTENCODING_ISO_8859_1 : eEncoding; -#else // WNT - return eEncoding; -#endif // WNT -} - -// static -inline rtl_TextEncoding INetMIME::translateFromMIME(rtl_TextEncoding - eEncoding) -{ -#if defined WNT - return eEncoding == RTL_TEXTENCODING_ISO_8859_1 ? - RTL_TEXTENCODING_MS_1252 : eEncoding; -#else - return eEncoding; -#endif -} - -// static -inline bool INetMIME::isMIMECharsetEncoding(rtl_TextEncoding eEncoding) -{ - return ( rtl_isOctetTextEncoding(eEncoding) == sal_True ); -} - -// static -inline int INetMIME::getUTF8OctetCount(sal_uInt32 nChar) -{ - DBG_ASSERT(nChar < 0x80000000, "INetMIME::getUTF8OctetCount(): Bad char"); - - return nChar < 0x80 ? 1 : - nChar < 0x800 ? 2 : - nChar <= 0x10000 ? 3 : - nChar <= 0x200000 ? 4 : - nChar <= 0x4000000 ? 5 : 6; -} - -// static -inline sal_uInt32 INetMIME::getUTF32Character(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd) -{ - DBG_ASSERT(rBegin && rBegin < pEnd, - "INetMIME::getUTF32Character(): Bad sequence"); - if (rBegin + 1 < pEnd && rBegin[0] >= 0xD800 && rBegin[0] <= 0xDBFF - && rBegin[1] >= 0xDC00 && rBegin[1] <= 0xDFFF) - { - sal_uInt32 nUTF32 = sal_uInt32(*rBegin++ & 0x3FF) << 10; - return (nUTF32 | (*rBegin++ & 0x3FF)) + 0x10000; - } - else - return *rBegin++; -} - -// static -inline sal_Unicode * INetMIME::putUTF32Character(sal_Unicode * pBuffer, - sal_uInt32 nUTF32) -{ - DBG_ASSERT(nUTF32 <= 0x10FFFF, "INetMIME::putUTF32Character(): Bad char"); - if (nUTF32 < 0x10000) - *pBuffer++ = sal_Unicode(nUTF32); - else - { - nUTF32 -= 0x10000; - *pBuffer++ = sal_Unicode(0xD800 | (nUTF32 >> 10)); - *pBuffer++ = sal_Unicode(0xDC00 | (nUTF32 & 0x3FF)); - } - return pBuffer; -} - -class INetMIMEOutputSink -{ -public: - static sal_uInt32 const NO_LINE_LENGTH_LIMIT = SAL_MAX_UINT32; - -private: - sal_uInt32 m_nColumn; - sal_uInt32 m_nLineLengthLimit; - -protected: - /** Write a sequence of octets. - - @param pBegin Points to the start of the sequence, must not be null. - - @param pEnd Points past the end of the sequence, must be >= pBegin. - */ - virtual void writeSequence(const sal_Char * pBegin, - const sal_Char * pEnd) = 0; - - /** Write a null terminated sequence of octets (without the terminating - null). - - @param pOctets A null terminated sequence of octets, must not be - null. - - @return The length of pOctets (without the terminating null). - */ - virtual sal_Size writeSequence(const sal_Char * pSequence); - - /** Write a sequence of octets. - - @descr The supplied sequence of UCS-4 characters is interpreted as a - sequence of octets. It is an error if any of the elements of the - sequence has a numerical value greater than 255. - - @param pBegin Points to the start of the sequence, must not be null. - - @param pEnd Points past the end of the sequence, must be >= pBegin. - */ - virtual void writeSequence(const sal_uInt32 * pBegin, - const sal_uInt32 * pEnd); - - /** Write a sequence of octets. - - @descr The supplied sequence of Unicode characters is interpreted as - a sequence of octets. It is an error if any of the elements of the - sequence has a numerical value greater than 255. - - @param pBegin Points to the start of the sequence, must not be null. - - @param pEnd Points past the end of the sequence, must be >= pBegin. - */ - virtual void writeSequence(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - -public: - INetMIMEOutputSink(sal_uInt32 nTheColumn = 0, - sal_uInt32 nTheLineLengthLimit - = INetMIME::SOFT_LINE_LENGTH_LIMIT): - m_nColumn(nTheColumn), m_nLineLengthLimit(nTheLineLengthLimit) {} - - virtual ~INetMIMEOutputSink() {} - - /** Get the current column. - - @return The current column (starting from zero). - */ - sal_uInt32 getColumn() const { return m_nColumn; } - - sal_uInt32 getLineLengthLimit() const { return m_nLineLengthLimit; } - - void setLineLengthLimit(sal_uInt32 nTheLineLengthLimit) - { m_nLineLengthLimit = nTheLineLengthLimit; } - - virtual ErrCode getError() const; - - /** Write a sequence of octets. - - @param pBegin Points to the start of the sequence, must not be null. - - @param pEnd Points past the end of the sequence, must be >= pBegin. - */ - inline void write(const sal_Char * pBegin, const sal_Char * pEnd); - - /** Write a sequence of octets. - - @param pBegin Points to the start of the sequence, must not be null. - - @param nLength The length of the sequence. - */ - void write(const sal_Char * pBegin, sal_Size nLength) - { write(pBegin, pBegin + nLength); } - - /** Write a sequence of octets. - - @descr The supplied sequence of UCS-4 characters is interpreted as a - sequence of octets. It is an error if any of the elements of the - sequence has a numerical value greater than 255. - - @param pBegin Points to the start of the sequence, must not be null. - - @param pEnd Points past the end of the sequence, must be >= pBegin. - */ - inline void write(const sal_uInt32 * pBegin, const sal_uInt32 * pEnd); - - /** Write a sequence of octets. - - @descr The supplied sequence of Unicode characters is interpreted as - a sequence of octets. It is an error if any of the elements of the - sequence has a numerical value greater than 255. - - @param pBegin Points to the start of the sequence, must not be null. - - @param pEnd Points past the end of the sequence, must be >= pBegin. - */ - inline void write(const sal_Unicode * pBegin, const sal_Unicode * pEnd); - - /** Write a sequence of octets. - - @param rOctets A OString, interpreted as a sequence of octets. - - @param nBegin The offset of the first character to write. - - @param nEnd The offset past the last character to write. - */ - void write(const OString& rOctets, xub_StrLen nBegin, - xub_StrLen nEnd) - { - writeSequence(rOctets.getStr() + nBegin, rOctets.getStr() + nEnd); - m_nColumn += nEnd - nBegin; - } - - /** Write a single octet. - - @param nOctet Some octet. - - @return This instance. - */ - inline INetMIMEOutputSink & operator <<(sal_Char nOctet); - - /** Write a null terminated sequence of octets (without the terminating - null). - - @param pOctets A null terminated sequence of octets, must not be - null. - - @return This instance. - */ - inline INetMIMEOutputSink & operator <<(const sal_Char * pOctets); - - /** Write a sequence of octets. - - @param rOctets A OString, interpreted as a sequence of octets. - - @return This instance. - */ - INetMIMEOutputSink & operator <<(const OString& rOctets) - { - writeSequence(rOctets.getStr(), rOctets.getStr() + rOctets.getLength()); - m_nColumn += rOctets.getLength(); - return *this; - } - - /** Call a manipulator function. - - @param pManipulator A manipulator function. - - @return Whatever the manipulator function returns. - */ - INetMIMEOutputSink & - operator <<(INetMIMEOutputSink & (* pManipulator)(INetMIMEOutputSink &)) - { return pManipulator(*this); } - - /** Write a line end (CR LF). - */ - void writeLineEnd(); - - /** A manipulator function that writes a line end (CR LF). - - @param rSink Some sink. - - @return The sink rSink. - */ - static inline INetMIMEOutputSink & endl(INetMIMEOutputSink & rSink); -}; - -inline void INetMIMEOutputSink::write(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - writeSequence(pBegin, pEnd); - m_nColumn += pEnd - pBegin; -} - -inline void INetMIMEOutputSink::write(const sal_uInt32 * pBegin, - const sal_uInt32 * pEnd) -{ - writeSequence(pBegin, pEnd); - m_nColumn += pEnd - pBegin; -} - -inline void INetMIMEOutputSink::write(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - writeSequence(pBegin, pEnd); - m_nColumn += pEnd - pBegin; -} - -inline INetMIMEOutputSink & INetMIMEOutputSink::operator <<(sal_Char nOctet) -{ - writeSequence(&nOctet, &nOctet + 1); - ++m_nColumn; - return *this; -} - -inline INetMIMEOutputSink & INetMIMEOutputSink::operator <<(const sal_Char * - pOctets) -{ - m_nColumn += writeSequence(pOctets); - return *this; -} - -// static -inline INetMIMEOutputSink & INetMIMEOutputSink::endl(INetMIMEOutputSink & - rSink) -{ - rSink.writeLineEnd(); - return rSink; -} - -// static -inline void INetMIME::writeEscapeSequence(INetMIMEOutputSink & rSink, - sal_uInt32 nChar) -{ - DBG_ASSERT(nChar <= 0xFF, "INetMIME::writeEscapeSequence(): Bad char"); - rSink << '=' << sal_uInt8(getHexDigit(nChar >> 4)) - << sal_uInt8(getHexDigit(nChar & 15)); -} - -class INetMIMEStringOutputSink: public INetMIMEOutputSink -{ - OStringBuffer m_aBuffer; - - using INetMIMEOutputSink::writeSequence; - - virtual void writeSequence(const sal_Char * pBegin, - const sal_Char * pEnd); - -public: - inline INetMIMEStringOutputSink(sal_uInt32 nColumn = 0, - sal_uInt32 nLineLengthLimit - = INetMIME::SOFT_LINE_LENGTH_LIMIT): - INetMIMEOutputSink(nColumn, nLineLengthLimit) {} - - virtual ErrCode getError() const; - - OString takeBuffer() - { - return m_aBuffer.makeStringAndClear(); - } -}; - -class INetMIMEEncodedWordOutputSink -{ -public: - enum Context { CONTEXT_TEXT = 1, - CONTEXT_COMMENT = 2, - CONTEXT_PHRASE = 4 }; - - enum Space { SPACE_NO, SPACE_ENCODED, SPACE_ALWAYS }; - -private: - enum { BUFFER_SIZE = 256 }; - - enum Coding { CODING_NONE, CODING_QUOTED, CODING_ENCODED, - CODING_ENCODED_TERMINATED }; - - enum EncodedWordState { STATE_INITIAL, STATE_FIRST_EQUALS, - STATE_FIRST_QUESTION, STATE_CHARSET, - STATE_SECOND_QUESTION, STATE_ENCODING, - STATE_THIRD_QUESTION, STATE_ENCODED_TEXT, - STATE_FOURTH_QUESTION, STATE_SECOND_EQUALS, - STATE_BAD }; - - INetMIMEOutputSink & m_rSink; - Context m_eContext; - Space m_eInitialSpace; - sal_uInt32 m_nExtraSpaces; - INetMIMECharsetList_Impl * m_pEncodingList; - sal_Unicode * m_pBuffer; - sal_uInt32 m_nBufferSize; - sal_Unicode * m_pBufferEnd; - Coding m_ePrevCoding; - rtl_TextEncoding m_ePrevMIMEEncoding; - Coding m_eCoding; - sal_uInt32 m_nQuotedEscaped; - EncodedWordState m_eEncodedWordState; - - inline bool needsEncodedWordEscape(sal_uInt32 nChar) const; - - void finish(bool bWriteTrailer); - -public: - inline INetMIMEEncodedWordOutputSink(INetMIMEOutputSink & rTheSink, - Context eTheContext, - Space eTheInitialSpace, - rtl_TextEncoding ePreferredEncoding); - - ~INetMIMEEncodedWordOutputSink(); - - INetMIMEEncodedWordOutputSink & operator <<(sal_uInt32 nChar); - - inline void write(const sal_Char * pBegin, const sal_Char * pEnd); - - inline void write(const sal_Unicode * pBegin, const sal_Unicode * pEnd); - - inline bool flush(); -}; - -inline INetMIMEEncodedWordOutputSink::INetMIMEEncodedWordOutputSink( - INetMIMEOutputSink & rTheSink, Context eTheContext, - Space eTheInitialSpace, rtl_TextEncoding ePreferredEncoding): - m_rSink(rTheSink), - m_eContext(eTheContext), - m_eInitialSpace(eTheInitialSpace), - m_nExtraSpaces(0), - m_pEncodingList(INetMIME::createPreferredCharsetList(ePreferredEncoding)), - m_ePrevCoding(CODING_NONE), - m_eCoding(CODING_NONE), - m_nQuotedEscaped(0), - m_eEncodedWordState(STATE_INITIAL) -{ - m_nBufferSize = BUFFER_SIZE; - m_pBuffer = static_cast< sal_Unicode * >(rtl_allocateMemory( - m_nBufferSize - * sizeof (sal_Unicode))); - m_pBufferEnd = m_pBuffer; -} - -inline void INetMIMEEncodedWordOutputSink::write(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIMEEncodedWordOutputSink::write(): Bad sequence"); - - while (pBegin != pEnd) - operator <<(*pBegin++); -} - -inline void INetMIMEEncodedWordOutputSink::write(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIMEEncodedWordOutputSink::write(): Bad sequence"); - - while (pBegin != pEnd) - operator <<(*pBegin++); -} - -inline bool INetMIMEEncodedWordOutputSink::flush() -{ - finish(true); - return m_ePrevCoding != CODING_NONE; -} - -struct INetContentTypeParameter -{ - /** The name of the attribute, in US-ASCII encoding and converted to lower - case. If a parameter value is split as described in RFC 2231, there - will only be one item for the complete parameter, with the attribute - name lacking any section suffix. - */ - const OString m_sAttribute; - - /** The optional character set specification (see RFC 2231), in US-ASCII - encoding and converted to lower case. - */ - const OString m_sCharset; - - /** The optional language specification (see RFC 2231), in US-ASCII - encoding and converted to lower case. - */ - const OString m_sLanguage; - - /** The attribute value. If the value is a quoted-string, it is - 'unpacked.' If a character set is specified, and the value can be - converted to Unicode, this is done. Also, if no character set is - specified, it is first tried to convert the value from UTF-8 encoding - to Unicode, and if that doesn't work (because the value is not in - UTF-8 encoding), it is converted from ISO-8859-1 encoding to Unicode - (which will always work). But if a character set is specified and the - value cannot be converted from that character set to Unicode, special - action is taken to produce a value that can possibly be transformed - back into its original form: Any 8-bit character from a non-encoded - part of the original value is directly converted to Unicode - (effectively handling it as if it was ISO-8859-1 encoded), and any - 8-bit character from an encoded part of the original value is mapped - to the range U+F800..U+F8FF at the top of the Corporate Use Subarea - within Unicode's Private Use Area (effectively adding 0xF800 to the - character's numeric value). - */ - const OUString m_sValue; - - /** This is true if the value is successfully converted to Unicode, and - false if the value is a special mixture of ISO-LATIN-1 characters and - characters from Unicode's Private Use Area. - */ - const bool m_bConverted; - - INetContentTypeParameter(const OString& rTheAttribute, - const OString& rTheCharset, const OString& rTheLanguage, - const OUString& rTheValue, bool bTheConverted) - : m_sAttribute(rTheAttribute) - , m_sCharset(rTheCharset) - , m_sLanguage(rTheLanguage) - , m_sValue(rTheValue) - , m_bConverted(bTheConverted) - { - } -}; - -class TOOLS_DLLPUBLIC INetContentTypeParameterList -{ -public: - - void Clear(); - - void Insert(INetContentTypeParameter * pParameter, sal_uIntPtr nIndex) - { - maEntries.insert(maEntries.begin()+nIndex,pParameter); - } - - void Append(INetContentTypeParameter *pParameter) - { - maEntries.push_back(pParameter); - } - - inline const INetContentTypeParameter * GetObject(sal_uIntPtr nIndex) const - { - return &(maEntries[nIndex]); - } - - const INetContentTypeParameter * find(const OString& rAttribute) const; - -private: - - boost::ptr_vector<INetContentTypeParameter> maEntries; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetmsg.hxx b/tools/inc/tools/inetmsg.hxx deleted file mode 100644 index 395286a04db2..000000000000 --- a/tools/inc/tools/inetmsg.hxx +++ /dev/null @@ -1,518 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_INETMSG_HXX -#define _TOOLS_INETMSG_HXX - -#include "tools/toolsdllapi.h" -#include <rtl/string.hxx> -#include <rtl/textenc.h> -#include <rtl/ustring.hxx> -#include <tools/inetmime.hxx> -#include <tools/stream.hxx> - -#include <vector> - -class DateTime; - -class INetMessageHeader -{ - OString m_aName; - OString m_aValue; - -public: - INetMessageHeader() - {} - - INetMessageHeader ( - const OString& rName, const OString& rValue) - : m_aName (rName), m_aValue (rValue) - {} - - INetMessageHeader ( - const INetMessageHeader& rHdr) - : m_aName (rHdr.m_aName), m_aValue (rHdr.m_aValue) - {} - - ~INetMessageHeader() - {} - - INetMessageHeader& operator= (const INetMessageHeader& rHdr) - { - m_aName = rHdr.m_aName; - m_aValue = rHdr.m_aValue; - return *this; - } - - const OString& GetName() const { return m_aName; } - const OString& GetValue() const { return m_aValue; } - - friend SvStream& operator<< ( - SvStream& rStrm, const INetMessageHeader& rHdr) - { - write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStrm, rHdr.m_aName); - write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStrm, rHdr.m_aValue); - return rStrm; - } - - friend SvStream& operator>> ( - SvStream& rStrm, INetMessageHeader& rHdr) - { - rHdr.m_aName = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStrm); - rHdr.m_aValue = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStrm); - return rStrm; - } -}; - -typedef ::std::vector< INetMessageHeader* > HeaderList_impl; - -class INetMessage -{ - HeaderList_impl m_aHeaderList; - - sal_uIntPtr m_nDocSize; - OUString m_aDocName; - SvLockBytesRef m_xDocLB; - - void ListCleanup_Impl(); - void ListCopy (const INetMessage& rMsg); - -protected: - OUString GetHeaderName_Impl ( - sal_uIntPtr nIndex, rtl_TextEncoding eEncoding) const - { - if ( nIndex < m_aHeaderList.size() ) { - return OStringToOUString(m_aHeaderList[ nIndex ]->GetName(), eEncoding); - } else { - return OUString(); - } - } - - OUString GetHeaderValue_Impl ( - sal_uIntPtr nIndex, INetMIME::HeaderFieldType eType) const - { - if ( nIndex < m_aHeaderList.size() ) { - return INetMIME::decodeHeaderFieldBody(eType, m_aHeaderList[ nIndex ]->GetValue()); - } else { - return OUString(); - } - } - - void SetHeaderField_Impl ( - const INetMessageHeader &rHeader, sal_uIntPtr &rnIndex) - { - INetMessageHeader *p = new INetMessageHeader (rHeader); - if (m_aHeaderList.size() <= rnIndex) - { - rnIndex = m_aHeaderList.size(); - m_aHeaderList.push_back( p ); - } - else - { - delete m_aHeaderList[ rnIndex ]; - m_aHeaderList[ rnIndex ] = p; - } - } - - void SetHeaderField_Impl ( - INetMIME::HeaderFieldType eType, - const OString &rName, - const OUString &rValue, - sal_uIntPtr &rnIndex); - - virtual SvStream& operator<< (SvStream& rStrm) const; - virtual SvStream& operator>> (SvStream& rStrm); - -public: - INetMessage() : m_nDocSize(0) {} - virtual ~INetMessage(); - - INetMessage (const INetMessage& rMsg) - : m_nDocSize (rMsg.m_nDocSize), - m_aDocName (rMsg.m_aDocName), - m_xDocLB (rMsg.m_xDocLB) - { - ListCopy (rMsg); - } - - INetMessage& operator= (const INetMessage& rMsg) - { - m_nDocSize = rMsg.m_nDocSize; - m_aDocName = rMsg.m_aDocName; - m_xDocLB = rMsg.m_xDocLB; - ListCopy (rMsg); - return *this; - } - - sal_uIntPtr GetHeaderCount() const { return m_aHeaderList.size(); } - - OUString GetHeaderName (sal_uIntPtr nIndex) const - { - return GetHeaderName_Impl (nIndex, RTL_TEXTENCODING_ASCII_US); - } - - OUString GetHeaderValue (sal_uIntPtr nIndex) const - { - return GetHeaderValue_Impl (nIndex, INetMIME::HEADER_FIELD_TEXT); - } - - INetMessageHeader GetHeaderField (sal_uIntPtr nIndex) const - { - if ( nIndex < m_aHeaderList.size() ) { - return INetMessageHeader( *m_aHeaderList[ nIndex ] ); - } else { - return INetMessageHeader(); - } - } - - virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rField, - sal_uIntPtr nIndex = ((sal_uIntPtr)-1) - ); - - sal_uIntPtr GetDocumentSize() const { return m_nDocSize; } - void SetDocumentSize (sal_uIntPtr nSize) { m_nDocSize = nSize; } - - const OUString& GetDocumentName() const { return m_aDocName; } - void SetDocumentName (const OUString& rName) { m_aDocName = rName; } - - SvLockBytes* GetDocumentLB() const { return m_xDocLB; } - void SetDocumentLB (SvLockBytes *pDocLB) { m_xDocLB = pDocLB; } - - friend SvStream& operator<< ( - SvStream& rStrm, const INetMessage& rMsg) - { - return rMsg.operator<< (rStrm); - } - - friend SvStream& operator>> ( - SvStream& rStrm, INetMessage& rMsg) - { - return rMsg.operator>> (rStrm); - } -}; - -#define INETMSG_RFC822_BCC 0 -#define INETMSG_RFC822_CC 1 -#define INETMSG_RFC822_COMMENTS 2 -#define INETMSG_RFC822_DATE 3 -#define INETMSG_RFC822_FROM 4 -#define INETMSG_RFC822_IN_REPLY_TO 5 -#define INETMSG_RFC822_KEYWORDS 6 -#define INETMSG_RFC822_MESSAGE_ID 7 -#define INETMSG_RFC822_REFERENCES 8 -#define INETMSG_RFC822_REPLY_TO 9 -#define INETMSG_RFC822_RETURN_PATH 10 -#define INETMSG_RFC822_SENDER 11 -#define INETMSG_RFC822_SUBJECT 12 -#define INETMSG_RFC822_TO 13 -#define INETMSG_RFC822_X_MAILER 14 -#define INETMSG_RFC822_RETURN_RECEIPT_TO 15 -#define INETMSG_RFC822_NUMHDR 16 - -class TOOLS_DLLPUBLIC INetRFC822Message : public INetMessage -{ - sal_uIntPtr m_nIndex[INETMSG_RFC822_NUMHDR]; - -protected: - virtual SvStream& operator<< (SvStream& rStrm) const; - virtual SvStream& operator>> (SvStream& rStrm); - -public: - INetRFC822Message(); - INetRFC822Message (const INetRFC822Message& rMsg); - virtual ~INetRFC822Message(); - - INetRFC822Message& operator= (const INetRFC822Message& rMsg); - - static bool ParseDateField ( - const OUString& rDateField, DateTime& rDateTime); - - using INetMessage::SetHeaderField; - virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, - sal_uIntPtr nIndex = ((sal_uIntPtr)-1) - ); - - // Header fields. - - OUString GetBCC() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_BCC], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetCC() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_CC], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetComments() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_COMMENTS], - INetMIME::HEADER_FIELD_TEXT); - } - - OUString GetDate() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_DATE], - INetMIME::HEADER_FIELD_STRUCTURED); - } - - OUString GetFrom() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_FROM], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetInReplyTo() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_IN_REPLY_TO], - INetMIME::HEADER_FIELD_ADDRESS); // ??? MESSAGE_ID ??? - } - - OUString GetKeywords() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_KEYWORDS], - INetMIME::HEADER_FIELD_PHRASE); - } - - OUString GetMessageID() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_MESSAGE_ID], - INetMIME::HEADER_FIELD_MESSAGE_ID); - } - - OUString GetReferences() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_REFERENCES], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetReplyTo() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_REPLY_TO], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetReturnPath() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_RETURN_PATH], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetReturnReceiptTo() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_RETURN_RECEIPT_TO], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetSender() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_SENDER], - INetMIME::HEADER_FIELD_ADDRESS); - } - - OUString GetSubject() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_SUBJECT], - INetMIME::HEADER_FIELD_TEXT); - } - - OUString GetTo() const - { - return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_TO], - INetMIME::HEADER_FIELD_TEXT); - } - - // Stream operators. - - friend SvStream& operator<< ( - SvStream& rStrm, const INetRFC822Message& rMsg) - { - return rMsg.operator<< (rStrm); - } - - friend SvStream& operator>> ( - SvStream& rStrm, INetRFC822Message& rMsg) - { - return rMsg.operator>> (rStrm); - } -}; - -#define INETMSG_MIME_VERSION 0 -#define INETMSG_MIME_CONTENT_DESCRIPTION 1 -#define INETMSG_MIME_CONTENT_DISPOSITION 2 -#define INETMSG_MIME_CONTENT_ID 3 -#define INETMSG_MIME_CONTENT_TYPE 4 -#define INETMSG_MIME_CONTENT_TRANSFER_ENCODING 5 -#define INETMSG_MIME_NUMHDR 6 - -enum INetMessageContainerType -{ - INETMSG_MESSAGE_RFC822, - INETMSG_MULTIPART_MIXED, - INETMSG_MULTIPART_ALTERNATIVE, - INETMSG_MULTIPART_DIGEST, - INETMSG_MULTIPART_PARALLEL, - INETMSG_MULTIPART_RELATED, - INETMSG_MULTIPART_FORM_DATA -}; - -class INetMIMEMessage; -typedef ::std::vector< INetMIMEMessage* > INetMIMEMessgeList_impl; - -class TOOLS_DLLPUBLIC INetMIMEMessage : public INetRFC822Message -{ - sal_uIntPtr m_nIndex[INETMSG_MIME_NUMHDR]; - INetMIMEMessage* pParent; - INetMIMEMessgeList_impl aChildren; - OString m_aBoundary; - bool bHeaderParsed; - - friend class INetMIMEMessageStream; - - const OString& GetMultipartBoundary() const { return m_aBoundary; } - void SetMultipartBoundary (const OString& rBnd) { m_aBoundary = rBnd; } - - void CleanupImp(); - void CopyImp (const INetMIMEMessage& rMsg); - void SetHeaderParsed() { bHeaderParsed = sal_True; } - -protected: - virtual SvStream& operator<< (SvStream& rStrm) const; - virtual SvStream& operator>> (SvStream& rStrm); - -public: - INetMIMEMessage(); - INetMIMEMessage (const INetMIMEMessage& rMsg); - virtual ~INetMIMEMessage(); - - INetMIMEMessage& operator= (const INetMIMEMessage& rMsg); - - bool HeaderParsed() const { return bHeaderParsed; } - - virtual INetMIMEMessage* CreateMessage ( - const INetMIMEMessage& rMsg) const; - - using INetRFC822Message::SetHeaderField; - virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, - sal_uIntPtr nIndex = ((sal_uIntPtr)-1) - ); - - // Header fields. - - void SetMIMEVersion (const OUString& rVersion); - OUString GetMIMEVersion() const - { - return GetHeaderValue (m_nIndex[INETMSG_MIME_VERSION]); - } - - OUString GetContentDescription() const - { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); - } - - void SetContentDisposition (const OUString& rDisposition); - OUString GetContentDisposition() const - { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); - } - - OUString GetContentID() const - { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_ID]); - } - - void SetContentType (const OUString& rType); - OUString GetContentType() const - { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_TYPE]); - } - - void SetContentTransferEncoding (const OUString& rEncoding); - OUString GetContentTransferEncoding() const - { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]); - } - - OUString GetDefaultContentType (); - - // Message container methods. - - bool IsContainer() const - { - return (IsMessage() || IsMultipart()); - } - bool IsMessage() const - { - OUString aType (GetContentType()); - return aType.matchIgnoreAsciiCase("message/"); - } - bool IsMultipart() const - { - OUString aType (GetContentType()); - return aType.matchIgnoreAsciiCase("multipart/"); - } - - INetMIMEMessage* GetChild (sal_uIntPtr nIndex) const - { - return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ] : NULL; - } - INetMIMEMessage* GetParent() const { return pParent; } - - bool EnableAttachChild ( - INetMessageContainerType eType = INETMSG_MULTIPART_MIXED); - bool AttachChild ( - INetMIMEMessage& rChildMsg, bool bOwner = true ); - - // Stream operators. - - friend SvStream& operator<< ( - SvStream& rStrm, const INetMIMEMessage& rMsg) - { - return rMsg.operator<< (rStrm); - } - - friend SvStream& operator>> ( - SvStream& rStrm, INetMIMEMessage& rMsg) - { - return rMsg.operator>> (rStrm); - } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/inetstrm.hxx b/tools/inc/tools/inetstrm.hxx deleted file mode 100644 index d7b4e149d798..000000000000 --- a/tools/inc/tools/inetstrm.hxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_INETSTRM_HXX -#define _TOOLS_INETSTRM_HXX - -#include "tools/toolsdllapi.h" -#include <sal/types.h> -#include <tools/string.hxx> - -class INetMessage; -class INetMIMEMessage; -class SvMemoryStream; -class SvStream; - -enum INetStreamStatus -{ - INETSTREAM_STATUS_LOADED = -4, - INETSTREAM_STATUS_WOULDBLOCK = -3, - INETSTREAM_STATUS_OK = -2, - INETSTREAM_STATUS_ERROR = -1 -}; - -class TOOLS_DLLPUBLIC INetIStream -{ - // Not implemented. - INetIStream (const INetIStream& rStrm); - INetIStream& operator= (const INetIStream& rStrm); - -protected: - virtual int GetData (sal_Char *pData, sal_uIntPtr nSize) = 0; - -public: - INetIStream (); - virtual ~INetIStream (void); - - int Read (sal_Char *pData, sal_uIntPtr nSize); -}; - -class INetOStream -{ - // Not implemented. - INetOStream (const INetOStream& rStrm); - INetOStream& operator= (const INetOStream& rStrm); - -protected: - virtual int PutData ( - const sal_Char *pData, sal_uIntPtr nSize) = 0; - -public: - INetOStream (); - virtual ~INetOStream (void); - - int Write (const sal_Char *pData, sal_uIntPtr nSize); -}; - -enum INetMessageStreamState -{ - INETMSG_EOL_BEGIN, - INETMSG_EOL_DONE, - INETMSG_EOL_SCR, - INETMSG_EOL_FCR, - INETMSG_EOL_FLF, - INETMSG_EOL_FSP, - INETMSG_EOL_FESC -}; - -/// Message Generator Interface. -class INetMessageIStream : public INetIStream -{ - INetMessage *pSourceMsg; - sal_Bool bHeaderGenerated; - - sal_uIntPtr nBufSiz; - sal_Char *pBuffer; - sal_Char *pRead; - sal_Char *pWrite; - - SvStream *pMsgStrm; - SvMemoryStream *pMsgBuffer; - sal_Char *pMsgRead; - sal_Char *pMsgWrite; - - virtual int GetData (sal_Char *pData, sal_uIntPtr nSize); - - // Not implemented. - INetMessageIStream (const INetMessageIStream& rStrm); - INetMessageIStream& operator= (const INetMessageIStream& rStrm); - -protected: - virtual int GetMsgLine (sal_Char *pData, sal_uIntPtr nSize); - -public: - INetMessageIStream (sal_uIntPtr nBufferSize = 2048); - virtual ~INetMessageIStream (void); - - INetMessage *GetSourceMessage (void) const { return pSourceMsg; } - void SetSourceMessage (INetMessage *pMsg) { pSourceMsg = pMsg; } - - void GenerateHeader (sal_Bool bGen = sal_True) { bHeaderGenerated = !bGen; } - sal_Bool IsHeaderGenerated (void) const { return bHeaderGenerated; } -}; - -/// Message Parser Interface. -class INetMessageOStream : public INetOStream -{ - INetMessage *pTargetMsg; - sal_Bool bHeaderParsed; - - INetMessageStreamState eOState; - - SvMemoryStream *pMsgBuffer; - - virtual int PutData (const sal_Char *pData, sal_uIntPtr nSize); - - // Not implemented. - INetMessageOStream (const INetMessageOStream& rStrm); - INetMessageOStream& operator= (const INetMessageOStream& rStrm); - -protected: - virtual int PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize); - -public: - INetMessageOStream (void); - virtual ~INetMessageOStream (void); - - INetMessage *GetTargetMessage (void) const { return pTargetMsg; } - void SetTargetMessage (INetMessage *pMsg) { pTargetMsg = pMsg; } - - void ParseHeader (sal_Bool bParse = sal_True) { bHeaderParsed = !bParse; } - sal_Bool IsHeaderParsed (void) const { return bHeaderParsed; } -}; - -class INetMessageIOStream - : public INetMessageIStream, - public INetMessageOStream -{ - // Not implemented. - INetMessageIOStream (const INetMessageIOStream& rStrm); - INetMessageIOStream& operator= (const INetMessageIOStream& rStrm); - -public: - INetMessageIOStream (sal_uIntPtr nBufferSize = 2048); - virtual ~INetMessageIOStream (void); -}; - -enum INetMessageEncoding -{ - INETMSG_ENCODING_7BIT, - INETMSG_ENCODING_8BIT, - INETMSG_ENCODING_BINARY, - INETMSG_ENCODING_QUOTED, - INETMSG_ENCODING_BASE64 -}; - -class TOOLS_DLLPUBLIC INetMIMEMessageStream : public INetMessageIOStream -{ - int eState; - - sal_uIntPtr nChildIndex; - INetMIMEMessageStream *pChildStrm; - - INetMessageEncoding eEncoding; - INetMessageIStream *pEncodeStrm; - INetMessageOStream *pDecodeStrm; - - SvMemoryStream *pMsgBuffer; - - static INetMessageEncoding GetMsgEncoding ( - const String& rContentType); - - // Not implemented. - INetMIMEMessageStream (const INetMIMEMessageStream& rStrm); - INetMIMEMessageStream& operator= (const INetMIMEMessageStream& rStrm); - -protected: - virtual int GetMsgLine (sal_Char *pData, sal_uIntPtr nSize); - virtual int PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize); - -public: - INetMIMEMessageStream (sal_uIntPtr nBufferSize = 2048); - virtual ~INetMIMEMessageStream (void); - - using INetMessageIStream::SetSourceMessage; - void SetSourceMessage (INetMIMEMessage *pMsg) - { - INetMessageIStream::SetSourceMessage ((INetMessage *)pMsg); - } - INetMIMEMessage *GetSourceMessage (void) const - { - return ((INetMIMEMessage *)INetMessageIStream::GetSourceMessage()); - } - - using INetMessageOStream::SetTargetMessage; - void SetTargetMessage (INetMIMEMessage *pMsg) - { - INetMessageOStream::SetTargetMessage ((INetMessage *)pMsg); - } - INetMIMEMessage *GetTargetMessage (void) const - { - return ((INetMIMEMessage *)INetMessageOStream::GetTargetMessage()); - } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/line.hxx b/tools/inc/tools/line.hxx deleted file mode 100644 index e1b62ffd00f8..000000000000 --- a/tools/inc/tools/line.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _LINE_HXX -#define _LINE_HXX - -#include "tools/toolsdllapi.h" -#include <tools/gen.hxx> - -class Link; - -class TOOLS_DLLPUBLIC Line -{ -private: - Point maStart; - Point maEnd; - -public: - Line() {}; - Line( const Point& rStartPt, const Point& rEndPt ) : maStart( rStartPt ), maEnd( rEndPt ) {} - - void SetStart( const Point& rStartPt ) { maStart = rStartPt; } - const Point& GetStart() const { return maStart; } - - void SetEnd( const Point& rEndPt ) { maEnd = rEndPt; } - const Point& GetEnd() const { return maEnd; } - - long Left() const { return ( maStart.X() < maEnd.X() ) ? maStart.X() : maEnd.X(); } - long Top() const { return ( maStart.Y() < maEnd.Y() ) ? maStart.Y() : maEnd.Y(); } - long Right() const { return ( maStart.X() > maEnd.X() ) ? maStart.X() : maEnd.X(); } - long Bottom() const { return ( maStart.Y() > maEnd.Y() ) ? maStart.Y() : maEnd.Y(); } - - double GetLength() const; - - sal_Bool Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const; - sal_Bool Intersection( const Line& rLine, Point& rIntersection ) const; - - double GetDistance( const double& rPtX, const double& rPtY ) const; - double GetDistance( const Point& rPoint ) const { return( GetDistance( rPoint.X(), rPoint.Y() ) ); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/lineend.hxx b/tools/inc/tools/lineend.hxx deleted file mode 100644 index c24e91cf83d8..000000000000 --- a/tools/inc/tools/lineend.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef _LINEEND_HXX -#define _LINEEND_HXX - -#include <rtl/string.hxx> -#include <rtl/ustring.hxx> -#include "tools/toolsdllapi.h" - -enum LineEnd { LINEEND_CR, LINEEND_LF, LINEEND_CRLF }; - -inline LineEnd GetSystemLineEnd() -{ -#if defined WNT - return LINEEND_CRLF; -#else - return LINEEND_LF; -#endif -} - -TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd); -TOOLS_DLLPUBLIC OUString convertLineEnd(const OUString &rIn, LineEnd eLineEnd); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/link.hxx b/tools/inc/tools/link.hxx deleted file mode 100644 index c325b67bae76..000000000000 --- a/tools/inc/tools/link.hxx +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _LINK_HXX -#define _LINK_HXX - -#include "tools/toolsdllapi.h" -#include "sal/config.h" -#include "sal/types.h" -#include <tools/solar.h> - -typedef long (*PSTUB)( void*, void* ); - -#define DECL_LINK( Method, ArgType ) \ - long Method( ArgType ); \ - static long LinkStub##Method( void* pThis, void* ) - -#define DECL_STATIC_LINK( Class, Method, ArgType ) \ - static long Method( Class*, ArgType ) - -#define DECL_DLLPRIVATE_LINK(Method, ArgType) \ - SAL_DLLPRIVATE long Method(ArgType); \ - SAL_DLLPRIVATE static long LinkStub##Method(void * pThis, void *) - -#define DECL_DLLPRIVATE_STATIC_LINK(Class, Method, ArgType) \ - SAL_DLLPRIVATE static long Method(Class *, ArgType) - -#define IMPL_STUB(Class, Method, ArgType) \ - long Class::LinkStub##Method( void* pThis, void* pCaller) \ - { \ - return ((Class*)pThis )->Method( (ArgType)pCaller ); \ - } - -#define IMPL_STATIC_LINK( Class, Method, ArgType, ArgName ) \ - long Class::Method( Class* pThis, ArgType ArgName ) - -#define IMPL_STATIC_LINK_NOINSTANCE( Class, Method, ArgType, ArgName ) \ - long Class::Method( SAL_UNUSED_PARAMETER Class*, ArgType ArgName ) - -#define LINK( Inst, Class, Member ) \ - Link( (Class*)Inst, (PSTUB)&Class::LinkStub##Member ) - -#define STATIC_LINK( Inst, Class, Member ) \ - Link( (Class*)Inst, (PSTUB)&Class::Member ) - -#define IMPL_LINK( Class, Method, ArgType, ArgName ) \ - IMPL_STUB( Class, Method, ArgType ) \ - long Class::Method( ArgType ArgName ) - -#define IMPL_LINK_NOARG( Class, Method ) \ - IMPL_STUB( Class, Method, void* ) \ - long Class::Method( SAL_UNUSED_PARAMETER void* ) - -#define IMPL_LINK_INLINE_START( Class, Method, ArgType, ArgName ) \ - inline long Class::Method( ArgType ArgName ) - -#define IMPL_LINK_INLINE_END( Class, Method, ArgType, ArgName ) \ - IMPL_STUB( Class, Method, ArgType ) - -#define IMPL_LINK_NOARG_INLINE_START( Class, Method ) \ - inline long Class::Method( SAL_UNUSED_PARAMETER void* ) - -#define IMPL_LINK_NOARG_INLINE_END( Class, Method ) \ - IMPL_STUB( Class, Method, void* ) - -#define IMPL_LINK_INLINE( Class, Method, ArgType, ArgName, Body ) \ - long Class::Method( ArgType ArgName ) \ - Body \ - IMPL_STUB( Class, Method, ArgType ) - -#define EMPTYARG - -class TOOLS_DLLPUBLIC Link -{ - void* pInst; - PSTUB pFunc; - -public: - Link(); - Link( void* pLinkHdl, PSTUB pMemFunc ); - - long Call( void* pCaller ) const; - - sal_Bool IsSet() const; - sal_Bool operator !() const; - - sal_Bool operator==( const Link& rLink ) const; - sal_Bool operator!=( const Link& rLink ) const - { return !(Link::operator==( rLink )); } - sal_Bool operator<( const Link& rLink ) const - { return ((sal_uIntPtr)rLink.pFunc < (sal_uIntPtr)pFunc); } -}; - -inline Link::Link() -{ - pInst = 0; - pFunc = 0; -} - -inline Link::Link( void* pLinkHdl, PSTUB pMemFunc ) -{ - pInst = pLinkHdl; - pFunc = pMemFunc; -} - -inline long Link::Call(void *pCaller) const -{ - return pFunc ? (*pFunc)(pInst, pCaller) : 0; -} - -inline sal_Bool Link::IsSet() const -{ - if ( pFunc ) - return sal_True; - else - return sal_False; -} - -inline sal_Bool Link::operator !() const -{ - if ( !pFunc ) - return sal_True; - else - return sal_False; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/mapunit.hxx b/tools/inc/tools/mapunit.hxx deleted file mode 100644 index 55d68911b957..000000000000 --- a/tools/inc/tools/mapunit.hxx +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _TOOLS_MAPUNIT_HXX -#define _TOOLS_MAPUNIT_HXX - -enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, - MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, - MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, - MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/mempool.hxx b/tools/inc/tools/mempool.hxx deleted file mode 100644 index 3fa27ff50773..000000000000 --- a/tools/inc/tools/mempool.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _SVMEMPOOL_HXX -#define _SVMEMPOOL_HXX - -#include "sal/config.h" - -#include "sal/macros.h" -#include "tools/toolsdllapi.h" -#include "tools/solar.h" - -struct FixedMemPool_Impl; - -class TOOLS_DLLPUBLIC FixedMemPool -{ - FixedMemPool_Impl * m_pImpl; - char const * m_pTypeName; - -public: - FixedMemPool( char const * pTypeName, - sal_uInt16 nTypeSize ); - ~FixedMemPool(); - - void* Alloc(); - void Free( void* p ); -}; - -#define DECL_FIXEDMEMPOOL_NEW_DECL() \ -static void * operator new( size_t n ) - -#define DECL_FIXEDMEMPOOL_NEW_IMPL( Class ) \ -void * Class::operator new( size_t n ) - -#define IMPL_FIXEDMEMPOOL_NEW_BODY( Class, aPool ) \ -{ \ - if ( n == sizeof( Class ) ) \ - return (aPool).Alloc(); \ - else \ - return ::operator new(n); \ -} - -#define DECL_FIXEDMEMPOOL_NEW_INLINE( Class, aPool ) \ -DECL_FIXEDMEMPOOL_NEW_DECL() \ -IMPL_FIXEDMEMPOOL_NEW_BODY( Class, aPool ) - -#define DECL_FIXEDMEMPOOL_DEL_DECL() \ -static void operator delete( void * p, size_t n ) - -#define DECL_FIXEDMEMPOOL_DEL_IMPL( Class ) \ -void Class::operator delete( void * p, size_t n ) - -#define IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) \ -{ \ - if ( n == sizeof( Class ) ) \ - (aPool).Free(p); \ - else \ - ::operator delete(p); \ -} - -#define DECL_FIXEDMEMPOOL_DEL_INLINE( Class, aPool ) \ -DECL_FIXEDMEMPOOL_DEL_DECL() \ -IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) - -#define DECL_FIXEDMEMPOOL_NEWDEL( Class ) \ - private: \ - static FixedMemPool aPool; \ - public: \ - DECL_FIXEDMEMPOOL_NEW_INLINE( Class, aPool ) \ - DECL_FIXEDMEMPOOL_DEL_INLINE( Class, aPool ) - -#define IMPL_FIXEDMEMPOOL_NEWDEL( Class ) \ - FixedMemPool Class::aPool( SAL_STRINGIFY( Class ), sizeof( Class ) ); - -#define DECL_FIXEDMEMPOOL_NEWDEL_DLL( Class ) \ - private: \ - static FixedMemPool aPool; \ - public: \ - DECL_FIXEDMEMPOOL_NEW_DECL(); \ - DECL_FIXEDMEMPOOL_DEL_DECL(); - -#define IMPL_FIXEDMEMPOOL_NEWDEL_DLL( Class ) \ - FixedMemPool Class::aPool( SAL_STRINGIFY( Class ), sizeof( Class ) ); \ - DECL_FIXEDMEMPOOL_NEW_IMPL( Class ) \ - IMPL_FIXEDMEMPOOL_NEW_BODY( Class, aPool ) \ - DECL_FIXEDMEMPOOL_DEL_IMPL( Class ) \ - IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx deleted file mode 100644 index 678fc94a998a..000000000000 --- a/tools/inc/tools/multisel.hxx +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _SV_MULTISEL_HXX -#define _SV_MULTISEL_HXX - -#include "tools/toolsdllapi.h" -#include <tools/gen.hxx> -#include <rtl/ustring.hxx> - -#include <vector> -#include <set> - -typedef ::std::vector< Range* > ImpSelList; - -#define SFX_ENDOFSELECTION ULONG_MAX - -class TOOLS_DLLPUBLIC MultiSelection -{ -private: - ImpSelList aSels; // array of SV-selections - Range aTotRange; // total range of indexes - sal_uIntPtr nCurSubSel; // index in aSels of current selected index - long nCurIndex; // current selected entry - sal_uIntPtr nSelCount; // number of selected indexes - sal_Bool bInverseCur;// inverse cursor - sal_Bool bCurValid; // are nCurIndex and nCurSubSel valid - sal_Bool bSelectNew; // auto-select newly inserted indexes - -#ifdef _SV_MULTISEL_CXX - TOOLS_DLLPRIVATE void ImplClear(); - TOOLS_DLLPRIVATE size_t ImplFindSubSelection( long nIndex ) const; - TOOLS_DLLPRIVATE sal_Bool ImplMergeSubSelections( size_t nPos1, size_t nPos2 ); - TOOLS_DLLPRIVATE long ImplFwdUnselected(); -#endif - -public: - MultiSelection(); - MultiSelection( const MultiSelection& rOrig ); - MultiSelection( const Range& rRange ); - ~MultiSelection(); - - MultiSelection& operator= ( const MultiSelection& rOrig ); - sal_Bool operator== ( MultiSelection& rOrig ); - sal_Bool operator!= ( MultiSelection& rOrig ) - { return !operator==( rOrig ); } - sal_Bool operator !() const - { return nSelCount == 0; } - - void SelectAll( sal_Bool bSelect = sal_True ); - sal_Bool Select( long nIndex, sal_Bool bSelect = sal_True ); - void Select( const Range& rIndexRange, sal_Bool bSelect = sal_True ); - sal_Bool IsSelected( long nIndex ) const; - sal_Bool IsAllSelected() const - { return nSelCount == sal_uIntPtr(aTotRange.Len()); } - long GetSelectCount() const { return nSelCount; } - - void SetTotalRange( const Range& rTotRange ); - void Insert( long nIndex, long nCount = 1 ); - void Remove( long nIndex ); - - const Range& GetTotalRange() const { return aTotRange; } - sal_Bool IsCurValid() const { return bCurValid; } - long GetCurSelected() const { return nCurIndex; } - long FirstSelected( sal_Bool bInverse = sal_False ); - long LastSelected(); - long NextSelected(); - - size_t GetRangeCount() const { return aSels.size(); } - const Range& GetRange( size_t nRange ) const { - return *(const Range*)aSels[nRange]; - } -}; - -class TOOLS_DLLPUBLIC StringRangeEnumerator -{ - struct Range - { - sal_Int32 nFirst; - sal_Int32 nLast; - - Range() : nFirst( -1 ), nLast( -1 ) {} - Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {} - }; - std::vector< StringRangeEnumerator::Range > maSequence; - sal_Int32 mnCount; - sal_Int32 mnMin; - sal_Int32 mnMax; - sal_Int32 mnOffset; - bool mbValidInput; - - bool setRange( const OUString& i_rNewRange, bool i_bStrict = false ); - bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence, bool bMayAdjust ); - bool insertJoinedRanges( const std::vector< sal_Int32 >& rNumbers, bool i_bStrict ); - bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; -public: - class TOOLS_DLLPUBLIC Iterator - { - const StringRangeEnumerator* pEnumerator; - const std::set< sal_Int32 >* pPossibleValues; - sal_Int32 nRangeIndex; - sal_Int32 nCurrent; - - friend class StringRangeEnumerator; - Iterator( const StringRangeEnumerator* i_pEnum, - const std::set< sal_Int32 >* i_pPossibleValues, - sal_Int32 i_nRange, - sal_Int32 i_nCurrent ) - : pEnumerator( i_pEnum ), pPossibleValues( i_pPossibleValues ) - , nRangeIndex( i_nRange ), nCurrent( i_nCurrent ) {} - - public: - Iterator() : pEnumerator( NULL ), pPossibleValues( NULL ), nRangeIndex( -1 ), nCurrent( -1 ) {} - Iterator& operator++(); - sal_Int32 operator*() const; - bool operator==(const Iterator&) const; - bool operator!=(const Iterator& i_rComp) const - { return ! (*this == i_rComp); } - }; - - friend class StringRangeEnumerator::Iterator; - - StringRangeEnumerator( const OUString& i_rInput, - sal_Int32 i_nMinNumber, - sal_Int32 i_nMaxNumber, - sal_Int32 i_nLogicalOffset = -1 - ); - - sal_Int32 size() const { return mnCount; } - Iterator begin( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; - Iterator end( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; - - bool isValidInput() const { return mbValidInput; } - bool hasValue( sal_Int32 nValue, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; - - /** - i_rPageRange: the string to be changed into a sequence of numbers - valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well - o_rPageVector: the output sequence of numbers - i_nLogicalOffset: an offset to be applied to each number in the string before inserting it in the resulting sequence - example: a user enters page numbers from 1 to n (since that is logical) - of course usable page numbers in code would start from 0 and end at n-1 - so the logical offset would be -1 - i_nMinNumber: the minimum allowed number - i_nMaxNumber: the maximum allowed number - - @returns: true if the input string was valid, o_rPageVector will contain the resulting sequence - false if the input string was invalid, o_rPageVector will contain - the sequence that parser is able to extract - - behavior: - - only non-negative sequence numbers are allowed - - only non-negative values in the input string are allowed - - the string "-3" means the sequence i_nMinNumber to 3 - - the string "3-" means the sequence 3 to i_nMaxNumber - - the string "-" means the sequence i_nMinNumber to i_nMaxNumber - - single number that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be ignored - - range that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be adjusted - */ - static bool getRangesFromString( const OUString& i_rPageRange, - std::vector< sal_Int32 >& o_rPageVector, - sal_Int32 i_nMinNumber, - sal_Int32 i_nMaxNumber, - sal_Int32 i_nLogicalOffset = -1, - std::set< sal_Int32 >* i_pPossibleValues = NULL - ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/pathutils.hxx b/tools/inc/tools/pathutils.hxx deleted file mode 100644 index 2153db7c7c3f..000000000000 --- a/tools/inc/tools/pathutils.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_TOOLS_PATHUTILS_HXX -#define INCLUDED_TOOLS_PATHUTILS_HXX - -#include "sal/config.h" - -#if defined WNT -#include <cstddef> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> - -// The compiled code is not part of the tl dynamic library, but is delivered as -// pathutils-obj and pathutils-slo objects (it is linked into special -// executables and dynamic libraries that do not link against OOo libraries): -namespace tools { - -/** Determine the filename part of a path. - @param path - A non-NULL pointer to a null-terminated path. - @return - A pointer to the trailing filename part of the given path. -*/ -WCHAR * filename(WCHAR * path); - -/** Concatenate two paths. - - Either the first path is empty and the second path is an absolute path. Or - the first path is an absolute path that ends in a backslash and the second - path is a relative path. In the latter case, to avoid paths that grow too - long, leading .. segments of the second path are removed together with - trailing segments from the first path. This should not cause problems as long - as there are no symbolic links on Windows (as with symbolic links, x\y\.. and - x might denote different directories). - - @param path - An output paremeter taking the resulting path; must point at a valid - range of memory of size at least MAX_PATH. If NULL is returned, the - content is unspecified. - @param frontBegin, frontEnd - Forms a valid range [frontBegin .. frontEnd) of less than MAX_PATH size. - @param backBegin, backLength - Forms a valid range [backBeghin .. backBegin + backLength) of less than - MAX_PATH size. - @return - A pointer to the terminating null character of the concatenation, or NULL - if a failure occurred. -*/ -WCHAR * buildPath( - WCHAR * path, WCHAR const * frontBegin, WCHAR const * frontEnd, - WCHAR const * backBegin, std::size_t backLength); - -/** Resolve a link file. - - @param path - An input/output parameter taking the path; must point at a valid range of - memory of size at least MAX_PATH. On input, contains the null-terminated - full path of the link file. On output, contains the null-terminated full - path of the resolved link; if NULL is returned, the content is unspecified. - @return - A pointer to the terminating null character of path, or NULL if a failure - occurred. -*/ -WCHAR * resolveLink(WCHAR * path); - -} - -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/poly.hxx b/tools/inc/tools/poly.hxx deleted file mode 100644 index 980840f66008..000000000000 --- a/tools/inc/tools/poly.hxx +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TL_POLY_HXX -#define _TL_POLY_HXX - -#include "tools/toolsdllapi.h" -#include <tools/gen.hxx> -#include <tools/debug.hxx> - -#include <vector> - -#define POLY_APPEND (0xFFFF) -#define POLYPOLY_APPEND (0xFFFF) - -#define POLY_OPTIMIZE_NONE 0x00000000UL -#define POLY_OPTIMIZE_OPEN 0x00000001UL -#define POLY_OPTIMIZE_CLOSE 0x00000002UL -#define POLY_OPTIMIZE_NO_SAME 0x00000004UL -#define POLY_OPTIMIZE_REDUCE 0x00000008UL -#define POLY_OPTIMIZE_EDGES 0x00000010UL - -enum PolyStyle -{ - POLY_ARC = 1, - POLY_PIE = 2, - POLY_CHORD = 3 -}; - -#ifndef ENUM_POLYFLAGS_DECLARED -#define ENUM_POLYFLAGS_DECLARED -enum PolyFlags -{ - POLY_NORMAL, - POLY_SMOOTH, - POLY_CONTROL, - POLY_SYMMTR -}; -#endif - -class SAL_WARN_UNUSED PolyOptimizeData -{ -private: - - enum DataType { DATA_NONE = 0, DATA_ABSOLUT = 1, DATA_PERCENT = 2 }; - DataType eType; - union { sal_uIntPtr mnAbsolut; sal_uInt16 mnPercent; }; - -public: - PolyOptimizeData() : eType( DATA_NONE ) {} - PolyOptimizeData( sal_uIntPtr nAbsolut ) : eType( DATA_ABSOLUT ), mnAbsolut( nAbsolut ) {} - PolyOptimizeData( sal_uInt16 nPercent ) : eType( DATA_PERCENT ), mnPercent( nPercent ) {} - - sal_uIntPtr GetAbsValue() const { (void) eType; DBG_ASSERT( eType == DATA_ABSOLUT, "Wrong data type" ); return mnAbsolut; } - sal_uInt16 GetPercentValue() const { (void) eType; DBG_ASSERT( eType == DATA_PERCENT, "Wrong data type" ); return mnPercent; } -}; - -class SvStream; -class ImplPolygon; -class ImplPolyPolygon; -class PolyPolygon; - -namespace basegfx -{ - class B2DPolygon; - class B2DPolyPolygon; -} - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Polygon -{ -private: - ImplPolygon* mpImplPolygon; - - TOOLS_DLLPRIVATE inline void ImplMakeUnique(); - -public: - static void ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 nPercent ); - void ImplRead( SvStream& rIStream ); - void ImplWrite( SvStream& rOStream ) const; - -public: - Polygon(); - Polygon( sal_uInt16 nSize ); - Polygon( sal_uInt16 nPoints, const Point* pPtAry, - const sal_uInt8* pFlagAry = NULL ); - Polygon( const Rectangle& rRect ); - Polygon( const Rectangle& rRect, - sal_uIntPtr nHorzRound, sal_uIntPtr nVertRound ); - Polygon( const Point& rCenter, - long nRadX, long nRadY, - sal_uInt16 nPoints = 0 ); - Polygon( const Rectangle& rBound, - const Point& rStart, const Point& rEnd, - PolyStyle ePolyStyle = POLY_ARC, - sal_Bool bWholeCircle = sal_False ); - Polygon( const Point& rBezPt1, const Point& rCtrlPt1, - const Point& rBezPt2, const Point& rCtrlPt2, - sal_uInt16 nPoints = 0 ); - - Polygon( const Polygon& rPoly ); - ~Polygon(); - - void SetPoint( const Point& rPt, sal_uInt16 nPos ); - const Point& GetPoint( sal_uInt16 nPos ) const; - - void SetFlags( sal_uInt16 nPos, PolyFlags eFlags ); - PolyFlags GetFlags( sal_uInt16 nPos ) const; - sal_Bool HasFlags() const; - - sal_Bool IsRect() const; - - void SetSize( sal_uInt16 nNewSize ); - sal_uInt16 GetSize() const; - - void Clear(); - - Rectangle GetBoundRect() const; - double GetSignedArea() const; - sal_Bool IsInside( const Point& rPt ) const; - sal_Bool IsRightOrientated() const; - double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 ); - void Clip( const Rectangle& rRect, sal_Bool bPolygon = sal_True ); - void Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* pData = NULL ); - - /** Adaptive subdivision of polygons with curves - - This method adaptively subdivides bezier arcs within the - polygon to straight line segments and returns the resulting - polygon. - - @param rResult - The resulting subdivided polygon - - @param d - This parameter controls the amount of subdivision. The - original curve is guaranteed to not differ by more than this - amount per bezier segment from the subdivided - lines. Concretely, if the polygon is in device coordinates and - d equals 1.0, then the difference between the subdivided and - the original polygon is guaranteed to be smaller than one - pixel. - */ - void AdaptiveSubdivide( Polygon& rResult, const double d = 1.0 ) const; - - void Move( long nHorzMove, long nVertMove ); - void Translate( const Point& rTrans ); - void Scale( double fScaleX, double fScaleY ); - void Rotate( const Point& rCenter, double fSin, double fCos ); - void Rotate( const Point& rCenter, sal_uInt16 nAngle10 ); - - void Insert( sal_uInt16 nPos, const Point& rPt, PolyFlags eFlags = POLY_NORMAL ); - void Insert( sal_uInt16 nPos, const Polygon& rPoly ); - - const Point& operator[]( sal_uInt16 nPos ) const { return GetPoint( nPos ); } - Point& operator[]( sal_uInt16 nPos ); - - Polygon& operator=( const Polygon& rPoly ); - sal_Bool operator==( const Polygon& rPoly ) const; - sal_Bool operator!=( const Polygon& rPoly ) const - { return !(Polygon::operator==( rPoly )); } - sal_Bool IsEqual( const Polygon& rPoly ) const; - - // streaming a Polygon does ignore PolyFlags, so use the Write Or Read - // method to take care of PolyFlags - TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Polygon& rPoly ); - TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly ); - - void Read( SvStream& rIStream ); - void Write( SvStream& rOStream ) const; - - const Point* GetConstPointAry() const; - const sal_uInt8* GetConstFlagAry() const; - - // convert to ::basegfx::B2DPolygon and return - ::basegfx::B2DPolygon getB2DPolygon() const; - - // constructor to convert from ::basegfx::B2DPolygon - // #i76339# made explicit - explicit Polygon(const ::basegfx::B2DPolygon& rPolygon); -}; - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED PolyPolygon -{ -private: - ImplPolyPolygon* mpImplPolyPolygon; - - TOOLS_DLLPRIVATE void ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, sal_uIntPtr nOperation ) const; - TOOLS_DLLPRIVATE void *ImplCreateArtVpath() const; - TOOLS_DLLPRIVATE void ImplSetFromArtVpath( void *pVpath ); - -public: - PolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 ); - PolyPolygon( const Polygon& rPoly ); - PolyPolygon( sal_uInt16 nPoly, const sal_uInt16* pPointCountAry, - const Point* pPtAry ); - PolyPolygon( const PolyPolygon& rPolyPoly ); - ~PolyPolygon(); - - void Insert( const Polygon& rPoly, sal_uInt16 nPos = POLYPOLY_APPEND ); - void Remove( sal_uInt16 nPos ); - void Replace( const Polygon& rPoly, sal_uInt16 nPos ); - const Polygon& GetObject( sal_uInt16 nPos ) const; - - sal_Bool IsRect() const; - - void Clear(); - - sal_uInt16 Count() const; - Rectangle GetBoundRect() const; - void Clip( const Rectangle& rRect ); - void Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* pData = NULL ); - - /** Adaptive subdivision of polygons with curves - - This method adaptively subdivides bezier arcs within the - polygon to straight line segments and returns the resulting - polygon. - - @param rResult - The resulting subdivided polygon - - @param d - This parameter controls the amount of subdivision. The - original curve is guaranteed to not differ by more than this - amount per bezier segment from the subdivided - lines. Concretely, if the polygon is in device coordinates and - d equals 1.0, then the difference between the subdivided and - the original polygon is guaranteed to be smaller than one - pixel. - */ - void AdaptiveSubdivide( PolyPolygon& rResult, const double d = 1.0 ) const; - - void GetIntersection( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const; - void GetUnion( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const; - - void Move( long nHorzMove, long nVertMove ); - void Translate( const Point& rTrans ); - void Scale( double fScaleX, double fScaleY ); - void Rotate( const Point& rCenter, double fSin, double fCos ); - void Rotate( const Point& rCenter, sal_uInt16 nAngle10 ); - - const Polygon& operator[]( sal_uInt16 nPos ) const { return GetObject( nPos ); } - Polygon& operator[]( sal_uInt16 nPos ); - - PolyPolygon& operator=( const PolyPolygon& rPolyPoly ); - sal_Bool operator==( const PolyPolygon& rPolyPoly ) const; - sal_Bool operator!=( const PolyPolygon& rPolyPoly ) const - { return !(PolyPolygon::operator==( rPolyPoly )); } - - sal_Bool IsEqual( const PolyPolygon& rPolyPoly ) const; - - TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, PolyPolygon& rPolyPoly ); - TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const PolyPolygon& rPolyPoly ); - - void Read( SvStream& rIStream ); - void Write( SvStream& rOStream ) const; - - // convert to ::basegfx::B2DPolyPolygon and return - ::basegfx::B2DPolyPolygon getB2DPolyPolygon() const; - - // constructor to convert from ::basegfx::B2DPolyPolygon - // #i76339# made explicit - explicit PolyPolygon(const ::basegfx::B2DPolyPolygon& rPolyPolygon); -}; - -typedef std::vector< PolyPolygon > PolyPolyVector; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/postsys.h b/tools/inc/tools/postsys.h deleted file mode 100644 index 3c3431e50b8d..000000000000 --- a/tools/inc/tools/postsys.h +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -/* not protected, must be included together with prestl.h! */ - -#if defined WNT - -#undef Region -#undef PolyPolygon -#undef Polygon -#undef Rectangle -#undef DELETE - -/* rename help IDs */ -#define WIN_HELP_INDEX 0x0003 -#define WIN_HELP_HELPONHELP 0x0004 -#undef HELP_INDEX -#undef HELP_HELPONHELP - -#define WIN_MOUSE_MOVED 0x0001 -#undef MOUSE_MOVED - -#define WIN_WB_LEFT 0 -#define WIN_WB_RIGHT 1 -#undef WB_LEFT -#undef WB_RIGHT - -#ifdef GetObject -#undef GetObject -#ifdef UNICODE -#define WIN_GetObject GetObjectW -#else -#define WIN_GetObject GetObjectA -#endif -#else -#define WIN_GetObject GetObject -#endif - -#ifdef SetPrinter -#undef SetPrinter -#ifdef UNICODE -#define WIN_SetPrinter SetPrinterW -#else -#define WIN_SetPrinter SetPrinterA -#endif -#else -#define WIN_SetPrinter SetPrinter -#endif - -#ifdef GetPrinter -#undef GetPrinter -#ifdef UNICODE -#define WIN_GetPrinter GetPrinterW -#else -#define WIN_GetPrinter GetPrinterA -#endif -#else -#define WIN_GetPrinter GetPrinter -#endif - -#ifdef DrawText -#undef DrawText -#ifdef UNICODE -#define WIN_DrawText DrawTextW -#else -#define WIN_DrawText DrawTextA -#endif -#else -#define WIN_DrawText DrawText -#endif - -#ifdef mciSetCommand -#undef mciSetCommand -#ifdef UNICODE -#define WIN_mciSetCommand mciSetCommandW -#else -#define WIN_mciSetCommand mciSetCommandA -#endif -#else -#define mciSetCommand mciSetCommand -#endif - -#ifdef SetPort -#undef SetPort -#ifdef UNICODE -#define WIN_SetPort SetPortW -#else -#define WIN_SetPort SetPortA -#endif -#else -#define WIN_SetPort SetPort -#endif - -#ifdef CopyFile -#undef CopyFile -#ifdef UNICODE -#define WIN_CopyFile CopyFileW -#else -#define WIN_CopyFile CopyFileA -#endif -#else -#define WIN_CopyFile CopyFile -#endif - -#ifdef GetUserName -#undef GetUserName -#ifdef UNICODE -#define WIN_GetUserName GetUserNameW -#else -#define WIN_GetUserName GetUserNameA -#endif -#else -#define WIN_GetUserName GetUserName -#endif - -#ifdef GetClassName -#undef GetClassName -#ifdef UNICODE -#define WIN_GetClassName GetClassNameW -#else -#define WIN_GetClassName GetClassNameA -#endif -#else -#define WIN_GetClassName GetClassName -#endif - -#ifdef GetCharWidth -#undef GetCharWidth -#ifdef UNICODE -#define WIN_GetCharWidth GetCharWidthW -#else -#define WIN_GetCharWidth GetCharWidthA -#endif -#else -#define WIN_GetCharWidth GetCharWidth -#endif - -#ifdef GetMetaFile -#undef GetMetaFile -#ifdef UNICODE -#define WIN_GetMetaFile GetMetaFileW -#else -#define WIN_GetMetaFile GetMetaFileA -#endif -#else -#define WIN_GetMetaFile GetMetaFile -#endif - -#ifdef GetNumberFormat -#undef GetNumberFormat -#ifdef UNICODE -#define WIN_GetNumberFormat GetNumberFormatW -#else -#define WIN_GetNumberFormat GetNumberFormatA -#endif -#else -#define WIN_GetNumberFormat GetNumberFormat -#endif - -#ifdef GetGlyphOutline -#undef GetGlyphOutline -#ifdef UNICODE -#define WIN_GetGlyphOutline GetGlyphOutlineW -#else -#define WIN_GetGlyphOutline GetGlyphOutlineA -#endif -#else -#define WIN_GetGlyphOutline GetGlyphOutline -#endif - -#ifdef GetKerningPairs -#undef GetKerningPairs -#ifdef UNICODE -#define WIN_GetKerningPairs GetKerningPairsW -#else -#define WIN_GetKerningPairs GetKerningPairsA -#endif -#else -#define WIN_GetKerningPairs GetKerningPairs -#endif - -#ifdef FindWindow -#undef FindWindow -#ifdef UNICODE -#define WIN_FindWindow FindWindowW -#else -#define WIN_FindWindow FindWindowA -#endif -#else -#define WIN_FindWindow FindWindow -#endif - -#undef Yield - -/* new StretchBlt() Modes (simpler names) */ -#ifndef STRETCH_ANDSCANS -#define STRETCH_ANDSCANS 1 -#endif -#ifndef STRETCH_ORSCANS -#define STRETCH_ORSCANS 2 -#endif -#ifndef STRETCH_DELETESCANS -#define STRETCH_DELETESCANS 3 -#endif - -extern "C" -{ - BOOL WINAPI WIN_Rectangle( HDC hDC, int X1, int Y1, int X2, int Y2 ); - BOOL WINAPI WIN_Polygon( HDC hDC, CONST POINT * ppt, int ncnt ); - BOOL WINAPI WIN_PolyPolygon( HDC hDC, CONST POINT * ppt, LPINT npcnt, int ncnt ); -} - -#endif - -// avoid conflict with Pair in tools -#undef Pair - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/presys.h b/tools/inc/tools/presys.h deleted file mode 100644 index 521768685aa9..000000000000 --- a/tools/inc/tools/presys.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -/* not protected, do only include once! */ - -// avoid conflict with pair in tools -#define Pair StlPair - -#if defined WNT - -#define Rectangle BLA_Rectangle -#define Polygon BLA_Polygon -#define PolyPolygon BLA_PolyPolygon -#define Region WIN_Region - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/pstm.hxx b/tools/inc/tools/pstm.hxx deleted file mode 100644 index 6f971ca7014a..000000000000 --- a/tools/inc/tools/pstm.hxx +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _PSTM_HXX -#define _PSTM_HXX - -#include <boost/unordered_map.hpp> -#include "tools/toolsdllapi.h" -#include <tools/unqidx.hxx> -#include <tools/ref.hxx> -#include <tools/rtti.hxx> -#include <tools/stream.hxx> -#include <map> - -#define ERRCODE_IO_NOFACTORY ERRCODE_IO_WRONGFORMAT - -class SvPersistBase; - -typedef void * (*SvCreateInstancePersist)( SvPersistBase ** ); - -#define SV_CLASS_REGISTER( Class ) \ - Register( Class::StaticClassId(), Class::CreateInstance ) - -class TOOLS_DLLPUBLIC SvClassManager -{ - typedef boost::unordered_map<sal_Int32, SvCreateInstancePersist> Map; - Map aAssocTable; - -public: - void Register( sal_Int32 nClassId, SvCreateInstancePersist pFunc ); - SvCreateInstancePersist Get( sal_Int32 nClassId ); -}; - -class TOOLS_DLLPUBLIC SvRttiBase : public SvRefBase -{ -public: - TYPEINFO(); -}; -SV_DECL_IMPL_REF(SvRttiBase) - -#define SV_DECL_PERSIST( Class, CLASS_ID ) \ - TYPEINFO(); \ - static sal_Int32 StaticClassId() { return CLASS_ID; } \ - static void * CreateInstance( SvPersistBase ** ppBase ); \ - friend SvPersistStream& operator >> ( SvPersistStream & rStm, \ - Class *& rpObj); \ - virtual sal_Int32 GetClassId() const; \ - virtual void Load( SvPersistStream & ); \ - virtual void Save( SvPersistStream & ); - -#define SV_DECL_PERSIST1( Class, Super1, CLASS_ID ) \ - SV_DECL_PERSIST( Class, CLASS_ID ) - -#define PRV_SV_IMPL_PERSIST( Class ) \ - void * Class::CreateInstance( SvPersistBase ** ppBase )\ - { \ - Class * p = new Class(); \ - *ppBase = p; \ - return p; \ - } \ - sal_Int32 Class::GetClassId() const \ - { return StaticClassId(); } \ - SvPersistStream& operator >> (SvPersistStream & rStm, Class *& rpObj)\ - { \ - SvPersistBase * pObj; \ - rStm >> pObj; \ - rpObj = PTR_CAST( Class, pObj ); \ - return rStm; \ - } - -#define SV_IMPL_PERSIST1( Class, Super1 ) \ - TYPEINIT1( Class, Super1 ) \ - PRV_SV_IMPL_PERSIST( Class ) - -class SvPersistStream; - -class SvPersistBase : public SvRttiBase -{ -public: - virtual sal_Int32 GetClassId() const = 0; - virtual void Load( SvPersistStream & ) = 0; - virtual void Save( SvPersistStream & ) = 0; - TOOLS_DLLPUBLIC friend SvPersistStream& operator >> ( SvPersistStream & rStm, - SvPersistBase *& rpObj ); -}; -SV_DECL_IMPL_REF(SvPersistBase) - -class SvPersistListWriteable -{ -public: - virtual ~SvPersistListWriteable() {} - virtual size_t size() const = 0; - virtual SvPersistBase* GetPersistBase(size_t idx) const = 0; -}; - -class SvPersistListReadable -{ -public: - virtual ~SvPersistListReadable() {} - virtual void push_back(SvPersistBase* p) = 0; -}; - -void TOOLS_DLLPUBLIC WritePersistListObjects(const SvPersistListWriteable& rList, SvPersistStream & rStm, bool bOnlyStreamed = false ); - -void TOOLS_DLLPUBLIC ReadObjects( SvPersistListReadable& rLst, SvPersistStream & rStm); - -// <T> has to be a subtype of "SvPersistBase*" -template<typename T> -class SvDeclPersistList : public SvRefMemberList<T>, - public SvPersistListWriteable, - public SvPersistListReadable -{ -public: - // implement the reader/writer adapter methods - size_t size() const { return SvRefMemberList<T>::size(); } - SvPersistBase* GetPersistBase(size_t idx) const { return SvRefMemberList<T>::operator[](idx); } - void push_back(SvPersistBase* p) { SvRefMemberList<T>::push_back(static_cast<T>(p)); } - void WriteObjects(SvPersistStream & rStm, bool bOnlyStreamed ) const { WritePersistListObjects(*this, rStm, bOnlyStreamed); } -}; - -template<typename T> -SvPersistStream& operator << (SvPersistStream &rStm, const SvDeclPersistList<T> &rLst) -{ - WritePersistListObjects( rLst, rStm ); - return rStm; -}; - -template<typename T> -SvPersistStream& operator >> (SvPersistStream &rStm, SvDeclPersistList<T> &rLst) -{ - ReadObjects( rLst, rStm ); - return rStm; -}; - -typedef UniqueIndex<SvPersistBase> SvPersistUIdx; -typedef std::map<SvPersistBase*, sal_uIntPtr> PersistBaseMap; - -class SvStream; - -/** Persistent Stream - - This class provides accessor to storing and loading runtime objects. - All dependent objects have to be stored as well. - In order to load objects automatically, every object class must - provide a Factory method to read an object from stream. - The list of all classes is stored in a <SvClassManager> object - and is sent to SvPersistStream upon initialization. - By using the Method SvPersistStream::WriteCompressed and - SvPersistStream::ReadCompressed, compressed sal_uInt32 values may be - written to / read from the Stream. - Several helper methods exists for writing and reading - object lengths to the stream: SvPersistStream::WriteDummyLen, - SvPersistStream::WriteLen and SvPersistStream::ReadLen. - - [Example] - - One example is described in the constructor. - Assume a ring-like dependency, where A referenes B, - B itself references C, and C references to both D and A. - - The order of the objects upon saving and loading does not matter, - as long objects are loaded in the same order they were stored. - - Saving: Loading: - A,B,C,D A,B,C,D correct - B,A,C,D B,A,C,D correct - C,A,B,D A,B,C,D wrong - A,B,C,D A,B,C wrong - - @note The file formats DBG_UTIL and !DBG_UTIL differ, but we can read from - both versions. -*/ -class TOOLS_DLLPUBLIC SvPersistStream : public SvStream -{ - SvClassManager & rClassMgr; - SvStream * pStm; - PersistBaseMap aPTable; // reversed pointer and key - SvPersistUIdx aPUIdx; - sal_uIntPtr nStartIdx; - const SvPersistStream * pRefStm; - sal_uInt32 nFlags; - - virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ); - virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ); - virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ); - virtual void FlushData(); - -protected: - void WriteObj( sal_uInt8 nHdr, SvPersistBase * pObj ); - sal_uInt32 ReadObj( SvPersistBase * & rpObj, sal_Bool bRegister ); - -public: - sal_Bool IsStreamed( SvPersistBase * pObj ) const - { return 0 != GetIndex( pObj ); } - virtual void ResetError(); - - SvPersistStream( SvClassManager &, SvStream * pStream, - sal_uInt32 nStartIdx = 1 ); - ~SvPersistStream(); - - void SetStream( SvStream * pStream ); - SvStream * GetStream() const { return pStm; } - virtual sal_uInt16 IsA() const; - - SvPersistBase * GetObject( sal_uIntPtr nIdx ) const; - sal_uIntPtr GetIndex( SvPersistBase * ) const; - - void SetContextFlags( sal_uInt32 n ) { nFlags = n; } - sal_uInt32 GetContextFlags() const { return nFlags; } - - static void WriteCompressed( SvStream & rStm, sal_uInt32 nVal ); - static sal_uInt32 ReadCompressed( SvStream & rStm ); - - sal_uInt32 WriteDummyLen(); - void WriteLen( sal_uInt32 nLenPos ); - sal_uInt32 ReadLen( sal_uInt32 * pTestPos ); - - SvPersistStream& WritePointer( SvPersistBase * pObj ); - SvPersistStream& ReadPointer( SvPersistBase * & rpObj ); - TOOLS_DLLPUBLIC friend SvPersistStream& operator << (SvPersistStream &, SvPersistBase *); - TOOLS_DLLPUBLIC friend SvPersistStream& operator >> (SvPersistStream &, SvPersistBase * &); - - // Objects maintain their IDs while storing and loading to/from stream - friend SvStream& operator >> ( SvStream &, SvPersistStream & ); - friend SvStream& operator << ( SvStream &, SvPersistStream & ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rc.h b/tools/inc/tools/rc.h deleted file mode 100644 index 5bcd4cb7f3b7..000000000000 --- a/tools/inc/tools/rc.h +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _TOOLS_RC_H -#define _TOOLS_RC_H - -#include <tools/rcid.h> - -// Defines for all "Window" resources. -// (Here are all window styles that are not in WinBits) -#define RSC_EXTRAMAPUNIT 0xFFFF // do not change that value! - -typedef short RSWND_STYLE; - -#define RSWND_DISABLED 0x01 -#define RSWND_CLIENTSIZE 0x02 - -#define WINDOW_XYMAPMODE 0x0001 -#define WINDOW_X 0x0002 -#define WINDOW_Y 0x0004 -#define WINDOW_WHMAPMODE 0x0008 -#define WINDOW_WIDTH 0x0010 -#define WINDOW_HEIGHT 0x0020 -#define WINDOW_TEXT 0x0080 -#define WINDOW_HELPTEXT 0x0100 -#define WINDOW_QUICKTEXT 0x0200 -#define WINDOW_EXTRALONG 0x0800 -#define WINDOW_UNIQUEID 0x1000 -#define WINDOW_BORDER_STYLE 0x2000 -#define WINDOW_HELPID 0x4000 - -// For "WorkWindow" resources: -#define WORKWIN_SHOWNORMAL 0 -#define WORKWIN_SHOWMINIMIZED 1 -#define WORKWIN_SHOWMAXIMIZED 2 - -// For "FixedBitmap" resource: -#define RSC_FIXEDBITMAP_BITMAP 0x0001 - -// For "FixedImage" resource: -#define RSC_FIXEDIMAGE_IMAGE 0x0001 - -// For "MenuButton" resources: -#define RSCMENUBUTTON_MENU 0x01 - -// For all menu resources: -#define RSC_MENU_ITEMS 0x01 -#define RSC_MENU_TEXT 0x02 -#define RSC_MENU_DEFAULTITEMID 0x04 - -// "MenuItem" resource options: -#define RSC_MENUITEM_SEPARATOR 0x001 -#define RSC_MENUITEM_ID 0x002 -#define RSC_MENUITEM_STATUS 0x004 -#define RSC_MENUITEM_TEXT 0x008 -#define RSC_MENUITEM_BITMAP 0x010 -#define RSC_MENUITEM_HELPTEXT 0x020 -#define RSC_MENUITEM_HELPID 0x040 -#define RSC_MENUITEM_KEYCODE 0x080 -#define RSC_MENUITEM_MENU 0x100 -#define RSC_MENUITEM_CHECKED 0x200 -#define RSC_MENUITEM_DISABLE 0x400 -#define RSC_MENUITEM_COMMAND 0x800 - -// "AccelKey" resource options: -#define ACCELITEM_ACCEL 0x01 -#define ACCELITEM_KEY 0x02 - -// For "Field" resources: -#define PATTERNFORMATTER_STRICTFORMAT 0x01 -#define PATTERNFORMATTER_EDITMASK 0x02 -#define PATTERNFORMATTER_LITTERALMASK 0x04 - -#define NUMERICFORMATTER_MIN 0x01 -#define NUMERICFORMATTER_MAX 0x02 -#define NUMERICFORMATTER_STRICTFORMAT 0x04 -//#define NUMERICFORMATTER_I12 0x08 // removed (2005-06-17) -#define NUMERICFORMATTER_DECIMALDIGITS 0x10 -#define NUMERICFORMATTER_VALUE 0x20 -#define NUMERICFORMATTER_NOTHOUSANDSEP 0x40 - -#define METRICFORMATTER_UNIT 0x01 -#define METRICFORMATTER_CUSTOMUNITTEXT 0x02 - -#define DATEFORMATTER_MIN 0x01 -#define DATEFORMATTER_MAX 0x02 -#define DATEFORMATTER_LONGFORMAT 0x04 -#define DATEFORMATTER_STRICTFORMAT 0x08 -//#define DATEFORMATTER_I12 0x10 // removed (2005-06-17) -#define DATEFORMATTER_VALUE 0x20 - -#define TIMEFORMATTER_MIN 0x01 -#define TIMEFORMATTER_MAX 0x02 -#define TIMEFORMATTER_TIMEFIELDFORMAT 0x04 -#define TIMEFORMATTER_DURATION 0x08 -#define TIMEFORMATTER_STRICTFORMAT 0x10 -//#define TIMEFORMATTER_I12 0x20 // removed (2005-06-17) -#define TIMEFORMATTER_VALUE 0x40 - -#define NUMERICFIELD_FIRST 0x01 -#define NUMERICFIELD_LAST 0x02 -#define NUMERICFIELD_SPINSIZE 0x04 - -#define METRICFIELD_FIRST 0x01 -#define METRICFIELD_LAST 0x02 -#define METRICFIELD_SPINSIZE 0x04 - -#define CURRENCYFIELD_FIRST 0x01 -#define CURRENCYFIELD_LAST 0x02 -#define CURRENCYFIELD_SPINSIZE 0x04 - -#define DATEFIELD_FIRST 0x01 -#define DATEFIELD_LAST 0x02 - -#define TIMEFIELD_FIRST 0x01 -#define TIMEFIELD_LAST 0x02 - -// For "ToolBoxItem" resources: -#define RSC_TOOLBOXITEM_ID 0x0001 -#define RSC_TOOLBOXITEM_TYPE 0x0002 -#define RSC_TOOLBOXITEM_STATUS 0x0004 -#define RSC_TOOLBOXITEM_HELPID 0x0008 -#define RSC_TOOLBOXITEM_TEXT 0x0010 -#define RSC_TOOLBOXITEM_HELPTEXT 0x0020 -#define RSC_TOOLBOXITEM_BITMAP 0x0040 -#define RSC_TOOLBOXITEM_IMAGE 0x0080 -#define RSC_TOOLBOXITEM_DISABLE 0x0100 -#define RSC_TOOLBOXITEM_STATE 0x0200 -#define RSC_TOOLBOXITEM_HIDE 0x0400 -#define RSC_TOOLBOXITEM_COMMAND 0x0800 -#define RSC_TOOLBOXITEM_MENUSTRINGS 0x1000 - -// For "ToolBox" resources: -#define RSC_TOOLBOX_BUTTONTYPE 0x01 -#define RSC_TOOLBOX_ALIGN 0x02 -#define RSC_TOOLBOX_LINECOUNT 0x04 -#define RSC_TOOLBOX_FLOATLINES 0x08 -#define RSC_TOOLBOX_CUSTOMIZE 0x10 -#define RSC_TOOLBOX_MENUSTRINGS 0x20 -#define RSC_TOOLBOX_ITEMIMAGELIST 0x40 -#define RSC_TOOLBOX_ITEMLIST 0x80 - -// For "MoreButton" resources: -#define RSC_MOREBUTTON_STATE 0x01 -#define RSC_MOREBUTTON_MAPUNIT 0x02 -#define RSC_MOREBUTTON_DELTA 0x04 - -// For "FloatingWindow" resources: -#define RSC_FLOATINGWINDOW_WHMAPMODE 0x01 -#define RSC_FLOATINGWINDOW_WIDTH 0x02 -#define RSC_FLOATINGWINDOW_HEIGHT 0x04 -#define RSC_FLOATINGWINDOW_ZOOMIN 0x08 - -// For "DockingWindow" resources: -#define RSC_DOCKINGWINDOW_XYMAPMODE 0x01 -#define RSC_DOCKINGWINDOW_X 0x02 -#define RSC_DOCKINGWINDOW_Y 0x04 -#define RSC_DOCKINGWINDOW_FLOATING 0x08 - -// For "TabControlItem" resources: -#define RSC_TABCONTROLITEM_ID 0x0001 -#define RSC_TABCONTROLITEM_TEXT 0x0002 -#define RSC_TABCONTROLITEM_PAGERESID 0x0008 - -// For "TabControl" resources: -#define RSC_TABCONTROL_ITEMLIST 0x01 - -// For "ImageButtons": -#define RSC_IMAGEBUTTON_IMAGE 0x01 -#define RSC_IMAGEBUTTON_SYMBOL 0x02 -#define RSC_IMAGEBUTTON_STATE 0x04 - -// For "ImageRadioButtons": -#define RSC_IMAGERADIOBUTTON_IMAGE 0x01 - -// For "Image": -#define RSC_IMAGE_IMAGEBITMAP 0x01 -#define RSC_IMAGE_MASKBITMAP 0x02 -#define RSC_IMAGE_MASKCOLOR 0x04 - -// For "ImageList": -#define RSC_IMAGELIST_IMAGEBITMAP 0x01 -#define RSC_IMAGELIST_MASKBITMAP 0x02 -#define RSC_IMAGELIST_MASKCOLOR 0x04 -#define RSC_IMAGELIST_IDLIST 0x08 -#define RSC_IMAGELIST_IDCOUNT 0x10 - -// FIXME obsolete, should be removed by MM -#define RSC_COLOR (RSC_NOTYPE + 0x16) -#define TIME_HOUR 0x01 -#define TIME_MINUTE 0x02 -#define TIME_SECOND 0x04 -#define TIME_SEC100 0x08 -#define DATE_YEAR 0x01 -#define DATE_MONTH 0x02 -#define DATE_DAY 0x04 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rc.hxx b/tools/inc/tools/rc.hxx deleted file mode 100644 index a043db47d4d5..000000000000 --- a/tools/inc/tools/rc.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_RC_HXX -#define _TOOLS_RC_HXX - -#include "tools/toolsdllapi.h" -#include <i18nlangtag/lang.h> -#include <tools/string.hxx> -#include <tools/resmgr.hxx> - -class TOOLS_DLLPUBLIC Resource -{ -protected: - ResMgr* m_pResMgr; - - // check availability of Resource - sal_Bool IsAvailableRes( const ResId& rId ) const - { return m_pResMgr->IsAvailable( rId, this ); } - - // Load a Resource - void GetRes( const ResId& rResId ); - - // check Resource state - void TestRes(); - - // Get a pointer to the Resource's data - void* GetClassRes() - { return m_pResMgr->GetClass(); } - - // increase the memory pointer gotten by GetClassRes() - void* IncrementRes( sal_uInt32 nBytes ) - { return m_pResMgr->Increment( nBytes ); } - - // return the memory size of a Resource data block - static sal_uInt32 GetObjSizeRes( RSHEADER_TYPE * pHT ) - { return ResMgr::GetObjSize( pHT ); } - - // return the remaining size of this Resource's data - sal_uInt32 GetRemainSizeRes() - { return m_pResMgr->GetRemainSize(); } - - // get a 32bit value from Resource data - static sal_Int32 GetLongRes( void * pLong ) - { return ResMgr::GetLong( pLong ); } - // get a 16bit value from Resource data - static sal_Int16 GetShortRes( void * pShort ) - { return ResMgr::GetShort( pShort ); } - - // read a 32bit value from resource data and increment pointer - sal_Int32 ReadLongRes() - { return m_pResMgr->ReadLong(); } - // read a 16bit value from resource data and increment pointer - sal_Int16 ReadShortRes() - { return m_pResMgr->ReadShort(); } - // read a string from resource data and increment pointer - OUString ReadStringRes() - { return m_pResMgr->ReadString(); } - // read a byte string from resource data and increment pointer - OString ReadByteStringRes() - { return m_pResMgr->ReadByteString(); } - - // free the resource from m_pResMgr's stack (pass this ptr for validation) - void FreeResource() - { m_pResMgr->PopContext( this ); } - - // constructors - Resource() : m_pResMgr( NULL ) {} - Resource( const ResId& rResId ); - -public: -#ifdef DBG_UTIL - ~Resource() { TestRes(); } -#else - ~Resource() {} -#endif -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rcid.h b/tools/inc/tools/rcid.h deleted file mode 100644 index d257639a99f8..000000000000 --- a/tools/inc/tools/rcid.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _TOOLS_RCID_H -#define _TOOLS_RCID_H - -#include <tools/resid.hxx> - -// Definition of the version number -#define RSCVERSION_ID 200U -// Definition of an invalid identifier -#define RC_NO_ID (sal_uInt32(0xFFFFFFFF)) - -// Resource types -// Minimum is 0x100 due to MS-Windows resource types -// (RSC_NOTYPE=0x100) is defined in resid.hxx -#define RSC_BYNAME (RSC_NOTYPE + 0x01) -#define RSC_VERSIONCONTROL (RSC_NOTYPE + 0x02) // Version control - -#define RSC_RESOURCE (RSC_NOTYPE + 0x10) -#define RSC_STRING (RSC_NOTYPE + 0x11) -#define RSC_BITMAP (RSC_NOTYPE + 0x13) -#define RSC_ACCEL (RSC_NOTYPE + 0x1a) -#define RSC_ACCELITEM (RSC_NOTYPE + 0x1b) // only used internally -#define RSC_MENU (RSC_NOTYPE + 0x1c) -#define RSC_MENUITEM (RSC_NOTYPE + 0x1d) // only used internally -#define RSC_KEYCODE (RSC_NOTYPE + 0x1f) -#define RSC_TIME (RSC_NOTYPE + 0x20) -#define RSC_DATE (RSC_NOTYPE + 0x21) -//#define RSC_INTERNATIONAL (RSC_NOTYPE + 0x22) // removed (2005-06-17) -#define RSC_IMAGE (RSC_NOTYPE + 0x23) -#define RSC_IMAGELIST (RSC_NOTYPE + 0x24) - -#define RSC_MESSBOX (RSC_NOTYPE + 0x30) -#define RSC_INFOBOX (RSC_NOTYPE + 0x31) -#define RSC_WARNINGBOX (RSC_NOTYPE + 0x32) -#define RSC_ERRORBOX (RSC_NOTYPE + 0x33) -#define RSC_QUERYBOX (RSC_NOTYPE + 0x34) -#define RSC_WINDOW (RSC_NOTYPE + 0x35) -#define RSC_SYSWINDOW (RSC_NOTYPE + 0x36) -#define RSC_WORKWIN (RSC_NOTYPE + 0x37) -#define RSC_MDIWINDOW (RSC_NOTYPE + 0x38) -#define RSC_FLOATINGWINDOW (RSC_NOTYPE + 0x39) -#define RSC_DIALOG (RSC_NOTYPE + 0x3a) -#define RSC_MODELESSDIALOG (RSC_NOTYPE + 0x3b) -#define RSC_MODALDIALOG (RSC_NOTYPE + 0x3c) -#define RSC_CONTROL (RSC_NOTYPE + 0x44) -#define RSC_BUTTON (RSC_NOTYPE + 0x45) -#define RSC_PUSHBUTTON (RSC_NOTYPE + 0x46) -#define RSC_OKBUTTON (RSC_NOTYPE + 0x47) -#define RSC_CANCELBUTTON (RSC_NOTYPE + 0x48) -#define RSC_HELPBUTTON (RSC_NOTYPE + 0x49) -#define RSC_IMAGEBUTTON (RSC_NOTYPE + 0x4a) -#define RSC_MENUBUTTON (RSC_NOTYPE + 0x4b) -#define RSC_MOREBUTTON (RSC_NOTYPE + 0x4c) -#define RSC_SPINBUTTON (RSC_NOTYPE + 0x4d) -#define RSC_RADIOBUTTON (RSC_NOTYPE + 0x4e) -#define RSC_IMAGERADIOBUTTON (RSC_NOTYPE + 0x4f) -#define RSC_CHECKBOX (RSC_NOTYPE + 0x50) -#define RSC_TRISTATEBOX (RSC_NOTYPE + 0x51) -#define RSC_EDIT (RSC_NOTYPE + 0x52) -#define RSC_MULTILINEEDIT (RSC_NOTYPE + 0x53) -#define RSC_COMBOBOX (RSC_NOTYPE + 0x54) -#define RSC_LISTBOX (RSC_NOTYPE + 0x55) -#define RSC_MULTILISTBOX (RSC_NOTYPE + 0x56) -#define RSC_TEXT (RSC_NOTYPE + 0x57) -#define RSC_FIXEDLINE (RSC_NOTYPE + 0x58) -#define RSC_FIXEDBITMAP (RSC_NOTYPE + 0x59) -#define RSC_FIXEDIMAGE (RSC_NOTYPE + 0x5a) -#define RSC_GROUPBOX (RSC_NOTYPE + 0x5c) -#define RSC_SCROLLBAR (RSC_NOTYPE + 0x5d) -#define RSC_SCROLLBARBOX (RSC_NOTYPE + 0x5e) -#define RSC_SPLITTER (RSC_NOTYPE + 0x5f) -#define RSC_SPLITWINDOW (RSC_NOTYPE + 0x60) -#define RSC_SPINFIELD (RSC_NOTYPE + 0x61) -#define RSC_PATTERNFIELD (RSC_NOTYPE + 0x62) -#define RSC_NUMERICFIELD (RSC_NOTYPE + 0x63) -#define RSC_METRICFIELD (RSC_NOTYPE + 0x64) -#define RSC_CURRENCYFIELD (RSC_NOTYPE + 0x65) -#define RSC_DATEFIELD (RSC_NOTYPE + 0x66) -#define RSC_TIMEFIELD (RSC_NOTYPE + 0x67) -#define RSC_PATTERNBOX (RSC_NOTYPE + 0x68) -#define RSC_NUMERICBOX (RSC_NOTYPE + 0x69) -#define RSC_METRICBOX (RSC_NOTYPE + 0x6a) -#define RSC_CURRENCYBOX (RSC_NOTYPE + 0x6b) -#define RSC_DATEBOX (RSC_NOTYPE + 0x6c) -#define RSC_TIMEBOX (RSC_NOTYPE + 0x6d) -#define RSC_LONGCURRENCYFIELD (RSC_NOTYPE + 0x6e) -#define RSC_LONGCURRENCYBOX (RSC_NOTYPE + 0x6f) -#define RSC_TOOLBOXITEM (RSC_NOTYPE + 0x70) -#define RSC_TOOLBOX (RSC_NOTYPE + 0x71) -#define RSC_DOCKINGWINDOW (RSC_NOTYPE + 0x72) -#define RSC_STATUSBAR (RSC_NOTYPE + 0x73) -#define RSC_TABPAGE (RSC_NOTYPE + 0x74) -#define RSC_TABCONTROL (RSC_NOTYPE + 0x75) -#define RSC_TABDIALOG (RSC_NOTYPE + 0x76) -#define RSC_TABCONTROLITEM (RSC_NOTYPE + 0x77) -#define RSC_TREELISTBOX (RSC_NOTYPE + 0x78) -#define RSC_STRINGARRAY (RSC_NOTYPE + 0x79) - -// (RSC_NOTYPE + 0x200) - (RSC_NOTYPE + 0x300) reserved for Sfx - -#define RT_SYS_BITMAP (RSC_NOTYPE + 0xf2) -#define RT_SYS_STRING (RSC_NOTYPE + 0xf3) // special case -#define RT_SYS_FILE (RSC_NOTYPE + 0xf4) // not implemented - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/ref.hxx b/tools/inc/tools/ref.hxx deleted file mode 100644 index ac7a42bc2e3e..000000000000 --- a/tools/inc/tools/ref.hxx +++ /dev/null @@ -1,256 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _REF_HXX -#define _REF_HXX - -#include "tools/toolsdllapi.h" -#include <vector> - -#define PRV_SV_IMPL_REF_COUNTERS( ClassName, Ref, AddRef, AddNextRef, ReleaseRef, Init, pRefbase ) \ -inline ClassName##Ref::ClassName##Ref( const ClassName##Ref & rObj ) \ - { pObj = rObj.pObj; if( pObj ) { Init pRefbase->AddNextRef; } } \ -inline ClassName##Ref::ClassName##Ref( ClassName * pObjP ) \ -{ pObj = pObjP; if( pObj ) { Init pRefbase->AddRef; } } \ -inline void ClassName##Ref::Clear() \ -{ \ - if( pObj ) \ - { \ - ClassName* const pRefObj = pRefbase; \ - pObj = 0; \ - pRefObj->ReleaseRef; \ - } \ -} \ -inline ClassName##Ref::~ClassName##Ref() \ -{ if( pObj ) { pRefbase->ReleaseRef; } } \ -inline ClassName##Ref & ClassName##Ref:: \ - operator = ( const ClassName##Ref & rObj ) \ -{ \ - if( rObj.pObj ) rObj.pRefbase->AddNextRef; \ - ClassName* const pRefObj = pRefbase; \ - pObj = rObj.pObj; \ - Init if( pRefObj ) { pRefObj->ReleaseRef; } \ - return *this; \ -} \ -inline ClassName##Ref & ClassName##Ref::operator = ( ClassName * pObjP ) \ -{ return *this = ClassName##Ref( pObjP ); } - -#define PRV_SV_DECL_REF_LOCK(ClassName, Ref) \ -protected: \ - ClassName * pObj; \ -public: \ - inline ClassName##Ref() { pObj = 0; } \ - inline ClassName##Ref( const ClassName##Ref & rObj ); \ - inline ClassName##Ref( ClassName * pObjP ); \ - inline void Clear(); \ - inline ~ClassName##Ref(); \ - inline ClassName##Ref & operator = ( const ClassName##Ref & rObj ); \ - inline ClassName##Ref & operator = ( ClassName * pObj ); \ - inline sal_Bool Is() const { return pObj != NULL; } \ - inline ClassName * operator & () const { return pObj; } \ - inline ClassName * operator -> () const { return pObj; } \ - inline ClassName & operator * () const { return *pObj; } \ - inline operator ClassName * () const { return pObj; } - -#define PRV_SV_DECL_REF( ClassName ) \ -PRV_SV_DECL_REF_LOCK( ClassName, Ref ) - -#define SV_DECL_REF( ClassName ) \ -class ClassName; \ -class ClassName##Ref \ -{ \ - PRV_SV_DECL_REF( ClassName ) \ -}; - -#define SV_DECL_LOCK( ClassName ) \ -class ClassName; \ -class ClassName##Lock \ -{ \ - PRV_SV_DECL_REF_LOCK( ClassName, Lock ) \ -}; - -#define SV_IMPL_REF( ClassName ) \ -PRV_SV_IMPL_REF_COUNTERS( ClassName, Ref, AddRef(), AddNextRef(),\ - ReleaseReference(), EMPTYARG, pObj ) - -#define SV_IMPL_LOCK( ClassName ) \ -PRV_SV_IMPL_REF_COUNTERS( ClassName, Lock, OwnerLock( sal_True ), \ - OwnerLock( sal_True ), OwnerLock( sal_False ), \ - EMPTYARG, pObj ) - -#define SV_DECL_IMPL_REF(ClassName) \ - SV_DECL_REF(ClassName) \ - SV_IMPL_REF(ClassName) - -template<typename T> -class SvRefMemberList : private std::vector<T> -{ -private: - typedef typename std::vector<T> base_t; - -public: - using base_t::size; - using base_t::front; - using base_t::back; - using base_t::operator[]; - using base_t::begin; - using base_t::end; - using typename base_t::iterator; - using typename base_t::const_iterator; - using base_t::rbegin; - using base_t::rend; - using typename base_t::reverse_iterator; - using base_t::empty; - - inline ~SvRefMemberList() { clear(); } - inline void clear() - { - for( typename base_t::const_iterator it = base_t::begin(); it != base_t::end(); ++it ) - { - T p = *it; - if( p ) - p->ReleaseReference(); - } - base_t::clear(); - } - - inline void push_back( T p ) - { - base_t::push_back( p ); - p->AddRef(); - } - - inline void insert(const SvRefMemberList& rOther) - { - for( typename base_t::const_iterator it = rOther.begin(); it != rOther.end(); ++it ) - { - push_back(*it); - } - } - - inline T pop_back() - { - T p = base_t::back(); - base_t::pop_back(); - if( p ) - p->ReleaseReference(); - return p; - } -}; - -#define SV_NO_DELETE_REFCOUNT 0x80000000 - -class TOOLS_DLLPUBLIC SvRefBase -{ - sal_uIntPtr nRefCount; - -protected: - virtual ~SvRefBase(); - virtual void QueryDelete(); - -public: - SvRefBase() { nRefCount = SV_NO_DELETE_REFCOUNT; } - SvRefBase( const SvRefBase & /* rObj */ ) - { nRefCount = SV_NO_DELETE_REFCOUNT; } - SvRefBase & operator = ( const SvRefBase & ) { return *this; } - - void RestoreNoDelete() - { - if( nRefCount < SV_NO_DELETE_REFCOUNT ) - nRefCount += SV_NO_DELETE_REFCOUNT; - } - sal_uIntPtr AddMulRef( sal_uIntPtr n ) { return nRefCount += n; } - sal_uIntPtr AddNextRef() { return ++nRefCount; } - sal_uIntPtr AddRef() - { - if( nRefCount >= SV_NO_DELETE_REFCOUNT ) - nRefCount -= SV_NO_DELETE_REFCOUNT; - return ++nRefCount; - } - void ReleaseReference() - { - if( !--nRefCount ) - QueryDelete(); - } - sal_uIntPtr ReleaseRef() - { - sal_uIntPtr n = --nRefCount; - if( !n ) - QueryDelete(); - return n; - } - sal_uIntPtr GetRefCount() const { return nRefCount; } -}; - -#ifndef EMPTYARG -#define EMPTYARG -#endif - -SV_DECL_IMPL_REF(SvRefBase) - -class SvCompatWeakHdl : public SvRefBase -{ - friend class SvCompatWeakBase; - void* _pObj; - SvCompatWeakHdl( void* pObj ) : _pObj( pObj ) {} - -public: - void ResetWeakBase( ) { _pObj = 0; } - void* GetObj() { return _pObj; } -}; - -SV_DECL_IMPL_REF( SvCompatWeakHdl ) - -class SvCompatWeakBase -{ - SvCompatWeakHdlRef _xHdl; - -public: - SvCompatWeakHdl* GetHdl() { return _xHdl; } - - // does not use Initalizer due to compiler warnings - SvCompatWeakBase( void* pObj ) { _xHdl = new SvCompatWeakHdl( pObj ); } - ~SvCompatWeakBase() { _xHdl->ResetWeakBase(); } -}; - -#define SV_DECL_COMPAT_WEAK( ClassName ) \ -class ClassName##Weak \ -{ \ - SvCompatWeakHdlRef _xHdl; \ -public: \ - inline ClassName##Weak( ) {} \ - inline ClassName##Weak( ClassName* pObj ) { \ - if( pObj ) _xHdl = pObj->GetHdl(); } \ - inline void Clear() { _xHdl.Clear(); } \ - inline ClassName##Weak& operator = ( ClassName * pObj ) { \ - _xHdl = pObj ? pObj->GetHdl() : 0; return *this; } \ - inline sal_Bool Is() const { \ - return _xHdl.Is() && _xHdl->GetObj(); } \ - inline ClassName * operator & () const { \ - return (ClassName*) ( _xHdl.Is() ? _xHdl->GetObj() : 0 ); } \ - inline ClassName * operator -> () const { \ - return (ClassName*) ( _xHdl.Is() ? _xHdl->GetObj() : 0 ); } \ - inline ClassName & operator * () const { \ - return *(ClassName*) _xHdl->GetObj(); } \ - inline operator ClassName * () const { \ - return (ClassName*) (_xHdl.Is() ? _xHdl->GetObj() : 0 ); } \ -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/resary.hxx b/tools/inc/tools/resary.hxx deleted file mode 100644 index 515dd779120b..000000000000 --- a/tools/inc/tools/resary.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_RESARY_HXX -#define _TOOLS_RESARY_HXX - -#include "boost/noncopyable.hpp" -#include <vector> -#include "tools/toolsdllapi.h" -#include <tools/string.hxx> -#include <tools/resid.hxx> - -#define RESARRAY_INDEX_NOTFOUND (0xffffffff) - -class TOOLS_DLLPUBLIC ResStringArray : private boost::noncopyable -{ -private: - struct ImplResStringItem - { - OUString m_aStr; - long m_nValue; - - ImplResStringItem( const OUString& rStr, long nValue = 0 ) : - m_aStr( rStr ), - m_nValue( nValue ) - {} - }; - - std::vector< ImplResStringItem > m_aStrings; - -public: - ResStringArray( const ResId& rResId ); - ~ResStringArray(); - - const OUString GetString( sal_uInt32 nIndex ) const - { return (nIndex < m_aStrings.size()) ? m_aStrings[nIndex].m_aStr : OUString(); } - long GetValue( sal_uInt32 nIndex ) const - { return (nIndex < m_aStrings.size()) ? m_aStrings[nIndex].m_nValue : -1; } - sal_uInt32 Count() const { return sal_uInt32(m_aStrings.size()); } - - sal_uInt32 FindIndex( long nValue ) const; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/resid.hxx b/tools/inc/tools/resid.hxx deleted file mode 100644 index 14c0a11915f7..000000000000 --- a/tools/inc/tools/resid.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _TOOLS_RESID_HXX -#define _TOOLS_RESID_HXX - -#include <osl/diagnose.h> -#include <rtl/ustring.hxx> -#include <tools/solar.h> -#include "tools/toolsdllapi.h" - -struct RSHEADER_TYPE; -typedef sal_uInt32 RESOURCE_TYPE; -#define RSC_NOTYPE 0x100 -#define RSC_DONTRELEASE (sal_uInt32(1 << 31)) - -class ResMgr; - -class ResId -{ - /* - consider two cases: either m_pResource is valid and points - two a resource data buffer; then m_nResId and m_pResMgr are - not used and may be 0 resp. NULL - or m_pResource is NULL, the m_nResId and m_pResMgr must be valid. - In this case the highest bit if set decides whether to - not to release the Resource context after loading this id - */ - RSHEADER_TYPE* m_pResource; - - mutable sal_uInt32 m_nResId; // Resource Identifier - mutable RESOURCE_TYPE m_nRT; // type for loading (mutable to be set later) - mutable ResMgr * m_pResMgr; // load from this ResMgr (mutable for setting on demand) - mutable RESOURCE_TYPE m_nRT2; // type for loading (supercedes m_nRT) - mutable sal_uInt32 m_nWinBits; // container for original style bits on a window in a resource - - void ImplInit( sal_uInt32 nId, ResMgr& rMgr, RSHEADER_TYPE* pRes ) - { - m_pResource = pRes; m_nResId = nId; m_nRT = RSC_NOTYPE; m_pResMgr = &rMgr; m_nRT2 = RSC_NOTYPE; m_nWinBits = 0; - OSL_ENSURE( m_pResMgr != NULL, "ResId without ResMgr created" ); - } - -public: - ResId( RSHEADER_TYPE * pRc, ResMgr& rMgr ) - { - ImplInit( 0, rMgr, pRc ); - } - ResId( sal_uInt32 nId, ResMgr& rMgr ) - { - ImplInit( nId, rMgr, NULL ); - } - // backwards compatibility; avoid ambiguities - ResId( sal_uInt16 nId, ResMgr& rMgr ) - { - ImplInit( sal_uInt32(nId), rMgr, NULL ); - } - ResId( int nId, ResMgr& rMgr ) - { - ImplInit( sal_uInt32(nId), rMgr, NULL ); - } - ResId( long nId, ResMgr& rMgr ) - { - ImplInit( sal_uInt32(nId), rMgr, NULL ); - } - - sal_uInt32 GetWinBits() const { return m_nWinBits; } - void SetWinBits( sal_uInt32 nBits ) const { m_nWinBits = nBits; } - - RESOURCE_TYPE GetRT() const { return( m_nRT ); } - - /** Set the type if not already set. Ask for tye with GetRT() - - [Example] - ResId aId( 1000 ); - aId.SetRT( RSC_WINDOW ); // settype window Window - aId.SetRT( RSC_BUTTON ); // will not set type Button - //aId.GetRT() == RSC_WINDOW is true - - @see - ResId::GetRT2(), ResId::GetRT() - */ - const ResId & SetRT( RESOURCE_TYPE nType ) const - { - if( RSC_NOTYPE == m_nRT ) - m_nRT = nType; - return *this; - } - - /** Get the effective type (m_nRT2 or m_nRT1) - - A second resource type is used to supercede settings - of the base class ( e.g. Window ) - */ - RESOURCE_TYPE GetRT2() const - { - return (RSC_NOTYPE == m_nRT2) ? m_nRT : m_nRT2; - } - - /** Set the superceding type. Ask spcifically for it with GetRT2() - - SetRT2() may only be called if no derived class calls SetRT in its - Resource constructor. - */ - const ResId & SetRT2( RESOURCE_TYPE nTyp ) const - { - if( RSC_NOTYPE == m_nRT2 ) - m_nRT2 = nTyp; - return *this; - } - - ResMgr * GetResMgr() const { return m_pResMgr; } - const ResId & SetResMgr( ResMgr * pMgr ) const - { - m_pResMgr = pMgr; - OSL_ENSURE( m_pResMgr != NULL, "invalid ResMgr set on ResId" ); - return *this; - } - - const ResId & SetAutoRelease(sal_Bool bRelease) const - { - if( bRelease ) - m_nResId &= ~RSC_DONTRELEASE; - else - m_nResId |= RSC_DONTRELEASE; - return *this; - } - - sal_Bool IsAutoRelease() const - { return !(m_nResId & RSC_DONTRELEASE); } - - sal_uInt32 GetId() const { return m_nResId & ~RSC_DONTRELEASE; } - RSHEADER_TYPE* GetpResource() const { return m_pResource; } - - TOOLS_DLLPUBLIC OUString toString() const; - TOOLS_DLLPUBLIC operator OUString() const { return toString(); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/resmgr.hxx b/tools/inc/tools/resmgr.hxx deleted file mode 100644 index 603a2c7a2eb5..000000000000 --- a/tools/inc/tools/resmgr.hxx +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_RESMGR_HXX -#define _TOOLS_RESMGR_HXX - -#include "tools/toolsdllapi.h" -#include <i18nlangtag/languagetag.hxx> -#include <tools/string.hxx> -#include <tools/resid.hxx> - -#include <vector> - -class SvStream; -class InternalResMgr; - -/// Defines structure used to build resource -struct RSHEADER_TYPE -{ -private: - sal_uInt32 nId; ///< Identifier of resource - RESOURCE_TYPE nRT; ///< Resource type - sal_uInt32 nGlobOff; ///< Global offset - sal_uInt32 nLocalOff; ///< Local offset - -public: - inline sal_uInt32 GetId(); ///< Identifier of resource - inline RESOURCE_TYPE GetRT(); ///< Resource type - inline sal_uInt32 GetGlobOff(); ///< Global offset - inline sal_uInt32 GetLocalOff(); ///< Local offset -}; - -typedef OUString (*ResHookProc)( const OUString& rStr ); - -// Initialization -#define RC_NOTYPE 0x00 -// Global resource -#define RC_GLOBAL 0x01 -#define RC_AUTORELEASE 0x02 -#define RC_NOTFOUND 0x04 -#define RC_FALLBACK_DOWN 0x08 -#define RC_FALLBACK_UP 0x10 - -class Resource; -class ResMgr; - -struct ImpRCStack -{ - // pResource and pClassRes equal NULL: resource was not loaded - RSHEADER_TYPE * pResource; ///< pointer to resource - void * pClassRes; ///< pointer to class specified init data - short Flags; ///< resource status - void * aResHandle; ///< Resource-Identifier from InternalResMgr - const Resource* pResObj; ///< pointer to Resource object - sal_uInt32 nId; ///< ResId used for error message - ResMgr* pResMgr; ///< ResMgr for Resource pResObj - - void Clear(); - void Init( ResMgr * pMgr, const Resource * pObj, sal_uInt32 nId ); -}; - -class TOOLS_DLLPUBLIC ResMgr -{ -private: - InternalResMgr* pImpRes; - std::vector< ImpRCStack > aStack; ///< resource context stack - int nCurStack; - ResMgr* pFallbackResMgr; ///< fallback ResMgr in case the Resource - ///< was not contained in this ResMgr - ResMgr* pOriginalResMgr; ///< the res mgr that fell back to this - ///< stack level - - TOOLS_DLLPRIVATE void incStack(); - TOOLS_DLLPRIVATE void decStack(); - - TOOLS_DLLPRIVATE const ImpRCStack * StackTop( sal_uInt32 nOff = 0 ) const - { - return (((int)nOff >= nCurStack) ? NULL : &aStack[nCurStack-nOff]); - } - TOOLS_DLLPRIVATE void Init( const OUString& rFileName ); - - TOOLS_DLLPRIVATE ResMgr( InternalResMgr * pImp ); - - #ifdef DBG_UTIL - TOOLS_DLLPRIVATE static void RscError_Impl( const sal_Char* pMessage, - ResMgr* pResMgr, - RESOURCE_TYPE nRT, - sal_uInt32 nId, - std::vector< ImpRCStack >& rResStack, - int nDepth ); - #endif - - // called from within GetResource() if a resource could not be found - TOOLS_DLLPRIVATE ResMgr* CreateFallbackResMgr( const ResId& rId, - const Resource* pResource ); - // creates a 1k sized buffer set to zero for unfound resources - // used in case RC_NOTFOUND - static void* pEmptyBuffer; - TOOLS_DLLPRIVATE static void* getEmptyBuffer(); - - // the next two methods are needed to prevent the string hook called - // with the res mgr mutex locked - // like GetString, but doesn't call the string hook - TOOLS_DLLPRIVATE static sal_uInt32 GetStringWithoutHook( OUString& rStr, - const sal_uInt8* pStr ); - // like ReadString but doesn't call the string hook - TOOLS_DLLPRIVATE OUString ReadStringWithoutHook(); - - static ResMgr* ImplCreateResMgr( InternalResMgr* pImpl ) { return new ResMgr( pImpl ); } - - // no copying - ResMgr(const ResMgr&); - ResMgr& operator=(const ResMgr&); - -public: - static void DestroyAllResMgr(); ///< Called upon app shutdown - - ~ResMgr(); - - /// Language-dependent resource library - static const sal_Char* GetLang( LanguageType& eLanguage, sal_uInt16 nPrio = 0 ); ///< @deprecated see "tools/source/rc/resmgr.cxx" - static ResMgr* SearchCreateResMgr( const sal_Char* pPrefixName, - LanguageTag& rLocale ); - static ResMgr* CreateResMgr( const sal_Char* pPrefixName, - LanguageTag aLocale = LanguageTag( LANGUAGE_SYSTEM) ); - - /// Test whether resource still exists - void TestStack( const Resource * ); - - /// Check whether resource is available - sal_Bool IsAvailable( const ResId& rId, - const Resource* = NULL) const; - - /// Search and load resource, given its ID - sal_Bool GetResource( const ResId& rId, const Resource * = NULL ); - static void * GetResourceSkipHeader( const ResId& rResId, ResMgr ** ppResMgr ); - /// Free resource context - void PopContext( const Resource* = NULL ); - - /// Increment resource pointer - void* Increment( sal_uInt32 nSize ); - - /// Size of an object within the resource - static sal_uInt32 GetObjSize( RSHEADER_TYPE* pHT ) - { return( pHT->GetGlobOff() ); } - - /// Return a string and its length out of the resource - static sal_uInt32 GetString( OUString& rStr, const sal_uInt8* pStr ); - /// Return a byte string and its length out of the resource - static sal_uInt32 GetByteString( OString& rStr, const sal_uInt8* pStr ); - - /// Return the size of a string in the resource - static sal_uInt32 GetStringSize( sal_uInt32 nLen ) - { nLen++; return (nLen + nLen%2); } - static sal_uInt32 GetStringSize( const sal_uInt8* pStr, sal_uInt32& nLen ); - - /// Return a int64 - static sal_uInt64 GetUInt64( void* pDatum ); - /// Return a long - static sal_Int32 GetLong( void * pLong ); - /// Return a short - static sal_Int16 GetShort( void * pShort ); - - /// Return a pointer to the resource - void * GetClass(); - - RSHEADER_TYPE * CreateBlock( const ResId & rId ); - - sal_uInt32 GetRemainSize(); - - const OUString& GetFileName() const; - - sal_Int16 ReadShort(); - sal_Int32 ReadLong(); - OUString ReadString(); - OString ReadByteString(); - - /// Generate auto help ID for current resource stack - OString GetAutoHelpId(); - - static void SetReadStringHook( ResHookProc pProc ); - static ResHookProc GetReadStringHook(); - static void SetDefaultLocale( const LanguageTag& rLocale ); -}; - -inline sal_uInt32 RSHEADER_TYPE::GetId() -{ - return (sal_uInt32)ResMgr::GetLong( &nId ); -} - -inline RESOURCE_TYPE RSHEADER_TYPE::GetRT() -{ - return (RESOURCE_TYPE)ResMgr::GetLong( &nRT ); -} - -inline sal_uInt32 RSHEADER_TYPE::GetGlobOff() -{ - return (sal_uInt32)ResMgr::GetLong( &nGlobOff ); -} - -inline sal_uInt32 RSHEADER_TYPE::GetLocalOff() -{ - return (sal_uInt32)ResMgr::GetLong( &nLocalOff ); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/rtti.hxx b/tools/inc/tools/rtti.hxx deleted file mode 100644 index a3501b75459b..000000000000 --- a/tools/inc/tools/rtti.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _RTTI_HXX -#define _RTTI_HXX - -#include <string.h> -#include <tools/solar.h> - -typedef void* (*TypeId)(); - -#define TYPEINFO() \ - static void* CreateType(); \ - static TypeId StaticType(); \ - static sal_Bool IsOf( TypeId aSameOrSuperType ); \ - virtual TypeId Type() const; \ - virtual sal_Bool IsA( TypeId aSameOrSuperType ) const - -#define TYPEINFO_VISIBILITY(visibility) \ - visibility static void* CreateType(); \ - visibility static TypeId StaticType(); \ - visibility static sal_Bool IsOf( TypeId aSameOrSuperType ); \ - visibility virtual TypeId Type() const; \ - visibility virtual sal_Bool IsA( TypeId aSameOrSuperType ) const - -#define TYPEINIT_FACTORY(sType, Factory ) \ - void* sType::CreateType() { return Factory; } \ - TypeId sType::StaticType() { return &CreateType; } \ - TypeId sType::Type() const { return &CreateType; } \ - sal_Bool sType::IsOf( TypeId aSameOrSuperType ) \ - { \ - if ( aSameOrSuperType == StaticType() ) \ - return sal_True - -#define STATICTYPE(sType) (sType::StaticType()) - -#define SUPERTYPE(sSuper) \ - if ( sSuper::IsOf(aSameOrSuperType ) ) \ - return sal_True - -#define TYPEINIT_END(sType) \ - return sal_False; \ - } \ - sal_Bool sType::IsA( TypeId aSameOrSuperType ) const \ - { return IsOf( aSameOrSuperType ); } - -#define TYPEINIT0_FACTORY(sType, Factory) \ - TYPEINIT_FACTORY(sType, Factory); \ - TYPEINIT_END(sType) -#define TYPEINIT0_AUTOFACTORY(sType) TYPEINIT0_FACTORY(sType, new sType) -#define TYPEINIT0(sType) TYPEINIT0_FACTORY(sType, 0) - -#define TYPEINIT1_FACTORY(sType, sSuper, Factory) \ - TYPEINIT_FACTORY(sType, Factory); \ - SUPERTYPE(sSuper); \ - TYPEINIT_END(sType) -#define TYPEINIT1_AUTOFACTORY(sType, sSuper) \ - TYPEINIT1_FACTORY(sType, sSuper, new sType) -#define TYPEINIT1(sType, sSuper) \ - TYPEINIT1_FACTORY(sType, sSuper, 0) - -#define TYPEINIT2_FACTORY(sType, sSuper1, sSuper2, Factory) \ - TYPEINIT_FACTORY(sType, Factory); \ - SUPERTYPE(sSuper1); \ - SUPERTYPE(sSuper2); \ - TYPEINIT_END(sType) -#define TYPEINIT2_AUTOFACTORY(sType, sSuper1, sSuper2) \ - TYPEINIT2_FACTORY(sType, sSuper1, sSuper2, new sType) -#define TYPEINIT2(sType, sSuper1, sSuper2) \ - TYPEINIT2_FACTORY(sType, sSuper1, sSuper2, 0) - -#define TYPEINIT3_FACTORY(sType, sSuper1, sSuper2, sSuper3, Factory) \ - TYPEINIT_FACTORY(sType, Factory); \ - SUPERTYPE(sSuper1); \ - SUPERTYPE(sSuper2); \ - SUPERTYPE(sSuper3); \ - TYPEINIT_END(sType) -#define TYPEINIT3(sType, sSuper1, sSuper2, sSuper3) \ - TYPEINIT3_FACTORY(sType, sSuper1, sSuper2, sSuper3, 0) - -#define TYPE(sType) (sType::StaticType()) -#define ISA(sType) IsA(sType::StaticType()) -#define ISOF(sType) IsOf(sType::StaticType()) -#define CREATE(TypeId) (TypeId()) - -/** Exemplary application macros for pointers - (can be extended for use with references) - - PTR_CAST: Safe pointer casting to a derived class. - Returns NULL pointer on cast error - - T: Target type to cast into - p: Pointer to be cast into T -*/ -#define PTR_CAST( T, pObj ) \ - ( pObj && (pObj)->IsA( TYPE(T) ) ? (T*)(pObj) : 0 ) - -/** Check whether object pObj has a Base Class T - (or if pObj is an instance of T) */ -#define HAS_BASE( T, pObj ) \ - ( pObj && (pObj)->IsA( TYPE(T) ) ) - -/** Check whether a pointer is targetting and object of type T. */ -#define IS_TYPE(T,pObj) \ - ( pObj && (pObj)->Type() == TYPE(T) ) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/shl.hxx b/tools/inc/tools/shl.hxx deleted file mode 100644 index 945921fa114a..000000000000 --- a/tools/inc/tools/shl.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _SHL_HXX -#define _SHL_HXX - -#include <tools/solar.h> -#include "tools/toolsdllapi.h" - -// GetAppData() - -// 0 (SHL_SHL1) removed -#define SHL_SHL2 1 -// 2 (SHL_SHL3) removed -// 3 (SHL_APP1) removed -// 4 (SHL_APP2) removed -// 5 (SHL_APP3) removed -// 6 (SHL_TOOLS) removed -// 7 (SHL_SV) removed -// 8 (SHL_SVT) removed -#define SHL_SVDDE 9 -#define SHL_ERR 10 -//11 (SHL_IPC) removed -//12 (SHL_SVX) removed -//13 (SHL_ITEM) removed -#define SHL_SVD 14 -//15 (SHL_SI) removed -//16 (SHL_SFC) removed -//17 (SHL_SFX) removed -//18 (SHL_SO2) removed -#define SHL_IDL 19 -//20 (SHL_IDE) removed -//21 (SHL_EDIT) removed -//22 (SHL_VCED) removed -#define SHL_BASIC 23 -//24 (SHL_HELP) removed -//25 (SHL_LNKCCH) removed -//26 (SHL_CHANNEL) removed -//27 (SHL_SBX) removed -//28 (SHL_SBC) removed -//29 (SHL_SDB) removed -//30 (SHL_SBA) removed -//31 (SHL_SBA2) removed -//32 (SHL_SCH) removed -//33 (SHL_SIM) removed -#define SHL_SM 34 -//35 (SHL_SGA) removed -//36 (SHL_DOCMGR) removed -//37 removed -//38 (SHL_MAIL) removed -//39 (SHL_NEWS) removed -//40 (SHL_OFFAPP) removed -//41 (SHL_INET) removed -//43 (SHL_CHAOS) removed -//43 (SHL_HISTORY) removed -//44 (SHL_SJ) removed -#define SHL_CALC 45 -#define SHL_DRAW 46 -#define SHL_WRITER 47 -//48 (SHL_MONEY) removed -//49 (SHL_HBCI) removed -//50 (SHL_BASE3D) removed -//51 (SHL_BRUSHITEM) removed -//52 (SHL_SFONTITEM) removed - -#define SHL_COUNT 53 - -TOOLS_DLLPUBLIC void** GetAppData( sal_uInt16 nSharedLib ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/simplerm.hxx b/tools/inc/tools/simplerm.hxx deleted file mode 100644 index 667454c6150c..000000000000 --- a/tools/inc/tools/simplerm.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -// a simple resource manager : no stacks, no sharing of the impl class, only loading of strings and blobs -// but thread-safety !! :) - -#ifndef _TOOLS_SIMPLERESMGR_HXX_ -#define _TOOLS_SIMPLERESMGR_HXX_ - -#include <osl/mutex.hxx> -#include <tools/resid.hxx> -#include <i18nlangtag/languagetag.hxx> -#include <tools/string.hxx> -#include "tools/toolsdllapi.h" - -class InternalResMgr; - -class TOOLS_DLLPUBLIC SimpleResMgr -{ -protected: - osl::Mutex m_aAccessSafety; - InternalResMgr* m_pResImpl; - -public: - /** creates a new SimpleResManager - @param pPrefixName - denotes the prefix of the resource file name, - in ThreadTextEncoding - @param rLocale - denotes the locale of the resource file to - load. If empty (SYSTEM), a default locale will be used. - */ - SimpleResMgr( const sal_Char* pPrefixName, - const LanguageTag& rLocale); - - virtual ~SimpleResMgr(); - - static SimpleResMgr* Create( const sal_Char* pPrefixName, - LanguageTag aLocale = LanguageTag( LANGUAGE_SYSTEM) );// only in VCL - - bool IsValid() const { return m_pResImpl != NULL; } - - /** reads the string with the given resource id - @param nId - the resource id of the string to read - @return - the string with the given resource id, or an empty string if the id does not denote - an existent string - @seealso IsAvailable - */ - OUString ReadString( sal_uInt32 nId ); - - /** checks whether a certain resource is availble - @param _resourceType - the type of the resource to check. Currently, only RSC_STRING (strings) and RSC_RESOURCE (blobs) - are supported, for every other type, <FALSE/> will be returned. - @param _resourceId - the id of the resource to lookup. - @return - <TRUE/> if and only if a resource of the given type, with the given id, is available. - */ - bool IsAvailable( RESOURCE_TYPE _resourceType, sal_uInt32 _resourceId ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h deleted file mode 100644 index 58d5849c5f42..000000000000 --- a/tools/inc/tools/solar.h +++ /dev/null @@ -1,154 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _SOLAR_H -#define _SOLAR_H - -#include <sal/types.h> -#include <osl/endian.h> -#include <comphelper/fileformat.h> - -/** Intermediate type to solve type clash with Windows headers. - Should be removed as soon as all code parts have been reviewed - and the correct type is known. Most of the times ULONG is meant - to be a 32-Bit unsigned integer type as sal_uInt32 is often - used for data exchange or for similar method args. */ -typedef sal_uIntPtr sal_uLong; /* Replaces type ULONG */ - -// misc. macros to leverage platform and compiler differences - -#define DELETEZ( p ) ( delete p,p = 0 ) - -// solar binary types - -/* Solar (portable) Binary (exchange) Type; OSI 6 subset - always little endian; - not necessarily aligned */ - -typedef sal_uInt8 SVBT8[1]; -typedef sal_uInt8 SVBT16[2]; -typedef sal_uInt8 SVBT32[4]; -typedef sal_uInt8 SVBT64[8]; - -#ifdef __cplusplus - -inline sal_uInt8 SVBT8ToByte ( const SVBT8 p ) { return p[0]; } -inline sal_uInt16 SVBT16ToShort( const SVBT16 p ) { return (sal_uInt16)p[0] - + ((sal_uInt16)p[1] << 8); } -inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0] - + ((sal_uInt32)p[1] << 8) - + ((sal_uInt32)p[2] << 16) - + ((sal_uInt32)p[3] << 24); } -#if defined OSL_LITENDIAN -inline double SVBT64ToDouble( const SVBT64 p ) { double n; - ((sal_uInt8*)&n)[0] = p[0]; - ((sal_uInt8*)&n)[1] = p[1]; - ((sal_uInt8*)&n)[2] = p[2]; - ((sal_uInt8*)&n)[3] = p[3]; - ((sal_uInt8*)&n)[4] = p[4]; - ((sal_uInt8*)&n)[5] = p[5]; - ((sal_uInt8*)&n)[6] = p[6]; - ((sal_uInt8*)&n)[7] = p[7]; - return n; } -#else -inline double SVBT64ToDouble( const SVBT64 p ) { double n; - ((sal_uInt8*)&n)[0] = p[7]; - ((sal_uInt8*)&n)[1] = p[6]; - ((sal_uInt8*)&n)[2] = p[5]; - ((sal_uInt8*)&n)[3] = p[4]; - ((sal_uInt8*)&n)[4] = p[3]; - ((sal_uInt8*)&n)[5] = p[2]; - ((sal_uInt8*)&n)[6] = p[1]; - ((sal_uInt8*)&n)[7] = p[0]; - return n; } -#endif - -inline void ByteToSVBT8 ( sal_uInt8 n, SVBT8 p ) { p[0] = n; } -inline void ShortToSVBT16( sal_uInt16 n, SVBT16 p ) { p[0] = (sal_uInt8) n; - p[1] = (sal_uInt8)(n >> 8); } -inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (sal_uInt8) n; - p[1] = (sal_uInt8)(n >> 8); - p[2] = (sal_uInt8)(n >> 16); - p[3] = (sal_uInt8)(n >> 24); } -#if defined OSL_LITENDIAN -inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[0]; - p[1] = ((sal_uInt8*)&n)[1]; - p[2] = ((sal_uInt8*)&n)[2]; - p[3] = ((sal_uInt8*)&n)[3]; - p[4] = ((sal_uInt8*)&n)[4]; - p[5] = ((sal_uInt8*)&n)[5]; - p[6] = ((sal_uInt8*)&n)[6]; - p[7] = ((sal_uInt8*)&n)[7]; } -#else -inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[7]; - p[1] = ((sal_uInt8*)&n)[6]; - p[2] = ((sal_uInt8*)&n)[5]; - p[3] = ((sal_uInt8*)&n)[4]; - p[4] = ((sal_uInt8*)&n)[3]; - p[5] = ((sal_uInt8*)&n)[2]; - p[6] = ((sal_uInt8*)&n)[1]; - p[7] = ((sal_uInt8*)&n)[0]; } -#endif -#endif - -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C -#endif - -#define _LF ((char)0x0A) -#define _CR ((char)0x0D) - -// pragmas - -#if defined _MSC_VER -/* deletion of pointer to incomplete type '...'; no destructor called - serious error, memory deleted without call of dtor */ -#pragma warning( error: 4150 ) -// warning C4002: too many actual parameters for macro -// warning C4003: not enough actual parameters for macro -#pragma warning(error : 4002 4003) -#endif - -#define UniString String -#define XubString String -#define xub_StrLen sal_uInt16 - -#define STRING_CONCAT3( s1, s2, s3 ) \ - s1 s2 s3 - -// dll file extensions - -#if defined WNT -#define SVLIBRARY( Base ) \ - STRING_CONCAT3( Base, "lo", ".dll" ) -#elif defined MACOSX -#define SVLIBRARY( Base ) \ - STRING_CONCAT3( "lib", Base, "lo.dylib" ) -#elif defined UNX -#define SVLIBRARY( Base ) \ - STRING_CONCAT3( "lib", Base, "lo.so" ) -#else - #error unknown platform -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/solarmutex.hxx b/tools/inc/tools/solarmutex.hxx deleted file mode 100644 index 1d6b13c59655..000000000000 --- a/tools/inc/tools/solarmutex.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_SOLARMUTEX_HXX -#define _TOOLS_SOLARMUTEX_HXX - -#include "tools/toolsdllapi.h" -#include <osl/mutex.hxx> - -namespace tools -{ - class TOOLS_DLLPUBLIC SolarMutex - { - public: - static void SetSolarMutex( ::osl::SolarMutex* pMutex ); - static bool Acquire(); - static void Release(); - }; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx deleted file mode 100644 index 78a0bc3df96f..000000000000 --- a/tools/inc/tools/stream.hxx +++ /dev/null @@ -1,779 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _STREAM_HXX -#define _STREAM_HXX - -#include <limits> -#include "tools/toolsdllapi.h" -#include <tools/solar.h> -#include <tools/string.hxx> -#include <tools/errinf.hxx> -#include <tools/ref.hxx> -#include <tools/rtti.hxx> -#include <rtl/string.hxx> - -class StreamData; - -inline rtl_TextEncoding GetStoreCharSet( rtl_TextEncoding eEncoding ) -{ - if ( eEncoding == RTL_TEXTENCODING_ISO_8859_1 ) - return RTL_TEXTENCODING_MS_1252; - else - return eEncoding; -} - -// StreamTypes - -typedef sal_uInt16 StreamMode; - -// read, write, create,... options -#define STREAM_READ 0x0001 ///< allow read accesses -#define STREAM_WRITE 0x0002 ///< allow write accesses -// file i/o -#define STREAM_NOCREATE 0x0004 ///< 1 == Dont create file -#define STREAM_TRUNC 0x0008 ///< Truncate _existing_ file to zero length -#define STREAM_COPY_ON_SYMLINK 0x0010 ///< copy-on-write for symlinks (UNX) - -#define STREAM_READWRITEBITS (STREAM_READ | STREAM_WRITE | \ - STREAM_NOCREATE | STREAM_TRUNC) - -// sharing options -#define STREAM_SHARE_DENYNONE 0x0100 -#define STREAM_SHARE_DENYREAD 0x0200 // overrides denynone -#define STREAM_SHARE_DENYWRITE 0x0400 // overrides denynone -#define STREAM_SHARE_DENYALL 0x0800 // overrides denyread,write,none - -#define STREAM_SHAREBITS (STREAM_SHARE_DENYNONE | STREAM_SHARE_DENYREAD |\ - STREAM_SHARE_DENYWRITE | STREAM_SHARE_DENYALL) - -#define STREAM_READWRITE (STREAM_READ | STREAM_WRITE) -#define STREAM_SHARE_DENYREADWRITE (STREAM_SHARE_DENYREAD | STREAM_SHARE_DENYWRITE) - -#define STREAM_STD_READ (STREAM_READ | STREAM_SHARE_DENYNONE | STREAM_NOCREATE) -#define STREAM_STD_WRITE (STREAM_WRITE | STREAM_SHARE_DENYALL) -#define STREAM_STD_READWRITE (STREAM_READWRITE | STREAM_SHARE_DENYALL) - -#define STREAM_SEEK_TO_BEGIN 0L -#define STREAM_SEEK_TO_END ULONG_MAX - -#define NUMBERFORMAT_INT_BIGENDIAN (sal_uInt16)0x0000 -#define NUMBERFORMAT_INT_LITTLEENDIAN (sal_uInt16)0xFFFF - -#define COMPRESSMODE_NONE (sal_uInt16)0x0000 -#define COMPRESSMODE_ZBITMAP (sal_uInt16)0x0001 -#define COMPRESSMODE_NATIVE (sal_uInt16)0x0010 - -#define STREAM_IO_DONTKNOW 0 -#define STREAM_IO_READ 1 -#define STREAM_IO_WRITE 2 - -#define ID_STREAM 1 -#define ID_FILESTREAM 2 -#define ID_MEMORYSTREAM 3 -#define ID_SHAREDMEMORYSTREAM 4 -#define ID_STORAGESTREAM 5 -#define ID_PERSISTSTREAM 6 - -class SvStream; - -typedef SvStream& (*SvStrPtr)( SvStream& ); - -inline SvStream& operator<<( SvStream& rStr, SvStrPtr f ); - -// SvLockBytes - -enum LockType {}; - -struct SvLockBytesStat -{ - sal_Size nSize; - - SvLockBytesStat() : nSize(0) {} -}; - -enum SvLockBytesStatFlag { SVSTATFLAG_DEFAULT }; - -class TOOLS_DLLPUBLIC SvLockBytes: public virtual SvRefBase -{ - SvStream * m_pStream; - sal_Bool m_bOwner; - sal_Bool m_bSync; - -protected: - void close(); - -public: - TYPEINFO(); - - SvLockBytes() : m_pStream(0), m_bOwner(sal_False), m_bSync(sal_False) {} - - SvLockBytes(SvStream * pTheStream, sal_Bool bTheOwner = sal_False) : - m_pStream(pTheStream), m_bOwner(bTheOwner), m_bSync(sal_False) {} - - virtual ~SvLockBytes() { close(); } - - virtual const SvStream * GetStream() const { return m_pStream; } - - virtual void SetSynchronMode(sal_Bool bTheSync = sal_True) { m_bSync = bTheSync; } - virtual sal_Bool IsSynchronMode() const { return m_bSync; } - - virtual ErrCode ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, - sal_Size * pRead) const; - virtual ErrCode WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCount, - sal_Size * pWritten); - - virtual ErrCode Flush() const; - - virtual ErrCode SetSize(sal_Size nSize); - - virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const; -}; - -SV_DECL_IMPL_REF(SvLockBytes); - -// SvOpenLockBytes - -class TOOLS_DLLPUBLIC SvOpenLockBytes: public SvLockBytes -{ -public: - TYPEINFO(); - - SvOpenLockBytes() : SvLockBytes(0, sal_False) {} - SvOpenLockBytes(SvStream * pStream, sal_Bool bOwner): - SvLockBytes(pStream, bOwner) {} - - virtual ErrCode FillAppend(const void * pBuffer, sal_Size nCount, - sal_Size * pWritten) = 0; - - virtual sal_Size Tell() const = 0; - - virtual sal_Size Seek(sal_Size nPos) = 0; - - virtual void Terminate() = 0; -}; - -SV_DECL_IMPL_REF(SvOpenLockBytes); - -// SvAsyncLockBytes - -class SvAsyncLockBytes: public SvOpenLockBytes -{ - sal_Size m_nSize; - sal_Bool m_bTerminated; - -public: - TYPEINFO(); - - SvAsyncLockBytes(SvStream * pStream, sal_Bool bOwner): - SvOpenLockBytes(pStream, bOwner), m_nSize(0), m_bTerminated(sal_False) {} - - virtual ErrCode ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, - sal_Size * pRead) const; - virtual ErrCode WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCount, - sal_Size * pWritten); - - virtual ErrCode FillAppend(const void * pBuffer, sal_Size nCount, - sal_Size * pWritten); - - virtual sal_Size Tell() const { return m_nSize; } - - virtual sal_Size Seek(sal_Size nPos); - - virtual void Terminate() { m_bTerminated = sal_True; } -}; - -SV_DECL_IMPL_REF(SvAsyncLockBytes); - -// SvStream - -class TOOLS_DLLPUBLIC SvStream -{ -private: - // LockBytes Interface - void* pImp; // unused - SvLockBytesRef xLockBytes; // Default implementation - sal_Size nActPos; - - // Puffer-Verwaltung - sal_uInt8* pRWBuf; // Points to read/write buffer - sal_uInt8* pBufPos; // pRWBuf + nBufActualPos - sal_uInt16 nBufSize; // Allocated size of buffer - sal_uInt16 nBufActualLen; // Length of used segment of puffer - // = nBufSize, if EOF did not occur - sal_uInt16 nBufActualPos; // current position in buffer (0..nBufSize-1) - sal_uInt16 nBufFree; // number of free slots in buffer to IO of type eIOMode - unsigned int eIOMode : 2;// STREAM_IO_* - - // Error codes, conversion, compression, ... - int bIsDirty : 1; // sal_True: Stream != buffer content - int bIsConsistent : 1;// sal_False: Buffer contains data, which were - // NOT allowed to be written by PutData - // into the derived stream (cf. PutBack) - int bSwap : 1; - int bIsEof : 1; - sal_uInt32 nError; - sal_uInt16 nNumberFormatInt; - sal_uInt16 nCompressMode; - LineEnd eLineDelimiter; - CharSet eStreamCharSet; - - // Encryption - OString m_aCryptMaskKey;// aCryptMaskKey.getLength != 0 -> Encryption used - unsigned char nCryptMask; - - // Userdata - long nVersion; // for external use - - // helper methods - TOOLS_DLLPRIVATE void ImpInit(); - - SvStream ( const SvStream& rStream ); // not implemented - SvStream& operator=( const SvStream& rStream ); // not implemented - -protected: - sal_Size nBufFilePos;///< File position of pBuf[0] - sal_uInt16 eStreamMode; - sal_Bool bIsWritable; - - virtual sal_Size GetData( void* pData, sal_Size nSize ); - virtual sal_Size PutData( const void* pData, sal_Size nSize ); - virtual sal_Size SeekPos( sal_Size nPos ); - virtual void FlushData(); - virtual void SetSize( sal_Size nSize ); - - void ClearError(); - void ClearBuffer(); - - // encrypt and write in blocks - sal_Size CryptAndWriteBuffer( const void* pStart, sal_Size nLen ); - sal_Bool EncryptBuffer( void* pStart, sal_Size nLen ); - - void SyncSvStream( sal_Size nNewStreamPos ); ///< SvStream <- Medium - void SyncSysStream(); ///< SvStream -> Medium - -public: - SvStream(); - SvStream( SvLockBytes *pLockBytes); - virtual ~SvStream(); - - SvLockBytes* GetLockBytes() const { return xLockBytes; } - - sal_uInt32 GetError() const { return ERRCODE_TOERROR(nError); } - sal_uInt32 GetErrorCode() const { return nError; } - - void SetError( sal_uInt32 nErrorCode ); - virtual void ResetError(); - - void SetNumberFormatInt( sal_uInt16 nNewFormat ); - sal_uInt16 GetNumberFormatInt() const { return nNumberFormatInt; } - /// Enable/disable swapping of endians, may be needed for Unicode import/export - inline void SetEndianSwap( sal_Bool bVal ); - /// returns status of endian swap flag - sal_Bool IsEndianSwap() const { return 0 != bSwap; } - - void SetCompressMode( sal_uInt16 nNewMode ) - { nCompressMode = nNewMode; } - sal_uInt16 GetCompressMode() const { return nCompressMode; } - - void SetCryptMaskKey(const OString& rCryptMaskKey); - const OString& GetCryptMaskKey() const { return m_aCryptMaskKey; } - - void SetStreamCharSet( CharSet eCharSet ) - { eStreamCharSet = eCharSet; } - CharSet GetStreamCharSet() const { return eStreamCharSet; } - - void SetLineDelimiter( LineEnd eLineEnd ) - { eLineDelimiter = eLineEnd; } - LineEnd GetLineDelimiter() const { return eLineDelimiter; } - - SvStream& operator>>( sal_uInt16& rUInt16 ); - SvStream& operator>>( sal_uInt32& rUInt32 ); - SvStream& operator>>( sal_uInt64& rUInt64 ); - SvStream& operator>>( sal_Int16& rInt16 ); - SvStream& operator>>( sal_Int32& rInt32 ); - SvStream& operator>>( sal_Int64& rInt64 ); - - SvStream& operator>>( signed char& rChar ); - SvStream& operator>>( char& rChar ); - SvStream& operator>>( unsigned char& rChar ); - SvStream& operator>>( float& rFloat ); - SvStream& operator>>( double& rDouble ); - SvStream& operator>>( SvStream& rStream ); - - SvStream& operator<<( sal_uInt16 nUInt16 ); - SvStream& operator<<( sal_uInt32 nUInt32 ); - SvStream& operator<<( sal_uInt64 nuInt64 ); - SvStream& operator<<( sal_Int16 nInt16 ); - SvStream& operator<<( sal_Int32 nInt32 ); - SvStream& operator<<( sal_Int64 nInt64 ); - - SvStream& operator<<( bool b ) - { return operator<<(static_cast< sal_Bool >(b)); } - SvStream& operator<<( signed char nChar ); - SvStream& operator<<( char nChar ); - SvStream& operator<<( unsigned char nChar ); - SvStream& operator<<( float nFloat ); - SvStream& operator<<( const double& rDouble ); - SvStream& operator<<( const char* pBuf ); - SvStream& operator<<( const unsigned char* pBuf ); - SvStream& operator<<( SvStream& rStream ); - - SvStream& WriteNumber( sal_uInt32 nUInt32 ); - SvStream& WriteNumber( sal_Int32 nInt32 ); - - sal_Size Read( void* pData, sal_Size nSize ); - sal_Size Write( const void* pData, sal_Size nSize ); - sal_Size Seek( sal_Size nPos ); - sal_Size SeekRel( sal_sSize nPos ); - sal_Size Tell() const { return nBufFilePos+nBufActualPos; } - // length between current (Tell()) pos and end of stream - virtual sal_Size remainingSize(); - void Flush(); - sal_Bool IsEof() const { return bIsEof; } - // next Tell() <= nSize - sal_Bool SetStreamSize( sal_Size nSize ); - - /** Read a line of bytes. - - @param nMaxBytesToRead - Maximum of bytes to read, if line is longer it will be - truncated. - - @note NOTE that the default is one character less than STRING_MAXLEN to - prevent problems after conversion to String that may be lurking - in various places doing something like - @code - for (sal_uInt16 i=0; i < aString.Len(); ++i) - @endcode - causing endless loops ... - */ - sal_Bool ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE ); - sal_Bool WriteLine( const OString& rStr ); - - /** Read a line of bytes. - - @param nMaxBytesToRead - Maximum of bytes to read, if line is longer it will be - truncated. - - @note NOTE that the default is one character less than STRING_MAXLEN to - prevent problems after conversion to String that may be lurking - in various places doing something like - @code - for (sal_uInt16 i=0; i < aString.Len(); ++i) - @endcode - causing endless loops ... - */ - sal_Bool ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, - sal_Int32 nMaxBytesToRead = 0xFFFE ); - sal_Bool ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet ); - sal_Bool WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ); - - /// Switch to no endian swapping and write 0xfeff - sal_Bool StartWritingUnicodeText(); - - /** If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit, if 0xfeff do - nothing (UTF-16), if 0xfffe switch endian swapping (UTF-16), if 0xefbb - or 0xbbef read another byte and check for UTF-8. If no UTF-* BOM was - detected put all read bytes back. This means that if 2 bytes were read - it was an UTF-16 BOM, if 3 bytes were read it was an UTF-8 BOM. There - is no UTF-7, UTF-32 or UTF-EBCDIC BOM detection! - - If eReadBomCharSet!=RTL_TEXTENCODING_DONTKNOW: only read a BOM of that - encoding and switch endian swapping if UTF-16 and 0xfffe. */ - sal_Bool StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ); - - /** Read a line of Unicode. - - @param nMaxCodepointsToRead - Maximum of codepoints (UCS-2 or UTF-16 pairs, not bytes) to - read, if line is longer it will be truncated. - - @note NOTE that the default is one character less than STRING_MAXLEN to - prevent problems after conversion to String that may be lurking in - various places doing something like - @code - for (sal_uInt16 i=0; i < aString.Len(); ++i) - @endcode - causing endless loops ... - */ - sal_Bool ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead = 0xFFFE ); - /** Read a 32bit length prefixed sequence of utf-16 if - eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a 16bit length - prefixed sequence of bytes and convert from eSrcCharSet */ - OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet); - /** Write a 32bit length prefixed sequence of utf-16 if - eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise convert to eSrcCharSet - and write a 16bit length prefixed sequence of bytes */ - SvStream& WriteUniOrByteString( const OUString& rStr, rtl_TextEncoding eDestCharSet ); - - /** Read a line of Unicode if eSrcCharSet==RTL_TEXTENCODING_UNICODE, - otherwise read a line of Bytecode and convert from eSrcCharSet - - @param nMaxCodepointsToRead - Maximum of codepoints (2 bytes if Unicode, bytes if not - Unicode) to read, if line is longer it will be truncated. - - @note NOTE that the default is one character less than STRING_MAXLEN to - prevent problems after conversion to String that may be lurking in - various places doing something like - @code - for (sal_uInt16 i=0; i < aString.Len(); ++i) - @endcode - causing endless loops ... - */ - sal_Bool ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, - sal_Int32 nMaxCodepointsToRead = 0xFFFE ); - /** Write a sequence of Unicode characters if - eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of - Bytecodes converted to eDestCharSet */ - sal_Bool WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteUnicodeOrByteText( const String& rStr ) - { return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); } - - /** Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, - otherwise write as Bytecode converted to eDestCharSet. - - This may result in more than one byte being written if a multi byte - encoding (e.g. UTF7, UTF8) is chosen. */ - sal_Bool WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteUniOrByteChar( sal_Unicode ch ) - { return WriteUniOrByteChar( ch, GetStreamCharSet() ); } - - void SetBufferSize( sal_uInt16 nBufSize ); - sal_uInt16 GetBufferSize() const { return nBufSize; } - - void RefreshBuffer(); - SvStream& PutBack( char aCh ); - - sal_Bool IsWritable() const { return bIsWritable; } - StreamMode GetStreamMode() const { return eStreamMode; } - virtual sal_uInt16 IsA() const; - - long GetVersion() { return nVersion; } - void SetVersion( long n ) { nVersion = n; } - - friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // for Manips - - /// end of input seen during previous i/o operation - bool eof() const { return bIsEof; } - - /// stream is broken - bool bad() const { return GetError() != 0; } - - /** Get state - - If the state is good() the previous i/o operation succeeded. - - If the state is good(), the next input operation might succeed; - otherwise, it will fail. - - Applying an input operation to a stream that is not in the good() state - is a null operation as far as the variable being read into is concerned. - - If we try to read into a variable v and the operation fails, the value - of v should be unchanged, - */ - bool good() const { return !(eof() || bad()); } -}; - -inline SvStream& operator<<( SvStream& rStr, SvStrPtr f ) -{ - (*f)(rStr); - return rStr; -} - -inline void SvStream::SetEndianSwap( sal_Bool bVal ) -{ -#ifdef OSL_BIGENDIAN - SetNumberFormatInt( bVal ? NUMBERFORMAT_INT_LITTLEENDIAN : NUMBERFORMAT_INT_BIGENDIAN ); -#else - SetNumberFormatInt( bVal ? NUMBERFORMAT_INT_BIGENDIAN : NUMBERFORMAT_INT_LITTLEENDIAN ); -#endif -} - -TOOLS_DLLPUBLIC SvStream& endl( SvStream& rStr ); -/// same as endl() but Unicode -TOOLS_DLLPUBLIC SvStream& endlu( SvStream& rStr ); -/// call endlu() if eStreamCharSet==RTL_TEXTECODING_UNICODE otherwise endl() -TOOLS_DLLPUBLIC SvStream& endlub( SvStream& rStr ); - -/// Attempt to read nUnits 8bit units to an OString, returned OString's -/// length is number of units successfully read -TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream& rStrm, - sal_Size nUnits); - -/// Attempt to read nUnits 8bit units to an OUString -TOOLS_DLLPUBLIC inline OUString read_uInt8s_ToOUString(SvStream& rStrm, - sal_Size nUnits, rtl_TextEncoding eEnc) -{ - return OStringToOUString(read_uInt8s_ToOString(rStrm, nUnits), eEnc); -} - -/// Attempt to read nUnits 16bit units to an OUString, returned -/// OUString's length is number of units successfully read -TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream& rStrm, - sal_Size nUnits); - -/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of -/// 16bit units to an OUString, returned OString's length is number of -/// units successfully read. -template<typename prefix> -OUString read_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm) -{ - prefix nUnits = 0; - rStrm >> nUnits; - return read_uInt16s_ToOUString(rStrm, nUnits); -} - -/// Attempt to write a prefixed sequence of nUnits 16bit units from an OUString, -/// returned value is number of bytes written -TOOLS_DLLPUBLIC sal_Size write_uInt16s_FromOUString(SvStream& rStrm, - const OUString& rStr, sal_Size nUnits); - -TOOLS_DLLPUBLIC inline sal_Size write_uInt16s_FromOUString(SvStream& rStrm, - const OUString& rStr) -{ - return write_uInt16s_FromOUString(rStrm, rStr, rStr.getLength()); -} - -namespace streamdetail -{ - /// Attempt to write a pascal-style length (of type prefix) prefixed - /// sequence of units from a string-type, returned value is number of bytes - /// written (including byte-count of prefix) - template<typename prefix, typename S, sal_Size (*writeOper)(SvStream&, const S&, sal_Size)> - sal_Size write_lenPrefixed_seq_From_str(SvStream& rStrm, const S &rStr) - { - sal_Size nWritten = 0; - prefix nUnits = std::min<sal_Size>(rStr.getLength(), std::numeric_limits<prefix>::max()); - SAL_WARN_IF(static_cast<sal_Size>(nUnits) != static_cast<sal_Size>(rStr.getLength()), - "tools.stream", - "string too long for prefix count to fit in output type"); - rStrm << nUnits; - if (rStrm.good()) - { - nWritten += sizeof(prefix); - nWritten += writeOper(rStrm, rStr, nUnits); - } - return nWritten; - } -} - -/// Attempt to write a pascal-style length (of type prefix) prefixed sequence -/// of 16bit units from an OUString, returned value is number of bytes written -/// (including byte-count of prefix) -template<typename prefix> sal_Size write_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm, - const OUString &rStr) -{ - return streamdetail::write_lenPrefixed_seq_From_str<prefix, OUString, write_uInt16s_FromOUString>(rStrm, rStr); -} - -/// Attempt to read 8bit units to an OString until a zero terminator is -/// encountered, returned OString's length is number of units *definitely* -/// successfully read, check SvStream::good() to see if null terminator was -/// successfully read -TOOLS_DLLPUBLIC OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm); - -/// Attempt to read 8bit units assuming source encoding eEnc to an OUString -/// until a zero terminator is encountered. Check SvStream::good() to see if -/// null terminator was successfully read -TOOLS_DLLPUBLIC OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc); - -/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of -/// 8bit units to an OString, returned OString's length is number of units -/// successfully read. -template<typename prefix> -OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) -{ - prefix nUnits = 0; - rStrm >> nUnits; - return read_uInt8s_ToOString(rStrm, nUnits); -} - -/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of -/// 8bit units to an OUString -template<typename prefix> -OUString read_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, - rtl_TextEncoding eEnc) -{ - return OStringToOUString(read_lenPrefixed_uInt8s_ToOString<prefix>(rStrm), eEnc); -} - -/// Attempt to write a prefixed sequence of nUnits 8bit units from an OString, -/// returned value is number of bytes written -TOOLS_DLLPUBLIC inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr, - sal_Size nUnits) -{ - return rStrm.Write(rStr.getStr(), nUnits); -} - -TOOLS_DLLPUBLIC inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr) -{ - return write_uInt8s_FromOString(rStrm, rStr, rStr.getLength()); -} - -/// Attempt to write a pascal-style length (of type prefix) prefixed sequence -/// of 8bit units from an OString, returned value is number of bytes written -/// (including byte-count of prefix) -template<typename prefix> sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm, - const OString &rStr) -{ - return streamdetail::write_lenPrefixed_seq_From_str<prefix, OString, write_uInt8s_FromOString>(rStrm, rStr); -} - -/// Attempt to write a pascal-style length (of type prefix) prefixed sequence -/// of 8bit units from an OUString, returned value is number of bytes written -/// (including byte-count of prefix) -template<typename prefix> sal_Size write_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm, - const OUString &rStr, rtl_TextEncoding eEnc) -{ - return write_lenPrefixed_uInt8s_FromOString<prefix>(rStrm, OUStringToOString(rStr, eEnc)); -} - -// FileStream - -class TOOLS_DLLPUBLIC SvFileStream : public SvStream -{ -private: - StreamData* pInstanceData; - String aFilename; - sal_uInt16 nLockCounter; - sal_Bool bIsOpen; -#ifdef UNX - sal_uInt32 GetFileHandle() const; -#endif - // Forbidden and not implemented. - SvFileStream (const SvFileStream&); - SvFileStream & operator= (const SvFileStream&); - - sal_Bool LockRange( sal_Size nByteOffset, sal_Size nBytes ); - sal_Bool UnlockRange( sal_Size nByteOffset, sal_Size nBytes ); - sal_Bool LockFile(); - sal_Bool UnlockFile(); - -protected: - virtual sal_Size GetData( void* pData, sal_Size nSize ); - virtual sal_Size PutData( const void* pData, sal_Size nSize ); - virtual sal_Size SeekPos( sal_Size nPos ); - virtual void SetSize( sal_Size nSize ); - virtual void FlushData(); - -public: - // Switches to Read StreamMode on failed attempt of Write opening - SvFileStream( const String& rFileName, StreamMode eOpenMode ); - SvFileStream(); - ~SvFileStream(); - - virtual void ResetError(); - - void Open( const String& rFileName, StreamMode eOpenMode ); - void Close(); - sal_Bool IsOpen() const { return bIsOpen; } - sal_Bool IsLocked() const { return ( nLockCounter!=0 ); } - virtual sal_uInt16 IsA() const; - - const String& GetFileName() const { return aFilename; } -}; - -// MemoryStream - -class TOOLS_DLLPUBLIC SvMemoryStream : public SvStream -{ - // Forbidden and not implemented. - SvMemoryStream (const SvMemoryStream&); - SvMemoryStream & operator= (const SvMemoryStream&); - - friend class SvCacheStream; - sal_Size GetSize() const { return nSize; } - -protected: - sal_Size nSize; - sal_Size nResize; - sal_Size nPos; - sal_Size nEndOfData; - sal_uInt8* pBuf; - sal_Bool bOwnsData; - - virtual sal_Size GetData( void* pData, sal_Size nSize ); - virtual sal_Size PutData( const void* pData, sal_Size nSize ); - virtual sal_Size SeekPos( sal_Size nPos ); - virtual void SetSize( sal_Size nSize ); - virtual void FlushData(); - - /// AllocateMemory must update pBuf accordingly - /// - pBuf: Address of new block - virtual sal_Bool AllocateMemory( sal_Size nSize ); - - /// ReAllocateMemory must update the following variables: - /// - pBuf: Address of new block - /// - nEndOfData: Set to nNewSize-1L , if outside of block - /// Set to 0 , if new block size is 0 bytes - /// - nSize: New block size - /// - nPos: Set to 0 if position outside of block - virtual sal_Bool ReAllocateMemory( long nDiff ); - - /// Is called when this stream allocated the buffer or the buffer is - /// resized. FreeMemory may need to NULLify handles in derived classes. - virtual void FreeMemory(); - - SvMemoryStream(void*) { } // for sub-classes - -public: - SvMemoryStream( void* pBuf, sal_Size nSize, StreamMode eMode); - SvMemoryStream( sal_Size nInitSize=512, sal_Size nResize=64 ); - ~SvMemoryStream(); - - virtual void ResetError(); - - sal_Size GetEndOfData() const { return nEndOfData; } - const void* GetData() { Flush(); return pBuf; } - operator const void*() { Flush(); return pBuf; } - virtual sal_uInt16 IsA() const; - - void* SwitchBuffer( sal_Size nInitSize=512, sal_Size nResize=64 ); - void* SetBuffer( void* pBuf, sal_Size nSize, - sal_Bool bOwnsData=sal_True, sal_Size nEOF=0 ); - - void ObjectOwnsMemory( sal_Bool bOwn ) { bOwnsData = bOwn; } - sal_Bool IsObjectMemoryOwner() { return bOwnsData; } - void SetResizeOffset( sal_Size nNewResize ) { nResize = nNewResize; } - sal_Size GetResizeOffset() const { return nResize; } - virtual sal_Size remainingSize() { return GetSize() - Tell(); } -}; - -/** Data Copy Stream - - This class is the foundation for all classes, using SvData - (SO2\DTRANS.HXX/CXX) for transportation (e.g., graphics). -*/ -class TOOLS_DLLPUBLIC SvDataCopyStream -{ -public: - // repeated execution of Load or Assign is allowed - TYPEINFO(); - virtual ~SvDataCopyStream(){} - virtual void Load( SvStream & ) = 0; - virtual void Save( SvStream & ) = 0; - virtual void Assign( const SvDataCopyStream & ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx deleted file mode 100644 index 5efcd3e3d933..000000000000 --- a/tools/inc/tools/string.hxx +++ /dev/null @@ -1,411 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _STRING_HXX -#define _STRING_HXX - -#include <tools/solar.h> -#include <osl/thread.h> -#include <rtl/textenc.h> -#include <rtl/textcvt.h> -#include <rtl/ustrbuf.h> -#include <rtl/string.hxx> -#include <rtl/ustring.hxx> -#include "tools/toolsdllapi.h" -#include "tools/lineend.hxx" - -/******************************************************************************* - * - * THIS CODE IS DEPRECATED. DO NOT USE IT IN ANY NEW CODE. - * - * Use the string classes in rtl/ustring.hxx and rtl/ustrbuf.hxx (and - * rtl/string.hxx and rtl/strbuf.hxx for byte-sized strings) instead. If you - * feel functionality missing from those string classes, please request - * improvements on discuss@openoffice.org. - * - * There will not be any fixes to the code here. - ******************************************************************************/ - -class ResId; -class String; -class UniString; - -#define BYTESTRING_TO_UNISTRING_CVTFLAGS (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |\ - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |\ - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT) - -// CharSet - -#ifndef ENUM_CHARSET_DECLARED -#define ENUM_CHARSET_DECLARED - -typedef rtl_TextEncoding CharSet; - -#endif - -// String-Types - -#ifdef STRING32 -#define STRING_NOTFOUND ((xub_StrLen)0x7FFFFFFF) -#define STRING_MATCH ((xub_StrLen)0x7FFFFFFF) -#define STRING_LEN ((xub_StrLen)0x7FFFFFFF) -#define STRING_MAXLEN ((xub_StrLen)0x7FFFFFFF) -#else -#define STRING_NOTFOUND ((xub_StrLen)0xFFFF) -#define STRING_MATCH ((xub_StrLen)0xFFFF) -#define STRING_LEN ((xub_StrLen)0xFFFF) -#define STRING_MAXLEN ((xub_StrLen)0xFFFF) -#endif - -enum StringCompare { COMPARE_LESS = -1, COMPARE_EQUAL = 0, COMPARE_GREATER = 1 }; - -//Internal String data - -// Data used for the management of this String -// use only for debugging purposes (never assign to String directly!) - -#ifdef SAL_W32 -#pragma pack(push, 4) -#endif - -typedef struct _UniStringData -{ - sal_Int32 mnRefCount; // reference counter - sal_Int32 mnLen; // Length of the String - sal_Unicode maStr[1]; // CharArray (String) -} UniStringData; - -#ifdef SAL_W32 -#pragma pack(pop) -#endif - -// UniString - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED UniString -{ -private: - UniStringData* mpData; - - TOOLS_DLLPRIVATE inline void ImplCopyData(); - TOOLS_DLLPRIVATE inline sal_Unicode * ImplCopyStringData(sal_Unicode *); - - UniString( const int* pDummy ); // not implemented: to prevent UniString( NULL ) - UniString(int); // not implemented; to detect misuses of - // UniString(sal_Unicode) - void Assign(int); // not implemented; to detect misuses of - // Assign(sal_Unicode) - void operator =(int); // not implemented; to detect misuses - // of operator =(sal_Unicode) - void Append(int); // not implemented; to detect misuses of - // Append(sal_Unicode) - void operator +=(int); // not implemented; to detect misuses - // of operator +=(sal_Unicode) - - //detect and reject use of RTL_CONSTASCII_STRINGPARAM instead of RTL_CONSTASCII_USTRINGPARAM - TOOLS_DLLPRIVATE UniString( const sal_Char*, sal_Int32 ); - - //detect and reject wrong way to attempt to create a UniString from a substring of - //a OString - TOOLS_DLLPRIVATE UniString(const OString& rByteStr, xub_StrLen nPos, xub_StrLen nLen, - sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS); - - //no longer implemented - TOOLS_DLLPRIVATE UniString( const OString& rByteStr, - rtl_TextEncoding eTextEncoding, - sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS ); - TOOLS_DLLPRIVATE UniString( const sal_Unicode* pCharStr ); - TOOLS_DLLPRIVATE UniString( const sal_Unicode* pCharStr, xub_StrLen nLen ); - TOOLS_DLLPRIVATE UniString( sal_Unicode c ); - TOOLS_DLLPRIVATE UniString& Assign( const sal_Unicode* pCharStr, xub_StrLen nLen ); - TOOLS_DLLPRIVATE UniString& Expand( xub_StrLen nCount, sal_Unicode cExpandChar ); -public: - UniString(); - UniString( const ResId& rResId ); - UniString( const UniString& rStr ); - UniString( const UniString& rStr, xub_StrLen nPos, xub_StrLen nLen ); - UniString( const OUString& rStr ); - UniString(char c); // ...but allow "UniString('a')" - UniString( const sal_Char* pByteStr, - rtl_TextEncoding eTextEncoding, - sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS ); - UniString( const sal_Char* pByteStr, xub_StrLen nLen, - rtl_TextEncoding eTextEncoding, - sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS ); - ~UniString(); - - operator OUString () const - { - return OUString( rtl_uStringBuffer_refReturn( - reinterpret_cast<rtl_uString*>(mpData)), SAL_NO_ACQUIRE ); - } - -#ifdef RTL_FAST_STRING - template< typename T1, typename T2 > - UniString( const rtl::OUStringConcat< T1, T2 >& concat ) - : mpData(NULL) { Assign( OUString( concat )); } - template< typename T1, typename T2 > - UniString& operator =( const rtl::OUStringConcat< T1, T2 >& concat ) - { return Assign( OUString( concat )); } - template< typename T1, typename T2 > - UniString& operator +=( const rtl::OUStringConcat< T1, T2 >& concat ) - { return Append( UniString( concat ) ); } -#endif - - static const UniString& EmptyString(); - sal_Int32 ToInt32() const; - sal_Int64 ToInt64() const; - - UniString& Assign( const UniString& rStr ); - UniString& Assign( const OUString& rStr ); - UniString& Assign( const sal_Unicode* pCharStr ); - UniString& Assign( sal_Unicode c ); - inline UniString & Assign(char c) // ...but allow "Assign('a')" - { return Assign(static_cast< sal_Unicode >(c)); } - UniString& AssignAscii( const sal_Char* pAsciiStr ); - UniString& AssignAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ); - UniString& operator =( const UniString& rStr ) - { return Assign( rStr ); } - UniString& operator =( const OUString& rStr ) - { return Assign( rStr ); } - UniString& operator =( const sal_Unicode* pCharStr ) - { return Assign( pCharStr ); } - UniString& operator =( sal_Unicode c ) - { return Assign( c ); } - inline UniString & operator =(char c) // ...but allow "= 'a'" - { return operator =(static_cast< sal_Unicode >(c)); } - - UniString& Append( const UniString& rStr ); - UniString& Append( const sal_Unicode* pCharStr ); - UniString& Append( const sal_Unicode* pCharStr, xub_StrLen nLen ); - UniString& Append( sal_Unicode c ); - inline UniString & Append(char c) // ...but allow "Append('a')" - { return Append(static_cast< sal_Unicode >(c)); } - UniString& AppendAscii( const sal_Char* pAsciiStr ); - UniString& AppendAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ); - UniString& operator +=( const UniString& rStr ) - { return Append( rStr ); } - UniString& operator +=( const OUString& rStr ) - { return Append( UniString(rStr) ); } - UniString& operator +=( const sal_Unicode* pCharStr ) - { return Append( pCharStr ); } - UniString& operator +=( sal_Unicode c ) - { return Append( c ); } - inline UniString & operator +=(char c) // ...but allow "+= 'a'" - { return operator +=(static_cast< sal_Unicode >(c)); } - - void SetChar( xub_StrLen nIndex, sal_Unicode c ); - sal_Unicode GetChar( xub_StrLen nIndex ) const - { return mpData->maStr[nIndex]; } - - xub_StrLen Len() const { return (xub_StrLen)mpData->mnLen; } - - UniString& Insert( const UniString& rStr, xub_StrLen nIndex = STRING_LEN ); - UniString& Insert( const UniString& rStr, xub_StrLen nPos, xub_StrLen nLen, - xub_StrLen nIndex = STRING_LEN ); - UniString& Insert( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ); - UniString& InsertAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = STRING_LEN ); - UniString& Replace( xub_StrLen nIndex, xub_StrLen nLen, const UniString& rStr ); - UniString& ReplaceAscii( xub_StrLen nIndex, xub_StrLen nLen, - const sal_Char* pAsciiStr, xub_StrLen nStrLen = STRING_LEN ); - UniString& Erase( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ); - UniString Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const; - - UniString& ToLowerAscii(); - UniString& ToUpperAscii(); - - StringCompare CompareTo( const UniString& rStr, - xub_StrLen nLen = STRING_LEN ) const; - StringCompare CompareToAscii( const sal_Char* pAsciiStr, - xub_StrLen nLen = STRING_LEN ) const; - StringCompare CompareIgnoreCaseToAscii( const UniString& rStr, - xub_StrLen nLen = STRING_LEN ) const; - StringCompare CompareIgnoreCaseToAscii( const sal_Char* pAsciiStr, - xub_StrLen nLen = STRING_LEN ) const; - sal_Bool Equals( const UniString& rStr ) const; - sal_Bool EqualsAscii( const sal_Char* pAsciiStr ) const; - sal_Bool EqualsIgnoreCaseAscii( const UniString& rStr ) const; - sal_Bool EqualsIgnoreCaseAscii( const sal_Unicode* pCharStr ) const; - sal_Bool EqualsIgnoreCaseAscii( const sal_Char* pAsciiStr ) const; - sal_Bool Equals( const UniString& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool Equals( const sal_Unicode* pCharStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsAscii( const sal_Char* pAsciiStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsIgnoreCaseAscii( const UniString& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsIgnoreCaseAscii( const sal_Char* pAsciiStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - - xub_StrLen Match( const UniString& rStr ) const; - - xub_StrLen Search( sal_Unicode c, xub_StrLen nIndex = 0 ) const; - xub_StrLen Search( const UniString& rStr, xub_StrLen nIndex = 0 ) const; - xub_StrLen Search( const sal_Unicode* pCharStr, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchBackward( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ) const; - xub_StrLen SearchChar( const sal_Unicode* pChars, xub_StrLen nIndex = 0 ) const; - - xub_StrLen SearchAndReplace( sal_Unicode c, sal_Unicode cRep, - xub_StrLen nIndex = 0 ); - xub_StrLen SearchAndReplace( const UniString& rStr, const UniString& rRepStr, - xub_StrLen nIndex = 0 ); - xub_StrLen SearchAndReplaceAscii( const sal_Char* pAsciiStr, const UniString& rRepStr, - xub_StrLen nIndex = 0 ); - void SearchAndReplaceAll( sal_Unicode c, sal_Unicode cRep ); - void SearchAndReplaceAll( const UniString& rStr, const UniString& rRepStr ); - void SearchAndReplaceAllAscii( const sal_Char* pAsciiStr, const UniString& rRepStr ); - - void SetToken( xub_StrLen nToken, sal_Unicode cTok, const UniString& rStr, - xub_StrLen nIndex = 0 ); - UniString GetToken( xub_StrLen nToken, sal_Unicode cTok, sal_Int32& rIndex ) const; - UniString GetToken( xub_StrLen nToken, sal_Unicode cTok = ';' ) const; - - const sal_Unicode* GetBuffer() const { return mpData->maStr; } - sal_Unicode* GetBufferAccess(); - void ReleaseBufferAccess( xub_StrLen nLen = STRING_LEN ); - sal_Unicode* AllocBuffer( xub_StrLen nLen ); - - friend sal_Bool operator == ( const UniString& rStr1, const UniString& rStr2 ) - { return rStr1.Equals( rStr2 ); } - friend sal_Bool operator != ( const UniString& rStr1, const UniString& rStr2 ) - { return !(operator == ( rStr1, rStr2 )); } - friend sal_Bool operator < ( const UniString& rStr1, const UniString& rStr2 ) - { return (rStr1.CompareTo( rStr2 ) == COMPARE_LESS); } - friend sal_Bool operator > ( const UniString& rStr1, const UniString& rStr2 ) - { return (rStr1.CompareTo( rStr2 ) == COMPARE_GREATER); } - friend sal_Bool operator <= ( const UniString& rStr1, const UniString& rStr2 ) - { return !(operator > ( rStr1, rStr2 )); } - friend sal_Bool operator >= ( const UniString& rStr1, const UniString& rStr2 ) - { return !(operator < ( rStr1, rStr2 )); } -}; - -inline UniString UniString::Copy( xub_StrLen nIndex, xub_StrLen nCount ) const -{ - return UniString( *this, nIndex, nCount ); -} - -inline UniString UniString::GetToken( xub_StrLen nToken, sal_Unicode cTok ) const -{ - sal_Int32 nTempPos = 0; - return GetToken( nToken, cTok, nTempPos ); -} - -template< typename charT, typename traits > std::basic_ostream<charT, traits> & -operator <<( - std::basic_ostream<charT, traits> & stream, UniString const & string) -{ - return stream << - OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr(); - // best effort; potentially loses data due to conversion failures - // (stray surrogate halves) and embedded null characters -} - -#ifdef RTL_FAST_STRING -namespace rtl -{ -template<> -struct ToStringHelper< UniString > - { - static int length( const UniString& s ) { return s.Len(); } - static sal_Unicode* addData( sal_Unicode* buffer, const UniString& s ) { return addDataHelper( buffer, s.GetBuffer(), s.Len()); } - static const bool allowOStringConcat = false; - static const bool allowOUStringConcat = true; - }; -} - -#endif - -// some compare operators, so that conversions from String to OUString don't -// have to insert conversions all over the place -inline bool operator==(UniString const& rLeft, OUString const& rRight) -{ - return OUString(rLeft) == rRight; -} - -inline bool operator==(OUString const& rLeft, UniString const& rRight) -{ - return rLeft == OUString(rRight); -} - -inline bool operator!=(UniString const& rLeft, OUString const& rRight) -{ - return OUString(rLeft) != rRight; -} - -inline bool operator!=(OUString const& rLeft, UniString const& rRight) -{ - return rLeft != OUString(rRight); -} - -#ifdef RTL_FAST_STRING -// The above operators make comparisons involving fast string concatenation ambiguous, so provide explicit overloads. -template< typename T1, typename T2 > -inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str ) -{ - return OUString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str ) -{ - return OUString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator==( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str == OUString( concat ); -} - -template< typename T1, typename T2 > -inline bool operator!=( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str != OUString( concat ); -} - -template< typename T1, typename T2 > -inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str ) -{ - return UniString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str ) -{ - return UniString( concat ) == str; -} - -template< typename T1, typename T2 > -inline bool operator==( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str == UniString( concat ); -} - -template< typename T1, typename T2 > -inline bool operator!=( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat ) -{ - return str != UniString( concat ); -} - -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/svborder.hxx b/tools/inc/tools/svborder.hxx deleted file mode 100644 index de4a8666cbd8..000000000000 --- a/tools/inc/tools/svborder.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _SVBORDER_HXX -#define _SVBORDER_HXX - -#include "tools/toolsdllapi.h" -#include <tools/gen.hxx> - -class TOOLS_DLLPUBLIC SvBorder -{ - long nTop, nRight, nBottom, nLeft; - -public: - SvBorder() - { - nTop = nRight = nBottom = nLeft = 0; - } - SvBorder( const Size & rSz ) - { - nTop = nBottom = rSz.Height(); - nRight = nLeft = rSz.Width(); - } - SvBorder( long nLeftP, long nTopP, long nRightP, long nBottomP ) - { - nLeft = nLeftP; - nTop = nTopP; - nRight = nRightP; - nBottom = nBottomP; - } - sal_Bool operator == ( const SvBorder & rObj ) const - { - return nTop == rObj.nTop && nRight == rObj.nRight && - nBottom == rObj.nBottom && nLeft == rObj.nLeft; - } - sal_Bool operator != ( const SvBorder & rObj ) const - { return !(*this == rObj); } - SvBorder & operator = ( const SvBorder & rBorder ) - { - Left() = rBorder.Left(); - Top() = rBorder.Top(); - Right() = rBorder.Right(); - Bottom() = rBorder.Bottom(); - return *this; - } - SvBorder & operator += ( const SvBorder & rBorder ) - { - Left() += rBorder.Left(); - Top() += rBorder.Top(); - Right() += rBorder.Right(); - Bottom() += rBorder.Bottom(); - return *this; - } - SvBorder & operator -= ( const SvBorder & rBorder ) - { - Left() -= rBorder.Left(); - Top() -= rBorder.Top(); - Right() -= rBorder.Right(); - Bottom() -= rBorder.Bottom(); - return *this; - } - sal_Bool IsInside( const SvBorder & rInside ) - { - return nTop >= rInside.nTop && nRight >= rInside.nRight && - nBottom >= rInside.nBottom && nLeft >= rInside.nLeft; - } - long & Top() { return nTop; } - long & Right() { return nRight; } - long & Bottom() { return nBottom; } - long & Left() { return nLeft; } - long Top() const { return nTop; } - long Right() const { return nRight; } - long Bottom() const { return nBottom; } - long Left() const { return nLeft; } -}; - -TOOLS_DLLPUBLIC Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder ); -TOOLS_DLLPUBLIC Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/tempfile.hxx b/tools/inc/tools/tempfile.hxx deleted file mode 100644 index 8ef8c574cf7c..000000000000 --- a/tools/inc/tools/tempfile.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_TEMPFILE_HXX -#define _TOOLS_TEMPFILE_HXX - -#include <tools/string.hxx> -#include "tools/toolsdllapi.h" - -struct TempFile_Impl; -class TOOLS_DLLPUBLIC TempFile -{ - TempFile_Impl* pImp; - sal_Bool bKillingFileEnabled; - -public: - /** Create a temporary file in the default tempfile folder. */ - TempFile(); - - /** Create a temporary file in the default tempfile folder; its name starts - with some given characters followed by a counter ( example: - rLeadingChars="abc" means "abc0", "abc1" and so on, depending on - existing files in that folder ). - - The extension string may be f.e. ".txt" or "", if no extension string is - given, ".tmp" is used. - */ - TempFile( const String& rLeadingChars, const String* pExtension=NULL ); - - /** TempFile will be removed from disk in dtor if EnableKillingTempFile was - called before. TempDirs will be removed recursively in that case. */ - ~TempFile(); - - sal_Bool IsValid() const; - - /** Returns the real name of the tempfile in file URL scheme. */ - String GetName() const; - - /** If enabled the file will be removed from disk when the dtor is called - (default is not enabled) */ - void EnableKillingFile( sal_Bool bEnable=sal_True ) { bKillingFileEnabled = bEnable; } - - sal_Bool IsKillingFileEnabled() const { return bKillingFileEnabled; } - - /** Only create a name for a temporary file that would be valid at that moment. */ - static String CreateTempName(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/tenccvt.hxx b/tools/inc/tools/tenccvt.hxx deleted file mode 100644 index 9cae3a79927f..000000000000 --- a/tools/inc/tools/tenccvt.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_TENCCVT_HXX -#define _TOOLS_TENCCVT_HXX - -#include <rtl/textenc.h> -#include "tools/toolsdllapi.h" - -// Functions for handling Import/Export - -/// return an encoding which has more defined Characters as the given -/// encoding, but have the same definition for the defined characters -/// e.g.: windows-1252 for iso-8859-1 or windows-1254 for iso-8859-9 -TOOLS_DLLPUBLIC rtl_TextEncoding GetExtendedCompatibilityTextEncoding( rtl_TextEncoding eEncoding ); - -/// return an encoding which has more defined Characters as the given -/// encoding. The encodings could be different. -/// e.g.: windows-1251 for iso-8859-5 -TOOLS_DLLPUBLIC rtl_TextEncoding GetExtendedTextEncoding( rtl_TextEncoding eEncoding ); - -/// if the given encoding is an multi-byte encoding (which allows more than -/// one byte per char, e.g. UTF-8 or Shift-JIS), a one-byte encoding -/// is returned (normally windows-1252). -TOOLS_DLLPUBLIC rtl_TextEncoding GetOneByteTextEncoding( rtl_TextEncoding eEncoding ); - -TOOLS_DLLPUBLIC rtl_TextEncoding GetSOLoadTextEncoding( rtl_TextEncoding eEncoding ); -TOOLS_DLLPUBLIC rtl_TextEncoding GetSOStoreTextEncoding( rtl_TextEncoding eEncoding ); - -/** - * Given a Unicode character, return a legacy Microsoft Encoding which - * supports it. Returns RTL_TEXTENCODING_DONTKNOW if there is - * no encoding which could support the character - * - * Useful as a utility to categorize unicode characters into the best fit - * windows charset range for exporting to ww6 & wmf or as a hint to non \u - * unicode token aware rtf readers - */ -TOOLS_DLLPUBLIC rtl_TextEncoding getBestMSEncodingByChar(sal_Unicode c); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/time.hxx b/tools/inc/tools/time.hxx deleted file mode 100644 index 64751af42284..000000000000 --- a/tools/inc/tools/time.hxx +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_TIME_HXX -#define _TOOLS_TIME_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -class ResId; - -/** - @WARNING: This class can serve both as wall clock time and time duration, and - the mixing of these concepts leads to problems such as there being - 25 hours or 10 minus 20 seconds being (non-negative) 10 seconds. -*/ - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Time -{ -private: - sal_Int64 nTime; - -public: - enum TimeInitSystem - { - SYSTEM - }; - - // temporary until all uses are inspected and resolved - enum TimeInitEmpty - { - EMPTY - }; - static const sal_Int64 hourPerDay = 24; - static const sal_Int64 minutePerHour = 60; - static const sal_Int64 secondPerMinute = 60; - static const sal_Int64 nanoSecPerSec = 1000000000; - static const sal_Int64 nanoSecPerMinute = nanoSecPerSec * secondPerMinute; - static const sal_Int64 nanoSecPerHour = nanoSecPerSec * secondPerMinute * minutePerHour; - static const sal_Int64 nanoSecPerDay = nanoSecPerSec * secondPerMinute * minutePerHour * hourPerDay; - static const sal_Int64 secondPerHour = secondPerMinute * minutePerHour; - static const sal_Int64 secondPerDay = secondPerMinute * minutePerHour * hourPerDay; - static const sal_Int64 minutePerDay = minutePerHour * hourPerDay; - static const sal_Int64 nanoPerMicro = 1000; - static const sal_Int64 nanoPerMilli = 1000000; - static const sal_Int64 nanoPerCenti = 10000000; - - Time( TimeInitEmpty ) - { nTime = 0; } - Time( TimeInitSystem ); - Time( const ResId & rResId ); - Time( sal_Int64 _nTime ) { Time::nTime = _nTime; } - Time( const Time& rTime ); - Time( sal_uInt32 nHour, sal_uInt32 nMin, - sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 ); - - void SetTime( sal_Int64 nNewTime ) { nTime = nNewTime; } - sal_Int64 GetTime() const { return nTime; } - - void SetHour( sal_uInt16 nNewHour ); - void SetMin( sal_uInt16 nNewMin ); - void SetSec( sal_uInt16 nNewSec ); - void SetNanoSec( sal_uInt32 nNewNanoSec ); - sal_uInt16 GetHour() const - { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime; - return static_cast<sal_uInt16>(nTempTime / SAL_CONST_UINT64(10000000000000)); } - sal_uInt16 GetMin() const - { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime; - return static_cast<sal_uInt16>((nTempTime / SAL_CONST_UINT64(100000000000)) % 100); } - sal_uInt16 GetSec() const - { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime; - return static_cast<sal_uInt16>((nTempTime / SAL_CONST_UINT64(1000000000)) % 100); } - sal_uInt32 GetNanoSec() const - { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime; - return static_cast<sal_uInt32>( nTempTime % SAL_CONST_UINT64(1000000000)); } - - // TODO: consider removing GetMSFromTime and MakeTimeFromMS? - sal_Int32 GetMSFromTime() const; - void MakeTimeFromMS( sal_Int32 nMS ); - sal_Int64 GetNSFromTime() const; - void MakeTimeFromNS( sal_Int64 nNS ); - - /// 12 hours == 0.5 days - double GetTimeInDays() const; - - sal_Bool IsBetween( const Time& rFrom, const Time& rTo ) const - { return ((nTime >= rFrom.nTime) && (nTime <= rTo.nTime)); } - - sal_Bool IsEqualIgnoreNanoSec( const Time& rTime ) const; - - sal_Bool operator ==( const Time& rTime ) const - { return (nTime == rTime.nTime); } - sal_Bool operator !=( const Time& rTime ) const - { return (nTime != rTime.nTime); } - sal_Bool operator >( const Time& rTime ) const - { return (nTime > rTime.nTime); } - sal_Bool operator <( const Time& rTime ) const - { return (nTime < rTime.nTime); } - sal_Bool operator >=( const Time& rTime ) const - { return (nTime >= rTime.nTime); } - sal_Bool operator <=( const Time& rTime ) const - { return (nTime <= rTime.nTime); } - - static Time GetUTCOffset(); - static sal_uIntPtr GetSystemTicks(); // Elapsed time - - void ConvertToUTC() { *this -= Time::GetUTCOffset(); } - void ConvertToLocalTime() { *this += Time::GetUTCOffset(); } - - Time& operator =( const Time& rTime ); - Time operator -() const - { return Time( -nTime ); } - Time& operator +=( const Time& rTime ); - Time& operator -=( const Time& rTime ); - TOOLS_DLLPUBLIC friend Time operator +( const Time& rTime1, const Time& rTime2 ); - TOOLS_DLLPUBLIC friend Time operator -( const Time& rTime1, const Time& rTime2 ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/tools.h b/tools/inc/tools/tools.h deleted file mode 100644 index c015042d6d42..000000000000 --- a/tools/inc/tools/tools.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_H -#define _TOOLS_H - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -// Methoden, die von VCL gerufen werden muessen -TOOLS_DLLPUBLIC void InitTools(); -TOOLS_DLLPUBLIC void DeInitTools(); -TOOLS_DLLPUBLIC void GlobalDeInitTools(); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/toolsdllapi.h b/tools/inc/tools/toolsdllapi.h deleted file mode 100644 index 6e72930e3bc0..000000000000 --- a/tools/inc/tools/toolsdllapi.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_TOOLSDLLAPI_H -#define INCLUDED_TOOLSDLLAPI_H - -#include "sal/types.h" - -#if defined(TOOLS_DLLIMPLEMENTATION) -#define TOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define TOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT -#endif -#define TOOLS_DLLPRIVATE SAL_DLLPRIVATE - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/unqidx.hxx b/tools/inc/tools/unqidx.hxx deleted file mode 100644 index 3a3ba979d092..000000000000 --- a/tools/inc/tools/unqidx.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _UNQIDX_HXX -#define _UNQIDX_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> -#include <tools/contnr.hxx> -#include <map> - -#define UNIQUEINDEX_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND - -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED UniqueIndexImpl : public std::map<sal_uInt32, void*> -{ -private: - sal_uIntPtr nStartIndex; - sal_uIntPtr nUniqIndex; - sal_uIntPtr nCount; - -public: - UniqueIndexImpl( sal_uIntPtr _nStartIndex = 0 ) - : std::map<sal_uInt32, void*>(), - nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex), nCount(0) {} - - sal_uIntPtr Insert( void* p ); - // insert value with key, replacing existing entry if necessary - void Insert( sal_uIntPtr aIndex, void* p ); - void* Remove( sal_uIntPtr aIndex ); - void* Get( sal_uIntPtr aIndex ) const; - - sal_uIntPtr GetIndexOf( void* p ) const; - sal_uIntPtr FirstIndex() const; - sal_uIntPtr LastIndex() const; - sal_uIntPtr NextIndex( sal_uIntPtr aCurrIndex ) const; -}; - -template<typename T> -class UniqueIndex : private UniqueIndexImpl -{ -public: - UniqueIndex<T>( sal_uIntPtr _nStartIndex = 0 ) : UniqueIndexImpl(_nStartIndex) {} - - sal_uIntPtr Insert(T* p) { return UniqueIndexImpl::Insert(p); } - void Insert(sal_uIntPtr aIdx, T* p) { return UniqueIndexImpl::Insert(aIdx, p); } - T* Get(sal_uIntPtr idx) const { return static_cast<T*>( UniqueIndexImpl::Get(idx) ); } - T* Remove(sal_uIntPtr idx) { return static_cast<T*>( UniqueIndexImpl::Remove(idx) ); } - sal_uIntPtr Count() const { return UniqueIndexImpl::size(); } - sal_uIntPtr GetIndexOf(T* p) const { return UniqueIndexImpl::GetIndexOf(p); } - - using UniqueIndexImpl::FirstIndex; - using UniqueIndexImpl::LastIndex; - using UniqueIndexImpl::NextIndex; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx deleted file mode 100644 index fef9f469c359..000000000000 --- a/tools/inc/tools/urlobj.hxx +++ /dev/null @@ -1,1783 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _URLOBJ_HXX -#define _URLOBJ_HXX - -#include "tools/toolsdllapi.h" -#include "com/sun/star/uno/Reference.hxx" -#include "rtl/string.h" -#include "rtl/ustrbuf.hxx" -#include "rtl/textenc.h" -#include "sal/types.h" - -namespace com { namespace sun { namespace star { namespace util { - class XStringWidth; -} } } } - -// Special tokens: -#define INET_PATH_TOKEN '/' -#define INET_MARK_TOKEN '#' -#define INET_HEX_ESCAPE '%' - -// Common URL prefixes for various schemes: -#define INET_FTP_SCHEME "ftp://" -#define INET_HTTP_SCHEME "http://" -#define INET_HTTPS_SCHEME "https://" -#define INET_FILE_SCHEME "file://" -#define INET_MAILTO_SCHEME "mailto:" -#define INET_NEWS_SCHEME "news:" -#define INET_HID_SCHEME "hid:" - -#define URL_PREFIX_PRIV_SOFFICE "private:" -enum -{ - URL_PREFIX_PRIV_SOFFICE_LEN - = RTL_CONSTASCII_LENGTH(URL_PREFIX_PRIV_SOFFICE) -}; - -#define URL_PREFIX_PRIV_OBSOLETE URL_PREFIX_PRIV_SOFFICE -enum -{ - URL_PREFIX_PRIV_OBSOLETE_LEN - = RTL_CONSTASCII_LENGTH(URL_PREFIX_PRIV_OBSOLETE) -}; - -#define URL_PREFIX_PRIV_EXTERN "staroffice:" -enum -{ - URL_PREFIX_PRIV_EXTERN_LEN = RTL_CONSTASCII_LENGTH(URL_PREFIX_PRIV_EXTERN) -}; - -// Schemes: -enum INetProtocol -{ - INET_PROT_NOT_VALID = 0, - INET_PROT_FTP = 1, - INET_PROT_HTTP = 2, - INET_PROT_FILE = 3, - INET_PROT_MAILTO = 4, - INET_PROT_VND_SUN_STAR_WEBDAV = 5, - INET_PROT_NEWS = 6, - INET_PROT_PRIV_SOFFICE = 7, - INET_PROT_PRIVATE = INET_PROT_PRIV_SOFFICE, // obsolete - INET_PROT_VND_SUN_STAR_HELP = 8, - INET_PROT_HTTPS = 9, - INET_PROT_SLOT = 10, - INET_PROT_MACRO = 11, - INET_PROT_JAVASCRIPT = 12, - INET_PROT_IMAP = 13, - INET_PROT_POP3 = 14, - INET_PROT_DATA = 15, - INET_PROT_CID = 16, - INET_PROT_OUT = 17, - INET_PROT_VND_SUN_STAR_HIER = 18, - INET_PROT_VIM = 19, - INET_PROT_UNO = 20, - INET_PROT_COMPONENT = 21, - INET_PROT_VND_SUN_STAR_PKG = 22, - INET_PROT_LDAP = 23, - INET_PROT_DB = 24, - INET_PROT_VND_SUN_STAR_CMD = 25, - INET_PROT_TELNET = 27, - INET_PROT_VND_SUN_STAR_EXPAND = 28, - INET_PROT_VND_SUN_STAR_TDOC = 29, - INET_PROT_GENERIC = 30, - INET_PROT_SMB = 31, - INET_PROT_HID = 32, - INET_PROT_SFTP = 33, - INET_PROT_CMIS = 34, - INET_PROT_END = 35 -}; - -class TOOLS_DLLPUBLIC INetURLObject -{ -public: - // Get- and Set-Methods: - - /** The way input strings that represent (parts of) URIs are interpreted - in set-methods. - - @descr Most set-methods accept either a OString or a OUString - as input. Using a OString, octets in the range 0x80--0xFF are - replaced by single escape sequences. Using a OUString , UTF-32 - characters in the range 0x80--0x10FFFF are replaced by sequences of - escape sequences, representing the UTF-8 coded characters. - - @descr Along with an EncodeMechanism parameter, the set-methods all - take an rtl_TextEncoding parameter, which is ignored unless the - EncodeMechanism is WAS_ENCODED. - */ - enum EncodeMechanism - { - /** All escape sequences that are already present are ignored, and are - interpreted as literal sequences of three characters. - */ - ENCODE_ALL, - - /** Sequences of escape sequences, that represent characters from the - specified character set and that can be converted to UTF-32 - characters, are first decoded. If they have to be encoded, they - are converted to UTF-8 characters and are than translated into - (sequences of) escape sequences. Other escape sequences are - copied verbatim (but using upper case hex digits). - */ - WAS_ENCODED, - - /** All escape sequences that are already present are copied verbatim - (but using upper case hex digits). - */ - NOT_CANONIC - }; - - /** The way strings that represent (parts of) URIs are returned from get- - methods. - - @descr Along with a DecodeMechanism parameter, the get-methods all - take an rtl_TextEncoding parameter, which is ignored unless the - DecodeMechanism is DECODE_WITH_CHARSET or DECODE_UNAMBIGUOUS. - */ - enum DecodeMechanism - { - /** The (part of the) URI is returned unchanged. Since URIs are - written using a subset of US-ASCII, the returned string is - guaranteed to contain only US-ASCII characters. - */ - NO_DECODE, - - /** All sequences of escape sequences that represent UTF-8 coded - UTF-32 characters with a numerical value greater than 0x7F, are - replaced by the respective UTF-16 characters. All other escape - sequences are not decoded. - */ - DECODE_TO_IURI, - - /** All (sequences of) escape sequences that represent characters from - the specified character set, and that can be converted to UTF-32, - are replaced by the respective UTF-16 characters. All other - escape sequences are not decoded. - */ - DECODE_WITH_CHARSET, - - /** All (sequences of) escape sequences that represent characters from - the specified character set, that can be converted to UTF-32, and - that (in the case of ASCII characters) can safely be decoded - without altering the meaning of the (part of the) URI, are - replaced by the respective UTF-16 characters. All other escape - sequences are not decoded. - */ - DECODE_UNAMBIGUOUS - }; - - // General Structure: - - inline INetURLObject(): - m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) {} - - inline bool HasError() const { return m_eScheme == INET_PROT_NOT_VALID; } - - inline OUString GetMainURL(DecodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aAbsURIRef, getEscapePrefix(), eMechanism, eCharset); } - - OUString GetURLNoPass(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - OUString GetURLNoMark(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - OUString - getAbbreviated(com::sun::star::uno::Reference< - com::sun::star::util::XStringWidth > const & - rStringWidth, - sal_Int32 nWidth, - DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - bool operator ==(INetURLObject const & rObject) const; - - inline bool operator !=(INetURLObject const & rObject) const - { return !(*this == rObject); } - - bool operator <(INetURLObject const & rObject) const; - - inline bool operator >(INetURLObject const & rObject) const - { return rObject < *this; } - - // Strict Parsing: - - inline INetURLObject(const OString& rTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline INetURLObject(OUString const & rTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline bool SetURL(const OString& rTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline bool SetURL(OUString const & rTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - bool ConcatData(INetProtocol eTheScheme, OUString const & rTheUser, - OUString const & rThePassword, - OUString const & rTheHost, sal_uInt32 nThePort, - OUString const & rThePath, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - // Smart Parsing: - - /** The supported notations for file system paths. - */ - enum FSysStyle - { - /** VOS notation (e.g., "//server/dir/file"). - */ - FSYS_VOS = 0x1, - - /** Unix notation (e.g., "/dir/file"). - */ - FSYS_UNX = 0x2, - - /** DOS notation (e.g., "a:\dir\file" and "\\server\dir\file"). - */ - FSYS_DOS = 0x4, - - /** Mac notation (e.g., "dir:file"). - */ - FSYS_MAC = 0x8, - - /** Detect the used notation. - - @descr For the following descriptions, please note that - whereas FSYS_DEFAULT includes all style bits, combinations of only - a few style bits are also possible, and are also described. - - @descr When used to translate a file system path to a file URL, - the subset of the following productions for which the appropriate - style bit is set are checked in order (using the conventions of - RFC 2234, RFC 2396, and RFC 2732; UCS4 stands for any UCS4 - character): - - Production T1 (VOS local; FSYS_VOS only): - "//." ["/" *UCS4] - becomes - "file:///" *UCS4 - - Production T2 (VOS host; FSYS_VOS only): - "//" [host] ["/" *UCS4] - becomes - "file://" host "/" *UCS4 - - Production T3 (UNC; FSYS_DOS only): - "\\" [host] ["\" *UCS4] - becomes - "file://" host "/" *UCS4 - replacing "\" by "/" within <*UCS4> - - Production T4 (Unix-like DOS; FSYS_DOS only): - ALPHA ":" ["/" *UCS4] - becomes - "file:///" ALPHA ":/" *UCS4 - replacing "\" by "/" within <*UCS4> - - Production T5 (DOS; FSYS_DOS only): - ALPHA ":" ["\" *UCS4] - becomes - "file:///" ALPHA ":/" *UCS4 - replacing "\" by "/" within <*UCS4> - - Production T6 (any): - *UCS4 - becomes - "file:///" *UCS4 - replacing the delimiter by "/" within <*UCS4>. The delimiter is - that character from the set { "/", "\", ":" } which appears most - often in <*UCS4> (if FSYS_UNX is not among the style bits, "/" - is removed from the set; if FSYS_DOS is not among the style - bits, "\" is removed from the set; if FSYS_MAC is not among the - style bits, ":" is removed from the set). If two or more - characters appear the same number of times, the character - mentioned first in that set is chosen. If the first character - of <*UCS4> is the delimiter, that character is not copied. - - @descr When used to translate a file URL to a file system path, - the following productions are checked in order (using the - conventions of RFC 2234, RFC 2396, and RFC 2732): - - Production F1 (VOS; FSYS_VOS): - "file://" host "/" fpath ["#" fragment] - becomes - "//" host "/" fpath - - Production F2 (DOS; FSYS_DOS): - "file:///" ALPHA ":" ["/" fpath] ["#" fragment] - becomes - ALPHA ":" ["\" fpath] - replacing "/" by "\" in <fpath> - - Production F3 (Unix; FSYS_UNX): - "file:///" fpath ["#" fragment] - becomes - "/" fpath - */ - FSYS_DETECT = FSYS_VOS | FSYS_UNX | FSYS_DOS - }; - - inline INetURLObject(OUString const & rTheAbsURIRef, - INetProtocol eTheSmartScheme, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT); - - inline void SetSmartProtocol(INetProtocol eTheSmartScheme) - { m_eSmartScheme = eTheSmartScheme; } - - inline bool - SetSmartURL(const OString& rTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT); - - inline bool - SetSmartURL(OUString const & rTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT); - - inline INetURLObject - smartRel2Abs(const OString& rTheRelURIRef, - bool & rWasAbsolute, - bool bIgnoreFragment = false, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - bool bRelativeNonURIs = false, - FSysStyle eStyle = FSYS_DETECT) const; - - inline INetURLObject - smartRel2Abs(OUString const & rTheRelURIRef, - bool & rWasAbsolute, - bool bIgnoreFragment = false, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - bool bRelativeNonURIs = false, - FSysStyle eStyle = FSYS_DETECT) const; - - // Relative URLs: - - inline bool - GetNewAbsURL(const OString& rTheRelURIRef, - INetURLObject * pTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT, bool bIgnoreFragment = false) - const; - - inline bool - GetNewAbsURL(OUString const & rTheRelURIRef, - INetURLObject * pTheAbsURIRef, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT, bool bIgnoreFragment = false) - const; - - /** @descr If rTheRelURIRef cannot be converted to an absolute URL - (because of syntactic reasons), either rTheRelURIRef or an empty - string is returned: If all of the parameters eEncodeMechanism, - eDecodeMechanism and eCharset have their respective default values, - then rTheRelURIRef is returned unmodified; otherwise, an empty string - is returned. - */ - static OUString - GetAbsURL(OUString const & rTheBaseURIRef, - OUString const & rTheRelURIRef, - bool bIgnoreFragment = false, - EncodeMechanism eEncodeMechanism = WAS_ENCODED, - DecodeMechanism eDecodeMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT); - - static inline OUString - GetRelURL(const OString& rTheBaseURIRef, - const OString& rTheAbsURIRef, - EncodeMechanism eEncodeMechanism = WAS_ENCODED, - DecodeMechanism eDecodeMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT); - - static inline OUString - GetRelURL(OUString const & rTheBaseURIRef, - OUString const & rTheAbsURIRef, - EncodeMechanism eEncodeMechanism = WAS_ENCODED, - DecodeMechanism eDecodeMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - FSysStyle eStyle = FSYS_DETECT); - - // External URLs: - - OUString getExternalURL(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const; - - static inline bool translateToExternal(const OString& rTheIntURIRef, - OUString & rTheExtURIRef, - DecodeMechanism eDecodeMechanism - = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - static inline bool translateToExternal(OUString const & rTheIntURIRef, - OUString & rTheExtURIRef, - DecodeMechanism eDecodeMechanism - = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - static inline bool translateToInternal(const OString& rTheExtURIRef, - OUString & rTheIntURIRef, - DecodeMechanism eDecodeMechanism - = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - static inline bool translateToInternal(OUString const & rTheExtURIRef, - OUString & rTheIntURIRef, - DecodeMechanism eDecodeMechanism - = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - // Scheme: - - struct SchemeInfo; - - inline INetProtocol GetProtocol() const { return m_eScheme; } - - /** Return the URL 'prefix' for a given scheme. - - @param eTheScheme One of the supported URL schemes. - - @return The 'prefix' of URLs of the given scheme. - */ - static OUString GetScheme(INetProtocol eTheScheme); - - static inline INetProtocol CompareProtocolScheme(const OString& - rTheAbsURIRef) - { return CompareProtocolScheme(extend(rTheAbsURIRef)); } - - static INetProtocol CompareProtocolScheme(OUString const & - rTheAbsURIRef); - - // User Info: - - inline bool HasUserData() const { return m_aUser.isPresent(); } - - inline bool IsEmptyUser() const - { return m_aUser.isPresent() && m_aUser.isEmpty(); } - - inline OUString GetUser(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aUser, getEscapePrefix(), eMechanism, eCharset); } - - inline OUString GetPass(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aAuth, getEscapePrefix(), eMechanism, eCharset); } - - inline bool SetUser(const OString& rTheUser, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return setUser(extend(rTheUser), true, eMechanism, eCharset); } - - inline bool SetUser(OUString const & rTheUser, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return setUser(rTheUser, false, eMechanism, eCharset); } - - inline bool SetPass(const OString& rThePassword, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline bool SetPass(OUString const & rThePassword, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline bool SetUserAndPass(const OString& rTheUser, - const OString& rThePassword, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - inline bool SetUserAndPass(OUString const & rTheUser, - OUString const & rThePassword, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - // Host and Port: - - inline bool HasPort() const { return m_aPort.isPresent(); } - - inline OUString GetHost(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aHost, getEscapePrefix(), eMechanism, eCharset); } - - OUString GetHostPort(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - sal_uInt32 GetPort() const; - - inline bool SetHost(const OString& rTheHost, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return setHost(extend(rTheHost), true, eMechanism, eCharset); } - - inline bool SetHost(OUString const & rTheHost, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return setHost(rTheHost, false, eMechanism, eCharset); } - - bool SetPort(sal_uInt32 nThePort); - - // Path: - - inline bool HasURLPath() const { return !m_aPath.isEmpty(); } - - inline OUString GetURLPath(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aPath, getEscapePrefix(), eMechanism, eCharset); } - - inline bool SetURLPath(const OString& rThePath, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return setPath(extend(rThePath), true, eMechanism, eCharset); } - - inline bool SetURLPath(OUString const & rThePath, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return setPath(rThePath, false, eMechanism, eCharset); } - - // Hierarchical Path: - - /** A constant to address the last segment in various methods dealing with - hierarchical paths. - - @descr It is often more efficient to address the last segment using - this constant, than to determine its ordinal value using - getSegmentCount(). - */ - enum { LAST_SEGMENT = -1 }; - - /** The number of segments in the hierarchical path. - - @descr Using RFC 2396 and RFC 2234, a hierarchical path is of the - form - - hierarchical-path = 1*("/" segment) - - segment = name *(";" param) - - name = [base ["." extension]] - - base = 1*pchar - - extension = *<any pchar except "."> - - param = *pchar - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @return The number of segments in the hierarchical path. If the path - is not hierarchical, 0 is returned. - */ - sal_Int32 getSegmentCount(bool bIgnoreFinalSlash = true) const; - - /** Remove a segment from the hierarchical path. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @return True if the segment has successfully been removed (and the - resulting URI is still valid). If the path is not hierarchical, or - the specified segment does not exist, false is returned. If false is - returned, the object is not modified. - */ - bool removeSegment(sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true); - - /** Insert a new segment into the hierarchical path. - - @param rTheName The name part of the new segment. The new segment - will contain no parameters. - - @param bAppendFinalSlash If the new segment is appended at the end of - the hierarchical path, this parameter specifies whether to add a final - slash after it or not. - - @param nIndex The non-negative index of the segment before which - to insert the new segment. LAST_SEGMENT or an nIndex that equals - getSegmentCount() inserts the new segment at the end of the - hierarchical path. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return True if the segment has successfully been inserted (and the - resulting URI is still valid). If the path is not hierarchical, or - the specified place to insert the new segment does not exist, false is - returned. If false is returned, the object is not modified. - */ - inline bool insertName(OUString const & rTheName, - bool bAppendFinalSlash = false, - sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - /** Get the name of a segment of the hierarchical path. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for get-methods. - - @param eCharset See the general discussion for get-methods. - - @return The name part of the specified segment. If the path is not - hierarchical, or the specified segment does not exits, an empty string - is returned. - */ - OUString getName(sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - /** Set the name of a segment (preserving any parameters and any query or - fragment part). - - @param rTheName The new name. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return True if the name has successfully been modified (and the - resulting URI is still valid). If the path is not hierarchical, or - the specified segment does not exist, false is returned. If false is - returned, the object is not modified. - */ - bool setName(OUString const & rTheName, - sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - /** Get the base of the name of a segment. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for get-methods. - - @param eCharset See the general discussion for get-methods. - - @return The base part of the specified segment. If the path is - not hierarchical, or the specified segment does not exits, an empty - string is returned. - */ - OUString getBase(sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - /** Set the base of the name of a segment (preserving the extension). - - @param rTheBase The new base. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return True if the base has successfully been modified (and the - resulting URI is still valid). If the path is not hierarchical, or - the specified segment does not exist, false is returned. If false is - returned, the object is not modified. - */ - bool setBase(OUString const & rTheBase, - sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - /** Determine whether the name of a segment has an extension. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @return True if the name of the specified segment has an extension. - If the path is not hierarchical, or the specified segment does not - exist, false is returned. - */ - bool hasExtension(sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true) const; - - /** Get the extension of the name of a segment. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for get-methods. - - @param eCharset See the general discussion for get-methods. - - @return The extension part of the specified segment. If the path is - not hierarchical, or the specified segment does not exits, an empty - string is returned. - */ - OUString getExtension(sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - /** Set the extension of the name of a segment (replacing an already - existing extension). - - @param rTheExtension The new extension. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return True if the extension has successfully been modified (and the - resulting URI is still valid). If the path is not hierarchical, or - the specified segment does not exist, false is returned. If false is - returned, the object is not modified. - */ - bool setExtension(OUString const & rTheExtension, - sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - /** Remove the extension of the name of a segment. - - @param nIndex The non-negative index of the segment, or LAST_SEGMENT - if addressing the last segment. - - @param bIgnoreFinalSlash If true, a final slash at the end of the - hierarchical path does not denote an empty segment, but is ignored. - - @return True if the extension has successfully been removed (and the - resulting URI is still valid), or if the name did not have an - extension. If the path is not hierarchical, or the specified segment - does not exist, false is returned. If false is returned, the object - is not modified. - */ - bool removeExtension(sal_Int32 nIndex = LAST_SEGMENT, - bool bIgnoreFinalSlash = true); - - /** Determine whether the hierarchical path ends in a final slash. - - @return True if the hierarchical path ends in a final slash. If the - path is not hierarchical, false is returned. - */ - bool hasFinalSlash() const; - - /** Make the hierarchical path end in a final slash (if it does not - already do so). - - @return True if a final slash has successfully been appended (and the - resulting URI is still valid), or if the hierarchical path already - ended in a final slash. If the path is not hierarchical, false is - returned. If false is returned, the object is not modified. - */ - bool setFinalSlash(); - - /** Remove a final slash from the hierarchical path. - - @return True if a final slash has successfully been removed (and the - resulting URI is still valid), or if the hierarchical path already did - not end in a final slash. If the path is not hierarchical, false is - returned. If false is returned, the object is not modified. - */ - bool removeFinalSlash(); - - // Query: - - inline bool HasParam() const { return m_aQuery.isPresent(); } - - inline OUString GetParam(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aQuery, getEscapePrefix(), eMechanism, eCharset); } - - inline bool SetParam(const OString& rTheQuery, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline bool SetParam(OUString const & rTheQuery, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - // Fragment: - - inline bool HasMark() const { return m_aFragment.isPresent(); } - - inline OUString GetMark(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return decode(m_aFragment, getEscapePrefix(), eMechanism, eCharset); } - - inline bool SetMark(const OString& rTheFragment, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline bool SetMark(OUString const & rTheFragment, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - // File URLs: - - /** Create an INetURLObject from a file system path. - - @param rFSysPath A file system path. An URL is not allowed here! - - @param eStyle The notation of rFSysPath. - */ - inline INetURLObject(OUString const & rFSysPath, FSysStyle eStyle); - - /** Set this INetURLObject to a file URL constructed from a file system - path. - - @param rFSysPath A file system path. An URL is not allowed here! - - @param eStyle The notation of rFSysPath. - - @return True if this INetURLObject has successfully been changed. If - false is returned, this INetURLObject has not been modified. - */ - bool setFSysPath(OUString const & rFSysPath, FSysStyle eStyle); - - /** Return the file system path represented by a file URL (ignoring any - fragment part). - - @param eStyle The notation of the returned file system path. - - @param pDelimiter Upon successful return, this parameter can return - the character that is the 'main' delimiter within the returned file - system path (e.g., "/" for Unix, "\" for DOS, ":" for Mac). This is - especially useful for routines that later try to shorten the returned - file system path at a 'good' position, e.g. to fit it into some - limited display space. - - @return The file system path represented by this file URL. If this - file URL does not represent a file system path according to the - specified notation, or if this is not a file URL at all, an empty - string is returned. - */ - OUString getFSysPath(FSysStyle eStyle, sal_Unicode * pDelimiter = 0) - const; - - // POP3 and URLs: - - OUString GetMsgId(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - // Coding: - - enum Part - { - PART_OBSOLETE_NORMAL = 0x001, // Obsolete, do not use! - PART_OBSOLETE_FILE = 0x002, // Obsolete, do not use! - PART_OBSOLETE_PARAM = 0x004, // Obsolete, do not use! - PART_USER_PASSWORD = 0x008, - PART_IMAP_ACHAR = 0x010, - PART_VIM = 0x020, - PART_HOST_EXTRA = 0x040, - PART_FPATH = 0x080, - PART_AUTHORITY = 0x100, - PART_PATH_SEGMENTS_EXTRA = 0x200, - PART_REL_SEGMENT_EXTRA = 0x400, - PART_URIC = 0x800, - PART_HTTP_PATH = 0x1000, - PART_FILE_SEGMENT_EXTRA = 0x2000, // Obsolete, do not use! - PART_MESSAGE_ID = 0x4000, - PART_MESSAGE_ID_PATH = 0x8000, - PART_MAILTO = 0x10000, - PART_PATH_BEFORE_QUERY = 0x20000, - PART_PCHAR = 0x40000, - PART_FRAGMENT = 0x80000, // Obsolete, do not use! - PART_VISIBLE = 0x100000, - PART_VISIBLE_NONSPECIAL = 0x200000, - PART_CREATEFRAGMENT = 0x400000, - PART_UNO_PARAM_VALUE = 0x800000, - PART_UNAMBIGUOUS = 0x1000000, - PART_URIC_NO_SLASH = 0x2000000, - PART_HTTP_QUERY = 0x4000000, //TODO! unused? - PART_NEWS_ARTICLE_LOCALPART = 0x8000000, - max_part = 0x80000000 - // Do not use! Only there to allow compatible changes in the - // future. - }; - - enum EscapeType - { - ESCAPE_NO, - ESCAPE_OCTET, - ESCAPE_UTF32 - }; - - /** Encode some text as part of a URI. - - @param rText Some text (for its interpretation, see the general - discussion for set-methods). - - @param ePart The part says which characters are 'forbidden' and must - be encoded (replaced by escape sequences). Characters outside the US- - ASCII range are always 'forbidden.' - - @param cEscapePrefix The first character in an escape sequence - (normally '%'). - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return The encoded representation of the text ('forbidden' - characters replaced by escape sequences). - */ - static inline OUString encode(const OString& rText, Part ePart, - sal_Char cEscapePrefix, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - /** Encode some text as part of a URI. - - @param rText Some text (for its interpretation, see the general - discussion for set-methods). - - @param ePart The part says which characters are 'forbidden' and must - be encoded (replaced by escape sequences). Characters outside the US- - ASCII range are always 'forbidden.' - - @param cEscapePrefix The first character in an escape sequence - (normally '%'). - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return The text, encoded according to the given mechanism and - charset ('forbidden' characters replaced by escape sequences). - */ - static inline OUString encode(OUString const & rText, Part ePart, - sal_Char cEscapePrefix, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - /** Decode some text. - - @param rText Some (encoded) text. - - @param cEscapePrefix The first character in an escape sequence - (normally '%'). - - @param eMechanism See the general discussion for get-methods. - - @param eCharset See the general discussion for get-methods. - - @return The text, decoded according to the given mechanism and - charset (escape sequences replaced by 'raw' characters). - */ - static inline OUString decode(OUString const & rText, - sal_Char cEscapePrefix, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - static inline OUString decode(OUStringBuffer const & rText, - sal_Char cEscapePrefix, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - static void appendUCS4Escape(OUStringBuffer & rTheText, - sal_Char cEscapePrefix, - sal_uInt32 nUCS4); - - static void appendUCS4(OUStringBuffer & rTheText, sal_uInt32 nUCS4, - EscapeType eEscapeType, bool bOctets, Part ePart, - sal_Char cEscapePrefix, rtl_TextEncoding eCharset, - bool bKeepVisibleEscapes); - - static sal_uInt32 getUTF32(sal_Unicode const *& rBegin, - sal_Unicode const * pEnd, bool bOctets, - sal_Char cEscapePrefix, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - EscapeType & rEscapeType); - - // Specialized helpers: - - static sal_uInt32 scanDomain(sal_Unicode const *& rBegin, - sal_Unicode const * pEnd, - bool bEager = true); - - // OBSOLETE Hierarchical Path: - - OUString GetPartBeforeLastName(DecodeMechanism eMechanism - = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const; - - /** Get the last segment in the path. - - @param eMechanism See the general discussion for get-methods. - - @param eCharset See the general discussion for get-methods. - - @return For a hierarchical URL, the last segment (everything after - the last unencoded '/'). Not that this last segment may be empty. If - the URL is not hierarchical, an empty string is returned. - */ - OUString GetLastName(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - const; - - /** Get the 'extension' of the last segment in the path. - - @param eMechanism See the general discussion for get-methods. - - @param eCharset See the general discussion for get-methods. - - @return For a hierarchical URL, everything after the first unencoded - '.' in the last segment of the path. Note that this 'extension' may - be empty. If the URL is not hierarchical, or if the last segment does - not contain an unencoded '.', an empty string is returned. - */ - OUString GetFileExtension(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const; - - inline bool Append(const OString& rTheSegment, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return appendSegment(extend(rTheSegment), true, eMechanism, eCharset); } - - inline bool Append(OUString const & rTheSegment, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) - { return appendSegment(rTheSegment, false, eMechanism, eCharset); } - - bool CutLastName(); - - // OBSOLETE File URLs: - - OUString PathToFileName() const; - - OUString GetFull() const; - - OUString GetPath() const; - - void SetBase(OUString const & rTheBase); - - OUString GetBase() const; - - void SetName(OUString const & rTheName, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline OUString GetName(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return GetLastName(eMechanism, eCharset); } - - void SetExtension(OUString const & rTheExtension, - EncodeMechanism eMechanism = WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - inline OUString GetExtension( - DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) const - { return GetFileExtension(eMechanism, eCharset); } - - OUString CutExtension(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - - bool IsCaseSensitive() const; - - -private: - // General Structure: - - class SubString - { - sal_Int32 m_nBegin; - sal_Int32 m_nLength; - - public: - explicit inline SubString(sal_Int32 nTheBegin = -1, - sal_Int32 nTheLength = 0): - m_nBegin(nTheBegin), m_nLength(nTheLength) {} - - inline bool isPresent() const { return m_nBegin != -1; } - - inline bool isEmpty() const { return m_nLength == 0; } - - inline sal_Int32 getBegin() const { return m_nBegin; } - - inline sal_Int32 getLength() const { return m_nLength; } - - inline sal_Int32 getEnd() const { return m_nBegin + m_nLength; } - - inline sal_Int32 clear(); - - inline sal_Int32 set(OUStringBuffer & rString, - OUString const & rSubString, - sal_Int32 nTheBegin); - - inline sal_Int32 set(OUString & rString, - OUString const & rSubString); - - inline sal_Int32 set(OUStringBuffer & rString, - OUString const & rSubString); - - inline void operator +=(sal_Int32 nDelta); - - int compare(SubString const & rOther, - OUStringBuffer const & rThisString, - OUStringBuffer const & rOtherString) const; - }; - - OUStringBuffer m_aAbsURIRef; - SubString m_aScheme; - SubString m_aUser; - SubString m_aAuth; - SubString m_aHost; - SubString m_aPort; - SubString m_aPath; - SubString m_aQuery; - SubString m_aFragment; - INetProtocol m_eScheme; - INetProtocol m_eSmartScheme; - - TOOLS_DLLPRIVATE void setInvalid(); - - bool setAbsURIRef( - OUString const & rTheAbsURIRef, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bSmart, - FSysStyle eStyle); - - // Relative URLs: - - bool convertRelToAbs( - OUString const & rTheRelURIRef, bool bOctets, - INetURLObject & rTheAbsURIRef, bool & rWasAbsolute, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset, - bool bIgnoreFragment, bool bSmart, bool bRelativeNonURIs, - FSysStyle eStyle) const; - - bool convertAbsToRel( - OUString const & rTheAbsURIRef, bool bOctets, - OUString & rTheRelURIRef, EncodeMechanism eEncodeMechanism, - DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset, - FSysStyle eStyle) const; - - // External URLs: - - static bool convertIntToExt( - OUString const & rTheIntURIRef, bool bOctets, - OUString & rTheExtURIRef, DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset); - - static bool convertExtToInt( - OUString const & rTheExtURIRef, bool bOctets, - OUString & rTheIntURIRef, DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset); - - // Scheme: - - struct PrefixInfo; - - TOOLS_DLLPRIVATE static inline SchemeInfo const & getSchemeInfo( - INetProtocol eTheScheme); - - TOOLS_DLLPRIVATE inline SchemeInfo const & getSchemeInfo() const; - - TOOLS_DLLPRIVATE static PrefixInfo const * getPrefix( - sal_Unicode const *& rBegin, sal_Unicode const * pEnd); - - // Authority: - - TOOLS_DLLPRIVATE sal_Int32 getAuthorityBegin() const; - - TOOLS_DLLPRIVATE SubString getAuthority() const; - - // User Info: - - bool setUser( - OUString const & rTheUser, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - bool clearPassword(); - - bool setPassword( - OUString const & rThePassword, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - // Host and Port: - - TOOLS_DLLPRIVATE static bool parseHost( - sal_Unicode const *& rBegin, sal_Unicode const * pEnd, - OUString & rCanonic); - - TOOLS_DLLPRIVATE static bool parseHostOrNetBiosName( - sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset, - bool bNetBiosName, OUStringBuffer* pCanonic); - - bool setHost( - OUString const & rTheHost, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - // Path: - - TOOLS_DLLPRIVATE static bool parsePath( - INetProtocol eScheme, sal_Unicode const ** pBegin, - sal_Unicode const * pEnd, bool bOctets, EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, bool bSkippedInitialSlash, - sal_uInt32 nSegmentDelimiter, sal_uInt32 nAltSegmentDelimiter, - sal_uInt32 nQueryDelimiter, sal_uInt32 nFragmentDelimiter, - OUStringBuffer &rSynPath); - - bool setPath( - OUString const & rThePath, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - // Hierarchical Path: - - TOOLS_DLLPRIVATE bool checkHierarchical() const; - - bool appendSegment( - OUString const & rTheSegment, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - TOOLS_DLLPRIVATE SubString getSegment( - sal_Int32 nIndex, bool bIgnoreFinalSlash) const; - - bool insertName( - OUString const & rTheName, bool bOctets, bool bAppendFinalSlash, - sal_Int32 nIndex, bool bIgnoreFinalSlash, EncodeMechanism eMechanism, - rtl_TextEncoding eCharset); - - // Query: - - bool clearQuery(); - - bool setQuery( - OUString const & rTheQuery, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - // Fragment: - - bool clearFragment(); - - bool setFragment( - OUString const & rTheMark, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - - // FILE URLs: - - TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const; - - // Coding: - - static inline OUString extend(const OString& rOctets) - { - return OStringToOUString(rOctets, RTL_TEXTENCODING_ISO_8859_1); - } - - static inline sal_Char getEscapePrefix(INetProtocol eTheScheme) - { return eTheScheme == INET_PROT_VIM ? '=' : '%'; } - - inline sal_Char getEscapePrefix() const - { return getEscapePrefix(m_eScheme); } - - TOOLS_DLLPRIVATE static inline void appendEscape( - OUStringBuffer & rTheText, sal_Char cEscapePrefix, - sal_uInt32 nOctet); - - static OUString encodeText( - sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets, - Part ePart, sal_Char cEscapePrefix, EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, bool bKeepVisibleEscapes); - - static inline OUString encodeText( - OUString const & rTheText, bool bOctets, Part ePart, - sal_Char cEscapePrefix, EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, bool bKeepVisibleEscapes); - - static OUString decode( - sal_Unicode const * pBegin, sal_Unicode const * pEnd, - sal_Char cEscapePrefix, DecodeMechanism, rtl_TextEncoding eCharset); - - inline OUString decode( - SubString const & rSubString, sal_Char cEscapePrefix, - DecodeMechanism eMechanism, rtl_TextEncoding eCharset) const; - - // Specialized helpers: - - TOOLS_DLLPRIVATE static bool scanIPv6reference( - sal_Unicode const *& rBegin, sal_Unicode const * pEnd); - -private: - void changeScheme(INetProtocol eTargetScheme); -}; - -// static -inline OUString INetURLObject::encodeText(OUString const & rTheText, - bool bOctets, Part ePart, - sal_Char cEscapePrefix, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - bool bKeepVisibleEscapes) -{ - return encodeText(rTheText.getStr(), - rTheText.getStr() + rTheText.getLength(), bOctets, ePart, - cEscapePrefix, eMechanism, eCharset, - bKeepVisibleEscapes); -} - -inline OUString INetURLObject::decode(SubString const & rSubString, - sal_Char cEscapePrefix, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset) const -{ - return rSubString.isPresent() ? - decode(m_aAbsURIRef.getStr() + rSubString.getBegin(), - m_aAbsURIRef.getStr() + rSubString.getEnd(), - cEscapePrefix, eMechanism, eCharset) : - OUString(); -} - -inline INetURLObject::INetURLObject(const OString& rTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset): - m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) -{ - setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset, false, - FSysStyle(0)); -} - -inline INetURLObject::INetURLObject(OUString const & rTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset): - m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) -{ - setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, false, - FSysStyle(0)); -} - -inline bool INetURLObject::SetURL(const OString& rTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset, - false, FSysStyle(0)); -} - -inline bool INetURLObject::SetURL(OUString const & rTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, false, - FSysStyle(0)); -} - -inline INetURLObject::INetURLObject(OUString const & rTheAbsURIRef, - INetProtocol eTheSmartScheme, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle): - m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(eTheSmartScheme) -{ - setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true, eStyle); -} - -inline bool INetURLObject::SetSmartURL(const OString& rTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle) -{ - return setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset, - true, eStyle); -} - -inline bool INetURLObject::SetSmartURL(OUString const & rTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle) -{ - return setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true, - eStyle); -} - -inline INetURLObject -INetURLObject::smartRel2Abs(const OString& rTheRelURIRef, - bool & rWasAbsolute, - bool bIgnoreFragment, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - bool bRelativeNonURIs, - FSysStyle eStyle) const -{ - INetURLObject aTheAbsURIRef; - convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef, rWasAbsolute, - eMechanism, eCharset, bIgnoreFragment, true, - bRelativeNonURIs, eStyle); - return aTheAbsURIRef; -} - -inline INetURLObject -INetURLObject::smartRel2Abs(OUString const & rTheRelURIRef, - bool & rWasAbsolute, - bool bIgnoreFragment, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - bool bRelativeNonURIs, - FSysStyle eStyle) const -{ - INetURLObject aTheAbsURIRef; - convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, rWasAbsolute, - eMechanism, eCharset, bIgnoreFragment, true, - bRelativeNonURIs, eStyle); - return aTheAbsURIRef; -} - -inline bool INetURLObject::GetNewAbsURL(const OString& rTheRelURIRef, - INetURLObject * pTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle, bool bIgnoreFragment) - const -{ - INetURLObject aTheAbsURIRef; - bool bWasAbsolute; - if (!convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef, - bWasAbsolute, eMechanism, eCharset, bIgnoreFragment, - false, false, eStyle)) - return false; - if (pTheAbsURIRef) - *pTheAbsURIRef = aTheAbsURIRef; - return true; -} - -inline bool INetURLObject::GetNewAbsURL(OUString const & rTheRelURIRef, - INetURLObject * pTheAbsURIRef, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle, bool bIgnoreFragment) - const -{ - INetURLObject aTheAbsURIRef; - bool bWasAbsolute; - if (!convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, bWasAbsolute, - eMechanism, eCharset, bIgnoreFragment, false, false, - eStyle)) - return false; - if (pTheAbsURIRef) - *pTheAbsURIRef = aTheAbsURIRef; - return true; -} - -// static -inline OUString INetURLObject::GetRelURL(const OString& rTheBaseURIRef, - const OString& rTheAbsURIRef, - EncodeMechanism eEncodeMechanism, - DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle) -{ - OUString aTheRelURIRef; - INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset). - convertAbsToRel(extend(rTheAbsURIRef), true, aTheRelURIRef, - eEncodeMechanism, eDecodeMechanism, eCharset, eStyle); - return aTheRelURIRef; -} - -// static -inline OUString INetURLObject::GetRelURL(OUString const & rTheBaseURIRef, - OUString const & rTheAbsURIRef, - EncodeMechanism eEncodeMechanism, - DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset, - FSysStyle eStyle) -{ - OUString aTheRelURIRef; - INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset). - convertAbsToRel(rTheAbsURIRef, false, aTheRelURIRef, eEncodeMechanism, - eDecodeMechanism, eCharset, eStyle); - return aTheRelURIRef; -} - -// static -inline bool INetURLObject::translateToExternal(const OString& rTheIntURIRef, - OUString & rTheExtURIRef, - DecodeMechanism - eDecodeMechanism, - rtl_TextEncoding eCharset) -{ - OUString aTheExtURIRef; - bool bRet = convertIntToExt(extend(rTheIntURIRef), true, aTheExtURIRef, - eDecodeMechanism, eCharset); - rTheExtURIRef = aTheExtURIRef; - return bRet; -} - -// static -inline bool INetURLObject::translateToExternal(OUString const & - rTheIntURIRef, - OUString & rTheExtURIRef, - DecodeMechanism - eDecodeMechanism, - rtl_TextEncoding eCharset) -{ - return convertIntToExt(rTheIntURIRef, false, rTheExtURIRef, - eDecodeMechanism, eCharset); -} - -// static -inline bool INetURLObject::translateToInternal(const OString& - rTheExtURIRef, - OUString & rTheIntURIRef, - DecodeMechanism - eDecodeMechanism, - rtl_TextEncoding eCharset) -{ - OUString aTheIntURIRef; - bool bRet = convertExtToInt(extend(rTheExtURIRef), true, aTheIntURIRef, - eDecodeMechanism, eCharset); - rTheIntURIRef = aTheIntURIRef; - return bRet; -} - -// static -inline bool INetURLObject::translateToInternal(OUString const & - rTheExtURIRef, - OUString & rTheIntURIRef, - DecodeMechanism - eDecodeMechanism, - rtl_TextEncoding eCharset) -{ - return convertExtToInt(rTheExtURIRef, false, rTheIntURIRef, - eDecodeMechanism, eCharset); -} - -inline bool INetURLObject::SetPass(const OString& rThePassword, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return rThePassword.isEmpty() ? - clearPassword() : - setPassword(extend(rThePassword), true, eMechanism, eCharset); -} - -inline bool INetURLObject::SetPass(OUString const & rThePassword, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return rThePassword.isEmpty() ? - clearPassword() : - setPassword(rThePassword, false, eMechanism, eCharset); -} - -inline bool INetURLObject::SetUserAndPass(const OString& rTheUser, - const OString& rThePassword, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return setUser(extend(rTheUser), true, eMechanism, eCharset) - && (rThePassword.isEmpty() ? - clearPassword() : - setPassword(extend(rThePassword), true, eMechanism, - eCharset)); -} - -inline bool INetURLObject::SetUserAndPass(OUString const & rTheUser, - OUString const & rThePassword, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return setUser(rTheUser, false, eMechanism, eCharset) - && (rThePassword.isEmpty() ? - clearPassword() : - setPassword(rThePassword, false, eMechanism, eCharset)); -} - -inline bool INetURLObject::insertName(OUString const & rTheName, - bool bAppendFinalSlash, - sal_Int32 nIndex, - bool bIgnoreFinalSlash, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return insertName(rTheName, false, bAppendFinalSlash, nIndex, - bIgnoreFinalSlash, eMechanism, eCharset); -} - -inline bool INetURLObject::SetParam(const OString& rTheQuery, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return rTheQuery.isEmpty() ? - clearQuery() : - setQuery(extend(rTheQuery), true, eMechanism, eCharset); -} - -inline bool INetURLObject::SetParam(OUString const & rTheQuery, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return rTheQuery.isEmpty() ? - clearQuery() : - setQuery(rTheQuery, false, eMechanism, eCharset); -} - -inline bool INetURLObject::SetMark(const OString& rTheFragment, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return rTheFragment.isEmpty() ? - clearFragment() : - setFragment(extend(rTheFragment), true, eMechanism, eCharset); -} - -inline bool INetURLObject::SetMark(OUString const & rTheFragment, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return rTheFragment.isEmpty() ? - clearFragment() : - setFragment(rTheFragment, false, eMechanism, eCharset); -} - -inline INetURLObject::INetURLObject(OUString const & rFSysPath, - FSysStyle eStyle): - m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) -{ - setFSysPath(rFSysPath, eStyle); -} - -// static -inline OUString INetURLObject::encode(const OString& rText, Part ePart, - sal_Char cEscapePrefix, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return encodeText(extend(rText), true, ePart, cEscapePrefix, eMechanism, - eCharset, false); -} - -// static -inline OUString INetURLObject::encode(OUString const & rText, Part ePart, - sal_Char cEscapePrefix, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return encodeText(rText, false, ePart, cEscapePrefix, eMechanism, - eCharset, false); -} - -// static -inline OUString INetURLObject::decode(OUString const & rText, - sal_Char cEscapePrefix, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return decode(rText.getStr(), rText.getStr() + rText.getLength(), - cEscapePrefix, eMechanism, eCharset); -} - -inline OUString INetURLObject::decode(OUStringBuffer const & rText, - sal_Char cEscapePrefix, - DecodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return decode(rText.getStr(), rText.getStr() + rText.getLength(), - cEscapePrefix, eMechanism, eCharset); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/vcompat.hxx b/tools/inc/tools/vcompat.hxx deleted file mode 100644 index cb3c29701e36..000000000000 --- a/tools/inc/tools/vcompat.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _VCOMPAT_HXX -#define _VCOMPAT_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -#define COMPAT_FORMAT( char1, char2, char3, char4 ) \ - ((sal_uInt32)((((sal_uInt32)(char)(char1)))| \ - (((sal_uInt32)(char)(char2))<<8UL)| \ - (((sal_uInt32)(char)(char3))<<16UL)| \ - ((sal_uInt32)(char)(char4))<<24UL)) - -class SvStream; - -class TOOLS_DLLPUBLIC VersionCompat -{ - SvStream* mpRWStm; - sal_uInt32 mnCompatPos; - sal_uInt32 mnTotalSize; - sal_uInt16 mnStmMode; - sal_uInt16 mnVersion; - - VersionCompat() {} - VersionCompat( const VersionCompat& ) {} - VersionCompat& operator=( const VersionCompat& ) { return *this; } - sal_Bool operator==( const VersionCompat& ) { return sal_False; } - -public: - - VersionCompat( SvStream& rStm, sal_uInt16 nStreamMode, sal_uInt16 nVersion = 1 ); - ~VersionCompat(); - - sal_uInt16 GetVersion() const { return mnVersion; } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/vector2d.hxx b/tools/inc/tools/vector2d.hxx deleted file mode 100644 index d3d1c5c0c805..000000000000 --- a/tools/inc/tools/vector2d.hxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _VECTOR2D_HXX -#define _VECTOR2D_HXX - -#include <math.h> -#include <tools/gen.hxx> - -class Vector2D -{ -private: - double mfX; - double mfY; - -public: - inline Vector2D() : mfX( 0.0 ), mfY( 0.0 ) {} - inline Vector2D( double fX, double fY ) : mfX( fX ), mfY( fY ) {} - inline Vector2D( const Vector2D& rVec ) : mfX( rVec.mfX ), mfY( rVec.mfY ) {} - inline Vector2D( const Pair& rPair ) : mfX( rPair.A() ), mfY( rPair.B() ) {}; - inline ~Vector2D() {} - - inline const double& X() const { return mfX; } - inline const double& Y() const { return mfY; } - inline double& X() { return mfX; } - inline double& Y() { return mfY; } - inline const double& operator[] (int nPos) const { return (nPos ? mfY : mfX); } - inline double& operator[] (int nPos) { return (nPos ? mfY : mfX); } - - inline double GetLength() const { return hypot( mfX, mfY ); } - inline Vector2D& Normalize(); - - inline void Min(const Vector2D& rVec) { if(rVec.mfX < mfX) mfX = rVec.mfX; if(rVec.mfY < mfY) mfY = rVec.mfY; } - inline void Max(const Vector2D& rVec) { if(rVec.mfX > mfX) mfX = rVec.mfX; if(rVec.mfY > mfY) mfY = rVec.mfY; } - inline void Abs() { if(mfX < 0.0) mfX = -mfX; if(mfY < 0.0) mfY = -mfY; } - - inline void CalcInBetween(Vector2D& rOld1, Vector2D& rOld2, double t) - { mfX = ((rOld2.mfX - rOld1.mfX) + t) + rOld1.mfX; mfY = ((rOld2.mfY - rOld1.mfY) + t) + rOld1.mfY; } - inline void CalcMiddle(Vector2D& rOld1, Vector2D& rOld2) - { mfX = (rOld1.mfX + rOld2.mfX) / 2.0; mfY = (rOld1.mfY + rOld2.mfY) / 2.0; } - inline void CalcMiddle(Vector2D& rOld1, Vector2D& rOld2, Vector2D& rOld3) - { mfX = (rOld1.mfX + rOld2.mfX + rOld3.mfX) / 3.0; mfY = (rOld1.mfY + rOld2.mfY + rOld3.mfY) / 3.0; } - - inline Vector2D& operator+=( const Vector2D& rVec ) { mfX += rVec.mfX, mfY += rVec.mfY; return *this; } - inline Vector2D& operator-=( const Vector2D& rVec ) { mfX -= rVec.mfX, mfY -= rVec.mfY; return *this; } - inline Vector2D operator+(const Vector2D& rVec) const { Vector2D aSum(*this); aSum += rVec; return aSum; } - inline Vector2D operator-(const Vector2D& rVec) const { Vector2D aSub(*this); aSub -= rVec; return aSub; } - inline Vector2D operator-(void) const { return Vector2D(-mfX, -mfY); } - - inline double Scalar( const Vector2D& rVec ) const { return( mfX * rVec.mfX + mfY * rVec.mfY ); } - - inline Vector2D& operator/=( const Vector2D& rVec ) { mfX /= rVec.mfX, mfY /= rVec.mfY; return *this; } - inline Vector2D& operator*=( const Vector2D& rVec ) { mfX *= rVec.mfX, mfY *= rVec.mfY; return *this; } - inline Vector2D operator/(const Vector2D& rVec) const { Vector2D aDiv(*this); aDiv /= rVec; return aDiv; } - inline Vector2D operator*(const Vector2D& rVec) const { Vector2D aMul(*this); aMul *= rVec; return aMul; } - - inline Vector2D& operator*=(double t) { mfX *= t; mfY *= t; return *this; } - inline Vector2D operator*(double t) const { Vector2D aNew(*this); aNew *= t; return aNew; } - inline Vector2D& operator/=(double t) { mfX /= t; mfY /= t; return *this; } - inline Vector2D operator/(double t) const { Vector2D aNew(*this); aNew /= t; return aNew; } - - inline sal_Bool operator==( const Vector2D& rVec ) const { return( mfX == rVec.mfX && mfY == rVec.mfY ); } - inline sal_Bool operator!=( const Vector2D& rVec ) const { return !( *this == rVec ); } - - inline Vector2D& operator=( const Vector2D& rVec ) { mfX = rVec.mfX, mfY = rVec.mfY; return *this; } - inline Vector2D& operator=( const Pair& rPair ) { mfX = rPair.A(), mfY = rPair.B(); return *this; } - inline Vector2D& operator-=( const Pair& rPair ) { mfX -= rPair.A(), mfY -= rPair.B(); return *this; } - inline Vector2D& operator+=( const Pair& rPair ) { mfX += rPair.A(), mfY += rPair.B(); return *this; } - inline Vector2D& operator*=( const Pair& rPair ) { mfX *= rPair.A(), mfY *= rPair.B(); return *this; } - inline Vector2D& operator/=( const Pair& rPair ) { mfX /= rPair.A(), mfY /= rPair.B(); return *this; } - - inline sal_Bool operator==( const Pair& rPair ) const { return( mfX == rPair.A() && mfY == rPair.B() ); } - inline sal_Bool operator!=( const Pair& rPair ) const { return !( *this == rPair ); } - - inline sal_Bool IsPositive( Vector2D& rVec ) const { return( ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0 ); } - inline sal_Bool IsNegative( Vector2D& rVec ) const { return !IsPositive( rVec ); } -}; - -inline Vector2D& Vector2D::Normalize() -{ - double fLen = Scalar( *this ); - - if( ( fLen != 0.0 ) && ( fLen != 1.0 ) && ( ( fLen = sqrt( fLen ) ) != 0.0 ) ) - mfX /= fLen, mfY /= fLen; - - return *this; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/weakbase.h b/tools/inc/tools/weakbase.h deleted file mode 100644 index a4ce1d0962e8..000000000000 --- a/tools/inc/tools/weakbase.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_WEAKBASE_H_ -#define _TOOLS_WEAKBASE_H_ - -#include <sal/types.h> -#include <osl/diagnose.h> - -/** the template classes in this header are helper to implement weak references - to implementation objects that are not refcounted. - - THIS IS NOT THREADSAFE - - Use this only to have 'safe' pointers to implementation objects that you - don't own but that you reference with a pointer. - - Example: - - class ImplClass : public tools::WeakBase< ImplClass > - { - ~ImplClass() { clearWeek(); } // not needed but safer, see method description - ... - }; - - class UserClass - { - tools::WeakReference< ImplClass > mxWeakRef; - - UserClass( ImplClass* pOjbect ) : mxWeakRef( pObject ) {} - - DoSomething() - { - if( mxWeakRef.is() ) - mxWeakRef->DoSomethingMore(); - } - }; -*/ -namespace tools -{ - -/** private connection helper, do not use directly */ -template <class reference_type> -struct WeakConnection -{ - sal_Int32 mnRefCount; - reference_type* mpReference; - - WeakConnection( reference_type* pReference ) : mnRefCount( 0 ), mpReference( pReference ) {}; - void acquire() { mnRefCount++; } - void release() { mnRefCount--; if( mnRefCount == 0 ) delete this; } -}; - -/** template implementation to hold a weak reference to an instance of type reference_type */ -template <class reference_type> -class WeakReference -{ -public: - /** constructs an empty reference */ - inline WeakReference(); - - /** constructs a reference with a pointer to a class derived from WeakBase */ - inline WeakReference( reference_type* pReference ); - - /** constructs a reference with another reference */ - inline WeakReference( const WeakReference< reference_type >& rWeakRef ); - - inline ~WeakReference(); - - /** returns true if the reference object is not null and still alive */ - inline bool is() const; - - /** returns the pointer to the reference object or null */ - inline reference_type * get() const; - - /** sets this reference to the given object or null */ - inline void reset( reference_type* pReference ); - - /** returns the pointer to the reference object or null */ - inline reference_type * operator->() const; - - /** returns true if this instance references pReferenceObject */ - inline sal_Bool operator== (const reference_type * pReferenceObject) const; - - /** returns true if this instance and the given weakref reference the same object */ - inline sal_Bool operator== (const WeakReference<reference_type> & handle) const; - - /** only needed for using this class with stl containers */ - inline sal_Bool operator!= (const WeakReference<reference_type> & handle) const; - - /** only needed for using this class with stl containers */ - inline sal_Bool operator< (const WeakReference<reference_type> & handle) const; - - /** only needed for using this class with stl containers */ - inline sal_Bool operator> (const WeakReference<reference_type> & handle) const; - - /** the assignment operator */ - inline WeakReference<reference_type>& operator= (const WeakReference<reference_type> & handle); - -private: - WeakConnection< reference_type >* mpWeakConnection; -}; - -/** derive your implementation classes from this class if you want them to support weak references */ -template <class reference_type> -class WeakBase -{ - friend class WeakReference<reference_type>; - -public: - inline WeakBase(); - - inline ~WeakBase(); - /** clears the reference pointer in all living weak references for this instance. - Further created weak references will also be invalid. - You should call this method in the d'tor of your derived classes for an early - invalidate of all living weak references while youre object is already inside - it d'tor. - */ - inline void clearWeak(); - -private: - inline WeakConnection< reference_type >* getWeakConnection(); - WeakConnection< reference_type >* mpWeakConnection; -}; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/weakbase.hxx b/tools/inc/tools/weakbase.hxx deleted file mode 100644 index 08e85e17d69b..000000000000 --- a/tools/inc/tools/weakbase.hxx +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _TOOLS_WEAKBASE_HXX_ -#define _TOOLS_WEAKBASE_HXX_ - -#include <tools/weakbase.h> - -/// see weakbase.h for documentation - -namespace tools -{ - -template< class reference_type > -inline WeakReference< reference_type >::WeakReference() -{ - mpWeakConnection = new WeakConnection<reference_type>( 0 ); - mpWeakConnection->acquire(); -} - -template< class reference_type > -inline WeakReference< reference_type >::WeakReference( reference_type* pReference ) -{ - if( pReference ) - mpWeakConnection = pReference->getWeakConnection(); - else - mpWeakConnection = new WeakConnection<reference_type>( 0 ); - - mpWeakConnection->acquire(); -} - -template< class reference_type > -inline WeakReference< reference_type >::WeakReference( const WeakReference< reference_type >& rWeakRef ) -{ - mpWeakConnection = rWeakRef.mpWeakConnection; - mpWeakConnection->acquire(); -} - -template< class reference_type > -inline WeakReference< reference_type >::~WeakReference() -{ - mpWeakConnection->release(); -} - -template< class reference_type > -inline bool WeakReference< reference_type >::is() const -{ - return mpWeakConnection->mpReference != 0; -} - -template< class reference_type > -inline reference_type * WeakReference< reference_type >::get() const -{ - return mpWeakConnection->mpReference; -} - -template< class reference_type > -inline void WeakReference< reference_type >::reset( reference_type* pReference ) -{ - mpWeakConnection->release(); - - if( pReference ) - mpWeakConnection = pReference->getWeakConnection(); - else - mpWeakConnection = new WeakConnection<reference_type>( 0 ); - - mpWeakConnection->acquire(); -} - -template< class reference_type > -inline reference_type * WeakReference< reference_type >::operator->() const -{ - OSL_PRECOND(mpWeakConnection, "tools::WeakReference::operator->() : null body"); - return mpWeakConnection->mpReference; -} - -template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const -{ - return mpWeakConnection->mpReference == pReferenceObject; -} - -template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator==(const WeakReference<reference_type> & handle) const -{ - return mpWeakConnection == handle.mpWeakConnection; -} - -template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator!=(const WeakReference<reference_type> & handle) const -{ - return mpWeakConnection != handle.mpWeakConnection; -} - -template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator<(const WeakReference<reference_type> & handle) const -{ - return mpWeakConnection->mpReference < handle.mpWeakConnection->mpReference; -} - -template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator>(const WeakReference<reference_type> & handle) const -{ - return mpWeakConnection->mpReference > handle.mpWeakConnection->mpReference; -} - -template< class reference_type > -inline WeakReference<reference_type>& WeakReference<reference_type>::operator= ( - const WeakReference<reference_type>& rReference) -{ - if (&rReference != this) - { - mpWeakConnection->release(); - - mpWeakConnection = rReference.mpWeakConnection; - mpWeakConnection->acquire(); - } - return *this; -} - -template< class reference_type > -inline WeakBase< reference_type >::WeakBase() -{ - mpWeakConnection = 0; -} - -template< class reference_type > -inline WeakBase< reference_type >::~WeakBase() -{ - if( mpWeakConnection ) - { - mpWeakConnection->mpReference = 0; - mpWeakConnection->release(); - mpWeakConnection = 0; - } -} - -template< class reference_type > -inline void WeakBase< reference_type >::clearWeak() -{ - if( mpWeakConnection ) - mpWeakConnection->mpReference = 0; -} - -template< class reference_type > -inline WeakConnection< reference_type >* WeakBase< reference_type >::getWeakConnection() -{ - if( !mpWeakConnection ) - { - mpWeakConnection = new WeakConnection< reference_type >( static_cast< reference_type* >( this ) ); - mpWeakConnection->acquire(); - } - return mpWeakConnection; -} - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx deleted file mode 100644 index acd1162ac4e3..000000000000 --- a/tools/inc/tools/wintypes.hxx +++ /dev/null @@ -1,325 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _TOOLS_WINTYPES_HXX -#define _TOOLS_WINTYPES_HXX - -#include <tools/solar.h> -#include <sal/types.h> - -// Window-Types - -typedef sal_uInt16 WindowType; -#define WINDOW_BASE 0x0100 -#define WINDOW_FIRST (WINDOW_BASE + 0x30) -#define WINDOW_MESSBOX (WINDOW_FIRST) -#define WINDOW_INFOBOX (WINDOW_FIRST + 0x01) -#define WINDOW_WARNINGBOX (WINDOW_FIRST + 0x02) -#define WINDOW_ERRORBOX (WINDOW_FIRST + 0x03) -#define WINDOW_QUERYBOX (WINDOW_FIRST + 0x04) -#define WINDOW_WINDOW (WINDOW_FIRST + 0x05) -#define WINDOW_SYSWINDOW (WINDOW_FIRST + 0x06) -#define WINDOW_WORKWINDOW (WINDOW_FIRST + 0x07) -#define WINDOW_CONTAINER (WINDOW_FIRST + 0x08) -#define WINDOW_FLOATINGWINDOW (WINDOW_FIRST + 0x09) -#define WINDOW_DIALOG (WINDOW_FIRST + 0x0a) -#define WINDOW_MODELESSDIALOG (WINDOW_FIRST + 0x0b) -#define WINDOW_MODALDIALOG (WINDOW_FIRST + 0x0c) -#define WINDOW_SYSTEMDIALOG (WINDOW_FIRST + 0x0d) -#define WINDOW_PATHDIALOG (WINDOW_FIRST + 0x0e) -#define WINDOW_FILEDIALOG (WINDOW_FIRST + 0x0f) -#define WINDOW_PRINTERSETUPDIALOG (WINDOW_FIRST + 0x10) -#define WINDOW_PRINTDIALOG (WINDOW_FIRST + 0x11) -#define WINDOW_COLORDIALOG (WINDOW_FIRST + 0x12) -#define WINDOW_FONTDIALOG (WINDOW_FIRST + 0x13) -#define WINDOW_CONTROL (WINDOW_FIRST + 0x14) -#define WINDOW_BUTTON (WINDOW_FIRST + 0x15) -#define WINDOW_PUSHBUTTON (WINDOW_FIRST + 0x16) -#define WINDOW_OKBUTTON (WINDOW_FIRST + 0x17) -#define WINDOW_CANCELBUTTON (WINDOW_FIRST + 0x18) -#define WINDOW_HELPBUTTON (WINDOW_FIRST + 0x19) -#define WINDOW_IMAGEBUTTON (WINDOW_FIRST + 0x1a) -#define WINDOW_MENUBUTTON (WINDOW_FIRST + 0x1b) -#define WINDOW_MOREBUTTON (WINDOW_FIRST + 0x1c) -#define WINDOW_SPINBUTTON (WINDOW_FIRST + 0x1d) -#define WINDOW_RADIOBUTTON (WINDOW_FIRST + 0x1e) -#define WINDOW_IMAGERADIOBUTTON (WINDOW_FIRST + 0x1f) -#define WINDOW_CHECKBOX (WINDOW_FIRST + 0x20) -#define WINDOW_TRISTATEBOX (WINDOW_FIRST + 0x21) -#define WINDOW_EDIT (WINDOW_FIRST + 0x22) -#define WINDOW_MULTILINEEDIT (WINDOW_FIRST + 0x23) -#define WINDOW_COMBOBOX (WINDOW_FIRST + 0x24) -#define WINDOW_LISTBOX (WINDOW_FIRST + 0x25) -#define WINDOW_MULTILISTBOX (WINDOW_FIRST + 0x26) -#define WINDOW_FIXEDTEXT (WINDOW_FIRST + 0x27) -#define WINDOW_FIXEDLINE (WINDOW_FIRST + 0x28) -#define WINDOW_FIXEDBITMAP (WINDOW_FIRST + 0x29) -#define WINDOW_FIXEDIMAGE (WINDOW_FIRST + 0x2a) -#define WINDOW_GROUPBOX (WINDOW_FIRST + 0x2c) -#define WINDOW_SCROLLBAR (WINDOW_FIRST + 0x2d) -#define WINDOW_SCROLLBARBOX (WINDOW_FIRST + 0x2e) -#define WINDOW_SPLITTER (WINDOW_FIRST + 0x2f) -#define WINDOW_SPLITWINDOW (WINDOW_FIRST + 0x30) -#define WINDOW_SPINFIELD (WINDOW_FIRST + 0x31) -#define WINDOW_PATTERNFIELD (WINDOW_FIRST + 0x32) -#define WINDOW_NUMERICFIELD (WINDOW_FIRST + 0x33) -#define WINDOW_METRICFIELD (WINDOW_FIRST + 0x34) -#define WINDOW_CURRENCYFIELD (WINDOW_FIRST + 0x35) -#define WINDOW_DATEFIELD (WINDOW_FIRST + 0x36) -#define WINDOW_TIMEFIELD (WINDOW_FIRST + 0x37) -#define WINDOW_PATTERNBOX (WINDOW_FIRST + 0x38) -#define WINDOW_NUMERICBOX (WINDOW_FIRST + 0x39) -#define WINDOW_METRICBOX (WINDOW_FIRST + 0x3a) -#define WINDOW_CURRENCYBOX (WINDOW_FIRST + 0x3b) -#define WINDOW_DATEBOX (WINDOW_FIRST + 0x3c) -#define WINDOW_TIMEBOX (WINDOW_FIRST + 0x3d) -#define WINDOW_LONGCURRENCYFIELD (WINDOW_FIRST + 0x3e) -#define WINDOW_LONGCURRENCYBOX (WINDOW_FIRST + 0x3f) -#define WINDOW_SCROLLWINDOW (WINDOW_FIRST + 0x40) -#define WINDOW_TOOLBOX (WINDOW_FIRST + 0x41) -#define WINDOW_DOCKINGWINDOW (WINDOW_FIRST + 0x42) -#define WINDOW_STATUSBAR (WINDOW_FIRST + 0x43) -#define WINDOW_TABPAGE (WINDOW_FIRST + 0x44) -#define WINDOW_TABCONTROL (WINDOW_FIRST + 0x45) -#define WINDOW_TABDIALOG (WINDOW_FIRST + 0x46) -#define WINDOW_BORDERWINDOW (WINDOW_FIRST + 0x47) -#define WINDOW_BUTTONDIALOG (WINDOW_FIRST + 0x48) -#define WINDOW_SYSTEMCHILDWINDOW (WINDOW_FIRST + 0x49) -#define WINDOW_SLIDER (WINDOW_FIRST + 0x4a) -#define WINDOW_MENUBARWINDOW (WINDOW_FIRST + 0x4b) -#define WINDOW_TREELISTBOX (WINDOW_FIRST + 0x4c) -#define WINDOW_HELPTEXTWINDOW (WINDOW_FIRST + 0x4d) -#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4e) -#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x4f) -#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x50) -#define WINDOW_RULER (WINDOW_FIRST + 0x51) -#define WINDOW_CALCINPUTLINE (WINDOW_FIRST + 0x52) -#define WINDOW_LAST (WINDOW_CALCINPUTLINE) - -// Window-Bits - -typedef sal_Int64 WinBits; - -// Window-Bits for Window -#define WB_CLIPCHILDREN ((WinBits)0x00000001) -#define WB_DIALOGCONTROL ((WinBits)0x00000002) -#define WB_NODIALOGCONTROL ((WinBits)0x00000004) -#define WB_BORDER ((WinBits)0x00000008) -#define WB_NOBORDER ((WinBits)0x00000010) -#define WB_SIZEABLE ((WinBits)0x00000020) -#define WB_3DLOOK ((WinBits)0x00000040) -#define WB_AUTOSIZE ((WinBits)0x00000080) - -// Window-Bits for SystemWindows -#define WB_MOVEABLE ((WinBits)0x00000100) -#define WB_ROLLABLE ((WinBits)0x00000200) -#define WB_CLOSEABLE ((WinBits)0x00000400) -#define WB_STANDALONE ((WinBits)0x00000800) -#define WB_APP ((WinBits)0x00001000) -#define WB_PINABLE ((WinBits)0x00002000) -#define WB_SYSTEMWINDOW ((WinBits)SAL_CONST_INT64(0x40000000)) -// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class -// -// the SystemChildWindow class was there first and is a very specialized -// sytem child window type for plugged applications. The SystemChildWindow class -// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit -// -// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows -// which should be created as system child windows with (more or less) -// normal event handling -#define WB_SYSTEMCHILDWINDOW ((WinBits)SAL_CONST_INT64(0x8000000000)) -#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) - -// Standard-Window-Bits for ChildWindows -#define WB_TABSTOP ((WinBits)0x00000100) -#define WB_NOTABSTOP ((WinBits)0x00000200) -#define WB_GROUP ((WinBits)0x00000400) -#define WB_NOGROUP ((WinBits)0x00000800) -#define WB_HORZ ((WinBits)0x00001000) -#define WB_VERT ((WinBits)0x00002000) -#define WB_LEFT ((WinBits)0x00004000) -#define WB_CENTER ((WinBits)0x00008000) -#define WB_RIGHT ((WinBits)0x00010000) -#define WB_TOP ((WinBits)0x00020000) -#define WB_VCENTER ((WinBits)0x00040000) -#define WB_BOTTOM ((WinBits)0x00080000) -#define WB_DRAG ((WinBits)0x00100000) -#define WB_SPIN ((WinBits)0x00200000) -#define WB_REPEAT ((WinBits)0x00400000) -#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) -#define WB_WORDBREAK ((WinBits)0x01000000) -#define WB_NOLABEL ((WinBits)0x02000000) -#define WB_SORT ((WinBits)0x04000000) -#define WB_DROPDOWN ((WinBits)0x08000000) -#define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) -#define WB_AUTOHSCROLL ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DOCKABLE ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_AUTOVSCROLL ((WinBits)SAL_CONST_INT64(0x40000000)) -#define WB_HYPHENATION (((WinBits)SAL_CONST_INT64(0x800000000)) | WB_WORDBREAK) -#define WB_CHILDDLGCTRL ((WinBits)SAL_CONST_INT64(0x100000000000)) -#define WB_REFMODE ((WinBits)SAL_CONST_INT64(0x200000000000)) - -// system floating window -#define WB_SYSTEMFLOATWIN ((WinBits)SAL_CONST_INT64(0x100000000)) -#define WB_INTROWIN ((WinBits)SAL_CONST_INT64(0x200000000)) -#define WB_NOSHADOW ((WinBits)SAL_CONST_INT64(0x400000000)) -#define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) -#define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) -#define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) -#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_POPUP ((WinBits)SAL_CONST_INT64(0x20000000)) - -#define WB_HSCROLL WB_HORZ -#define WB_VSCROLL WB_VERT -#define WB_TOPIMAGE WB_TOP - -// Window-Bits for PushButtons -#define WB_DEFBUTTON ((WinBits)0x10000000) -#define WB_NOLIGHTBORDER ((WinBits)0x20000000) -#define WB_RECTSTYLE ((WinBits)0x08000000) -#define WB_SMALLSTYLE ((WinBits)0x04000000) -#define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) -#define WB_FLATBUTTON ((WinBits)SAL_CONST_INT64(0x4000000000)) - -// Window-Bits for FixedText -#define WB_PATHELLIPSIS ((WinBits)0x00100000) -#define WB_EXTRAOFFSET ((WinBits)0x02000000) -#define WB_NOMULTILINE ((WinBits)0x10000000) -#define WB_INFO ((WinBits)0x20000000) - -// Window-Bits for CheckBox -#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) -#define WB_EARLYTOGGLE ((WinBits)SAL_CONST_INT64(0x4000000000)) - -// Window-Bits for Edit -#define WB_PASSWORD ((WinBits)0x01000000) -#define WB_READONLY ((WinBits)0x02000000) -#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_FORCECTRLBACKGROUND ((WinBits)0x80000000) - -// Window-Bits for MultiLineEdit -#define WB_IGNORETAB ((WinBits)0x20000000) - -// Window-Bits for ListBox and MultiListBox -#define WB_SIMPLEMODE ((WinBits)0x20000000) - -// Window-Bits for FixedBitmap -#define WB_FAST ((WinBits)0x04000000) -#define WB_SCALE ((WinBits)0x08000000) -#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) - -// Window-Bits for ToolBox -#define WB_LINESPACING ((WinBits)0x01000000) -#define WB_SCROLL ((WinBits)0x02000000) -#define WB_FORCETABCYCLE ((WinBits)0x04000000) - -// Window-Bits for DockingWindows -#define WB_DOCKBORDER ((WinBits)0x00001000) - -// Window-Bits for SplitWindow -#define WB_NOSPLITDRAW ((WinBits)0x01000000) -#define WB_FLATSPLITDRAW ((WinBits)0x02000000) - -// Window-Bits for MessageBoxen -#define WB_OK ((WinBits)0x00100000) -#define WB_OK_CANCEL ((WinBits)0x00200000) -#define WB_YES_NO ((WinBits)0x00400000) -#define WB_YES_NO_CANCEL ((WinBits)0x00800000) -#define WB_RETRY_CANCEL ((WinBits)0x01000000) -#define WB_DEF_OK ((WinBits)0x02000000) -#define WB_DEF_CANCEL ((WinBits)0x04000000) -#define WB_DEF_RETRY ((WinBits)0x08000000) -#define WB_DEF_YES ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DEF_NO ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Standard-WinBits -#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) -#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) -#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDMODELESS (WB_STDDIALOG) -#define WB_STDMODAL (WB_STDDIALOG) -#define WB_STDTABDIALOG (WB_STDDIALOG) -#define WB_STDTABCONTROL 0 -#define WB_STDPOPUP (WB_BORDER | WB_POPUP | WB_SYSTEMWINDOW | WB_3DLOOK | WB_DIALOGCONTROL) - -// For TreeListBox -#define WB_HASBUTTONS ((WinBits)SAL_CONST_INT64(0x000100000000)) -#define WB_HASLINES ((WinBits)SAL_CONST_INT64(0x000200000000)) -#define WB_HASLINESATROOT ((WinBits)SAL_CONST_INT64(0x000400000000)) -#define WB_HASBUTTONSATROOT ((WinBits)SAL_CONST_INT64(0x000800000000)) -#define WB_NOINITIALSELECTION ((WinBits)SAL_CONST_INT64(0x001000000000)) -#define WB_HIDESELECTION ((WinBits)SAL_CONST_INT64(0x002000000000)) -#define WB_FORCE_MAKEVISIBLE ((WinBits)SAL_CONST_INT64(0x004000000000)) -// DO NOT USE: 0x008000000000, that's WB_SYSTEMCHILDWINDOW -#define WB_QUICK_SEARCH ((WinBits)SAL_CONST_INT64(0x010000000000)) - -// For FileOpen Dialog -#define WB_PATH ((WinBits)0x00100000) -#define WB_OPEN ((WinBits)0x00200000) -#define WB_SAVEAS ((WinBits)0x00400000) - -// For Slider -// Window-Bits for TabControl -#define WB_SLIDERSET ((WinBits)0x02000000) - -// extended WinBits -#define WB_EXT_DOCUMENT ((WinBits)0x00000001) -#define WB_EXT_DOCMODIFIED ((WinBits)0x00000002) - -// WindowAlign - -enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; -enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM, - IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT, - IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM, - IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER }; -enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT }; - -// TriState - -enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; - - -// ButtonDialog-Types - -typedef sal_uInt16 StandardButtonType; -#define BUTTON_OK ((StandardButtonType)0) -#define BUTTON_CANCEL ((StandardButtonType)1) -#define BUTTON_YES ((StandardButtonType)2) -#define BUTTON_NO ((StandardButtonType)3) -#define BUTTON_RETRY ((StandardButtonType)4) -#define BUTTON_HELP ((StandardButtonType)5) -#define BUTTON_CLOSE ((StandardButtonType)6) -#define BUTTON_MORE ((StandardButtonType)7) -#define BUTTON_IGNORE ((StandardButtonType)8) -#define BUTTON_ABORT ((StandardButtonType)9) -#define BUTTON_LESS ((StandardButtonType)10) -#define BUTTON_RESET ((StandardButtonType)11) -#define BUTTON_COUNT 12 - -// prominent place for ListBox window types - -enum ProminentEntry { PROMINENT_TOP, PROMINENT_MIDDLE }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/wldcrd.hxx b/tools/inc/tools/wldcrd.hxx deleted file mode 100644 index 8991b8882474..000000000000 --- a/tools/inc/tools/wldcrd.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _WLDCRD_HXX -#define _WLDCRD_HXX - -#include "tools/toolsdllapi.h" -#include <tools/string.hxx> -#include <osl/thread.h> - -class TOOLS_DLLPUBLIC WildCard -{ -private: - OString aWildString; - char cSepSymbol; - - sal_uInt16 ImpMatch( const char *pWild, const char *pStr ) const; - -public: - WildCard() - : aWildString('*') - , cSepSymbol('\0') - { - } - - WildCard(const OUString& rWildCard, const char cSeparator = '\0') - : aWildString(OUStringToOString(rWildCard, osl_getThreadTextEncoding())) - , cSepSymbol(cSeparator) - { - } - - const OUString getGlob() const - { - return OStringToOUString(aWildString, osl_getThreadTextEncoding()); - } - - void setGlob(const OUString& rString) - { - aWildString = OUStringToOString(rString, osl_getThreadTextEncoding()); - } - - sal_Bool Matches( const String& rStr ) const; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/zcodec.hxx b/tools/inc/tools/zcodec.hxx deleted file mode 100644 index 185cb1d9ecb0..000000000000 --- a/tools/inc/tools/zcodec.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _ZCODEC_HXX -#define _ZCODEC_HXX - -#include "tools/toolsdllapi.h" -#include <tools/solar.h> - -// Defines - -#define DEFAULT_IN_BUFSIZE (0x00008000UL) -#define DEFAULT_OUT_BUFSIZE (0x00008000UL) - -#define MAX_MEM_USAGE 8 - -// memory requirement using compress: -// [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9) -// memory requirement using decompress: -// [ INBUFFER ] + [ OUTBUFFER ] + 32KB - -#define ZCODEC_NO_COMPRESSION (0x00000000UL) -#define ZCODEC_BEST_SPEED (0x00000001UL) -#define ZCODEC_DEFAULT_COMPRESSION (0x00000006UL) -#define ZCODEC_BEST_COMPRESSION (0x00000009UL) - -#define ZCODEC_DEFAULT_STRATEGY (0x00000000UL) -#define ZCODEC_ZFILTERED (0x00000100UL) -#define ZCODEC_ZHUFFMAN_ONLY (0x00000200UL) - -#define ZCODEC_UPDATE_CRC (0x00010000UL) -#define ZCODEC_GZ_LIB (0x00020000UL) - -#define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_DEFAULT_STRATEGY | ZCODEC_UPDATE_CRC ) -#define ZCODEC_DEFAULT ( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_DEFAULT_STRATEGY ) - -class SvStream; - -class TOOLS_DLLPUBLIC ZCodec -{ -private: - sal_uIntPtr mbInit; - sal_Bool mbStatus; - sal_Bool mbFinish; - sal_uIntPtr mnMemUsage; - SvStream* mpIStm; - sal_uInt8* mpInBuf; - sal_uIntPtr mnInBufSize; - sal_uIntPtr mnInToRead; - SvStream* mpOStm; - sal_uInt8* mpOutBuf; - sal_uIntPtr mnOutBufSize; - - sal_uIntPtr mnCRC; - sal_uIntPtr mnCompressMethod; - void* mpsC_Stream; - - void ImplInitBuf( sal_Bool nIOFlag ); - void ImplWriteBack( void ); - -public: - ZCodec( sal_uIntPtr nInBuf, sal_uIntPtr nOutBuf, sal_uIntPtr nMemUsage = MAX_MEM_USAGE ); - ZCodec( void ); - virtual ~ZCodec(); - - virtual void BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT ); - virtual long EndCompression(); - sal_Bool IsFinished () const { return mbFinish; } - - long Compress( SvStream& rIStm, SvStream& rOStm ); - long Decompress( SvStream& rIStm, SvStream& rOStm ); - - long Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize ); - long Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize ); - long ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize ); - - void SetBreak( sal_uIntPtr ); - sal_uIntPtr GetBreak( void ); - void SetCRC( sal_uIntPtr nCurrentCRC ); - sal_uIntPtr UpdateCRC( sal_uIntPtr nLatestCRC, sal_uInt8* pSource, long nDatSize ); - sal_uIntPtr GetCRC(); -}; - -class GZCodec : public ZCodec -{ -public: - GZCodec(){}; - ~GZCodec(){}; - virtual void BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |