diff options
607 files changed, 4043 insertions, 30907 deletions
diff --git a/.gitignore b/.gitignore index 25df1065c1ec..9ea0cd6ebaf0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,18 @@ # backup and temporary files *~ .*.sw[op] +.gitattributes # the build directories /*/unxlng?? /*/unxlng??.pro /*/wntmsc??? /*/wntmsc???.pro +/*/wntgcc? +/*/wntgcc?.pro /*/unxmac?? /*/unxmac??.pro +/*/unxios? +/*/unxios?.pro +/*/unxand? +/*/unxand?.pro diff --git a/basebmp/test/bmpdemo.cxx b/basebmp/test/bmpdemo.cxx index ab260655d968..effce214bb2f 100644 --- a/basebmp/test/bmpdemo.cxx +++ b/basebmp/test/bmpdemo.cxx @@ -1189,8 +1189,7 @@ void TestWindow::Paint( const Rectangle& /*rRect*/ ) // Fill bitmap with generated content { - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), - aBitmap ); + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); for( int y=0; y<aTestSize.getY(); ++y ) for( int x=0; x<aTestSize.getX(); ++x ) pWriteAccess->SetPixel(y,x, diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 4fdc39bb6fd4..cdb4ccef5d52 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -60,13 +60,6 @@ CDEFS+=-xalias_level=compatible .ENDIF .ENDIF -#building with stlport, but cppunit was not built with stlport -.IF "$(USE_SYSTEM_STL)"!="YES" -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGSCXX+=-DADAPT_EXT_STL -.ENDIF -.ENDIF - CFLAGSCXX += $(CPPUNIT_CFLAGS) # --- Common ---------------------------------------------------------- diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 928902090b66..a7524ddcf5fe 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -168,8 +168,8 @@ public: for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); - aStart++; - aEnd--; + ++aStart; + --aEnd; } } } @@ -210,7 +210,7 @@ public: CoordinateData2DVector::iterator aStart(maVector.begin()); CoordinateData2DVector::iterator aEnd(maVector.end()); - for(; aStart != aEnd; aStart++) + for(; aStart != aEnd; ++aStart) { aStart->transform(rMatrix); } @@ -317,7 +317,7 @@ public: aEnd += nCount; maVector.reserve(nCount); - for(; aStart != aEnd; aStart++) + for(; aStart != aEnd; ++aStart) { if(!aStart->getPrevVector().equalZero()) mnUsedVectors++; @@ -449,7 +449,7 @@ public: ControlVectorPair2DVector::const_iterator aEnd(rSource.maVector.end()); maVector.insert(aIndex, aStart, aEnd); - for(; aStart != aEnd; aStart++) + for(; aStart != aEnd; ++aStart) { if(!aStart->getPrevVector().equalZero()) mnUsedVectors++; @@ -468,7 +468,7 @@ public: const ControlVectorPair2DVector::iterator aDeleteEnd(aDeleteStart + nCount); ControlVectorPair2DVector::const_iterator aStart(aDeleteStart); - for(; mnUsedVectors && aStart != aDeleteEnd; aStart++) + for(; mnUsedVectors && aStart != aDeleteEnd; ++aStart) { if(!aStart->getPrevVector().equalZero()) mnUsedVectors--; @@ -501,8 +501,8 @@ public: // swap entries ::std::swap(*aStart, *aEnd); - aStart++; - aEnd--; + ++aStart; + --aEnd; } if(aStart == aEnd) diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index af337a5bcc75..4c8ab7b44a45 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -105,7 +105,7 @@ public: for(sal_uInt32 a(0L); a < nCount; a++) { aIndex = maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a)); - aIndex++; + ++aIndex; } } } diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index b6dad1e917fa..1b15b953e29e 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -933,7 +933,7 @@ namespace basegfx // first step: prepareForPolygonOperation and simple merge of non-overlapping // PolyPolygons for speedup; this is possible for the wanted OR-operation - if(aInput.size()) + if(!aInput.empty()) { std::vector< basegfx::B2DPolyPolygon > aResult; aResult.reserve(aInput.size()); @@ -942,7 +942,7 @@ namespace basegfx { const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a])); - if(aResult.size()) + if(!aResult.empty()) { const B2DRange aCandidateRange(aCandidate.getB2DRange()); bool bCouldMergeSimple(false); diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx index 019ed0fff970..06d01fc4cc29 100644 --- a/basegfx/source/polygon/b3dpolygon.cxx +++ b/basegfx/source/polygon/b3dpolygon.cxx @@ -242,8 +242,8 @@ public: for(sal_uInt32 a(0); a < nHalfSize; a++) { ::std::swap(*aStart, *aEnd); - aStart++; - aEnd--; + ++aStart; + --aEnd; } } } @@ -253,7 +253,7 @@ public: CoordinateData3DVector::iterator aStart(maVector.begin()); CoordinateData3DVector::iterator aEnd(maVector.end()); - for(; aStart != aEnd; aStart++) + for(; aStart != aEnd; ++aStart) { aStart->transform(rMatrix); } diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 09d8b805f9f5..2c0f30c291a9 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -36,13 +36,6 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -#building with stlport, but cppunit was not built with stlport -.IF "$(USE_SYSTEM_STL)"!="YES" -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGSCXX+=-DADAPT_EXT_STL -.ENDIF -.ENDIF - CFLAGSCXX += $(CPPUNIT_CFLAGS) # --- Common ---------------------------------------------------------- diff --git a/basegfx/util/makefile.mk b/basegfx/util/makefile.mk index 4d5d92ce7551..777f30aba696 100644 --- a/basegfx/util/makefile.mk +++ b/basegfx/util/makefile.mk @@ -52,9 +52,6 @@ LIB1FILES=\ $(SLB)$/raster.lib SHL1TARGET= basegfx$(DLLPOSTFIX) -.IF "$(GUI)" == "OS2" -SHL1TARGET= bgfx -.ENDIF SHL1IMPLIB= ibasegfx SHL1STDLIBS=\ diff --git a/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx b/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx index 9e31473ba589..29c8fb05b38d 100644 --- a/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx +++ b/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx @@ -183,10 +183,7 @@ namespace canvas return ::com::sun::star::uno::makeAny(mxWindow); } -#if defined __SUNPRO_CC - using Base::disposing; -#endif - virtual void SAL_CALL disposing() + virtual void disposeThis() { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); @@ -197,7 +194,7 @@ namespace canvas } // pass on to base class - BaseType::disposing(); + BaseType::disposeThis(); } ::com::sun::star::awt::Rectangle transformBounds( const ::com::sun::star::awt::Rectangle& rBounds ) @@ -234,12 +231,14 @@ namespace canvas } // XWindowListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) + virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); if( Source.Source == mxWindow ) mxWindow.clear(); + + BaseType::disposeEventSource(Source); } virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException) diff --git a/canvas/inc/canvas/base/canvasbase.hxx b/canvas/inc/canvas/base/canvasbase.hxx index 204355da93c3..7afcf9f8aea7 100644 --- a/canvas/inc/canvas/base/canvasbase.hxx +++ b/canvas/inc/canvas/base/canvasbase.hxx @@ -120,17 +120,14 @@ namespace canvas { } -#if defined __SUNPRO_CC - using Base::disposing; -#endif - virtual void SAL_CALL disposing() + virtual void disposeThis() { MutexType aGuard( BaseType::m_aMutex ); maCanvasHelper.disposing(); // pass on to base class - BaseType::disposing(); + BaseType::disposeThis(); } // XCanvas diff --git a/canvas/inc/canvas/base/canvascustomspritebase.hxx b/canvas/inc/canvas/base/canvascustomspritebase.hxx index ec4477ab9cc9..a5c026a74311 100644 --- a/canvas/inc/canvas/base/canvascustomspritebase.hxx +++ b/canvas/inc/canvas/base/canvascustomspritebase.hxx @@ -103,14 +103,14 @@ namespace canvas @derive when overriding this method in derived classes, <em>always</em> call the base class' method! */ - virtual void SAL_CALL disposing() + virtual void disposeThis() { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); maSpriteHelper.disposing(); // pass on to base class - BaseType::disposing(); + BaseType::disposeThis(); } // XCanvas: selectively override base's methods here, for opacity tracking diff --git a/canvas/inc/canvas/base/disambiguationhelper.hxx b/canvas/inc/canvas/base/disambiguationhelper.hxx new file mode 100644 index 000000000000..b58ed29ea289 --- /dev/null +++ b/canvas/inc/canvas/base/disambiguationhelper.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX +#define INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX + +#include <osl/mutex.hxx> + + +/* Definition of the DisambiguationHelper class */ + +namespace canvas +{ + /** Base class, initializing its own baseclass with m_aMutex. + + This is necessary to make the CanvasBase, GraphicDeviceBase, + etc. classes freely combinable - letting them perform this + initialization would prohibit deriving e.g. CanvasBase from + GraphicDeviceBase. + + On top of that, disambiguates XEventListener::disposing and + WeakComponentImplHelper::disposing. + + Having two virtual methods with the same name, and not + overriding them in every derived class, will hide one of + them. Later trying to override the same method, will generate + a new vtable slot, and lead to very hard to spot errors. + */ + template< class Base > class DisambiguationHelper : public Base + { + public: + typedef Base BaseType; + + /** Construct DisambiguationHelper + + This method is the whole purpose of this template: + initializing a base class with the provided m_aMutex + member (the WeakComponentImplHelper templates need that, + as they require the lifetime of the mutex to extend + theirs). + */ + DisambiguationHelper() : + BaseType( m_aMutex ) + { + } + + virtual void SAL_CALL disposing() + { disposeThis(); } + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) + { disposeEventSource(Source); } + + virtual void disposeThis() + {} + virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) + {} + +protected: + mutable ::osl::Mutex m_aMutex; + }; +} + +#endif /* INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/graphicdevicebase.hxx b/canvas/inc/canvas/base/graphicdevicebase.hxx index 62424e4cdabd..b8baee2417b9 100644 --- a/canvas/inc/canvas/base/graphicdevicebase.hxx +++ b/canvas/inc/canvas/base/graphicdevicebase.hxx @@ -95,7 +95,7 @@ namespace canvas @tpl Mutex Lock strategy to use. Defaults to using the - BaseMutexHelper-provided lock. Everytime one of the methods is + DisambiguationHelper-provided lock. Everytime one of the methods is entered, an object of type Mutex is created with m_aMutex as the sole parameter, and destroyed again when the method scope is left. @@ -144,17 +144,14 @@ namespace canvas _1))); } -#if defined __SUNPRO_CC - using Base::disposing; -#endif - virtual void SAL_CALL disposing() + virtual void disposeThis() { MutexType aGuard( BaseType::m_aMutex ); maDeviceHelper.disposing(); // pass on to base class - cppu::WeakComponentImplHelperBase::disposing(); + BaseType::disposeThis(); } // XGraphicDevice diff --git a/canvas/inc/canvas/base/spritecanvasbase.hxx b/canvas/inc/canvas/base/spritecanvasbase.hxx index 1cf255fe5579..47134abfc2d5 100644 --- a/canvas/inc/canvas/base/spritecanvasbase.hxx +++ b/canvas/inc/canvas/base/spritecanvasbase.hxx @@ -86,17 +86,14 @@ namespace canvas { } -#if defined __SUNPRO_CC - using Base::disposing; -#endif - virtual void SAL_CALL disposing() + virtual void disposeThis() { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); maRedrawManager.disposing(); // pass on to base class - BaseType::disposing(); + BaseType::disposeThis(); } // XSpriteCanvas diff --git a/canvas/source/cairo/cairo_canvas.cxx b/canvas/source/cairo/cairo_canvas.cxx index 9903dade4863..802006d59110 100644 --- a/canvas/source/cairo/cairo_canvas.cxx +++ b/canvas/source/cairo/cairo_canvas.cxx @@ -131,14 +131,14 @@ namespace cairocanvas OSL_TRACE( "CairoCanvas destroyed" ); } - void SAL_CALL Canvas::disposing() + void Canvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); mxComponentContext.clear(); // forward to parent - CanvasBaseT::disposing(); + CanvasBaseT::disposeThis(); } ::rtl::OUString SAL_CALL Canvas::getServiceName( ) throw (uno::RuntimeException) diff --git a/canvas/source/cairo/cairo_canvas.hxx b/canvas/source/cairo/cairo_canvas.hxx index 02837d03f6b6..aec8713f8fe9 100644 --- a/canvas/source/cairo/cairo_canvas.hxx +++ b/canvas/source/cairo/cairo_canvas.hxx @@ -47,7 +47,7 @@ #include <comphelper/uno3.hxx> #include <canvas/base/spritecanvasbase.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/bufferedgraphicdevicebase.hxx> #include <basegfx/vector/b2isize.hxx> @@ -69,7 +69,7 @@ namespace cairocanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base; - typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >, + typedef ::canvas::GraphicDeviceBase< ::canvas::DisambiguationHelper< GraphicDeviceBase_Base >, DeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > CanvasBase_Base; @@ -122,12 +122,8 @@ namespace cairocanvas /// For resource tracking ~Canvas(); -#if defined __SUNPRO_CC - using CanvasBaseT::disposing; -#endif - /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx index 33ee53ffcf2a..63761b848af8 100644 --- a/canvas/source/cairo/cairo_canvasbitmap.cxx +++ b/canvas/source/cairo/cairo_canvasbitmap.cxx @@ -102,7 +102,7 @@ namespace cairocanvas maCanvasHelper.clear(); } - void SAL_CALL CanvasBitmap::disposing() + void CanvasBitmap::disposeThis() { mpSurfaceProvider.clear(); @@ -110,7 +110,7 @@ namespace cairocanvas mpBufferSurface.reset(); // forward to parent - CanvasBitmap_Base::disposing(); + CanvasBitmap_Base::disposeThis(); } SurfaceSharedPtr CanvasBitmap::getSurface() diff --git a/canvas/source/cairo/cairo_canvasbitmap.hxx b/canvas/source/cairo/cairo_canvasbitmap.hxx index 532ce8d26b41..1626c9240ff6 100644 --- a/canvas/source/cairo/cairo_canvasbitmap.hxx +++ b/canvas/source/cairo/cairo_canvasbitmap.hxx @@ -58,7 +58,7 @@ namespace cairocanvas ::com::sun::star::lang::XServiceInfo, ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base; class CanvasBitmapSpriteSurface_Base : - public ::canvas::BaseMutexHelper<CanvasBitmapBase_Base>, + public ::canvas::DisambiguationHelper<CanvasBitmapBase_Base>, public SurfaceProvider { }; @@ -87,7 +87,7 @@ namespace cairocanvas bool bHasAlpha ); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/cairo/cairo_canvascustomsprite.cxx b/canvas/source/cairo/cairo_canvascustomsprite.cxx index b78bf44c3313..5c7852c41dec 100644 --- a/canvas/source/cairo/cairo_canvascustomsprite.cxx +++ b/canvas/source/cairo/cairo_canvascustomsprite.cxx @@ -78,7 +78,7 @@ namespace cairocanvas maCanvasHelper.clear(); } - void SAL_CALL CanvasCustomSprite::disposing() + void CanvasCustomSprite::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); @@ -86,7 +86,7 @@ namespace cairocanvas mpBufferSurface.reset(); // forward to parent - CanvasCustomSpriteBaseT::disposing(); + CanvasCustomSpriteBaseT::disposeThis(); } void CanvasCustomSprite::redraw( const CairoSharedPtr& pCairo, diff --git a/canvas/source/cairo/cairo_canvascustomsprite.hxx b/canvas/source/cairo/cairo_canvascustomsprite.hxx index d9b525716690..52dac5233138 100644 --- a/canvas/source/cairo/cairo_canvascustomsprite.hxx +++ b/canvas/source/cairo/cairo_canvascustomsprite.hxx @@ -42,7 +42,7 @@ #include <basegfx/vector/b2isize.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/canvascustomspritebase.hxx> #include "cairo_sprite.hxx" @@ -76,7 +76,7 @@ namespace cairocanvas remain a base class that provides implementation, not to enforce any specific interface on its derivees. */ - class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >, + class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >, public Sprite, public SurfaceProvider { @@ -111,7 +111,7 @@ namespace cairocanvas CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, const SpriteCanvasRef& rRefDevice ); - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx index a04c3e755eba..f55f861d3839 100644 --- a/canvas/source/cairo/cairo_spritecanvas.cxx +++ b/canvas/source/cairo/cairo_spritecanvas.cxx @@ -125,14 +125,14 @@ namespace cairocanvas maArguments.realloc(0); } - void SAL_CALL SpriteCanvas::disposing() + void SpriteCanvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); mxComponentContext.clear(); // forward to parent - SpriteCanvasBaseT::disposing(); + SpriteCanvasBaseT::disposeThis(); } ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException) diff --git a/canvas/source/cairo/cairo_spritecanvas.hxx b/canvas/source/cairo/cairo_spritecanvas.hxx index 54cd3a181cec..b64fd1474c6e 100644 --- a/canvas/source/cairo/cairo_spritecanvas.hxx +++ b/canvas/source/cairo/cairo_spritecanvas.hxx @@ -45,7 +45,7 @@ #include <comphelper/uno3.hxx> #include <canvas/base/spritecanvasbase.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/bufferedgraphicdevicebase.hxx> #include <basegfx/vector/b2isize.hxx> @@ -69,7 +69,7 @@ namespace cairocanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; - typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >, + typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBase_Base; @@ -121,12 +121,8 @@ namespace cairocanvas void initialize(); -#if defined __SUNPRO_CC - using SpriteCanvasBaseT::disposing; -#endif - /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index 956c115f5d9b..c29319b3974e 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -124,14 +124,14 @@ namespace dxcanvas maArguments.realloc(0); } - void SAL_CALL Canvas::disposing() + void Canvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); mxComponentContext.clear(); // forward to parent - CanvasBaseT::disposing(); + CanvasBaseT::disposeThis(); } ::rtl::OUString SAL_CALL Canvas::getServiceName( ) throw (uno::RuntimeException) @@ -201,7 +201,7 @@ namespace dxcanvas maArguments.realloc(0); } - void SAL_CALL BitmapCanvas::disposing() + void BitmapCanvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); @@ -209,7 +209,7 @@ namespace dxcanvas mxComponentContext.clear(); // forward to parent - BitmapCanvasBaseT::disposing(); + BitmapCanvasBaseT::disposeThis(); } ::rtl::OUString SAL_CALL BitmapCanvas::getServiceName( ) throw (uno::RuntimeException) diff --git a/canvas/source/directx/dx_canvas.hxx b/canvas/source/directx/dx_canvas.hxx index 760bd31aa244..32810ede36e5 100644 --- a/canvas/source/directx/dx_canvas.hxx +++ b/canvas/source/directx/dx_canvas.hxx @@ -45,7 +45,7 @@ #include <comphelper/uno3.hxx> #include <canvas/base/integerbitmapbase.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/graphicdevicebase.hxx> #include "dx_bitmapprovider.hxx" @@ -63,7 +63,7 @@ namespace dxcanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base; - typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >, + typedef ::canvas::GraphicDeviceBase< ::canvas::DisambiguationHelper< GraphicDeviceBase1_Base >, DeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > CanvasBase1_Base; @@ -92,7 +92,7 @@ namespace dxcanvas void initialize(); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base @@ -120,7 +120,7 @@ namespace dxcanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base; - typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >, + typedef ::canvas::GraphicDeviceBase< ::canvas::DisambiguationHelper< GraphicDeviceBase2_Base >, DeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > CanvasBase2_Base; @@ -149,7 +149,7 @@ namespace dxcanvas void initialize(); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index ad8680d44db1..7ad5b18800de 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -60,13 +60,13 @@ namespace dxcanvas maCanvasHelper.setTarget( mpBitmap ); } - void SAL_CALL CanvasBitmap::disposing() + void CanvasBitmap::disposeThis() { mpBitmap.reset(); mpDevice.clear(); // forward to parent - CanvasBitmap_Base::disposing(); + CanvasBitmap_Base::disposeThis(); } struct AlphaDIB diff --git a/canvas/source/directx/dx_canvasbitmap.hxx b/canvas/source/directx/dx_canvasbitmap.hxx index b64840ddaded..7a80e2b96796 100644 --- a/canvas/source/directx/dx_canvasbitmap.hxx +++ b/canvas/source/directx/dx_canvasbitmap.hxx @@ -42,7 +42,7 @@ #include <cppuhelper/compbase3.hxx> #include <comphelper/uno3.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/integerbitmapbase.hxx> #include "dx_bitmapprovider.hxx" @@ -60,7 +60,7 @@ namespace dxcanvas ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base; - typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, + typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >, BitmapCanvasHelper, ::osl::MutexGuard, ::cppu::OWeakObject > CanvasBitmap_Base; @@ -80,7 +80,7 @@ namespace dxcanvas const DeviceRef& rDevice ); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx b/canvas/source/directx/dx_canvascustomsprite.cxx index 73334b1698a5..138b2c36dc3c 100644 --- a/canvas/source/directx/dx_canvascustomsprite.cxx +++ b/canvas/source/directx/dx_canvascustomsprite.cxx @@ -83,7 +83,7 @@ namespace dxcanvas maCanvasHelper.clear(); } - void SAL_CALL CanvasCustomSprite::disposing() + void CanvasCustomSprite::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); @@ -91,7 +91,7 @@ namespace dxcanvas mpSpriteCanvas.clear(); // forward to parent - CanvasCustomSpriteBaseT::disposing(); + CanvasCustomSpriteBaseT::disposeThis(); } #define IMPLEMENTATION_NAME "DXCanvas.CanvasCustomSprite" diff --git a/canvas/source/directx/dx_canvascustomsprite.hxx b/canvas/source/directx/dx_canvascustomsprite.hxx index 38b9bd85b2e4..8e6c534683ce 100644 --- a/canvas/source/directx/dx_canvascustomsprite.hxx +++ b/canvas/source/directx/dx_canvascustomsprite.hxx @@ -42,7 +42,7 @@ #include <basegfx/vector/b2isize.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/canvascustomspritebase.hxx> #include "dx_sprite.hxx" @@ -75,7 +75,7 @@ namespace dxcanvas remain a base class that provides implementation, not to enforce any specific interface on its derivees. */ - class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >, + class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >, public Sprite { }; @@ -111,7 +111,7 @@ namespace dxcanvas const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, bool bShowSpriteBounds ); - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/directx/dx_spritecanvas.cxx b/canvas/source/directx/dx_spritecanvas.cxx index 2e2131b44c15..430f4639cb92 100644 --- a/canvas/source/directx/dx_spritecanvas.cxx +++ b/canvas/source/directx/dx_spritecanvas.cxx @@ -126,14 +126,14 @@ namespace dxcanvas maArguments.realloc(0); } - void SAL_CALL SpriteCanvas::disposing() + void SpriteCanvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); mxComponentContext.clear(); // forward to parent - SpriteCanvasBaseT::disposing(); + SpriteCanvasBaseT::disposeThis(); } ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException) diff --git a/canvas/source/directx/dx_spritecanvas.hxx b/canvas/source/directx/dx_spritecanvas.hxx index ec6d3785d536..3b306f23675b 100644 --- a/canvas/source/directx/dx_spritecanvas.hxx +++ b/canvas/source/directx/dx_spritecanvas.hxx @@ -45,7 +45,7 @@ #include <comphelper/uno3.hxx> #include <canvas/base/spritecanvasbase.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/bufferedgraphicdevicebase.hxx> #include "dx_bitmapprovider.hxx" @@ -66,7 +66,7 @@ namespace dxcanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; - typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >, + typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBase_Base; @@ -117,7 +117,7 @@ namespace dxcanvas void initialize(); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index 0801ad81c780..aec1b4307791 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -178,8 +178,7 @@ namespace dxcanvas Bitmap aBitmap( rBmpEx.GetBitmap() ); - ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), - aBitmap ); + Bitmap::ScopedReadAccess pReadAccess( aBitmap ); const sal_Int32 nWidth( aBmpSize.Width() ); const sal_Int32 nHeight( aBmpSize.Height() ); @@ -192,8 +191,7 @@ namespace dxcanvas { Bitmap aAlpha( rBmpEx.GetAlpha().GetBitmap() ); - ScopedBitmapReadAccess pAlphaReadAccess( aAlpha.AcquireReadAccess(), - aAlpha ); + Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha ); // By convention, the access buffer always has // one of the following formats: @@ -335,8 +333,7 @@ namespace dxcanvas { Bitmap aMask( rBmpEx.GetMask() ); - ScopedBitmapReadAccess pMaskReadAccess( aMask.AcquireReadAccess(), - aMask ); + Bitmap::ScopedReadAccess pMaskReadAccess( aMask ); // By convention, the access buffer always has // one of the following formats: diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 516ac006af33..e96f31f5ba7a 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -527,13 +527,13 @@ const ::cppu::ImplementationEntry s_entries [] = { extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sal_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) diff --git a/canvas/source/null/null_canvasbitmap.cxx b/canvas/source/null/null_canvasbitmap.cxx index 473b5c6459d7..92ee7b8094f5 100644 --- a/canvas/source/null/null_canvasbitmap.cxx +++ b/canvas/source/null/null_canvasbitmap.cxx @@ -53,12 +53,12 @@ namespace nullcanvas bHasAlpha ); } - void SAL_CALL CanvasBitmap::disposing() + void CanvasBitmap::disposeThis() { mpDevice.clear(); // forward to parent - CanvasBitmap_Base::disposing(); + CanvasBitmap_Base::disposeThis(); } #define IMPLEMENTATION_NAME "NullCanvas.CanvasBitmap" diff --git a/canvas/source/null/null_canvasbitmap.hxx b/canvas/source/null/null_canvasbitmap.hxx index 65f078dd3507..fa0577c8c02a 100644 --- a/canvas/source/null/null_canvasbitmap.hxx +++ b/canvas/source/null/null_canvasbitmap.hxx @@ -40,6 +40,7 @@ #include <boost/shared_ptr.hpp> #include <canvas/base/integerbitmapbase.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include "null_canvashelper.hxx" #include "null_spritecanvas.hxx" @@ -53,7 +54,7 @@ namespace nullcanvas typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::lang::XServiceInfo > CanvasBitmapBase_Base; - typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, + typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >, CanvasHelper, ::osl::MutexGuard, ::cppu::OWeakObject > CanvasBitmap_Base; @@ -75,7 +76,7 @@ namespace nullcanvas bool bHasAlpha ); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/canvas/source/null/null_canvascustomsprite.cxx b/canvas/source/null/null_canvascustomsprite.cxx index cef8535a5c33..36dbc9a69871 100644 --- a/canvas/source/null/null_canvascustomsprite.cxx +++ b/canvas/source/null/null_canvascustomsprite.cxx @@ -66,14 +66,14 @@ namespace nullcanvas rRefDevice ); } - void SAL_CALL CanvasCustomSprite::disposing() + void CanvasCustomSprite::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); mpSpriteCanvas.clear(); // forward to parent - CanvasCustomSpriteBaseT::disposing(); + CanvasCustomSpriteBaseT::disposeThis(); } void CanvasCustomSprite::redraw() const diff --git a/canvas/source/null/null_canvascustomsprite.hxx b/canvas/source/null/null_canvascustomsprite.hxx index 905f3513dc9e..17aa1f92d9a7 100644 --- a/canvas/source/null/null_canvascustomsprite.hxx +++ b/canvas/source/null/null_canvascustomsprite.hxx @@ -42,7 +42,7 @@ #include <basegfx/vector/b2isize.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/canvascustomspritebase.hxx> #include "sprite.hxx" @@ -75,8 +75,8 @@ namespace nullcanvas remain a base class that provides implementation, not to enforce any specific interface on its derivees. */ - class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >, - public Sprite + class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >, + public Sprite { }; @@ -109,7 +109,7 @@ namespace nullcanvas CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, const SpriteCanvasRef& rRefDevice ); - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/null/null_spritecanvas.cxx b/canvas/source/null/null_spritecanvas.cxx index 82b6144707eb..509e3656f8fa 100644 --- a/canvas/source/null/null_spritecanvas.cxx +++ b/canvas/source/null/null_spritecanvas.cxx @@ -100,14 +100,14 @@ namespace nullcanvas maArguments.realloc(0); } - void SAL_CALL SpriteCanvas::disposing() + void SpriteCanvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); mxComponentContext.clear(); // forward to parent - SpriteCanvasBaseT::disposing(); + SpriteCanvasBaseT::disposeThis(); } ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException) diff --git a/canvas/source/null/null_spritecanvas.hxx b/canvas/source/null/null_spritecanvas.hxx index 67f14b80b062..165d73aa4db4 100644 --- a/canvas/source/null/null_spritecanvas.hxx +++ b/canvas/source/null/null_spritecanvas.hxx @@ -45,7 +45,7 @@ #include <comphelper/uno3.hxx> #include <canvas/base/spritecanvasbase.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/bufferedgraphicdevicebase.hxx> #include "null_spritecanvashelper.hxx" @@ -63,7 +63,7 @@ namespace nullcanvas ::com::sun::star::awt::XWindowListener, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; - typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >, + typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, DeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBase_Base; @@ -114,12 +114,8 @@ namespace nullcanvas void initialize(); -#if defined __SUNPRO_CC - using SpriteCanvasBaseT::disposing; -#endif - /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx index 81ce996015c2..c3dd0c569f89 100644 --- a/canvas/source/vcl/canvas.cxx +++ b/canvas/source/vcl/canvas.cxx @@ -133,14 +133,14 @@ namespace vclcanvas OSL_TRACE( "Canvas destroyed" ); } - void SAL_CALL Canvas::disposing() + void Canvas::disposeThis() { SolarMutexGuard aGuard; mxComponentContext.clear(); // forward to parent - CanvasBaseT::disposing(); + CanvasBaseT::disposeThis(); } ::rtl::OUString SAL_CALL Canvas::getServiceName( ) throw (::com::sun::star::uno::RuntimeException) diff --git a/canvas/source/vcl/canvas.hxx b/canvas/source/vcl/canvas.hxx index 555340970a8f..16d5c5abd5b3 100644 --- a/canvas/source/vcl/canvas.hxx +++ b/canvas/source/vcl/canvas.hxx @@ -43,7 +43,7 @@ #include <cppuhelper/compbase7.hxx> #include <comphelper/uno3.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/integerbitmapbase.hxx> #include <canvas/base/graphicdevicebase.hxx> @@ -64,7 +64,7 @@ namespace vclcanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base; - typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >, + typedef ::canvas::GraphicDeviceBase< ::canvas::DisambiguationHelper< GraphicDeviceBase_Base >, DeviceHelper, tools::LocalGuard, ::cppu::OWeakObject > CanvasBase_Base; @@ -96,12 +96,8 @@ namespace vclcanvas /// For resource tracking ~Canvas(); -#if defined __SUNPRO_CC - using CanvasBaseT::disposing; -#endif - /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/canvas/source/vcl/canvasbitmap.cxx b/canvas/source/vcl/canvasbitmap.cxx index 1f8840afc264..84f5a8db58c3 100644 --- a/canvas/source/vcl/canvasbitmap.cxx +++ b/canvas/source/vcl/canvasbitmap.cxx @@ -82,12 +82,6 @@ namespace vclcanvas maCanvasHelper.init( rBitmap, rDevice, rOutDevProvider ); } - void SAL_CALL CanvasBitmap::disposing() - { - // forward to base - CanvasBitmap_Base::disposing(); - } - #define IMPLEMENTATION_NAME "VCLCanvas.CanvasBitmap" #define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap" diff --git a/canvas/source/vcl/canvasbitmap.hxx b/canvas/source/vcl/canvasbitmap.hxx index a8b20725c629..540b190b76a1 100644 --- a/canvas/source/vcl/canvasbitmap.hxx +++ b/canvas/source/vcl/canvasbitmap.hxx @@ -57,7 +57,7 @@ namespace vclcanvas ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base; - typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, + typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >, CanvasBitmapHelper, tools::LocalGuard, ::cppu::OWeakObject > CanvasBitmap_Base; @@ -87,9 +87,6 @@ namespace vclcanvas ::com::sun::star::rendering::XGraphicDevice& rDevice, const OutDevProviderSharedPtr& rOutDevProvider ); - // overridden because of mpDevice - virtual void SAL_CALL disposing(); - // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index 38dcc9e844e8..2c5a9ff0f220 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -149,9 +149,8 @@ namespace vclcanvas Bitmap aBitmap( mpBackBuffer->getBitmapReference().GetBitmap() ); Bitmap aAlpha( mpBackBuffer->getBitmapReference().GetAlpha().GetBitmap() ); - ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), - aBitmap ); - ScopedBitmapReadAccess pAlphaReadAccess( aAlpha.IsEmpty() ? + Bitmap::ScopedReadAccess pReadAccess( aBitmap ); + Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha.IsEmpty() ? (BitmapReadAccess*)NULL : aAlpha.AcquireReadAccess(), aAlpha ); @@ -229,9 +228,8 @@ namespace vclcanvas // actually changed a pixel { - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), - aBitmap ); - ScopedBitmapWriteAccess pAlphaWriteAccess( aAlpha.IsEmpty() ? + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); + Bitmap::ScopedWriteAccess pAlphaWriteAccess( aAlpha.IsEmpty() ? (BitmapWriteAccess*)NULL : aAlpha.AcquireWriteAccess(), aAlpha ); @@ -471,9 +469,8 @@ namespace vclcanvas // actually changed a pixel { - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), - aBitmap ); - ScopedBitmapWriteAccess pAlphaWriteAccess( aAlpha.IsEmpty() ? + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); + Bitmap::ScopedWriteAccess pAlphaWriteAccess( aAlpha.IsEmpty() ? (BitmapWriteAccess*)NULL : aAlpha.AcquireWriteAccess(), aAlpha ); @@ -525,9 +522,8 @@ namespace vclcanvas Bitmap aBitmap( mpBackBuffer->getBitmapReference().GetBitmap() ); Bitmap aAlpha( mpBackBuffer->getBitmapReference().GetAlpha().GetBitmap() ); - ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), - aBitmap ); - ScopedBitmapReadAccess pAlphaReadAccess( aAlpha.IsEmpty() ? + Bitmap::ScopedReadAccess pReadAccess( aBitmap ); + Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha.IsEmpty() ? (BitmapReadAccess*)NULL : aAlpha.AcquireReadAccess(), aAlpha ); ENSURE_OR_THROW( pReadAccess.get() != NULL, diff --git a/canvas/source/vcl/canvascustomsprite.cxx b/canvas/source/vcl/canvascustomsprite.cxx index 010422b6e093..2fcf6311485b 100644 --- a/canvas/source/vcl/canvascustomsprite.cxx +++ b/canvas/source/vcl/canvascustomsprite.cxx @@ -129,14 +129,6 @@ namespace vclcanvas maCanvasHelper.clear(); } - void SAL_CALL CanvasCustomSprite::disposing() - { - SolarMutexGuard aGuard; - - // forward to parent - CanvasCustomSpriteBaseT::disposing(); - } - #define IMPLEMENTATION_NAME "VCLCanvas.CanvasCustomSprite" #define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite" diff --git a/canvas/source/vcl/canvascustomsprite.hxx b/canvas/source/vcl/canvascustomsprite.hxx index 1753f80194d9..6acaddafd545 100644 --- a/canvas/source/vcl/canvascustomsprite.hxx +++ b/canvas/source/vcl/canvascustomsprite.hxx @@ -41,7 +41,7 @@ #include <vcl/virdev.hxx> #include <canvas/vclwrapper.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/spritesurface.hxx> #include <canvas/base/canvascustomspritebase.hxx> @@ -77,7 +77,7 @@ namespace vclcanvas remain a base class that provides implementation, not to enforce any specific interface on its derivees. */ - class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >, + class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >, public Sprite { }; @@ -100,8 +100,6 @@ namespace vclcanvas const OutDevProviderSharedPtr& rOutDevProvider, bool bShowSpriteBounds ); - virtual void SAL_CALL disposing(); - // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base // Classname Base doing refcount Base implementing the XComponent interface diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 6fb918df8f1c..38185d812fb5 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -948,8 +948,7 @@ namespace vclcanvas Bitmap aBitmap( rOutDev.GetBitmap(aRect.TopLeft(), aRect.GetSize()) ); - ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), - aBitmap ); + Bitmap::ScopedReadAccess pReadAccess( aBitmap ); ENSURE_OR_THROW( pReadAccess.get() != NULL, "Could not acquire read access to OutDev bitmap" ); @@ -1014,8 +1013,7 @@ namespace vclcanvas Bitmap aTmpBitmap( rOutDev.GetBitmap( aEmptyPoint, aSize ) ); - ScopedBitmapReadAccess pReadAccess( aTmpBitmap.AcquireReadAccess(), - aTmpBitmap ); + Bitmap::ScopedReadAccess pReadAccess( aTmpBitmap ); pPalette = &pReadAccess->GetPalette(); } @@ -1026,8 +1024,7 @@ namespace vclcanvas bool bCopyBack( false ); // only copy something back, if we // actually changed some pixel { - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), - aBitmap ); + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); ENSURE_OR_THROW( pWriteAccess.get() != NULL, "Could not acquire write access to OutDev bitmap" ); diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 24f32aadc237..a8187766e15b 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -277,9 +277,8 @@ namespace vclcanvas aSrcAlpha = rBitmap.GetMask(); } - ScopedBitmapReadAccess pReadAccess( aSrcBitmap.AcquireReadAccess(), - aSrcBitmap ); - ScopedBitmapReadAccess pAlphaReadAccess( rBitmap.IsTransparent() ? + Bitmap::ScopedReadAccess pReadAccess( aSrcBitmap ); + Bitmap::ScopedReadAccess pAlphaReadAccess( rBitmap.IsTransparent() ? aSrcAlpha.AcquireReadAccess() : (BitmapReadAccess*)NULL, aSrcAlpha ); @@ -334,10 +333,8 @@ namespace vclcanvas // copy-constructing the resulting bitmap. This will // rule out the possibility that cached accessor data // is not yet written back. - ScopedBitmapWriteAccess pWriteAccess( aDstBitmap.AcquireWriteAccess(), - aDstBitmap ); - ScopedBitmapWriteAccess pAlphaWriteAccess( aDstAlpha.AcquireWriteAccess(), - aDstAlpha ); + Bitmap::ScopedWriteAccess pWriteAccess( aDstBitmap ); + Bitmap::ScopedWriteAccess pAlphaWriteAccess( aDstAlpha ); if( pWriteAccess.get() != NULL && diff --git a/canvas/source/vcl/spritecanvas.cxx b/canvas/source/vcl/spritecanvas.cxx index b06bd1c77e9e..14c2446dcab7 100644 --- a/canvas/source/vcl/spritecanvas.cxx +++ b/canvas/source/vcl/spritecanvas.cxx @@ -129,14 +129,14 @@ namespace vclcanvas } - void SAL_CALL SpriteCanvas::disposing() + void SpriteCanvas::disposeThis() { SolarMutexGuard aGuard; mxComponentContext.clear(); // forward to parent - SpriteCanvasBaseT::disposing(); + SpriteCanvasBaseT::disposeThis(); } ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException) diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx index 15688fca0ee3..26500fc93552 100644 --- a/canvas/source/vcl/spritecanvas.hxx +++ b/canvas/source/vcl/spritecanvas.hxx @@ -45,7 +45,7 @@ #include <comphelper/uno3.hxx> #include <canvas/base/spritecanvasbase.hxx> -#include <canvas/base/basemutexhelper.hxx> +#include <canvas/base/disambiguationhelper.hxx> #include <canvas/base/bufferedgraphicdevicebase.hxx> #include "spritecanvashelper.hxx" @@ -68,7 +68,7 @@ namespace vclcanvas ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; - typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >, + typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, tools::LocalGuard, ::cppu::OWeakObject > SpriteCanvasBase_Base; @@ -123,12 +123,8 @@ namespace vclcanvas /// For resource tracking ~SpriteCanvas(); -#if defined __SUNPRO_CC - using SpriteCanvasBaseT::disposing; -#endif - /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void disposeThis(); // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base diff --git a/comphelper/Library_comphelp.mk b/comphelper/Library_comphelp.mk index 7c365bc97cd2..8336b8cb2124 100644 --- a/comphelper/Library_comphelp.mk +++ b/comphelper/Library_comphelp.mk @@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/misc/ihwrapnofilter \ comphelper/source/misc/instancelocker \ comphelper/source/misc/interaction \ - comphelper/source/misc/legacysingletonfactory \ comphelper/source/misc/listenernotification \ comphelper/source/misc/locale \ comphelper/source/misc/logging \ diff --git a/comphelper/Package_inc.mk b/comphelper/Package_inc.mk index 5794c56ab74d..a02bde6b7475 100644 --- a/comphelper/Package_inc.mk +++ b/comphelper/Package_inc.mk @@ -38,6 +38,7 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stillreadwritein $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/anycompare.hxx,comphelper/anycompare.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/propagg.hxx,comphelper/propagg.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scopeguard.hxx,comphelper/scopeguard.hxx)) +$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scoped_disposing_ptr.hxx,comphelper/scoped_disposing_ptr.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/asyncnotification.hxx,comphelper/asyncnotification.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/namedvaluecollection.hxx,comphelper/namedvaluecollection.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/composedprops.hxx,comphelper/composedprops.hxx)) @@ -89,7 +90,6 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ChainablePropert $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stl_types.hxx,comphelper/stl_types.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/eventattachermgr.hxx,comphelper/eventattachermgr.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/componentcontext.hxx,comphelper/componentcontext.hxx)) -$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/legacysingletonfactory.hxx,comphelper/legacysingletonfactory.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/accessibleeventnotifier.hxx,comphelper/accessibleeventnotifier.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ihwrapnofilter.hxx,comphelper/ihwrapnofilter.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/sequenceasvector.hxx,comphelper/sequenceasvector.hxx)) diff --git a/comphelper/inc/comphelper/accimplaccess.hxx b/comphelper/inc/comphelper/accimplaccess.hxx index 8ba9fe43867e..fbbee6fbfde6 100644 --- a/comphelper/inc/comphelper/accimplaccess.hxx +++ b/comphelper/inc/comphelper/accimplaccess.hxx @@ -154,7 +154,7 @@ namespace comphelper private: - COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId(); + COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); }; //......................................................................... diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index cd65ea50577d..4bc917ef13d3 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.hxx @@ -29,7 +29,6 @@ #define COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX #include <comphelper/comphelperdllapi.h> -#include <comphelper/legacysingletonfactory.hxx> /** === begin UNO includes === **/ #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -272,29 +271,6 @@ namespace comphelper } //========================================================================== - //= OLegacySingletonRegistration - //========================================================================== - template <class TYPE> - class OLegacySingletonRegistration - { - public: - OLegacySingletonRegistration( OModule& _rModule ); - }; - - //-------------------------------------------------------------------------- - template <class TYPE> - OLegacySingletonRegistration<TYPE>::OLegacySingletonRegistration( OModule& _rModule ) - { - _rModule.registerImplementation( ComponentDescription( - TYPE::getImplementationName_static(), - TYPE::getSupportedServiceNames_static(), - ::rtl::OUString(), - &TYPE::Create, - &::comphelper::createLegacySingletonFactory - ) ); - } - - //========================================================================== //= helpers //========================================================================== @@ -305,7 +281,7 @@ namespace comphelper /* -------------------------------------------------------------------- */ \ class ModuleClass : public ::comphelper::OModule \ { \ - friend struct CreateModuleClass; \ + friend struct ModuleClass##Creator; \ typedef ::comphelper::OModule BaseClass; \ \ public: \ @@ -350,32 +326,20 @@ namespace comphelper OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ { \ } \ - }; \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OLegacySingletonRegistration< TYPE > BaseClass; \ - \ - public: \ - OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; \ + }; //========================================================================== //= implementing a OModule for a component library #define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \ - struct CreateModuleClass \ + struct ModuleClass##Creator \ { \ - ModuleClass* operator()() \ - { \ - static ModuleClass* pModule = new ModuleClass; \ - return pModule; \ - } \ + ModuleClass m_aModuleClass; \ }; \ + namespace \ + { \ + class the##ModuleClass##Instance : public rtl::Static<ModuleClass##Creator, the##ModuleClass##Instance> {}; \ + } \ \ ModuleClass::ModuleClass() \ :BaseClass() \ @@ -384,16 +348,14 @@ namespace comphelper \ ModuleClass& ModuleClass::getInstance() \ { \ - return *rtl_Instance< ModuleClass, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >:: \ - create( CreateModuleClass(), ::osl::GetGlobalMutex() ); \ + return the##ModuleClass##Instance::get().m_aModuleClass; \ } \ //========================================================================== //= implementing the API of a component library (component_*) #define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \ - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL \ - component_getImplementationEnvironment( \ + extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( \ const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) \ { \ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ diff --git a/comphelper/inc/comphelper/documentconstants.hxx b/comphelper/inc/comphelper/documentconstants.hxx index cb280b2525f7..06653b023002 100644 --- a/comphelper/inc/comphelper/documentconstants.hxx +++ b/comphelper/inc/comphelper/documentconstants.hxx @@ -148,4 +148,4 @@ #define SFX_FILTER_VERSION_NONE 0 #define SFX_FILTER_NOTINSTALLED SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/legacysingletonfactory.hxx b/comphelper/inc/comphelper/legacysingletonfactory.hxx deleted file mode 100644 index d40f828d1384..000000000000 --- a/comphelper/inc/comphelper/legacysingletonfactory.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef COMPHELPER_LEGACYSINGLETONFACTORY_HXX -#define COMPHELPER_LEGACYSINGLETONFACTORY_HXX - -#include "comphelper/comphelperdllapi.h" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include <cppuhelper/factory.hxx> - -//........................................................................ -namespace comphelper -{ -//........................................................................ - -/** creates a factory which can be used when implementing old-style singletons - - Before UNO having the component context concept, singletons were implemented by providing - a factory which return the very same component instance for every creation request. - - Nowadays, singletons are implemented by making them available at the component context, - as dedicated property. - - To bridge between both worlds - sometimes necessary to support legacy code, which instantiates - singletons at the global service manager, instead of obtaining the property at the - component context -, you can use the function below. I creates a single-component - factory, which behaves like the old factories did: Upon multiple creation requests, - it will always return the same instance. Additionally, the signature of the function - is the same as the signature of <code>::cppu::createSingleComponentFactory</code> - (which creates a "normal" component factory), so you can use both factory functions - in the same context. -*/ -::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > - COMPHELPER_DLLPUBLIC createLegacySingletonFactory( - ::cppu::ComponentFactoryFunc _componentFactoryFunc, - const ::rtl::OUString& _rImplementationName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames, - rtl_ModuleCount* _pModCount = NULL - ); - -//........................................................................ -} // namespace comphelper -//........................................................................ - -#endif // COMPHELPER_LEGACYSINGLETONFACTORY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/scoped_disposing_ptr.hxx b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx new file mode 100644 index 000000000000..7278126c2633 --- /dev/null +++ b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx @@ -0,0 +1,178 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _SCOPED_DISPOSING_PTR +#define _SCOPED_DISPOSING_PTR + +#include <cppuhelper/implbase1.hxx> +#include <boost/utility.hpp> +#include <boost/scoped_ptr.hpp> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XDesktop.hpp> + +// for locking SolarMutex: svapp + mutex +#include <vcl/svapp.hxx> +#include <osl/mutex.hxx> + +namespace comphelper +{ +//Similar to boost::scoped_ptr, except additionally releases the ptr on XComponent::disposing and/or XTerminateListener::notifyTermination if supported +template<class T> class scoped_disposing_ptr : private boost::noncopyable +{ +private: + boost::scoped_ptr<T> m_aItem; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> m_xTerminateListener; +public: + scoped_disposing_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 ) + : m_aItem(p) + { + m_xTerminateListener = new TerminateListener(rComponent, *this); + } + + virtual void reset(T * p = 0) + { + m_aItem.reset(p); + } + + T & operator*() const + { + return *m_aItem; + } + + T * get() const + { + return m_aItem.get(); + } + + T * operator->() const + { + return m_aItem.get(); + } + + operator bool () const + { + return m_aItem; + } + + virtual ~scoped_disposing_ptr() + { + reset(); + } +private: + class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener > + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent; + scoped_disposing_ptr<T>& m_rItem; + public: + TerminateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, + scoped_disposing_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem) + { + if (m_xComponent.is()) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY); + if (xDesktop.is()) + xDesktop->addTerminateListener(this); + else + m_xComponent->addEventListener(this); + } + } + + ~TerminateListener() + { + if ( m_xComponent.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY); + if (xDesktop.is()) + xDesktop->removeTerminateListener(this); + else + m_xComponent->removeEventListener(this); + } + } + + private: + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvt ) + throw (::com::sun::star::uno::RuntimeException) + { + bool shutDown = (rEvt.Source == m_xComponent); + + if (shutDown && m_xComponent.is()) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY); + if (xDesktop.is()) + xDesktop->removeTerminateListener(this); + else + m_xComponent->removeEventListener(this); + m_xComponent.clear(); + } + + if (shutDown) + m_rItem.reset(); + } + + // XTerminateListener + virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& ) + throw(::com::sun::star::frame::TerminationVetoException, + ::com::sun::star::uno::RuntimeException) + { + } + + virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& rEvt ) + throw (::com::sun::star::uno::RuntimeException) + { + disposing(rEvt); + } + }; +}; + +//Something like an OutputDevice requires the SolarMutex to be taken before use +//for threadsafety. The user can ensure this, except in the case of its dtor +//being called from reset due to a terminate on the XComponent being called +//from an aribitrary thread +template<class T> class scoped_disposing_solar_mutex_reset_ptr + : public scoped_disposing_ptr<T> +{ +public: + scoped_disposing_solar_mutex_reset_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 ) + : scoped_disposing_ptr<T>(rComponent, p) + { + } + + virtual void reset(T * p = 0) + { + SolarMutexGuard aGuard; + scoped_disposing_ptr<T>::reset(p); + } +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/sequence.hxx b/comphelper/inc/comphelper/sequence.hxx index 9ccb89770ca4..125668172fb1 100644 --- a/comphelper/inc/comphelper/sequence.hxx +++ b/comphelper/inc/comphelper/sequence.hxx @@ -179,13 +179,9 @@ namespace comphelper ,m_pCurrent(NULL) { ::com::sun::star::uno::Sequence< TYPE > aContainer; - #ifdef DBG_UTIL - sal_Bool bSuccess = - #endif - _rSequenceAny >>= aContainer; - #ifdef DBG_UTIL + sal_Bool bSuccess = _rSequenceAny >>= aContainer; OSL_ENSURE(bSuccess, "OSequenceIterator::OSequenceIterator: invalid Any!"); - #endif + (void)bSuccess; construct(aContainer); } diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx index e691ea2bd76c..15b0ae6a9f7c 100644 --- a/comphelper/inc/comphelper/servicehelper.hxx +++ b/comphelper/inc/comphelper/servicehelper.hxx @@ -29,6 +29,21 @@ #ifndef _COMPHELPER_SERVICEHELPER_HXX_ #define _COMPHELPER_SERVICEHELPER_HXX_ +#include <rtl/uuid.h> +#include <rtl/instance.hxx> + +class UnoTunnelIdInit +{ +private: + ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq; +public: + UnoTunnelIdInit() : m_aSeq(16) + { + rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True ); + } + const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; } +}; + /** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function that gives access to your implementation for a given interface reference, if possible. @@ -49,20 +64,13 @@ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); #define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \ +namespace \ +{ \ + class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \ +} \ const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \ { \ - static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; \ - if( !pSeq ) \ - { \ - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \ - if( !pSeq ) \ - { \ - static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \ - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \ - pSeq = &aSeq; \ - } \ - } \ - return *pSeq; \ + return the##classname##UnoTunnelId::get().getSeq(); \ } \ \ classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \ diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx index b1f769388ee0..e71a008c5e3e 100644 --- a/comphelper/inc/comphelper/string.hxx +++ b/comphelper/inc/comphelper/string.hxx @@ -190,6 +190,7 @@ public: { return compareNatural(rLHS, rRHS, m_xCollator, m_xBI, m_aLocale); } + const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale; } }; } } diff --git a/comphelper/inc/comphelper/types.hxx b/comphelper/inc/comphelper/types.hxx index 46020e64dd29..dfa1565c4493 100644 --- a/comphelper/inc/comphelper/types.hxx +++ b/comphelper/inc/comphelper/types.hxx @@ -104,7 +104,7 @@ namespace comphelper /** check if a type you have at hand at runtime is equal to another type you have at compile time */ template <class TYPE> - sal_Bool isAReference(const staruno::Any& _rVal, TYPE* pDummy) + sal_Bool isAReference(const staruno::Any& _rVal, TYPE*) { return _rVal.getValueType().equals( cppu::getTypeFavourUnsigned( diff --git a/comphelper/inc/comphelper/uno3.hxx b/comphelper/inc/comphelper/uno3.hxx index 617c200d3fd5..dff10cc994d3 100644 --- a/comphelper/inc/comphelper/uno3.hxx +++ b/comphelper/inc/comphelper/uno3.hxx @@ -30,6 +30,7 @@ #define _COMPHELPER_UNO3_HXX_ #include <osl/interlck.h> +#include <rtl/instance.hxx> #include <comphelper/types.hxx> #include <com/sun/star/uno/XAggregation.hpp> #include <comphelper/sequence.hxx> @@ -197,19 +198,13 @@ namespace comphelper virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); #define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \ + namespace \ + { \ + class the##classname##ImplementationId : public rtl::Static< ::cppu::OImplementationId, the##classname##ImplementationId> {}; \ + } \ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) \ { \ - static ::cppu::OImplementationId* pId = NULL; \ - if (!pId) \ - { \ - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ - if (!pId) \ - { \ - static ::cppu::OImplementationId aId; \ - pId = &aId; \ - } \ - } \ - return pId->getImplementationId(); \ + return the##classname##ImplementationId::get().getImplementationId(); \ } #define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \ diff --git a/comphelper/source/container/containermultiplexer.cxx b/comphelper/source/container/containermultiplexer.cxx index fa68a34c2940..21c72fbbead1 100644 --- a/comphelper/source/container/containermultiplexer.cxx +++ b/comphelper/source/container/containermultiplexer.cxx @@ -118,7 +118,7 @@ namespace comphelper } catch(const Exception&) { - OSL_FAIL("Exceptiopn catched!"); + OSL_FAIL("Exceptiopn caught!"); } ::comphelper::decrement(m_refCount); } @@ -153,7 +153,7 @@ namespace comphelper } catch(const Exception&) { - OSL_FAIL("Exception catched!"); + OSL_FAIL("Exception caught!"); } m_xContainer = NULL; m_pListener = NULL; diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index acbb962ea4d7..dd4fa54f3354 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -31,7 +31,7 @@ #include <deque> -#if defined( OS2 ) || defined( UNX ) +#if defined( UNX ) #include <wchar.h> #endif #include <osl/mutex.hxx> @@ -470,7 +470,7 @@ void detachAll_Impl while( aObjIt != aObjEnd ) { pMgr->detach( nIdx, (*aObjIt).xTarget ); - aObjIt++; + ++aObjIt; } } @@ -487,7 +487,7 @@ void attachAll_Impl while( aObjIt != aObjEnd ) { pMgr->attach( nIdx, (*aObjIt).xTarget, (*aObjIt).aHelper ); - aObjIt++; + ++aObjIt; } } @@ -541,7 +541,7 @@ void SAL_CALL ImplEventAttacherManager::registerScriptEvent { } - aObjIt++; + ++aObjIt; } } @@ -605,7 +605,7 @@ void SAL_CALL ImplEventAttacherManager::revokeScriptEvent break; } - aEvtIt++; + ++aEvtIt; } #else Sequence< ScriptEventDescriptor >& rEventList = (*aIt).aEventList; @@ -698,7 +698,7 @@ Sequence< ScriptEventDescriptor > SAL_CALL ImplEventAttacherManager::getScriptEv while( aEvtIt != aEvtEnd ) { pArray[i++] = *aEvtIt; - aEvtIt++; + ++aEvtIt; } return aSeq; #else @@ -763,7 +763,7 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference } pArray[i++] = xAdapter; - aEvtIt++; + ++aEvtIt; } #else sal_Int32 nLen = aCurrentPosition->aEventList.getLength(); @@ -824,7 +824,7 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference } } i++; - aEvtIt++; + ++aEvtIt; } #else sal_Int32 nLen = aCurrentPosition->aEventList.getLength(); @@ -847,7 +847,7 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference aCurrentPosition->aObjList.erase( aObjIt ); break; } - aObjIt++; + ++aObjIt; } } @@ -910,7 +910,7 @@ void SAL_CALL ImplEventAttacherManager::write(const Reference< XObjectOutputStre OutStream->writeUTF( rDesc.ScriptType ); OutStream->writeUTF( rDesc.ScriptCode ); - aEvtIt++; + ++aEvtIt; } #else sal_Int32 nLen = (*aIt).aEventList.getLength(); @@ -927,7 +927,7 @@ void SAL_CALL ImplEventAttacherManager::write(const Reference< XObjectOutputStre OutStream->writeUTF( rDesc.ScriptCode ); } #endif - aIt++; + ++aIt; } // Die jetzt bekannte Laenge eintragen diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx index 650130939cda..b9d26591f19f 100644 --- a/comphelper/source/misc/accessiblewrapper.cxx +++ b/comphelper/source/misc/accessiblewrapper.cxx @@ -241,10 +241,9 @@ namespace comphelper case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED: case AccessibleEventId::TABLE_ROW_HEADER_CHANGED: case AccessibleEventId::TABLE_SUMMARY_CHANGED: - // --> PB 2006-03-21 #130798# EventId TEXT_SELECTION_CHANGED was missed + // #130798# // these Ids are also missed: SUB_WINDOW_OF_RELATION_CHANGED & TEXT_ATTRIBUTE_CHANGED case AccessibleEventId::TEXT_SELECTION_CHANGED: - // <-- // nothing to translate break; diff --git a/comphelper/source/misc/accimplaccess.cxx b/comphelper/source/misc/accimplaccess.cxx index 7128d4e13991..e06df35cde0c 100644 --- a/comphelper/source/misc/accimplaccess.cxx +++ b/comphelper/source/misc/accimplaccess.cxx @@ -121,21 +121,13 @@ namespace comphelper return ( NULL != pImplementation ); } + namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + //--------------------------------------------------------------------- - const Sequence< sal_Int8 >& OAccessibleImplementationAccess::getUnoTunnelImplementationId() + const Sequence< sal_Int8 > OAccessibleImplementationAccess::getUnoTunnelImplementationId() { - static Sequence< sal_Int8 > aId; - if ( !aId.getLength() ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !aId.getLength() ) - { - static ::cppu::OImplementationId aImplId; - // unfortunately, the OImplementationId::getImplementationId returns a copy, not a static reference ... - aId = aImplId.getImplementationId(); - } - } - return aId; + ::cppu::OImplementationId &rID = lcl_ImplId::get(); + return rID.getImplementationId(); } //--------------------------------------------------------------------- diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index b9cc41fe5b09..32d1c53aff93 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -30,6 +30,8 @@ #include "comphelper_module.hxx" +#include <rtl/instance.hxx> + //-------------------------------------------------------------------- extern void createRegistryInfo_OPropertyBag(); extern void createRegistryInfo_SequenceOutputStream(); @@ -49,13 +51,12 @@ namespace comphelper { namespace module { //........................................................................ - static void initializeModule() + namespace { - static bool bInitialized( false ); - if ( !bInitialized ) + class doInitialize { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !bInitialized ) + public: + doInitialize() { createRegistryInfo_OPropertyBag(); createRegistryInfo_SequenceOutputStream(); @@ -70,7 +71,14 @@ namespace comphelper { namespace module createRegistryInfo_OSimpleLogRing(); createRegistryInfo_OOfficeRestartManager(); } - } + }; + + struct theInitializer : public rtl::Static< doInitialize, theInitializer > {}; + } + + static void initializeModule() + { + theInitializer::get(); } //........................................................................ diff --git a/comphelper/source/misc/legacysingletonfactory.cxx b/comphelper/source/misc/legacysingletonfactory.cxx deleted file mode 100644 index d469d2512c4f..000000000000 --- a/comphelper/source/misc/legacysingletonfactory.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_comphelper.hxx" - -#include "comphelper/legacysingletonfactory.hxx" - -/** === begin UNO includes === **/ -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -/** === end UNO includes === **/ - -#include <cppuhelper/implbase2.hxx> - -#include <algorithm> - -//........................................................................ -namespace comphelper -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::lang::XSingleComponentFactory; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::lang::XInitialization; - /** === end UNO using === **/ - - //==================================================================== - //= LegacySingletonFactory - //==================================================================== - typedef ::cppu::WeakImplHelper2 < XServiceInfo - , XSingleComponentFactory - > LegacySingletonFactory_Base; - - class COMPHELPER_DLLPRIVATE LegacySingletonFactory : public LegacySingletonFactory_Base - { - public: - LegacySingletonFactory( - ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount - ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - - // XSingleComponentFactory - virtual Reference< XInterface > SAL_CALL createInstanceWithContext( const Reference< XComponentContext >& Context ) throw (Exception, RuntimeException); - virtual Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const Sequence< Any >& Arguments, const Reference< XComponentContext >& Context ) throw (Exception, RuntimeException); - - protected: - ~LegacySingletonFactory(); - - private: - /** creates m_xInstance, returns whether it actually was created (<TRUE/>) or existed before (<FALSE/> - */ - bool impl_nts_ensureInstance( const Reference< XComponentContext >& _rxContext ); - - private: - ::osl::Mutex m_aMutex; - ::cppu::ComponentFactoryFunc m_componentFactoryFunc; - ::rtl::OUString m_sImplementationName; - Sequence< ::rtl::OUString > m_aServiceNames; - rtl_ModuleCount* m_pModuleCount; - Reference< XInterface > m_xTheInstance; - }; - - //-------------------------------------------------------------------- - LegacySingletonFactory::LegacySingletonFactory( ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount ) - :m_componentFactoryFunc ( _componentFactoryFunc ) - ,m_sImplementationName ( _rImplementationName ) - ,m_aServiceNames ( _rServiceNames ) - ,m_pModuleCount ( _pModCount ) - ,m_xTheInstance ( ) - { - if ( m_pModuleCount ) - m_pModuleCount->acquire( m_pModuleCount ); - } - - //-------------------------------------------------------------------- - LegacySingletonFactory::~LegacySingletonFactory() - { - if ( m_pModuleCount ) - m_pModuleCount->release( m_pModuleCount ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL LegacySingletonFactory::getImplementationName( ) throw (RuntimeException) - { - return m_sImplementationName; - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL LegacySingletonFactory::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() ); - const ::rtl::OUString* pStart = aServices.getConstArray(); - const ::rtl::OUString* pEnd = aServices.getConstArray() + aServices.getLength(); - return ::std::find( pStart, pEnd, _rServiceName ) != pEnd; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL LegacySingletonFactory::getSupportedServiceNames( ) throw (RuntimeException) - { - return m_aServiceNames; - } - - //-------------------------------------------------------------------- - bool LegacySingletonFactory::impl_nts_ensureInstance( const Reference< XComponentContext >& _rxContext ) - { - if ( m_xTheInstance.is() ) - return false; - - m_xTheInstance = (*m_componentFactoryFunc)( _rxContext ); - if ( !m_xTheInstance.is() ) - throw RuntimeException(); - - return true; // true -> "was newly created" - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL LegacySingletonFactory::createInstanceWithContext( const Reference< XComponentContext >& _rxContext ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_nts_ensureInstance( _rxContext ); - - return m_xTheInstance; - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL LegacySingletonFactory::createInstanceWithArgumentsAndContext( const Sequence< Any >& _rArguments, const Reference< XComponentContext >& _rxContext ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !impl_nts_ensureInstance( _rxContext ) ) - throw RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Instance already created before, unable to initialize it." ) ), - *this - ); - - Reference< XInitialization > xInit( m_xTheInstance, UNO_QUERY_THROW ); - xInit->initialize( _rArguments ); - - return m_xTheInstance; - } - - //==================================================================== - //= createLegacySingletonFactory - //==================================================================== - Reference< XSingleComponentFactory > createLegacySingletonFactory( - ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount ) - { - return new LegacySingletonFactory( _componentFactoryFunc, _rImplementationName, _rServiceNames, _pModCount ); - } - - -//........................................................................ -} // namespace comphelper -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx index d8d81aadea3f..c81e761392b9 100644 --- a/comphelper/source/misc/mimeconfighelper.cxx +++ b/comphelper/source/misc/mimeconfighelper.cxx @@ -197,7 +197,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFacto if ( !m_xFilterFactory.is() ) m_xFilterFactory.set( - m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), + m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ), uno::UNO_QUERY ); return m_xFilterFactory; @@ -220,7 +220,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte if ( aFilterAny >>= aData ) { SequenceAsHashMap aFilterHM( aData ); - nFlags = aFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 ); + nFlags = aFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); } } } catch( uno::Exception& ) @@ -795,7 +795,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( if ( aImpFilterAny >>= aImpData ) { SequenceAsHashMap aImpFilterHM( aImpData ); - sal_Int32 nFlags = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), + sal_Int32 nFlags = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); if ( !( nFlags & SFX_FILTER_IMPORT ) ) @@ -810,16 +810,16 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( } else { - ::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "DocumentService" ), ::rtl::OUString() ); - ::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Type" ), ::rtl::OUString() ); + ::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString() ); + ::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")), ::rtl::OUString() ); OSL_ENSURE( aDocumentServiceName.getLength() && aTypeName.getLength(), "Incomplete filter data!" ); if ( aDocumentServiceName.getLength() && aTypeName.getLength() ) { uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); - aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "Type" ); + aSearchRequest[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")); aSearchRequest[0].Value <<= aTypeName; - aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aSearchRequest[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); aSearchRequest[1].Value <<= aDocumentServiceName; uno::Sequence< beans::PropertyValue > aExportFilterProps = SearchForFilter( @@ -831,7 +831,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( if ( aExportFilterProps.getLength() ) { SequenceAsHashMap aExpPropsHM( aExportFilterProps ); - aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ), ::rtl::OUString() ); + aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), ::rtl::OUString() ); } } } @@ -866,7 +866,7 @@ uno::Sequence< beans::PropertyValue > MimeConfigurationHelper::SearchForFilter( if ( xFilterEnum->nextElement() >>= aProps ) { SequenceAsHashMap aPropsHM( aProps ); - sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), + sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx index ab25d70c6e24..0491d9991271 100644 --- a/comphelper/source/misc/uieventslogger.cxx +++ b/comphelper/source/misc/uieventslogger.cxx @@ -49,6 +49,7 @@ #include <osl/mutex.hxx> #include <osl/time.h> #include <rtl/ustrbuf.hxx> +#include <rtl/instance.hxx> using namespace com::sun::star::beans; @@ -143,7 +144,6 @@ namespace comphelper // static methods and data static ptr getInstance(); - static void prepareMutex(); static bool shouldActivate(); static bool getEnabledFromCoreController(); static bool getEnabledFromCfg(); @@ -152,7 +152,6 @@ namespace comphelper static sal_Int32 findIdx(const Sequence<PropertyValue>& args, const OUString& key); static ptr instance; - static Mutex * singleton_mutex; static const sal_Int32 COLUMNS; static const OUString CFG_ENABLED; static const OUString CFG_IDLETIMEOUT; @@ -214,6 +213,10 @@ namespace comphelper const OUString UiEventsLogger_Impl::URL_SPECIAL(RTL_CONSTASCII_USTRINGPARAM(".special:")); const OUString UiEventsLogger_Impl::URL_FILE(RTL_CONSTASCII_USTRINGPARAM("file:")); + namespace + { + struct theSingletonMutex : public rtl::Static< Mutex, theSingletonMutex > {}; + } // public UiEventsLogger interface sal_Bool UiEventsLogger::isEnabled() @@ -221,8 +224,7 @@ namespace comphelper if ( UiEventsLogger_Impl::getEnabledFromCfg() ) { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); return UiEventsLogger_Impl::getInstance()->m_Active; } catch(...) { return false; } // never throws } // if ( ) @@ -232,8 +234,7 @@ namespace comphelper sal_Int32 UiEventsLogger::getSessionLogEventCount() { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); return UiEventsLogger_Impl::getInstance()->m_SessionLogEventCount; } catch(...) { return 0; } // never throws } @@ -269,8 +270,7 @@ namespace comphelper const Sequence<PropertyValue>& args) { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); UiEventsLogger_Impl::getInstance()->logDispatch(url, args); } catch(...) { } // never throws } @@ -283,8 +283,7 @@ namespace comphelper const OUString& param) { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); UiEventsLogger_Impl::getInstance()->logVcl(parent_id, window_type, id, method, param); } catch(...) { } // never throws } @@ -313,16 +312,14 @@ namespace comphelper void UiEventsLogger::disposing() { // we dont want to create an instance just to dispose it - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); if(UiEventsLogger_Impl::instance!=UiEventsLogger_Impl::ptr()) UiEventsLogger_Impl::getInstance()->disposing(); } void UiEventsLogger::reinit() { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); if(UiEventsLogger_Impl::instance) { UiEventsLogger_Impl::instance->disposing(); @@ -665,17 +662,6 @@ namespace comphelper return instance; } - Mutex * UiEventsLogger_Impl::singleton_mutex = NULL; - void UiEventsLogger_Impl::prepareMutex() - { - if(singleton_mutex == NULL) - { - Guard<Mutex> global_guard(Mutex::getGlobalMutex()); - if(singleton_mutex == NULL) - singleton_mutex = new Mutex(); - } - } - sal_Int32 UiEventsLogger_Impl::findIdx(const Sequence<PropertyValue>& args, const OUString& key) { for(sal_Int32 i=0; i<args.getLength(); i++) diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index de636191b1aa..35bcfecc7f9d 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -67,7 +67,7 @@ static bool makeCanonicalFileURL( rtl::OUString & rURL ) if ( osl::DirectoryItem::get( aNormalizedURL, aDirItem ) == osl::DirectoryItem::E_None ) { - osl::FileStatus aFileStatus( FileStatusMask_FileURL ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); if ( aDirItem.getFileStatus( aFileStatus ) == osl::DirectoryItem::E_None ) @@ -162,9 +162,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) if ( nIndex != -1 ) { return rtl::OUString( - URL.replaceAt( nIndex, - m_pOfficeBrandDir->getLength(), - m_aOfficeBrandDirMacro ) ); + aCanonicalURL.replaceAt( nIndex, + m_pOfficeBrandDir->getLength(), + m_aOfficeBrandDirMacro ) ); } else { @@ -172,9 +172,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) if ( nIndex != -1 ) { return rtl::OUString( - URL.replaceAt( nIndex, - m_pOfficeBaseDir->getLength(), - m_aOfficeBaseDirMacro ) ); + aCanonicalURL.replaceAt( nIndex, + m_pOfficeBaseDir->getLength(), + m_aOfficeBaseDirMacro ) ); } else { @@ -182,9 +182,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) if ( nIndex != -1 ) { return rtl::OUString( - URL.replaceAt( nIndex, - m_pUserDir->getLength(), - m_aUserDirMacro ) ); + aCanonicalURL.replaceAt( nIndex, + m_pUserDir->getLength(), + m_aUserDirMacro ) ); } } } diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 2844031d370c..78f33af7aed0 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -108,7 +108,7 @@ MasterPropertySet::~MasterPropertySet() while (aIter != aEnd ) { delete (*aIter).second; - aIter++; + ++aIter; } } diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx index 0cfaf6ec1a6f..46dffe062c03 100644 --- a/comphelper/source/property/MasterPropertySetInfo.cxx +++ b/comphelper/source/property/MasterPropertySetInfo.cxx @@ -63,7 +63,7 @@ MasterPropertySetInfo::~MasterPropertySetInfo() while (aIter != aEnd ) { delete (*aIter).second; - aIter++; + ++aIter; } } diff --git a/comphelper/source/property/propstate.cxx b/comphelper/source/property/propstate.cxx index 5be6c842a5f8..b58bdb6d0283 100644 --- a/comphelper/source/property/propstate.cxx +++ b/comphelper/source/property/propstate.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/uno/genfunc.h> #include <cppuhelper/queryinterface.hxx> #include <comphelper/sequence.hxx> +#include <rtl/instance.hxx> //......................................................................... namespace comphelper @@ -217,20 +218,13 @@ namespace comphelper ); } + namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + //--------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OStatefulPropertySet::getImplementationId() throw(RuntimeException) { - static ::cppu::OImplementationId * pId = NULL; - if ( !pId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pId ) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + ::cppu::OImplementationId &rID = lcl_ImplId::get(); + return rID.getImplementationId(); } //--------------------------------------------------------------------- diff --git a/comphelper/source/streaming/oslfile2streamwrap.cxx b/comphelper/source/streaming/oslfile2streamwrap.cxx index 40858acd338b..68af33298336 100644 --- a/comphelper/source/streaming/oslfile2streamwrap.cxx +++ b/comphelper/source/streaming/oslfile2streamwrap.cxx @@ -139,7 +139,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::available() throw( stario::NotConnecte throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); sal_uInt64 nDummy = 0; - eError = m_pFile->setPos(Pos_End, nDummy); + eError = m_pFile->setPos(osl_Pos_End, nDummy); if (eError != FileBase::E_None) throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); @@ -149,7 +149,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::available() throw( stario::NotConnecte throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); nAvailable = nAvailable - nPos; - eError = m_pFile->setPos(Pos_Absolut, nPos); + eError = m_pFile->setPos(osl_Pos_Absolut, nPos); if (eError != FileBase::E_None) throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); return sal::static_int_cast< sal_Int32 >( diff --git a/comphelper/source/xml/attributelist.cxx b/comphelper/source/xml/attributelist.cxx index 2c956623fcb7..2442fd69f106 100644 --- a/comphelper/source/xml/attributelist.cxx +++ b/comphelper/source/xml/attributelist.cxx @@ -93,7 +93,7 @@ OUString SAL_CALL AttributeList::getTypeByName( const OUString& sName ) throw( : { ::std::vector<struct TagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin(); - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) { if( (*ii).sName == sName ) { return (*ii).sType; } @@ -105,7 +105,7 @@ OUString SAL_CALL AttributeList::getValueByName(const OUString& sName) throw( :: { ::std::vector<struct TagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin(); - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) { if( (*ii).sName == sName ) { return (*ii).sValue; } @@ -144,7 +144,7 @@ void AttributeList::RemoveAttribute( const OUString sName ) { ::std::vector<struct TagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin(); - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) { if( (*ii).sName == sName ) { m_pImpl->vecAttribute.erase( ii ); break; diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index d75d0d86547e..2ef752b7024a 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1077,7 +1077,6 @@ namespace cppcanvas aStrikeoutText += pChars[0]; - sal_Int32 nStartPos = 0; xub_StrLen nLen = aStrikeoutText.Len(); if( nLen ) @@ -1096,6 +1095,8 @@ namespace cppcanvas pStrikeoutCharWidths[ i ] += pStrikeoutCharWidths[ i-1 ]; } + sal_Int32 nStartPos = 0; + pStrikeoutTextAction = TextActionFactory::createTextAction( rStartPoint, diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index 3f2799b20dcb..482b2a430dc1 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -534,7 +534,7 @@ namespace cppcanvas sal_Int32 TransparencyGroupAction::getActionCount() const { - return mpGroupMtf.get() ? mpGroupMtf->GetActionCount() : 0; + return mpGroupMtf.get() ? mpGroupMtf->GetActionSize() : 0; } } diff --git a/dtrans/source/cnttype/mctfentry.cxx b/dtrans/source/cnttype/mctfentry.cxx index 9aa350590bf0..5a4df1c21798 100644 --- a/dtrans/source/cnttype/mctfentry.cxx +++ b/dtrans/source/cnttype/mctfentry.cxx @@ -94,7 +94,7 @@ extern "C" // component_getImplementationEnvironment //---------------------------------------------------------------------- -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -105,7 +105,7 @@ void SAL_CALL component_getImplementationEnvironment( // returns a factory to create XFilePicker-Services //---------------------------------------------------------------------- -void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) { void* pRet = 0; diff --git a/dtrans/source/generic/dtrans.cxx b/dtrans/source/generic/dtrans.cxx index 4cf2f73d4c8e..7a47d12920a6 100644 --- a/dtrans/source/generic/dtrans.cxx +++ b/dtrans/source/generic/dtrans.cxx @@ -46,7 +46,7 @@ extern "C" //================================================================================================== -void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -54,7 +54,7 @@ void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvType //================================================================================================== -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ diff --git a/dtrans/source/os2/clipb/OS2Bitmap.cxx b/dtrans/source/os2/clipb/OS2Bitmap.cxx deleted file mode 100644 index 0f7b46bca31c..000000000000 --- a/dtrans/source/os2/clipb/OS2Bitmap.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * This code is property of Serenity Systems Intl - * All rights reserverd. - * - ************************************************************************/ - -#define INCL_WIN -#include <svpm.h> - -#include "Os2Clipboard.hxx" - -// same typedefs from win32 sdk -typedef unsigned short WORD; -typedef unsigned long DWORD; - -#pragma pack(push, 1) - -typedef struct { - PM_BYTE rgbBlue; - PM_BYTE rgbGreen; - PM_BYTE rgbRed; - PM_BYTE rgbReserved; -} RGBQUAD, *LPRGBQUAD; - -typedef struct -{ - WORD bfType; - DWORD bfSize; - WORD bfReserved1; - WORD bfReserved2; - DWORD bfOffBits; -} W32_BITMAPFILEHEADER, *PW32_BITMAPFILEHEADER; - -typedef struct -{ - DWORD biSize; - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; -} W32_BITMAPINFOHEADER, *PW32_BITMAPINFOHEADER; - -#pragma pack(pop) - -// store screen bitcount -LONG lBitCountScreen; - -/* - * Convert an OOo bitmap to an OS/2 bitmap handle - * - * An OOo bitmap is a BITMAPFILEHEADER structure followed by a Windows DIB - * - * OS/2 InfoHeader is a superset of Win32 InhoHeader, so we can just copy - * the win32 memory over the os2 memory and fix the cbFix field. - * colortable and bitmap data share the same format. - * -*/ -HBITMAP OOoBmpToOS2Handle( Any &aAnyB) -{ - // copy bitmap to clipboard - Sequence<sal_Int8> ByteStream; - aAnyB >>= ByteStream; - - // get w32 file header data - PW32_BITMAPFILEHEADER pbfh = (PW32_BITMAPFILEHEADER)ByteStream.getArray(); - // get w32 info header - PW32_BITMAPINFOHEADER pbih = (PW32_BITMAPINFOHEADER) (pbfh+1); - - // create os2 infoheader2 (same fields of w32) - BITMAPINFOHEADER2 bih2; - memset( &bih2, 0, sizeof( bih2)); - memcpy( &bih2, pbih, pbih->biSize); - bih2.cbFix = sizeof(bih2); - - // Determine size of color table - int iNumColors, numbits=bih2.cPlanes * bih2.cBitCount; - if (numbits != 24) - iNumColors = bih2.cclrUsed ? bih2.cclrUsed : 2<<numbits; - else - iNumColors = bih2.cclrUsed; - int iColorTableSize = iNumColors*sizeof(RGB2); - - // allocate bitmap info2 (header2+colortable) - PBITMAPINFO2 pbi2=(PBITMAPINFO2) malloc( sizeof(BITMAPINFOHEADER2)+iColorTableSize); - // setup header fields - memcpy( pbi2, &bih2, sizeof(BITMAPINFOHEADER2)); - // copy color palette (follows pbih) - memcpy( &pbi2->argbColor[0], (pbih+1), iColorTableSize); - - // get bitmap data - PBYTE pbPelData = (PBYTE)ByteStream.getArray() + pbfh->bfOffBits; - HPS hps = WinGetPS(HWND_DESKTOP); - HBITMAP hbm = GpiCreateBitmap( hps, &bih2, CBM_INIT, pbPelData, pbi2); - debug_printf( "OOoBmpToOS2Handle hbm %x\n", hbm); - WinReleasePS(hps); - - // return handle - return hbm; -} - -/* - * Convert an OS/2 bitmap handle to OOo bitmap - * - * First we need to copy the bitmap to a PS, then we can get bitmap data. - * -*/ -int OS2HandleToOOoBmp( HBITMAP hbm, Sequence< sal_Int8 >* OOoDIBStream) -{ - HAB hab = WinQueryAnchorBlock(HWND_DESKTOP); - HDC hdc; - SIZEL sizl; - HPS hps; - PM_BYTE* pbBuffer; - ULONG cbBuffer; - - struct { - BITMAPINFOHEADER2 bmp2; - RGB2 argb2Color[0x100]; - } bm; - - if (!lBitCountScreen) { - HPS hps = WinGetPS(HWND_DESKTOP); - HDC hdc = GpiQueryDevice(hps); - DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &lBitCountScreen); - WinReleasePS(hps); - } - - // STEP 1: get OS/2 bitmap data and header - // get bitmap header - memset(&(bm.bmp2), 0, sizeof(bm.bmp2)); - bm.bmp2.cbFix = 16; - GpiQueryBitmapInfoHeader(hbm, &bm.bmp2); - - /* Data only actually stored in clipboard quality */ - if ( lBitCountScreen < bm.bmp2.cBitCount ) - bm.bmp2.cBitCount = lBitCountScreen; - - if ( bm.bmp2.cBitCount == 16 ) - bm.bmp2.cBitCount = 24; - - if ( bm.bmp2.cPlanes != 1 ) { - return 0; - } - - if ( (hdc = DevOpenDC(hab, OD_MEMORY, "*", 0L, (PDEVOPENDATA) NULL, (HDC) NULL)) == (HDC) NULL ) { - return 0; - } - - sizl.cx = bm.bmp2.cx; - sizl.cy = bm.bmp2.cy; - if ( (hps = GpiCreatePS(hab, hdc, &sizl, PU_PELS | GPIF_DEFAULT | GPIT_MICRO | GPIA_ASSOC)) == (HPS) NULL ) { - DevCloseDC(hdc); - return 0; - } - // copy bitmap to hps - GpiSetBitmap(hps, hbm); - - // buffer lengths - cbBuffer = (((bm.bmp2.cBitCount * bm.bmp2.cx) + 31) / 32) * 4 * bm.bmp2.cy * bm.bmp2.cPlanes; - pbBuffer = (PM_BYTE*) malloc( cbBuffer); - // now get bitmap data - GpiQueryBitmapBits(hps, 0L, (LONG) bm.bmp2.cy, pbBuffer, (BITMAPINFO2*)&bm); - // free OS/2 resources - GpiSetBitmap(hps, (HBITMAP) NULL); - GpiDestroyPS(hps); - DevCloseDC(hdc); - - // STEP 2: now convert to Win32 DIB - // Determine size of color table - int iNumColors, numbits=bm.bmp2.cPlanes * bm.bmp2.cBitCount; - if (numbits != 24) - iNumColors = bm.bmp2.cclrUsed ? bm.bmp2.cclrUsed : 2<<numbits; - else - iNumColors = bm.bmp2.cclrUsed; - int iColorTableSize = iNumColors*sizeof(RGBQUAD); - - // reallocate data stream object size - OOoDIBStream->realloc( sizeof( W32_BITMAPFILEHEADER ) - + sizeof( W32_BITMAPINFOHEADER) + iColorTableSize + cbBuffer); - - // fill w32 file header data - PW32_BITMAPFILEHEADER pbfh = (PW32_BITMAPFILEHEADER) OOoDIBStream->getArray(); - memset( pbfh, 0, sizeof( W32_BITMAPFILEHEADER)); - pbfh->bfType = 'MB'; - pbfh->bfSize = sizeof( W32_BITMAPFILEHEADER ) - + sizeof( W32_BITMAPINFOHEADER) + iColorTableSize + cbBuffer; - pbfh->bfOffBits = sizeof( W32_BITMAPFILEHEADER) + sizeof( W32_BITMAPINFOHEADER) + iColorTableSize; - - // fill w32 info header - PW32_BITMAPINFOHEADER pbih = (PW32_BITMAPINFOHEADER) (pbfh+1); - // copy header fields (only win32 ones) and fix size - memcpy( pbih, &bm.bmp2, sizeof(W32_BITMAPINFOHEADER)); - pbih->biSize = sizeof(W32_BITMAPINFOHEADER); - - // fill color palette (follows pbih) - memcpy( (pbih+1), &bm.argb2Color[0], iColorTableSize); - - // fill bitmap data - memcpy( (char*) pbfh + pbfh->bfOffBits, pbBuffer, cbBuffer); - - // done - free( pbBuffer); - return 1; -} - -#ifdef TESTBMP - -#include <io.h> -#include <fcntl.h> -#include <stdio.h> - -int main( void) -{ - HAB hAB = WinQueryAnchorBlock( HWND_DESKTOP ); - - // query clipboard data to get mimetype - if( WinOpenClipbrd( hAB ) ) - { - ULONG handle = WinQueryClipbrdData( hAB, CF_BITMAP); - if (handle) { - Sequence< sal_Int8 > winDIBStream; - // convert to oustring and return it - if (OS2HandleToOOoBmp( handle, &winDIBStream) == 1) { - printf( "Conversion ok.\n"); - int fd = open( "test.bmp", O_BINARY | O_CREAT | O_TRUNC | O_RDWR); - printf( "writing to fd %d\n", fd); - write( fd, winDIBStream.getArray(), winDIBStream.getLength()); - close( fd); - } else - printf( "failed conversion.\n"); - - } - WinCloseClipbrd( hAB); - } - return 0; -} - -#endif //TESTBMP - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/os2/clipb/Os2Clipboard.cxx b/dtrans/source/os2/clipb/Os2Clipboard.cxx deleted file mode 100644 index 76df3e4945c4..000000000000 --- a/dtrans/source/os2/clipb/Os2Clipboard.cxx +++ /dev/null @@ -1,429 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//------------------------------------------------------------------------ -// includes -//------------------------------------------------------------------------ - -#include "Os2Clipboard.hxx" - -//------------------------------------------------------------------------ -// namespace directives -//------------------------------------------------------------------------ - -using namespace com::sun::star::datatransfer; -using namespace com::sun::star::datatransfer::clipboard; -using namespace com::sun::star::datatransfer::clipboard::RenderingCapabilities; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace cppu; -using namespace osl; -using namespace os2; - -using ::rtl::OUString; - -const Type CPPUTYPE_SEQINT8 = getCppuType( ( Sequence< sal_Int8 >* )0 ); -const Type CPPUTYPE_OUSTRING = getCppuType( (OUString*)0 ); - -#define DTRANS_OBJ_CLASSNAME "DTRANSOBJWND" - -// ----------------------------------------------------------------------- - -inline void SetWindowPtr( HWND hWnd, Os2Clipboard* pThis ) -{ - WinSetWindowULong( hWnd, QWL_USER, (ULONG)pThis ); -} - -inline Os2Clipboard* GetWindowPtr( HWND hWnd ) -{ - return (Os2Clipboard*)WinQueryWindowULong( hWnd, QWL_USER ); -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY DtransObjWndProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - - switch ( nMsg ) - { - case WM_DRAWCLIPBOARD: // clipboard content has changed - { - Os2Clipboard* os2Clipboard = GetWindowPtr( hWnd); - if (os2Clipboard) - { - debug_printf("WM_DRAWCLIPBOARD os2Clipboard %08x\n", os2Clipboard); - if (os2Clipboard->m_bInSetClipboardData) - { - debug_printf("WM_DRAWCLIPBOARD our change\n"); - } - else - { - // notify listener for clipboard change - debug_printf("WM_DRAWCLIPBOARD notify change\n"); - os2Clipboard->notifyAllClipboardListener(); - } - } - } - break; - } - - return WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); -} - -// ----------------------------------------------------------------------- - -Os2Clipboard::Os2Clipboard() : - m_aMutex(), - WeakComponentImplHelper4< XClipboardEx, XClipboardNotifier, XServiceInfo, XInitialization > (m_aMutex), - m_bInitialized(sal_False), - m_bInSetClipboardData(sal_False) -{ - MutexGuard aGuard(m_aMutex); - - debug_printf("Os2Clipboard::Os2Clipboard\n"); - hAB = WinQueryAnchorBlock( HWND_DESKTOP ); - hText = 0; - hBitmap = 0; - -} - -Os2Clipboard::~Os2Clipboard() -{ - debug_printf("Os2Clipboard::~Os2Clipboard\n"); -} - -void SAL_CALL Os2Clipboard::initialize( const Sequence< Any >& aArguments ) - throw(Exception, RuntimeException) -{ - if (!m_bInitialized) - { - for (sal_Int32 n = 0, nmax = aArguments.getLength(); n < nmax; n++) - if (aArguments[n].getValueType() == getCppuType((OUString *) 0)) - { - aArguments[0] >>= m_aName; - break; - } - } -} - -OUString SAL_CALL Os2Clipboard::getImplementationName() throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::getImplementationName\n"); - return OUString(RTL_CONSTASCII_USTRINGPARAM( OS2_CLIPBOARD_IMPL_NAME )); -} - -sal_Bool SAL_CALL Os2Clipboard::supportsService( const OUString& ServiceName ) throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::supportsService\n"); - Sequence < OUString > SupportedServicesNames = Os2Clipboard_getSupportedServiceNames(); - - for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) - if (SupportedServicesNames[n].compareTo(ServiceName) == 0) - return sal_True; - - return sal_False; -} - -Sequence< OUString > SAL_CALL Os2Clipboard::getSupportedServiceNames() throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::getSupportedServiceNames\n"); - return Os2Clipboard_getSupportedServiceNames(); -} - -Reference< XTransferable > SAL_CALL Os2Clipboard::getContents() throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::getContents\n"); - MutexGuard aGuard(m_aMutex); - - // os2 can have only one viewer at time, and we don't get a notification - // when the viewer changes. So we need to check handles of clipboard - // data and compare with previous handles - if (UWinOpenClipbrd(hAB)) { - sal_Bool fireChanged = sal_False; - ULONG handle = UWinQueryClipbrdData( hAB, UCLIP_CF_UNICODETEXT); - if (handle) { - if (handle != hText) { - hText = handle; - fireChanged = sal_True; - } - } - handle = UWinQueryClipbrdData( hAB, UCLIP_CF_BITMAP); - if (handle) { - if (handle != hBitmap) { - hBitmap = handle; - fireChanged = sal_True; - } - } - UWinCloseClipbrd( hAB); - if (fireChanged) - { - // notify listener for clipboard change - debug_printf("Os2Clipboard::getContents notify change\n"); - notifyAllClipboardListener(); - } - } - - if( ! m_aContents.is() ) - m_aContents = new Os2Transferable( static_cast< OWeakObject* >(this) ); - - return m_aContents; -} - -void SAL_CALL Os2Clipboard::setContents( const Reference< XTransferable >& xTrans, const Reference< XClipboardOwner >& xClipboardOwner ) throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::setContents\n"); - // remember old values for callbacks before setting the new ones. - ClearableMutexGuard aGuard(m_aMutex); - - Reference< XClipboardOwner > oldOwner(m_aOwner); - m_aOwner = xClipboardOwner; - - Reference< XTransferable > oldContents(m_aContents); - m_aContents = xTrans; - - aGuard.clear(); - - // notify old owner on loss of ownership - if( oldOwner.is() ) - oldOwner->lostOwnership(static_cast < XClipboard * > (this), oldContents); - - // notify all listeners on content changes - OInterfaceContainerHelper *pContainer = - rBHelper.aLC.getContainer(getCppuType( (Reference < XClipboardListener > *) 0)); - if (pContainer) - { - ClipboardEvent aEvent(static_cast < XClipboard * > (this), m_aContents); - OInterfaceIteratorHelper aIterator(*pContainer); - - while (aIterator.hasMoreElements()) - { - Reference < XClipboardListener > xListener(aIterator.next(), UNO_QUERY); - if (xListener.is()) - xListener->changedContents(aEvent); - } - } - -#if OSL_DEBUG_LEVEL > 0 - // dump list of available mimetypes - Sequence< DataFlavor > aFlavors( m_aContents->getTransferDataFlavors() ); - for( int i = 0; i < aFlavors.getLength(); i++ ) - debug_printf("Os2Clipboard::setContents available mimetype: %d %s\n", - i, CHAR_POINTER(aFlavors.getConstArray()[i].MimeType)); -#endif - - // we can only export text or bitmap - DataFlavor nFlavorText( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")), - OUString(RTL_CONSTASCII_USTRINGPARAM("Unicode-Text")), CPPUTYPE_OUSTRING); - DataFlavor nFlavorBitmap( OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )), - OUString(RTL_CONSTASCII_USTRINGPARAM("Bitmap")), CPPUTYPE_DEFAULT); - - // try text transfer data (if any) - PSZ pSharedText = NULL; - HBITMAP hbm = NULL; - try - { - Any aAny = m_aContents->getTransferData( nFlavorText ); - if (aAny.hasValue()) - { - APIRET rc; - // copy unicode text to clipboard - OUString aString; - aAny >>= aString; - // share text - rc = DosAllocSharedMem( (PPVOID) &pSharedText, NULL, - aString.getLength() * 2 + 2, - PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE | OBJ_ANY); - if (!rc) - memcpy( pSharedText, aString.getStr(), aString.getLength() * 2 + 2 ); - else - pSharedText = NULL; - debug_printf("Os2Clipboard::setContents SetClipbrdData text done\n"); - } - } catch ( UnsupportedFlavorException&) { - debug_printf("Os2Clipboard::setContents UnsupportedFlavorException (no text)\n"); - } - - // try bitmap transfer data (if any) - try - { - Any aAnyB = m_aContents->getTransferData( nFlavorBitmap ); - if (aAnyB.hasValue()) - { - hbm = OOoBmpToOS2Handle( aAnyB); - debug_printf("Os2Clipboard::setContents SetClipbrdData bitmap done\n"); - } - } catch ( UnsupportedFlavorException&) { - debug_printf("Os2Clipboard::setContents UnsupportedFlavorException (no bitmap)\n"); - } - - // copy to clipboard - if ( UWinOpenClipbrd( hAB) && (pSharedText || hbm)) - { - // set the flag, so we will ignore the next WM_DRAWCLIPBOARD - // since we generate it with following code. - m_bInSetClipboardData = sal_True; - UWinEmptyClipbrd( hAB); - // give pointer to clipboard (it will become owner of pSharedText!) - if (pSharedText) { - UWinSetClipbrdData( hAB, (ULONG) pSharedText, UCLIP_CF_UNICODETEXT, CFI_POINTER); - // update internal handle to avoid detection of this text as new data - hText = (ULONG)pSharedText; - } - // give bitmap to clipboard - if (hbm) { - UWinSetClipbrdData( hAB, (ULONG) hbm, UCLIP_CF_BITMAP, CFI_HANDLE); - // update internal handle to avoid detection of this bitmap as new data - hBitmap = hbm; - } - // reset the flag, so we will not ignore next WM_DRAWCLIPBOARD - m_bInSetClipboardData = sal_False; - UWinCloseClipbrd( hAB); - } - -} - -OUString SAL_CALL Os2Clipboard::getName() throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::getName\n"); - return m_aName; -} - -sal_Int8 SAL_CALL Os2Clipboard::getRenderingCapabilities() throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::getRenderingCapabilities\n"); - return Delayed; -} - -//======================================================================== -// XClipboardNotifier -//======================================================================== - -void SAL_CALL Os2Clipboard::addClipboardListener( const Reference< XClipboardListener >& listener ) throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::addClipboardListener\n"); - MutexGuard aGuard( rBHelper.rMutex ); - OSL_ENSURE( !rBHelper.bInDispose, "do not add listeners in the dispose call" ); - OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" ); - if (!rBHelper.bInDispose && !rBHelper.bDisposed) - rBHelper.aLC.addInterface( getCppuType( (const ::com::sun::star::uno::Reference< XClipboardListener > *) 0), listener ); -} - -void SAL_CALL Os2Clipboard::removeClipboardListener( const Reference< XClipboardListener >& listener ) throw( RuntimeException ) -{ - debug_printf("Os2Clipboard::removeClipboardListener\n"); - MutexGuard aGuard( rBHelper.rMutex ); - OSL_ENSURE( !rBHelper.bDisposed, "object is disposed" ); - if (!rBHelper.bInDispose && !rBHelper.bDisposed) - rBHelper.aLC.removeInterface( getCppuType( (const Reference< XClipboardListener > *) 0 ), listener ); \ -} - -// ------------------------------------------------------------------------ - -void SAL_CALL Os2Clipboard::notifyAllClipboardListener( ) -{ - if ( !rBHelper.bDisposed ) - { - ClearableMutexGuard aGuard( rBHelper.rMutex ); - if ( !rBHelper.bDisposed ) - { - aGuard.clear( ); - - ClearableMutexGuard aGuard(m_aMutex); - // copy member references on stack so they can be called - // without having the mutex - Reference< XClipboardOwner > xOwner( m_aOwner ); - Reference< XTransferable > xTrans( m_aContents ); - // clear members - m_aOwner.clear(); - m_aContents.clear(); - // release the mutex - aGuard.clear(); - - // inform previous owner of lost ownership - if ( xOwner.is() ) - xOwner->lostOwnership(static_cast < XClipboard * > (this), m_aContents); - - OInterfaceContainerHelper* pICHelper = rBHelper.aLC.getContainer( - getCppuType( ( Reference< XClipboardListener > * ) 0 ) ); - - if ( pICHelper ) - { - try - { - OInterfaceIteratorHelper iter(*pICHelper); - m_aContents = 0; - m_aContents = new Os2Transferable( static_cast< OWeakObject* >(this) ); - ClipboardEvent aClipbEvent(static_cast<XClipboard*>(this), m_aContents); - - while(iter.hasMoreElements()) - { - try - { - Reference<XClipboardListener> xCBListener(iter.next(), UNO_QUERY); - if (xCBListener.is()) - xCBListener->changedContents(aClipbEvent); - } - catch(RuntimeException&) - { - OSL_FAIL( "RuntimeException caught" ); - debug_printf( "RuntimeException caught" ); - } - } - } - catch(const ::com::sun::star::lang::DisposedException&) - { - OSL_FAIL("Service Manager disposed"); - debug_printf( "Service Manager disposed"); - - // no further clipboard changed notifications - //m_pImpl->unregisterClipboardViewer(); - } - - } // end if - } // end if - } // end if -} - -// ------------------------------------------------------------------------ - -Sequence< OUString > SAL_CALL Os2Clipboard_getSupportedServiceNames() -{ - Sequence< OUString > aRet(1); - aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( OS2_CLIPBOARD_SERVICE_NAME )); - return aRet; -} - -// ------------------------------------------------------------------------ - -Reference< XInterface > SAL_CALL Os2Clipboard_createInstance( - const Reference< XMultiServiceFactory > & xMultiServiceFactory) -{ - return Reference < XInterface >( ( OWeakObject * ) new Os2Clipboard()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/os2/clipb/Os2Clipboard.hxx b/dtrans/source/os2/clipb/Os2Clipboard.hxx deleted file mode 100644 index 03ddc6cc93c7..000000000000 --- a/dtrans/source/os2/clipb/Os2Clipboard.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OS2CLIPBOARD_HXX_ -#define _OS2CLIPBOARD_HXX_ - -#include <rtl/ustring.hxx> -#include <sal/types.h> -#include <cppuhelper/compbase4.hxx> -#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp> -#include "Os2Transferable.hxx" - -// the service names -#define OS2_CLIPBOARD_SERVICE_NAME "com.sun.star.datatransfer.clipboard.SystemClipboard" - -// the implementation names -#define OS2_CLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.Os2Clipboard" - -// the registry key names -#define OS2_CLIPBOARD_REGKEY_NAME "/com.sun.star.datatransfer.clipboard.Os2Clipboard/UNO/SERVICES/com.sun.star.datatransfer.clipboard.SystemClipboard" - -namespace os2 { - -class Os2Clipboard : - //public cppu::WeakComponentImplHelper3< ::com::sun::star::datatransfer::clipboard::XClipboardEx, ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, ::com::sun::star::lang::XServiceInfo > - public ::cppu::WeakComponentImplHelper4 < \ - ::com::sun::star::datatransfer::clipboard::XClipboardEx, \ - ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, \ - ::com::sun::star::lang::XServiceInfo, \ - ::com::sun::star::lang::XInitialization > -{ - -public: - Os2Clipboard(); - ~Os2Clipboard(); - - /* - * XInitialization - */ - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) - throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - /* - * XServiceInfo - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); - - /* - * XClipboard - */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() - throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setContents( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) - throw( ::com::sun::star::uno::RuntimeException ); - virtual ::rtl::OUString SAL_CALL getName() - throw( ::com::sun::star::uno::RuntimeException ); - - /* - * XClipboardEx - */ - virtual sal_Int8 SAL_CALL getRenderingCapabilities() - throw( ::com::sun::star::uno::RuntimeException ); - - /* - * XClipboardNotifier - */ - virtual void SAL_CALL addClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) - throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) - throw( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL notifyAllClipboardListener( ); - -public: - sal_Bool m_bInSetClipboardData; - -private: - HAB hAB; - HWND hObjWnd; - ULONG hText, hBitmap; // handles to previous clipboard data - - ::osl::Mutex m_aMutex; - ::rtl::OUString m_aName; - - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; - - sal_Bool m_bInitialized; - -}; - -} // namespace Os2 - -// ------------------------------------------------------------------------ - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Os2Clipboard_getSupportedServiceNames(); -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Os2Clipboard_createInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/os2/clipb/Os2Service.cxx b/dtrans/source/os2/clipb/Os2Service.cxx deleted file mode 100644 index 264d4230f237..000000000000 --- a/dtrans/source/os2/clipb/Os2Service.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "Os2Clipboard.hxx" -#include <cppuhelper/factory.hxx> -#include <com/sun/star/container/XSet.hpp> -#include <osl/diagnose.h> - -using namespace com::sun::star::uno; -using namespace com::sun::star::registry; -using namespace cppu; -using namespace com::sun::star::lang; -using namespace com::sun::star::datatransfer::clipboard; -using namespace os2; - -using ::rtl::OUString; - -namespace os2 { - -Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) -{ - return Reference< XInterface >( static_cast< XClipboard* >( new Os2Clipboard() ) ); -} - -} // namespace os2 - -extern "C" -{ - -void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) -{ - void* pRet = 0; - - if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, OS2_CLIPBOARD_IMPL_NAME ) ) ) - { - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( OS2_CLIPBOARD_SERVICE_NAME ) ); - - //OUString( RTL_CONSTASCII_USTRINGPARAM( FPS_IMPL_NAME ) ) - Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( - reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createInstance, - aSNS ) ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/os2/clipb/Os2Transferable.cxx b/dtrans/source/os2/clipb/Os2Transferable.cxx deleted file mode 100644 index 908a2f00ace4..000000000000 --- a/dtrans/source/os2/clipb/Os2Transferable.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if OSL_DEBUG_LEVEL > 1 -#include <stdio.h> -#endif - -#define INCL_WIN -#include <svpm.h> - -#include <string.h> -#include <com/sun/star/io/IOException.hpp> -#include "Os2Transferable.hxx" - -using namespace com::sun::star::datatransfer; -using namespace com::sun::star::lang; -using namespace com::sun::star::io; -using namespace com::sun::star::uno; -using namespace cppu; -using namespace osl; -using namespace os2; - -using ::rtl::OUString; - -// ======================================================================= - -Os2Transferable::Os2Transferable( - const Reference< XInterface >& xCreator ) : - m_xCreator( xCreator ) -{ - debug_printf("Os2Transferable::Os2Transferable %08x\n", this); - hAB = WinQueryAnchorBlock( HWND_DESKTOP ); - - // query clipboard data to get mimetype - if( UWinOpenClipbrd( hAB ) ) - { - ULONG handle = UWinQueryClipbrdData( hAB, UCLIP_CF_UNICODETEXT); - if (handle) { - aFlavor.MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")); - aFlavor.DataType = getCppuType( (OUString*)0 ); - //debug_printf("Os2Transferable::Os2Transferable pszText %s\n", pszText); - } - handle = UWinQueryClipbrdData( hAB, UCLIP_CF_BITMAP); - if (handle) { - aFlavor.MimeType = OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )); - aFlavor.DataType = getCppuType( (OUString*)0 ); - //debug_printf("Os2Transferable::Os2Transferable pszText %s\n", pszText); - } - UWinCloseClipbrd( hAB); - } - else - { - debug_printf("Os2Transferable::Os2Transferable failed to open clipboard\n"); - } - -} - -//================================================================================================== - -Os2Transferable::~Os2Transferable() -{ - debug_printf("Os2Transferable::~Os2Transferable %08x\n", this); -} - -//================================================================================================== - -Any SAL_CALL Os2Transferable::getTransferData( const DataFlavor& rFlavor ) - throw(UnsupportedFlavorException, IOException, RuntimeException) -{ - debug_printf("Os2Transferable::getTransferData %08x\n", this); - debug_printf("Os2Transferable::getTransferData mimetype: %s\n", CHAR_POINTER(rFlavor.MimeType)); - Any aRet; - Sequence< sal_Int8 > aData; - - // retrieve unicode text - if( rFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")) ) ) - { - if( UWinOpenClipbrd( hAB ) ) - { - // check if clipboard has text format - sal_Unicode* pszText = (sal_Unicode*) UWinQueryClipbrdData( hAB, UCLIP_CF_UNICODETEXT); - if (pszText) { - // convert to oustring and return it - OUString aString( pszText); - aRet <<= aString; - } - UWinCloseClipbrd( hAB ); - if (pszText) - return aRet; - } - } - - // retrieve bitmap - if( rFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )) ) ) - { - if( UWinOpenClipbrd( hAB ) ) - { - // check if clipboard has text format - ULONG handle = UWinQueryClipbrdData( hAB, UCLIP_CF_BITMAP); - if (handle) { - Sequence< sal_Int8 > winDIBStream; - // convert to oustring and return it - if (OS2HandleToOOoBmp( handle, &winDIBStream)) - aRet <<= winDIBStream; - else - handle = 0; - } - UWinCloseClipbrd( hAB ); - if (handle) - return aRet; - } - } - - // clipboard format unsupported, throw exception - throw UnsupportedFlavorException( rFlavor.MimeType, static_cast < XTransferable * > ( this ) ); -} - -//================================================================================================== - -Sequence< DataFlavor > SAL_CALL Os2Transferable::getTransferDataFlavors() - throw(RuntimeException) -{ - debug_printf("Os2Transferable::getTransferDataFlavors %08x\n", this); - Sequence< DataFlavor > aFlavorList(1); - aFlavorList[0] = aFlavor; - debug_printf("Os2Transferable::getTransferDataFlavors mimetype: %s\n", CHAR_POINTER(aFlavor.MimeType)); - return aFlavorList; -} - -//================================================================================================== - -sal_Bool SAL_CALL Os2Transferable::isDataFlavorSupported( const DataFlavor& aFlavor ) - throw(RuntimeException) -{ - debug_printf("Os2Transferable::isDataFlavorSupported %08x\n", this); - debug_printf("Os2Transferable::isDataFlavorSupported %s\n", CHAR_POINTER(aFlavor.MimeType)); - - if( aFlavor.DataType != getCppuType( (Sequence< sal_Int8 >*)0 ) ) - { - if( ! aFlavor.MimeType.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("text/plain;charset=utf-16")) ) && - aFlavor.DataType == getCppuType( (OUString*)0 ) ) - return false; - } - - Sequence< DataFlavor > aFlavors( getTransferDataFlavors() ); - for( int i = 0; i < aFlavors.getLength(); i++ ) - if( aFlavor.MimeType.equalsIgnoreAsciiCase( aFlavors.getConstArray()[i].MimeType ) && - aFlavor.DataType == aFlavors.getConstArray()[i].DataType ) - return sal_True; - - return sal_False; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/os2/clipb/Os2Transferable.hxx b/dtrans/source/os2/clipb/Os2Transferable.hxx deleted file mode 100644 index 39126e522280..000000000000 --- a/dtrans/source/os2/clipb/Os2Transferable.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DTRANS_OS2_TRANSFERABLE_HXX_ -#define _DTRANS_OS2_TRANSFERABLE_HXX_ - -#include <com/sun/star/datatransfer/XTransferable.hpp> - -#include <com/sun/star/lang/XEventListener.hpp> -#include <cppuhelper/implbase1.hxx> -#include <osl/thread.h> - -#include <errno.h> - -#include <uclip.h> - -#define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer - -#if OSL_DEBUG_LEVEL > 1 -#define debug_printf( ...) { 1; } -#else -#define debug_printf( ...) { 1; } -#endif - -#define CPPUTYPE_SEQSALINT8 getCppuType( (const Sequence< sal_Int8 >*) 0 ) -#define CPPUTYPE_DEFAULT CPPUTYPE_SEQSALINT8 - -#ifdef OOO_VENDOR -using namespace com::sun::star::uno; -HBITMAP OOoBmpToOS2Handle( Any &aAnyB); -int OS2HandleToOOoBmp( HBITMAP hbm, Sequence< sal_Int8 >* winDIBStream); -#else -#define OOoBmpToOS2Handle(a) 0 -#define OS2HandleToOOoBmp(a,b) 0 -#endif - -namespace os2 { - - class Os2Transferable : public ::cppu::WeakImplHelper1 < - ::com::sun::star::datatransfer::XTransferable > - { - HAB hAB; - ::rtl::OUString clipText; - ::com::sun::star::datatransfer::DataFlavor aFlavor; - ::osl::Mutex m_aMutex; - ::com::sun::star::uno::Reference< XInterface > m_xCreator; - - public: - Os2Transferable( const ::com::sun::star::uno::Reference< XInterface >& xCreator); - virtual ~Os2Transferable(); - - /* - * XTransferable - */ - - virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) - throw(::com::sun::star::datatransfer::UnsupportedFlavorException, - ::com::sun::star::io::IOException, - ::com::sun::star::uno::RuntimeException - ); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) - throw(::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) - throw(::com::sun::star::uno::RuntimeException); - }; - -} // namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/os2/clipb/exports.dxp b/dtrans/source/os2/clipb/exports.dxp deleted file mode 100644 index 926e49f5f1a5..000000000000 --- a/dtrans/source/os2/clipb/exports.dxp +++ /dev/null @@ -1,3 +0,0 @@ -component_getImplementationEnvironment -component_getFactory - diff --git a/dtrans/source/os2/clipb/makefile.mk b/dtrans/source/os2/clipb/makefile.mk deleted file mode 100644 index a1ccc1ae87ec..000000000000 --- a/dtrans/source/os2/clipb/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=dtrans -TARGET=sysdtrans -ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST=$(TARGET) -COMPRDB=$(SOLARBINDIR)$/types.rdb -USE_BOUNDCHK= - -.IF "$(USE_BOUNDCHK)"=="TR" -bndchk=tr -stoponerror=tr -.ENDIF - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -SLOFILES= $(SLO)$/Os2Clipboard.obj \ - $(SLO)$/Os2Service.obj \ - $(SLO)$/Os2Transferable.obj - -.IF "$(OOO_VENDOR)"=="Serenity Systems Intl" -SLOFILES+= $(SLO)$/OS2Bitmap.obj -CDEFS+=-DOOO_VENDOR -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/dtrans/source/os2/clipb/sysdtrans.xml b/dtrans/source/os2/clipb/sysdtrans.xml deleted file mode 100644 index a6dec8a03a42..000000000000 --- a/dtrans/source/os2/clipb/sysdtrans.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> sysdtrans </module-name> - <component-description> - <author> Tino Rachui </author> - <name> com.sun.star.comp.datatransfer.SystemClipboard </name> - <description> - The win32 implementation of the datatransfer service. -</description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="beta"/> - <supported-service> com.sun.star.datatransfer.clipboard.SystemClipboard </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.datatransfer.clipboard.XClipboardEx </type> - <type> com.sun.star.datatransfer.XTransferable </type> - <type> com.sun.star.datatransfer.XTransferableEx </type> - <type> com.sun.star.datatransfer.clipboard.XClipboardOwner</type> - <type> com.sun.star.datatransfer.clipboard.XClipboardListener</type> - <type> com.sun.star.datatransfer.clipboard.XClipboardNotifier</type> - <type> com.sun.star.datatransfer.clipboard.XFlushableClipboard</type> - <type> com.sun.star.datatransfer.clipboard.RenderingCapabilities</type> - <type> com.sun.star.datatransfer.XTransferDataAccess </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.XAggregation </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.container.XSet </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper </runtime-module-dependency> - <runtime-module-dependency> cppu2 </runtime-module-dependency> - <runtime-module-dependency> sal2 </runtime-module-dependency> -</module-description> diff --git a/dtrans/source/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx index 16c6bba65c94..cd0de3ebf9ff 100644 --- a/dtrans/source/win32/clipb/wcbentry.cxx +++ b/dtrans/source/win32/clipb/wcbentry.cxx @@ -92,7 +92,7 @@ extern "C" // component_getImplementationEnvironment //---------------------------------------------------------------------- -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -103,7 +103,7 @@ void SAL_CALL component_getImplementationEnvironment( // returns a factory to create XFilePicker-Services //---------------------------------------------------------------------- -void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) { void* pRet = 0; diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx index 05de69261094..b089f95b6472 100644 --- a/dtrans/source/win32/dnd/dndentry.cxx +++ b/dtrans/source/win32/dnd/dndentry.cxx @@ -67,7 +67,7 @@ sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) // component_getImplementationEnvironment //---------------------------------------------------------------------- -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -78,7 +78,7 @@ void SAL_CALL component_getImplementationEnvironment( // returns a factory to create XFilePicker-Services //---------------------------------------------------------------------- -void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) { void* pRet = 0; Reference< XSingleServiceFactory > xFactory; diff --git a/dtrans/source/win32/ftransl/ftranslentry.cxx b/dtrans/source/win32/ftransl/ftranslentry.cxx index b8491fbb0481..fb0655ead9cd 100644 --- a/dtrans/source/win32/ftransl/ftranslentry.cxx +++ b/dtrans/source/win32/ftransl/ftranslentry.cxx @@ -95,7 +95,7 @@ extern "C" // component_getImplementationEnvironment //---------------------------------------------------------------------- -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -106,7 +106,7 @@ void SAL_CALL component_getImplementationEnvironment( // returns a factory to create XFilePicker-Services //---------------------------------------------------------------------- -void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) { void* pRet = 0; diff --git a/dtrans/util/makefile.mk b/dtrans/util/makefile.mk index 8df69bbf1d36..850f2910fbf7 100644 --- a/dtrans/util/makefile.mk +++ b/dtrans/util/makefile.mk @@ -155,27 +155,6 @@ DEF4EXPORTFILE= exports.dxp .ENDIF # "$(GUI)"=="WNT" -.IF "$(GUI)"=="OS2" - -# --- sysdtrans dll --- - -SHL3TARGET=$(TARGET3) - -SHL3LIBS=$(SLB)$/sysdtrans.lib - -SHL3STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - UClip.lib - -SHL3IMPLIB=i$(SHL3TARGET) - -SHL3DEF= $(MISC)$/$(SHL3TARGET).def -DEF3NAME= $(SHL3TARGET) -DEF3EXPORTFILE= exports.dxp - -.ENDIF # "$(GUI)"=="OS2" .ENDIF # L10N_framework .INCLUDE : target.mk diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 020cb72b3334..4f21704875fb 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -531,6 +531,7 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_TEKE_TYEE 0x0661 #define LANGUAGE_USER_VILI 0x0662 #define LANGUAGE_USER_PORTUGUESE_ANGOLA 0x8016 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PORTUGUESE)) */ +#define LANGUAGE_USER_MANX 0x0663 #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index a40e189bf82c..0bff3d0b174c 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -104,8 +104,8 @@ xdictionary::~xdictionary() { osl_unloadModule(hModule); for (sal_Int32 i = 0; i < CACHE_MAX; i++) { if (cache[i].size > 0) { - delete cache[i].contents; - delete cache[i].wordboundary; + delete [] cache[i].contents; + delete [] cache[i].wordboundary; } } } @@ -233,70 +233,70 @@ static sal_Int16 JapaneseCharType(sal_Unicode c) WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary& wordBoundary) { + WordBreakCache& rCache = cache[text[0] & 0x1f]; - WordBreakCache& aCache = cache[text[0] & 0x1f]; + if (rCache.size != 0 && rCache.equals(text, wordBoundary)) + return rCache; - if (aCache.size != 0 && aCache.equals(text, wordBoundary)) - return aCache; + sal_Int32 len = wordBoundary.endPos - wordBoundary.startPos; - sal_Int32 len = wordBoundary.endPos - wordBoundary.startPos; - - if (aCache.size == 0 || len > aCache.size) { - if (aCache.size != 0) { - delete aCache.contents; - delete aCache.wordboundary; - aCache.size = len; - } - else - aCache.size = len > DEFAULT_SIZE ? len : DEFAULT_SIZE; - aCache.contents = new sal_Unicode[aCache.size + 1]; - aCache.wordboundary = new sal_Int32[aCache.size + 2]; + if (rCache.size == 0 || len > rCache.size) { + if (rCache.size != 0) { + delete rCache.contents; + delete rCache.wordboundary; + rCache.size = len; } - aCache.length = len; - memcpy(aCache.contents, text + wordBoundary.startPos, len * sizeof(sal_Unicode)); - *(aCache.contents + len) = 0x0000; - // reset the wordboundary in cache - memset(aCache.wordboundary, '\0', sizeof(sal_Int32)*(len + 2)); - - sal_Int32 i = 0; // loop variable - while (aCache.wordboundary[i] < aCache.length) { - len = 0; - // look the continuous white space as one word and cashe it - while (u_isWhitespace((sal_uInt32)text[wordBoundary.startPos + aCache.wordboundary[i] + len])) - len ++; - - if (len == 0) { - const sal_Unicode *str = text + wordBoundary.startPos + aCache.wordboundary[i]; - sal_Int32 slen = aCache.length - aCache.wordboundary[i]; - sal_Int16 type = 0, count = 0; - for (;len == 0 && slen > 0; str++, slen--) { - len = getLongestMatch(str, slen); - if (len == 0) { - if (!japaneseWordBreak) { - len = 1; - } else { - if (count == 0) - type = JapaneseCharType(*str); - else if (type != JapaneseCharType(*str)) - break; - count++; - } + else + rCache.size = len > DEFAULT_SIZE ? len : DEFAULT_SIZE; + rCache.contents = new sal_Unicode[rCache.size + 1]; + rCache.wordboundary = new sal_Int32[rCache.size + 2]; + } + rCache.length = len; + memcpy(rCache.contents, text + wordBoundary.startPos, len * sizeof(sal_Unicode)); + *(rCache.contents + len) = 0x0000; + // reset the wordboundary in cache + memset(rCache.wordboundary, '\0', sizeof(sal_Int32)*(len + 2)); + + sal_Int32 i = 0; // loop variable + while (rCache.wordboundary[i] < rCache.length) { + len = 0; + // look the continuous white space as one word and cashe it + while (u_isWhitespace((sal_uInt32)text[wordBoundary.startPos + rCache.wordboundary[i] + len])) + len ++; + + if (len == 0) { + const sal_Unicode *str = text + wordBoundary.startPos + rCache.wordboundary[i]; + sal_Int32 slen = rCache.length - rCache.wordboundary[i]; + sal_Int16 type = 0, count = 0; + for (;len == 0 && slen > 0; str++, slen--) { + len = getLongestMatch(str, slen); + if (len == 0) { + if (!japaneseWordBreak) { + len = 1; + } else { + if (count == 0) + type = JapaneseCharType(*str); + else if (type != JapaneseCharType(*str)) + break; + count++; } } - if (count) { - aCache.wordboundary[i+1] = aCache.wordboundary[i] + count; - i++; - } } - - if (len) { - aCache.wordboundary[i+1] = aCache.wordboundary[i] + len; + if (count) + { + rCache.wordboundary[i+1] = rCache.wordboundary[i] + count; i++; } } - aCache.wordboundary[i + 1] = aCache.length + 1; - return aCache; + if (len) { + rCache.wordboundary[i+1] = rCache.wordboundary[i] + len; + i++; + } + } + rCache.wordboundary[i + 1] = rCache.length + 1; + + return rCache; } Boundary xdictionary::previousWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType) diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 4921c90f2223..ec0e86baf24e 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -269,12 +269,11 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3 { /* working variables */ long lFactorA, lFactorB, lFactorC, lFactorD, lFactorE; - long lAdjust; /* test whether to adjust for the Gregorian calendar crossover */ if (lJulianDay >= GREGORIAN_CROSSOVER) { /* calculate a small adjustment */ - lAdjust = (long) (((float) (lJulianDay - 1867216) - 0.25) / 36524.25); + long lAdjust = (long) (((float) (lJulianDay - 1867216) - 0.25) / 36524.25); lFactorA = lJulianDay + 1 + lAdjust - ((long) (0.25 * lAdjust)); diff --git a/i18npool/source/indexentry/genindex_data.cxx b/i18npool/source/indexentry/genindex_data.cxx index fcd16a6f4d7f..48ae02576a87 100644 --- a/i18npool/source/indexentry/genindex_data.cxx +++ b/i18npool/source/indexentry/genindex_data.cxx @@ -79,7 +79,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_Int32 nPos=0; sal_uInt32 nChar = Ostr.iterateCodePoints(&nPos, 2); - if (nChar > MAX_ADDRESS) { + if (nChar >= MAX_ADDRESS) { printf("Code point 0x%lx exceeds MAX_ADDRESS 0x%x, Please increase MAX_ADDRESS", static_cast<long unsigned int>(nChar), MAX_ADDRESS); exit(1); } diff --git a/i18npool/source/isolang/insys.cxx b/i18npool/source/isolang/insys.cxx index 4432a0923a0d..fac39e1f2689 100644 --- a/i18npool/source/isolang/insys.cxx +++ b/i18npool/source/isolang/insys.cxx @@ -33,7 +33,7 @@ #include "inwnt.cxx" -#elif defined( UNX ) || defined( OS2 ) +#elif defined( UNX ) #include "inunx.cxx" diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index f324277b482f..f639df661073 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -460,6 +460,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_BUSHI, "buc", "YT" }, { LANGUAGE_USER_TAHITIAN, "ty", "PF" }, { LANGUAGE_USER_MALAGASY_PLATEAU, "plt", "MG" }, + { LANGUAGE_USER_MALAGASY_PLATEAU, "mg", "MG" }, { LANGUAGE_USER_BAFIA, "ksf", "CM" }, { LANGUAGE_USER_GIKUYU, "ki", "KE" }, { LANGUAGE_USER_RUSYN_UKRAINE, "rue", "UA" }, @@ -478,6 +479,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_TEKE_TYEE, "tyx", "CG" }, { LANGUAGE_USER_VILI, "vif", "CG" }, { LANGUAGE_USER_PORTUGUESE_ANGOLA, "pt", "AO" }, + { LANGUAGE_USER_MANX, "gv", "GB" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 0e1e44ed8bb7..df038d445ead 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -29,9 +29,6 @@ PRJ=..$/..$/.. PRJNAME=i18npool TARGET=localedata -.IF "$(GUI)" == "OS2" -TARGET=ld -.ENDIF LIBTARGET=NO # Disable debugging on MSC compilers, due linker bug @@ -60,9 +57,6 @@ LINK_LOCALEDATA_ES_LIB=-l$(SHL2TARGET) LINK_LOCALEDATA_EN_LIB=$(LB)$/i$(SHL1TARGET).lib LINK_LOCALEDATA_ES_LIB=$(LB)$/i$(SHL2TARGET).lib .ENDIF -.ELIF "$(GUI)" == "OS2" -LINK_LOCALEDATA_EN_LIB=$(LB)$/i$(SHL1TARGET).lib -LINK_LOCALEDATA_ES_LIB=$(LB)$/i$(SHL2TARGET).lib .ELSE LINK_LOCALEDATA_EN_LIB=-l$(SHL1TARGET) LINK_LOCALEDATA_ES_LIB=-l$(SHL2TARGET) @@ -72,9 +66,6 @@ LINK_LOCALEDATA_ES_LIB=-l$(SHL2TARGET) # English Locales SHL1TARGET=localedata_en -.IF "$(GUI)" == "OS2" -SHL1TARGET=ld_en -.ENDIF SHL1IMPLIB=i$(SHL1TARGET) SHL1VERSIONMAP=localedata_en.map @@ -102,9 +93,6 @@ LIB1OBJFILES=$(SHL1OBJS) # Spanish Locales SHL2TARGET=localedata_es -.IF "$(GUI)" == "OS2" -SHL2TARGET=ld_es -.ENDIF SHL2IMPLIB=i$(SHL2TARGET) SHL2VERSIONMAP=localedata_es.map @@ -140,9 +128,6 @@ LIB2OBJFILES=$(SHL2OBJS) # European Locales SHL3TARGET=localedata_euro -.IF "$(GUI)" == "OS2" -SHL3TARGET=ld_eur -.ENDIF SHL3IMPLIB=i$(SHL3TARGET) SHL3VERSIONMAP=localedata_euro.map @@ -229,9 +214,6 @@ LIB3OBJFILES=$(SHL3OBJS) # Other Locales SHL4TARGET=localedata_others -.IF "$(GUI)" == "OS2" -SHL4TARGET=ld_oth -.ENDIF SHL4IMPLIB=i$(SHL4TARGET) SHL4VERSIONMAP=localedata_others.map diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index adf74e25aef8..d011865a7e35 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -52,17 +52,10 @@ typedef sal_Unicode*** (SAL_CALL * MyFunc_Type2)( sal_Int16&, sal_Int16& ); typedef sal_Unicode**** (SAL_CALL * MyFunc_Type3)( sal_Int16&, sal_Int16&, sal_Int16& ); typedef sal_Unicode const * const * (SAL_CALL * MyFunc_FormatCode)( sal_Int16&, sal_Unicode const *&, sal_Unicode const *& ); -#ifdef OS2 // YD 8.3!! -static const char *lcl_DATA_EN = "ld_en"; -static const char *lcl_DATA_ES = "ld_es"; -static const char *lcl_DATA_EURO = "ld_eur"; -static const char *lcl_DATA_OTHERS = "ld_oth"; -#else static const char *lcl_DATA_EN = "localedata_en"; static const char *lcl_DATA_ES = "localedata_es"; static const char *lcl_DATA_EURO = "localedata_euro"; static const char *lcl_DATA_OTHERS = "localedata_others"; -#endif static const struct { const char* pLocale; diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 8183b46d76cf..fd08933af2fa 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -576,12 +576,12 @@ static const struct InstancesArray { extern "C" { -void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ ) +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) { void* pRet = NULL; diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx index 252421fa25ce..fe1d1833e944 100644 --- a/i18npool/source/search/levdis.cxx +++ b/i18npool/source/search/levdis.cxx @@ -307,12 +307,12 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) // aus Userwerten nOtherX, nShorterY, nLongerZ, bRelaxed int WLevDistance::CalcLPQR( int nX, int nY, int nZ, bool bRelaxed ) { - int nMid, nMax; if ( nX < 0 ) nX = 0; // nur positive Werte if ( nY < 0 ) nY = 0; if ( nZ < 0 ) nZ = 0; if (0 == Min3( nX, nY, nZ )) // mindestens einer 0 { + int nMid, nMax; nMax = Max3( nX, nY, nZ ); // entweder 0 bei drei 0 oder Max if ( 0 == (nMid = Mid3( nX, nY, nZ )) ) // sogar zwei 0 nLimit = nMax; // entweder 0 oder einziger >0 diff --git a/i18npool/source/search/makefile.mk b/i18npool/source/search/makefile.mk index 372b32a216d1..ba47813a68c4 100644 --- a/i18npool/source/search/makefile.mk +++ b/i18npool/source/search/makefile.mk @@ -55,7 +55,7 @@ EXCEPTIONSNOOPTFILES= \ SHL1TARGET= $(TARGET) SHL1OBJS= $(SLOFILES) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") I18NREGEXPLIB=-li18nregexp$(COMID) .ELSE I18NREGEXPLIB=ii18nregexp.lib diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index ce8e7b15bfea..756d6c863ff9 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -982,13 +982,13 @@ SAL_CALL TextSearch_CreateInstance( extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) { void* pRet = NULL; diff --git a/i18nutil/source/utility/makefile.mk b/i18nutil/source/utility/makefile.mk index b38084309af4..adfddd91db2d 100644 --- a/i18nutil/source/utility/makefile.mk +++ b/i18nutil/source/utility/makefile.mk @@ -46,11 +46,7 @@ SLOFILES= \ $(SLO)$/oneToOneMapping.obj # Unicode utilities -.IF "$(GUI)" == "OS2" -SHL1TARGET= $(TARGET) -.ELSE SHL1TARGET= $(TARGET)$(COMID) -.ENDIF SHL1IMPLIB= i$(TARGET) DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 999eac78ec0a..0d707abe9898 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -342,7 +342,6 @@ public: static bool hasUTF8ByteOrderMarker( const ByteString &rString ); static void RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ); static bool fileHasUTF8ByteOrderMarker( const ByteString &rString ); - static ByteString GetIsoLangByIndex( sal_uInt16 nIndex ); static void QuotHTML( ByteString &rString ); static bool CopyFile( const ByteString& source , const ByteString& dest ); diff --git a/l10ntools/inc/xmlparse.hxx b/l10ntools/inc/xmlparse.hxx index 9f67e7343633..97e56df59253 100644 --- a/l10ntools/inc/xmlparse.hxx +++ b/l10ntools/inc/xmlparse.hxx @@ -176,7 +176,7 @@ public: ); virtual int GetPosition( ByteString id ); - size_t RemoveChild( XMLElement *pRefElement ); + int RemoveChild( XMLElement *pRefElement ); void RemoveAndDeleteAllChilds(); /// returns a child element which matches the given one @@ -270,31 +270,9 @@ public: /// UnQuot the XML characters and restore \n \t static void UnQuotHTML ( String &rString ); - - /// Return the numeric iso language code - //sal_uInt16 GetLangByIsoLang( const ByteString &rIsoLang ); - - /// Return the alpha strings representation - ByteString GetIsoLangByIndex( sal_uInt16 nIndex ); - - static XMLUtil& Instance(); - ~XMLUtil(); - - void dump(); - private: - /// Mapping iso alpha string code <-> iso numeric code - HashMap lMap; - - /// Mapping iso numeric code <-> iso alpha string code - ByteString isoArray[MAX_LANGUAGES]; - static void UnQuotData( String &rString ); static void UnQuotTags( String &rString ); - - XMLUtil(); - XMLUtil(const XMLUtil&); - }; diff --git a/l10ntools/layout/tralay.cxx b/l10ntools/layout/tralay.cxx index 8fc55c2e5428..e8c614450ca9 100644 --- a/l10ntools/layout/tralay.cxx +++ b/l10ntools/layout/tralay.cxx @@ -229,7 +229,7 @@ static bool is_dir( ByteString const& name ) FileBase::getFileURLFromSystemPath( sFileURL, sFileURL ); if( DirectoryItem::get( sFileURL, aItem ) == FileBase::E_None ) { - FileStatus aStatus(FileStatusMask_Type); + FileStatus aStatus(osl_FileStatus_Mask_Type); if( aItem.getFileStatus( aStatus ) == FileBase::E_None ) { if( aStatus.getFileType() == FileStatus::Directory ) diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl index a53ca9caf5e7..82e77930c2e0 100755 --- a/l10ntools/scripts/localize.pl +++ b/l10ntools/scripts/localize.pl @@ -73,9 +73,6 @@ my $srcpath = ''; my $languages; #my %sl_modules; # Contains all modules where en-US and de is source language my $use_default_date = '0'; -my $force_ooo_module = '0'; -my %is_ooo_module; -my %is_so_module; # ( leftpart ) ( rightpart ) # prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp @@ -91,9 +88,6 @@ parse_options(); my $binpath = ''; $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin/" ; -#%sl_modules = fetch_sourcelanguage_dirlist(); - - if ( $mode eq "merge" ) { if ( ! $no_gsicheck ){ merge_gsicheck(); @@ -133,9 +127,6 @@ sub splitfile{ # my %lang_hash; my %string_hash_ooo; - my %string_hash_so; - my %so_modules; - $so_modules{ "extras_full" } = "TRUE"; while( <MYFILE>){ if( /$sdf_regex/ ){ @@ -151,14 +142,7 @@ sub splitfile{ next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module chomp( $line ); - if( $force_ooo_module ) - { - $string_hash_ooo { $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line; - } - else - { - $string_hash_so{ $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line; - } + $string_hash_ooo { $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line; } } close( MYFILE ); @@ -169,20 +153,9 @@ sub splitfile{ } my $src_root = $ENV{SRC_ROOT}; my $ooo_src_root = $ENV{SRC_ROOT}; - my $so_l10n_path = $src_root."/sun/l10n_so/source"; my $ooo_l10n_path = $ooo_src_root."/translations/source"; - #print "$so_l10n_path\n"; - #print "$ooo_l10n_path\n"; - - if( $force_ooo_module ) - { - write_sdf( \%string_hash_ooo , $ooo_l10n_path ); - } - else - { - write_sdf( \%string_hash_so , $so_l10n_path ); - } + write_sdf( \%string_hash_ooo , $ooo_l10n_path ); } sub write_sdf @@ -324,24 +297,11 @@ sub merge_gsicheck{ } $sdffile = $tmpfile; } -######################################################### -# find search function -sub wanted -{ - my $file = $File::Find::name; - if( -f $file && $file =~ /.*localize.sdf$/ && !( $file =~ /.*\.svn.*/ ) ) { - push @sdfparticles , $file; - if( $bVerbose eq "1" ) { print STDOUT "$file\n"; } - else { print "."; } - } -} - sub add_paths { my $langhash_ref = shift; my $root_dir = $ENV{ SRC_ROOT }; my $ooo_l10n_dir = "$root_dir/translations/source"; - my $so_l10n_dir = "$root_dir/l10n_so/source"; if( -e $ooo_l10n_dir ) { @@ -356,20 +316,6 @@ sub add_paths } } else { die "ERROR: Can not find directory $ooo_l10n_dir!!!" } - if( -e $so_l10n_dir ) - { - foreach my $lang ( keys( %{ $langhash_ref } ) ) - { - my $loc_file = "$so_l10n_dir/$lang/localize.sdf"; - if( -e $loc_file ) - { - push @sdfparticles , "$ooo_l10n_dir/$lang/localize.sdf"; - } - else { #print "WARNING: $loc_file not found ....\n"; - } - } - - } } sub collectfiles{ print STDOUT "### Localize\n"; @@ -620,147 +566,9 @@ sub collectfiles{ #print STDOUT "DBG: \$localizeSDF $localizeSDF \$particleSDF_merged $particleSDF_merged\n"; unlink $localizeSDF , $particleSDF_merged , $my_localize_log; - - #sort_outfile( $outputfile ); - #remove_obsolete( $outputfile ) , if $bHasSourceLanguage ne ""; } ######################################################### -sub remove_obsolete{ - my $outfile = shift; - my @lines; - my $enusleftpart; - my @good_lines; - - print STDOUT "### Removing obsolete strings\n"; - - # Kick out all strings without en-US reference - if ( open ( SORTEDFILE , "< $outfile" ) ){ - while( <SORTEDFILE> ){ - if( /$sdf_regex/ ){ - my $line = defined $_ ? $_ : ''; - my $language = defined $12 ? $12 : ''; - my $prj = defined $3 ? $3 : ''; - my $file = defined $4 ? $4 : ''; - my $type = defined $6 ? $6 : ''; - my $gid = defined $7 ? $7 : ''; - my $lid = defined $8 ? $8 : ''; - my $plattform = defined $10 ? $10 : ''; - my $helpid = defined $9 ? $9 : ''; - - my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid; - - if( $language eq "en-US" ){ # source string found, 1. entry - $enusleftpart = $leftpart; - push @good_lines , $line; - }else{ - if( !defined $enusleftpart or !defined $leftpart ){ - print STDERR "BADLINE: $line\n"; - print STDERR "\$enusleftpart = $enusleftpart\n"; - print STDERR "\$leftpart = $leftpart\n"; - } - if( $enusleftpart eq $leftpart ){ # matching language - push @good_lines , $line; - } - #else{ - # print STDERR "OUT: \$enusleftpart=$enusleftpart \$leftpart=$leftpart \$line=$line\n"; - #} - } - } - } - close SORTEDFILE; - } else { print STDERR "ERROR: Can't open file $outfile\n";} - - # Write file - if ( open ( SORTEDFILE , "> $outfile" ) ){ - foreach my $newline ( @good_lines ) { - print SORTEDFILE $newline; - } - close SORTEDFILE; - } else { print STDERR "ERROR: Can't open file $outfile\n";} - -} -######################################################### -sub sort_outfile{ - my $outfile = shift; - print STDOUT "### Sorting ... $outfile ..."; - my @lines; - my @sorted_lines; - - - #if ( open ( SORTEDFILE , "< $outputfile" ) ){ - if ( open ( SORTEDFILE , "< $outfile" ) ){ - my $line; - while ( <SORTEDFILE> ){ - $line = $_; - if( $line =~ /^[^\#]/ ){ - push @lines , $line; - } - } - close SORTEDFILE; - @sorted_lines = sort { - my $xa_lang = ""; - my $xa_left_part = ""; - my $xa_right_part = ""; - my $xa_timestamp = ""; - my $xb_lang = ""; - my $xb_left_part = ""; - my $xb_right_part = ""; - my $xb_timestamp = ""; - my $xa = ""; - my $xb = ""; - my @alist; - my @blist; - - if( $a=~ /$sdf_regex/ ){ - $xa_left_part = defined $2 ? $2 : ''; - $xa_lang = defined $12 ? $12 : ''; - $xa_right_part = defined $13 ? $13 : ''; - $xa_left_part = remove_last_column( $xa_left_part ); - - } - if( $b=~ /$sdf_regex/ ){ - $xb_left_part = defined $2 ? $2 : ''; - $xb_lang = defined $12 ? $12 : ''; - $xb_right_part = defined $13 ? $13 : ''; - $xb_left_part = remove_last_column( $xb_left_part ); - - - } - if( ( $xa_left_part cmp $xb_left_part ) == 0 ){ # Left part equal - if( ( $xa_lang cmp $xb_lang ) == 0 ){ # Lang equal - return ( $xa_right_part cmp $xb_right_part ); # Right part compare - } - elsif( $xa_lang eq "en-US" ) { return -1; } # en-US wins - elsif( $xb_lang eq "en-US" ) { return 1; } # en-US wins - else { return $xa_lang cmp $xb_lang; } # lang compare - } - else { - return $xa_left_part cmp $xb_left_part; # Left part compare - } - } @lines; - - if ( open ( SORTEDFILE , "> $outfile" ) ){ - print SORTEDFILE get_license_header(); - foreach my $newline ( @sorted_lines ) { - print SORTEDFILE $newline; - #print STDOUT $newline; - } - } - close SORTEDFILE; - } else { print STDERR "WARNING: Can't open file $outfile\n";} - print "done\n"; - -} -######################################################### -sub remove_last_column{ - my $string = shift; - my @alist = split ( "\t" , $string ); - pop @alist; - return join( "\t" , @alist ); -} - -######################################################### sub rename_language{ my $fallbackhashhash_ref = shift; my $cur_fallback = shift; @@ -1005,7 +813,7 @@ sub parse_options{ my $extract; my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose , 'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date , 'c' => \$create_dirs , - 'n' => \$no_gsicheck , 'o' => \$force_ooo_module ); + 'n' => \$no_gsicheck ); $outputfile = $sdffile; #print STDOUT "DBG: lang = $languages\n"; @@ -1062,7 +870,6 @@ sub usage{ print STDERR " -h File with localize.sdf's\n!"; print STDERR " -n No gsicheck\n"; print STDERR " -i Module to merge\n"; - print STDERR " -o force using ooo localization from the l10n module instead of l10n_so; \n"; print STDERR " useful if the type can't be detected by the .svn tags; \n"; print STDERR " -v Verbose\n"; print STDERR "\nExample:\n"; diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index e3ee7aee552a..39b9a2579c8a 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -2261,7 +2261,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) break; nLIndex ++; PFormEntrys *oldEntry = pEntrys; - pEntrys = pMergeDataFile->GetPFormEntrys( pResData ); // <--- game over + pEntrys = pMergeDataFile->GetPFormEntrys( pResData ); if( !pEntrys ) pEntrys = oldEntry; } diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 5659123304c8..6e6a6d118323 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -690,7 +690,7 @@ DirEntry Export::GetTempFile() String sDecodedStr = INetURLObject::decode( strTmp , '%' , eMechanism ); ByteString sTmp( sDecodedStr , RTL_TEXTENCODING_UTF8 ); -#if defined(WNT) || defined(OS2) +#if defined(WNT) sTmp.SearchAndReplace("file:///",""); sTmp.SearchAndReplaceAll('/','\\'); #else diff --git a/l10ntools/source/filter/merge/makefile.mk b/l10ntools/source/filter/merge/makefile.mk index b66e5b27e6a1..8ef73debd743 100644 --- a/l10ntools/source/filter/merge/makefile.mk +++ b/l10ntools/source/filter/merge/makefile.mk @@ -65,7 +65,7 @@ JARCOMPRESS = TRUE .INCLUDE : target.mk -.IF "$(SOLAR_JAVA)" != "" || "$(GUI)"=="OS2" +.IF "$(SOLAR_JAVA)" != "" ALLTAR : $(OWNCOPY) .IF "$(JARTARGETN)" != "" diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index 7c5c0b9bef40..89fb66775d54 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -775,7 +775,7 @@ void Help() } /*****************************************************************************/ -#if defined(UNX) || defined(OS2) +#if defined(UNX) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/l10ntools/source/gsiconv.cxx b/l10ntools/source/gsiconv.cxx index 7fd345b6e3aa..06d203d1fb21 100644 --- a/l10ntools/source/gsiconv.cxx +++ b/l10ntools/source/gsiconv.cxx @@ -199,7 +199,7 @@ void Help() } /*****************************************************************************/ -#if defined(UNX) || defined(OS2) +#if defined(UNX) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/l10ntools/source/help/HelpCompiler.cxx b/l10ntools/source/help/HelpCompiler.cxx index f0e709cccf25..df2093931126 100644 --- a/l10ntools/source/help/HelpCompiler.cxx +++ b/l10ntools/source/help/HelpCompiler.cxx @@ -464,7 +464,7 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException ) streamTable.default_helptexts = aparser.helptexts; streamTable.default_keywords = aparser.keywords; } - else if (modulename == module) + else { streamTable.dropappl(); streamTable.appl_doc = docResolvedDoc; @@ -472,14 +472,6 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException ) streamTable.appl_helptexts = aparser.helptexts; streamTable.appl_keywords = aparser.keywords; } - else - { - std::stringstream aStrStream; - aStrStream << "ERROR: Found unexpected module name \"" << modulename - << "\" in file" << src.native_file_string().c_str() << std::endl; - throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); - } - } // end iteration over all applications streamTable.document_id = documentId; diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx index 8b063509a699..016f7eefb8bc 100644 --- a/l10ntools/source/help/HelpCompiler.hxx +++ b/l10ntools/source/help/HelpCompiler.hxx @@ -38,8 +38,8 @@ #include <sstream> #include <algorithm> #include <ctype.h> -#ifdef SYSTEM_DB -#include <db.h> +#ifdef SYSTEM_DB_HEADER +#include SYSTEM_DB_HEADER #else #include <berkeleydb/db.h> #endif diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 8dfb47303fd1..81a96ce37899 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -486,10 +486,8 @@ void HelpLinker::link() throw( HelpProcessingException ) if( !bExtensionMode ) { -#ifndef OS2 // YD @TODO@ crashes libc runtime :-( std::cout << "Making " << outputFile.native_file_string() << " from " << helpFiles.size() << " input files" << std::endl; -#endif } // here we start our loop over the hzip files. @@ -1060,9 +1058,7 @@ int main(int argc, char**argv) exit(1); } sal_uInt32 endtime = osl_getGlobalTimer(); -#ifndef OS2 // YD @TODO@ crashes libc runtime :-( std::cout << "time taken was " << (endtime-starttime)/1000.0 << " seconds" << std::endl; -#endif return 0; } @@ -1162,10 +1158,10 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp aTreeFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/help.tree")); osl::DirectoryItem aTreeFileItem; osl::FileBase::RC rcGet = osl::DirectoryItem::get( aTreeFileURL, aTreeFileItem ); - osl::FileStatus aFileStatus( FileStatusMask_FileSize ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileSize ); if( rcGet == osl::FileBase::E_None && aTreeFileItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None && - aFileStatus.isValid( FileStatusMask_FileSize ) ) + aFileStatus.isValid( osl_FileStatus_Mask_FileSize ) ) { sal_uInt64 ret, len = aFileStatus.getFileSize(); char* s = new char[ int(len) ]; // the buffer to hold the installed files diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk index b66077501a8d..3fd6879a9989 100644 --- a/l10ntools/source/help/makefile.mk +++ b/l10ntools/source/help/makefile.mk @@ -44,9 +44,7 @@ LIBXSLTINCDIR=external$/libxslt CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) .ENDIF -.IF "$(SYSTEM_DB)" == "YES" -CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) -.ENDIF +CFLAGS+= $(SYSTEM_DB_CFLAGS) .IF "$(SYSTEM_EXPAT)" == "YES" CFLAGS+=-DSYSTEM_EXPAT diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx index 74d183185cfa..e67f9793b899 100644 --- a/l10ntools/source/helpex.cxx +++ b/l10ntools/source/helpex.cxx @@ -201,7 +201,7 @@ void Help() /*****************************************************************************/ #ifndef TESTDRIVER -#if defined(UNX) || defined(OS2) +#if defined(UNX) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index a0032bc2558b..1905b7a9b2be 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -470,7 +470,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile if( !Export::CopyFile( sTempFile , sTempFileCopy ) ) { -#if defined(UNX) || defined(OS2) +#if defined(UNX) sleep( 3 ); #else Sleep( 3 ); @@ -488,7 +488,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile remove( sTargetFile.GetBuffer() ); } int rc; -#if defined(UNX) || defined(OS2) +#if defined(UNX) rc = rename( sTempFile.GetBuffer() , sTargetFile.GetBuffer() ); #else rc = MoveFileEx( sTempFile.GetBuffer() , sTargetFile.GetBuffer(), MOVEFILE_REPLACE_EXISTING ); @@ -504,7 +504,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile // if( aFS.GetSize() < 1 ) //#endif { -#if defined(UNX) || defined(OS2) +#if defined(UNX) sleep( 3 ); #else Sleep( 3 ); @@ -514,7 +514,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile { remove( sTargetFile.GetBuffer() ); } -#if defined(UNX) || defined(OS2) +#if defined(UNX) rc = rename( sTempFileCopy.GetBuffer() , sTargetFile.GetBuffer() ); #else rc = MoveFileEx( sTempFileCopy.GetBuffer() , sTargetFile.GetBuffer() , MOVEFILE_REPLACE_EXISTING ); diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx index 723b54d21e01..f9c286f43b25 100644 --- a/l10ntools/source/lngex.cxx +++ b/l10ntools/source/lngex.cxx @@ -171,7 +171,7 @@ void Help() } /*****************************************************************************/ -#if defined(UNX) || defined(OS2) +#if defined(UNX) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index fd49cadf256f..c6c38aa1850f 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -346,7 +346,7 @@ void SourceTreeLocalizer::WorkOnFile( ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US ); ByteString sDel; -#if defined(WNT) || defined(OS2) +#if defined(WNT) sDel=ByteString("\\"); #else sDel=ByteString("/"); @@ -355,7 +355,7 @@ void SourceTreeLocalizer::WorkOnFile( ByteString sPath2( Export::GetEnv("INPATH") ); ByteString sPath3( "bin" ); ByteString sExecutable( sPath1 ); -#if defined(WNT) || defined(OS2) +#if defined(WNT) sExecutable.SearchAndReplaceAll( "/", sDel ); #endif sExecutable += sDel ; @@ -876,7 +876,7 @@ sal_Bool CheckLanguages( ByteString &rLanguages ) } /*****************************************************************************/ -#if defined(UNX) || defined(OS2) +#if defined(UNX) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index fa7c914d233e..6576a94fcf8f 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -386,4 +386,4 @@ ByteString MergeDataFile::CreateKey( const ByteString& rTYP , const ByteString& return sKey.toAsciiUpperCase(); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx index 65bd70a32ef4..c3706aa4cd30 100644 --- a/l10ntools/source/tagtest.cxx +++ b/l10ntools/source/tagtest.cxx @@ -953,7 +953,6 @@ void TokenParser::Paragraph() Paragraph(); } break; - case TAG_OS2: case TAG_WIN: case TAG_UNIX: case TAG_MAC: //... @@ -1016,7 +1015,6 @@ void TokenParser::PfCase() CaseEnd(); } break; - case TAG_OS2: case TAG_WIN: case TAG_UNIX: case TAG_MAC: //First (PfBegin) @@ -1035,7 +1033,6 @@ void TokenParser::PfCaseBegin() { switch ( aTag.nId ) { - case TAG_OS2: case TAG_WIN: case TAG_UNIX: case TAG_MAC: diff --git a/l10ntools/source/xgfconv.cxx b/l10ntools/source/xgfconv.cxx index 211ea3cad402..82d928b33008 100644 --- a/l10ntools/source/xgfconv.cxx +++ b/l10ntools/source/xgfconv.cxx @@ -8,7 +8,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_l10ntools.hxx" -#if defined(UNX) || defined(OS2) +#if defined(UNX) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index f85bd90df8e2..7b0b11817687 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -188,7 +188,7 @@ int XMLParentNode::GetPosition( ByteString id ){ } /*****************************************************************************/ -size_t XMLParentNode::RemoveChild( XMLElement *pRefElement ) +int XMLParentNode::RemoveChild( XMLElement *pRefElement ) /*****************************************************************************/ { XMLElement* a; @@ -330,9 +330,6 @@ void XMLFile::WriteString( ofstream &rStream, const String &sString ) sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur ) { - XMLUtil& xmlutil = XMLUtil::Instance(); - (void) xmlutil; - if ( !pCur ) Write( rStream, this ); else { @@ -351,11 +348,11 @@ sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur ) for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ) { rStream << " "; String sData(* (*pElement->GetAttributeList())[ j ] ); - xmlutil.QuotHTML( sData ); + XMLUtil::QuotHTML( sData ); WriteString( rStream , sData ); rStream << "=\""; sData = (*pElement->GetAttributeList())[ j ]->GetValue(); - xmlutil.QuotHTML( sData ); + XMLUtil::QuotHTML( sData ); WriteString( rStream , sData ); rStream << "\""; } @@ -374,7 +371,7 @@ sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur ) case XML_NODE_TYPE_DATA: { XMLData *pData = ( XMLData * ) pCur; String sData( pData->GetData()); - xmlutil.QuotHTML( sData ); + XMLUtil::QuotHTML( sData ); WriteString( rStream, sData ); } break; @@ -1417,35 +1414,4 @@ void XMLUtil::UnQuotData( String &rString_in ){ } -XMLUtil::XMLUtil(){ -} - - -/*****************************************************************************/ -void XMLUtil::dump(){ -/*****************************************************************************/ - int cnt=1; - printf("size=%lu\n",static_cast<unsigned long>(lMap.size())); - for(HashMap::iterator pos = lMap.begin(); pos != lMap.end() ; ++pos){ - fprintf(stdout,"key=%s , value=%d , no=%d\n",pos->first.GetBuffer(),pos->second,cnt++); - } -} -/*****************************************************************************/ -XMLUtil& XMLUtil::Instance(){ -/*****************************************************************************/ - static XMLUtil instance; - return instance; -} -/*****************************************************************************/ -XMLUtil::~XMLUtil(){} -/*****************************************************************************/ -/*****************************************************************************/ -ByteString XMLUtil::GetIsoLangByIndex( sal_uInt16 nIndex ) -/*****************************************************************************/ -{ - if(nIndex > 0 && MAX_LANGUAGES >= nIndex ) - return isoArray[nIndex]; - return ""; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 69cc32c52306..c333f3d2060b 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -371,7 +371,7 @@ int XRMResParser::Execute( int nToken, char * pToken ) ByteString sLang = GetAttribute( sCurrentOpenTag, "xml:lang" ); WorkOnText( sCurrentOpenTag, sCurrentText ); Output( sCurrentText ); - EndOfText( sCurrentOpenTag, sCurrentCloseTag );// <--- + EndOfText( sCurrentOpenTag, sCurrentCloseTag ); bText = sal_False; rToken = ByteString(""); sCurrentText = ByteString(""); diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index 0c6ecd88e56b..3475aeeca9bb 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -36,13 +36,6 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -#building with stlport, but cppunit was not built with stlport -.IF "$(USE_SYSTEM_STL)"!="YES" -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGSCXX+=-DADAPT_EXT_STL -.ENDIF -.ENDIF - CFLAGSCXX += $(CPPUNIT_CFLAGS) .IF "$(L10N_framework)"=="" diff --git a/padmin/source/fontentry.cxx b/padmin/source/fontentry.cxx index 14376e45b2ca..ab84a548c1bc 100644 --- a/padmin/source/fontentry.cxx +++ b/padmin/source/fontentry.cxx @@ -107,35 +107,35 @@ String FontNameDlg::fillFontEntry( FastPrintFontInfo& rInfo, const String& rFile bool bWeight = true, bItalic = true, bWidth = true; switch( rInfo.m_eWeight ) { - case weight::Thin: aEntry.AppendAscii( ", " ); aEntry.Append( aThinTxt ); break; - case weight::UltraLight: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraLightTxt ); break; - case weight::Light: aEntry.AppendAscii( ", " ); aEntry.Append( aLightTxt ); break; - case weight::SemiLight: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiLightTxt ); break; - case weight::SemiBold: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiBoldTxt ); break; - case weight::Bold: aEntry.AppendAscii( ", " ); aEntry.Append( aBoldTxt ); break; - case weight::UltraBold: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraBoldTxt ); break; + case WEIGHT_THIN: aEntry.AppendAscii( ", " ); aEntry.Append( aThinTxt ); break; + case WEIGHT_ULTRALIGHT: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraLightTxt ); break; + case WEIGHT_LIGHT: aEntry.AppendAscii( ", " ); aEntry.Append( aLightTxt ); break; + case WEIGHT_SEMILIGHT: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiLightTxt ); break; + case WEIGHT_SEMIBOLD: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiBoldTxt ); break; + case WEIGHT_BOLD: aEntry.AppendAscii( ", " ); aEntry.Append( aBoldTxt ); break; + case WEIGHT_ULTRABOLD: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraBoldTxt ); break; default: bWeight = false; break; } switch( rInfo.m_eItalic ) { - case italic::Oblique: aEntry.AppendAscii( ", " ); aEntry.Append( aObliqueTxt ); break; - case italic::Italic: aEntry.AppendAscii( ", " ); aEntry.Append( aItalicTxt ); break; + case ITALIC_OBLIQUE: aEntry.AppendAscii( ", " ); aEntry.Append( aObliqueTxt ); break; + case ITALIC_NORMAL: aEntry.AppendAscii( ", " ); aEntry.Append( aItalicTxt ); break; default: bItalic = false; break; } switch( rInfo.m_eWidth ) { - case width::UltraCondensed: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraCondensedTxt ); break; - case width::ExtraCondensed: aEntry.AppendAscii( ", " ); aEntry.Append( aExtraCondensedTxt ); break; - case width::Condensed: aEntry.AppendAscii( ", " ); aEntry.Append( aCondensedTxt ); break; - case width::SemiCondensed: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiCondensedTxt ); break; - case width::SemiExpanded: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiExpandedTxt ); break; - case width::Expanded: aEntry.AppendAscii( ", " ); aEntry.Append( aExpandedTxt ); break; - case width::ExtraExpanded: aEntry.AppendAscii( ", " ); aEntry.Append( aExtraExpandedTxt ); break; - case width::UltraExpanded: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraExpandedTxt ); break; + case WIDTH_ULTRA_CONDENSED: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraCondensedTxt ); break; + case WIDTH_EXTRA_CONDENSED: aEntry.AppendAscii( ", " ); aEntry.Append( aExtraCondensedTxt ); break; + case WIDTH_CONDENSED: aEntry.AppendAscii( ", " ); aEntry.Append( aCondensedTxt ); break; + case WIDTH_SEMI_CONDENSED: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiCondensedTxt ); break; + case WIDTH_SEMI_EXPANDED: aEntry.AppendAscii( ", " ); aEntry.Append( aSemiExpandedTxt ); break; + case WIDTH_EXPANDED: aEntry.AppendAscii( ", " ); aEntry.Append( aExpandedTxt ); break; + case WIDTH_EXTRA_EXPANDED: aEntry.AppendAscii( ", " ); aEntry.Append( aExtraExpandedTxt ); break; + case WIDTH_ULTRA_EXPANDED: aEntry.AppendAscii( ", " ); aEntry.Append( aUltraExpandedTxt ); break; default: bWidth = false; break; diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 41950f8b1864..0a1cee5e557f 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -108,8 +108,8 @@ void padmin::FindFiles( const String& rDirectory, ::std::list< String >& rResult DirectoryItem aItem; while( aDir.getNextItem( aItem ) == FileBase::E_None ) { - FileStatus aStatus( FileStatusMask_FileName | - FileStatusMask_Type + FileStatus aStatus( osl_FileStatus_Mask_FileName | + osl_FileStatus_Mask_Type ); if( aItem.getFileStatus( aStatus ) == FileBase::E_None ) { diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx index 7e47e4264d8c..63c46fd3160b 100644 --- a/padmin/source/pamain.cxx +++ b/padmin/source/pamain.cxx @@ -46,6 +46,7 @@ #include "unotools/configmgr.hxx" #include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/lang/XComponent.hpp" using namespace padmin; using namespace cppu; @@ -104,10 +105,11 @@ int MyApp::Main() //------------------------------------------------- // create the global service-manager //------------------------------------------------- + Reference< XComponentContext > xCtx; Reference< XMultiServiceFactory > xFactory; try { - Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext(); + xCtx = defaultBootstrap_InitialComponentContext(); xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(), UNO_QUERY ); if( xFactory.is() ) setProcessServiceFactory( xFactory ); @@ -175,6 +177,18 @@ int MyApp::Main() */ ::ucbhelper::ContentBroker::deinitialize(); + /* + * clean up UNO + */ + try + { + Reference<XComponent> xComp(xCtx, UNO_QUERY_THROW); + xComp->dispose(); + } + catch(...) + { + } + return EXIT_SUCCESS; } diff --git a/regexp/source/reclass.cxx b/regexp/source/reclass.cxx index ed766fdc2503..79457e6c1fd3 100644 --- a/regexp/source/reclass.cxx +++ b/regexp/source/reclass.cxx @@ -1689,7 +1689,7 @@ Regexpr::regex_compile() sal_Unicode tmp = translit->transliterateChar2Char(c); BUF_PUSH(tmp); (*pending_exact)++; - } catch (::com::sun::star::i18n::MultipleCharsOutputException e) { + } catch (const ::com::sun::star::i18n::MultipleCharsOutputException&) { ::rtl::OUString o2( translit->transliterateChar2String( c)); sal_Int32 len2 = o2.getLength(); const sal_Unicode * k2 = o2.getStr(); @@ -2934,7 +2934,7 @@ Regexpr::set_list_bit(sal_Unicode c, sal_Unicode *b) try { sal_Unicode tmp = translit->transliterateChar2Char(c); b[tmp / BYTEWIDTH] |= 1 << (tmp % BYTEWIDTH); - } catch (::com::sun::star::i18n::MultipleCharsOutputException e) { + } catch (const ::com::sun::star::i18n::MultipleCharsOutputException&) { ::rtl::OUString o2( translit->transliterateChar2String( c)); sal_Int32 len2 = o2.getLength(); const sal_Unicode * k2 = o2.getStr(); diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 0f59c7ab4cdf..47be75549220 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -49,7 +49,6 @@ #include <rtl/textcvt.h> #include <rtl/textenc.h> -#include <tools/list.hxx> using ::rtl::OString; using ::rtl::OStringBuffer; @@ -380,12 +379,12 @@ void IncludeParser( RscFileInst * pFileInst ) if( STRING == (nToken = MakeToken( &aYYSType )) ){ lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, aYYSType.string ); - pFName->InsertDependFile( lKey, LIST_APPEND ); + pFName->InsertDependFile( lKey, ULONG_MAX ); } else if( INCLUDE_STRING == nToken ){ lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, ByteString() ); - pFName->InsertDependFile( lKey, LIST_APPEND ); + pFName->InsertDependFile( lKey, ULONG_MAX ); }; }; }; diff --git a/rsc/source/parser/rscyacc.cxx b/rsc/source/parser/rscyacc.cxx index efef5f3b42ff..c795abcc1fc9 100644 --- a/rsc/source/parser/rscyacc.cxx +++ b/rsc/source/parser/rscyacc.cxx @@ -33,7 +33,6 @@ #include <string.h> #include <tools/rc.h> -#include <tools/list.hxx> #include <rscerror.h> #include <rsctools.hxx> #include <rscclass.hxx> diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index 329884e498b6..24240d184236 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -148,7 +148,7 @@ resource_definition if( $4.IsNumber() ){ if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), ByteString( $3 ), - $4.GetLong(), LIST_APPEND ) ) + $4.GetLong(), ULONG_MAX ) ) bError = sal_True; } else if( $4.IsDefinition() ){ @@ -161,13 +161,13 @@ resource_definition pExpr = new RscExpression( aExpType, '+', $4 ); if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), - ByteString( $3 ), pExpr, LIST_APPEND ) ) + ByteString( $3 ), pExpr, ULONG_MAX ) ) bError = sal_True; } else if( $4.IsExpression() ){ if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), ByteString( $3 ), $4.aExp.pExp, - LIST_APPEND ) ) + ULONG_MAX ) ) bError = sal_True; } diff --git a/rsc/source/prj/makefile.mk b/rsc/source/prj/makefile.mk index b8e0224a5cd0..ebd1740aa1b3 100644 --- a/rsc/source/prj/makefile.mk +++ b/rsc/source/prj/makefile.mk @@ -45,9 +45,7 @@ APP1TARGET= rsc APP1STDLIBS=$(TOOLSLIB) $(I18NISOLANGLIB) $(SALLIB) # $(RTLLIB) APP1LIBS= $(LB)$/rsctoo.lib APP1OBJS= $(OBJ)$/start.obj -.IF "$(GUI)" != "OS2" APP1STACK=64000 -.ENDIF APP1RPATH=NONE APP2TARGET= rsc2 @@ -58,9 +56,7 @@ APP2LIBS= $(LB)$/rsctoo.lib \ $(LB)$/rscrsc.lib \ $(LB)$/rscmis.lib APP2OBJS= $(OBJ)$/gui.obj -.IF "$(GUI)" != "OS2" APP2STACK=64000 -.ENDIF APP2RPATH=NONE # --- Targets ------------------------------------------------------------ diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index 532851ffbdea..8a949546ce3a 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -41,12 +41,7 @@ #include <io.h> #include <process.h> -#if defined ( OS2 ) && !defined ( GCC ) -#include <direct.h> -#endif -#if !defined ( OS2 ) #include <dos.h> -#endif #endif // UNX #include <rsctools.hxx> @@ -151,11 +146,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, pCmdL = &aRespCmdL; for( i = 0; i < (int)(aNewCmdL.GetCount() -1); i++ ) { -#ifdef OS2 - fprintf( fRspFile, "%s\n", (const char *)aNewCmdL.GetEntry( i ) ); -#else fprintf( fRspFile, "%s ", (const char *)aNewCmdL.GetEntry( i ) ); -#endif } fclose( fRspFile ); @@ -171,7 +162,7 @@ static sal_Bool CallPrePro( const ByteString& rPrePro, } } -#if defined UNX || defined OS2 +#if defined UNX nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() ); #else nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char**)pCmdL->GetBlock() ); @@ -238,28 +229,16 @@ static sal_Bool CallRsc2( ByteString aRsc2Name, { } else -#ifdef OS2 - fprintf( fRspFile, "%s\n", -#else fprintf( fRspFile, "%s ", -#endif (const char *)pCmdLine->GetEntry( i ) ); }; -#ifdef OS2 - fprintf( fRspFile, "%s\n", aSrsName.GetBuffer() ); -#else fprintf( fRspFile, "%s", aSrsName.GetBuffer() ); -#endif for ( size_t i = 0, n = pInputList->size(); i < n; ++i ) { pString = (*pInputList)[ i ]; -#ifdef OS2 - fprintf( fRspFile, "%s\n", pString->GetBuffer() ); -#else fprintf( fRspFile, " %s", pString->GetBuffer() ); -#endif }; fclose( fRspFile ); @@ -281,7 +260,7 @@ static sal_Bool CallRsc2( ByteString aRsc2Name, printf( "\n" ); } -#if defined UNX || defined OS2 +#if defined UNX nExit = spawnvp( P_WAIT, aRsc2Name.GetBuffer(), (char* const*)aNewCmdL.GetBlock() ); #else nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char**)aNewCmdL.GetBlock() ); diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c index 3654330a9035..92887b1c675f 100644 --- a/rsc/source/rscpp/cpp3.c +++ b/rsc/source/rscpp/cpp3.c @@ -168,7 +168,7 @@ void setincdirs() * verwendete knallte es in strcpy() ! */ -#if !defined( WNT ) && ! defined UNX && ! defined OS2 +#if !defined( WNT ) && ! defined UNX extern char *getenv( char *pStr ); /* BP */ #endif char *pIncGetEnv = NULL; /* Pointer auf INCLUDE */ diff --git a/rsc/source/rscpp/makefile.mk b/rsc/source/rscpp/makefile.mk index ca62bb37792c..2cec0885ffad 100644 --- a/rsc/source/rscpp/makefile.mk +++ b/rsc/source/rscpp/makefile.mk @@ -61,10 +61,8 @@ OBJFILES= \ LIBSALCPPRT=$(0) APP1TARGET= $(TARGET) APP1LIBS=$(LB)$/$(TARGET).lib -.IF "$(GUI)" != "OS2" APP1STACK=32768 .ENDIF -.ENDIF .IF "$(GUI)"=="UNX" CDEFS+=-Dunix diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index 99268b83d3d8..ad4bab1412a2 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -32,7 +32,6 @@ // Programmuebergreifende Includes. #include <rscdef.hxx> -#include <tools/list.hxx> /****************** C o d e **********************************************/ /****************** R s c I d ********************************************/ @@ -876,7 +875,7 @@ sal_Bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, if( lFileKey == pDefDec->GetFileKey() ) { RscFile * pFile = GetFile( pDefDec->GetFileKey() ); if( pFile && (lPos <= pFile->aDefLst.GetPos( (RscDefine *)pDefDec )) - && (lPos != LIST_APPEND) ) + && (lPos != ULONG_MAX ) ) return sal_False; } else if( !Depend( lFileKey, pDefDec->GetFileKey() ) ) @@ -1138,7 +1137,7 @@ sal_uLong RscFileTab :: NewCodeFile( const ByteString & rName ) pFName->aFileName = rName; pFName->aPathName = rName; lKey = Insert( pFName ); - pFName->InsertDependFile( lKey, LIST_APPEND ); + pFName->InsertDependFile( lKey, ULONG_MAX ); } return lKey; } @@ -1162,7 +1161,7 @@ sal_uLong RscFileTab :: NewIncFile( const ByteString & rName, pFName->aPathName = rPath; pFName->SetIncFlag(); lKey = Insert( pFName ); - pFName->InsertDependFile( lKey, LIST_APPEND ); + pFName->InsertDependFile( lKey, ULONG_MAX ); } return lKey; } diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index 11f4fff7caf1..ec0931607c44 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -36,9 +36,6 @@ #if defined (WNT ) #include <direct.h> #endif -#if defined ( OS2 ) && !defined ( GCC ) -#include <direct.h> -#endif #include <string.h> #include <ctype.h> diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/cppunit/makefile.mk index b28f0cbac2ab..e06eca25a737 100644 --- a/sax/qa/cppunit/makefile.mk +++ b/sax/qa/cppunit/makefile.mk @@ -35,13 +35,6 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -#building with stlport, but cppunit was not built with stlport -.IF "$(USE_SYSTEM_STL)"!="YES" -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGSCXX+=-DADAPT_EXT_STL -.ENDIF -.ENDIF - CFLAGSCXX += $(CPPUNIT_CFLAGS) DLLPRE = # no leading "lib" on .so files diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 114d29bea648..06258510ceca 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -1029,13 +1029,13 @@ using namespace sax_expatwrap; extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sax/source/fastparser/facreg.cxx b/sax/source/fastparser/facreg.cxx index af05616854c1..e4152cfc1b58 100644 --- a/sax/source/fastparser/facreg.cxx +++ b/sax/source/fastparser/facreg.cxx @@ -35,13 +35,13 @@ Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance( const Referen extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index bff58a6a5817..e24721fb0d7c 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -525,6 +525,19 @@ void SAL_CALL FastSaxParser::registerNamespace( const OUString& NamespaceURL, sa throw IllegalArgumentException(); } +OUString SAL_CALL FastSaxParser::getNamespaceURL( const OUString& rPrefix ) throw(IllegalArgumentException, RuntimeException) +{ + try + { + return GetNamespaceURL( OUStringToOString( rPrefix, RTL_TEXTENCODING_UTF8 ) ); + } + catch(Exception) + { + ; + } + throw IllegalArgumentException(); +} + void FastSaxParser::setErrorHandler(const Reference< XErrorHandler > & Handler) throw (RuntimeException) { maData.mxErrorHandler = Handler; diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx index 77f04c798433..09a1d72be9ce 100644 --- a/sax/source/fastparser/fastparser.hxx +++ b/sax/source/fastparser/fastparser.hxx @@ -112,6 +112,7 @@ public: virtual void SAL_CALL setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL registerNamespace( const ::rtl::OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNamespaceURL( const ::rtl::OUString& rPrefix ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setErrorHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setEntityResolver( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver >& Resolver ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setLocale( const ::com::sun::star::lang::Locale& rLocale ) throw (::com::sun::star::uno::RuntimeException); diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index e894c2ca0d13..a44d148e1aba 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -514,7 +514,7 @@ namespace sax_fastparser { std::map< sal_Int32, Int8Sequence >::iterator iter = maData.begin(); while ( iter != maData.end( ) ) { - fprintf( stderr, "pair: %d, ", iter->first ); + fprintf( stderr, "pair: %ld, ", iter->first ); for ( sal_Int32 i=0, len=iter->second.getLength(); i < len; ++i ) fprintf( stderr, "%c", iter->second[i] ); fprintf( stderr, "\n" ); diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index 6fe4fb5b1d0a..db58f193088f 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -787,7 +787,7 @@ extern "C" { -void SAL_CALL component_getImplementationEnvironment( +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -830,7 +830,7 @@ sal_Bool SAL_CALL component_writeInfo( return sal_False; } -void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { void * pRet = 0; diff --git a/sot/Package_inc.mk b/sot/Package_inc.mk index 1b664c263184..f1f71cf91b2a 100644 --- a/sot/Package_inc.mk +++ b/sot/Package_inc.mk @@ -27,7 +27,6 @@ $(eval $(call gb_Package_Package,sot_inc,$(SRCDIR)/sot/inc)) $(eval $(call gb_Package_add_file,sot_inc,inc/sot/absdev.hxx,sot/absdev.hxx)) -$(eval $(call gb_Package_add_file,sot_inc,inc/sot/agg.hxx,sot/agg.hxx)) $(eval $(call gb_Package_add_file,sot_inc,inc/sot/clsids.hxx,sot/clsids.hxx)) $(eval $(call gb_Package_add_file,sot_inc,inc/sot/exchange.hxx,sot/exchange.hxx)) $(eval $(call gb_Package_add_file,sot_inc,inc/sot/factory.hxx,sot/factory.hxx)) diff --git a/sot/inc/sot/agg.hxx b/sot/inc/sot/agg.hxx deleted file mode 100644 index ff5b282160ae..000000000000 --- a/sot/inc/sot/agg.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SOT_AGG_HXX -#define _SOT_AGG_HXX - -#include <tools/ownlist.hxx> - -/************** class SvAggregate ***************************************/ -/************************************************************************/ -class SotFactory; -class SotObject; -struct SvAggregate -{ - union - { - SotFactory * pFact; - SotObject * pObj; - }; - sal_Bool bFactory; - sal_Bool bMainObj; // sal_True, das Objekt, welches das casting steuert - - SvAggregate() - : pFact( NULL ) - , bFactory( sal_False ) - , bMainObj( sal_False ) {} - SvAggregate( SotObject * pObjP, sal_Bool bMainP ) - : pObj( pObjP ) - , bFactory( sal_False ) - , bMainObj( bMainP ) {} - SvAggregate( SotFactory * pFactP ) - : pFact( pFactP ) - , bFactory( sal_True ) - , bMainObj( sal_False ) {} -}; - -/************** class SvAggregateMemberList *****************************/ -/************************************************************************/ -class SvAggregateMemberList -{ - PRV_SV_DECL_OWNER_LIST(SvAggregateMemberList,SvAggregate) -}; - -#endif // _AGG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sot/inc/sot/object.hxx b/sot/inc/sot/object.hxx index 02ae430a38f8..40cc26800317 100644 --- a/sot/inc/sot/object.hxx +++ b/sot/inc/sot/object.hxx @@ -427,10 +427,6 @@ private: //==================class SotObjectRef====================================== SV_IMPL_REF(SotObject) -//==================class SotObject*List==================================== -SV_DECL_REF_LIST(SotObject,SotObject*) -SV_IMPL_REF_LIST(SotObject,SotObject*) - #endif // _IFACE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sot/inc/sot/sotdata.hxx b/sot/inc/sot/sotdata.hxx index 0e2564ee0ae9..ec8a3563c5c8 100644 --- a/sot/inc/sot/sotdata.hxx +++ b/sot/inc/sot/sotdata.hxx @@ -34,25 +34,27 @@ #include <tools/solar.h> #include "sot/sotdllapi.h" +#include <com/sun/star/datatransfer/DataFlavor.hpp> #include <vector> +#include <list> //==================class SotData_Impl==================================== -class List; class SotFactory; -class SotObjectList; +class SotObject; typedef ::std::vector< SotFactory* > SotFactoryList; +typedef ::std::vector< com::sun::star::datatransfer::DataFlavor* > tDataFlavorList; struct SotData_Impl { - sal_uInt32 nSvObjCount; - SotObjectList * pObjectList; + sal_uInt32 nSvObjCount; + std::list<SotObject*> aObjectList; SotFactoryList * pFactoryList; SotFactory * pSotObjectFactory; SotFactory * pSotStorageStreamFactory; SotFactory * pSotStorageFactory; - List* pDataFlavorList; + tDataFlavorList* pDataFlavorList; SotData_Impl(); }; diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx index 30ffbf06d2a7..2d17974d0a2d 100644 --- a/sot/inc/sot/stg.hxx +++ b/sot/inc/sot/stg.hxx @@ -42,9 +42,11 @@ #include <tools/rtti.hxx> #include <tools/stream.hxx> #include <tools/globname.hxx> +#include "sot/storinfo.hxx" #include "sot/sotdllapi.h" #include <list> + class UNOStorageHolder; typedef ::std::list< UNOStorageHolder* > UNOStorageHolderList; @@ -99,7 +101,6 @@ public: virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0; }; -class SvStorageInfoList; class BaseStorage : public StorageBase { public: diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx index 1e78865a3ef0..e1ce95158b12 100644 --- a/sot/inc/sot/storage.hxx +++ b/sot/inc/sot/storage.hxx @@ -38,6 +38,7 @@ #include <sot/factory.hxx> #include <tools/stream.hxx> #include <tools/errcode.hxx> +#include "sot/storinfo.hxx" #include "sot/sotdllapi.h" #define STORAGE_FAILIFTHERE 0x02 @@ -108,7 +109,6 @@ namespace ucbhelper class Content; } -class SvStorageInfoList; class BaseStorage; class UNOStorageHolder; class SOT_DLLPUBLIC SotStorage : virtual public SotObject diff --git a/sot/inc/sot/storinfo.hxx b/sot/inc/sot/storinfo.hxx index 0d7c73d3717c..53af47454ea4 100644 --- a/sot/inc/sot/storinfo.hxx +++ b/sot/inc/sot/storinfo.hxx @@ -29,9 +29,8 @@ #ifndef _SOT_STORINFO_HXX #define _SOT_STORINFO_HXX -#include <tools/pstm.hxx> #include <tools/globname.hxx> -#include <tools/ownlist.hxx> +#include <vector> #include "sot/sotdllapi.h" class StgDirEntry; @@ -40,8 +39,8 @@ class SvStorageInfo friend class SvStorage; String aName; SvGlobalName aClassName; - sal_uLong nSize; - sal_Bool bStream:1, + sal_uLong nSize; + sal_Bool bStream:1, bStorage:1; SvStorageInfo(){}; // Fuer SvStorage @@ -61,11 +60,7 @@ public: sal_uLong GetSize() const { return nSize; } }; -class SOT_DLLPUBLIC SvStorageInfoList -{ - PRV_SV_DECL_OWNER_LIST(SvStorageInfoList,SvStorageInfo) - const SvStorageInfo * Get( const String & rName ); -}; +typedef ::std::vector< SvStorageInfo > SvStorageInfoList; SOT_DLLPUBLIC sal_uLong ReadClipboardFormat( SvStream & rStm ); SOT_DLLPUBLIC void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat ); diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index f27df19eceb1..20b8efddbfff 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -33,7 +33,6 @@ #define _SOT_FORMATS_INCLUDE_SYSTEMFORMATS #include <tools/debug.hxx> #include <tools/solar.h> -#include <tools/list.hxx> #include <tools/globname.hxx> #include <tools/string.hxx> #include <sot/sotdata.hxx> @@ -42,7 +41,6 @@ #include <sot/clsids.hxx> #include <rtl/instance.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/datatransfer/DataFlavor.hpp> #include <comphelper/documentconstants.hxx> #ifdef GetObject @@ -229,11 +227,11 @@ namespace //----------------------------------------------------------------------- -static List& InitFormats_Impl() +static tDataFlavorList& InitFormats_Impl() { SotData_Impl * pSotData = SOTDATA(); if( !pSotData->pDataFlavorList ) - pSotData->pDataFlavorList = new List(); + pSotData->pDataFlavorList = new tDataFlavorList(); return *pSotData->pDataFlavorList; } @@ -263,10 +261,10 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName ) : i ); // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + tDataFlavorList& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && rName == String( pFlavor->HumanPresentableName ) ) return i + SOT_FORMATSTR_ID_USER_END + 1; } @@ -278,7 +276,7 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName ) pNewFlavor->HumanPresentableName = rName; pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 ); - rL.Insert( pNewFlavor, LIST_APPEND ); + rL.push_back( pNewFlavor ); return nMax + SOT_FORMATSTR_ID_USER_END + 1; } @@ -298,10 +296,10 @@ sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType ) return i; // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + tDataFlavorList& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && rMimeType == String( pFlavor->MimeType ) ) return i + SOT_FORMATSTR_ID_USER_END + 1; } @@ -313,7 +311,7 @@ sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType ) pNewFlavor->HumanPresentableName = rMimeType; pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 ); - rL.Insert( pNewFlavor, LIST_APPEND ); + rL.push_back( pNewFlavor ); return nMax + SOT_FORMATSTR_ID_USER_END + 1; } @@ -330,9 +328,9 @@ sal_uLong SotExchange::RegisterFormat( const DataFlavor& rFlavor ) if( !nRet ) { - List& rL = InitFormats_Impl(); - nRet = rL.Count() + SOT_FORMATSTR_ID_USER_END + 1; - rL.Insert( new DataFlavor( rFlavor ), LIST_APPEND ); + tDataFlavorList& rL = InitFormats_Impl(); + nRet = rL.size() + SOT_FORMATSTR_ID_USER_END + 1; + rL.push_back( new DataFlavor( rFlavor ) ); } return nRet; @@ -359,13 +357,13 @@ sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavo } else { - List& rL = InitFormats_Impl(); + tDataFlavorList& rL = InitFormats_Impl(); nFormat -= SOT_FORMATSTR_ID_USER_END + 1; - if( rL.Count() > nFormat ) + if( rL.size() > nFormat ) { - rFlavor = *(DataFlavor*) rL.GetObject( nFormat ); + rFlavor = *rL[ nFormat ]; bRet = sal_True; } else @@ -393,12 +391,12 @@ String SotExchange::GetFormatMimeType( sal_uLong nFormat ) sMimeType.AssignAscii( FormatArray_Impl::get()[nFormat].pMimeType ); else { - List& rL = InitFormats_Impl(); + tDataFlavorList& rL = InitFormats_Impl(); nFormat -= SOT_FORMATSTR_ID_USER_END + 1; - if( rL.Count() > nFormat ) - sMimeType = ((DataFlavor*) rL.GetObject( nFormat ))->MimeType; + if( rL.size() > nFormat ) + sMimeType = rL[ nFormat ]->MimeType; } DBG_ASSERT( sMimeType.Len(), "SotExchange::GetFormatMimeType(): DataFlavor not initialized" ); @@ -431,11 +429,11 @@ sal_uLong SotExchange::GetFormatIdFromMimeType( const String& rMimeType ) : i ); // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); + tDataFlavorList& rL = InitFormats_Impl(); ::rtl::OUString aMimeType( rMimeType ); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && aMimeType == pFlavor->MimeType ) return i + SOT_FORMATSTR_ID_USER_END + 1; } @@ -471,10 +469,10 @@ sal_uLong SotExchange::GetFormat( const DataFlavor& rFlavor ) : i ); // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + tDataFlavorList& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && rMimeType == pFlavor->MimeType ) return i + SOT_FORMATSTR_ID_USER_END + 1; } diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 904c6a7f90f8..01d098e62a75 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -39,7 +39,6 @@ #include <sot/sotdata.hxx> #include <sot/clsids.hxx> #include <rtl/instance.hxx> -#include <com/sun/star/datatransfer/DataFlavor.hpp> /************** class SotData_Impl *********************************************/ /************************************************************************* @@ -49,7 +48,6 @@ *************************************************************************/ SotData_Impl::SotData_Impl() : nSvObjCount( 0 ) - , pObjectList( NULL ) , pFactoryList( NULL ) , pSotObjectFactory( NULL ) , pSotStorageStreamFactory( NULL ) @@ -97,15 +95,16 @@ void SotFactory::DeInit() pFactoryList->clear(); delete pFactoryList; pSotData->pFactoryList = NULL; + } - delete pSotData->pObjectList; - pSotData->pObjectList = NULL; + pSotData->aObjectList.clear(); + if( pSotData->pDataFlavorList ) { - for( sal_uLong i = 0, nMax = pSotData->pDataFlavorList->Count(); i < nMax; i++ ) - delete (::com::sun::star::datatransfer::DataFlavor*) pSotData->pDataFlavorList->GetObject( i ); + for( size_t i = 0, nMax = pSotData->pDataFlavorList->size(); i < nMax; i++ ) + delete (*pSotData->pDataFlavorList)[ i ]; delete pSotData->pDataFlavorList; pSotData->pDataFlavorList = NULL; } @@ -223,10 +222,9 @@ void SotFactory::IncSvObjectCount( SotObject * pObj ) { SotData_Impl * pSotData = SOTDATA(); pSotData->nSvObjCount++; - if( !pSotData->pObjectList ) - pSotData->pObjectList = new SotObjectList(); + if( pObj ) - pSotData->pObjectList->Insert( pObj ); + pSotData->aObjectList.push_back( pObj ); } @@ -240,7 +238,7 @@ void SotFactory::DecSvObjectCount( SotObject * pObj ) SotData_Impl * pSotData = SOTDATA(); pSotData->nSvObjCount--; if( pObj ) - pSotData->pObjectList->Remove( pObj ); + pSotData->aObjectList.remove( pObj ); if( !pSotData->nSvObjCount ) { //keine internen und externen Referenzen mehr @@ -257,14 +255,10 @@ void SotFactory::TestInvariant() { #ifdef TEST_INVARIANT SotData_Impl * pSotData = SOTDATA(); - if( pSotData->pObjectList ) - { - sal_uLong nCount = pSotData->pObjectList->Count(); - for( sal_uLong i = 0; i < nCount ; i++ ) - { - pSotData->pObjectList->GetObject( i )->TestInvariant( sal_False ); - } - } + + std::list<SotObject*>::iterator it; + for( it = pSotData->aObjectList.begin(); it != pSotData->aObjectList.end(); ++it ) + (*it)->TestInvariant( sal_False ); #endif } diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx index d1f4e6331397..1c5a24ba4657 100644 --- a/sot/source/base/object.cxx +++ b/sot/source/base/object.cxx @@ -34,7 +34,6 @@ #include <tools/debug.hxx> #include <sot/object.hxx> #include <sot/factory.hxx> -#include <sot/agg.hxx> /************** class SotObject ******************************************/ class SotObjectFactory : public SotFactory diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index c73028833790..940efd5a8d70 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -32,11 +32,9 @@ #include <sot/storinfo.hxx> #include <osl/file.hxx> #include <tools/tempfile.hxx> -#include <tools/ownlist.hxx> #include <tools/string.hxx> #include <tools/fsys.hxx> #include <tools/stream.hxx> -#include <tools/pstm.hxx> #include <tools/debug.hxx> #include "sot/stg.hxx" @@ -549,7 +547,7 @@ void Storage::FillInfoList( SvStorageInfoList* pList ) const if( !p->bInvalid ) { SvStorageInfo aInfo( *p ); - pList->Append( aInfo ); + pList->push_back( aInfo ); } p = aIter.Next(); } @@ -806,9 +804,9 @@ sal_Bool Storage::CopyTo( BaseStorage* pDest ) const SvStorageInfoList aList; FillInfoList( &aList ); sal_Bool bRes = sal_True; - for( sal_uInt16 i = 0; i < aList.Count() && bRes; i++ ) + for( size_t i = 0; i < aList.size() && bRes; i++ ) { - SvStorageInfo& rInfo = aList.GetObject( i ); + SvStorageInfo& rInfo = aList[ i ]; bRes = pThis->CopyTo( rInfo.GetName(), pDest, rInfo.GetName() ); } if( !bRes ) diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index db861fb93911..64169313e67e 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -388,4 +388,4 @@ sal_uLong StgIo::ValidateFATs() return FAT_OK; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx index 1cdde1a45104..5f1768b8e7ef 100644 --- a/sot/source/sdstor/storinfo.cxx +++ b/sot/source/sdstor/storinfo.cxx @@ -34,21 +34,6 @@ #include <sot/exchange.hxx> -/************** class SvStorageInfoList ********************************** -*************************************************************************/ -PRV_SV_IMPL_OWNER_LIST(SvStorageInfoList,SvStorageInfo) - -const SvStorageInfo * SvStorageInfoList::Get( const String & rEleName ) -{ - for( sal_uLong i = 0; i < Count(); i++ ) - { - const SvStorageInfo & rType = GetObject( i ); - if( rType.GetName() == rEleName ) - return &rType; - } - return NULL; -} - /************** class SvStorageInfo ************************************** *************************************************************************/ sal_uLong ReadClipboardFormat( SvStream & rStm ) diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 3fcf8b07cf9d..198a6572dec3 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -201,16 +201,8 @@ void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 nBytesToSkip) throw( N ::osl::MutexGuard aGuard( m_aMutex ); checkError(); -#ifdef DBG_UTIL - sal_uInt32 nCurrentPos = m_pSvStream->Tell(); -#endif - m_pSvStream->SeekRel(nBytesToSkip); checkError(); - -#ifdef DBG_UTIL - nCurrentPos = m_pSvStream->Tell(); -#endif } //------------------------------------------------------------------------------ @@ -2682,7 +2674,7 @@ void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const if ( pElement->m_xStream.Is() ) nSize = pElement->m_xStream->GetSize(); SvStorageInfo aInfo( pElement->m_aName, nSize, pElement->m_bIsStorage ); - pList->Append( aInfo ); + pList->push_back( aInfo ); } } } diff --git a/sot/source/sdstor/unostorageholder.cxx b/sot/source/sdstor/unostorageholder.cxx index dcfdfa134480..dbb54e08cd4d 100644 --- a/sot/source/sdstor/unostorageholder.cxx +++ b/sot/source/sdstor/unostorageholder.cxx @@ -37,7 +37,7 @@ #include <comphelper/processfactory.hxx> #include "unostorageholder.hxx" -#include <sot/storinfo.hxx> +#include "sot/storinfo.hxx" using namespace ::com::sun::star; @@ -140,7 +140,7 @@ void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ ) SvStorageInfoList aSubStorInfoList; m_rSotStorage->FillInfoList( &aSubStorInfoList ); - for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.Count(); nInd++ ) + for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.size(); nInd++ ) { m_rSotStorage->Remove( aSubStorInfoList[nInd].GetName() ); if ( m_rSotStorage->GetError() ) diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index a50bfb9ae227..0e765a7285c9 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -566,8 +566,8 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::getElementNames() throw uno::RuntimeException(); // TODO: } - uno::Sequence< ::rtl::OUString > aSeq( aList.Count() ); - for ( sal_uInt32 nInd = 0; nInd < aList.Count(); nInd++ ) + uno::Sequence< ::rtl::OUString > aSeq( aList.size() ); + for ( sal_uInt32 nInd = 0; nInd < aList.size(); nInd++ ) aSeq[nInd] = aList[nInd].GetName(); return aSeq; @@ -629,7 +629,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasElements() throw uno::RuntimeException(); // TODO: } - return ( aList.Count() != 0 ); + return ( aList.size() != 0 ); } //____________________________________________________________________________________________________ diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx index 9dc31764c53c..6bb9f311119b 100644 --- a/svl/inc/svl/ownlist.hxx +++ b/svl/inc/svl/ownlist.hxx @@ -31,8 +31,8 @@ #include "svl/svldllapi.h" #include <tools/stream.hxx> -#include <tools/ownlist.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <vector> namespace com { namespace sun { namespace star { namespace beans { @@ -76,6 +76,8 @@ public: } }; +typedef ::std::vector< SvCommand > SvCommandList_impl; + //========================================================================= class SVL_DLLPUBLIC SvCommandList /* [Beschreibung] @@ -85,9 +87,12 @@ class SVL_DLLPUBLIC SvCommandList in die Liste gestellt. */ { - PRV_SV_DECL_OWNER_LIST(SvCommandList,SvCommand); - SvCommand & Append( const String & rCommand, const String & rArg ); - sal_Bool AppendCommands( const String & rCmd, sal_uInt16 * pEaten ); +private: + SvCommandList_impl aCommandList; + +public: + SvCommand& Append( const String & rCommand, const String & rArg ); + sal_Bool AppendCommands( const String & rCmd, sal_uInt16 * pEaten ); String GetCommands() const; sal_Bool FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); @@ -95,6 +100,16 @@ class SVL_DLLPUBLIC SvCommandList SVL_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); SVL_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); + + size_t size() const { return aCommandList.size(); } + + SvCommand operator[]( size_t i) { + return aCommandList[ i ]; + } + + void clear() { + aCommandList.clear(); + } }; #endif // _OWNLIST_HXX diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx index e72a5ffde911..3aa181d5cf7d 100644 --- a/svl/inc/svl/slstitm.hxx +++ b/svl/inc/svl/slstitm.hxx @@ -28,9 +28,10 @@ #ifndef _SFXSLSTITM_HXX #define _SFXSLSTITM_HXX +#include <vector> + #include "svl/svldllapi.h" #include <tools/rtti.hxx> -#include <tools/list.hxx> #include <svl/poolitem.hxx> #include <com/sun/star/uno/Sequence.h> @@ -45,15 +46,14 @@ public: TYPEINFO(); SfxStringListItem(); - SfxStringListItem( sal_uInt16 nWhich, const List* pList=NULL ); + SfxStringListItem( sal_uInt16 nWhich, const std::vector<String> *pList=NULL ); SfxStringListItem( sal_uInt16 nWhich, SvStream& rStream ); SfxStringListItem( const SfxStringListItem& rItem ); ~SfxStringListItem(); - List * GetList(); + std::vector<String>& GetList(); - const List * GetList() const - { return SAL_CONST_CAST(SfxStringListItem *, this)->GetList(); } + const std::vector<String>& GetList() const; #ifndef TF_POOLABLE virtual int IsPoolable() const; @@ -75,7 +75,7 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const; virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; - void Sort( sal_Bool bAscending = sal_True, List* pParallelList = 0 ); + void Sort( sal_Bool bAscending = sal_True); virtual bool PutValue ( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx index 7e5e8868f58a..48753d0c4fb1 100644 --- a/svl/inc/svl/svarray.hxx +++ b/svl/inc/svl/svarray.hxx @@ -743,7 +743,7 @@ SV_IMPL_VARARR(nm##_SAR, AE)\ _SV_IMPL_SORTAR_ALG( nm,AE )\ _SV_SEEK_OBJECT( nm,AE ) -#if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52) +#if defined (C40) || defined (C41) || defined (C42) || defined(C50) #define C40_INSERT( c, p, n) Insert( (c const *) p, n ) #define C40_PTR_INSERT( c, p) Insert( (c const *) p ) #define C40_REPLACE( c, p, n) Replace( (c const *) p, n ) diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx index d60ef0094723..8fb7b2f06f8d 100644 --- a/svl/inc/svl/svdde.hxx +++ b/svl/inc/svl/svdde.hxx @@ -55,18 +55,11 @@ class DdeItemImp; struct Conversation; #ifndef _SVDDE_NOLISTS -DECLARE_LIST( DdeConnections, DdeConnection* ) DECLARE_LIST( DdeServices, DdeService* ) -DECLARE_LIST( DdeTopics, DdeTopic* ) -DECLARE_LIST( DdeItems, DdeItem* ) #else -typedef List DdeConnections; typedef List DdeServices; -typedef List DdeTopics; -typedef List DdeItems; #endif -DECLARE_LIST( DdeTransactions, DdeTransaction* ) typedef ::std::vector< long > DdeFormats; typedef ::std::vector< Conversation* > ConvList; @@ -232,7 +225,7 @@ class SVL_DLLPUBLIC DdeConnection { friend class DdeInternal; friend class DdeTransaction; - DdeTransactions aTransactions; + std::vector<DdeTransaction*> aTransactions; DdeString* pService; DdeString* pTopic; DdeImp* pImp; @@ -244,7 +237,7 @@ public: long GetError(); long GetConvId(); - static const DdeConnections& GetConnections(); + static const std::vector<DdeConnection*>& GetConnections(); sal_Bool IsConnected(); @@ -331,7 +324,7 @@ private: private: DdeString* pName; String aItem; - DdeItems aItems; + std::vector<DdeItem*> aItems; Link aConnectLink; Link aDisconnectLink; Link aGetLink; @@ -363,7 +356,7 @@ public: DdeItem* AddItem( const DdeItem& ); // werden kopiert ! void RemoveItem( const DdeItem& ); const String& GetCurItem() { return aItem; } - const DdeItems& GetItems() { return aItems; } + const std::vector<DdeItem*>& GetItems() const { return aItems; } private: DdeTopic( const DdeTopic& ); @@ -394,7 +387,7 @@ protected: const DdeTopic* GetSysTopic() const { return pSysTopic; } private: - DdeTopics aTopics; + std::vector<DdeTopic*> aTopics; DdeFormats aFormats; DdeTopic* pSysTopic; DdeString* pName; @@ -411,7 +404,7 @@ public: short GetError() { return nStatus; } static DdeServices& GetServices(); - DdeTopics& GetTopics() { return aTopics; } + std::vector<DdeTopic*>& GetTopics() { return aTopics; } void AddTopic( const DdeTopic& ); void RemoveTopic( const DdeTopic& ); diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx index b831362e72da..6a54fb87ae96 100644 --- a/svl/inc/svl/svstdarr.hxx +++ b/svl/inc/svl/svstdarr.hxx @@ -103,11 +103,6 @@ private: #define _SVSTDARR_USHORTSSORT_DECL #endif -#ifndef _SVSTDARR_LONGSSORT_DECL -SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_LONGSSORT_DECL -#endif - #include <tools/string.hxx> typedef String* StringPtr; diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx index e1883cc69f0d..3172fd9322d6 100644 --- a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -222,14 +222,14 @@ static ::cppu::ImplementationEntry const lRegEntries[] = }; //============================================================================= -extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, uno_Environment** ) { *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //============================================================================= -extern "C" void * SAL_CALL component_getFactory(const char* sImplName , +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const char* sImplName , void* pServiceManager, void* pRegistryKey ) { diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index e64a03a96e8e..a3a19fe443c8 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -378,7 +378,7 @@ sal_Bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const static SvtCJKOptions_Impl* pCJKOptions = NULL; static sal_Int32 nCJKRefCount = 0; -namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; } +namespace { struct theCJKOptionsMutex : public rtl::Static< ::osl::Mutex , theCJKOptionsMutex >{}; } // class SvtCJKOptions -------------------------------------------------- @@ -386,7 +386,7 @@ namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; } SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad) { // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CJKMutex::get() ); + ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() ); if ( !pCJKOptions ) { pCJKOptions = new SvtCJKOptions_Impl; @@ -404,7 +404,7 @@ SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad) SvtCJKOptions::~SvtCJKOptions() { // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CJKMutex::get() ); + ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() ); if ( !--nCJKRefCount ) DELETEZ( pCJKOptions ); } diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx index def16ac62d8b..21b6a3bffa4e 100644 --- a/svl/source/filerec/filerec.cxx +++ b/svl/source/filerec/filerec.cxx @@ -882,12 +882,13 @@ bool SfxMultiRecordReader::ReadHeader_Impl() else _pStream->Seek( _nContentSize ); _pContentOfs = new sal_uInt32[_nContentCount]; + memset(_pContentOfs, 0, _nContentCount*sizeof(sal_uInt32)); //! darf man jetzt so einr"ucken #if defined(OSL_LITENDIAN) - _pStream->Read( _pContentOfs, sizeof(sal_uInt32)*_nContentCount ); + _pStream->Read( _pContentOfs, sizeof(sal_uInt32)*_nContentCount ); #else - for ( sal_uInt16 n = 0; n < _nContentCount; ++n ) - *_pStream >> _pContentOfs[n]; + for ( sal_uInt16 n = 0; n < _nContentCount; ++n ) + *_pStream >> _pContentOfs[n]; #endif _pStream->Seek( nContentPos ); } @@ -899,7 +900,10 @@ bool SfxMultiRecordReader::ReadHeader_Impl() //------------------------------------------------------------------------- SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream ) -: _pContentOfs( NULL ), _nContentNo(0) + : _pContentOfs(0) + , _nContentSize(0) + , _nContentCount(0) + , _nContentNo(0) { // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen _nStartPos = pStream->Tell(); diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index 1702604b7fe9..bf2180770172 100644 --- a/svl/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -88,6 +88,16 @@ struct SfxItemPool_Impl SfxItemPool_Impl( sal_uInt16 nStart, sal_uInt16 nEnd ) : ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1]) + , nLoadingVersion(0) + , nInitRefCount(0) + , nVerStart(0) + , nVerEnd(0) + , nStoringStart(0) + , nStoringEnd(0) + , nMajorVer(0) + , nMinorVer(0) + , bInSetItem(false) + , bStreaming(false) { memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) ); } diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 78fbd27e8bdb..147d90b0ea09 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -1876,12 +1876,12 @@ static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_u { // alte Items vor nPos kopieren if ( nPos ) - memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem **) ); + memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem *) ); // alte Items hinter nPos kopieren if ( nPos < nOldSize ) memcpy( (void*) (pNew + nPos + 1), pItems + nPos, - (nOldSize-nPos) * sizeof(SfxPoolItem **) ); + (nOldSize-nPos) * sizeof(SfxPoolItem *) ); } // neues Item initialisieren diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index f9ddc18a2318..d75560f5a26d 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -404,7 +404,7 @@ void SfxItemPool::readTheItems ( nLastSurrogate = nSurrogate; // Ref-Count und Item laden - sal_uInt16 nRef; + sal_uInt16 nRef(0); rStream >> nRef; pItem = pDefItem->Create(rStream, nVersion); @@ -607,7 +607,7 @@ SvStream &SfxItemPool::Load(SvStream &rStream) for ( sal_uInt16 nVerNo = 0; aVerRec.GetContent(); ++nVerNo ) { // Header f"ur einzelne Version einlesen - sal_uInt16 nVersion, nHStart, nHEnd; + sal_uInt16 nVersion(0), nHStart(0), nHEnd(0); rStream >> nVersion >> nHStart >> nHEnd; sal_uInt16 nCount = nHEnd - nHStart + 1; @@ -616,6 +616,7 @@ SvStream &SfxItemPool::Load(SvStream &rStream) { // Add new Version sal_uInt16 *pMap = new sal_uInt16[nCount]; + memset(pMap, 0, nCount * sizeof(sal_uInt16)); for ( sal_uInt16 n = 0; n < nCount; ++n ) rStream >> pMap[n]; SetVersionMap( nVersion, nHStart, nHEnd, pMap ); @@ -632,8 +633,8 @@ SvStream &SfxItemPool::Load(SvStream &rStream) while ( aWhichIdsRec.GetContent() ) { // SlotId, Which-Id und Item-Version besorgen - sal_uInt32 nCount; - sal_uInt16 nVersion, nWhich; + sal_uInt32 nCount(0); + sal_uInt16 nVersion(0), nWhich(0); //!sal_uInt16 nSlotId = aWhichIdsRec.GetContentTag(); rStream >> nWhich; if ( pImp->nLoadingVersion != pImp->nVersion ) @@ -686,7 +687,7 @@ SvStream &SfxItemPool::Load(SvStream &rStream) while ( aDefsRec.GetContent() ) { // SlotId, Which-Id und Item-Version besorgen - sal_uInt16 nVersion, nWhich; + sal_uInt16 nVersion(0), nWhich(0); //!sal_uInt16 nSlotId = aDefsRec.GetContentTag(); rStream >> nWhich; if ( pImp->nLoadingVersion != pImp->nVersion ) @@ -739,7 +740,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_STARTPOOL_4 ); rStream >> pImp->nMajorVer >> pImp->nMinorVer; } - sal_uInt32 nAttribSize; + sal_uInt32 nAttribSize(0); int bOwnPool = sal_True; UniString aExternName; if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 2 ) @@ -772,7 +773,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) sal_uLong nStartPos = rStream.Tell(); rStream.SeekRel( nAttribSize ); CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_SIZES ); - sal_uInt32 nSizeTableLen; + sal_uInt32 nSizeTableLen(0); rStream >> nSizeTableLen; sal_Char *pBuf = new sal_Char[nSizeTableLen]; rStream.Read( pBuf, nSizeTableLen ); @@ -784,18 +785,18 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) { // Version-Map finden (letztes sal_uLong der Size-Table gibt Pos an) rStream.Seek( nEndOfSizes - sizeof(sal_uInt32) ); - sal_uInt32 nVersionMapPos; + sal_uInt32 nVersionMapPos(0); rStream >> nVersionMapPos; rStream.Seek( nVersionMapPos ); // Versions-Maps einlesen CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_VERSIONMAP ); - sal_uInt16 nVerCount; + sal_uInt16 nVerCount(0); rStream >> nVerCount; for ( sal_uInt16 nVerNo = 0; nVerNo < nVerCount; ++nVerNo ) { // Header f"ur einzelne Version einlesen - sal_uInt16 nVersion, nHStart, nHEnd; + sal_uInt16 nVersion(0), nHStart(0), nHEnd(0); rStream >> nVersion >> nHStart >> nHEnd; sal_uInt16 nCount = nHEnd - nHStart + 1; sal_uInt16 nBytes = (nCount)*sizeof(sal_uInt16); @@ -805,6 +806,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) { // Add new Version sal_uInt16 *pMap = new sal_uInt16[nCount]; + memset(pMap, 0, nCount * sizeof(sal_uInt16)); for ( sal_uInt16 n = 0; n < nCount; ++n ) rStream >> pMap[n]; SetVersionMap( nVersion, nHStart, nHEnd, pMap ); @@ -820,7 +822,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ITEMS ); bool bSecondaryLoaded = false; long nSecondaryEnd = 0; - sal_uInt16 nWhich, nSlot; + sal_uInt16 nWhich(0), nSlot(0); while ( rStream >> nWhich, nWhich ) { // ggf. Which-Id aus alter Version verschieben? @@ -831,8 +833,8 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) sal_uInt16 nMappedWhich = GetWhich(nSlot, sal_False); int bKnownItem = bOwnPool || IsWhich(nMappedWhich); - sal_uInt16 nRef, nCount, nVersion; - sal_uInt32 nAttrSize; + sal_uInt16 nRef(0), nCount(0), nVersion(0); + sal_uInt32 nAttrSize(0); rStream >> nVersion >> nCount; SfxPoolItemArray_Impl **ppArr = 0; @@ -981,8 +983,8 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) int bKnownItem = bOwnPool || IsWhich(nMappedWhich); sal_uLong nPos = nLastPos; - sal_uInt32 nSize; - sal_uInt16 nVersion; + sal_uInt32 nSize(0); + sal_uInt16 nVersion(0); rStream >> nVersion; if ( bKnownItem ) @@ -1072,7 +1074,7 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate { // Read the first surrogate - sal_uInt32 nSurrogat; + sal_uInt32 nSurrogat(0); rStream >> nSurrogat; // Is item stored directly? @@ -1622,7 +1624,7 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect, // pRefPool==-1 => nicht putten! { - sal_uInt16 nWhich, nSlot; // nSurrogate; + sal_uInt16 nWhich(0), nSlot(0); // nSurrogate; rStream >> nWhich >> nSlot; sal_Bool bDontPut = (SfxItemPool*)-1 == pRefPool; @@ -1637,8 +1639,8 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect, else { // WID in der Version nicht vorhanden => ueberspringen - sal_uInt32 nSurro; - sal_uInt16 nVersion, nLen; + sal_uInt32 nSurro(0); + sal_uInt16 nVersion(0), nLen(0); rStream >> nSurro; if ( SFX_ITEMS_DIRECT == nSurro ) { @@ -1676,8 +1678,8 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect, if ( bDirect || ( nWhich && !pItem ) ) { // bDirekt bzw. nicht IsPoolable() => Item direkt laden - sal_uInt16 nVersion; - sal_uInt32 nLen; + sal_uInt16 nVersion(0); + sal_uInt32 nLen(0); rStream >> nVersion >> nLen; sal_uLong nIStart = rStream.Tell(); diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index e001bf1e23f2..74239d48546e 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -47,11 +47,11 @@ class SfxImpStringList { public: sal_uInt16 nRefCount; - List aList; + std::vector<String> aList; SfxImpStringList() { nRefCount = 1; } ~SfxImpStringList(); - void Sort( sal_Bool bAscending, List* ); + void Sort( sal_Bool bAscending); }; //------------------------------------------------------------------------ @@ -59,21 +59,14 @@ public: SfxImpStringList::~SfxImpStringList() { DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted"); - String* pStr = (String*)aList.First(); - while( pStr ) - { - delete pStr; - pStr = (String*)aList.Next(); - } nRefCount = 0xffff; } //------------------------------------------------------------------------ -void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList ) +void SfxImpStringList::Sort( sal_Bool bAscending) { - DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too small"); - sal_uLong nCount = aList.Count(); + sal_uLong nCount = aList.size(); if( nCount > 1 ) { nCount -= 2; @@ -84,10 +77,10 @@ void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList ) bSwapped = sal_False; for( sal_uLong nCur = 0; nCur <= nCount; nCur++ ) { - String* pStr1 = (String*)aList.GetObject( nCur ); - String* pStr2 = (String*)aList.GetObject( nCur+1 ); + String aStr1 = aList[nCur]; + String aStr2 = aList[nCur+1]; // COMPARE_GREATER => pStr2 ist groesser als pStr1 - StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@ + StringCompare eCompare = aStr1.CompareIgnoreCaseToAscii( aStr2 ); //@@@ sal_Bool bSwap = sal_False; if( bAscending ) { @@ -100,15 +93,8 @@ void SfxImpStringList::Sort( sal_Bool bAscending, List* pParallelList ) if( bSwap ) { bSwapped = sal_True; - aList.Replace( pStr1, nCur + 1 ); - aList.Replace( pStr2, nCur ); - if( pParallelList ) - { - void* p1 = pParallelList->GetObject( nCur ); - void* p2 = pParallelList->GetObject( nCur + 1 ); - pParallelList->Replace( p1, nCur + 1 ); - pParallelList->Replace( p2, nCur ); - } + aList[nCur+1] = aStr1; + aList[nCur] = aStr2; } } } @@ -124,7 +110,7 @@ SfxStringListItem::SfxStringListItem() : //------------------------------------------------------------------------ -SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) : +SfxStringListItem::SfxStringListItem( sal_uInt16 which, const std::vector<String>* pList ) : SfxPoolItem( which ), pImp(NULL) { @@ -134,14 +120,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, const List* pList ) : { pImp = new SfxImpStringList; - long i, nCount = pList->Count(); - String *pStr1, *pStr2; - for( i=0; i < nCount; i++ ) - { - pStr1 = (String*)pList->GetObject(i); - pStr2 = new String( *pStr1 ); - pImp->aList.Insert( pStr2, LIST_APPEND ); - } + if (pImp) + pImp->aList = *pList; } } @@ -157,13 +137,15 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) : if( nEntryCount ) pImp = new SfxImpStringList; - long i; - String* pStr; - for( i=0; i < nEntryCount; i++ ) + if (pImp) { - pStr = new String; - readByteString(rStream, *pStr); - pImp->aList.Insert( pStr, LIST_APPEND ); + long i; + String aStr; + for( i=0; i < nEntryCount; i++ ) + { + readByteString(rStream, aStr); + pImp->aList.push_back(aStr); + } } } @@ -171,10 +153,8 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) : SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) : SfxPoolItem( rItem ), - pImp(NULL) + pImp(rItem.pImp) { - pImp = rItem.pImp; - if( pImp ) { DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); @@ -198,12 +178,17 @@ SfxStringListItem::~SfxStringListItem() //------------------------------------------------------------------------ -List* SfxStringListItem::GetList() +std::vector<String>& SfxStringListItem::GetList() { if( !pImp ) pImp = new SfxImpStringList; DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - return &(pImp->aList); + return pImp->aList; +} + +const std::vector<String>& SfxStringListItem::GetList () const +{ + return SAL_CONST_CAST(SfxStringListItem *, this)->GetList(); } //------------------------------------------------------------------------ @@ -214,10 +199,7 @@ int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const SfxStringListItem* pItem = (SfxStringListItem*)&rItem; - if( pImp == pItem->pImp ) - return sal_True; - else - return sal_False; + return pImp == pItem->pImp; } //------------------------------------------------------------------------ @@ -268,16 +250,11 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - long nCount = pImp->aList.Count(); + sal_uInt32 nCount = pImp->aList.size(); rStream << nCount; - long i; - String* pStr; - for( i=0; i < nCount; i++ ) - { - pStr = (String*)(pImp->aList.GetObject( i )); - writeByteString(rStream, *pStr); - } + for( sal_uInt32 i=0; i < nCount; i++ ) + writeByteString(rStream, pImp->aList[i]); return rStream; } @@ -308,17 +285,15 @@ void SfxStringListItem::SetString( const XubString& rStr ) else nLen = nDelimPos - nStart; - XubString* pStr = new XubString(aStr.Copy(nStart, nLen)); // String gehoert der Liste - pImp->aList.Insert( pStr, LIST_APPEND ); + pImp->aList.push_back(aStr.Copy(nStart, nLen)); nStart += nLen + 1 ; // delimiter ueberspringen } while( nDelimPos != STRING_NOTFOUND ); // Kein Leerstring am Ende - if( pImp->aList.Last() && - !((XubString*)pImp->aList.Last())->Len() ) - delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 ); + if (!pImp->aList.empty() && !(pImp->aList.rbegin())->Len()) + pImp->aList.pop_back(); } //------------------------------------------------------------------------ @@ -329,13 +304,17 @@ XubString SfxStringListItem::GetString() if ( pImp ) { DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - XubString* pStr = (XubString*)(pImp->aList.First()); - while( pStr ) + + std::vector<String>::iterator iter; + for (iter = pImp->aList.begin();;) { - aStr += *pStr; - pStr = (XubString*)(pImp->aList.Next()); - if ( pStr ) + aStr += *iter; + ++iter; + + if (iter != pImp->aList.end()) aStr += '\r'; + else + break; } } aStr.ConvertLineEnd(); @@ -355,11 +334,11 @@ int SfxStringListItem::IsPoolable() const //------------------------------------------------------------------------ -void SfxStringListItem::Sort( sal_Bool bAscending, List* pParallelList ) +void SfxStringListItem::Sort( sal_Bool bAscending) { DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0"); if( pImp ) - pImp->Sort( bAscending, pParallelList ); + pImp->Sort( bAscending); } //---------------------------------------------------------------------------- @@ -374,22 +353,22 @@ void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl: pImp->nRefCount--; pImp = new SfxImpStringList; - for ( sal_Int32 n = 0; n < rList.getLength(); n++ ) + if (pImp) { - XubString* pStr = new XubString( rList[n] ); // String gehoert der Liste - pImp->aList.Insert( pStr, LIST_APPEND ); + for ( sal_Int32 n = 0; n < rList.getLength(); n++ ) + pImp->aList.push_back(XubString(rList[n])); } } //---------------------------------------------------------------------------- void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const { - long nCount = pImp->aList.Count(); + long nCount = pImp->aList.size(); rList.realloc( nCount ); for( long i=0; i < nCount; i++ ) - rList[i] = *(String*)(pImp->aList.GetObject( i )); + rList[i] = pImp->aList[i]; } //---------------------------------------------------------------------------- diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index 6f3cc966995b..2a0bf03a733e 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -34,7 +34,6 @@ #define _SVSTDARR_ULONGS #define _SVSTDARR_ULONGSSORT #define _SVSTDARR_sal_uInt16S -#define _SVSTDARR_LONGSSORT #define _SVSTDARR_STRINGS #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGSSORT @@ -69,7 +68,6 @@ SV_IMPL_VARARR( SvULongs, sal_uLong ) SV_IMPL_VARARR( SvUShorts, sal_uInt16 ) SV_IMPL_VARARR_SORT( SvULongsSort, sal_uLong ) -SV_IMPL_VARARR_SORT( SvLongsSort, long ) SV_IMPL_PTRARR( SvStrings, StringPtr ) SV_IMPL_PTRARR( SvStringsDtor, StringPtr ) diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index 721dece14b5e..b39998dc57f4 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -106,13 +106,13 @@ INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) // there is currently no UCB functionality to resolve the symbolic links; // since the lock files are used only for local file systems the osl functionality is used directly - ::osl::FileStatus aStatus( FileStatusMask_Type | FileStatusMask_LinkTargetURL ); + ::osl::FileStatus aStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL ); ::osl::DirectoryItem aItem; if ( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aURLToCheck, aItem ) && aItem.is() && ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) ) { - if ( aStatus.isValid( FileStatusMask_Type ) - && aStatus.isValid( FileStatusMask_LinkTargetURL ) + if ( aStatus.isValid( osl_FileStatus_Mask_Type ) + && aStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) && aStatus.getFileType() == ::osl::FileStatus::Link ) { aURLToCheck = aStatus.getLinkTargetURL(); diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx index c1edd6761839..0e3fae02ff8e 100644 --- a/svl/source/misc/ownlist.cxx +++ b/svl/source/misc/ownlist.cxx @@ -39,8 +39,6 @@ using namespace com::sun::star; //========================================================================= //============== SvCommandList ============================================ //========================================================================= -PRV_SV_IMPL_OWNER_LIST(SvCommandList,SvCommand) - static String parseString(const String & rCmd, sal_uInt16 * pIndex) { @@ -110,78 +108,11 @@ sal_Bool SvCommandList::AppendCommands value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index); } - SvCommand * pCmd = new SvCommand(name, value); - aTypes.Insert(pCmd, LIST_APPEND); + aCommandList.push_back( SvCommand(name, value)); } *pEaten = index; -// sal_uInt16 nPos = 0; -// while( nPos < rCmd.Len() ) -// { -// // ein Zeichen ? Dann faengt hier eine Option an -// if( isalpha( rCmd[nPos] ) ) -// { -// String aValue; -// sal_uInt16 nStt = nPos; -// register char c; - -// while( nPos < rCmd.Len() && -// ( isalnum(c=rCmd[nPos]) || '-'==c || '.'==c ) ) -// nPos++; - -// String aToken( rCmd.Copy( nStt, nPos-nStt ) ); - -// while( nPos < rCmd.Len() && -// ( !String::IsPrintable( (c=rCmd[nPos]), -// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) ) -// nPos++; - -// // hat die Option auch einen Wert? -// if( nPos!=rCmd.Len() && '='==c ) -// { -// nPos++; - -// while( nPos < rCmd.Len() && -// ( !String::IsPrintable( (c=rCmd[nPos]), -// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) ) -// nPos++; - -// if( nPos != rCmd.Len() ) -// { -// sal_uInt16 nLen = 0; -// nStt = nPos; -// if( '"' == c ) -// { -// nPos++; nStt++; -// while( nPos < rCmd.Len() && -// '"' != rCmd[nPos] ) -// nPos++, nLen++; -// if( nPos!=rCmd.Len() ) -// nPos++; -// } -// else -// // hier sind wir etwas laxer als der -// // Standard und erlauben alles druckbare -// while( nPos < rCmd.Len() && -// String::IsPrintable( (c=rCmd[nPos]), -// RTL_TEXTENCODING_MS_1252 ) && -// !isspace( c ) ) -// nPos++, nLen++; - -// if( nLen ) -// aValue = rCmd( nStt, nLen ); -// } -// } - -// SvCommand * pCmd = new SvCommand( aToken, aValue ); -// aTypes.Insert( pCmd, LIST_APPEND ); -// } -// else -// // white space un unerwartete Zeichen ignorieren wie -// nPos++; -// } -// *pEaten = nPos; return sal_True; } @@ -199,16 +130,16 @@ String SvCommandList::GetCommands() const */ { String aRet; - for( sal_uLong i = 0; i < aTypes.Count(); i++ ) + for( sal_uLong i = 0; i < aCommandList.size(); i++ ) { if( i != 0 ) aRet += ' '; - SvCommand * pCmd = (SvCommand *)aTypes.GetObject( i ); - aRet += pCmd->GetCommand(); - if( pCmd->GetArgument().Len() ) + SvCommand aCmd = aCommandList[ i ]; + aRet += aCmd.GetCommand(); + if( aCmd.GetArgument().Len() ) { aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "=\"" ) ); - aRet += pCmd->GetArgument(); + aRet += aCmd.GetArgument(); aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) ); } } @@ -231,9 +162,8 @@ SvCommand & SvCommandList::Append SvCommand & Das erteugte Objekt wird zur"uckgegeben. */ { - SvCommand * pCmd = new SvCommand( rCommand, rArg ); - aTypes.Insert( pCmd, LIST_APPEND ); - return *pCmd; + aCommandList.push_back( SvCommand( rCommand, rArg ) ); + return aCommandList.back(); } //========================================================================= @@ -259,9 +189,9 @@ SvStream & operator >> { while( nCount-- ) { - SvCommand * pCmd = new SvCommand(); - rStm >> *pCmd; - rThis.aTypes.Insert( pCmd, LIST_APPEND ); + SvCommand aCmd; + rStm >> aCmd; + rThis.aCommandList.push_back( aCmd ); } } return rStm; @@ -284,13 +214,12 @@ SvStream & operator << SvStream & Der "ubergebene Stream. */ { - sal_uInt32 nCount = rThis.aTypes.Count(); + sal_uInt32 nCount = rThis.aCommandList.size(); rStm << nCount; for( sal_uInt32 i = 0; i < nCount; i++ ) { - SvCommand * pCmd = (SvCommand *)rThis.aTypes.GetObject( i ); - rStm << *pCmd; + rStm << rThis.aCommandList[ i ]; } return rStm; } @@ -314,14 +243,13 @@ sal_Bool SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence ) { - const sal_Int32 nCount = Count(); + const sal_Int32 nCount = aCommandList.size(); aCommandSequence.realloc( nCount ); for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) { - const SvCommand& rCommand = (*this)[ nIndex ]; - aCommandSequence[nIndex].Name = rCommand.GetCommand(); + aCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand(); aCommandSequence[nIndex].Handle = -1; - aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( rCommand.GetArgument() ) ); + aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( aCommandList[ nIndex ].GetArgument() ) ); aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE; } } diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 7f35277118db..b4611b79babf 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -4429,8 +4429,6 @@ sal_Char NfCurrencyEntry::GetEuroSymbol( rtl_TextEncoding eTextEncoding ) default: // default system #if WNT return '\x80'; -#elif OS2 - return '\xD5'; #elif UNX // return '\xA4'; // #56121# 0xA4 waere korrekt fuer iso-8859-15 return '\x80'; // aber Windoze-Code fuer die konvertierten TrueType-Fonts diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b1c1c138bdde..990b7e261172 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3548,11 +3548,11 @@ sal_Bool SvNumberformat::ImpGetNumberOutput(double fNumber, sal_uInt16 i, j; xub_StrLen k; String sStr; - long nPrecExp; sal_Bool bInteger = sal_False; if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT ) { // special formatting only if no GENERAL keyword in format code const sal_uInt16 nThousand = rInfo.nThousand; + long nPrecExp; for (i = 0; i < nThousand; i++) { if (fNumber > _D_MIN_M_BY_1000) diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 7a92da90543b..9eee6a55c823 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -1400,11 +1400,12 @@ bool ImpSvNumberformatScan::InsertSymbol( sal_uInt16 & nPos, svt::NfSymbolType e { if (nAnzStrings >= NF_MAX_FORMAT_SYMBOLS || nPos > nAnzStrings) return false; - ++nAnzResStrings; if (nPos > 0 && nTypeArray[nPos-1] == NF_SYMBOLTYPE_EMPTY) --nPos; // reuse position else { + if ((size_t) (nAnzStrings + 1) >= NF_MAX_FORMAT_SYMBOLS) + return false; ++nAnzStrings; for (size_t i = nAnzStrings; i > nPos; --i) { @@ -1412,6 +1413,7 @@ bool ImpSvNumberformatScan::InsertSymbol( sal_uInt16 & nPos, svt::NfSymbolType e sStrArray[i] = sStrArray[i-1]; } } + ++nAnzResStrings; nTypeArray[nPos] = static_cast<short>(eType); sStrArray[nPos] = rStr; return true; diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index 6e8fe7662e05..3f6ffafd0028 100644 --- a/svl/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -31,6 +31,7 @@ #define UNICODE #include <string.h> // memset +#include <algorithm> #include "ddeimp.hxx" #include <svl/svdde.hxx> @@ -39,11 +40,6 @@ #include <tools/solarmutex.hxx> #include <osl/mutex.hxx> -// static DWORD hDdeInst = NULL; -// static short nInstance = 0; - -// DdeConnections* DdeConnection::pConnections = NULL; - DdeInstData* ImpInitInstData() { DdeInstData* pData = new DdeInstData; @@ -74,30 +70,34 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( HDDEDATA hData, DWORD nInfo1, DWORD ) { HDDEDATA nRet = DDE_FNOTPROCESSED; - DdeConnections& rAll = (DdeConnections&)DdeConnection::GetConnections(); + const std::vector<DdeConnection*> &rAll = DdeConnection::GetConnections(); DdeConnection* self = 0; DdeInstData* pInst = ImpGetInstData(); DBG_ASSERT(pInst,"SVDDE:No instance data"); - for ( self = rAll.First(); self; self = rAll.Next() ) + for ( size_t i = 0; i < rAll.size(); ++i) + { + self = rAll[i]; + if ( self->pImp->hConv == hConv ) break; + } if( self ) { - DdeTransaction* t; sal_Bool bFound = sal_False; - for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() ) + std::vector<DdeTransaction*>::iterator iter; + for( iter = self->aTransactions.begin(); iter != self->aTransactions.end(); ++iter ) { switch( nCode ) { case XTYP_XACT_COMPLETE: - if( (DWORD)t->nId == nInfo1 ) + if( (DWORD)(*iter)->nId == nInfo1 ) { - nCode = t->nType & (XCLASS_MASK | XTYP_MASK); - t->bBusy = sal_False; - t->Done( 0 != hData ); + nCode = (*iter)->nType & (XCLASS_MASK | XTYP_MASK); + (*iter)->bBusy = sal_False; + (*iter)->Done( 0 != hData ); bFound = sal_True; } break; @@ -107,27 +107,27 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( self->pImp->nStatus = self->pImp->hConv ? DMLERR_NO_ERROR : DdeGetLastError( pInst->hDdeInstCli ); - t = 0; + iter = self->aTransactions.end(); nRet = 0; bFound = sal_True; break; case XTYP_ADVDATA: - bFound = sal_Bool( *t->pName == hText2 ); + bFound = sal_Bool( *(*iter)->pName == hText2 ); break; } if( bFound ) break; } - if( t ) + if( iter != self->aTransactions.end() ) { switch( nCode ) { case XTYP_ADVDATA: if( !hData ) { - ((DdeLink*) t)->Notify(); + static_cast<DdeLink*>(*iter)->Notify(); nRet = (HDDEDATA)DDE_FACK; break; } @@ -143,7 +143,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( d.pImp->hData = hData; d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); d.Lock(); - t->Data( &d ); + (*iter)->Data( &d ); nRet = (HDDEDATA)DDE_FACK; break; } @@ -173,7 +173,6 @@ DdeConnection::DdeConnection( const String& rService, const String& rTopic ) CBF_FAIL_ALLSVRXACTIONS | CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS, 0L ); - pInst->pConnections = new DdeConnections; } pService = new DdeString( pInst->hDdeInstCli, rService ); @@ -186,8 +185,7 @@ DdeConnection::DdeConnection( const String& rService, const String& rTopic ) pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); } - if ( pInst->pConnections ) - pInst->pConnections->Insert( this ); + pInst->aConnections.push_back( this ); } // --- DdeConnection::~DdeConnection() ----------------------------- @@ -202,8 +200,12 @@ DdeConnection::~DdeConnection() DdeInstData* pInst = ImpGetInstData(); DBG_ASSERT(pInst,"SVDDE:No instance data"); - if ( pInst->pConnections ) - pInst->pConnections->Remove( this ); + + std::vector<DdeConnection*>::iterator it(std::find(pInst->aConnections.begin(), + pInst->aConnections.end(), + this)); + if (it != pInst->aConnections.end()) + pInst->aConnections.erase(it); pInst->nInstanceCli--; pInst->nRefCount--; @@ -212,8 +214,6 @@ DdeConnection::~DdeConnection() if( DdeUninitialize( pInst->hDdeInstCli ) ) { pInst->hDdeInstCli = NULL; - delete pInst->pConnections; - pInst->pConnections = NULL; if( pInst->nRefCount == 0 ) ImpDeinitInstData(); } @@ -226,11 +226,7 @@ DdeConnection::~DdeConnection() sal_Bool DdeConnection::IsConnected() { CONVINFO c; -#ifdef OS2 - c.nSize = sizeof( c ); -#else c.cb = sizeof( c ); -#endif if ( DdeQueryConvInfo( pImp->hConv, QID_SYNC, &c ) ) return sal_True; else @@ -263,11 +259,11 @@ long DdeConnection::GetConvId() return (long)pImp->hConv; } -const DdeConnections& DdeConnection::GetConnections() +const std::vector<DdeConnection*>& DdeConnection::GetConnections() { DdeInstData* pInst = ImpGetInstData(); DBG_ASSERT(pInst,"SVDDE:No instance data"); - return *(pInst->pConnections); + return pInst->aConnections; } // --- DdeTransaction::DdeTransaction() ---------------------------- @@ -283,7 +279,7 @@ DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName, nType = 0; bBusy = sal_False; - rDde.aTransactions.Insert( this ); + rDde.aTransactions.push_back( this ); } // --- DdeTransaction::~DdeTransaction() --------------------------- @@ -297,7 +293,8 @@ DdeTransaction::~DdeTransaction() } delete pName; - rDde.aTransactions.Remove( this ); + rDde.aTransactions.erase(std::remove(rDde.aTransactions.begin(), + rDde.aTransactions.end(),this)); } // --- DdeTransaction::Execute() ----------------------------------- diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index 6afb6c20de87..0364c1bcf7e1 100644 --- a/svl/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -161,23 +161,11 @@ sal_uLong DdeData::GetExternalFormat( sal_uLong nFmt ) default: { -#if defined(WNT) || defined( PM2 ) - String aName( SotExchange::GetFormatName( nFmt ) ); - #if defined(WNT) - + String aName( SotExchange::GetFormatName( nFmt ) ); if( aName.Len() ) nFmt = RegisterClipboardFormat( reinterpret_cast<LPCWSTR>(aName.GetBuffer()) ); #endif -#if defined( PM2 ) - - if( aName.Len() ) - { - HATOMTBL hSysTable = WinQuerySystemAtomTable(); - nFmt = (sal_uLong)WinAddAtom( hSysTable, (PSZ)aName.GetBuffer() ); - } -#endif -#endif } } return nFmt; @@ -209,17 +197,6 @@ sal_uLong DdeData::GetInternalFormat( sal_uLong nFmt ) nFmt = SotExchange::RegisterFormatName( String(reinterpret_cast<const sal_Unicode*>(szName)) ); } #endif -#if defined(PM2) - if( nFmt > CF_PALETTE ) - { - char szName[ 256 ]; - - HATOMTBL hSysTable = WinQuerySystemAtomTable(); - WinQueryAtomName( hSysTable, (ATOM)nFmt, (PSZ)szName, - sizeof( szName ) ); - nFmt = SotExchange::RegisterFormatName( String( szName ) ); - } -#endif break; } return nFmt; diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx index 2488c9712dcf..bf9bb50fde1f 100644 --- a/svl/source/svdde/ddeimp.hxx +++ b/svl/source/svdde/ddeimp.hxx @@ -29,35 +29,17 @@ #ifndef _DDEIMP_HXX #define _DDEIMP_HXX -#ifdef OS2 - -#include "ddemlos2.h" - -#define WORD sal_uInt16 -#define DWORD sal_uLong -#define LPBYTE sal_uInt8* -#define LPWORD sal_uInt16* -#define LPDWORD sal_uLong* -#define LPCTSTR PCSZ - -#else - #include <windows.h> #include <ddeml.h> #include "ddewrap.hxx" -#endif - #include <tools/string.hxx> -#include <tools/list.hxx> #include <tools/shl.hxx> #include <vector> class DdeService; class DdeTopic; class DdeItem; -class DdeTopics; -class DdeItems; // ---------------- // - Conversation - @@ -86,7 +68,7 @@ public: static HDDEDATA CALLBACK InfCallback ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); #else -#if (defined ( GCC ) && defined ( OS2 )) || defined( ICC ) +#if defined( ICC ) static HDDEDATA CALLBACK CliCallback ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); static HDDEDATA CALLBACK SvrCallback @@ -138,13 +120,13 @@ struct DdeDataImp sal_uLong nFmt; }; -class DdeConnections; +class DdeConnection; class DdeServices; struct DdeInstData { sal_uInt16 nRefCount; - DdeConnections* pConnections; + std::vector<DdeConnection*> aConnections; // Server long hCurConvSvr; DWORD hDdeInstSvr; diff --git a/svl/source/svdde/ddeinf.cxx b/svl/source/svdde/ddeinf.cxx index f93d1b653a9f..3c4f7a4fcaa2 100644 --- a/svl/source/svdde/ddeinf.cxx +++ b/svl/source/svdde/ddeinf.cxx @@ -41,7 +41,7 @@ HDDEDATA CALLBACK DdeInternal::InfCallback( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) #else -#if ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) +#if defined( ICC ) HDDEDATA CALLBACK DdeInternal::InfCallback( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) #else diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index a2ff3fda485b..99b8cce0ae71 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -31,6 +31,7 @@ #define UNICODE #include "ddeimp.hxx" +#include <algorithm> #include <svl/svdde.hxx> #include <svl/svarray.hxx> #include <tools/debug.hxx> @@ -60,7 +61,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback( WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, HDDEDATA hData, DWORD, DWORD ) #else -#if ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) +#if defined( ICC ) HDDEDATA CALLBACK DdeInternal::SvrCallback( WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, HDDEDATA hData, DWORD, DWORD ) @@ -121,10 +122,10 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( { if ( !hText2 || ( *pService->pName == hText2 ) ) { - for( pTopic = pService->aTopics.First(); pTopic; - pTopic = pService->aTopics.Next() ) + std::vector<DdeTopic*>::const_iterator iter; + for (iter = pService->aTopics.begin(); iter != pService->aTopics.end(); ++iter) { - if ( !hText1 || (*pTopic->pName == hText1) ) + if ( !hText1 || iter->pName == hText1 ) nTopics++; } } @@ -330,25 +331,38 @@ found: if( !pItem->pImpData && pTopic->StartAdviseLoop() ) { // dann wurde das Item ausgewechselt - pTopic->aItems.Remove( pItem ); - DdeItem* pTmp; - for( pTmp = pTopic->aItems.First(); pTmp; - pTmp = pTopic->aItems.Next() ) - if( *pTmp->pName == hText2 ) + std::vector<DdeItem*>::iterator it(std::find(pTopic->aItems.begin(), + pTopic->aItems.end(), + pItem)); + if (it != pTopic->aItems.end()) + pTopic->aItems.erase(it); + + std::vector<DdeItem*>::iterator iter; + for( iter = pTopic->aItems.begin(); + iter != pTopic->aItems.end(); + ++iter ) + { + if( *(*iter)->pName == hText2 ) { // es wurde tatsaechlich ausgewechselt delete pItem; pItem = 0; break; } + } + if( pItem ) // es wurde doch nicht ausgewechselt, also wieder rein - pTopic->aItems.Insert( pItem ); + pTopic->aItems.push_back(pItem); else - pItem = pTmp; + pItem = iter != pTopic->aItems.end() ? *iter : NULL; + } + + if (pItem) + { + pItem->IncMonitor( (long)hConv ); + pInst->hCurConvSvr = NULL; } - pItem->IncMonitor( (long)hConv ); - pInst->hCurConvSvr = NULL; } return (HDDEDATA)sal_True; @@ -403,17 +417,17 @@ DdeService* DdeInternal::FindService( HSZ hService ) DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic ) { - DdeTopic* s; - DdeTopics& rTopics = rService.aTopics; + std::vector<DdeTopic*>::iterator iter; + std::vector<DdeTopic*> &rTopics = rService.aTopics; int bWeiter = sal_False; DdeInstData* pInst = ImpGetInstData(); DBG_ASSERT(pInst,"SVDDE:No instance data"); do { // middle check loop - for ( s = rTopics.First(); s; s = rTopics.Next() ) + for ( iter = rTopics.begin(); iter != rTopics.end(); ++iter ) { - if ( *s->pName == hTopic ) - return s; + if ( *(*iter)->pName == hTopic ) + return *iter; } bWeiter = !bWeiter; @@ -434,17 +448,17 @@ DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic ) DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem ) { - DdeItem* s; - DdeItems& rItems = rTopic.aItems; + std::vector<DdeItem*>::iterator iter; + std::vector<DdeItem*> &rItems = rTopic.aItems; DdeInstData* pInst = ImpGetInstData(); DBG_ASSERT(pInst,"SVDDE:No instance data"); int bWeiter = sal_False; do { // middle check loop - for ( s = rItems.First(); s; s = rItems.Next() ) - if ( *s->pName == hItem ) - return s; + for ( iter = rItems.begin(); iter != rItems.end(); ++iter ) + if ( *(*iter)->pName == hItem ) + return *iter; bWeiter = !bWeiter; if( !bWeiter ) @@ -559,19 +573,19 @@ DdeServices& DdeService::GetServices() void DdeService::AddTopic( const DdeTopic& rTopic ) { RemoveTopic( rTopic ); - aTopics.Insert( (DdeTopic*) &rTopic ); + aTopics.push_back((DdeTopic *) &rTopic); } // --- DdeService::RemoveTopic() ----------------------------------- void DdeService::RemoveTopic( const DdeTopic& rTopic ) { - DdeTopic* t; - for ( t = aTopics.First(); t; t = aTopics.Next() ) + std::vector<DdeTopic*>::iterator iter; + for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter ) { - if ( !DdeCmpStringHandles (*t->pName, *rTopic.pName ) ) + if ( !DdeCmpStringHandles (*(*iter)->pName, *rTopic.pName ) ) { - aTopics.Remove( t ); + aTopics.erase(iter); // JP 27.07.95: und alle Conversions loeschen !!! // (sonst wird auf geloeschten Topics gearbeitet!!) for( size_t n = pConv->size(); n; ) @@ -644,13 +658,13 @@ DdeTopic::DdeTopic( const String& rName ) DdeTopic::~DdeTopic() { - DdeItem* t; - while( ( t = aItems.First() ) != NULL ) + std::vector<DdeItem*>::iterator iter; + for (iter = aItems.begin(); iter != aItems.end(); ++iter) { - aItems.Remove( t ); - t->pMyTopic = 0; - delete t; + (*iter)->pMyTopic = 0; + delete *iter; } + delete pName; } @@ -679,7 +693,7 @@ DdeItem* DdeTopic::AddItem( const DdeItem& r ) s = new DdeItem( r ); if ( s ) { - aItems.Insert( s ); + aItems.push_back( s ); s->pMyTopic = this; } return s; @@ -691,7 +705,7 @@ void DdeTopic::InsertItem( DdeItem* pNew ) { if( pNew ) { - aItems.Insert( pNew ); + aItems.push_back( pNew ); pNew->pMyTopic = this; } } @@ -700,18 +714,18 @@ void DdeTopic::InsertItem( DdeItem* pNew ) void DdeTopic::RemoveItem( const DdeItem& r ) { - DdeItem* s; - for ( s = aItems.First(); s; s = aItems.Next() ) + std::vector<DdeItem*>::iterator iter; + for (iter = aItems.begin(); iter != aItems.end(); ++iter) { - if ( !DdeCmpStringHandles (*s->pName, *r.pName ) ) + if ( !DdeCmpStringHandles (*(*iter)->pName, *r.pName ) ) break; } - if ( s ) + if ( iter != aItems.end() ) { - aItems.Remove( s ); - s->pMyTopic = 0; - delete s; + (*iter)->pMyTopic = 0; + delete *iter; + aItems.erase(iter); } } @@ -719,17 +733,16 @@ void DdeTopic::RemoveItem( const DdeItem& r ) void DdeTopic::NotifyClient( const String& rItem ) { - DdeItem* pItem; + std::vector<DdeItem*>::iterator iter; DdeInstData* pInst = ImpGetInstData(); DBG_ASSERT(pInst,"SVDDE:No instance data"); - for ( pItem = aItems.First(); pItem; pItem = aItems.Next() ) + for ( iter = aItems.begin(); iter != aItems.end(); ++iter) { - if ( pItem->GetName() == rItem ) + if ( (*iter)->GetName() == rItem && (*iter)->pImpData) { - if ( pItem->pImpData ) - DdePostAdvise( pInst->hDdeInstSvr, *pName, *pItem->pName ); + DdePostAdvise( pInst->hDdeInstSvr, *pName, *(*iter)->pName ); + break; } - break; } } @@ -751,8 +764,9 @@ void DdeTopic::Disconnect( long nId ) void DdeTopic::_Disconnect( long nId ) { - for( DdeItem* pItem = aItems.First(); pItem; pItem = aItems.Next() ) - pItem->DecMonitor( nId ); + std::vector<DdeItem*>::iterator iter; + for (iter = aItems.begin(); iter != aItems.end(); ++iter) + (*iter)->DecMonitor( nId ); Disconnect( nId ); } @@ -851,7 +865,8 @@ DdeItem::DdeItem( const DdeItem& r) DdeItem::~DdeItem() { if( pMyTopic ) - pMyTopic->aItems.Remove( this ); + pMyTopic->aItems.erase(std::remove(pMyTopic->aItems.begin(), + pMyTopic->aItems.end(),this)); delete pName; delete pImpData; } @@ -986,18 +1001,18 @@ void DdeGetPutItem::AdviseLoop( sal_Bool ) String DdeService::SysItems() { String s; - DdeTopic* t; - for ( t = aTopics.First(); t; t = aTopics.Next() ) + std::vector<DdeTopic*>::iterator iter; + std::vector<DdeItem*>::iterator iterItem; + for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter ) { - if ( t->GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) ) + if ( (*iter)->GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) ) { short n = 0; - DdeItem* pi; - for ( pi = t->aItems.First(); pi; pi = t->aItems.Next(), n++ ) + for ( iterItem = (*iter)->aItems.begin(); iterItem != (*iter)->aItems.end(); ++iterItem, n++ ) { if ( n ) s += '\t'; - s += pi->GetName(); + s += (*iterItem)->GetName(); } s += String::CreateFromAscii("\r\n"); } @@ -1011,14 +1026,14 @@ String DdeService::SysItems() String DdeService::Topics() { String s; - DdeTopic* t; + std::vector<DdeTopic*>::iterator iter; short n = 0; - for ( t = aTopics.First(); t; t = aTopics.Next(), n++ ) + for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter, n++ ) { if ( n ) s += '\t'; - s += t->GetName(); + s += (*iter)->GetName(); } s += String::CreateFromAscii("\r\n"); @@ -1050,28 +1065,8 @@ String DdeService::Formats() case CF_BITMAP: p = reinterpret_cast<LPCTSTR>(String::CreateFromAscii("BITMAP").GetBuffer()); break; -#ifdef OS2 - case CF_DSPTEXT: - p = String::CreateFromAscii("TEXT").GetBuffer(); - break; - case CF_DSPBITMAP: - p = String::CreateFromAscii("BITMAP").GetBuffer(); - break; - case CF_METAFILE: - p = String::CreateFromAscii("METAFILE").GetBuffer(); - break; - case CF_DSPMETAFILE: - p = String::CreateFromAscii("METAFILE").GetBuffer(); - break; - case CF_PALETTE: - p = String::CreateFromAscii("PALETTE").GetBuffer(); - break; - default: - p= String::CreateFromAscii("PRIVATE").GetBuffer(); -#else default: GetClipboardFormatName( (UINT)f, buf, sizeof(buf) / sizeof(TCHAR) ); -#endif } s += String( reinterpret_cast<const sal_Unicode*>(p) ); } diff --git a/svtools/AllLangResTarget_svt.mk b/svtools/AllLangResTarget_svt.mk index 0cc0bab23326..52bed245f66d 100644 --- a/svtools/AllLangResTarget_svt.mk +++ b/svtools/AllLangResTarget_svt.mk @@ -51,7 +51,6 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\ svtools/source/control/ctrltool.src \ svtools/source/control/filectrl.src \ svtools/source/dialogs/addresstemplate.src \ - svtools/source/dialogs/colrdlg.src \ svtools/source/dialogs/filedlg2.src \ svtools/source/dialogs/formats.src \ svtools/source/dialogs/prnsetup.src \ diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 3c666bfeb548..def31f0d121f 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -150,7 +150,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/valueacc \ svtools/source/control/valueset \ svtools/source/dialogs/addresstemplate \ - svtools/source/dialogs/colctrl \ svtools/source/dialogs/colrdlg \ svtools/source/dialogs/filedlg \ svtools/source/dialogs/filedlg2 \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index b5a32a27b865..39d2331641fc 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -44,7 +44,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/brwhead.hxx,svtools/br $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/calendar.hxx,svtools/calendar.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/chartprettypainter.hxx,svtools/chartprettypainter.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/cliplistener.hxx,svtools/cliplistener.hxx)) -$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colctrl.hxx,svtools/colctrl.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/collatorres.hxx,svtools/collatorres.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colorcfg.hxx,svtools/colorcfg.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colrdlg.hxx,svtools/colrdlg.hxx)) diff --git a/svtools/inc/svtools/colctrl.hxx b/svtools/inc/svtools/colctrl.hxx deleted file mode 100644 index 5ad4681b26bb..000000000000 --- a/svtools/inc/svtools/colctrl.hxx +++ /dev/null @@ -1,205 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_COLCTRL_HXX -#define _SV_COLCTRL_HXX - -#include <tools/color.hxx> -#include <vcl/ctrl.hxx> -#include <svtools/valueset.hxx> - -// ---------------- -// - ColorControl - -// ---------------- - -class Bitmap; -class BitmapReadAccess; -class ColorHSB; - -class SvColorControl : public Control -{ -private: - Bitmap* mpBitmap; - BitmapReadAccess* mpReadAccess; - Color maColor; - short mnLuminance; - Point maPosition; - Link maModifyHdl; - - void Initialize(); - void CreateBitmap(); - void ShowPosition( const Point& aPos ); - -public: - SvColorControl( Window* pParent, WinBits nStyle = 0 ); - SvColorControl( Window* pParent, const ResId& rResId ); - ~SvColorControl(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); -// virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Paint( const Rectangle& rRect ); - virtual void Resize(); -// virtual void GetFocus(); -// virtual void LoseFocus(); - - virtual void Modify(); - - Color GetColor() const { return maColor; }; - void SetColor( const Color& rCol ); - void SetColor( const ColorHSB& rCol, sal_Bool bSetColor = sal_True ); - - short GetLuminance() const { return mnLuminance; }; - void SetLuminance( short nLum ); - - void SetModifyHdl( const Link& rLink ) { maModifyHdl = rLink; } - const Link& GetModifyHdl() const { return maModifyHdl; } - -}; - -// ----------------------- -// - ColorPreviewControl - -// ----------------------- - -class ColorPreviewControl : public Control -{ -private: - Color maColor; - -public: - ColorPreviewControl( Window* pParent, WinBits nStyle = 0 ); - ColorPreviewControl( Window* pParent, const ResId& rResId ); - ~ColorPreviewControl(); - - virtual void Paint( const Rectangle& rRect ); - - Color GetColor() const { return maColor; }; - void SetColor( const Color& rCol ); -}; - -// ----------------------- -// - ColorMixingControl - -// ----------------------- - -enum CMCPosition { CMC_TOPLEFT, CMC_TOPRIGHT, CMC_BOTTOMLEFT, CMC_BOTTOMRIGHT, CMC_OTHER }; - -class ColorMixingControl : public ValueSet -{ -private: - sal_uInt16 mnRows; - sal_uInt16 mnColumns; - Color maColor[4]; - - void Initialize(); - - Color CalcDifferenceColor( sal_uInt16 nCol1, sal_uInt16 nCol2, sal_uInt16 nSteps ); - void FillRow( sal_uInt16 nRow ); - void FillColumn( sal_uInt16 nColumn ); - -public: - ColorMixingControl( Window* pParent, WinBits nStyle = 0, - sal_uInt16 nRows = 4, sal_uInt16 nColumns = 4 ); - ColorMixingControl( Window* pParent, const ResId& rResId, - sal_uInt16 nRows = 4, sal_uInt16 nColumns = 4 ); - ~ColorMixingControl(); - - sal_uInt16 GetRows() const { return mnRows; }; - void SetRows( sal_uInt16 nRows ); - sal_uInt16 GetColumns() const { return mnColumns; }; - void SetColumns( sal_uInt16 nColumns ); - - using ValueSet::GetColor; - Color GetColor( CMCPosition ePos ) const { return maColor[ ePos ]; }; - using ValueSet::SetColor; - void SetColor( CMCPosition ePos, const Color& rCol ); - - String GetRGBString( const Color& rColor ); - CMCPosition GetCMCPosition() const; -}; - -// ------------ -// - ColorHSB - -// ------------ - -class ColorHSB -{ -private: - sal_uInt16 mnHue; // Farbwinkel, 360 Grad - sal_uInt16 mnSat; // Saturation, 100 % - sal_uInt16 mnBri; // Brightness, 100 % - -public: - ColorHSB() - { mnHue=0; mnSat=0; mnBri=0; } - ColorHSB( sal_uInt16 nH, sal_uInt16 nS, sal_uInt16 nB ) - { mnHue=nH; mnSat=nS; mnBri=nB; } - ColorHSB( const Color& rColor ); - - void SetHue( sal_uInt16 nH ) { mnHue=nH; } - void SetSat( sal_uInt16 nS ) { mnSat=nS; } - void SetBri( sal_uInt16 nB ) { mnBri=nB; } - sal_uInt16 GetHue() const { return mnHue; } - sal_uInt16 GetSat() const { return mnSat; } - sal_uInt16 GetBri() const { return mnBri; } - Color GetRGB() const; -}; - -// ------------- -// - ColorCMYK - -// ------------- - -class ColorCMYK -{ -private: - sal_uInt16 mnCyan; - sal_uInt16 mnMagenta; - sal_uInt16 mnYellow; - sal_uInt16 mnKey; - -public: - ColorCMYK() - { mnCyan=0; mnMagenta=0; mnYellow=0; mnKey=100; } - ColorCMYK( sal_uInt16 nC, sal_uInt16 nM, sal_uInt16 nY, sal_uInt16 nK ) - { mnCyan=nC; mnMagenta=nM; mnYellow=nY; mnKey=nK; } - ColorCMYK( const Color& rColor ); - - void SetCyan( sal_uInt16 nC ) { mnCyan=nC; } - void SetMagenta( sal_uInt16 nM ) { mnMagenta=nM; } - void SetYellow( sal_uInt16 nY ) { mnYellow=nY; } - void SetKey( sal_uInt16 nK ) { mnKey=nK; } - sal_uInt16 GetCyan() const { return mnCyan; } - sal_uInt16 GetMagenta() const { return mnMagenta; } - sal_uInt16 GetYellow() const { return mnYellow; } - sal_uInt16 GetKey() const { return mnKey; } - Color GetRGB() const; -}; - -#endif // _SV_COLCTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/svtools/colrdlg.hxx b/svtools/inc/svtools/colrdlg.hxx index 8197bb81de28..09336e12d134 100644 --- a/svtools/inc/svtools/colrdlg.hxx +++ b/svtools/inc/svtools/colrdlg.hxx @@ -30,77 +30,37 @@ #define _SV_COLRDLG_HXX #include "svtools/svtdllapi.h" -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/colctrl.hxx> + +#include <tools/color.hxx> + +class Window; // --------------- // - ColorDialog - // --------------- -class SVT_DLLPUBLIC SvColorDialog : public ModalDialog +namespace svtools { -private: - ColorMixingControl maColMixCtrl; - PushButton maBtn1; - PushButton maBtn2; - //PushButton maBtn3; - //PushButton maBtn4; - //FixedText maFtRGB; - SvColorControl maCtlColor; - - // CMYK controls. - FixedText maFtCyan; - MetricField maNumCyan; - FixedText maFtMagenta; - MetricField maNumMagenta; - FixedText maFtYellow; - MetricField maNumYellow; - FixedText maFtKey; - MetricField maNumKey; - - // RGB controls. - FixedText maFtRed; - NumericField maNumRed; - FixedText maFtGreen; - NumericField maNumGreen; - FixedText maFtBlue; - NumericField maNumBlue; - - // HSL controls. - FixedText maFtHue; - NumericField maNumHue; - FixedText maFtSaturation; - NumericField maNumSaturation; - FixedText maFtLuminance; - NumericField maNumLuminance; - - ColorPreviewControl maCtlPreview; - ColorPreviewControl maCtlPreviewOld; - - OKButton maBtnOK; - CancelButton maBtnCancel; - HelpButton maBtnHelp; - - Color maColor; - - SVT_DLLPRIVATE void Initialize(); - - DECL_DLLPRIVATE_LINK( ColorModifyHdl, void * ); - DECL_DLLPRIVATE_LINK( ClickBtnHdl, void * ); - DECL_DLLPRIVATE_LINK( ClickMixCtrlHdl, void * ); - DECL_DLLPRIVATE_LINK( SelectMixCtrlHdl, void * ); + // SELECT is the default + enum ColorPickerMode { ColorPickerMode_SELECT = 0, ColorPickerMode_ADD = 1, ColorPickerMode_MODIFY = 2 }; +} +class SVT_DLLPUBLIC SvColorDialog +{ public: - SvColorDialog( Window* pParent ); - ~SvColorDialog(); + SvColorDialog( ::Window* pParent ); void SetColor( const Color& rColor ); const Color& GetColor() const; + void SetMode( sal_Int16 eMode ); + virtual short Execute(); + +private: + Window* mpParent; + Color maColor; + sal_Int16 meMode; }; #endif // _SV_COLRDLG_HXX diff --git a/svtools/inc/svtools/ctrlbox.hxx b/svtools/inc/svtools/ctrlbox.hxx index 8678b770dc6e..56c69e0d078b 100644 --- a/svtools/inc/svtools/ctrlbox.hxx +++ b/svtools/inc/svtools/ctrlbox.hxx @@ -31,6 +31,7 @@ #include "svtools/svtdllapi.h" +#include <tools/string.hxx> #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> #include <vcl/image.hxx> @@ -56,6 +57,8 @@ typedef ::std::vector< ImplFontNameListData* > ImplFontList; #define CHANGE_DIST ( ( sal_uInt16 ) 4 ) #define ADAPT_DIST ( ( sal_uInt16 ) 8 ) + + /************************************************************************* Beschreibung @@ -461,8 +464,9 @@ private: Image maImagePrinterFont; Image maImageBitmapFont; Image maImageScalableFont; - sal_Bool mbWYSIWYG; - sal_Bool mbSymbols; + sal_Bool mbWYSIWYG; + sal_Bool mbSymbols; + String maFontMRUEntriesFile; #ifdef _CTRLBOX_CXX SVT_DLLPRIVATE void ImplCalcUserItemSize(); @@ -472,6 +476,8 @@ private: void InitBitmaps( void ); protected: virtual void DataChanged( const DataChangedEvent& rDCEvt ); + void LoadMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' ); + void SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep = ';' ) const; public: FontNameBox( Window* pParent, WinBits nWinStyle = WB_SORT ); @@ -489,6 +495,8 @@ public: sal_Bool IsSymbolsEnabled() const { return mbSymbols; } private: + void InitFontMRUEntriesFile(); + // declared as private because some compilers would generate the default functions FontNameBox( const FontNameBox& ); FontNameBox& operator =( const FontNameBox& ); diff --git a/svtools/inc/svtools/ctrltool.hxx b/svtools/inc/svtools/ctrltool.hxx index e0352c4eb585..e5df9eaa8852 100644 --- a/svtools/inc/svtools/ctrltool.hxx +++ b/svtools/inc/svtools/ctrltool.hxx @@ -29,8 +29,9 @@ #ifndef _CTRLTOOL_HXX #define _CTRLTOOL_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include "svtools/svtdllapi.h" -#include <tools/list.hxx> #include <sal/types.h> #include <vcl/metric.hxx> @@ -150,7 +151,7 @@ von der FontList, sollte deshalb das Array nicht mehr referenziert werden. #define FONTLIST_FONTNAMETYPE_SCREEN ((sal_uInt16)0x0002) #define FONTLIST_FONTNAMETYPE_SCALABLE ((sal_uInt16)0x0004) -class SVT_DLLPUBLIC FontList : private List +class SVT_DLLPUBLIC FontList { private: XubString maMapBoth; @@ -170,7 +171,7 @@ private: long* mpSizeAry; OutputDevice* mpDev; OutputDevice* mpDev2; - + boost::ptr_vector<ImplFontListNameInfo> maEntries; #ifdef CTRLTOOL_CXX SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const XubString& rSearchName, sal_uLong* pIndex ) const; SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const XubString& rStr ) const; @@ -206,7 +207,7 @@ public: sal_Bool IsAvailable( const XubString& rName ) const; sal_uInt16 GetFontNameCount() const - { return (sal_uInt16)List::Count(); } + { return (sal_uInt16)maEntries.size(); } const FontInfo& GetFontName( sal_uInt16 nFont ) const; sal_uInt16 GetFontNameType( sal_uInt16 nFont ) const; sal_Handle GetFirstFontInfo( const XubString& rName ) const; diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index ed2bbd55f7d4..4ea0bce85ee0 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -39,6 +39,7 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> +struct WMF_APMFILEHEADER; // ----------------------- // - GraphicFilter-Types - // ----------------------- @@ -345,13 +346,15 @@ public: sal_uInt16 ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rStream, sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW, - sal_uInt16 * pDeterminedFormat = NULL, sal_uInt32 nImportFlags = 0 ); + sal_uInt16 * pDeterminedFormat = NULL, sal_uInt32 nImportFlags = 0, + WMF_APMFILEHEADER *pAPMHeader = NULL ); sal_uInt16 ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rStream, sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat, sal_uInt32 nImportFlags, - com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData ); + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData, + WMF_APMFILEHEADER *pAPMHeader = NULL ); sal_Bool Setup( sal_uInt16 nFormat ); @@ -361,7 +364,7 @@ public: void ResetLastError(); const Link GetFilterCallback() const; - static GraphicFilter* GetGraphicFilter(); + static GraphicFilter& GetGraphicFilter(); static int LoadGraphic( const String& rPath, const String& rFilter, Graphic& rGraphic, GraphicFilter* pFilter = NULL, diff --git a/svtools/inc/svtools/fltdefs.hxx b/svtools/inc/svtools/fltdefs.hxx index fbdfb573edae..5a8cee962e38 100644 --- a/svtools/inc/svtools/fltdefs.hxx +++ b/svtools/inc/svtools/fltdefs.hxx @@ -72,20 +72,10 @@ typedef sal_uInt8* PDIBBYTE; #endif -#if defined ( OS2 ) || defined ( UNX ) +#if defined ( UNX ) void ReadBitmap( SvStream& rIStream, Bitmap& rBmp, sal_uInt16 nDefaultHeight = 0, sal_uLong nOffBits = 0 ); void ReplaceInfoHeader( SvStream& rStm, sal_uInt8* pBuffer ); -#ifdef OS2 -#define RGBQUAD RGBQUADOS2 -#define BITMAPFILEHEADER BITMAPFILEHEADEROS2 -#define PBITMAPFILEHEADER PBITMAPFILEHEADEROS2 -#define BITMAPINFOHEADER BITMAPINFOHEADEROS2 -#define PBITMAPINFOHEADER PBITMAPINFOHEADEROS2 -#define BITMAPINFO BITMAPINFOOS2 -#define PBITMAPINFO PBITMAPINFOOS2 -#endif - typedef struct RGBQUAD { sal_uInt8 rgbBlue; diff --git a/svtools/inc/svtools/htmlcfg.hxx b/svtools/inc/svtools/htmlcfg.hxx index 33c87839db8a..c668324069bd 100644 --- a/svtools/inc/svtools/htmlcfg.hxx +++ b/svtools/inc/svtools/htmlcfg.hxx @@ -59,8 +59,8 @@ class SVT_DLLPUBLIC SvxHtmlOptions : public utl::ConfigItem void CallListeners(); public: - SvxHtmlOptions(); - ~SvxHtmlOptions(); + SvxHtmlOptions(); + ~SvxHtmlOptions(); virtual void Commit(); virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); @@ -92,7 +92,7 @@ public: sal_Bool IsDefaultTextEncoding() const; rtl_TextEncoding GetTextEncoding() const; void SetTextEncoding( rtl_TextEncoding ); - static SvxHtmlOptions* Get(); + static SvxHtmlOptions& Get(); sal_Bool IsNumbersEnglishUS() const; void SetNumbersEnglishUS(sal_Bool bSet); diff --git a/svtools/inc/svtools/htmltokn.h b/svtools/inc/svtools/htmltokn.h index bd4fe7ba6c25..0b7852d27ec2 100644 --- a/svtools/inc/svtools/htmltokn.h +++ b/svtools/inc/svtools/htmltokn.h @@ -523,7 +523,7 @@ HTML_OPTION_ENUM_END, // Attribute mit Script-Code als Wert HTML_OPTION_SCRIPT_START = HTML_OPTION_ENUM_END, - HTML_O_ONABORT = HTML_OPTION_SCRIPT_START, // JavaScaript + HTML_O_ONABORT = HTML_OPTION_SCRIPT_START, // JavaScript HTML_O_ONBLUR, // JavaScript HTML_O_ONCHANGE, // JavaScript HTML_O_ONCLICK, // JavaScript diff --git a/svtools/inc/svtools/insdlg.hxx b/svtools/inc/svtools/insdlg.hxx index e7d894122243..4bb9cd893828 100644 --- a/svtools/inc/svtools/insdlg.hxx +++ b/svtools/inc/svtools/insdlg.hxx @@ -35,7 +35,7 @@ #include <tools/globname.hxx> #include <sot/formats.hxx> -#include <svl/ownlist.hxx> +#include <vector> #include <svtools/transfer.hxx> class SvObjectServer @@ -53,13 +53,27 @@ public: const String & GetHumanName() const { return aHumanName; } }; +typedef ::std::vector< SvObjectServer > SvObjectServerList_impl; + class SVT_DLLPUBLIC SvObjectServerList { - PRV_SV_DECL_OWNER_LIST(SvObjectServerList,SvObjectServer) +private: + SvObjectServerList_impl aObjectServerList; + +public: const SvObjectServer * Get( const String & rHumanName ) const; const SvObjectServer * Get( const SvGlobalName & ) const; void Remove( const SvGlobalName & ); void FillInsertObjects(); + size_t Count() const + { + return aObjectServerList.size(); + } + + const SvObjectServer operator[]( size_t n ) const + { + return aObjectServerList[ n ]; + } }; class SVT_DLLPUBLIC SvPasteObjectHelper diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index b9e9e11fe608..a9a0c5a2da58 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -45,7 +45,7 @@ #ifdef WNT #define CDECL _cdecl #endif -#if defined(UNX) || defined(OS2) +#if defined(UNX) #define CDECL #endif #ifdef UNX diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 6d9ca1bb379d..bcad9e4e0beb 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -31,7 +31,7 @@ #include "svtools/svtdllapi.h" #include <tools/solar.h> -#include <tools/list.hxx> +#include <vector> #include <tools/table.hxx> #include <tools/link.hxx> @@ -61,20 +61,37 @@ #define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010 class SvListEntry; +typedef ::std::vector< SvListEntry* > SvTreeEntryList_impl; -class SvTreeEntryList : public List // SvEntryListStd +//============================================================================= + +class SVT_DLLPUBLIC SvTreeEntryList { +private: + SvTreeEntryList_impl aTreeEntryList; + public: - SvTreeEntryList(sal_uInt16 nInitPos=16, sal_uInt16 nResize=16 ) - : List( nInitPos, nResize ) - {} - SvTreeEntryList(sal_uInt16 BlockSize, sal_uInt16 InitSize, sal_uInt16 Resize ) - : List(BlockSize, InitSize, Resize ) - {} - - void DestroyAll(); + SvTreeEntryList() {}; + SvTreeEntryList( SvTreeEntryList& rList ); + + void DestroyAll(); + void erase( size_t nItem ); + void erase( SvListEntry* pItem ); + void replace( SvListEntry* pOldItem, SvListEntry* pNewItem ); + + size_t size() const { return aTreeEntryList.size(); } + size_t GetPos( SvListEntry* pItem ); + + bool empty() const { return aTreeEntryList.empty(); } + + void push_back( SvListEntry* pItem ); + void insert( size_t nPos, SvListEntry* pItem ); + SvListEntry* last(); + SvListEntry* operator[]( size_t i ); }; +//============================================================================= + class SVT_DLLPUBLIC SvListEntry { friend class SvTreeList; @@ -111,6 +128,8 @@ public: virtual void Clone( SvListEntry* pSource ); }; +//============================================================================= + class SvListView; class SvViewData @@ -157,6 +176,8 @@ public: bool IsSelectable() const { return (bool)(nFlags&SVLISTENTRYFLAG_NOT_SELECTABLE)==0; } }; +//============================================================================= + enum SvSortMode { SortAscending, SortDescending, SortNone }; // Rueckgabewerte Sortlink: @@ -168,20 +189,24 @@ struct SvSortData SvListEntry* pRight; }; +//============================================================================= + +typedef ::std::vector< SvListView* > SvViewList_impl; + class SVT_DLLPUBLIC SvTreeList { friend class SvListView; - List aViewList; - sal_uLong nEntryCount; + SvViewList_impl aViewList; + sal_uLong nEntryCount; Link aCloneLink; Link aCompareLink; SvSortMode eSortMode; - sal_uInt16 nRefCount; + sal_uInt16 nRefCount; - sal_Bool bAbsPositionsValid; + sal_Bool bAbsPositionsValid; SvListEntry* FirstVisible() const { return First(); } SvListEntry* NextVisible( const SvListView*,SvListEntry* pEntry, sal_uInt16* pDepth=0 ) const; @@ -190,35 +215,39 @@ class SVT_DLLPUBLIC SvTreeList SvListEntry* NextVisible( const SvListView*,SvListEntry* pEntry, sal_uInt16& rDelta ) const; SvListEntry* PrevVisible( const SvListView*,SvListEntry* pEntry, sal_uInt16& rDelta ) const; - sal_Bool IsEntryVisible( const SvListView*,SvListEntry* pEntry ) const; + sal_Bool IsEntryVisible( const SvListView*,SvListEntry* pEntry ) const; SvListEntry* GetEntryAtVisPos( const SvListView*,sal_uLong nVisPos ) const; - sal_uLong GetVisiblePos( const SvListView*,SvListEntry* pEntry ) const; - sal_uLong GetVisibleCount( const SvListView* ) const; - sal_uLong GetVisibleChildCount( const SvListView*,SvListEntry* pParent ) const; + sal_uLong GetVisiblePos( const SvListView*,SvListEntry* pEntry ) const; + sal_uLong GetVisibleCount( const SvListView* ) const; + sal_uLong GetVisibleChildCount( const SvListView*,SvListEntry* pParent ) const; SvListEntry* FirstSelected( const SvListView*) const; SvListEntry* NextSelected( const SvListView*,SvListEntry* pEntry ) const; SvListEntry* PrevSelected( const SvListView*,SvListEntry* pEntry ) const; SvListEntry* LastSelected( const SvListView*) const; - sal_Bool Select( SvListView*,SvListEntry* pEntry, sal_Bool bSelect=sal_True ); - sal_uLong SelectChilds( SvListView*,SvListEntry* pParent, sal_Bool bSelect ); + sal_Bool Select( SvListView*,SvListEntry* pEntry, sal_Bool bSelect=sal_True ); + sal_uLong SelectChilds( SvListView*,SvListEntry* pParent, sal_Bool bSelect ); void SelectAll( SvListView*,sal_Bool bSelect ); // ruft nicht Select-Hdl - sal_uLong GetChildSelectionCount( const SvListView*,SvListEntry* pParent ) const; + sal_uLong GetChildSelectionCount( const SvListView*,SvListEntry* pParent ) const; void Expand( SvListView*,SvListEntry* pParent ); void Collapse( SvListView*,SvListEntry* pParent ); SVT_DLLPRIVATE void SetAbsolutePositions(); - SVT_DLLPRIVATE SvTreeEntryList*CloneChilds( SvTreeEntryList* pChilds, - SvListEntry* pNewParent, - sal_uLong& nCloneCount ) const; - SVT_DLLPRIVATE void SetListPositions( SvTreeEntryList* ); + SVT_DLLPRIVATE SvTreeEntryList* CloneChilds( SvTreeEntryList* pChilds, + SvListEntry* pNewParent, + sal_uLong& nCloneCount + ) const; + SVT_DLLPRIVATE void SetListPositions( SvTreeEntryList* ); // rPos wird bei SortModeNone nicht geaendert - SVT_DLLPRIVATE void GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, - sal_uLong& rPos ); - SVT_DLLPRIVATE void ResortChilds( SvListEntry* pParent ); + SVT_DLLPRIVATE void GetInsertionPos( + SvListEntry* pEntry, + SvListEntry* pParent, + sal_uLong& rPos + ); + SVT_DLLPRIVATE void ResortChilds( SvListEntry* pParent ); protected: @@ -226,19 +255,26 @@ protected: public: - SvTreeList(); - virtual ~SvTreeList(); + SvTreeList(); + virtual ~SvTreeList(); void InsertView( SvListView* ); void RemoveView( SvListView* ); - sal_uLong GetViewCount() const { return aViewList.Count(); } - SvListView* GetView(sal_uLong nPos) const {return (SvListView*)aViewList.GetObject(nPos);} - void Broadcast( sal_uInt16 nActionId, SvListEntry* pEntry1=0, - SvListEntry* pEntry2=0, sal_uLong nPos=0 ); + sal_uLong GetViewCount() const { return aViewList.size(); } + SvListView* GetView(sal_uLong nPos) const { + return ( nPos < aViewList.size() ) ? aViewList[ nPos ] : NULL; + } + + void Broadcast( + sal_uInt16 nActionId, + SvListEntry* pEntry1=0, + SvListEntry* pEntry2=0, + sal_uLong nPos=0 + ); // informiert alle Listener void InvalidateEntry( SvListEntry* ); - sal_uLong GetEntryCount() const { return nEntryCount; } + sal_uLong GetEntryCount() const { return nEntryCount; } SvListEntry* First() const; SvListEntry* Next( SvListEntry* pEntry, sal_uInt16* pDepth=0 ) const; SvListEntry* Prev( SvListEntry* pEntry, sal_uInt16* pDepth=0 ) const; @@ -249,39 +285,42 @@ public: SvListEntry* PrevSibling( SvListEntry* pEntry ) const; SvListEntry* LastSibling( SvListEntry* pEntry ) const; - sal_uLong Insert( SvListEntry* pEntry,SvListEntry* pPar,sal_uLong nPos=LIST_APPEND); - sal_uLong Insert( SvListEntry* pEntry,sal_uLong nRootPos = LIST_APPEND ) { return Insert(pEntry, pRootItem, nRootPos ); } + sal_uLong Insert( SvListEntry* pEntry,SvListEntry* pPar,sal_uLong nPos=ULONG_MAX); + sal_uLong Insert( SvListEntry* pEntry,sal_uLong nRootPos = ULONG_MAX ) { return Insert(pEntry, pRootItem, nRootPos ); } void InsertTree( SvListEntry* pTree, SvListEntry* pTarget ); - void InsertTree( SvListEntry* pTree, SvListEntry* pTargetParent, - sal_uLong nListPos ); + void InsertTree( + SvListEntry* pTree, + SvListEntry* pTargetParent, + sal_uLong nListPos + ); // Entries muessen im gleichen Model stehen! void Move( SvListEntry* pSource, SvListEntry* pTarget ); // erzeugt ggf. Child-List - sal_uLong Move( SvListEntry* pSource, SvListEntry* pTargetParent, + sal_uLong Move( SvListEntry* pSource, SvListEntry* pTargetParent, sal_uLong nListPos); void Copy( SvListEntry* pSource, SvListEntry* pTarget ); - sal_uLong Copy( SvListEntry* pSource, SvListEntry* pTargetParent, + sal_uLong Copy( SvListEntry* pSource, SvListEntry* pTargetParent, sal_uLong nListPos); - sal_Bool Remove( SvListEntry* pEntry ); + sal_Bool Remove( SvListEntry* pEntry ); void Clear(); - sal_Bool HasChilds( SvListEntry* pEntry ) const; - sal_Bool HasParent( SvListEntry* pEntry ) const { return (sal_Bool)(pEntry->pParent!=pRootItem); } - sal_Bool IsChild( SvListEntry* pParent, SvListEntry* pChild ) const; - sal_Bool IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const; + sal_Bool HasChilds( SvListEntry* pEntry ) const; + sal_Bool HasParent( SvListEntry* pEntry ) const { return (sal_Bool)(pEntry->pParent!=pRootItem); } + sal_Bool IsChild( SvListEntry* pParent, SvListEntry* pChild ) const; + sal_Bool IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const; SvListEntry* GetEntry( SvListEntry* pParent, sal_uLong nPos ) const; SvListEntry* GetEntry( sal_uLong nRootPos ) const; SvListEntry* GetEntryAtAbsPos( sal_uLong nAbsPos ) const; SvListEntry* GetParent( SvListEntry* pEntry ) const; SvListEntry* GetRootLevelParent( SvListEntry* pEntry ) const; - SvTreeEntryList* GetChildList( SvListEntry* pParent ) const; + SvTreeEntryList* GetChildList( SvListEntry* pParent ) const; - sal_uLong GetAbsPos( SvListEntry* pEntry ) const; - sal_uLong GetRelPos( SvListEntry* pChild ) const { return pChild->GetChildListPos(); } - sal_uLong GetChildCount( SvListEntry* pParent ) const; - sal_uInt16 GetDepth( SvListEntry* pEntry ) const; - sal_Bool IsAtRootDepth( SvListEntry* pEntry ) const { return (sal_Bool)(pEntry->pParent==pRootItem); } + sal_uLong GetAbsPos( SvListEntry* pEntry ) const; + sal_uLong GetRelPos( SvListEntry* pChild ) const { return pChild->GetChildListPos(); } + sal_uLong GetChildCount( SvListEntry* pParent ) const; + sal_uInt16 GetDepth( SvListEntry* pEntry ) const; + sal_Bool IsAtRootDepth( SvListEntry* pEntry ) const { return (sal_Bool)(pEntry->pParent==pRootItem); } // das Model ruft zum Clonen von Entries den Clone-Link auf, // damit man sich nicht vom Model ableiten muss, wenn man @@ -295,7 +334,7 @@ public: virtual SvListEntry* CloneEntry( SvListEntry* ) const; // ruft den Clone-Link virtual SvListEntry* CreateEntry() const; // zum 'new'en von Entries - sal_uInt16 GetRefCount() const { return nRefCount; } + sal_uInt16 GetRefCount() const { return nRefCount; } void SetRefCount( sal_uInt16 nRef ) { nRefCount = nRef; } void SetSortMode( SvSortMode eMode ) { eSortMode = eMode; } @@ -305,9 +344,13 @@ public: const Link& GetCompareHdl() const { return aCompareLink; } void Resort(); +#ifdef CHECK_INTEGRITY void CheckIntegrity() const; +#endif }; +//============================================================================= + class SVT_DLLPUBLIC SvListView { friend class SvTreeList; @@ -439,18 +482,18 @@ inline SvListEntry* SvTreeList::GetEntry( SvListEntry* pParent, sal_uLong nPos ) { if ( !pParent ) pParent = pRootItem; SvListEntry* pRet = 0; - if ( pParent->pChilds ) - pRet = (SvListEntry*)(pParent->pChilds->GetObject(nPos)); + if ( pParent->pChilds + && nPos < pParent->pChilds->size() + ) + pRet = (*pParent->pChilds)[ nPos ]; return pRet; } inline SvListEntry* SvTreeList::GetEntry( sal_uLong nRootPos ) const { - SvListEntry* pRet; + SvListEntry* pRet = NULL; if ( nEntryCount ) - pRet = (SvListEntry*)(pRootItem->pChilds->GetObject(nRootPos)); - else - pRet = 0; + pRet = (*pRootItem->pChilds)[nRootPos]; return pRet; } diff --git a/svtools/inc/svtools/wmf.hxx b/svtools/inc/svtools/wmf.hxx index be1852701f33..3c1f07774a45 100644 --- a/svtools/inc/svtools/wmf.hxx +++ b/svtools/inc/svtools/wmf.hxx @@ -32,7 +32,30 @@ #include "svtools/svtdllapi.h" #include <svtools/fltcall.hxx> -sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ); +struct WMF_APMFILEHEADER { + sal_uInt32 key; + sal_uInt16 hmf; + sal_uInt16 left; + sal_uInt16 top; + sal_uInt16 right; + sal_uInt16 bottom; + sal_uInt16 inch; + sal_uInt32 reserved; + sal_uInt16 checksum; + + WMF_APMFILEHEADER() : key(0x9ac6cdd7L), + hmf(0), + left(0), + top(0), + right(0), + bottom(0), + inch(96), + reserved(0), + checksum(0) { + } +}; + +sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem = NULL, WMF_APMFILEHEADER *pAPMHeader = NULL ); SVT_DLLPUBLIC sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem ); diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index e7b8dce0fde9..6e80db6fcf6c 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -202,7 +202,9 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< ::rtl::OUString>& rProperty { for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ASSERT( pValues[nProp].hasValue(), "property value missing" ); +#endif if ( pValues[nProp].hasValue() ) { sal_Bool bTmp = sal_Bool(); @@ -264,8 +266,8 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< ::rtl::OUString>& rProperty } else { - DBG_ERRORFILE( "Wrong Type!" ); - } + DBG_ERRORFILE( "Wrong Type!" ); + } } } if ( IsHelpTips() != Help::IsQuickHelpEnabled() ) diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index c3d5526a41fa..338fd0d6e40c 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -35,6 +35,7 @@ #include <tools/debug.hxx> #include <tools/link.hxx> #include <sal/macros.h> +#include <rtl/instance.hxx> #include <list> // ----------------------------------------------------------------------- @@ -53,8 +54,6 @@ using namespace com::sun::star::uno; using ::rtl::OUString; -static SvxHtmlOptions* pOptions = 0; - #define C2U(cChar) OUString::createFromAscii(cChar) struct HtmlOptions_Impl @@ -458,11 +457,14 @@ sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const return pImp->bIsEncodingDefault; } -SvxHtmlOptions* SvxHtmlOptions::Get() +namespace +{ + class theSvxHtmlOptions : public rtl::Static<SvxHtmlOptions, theSvxHtmlOptions> {}; +} + +SvxHtmlOptions& SvxHtmlOptions::Get() { - if ( !pOptions ) - pOptions = new SvxHtmlOptions; - return pOptions; + return theSvxHtmlOptions::get(); } sal_Bool SvxHtmlOptions::IsNumbersEnglishUS() const diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index 4abb7ba102df..a70be005dcca 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -258,6 +258,10 @@ SvtMenuOptions_Impl::SvtMenuOptions_Impl() // Safe impossible cases. // Check any for valid value. DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nInvalid property value for property detected!\n" ); + + if (!seqValues[nProperty].hasValue()) + continue; + switch( nProperty ) { case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES : { diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 546212bebc45..405891696421 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> +#include <rtl/instance.hxx> //_________________________________________________________________________________________________________________ // namespaces @@ -1685,29 +1686,17 @@ void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPe m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent ); } +namespace +{ + class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theOptionsDrawinglayerMutex::get(); } // eof diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx index 6fd401533267..41d6a100c1f3 100644 --- a/svtools/source/contnr/svicnvw.cxx +++ b/svtools/source/contnr/svicnvw.cxx @@ -547,21 +547,6 @@ void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem, aRect.Bottom() += 2; // sieht huebscher aus -#ifdef OS2 - -#if OS2_SINGLE_LINE_EDIT - aRect.Left() -= 3; - aRect.Right() += 3; - aRect.Top() -= 3; - aRect.Bottom() += 3; -#else - aRect.Left() -= 10; - aRect.Right() += 10; - aRect.Top() -= 5; - aRect.Bottom() += 5; -#endif - -#endif // OS2 EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True ); } diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 69e9d12ace50..ac327a844444 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -44,6 +44,7 @@ #include <tools/wintypes.hxx> #include <svtools/svtools.hrc> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #define NODE_BMP_TABDIST_NOTVALID -2000000 #define FIRST_ENTRY_TAB 1 @@ -64,7 +65,7 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvLBoxTreeList* pLBTree, WinBits n aFctSet( this, &aSelEng, pLBView ), nExtendedWinBits( 0 ), bAreChildrenTransient( sal_True ), - pIntlWrapper( NULL ) // #102891# ----------------------- + m_pStringSorter(NULL) { osl_incrementInterlockedCount(&s_nImageRefCount); pView = pLBView; @@ -126,9 +127,7 @@ SvImpLBox::~SvImpLBox() aEditTimer.Stop(); StopUserEvent(); - // #102891# --------------------- - if( pIntlWrapper ) - delete pIntlWrapper; + delete m_pStringSorter; if ( osl_decrementInterlockedCount(&s_nImageRefCount) == 0 ) { DELETEZ(s_pDefCollapsed); @@ -136,23 +135,29 @@ SvImpLBox::~SvImpLBox() } } -// #102891# -------------------- -void SvImpLBox::UpdateIntlWrapper() +void SvImpLBox::UpdateStringSorter() { - const ::com::sun::star::lang::Locale & aNewLocale = Application::GetSettings().GetLocale(); - if( !pIntlWrapper ) - pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), aNewLocale ); - else + const ::com::sun::star::lang::Locale& rNewLocale = Application::GetSettings().GetLocale(); + + if( m_pStringSorter ) { - const ::com::sun::star::lang::Locale &aLocale = pIntlWrapper->getLocale(); - if( aLocale.Language != aNewLocale.Language || // different Locale from the older one - aLocale.Country != aNewLocale.Country || - aLocale.Variant != aNewLocale.Variant ) + // different Locale from the older one, drop it and force recreate + const ::com::sun::star::lang::Locale &aLocale = m_pStringSorter->getLocale(); + if( aLocale.Language != rNewLocale.Language || + aLocale.Country != rNewLocale.Country || + aLocale.Variant != rNewLocale.Variant ) { - delete pIntlWrapper; - pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), aNewLocale ); + delete m_pStringSorter; + m_pStringSorter = NULL; } } + + if( !m_pStringSorter ) + { + m_pStringSorter = new comphelper::string::NaturalStringSorter( + ::comphelper::getProcessComponentContext(), + rNewLocale); + } } // #97680# ---------------------- @@ -1713,7 +1718,7 @@ void SvImpLBox::RemovingEntry( SvLBoxEntry* pEntry ) SvLBoxEntry* pParent = (SvLBoxEntry*)(pView->GetModel()->GetParent(pEntry)); - if( pParent && pView->GetModel()->GetChildList(pParent)->Count() == 1 ) + if( pParent && pView->GetModel()->GetChildList(pParent)->size() == 1 ) { DBG_ASSERT( pView->IsExpanded( pParent ), "Parent not expanded"); pParent->SetFlags( pParent->GetFlags() | SV_ENTRYFLAG_NO_NODEBMP); @@ -1881,7 +1886,7 @@ void SvImpLBox::EntryInserted( SvLBoxEntry* pEntry ) if( GetUpdateMode() ) { SvLBoxEntry* pParent = (SvLBoxEntry*)pTree->GetParent(pEntry); - if( pParent && pTree->GetChildList(pParent)->Count() == 1 ) + if( pParent && pTree->GetChildList(pParent)->size() == 1 ) // Pluszeichen zeichnen pTree->InvalidateEntry( pParent ); @@ -2094,11 +2099,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( !rMEvt.IsLeft() && !rMEvt.IsRight()) return; -#ifdef OS2 - // unter OS/2 kommt zwischen MouseButtonDown und - // MouseButtonUp ein MouseMove - nFlags |= F_IGNORE_NEXT_MOUSEMOVE; -#endif aEditTimer.Stop(); Point aPos( rMEvt.GetPosPixel()); @@ -2181,9 +2181,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) { -#ifdef OS2 - nFlags &= (~F_IGNORE_NEXT_MOUSEMOVE); -#endif if ( !ButtonUpCheckCtrl( rMEvt ) && ( aSelEng.GetSelectionMode() != NO_SELECTION ) ) aSelEng.SelMouseButtonUp( rMEvt ); EndScroll(); @@ -2199,13 +2196,6 @@ void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) void SvImpLBox::MouseMove( const MouseEvent& rMEvt) { -#ifdef OS2 - if( nFlags & F_IGNORE_NEXT_MOUSEMOVE ) - { - nFlags &= (~F_IGNORE_NEXT_MOUSEMOVE); - return; - } -#endif SvLBoxEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() ); if ( !MouseMoveCheckCtrl( rMEvt, pEntry ) && ( aSelEng.GetSelectionMode() != NO_SELECTION ) ) aSelEng.SelMouseMove( rMEvt ); @@ -2550,7 +2540,7 @@ sal_Bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) // Sonderbehandlung Explorer: Befindet sich auf der // Root nur ein Eintrag,dann den Root-Entry nicht // einklappen - if( pTree->GetChildList(0)->Count() < 2 ) + if( pTree->GetChildList(0)->size() < 2 ) { nRefDepth = 1; pParentToCollapse = pCursor; @@ -3448,10 +3438,10 @@ void SvImpLBox::FindMostRight_Impl( SvLBoxEntry* pParent, SvLBoxEntry* pEntryToI if( !pList ) return; - sal_uLong nCount = pList->Count(); + sal_uLong nCount = pList->size(); for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) { - SvLBoxEntry* pChild = (SvLBoxEntry*)pList->GetObject( nCur ); + SvLBoxEntry* pChild = (SvLBoxEntry*)(*pList)[ nCur ]; if( pChild != pEntryToIgnore ) { SetMostRight( pChild ); diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index eab15f65647c..3514c7b6a271 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -1636,16 +1636,6 @@ sal_Bool SvImpIconView::KeyInput( const KeyEvent& rKEvt ) } break; -#ifdef OS2 - case KEY_F9: - if( rKEvt.GetKeyCode().IsShift() ) - { - if( pCursor && pView->IsInplaceEditingEnabled() ) - pView->EditEntry( pCursor ); - } - break; -#endif - case KEY_SPACE: if( pCursor ) { @@ -1693,9 +1683,6 @@ void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight ) Point aPos( 0, nRealHeight ); aPos.Y() -= nHorSBarHeight; -#ifdef OS2 - aPos.Y()++; -#endif if( aHorSBar.GetPosPixel() != aPos ) aHorSBar.SetPosPixel( aPos ); @@ -1708,11 +1695,6 @@ void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight ) aPos.Y()--; #endif -#ifdef OS2 - aPos.Y()--; - aPos.X()++; -#endif - if( aVerSBar.GetPosPixel() != aPos ) aVerSBar.SetPosPixel( aPos ); } @@ -1798,9 +1780,6 @@ void SvImpIconView::AdjustScrollBars() #if defined(WNT) aSize.Height() += 2; #endif -#ifdef OS2 - aSize.Height() += 3; -#endif if( aSize != aVerSBar.GetSizePixel() ) aVerSBar.SetSizePixel( aSize ); aVerSBar.SetVisibleSize( nVisibleHeight ); @@ -1823,11 +1802,6 @@ void SvImpIconView::AdjustScrollBars() #if defined(WNT) aSize.Width()++; #endif -#ifdef OS2 - aSize.Width() += 3; - if( nResult & 0x0001 ) // vertikale Scrollbar ? - aSize.Width()--; -#endif #if defined(WNT) if( nResult & 0x0001 ) // vertikale Scrollbar ? { @@ -1850,18 +1824,11 @@ void SvImpIconView::AdjustScrollBars() aHorSBar.Hide(); } -#ifdef OS2 - nRealWidth++; -#endif aOutputSize.Width() = nRealWidth; #if defined(WNT) if( nResult & 0x0002 ) // hor scrollbar ? nRealHeight++; // weil unterer Rand geclippt wird #endif -#ifdef OS2 - if( nResult & 0x0002 ) // hor scrollbar ? - nRealHeight++; -#endif aOutputSize.Height() = nRealHeight; } @@ -2025,11 +1992,7 @@ void SvImpIconView::PaintEmphasis( const Rectangle& rRect, sal_Bool bSelected, } else { -#ifndef OS2 aNewColor =rStyleSettings.GetFieldColor(); -#else - aNewColor = pOut->GetBackground().GetColor(); -#endif } if( bCursored ) @@ -3712,13 +3675,9 @@ const Size& SvImpIconView::GetItemSize( SvIconView* pIconView, Rectangle SvImpIconView::CalcFocusRect( SvLBoxEntry* pEntry ) { -#if !defined(OS2) SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); DBG_ASSERT(pStringItem,"Text not set"); return CalcTextRect( pEntry, pStringItem ); -#else - return CalcBmpRect( pEntry ); -#endif } diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index a543343ed59e..632384becfce 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -1026,15 +1026,15 @@ sal_Bool SvLBox::CopySelection( SvLBox* pSource, SvLBoxEntry* pTarget ) { // Childs werden automatisch mitkopiert pSource->SelectChilds( pSourceEntry, sal_False ); - aList.Insert( pSourceEntry, LIST_APPEND ); + aList.push_back( pSourceEntry ); pSourceEntry = pSource->NextSelected( pSourceEntry ); } - pSourceEntry = (SvLBoxEntry*)aList.First(); - while ( pSourceEntry ) + for ( size_t i = 0, n = aList.size(); i < n; ++i ) { + pSourceEntry = (SvLBoxEntry*)aList[ i ]; SvLBoxEntry* pNewParent = 0; - sal_uLong nInsertionPos = LIST_APPEND; + sal_uLong nInsertionPos = ULONG_MAX; sal_Bool bOk=NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos); if ( bOk ) { @@ -1059,7 +1059,6 @@ sal_Bool SvLBox::CopySelection( SvLBox* pSource, SvLBoxEntry* pTarget ) if( bOk == (sal_Bool)2 ) // !!!HACK verschobenen Entry sichtbar machen? MakeVisible( pSourceEntry ); - pSourceEntry = (SvLBoxEntry*)aList.Next(); } pModel->SetCloneLink( aCloneLink ); return bSuccess; @@ -1087,20 +1086,20 @@ sal_Bool SvLBox::MoveSelectionCopyFallbackPossible( SvLBox* pSource, SvLBoxEntry { // Childs werden automatisch mitbewegt pSource->SelectChilds( pSourceEntry, sal_False ); - aList.Insert( pSourceEntry, LIST_APPEND ); + aList.push_back( pSourceEntry ); pSourceEntry = pSource->NextSelected( pSourceEntry ); } - pSourceEntry = (SvLBoxEntry*)aList.First(); - while ( pSourceEntry ) + for ( size_t i = 0, n = aList.size(); i < n; ++i ) { + pSourceEntry = (SvLBoxEntry*)aList[ i ]; SvLBoxEntry* pNewParent = 0; sal_uLong nInsertionPos = LIST_APPEND; sal_Bool bOk = NotifyMoving(pTarget,pSourceEntry,pNewParent,nInsertionPos); sal_Bool bCopyOk = bOk; if ( !bOk && bAllowCopyFallback ) { - nInsertionPos = LIST_APPEND; + nInsertionPos = ULONG_MAX; bCopyOk = NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos); } @@ -1129,8 +1128,6 @@ sal_Bool SvLBox::MoveSelectionCopyFallbackPossible( SvLBox* pSource, SvLBoxEntry if( bOk == (sal_Bool)2 ) // !!!HACK verschobenen Entry sichtbar machen? MakeVisible( pSourceEntry ); - - pSourceEntry = (SvLBoxEntry*)aList.Next(); } pModel->SetCloneLink( aCloneLink ); return bSuccess; @@ -1145,17 +1142,16 @@ void SvLBox::RemoveSelection() SvLBoxEntry* pEntry = FirstSelected(); while ( pEntry ) { - aList.Insert( pEntry ); + aList.push_back( pEntry ); if ( pEntry->HasChilds() ) // Remove loescht Childs automatisch SelectChilds( pEntry, sal_False ); pEntry = NextSelected( pEntry ); } - pEntry = (SvLBoxEntry*)aList.First(); - while ( pEntry ) + for ( size_t i = 0, n = aList.size(); i < n; ++i ) { + pEntry = (SvLBoxEntry*)aList[ i ]; pModel->Remove( pEntry ); - pEntry = (SvLBoxEntry*)aList.Next(); } } diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 12ac258dd31c..d03b956bf571 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -37,6 +37,7 @@ class TabBar; #include <svtools/svlbitm.hxx> #include <svtools/svtreebx.hxx> #include <tools/diagnose_ex.h> +#include <comphelper/string.hxx> #include <svimpbox.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -1287,12 +1288,6 @@ void SvTreeListBox::EditItemText( SvLBoxEntry* pEntry, SvLBoxString* pItem, aPos += aOrigin; // in Win-Koord umrechnen aSize.Width() -= aOrigin.X(); Rectangle aRect( aPos, aSize ); -#ifdef OS2 - // Platz lassen fuer WB_BORDER - aRect.Left() -= 2; - aRect.Top() -= 3; - aRect.Bottom() += 3; -#endif EditText( pItem->GetText(), aRect, rSelection ); } @@ -1472,9 +1467,6 @@ void SvTreeListBox::ImplInitStyle() GetModel()->SetSortMode( SortNone ); GetModel()->SetCompareHdl( Link() ); } -#ifdef OS2 - nWindowStyle |= WB_VSCROLL; -#endif pImp->SetStyle( nWindowStyle ); pImp->Resize(); Invalidate(); @@ -2274,8 +2266,8 @@ IMPL_LINK( SvTreeListBox, DefaultCompare, SvSortData*, pData ) SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight ); String aLeft( ((SvLBoxString*)(pLeft->GetFirstItem(SV_ITEM_ID_LBOXSTRING)))->GetText()); String aRight( ((SvLBoxString*)(pRight->GetFirstItem(SV_ITEM_ID_LBOXSTRING)))->GetText()); - pImp->UpdateIntlWrapper(); - return pImp->pIntlWrapper->getCaseCollator()->compareString( aLeft, aRight ); + pImp->UpdateStringSorter(); + return pImp->m_pStringSorter->compare(aLeft, aRight); } void SvTreeListBox::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index f78b13fb04ad..bbb99158ad26 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -33,7 +33,6 @@ #include <svtools/treelist.hxx> - DBG_NAME(SvListEntry); SvListEntry::SvListEntry() @@ -81,14 +80,13 @@ void SvListEntry::SetListPositions() { if( pChilds ) { - SvListEntry *pEntry = (SvListEntry*)pChilds->First(); sal_uLong nCur = 0; - while ( pEntry ) + for ( size_t i = 0, n = pChilds->size(); i < n; ++i ) { + SvListEntry *pEntry = (SvListEntry*)(*pChilds)[ i ]; pEntry->nListPos &= 0x80000000; pEntry->nListPos |= nCur; nCur++; - pEntry = (SvListEntry*)pChilds->Next(); } } nListPos &= (~0x80000000); @@ -121,16 +119,92 @@ SvViewData::~SvViewData() #endif } +//============================================================================= +// SvTreeEntryList +//============================================================================= + +SvTreeEntryList::SvTreeEntryList( SvTreeEntryList& rList ) +{ + for ( size_t i = 0, n = rList.size(); i < n; ++i ) { + aTreeEntryList.push_back( new SvListEntry( *rList[ i ] ) ); + } +} + void SvTreeEntryList::DestroyAll() { - SvListEntry* pPtr = (SvListEntry*)First(); - while( pPtr ) + for ( size_t i = 0, n = aTreeEntryList.size(); i < n; ++i ) + delete aTreeEntryList[ i ]; + aTreeEntryList.clear(); +} + +void SvTreeEntryList::erase( size_t nItem ) +{ + if ( nItem < aTreeEntryList.size() ) + aTreeEntryList.erase( aTreeEntryList.begin() + nItem ); +} + +void SvTreeEntryList::erase( SvListEntry* pItem ) +{ + for ( SvTreeEntryList_impl::iterator it = aTreeEntryList.begin(); + it < aTreeEntryList.end(); + ++it + ) { + if ( *it == pItem ) { + aTreeEntryList.erase( it ); + break; + } + } +} + +void SvTreeEntryList::replace( SvListEntry* pOldItem, SvListEntry* pNewItem ) +{ + for( size_t i = 0, n = aTreeEntryList.size(); i < n; ++i ) { + if( aTreeEntryList[ i ] == pOldItem ) { + aTreeEntryList[ i ] = pNewItem; + break; + } + } +} + + +SvListEntry* SvTreeEntryList::last() +{ + return aTreeEntryList.empty() ? NULL : aTreeEntryList.back(); +} + +SvListEntry* SvTreeEntryList::operator[]( size_t i ) +{ + return ( i < aTreeEntryList.size() ) ? aTreeEntryList[ i ] : NULL; +} + +size_t SvTreeEntryList::GetPos( SvListEntry* pItem ) +{ + for ( size_t i = 0, n = aTreeEntryList.size(); i < n; ++i ) { - delete pPtr; - pPtr = (SvListEntry*)Next(); + if ( aTreeEntryList[ i ] == pItem ) + return i; } + return ULONG_MAX; } +void SvTreeEntryList::push_back( SvListEntry* pItem ) +{ + aTreeEntryList.push_back( pItem ); +} + +void SvTreeEntryList::insert( size_t nPos, SvListEntry* pItem ) +{ + if ( nPos < aTreeEntryList.size() ) + { + SvTreeEntryList_impl::iterator it = aTreeEntryList.begin(); + ::std::advance( it, nPos ); + aTreeEntryList.insert( it, pItem ); + } + else + { + aTreeEntryList.push_back( pItem ); + } +} /************************************************************************* |* @@ -172,10 +246,10 @@ SvTreeList::~SvTreeList() void SvTreeList::Broadcast( sal_uInt16 nActionId, SvListEntry* pEntry1, SvListEntry* pEntry2, sal_uLong nPos ) { - sal_uLong nViewCount = aViewList.Count(); + sal_uLong nViewCount = aViewList.size(); for( sal_uLong nCurView = 0; nCurView < nViewCount; nCurView++ ) { - SvListView* pView = (SvListView*)aViewList.GetObject( nCurView ); + SvListView* pView = aViewList[ nCurView ]; if( pView ) pView->ModelNotification( nActionId, pEntry1, pEntry2, nPos ); } @@ -183,21 +257,24 @@ void SvTreeList::Broadcast( sal_uInt16 nActionId, SvListEntry* pEntry1, void SvTreeList::InsertView( SvListView* pView) { - sal_uLong nPos = aViewList.GetPos( pView ); - if ( nPos == LIST_ENTRY_NOTFOUND ) - { - aViewList.Insert( pView, LIST_APPEND ); - nRefCount++; + for (sal_uLong i = 0, n = aViewList.size(); i < n; ++i ) { + if ( pView == aViewList[ i ] ) { + return; + } } + aViewList.push_back( pView ); + nRefCount++; } void SvTreeList::RemoveView( SvListView* pView ) { - sal_uLong nPos = aViewList.GetPos( pView ); - if ( nPos != LIST_ENTRY_NOTFOUND ) + for ( SvViewList_impl::iterator it = aViewList.begin(); it < aViewList.end(); ++it ) { - aViewList.Remove( pView ); - nRefCount--; + if ( pView == *it ) { + aViewList.erase( it ); + nRefCount--; + break; + } } } @@ -243,12 +320,7 @@ void SvTreeList::Clear() SvTreeEntryList* pRootList = pRootItem->pChilds; if ( pRootList ) { - SvListEntry* pEntry = (SvListEntry*)(pRootList->First()); - while( pEntry ) - { - delete pEntry; - pEntry = (SvListEntry*)(pRootList->Next()); - } + pRootList->DestroyAll(); delete pRootItem->pChilds; pRootItem->pChilds = 0; } @@ -272,16 +344,15 @@ sal_Bool SvTreeList::IsChild( SvListEntry* pParent, SvListEntry* pChild ) const SvTreeEntryList* pList = pParent->pChilds; if ( !pList ) return sal_False; - SvListEntry* pActualChild = (SvListEntry*)(pList->First()); - while( !bIsChild && pActualChild ) + for ( size_t i = 0, n = pList->size(); i < n && !bIsChild ; ++i ) { + SvListEntry* pActualChild = (*pList)[ i ]; if ( pActualChild == pChild ) bIsChild = sal_True; else { if ( pActualChild->pChilds ) bIsChild = IsChild( pActualChild, pChild ); - pActualChild = (SvListEntry*)(pList->Next()); } } return bIsChild; @@ -309,12 +380,13 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal // Dummy-Ptr einfuegen, weil nListPos durch das // folgende Remove ungueltig werden koennte - SvListEntry* pDummy = 0; pDstList->Insert( pDummy, nListPos ); + SvListEntry* pDummy = 0; + pDstList->insert( nListPos, pDummy ); // loeschen - pSrcList->Remove( pSrcEntry ); + pSrcList->erase( pSrcEntry ); // Hat Parent noch Childs ? - if ( pSrcList->Count() == 0 ) + if ( pSrcList->empty() ) { // Keine Childs, deshalb Child-List loeschen SvListEntry* pParent = pSrcEntry->pParent; @@ -327,7 +399,7 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal // der ChildList den alten Parent noch benoetigen!) pSrcEntry->pParent = pTargetParent; - pDstList->Replace( pSrcEntry, pDummy ); + pDstList->replace( pDummy, pSrcEntry ); // Listenpositionen in Zielliste korrigieren SetListPositions( pDstList ); @@ -335,7 +407,7 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal SetListPositions( pSrcList ); #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif sal_uLong nRetVal = pDstList->GetPos( pSrcEntry ); @@ -361,11 +433,11 @@ sal_uLong SvTreeList::Copy(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal SvTreeEntryList* pDstList = pTargetParent->pChilds; pClonedEntry->pParent = pTargetParent; // Parent umsetzen - pDstList->Insert( pClonedEntry, nListPos ); // Einfuegen + pDstList->insert( nListPos, pClonedEntry ); // Einfuegen SetListPositions( pDstList ); // Listenpositionen in Zielliste korrigieren #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif Broadcast( LISTACTION_INSERTED_TREE, pClonedEntry ); sal_uLong nRetVal = pDstList->GetPos( pClonedEntry ); @@ -466,7 +538,7 @@ void SvTreeList::InsertTree(SvListEntry* pSrcEntry, pSrcEntry->pParent = pTargetParent; // Parent umsetzen SvTreeEntryList* pDstList = pTargetParent->pChilds; - pDstList->Insert( pSrcEntry, nListPos ); // einfuegen + pDstList->insert( nListPos, pSrcEntry ); // einfuegen SetListPositions(pDstList); // Listenpositionen in Zielliste korrigieren nEntryCount += GetChildCount( pSrcEntry ); nEntryCount++; // der Parent ist ja auch neu @@ -517,11 +589,11 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds, SvListEntry* pNewParent, sal_uLong& nCloneCount ) const { - DBG_ASSERT(pChilds->Count(),"Childs?"); + DBG_ASSERT(!pChilds->empty(),"Childs?"); SvTreeEntryList* pClonedChilds = new SvTreeEntryList; - SvListEntry* pChild = (SvListEntry*)pChilds->First(); - while ( pChild ) + for ( size_t i = 0, n = pChilds->size(); i < n; ++i ) { + SvListEntry* pChild = (*pChilds)[ i ]; SvListEntry* pNewChild = CloneEntry( pChild ); nCloneCount++; pNewChild->pParent = pNewParent; @@ -532,8 +604,7 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds, pNewChild->pChilds = pSubChilds; } - pClonedChilds->Insert( pNewChild, LIST_APPEND ); - pChild = (SvListEntry*)pChilds->Next(); + pClonedChilds->push_back( pNewChild ); } return pClonedChilds; } @@ -619,7 +690,7 @@ sal_uLong SvTreeList::GetChildSelectionCount(const SvListView* pView,SvListEntry SvListEntry* SvTreeList::First() const { if ( nEntryCount ) - return (SvListEntry*)(pRootItem->pChilds->GetObject(0)); + return (*pRootItem->pChilds)[ 0 ]; else return 0; } @@ -646,18 +717,18 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons SvTreeEntryList* pActualList = pActEntry->pParent->pChilds; sal_uLong nActualPos = pActEntry->GetChildListPos(); - if ( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ ) + if ( pActEntry->pChilds ) { nDepth++; - pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0)); + pActEntry = (*pActEntry->pChilds)[ 0 ]; if ( bWithDepth ) *pDepth = nDepth; return pActEntry; } - if ( pActualList->Count() > ( nActualPos + 1 ) ) + if ( pActualList->size() > ( nActualPos + 1 ) ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 )); + pActEntry = (*pActualList)[ nActualPos + 1 ]; if ( bWithDepth ) *pDepth = nDepth; return pActEntry; @@ -671,9 +742,9 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons pActualList = pParent->pParent->pChilds; DBG_ASSERT(pActualList,"TreeData corrupt!"); nActualPos = pParent->GetChildListPos(); - if ( pActualList->Count() > ( nActualPos + 1 ) ) + if ( pActualList->size() > ( nActualPos + 1 ) ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 )); + pActEntry = (*pActualList)[ nActualPos + 1 ]; if ( bWithDepth ) *pDepth = nDepth; return pActEntry; @@ -706,12 +777,12 @@ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons if ( nActualPos > 0 ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 )); + pActEntry = (*pActualList)[ nActualPos - 1 ]; while( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ ) { pActualList = pActEntry->pChilds; nDepth++; - pActEntry = (SvListEntry*)(pActualList->Last()); + pActEntry = pActualList->last(); } if ( bWithDepth ) *pDepth = nDepth; @@ -741,15 +812,11 @@ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const { SvTreeEntryList* pActList = pRootItem->pChilds; -// if ( pActList->Count() == 0 ) -// return 0; SvListEntry* pEntry = 0; while( pActList ) { - pEntry = (SvListEntry*)(pActList->Last()); + pEntry = pActList->last(); pActList = pEntry->pChilds; -// if ( pActList->Count() == 0 ) -// pActList = 0; } return pEntry; } @@ -839,16 +906,16 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn { DBG_ASSERT(pActEntry->pChilds,"Childs?"); nDepth++; - pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0)); + pActEntry = (*pActEntry->pChilds)[ 0 ]; if ( bWithDepth ) *pActDepth = nDepth; return pActEntry; } nActualPos++; - if ( pActualList->Count() > nActualPos ) + if ( pActualList->size() > nActualPos ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos )); + pActEntry = (*pActualList)[ nActualPos ]; if ( bWithDepth ) *pActDepth = nDepth; return pActEntry; @@ -861,9 +928,9 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn pActualList = pParent->pParent->pChilds; nActualPos = pParent->GetChildListPos(); nActualPos++; - if ( pActualList->Count() > nActualPos ) + if ( pActualList->size() > nActualPos ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos )); + pActEntry = (*pActualList)[ nActualPos ]; if ( bWithDepth ) *pActDepth = nDepth; return pActEntry; @@ -901,12 +968,12 @@ SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActE if ( nActualPos > 0 ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 )); + pActEntry = (*pActualList)[ nActualPos - 1 ]; while( pView->IsExpanded(pActEntry) ) { pActualList = pActEntry->pChilds; nDepth++; - pActEntry = (SvListEntry*)(pActualList->Last()); + pActEntry = pActualList->last(); } if ( bWithDepth ) *pActDepth = nDepth; @@ -1023,7 +1090,7 @@ SvListEntry* SvTreeList::FirstChild( SvListEntry* pParent ) const pParent = pRootItem; SvListEntry* pResult; if ( pParent->pChilds ) - pResult = (SvListEntry*)(pParent->pChilds->GetObject( 0 )); + pResult = (*pParent->pChilds)[ 0 ]; else pResult = 0; return pResult; @@ -1035,10 +1102,9 @@ SvListEntry* SvTreeList::NextSibling( SvListEntry* pEntry ) const if( !pEntry ) return 0; SvTreeEntryList* pList = pEntry->pParent->pChilds; -// sal_uLong nPos = pList->GetPos( pEntry ); sal_uLong nPos = pEntry->GetChildListPos(); nPos++; - pEntry = (SvListEntry*)(pList->GetObject( nPos )); + pEntry = (*pList)[ nPos ]; return pEntry; } @@ -1049,12 +1115,11 @@ SvListEntry* SvTreeList::PrevSibling( SvListEntry* pEntry ) const return 0; SvTreeEntryList* pList = pEntry->pParent->pChilds; - // sal_uLong nPos = pList->GetPos( pEntry ); sal_uLong nPos = pEntry->GetChildListPos(); if ( nPos == 0 ) return 0; nPos--; - pEntry = (SvListEntry*)(pList->GetObject( nPos )); + pEntry = (*pList)[ nPos ]; return pEntry; } @@ -1067,7 +1132,7 @@ SvListEntry* SvTreeList::LastSibling( SvListEntry* pEntry ) const SvListEntry* pSib = 0; SvTreeEntryList* pSibs = pEntry->pParent->pChilds; if ( pSibs ) - pSib = (SvListEntry*)(pSibs->Last()); + pSib = pSibs->last(); return pSib; } @@ -1146,15 +1211,15 @@ sal_uLong SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,sal_uLong bAbsPositionsValid = sal_False; pEntry->pParent = pParent; - pList->Insert( pEntry, nPos ); + pList->insert( nPos, pEntry ); nEntryCount++; - if( nPos != LIST_APPEND && (nPos != (pList->Count()-1)) ) + if( nPos != ULONG_MAX && (nPos != (pList->size()-1)) ) SetListPositions( pList ); else - pEntry->nListPos = pList->Count()-1; + pEntry->nListPos = pList->size()-1; #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif Broadcast( LISTACTION_INSERTED, pEntry ); return nPos; // pEntry->nListPos; @@ -1319,20 +1384,20 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry ) if ( pEntry->HasChildListPos() ) { - sal_uLong nListPos = pEntry->GetChildListPos(); - bLastEntry = (nListPos == (pList->Count()-1) ) ? sal_True : sal_False; - pList->Remove( nListPos ); + size_t nListPos = pEntry->GetChildListPos(); + bLastEntry = (nListPos == (pList->size()-1) ) ? sal_True : sal_False; + pList->erase( nListPos ); } else { - pList->Remove( (void*) pEntry ); + pList->erase( pEntry ); } // moved to end of method because it is used later with Broadcast // delete pEntry; // loescht auch alle Childs - if ( pList->Count() == 0 ) + if ( pList->empty() ) { pParent->pChilds = 0; delete pList; @@ -1345,7 +1410,7 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry ) nEntryCount -= nRemoved; #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif Broadcast( LISTACTION_REMOVED, pEntry ); @@ -1364,7 +1429,7 @@ sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_B DBG_ASSERT(pView&&pParent,"SelChilds:View/Parent?"); if ( !pParent->pChilds ) return 0; - if ( pParent->pChilds->Count() == 0 ) + if ( pParent->pChilds->empty() ) return 0; sal_uInt16 nRefDepth = GetDepth( pParent ); @@ -1403,7 +1468,7 @@ void SvTreeList::SelectAll( SvListView* pView, sal_Bool bSelect ) else pView->nSelectionCount = 0; #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif } @@ -1433,22 +1498,12 @@ SvListEntry* SvTreeList::GetEntryAtVisPos( const SvListView* pView, sal_uLong nV void SvTreeList::SetListPositions( SvTreeEntryList* pList ) { - if( pList->Count() ) + if( !pList->empty() ) { - SvListEntry* pEntry = (SvListEntry*)(pList->GetObject(0)); + SvListEntry* pEntry = (*pList)[ 0 ]; if( pEntry->pParent ) pEntry->pParent->InvalidateChildrensListPositions(); } - /* - sal_uLong nListPos = 0; - SvListEntry* pEntry = (SvListEntry*)(pList->First()); - while( pEntry ) - { - pEntry->nListPos = nListPos; - nListPos++; - pEntry = (SvListEntry*)(pList->Next()); - } - */ } @@ -1463,11 +1518,27 @@ sal_Bool SvTreeList::IsInChildList( SvListEntry* pParent, SvListEntry* pChild) c pParent = pRootItem; sal_Bool bIsChild = sal_False; if ( pParent->pChilds ) - bIsChild = (sal_Bool)(pParent->pChilds->GetPos(pChild) != LIST_ENTRY_NOTFOUND); + bIsChild = (sal_Bool)(pParent->pChilds->GetPos(pChild) != ULONG_MAX); return bIsChild; } +SvListEntry* SvTreeList::GetRootLevelParent( SvListEntry* pEntry ) const +{ + DBG_ASSERT(pEntry,"GetRootLevelParent:No Entry"); + SvListEntry* pCurParent = 0; + if ( pEntry ) + { + pCurParent = pEntry->pParent; + if ( pCurParent == pRootItem ) + return pEntry; // ist sein eigener Parent + while( pCurParent && pCurParent->pParent != pRootItem ) + pCurParent = pCurParent->pParent; + } + return pCurParent; +} +//============================================================================= +#ifdef CHECK_INTEGRITY void lcl_CheckList( SvTreeEntryList* pList ) { SvListEntry* pEntry = (SvListEntry*)(pList->First()); @@ -1497,24 +1568,7 @@ void SvTreeList::CheckIntegrity() const } DBG_ASSERT(nMyEntryCount==GetEntryCount(),"Entry count invalid"); } - -SvListEntry* SvTreeList::GetRootLevelParent( SvListEntry* pEntry ) const -{ - DBG_ASSERT(pEntry,"GetRootLevelParent:No Entry"); - SvListEntry* pCurParent = 0; - if ( pEntry ) - { - pCurParent = pEntry->pParent; - if ( pCurParent == pRootItem ) - return pEntry; // ist sein eigener Parent - while( pCurParent && pCurParent->pParent != pRootItem ) - pCurParent = pCurParent->pParent; - } - return pCurParent; -} - - - +#endif //************************************************************************* //************************************************************************* @@ -1691,7 +1745,7 @@ void SvListView::ActionMoving( SvListEntry* pEntry,SvListEntry*,sal_uLong) DBG_CHKTHIS(SvListView,0); SvListEntry* pParent = pEntry->pParent; DBG_ASSERT(pParent,"Model not consistent"); - if( pParent != pModel->pRootItem && pParent->pChilds->Count() == 1 ) + if( pParent != pModel->pRootItem && pParent->pChilds->size() == 1 ) { SvViewData* pViewData = (SvViewData*)aDataTable.Get( (sal_uLong)pParent ); pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); @@ -1757,15 +1811,14 @@ void SvListView::RemoveViewData( SvListEntry* pParent ) SvTreeEntryList* pChilds = pParent->pChilds; if( pChilds ) { - SvListEntry* pCur = (SvListEntry*)pChilds->First(); - while( pCur ) + for ( size_t i = 0; i < pChilds->size(); ++i ) { + SvListEntry* pCur = (*pChilds)[ i ]; SvViewData* pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pCur); delete pViewData; aDataTable.Remove( (sal_uLong)pCur ); if( pCur->HasChilds()) RemoveViewData( pCur ); - pCur = (SvListEntry*)pChilds->Next(); } } } @@ -1804,7 +1857,7 @@ void SvListView::ActionRemoving( SvListEntry* pEntry ) SvListEntry* pCurEntry = pEntry->pParent; if ( pCurEntry && pCurEntry != pModel->pRootItem && - pCurEntry->pChilds->Count() == 1 ) + pCurEntry->pChilds->size() == 1 ) { pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pCurEntry); pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); @@ -1899,19 +1952,19 @@ void SvTreeList::Resort() void SvTreeList::ResortChilds( SvListEntry* pParent ) { DBG_ASSERT(pParent,"Parent not set"); - List* pChildList = pParent->pChilds; + SvTreeEntryList* pChildList = pParent->pChilds; if( !pChildList ) return; - List aList( *pChildList ); - pChildList->Clear(); + SvTreeEntryList aList( *pChildList ); + pChildList->DestroyAll(); - sal_uLong nCount = aList.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aList.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvListEntry* pCurEntry = (SvListEntry*)aList.GetObject( nCur ); - sal_uLong nListPos = LIST_APPEND; + SvListEntry* pCurEntry = aList[ nCur ]; + sal_uLong nListPos = ULONG_MAX; GetInsertionPos( pCurEntry, pParent, nListPos ); - pChildList->Insert( pCurEntry, nListPos ); + pChildList->insert( nListPos, pCurEntry ); if( pCurEntry->pChilds ) ResortChilds( pCurEntry ); } @@ -1926,20 +1979,20 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, if( eSortMode == SortNone ) return; - rPos = LIST_APPEND; + rPos = ULONG_MAX; SvTreeEntryList* pChildList = GetChildList( pParent ); - if( pChildList && pChildList->Count() ) + if( pChildList && pChildList->size() ) { long i = 0; - long j = pChildList->Count()-1; + long j = pChildList->size()-1; long k; StringCompare eCompare = COMPARE_GREATER; do { k = (i+j)/2; - SvListEntry* pTempEntry = (SvListEntry*)(pChildList->GetObject(k)); + SvListEntry* pTempEntry = (*pChildList)[ k ]; eCompare = Compare( pEntry, pTempEntry ); if( eSortMode == SortDescending && eCompare != COMPARE_EQUAL ) { @@ -1956,8 +2009,8 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, if( eCompare != COMPARE_EQUAL ) { - if(i > ((long)pChildList->Count() - 1)) // nicht gefunden, Ende der Liste - rPos = LIST_APPEND; + if(i > ((long)pChildList->size() - 1)) // nicht gefunden, Ende der Liste + rPos = ULONG_MAX; else rPos = i; // nicht gefunden, Mitte } diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 889a3a89c3e0..14dae85f4ee8 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -31,8 +31,10 @@ #define _CTRLBOX_CXX #include <tools/debug.hxx> +#include <tools/stream.hxx> #include <vcl/svapp.hxx> #include <vcl/field.hxx> +#include <vcl/helper.hxx> #include <sal/macros.h> #include <comphelper/processfactory.hxx> #include <unotools/charclass.hxx> @@ -48,6 +50,12 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <rtl/bootstrap.hxx> + +#if OSL_DEBUG_LEVEL > 1 +#include <cstdio> +#endif + #define IMGINNERTEXTSPACE 2 #define IMGOUTERTEXTSPACE 5 #define EXTRAFONTSIZE 5 @@ -56,6 +64,8 @@ #define TWIPS_TO_PT100(val) (val * 5) #define PT100_TO_TWIPS(val) (val / 5) +#define FONTNAMEBOXMRUENTRIESFILE "/user/config/fontnameboxmruentries" + using namespace ::com::sun::star; // ======================================================================== @@ -309,25 +319,25 @@ bool BorderWidthImpl::operator== ( const BorderWidthImpl& r ) const long BorderWidthImpl::GetLine1( long nWidth ) const { - long result = m_nRate1; + long result = static_cast<long>(m_nRate1); if ( ( m_nFlags & CHANGE_LINE1 ) > 0 ) - result = m_nRate1 * nWidth; + result = static_cast<long>(m_nRate1 * nWidth); return result; } long BorderWidthImpl::GetLine2( long nWidth ) const { - long result = m_nRate2; + long result = static_cast<long>(m_nRate2); if ( ( m_nFlags & CHANGE_LINE2 ) > 0 ) - result = m_nRate2 * nWidth; + result = static_cast<long>(m_nRate2 * nWidth); return result; } long BorderWidthImpl::GetGap( long nWidth ) const { - long result = m_nRateGap; + long result = static_cast<long>(m_nRateGap); if ( ( m_nFlags & CHANGE_DIST ) > 0 ) - result = m_nRateGap * nWidth; + result = static_cast<long>(m_nRateGap * nWidth); // Avoid having too small distances (less than 1pt) if ( result < 20 && m_nRate1 > 0 && m_nRate2 > 0 ) @@ -384,7 +394,7 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap ) while ( pIt != aToCompare.end() && !bInvalid ) { bInvalid = ( nWidth != *pIt ); - pIt++; + ++pIt; } if ( bInvalid ) nWidth = 0.0; @@ -986,6 +996,7 @@ FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) : mpFontList = NULL; mbWYSIWYG = sal_False; mbSymbols = sal_False; + InitFontMRUEntriesFile(); } // ------------------------------------------------------------------- @@ -997,12 +1008,14 @@ FontNameBox::FontNameBox( Window* pParent, const ResId& rResId ) : mpFontList = NULL; mbWYSIWYG = sal_False; mbSymbols = sal_False; + InitFontMRUEntriesFile(); } // ------------------------------------------------------------------- FontNameBox::~FontNameBox() { + SaveMRUEntries (maFontMRUEntriesFile); ImplDestroyFontList(); } @@ -1018,6 +1031,66 @@ void FontNameBox::DataChanged( const DataChangedEvent& rDCEvt ) // ------------------------------------------------------------------- +void FontNameBox::SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep ) const +{ + ByteString aEntries = ByteString( GetMRUEntries( cSep ), RTL_TEXTENCODING_UTF8 ); + + if( ! aEntries.Len() || ! aFontMRUEntriesFile.Len() ) + return; + + SvFileStream aStream; + aStream.Open( aFontMRUEntriesFile, STREAM_WRITE | STREAM_TRUNC ); + if( ! (aStream.IsOpen() && aStream.IsWritable()) ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "FontNameBox::SaveMRUEntries: opening mru entries file %s failed\n", ByteString(aFontMRUEntriesFile , RTL_TEXTENCODING_UTF8 ).GetBuffer() ); +#endif + return; + } + + aStream.SetLineDelimiter( LINEEND_LF ); + aStream.WriteLine( aEntries ); + aStream.WriteLine( ByteString() ); +} + +// ------------------------------------------------------------------- + +void FontNameBox::LoadMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep ) +{ + if( ! aFontMRUEntriesFile.Len() ) + return; + + SvFileStream aStream( aFontMRUEntriesFile, STREAM_READ ); + if( ! aStream.IsOpen() ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "FontNameBox::LoadMRUEntries: opening mru entries file %s failed\n", ByteString( aFontMRUEntriesFile, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); +#endif + return; + } + + ByteString aLine; + aStream.ReadLine( aLine ); + XubString aEntries = XubString( aLine, RTL_TEXTENCODING_UTF8 ); + SetMRUEntries( aEntries, cSep ); +} + +// ------------------------------------------------------------------ + +void FontNameBox::InitFontMRUEntriesFile() +{ + rtl::OUString sUserConfigDir(RTL_CONSTASCII_USTRINGPARAM("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}")); + rtl::Bootstrap::expandMacros(sUserConfigDir); + + maFontMRUEntriesFile = sUserConfigDir; + if( maFontMRUEntriesFile.Len() ) + { + maFontMRUEntriesFile.AppendAscii( FONTNAMEBOXMRUENTRIESFILE ); + } +} + +// ------------------------------------------------------------------- + void FontNameBox::InitBitmaps( void ) { maImagePrinterFont = Image( SvtResId( RID_IMG_PRINTERFONT ) ); @@ -1045,6 +1118,8 @@ void FontNameBox::Fill( const FontList* pList ) { // store old text and clear box XubString aOldText = GetText(); + XubString rEntries = GetMRUEntries(); + sal_Bool bLoadFromFile = ! rEntries.Len(); Clear(); ImplDestroyFontList(); @@ -1070,6 +1145,11 @@ void FontNameBox::Fill( const FontList* pList ) } } + if ( bLoadFromFile ) + LoadMRUEntries (maFontMRUEntriesFile); + else + SetMRUEntries( rEntries ); + ImplCalcUserItemSize(); // restore text diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index e65614a2c26f..ff17a99c5069 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -171,30 +171,30 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon // und somit die Wahrscheinlichkeit das hinten angehaengt werden muss // sehr gross ist. StringCompare eComp; - sal_uLong nCnt = Count(); + sal_uLong nCnt = maEntries.size(); if ( !nCnt ) { if ( pIndex ) - *pIndex = LIST_APPEND; + *pIndex = ULONG_MAX; return NULL; } else { - ImplFontListNameInfo* pCmpData = (ImplFontListNameInfo*)List::GetObject( nCnt-1 ); + const ImplFontListNameInfo* pCmpData = &maEntries[nCnt-1]; eComp = rSearchName.CompareTo( pCmpData->maSearchName ); if ( eComp == COMPARE_GREATER ) { if ( pIndex ) - *pIndex = LIST_APPEND; + *pIndex = ULONG_MAX; return NULL; } else if ( eComp == COMPARE_EQUAL ) - return pCmpData; + return const_cast<ImplFontListNameInfo*>(pCmpData); } // Fonts in der Liste suchen - ImplFontListNameInfo* pCompareData; - ImplFontListNameInfo* pFoundData = NULL; + const ImplFontListNameInfo* pCompareData; + const ImplFontListNameInfo* pFoundData = NULL; sal_uLong nLow = 0; sal_uLong nHigh = nCnt-1; sal_uLong nMid; @@ -202,7 +202,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon do { nMid = (nLow + nHigh) / 2; - pCompareData = (ImplFontListNameInfo*)List::GetObject( nMid ); + pCompareData = &maEntries[nMid]; eComp = rSearchName.CompareTo( pCompareData->maSearchName ); if ( eComp == COMPARE_LESS ) { @@ -232,7 +232,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon *pIndex = nMid; } - return pFoundData; + return const_cast<ImplFontListNameInfo*>(pFoundData); } // ----------------------------------------------------------------------- @@ -284,7 +284,11 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, pData->mpFirst = pNewInfo; pNewInfo->mpNext = NULL; pData->mnType = 0; - Insert( (void*)pData, nIndex ); + + if (nIndex < maEntries.size()) + maEntries.insert(maEntries.begin()+nIndex,pData); + else + maEntries.push_back(pData); } } else @@ -344,8 +348,7 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, // ======================================================================= -FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, sal_Bool bAll ) : - List( 4096, sal::static_int_cast< sal_uInt16 >(pDevice->GetDevFontCount()), 32 ) +FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, sal_Bool bAll ) { // Variablen initialisieren mpDev = pDevice; @@ -387,20 +390,17 @@ FontList::~FontList() delete[] mpSizeAry; // FontInfos loeschen - ImplFontListNameInfo* pData = (ImplFontListNameInfo*)First(); - while ( pData ) + ImplFontListFontInfo *pTemp, *pInfo; + boost::ptr_vector<ImplFontListNameInfo>::iterator it; + for (it = maEntries.begin(); it != maEntries.end(); ++it) { - ImplFontListFontInfo* pTemp; - ImplFontListFontInfo* pInfo = pData->mpFirst; + pInfo = it->mpFirst; while ( pInfo ) { pTemp = pInfo->mpNext; delete pInfo; pInfo = pTemp; } - ImplFontListNameInfo* pNext = (ImplFontListNameInfo*)Next(); - delete pData; - pData = pNext; } } // ----------------------------------------------------------------------- @@ -757,8 +757,7 @@ const FontInfo& FontList::GetFontName( sal_uInt16 nFont ) const { DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" ); - ImplFontListNameInfo* pData = (ImplFontListNameInfo*)List::GetObject( nFont ); - return *(pData->mpFirst); + return *(maEntries[nFont].mpFirst); } // ----------------------------------------------------------------------- @@ -767,8 +766,7 @@ sal_uInt16 FontList::GetFontNameType( sal_uInt16 nFont ) const { DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontNameType(): nFont >= Count" ); - ImplFontListNameInfo* pData = (ImplFontListNameInfo*)List::GetObject( nFont ); - return pData->mnType; + return maEntries[nFont].mnType; } // ----------------------------------------------------------------------- diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 51e4fed41eb1..b3ae722a4555 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -467,13 +467,10 @@ void Ruler::ImplInvertLines( sal_Bool bErase ) void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) { - long n = 0; long nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3; long nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1; Size aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode ); long nTickWidth; - long nX; - long nY; sal_Bool bNoTicks = sal_False; //Amelia @@ -569,6 +566,9 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) if ( !bNoTicks ) { + long nX; + long nY; + long n = 0; long nTxtWidth2; long nTxtHeight2 = GetTextHeight()/2; long nTick = 0; @@ -1679,12 +1679,11 @@ sal_Bool Ruler::ImplHitTest( const Point& rPos, ImplRulerHitTest* pHitTest, } nHitBottom = mnVirHeight+(RULER_OFF*2); - // --> FME 2004-08-05 #i32608# + // #i32608# pHitTest->nAryPos = 0; pHitTest->mnDragSize = 0; pHitTest->bSize = sal_False; pHitTest->bSizeBar = sal_False; - // <-- // Damit ueberstehende Tabs und Einzuege mit beruecksichtigt werden long nXExtraOff; diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index fcb749cdc0d8..d83c578d4650 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -1081,12 +1081,12 @@ void ToolbarMenu::MouseMove( const MouseEvent& rMEvt ) void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) { - long nY = 0; long nMouseY = rMEvt.GetPosPixel().Y(); Size aOutSz = GetOutputSizePixel(); if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) ) { bool bHighlighted = sal_False; + long nY = 0; const int nEntryCount = mpImpl->maEntryVector.size(); int nEntry; @@ -1570,53 +1570,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle, NULL, NULL ); // pVector, pDisplayText ); } -/* - // Accel - if ( !bLayout && !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) - { - XubString aAccText = pData->aAccelKey.GetName(); - aTmpPos.X() = aOutSz.Width() - this->GetTextWidth( aAccText ); - aTmpPos.X() -= 4*nExtra; - - aTmpPos.X() -= nOuterSpace; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nTextOffsetY; - this->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle ); - } -*/ - -/* - // SubMenu? - if ( !bLayout && !bIsMenuBar && pData->pSubMenu ) - { - aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += ( pEntry->maSize.Height() / 2 ) - ( nFontHeight/4 ); - if ( pEntry->mnBits & MIB_POPUPSELECT ) - { - this->SetTextColor( rSettings.GetMenuTextColor() ); - Point aTmpPos2( aPos ); - aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; - aDecoView.DrawFrame( - Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pEntry->maSize.Height() ) ), FRAME_DRAW_GROUP ); - } - aDecoView.DrawSymbol( - Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), - SYMBOL_SPIN_RIGHT, this->GetTextColor(), nSymbolStyle ); -// if ( pEntry->mnBits & MIB_POPUPSELECT ) -// { -// aTmpPos.Y() += nFontHeight/2 ; -// this->SetLineColor( rSettings.GetShadowColor() ); -// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// this->SetLineColor( rSettings.GetLightColor() ); -// aTmpPos.Y()++; -// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// this->SetLineColor(); -// } - } -*/ - if ( pThisOnly && bHighlighted ) { // This restores the normal menu or menu bar text diff --git a/svtools/source/dialogs/colctrl.cxx b/svtools/source/dialogs/colctrl.cxx deleted file mode 100644 index d98e0bd780b9..000000000000 --- a/svtools/source/dialogs/colctrl.cxx +++ /dev/null @@ -1,676 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#include <vcl/salbtype.hxx> -#include <vcl/bmpacc.hxx> - -#include <svtools/colctrl.hxx> - -// ---------------- -// - ColorControl - -// ---------------- - -SvColorControl::SvColorControl( Window* pParent, WinBits nStyle ) : - Control ( pParent, nStyle ), - mpBitmap ( NULL ), - mpReadAccess ( NULL ), - mnLuminance ( 50 ) -{ - Initialize(); -} - -// ----------------------------------------------------------------------- -SvColorControl::SvColorControl( Window* pParent, const ResId& rResId ) : - Control ( pParent, rResId ), - mpBitmap ( NULL ), - mpReadAccess ( NULL ), - mnLuminance ( 50 ) -{ - Initialize(); -} - - -// ----------------------------------------------------------------------- -SvColorControl::~SvColorControl() -{ - delete mpBitmap; -} - -// ----------------------------------------------------------------------- -void SvColorControl::Initialize() -{ - SetLineColor( Color( COL_BLACK ) ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::CreateBitmap() -{ - const Size aSize( GetOutputSizePixel() ); - - if( mpBitmap && mpBitmap->GetSizePixel() != aSize ) - delete mpBitmap, mpBitmap = NULL; - - if( !mpBitmap ) - mpBitmap = new Bitmap( aSize, 24 ); - - BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess(); - - if( pWriteAccess ) - { - sal_uInt16 nX = (sal_uInt16) aSize.Width(); - sal_uInt16 nY = (sal_uInt16) aSize.Height(); - - sal_uInt16 nHue, nSat; - ColorHSB aColHSB( 0, 0, mnLuminance ); - - for( sal_uInt16 i = 0; i < nY; i++ ) - { - nSat = (sal_uInt16) FRound( 100 - ( 100.0 * i + 0.5 ) / nY ); - - for( sal_uInt16 j = 0; j < nX; j++ ) - { - nHue = (sal_uInt16) FRound( ( 360.0 * j + 0.5 ) / nX ); - - aColHSB.SetHue( nHue ); - aColHSB.SetSat( nSat ); - - // mpBitmap always has a bit count of 24 => use of SetPixel(...) is safe - pWriteAccess->SetPixel( i, j, BitmapColor( aColHSB.GetRGB() ) ); - } - } - - mpBitmap->ReleaseAccess( pWriteAccess ); - } - - SetColor( maColor ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::ShowPosition( const Point& rPos ) -{ - // Explizites Abfragen des Bereichs, da schon mal ein Wert < 0 vorhanden ist - if( mpBitmap ) - { - long nX = rPos.X(); - long nY = rPos.Y(); - if( nX < 0L ) - nX = 0L; - else if( nX >= mpBitmap->GetSizePixel().Width() ) - nX = mpBitmap->GetSizePixel().Width() - 1L; - - if( nY < 0L ) - nY= 0L; - else if( nY >= mpBitmap->GetSizePixel().Height() ) - nY = mpBitmap->GetSizePixel().Height() - 1L; - - Point aPos = maPosition; - maPosition.X() = nX - 2; - maPosition.Y() = nY - 2; - Invalidate( Rectangle( aPos, Size( 5, 5) ) ); - Invalidate( Rectangle( maPosition, Size( 5, 5) ) ); - - if( ( mpReadAccess = mpBitmap->AcquireReadAccess() ) != NULL ) - { - // mpBitmap always has a bit count of 24 => use of GetPixel(...) is safe - maColor = mpReadAccess->GetPixel( nY, nX ); - mpBitmap->ReleaseAccess( mpReadAccess ); - mpReadAccess = NULL; - } - } -} -// ----------------------------------------------------------------------- -void SvColorControl::MouseMove( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) - { - ShowPosition( rMEvt.GetPosPixel() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() && !rMEvt.IsShift() ) - { - //ShowPointer( sal_False ); - CaptureMouse(); - ShowPosition( rMEvt.GetPosPixel() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::MouseButtonUp( const MouseEvent& ) -{ - //ShowPointer( sal_True ); - if( IsMouseCaptured() ) - ReleaseMouse(); -} - -// ----------------------------------------------------------------------- -void SvColorControl::Paint( const Rectangle& rRect ) -{ - if( !mpBitmap ) - CreateBitmap(); - - Bitmap aOutputBitmap( *mpBitmap ); - - if( GetBitCount() <= 8 ) - aOutputBitmap.Dither(); - - DrawBitmap( rRect.TopLeft(), rRect.GetSize(), rRect.TopLeft(), rRect.GetSize(), aOutputBitmap ); - - // Positions-Control (Fadenkreuz oder Aehnliches) - Point aPos1( maPosition ); - Point aPos2( maPosition ); - aPos2.X() += 4; - DrawLine( aPos1, aPos2 ); - aPos2.X() -= 4; - aPos2.Y() += 4; - DrawLine( aPos1, aPos2 ); - aPos1.Y() += 4; - aPos2.X() += 4; - DrawLine( aPos1, aPos2 ); - aPos1.X() += 4; - aPos2.Y() -= 4; - DrawLine( aPos1, aPos2 ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::Resize() -{ - CreateBitmap(); - Control::Resize(); -} - -// ----------------------------------------------------------------------- -void SvColorControl::Modify() -{ - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::SetColor( const ColorHSB& rCol, sal_Bool bSetColor ) -{ - if( bSetColor ) - maColor = rCol.GetRGB(); - - if( mpBitmap ) - { - sal_uInt16 nX = (sal_uInt16) mpBitmap->GetSizePixel().Width(); - sal_uInt16 nY = (sal_uInt16) mpBitmap->GetSizePixel().Height(); - sal_Int16 nZ = rCol.GetBri(); - - SetLuminance( nZ ); - nX = rCol.GetHue() * nX / 360; // Farbe - nY = nY - rCol.GetSat() * nY / 100; // Saettigung - ShowPosition( Point( nX, nY ) ); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::SetColor( const Color& rCol ) -{ - maColor = rCol; - - if( mpBitmap ) - { - ColorHSB aColHsb( rCol ); - SetColor( aColHsb, sal_False ); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::SetLuminance( short nLum ) -{ - if( nLum != mnLuminance && nLum >= 0 && nLum <= 100 ) - { - mnLuminance = nLum; - - if( mnLuminance < 40 ) - SetLineColor( Color( COL_WHITE ) ); - else - SetLineColor( Color( COL_BLACK ) ); - - CreateBitmap(); - - long nX = maPosition.X() + 2; - long nY = maPosition.Y() + 2; - - if( mpBitmap && ( ( mpReadAccess = mpBitmap->AcquireReadAccess() ) != NULL ) ) - { - // mpBitmap always has a bit count of 24 => use of GetPixel(...) is safe - maColor = mpReadAccess->GetPixel( nY, nX ); - mpBitmap->ReleaseAccess( mpReadAccess ); - mpReadAccess = NULL; - } - - Invalidate(); - } -} - - -// ----------------------- -// - ColorPreviewControl - -// ----------------------- - - -// ----------------------------------------------------------------------- -ColorPreviewControl::ColorPreviewControl( Window* pParent, WinBits nStyle ) : - Control ( pParent, nStyle ) -{ - SetFillColor( maColor ); - SetLineColor( maColor ); -} - -// ----------------------------------------------------------------------- -ColorPreviewControl::ColorPreviewControl( Window* pParent, const ResId& rResId ) : - Control ( pParent, rResId ) -{ - SetFillColor( maColor ); - SetLineColor( maColor ); -} - - -// ----------------------------------------------------------------------- -ColorPreviewControl::~ColorPreviewControl() -{ -} - -// ----------------------------------------------------------------------- -void ColorPreviewControl::Paint( const Rectangle& rRect ) -{ - DrawRect( rRect ); -} - -// ----------------------------------------------------------------------- -void ColorPreviewControl::SetColor( const Color& rCol ) -{ - if( rCol != maColor ) - { - maColor = rCol; - SetFillColor( maColor ); - SetLineColor( maColor ); - Invalidate(); - } -} - - -// ----------------------- -// - ColorMixingControl - -// ----------------------- - - -// ----------------------------------------------------------------------- -ColorMixingControl::ColorMixingControl( Window* pParent, WinBits nStyle, - sal_uInt16 nRows, sal_uInt16 nColumns ) : - ValueSet ( pParent, nStyle ), - mnRows ( nRows ), - mnColumns ( nColumns ) -{ - Initialize(); -} - -// ----------------------------------------------------------------------- -ColorMixingControl::ColorMixingControl( Window* pParent, const ResId& rResId, - sal_uInt16 nRows, sal_uInt16 nColumns ) : - ValueSet ( pParent, rResId ), - mnRows ( nRows ), - mnColumns ( nColumns ) -{ - Initialize(); -} - - -// ----------------------------------------------------------------------- -ColorMixingControl::~ColorMixingControl() -{ -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::Initialize() -{ - SetColCount( mnColumns ); - - Color aColor; - String aStr; - for( sal_uInt16 i = 1; i <= mnRows * mnColumns; i++ ) - { - InsertItem( i, aColor, aStr ); - } - - SetColor( CMC_TOPLEFT, Color( COL_LIGHTRED ) ); - SetColor( CMC_BOTTOMRIGHT, Color( COL_LIGHTBLUE ) ); - - SetColor( CMC_TOPRIGHT, Color( COL_LIGHTGREEN ) ); - SetColor( CMC_BOTTOMLEFT, Color( COL_YELLOW ) ); -} - -// ----------------------------------------------------------------------- -Color ColorMixingControl::CalcDifferenceColor( sal_uInt16 nCol1, sal_uInt16 nCol2, - sal_uInt16 nSteps ) -{ - // Die Berechnung ist noch etwas ungenau, daher sollte besser mit floats - // gearbeitet werden... (muss !!!) - Color aColor( GetItemColor( nCol1 ) ); - Color aColor2( GetItemColor( nCol2 ) ); - - aColor.SetRed( (sal_uInt8) ( ( aColor2.GetRed() - aColor.GetRed() ) / nSteps ) ); - aColor.SetGreen( (sal_uInt8) ( ( aColor2.GetGreen() - aColor.GetGreen() ) / nSteps ) ); - aColor.SetBlue( (sal_uInt8) ( ( aColor2.GetBlue() - aColor.GetBlue() ) / nSteps ) ); - - return( aColor ); -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::FillRow( sal_uInt16 nRow ) -{ - sal_uInt16 nCol1 = nRow * mnColumns + 1; - sal_uInt16 nCol2 = ( nRow + 1 ) * mnColumns; - Color aColor( GetItemColor( nCol1 ) ); - Color aDiffColor( CalcDifferenceColor( nCol1, nCol2, mnColumns - 1 ) ); - - for( sal_uInt16 i = nCol1 + 1; i < nCol2; i++ ) - { - aColor.SetRed( aColor.GetRed() + aDiffColor.GetRed() ); - aColor.SetGreen( aColor.GetGreen() + aDiffColor.GetGreen() ); - aColor.SetBlue( aColor.GetBlue() + aDiffColor.GetBlue() ); - - SetItemColor( i, aColor ); - SetItemText( i, GetRGBString( aColor ) ); - } -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::FillColumn( sal_uInt16 nColumn ) -{ - sal_uInt16 nCol1 = nColumn + 1; - sal_uInt16 nCol2 = nColumn + ( mnRows - 1 ) * mnColumns + 1; - Color aColor( GetItemColor( nCol1 ) ); - Color aDiffColor( CalcDifferenceColor( nCol1, nCol2, mnRows - 1 ) ); - - for( sal_uInt16 i = nCol1 + mnColumns; i < nCol2; i = i + mnColumns ) - { - aColor.SetRed( aColor.GetRed() + aDiffColor.GetRed() ); - aColor.SetGreen( aColor.GetGreen() + aDiffColor.GetGreen() ); - aColor.SetBlue( aColor.GetBlue() + aDiffColor.GetBlue() ); - - SetItemColor( i, aColor ); - SetItemText( i, GetRGBString( aColor ) ); - } -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::SetRows( sal_uInt16 nRows ) -{ - mnRows = nRows; -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::SetColumns( sal_uInt16 nColumns ) -{ - mnColumns = nColumns; -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::SetColor( CMCPosition ePos, const Color& rCol ) -{ - if( rCol != maColor[ ePos ] ) - { - maColor[ ePos ] = rCol; - sal_uInt16 nPos = 0; - sal_uInt16 nColumn = 0; - String aStr( GetRGBString( rCol ) ); - - switch( ePos ) - { - case CMC_TOPLEFT: - nPos = 1; - nColumn = 0; - break; - - case CMC_TOPRIGHT: - nPos = mnColumns; - nColumn = mnColumns - 1; - break; - - case CMC_BOTTOMLEFT: - nPos = ( mnRows - 1 ) * mnColumns + 1; - nColumn = 0; - break; - - case CMC_BOTTOMRIGHT: - nPos = mnRows * mnColumns; - nColumn = mnColumns - 1; - break; - case CMC_OTHER: - break; // -Wall not handled. - } - SetItemColor( nPos, rCol ); - SetItemText( nPos, aStr ); - FillColumn( nColumn ); - - for( sal_uInt16 i = 0; i < mnRows; i++ ) - FillRow( i ); - } -} - -// ----------------------------------------------------------------------- -String ColorMixingControl::GetRGBString( const Color& rColor ) -{ - String aStr( String::CreateFromInt32(rColor.GetRed()) ); - aStr += ' '; - aStr += String::CreateFromInt32(rColor.GetGreen()); - aStr += ' '; - aStr += String::CreateFromInt32(rColor.GetBlue()); - - return aStr; -} -// ----------------------------------------------------------------------- -CMCPosition ColorMixingControl::GetCMCPosition() const -{ - CMCPosition ePos = CMC_OTHER; - sal_uInt16 nPos = GetSelectItemId(); - - if( nPos == 1 ) - ePos = CMC_TOPLEFT; - else if( nPos == mnColumns ) - ePos = CMC_TOPRIGHT; - else if( nPos == ( mnRows - 1 ) * mnColumns + 1 ) - ePos = CMC_BOTTOMLEFT; - else if( nPos == mnRows * mnColumns ) - ePos = CMC_BOTTOMRIGHT; - - return( ePos ); -} - - -// ------------ -// - ColorHSB - -// ------------ - -// Erste Ansaetze gingen auf die Berechnung von Sven Hannover zurueck -// Der jetzige Algorithmus stammt im weitesten Sinne aus dem Foley/VanDam - - -/************************************************************************** -|* -|* ColorHSB::ColorHSB() -|* -**************************************************************************/ - -ColorHSB::ColorHSB( const Color& rColor ) -{ - sal_uInt8 c[3]; - sal_uInt8 cMax, cMin; - - c[0] = rColor.GetRed(); - c[1] = rColor.GetGreen(); - c[2] = rColor.GetBlue(); - - cMax = c[0]; - if( c[1] > cMax ) - cMax = c[1]; - if( c[2] > cMax ) - cMax = c[2]; - - // Brightness = max(R, G, B); - mnBri = cMax * 100 / 255; - - cMin = c[0]; - if( c[1] < cMin ) - cMin = c[1]; - if( c[2] < cMin ) - cMin = c[2]; - - sal_uInt8 cDelta = cMax - cMin; - - // Saturation = max - min / max - if( mnBri > 0 ) - mnSat = cDelta * 100 / cMax; - else - mnSat = 0; - - if( mnSat == 0 ) - mnHue = 0; // Default = undefined - else - { - double dHue = 0; - - if( c[0] == cMax ) - { - dHue = (double)( c[1] - c[2] ) / (double)cDelta; - } - else if( c[1] == cMax ) - { - dHue = 2.0 + (double)( c[2] - c[0] ) / (double)cDelta; - } - else if ( c[2] == cMax ) - { - dHue = 4.0 + (double)( c[0] - c[1] ) / (double)cDelta; - } - // else dHue = ??? -Wall FIXME - dHue *= 60.0; - - if( dHue < 0.0 ) - dHue += 360.0; - - mnHue = (sal_uInt16) dHue; - } -} - -/************************************************************************** -|* -|* ColorHSB::GetRGB() -|* -**************************************************************************/ - -Color ColorHSB::GetRGB() const -{ - sal_uInt8 cR,cG,cB; - sal_uInt8 nB = (sal_uInt8) ( mnBri * 255 / 100 ); - - if( mnSat == 0 ) - { - cR = nB; - cG = nB; - cB = nB; - } - else - { - double dH = mnHue; - double f; - sal_uInt16 n; - if( dH == 360.0 ) - dH = 0.0; - - dH /= 60.0; - n = (sal_uInt16) dH; - f = dH - n; - - // #107375# Doing the calculation completely in floating - // point, the former optimization gave sometimes negative - // results for c and was pointless anyway - sal_uInt8 a = static_cast<sal_uInt8>( nB * ( 100.0 - mnSat ) / 100.0 ); - sal_uInt8 b = static_cast<sal_uInt8>( nB * ( 100.0 - mnSat * f ) / 100.0 ); - sal_uInt8 c = static_cast<sal_uInt8>( nB * ( 100.0 - mnSat * ( 1.0 - f ) ) / 100.0 ); - - switch( n ) - { - case 0: cR = nB; cG = c; cB = a; break; - case 1: cR = b; cG = nB; cB = a; break; - case 2: cR = a; cG = nB; cB = c; break; - case 3: cR = a; cG = b; cB = nB; break; - case 4: cR = c; cG = a; cB = nB; break; - case 5: cR = nB; cG = a; cB = b; break; - default: cR = 0; cG = 0; cB = 0; break; // -Wall ???? - } - } - - return( Color( cR, cG, cB ) ); -} - -// ------------ -// - ColorCMYK - -// ------------ - - -// ----------------------------------------------------------------------- -ColorCMYK::ColorCMYK( const Color& rColor ) -{ - mnCyan = 255 - rColor.GetRed(); - mnMagenta = 255 - rColor.GetGreen(); - mnYellow = 255 - rColor.GetBlue(); - - mnKey = Min( Min( mnCyan, mnMagenta ), mnYellow ); - - mnCyan = mnCyan - mnKey; - mnMagenta = mnMagenta - mnKey; - mnYellow = mnYellow - mnKey; -} - -// ----------------------------------------------------------------------- -Color ColorCMYK::GetRGB() const -{ - int nTmp = Max( 0, 255 - ( mnCyan + mnKey ) ); - sal_uInt8 cR = (sal_uInt8) nTmp; - nTmp = Max( 0, 255 - ( mnMagenta + mnKey ) ); - sal_uInt8 cG = (sal_uInt8) nTmp; - nTmp = Max( 0, 255 - ( mnYellow + mnKey ) ); - sal_uInt8 cB = (sal_uInt8) nTmp; - - return( Color( cR, cG, cB ) ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index 5e94c0529760..d5f3b4ea9c65 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -29,300 +29,105 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <svtools/svtdata.hxx> -#include "colrdlg.hrc" -#include <svtools/colrdlg.hxx> - -// --------------- -// - ColorDialog - -// --------------- +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -SvColorDialog::SvColorDialog( Window* pWindow ) : - ModalDialog ( pWindow, SvtResId( DLG_COLOR ) ), - maColMixCtrl ( this, SvtResId( VAL_SET_COLOR ), 8, 8 ), - maBtn1 ( this, SvtResId( BTN_1 ) ), - maBtn2 ( this, SvtResId( BTN_2 ) ), - //maBtn3 ( this, SvtResId( BTN_3 ) ), - //maBtn4 ( this, SvtResId( BTN_4 ) ), - //maFtRGB ( this, SvtResId( FT_RGB ) ), - maCtlColor ( this, SvtResId( CTL_COLOR ) ), +#include <comphelper/processfactory.hxx> - maFtCyan ( this, SvtResId( FT_CYAN ) ), - maNumCyan ( this, SvtResId( NUM_CYAN ) ), - maFtMagenta ( this, SvtResId( FT_MAGENTA ) ), - maNumMagenta ( this, SvtResId( NUM_MAGENTA ) ), - maFtYellow ( this, SvtResId( FT_YELLOW ) ), - maNumYellow ( this, SvtResId( NUM_YELLOW ) ), - maFtKey ( this, SvtResId( FT_KEY ) ), - maNumKey ( this, SvtResId( NUM_KEY ) ), +#include <toolkit/helper/vclunohelper.hxx> - maFtRed ( this, SvtResId( FT_RED ) ), - maNumRed ( this, SvtResId( NUM_RED ) ), - maFtGreen ( this, SvtResId( FT_GREEN ) ), - maNumGreen ( this, SvtResId( NUM_GREEN ) ), - maFtBlue ( this, SvtResId( FT_BLUE ) ), - maNumBlue ( this, SvtResId( NUM_BLUE ) ), +#include <svtools/colrdlg.hxx> - maFtHue ( this, SvtResId( FT_HUE ) ), - maNumHue ( this, SvtResId( NUM_HUE ) ), - maFtSaturation ( this, SvtResId( FT_SATURATION ) ), - maNumSaturation ( this, SvtResId( NUM_SATURATION ) ), - maFtLuminance ( this, SvtResId( FT_LUMINANCE ) ), - maNumLuminance ( this, SvtResId( NUM_LUMINANCE ) ), +using rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::ui::dialogs; - maCtlPreview ( this, SvtResId( CTL_PREVIEW ) ), - maCtlPreviewOld ( this, SvtResId( CTL_PREVIEW_OLD ) ), +// --------------- +// - ColorDialog - +// --------------- - maBtnOK ( this, SvtResId( BTN_OK ) ), - maBtnCancel ( this, SvtResId( BTN_CANCEL ) ), - maBtnHelp ( this, SvtResId( BTN_HELP ) ) +SvColorDialog::SvColorDialog( Window* pWindow ) +: mpParent( pWindow ) +, meMode( svtools::ColorPickerMode_SELECT ) { - FreeResource(); - - maColMixCtrl.SetDoubleClickHdl( LINK( this, SvColorDialog, ClickMixCtrlHdl ) ); - maColMixCtrl.SetSelectHdl( LINK( this, SvColorDialog, SelectMixCtrlHdl ) ); - - Link aLink( LINK( this, SvColorDialog, ColorModifyHdl ) ); - maCtlColor.SetModifyHdl( aLink ); - - maNumRed.SetModifyHdl( aLink ); - maNumGreen.SetModifyHdl( aLink ); - maNumBlue.SetModifyHdl( aLink ); - - maNumCyan.SetModifyHdl( aLink ); - maNumMagenta.SetModifyHdl( aLink ); - maNumYellow.SetModifyHdl( aLink ); - maNumKey.SetModifyHdl( aLink ); - - maNumHue.SetModifyHdl( aLink ); - maNumSaturation.SetModifyHdl( aLink ); - maNumLuminance.SetModifyHdl( aLink ); - - aLink = ( LINK( this, SvColorDialog, ClickBtnHdl ) ); - maBtn1.SetClickHdl( aLink ); - maBtn2.SetClickHdl( aLink ); - //maBtn3.SetClickHdl( aLink ); - //maBtn4.SetClickHdl( aLink ); - - maColMixCtrl.SetExtraSpacing( 0 ); } - // ----------------------------------------------------------------------- -SvColorDialog::~SvColorDialog() -{ -} -// ----------------------------------------------------------------------- -void SvColorDialog::Initialize() -{ - maNumRed.SetValue( maColor.GetRed() ); - maNumGreen.SetValue( maColor.GetGreen() ); - maNumBlue.SetValue( maColor.GetBlue() ); - - ColorCMYK aColorCMYK( maColor ); - - long aCyan = (long) ( (double)aColorCMYK.GetCyan() * 100.0 / 255.0 + 0.5 ); - long aMagenta = (long) ( (double)aColorCMYK.GetMagenta() * 100.0 / 255.0 + 0.5 ); - long aYellow = (long) ( (double)aColorCMYK.GetYellow() * 100.0 / 255.0 + 0.5 ); - long aKey = (long) ( (double)aColorCMYK.GetKey() * 100.0 / 255.0 + 0.5 ); - maNumCyan.SetValue( aCyan ); - maNumMagenta.SetValue( aMagenta ); - maNumYellow.SetValue( aYellow ); - maNumKey.SetValue( aKey ); - - ColorHSB aColorHSB( maColor ); - maNumHue.SetValue( aColorHSB.GetHue() ); - maNumSaturation.SetValue( aColorHSB.GetSat() ); - maNumLuminance.SetValue( aColorHSB.GetBri() ); - - maCtlColor.SetColor( aColorHSB ); - - maColMixCtrl.SelectItem( 1 ); - - maCtlPreview.SetColor( maColor ); - maCtlPreviewOld.SetColor( maColor ); -} - -// ----------------------------------------------------------------------- void SvColorDialog::SetColor( const Color& rColor ) { maColor = rColor; } // ----------------------------------------------------------------------- + const Color& SvColorDialog::GetColor() const { - return( maColor ); + return maColor; } // ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, ColorModifyHdl, void *, p ) -{ - sal_uInt16 n = 0x00; // 1 == RGB, 2 == CMYK, 4 == HSB - - if( p == &maCtlColor ) - { - maColor = maCtlColor.GetColor(); - maNumRed.SetValue( maColor.GetRed() ); - maNumGreen.SetValue( maColor.GetGreen() ); - maNumBlue.SetValue( maColor.GetBlue() ); - n = 7; - } - else if( p == &maNumRed ) - { - maColor.SetRed( (sal_uInt8)maNumRed.GetValue() ); - maCtlColor.SetColor( maColor ); - n = 6; - } - else if( p == &maNumGreen ) - { - maColor.SetGreen( (sal_uInt8)maNumGreen.GetValue() ); - maCtlColor.SetColor( maColor ); - n = 6; - } - else if( p == &maNumBlue ) - { - maColor.SetBlue( (sal_uInt8)maNumBlue.GetValue() ); - maCtlColor.SetColor( maColor ); - n = 6; - } - else if( p == &maNumHue || - p == &maNumSaturation || - p == &maNumLuminance ) - { - - ColorHSB aColorHSB( (sal_uInt16) maNumHue.GetValue(), - (sal_uInt16) maNumSaturation.GetValue(), - (sal_uInt16) maNumLuminance.GetValue() ); - maCtlColor.SetColor( aColorHSB ); - maColor = maCtlColor.GetColor(); - n = 3; - } - else if( p == &maNumCyan || - p == &maNumMagenta || - p == &maNumYellow || - p == &maNumKey ) - { - long aCyan = (long) ( (double)maNumCyan.GetValue() * 255.0 / 100.0 + 0.5 ); - long aMagenta = (long) ( (double)maNumMagenta.GetValue() * 255.0 / 100.0 + 0.5 ); - long aYellow = (long) ( (double)maNumYellow.GetValue() * 255.0 / 100.0 + 0.5 ); - long aKey = (long) ( (double)maNumKey.GetValue() * 255.0 / 100.0 + 0.5 ); - - ColorCMYK aColorCMYK( (sal_uInt16) aCyan, - (sal_uInt16) aMagenta, - (sal_uInt16) aYellow, - (sal_uInt16) aKey ); - maColor = aColorCMYK.GetRGB(); - maCtlColor.SetColor( maColor ); - n = 5; - } - - if( n & 1 ) // RGB setzen - { - maNumRed.SetValue( maColor.GetRed() ); - maNumGreen.SetValue( maColor.GetGreen() ); - maNumBlue.SetValue( maColor.GetBlue() ); - } - if( n & 2 ) // CMYK setzen - { - ColorCMYK aColorCMYK( maColor ); - long aCyan = (long) ( (double)aColorCMYK.GetCyan() * 100.0 / 255.0 + 0.5 ); - long aMagenta = (long) ( (double)aColorCMYK.GetMagenta() * 100.0 / 255.0 + 0.5 ); - long aYellow = (long) ( (double)aColorCMYK.GetYellow() * 100.0 / 255.0 + 0.5 ); - long aKey = (long) ( (double)aColorCMYK.GetKey() * 100.0 / 255.0 + 0.5 ); - maNumCyan.SetValue( aCyan ); - maNumMagenta.SetValue( aMagenta ); - maNumYellow.SetValue( aYellow ); - maNumKey.SetValue( aKey ); - } - if( n & 4 ) // HSB setzen - { - ColorHSB aColorHSB( maColor ); - maNumHue.SetValue( aColorHSB.GetHue() ); - maNumSaturation.SetValue( aColorHSB.GetSat() ); - maNumLuminance.SetValue( aColorHSB.GetBri() ); - } - - maCtlPreview.SetColor( maColor ); - - return 0; +void SvColorDialog::SetMode( sal_Int16 eMode ) +{ + meMode = eMode; } // ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, ClickBtnHdl, void *, p ) -{ - /* - Color aColor = maCtlColor.GetColor(); - if( p == &maBtn1 ) - maColMixCtrl.SetColor( CMC_TOPLEFT, aColor ); - if( p == &maBtn2 ) - maColMixCtrl.SetColor( CMC_TOPRIGHT, aColor ); - if( p == &maBtn3 ) - maColMixCtrl.SetColor( CMC_BOTTOMLEFT, aColor ); - if( p == &maBtn4 ) - maColMixCtrl.SetColor( CMC_BOTTOMRIGHT, aColor ); - */ - if( p == &maBtn1 ) - { - CMCPosition ePos = maColMixCtrl.GetCMCPosition(); - if( ePos != CMC_OTHER ) - maColMixCtrl.SetColor( ePos, maColor ); - } - else if( p == &maBtn2 ) +short SvColorDialog::Execute() +{ + short ret = 0; + try { - sal_uInt16 nPos = maColMixCtrl.GetSelectItemId(); - maColor = maColMixCtrl.GetItemColor( nPos ); - maCtlColor.SetColor( maColor ); - ColorModifyHdl( &maCtlColor ); + const OUString sColor( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ); + Reference< XMultiServiceFactory > xSMGR( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + + Reference< com::sun::star::awt::XWindow > xParent( VCLUnoHelper::GetInterface( mpParent ) ); + + Sequence< Any > args(1); + args[0] = Any( xParent ); + + Reference< XExecutableDialog > xDialog( xSMGR->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.cui.ColorPicker"), args), UNO_QUERY_THROW ); + Reference< XPropertyAccess > xPropertyAccess( xDialog, UNO_QUERY_THROW ); + + Sequence< PropertyValue > props( 2 ); + props[0].Name = sColor; + props[0].Value <<= (sal_Int32) maColor.GetColor(); + props[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Mode" ) ); + props[1].Value <<= (sal_Int16) meMode; + + xPropertyAccess->setPropertyValues( props ); + + ret = xDialog->execute(); + + if( ret ) + { + props = xPropertyAccess->getPropertyValues(); + for( sal_Int32 n = 0; n < props.getLength(); n++ ) + { + if( props[n].Name.equals( sColor ) ) + { + sal_Int32 nColor = 0; + if( props[n].Value >>= nColor ) + { + maColor.SetColor( nColor ); + } + + } + } + } } - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, ClickMixCtrlHdl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = maColMixCtrl.GetSelectItemId(); - CMCPosition ePos = maColMixCtrl.GetCMCPosition(); - - if( ePos != CMC_OTHER ) - maColMixCtrl.SetColor( ePos, maColor ); - else + catch(Exception&) { - maColor = maColMixCtrl.GetItemColor( nPos ); - maCtlColor.SetColor( maColor ); - ColorModifyHdl( &maCtlColor ); + OSL_ASSERT(false); } - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, SelectMixCtrlHdl, void *, EMPTYARG ) -{ - //sal_uInt16 nPos = maColMixCtrl.GetSelectItemId(); - //maFtRGB.SetText( maColMixCtrl.GetItemText( nPos ) ); - - CMCPosition ePos = maColMixCtrl.GetCMCPosition(); - if( ePos == CMC_OTHER ) - maBtn1.Enable( sal_False ); - else - maBtn1.Enable(); - - return 0; -} - -// ----------------------------------------------------------------------- -short SvColorDialog::Execute() -{ - Initialize(); - - short nRet = ModalDialog::Execute(); - - return( nRet ); + return ret; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/colrdlg.hrc b/svtools/source/dialogs/colrdlg.hrc deleted file mode 100644 index b1e785bd2f17..000000000000 --- a/svtools/source/dialogs/colrdlg.hrc +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define DLG_COLOR 996 - -#define VAL_SET_COLOR 2 -#define BTN_1 1 -#define BTN_2 2 -#define BTN_3 3 -#define BTN_4 4 -#define FT_RGB 12 - -#define CTL_COLOR 1 - -#define FT_RED 1 -#define NUM_RED 1 -#define FT_GREEN 2 -#define NUM_GREEN 2 -#define FT_BLUE 3 -#define NUM_BLUE 3 - -#define FT_CYAN 7 -#define NUM_CYAN 7 -#define FT_MAGENTA 8 -#define NUM_MAGENTA 8 -#define FT_YELLOW 9 -#define NUM_YELLOW 9 -#define FT_KEY 10 -#define NUM_KEY 10 - -#define FT_HUE 4 -#define NUM_HUE 4 -#define FT_SATURATION 5 -#define NUM_SATURATION 5 -#define FT_LUMINANCE 6 -#define NUM_LUMINANCE 6 - -#define CTL_PREVIEW 3 -#define CTL_PREVIEW_OLD 4 - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 - -//IAccessibility2 Implementation 2009----- -#define STR_COLORDES 3001 diff --git a/svtools/source/dialogs/colrdlg.src b/svtools/source/dialogs/colrdlg.src deleted file mode 100644 index c0b4f33db69a..000000000000 --- a/svtools/source/dialogs/colrdlg.src +++ /dev/null @@ -1,294 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "colrdlg.hrc" -#define DIFF 3 -ModalDialog DLG_COLOR -{ - HelpID = "svtools:ModalDialog:DLG_COLOR"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 165 + DIFF ) ; - Moveable = TRUE ; - Text [ en-US ] = "Color" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 205 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 205 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 205 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Control VAL_SET_COLOR - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 91 , 100 ) ; - TabStop = TRUE ; - }; - Control CTL_COLOR - { - Border = TRUE ; - Pos = MAP_APPFONT ( 100 , 6 ) ; - Size = MAP_APPFONT ( 100 , 100 ) ; - TabStop = TRUE ; - }; - FixedText FT_CYAN - { - Pos = MAP_APPFONT ( 6 , 110 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Cyan" ; - }; - FixedText FT_MAGENTA - { - Pos = MAP_APPFONT ( 6 , 123 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Magenta" ; - }; - FixedText FT_YELLOW - { - Pos = MAP_APPFONT ( 6 , 136 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Yellow" ; - }; - FixedText FT_KEY - { - Pos = MAP_APPFONT ( 6 , 149 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Key" ; - }; - MetricField NUM_CYAN - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_CYAN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 109 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - }; - MetricField NUM_MAGENTA - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_MAGENTA"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 122 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - }; - MetricField NUM_YELLOW - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_YELLOW"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 135 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - }; - MetricField NUM_KEY - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_KEY"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 148 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - }; - FixedText FT_RED - { - Pos = MAP_APPFONT ( 72 , 123 + DIFF ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Red" ; - }; - FixedText FT_GREEN - { - Pos = MAP_APPFONT ( 72 , 136 + DIFF ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Green" ; - }; - FixedText FT_BLUE - { - Pos = MAP_APPFONT ( 72 , 149 + DIFF ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Blue" ; - }; - NumericField NUM_RED - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_RED"; - Border = TRUE ; - Pos = MAP_APPFONT ( 106 , 122 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - NumericField NUM_GREEN - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_GREEN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 106 , 135 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - NumericField NUM_BLUE - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_BLUE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 106 , 148 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - FixedText FT_HUE - { - Pos = MAP_APPFONT ( 135 , 123 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "H~ue" ; - }; - NumericField NUM_HUE - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_HUE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 171 , 122 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 359 ; - Last = 359 ; - }; - FixedText FT_SATURATION - { - Pos = MAP_APPFONT ( 135 , 136 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Saturation" ; - }; - NumericField NUM_SATURATION - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_SATURATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 171 , 135 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - }; - FixedText FT_LUMINANCE - { - Pos = MAP_APPFONT ( 135 , 149 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "Bright~ness" ; - }; - NumericField NUM_LUMINANCE - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_LUMINANCE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 171 , 148 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - }; - PushButton BTN_1 - { - HelpID = "svtools:PushButton:DLG_COLOR:BTN_1"; - Pos = MAP_APPFONT ( 80 , 109 ) ; - Size = MAP_APPFONT ( 17 , 12 ) ; - Text = "~<--" ; - TabStop = TRUE ; - }; - PushButton BTN_2 - { - HelpID = "svtools:PushButton:DLG_COLOR:BTN_2"; - Pos = MAP_APPFONT ( 100 , 109 ) ; - Size = MAP_APPFONT ( 17 , 12 ) ; - Text = "--~>" ; - TabStop = TRUE ; - }; - Control CTL_PREVIEW_OLD - { - Border = TRUE ; - Pos = MAP_APPFONT ( 200 , 109 ) ; - Size = MAP_APPFONT ( 26 , 51 + DIFF ) ; - TabStop = FALSE ; - }; - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 229 , 109 ) ; - Size = MAP_APPFONT ( 26 , 51 + DIFF ) ; - TabStop = FALSE ; - }; -}; - -String STR_COLORDES -{ - Text [ en-US ] = "RGB(%1, %2, %3) Hue:%4 Saturation:%5 Brightness:%6"; -};
\ No newline at end of file diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index a6ccff12a506..e7bf845a03ea 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -144,7 +144,7 @@ ImpPathDialog::~ImpPathDialog() delete pOkBtn; delete pCancelBtn; delete pNewDirBtn; -# if defined(UNX) || defined(OS2) +# if defined(UNX) delete pHomeBtn; # endif } @@ -207,7 +207,7 @@ void ImpPathDialog::InitControls() nTextWidth = pDlg->GetTextWidth( aNewDirStr )+nExtraWidth; if( nTextWidth > aBtnSiz.Width() ) aBtnSiz.Width() = nTextWidth; -#if defined(UNX) || defined(OS2) +#if defined(UNX) String aHomeDirStr( SvtResId( STR_FILEDLG_HOME ) ); nTextWidth = pDlg->GetTextWidth( aHomeDirStr )+nExtraWidth; if( nTextWidth > aBtnSiz.Width() ) @@ -224,7 +224,7 @@ void ImpPathDialog::InitControls() aPnt.Y() += aBtnSiz.Height() + a3Siz.Height(); INITCONTROL( pNewDirBtn, PushButton, WB_DEFBUTTON, aPnt, aBtnSiz, aNewDirStr, HID_FILEDLG_NEWDIR ); -#if defined(UNX) || defined(OS2) +#if defined(UNX) aPnt.Y() += aBtnSiz.Height() + a3Siz.Height(); INITCONTROL( pHomeBtn, PushButton, WB_DEFBUTTON, aPnt, aBtnSiz, aHomeDirStr, HID_FILEDLG_HOME ); diff --git a/svtools/source/dialogs/formats.src b/svtools/source/dialogs/formats.src index 0477cd1bc4ca..3ab9488fbbc5 100644 --- a/svtools/source/dialogs/formats.src +++ b/svtools/source/dialogs/formats.src @@ -189,7 +189,7 @@ String STR_FORMAT_ID_BIFF_5 }; String STR_FORMAT_ID_BIFF_8 { - Text [ en-US ] = "Biff8 (Microsoft Excel 97/2000/XP)"; + Text [ en-US ] = "Biff8 (Microsoft Excel 97/2000/XP/2003)"; }; String STR_FORMAT_ID_SYLK { diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index ee950a4e7cc2..b102f3845f4b 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -70,7 +70,6 @@ struct OleObjectDescriptor /********************** SvObjectServerList ******************************** **************************************************************************/ -PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) /************************************************************************* |* SvObjectServerList::SvObjectServerList() @@ -79,10 +78,10 @@ PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) *************************************************************************/ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) const { - for( sal_uLong i = 0; i < Count(); i++ ) + for( size_t i = 0; i < aObjectServerList.size(); i++ ) { - if( rHumanName == GetObject( i ).GetHumanName() ) - return &GetObject( i ); + if( rHumanName == aObjectServerList[ i ].GetHumanName() ) + return &aObjectServerList[ i ]; } return NULL; } @@ -94,26 +93,27 @@ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) cons *************************************************************************/ const SvObjectServer * SvObjectServerList::Get( const SvGlobalName & rName ) const { - for( sal_uLong i = 0; i < Count(); i++ ) + for( size_t i = 0; i < aObjectServerList.size(); i++ ) { - if( rName == GetObject( i ).GetClassName() ) - return &GetObject( i ); + if( rName == aObjectServerList[ i ].GetClassName() ) + return &aObjectServerList[ i ]; } return NULL; } void SvObjectServerList::Remove( const SvGlobalName & rName ) { - SvObjectServer * pS = (SvObjectServer *)aTypes.First(); - while( pS ) + for( size_t i = 0; i < aObjectServerList.size(); ) { - if( rName == pS->GetClassName() ) + if( aObjectServerList[ i ].GetClassName() == rName ) { - Remove(); - pS = (SvObjectServer *)aTypes.GetCurObject(); + SvObjectServerList_impl::iterator it = aObjectServerList.begin() + i; + aObjectServerList.erase( it ); } else - pS = (SvObjectServer *)aTypes.Next(); + { + ++i; + } } } @@ -208,7 +208,7 @@ void SvObjectServerList::FillInsertObjects() { if( !Get( aClassName ) ) // noch nicht eingetragen - Append( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); + aObjectServerList.push_back( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); } } } @@ -220,7 +220,7 @@ void SvObjectServerList::FillInsertObjects() #ifdef WNT SvGlobalName aOleFact( SO3_OUT_CLASSID ); String aOleObj( SvtResId( STR_FURTHER_OBJECT ) ); - Append( SvObjectServer( aOleFact, aOleObj ) ); + aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) ); #endif }catch( container::NoSuchElementException) diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 2e45ae38172b..6c720acff89b 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -859,9 +859,6 @@ void TextWindow::Command( const CommandEvent& rCEvt ) if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) { PopupMenu* pPopup = Edit::CreatePopupMenu(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED ) - pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES ); if ( !mpExtTextView->HasSelection() ) { pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False ); diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index b4eeb76d8a06..d070e8364dcc 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -39,9 +39,6 @@ SV_IMPL_PTRARR( TextCharAttribs, TextCharAttribPtr ); // Vergleichmethode wird von QuickSort gerufen... EXTERN_C -#if defined( PM2 ) -int _stdcall -#else #ifdef WNT #if _MSC_VER >= 1200 int __cdecl @@ -51,7 +48,6 @@ int _cdecl #else int #endif -#endif CompareStart( const void* pFirst, const void* pSecond ) { diff --git a/svtools/source/filter/FilterConfigCache.cxx b/svtools/source/filter/FilterConfigCache.cxx index 50bc9a028309..73e89d747a21 100644 --- a/svtools/source/filter/FilterConfigCache.cxx +++ b/svtools/source/filter/FilterConfigCache.cxx @@ -107,10 +107,9 @@ sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUSt if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) ) bIsPixelFormat = sal_True; } - String aTemp( OUString(RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "?" ) )) ); - xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' ); - aTemp.Replace( nIndex, 1, sFilterName ); - sFilterName = aTemp; + rtl::OUString sTemp(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?"))); + sal_Int32 nIndex = sTemp.indexOf(static_cast<sal_Unicode>('?')); + sFilterName = sTemp.replaceAt(nIndex, 1, sFilterName); } return sFilterName.Len() != 0; } @@ -350,7 +349,6 @@ FilterConfigCache::FilterConfigCache( sal_Bool bConfig ) : FilterConfigCache::~FilterConfigCache() { - } String FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat ) diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 64d0365f0493..0a03904cf176 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -521,7 +522,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast<com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*>(NULL) ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast<com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*>(NULL), NULL ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } @@ -1510,3 +1511,5 @@ IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx index 20a9ac3ea832..d15f143701ec 100644 --- a/svtools/source/filter/exportdialog.hxx +++ b/svtools/source/filter/exportdialog.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -214,3 +215,4 @@ public: #endif // _EXPORTDIALOG_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index 2a64a576feb6..830082fa6eb0 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -79,23 +79,11 @@ #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF -#if (defined OS2 && !defined ICC) - -#define IMPORT_FUNCTION_NAME "_GraphicImport" -#define EXPORT_FUNCTION_NAME "_GraphicExport" -#define IMPDLG_FUNCTION_NAME "_DoImportDialog" -#define EXPDLG_FUNCTION_NAME "_DoExportDialog" - -#else - #define IMPORT_FUNCTION_NAME "GraphicImport" #define EXPORT_FUNCTION_NAME "GraphicExport" #define IMPDLG_FUNCTION_NAME "DoImportDialog" #define EXPDLG_FUNCTION_NAME "DoExportDialog" -#endif - - // ----------- // - statics - // ----------- @@ -111,8 +99,6 @@ static ::osl::Mutex& getListMutex() return s_aListProtection; } -static GraphicFilter* pGraphicFilter=0; - // ------------------------- // - ImpFilterOutputStream - // ------------------------- @@ -1051,7 +1037,6 @@ GraphicFilter::~GraphicFilter() } } - delete pErrorEx; } @@ -1319,16 +1304,17 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& } sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, - sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags ) + sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags, WMF_APMFILEHEADER *pAPMHeader ) { - return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL ); + return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL, pAPMHeader ); } //------------------------------------------------------------------------- sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags, - com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData ) + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData, + WMF_APMFILEHEADER *pAPMHeader ) { String aFilterName; sal_uLong nStmBegin; @@ -1505,7 +1491,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, vcl::SVGReader aSVGReader( rIStream ); GDIMetaFile aSVGMtf; - if( 0 == aSVGReader.Read( aSVGMtf ).GetActionCount() ) + if( 0 == aSVGReader.Read( aSVGMtf ).GetActionSize() ) nStatus = GRFILTER_FILTERERROR; else rGraphic = Graphic( aSVGMtf ); @@ -1546,7 +1532,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, aFilterName.EqualsIgnoreCaseAscii( IMP_EMF ) ) { GDIMetaFile aMtf; - if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL ) ) + if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL, pAPMHeader ) ) nStatus = GRFILTER_FORMATERROR; else { @@ -2205,16 +2191,24 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData ) return nRet; } -// ------------------------------------------------------------------------ - -GraphicFilter* GraphicFilter::GetGraphicFilter() +namespace { - if( !pGraphicFilter ) + class StandardGraphicFilter { - pGraphicFilter = new GraphicFilter; - pGraphicFilter->GetImportFormatCount(); - } - return pGraphicFilter; + public: + StandardGraphicFilter() + { + m_aFilter.GetImportFormatCount(); + } + GraphicFilter m_aFilter; + }; + + class theGraphicFilter : public rtl::Static<StandardGraphicFilter, theGraphicFilter> {}; +} + +GraphicFilter& GraphicFilter::GetGraphicFilter() +{ + return theGraphicFilter::get().m_aFilter; } int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, @@ -2222,7 +2216,7 @@ int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, sal_uInt16* pDeterminedFormat ) { if ( !pFilter ) - pFilter = GetGraphicFilter(); + pFilter = &GetGraphicFilter(); const sal_uInt16 nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() ? pFilter->GetImportFormatNumber( rFilterName ) @@ -2255,4 +2249,4 @@ int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, return nRes; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/igif/gifread.cxx b/svtools/source/filter/igif/gifread.cxx index 8de8c6c01148..6765937081d7 100644 --- a/svtools/source/filter/igif/gifread.cxx +++ b/svtools/source/filter/igif/gifread.cxx @@ -451,7 +451,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount ) { if( bInterlaced ) { - long nT1, nT2; + long nT1; // falls Interlaced, werden die Zeilen kopiert if( nLastInterCount ) @@ -489,7 +489,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount ) if( nT1 >= nImageHeight ) { - nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 ); + long nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 ); nT1 = ( nT2 << 3 ) + 4; nLastInterCount = 3; diff --git a/svtools/source/filter/sgvmain.cxx b/svtools/source/filter/sgvmain.cxx index 404e2b5b01a1..ad0c530382f8 100644 --- a/svtools/source/filter/sgvmain.cxx +++ b/svtools/source/filter/sgvmain.cxx @@ -768,7 +768,6 @@ void CircType::Draw(OutputDevice& rOut) void BmapType::Draw(OutputDevice& rOut) { //ifstream aInp; - unsigned char nSgfTyp; sal_uInt16 nVersion; String aStr( reinterpret_cast< char const * >(&Filename[ 1 ]), @@ -778,7 +777,7 @@ void BmapType::Draw(OutputDevice& rOut) SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); if ( pInp ) { - nSgfTyp=CheckSgfTyp( *pInp,nVersion); + unsigned char nSgfTyp=CheckSgfTyp( *pInp,nVersion); switch(nSgfTyp) { case SGF_BITIMAGE: { GraphicFilter aFlt; diff --git a/svtools/source/filter/sgvspln.cxx b/svtools/source/filter/sgvspln.cxx index 0ed81a50d534..864ff3ee5c8b 100644 --- a/svtools/source/filter/sgvspln.cxx +++ b/svtools/source/filter/sgvspln.cxx @@ -34,10 +34,6 @@ #include <tools/poly.hxx> -#if defined( PM2 ) && defined( __BORLANDC__ ) -#pragma option -Od -#endif - extern "C" { /*.pn 277 */ @@ -807,9 +803,6 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n, *************************************************************************/ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly) { - short MinKoord=-32000; // zur Vermeidung - short MaxKoord=32000; // von Ueberlaeufen - double* ax; // Koeffizienten der Polynome double* ay; double* bx; @@ -820,19 +813,20 @@ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly) double* dy; double* tv; - double Step; // Schrittweite fuer t - double dt1,dt2,dt3; // Delta t, y, ^3 - double t; sal_Bool bEnde; // Teilpolynom zu Ende? sal_uInt16 n; // Anzahl der zu zeichnenden Teilpolynome sal_uInt16 i; // aktuelles Teilpolynom sal_Bool bOk; // noch alles ok? - sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten - long x,y; bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv); if (bOk) { - Step =10; + short MinKoord=-32000; // zur Vermeidung + short MaxKoord=32000; // von Ueberlaeufen + double Step =10; + double dt1,dt2,dt3; // Delta t, y, ^3 + double t; + sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten + long x,y; rPoly.SetSize(1); rPoly.SetPoint(Point(short(ax[0]),short(ay[0])),0); // erster Punkt diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index 5eb0b5e5c1f4..ddda27f2efa2 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -617,8 +617,8 @@ sal_uInt16 SetTextContext(OutputDevice& rOut, ObjTextType& Atr, sal_Bool Kapt, s switch (Atr.GetFont()) { case 92500: case 92501: case 92504: case 92505: { -#if defined(WNT) || defined(PM2) - FNam=String::CreateFromAscii( "Times New Roman" ); // CG Times ist unter Windows und OS/2 Times New Roman +#if defined(WNT) + FNam=String::CreateFromAscii( "Times New Roman" ); // CG Times ist unter Windows Times New Roman #else FNam=String::CreateFromAscii( "Times" ); // ansonsten ist das einfach Times #endif @@ -765,7 +765,6 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A sal_uInt16& nChars, sal_uInt16 Rest, short* Line, UCHAR* cLine) { - sal_uInt16 KernDist=0; // Wert fuer Kerning sal_uInt16 ChrWidth; UCHAR c; UCHAR c1; @@ -775,6 +774,7 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A AbsEnd=(c==AbsatzEnd || c==TextEnd); if (AbsEnd==sal_False) { + sal_uInt16 KernDist=0; // Wert fuer Kerning R.OutCh=ConvertTextChar(c); // von HardTrenn nach '-', ... R.Kapt=(R.Attrib.Schnitt & TextKaptBit) !=0 && UpcasePossible(R.OutCh); if (R.Kapt) R.OutCh=Upcase(R.OutCh); diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx index bf5838d3267f..4efaa1bbbb88 100644 --- a/svtools/source/filter/wmf/emfwr.cxx +++ b/svtools/source/filter/wmf/emfwr.cxx @@ -903,7 +903,7 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { - for( sal_uLong j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ ) + for( size_t j = 0, nActionCount = rMtf.GetActionSize(); j < nActionCount; j++ ) { const MetaAction* pAction = rMtf.GetAction( j ); const sal_uInt16 nType = pAction->GetType(); @@ -1157,7 +1157,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) const MetaEPSAction* pA = (const MetaEPSAction*) pAction; const GDIMetaFile aSubstitute( pA->GetSubstitute() ); - for( sal_uLong i = 0, nCount = aSubstitute.GetActionCount(); i < nCount; i++ ) + for( size_t i = 0, nCount = aSubstitute.GetActionSize(); i < nCount; i++ ) { const MetaAction* pSubstAct = aSubstitute.GetAction( i ); if( pSubstAct->GetType() == META_BMPSCALE_ACTION ) diff --git a/svtools/source/filter/wmf/winmtf.cxx b/svtools/source/filter/wmf/winmtf.cxx index 252f217de365..d2a4b0ec50c2 100644 --- a/svtools/source/filter/wmf/winmtf.cxx +++ b/svtools/source/filter/wmf/winmtf.cxx @@ -37,6 +37,7 @@ #include <vcl/graphictools.hxx> #include <vcl/canvastools.hxx> #include <vcl/metric.hxx> +#include <vcl/svapp.hxx> #include <rtl/tencinfo.h> // ------------------------------------------------------------------------ @@ -377,6 +378,19 @@ Point WinMtfOutput::ImplMap( const Point& rPt ) { switch( mnMapMode ) { + case MM_TEXT: + fX2 -= mnWinOrgX; + fY2 -= mnWinOrgY; + if( mnDevWidth != 1 || mnDevHeight != 1 ) { + fX2 *= 2540.0/mnUnitsPerInch; + fY2 *= 2540.0/mnUnitsPerInch; + } + fX2 += mnDevOrgX; + fY2 += mnDevOrgY; + fX2 *= (double)mnMillX * 100.0 / (double)mnPixX; + fY2 *= (double)mnMillY * 100.0 / (double)mnPixY; + + break; case MM_LOENGLISH : { fX2 -= mnWinOrgX; @@ -452,6 +466,15 @@ Size WinMtfOutput::ImplMap( const Size& rSz ) { switch( mnMapMode ) { + case MM_TEXT: + if( mnDevWidth != 1 && mnDevHeight != 1 ) { + fWidth *= 2540.0/mnUnitsPerInch; + fHeight*= 2540.0/mnUnitsPerInch; + } else { + fWidth *= (double)mnMillX * 100 / (double)mnPixX; + fHeight *= (double)mnMillY * 100 / (double)mnPixY; + } + break; case MM_LOENGLISH : { fWidth *= 25.40; @@ -894,6 +917,7 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : mbComplexClip ( false ), mnGfxMode ( GM_COMPATIBLE ), mnMapMode ( MM_TEXT ), + mnUnitsPerInch ( 96 ), mnDevOrgX ( 0 ), mnDevOrgY ( 0 ), mnDevWidth ( 1 ), @@ -1594,6 +1618,8 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry sal_Int32* pDX = pDXArry; if ( !pDXArry ) { + SolarMutexGuard aGuard; + pDX = new sal_Int32[ rText.Len() ]; if ( !pVDev ) pVDev = new VirtualDevice; @@ -2014,6 +2040,14 @@ void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode ) //----------------------------------------------------------------------------------- +void WinMtfOutput::SetUnitsPerInch( sal_uInt16 nUnitsPerInch ) +{ + if( nUnitsPerInch != 0 ) + mnUnitsPerInch = nUnitsPerInch; +} + +//----------------------------------------------------------------------------------- + void WinMtfOutput::SetWorldTransform( const XForm& rXForm ) { maXForm.eM11 = rXForm.eM11; @@ -2226,4 +2260,4 @@ void WinMtfOutput::PassEMFPlus( void* pBuffer, sal_uInt32 nLength ) mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS", 0, static_cast<const sal_uInt8*>(pBuffer), nLength ) ); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index dc05969c7d5a..16e9296a2b8f 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -157,6 +157,7 @@ struct LOGFONTW sal_uInt8 lfPitchAndFamily; String alfFaceName; }; +struct WMF_APMFILEHEADER; #define TA_NOUPDATECP 0x0000 #define TA_UPDATECP 0x0001 @@ -581,6 +582,8 @@ class WinMtfOutput sal_uInt32 mnGfxMode; sal_uInt32 mnMapMode; + sal_uInt16 mnUnitsPerInch; + XForm maXForm; sal_Int32 mnDevOrgX, mnDevOrgY; sal_Int32 mnDevWidth, mnDevHeight; @@ -627,6 +630,7 @@ class WinMtfOutput sal_uInt32 GetMapMode() const { return mnMapMode; }; void SetMapMode( sal_uInt32 mnMapMode ); + void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); void SetWorldTransform( const XForm& rXForm ); void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); @@ -767,7 +771,7 @@ private: sal_uInt32 nUnicodeEscapeAction; // Liesst den Kopf der WMF-Datei - sal_Bool ReadHeader(); + sal_Bool ReadHeader(WMF_APMFILEHEADER *pAPMHeader); // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction. void ReadRecordParams( sal_uInt16 nFunction ); @@ -788,9 +792,9 @@ public: ~WMFReader(); // Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile - void ReadWMF(); + void ReadWMF(WMF_APMFILEHEADER *pAPMHeader=NULL); }; #endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx index e989c2dd8904..a794da5b3274 100644 --- a/svtools/source/filter/wmf/winwmf.cxx +++ b/svtools/source/filter/wmf/winwmf.cxx @@ -31,6 +31,7 @@ #include "winmtf.hxx" #include <vcl/gdimtf.hxx> +#include <svtools/wmf.hxx> #include <rtl/crc.h> #include <rtl/tencinfo.h> #include <osl/endian.h> @@ -997,7 +998,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) // ------------------------------------------------------------------------ -sal_Bool WMFReader::ReadHeader() +sal_Bool WMFReader::ReadHeader(WMF_APMFILEHEADER *pAPMHeader) { Rectangle aPlaceableBound; sal_uInt32 nl, nStrmPos = pWMF->Tell(); @@ -1030,12 +1031,20 @@ sal_Bool WMFReader::ReadHeader() } else { - nUnitsPerInch = 96; - pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the the metaactions - GetPlaceableBound( aPlaceableBound, pWMF ); - pWMF->Seek( nStrmPos ); + nUnitsPerInch = (pAPMHeader!=NULL?pAPMHeader->inch:96); + pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the the metaactions + GetPlaceableBound( aPlaceableBound, pWMF ); + pWMF->Seek( nStrmPos ); + if (pAPMHeader!=NULL) { + // #n417818#: If we have an external header then overwrite the bounds! + aPlaceableBound=Rectangle(pAPMHeader->left*567*nUnitsPerInch/1440/1000, + pAPMHeader->top*567*nUnitsPerInch/1440/1000, + pAPMHeader->right*567*nUnitsPerInch/1440/1000, + pAPMHeader->bottom*567*nUnitsPerInch/1440/1000); + } } + pOut->SetUnitsPerInch( nUnitsPerInch ); pOut->SetWinOrg( aPlaceableBound.TopLeft() ); aWMFSize = Size( labs( aPlaceableBound.GetWidth() ), labs( aPlaceableBound.GetHeight() ) ); pOut->SetWinExt( aWMFSize ); @@ -1068,7 +1077,7 @@ sal_Bool WMFReader::ReadHeader() return sal_True; } -void WMFReader::ReadWMF() +void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader) { sal_uInt16 nFunction; sal_uLong nPos, nPercent, nLastPercent; @@ -1093,7 +1102,7 @@ void WMFReader::ReadWMF() pWMF->Seek( nStartPos ); Callback( (sal_uInt16) ( nLastPercent = 0 ) ); - if ( ReadHeader() ) + if ( ReadHeader( pAPMHeader ) ) { nPos = pWMF->Tell(); @@ -1429,4 +1438,4 @@ WMFReader::~WMFReader() delete pEMFStream; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/wmf.cxx b/svtools/source/filter/wmf/wmf.cxx index d78ce2d160bb..9b2a8edf2d6e 100644 --- a/svtools/source/filter/wmf/wmf.cxx +++ b/svtools/source/filter/wmf/wmf.cxx @@ -36,7 +36,7 @@ // ----------------------------------------------------------------------------- -sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem ) +sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_APMFILEHEADER *pAPMHeader ) { sal_uInt32 nMetaType; sal_uInt32 nOrgPos = rStreamWMF.Tell(); @@ -52,7 +52,7 @@ sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaF } else { - WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF(); + WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF( pAPMHeader ); } rStreamWMF.SetNumberFormatInt( nOrigNumberFormat ); return !rStreamWMF.GetError(); diff --git a/svtools/source/filter/wmf/wmfwr.cxx b/svtools/source/filter/wmf/wmfwr.cxx index df856064ab0c..18c0336740e1 100644 --- a/svtools/source/filter/wmf/wmfwr.cxx +++ b/svtools/source/filter/wmf/wmfwr.cxx @@ -274,11 +274,11 @@ void WMFWriter::MayCallback() void WMFWriter::CountActionsAndBitmaps( const GDIMetaFile & rMTF ) { - sal_uLong nAction, nActionCount; + size_t nAction, nActionCount; - nActionCount = rMTF.GetActionCount(); + nActionCount = rMTF.GetActionSize(); - for ( nAction=0; nAction<nActionCount; nAction++ ) + for ( nAction=0; nAction < nActionCount; nAction++ ) { MetaAction* pMA = rMTF.GetAction( nAction ); @@ -1146,16 +1146,16 @@ void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx: void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) { - sal_uLong nA, nACount; + size_t nA, nACount; MetaAction* pMA; if( bStatus ) { - nACount = rMTF.GetActionCount(); + nACount = rMTF.GetActionSize(); WMFRecord_SetStretchBltMode(); - for( nA=0; nA<nACount; nA++ ) + for( nA=0; nA < nACount; nA++ ) { pMA = rMTF.GetAction( nA ); @@ -1665,8 +1665,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) const MetaEPSAction* pA = (const MetaEPSAction*)pMA; const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() ); - sal_Int32 nCount = aGDIMetaFile.GetActionCount(); - for ( sal_Int32 i = 0; i < nCount; i++ ) + size_t nCount = aGDIMetaFile.GetActionSize(); + for ( size_t i = 0; i < nCount; i++ ) { const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i ); if ( pMetaAct->GetType() == META_BMPSCALE_ACTION ) diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 658cf983bcb5..df7bfa9f88b1 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -118,7 +118,7 @@ GraphicID::GraphicID( const GraphicObject& rObj ) { const GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); - mnID1 |= ( aMtf.GetActionCount() & 0x0fffffff ); + mnID1 |= ( aMtf.GetActionSize() & 0x0fffffff ); mnID2 = aMtf.GetPrefSize().Width(); mnID3 = aMtf.GetPrefSize().Height(); mnID4 = rGraphic.GetChecksum(); diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index ef53bf3a98c5..19b09e8f67a7 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -295,7 +295,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& MapMode m(maGraphic.GetPrefMapMode()); aSize100 = pOut->LogicToLogic( maGraphic.GetPrefSize(), &m, &aMap100 ); } - // <-- nTotalWidth = aSize100.Width() - pAttr->GetLeftCrop() - pAttr->GetRightCrop(); nTotalHeight = aSize100.Height() - pAttr->GetTopCrop() - pAttr->GetBottomCrop(); diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index af579f82c446..b08c1eab2035 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -498,13 +498,12 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( pIStm ) { - ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); + ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter(); - if( pFilter ) { ::Graphic aVCLGraphic; - if( ( pFilter->ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && + if( ( rFilter.ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && ( aVCLGraphic.GetType() != GRAPHIC_NONE ) ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; @@ -658,7 +657,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal aDummyVDev.EnableOutput( sal_False ); aDummyVDev.SetMapMode( aNewMapMode ); - for( sal_uInt32 i = 0, nObjCount = aMtf.GetActionCount(); i < nObjCount; i++ ) + for( size_t i = 0, nObjCount = aMtf.GetActionSize(); i < nObjCount; i++ ) { MetaAction* pAction = aMtf.GetAction( i ); switch( pAction->GetType() ) @@ -826,9 +825,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG if( pFilterShortName ) { - ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); + ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter(); - if( pFilter ) { const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); @@ -846,8 +844,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG aMemStrm << aGraphic; else { - pFilter->ExportGraphic( aGraphic, aPath, aMemStrm, - pFilter->GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ), + rFilter.ExportGraphic( aGraphic, aPath, aMemStrm, + rFilter.GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ), ( aFilterDataSeq.getLength() ? &aFilterDataSeq : NULL ) ); } aMemStrm.Seek( STREAM_SEEK_TO_END ); diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index 122416f8764d..c7603827f61e 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -47,6 +47,13 @@ class SvLBoxEntry; class SvLBoxItem; class SvLBoxTab; class TabBar; +namespace comphelper +{ + namespace string + { + class NaturalStringSorter; + } +} class ImpLBSelEng : public FunctionSet { @@ -163,7 +170,7 @@ private: Timer aEditTimer; // #102891# ------------------- - IntlWrapper * pIntlWrapper; + comphelper::string::NaturalStringSorter *m_pStringSorter; // #97680# -------------------- std::vector< short > aContextBmpWidthVector; @@ -239,8 +246,7 @@ private: static void implInitDefaultNodeImages(); - // #102891# ------------------- - void UpdateIntlWrapper(); + void UpdateStringSorter(); // #97680# -------------------- short UpdateContextBmpWidthVector( SvLBoxEntry* pEntry, short nWidth ); diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index fb750968b798..f7c9763d90fc 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -52,7 +52,7 @@ ErrorBox ERRORBOX_JVMCREATIONFAILED { Buttons = WB_OK; DefButton = WB_DEF_OK ; - Message[ en-US ] = "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Java."; + Message[ en-US ] = "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Java."; }; ErrorBox ERRORBOX_RESTARTREQUIRED diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 405b98588598..7d1f47300b69 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -34,9 +34,6 @@ #include <tools/wintypes.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> -#if defined(OS2) -#include <vcl/sound.hxx> -#endif #include <svtools/ehdl.hxx> #include <svtools/svtdata.hxx> @@ -175,8 +172,7 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l SfxErrorHandler::~SfxErrorHandler() { - if( pFreeMgr ) - delete pFreeMgr; + delete pFreeMgr; } //------------------------------------------------------------------------- diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 1f6b71485981..f31fe586d667 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -294,6 +294,7 @@ EmbeddedObjectRef::~EmbeddedObjectRef() { delete mpImp->pGraphic; Clear(); + delete mpImp; } void EmbeddedObjectRef::Assign( const NS_UNO::Reference < NS_EMBED::XEmbeddedObject >& xObj, sal_Int64 nAspect ) @@ -436,9 +437,9 @@ void EmbeddedObjectRef::GetReplacement( sal_Bool bUpdate ) SvStream* pGraphicStream = GetGraphicStream( bUpdate ); if ( pGraphicStream ) { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); if( mpImp->pGraphic ) - pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + rGF.ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); mpImp->mnGraphicVersion++; delete pGraphicStream; } @@ -529,8 +530,8 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream if ( pGraphicStream ) { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); - pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); + rGF.ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) diff --git a/svtools/source/misc/filechangedchecker.cxx b/svtools/source/misc/filechangedchecker.cxx index abd0f3439c81..6a3d04107420 100644 --- a/svtools/source/misc/filechangedchecker.cxx +++ b/svtools/source/misc/filechangedchecker.cxx @@ -67,7 +67,7 @@ bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const // Retrieve the status - we are only interested in last File // Modified time - osl::FileStatus aStatus( FileStatusMask_ModifyTime ); + osl::FileStatus aStatus( osl_FileStatus_Mask_ModifyTime ); if( osl::FileBase::E_None != aItem.getFileStatus(aStatus) ) return false; diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 92fd64bde9cc..8a56a3005e1b 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -54,6 +54,7 @@ #include <svtools/imagemgr.hrc> #include <svtools/svtdata.hxx> #include <osl/mutex.hxx> +#include <boost/scoped_ptr.hpp> // globals ******************************************************************* @@ -185,35 +186,6 @@ static SvtExtensionResIdMapping_Impl const ExtensionMap_Impl[] = { 0, sal_False, 0, 0 } }; -#ifdef OS2 - SvtExtensionResIdMapping_Impl Mappings[] = - { - {"StarWriter 4.0", sal_False,STR_DESCRIPTION_SWRITER_DOC, IMG_WRITER}, - {"StarWriter 3.0", sal_False,STR_DESCRIPTION_SWRITER_DOC, IMG_WRITER}, - {"StarCalc 4.0", sal_False,STR_DESCRIPTION_SCALC_DOC, IMG_CALC}, - {"StarCalc 3.0", sal_False,STR_DESCRIPTION_SCALC_DOC, IMG_CALC}, - {"StarImpress 4.0", sal_False,STR_DESCRIPTION_SIMPRESS_DOC,IMG_IMPRESS}, - {"StarDraw 4.0", sal_False,STR_DESCRIPTION_SDRAW_DOC, IMG_DRAW}, - {"StarDraw 3.0", sal_False,STR_DESCRIPTION_SDRAW_DOC, IMG_DRAW}, - {"StarChart 3.0", sal_False,STR_DESCRIPTION_SCHART_DOC, IMG_CHART}, - {"StarChart 4.0", sal_False,STR_DESCRIPTION_SCHART_DOC, IMG_CHART}, - {"Bitmap", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_BITMAP}, - {"AutoCAD", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"Gif-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_GIF}, - {"JPEG-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_JPG}, - {"Metafile ", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"Photo-CD ", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCD}, - {"Mac Pict", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCT}, - {"PCX-File ", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCX}, - {"PNG-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"SV-Metafile", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"TIFF-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_TIFF}, - {"MS-Metafile", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_WMF}, - {"XBM-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_BITMAP}, - {NULL, 0} - }; -#endif - struct SvtFactory2ExtensionMapping_Impl { const char* _pFactory; @@ -537,36 +509,34 @@ static Image GetImageFromList_Impl( sal_uInt16 nImageId, sal_Bool bBig ) ImageList* pList = NULL; - static ImageList* _pSmallImageList = NULL; - static ImageList* _pBigImageList = NULL; + static boost::scoped_ptr<ImageList> xSmallImageList; + static boost::scoped_ptr<ImageList> xBigImageList; static sal_uLong nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); // If the style has been changed, throw away our cache of the older images if ( nStyle != Application::GetSettings().GetStyleSettings().GetSymbolsStyle() ) { - delete _pSmallImageList, _pSmallImageList = NULL; - delete _pBigImageList, _pBigImageList = NULL; + xSmallImageList.reset(); + xBigImageList.reset(); nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); } if ( bBig ) { - if ( !_pBigImageList ) - _pBigImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_BIG ) ); - pList = _pBigImageList; + if ( !xBigImageList ) + xBigImageList.reset(new ImageList(SvtResId(RID_SVTOOLS_IMAGELIST_BIG))); + pList = xBigImageList.get(); } else { - if ( !_pSmallImageList ) - _pSmallImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_SMALL ) ); - pList = _pSmallImageList; + if ( !xSmallImageList ) + xSmallImageList.reset(new ImageList(SvtResId(RID_SVTOOLS_IMAGELIST_SMALL))); + pList = xSmallImageList.get(); } if ( pList->HasImageAtPos( nImageId ) ) return pList->GetImage( nImageId ); - else - return Image(); -// return GetOfficeImageFromList_Impl( nImageId, bBig ); + return Image(); } String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObject, sal_Bool bDetectFolder ) diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 88bb9a9a510a..d4ee29924801 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -1222,4 +1222,4 @@ void ImageMap::Read( SvStream& rIStm, const String& rBaseURL ) } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 7785e24f243d..215414a2d968 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -812,7 +812,7 @@ sal_Bool TransferableHelper::SetBitmap( const Bitmap& rBitmap, const DataFlavor& sal_Bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf, const DataFlavor& ) { - if( rMtf.GetActionCount() ) + if( rMtf.GetActionSize() ) { SvMemoryStream aMemStm( 65535, 65535 ); @@ -2278,28 +2278,27 @@ TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( Window DBG_ASSERT( pWindow, "Window pointer is NULL" ); Reference< XClipboard > xClipboard; - TransferableDataHelper aRet; + TransferableDataHelper aRet; if( pWindow ) xClipboard = pWindow->GetClipboard(); if( xClipboard.is() ) - { - try - + { + try { Reference< XTransferable > xTransferable( xClipboard->getContents() ); if( xTransferable.is() ) { aRet = TransferableDataHelper( xTransferable ); - aRet.mxClipboard = xClipboard; - // also copy the clipboard + // also copy the clipboard + aRet.mxClipboard = xClipboard; } - } + } catch( const ::com::sun::star::uno::Exception& ) { - } + } } return aRet; diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx index 412140f9a3f5..38d3dc3cc377 100644 --- a/svtools/source/svhtml/htmlkywd.cxx +++ b/svtools/source/svhtml/htmlkywd.cxx @@ -207,9 +207,6 @@ static int #if defined( WNT ) __cdecl #endif -#if defined( ICC ) && defined( OS2 ) - _Optlink -#endif HTMLKeyCompare( const void *pFirst, const void *pSecond) { int nRet = 0; @@ -562,9 +559,6 @@ static int #if defined( WNT ) __cdecl #endif -#if defined( ICC ) && defined( OS2 ) - _Optlink -#endif HTMLCharNameCompare( const void *pFirst, const void *pSecond) { int nRet = 0; @@ -1023,9 +1017,6 @@ static int #if defined( WNT ) __cdecl #endif -#if defined( ICC ) && defined( OS2 ) - _Optlink -#endif HTMLColorNameCompare( const void *pFirst, const void *pSecond) { int nRet = 0; diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index 134783a80056..76dccb5a5026 100644 --- a/svtools/source/svrtf/rtfkeywd.cxx +++ b/svtools/source/svrtf/rtfkeywd.cxx @@ -1191,9 +1191,6 @@ static int #if defined( WNT ) __cdecl #endif -#if defined( ICC ) && defined( OS2 ) -_Optlink -#endif RTFKeyCompare( const void *pFirst, const void *pSecond) { int nRet = 0; diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index e3cf909ea31c..83d419ee50bb 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -78,15 +78,6 @@ public: sal_Int32& mrLock; }; -// -------------------------------------------------------------------- - -class ImplGraphicItem : public SvLBoxBmp -{ -public: - ImplGraphicItem( SvLBoxEntry* pEntry, sal_uInt16 nFlags, Image& aImage ) : SvLBoxBmp( pEntry, nFlags, aImage ) {} - - OUString msGraphicURL; -}; // -------------------------------------------------------------------- @@ -125,7 +116,7 @@ private: // -------------------------------------------------------------------- -class SVT_DLLPUBLIC UnoTreeListItem : public SvLBoxItem +class UnoTreeListItem : public SvLBoxItem { public: UnoTreeListItem( SvLBoxEntry* ); diff --git a/svtools/workben/treecontrol/treetest.cxx b/svtools/workben/treecontrol/treetest.cxx index 0fd806f1c5ba..7209159c9ca5 100644 --- a/svtools/workben/treecontrol/treetest.cxx +++ b/svtools/workben/treecontrol/treetest.cxx @@ -218,7 +218,7 @@ void DirectoryTree::fillNode( const Reference< XMutableTreeNode >& xNode ) if( aDirectory.open() == osl::Directory::E_None ) { osl::DirectoryItem aItem; - osl::FileStatus fs( FileStatusMask_Type | FileStatusMask_FileURL); + osl::FileStatus fs( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL); while( aDirectory.getNextItem( aItem, 0xffffffff ) == osl::Directory::E_None ) { if (aItem.getFileStatus(fs) == osl::FileBase::E_None) diff --git a/toolkit/source/awt/asynccallback.cxx b/toolkit/source/awt/asynccallback.cxx index 672c939d8fd4..1994b2b4ac26 100644 --- a/toolkit/source/awt/asynccallback.cxx +++ b/toolkit/source/awt/asynccallback.cxx @@ -195,4 +195,4 @@ void * SAL_CALL comp_AsyncCallback_component_getFactory( } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxbutton.cxx b/toolkit/source/awt/vclxbutton.cxx index 6ab3221c5df0..5a368793fc89 100644 --- a/toolkit/source/awt/vclxbutton.cxx +++ b/toolkit/source/awt/vclxbutton.cxx @@ -57,70 +57,70 @@ VCLXIconButton::VCLXIconButton( Window *p, rtl::OUString aDefaultLabel, char con VCLXOKButton::VCLXOKButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_OK ), - "res/commandimagelist/sc_ok.png" ) + "cmd/sc_ok.png" ) { } VCLXCancelButton::VCLXCancelButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_CANCEL ), // : VCLXIconButton( xButton, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("~Cancel ")), - "res/commandimagelist/sc_cancel.png" ) + "cmd/sc_cancel.png" ) { } VCLXYesButton::VCLXYesButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_YES ), - "res/commandimagelist/sc_yes.png" ) + "cmd/sc_yes.png" ) { } VCLXNoButton::VCLXNoButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_NO ), - "res/commandimagelist/sc_no.png" ) + "cmd/sc_no.png" ) { } VCLXRetryButton::VCLXRetryButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_RETRY ), - "res/commandimagelist/sc_retry.png" ) + "cmd/sc_retry.png" ) { } VCLXIgnoreButton::VCLXIgnoreButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_IGNORE ), - "res/commandimagelist/sc_ignore.png" ) + "cmd/sc_ignore.png" ) { } VCLXResetButton::VCLXResetButton( Window *p ) : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("~Reset ")), - "res/commandimagelist/sc_reset.png" ) + "cmd/sc_reset.png" ) { } VCLXApplyButton::VCLXApplyButton( Window *p ) : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Apply")), - "res/commandimagelist/sc_apply.png" ) + "cmd/sc_apply.png" ) { } VCLXHelpButton::VCLXHelpButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_HELP ), - "res/commandimagelist/sc_help.png" ) + "cmd/sc_help.png" ) { } VCLXMoreButton::VCLXMoreButton( Window *p ) : VCLXIconButton( p, Button::GetStandardText( BUTTON_MORE ), // : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("More ")), - "res/commandimagelist/sc_more.png" ) + "cmd/sc_more.png" ) { } VCLXAdvancedButton::VCLXAdvancedButton( Window *p ) // : VCLXIconButton( p, Button::GetStandardText( BUTTON_ADVANCED ), : VCLXIconButton( p, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Advanced ")), - "res/commandimagelist/sc_advanced.png" ) + "cmd/sc_advanced.png" ) { } diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx index 7f2721726e9e..7cb667b18528 100644 --- a/toolkit/source/awt/vclxsystemdependentwindow.cxx +++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx @@ -92,11 +92,6 @@ IMPL_XTYPEPROVIDER_END { aRet <<= (sal_Int32)pSysData->hWnd; } -#elif (defined OS2) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 ) - { - aRet <<= (sal_Int32)pSysData->hWnd; - } #elif (defined QUARTZ) if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC ) { diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 82a73fedf954..cd488833782a 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -131,8 +131,6 @@ namespace css = ::com::sun::star; #if (defined WNT) #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 -#elif (defined OS2) -#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 #elif (defined QUARTZ) #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_MAC #elif (defined UNX) @@ -346,9 +344,6 @@ static int #if defined( WNT ) __cdecl #endif -#if defined( ICC ) && defined( OS2 ) -_Optlink -#endif ComponentInfoCompare( const void* pFirst, const void* pSecond) { return( strcmp( ((ComponentInfo*)pFirst)->pName, @@ -996,8 +991,6 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, aParentData.bXEmbedSupport = bXEmbed; #elif defined WNT aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle); - #elif defined OS2 - aParentData.hWnd = (HWND)nWindowHandle; #endif pNewWindow = new WorkWindow( &aParentData ); } @@ -1222,8 +1215,6 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( aParentData.bXEmbedSupport = bXEmbed; #elif defined WNT aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle); - #elif defined OS2 - aParentData.hWnd = (HWND)nWindowHandle; #endif SolarMutexGuard aGuard; try diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index abcf616a2a90..8bf3c861c01d 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -104,11 +104,6 @@ Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException) { aRet <<= (sal_Int32)pSysData->hWnd; } -#elif (defined OS2) - if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 ) - { - aRet <<= (sal_Int32)pSysData->hWnd; - } #elif (defined QUARTZ) if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC ) { diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx index 3039e11c3895..6a9c64ba3c95 100644 --- a/toolkit/source/awt/vclxwindow1.cxx +++ b/toolkit/source/awt/vclxwindow1.cxx @@ -92,7 +92,7 @@ void VCLXWindow::SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle ) // create system parent data SystemParentData aSysParentData; aSysParentData.nSize = sizeof ( SystemParentData ); -#if defined( WNT ) || defined ( OS2 ) +#if defined( WNT ) aSysParentData.hWnd = (HWND) nHandle; #elif defined( QUARTZ ) aSysParentData.pView = reinterpret_cast<NSView*>(nHandle); diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 525e5d30ce3f..56f1b7fab53d 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -47,7 +47,6 @@ #include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/resource/XStringResourceResolver.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <tools/list.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 2b7f664a8b00..7516a422eddd 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -40,7 +40,6 @@ #include <com/sun/star/awt/WindowAttribute.hpp> #include <com/sun/star/resource/XStringResourceResolver.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <tools/list.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx index ccdbe1f26fca..20abfff2654e 100644 --- a/toolkit/source/controls/geometrycontrolmodel.cxx +++ b/toolkit/source/controls/geometrycontrolmodel.cxx @@ -593,20 +593,16 @@ return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier ); } + namespace + { + class theOCommonGeometryControlModelImplementationId : + public rtl::Static< ::cppu::OImplementationId, theOCommonGeometryControlModelImplementationId > {}; + } + //-------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( ) throw (RuntimeException) { - static ::cppu::OImplementationId * pId = NULL; - if ( !pId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pId ) - { - static ::cppu::OImplementationId s_aId; - pId = &s_aId; - } - } - return pId->getImplementationId(); + return theOCommonGeometryControlModelImplementationId::get().getImplementationId(); } //-------------------------------------------------------------------- diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index 56eddb34fce4..91cc3c151e5f 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -391,4 +391,4 @@ namespace toolkit { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) ); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/controls/grid/initguard.hxx b/toolkit/source/controls/grid/initguard.hxx index 138cdd8c894c..33a8d58c44a4 100644 --- a/toolkit/source/controls/grid/initguard.hxx +++ b/toolkit/source/controls/grid/initguard.hxx @@ -64,4 +64,4 @@ namespace toolkit #endif // SVTOOLS_INITGUARD_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx index 74e3c6b01000..5629aa9d12ba 100644 --- a/toolkit/source/controls/tabpagemodel.cxx +++ b/toolkit/source/controls/tabpagemodel.cxx @@ -40,7 +40,6 @@ #include <com/sun/star/awt/UnoControlDialogModelProvider.hpp> #include <com/sun/star/resource/XStringResourceResolver.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <tools/list.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx index fcad9bd5e287..9ef7508b7635 100644 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -232,4 +232,4 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::su // ---------------------------------------------------- IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener ) IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener, tabPageActivated, ::com::sun::star::awt::tab::TabPageActivatedEvent ) -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 34ca76ebd8d3..b5abb11d632e 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -64,7 +64,7 @@ using namespace ::com::sun::star; case WINDOW_OKBUTTON: case WINDOW_CANCELBUTTON: return new VCLXButton; case WINDOW_CHECKBOX: return new VCLXCheckBox; - // --> OD 2009-06-29 #i95042# + // #i95042# // A Window of type <MetricBox> is inherited from type <ComboBox>. // Thus, it does make more sense to return a <VCLXComboBox> instance // instead of only a <VCLXWindow> instance, especially regarding its diff --git a/toolkit/test/accessibility/HelpWindow.java b/toolkit/test/accessibility/HelpWindow.java index 74627ad99761..a66d0975f704 100644 --- a/toolkit/test/accessibility/HelpWindow.java +++ b/toolkit/test/accessibility/HelpWindow.java @@ -30,7 +30,7 @@ class HelpWindow File aFile = new File (sFilename); try { - loadURL (aFile.toURL()); + loadURL (aFile.toURI().toURL()); } catch (MalformedURLException e) { diff --git a/toolkit/uiconfig/layout/message-box.xml b/toolkit/uiconfig/layout/message-box.xml index 61305e443fa3..2bd19bbb42fb 100644 --- a/toolkit/uiconfig/layout/message-box.xml +++ b/toolkit/uiconfig/layout/message-box.xml @@ -10,16 +10,16 @@ <vbox border="5" spacing="5"> <hbox border="5" spacing="20"> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" /> + <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-error.png" /> </align> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" /> + <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-info.png" /> </align> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" /> + <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-query.png" /> </align> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" /> + <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-warning.png" /> </align> <align cnt:expand="false" cnt:fill="true"> <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" /> diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx index 27a8987ec1ba..ceee0fdaba4d 100644 --- a/toolkit/workben/layout/editor.cxx +++ b/toolkit/workben/layout/editor.cxx @@ -1329,16 +1329,16 @@ public: { mpListBox->SetSelectHdl( LINK( this, SortListBox, ItemSelectedHdl ) ); - mpUpButton->SetModeImage( layout::Image ( "res/commandimagelist/lc_moveup.png" ) ); + mpUpButton->SetModeImage( layout::Image ( "cmd/lc_moveup.png" ) ); mpUpButton->SetImageAlign( IMAGEALIGN_LEFT ); mpUpButton->SetClickHdl( LINK( this, SortListBox, UpPressedHdl ) ); - mpDownButton->SetModeImage( layout::Image ( "res/commandimagelist/lc_movedown.png" ) ); + mpDownButton->SetModeImage( layout::Image ( "cmd/lc_movedown.png" ) ); mpDownButton->SetImageAlign( IMAGEALIGN_LEFT ); mpDownButton->SetClickHdl( LINK( this, SortListBox, DownPressedHdl ) ); - // "res/commandimagelist/lch_delete.png", "res/commandimagelist/lc_delete.png" - mpRemoveButton->SetModeImage( layout::Image ( "res/commandimagelist/sc_closedoc.png" ) ); + // "cmd/lch_delete.png", "cmd/lc_delete.png" + mpRemoveButton->SetModeImage( layout::Image ( "cmd/sc_closedoc.png" ) ); mpRemoveButton->SetImageAlign( IMAGEALIGN_LEFT ); mpRemoveButton->SetClickHdl( LINK( this, SortListBox, RemovePressedHdl ) ); @@ -1659,7 +1659,7 @@ EditorImpl::EditorImpl( layout::Dialog *dialog, pBtn->SetClickHdl( LINK( this, EditorImpl, CreateWidgetHdl ) ); if ( WIDGETS_SPECS[ i ].pIconName != NULL ) { - rtl::OString aPath ("res/commandimagelist/"); + rtl::OString aPath ("cmd/"); aPath += WIDGETS_SPECS[ i ].pIconName; layout::Image aImg( aPath ); pBtn->SetModeImage( aImg ); diff --git a/toolkit/workben/layout/message-box.xml b/toolkit/workben/layout/message-box.xml index 61305e443fa3..2bd19bbb42fb 100644 --- a/toolkit/workben/layout/message-box.xml +++ b/toolkit/workben/layout/message-box.xml @@ -10,16 +10,16 @@ <vbox border="5" spacing="5"> <hbox border="5" spacing="20"> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" /> + <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-error.png" /> </align> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" /> + <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-info.png" /> </align> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" /> + <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-query.png" /> </align> <align cnt:expand="false" cnt:fill="true"> - <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" /> + <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="cmd/msgbox-warning.png" /> </align> <align cnt:expand="false" cnt:fill="true"> <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" /> diff --git a/toolkit/workben/layout/plugin.xml b/toolkit/workben/layout/plugin.xml index c5f1b2abe040..5303e3a2329e 100644 --- a/toolkit/workben/layout/plugin.xml +++ b/toolkit/workben/layout/plugin.xml @@ -10,7 +10,7 @@ has_border="true" sizeable="true" moveable="true"> <vbox spacing="5" border="5"> <hbox spacing="5" cnt:expand="false"> - <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" /> + <fixedimage id="FI_HEADER" cnt:expand="false" graphic="cmd/sc_apply.png" /> <fixedtext id="FT_HEADER" _label="Plugin Test"/> </hbox> <fixedline id="FL_HEADER"/> diff --git a/toolkit/workben/layout/recover.xml b/toolkit/workben/layout/recover.xml index b7387b687de2..790a6b694658 100644 --- a/toolkit/workben/layout/recover.xml +++ b/toolkit/workben/layout/recover.xml @@ -10,7 +10,7 @@ has_border="true" sizeable="true" moveable="true"> <vbox spacing="5" border="5" width="640"> <hbox spacing="5" cnt:expand="false"> - <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" /> + <fixedimage id="FI_HEADER" cnt:expand="false" graphic="cmd/sc_apply.png" /> <fixedtext id="FT_HEADER" _label="OpenOffice.org Document Restore"/> </hbox> <fixedline id="FL_HEADER"/> @@ -24,22 +24,22 @@ LINE TEST"/> <vbox cnt:fill="true" cnt:expand="true" cnt:padding="20" border="20" spacing="20"> <hbox> <checkbox id="CB_DOC" state="1" cnt:expand="false" scale="false"/> - <fixedimage id="FI_DOC" cnt:v-align="0.5" image-align="0.5" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertdoc.png"/> + <fixedimage id="FI_DOC" cnt:v-align="0.5" image-align="0.5" cnt:expand="false" scale="false" graphic="cmd/lc_insertdoc.png"/> <fixedtext id="FT_DOC" _label="My document"/> </hbox> <hbox> <checkbox id="CB_SHEET" state="1" cnt:expand="false" scale="false" /> - <fixedimage id="FI_SHEET" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_inserttable.png" /> + <fixedimage id="FI_SHEET" cnt:expand="false" scale="false" graphic="cmd/lc_inserttable.png" /> <fixedtext id="FT_SHEET" _label="My spreadsheet"/> </hbox> <hbox> <checkbox id="CB_DRAW" state="1" cnt:expand="false" scale="false"/> - <fixedimage id="FI_DRAW" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertdraw.png" /> + <fixedimage id="FI_DRAW" cnt:expand="false" scale="false" graphic="cmd/lc_insertdraw.png" /> <fixedtext id="FT_DRAW" _label="My drawing"/> </hbox> <hbox> <checkbox id="CB_PRESENT" state="1" cnt:expand="false" scale="false" /> - <fixedimage id="FI_PRESENT" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertvideo.png" /> + <fixedimage id="FI_PRESENT" cnt:expand="false" scale="false" graphic="cmd/lc_insertvideo.png" /> <fixedtext id="FT_PRESENT" _label="My presentation"/> </hbox> <hbox border="5"> diff --git a/tools/Executable_mkunroll.mk b/tools/Executable_mkunroll.mk index 16cc39fd991d..3aa74bc160ea 100644 --- a/tools/Executable_mkunroll.mk +++ b/tools/Executable_mkunroll.mk @@ -46,14 +46,12 @@ $(eval $(call gb_Executable_add_linked_libs,mkunroll,\ $(gb_STDLIBS) \ )) -# used to link against basegfxlx comphelp4gcc3 i18nisolang1gcc3 ucbhelper4gcc3 uno_cppu uno_cppuhelpergcc3 uno_salhelpergcc3 - seems to be superficial - $(eval $(call gb_Executable_add_exception_objects,mkunroll,\ - tools/bootstrp/addexes2/mkfilt \ - tools/bootstrp/appdef \ - tools/bootstrp/cppdep \ - tools/bootstrp/inimgr \ - tools/bootstrp/prj \ + tools/bootstrp/mkunroll/mkunroll \ +)) + +$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\ + toolshelpers \ )) # vim: set noet sw=4 ts=4: diff --git a/tools/Executable_rscdep.mk b/tools/Executable_rscdep.mk index f12a09296783..87c4b3776033 100644 --- a/tools/Executable_rscdep.mk +++ b/tools/Executable_rscdep.mk @@ -46,13 +46,13 @@ $(eval $(call gb_Executable_add_linked_libs,rscdep,\ )) $(eval $(call gb_Executable_add_exception_objects,rscdep,\ - tools/bootstrp/appdef \ - tools/bootstrp/cppdep \ - tools/bootstrp/inimgr \ - tools/bootstrp/prj \ tools/bootstrp/rscdep \ )) +$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\ + toolshelpers \ +)) + ifeq ($(OS),WNT) ifeq ($(HAVE_GETOPT),YES) $(eval $(call gb_Executable_set_cxxflags,rscdep,\ diff --git a/tools/Executable_sspretty.mk b/tools/Executable_sspretty.mk deleted file mode 100644 index 5cfd08768b6c..000000000000 --- a/tools/Executable_sspretty.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Executable_Executable,sspretty)) - -$(eval $(call gb_Executable_set_include,sspretty,\ - $$(INCLUDE) \ - -I$(realpath $(SRCDIR)/tools/inc) \ - -I$(realpath $(SRCDIR)/tools/inc/pch) \ - -I$(realpath $(SRCDIR)/tools/bootstrp) \ -)) - -$(eval $(call gb_Executable_set_cxxflags,sspretty,\ - $$(CXXFLAGS) \ - -D_TOOLS_STRINGLIST \ -)) - -$(eval $(call gb_Executable_add_linked_libs,sspretty,\ - sal \ - tl \ - $(gb_STDLIBS) \ -)) -# used to link against basegfxlx comphelp4gcc3 i18nisolang1gcc3 ucbhelper4gcc3 uno_cppu uno_cppuhelpergcc3 uno_salhelpergcc3 - seems to be superficial - -$(eval $(call gb_Executable_add_exception_objects,sspretty,\ - tools/bootstrp/appdef \ - tools/bootstrp/cppdep \ - tools/bootstrp/inimgr \ - tools/bootstrp/prj \ - tools/bootstrp/sspretty \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index 6e950b0c7a58..a16310587a1f 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -33,11 +33,11 @@ $(eval $(call gb_Module_add_targets,tools,\ Executable_mkunroll \ Executable_rscdep \ Executable_so_checksum \ - Executable_sspretty \ Library_tl \ Package_inc \ Package_reversemap \ StaticLibrary_ooopathutils \ + StaticLibrary_toolshelpers \ )) # vim: set noet sw=4 ts=4: diff --git a/tools/Package_inc.mk b/tools/Package_inc.mk index 5062bd0be301..9dd746dbcf9b 100644 --- a/tools/Package_inc.mk +++ b/tools/Package_inc.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -62,7 +62,6 @@ $(eval $(call gb_Package_add_file,tools_inc,inc/tools/list.hxx,tools/list.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/ownlist.hxx,tools/ownlist.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)) @@ -70,7 +69,6 @@ $(eval $(call gb_Package_add_file,tools_inc,inc/tools/postx.h,tools/postx.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/prex.h,tools/prex.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/queue.hxx,tools/queue.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)) diff --git a/tools/StaticLibrary_ooopathutils.mk b/tools/StaticLibrary_ooopathutils.mk index e58becb175d3..e58becb175d3 100755..100644 --- a/tools/StaticLibrary_ooopathutils.mk +++ b/tools/StaticLibrary_ooopathutils.mk diff --git a/tools/StaticLibrary_toolshelpers.mk b/tools/StaticLibrary_toolshelpers.mk new file mode 100644 index 000000000000..a63ac47a7eac --- /dev/null +++ b/tools/StaticLibrary_toolshelpers.mk @@ -0,0 +1,61 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com> +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_StaticLibrary_StaticLibrary,toolshelpers)) + +$(eval $(call gb_StaticLibrary_set_include,toolshelpers,\ + $$(INCLUDE) \ + -I$(realpath $(SRCDIR)/tools/inc) \ + -I$(realpath $(SRCDIR)/tools/inc/pch) \ + -I$(realpath $(SRCDIR)/tools/bootstrp) \ +)) + +$(eval $(call gb_StaticLibrary_set_cxxflags,toolshelpers,\ + $$(CXXFLAGS) \ + -D_TOOLS_STRINGLIST \ +)) + +$(eval $(call gb_StaticLibrary_add_exception_objects,toolshelpers,\ + tools/bootstrp/appdef \ + tools/bootstrp/cppdep \ + tools/bootstrp/prj \ +)) + +ifeq ($(OS),WNT) +ifeq ($(HAVE_GETOPT),YES) +$(eval $(call gb_StaticLibrary_set_cxxflags,toolshelpers,\ + $$(CXXFLAGS) \ + -DHAVE_GETOPT \ +)) +else +$(eval $(call gb_StaticLibrary_add_linked_libs,toolshelpers,\ + gnu_getopt \ +)) +endif +endif + +# vim: set noet sw=4 ts=4: diff --git a/tools/bootstrp/appdef.cxx b/tools/bootstrp/appdef.cxx index e411ea022d3a..9600272ca858 100644 --- a/tools/bootstrp/appdef.cxx +++ b/tools/bootstrp/appdef.cxx @@ -35,123 +35,6 @@ #include "bootstrp/appdef.hxx" -const char* GetDefStandList() -{ - char* pRet; - char* pEnv = getenv("STAR_STANDLST"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _DEF_STAND_LIST ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _DEF_STAND_LIST ); - } - return pRet; -} - - -const char* GetIniRoot() -{ - char* pRet; - char* pEnv = getenv("STAR_INIROOT"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _INIROOT ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _INIROOT ); - } - return pRet; -} - -const char* GetIniRootOld() -{ - char* pRet; - char* pEnv = getenv("STAR_INIROOTOLD"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _INIROOT_OLD ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _INIROOT_OLD ); - } - return pRet; -} - -const char* GetSSolarIni() -{ - char* pRet; - char* pEnv = getenv("STAR_SSOLARINI"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _DEF_SSOLARINI ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _DEF_SSOLARINI ); - } - return pRet; -} - - -const char* GetSSCommon() -{ - char* pRet; - char* pEnv = getenv("STAR_SSCOMMON"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( _DEF_SSCOMMON ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, _DEF_SSCOMMON ); - } - return pRet; -} - - -const char* GetBServerRoot() -{ - char* pRet; - char* pEnv = getenv("STAR_BSERVERROOT"); - if ( pEnv ) - { - int nLen = strlen( pEnv ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, pEnv ); - } - else - { - int nLen = strlen( B_SERVER_ROOT ); - pRet = ( char *) malloc( nLen + 1 ); - (void) strcpy( pRet, B_SERVER_ROOT ); - } - return pRet; -} - const char* GetEnv( const char *pVar ) { char const *pRet = getenv( pVar ); diff --git a/tools/bootstrp/inimgr.cxx b/tools/bootstrp/inimgr.cxx deleted file mode 100644 index 3d9d818e1a38..000000000000 --- a/tools/bootstrp/inimgr.cxx +++ /dev/null @@ -1,213 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" -#if !defined( UNX ) -#include <direct.h> -#else -#include <sys/stat.h> -#endif -#include <stdlib.h> -#include <stdio.h> - - -#include "bootstrp/inimgr.hxx" -#include "bootstrp/appdef.hxx" - -/****************************************************************************/ -IniManager::IniManager( ByteString &rDir, ByteString &rLocalDir ) -/****************************************************************************/ - : bUpdate( sal_True ) -{ - sLocalPath = ByteString( getenv( "LOCALINI" )); - if ( !sLocalPath.Len()) - sLocalPath = rLocalDir; - - sGlobalDir = rDir; -#if !defined( UNX ) && !defined( OS2 ) - mkdir(( char * ) sLocalPath.GetBuffer()); -#else - mkdir( sLocalPath.GetBuffer() ,00777 ); -#endif -} - -/****************************************************************************/ -IniManager::IniManager( ByteString &rDir ) -/****************************************************************************/ - : bUpdate( sal_True ) -{ - sLocalPath = GetLocalIni(); - sGlobalDir = rDir; -#if !defined( UNX ) && !defined( OS2 ) - mkdir(( char * ) sLocalPath.GetBuffer()); -#else - mkdir( sLocalPath.GetBuffer() ,00777 ); -#endif -} - -/****************************************************************************/ -IniManager::IniManager() -/****************************************************************************/ - : bUpdate( sal_True ) -{ - sLocalPath = GetLocalIni(); - -#if !defined( UNX ) && !defined( OS2 ) - mkdir(( char * ) sLocalPath.GetBuffer()); -#else - mkdir( sLocalPath.GetBuffer(), 00777 ); -#endif - - sGlobalDir = GetGlobalIni(); -} - -/****************************************************************************/ -ByteString IniManager::ToLocal( ByteString &rPath ) -/****************************************************************************/ -{ - ByteString sTmp( rPath ); -#if !defined( UNX ) - ByteString sUnc( _INI_UNC ); - sUnc.ToUpperAscii(); - ByteString sOldUnc( _INI_UNC_OLD ); - sOldUnc.ToUpperAscii(); - sTmp.ToUpperAscii(); - - sTmp.SearchAndReplace( sUnc, _INI_DRV ); - sTmp.SearchAndReplace( sOldUnc, _INI_DRV ); - sTmp.ToUpperAscii(); - - ByteString sIni( sGlobalDir ); - sIni.ToUpperAscii(); - - sTmp.SearchAndReplace( sIni, sLocalPath ); - - while ( sTmp.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND ) ; -#else - sTmp.SearchAndReplace( sGlobalDir, sLocalPath ); - - ByteString sOldGlobalDir( GetIniRootOld() ); - sTmp.SearchAndReplace( sOldGlobalDir, sLocalPath ); - - while ( sTmp.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND ) ; -#endif - - return sTmp; -} - -/****************************************************************************/ -ByteString IniManager::GetLocalIni() -/****************************************************************************/ -{ - ByteString sLocalPath = ByteString( getenv( "LOCALINI" )); - - if ( !sLocalPath.Len()) { -#ifdef UNX - ByteString sLocal( getenv( "HOME" )); - sLocal += ByteString( "/localini" ); -#else - ByteString sLocal( getenv( "TMP" )); - sLocal += ByteString( "\\localini" ); -#endif - - sLocalPath = sLocal; - } - - return sLocalPath; -} - -/****************************************************************************/ -ByteString IniManager::GetGlobalIni() -/****************************************************************************/ -{ - ByteString sGlobalPath = ByteString( GetEnv( "GLOBALINI" )); - - if ( !sGlobalPath.Len()) - sGlobalPath = ByteString( _INIROOT ); - - return sGlobalPath; -} - -/****************************************************************************/ -void IniManager::ForceUpdate() -/****************************************************************************/ -{ - UniString sUniGlobalDir( sGlobalDir, gsl_getSystemTextEncoding()); - DirEntry aPath( UniString( sGlobalDir, gsl_getSystemTextEncoding())); - Dir aDir( aPath, FSYS_KIND_DIR | FSYS_KIND_FILE); - -#ifndef UNX - sLocalPath.EraseTrailingChars( '\\' ); - sLocalPath += "\\"; -#else - sLocalPath.EraseTrailingChars( '/' ); - sLocalPath += "/"; -#endif - - for ( sal_uInt16 i=0; i < aDir.Count(); i++ ) { - ByteString sEntry( aDir[i].GetName(), gsl_getSystemTextEncoding()); - if (( sEntry != "." ) && - ( sEntry != ".." )) - { - if ( !FileStat( aDir[i] ).IsKind( FSYS_KIND_DIR )) { - ByteString sSrc( aDir[i].GetFull(), gsl_getSystemTextEncoding()); - ByteString sDestination( sLocalPath ); - sDestination += sEntry; - - UniString sUniDestination( sDestination, gsl_getSystemTextEncoding()); - DirEntry aDestEntry( sUniDestination ); - FileStat aDestStat( aDestEntry ); - FileStat aSrcStat( aDir[i] ); - - if (( !aDestEntry.Exists() ) || - ( aSrcStat.IsYounger( aDestStat ))) - { - FileCopier aFileCopier( aDir[ i ], aDestEntry ); - aFileCopier.Execute(); - - while ( !aDestEntry.Exists()) - aFileCopier.Execute(); - } - } - } - } -} - -/****************************************************************************/ -void IniManager::Update() -/****************************************************************************/ -{ - if ( bUpdate ) - { - ForceUpdate(); - bUpdate = sal_False; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/mkcreate.cxx b/tools/bootstrp/mkcreate.cxx deleted file mode 100644 index f151464772a1..000000000000 --- a/tools/bootstrp/mkcreate.cxx +++ /dev/null @@ -1,910 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -// global includes -#include <stdio.h> - -// local includes -#include "bootstrp/mkcreate.hxx" -#include "bootstrp/inimgr.hxx" -#include "bootstrp/appdef.hxx" -#include <tools/geninfo.hxx> -#include <tools/iparser.hxx> -#include "bootstrp/prj.hxx" - -char const *NoBuildProject[] = { - "solenv", - "EndOf_NoBuildProject" -}; - -char const *LimitedPath[] = { - "jurt\\com\\sun\\star", - "r_tools", - "ridljar", - "setup2", - "connectivity", - "EndOf_LimitedPath" -}; - -// -// class SourceDirectory -// - -/*****************************************************************************/ -SourceDirectory::SourceDirectory( const ByteString &rDirectoryName, - sal_uInt16 nOperatingSystem, SourceDirectory *pParentDirectory ) -/*****************************************************************************/ - : ByteString( rDirectoryName ), - pParent( pParentDirectory ), - pSubDirectories( NULL ), - nOSType( nOperatingSystem ), - nDepth( 0 ), - pDependencies( NULL ), - pCodedDependencies( NULL ), - pCodedIdentifier( NULL ) -{ - if ( pParent ) { - if ( !pParent->pSubDirectories ) - pParent->pSubDirectories = new SourceDirectoryList(); - pParent->pSubDirectories->InsertSorted( this ); - nDepth = pParent->nDepth + 1; - } -} - -/*****************************************************************************/ -SourceDirectory::~SourceDirectory() -/*****************************************************************************/ -{ - delete pSubDirectories; -} - -/*****************************************************************************/ -CodedDependency *SourceDirectory::AddCodedDependency( - const ByteString &rCodedIdentifier, sal_uInt16 nOperatingSystems ) -/*****************************************************************************/ -{ - CodedDependency *pReturn = NULL; - - if ( !pCodedDependencies ) { - pCodedDependencies = new SByteStringList(); - pReturn = new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedDependencies->PutString(( ByteString * ) pReturn ); - } - else { - size_t nPos = pCodedDependencies->IsString( (ByteString*)(&rCodedIdentifier) ); - if ( nPos == NOT_THERE ) { - pReturn = - new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedDependencies->PutString(( ByteString * ) pReturn ); - } - else { - pReturn = ( CodedDependency * ) (*pCodedDependencies)[ nPos ]; - pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems ); - } - } - return pReturn; -} - -/*****************************************************************************/ -CodedDependency *SourceDirectory::AddCodedIdentifier( - const ByteString &rCodedIdentifier, sal_uInt16 nOperatingSystems ) -/*****************************************************************************/ -{ - CodedDependency *pReturn = NULL; - - if ( !pCodedIdentifier ) { - pCodedIdentifier = new SByteStringList(); - pReturn = new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedIdentifier->PutString(( ByteString * ) pReturn ); - } - else { - size_t nPos = pCodedIdentifier->IsString( ( ByteString*)(&rCodedIdentifier) ); - if ( nPos == NOT_THERE ) { - pReturn = - new CodedDependency( rCodedIdentifier, nOperatingSystems ); - pCodedIdentifier->PutString(( ByteString * ) pReturn ); - } - else { - pReturn = ( CodedDependency * ) (*pCodedIdentifier)[ nPos ]; - pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems ); - } - } - if ( pParent && pParent->nDepth > 1 ) - pParent->AddCodedIdentifier( rCodedIdentifier, nOperatingSystems ); - - return pReturn; -} - -/*****************************************************************************/ -ByteString SourceDirectory::GetFullPath() -/*****************************************************************************/ -{ - ByteString sFullPath; - if ( pParent ) { - sFullPath = pParent->GetFullPath(); - sFullPath += ByteString( PATH_SEPARATOR ); - } - sFullPath += *this; - - return sFullPath; -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::GetRootDirectory() -/*****************************************************************************/ -{ - if ( !pParent ) - return this; - - return pParent->GetRootDirectory(); -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::GetSubDirectory( - const ByteString &rDirectoryPath, sal_uInt16 nOperatingSystem ) -/*****************************************************************************/ -{ - ByteString sSearch; - - sal_Bool bSubs = sal_True; - sal_uIntPtr nIndex = 0; - - while ( bSubs && ByteString( LimitedPath[ nIndex ]) != "EndOf_LimitedPath" ) { - SourceDirectory *pActDir = this; - ByteString sLimitation( LimitedPath[ nIndex ]); - - sal_Bool bBreak = sal_False; - for ( sal_uIntPtr i = sLimitation.GetTokenCount( '\\' ); i > 0 && !bBreak; i-- ) { - if (( !pActDir ) || ( *pActDir != sLimitation.GetToken(( sal_uInt16 )( i - 1 ), '\\' ))) - bBreak = sal_True; - else - pActDir = pActDir->pParent; - } - bSubs = bBreak; - nIndex++; - } - - if ( !bSubs ) - { - sSearch = rDirectoryPath; - } - else - sSearch = rDirectoryPath.GetToken( 0, PATH_SEPARATOR ); - - SourceDirectory *pSubDirectory = NULL; - - if ( pSubDirectories ) - pSubDirectory = pSubDirectories->Search( sSearch ); - - if ( !pSubDirectory ) - pSubDirectory = new SourceDirectory( - sSearch, nOperatingSystem, this ); - - pSubDirectory->nOSType |= nOperatingSystem; - - if ( sSearch.Len() == rDirectoryPath.Len()) - return pSubDirectory; - - ByteString sPath = rDirectoryPath.Copy( sSearch.Len() + 1 ); - - return pSubDirectory->GetSubDirectory( sPath, nOperatingSystem ); -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::GetDirectory( - const ByteString &rDirectoryName, sal_uInt16 nOperatingSystem ) -/*****************************************************************************/ -{ - ByteString sDirectoryName( rDirectoryName ); -#ifdef UNX - sDirectoryName.SearchAndReplaceAll( "\\", "/" ); -#endif - - SourceDirectory *pRoot = GetRootDirectory(); - - if ( sDirectoryName.Search( *pRoot ) != 0 ) - return NULL; - - if ( sDirectoryName.Len() == pRoot->Len()) - return pRoot; - - if ( sDirectoryName.GetChar( pRoot->Len()) == PATH_SEPARATOR ) { - ByteString sSub = sDirectoryName.Copy( pRoot->Len() + 1 ); - return pRoot->GetSubDirectory( sSub, nOperatingSystem ); - } - - return NULL; -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::Insert( const ByteString &rDirectoryName, - sal_uInt16 nOperatingSystem ) -/*****************************************************************************/ -{ - SourceDirectory *pSubDirectory = NULL; - if ( pSubDirectories ) - pSubDirectory = pSubDirectories->Search( rDirectoryName ); - - if ( !pSubDirectory ) - pSubDirectory = new SourceDirectory( - rDirectoryName, nOperatingSystem, this ); - - return pSubDirectory; -} - -/*****************************************************************************/ -Dependency *SourceDirectory::ResolvesDependency( - CodedDependency *pCodedDependency ) -/*****************************************************************************/ -{ - if ( !pCodedIdentifier ) - return NULL; - - size_t nPos = pCodedIdentifier->IsString( pCodedDependency ); - if ( nPos != NOT_THERE ) { - CodedDependency *pIdentifier = ( CodedDependency* )(*pCodedIdentifier)[ nPos ]; - sal_uInt16 nResult = - pIdentifier->GetOperatingSystem() & - pCodedDependency->GetOperatingSystem(); - Dependency *pReturn = new Dependency( *this, nResult ); - nResult ^= pCodedDependency->GetOperatingSystem(); - pCodedDependency->SetOperatingSystem( nResult ); - return pReturn; - } - return NULL; -} - - -/*****************************************************************************/ -void SourceDirectory::ResolveDependencies() -/*****************************************************************************/ -{ - if ( !pSubDirectories ) - return; - - for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { - SourceDirectory *pActDirectory = (SourceDirectory*)(*pSubDirectories)[ i ]; - if ( pActDirectory->pSubDirectories ) - pActDirectory->ResolveDependencies(); - - if ( pActDirectory->pCodedDependencies ) { - while ( pActDirectory->pCodedDependencies->size() ) - { - CodedDependency *pCodedDependency = ( CodedDependency * ) - (*pActDirectory->pCodedDependencies)[ 0 ]; - - for ( size_t k = 0; - ( k < pSubDirectories->size() ) - && ( pCodedDependency->GetOperatingSystem() != OS_NONE ); - k++ - ) { - Dependency *pDependency = - ((SourceDirectory *)(*pSubDirectories)[ k ])-> - ResolvesDependency( pCodedDependency ); - if ( pDependency ) - { - if ( !pActDirectory->pDependencies ) - pActDirectory->pDependencies = new SByteStringList(); - pActDirectory->pDependencies->PutString( pDependency ); - } - } - if ( pCodedDependency->GetOperatingSystem()) { - if ( !pCodedDependencies ) - pCodedDependencies = new SByteStringList(); - pCodedDependencies->PutString( pCodedDependency ); - } - else - delete pCodedDependency; - pActDirectory->pCodedDependencies->erase( 0 ); - } - } - } -} - -/*****************************************************************************/ -ByteString SourceDirectory::GetTarget() -/*****************************************************************************/ -{ - ByteString sReturn; - - if ( !pDependencies ) - return sReturn; - - size_t k = 0; - while ( k < pDependencies->size()) { - if ( *this == *(*pDependencies)[ k ] ) - delete pDependencies->erase( k ); - else - k++; - } - - if ( !pDependencies->size() ) { - delete pDependencies; - pDependencies = NULL; - return sReturn; - } - - sal_Bool bDependsOnPlatform = sal_False; - for ( size_t i = 0; i < pDependencies->size(); i++ ) { - if ( ((Dependency*)(*pDependencies)[ i ])->GetOperatingSystem() != OS_ALL ) { - bDependsOnPlatform = sal_True; - break; - } - } - - ByteString sTarget( *this ); - sTarget.SearchAndReplaceAll( "\\", "$/" ); - if ( !bDependsOnPlatform ) { - sReturn = sTarget; - sReturn += " :"; - for ( size_t i = 0; i < pDependencies->size(); i++ ) { - ByteString sDependency( *(*pDependencies)[ i ] ); - sDependency.SearchAndReplaceAll( "\\", "$/" ); - sReturn += " "; - sReturn += sDependency; - } - } - else { - ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" ); - sUNX += sTarget; - sUNX += " :"; - sal_Bool bUNX = sal_False; - - ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" ); - sWNT += sTarget; - sWNT += " :"; - sal_Bool bWNT = sal_False; - - ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" ); - sOS2 += sTarget; - sOS2 += " :"; - sal_Bool bOS2 = sal_False; - - for ( size_t i = 0; i < pDependencies->size(); i++ ) { - Dependency *pDependency = (Dependency*)(*pDependencies)[ i ]; - ByteString sDependency( *pDependency ); - sDependency.SearchAndReplaceAll( "\\", "$/" ); - - if ( pDependency->GetOperatingSystem() & OS_UNX ) { - sUNX += " "; - sUNX += sDependency; - bUNX = sal_True; - } - if ( pDependency->GetOperatingSystem() & OS_WIN32 ) { - sWNT += " "; - sWNT += sDependency; - bWNT = sal_True; - } - if ( pDependency->GetOperatingSystem() & OS_OS2 ) { - sOS2 += " "; - sOS2 += sDependency; - bOS2 = sal_True; - } - } - - if ( bUNX ) { - sReturn += sUNX; - sReturn += "\n.ENDIF\n"; - } - if ( bWNT ) { - sReturn += sWNT; - sReturn += "\n.ENDIF\n"; - } - if ( bOS2 ) { - sReturn += sOS2; - sReturn += "\n.ENDIF\n"; - } - } - sReturn.EraseTrailingChars( '\n' ); - return sReturn; -} - -/*****************************************************************************/ -ByteString SourceDirectory::GetSubDirsTarget() -/*****************************************************************************/ -{ - ByteString sReturn; - - if ( pSubDirectories ) { - sal_Bool bDependsOnPlatform = sal_False; - for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { - if ( ((SourceDirectory*)(*pSubDirectories)[ i ])->GetOperatingSystems() != OS_ALL ) { - bDependsOnPlatform = sal_True; - } - } - - if ( !bDependsOnPlatform ) { - sReturn = "RC_SUBDIRS = "; - - for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { - ByteString sSubDirectory( *(*pSubDirectories)[ i ] ); - sSubDirectory.SearchAndReplaceAll( "\\", "$/" ); - sReturn += " \\\n\t"; - sReturn += sSubDirectory; - } - sReturn += "\n"; - } - else { - ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" ); - sUNX += "RC_SUBDIRS = "; - sal_Bool bUNX = sal_False; - - ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" ); - sWNT += "RC_SUBDIRS = "; - sal_Bool bWNT = sal_False; - - ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" ); - sOS2 += "RC_SUBDIRS = "; - sal_Bool bOS2 = sal_False; - - for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { - SourceDirectory *pDirectory = (SourceDirectory*)(*pSubDirectories)[ i ]; - ByteString sDirectory( *pDirectory ); - sDirectory.SearchAndReplaceAll( "\\", "$/" ); - - if ( pDirectory->GetOperatingSystems() & OS_UNX ) { - sUNX += " \\\n\t"; - sUNX += sDirectory; - bUNX = sal_True; - } - if ( pDirectory->GetOperatingSystems() & OS_WIN32 ) { - sWNT += " \\\n\t"; - sWNT += sDirectory; - bWNT = sal_True; - } - if ( pDirectory->GetOperatingSystems() & OS_OS2 ) { - sOS2 += " \\\n\t"; - sOS2 += sDirectory; - bOS2 = sal_True; - } - } - if ( bUNX ) { - sReturn += sUNX; - sReturn += "\n.ENDIF\n"; - } - if ( bWNT ) { - sReturn += sWNT; - sReturn += "\n.ENDIF\n"; - } - if ( bOS2 ) { - sReturn += sOS2; - sReturn += "\n.ENDIF\n"; - } - } - } - return sReturn; -} - -/*****************************************************************************/ -sal_uInt16 SourceDirectory::GetOSType( const ByteString &sDependExt ) -/*****************************************************************************/ -{ - sal_uInt16 nOSType = 0; - if ( sDependExt == "" ) - nOSType |= OS_ALL; - else if ( sDependExt == "N" || sDependExt == "W" ) - nOSType |= OS_WIN32; - else if ( sDependExt == "U" ) - nOSType |= OS_UNX; - else if ( sDependExt == "P" ) - nOSType |= OS_OS2; - return nOSType; -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectory::CreateRootDirectory( - const ByteString &rRoot, const ByteString &rVersion, sal_Bool bAll ) -/*****************************************************************************/ -{ - IniManager aIniManager; - aIniManager.Update(); - - ByteString sDefLst( GetDefStandList()); - ByteString sStandLst( aIniManager.ToLocal( sDefLst )); - String s = String( sStandLst, gsl_getSystemTextEncoding()); - InformationParser aParser; - GenericInformationList *pVerList = aParser.Execute( s ); - - ByteString sVersion( rVersion ); - Star aStar( pVerList, sVersion, sal_True, rRoot.GetBuffer()); - - SourceDirectory *pSourceRoot = new SourceDirectory( rRoot, OS_ALL ); - - for ( sal_uIntPtr i = 0; i < aStar.Count(); i++ ) { - Prj *pPrj = aStar.GetObject( i ); - - sal_Bool bBuildable = sal_True; - sal_uIntPtr nIndex = 0; - - while ( bBuildable && ByteString( NoBuildProject[ nIndex ]) != "EndOf_NoBuildProject" ) { - bBuildable = ( ByteString( NoBuildProject[ nIndex ]) != pPrj->GetProjectName()); - nIndex ++; - } - - if ( bBuildable ) { - SourceDirectory *pProject = pSourceRoot->Insert( pPrj->GetProjectName(), OS_ALL ); - - SByteStringList *pPrjDependencies = pPrj->GetDependencies( sal_False ); - if ( pPrjDependencies ) - for ( size_t x = 0; x < pPrjDependencies->size(); x++ ) - pProject->AddCodedDependency( *(*pPrjDependencies)[ x ], OS_ALL ); - - pProject->AddCodedIdentifier( pPrj->GetProjectName(), OS_ALL ); - - for ( sal_uIntPtr j = 0; j < pPrj->Count(); j++ ) { - CommandData *pData = pPrj->GetObject( j ); - if ( bAll || ( pData->GetCommandType() == COMMAND_NMAKE )) { - ByteString sDirPath( rRoot ); - sDirPath += ByteString( PATH_SEPARATOR ); - sDirPath += pData->GetPath(); - SourceDirectory *pDirectory = - pSourceRoot->InsertFull( sDirPath, pData->GetOSType()); - SByteStringList *pDependencies = pData->GetDependencies(); - if ( pDependencies ) { - for ( size_t k = 0; k < pDependencies->size(); k++ ) { - ByteString sDependency( *(*pDependencies)[ k ] ); - ByteString sDependExt(sDependency.GetToken( 1, '.' )); - sDependExt.ToUpperAscii(); - pDirectory->AddCodedDependency( - sDependency.GetToken( 0, '.' ), GetOSType( sDependExt )); - } - } - ByteString sIdentifier = pData->GetLogFile(); - ByteString sIdExt = sIdentifier.GetToken( 1, '.' ); - sIdExt.ToUpperAscii(); - pDirectory->AddCodedIdentifier( sIdentifier.GetToken( 0, '.' ), GetOSType( sIdExt )); - } - } - } - } - delete pVerList; - return pSourceRoot; -} - -/*****************************************************************************/ -sal_Bool SourceDirectory::RemoveDirectoryTreeAndAllDependencies() -/*****************************************************************************/ -{ - if ( !pParent ) - return sal_False; - - SourceDirectoryList *pParentContent = pParent->pSubDirectories; - size_t i = 0; - while ( i < pParentContent->size() ) { - SourceDirectory *pCandidate = (SourceDirectory*)(*pParentContent)[ i ]; - if ( pCandidate == this ) { - pParentContent->erase( i ); - } - else { - if ( pCandidate->pDependencies ) { - size_t nPos = pCandidate->pDependencies->IsString( this ); - if ( nPos != NOT_THERE ) - delete pCandidate->pDependencies->erase( nPos ); - } - i++; - } - } - delete this; - return sal_True; -} - -/*****************************************************************************/ -sal_Bool SourceDirectory::CreateRecursiveMakefile( sal_Bool bAllChilds ) -/*****************************************************************************/ -{ - if ( !pSubDirectories ) - return sal_True; - - fprintf( stdout, "%s", GetFullPath().GetBuffer()); - - String aTmpStr( GetFullPath(), gsl_getSystemTextEncoding()); - DirEntry aEntry( aTmpStr ); - if ( !aEntry.Exists()) { - fprintf( stdout, " ... no directory!\n" ); - return sal_False; - } - - size_t j = 0; - while( j < pSubDirectories->size()) { - String sSubDirectory( - ((SourceDirectory*)(*pSubDirectories)[ j ])->GetFullPath(), - gsl_getSystemTextEncoding() - ); - DirEntry aSubDirectory( sSubDirectory ); - if ( !aSubDirectory.Exists() ) - ((SourceDirectory*)(*pSubDirectories)[ j ])->RemoveDirectoryTreeAndAllDependencies(); - else - j++; - } - - DirEntry aRCFile( String( "makefile.rc", gsl_getSystemTextEncoding())); - DirEntry aRCEntry( aEntry ); - aRCEntry += aRCFile; - - DirEntry aMKFile( String( "makefile.mk", gsl_getSystemTextEncoding())); - DirEntry aMKEntry( aEntry ); - aMKEntry += aMKFile; - - sal_Bool bMakefileMk = sal_False; - if ( aMKEntry.Exists()) { - if ( nDepth == 1 && *this == ByteString( "api" )) - fprintf( stdout, " ... makefile.mk exists, ignoring (hack: prj == api)!" ); - else { - fprintf( stdout, " ... makefile.mk exists, including!" ); - bMakefileMk = sal_True; - } - } - - SvFileStream aMakefile( aRCEntry.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC ); - if ( !aMakefile.IsOpen()) { - fprintf( stdout, " ... failed!\n" ); - return sal_False; - } - - ByteString sHeader( - "#*************************************************************************\n" - "#\n" - "# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" - "#\n" - "# Copyright 2000, 2010 Oracle and/or its affiliates.\n" - "#\n" - "# OpenOffice.org - a multi-platform office productivity suite\n" - "#\n" - "# This file is part of OpenOffice.org.\n" - "#\n" - "# OpenOffice.org is free software: you can redistribute it and/or modify\n" - "# it under the terms of the GNU Lesser General Public License version 3\n" - "# only, as published by the Free Software Foundation.\n" - "#\n" - "# OpenOffice.org is distributed in the hope that it will be useful,\n" - "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "# GNU Lesser General Public License version 3 for more details\n" - "# (a copy is included in the LICENSE file that accompanied this code).\n" - "#\n" - "# You should have received a copy of the GNU Lesser General Public License\n" - "# version 3 along with OpenOffice.org. If not, see\n" - "# <http://www.openoffice.org/license.html>\n" - "# for a copy of the LGPLv3 License.\n" - "#\n" - "#*************************************************************************\n" - "\n" - ); - if ( !bMakefileMk ) { - if ( nDepth == 0 ) { - sHeader += ByteString( - "\n" - "# \n" - "# mark this makefile as a recursive one\n" - "# \n" - "\n" - "MAKEFILERC=yes\n" - "\n" - "# \n" - "# implementation of cvs checkout\n" - "# \n" - "\n" - ".IF \"$(checkout)\"==\"\"\n" - "all_target: ALLTAR\n" - ".ELSE\t# \"$(checkout)\"==\"\"\n" - ".IF \"$(checkout)\"==\"true\"\n" - "% : $(NULL)\n" - "\t_cvs co $@\n" - ".ELSE\t# \"$(checkout)\"==\"true\"\n" - "% : $(NULL)\n" - "\t_cvs co -r$(checkout) $@\n" - ".ENDIF\t# \"$(checkout)\"==\"true\"\n" - "all_subdirs : $(RC_SUBDIRS)\n" - ".ENDIF\t# \"$(checkout)\"==\"\"\n" - ); - } - else { - sHeader += ByteString( - "\n" - "# \n" - "# mark this makefile as a recursive one\n" - "# \n" - "\n" - "MAKEFILERC=yes\n" - ); - if ( nDepth == 1 ) - sHeader += ByteString( - ".IF \"$(build_deliver)\"==\"true\"\n" - "all_target:\t\t\\\n" - "\tTG_DELIVER\t\\\n" - "\tALLTAR\n" - ".ELSE # \"$(build_deliver)\"==\"true\"\n" - "all_target: ALLTAR\n" - ".ENDIF # \"$(build_deliver)\"==\"true\"\n" - ); - else - sHeader += ByteString( - "all_target: ALLTAR\n" - ); - } - } - else { - if ( nDepth == 1 ) - sHeader += ByteString( - ".IF \"$(build_deliver)\"==\"true\"\n" - "all_target:\t\t\\\n" - "\tTG_DELIVER\t\\\n" - "\tALLTAR\n" - ".ELSE # \"$(build_deliver)\"==\"true\"\n" - "all_target: ALLTAR\n" - ".ENDIF # \"$(build_deliver)\"==\"true\"\n" - ); - } - sHeader += ByteString( - "\n" - "# \n" - "# macro RC_SUBDIRS handles iteration over\n" - "# all mandatory sub directories\n" - "# \n" - ); - - aMakefile.WriteLine( sHeader ); - aMakefile.WriteLine( GetSubDirsTarget()); - - if ( nDepth == 0 ) { - ByteString sBootstrapTarget( - "# \n" - "# bootstrap target\n" - "# \n\n" - "bootstrap .PHONY :\n" - "\t@config_office/bootstrap\n\n" - ); - aMakefile.WriteLine( sBootstrapTarget ); - ByteString sConfigureTarget( - "# \n" - "# configure target\n" - "# \n\n" - "configure .PHONY SETDIR=config_office :\n" - "\t@configure\n" - ); - aMakefile.WriteLine( sConfigureTarget ); - } - else if ( nDepth == 1 ) { - ByteString sDeliverTarget( - "# \n" - "# deliver target to handle\n" - "# project dependencies\n" - "# \n\n" - "TG_DELIVER : $(RC_SUBDIRS)\n" - "\t$(DELIVER)\n" - ); - aMakefile.WriteLine( sDeliverTarget ); - } - - if ( bMakefileMk ) { - ByteString sInclude( - "# \n" - "# local makefile\n" - "# \n" - "\n" - ".INCLUDE : makefile.mk\n" - ); - - if ( nDepth != 1 ) - sInclude += ByteString( - "\n" - "all_rc_target: ALLTAR\n" - ); - - aMakefile.WriteLine( sInclude ); - } - - ByteString sComment( - "# \n" - "# single directory targets for\n" - "# dependency handling between directories\n" - "# \n" - ); - aMakefile.WriteLine( sComment ); - - for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { - ByteString sTarget( ((SourceDirectory*)(*pSubDirectories)[ i ])->GetTarget() ); - if ( sTarget.Len()) - aMakefile.WriteLine( sTarget ); - } - - ByteString sFooter( - "\n" - ); - if ( !bMakefileMk ) { - sFooter += ByteString( - "# \n" - "# central target makefile\n" - "# \n" - "\n" - ); - if ( nDepth != 0 ) { - sFooter += ByteString( - ".INCLUDE : target.mk\n" - ); - } - else { - sFooter += ByteString( - ".IF \"$(checkout)\"==\"\"\n" - ".INCLUDE : target.mk\n" - ".ENDIF\t#\"$(checkout)\"==\"\"\n" - ); - } - } - sFooter += ByteString( - "\n" - "#*************************************************************************\n" - ); - aMakefile.WriteLine( sFooter ); - - aMakefile.Close(); - - fprintf( stdout, "\n" ); - - sal_Bool bSuccess = sal_True; - if ( bAllChilds ) { - for ( size_t k = 0; k < pSubDirectories->size(); k++ ) { - if ( !((SourceDirectory*)(*pSubDirectories)[ k ])->CreateRecursiveMakefile( TRUE ) ) { - bSuccess = sal_False; - break; - } - } - } - - return bSuccess; -} - -// -// class SourceDirectoryList -// - -/*****************************************************************************/ -SourceDirectoryList::~SourceDirectoryList() -/*****************************************************************************/ -{ - for ( size_t i = 0; i < size(); i++ ) - delete at( i ); -} - -/*****************************************************************************/ -SourceDirectory *SourceDirectoryList::Search( - const ByteString &rDirectoryName ) -/*****************************************************************************/ -{ - size_t nPos = IsString( ( ByteString * ) (&rDirectoryName) ); - if ( nPos != LIST_ENTRY_NOTFOUND ) - return ( SourceDirectory * ) at( nPos ); - - return NULL; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/addexes2/mkfilt.cxx b/tools/bootstrp/mkunroll/mkunroll.cxx index b454f901de5b..ff958ba8e717 100644 --- a/tools/bootstrp/addexes2/mkfilt.cxx +++ b/tools/bootstrp/mkunroll/mkunroll.cxx @@ -125,7 +125,7 @@ MkFilter::MkFilter( ByteString aInFile, ByteString aOutFile ) : MkFilter::~MkFilter() { - for ( size_t i = 0, n = pLst->size(); i < n; ++i ) { + for ( size_t i = 0, n = pTnrLst->size(); i < n; ++i ) { delete (*pTnrLst)[ i ]; } delete pTnrLst; @@ -157,14 +157,12 @@ void MkFilter::Filter() fprintf( stderr, "\nunroll begin\n" ); nState = 1; } - ; if ( nState == 0 ) { fprintf( stderr, "." ); MkLine *pMkLine = new MkLine(); - ByteString *pStr = new ByteString( aLineBuf ); - pMkLine->aLine = *pStr; + pMkLine->aLine = aLineBuf; pMkLine->bOut = sal_False; pLst->push_back( pMkLine ); @@ -179,8 +177,7 @@ void MkFilter::Filter() fprintf( stderr, ";\nunroll end\n" ); MkLine *p_MkLine = new MkLine(); p_MkLine->bHier = sal_True; - ByteString *pByteString = new ByteString("# do not delete this line === mkfilter3i\n"); - p_MkLine->aLine = *pByteString; + p_MkLine->aLine = ByteString("# do not delete this line === mkfilter3i\n"); p_MkLine->bOut = sal_False; p_MkLine->pPrivateTnrLst = pTnrLst; pTnrLst = new ByteStringList(); @@ -188,8 +185,7 @@ void MkFilter::Filter() nState = 0; bInTnrList = sal_False; } - ByteString *pStr = new ByteString( aLineBuf ); - pMkLine->aLine = *pStr; + pMkLine->aLine = ByteString( aLineBuf ); pMkLine->bOut = sal_False; if ( bInTnrList ) diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index e669787238b2..015d8855caad 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -30,15 +30,13 @@ #include "precompiled_tools.hxx" #include <stdlib.h> #include <stdio.h> -//#include "bootstrp/sstring.hxx" #include <osl/mutex.hxx> #include <tools/stream.hxx> #include <tools/geninfo.hxx> #include "bootstrp/prj.hxx" -#include "bootstrp/inimgr.hxx" -#if defined(WNT) || defined(OS2) +#if defined(WNT) #define LIST_DELIMETER ';' #define PATH_DELIMETER '\\' #elif defined UNX diff --git a/tools/bootstrp/sspretty.cxx b/tools/bootstrp/sspretty.cxx deleted file mode 100644 index e4ab7df062a0..000000000000 --- a/tools/bootstrp/sspretty.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" -#include <tools/iparser.hxx> -#include <tools/geninfo.hxx> -#include <stdio.h> - - -/*****************************************************************************/ -#ifdef UNX -int main( int argc, char *argv[] ) -#else -int _cdecl main( int argc, char *argv[] ) -#endif -/*****************************************************************************/ -{ - if ( argc != 2 ) { - fprintf( stdout, "\nsspretty.exe v1.0 (c) 2001\n\n" ); - fprintf( stdout, "Syntax: sspretty filename\n" ); - } - else { - String aFileName( argv[ 1 ], RTL_TEXTENCODING_ASCII_US ); - InformationParser aParser; - GenericInformationList *pList = aParser.Execute( aFileName ); - if ( pList ) - aParser.Save( aFileName, pList ); - else { - fprintf( stderr, "Error reading input file!\n" ); - return 1; - } - } - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/bootstrp/appdef.hxx b/tools/inc/bootstrp/appdef.hxx index 0444478f30ee..833cd404847f 100644 --- a/tools/inc/bootstrp/appdef.hxx +++ b/tools/inc/bootstrp/appdef.hxx @@ -31,36 +31,14 @@ #ifdef UNX -#define DEFAULT_INI_ROOT "/so/env" -#define DEFAULT_BS_ROOT "/so/env/b_server" #define PATH_SEPARATOR '/' #define S_PATH_SEPARATOR "/" #else -#define DEFAULT_INI_ROOT "r:" -#define DEFAULT_BS_ROOT "n:" #define PATH_SEPARATOR '\\' #define S_PATH_SEPARATOR "\\" #endif -#define _INI_DRV DEFAULT_INI_ROOT -#define B_SERVER_ROOT DEFAULT_BS_ROOT -#define _SOLARLIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "solar.lst" -#define _DEF_STAND_LIST B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "stand.lst" -#define _DEF_SSOLARINI B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "ssolar.ini" -#define _DEF_SSCOMMON B_SERVER_ROOT S_PATH_SEPARATOR "config" S_PATH_SEPARATOR "ssolar.cmn" -#define _INIROOT B_SERVER_ROOT S_PATH_SEPARATOR "config" -#define _INIROOT_OLD B_SERVER_ROOT S_PATH_SEPARATOR "config" -#define _INI_UNC "\\\\jumbo2.germany.sun.com\\R-Laufwerk" -#define _INI_UNC_OLD "\\\\jumbo2.germany.sun.com\\R-Laufwerk" - - // path conversion -const char* GetDefStandList(); -const char* GetIniRoot(); -const char* GetIniRootOld(); -const char* GetSSolarIni(); -const char* GetSSCommon(); -const char* GetBServerRoot(); const char* GetEnv( const char *pVar ); const char* GetEnv( const char *pVar, const char *pDefault ); diff --git a/tools/inc/bootstrp/inimgr.hxx b/tools/inc/bootstrp/inimgr.hxx deleted file mode 100644 index 016eee7bcb76..000000000000 --- a/tools/inc/bootstrp/inimgr.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _INIMGR_HXX -#define _INIMGR_HXX - -#include <tools/fsys.hxx> -#include <tools/string.hxx> - -/***************************************************************************** -Purpose: Allows to work on a local set of initialisation files -If Update is used, the user must ensure that only one set of -Source and Destination Dir is used. Otherwise ForceUpdate has to be used -*****************************************************************************/ - -class IniManager -{ -private: - sal_Bool bUpdate; - - ByteString sGlobalDir; /// holds the org. ini dir - ByteString sLocalPath; /// holds path of local ini dir - -public: - IniManager( ByteString &rDir, ByteString &rLocalDir ); - IniManager( ByteString &rDir ); - IniManager(); - - ByteString ToLocal( ByteString &rPath ); - void Update(); /// Call ForceUpdate the First Time called - void ForceUpdate(); - - static ByteString GetLocalIni(); - static ByteString GetGlobalIni(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/bootstrp/mkcreate.hxx b/tools/inc/bootstrp/mkcreate.hxx deleted file mode 100644 index aa2e8f4acddf..000000000000 --- a/tools/inc/bootstrp/mkcreate.hxx +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MK_CREATE_HXX -#define _MK_CREATE_HXX - -#include <tools/string.hxx> -//#include "bootstrp/sstring.hxx" - -#include "bootstrp/prj.hxx" - -class SvStream; -class SourceDirectoryList; - -// -// class SourceDirectoryDependency -// - -class CodedDependency : public ByteString -{ -private: - sal_uInt16 nOSType; // operating systems where dependeny exists - -public: - /* create a dependency instance with given coded directory name - */ - CodedDependency( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ) : - ByteString( rCodedIdentifier ), - nOSType( nOperatingSystems ) - { - } - - /* returns the operating system - */ - sal_uInt16 GetOperatingSystem() - { - return nOSType; - } - - /* set operating system - */ - void SetOperatingSystem( sal_uInt16 nOperatingSystems ) - { - nOSType = nOperatingSystems; - } - - /* add operating systems if same dependency - */ - sal_Bool TryToMerge( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ) - { - if ( rCodedIdentifier != *this ) - return sal_False; - nOSType |= nOperatingSystems; - return sal_True; - } -}; - -// -// class Dependecy -// - -class Dependency : public ByteString -{ -private: - sal_uInt16 nOSType; // operating systems where dependecy exists - -public: - /* create a dependency instance with given directory name - */ - Dependency( - const ByteString &rDirectoryName, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ) : - ByteString( rDirectoryName ), - nOSType( nOperatingSystems ) - { - } - - /* returns the operating system - */ - sal_uInt16 GetOperatingSystem() - { - return nOSType; - } -}; - -// -// class SourceDirectory -// - -class SourceDirectory : public ByteString -{ -private: - SourceDirectory *pParent; // the parent directory - SourceDirectoryList *pSubDirectories; // list of sub directories - sal_uInt16 nOSType; // operating systems where this directory is used - sal_uInt16 nDepth; // depth of directory structure (root is 0) - - SByteStringList *pDependencies; // dependencies on other directories in this depth - - SByteStringList *pCodedDependencies; // dependencies on other directories in different depth - SByteStringList *pCodedIdentifier; // symbolic identifier to resolve dependencies - - /* try to resolve a single dependency - */ - Dependency *ResolvesDependency( - CodedDependency *pCodedDependency // the dependency - ); - - /* returns the operating systems of a coded dependency - */ - static sal_uInt16 GetOSType( - const ByteString &sDependExt // the corresponding dependency extension (see also prj.hxx) - ); - - /* removes this and all sub directories with all dependencies - */ - sal_Bool RemoveDirectoryTreeAndAllDependencies(); - -public: - - /* create a directory instance with given parent and name, no parent means this is the root - * (not the file system root but the root of the source tree, e.g. o:\569) - */ - SourceDirectory( - const ByteString &rDirectoryName, // name without parent - sal_uInt16 nOperatingSystem, // the operating systems where this directory is used - SourceDirectory *pParentDirectory = NULL // parent (if not root) - ); - ~SourceDirectory(); - - /* returns the full absolute path of this directory - */ - ByteString GetFullPath(); - - /* returns a list of all sub directories - */ - SourceDirectoryList *GetSubDirectories() { return pSubDirectories; } - - /* returns the Operating systems where this directory is used - */ - sal_uInt16 GetOperatingSystems() { return nOSType; } - - /* returns the given directory - */ - SourceDirectory *GetDirectory( - const ByteString &rDirectoryName, // full path - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ); - - /* create the directory and all mandatory parents - */ - SourceDirectory *InsertFull( - const ByteString &rDirectoryName, // full path - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ) - { - return GetDirectory( rDirectoryName, nOperatingSystem ); - } - - /* create the directory as sub directory of this directory - */ - SourceDirectory *Insert( - const ByteString &rDirectoryName, // name without parent - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ); - - /* get the root directory - */ - SourceDirectory *GetRootDirectory(); - - /* get sub directory if exists - */ - SourceDirectory *GetSubDirectory( - const ByteString &rDirectoryPath, // full sub path - sal_uInt16 nOperatingSystem // the operating systems where this directory is used - ); - - /* add a dependency for several platforms - */ - CodedDependency *AddCodedDependency( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ); - - /* returns the dependency list - */ - SByteStringList *GetCodedDependencies() - { - return pCodedDependencies; - } - - /* add symbolic identifier to resolve dependencies (to this directory and all parents) - */ - CodedDependency *AddCodedIdentifier( - const ByteString &rCodedIdentifier, // the coded name of the directory - sal_uInt16 nOperatingSystems // the operating systems where this dependency exists - ); - - /* returns the identifier list - */ - SByteStringList *GetCodedIdentifier() - { - return pCodedIdentifier; - } - - /* create dependencies on other directory, coded dependecies are used - */ - void ResolveDependencies(); - - /* returns the target definition for this directory (if dependencies exist) - */ - ByteString GetTarget(); - - /* returns the target definition for all sub directory - */ - ByteString GetSubDirsTarget(); - - /* create the full directory tree (only virtual, not in file system) - */ - static SourceDirectory *CreateRootDirectory( - const ByteString &rRoot, // the root directory in file system - const ByteString &rVersion, // the solar verion (r.g. SRC590, SRC591 etc.) - sal_Bool bAll = sal_False // add all directories or only buildable ones - ); - - /* create the makefile.rc in file system - */ - sal_Bool CreateRecursiveMakefile( - sal_Bool bAllChilds = sal_False // create rcursive for all sub directories - ); -}; - -// -// class SourceDirectoryList -// - -class SourceDirectoryList : public SByteStringList -{ -public: - /* create a empty directory list - */ - SourceDirectoryList() - { - } - ~SourceDirectoryList(); - - /* search for a directory by directory name - */ - SourceDirectory *Search( - const ByteString &rDirectoryName // name without parent - ); - - /* insert a new directory - */ - size_t InsertSorted( - SourceDirectory *pDirectory // directory - ) - { - return PutString(( ByteString * ) pDirectory ); - } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx index a75319d89677..ecd5f83b688c 100644 --- a/tools/inc/tools/color.hxx +++ b/tools/inc/tools/color.hxx @@ -177,10 +177,14 @@ public: 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 )); } + // the range for cymk is 0 to 1.0 + static ColorData CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ); + void RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ); + + 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 ); diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx index b0854f58daa5..440d3aeaeabb 100644 --- a/tools/inc/tools/fsys.hxx +++ b/tools/inc/tools/fsys.hxx @@ -114,21 +114,10 @@ enum DirEntryFlag enum FSysPathStyle { FSYS_STYLE_HOST, - FSYS_STYLE_FAT, - FSYS_STYLE_MSDOS = FSYS_STYLE_FAT, - FSYS_STYLE_VFAT, - FSYS_STYLE_WIN95 = FSYS_STYLE_VFAT, - FSYS_STYLE_HPFS, - FSYS_STYLE_OS2 = FSYS_STYLE_HPFS, FSYS_STYLE_NTFS, - FSYS_STYLE_NWFS, - FSYS_STYLE_SYSV, FSYS_STYLE_BSD, FSYS_STYLE_UNX = FSYS_STYLE_BSD, - FSYS_STYLE_MAC, FSYS_STYLE_DETECT, - FSYS_STYLE_UNKNOWN, - FSYS_STYLE_URL }; // FSysAction @@ -223,10 +212,8 @@ public: Time TimeAccessed() const { return aTimeAccessed; } sal_Bool IsYounger( const FileStat& rIsOlder ) const; -#define TF_FSYS_READONLY_FLAG static sal_uIntPtr SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO = sal_True ); static sal_Bool GetReadOnlyFlag( const DirEntry &rEntry ); - static sal_Bool HasReadOnlyFlag(); static ErrCode QueryDiskSpace( const String &rPath, BigInt &rFreeBytes, BigInt &rTotalBytes ); @@ -273,7 +260,6 @@ private: FSysPathStyle eStyle ); TOOLS_DLLPRIVATE const DirEntry* ImpGetTopPtr() const; TOOLS_DLLPRIVATE DirEntry* ImpGetTopPtr(); - TOOLS_DLLPRIVATE sal_Bool ImpToRel( String aStart ); protected: void ImpTrim( FSysPathStyle eStyle ); @@ -298,9 +284,6 @@ public: FSysPathStyle eParser = FSYS_STYLE_HOST ); ~DirEntry(); - sal_Bool IsLongNameOnFAT() const; - sal_Bool IsCaseSensitive (FSysPathStyle eFormatter = FSYS_STYLE_HOST) const; - sal_uIntPtr GetError() const { return nError; } sal_Bool IsValid() const; DirEntryFlag GetFlag() const { return eFlag; }; @@ -331,9 +314,6 @@ public: bool IsAbs() const; sal_Bool ToAbs(); sal_Bool Find( const String& rPfad, char cDelim = 0 ); - sal_Bool ToRel(); - sal_Bool ToRel( const DirEntry& rRefDir ); - sal_uInt16 CutRelParents(); sal_Bool SetCWD( sal_Bool bSloppy = sal_False ) const; sal_Bool MakeDir( sal_Bool bSloppy = sal_False ) const; @@ -368,11 +348,7 @@ public: static String GetAccessDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); static String GetSearchDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); - static sal_uInt16 GetMaxNameLen( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); static FSysPathStyle GetPathStyle( const String &rDevice ); - static String ConvertNameToSystem( const String & rName ); - static String ConvertSystemToName( const String & rName ); - static sal_Bool IsRFSAvailable(); }; // -------------- diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index 6bb133d8c32e..f53dba883e1a 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -140,17 +140,10 @@ public: Point& operator *= ( const long nVal ); Point& operator /= ( const long nVal ); -#ifdef __BORLANDC__ - friend Point operator+( const Point &rVal1, const Point &rVal2 ); - friend Point operator-( const Point &rVal1, const Point &rVal2 ); - friend Point operator*( const Point &rVal1, const long nVal2 ); - friend Point operator/( const Point &rVal1, const long nVal2 ); -#else 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 ); -#endif long getX() const { return X(); } long getY() const { return Y(); } @@ -449,13 +442,8 @@ public: Rectangle& operator += ( const Point& rPt ); Rectangle& operator -= ( const Point& rPt ); -#ifdef __BORLANDC__ - friend Rectangle operator + ( const Rectangle& rRect, const Point& rPt ); - friend Rectangle operator - ( const Rectangle& rRect, const Point& rPt ); -#else friend inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt ); friend inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ); -#endif TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Rectangle& rRect ); TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect ); diff --git a/tools/inc/tools/geninfo.hxx b/tools/inc/tools/geninfo.hxx index 9501ac771a83..b173d9996b76 100644 --- a/tools/inc/tools/geninfo.hxx +++ b/tools/inc/tools/geninfo.hxx @@ -104,7 +104,6 @@ GenericLockInformation( const ByteString &rKey, const ByteString &rValue, GenericInformationList *pSubInfos = NULL ) : GenericInformation( rKey, rValue, pParentList, pSubInfos), aLockState( read ), nLockKey( 0 ) {}; - //~GenericLockInformation(); /* bietet einen Lockmechanismus fuer exclusive Zugriffe * @@ -174,7 +173,6 @@ GenericLockInformation( const ByteString &rKey, const ByteString &rValue, return NULL; return GenericInformation::GetSubInfo(rKey, bSearchByPath, bCreatePath); } - // TYPEINFO(); private: LockState aLockState; diff --git a/tools/inc/tools/inetdef.hxx b/tools/inc/tools/inetdef.hxx index 91636d8dc718..f3420b8ff50e 100644 --- a/tools/inc/tools/inetdef.hxx +++ b/tools/inc/tools/inetdef.hxx @@ -32,8 +32,6 @@ //============================================================================ #if defined WNT #define TOOLS_INETDEF_OS "Win32" -#elif defined OS2 -#define TOOLS_INETDEF_OS "OS/2" #elif defined UNX #if defined AIX #define TOOLS_INETDEF_OS "AIX" diff --git a/tools/inc/tools/iparser.hxx b/tools/inc/tools/iparser.hxx index 23f0a1b68534..7df999d1fbb0 100644 --- a/tools/inc/tools/iparser.hxx +++ b/tools/inc/tools/iparser.hxx @@ -66,8 +66,6 @@ key [value] */ -#define DEF_STAND_LST "\\\\dev4\\data1\\b_server\\config\\stand.lst" - // error codes: #define IP_NO_ERROR 0x0000 diff --git a/tools/inc/tools/ownlist.hxx b/tools/inc/tools/ownlist.hxx deleted file mode 100644 index 715734f162f6..000000000000 --- a/tools/inc/tools/ownlist.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TOOLS_OWNLIST_HXX -#define _TOOLS_OWNLIST_HXX - -#include <tools/list.hxx> -/************************************************************************* -*************************************************************************/ - -#define PRV_SV_DECL_OWNER_LIST(ClassName,Type) \ - List aTypes; \ -public: \ - ClassName( sal_uInt16 nInitSize = 16, \ - sal_uInt16 nReSize = 16 ) \ - : aTypes( nInitSize, nReSize ) {} \ - ClassName( const ClassName & rObj ) \ - { *this = rObj; } \ - ClassName & operator = ( const ClassName & ); \ - ~ClassName() \ - { Clear(); } \ - void Clear(); \ - void Remove() \ - { delete (Type *)aTypes.Remove(); } \ - void Remove( Type * pObj ) \ - { delete (Type *)aTypes.Remove( pObj ); } \ - void Remove( sal_uIntPtr nPos ) \ - { delete (Type *)aTypes.Remove( nPos ); } \ - Type & Insert( const Type &, sal_uIntPtr nPos ); \ - Type & Insert( const Type & rType ) \ - { return Insert( rType, aTypes.GetCurPos() ); } \ - Type & Append( const Type & rType ) \ - { return Insert( rType, LIST_APPEND ); } \ - Type & GetObject( sal_uIntPtr nPos ) const \ - { return *(Type *)aTypes.GetObject( nPos ); } \ - Type & operator []( sal_uIntPtr nPos ) const \ - { return *(Type *)aTypes.GetObject( nPos ); } \ - sal_uIntPtr Count() const { return aTypes.Count(); } - -#define PRV_SV_IMPL_OWNER_LIST(ClassName,Type) \ -ClassName & ClassName::operator = ( const ClassName & rObj ) \ -{ \ - if( this != &rObj ) \ - { \ - Clear(); \ - for( sal_uIntPtr i = 0; i < rObj.Count(); i++ ) \ - Append( rObj.GetObject( i ) ); \ - } \ - return *this; \ -} \ -void ClassName::Clear() \ -{ \ - Type * p = (Type *)aTypes.First(); \ - while( p ) \ - { \ - delete p; \ - p = (Type *)aTypes.Next(); \ - } \ - aTypes.Clear(); \ -} \ -Type & ClassName::Insert( const Type & rType, sal_uIntPtr nPos ) \ -{ \ - Type * pType = new Type( rType ); \ - aTypes.Insert( pType, nPos ); \ - return *pType; \ -} - -#endif // _TOOLS_OWNLIST_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/queue.hxx b/tools/inc/tools/queue.hxx deleted file mode 100644 index c32880b764d5..000000000000 --- a/tools/inc/tools/queue.hxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _QUEUE_HXX -#define _QUEUE_HXX - -#include <tools/solar.h> -#include <tools/contnr.hxx> - -// --------- -// - Queue - -// --------- - -#define QUEUE_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND - -class Queue : private Container -{ -public: - using Container::Clear; - using Container::Count; - using Container::GetObject; - using Container::GetPos; - - Queue( sal_uInt16 _nInitSize = 16, sal_uInt16 _nReSize = 16 ) : - Container( _nReSize, _nInitSize, _nReSize ) {} - Queue( const Queue& rQueue ) : Container( rQueue ) {} - - void Put( void* p ) { Container::Insert( p, CONTAINER_APPEND ); } - void* Get() { return Container::Remove( (sal_uIntPtr)0 ); } - - Queue& operator =( const Queue& rQueue ) - { Container::operator =( rQueue ); return *this; } - - sal_Bool operator ==( const Queue& rQueue ) const - { return Container::operator ==( rQueue ); } - sal_Bool operator !=( const Queue& rQueue ) const - { return Container::operator !=( rQueue ); } -}; - -// ----------------- -// - DECLARE_QUEUE - -// ----------------- - -#define DECLARE_QUEUE( ClassName, Type ) \ -class ClassName : private Queue \ -{ \ -public: \ - using Queue::Clear; \ - using Queue::Count; \ - \ - ClassName( sal_uInt16 _nInitSize = 16, \ - sal_uInt16 _nReSize = 16 ) : \ - Queue( _nInitSize, _nReSize ) {} \ - ClassName( const ClassName& rClassName ) : \ - Queue( rClassName ) {} \ - \ - void Put( Type p ) { Queue::Put( (void*)p ); } \ - Type Get() { return (Type)Queue::Get(); } \ - \ - Type GetObject( sal_uIntPtr nIndex ) const \ - { return (Type)Queue::GetObject( nIndex ); } \ - sal_uIntPtr GetPos( const Type p ) const \ - { return Queue::GetPos( (const void*)p ); } \ - sal_uIntPtr GetPos( const Type p, sal_uIntPtr nStartIndex, \ - sal_Bool bForward = sal_True ) const \ - { return Queue::GetPos( (const void*)p, \ - nStartIndex, \ - bForward ); } \ - \ - ClassName& operator =( const ClassName& rClassName ) \ - { Queue::operator =( rClassName ); \ - return *this; } \ - \ - sal_Bool operator ==( const Queue& rQueue ) const \ - { return Queue::operator ==( rQueue ); } \ - sal_Bool operator !=( const Queue& rQueue ) const \ - { return Queue::operator !=( rQueue ); } \ -}; - -#endif // _QUEUE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index 55e649e42d0a..bb65e70e0c54 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -221,8 +221,6 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } #define __DLLEXTENSION "mi" #elif defined WNT && defined _MSC_VER && defined X86_64 #define __DLLEXTENSION "mx" -#elif defined OS2 - #define __DLLEXTENSION "go" #elif defined AIX #define __DLLEXTENSION "ap.so" #elif defined SOLARIS && defined SPARC && defined IS_LP64 @@ -310,7 +308,7 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } #define LIBRARY_CONCAT4( s1, s2, s3, s4 ) \ s1 s2 s3 s4 -#if defined WNT || defined OS2 +#if defined WNT #define SVLIBRARY( Base ) \ LIBRARY_CONCAT3( Base, __DLLEXTENSION, ".DLL" ) #define SVLIBRARYLANG( Base, Lang ) \ diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index d86df43ce93c..016a0d70aaa9 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -267,7 +267,6 @@ private: sal_uInt16 nCompressMode; LineEnd eLineDelimiter; CharSet eStreamCharSet; -// CharSet eTargetCharSet; // Verschluesselung ByteString aKey; // aKey.Len != 0 -> Verschluesselung @@ -344,9 +343,6 @@ public: void SetStreamCharSet( CharSet eCharSet ) { eStreamCharSet = eCharSet; } CharSet GetStreamCharSet() const { return eStreamCharSet; } -// void SetTargetCharSet( CharSet eCharSet ) -// { eTargetCharSet = eCharSet; } -// CharSet GetTargetCharSet() const { return eTargetCharSet; } void SetLineDelimiter( LineEnd eLineEnd ) { eLineDelimiter = eLineEnd; } @@ -657,16 +653,6 @@ inline SvStream& SvStream::ReadNumber( int& rInt ) return *this; } -/* -inline SvStream& SvStream::ReadNumber( unsigned int& rUInt ) -{ - sal_uIntPtr nTmp; - ReadNumber( nTmp ); - rUInt = (unsigned int)nTmp; - return *this; -} -*/ - inline SvStream& SvStream::ReadNumber( float& rFloat ) { double nTmp; diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index e10e7288d1e8..f77d9630d962 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -133,8 +133,6 @@ enum StringCompare { COMPARE_LESS = -1, COMPARE_EQUAL = 0, COMPARE_GREATER = 1 } #ifdef SAL_W32 #pragma pack(push, 8) -#elif defined(SAL_OS2) -#pragma pack(1) #endif typedef struct _ByteStringData @@ -146,8 +144,6 @@ typedef struct _ByteStringData #ifdef SAL_W32 #pragma pack(pop) -#elif defined(SAL_OS2) -#pragma pack() #endif // -------------- @@ -421,8 +417,6 @@ inline ByteString ByteString::GetQuotedToken( xub_StrLen nToken, const ByteStrin #ifdef SAL_W32 #pragma pack(push, 4) -#elif defined(SAL_OS2) -#pragma pack(1) #endif typedef struct _UniStringData @@ -434,8 +428,6 @@ typedef struct _UniStringData #ifdef SAL_W32 #pragma pack(pop) -#elif defined(SAL_OS2) -#pragma pack() #endif // ------------- diff --git a/tools/os2/inc/dll.hxx b/tools/os2/inc/dll.hxx deleted file mode 100644 index bb71da856943..000000000000 --- a/tools/os2/inc/dll.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DLL_HXX -#define _DLL_HXX - -// MultiThread-Sicherung aktivieren -void EnterMultiThread( int bEnter ); -int IsMultiThread(); - -// Um Resourcen wieder freizugeben -//YD void ImpDeInitOS2Tools(); -inline void ImpDeInitOS2Tools() {} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/os2/source/dll/toolsdll.cxx b/tools/os2/source/dll/toolsdll.cxx deleted file mode 100644 index 346e01faf46d..000000000000 --- a/tools/os2/source/dll/toolsdll.cxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <tools/shl.hxx> - -#include <dll.hxx> - -// ======================================================================= - -static void* aAppData[SHL_COUNT]; - -// ----------------------------------------------------------------------- - -void** GetAppData( USHORT nSharedLib ) -{ - return &(aAppData[nSharedLib]); -} - -// ======================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 5a5c524dd80d..66adb081b04d 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -29,10 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#if defined( OS2 ) -#define INCL_DOSDATETIME -#include <svpm.h> -#elif defined( WNT ) +#if defined( WNT ) #include <windows.h> #else #include <time.h> @@ -140,15 +137,7 @@ static void DaysToDate( long nDays, Date::Date() { -#if defined( OS2 ) - DATETIME aDateTime; - DosGetDateTime( &aDateTime ); - - // Datum zusammenbauen - nDate = ((sal_uIntPtr)aDateTime.day) + - (((sal_uIntPtr)aDateTime.month)*100) + - (((sal_uIntPtr)aDateTime.year)*10000); -#elif defined WNT +#if defined WNT SYSTEMTIME aDateTime; GetLocalTime( &aDateTime ); diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 5f12c47c54ad..43e1b65c82b6 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -31,11 +31,7 @@ #define _TOOLS_TIME_CXX -#if defined( OS2 ) -#define INCL_DOSMISC -#define INCL_DOSDATETIME -#include <svpm.h> -#elif defined( WNT ) +#if defined( WNT ) #include <windows.h> #elif defined UNX #include <unistd.h> @@ -94,16 +90,7 @@ static Time Sec100ToTime( sal_Int32 nSec100 ) Time::Time() { -#if defined( OS2 ) - DATETIME aDateTime; - DosGetDateTime( &aDateTime ); - - // Zeit zusammenbauen - nTime = (((sal_Int32)aDateTime.hours)*1000000) + - (((sal_Int32)aDateTime.minutes)*10000) + - (((sal_Int32)aDateTime.seconds)*100) + - ((sal_Int32)aDateTime.hundredths); -#elif defined( WNT ) +#if defined( WNT ) SYSTEMTIME aDateTime; GetLocalTime( &aDateTime ); @@ -313,23 +300,7 @@ sal_Bool Time::IsEqualIgnore100Sec( const Time& rTime ) const Time Time::GetUTCOffset() { -#if defined( OS2 ) -#undef timezone - DATETIME aDateTime; - DosGetDateTime( &aDateTime ); - - // Zeit zusammenbauen - if ( aDateTime.timezone != -1 ) - { - short nTempTime = (short)Abs( aDateTime.timezone ); - Time aTime( 0, (sal_uInt16)nTempTime ); - if ( aDateTime.timezone > 0 ) - aTime = -aTime; - return aTime; - } - else - return Time( 0 ); -#elif defined( WNT ) +#if defined( WNT ) TIME_ZONE_INFORMATION aTimeZone; aTimeZone.Bias = 0; DWORD nTimeZoneRet = GetTimeZoneInformation( &aTimeZone ); @@ -391,10 +362,6 @@ sal_uIntPtr Time::GetSystemTicks() { #if defined WNT return (sal_uIntPtr)GetTickCount(); -#elif defined( OS2 ) - sal_uIntPtr nClock; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) ); - return (sal_uIntPtr)nClock; #else timeval tv; gettimeofday (&tv, 0); @@ -414,10 +381,6 @@ sal_uIntPtr Time::GetProcessTicks() { #if defined WNT return (sal_uIntPtr)GetTickCount(); -#elif defined( OS2 ) - sal_uIntPtr nClock; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) ); - return (sal_uIntPtr)nClock; #else static sal_uIntPtr nImplTicksPerSecond = 0; static double dImplTicksPerSecond; diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 72799c291e9c..b2b6367ca734 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -37,20 +37,13 @@ #include <direct.h> #endif +#include <errno.h> #include <time.h> #include <cstdarg> // combinations #include <stdlib.h> #include <string.h> #include <stdio.h> -#ifdef OS2 -#define INCL_DOSSEMAPHORES -#define INCL_DOSMISC -#define INCL_WINDIALOGS -#define INCL_WINSHELLDATA -#include <svpm.h> -#endif - #if defined ( WNT ) #include <windows.h> #endif @@ -209,8 +202,6 @@ static int bDbgImplInMain = sal_False; #if defined( WNT ) static CRITICAL_SECTION aImplCritDbgSection; -#elif defined( OS2 ) -static HMTX hImplCritDbgSection = 0; #endif static sal_Bool bImplCritDbgSectionInit = sal_False; @@ -220,8 +211,6 @@ void ImplDbgInitLock() { #if defined( WNT ) InitializeCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosCreateMutexSem( NULL, &hImplCritDbgSection, 0, sal_False ); #endif bImplCritDbgSectionInit = sal_True; } @@ -232,8 +221,6 @@ void ImplDbgDeInitLock() { #if defined( WNT ) DeleteCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosCloseMutexSem( hImplCritDbgSection ); #endif bImplCritDbgSectionInit = sal_False; } @@ -247,8 +234,6 @@ void ImplDbgLock() #if defined( WNT ) EnterCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosRequestMutexSem( hImplCritDbgSection, SEM_INDEFINITE_WAIT ); #endif } @@ -261,14 +246,12 @@ void ImplDbgUnlock() #if defined( WNT ) LeaveCriticalSection( &aImplCritDbgSection ); -#elif defined( OS2 ) - DosReleaseMutexSem( hImplCritDbgSection ); #endif } // ======================================================================= -#if (defined WNT || defined OS2) +#if defined WNT //#define SV_MEMMGR // #endif #ifdef SV_MEMMGR @@ -315,10 +298,6 @@ static sal_uIntPtr ImplGetPerfTime() { #if defined( WNT ) return (sal_uIntPtr)GetTickCount(); -#elif defined( OS2 ) - sal_uIntPtr nClock; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) ); - return (sal_uIntPtr)nClock; #else static sal_uIntPtr nImplTicksPerSecond = 0; static double dImplTicksPerSecond; @@ -682,9 +661,6 @@ static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen ) strncpy( pStr, pName, nMaxLen ); else GetProfileStringA( "sv", "dbgsv", "dbgsv.ini", pStr, nMaxLen ); -#elif defined( OS2 ) - PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSV", - "dbgsv.ini", (PSZ)pStr, nMaxLen ); #else strncpy( pStr, "dbgsv.ini", nMaxLen ); #endif @@ -706,9 +682,6 @@ static void DbgGetLogFileName( sal_Char* pStr ) strcpy( pStr, pName ); else GetProfileStringA( "sv", "dbgsvlog", "dbgsv.log", pStr, 200 ); -#elif defined( OS2 ) - PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSVLOG", - "dbgsv.log", (PSZ)pStr, 200 ); #else strcpy( pStr, "dbgsv.log" ); #endif @@ -720,8 +693,6 @@ static void DbgDebugBeep() { #if defined( WNT ) MessageBeep( MB_ICONHAND ); -#elif defined( OS2 ) - WinAlarm( HWND_DESKTOP, WA_ERROR ); #endif } @@ -827,7 +798,11 @@ static DebugData* GetDebugData() } - getcwd( aCurPath, sizeof( aCurPath ) ); + sal_Char* getcwdResult = getcwd( aCurPath, sizeof( aCurPath ) ); + if ( !getcwdResult ) + { + OSL_TRACE( "getcwd failed with error %s", strerror(errno) ); + } // Daten initialisieren if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_XTOR ) @@ -856,8 +831,17 @@ static FILETYPE ImplDbgInitFile() static sal_Bool bFileInit = sal_False; sal_Char aBuf[4096]; - getcwd( aBuf, sizeof( aBuf ) ); - chdir( aCurPath ); + sal_Char* getcwdResult = getcwd( aBuf, sizeof( aBuf ) ); + if ( !getcwdResult ) { + OSL_TRACE( "getcwd failed with error = %s", strerror(errno) ); + return NULL; + } + + int chdirResult = chdir( aCurPath ); + if ( !chdirResult ) { + OSL_TRACE ( "chdir failed with error = %s", strerror(errno) ); + return NULL; + } DebugData* pData = GetDebugData(); FILETYPE pDebugFile; @@ -892,7 +876,11 @@ static FILETYPE ImplDbgInitFile() else pDebugFile = FileOpen( pData->aDbgData.aDebugName, "a" ); - chdir( aBuf ); + chdirResult = chdir( aBuf ); + if ( !chdirResult ) + { + OSL_TRACE( "chdir failed with error = %s", strerror(errno) ); + } return pDebugFile; } @@ -1683,7 +1671,7 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa int nMsgLen = strlen( pMsg ); if ( nBufLen+nMsgLen > DBG_BUF_MAXLEN ) { - int nCopyLen = DBG_BUF_MAXLEN-nBufLen-3; + int nCopyLen = DBG_BUF_MAXLEN-nBufLen-4; strncpy( &(aBufOut[nBufLen]), pMsg, nCopyLen ); strcpy( &(aBufOut[nBufLen+nCopyLen]), "..." ); } diff --git a/tools/source/fsys/comdep.cxx b/tools/source/fsys/comdep.cxx index 1904e39132ba..3461b46c9316 100644 --- a/tools/source/fsys/comdep.cxx +++ b/tools/source/fsys/comdep.cxx @@ -39,8 +39,6 @@ DBG_NAMEEX( DirEntry ) #include "unx.cxx" #elif defined WNT #include "wntmsc.cxx" -#elif defined OS2 -#include "os2.cxx" #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/comdep.hxx b/tools/source/fsys/comdep.hxx index 895216f8f3da..e528d3b6fdfd 100644 --- a/tools/source/fsys/comdep.hxx +++ b/tools/source/fsys/comdep.hxx @@ -31,29 +31,19 @@ #include <tools/fsys.hxx> -#define ACCESSDELIM(e) ( (e == FSYS_STYLE_MAC) ? ":" : \ - ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \ - e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \ - ? "\\" : "/" ) +#define ACCESSDELIM(e) ( ( e == FSYS_STYLE_NTFS ) ? "\\" : "/" ) #define ACCESSDELIM_C(e)(char)\ - ( (e == FSYS_STYLE_MAC) ? ':' : \ - ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \ - e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \ - ? '\\' : '/' ) -#define SEARCHDELIM(e) ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ":" \ - : ";" ) + ( ( e == FSYS_STYLE_NTFS ) ? '\\' : '/' ) +#define SEARCHDELIM(e) ( (e == FSYS_STYLE_BSD) ? ":" : ";" ) #define SEARCHDELIM_C(e)(char)\ - ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ':' \ - : ';' ) -#define ACTPARENT(e) ( (e == FSYS_STYLE_MAC) ? ":" : ".." ) -#define ACTCURRENT(e) ( (e == FSYS_STYLE_MAC) ? "" : "." ) + ( (e == FSYS_STYLE_BSD) ? ':' : ';' ) +#define ACTPARENT(e) ".." +#define ACTCURRENT(e) "." #if defined UNX #include "unx.hxx" #elif defined WNT #include "wntmsc.hxx" -#elif defined OS2 -#include "os2.hxx" #endif //-------------------------------------------------------------------- @@ -93,7 +83,7 @@ struct DirReader_Impl // nur den String der Memer-Var nehmen! -#if defined(UNX) || defined(OS2) //for further exlpanation see DirReader_Impl::Read() in unx.cxx +#if defined(UNX) //for further eplanation see DirReader_Impl::Read() in unx.cxx pDosDir = NULL; #else aBypass = ByteString(aPath, osl_getThreadTextEncoding()); @@ -145,7 +135,7 @@ struct FileCopier_Impl //-------------------------------------------------------------------- -#if defined WNT || defined OS2 +#if defined WNT sal_Bool IsRedirectable_Impl( const ByteString &rPath ); #else #define IsRedirectable_Impl( rPath ) sal_True diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index b9882bad50a1..a188569868e1 100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -38,7 +38,7 @@ #include <process.h> #endif -#if defined(UNX) || defined(OS2) +#if defined(UNX) #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -447,36 +447,15 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty else { - if ( eStyle == FSYS_STYLE_FAT ) + // normalen Entries kommen auf den Stack + DirEntry *pNew = new DirEntry( aName, FSYS_FLAG_NORMAL, eStyle ); + if ( !pNew->IsValid() ) { - // ist der Name grundsaetzlich ungueltig? - int nPunkte = 0; - const char *pChar; - for ( pChar = aName.GetBuffer(); - nPunkte < 2 && *pChar != 0; - pChar++ ) - { - if ( *pChar == ';' ) - nPunkte = 0; - else - nPunkte += ( *pChar == '.' ) ? 1 : 0; - } - if ( nPunkte > 1 ) - { - aName = rPfad; - return FSYS_ERR_MISPLACEDCHAR; - } + aName = rPfad; + ErrCode eErr = pNew->GetError(); + delete pNew; + return eErr; } - - // normalen Entries kommen auf den Stack - DirEntry *pNew = new DirEntry( aName, FSYS_FLAG_NORMAL, eStyle ); - if ( !pNew->IsValid() ) - { - aName = rPfad; - ErrCode eErr = pNew->GetError(); - delete pNew; - return eErr; - } aStack.Push( pNew ); } } @@ -533,54 +512,15 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty FSysError DirEntry::ImpParseName( const ByteString& rbInitName, FSysPathStyle eStyle ) { - String rInitName( rbInitName, osl_getThreadTextEncoding() ); if ( eStyle == FSYS_STYLE_HOST ) eStyle = DEFSTYLE; - // KI-Division of FSys - if ( eStyle == FSYS_STYLE_DETECT ) - { - sal_Unicode cFirst = rInitName.GetChar(0); - if ( rInitName.Len() == 2 && rInitName.GetChar(1) == ':' && - ((cFirst >= 'A' && cFirst <= 'Z') || - (cFirst >= 'a' && cFirst <= 'z'))) - eStyle = FSYS_STYLE_HPFS; - else if ( rInitName.Len() > 2 && rInitName.GetChar(1) == ':' ) - { - if ( rInitName.Search( ':', 2 ) == STRING_NOTFOUND ) - eStyle = FSYS_STYLE_HPFS; - else - eStyle = FSYS_STYLE_MAC; - } - else if ( rInitName.Search( '/' ) != STRING_NOTFOUND ) - eStyle = FSYS_STYLE_BSD; - else if ( rInitName.Search( '\\' ) != STRING_NOTFOUND ) - eStyle = FSYS_STYLE_HPFS; - else if ( rInitName.Search( ':' ) != STRING_NOTFOUND ) - eStyle = FSYS_STYLE_MAC; - else - eStyle = FSYS_STYLE_HPFS; - } - - switch ( eStyle ) - { - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - return ImpParseOs2Name( rbInitName, eStyle ); - - case FSYS_STYLE_BSD: - case FSYS_STYLE_SYSV: - return ImpParseUnixName( rbInitName, eStyle ); - - case FSYS_STYLE_MAC: - return FSYS_ERR_OK; +#if defined(WNT) + return ImpParseOs2Name( rbInitName, eStyle ); +#else + return ImpParseUnixName( rbInitName, eStyle ); +#endif - default: - return FSYS_ERR_UNKNOWN; - } } /************************************************************************* @@ -607,7 +547,7 @@ static FSysPathStyle GetStyle( FSysPathStyle eStyle ) |* *************************************************************************/ -void DirEntry::ImpTrim( FSysPathStyle eStyle ) +void DirEntry::ImpTrim( FSysPathStyle /* eStyle */ ) { // Wildcards werden nicht geclipt if ( ( aName.Search( '*' ) != STRING_NOTFOUND ) || @@ -615,93 +555,19 @@ void DirEntry::ImpTrim( FSysPathStyle eStyle ) ( aName.Search( ';' ) != STRING_NOTFOUND ) ) return; - switch ( eStyle ) +#if defined(WNT) + if ( aName.Len() > 254 ) { - case FSYS_STYLE_FAT: - { - sal_uInt16 nPunktPos = aName.Search( '.' ); - if ( nPunktPos == STRING_NOTFOUND ) - { - if ( aName.Len() > 8 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 8 ); - } - } - else - { - if ( nPunktPos > 8 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 8, nPunktPos - 8 ); - nPunktPos = 8; - } - if ( aName.Len() > nPunktPos + 3 ) - { - if ( aName.Len() - nPunktPos > 4 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( nPunktPos + 4 ); - } - } - } - aName.ToLowerAscii(); - break; - } - - case FSYS_STYLE_VFAT: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - if ( aName.Len() > 254 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 254 ); - } - - if ( eStyle == FSYS_STYLE_HPFS && - ( eFlag == FSYS_FLAG_ABSROOT || eFlag == FSYS_FLAG_RELROOT ) ) - aName.ToUpperAscii(); - break; - - case FSYS_STYLE_SYSV: - if ( aName.Len() > 14 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 14 ); - } - break; - - case FSYS_STYLE_BSD: - if ( aName.Len() > 250 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 250 ); - } - break; - - case FSYS_STYLE_MAC: - if ( eFlag & ( FSYS_FLAG_ABSROOT | FSYS_FLAG_VOLUME ) ) - { - if ( aName.Len() > 27 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 27 ); - } - } - else - { - if ( aName.Len() > 31 ) - { - nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; - aName.Erase( 31 ); - } - } - break; - - default: - /* kann nicht sein */; + nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; + aName.Erase( 254 ); + } +#else + if ( aName.Len() > 250 ) + { + nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK; + aName.Erase( 250 ); } +#endif } /************************************************************************* @@ -777,7 +643,7 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) } ByteString aTmpName(rInitName, osl_getThreadTextEncoding()); - if( eStyle == FSYS_STYLE_URL || aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) + if( aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) { #ifndef BOOTSTRAP DBG_WARNING( "File URLs are not permitted but accepted" ); @@ -833,7 +699,7 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle ) } ByteString aTmpName( rInitName ); - if( eStyle == FSYS_STYLE_URL || rInitName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) + if( rInitName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) { #ifndef BOOTSTRAP DBG_WARNING( "File URLs are not permitted but accepted" ); @@ -966,7 +832,7 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const if ( !IsValid() ) return sal_False; -#if defined WNT || defined OS2 +#if defined WNT // spezielle Filenamen sind vom System da if ( ( aName.CompareIgnoreCaseToAscii("CLOCK$") == COMPARE_EQUAL || aName.CompareIgnoreCaseToAscii("CON") == COMPARE_EQUAL || @@ -990,7 +856,7 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const return sal_True; } -#if defined WNT || defined OS2 +#if defined WNT if ( 0 != ( eKind & FSYS_KIND_DEV ) ) { return DRIVE_EXISTS( ImpGetTopPtr()->aName.GetChar(0) ); @@ -1078,12 +944,6 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, aRet = ByteString(GetName( eStyle ), osl_getThreadTextEncoding()); } - if ( ( eStyle == FSYS_STYLE_MAC ) && - ( ImpGetTopPtr()->eFlag != FSYS_FLAG_VOLUME ) && - ( ImpGetTopPtr()->eFlag != FSYS_FLAG_ABSROOT ) && - ( aRet.GetChar(0) != ':' ) ) - aRet.Insert( ACCESSDELIM_C(eStyle), 0 ); - //! Hack if ( bWithDelimiter ) if ( aRet.GetChar( aRet.Len()-1 ) != ACCESSDELIM_C(eStyle) ) @@ -1182,62 +1042,15 @@ String DirEntry::GetName( FSysPathStyle eStyle ) const case FSYS_FLAG_ABSROOT: { - if ( eStyle == FSYS_STYLE_URL ) - { - aRet = "file:///"; - aRet += aName; - -#ifndef UNX - if ( aName.Len()) - { - if ( aName.GetChar(aName.Len()-1) == ':' ) - { - aRet.SetChar(aRet.Len()-1, '|'); - } - else - { - aRet.Insert( '/', 5 ); - } - aRet += "/"; - } -#endif - } - else if ( eStyle != FSYS_STYLE_MAC && - aName.Len() > 1 && aName.GetChar( 1 ) != ':' ) - { - // UNC-Pathname - aRet = ACCESSDELIM_C(eStyle); - aRet += ACCESSDELIM_C(eStyle); - aRet += aName ; - aRet += ACCESSDELIM_C(eStyle); - } - else - { - aRet = aName; - aRet += ACCESSDELIM_C(eStyle); - } + aRet = aName; + aRet += ACCESSDELIM_C(eStyle); break; } case FSYS_FLAG_INVALID: case FSYS_FLAG_VOLUME: { - if ( eStyle == FSYS_STYLE_URL ) - { - aRet = "file:///"; - aRet += aName; -#ifndef UNX - if ( aName.Len() && aName.GetChar(aName.Len()-1) == ':' ) - { - aRet.SetChar(aRet.Len()-1, '|'); - } -#endif - } - else - { - aRet = aName; - } - + aRet = aName; break; } @@ -1358,14 +1171,8 @@ sal_Bool DirEntry::operator==( const DirEntry& rEntry ) const ( rEntry.eFlag == FSYS_FLAG_INVALID ) ) return sal_False; -#ifndef OS2 - const -#endif - DirEntry *pThis = (DirEntry *)this; -#ifndef OS2 - const -#endif - DirEntry *pWith = (DirEntry *)&rEntry; + const DirEntry *pThis = (DirEntry *)this; + const DirEntry *pWith = (DirEntry *)&rEntry; while( pThis && pWith && (pThis->eFlag == pWith->eFlag) ) { if ( CMP_LOWER(pThis->aName) != CMP_LOWER(pWith->aName) ) @@ -1601,8 +1408,7 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter ) if ( (eFlag != FSYS_FLAG_NORMAL) || (aName.Search( ':' ) != STRING_NOTFOUND) || - (aName.Search( aAccDelim ) != STRING_NOTFOUND) || - (eFormatter == FSYS_STYLE_FAT && (aName.GetTokenCount( '.' ) > 2) ) ) + (aName.Search( aAccDelim ) != STRING_NOTFOUND) ) { eFlag = FSYS_FLAG_INVALID; } @@ -1656,131 +1462,6 @@ sal_Bool DirEntry::Find( const String& rPfad, char cDelim ) /************************************************************************* |* -|* DirEntry::ImpToRel() -|* -*************************************************************************/ - -sal_Bool DirEntry::ImpToRel( String aCurStr ) -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aThis(*this); - aThis.ToAbs(); - String aThisStr( aThis.GetFull( FSYS_STYLE_HPFS ) ); - - // #109512 preserve case of path even if caseinsensitive - String aThisCompareStr( aThisStr ), aCurCompareStr( aCurStr ); - if ( ! IsCaseSensitive() ) - { - aThisCompareStr.ToLowerAscii(); - aCurCompareStr.ToLowerAscii(); - } - - // "Ubereinstimmung pr"ufen - sal_uInt16 nPos = aThisCompareStr.Match( aCurCompareStr ); - if ( nPos == STRING_MATCH && aThisStr.Len() != aCurStr.Len() ) - nPos = Min( aThisStr.Len(), aCurStr.Len() ); - - // Sonderfall, die DirEntries sind identisch - if ( nPos == STRING_MATCH ) - { - // dann ist der relative Pfad das aktuelle Verzeichnis - *this = DirEntry(); - return sal_True; - } - - // Sonderfall, die DirEntries sind total verschieden - if ( nPos == 0 ) - { - // dann ist der relativste Pfad absolut - *this = aThis; - return sal_False; - } - - // sonst nehmen wir die identischen Einzelteile vorne weg - while ( nPos > 0 && aThisStr.GetChar(nPos) != '\\' ) - --nPos; - aThisStr.Erase( 0, nPos + ( ( aThisStr.GetChar(nPos) == '\\' ) ? 1 : 0 ) ); - aCurStr.Erase( 0, nPos + ( ( aCurStr.GetChar(nPos) == '\\' ) ? 1 : 0 ) ); - - // und fuellen mit dem Level der Directories auf - for ( nPos = 0; nPos < aCurStr.Len(); ++nPos ) - if ( aCurStr.GetChar(nPos) == '\\' ) - aThisStr.Insert( String( "..\\", osl_getThreadTextEncoding() ), 0 ); - - // das ist dann unser relativer Pfad - *this = DirEntry( aThisStr, FSYS_STYLE_HPFS ); - return sal_True; -} - -/************************************************************************* -|* -|* DirEntry::CutRelParents() -|* -*************************************************************************/ - -sal_uInt16 DirEntry::CutRelParents() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - // erstes '..' finden - DirEntry *pDir = 0; - DirEntry *pPar; - - for ( pPar = this; - pPar && pPar->eFlag != FSYS_FLAG_PARENT; - pPar = pPar->pParent ) - pDir = pPar; - - // '..' zaehlen - sal_uInt16 nParCount = 0; - while ( pPar && pPar->eFlag == FSYS_FLAG_PARENT ) - { - ++nParCount; - pPar = pPar->pParent; - } - - // cutten - if ( pDir ) - DELETEZ(pDir->pParent); - else - eFlag = FSYS_FLAG_CURRENT; - - return nParCount; -} - -/************************************************************************* -|* -|* DirEntry::ToRel() -|* -*************************************************************************/ - -sal_Bool DirEntry::ToRel() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aCur; - aCur.ToAbs(); - return ImpToRel( aCur.GetFull( FSYS_STYLE_HPFS ) ); -} - -/************************************************************************* -|* -|* DirEntry::ToRel() -|* -*************************************************************************/ - -sal_Bool DirEntry::ToRel( const DirEntry& rStart ) -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - DirEntry aStart( rStart ); - aStart.ToAbs(); - return ImpToRel( aStart.GetFull( FSYS_STYLE_HPFS ) ); -} - -/************************************************************************* -|* |* DirEntry::GetDevice() |* *************************************************************************/ @@ -1840,42 +1521,6 @@ String DirEntry::GetSearchDelimiter( FSysPathStyle eFormatter ) /************************************************************************* |* -|* DirEntry::GetMaxNameLen() -|* -|* Beschreibung Liefert die maximale Anzahl von Zeichen in -|* einzelnen Namensteile. Bei FileSystmen mit -|* fester Extension (FAT) zaehlt diese nicht mit. -|* Bei unbekannten FileSytemen und FSYS_STYLE_URL -|* wird USHRT_MAX zurueckgegeben. -|* -*************************************************************************/ - -sal_uInt16 DirEntry::GetMaxNameLen( FSysPathStyle eFormatter ) -{ - eFormatter = GetStyle( eFormatter ); - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: return 31; - - case FSYS_STYLE_FAT: return 8; - - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: return 255; - - - case FSYS_STYLE_SYSV: return 14; - - case FSYS_STYLE_BSD: return 250; - - default: - return USHRT_MAX; - } -} - -/************************************************************************* -|* |* DirEntry::TempName() |* |* Beschreibung FSYS.SDW - Aha, wo? @@ -1971,7 +1616,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const strcpy(ret_val,dir); /* Make sure directory ends with a separator */ -#if defined(WNT) || defined(OS2) +#if defined(WNT) if ( i>0 && ret_val[i-1] != '\\' && ret_val[i-1] != '/' && ret_val[i-1] != ':') ret_val[i++] = '\\'; @@ -2039,7 +1684,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const } else { -#if defined(UNX) || defined(OS2) +#if defined(UNX) if( access( ByteString(aRedirected, osl_getThreadTextEncoding()).GetBuffer(), F_OK ) ) { aRet = DirEntry( aRetVal ); @@ -2252,13 +1897,6 @@ sal_Bool IsValidEntry_Impl( const DirEntry &rPath, aPath += aName; if ( 1 == aPath.Level() ) return sal_False; - if ( eStyle == FSYS_STYLE_FAT || eStyle == FSYS_STYLE_NWFS || - eStyle == FSYS_STYLE_UNKNOWN ) - { - DirEntry aDosEntry( rLongName, FSYS_STYLE_FAT ); - if ( !aDosEntry.IsValid() ) - return sal_False; - } // Pfad-Trenner sind nicht erlaubt (bei ungek"urzten auch nicht FSYS_SHORTNAME_DELIMITER) char cDelim = bUseDelim == 2 ? FSYS_SHORTNAME_DELIMITER : char(0); @@ -2279,14 +1917,6 @@ sal_Bool IsValidEntry_Impl( const DirEntry &rPath, //------------------------------------------------------------------------- -#define MAX_EXT_FAT 3 -#define MAX_LEN_FAT 8 -#define INVALID_CHARS_FAT "\\/\"':|^<>[]?* " - -#define MAX_EXT_MAC 16 // nur wegen sinnvoller Namensk"rzung -#define MAX_LEN_MAC 31 -#define INVALID_CHARS_MAC "\":" - #define MAX_EXT_MAX 250 #define MAX_LEN_MAX 255 #define INVALID_CHARS_DEF "\\/\"':|^<>?*" @@ -2323,49 +1953,27 @@ sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, if ( FSYS_STYLE_DETECT == eStyle ) eStyle = DirEntry::GetPathStyle( GetDevice().GetName() ); ByteString aInvalidChars; - switch ( eStyle ) - { - case FSYS_STYLE_FAT: - nMaxExt = MAX_EXT_FAT; - nMaxLen = MAX_LEN_FAT; - aInvalidChars = INVALID_CHARS_FAT; - break; - - case FSYS_STYLE_MAC: - nMaxExt = MAX_EXT_MAC; - nMaxLen = MAX_LEN_MAC; - aInvalidChars = INVALID_CHARS_MAC; - break; - - default: - nMaxExt = MAX_EXT_MAX; - nMaxLen = MAX_LEN_MAX; - aInvalidChars = INVALID_CHARS_DEF; - } + nMaxExt = MAX_EXT_MAX; + nMaxLen = MAX_LEN_MAX; + aInvalidChars = INVALID_CHARS_DEF; // Extension abschneiden und kuerzen ByteString aExt; ByteString aFName = bLongName; - if ( FSYS_STYLE_MAC != eStyle ) + DirEntry aUnparsed; + aUnparsed.aName = bLongName; + aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding()); + aFName = aUnparsed.aName; + if ( aExt.Len() > nMaxExt ) { - DirEntry aUnparsed; - aUnparsed.aName = bLongName; - aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding()); - aFName = aUnparsed.aName; - if ( aExt.Len() > nMaxExt ) - { - char c = aExt.GetChar( aExt.Len() - 1 ); - aExt.Erase(nMaxExt-1); - aExt += c; - } + char c = aExt.GetChar( aExt.Len() - 1 ); + aExt.Erase(nMaxExt-1); + aExt += c; } - if ( FSYS_STYLE_FAT != eStyle ) - { - // ausser auf einem FAT-System geh"ort die Extension zur - // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden. - nMaxLen -= ( aExt.Len() + 1 ); - } + // ausser auf einem FAT-System geh"ort die Extension zur + // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden. + nMaxLen -= ( aExt.Len() + 1 ); // Name k"urzen ByteString aSName; @@ -2530,7 +2138,7 @@ FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const |* *************************************************************************/ -#if defined WNT || defined UNX || defined OS2 +#if defined WNT || defined UNX FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const { @@ -2553,13 +2161,6 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const return FSYS_ERR_ALREADYEXISTS; } -#if defined(OS2) - if ( FileStat(*this).IsKind(FSYS_KIND_DIR) && aDest.GetPath() != GetPath() ) - { - return FSYS_ERR_NOTSUPPORTED; - } -#endif - FSysFailOnErrorImpl(); String aFrom( GetFull() ); @@ -2634,7 +2235,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const // on some nfs connections rename with from == to // leads to destruction of file if ( ( aFrom != aTo ) && ( 0 != rename( bFrom.GetBuffer(), bTo.GetBuffer() ) ) ) -#if !defined(UNX) && !defined(OS2) +#if !defined(UNX) return Sys2SolarError_Impl( GetLastError() ); #else { @@ -2672,6 +2273,10 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const } else { + if ( fpIN ) + fclose( fpIN ); + if ( fpOUT ) + fclose( fpOUT ); return Sys2SolarError_Impl( EXDEV ); } } @@ -2773,9 +2378,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const { if ( FSYS_ACTION_USERECYCLEBIN == (nActions & FSYS_ACTION_USERECYCLEBIN) ) { -#ifdef OS2 - eError = ApiRet2ToSolarError_Impl( DosDelete( (PSZ) pName ) ); -#elif defined(WNT) +#if defined(WNT) SHFILEOPSTRUCT aOp; aOp.hwnd = 0; aOp.wFunc = FO_DELETE; @@ -2866,28 +2469,6 @@ sal_uInt16 DirEntry::Level() const /************************************************************************* |* -|* DirEntry::ConvertNameToSystem() -|* -*************************************************************************/ - -String DirEntry::ConvertNameToSystem( const String &rName ) -{ - return rName; -} - -/************************************************************************* -|* -|* DirEntry::ConvertSystemToName() -|* -*************************************************************************/ - -String DirEntry::ConvertSystemToName( const String &rName ) -{ - return rName; -} - -/************************************************************************* -|* |* DirEntry::IsValid() |* *************************************************************************/ @@ -2897,57 +2478,6 @@ sal_Bool DirEntry::IsValid() const return (nError == FSYS_ERR_OK); } -/************************************************************************* -|* -|* DirEntry::IsRFSAvailable() -|* -*************************************************************************/ - -sal_Bool DirEntry::IsRFSAvailable() -{ - return sal_False; -} - -/************************************************************************* -|* -|* IsLongNameOnFAT() -|* -|* Beschreibung ?berpr?ft , ob das DirEntry einen langen -|* Filenamen auf einer FAT-Partition enth?lt (EAs). -|* (eigentlich nur f?r OS2 interessant) -|* -*************************************************************************/ - -sal_Bool DirEntry::IsLongNameOnFAT() const -{ - // FAT-System? - DirEntry aTempDirEntry(*this); - aTempDirEntry.ToAbs(); - if (DirEntry::GetPathStyle(aTempDirEntry.GetDevice().GetName().GetChar(0)) != FSYS_STYLE_FAT) - { - return sal_False; // nein, also false - } - - // DirEntry-Kette auf lange Dateinamen pr?fen - for( sal_uInt16 iLevel = this->Level(); iLevel > 0; iLevel-- ) - { - const DirEntry& rEntry = (const DirEntry&) (*this)[iLevel-1]; - String aBase( rEntry.GetBase() ); - String aExtension( rEntry.GetExtension() ); - - if (aBase.Len()>8) // Name > 8? - { - return sal_True; - } - - if (aExtension.Len()>3) // Extension > 3? - { - return sal_True; - } - } - return sal_False; -} - //======================================================================== #if defined(DBG_UTIL) diff --git a/tools/source/fsys/filecopy.cxx b/tools/source/fsys/filecopy.cxx index ddce58f66cb2..66b01e57a4b4 100644 --- a/tools/source/fsys/filecopy.cxx +++ b/tools/source/fsys/filecopy.cxx @@ -33,13 +33,6 @@ #include <windows.h> #include <io.h> -#elif defined(OS2) -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <share.h> -#include <io.h> - #elif defined UNX #include <fcntl.h> #include <unistd.h> @@ -219,78 +212,14 @@ FSysError FileCopier::DoCopy_Impl( FSysError eRet = FSYS_ERR_OK; ErrCode eWarn = FSYS_ERR_OK; - // HPFS->FAT? - FSysPathStyle eSourceStyle = DirEntry::GetPathStyle( rSource.ImpGetTopPtr()->GetName() ); - FSysPathStyle eTargetStyle = DirEntry::GetPathStyle( rTarget.ImpGetTopPtr()->GetName() ); - sal_Bool bMakeShortNames = ( eSourceStyle == FSYS_STYLE_HPFS && eTargetStyle == FSYS_STYLE_FAT ); - // Zieldateiname ggf. kuerzen DirEntry aTgt; - if ( bMakeShortNames ) - { - aTgt = rTarget.GetPath(); - aTgt.MakeShortName( rTarget.GetName() ); - } - else - aTgt = rTarget; - - // kein Move wenn Namen gekuerzt werden muessten - if ( bMakeShortNames && FSYS_ACTION_MOVE == ( pImp->nActions & FSYS_ACTION_MOVE ) && aTgt != rTarget ) - return ERRCODE_IO_NAMETOOLONG; + aTgt = rTarget; // source is directory? FileStat aSourceFileStat( rSource ); if ( aSourceFileStat.IsKind( FSYS_KIND_DIR ) ) { -#ifdef OS2 - CHAR szSource[CCHMAXPATHCOMP]; - HOBJECT hSourceObject; - - strcpy(szSource, ByteString(rSource.GetFull(), osl_getThreadTextEncoding()).GetBuffer()); - hSourceObject = WinQueryObject(szSource); - - if ( hSourceObject ) - { - PSZ pszSourceName; - PSZ pszTargetName; - CHAR szTarget[CCHMAXPATHCOMP]; - HOBJECT hTargetObject; - HOBJECT hReturn = NULLHANDLE; - - strcpy(szTarget, ByteString(rTarget.GetFull(), osl_getThreadTextEncoding()).GetBuffer()); - pszTargetName = strrchr(szTarget, '\\'); - pszSourceName = strrchr(szSource, '\\'); - - hTargetObject = WinQueryObject(szTarget); - - if ( hTargetObject ) - WinDestroyObject(hTargetObject); - - if ( pszTargetName && pszSourceName ) - { - *pszTargetName = '\0'; - pszSourceName++; - pszTargetName++; - - if(strcmp(pszSourceName, pszTargetName) == 0) - { - hTargetObject = WinQueryObject(szTarget); - - if(pImp->nActions & FSYS_ACTION_MOVE) - { - hReturn = WinMoveObject(hSourceObject, hTargetObject, 0); - } - else - { - hReturn = WinCopyObject(hSourceObject, hTargetObject, 0); - } - if ( bMakeShortNames && aTarget.Exists() ) - aTarget.Kill(); - return hReturn ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN; - } - } - } -#endif // recursive copy eRet = Error( aTgt.MakeDir() ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN, 0, &aTgt ); Dir aSourceDir( rSource, FSYS_KIND_DIR|FSYS_KIND_FILE ); diff --git a/tools/source/fsys/fstat.cxx b/tools/source/fsys/fstat.cxx index 221ed2c0377b..c0a9c8ce5eba 100644 --- a/tools/source/fsys/fstat.cxx +++ b/tools/source/fsys/fstat.cxx @@ -134,21 +134,6 @@ sal_Bool FileStat::IsKind( DirEntryKind nKind ) const /************************************************************************* |* -|* FileStat::HasReadOnlyFlag() -|* -*************************************************************************/ - -sal_Bool FileStat::HasReadOnlyFlag() -{ -#if defined WNT || defined UNX || defined OS2 - return sal_True; -#else - return sal_False; -#endif -} - -/************************************************************************* -|* |* FileStat::GetReadOnlyFlag() |* *************************************************************************/ @@ -161,16 +146,6 @@ sal_Bool FileStat::GetReadOnlyFlag( const DirEntry &rEntry ) DWORD nRes = GetFileAttributes( (LPCTSTR) aFPath.GetBuffer() ); return ULONG_MAX != nRes && ( FILE_ATTRIBUTE_READONLY & nRes ) == FILE_ATTRIBUTE_READONLY; -#elif defined OS2 - FILESTATUS3 aFileStat; - APIRET nRet = DosQueryPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat) ); - switch ( nRet ) - { - case NO_ERROR: - return FILE_READONLY == ( aFileStat.attrFile & FILE_READONLY ); - default: - return sal_False; - } #elif defined UNX /* could we stat the object? */ struct stat aBuf; @@ -201,26 +176,6 @@ sal_uIntPtr FileStat::SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO ) ( nRes & ~FILE_ATTRIBUTE_READONLY ) | ( bRO ? FILE_ATTRIBUTE_READONLY : 0 ) ); return ( ULONG_MAX == nRes ) ? ERRCODE_IO_UNKNOWN : 0; -#elif defined OS2 - FILESTATUS3 aFileStat; - APIRET nRet = DosQueryPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat) ); - if ( !nRet ) - { - aFileStat.attrFile = ( aFileStat.attrFile & ~FILE_READONLY ) | - ( bRO ? FILE_READONLY : 0 ); - nRet = DosSetPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat), 0 ); - } - switch ( nRet ) - { - case NO_ERROR: - return ERRCODE_NONE; - - case ERROR_SHARING_VIOLATION: - return ERRCODE_IO_LOCKVIOLATION; - - default: - return ERRCODE_IO_NOTEXISTS; - } #elif defined UNX /* first, stat the object to get permissions */ struct stat aBuf; @@ -260,7 +215,7 @@ sal_uIntPtr FileStat::SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO ) |* FileStat::SetDateTime |* *************************************************************************/ -#if defined WNT || defined OS2 +#if defined WNT void FileStat::SetDateTime( const String& rFileName, const DateTime& rNewDateTime ) @@ -270,7 +225,6 @@ void FileStat::SetDateTime( const String& rFileName, Date aNewDate = rNewDateTime; Time aNewTime = rNewDateTime; -#if defined WNT TIME_ZONE_INFORMATION aTZI; DWORD dwTZI = GetTimeZoneInformation( &aTZI ); @@ -335,55 +289,6 @@ void FileStat::SetDateTime( const String& rFileName, SetFileTime( hFile, &aFileTime, &aFileTime, &aFileTime ); CloseHandle( hFile ); } -#elif defined OS2 - - // open file - ULONG nAction = FILE_EXISTED; - HFILE hFile = 0; - ULONG nFlags = OPEN_FLAGS_WRITE_THROUGH | - OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | - OPEN_FLAGS_RANDOM | OPEN_FLAGS_NOINHERIT | - OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE; - - APIRET nRet = DosOpen((PSZ)aFileName.GetBuffer(), &hFile, (PULONG)&nAction, - 0/*size*/, FILE_NORMAL, - OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, - nFlags, 0/*ea*/); - - if ( nRet == 0 ) - { - FILESTATUS3 FileInfoBuffer; - - nRet = DosQueryFileInfo( - hFile, 1, &FileInfoBuffer, sizeof(FileInfoBuffer)); - - if ( nRet == 0 ) - { - FDATE aNewDate; - FTIME aNewTime; - - // create date and time words - aNewDate.day = rNewDateTime.GetDay(); - aNewDate.month = rNewDateTime.GetMonth(); - aNewDate.year = rNewDateTime.GetYear() - 1980; - aNewTime.twosecs = rNewDateTime.GetSec() / 2; - aNewTime.minutes = rNewDateTime.GetMin(); - aNewTime.hours = rNewDateTime.GetHour(); - - // set file date and time - FileInfoBuffer.fdateCreation = aNewDate; - FileInfoBuffer.ftimeCreation = aNewTime; - FileInfoBuffer.fdateLastAccess = aNewDate; - FileInfoBuffer.ftimeLastAccess = aNewTime; - FileInfoBuffer.fdateLastWrite = aNewDate; - FileInfoBuffer.ftimeLastWrite = aNewTime; - - DosSetFileInfo(hFile, 1, &FileInfoBuffer, sizeof(FileInfoBuffer)); - } - DosClose(hFile); - } -#endif - } #endif diff --git a/tools/source/fsys/os2.cxx b/tools/source/fsys/os2.cxx deleted file mode 100644 index 2cad032f0d65..000000000000 --- a/tools/source/fsys/os2.cxx +++ /dev/null @@ -1,846 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_DOSEXCEPTIONS - -#include <stdlib.h> - -#ifdef __BORLANDC__ -#include <alloc.h> -#else -#include <malloc.h> -#endif -#include <tools/debug.hxx> -#include <tools/bigint.hxx> -#include <tools/fsys.hxx> -#include "comdep.hxx" - -#ifdef OS2 -#include <osl/mutex.hxx> -#endif - -int Sys2SolarError_Impl( int nSysErr ); - -static char sCaseMap[256]; -static BOOL bCaseMap = FALSE; -static BOOL bDriveMap = FALSE; - -struct DriveMapItem -{ - DirEntryKind nKind; - char cName; - FSysPathStyle nStyle; -}; - -void CreateCaseMapImpl(); -void CreateDriveMapImpl(); - -static DriveMapItem aDriveMap[26]; - -static BOOL bLastCaseSensitive = FALSE; - -//==================================================================== - -int ApiRet2ToSolarError_Impl( int nApiRet ) -{ - switch ( nApiRet ) - { - case NO_ERROR: return ERRCODE_NONE; - case ERROR_FILE_NOT_FOUND: return ERRCODE_IO_NOTEXISTS; - case ERROR_PATH_NOT_FOUND: return ERRCODE_IO_NOTEXISTSPATH; - case ERROR_TOO_MANY_OPEN_FILES: return ERRCODE_IO_TOOMANYOPENFILES; - case ERROR_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED; - case ERROR_NOT_ENOUGH_MEMORY: return ERRCODE_IO_OUTOFMEMORY; - case ERROR_BAD_FORMAT: return ERRCODE_IO_WRONGFORMAT; - case ERROR_NOT_SAME_DEVICE: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_WRITE_PROTECT: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_BAD_UNIT: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_CRC: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_NOT_DOS_DISK: return ERRCODE_IO_INVALIDDEVICE; - case ERROR_WRITE_FAULT: return ERRCODE_IO_CANTWRITE; - case ERROR_READ_FAULT: return ERRCODE_IO_CANTREAD; - case ERROR_SHARING_VIOLATION: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_LOCK_VIOLATION: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_WRONG_DISK: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_HANDLE_DISK_FULL: return ERRCODE_IO_OUTOFSPACE; - case ERROR_NOT_SUPPORTED: return ERRCODE_IO_NOTSUPPORTED; - case ERROR_DUP_NAME: return ERRCODE_IO_ALREADYEXISTS; - case ERROR_BAD_NETPATH: return ERRCODE_IO_NOTEXISTSPATH; - case ERROR_DEV_NOT_EXIST: return ERRCODE_IO_NOTEXISTS; - case ERROR_NETWORK_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED; - case ERROR_INVALID_PARAMETER: return ERRCODE_IO_INVALIDPARAMETER; - case ERROR_NET_WRITE_FAULT: return ERRCODE_IO_CANTWRITE; - case ERROR_DEVICE_IN_USE: return ERRCODE_IO_INVALIDPARAMETER; - case ERROR_DISK_FULL: return ERRCODE_IO_OUTOFSPACE; - case ERROR_BAD_ARGUMENTS: return ERRCODE_IO_INVALIDPARAMETER; - case ERROR_BAD_PATHNAME: return ERRCODE_IO_NOTEXISTSPATH; - case ERROR_LOCK_FAILED: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_LOCKED: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_DUPLICATE_NAME: return ERRCODE_IO_ALREADYEXISTS; - case ERROR_DIRECTORY_IN_CDS: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_CURRENT_DIRECTORY: return ERRCODE_IO_LOCKVIOLATION; - case ERROR_FILENAME_EXCED_RANGE: return ERRCODE_IO_NAMETOOLONG; - } - - OSL_TRACE( "FSys: unknown apiret error %d occurred", nApiRet ); - return FSYS_ERR_UNKNOWN; -} - -//-------------------------------------------------------------------- - -char* volumeid( const char* pPfad ) -{ - static FSINFO aFSInfoBuf; - ULONG ulFSInfoLevel = FSIL_VOLSER; - ULONG nDriveNumber; - - nDriveNumber = toupper(*pPfad) - 'A' + 1; - - if ( nDriveNumber >= 3 ) - { - APIRET rc = DosQueryFSInfo( - nDriveNumber, ulFSInfoLevel, &aFSInfoBuf, sizeof(FSINFO) ); - if ( rc ) - return 0; - return (char*) aFSInfoBuf.vol.szVolLabel; - } - return 0; -} - -//-------------------------------------------------------------------- - -/************************************************************************* -|* -|* DirEntry::ToAbs() -|* -*************************************************************************/ - -BOOL DirEntry::ToAbs() -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - if ( FSYS_FLAG_VOLUME == eFlag ) - { - eFlag = FSYS_FLAG_ABSROOT; - return TRUE; - } - - if ( IsAbs() ) - return TRUE; - - char sBuf[_MAX_PATH + 1]; - *this = DirEntry( String( getcwd( sBuf, _MAX_PATH ), osl_getThreadTextEncoding() ) ) + *this; - - return IsAbs(); -} - -/************************************************************************* -|* -|* DirEntry::GetVolume() -|* -*************************************************************************/ - -String DirEntry::GetVolume() const -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - String aRet; - const DirEntry *pTop = ImpGetTopPtr(); - ByteString aName = ByteString( pTop->aName ).ToLowerAscii(); - - if ( ( pTop->eFlag == FSYS_FLAG_ABSROOT || - pTop->eFlag == FSYS_FLAG_RELROOT || - pTop->eFlag == FSYS_FLAG_VOLUME ) - && aName != "a:" && aName != "b:" && Exists() ) - { - const char *pVol; - pVol = volumeid( (char*) pTop->aName.GetBuffer() ); - if (pVol) - aRet = String( pVol, osl_getThreadTextEncoding()); - } - - return aRet; -} - -/************************************************************************* -|* -|* DirEntry::SetCWD() -|* -*************************************************************************/ - -BOOL DirEntry::SetCWD( BOOL bSloppy ) const -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - if ( eFlag == FSYS_FLAG_CURRENT && !aName.Len() ) - return TRUE; - - if ( !chdir(ByteString(GetFull(), osl_getThreadTextEncoding()).GetBuffer()) ) - { - //nError = FSYS_ERR_OK; - return TRUE; - } - - if ( bSloppy && pParent && - !chdir(ByteString(pParent->GetFull(), osl_getThreadTextEncoding()).GetBuffer()) ) - { - //nError = FSYS_ERR_OK; - return TRUE; - } - - //nError = FSYS_ERR_NOTADIRECTORY; - return FALSE; -} - -/************************************************************************* -|* -|* DirEntry::MoveTo() -|* -*************************************************************************/ - - -//------------------------------------------------------------------------- - -USHORT DirReader_Impl::Init() -{ - // Block-Devices auflisten? - if ( pDir->eAttrMask & FSYS_KIND_BLOCK ) - { - CreateDriveMapImpl(); - // CWD merken - DirEntry aCurrentDir; - aCurrentDir.ToAbs(); - - // einzeln auf Existenz und Masken-konformit"at pr"ufen - USHORT nRead = 0; - char sDrive[3] = { '?', ':', 0 }; - char sRoot[4] = { '?', ':', '\\', 0 }; - for ( char c = 'a'; c <= 'z'; c++ ) - { - sDrive[0] = c; - sRoot[0] = c; - DirEntry* pDrive = new DirEntry( sDrive, FSYS_FLAG_VOLUME, FSYS_STYLE_HOST ); - if ( pDir->aNameMask.Matches( String( ByteString(sDrive), osl_getThreadTextEncoding())) - && aDriveMap[c-'a'].nKind != FSYS_KIND_UNKNOWN ) - { - if ( pDir->pStatLst ) //Status fuer Sort gewuenscht? - { - FileStat *pNewStat = new FileStat( *pDrive ); - pDir->ImpSortedInsert( pDrive, pNewStat ); - } - else - pDir->ImpSortedInsert( pDrive, NULL ); - ++nRead; - } - else - delete pDrive; - } - - // CWD restaurieren - aCurrentDir.SetCWD(); - return nRead; - } - - return 0; -} - -//------------------------------------------------------------------------- - -USHORT DirReader_Impl::Read() -{ - if (!pDosDir) - { - pDosDir = opendir( (char*) ByteString(aPath, osl_getThreadTextEncoding()).GetBuffer() ); - } - - if (!pDosDir) - { - bReady = TRUE; - return 0; - } - - // Directories und Files auflisten? - if ( ( pDir->eAttrMask & FSYS_KIND_DIR || pDir->eAttrMask & FSYS_KIND_FILE ) && - ( ( pDosEntry = readdir( pDosDir ) ) != NULL ) ) - { - String aD_Name(pDosEntry->d_name, osl_getThreadTextEncoding()); - if ( pDir->aNameMask.Matches( aD_Name ) ) - { - DirEntryFlag eFlag = - 0 == strcmp( pDosEntry->d_name, "." ) ? FSYS_FLAG_CURRENT - : 0 == strcmp( pDosEntry->d_name, ".." ) ? FSYS_FLAG_PARENT - : FSYS_FLAG_NORMAL; - DirEntry *pTemp = new DirEntry( ByteString(pDosEntry->d_name), eFlag, FSYS_STYLE_UNX ); - if ( pParent ) - pTemp->ImpChangeParent( new DirEntry( *pParent ), FALSE); - FileStat aStat( *pTemp ); - if ( ( ( ( pDir->eAttrMask & FSYS_KIND_DIR ) && - ( aStat.IsKind( FSYS_KIND_DIR ) ) ) || - ( ( pDir->eAttrMask & FSYS_KIND_FILE ) && - !( aStat.IsKind( FSYS_KIND_DIR ) ) ) ) && - !( pDir->eAttrMask & FSYS_KIND_VISIBLE && - pDosEntry->d_name[0] == '.' ) ) - { - if ( pDir->pStatLst ) //Status fuer Sort gewuenscht? - pDir->ImpSortedInsert( pTemp, new FileStat( aStat ) ); - else - pDir->ImpSortedInsert( pTemp, NULL );; - return 1; - } - else - delete pTemp; - } - } - else - bReady = TRUE; - return 0; -} - -/************************************************************************* -|* -|* FileStat::FileStat() -|* -*************************************************************************/ - -FileStat::FileStat( const void *pInfo, // struct dirent - const void * ): // dummy - aDateCreated(0), - aTimeCreated(0), - aDateModified(0), - aTimeModified(0), - aDateAccessed(0), - aTimeAccessed(0) -{ - struct dirent *pDirent = (struct dirent*) pInfo; - - nSize = pDirent->d_size; - - aDateCreated = MsDos2Date( (FDATE*) &pDirent->d_date ); - aTimeCreated = MsDos2Time( (FTIME*) &pDirent->d_time ); - aDateModified = aDateModified; - aTimeModified = aTimeModified; - aDateAccessed = aDateModified; - aTimeAccessed = aTimeModified; - - nKindFlags = FSYS_KIND_FILE; - if ( pDirent->d_type & DOS_DIRECT ) - nKindFlags = FSYS_KIND_DIR; -} - -/************************************************************************* -|* -|* FileStat::Update() -|* -*************************************************************************/ - -struct _FSYS_FSQBUFFER -{ - FSQBUFFER2 aBuf; - UCHAR sBuf[256]; -}; - -BOOL FileStat::Update( const DirEntry& rDirEntry, BOOL bAccessRemovableDevice ) -{ - nSize = 0; - FSysPathStyle eStyle = FSYS_STYLE_UNKNOWN; - aCreator.Erase(); - aType.Erase(); - aDateCreated = Date(0); - aTimeCreated = Time(0); - aDateModified = Date(0); - aTimeModified = Time(0); - aDateAccessed = Date(0); - aTimeAccessed = Time(0); - - if ( !rDirEntry.IsValid() ) - { - nError = FSYS_ERR_NOTEXISTS; - return FALSE; - } - - // Sonderbehandlung falls es sich um eine Root ohne Laufwerk handelt - if ( !rDirEntry.aName.Len() && rDirEntry.eFlag == FSYS_FLAG_ABSROOT ) - { - nKindFlags = FSYS_KIND_DIR; - nError = FSYS_ERR_OK; - return TRUE; - } - - // Sonderbehandlung falls es sich um eine Wildcard handelt - ByteString aTempName( rDirEntry.GetName(), osl_getThreadTextEncoding() ); - if ( strchr( aTempName.GetBuffer(), '?' ) || - strchr( aTempName.GetBuffer(), '*' ) || - strchr( aTempName.GetBuffer(), ';' ) ) - { - nKindFlags = FSYS_KIND_WILD; - nError = FSYS_ERR_OK; - return TRUE; - } - - // Sonderbehandlung falls es sich um eine Root handelt - if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME || - rDirEntry.eFlag == FSYS_FLAG_ABSROOT ) - { - if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME ) - nKindFlags = FSYS_KIND_DEV; - else - nKindFlags = FSYS_KIND_DIR; - - if ( rDirEntry.aName.Len() == 2 ) - { - if ( !bDriveMap ) - CreateDriveMapImpl(); - - ByteString rDirEntryUpperCase = ByteString( rDirEntry.aName ).ToUpperAscii(); - DriveMapItem &rItem = aDriveMap[rDirEntryUpperCase.GetChar(0) - 'A']; - if ( !rItem.nKind ) - { - nError = ERRCODE_IO_INVALIDDEVICE; - nKindFlags = FSYS_KIND_UNKNOWN; - return FALSE; - } - else - { - if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME ) - nKindFlags |= FSYS_KIND_BLOCK | rItem.nKind; - eStyle = rItem.nStyle; - } - } - - nError = FSYS_ERR_OK; - return TRUE; - } - - // disable error-boxes for hard-errors - DosError(FERR_DISABLEHARDERR); - - // Statusinformation vom Betriebssystem holen - DirEntry aTempDirEntry( rDirEntry ); - char* p; - - aTempDirEntry.ToAbs(); - ByteString aFullName( aTempDirEntry.GetFull(), osl_getThreadTextEncoding() ); - - p = (char *) aFullName.GetBuffer(); - - FILESTATUS3 filestat; - memset( &filestat, 0, sizeof( filestat ) ); - if( DosQueryPathInfo( (PSZ)p, 1, &filestat, sizeof( filestat ) ) ) - { - nError = FSYS_ERR_NOTEXISTS; - nKindFlags = FSYS_KIND_UNKNOWN; - return FALSE; - } - - nError = FSYS_ERR_OK; - nSize = filestat.cbFile; - - nKindFlags = FSYS_KIND_UNKNOWN; - if( filestat.attrFile & FILE_DIRECTORY ) - nKindFlags |= FSYS_KIND_DIR; - if ( nKindFlags == FSYS_KIND_UNKNOWN ) - nKindFlags = nKindFlags | FSYS_KIND_FILE; - - aDateModified = Date( filestat.fdateLastWrite.day, - filestat.fdateLastWrite.month, - filestat.fdateLastWrite.year + 1980 ); - - aTimeModified = Time( filestat.ftimeLastWrite.hours, - filestat.ftimeLastWrite.minutes, - filestat.ftimeLastWrite.twosecs*2 ); - - if ( filestat.fdateCreation.day ) - { - aDateCreated = Date( filestat.fdateCreation.day, - filestat.fdateCreation.month, - filestat.fdateCreation.year + 1980 ); - - aTimeCreated = Time( filestat.ftimeCreation.hours, - filestat.ftimeCreation.minutes, - filestat.ftimeCreation.twosecs*2 ); - } - else - { - aDateCreated = aDateModified; - aTimeCreated = aTimeModified; - } - - if ( filestat.fdateLastAccess.day > 0 ) - { - aDateAccessed = Date( filestat.fdateLastAccess.day, - filestat.fdateLastAccess.month, - filestat.fdateLastAccess.year + 1980 ); - - aTimeAccessed = Time( filestat.ftimeLastAccess.hours, - filestat.ftimeLastAccess.minutes, - filestat.ftimeLastAccess.twosecs*2 ); - } - else - { - aDateAccessed = aDateModified; - aTimeAccessed = aTimeModified; - } - - return TRUE; -} - -BOOL IsRedirectable_Impl( const ByteString &rPath ) -{ - if ( rPath.Len() >= 3 && ':' == rPath.GetBuffer()[1] ) - { - ByteString aVolume = rPath.Copy( 0, 3 ); - DriveMapItem &rItem = aDriveMap[toupper(aVolume.GetChar(0)) - 'A']; - return FSYS_KIND_FIXED != rItem.nKind; - } - return FALSE; -} - - -/************************************************************************* -|* -|* TempDirImpl() -|* -|* Beschreibung liefert den Namens des Directories fuer temporaere -|* Dateien -|* -*************************************************************************/ - -const char* TempDirImpl( char *pBuf ) -{ - PSZ pVar; - USHORT nRet; - BOOL bAppendTemp = FALSE; // mu\s noch \\temp angeh"angt werden - - // Erstmal sehen, ob TEMP oder TMP gesetzt sind - nRet = DosScanEnv( (PSZ)"TEMP", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"temp", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"TMP", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"tmp", &pVar ); - if( nRet ) - nRet = DosScanEnv( (PSZ)"TMPDIR", &pVar ); - - // falls das geklappt hat, und ein Backslash dranhaengt, - // oder falls es bisher nicht geklappt hat, - // muessen wir nachher einen Backslash entfernen - BOOL bRemoveBS = nRet || *(pVar+strlen(pVar)-1) == '\\'; - - // Keine temp-Variable gefunden, dann gehen wir mal auf die Suche - // nach dem System-Laufwerk - if( nRet ) - { - nRet = DosScanEnv( (PSZ)"USER_INI",&pVar ); - bAppendTemp = (0 == nRet); - } - if( nRet ) - { - nRet = DosScanEnv( (PSZ)"SYSTEM_INI", &pVar ); - bAppendTemp = (0 == nRet); - } - if( nRet ) - // Wenn das immer noch nicht reicht nehmen wir eben die Root von C: -#ifdef __BORLANDC__ - pVar = (PSZ)"c:\\temp\\"; -#else - pVar = (PCSZ)"c:\\temp\\"; -#endif - strcpy( pBuf, (const char*)pVar ); - - // jetzt haengt ggf. ein Backlash dran, den wir abschneiden, - // ggf. inklusive dahinter haengendem Dateinamen - if ( bRemoveBS ) - { - char *pTail = pBuf + strlen(pBuf) - 1; - for ( char cLast = *pTail; cLast != '\\'; cLast = *(--pTail) ) - *pTail = 0; - } - - if ( bAppendTemp ) - strcat( pBuf, "\\temp" ); - DirEntry( pBuf ).MakeDir(); - - return pBuf; -} - -#define CURRENT_COUNTRY 0 -#define NLS_CODEPAGE 850 - -/*==================================================================== - * CreateDriveMapImpl() - * creates a map of drive-infos like FileSystem (style) and Kind (remote) - *--------------------------------------------------------------------*/ -typedef struct _FSQBUFFER_ -{ - FSQBUFFER2 aBuf; - UCHAR sBuf[64]; -} FSQBUFFER_; - -void CreateDriveMapImpl() -{ -#ifdef POWERPC - // !!!!! Hack, da der untere Teil mit Beta 2 noch abstuertzt !!!!! - BYTE nFloppies = 1; - for ( USHORT nDrive = 0; nDrive < 26; ++nDrive ) - { - if ( nDrive < nFloppies ) - { - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE; - aDriveMap[nDrive].nStyle = FSYS_STYLE_FAT; - } - else - { - aDriveMap[nDrive].nKind = FSYS_KIND_UNKNOWN; - aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN; - } - } - - aDriveMap[2].nKind = FSYS_KIND_FIXED; - aDriveMap[2].nStyle = FSYS_STYLE_FAT; -#else - FSQBUFFER_ aBuf; - ULONG nBufLen; - APIRET nRet; - USHORT nDrive; - - // disable error-boxes for hard-errors - DosError(FERR_DISABLEHARDERR); - - // determine number of floppy-drives - BYTE nFloppies; - nRet = DosDevConfig( (void*) &nFloppies, DEVINFO_FLOPPY ); - - // reset the map - for ( nDrive = 0; nDrive < 26; ++nDrive ) - { - if ( nDrive < nFloppies ) - { - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE; - aDriveMap[nDrive].nStyle = FSYS_STYLE_FAT; - } - else - { - aDriveMap[nDrive].nKind = FSYS_KIND_UNKNOWN; - aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN; - } - } - - // determine file-system via DosOpen/DocDevIOCtrl - for ( nDrive = 2; nDrive < 26; ++nDrive ) - { - // open drive - BOOL bFixed; - HFILE nDevHandle; - char pDriveName[3] = "#:"; - pDriveName[0] = nDrive+'a'; - ULONG nAction; - nRet = DosOpen( (PSZ) pDriveName, &nDevHandle, - &nAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS, - OPEN_FLAGS_DASD|OPEN_SHARE_DENYNONE|OPEN_ACCESS_READONLY, - 0 ); - - // exists? - if ( !nRet ) - { - // removeable? - BYTE nDriveId = nDrive; - ULONG nParaOutLen, nDataOutLen; - nRet = DosDevIOCtl(nDevHandle, 8, 0x20, - &nDriveId, sizeof(nDriveId), &nParaOutLen, - &bFixed, sizeof(bFixed), &nDataOutLen ); - - // prepare the drive-map - if ( !nRet && !bFixed ) - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE; - - // close drive - DosClose(nDevHandle); - } - else if ( nRet == ERROR_NOT_READY ) - aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE | FSYS_KIND_CDROM; - } - - // determine file-system via FSAttach - nRet = 0; - for ( USHORT n = 3; nRet != ERROR_NO_MORE_ITEMS; ++n ) - { - nBufLen = sizeof( aBuf ); - nRet = DosQueryFSAttach( 0, n, FSAIL_DRVNUMBER, - (_FSQBUFFER2*) &aBuf, &nBufLen ); - if ( !nRet ) - { - nDrive = toupper(aBuf.aBuf.szName[0]) - 'A'; - - if ( aDriveMap[nDrive].nKind == FSYS_KIND_UNKNOWN ) - aDriveMap[nDrive].nKind = - aBuf.aBuf.iType == 3 ? FSYS_KIND_FIXED : - aBuf.aBuf.iType == 4 ? FSYS_KIND_REMOTE : - FSYS_KIND_UNKNOWN; - - char *pType = (char*)(aBuf.aBuf.szName + aBuf.aBuf.cbName + 1); - aDriveMap[nDrive].nStyle = - strcmp( pType, "FAT" ) == 0 ? FSYS_STYLE_FAT : - strcmp( pType, "FAT32" ) == 0 ? FSYS_STYLE_VFAT : - strcmp( pType, "NTFS" ) == 0 ? FSYS_STYLE_NTFS : - strcmp( pType, "HPFS" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "JFS" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "RAMFS" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "NDFS32" ) == 0 ? FSYS_STYLE_HPFS : - strcmp( pType, "NWFS" ) == 0 ? FSYS_STYLE_NWFS : - strcmp( pType, "EXT2" ) == 0 ? FSYS_STYLE_UNX : - strcmp( pType, "NFS" ) == 0 ? FSYS_STYLE_UNX : - FSYS_STYLE_UNKNOWN; - if ( strcmp( pType, "CDFS" ) == 0 ) - aDriveMap[nDrive].nKind = FSYS_KIND_CDROM|FSYS_KIND_REMOVEABLE; - } - } -#endif - - bDriveMap = TRUE; -} - -Time MsDos2Time( const time_t *pTimeT ) -{ - tm *pTm = localtime( pTimeT ); - if ( pTm ) - return Time( pTm->tm_hour, pTm->tm_min, pTm->tm_sec ); - else - return Time(0); -} - -Date MsDos2Date( const time_t *pTimeT ) -{ - tm *pTm = localtime( pTimeT ); - if ( pTm ) - return Date( pTm->tm_mday, pTm->tm_mon + 1, pTm->tm_year ); - else - return Date(0); -} - -/************************************************************************* -|* -|* DirEntry::GetPathStyle() const -|* -*************************************************************************/ - -FSysPathStyle DirEntry::GetPathStyle( const String &rDevice ) -{ - ByteString aRootDir(rDevice, osl_getThreadTextEncoding()); - // UNC-Pathname? - if ( aRootDir.Len()==0 || ( aRootDir.Len() > 1 && aRootDir.GetChar(1) != ':' ) ) - return FSYS_STYLE_UNKNOWN; - - if ( !bDriveMap ) - CreateDriveMapImpl(); - return aDriveMap[toupper(aRootDir.GetChar(0)) - 'A'].nStyle; -} - -/************************************************************************* -|* -|* DirEntry::IsCaseSensitive() const -|* -*************************************************************************/ - -BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const -{ - if (eFormatter==FSYS_STYLE_HOST) - { - if (GetPathStyle(GetDevice().GetName()) == FSYS_STYLE_UNX) - { - return TRUE; - } - else - { - return FALSE; - } - } - else - { - BOOL isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_DETECT: - { - isCaseSensitive = FALSE; - break; - } - case FSYS_STYLE_SYSV: - case FSYS_STYLE_BSD: - { - isCaseSensitive = TRUE; - break; - } - default: - { - isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv - break; - } - } - return isCaseSensitive; - } -} - - - - -//========================================================================= - -ErrCode FileStat::QueryDiskSpace( const String &rPath, - BigInt &rFreeBytes, BigInt &rTotalBytes ) -{ - FSALLOCATE aFSInfoBuf; - ByteString aVol( DirEntry(rPath).ImpGetTopPtr()->GetName(), osl_getThreadTextEncoding()); - ULONG nDriveNumber = toupper( aVol.GetChar(0) ) - 'A' + 1; - - APIRET rc = DosQueryFSInfo( nDriveNumber, FSIL_ALLOC, - &aFSInfoBuf, sizeof(aFSInfoBuf) ); - if ( rc ) - return Sys2SolarError_Impl( rc ); - - BigInt aBytesPerCluster( BigInt(aFSInfoBuf.cbSector) * - BigInt(aFSInfoBuf.cSectorUnit) ); - rFreeBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnitAvail); - rTotalBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnit); - return 0; -} - -//========================================================================= - -void FSysEnableSysErrorBox( BOOL bEnable ) -{ - DosError( bEnable ? 0 : FERR_DISABLEHARDERR ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/os2.hxx b/tools/source/fsys/os2.hxx deleted file mode 100644 index 8fd984692ac1..000000000000 --- a/tools/source/fsys/os2.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _os2_hxx -#define _os2_hxx - - -#define INCL_DOSEXCEPTIONS -#define INCL_DOSFILEMGR -#define INCL_DOSPROCESS -#define INCL_DOSDEVICES -#define INCL_DOSERRORS -#define INCL_DOSMISC -#define INCL_DOSNLS /* National Language Support values */ -#include <svpm.h> - -#include <dirent.h> -#include <string.h> - -#include <sys\types.h> -#include <sys\stat.h> -#include <stdio.h> -#include <ctype.h> -#include <emx/syscalls.h> - -#define FSYS_UNIX FALSE - -#define DOS_DIRECT _A_SUBDIR -#define DOS_VOLUMEID _A_VOLID - -#define _mkdir(p) mkdir(p, 0777) - -const char* TempDirImpl( char *pBuf ); -String ToLowerImpl( const String& ); - -#define DEFSTYLE FSYS_STYLE_OS2 -#define MKDIR( p ) mkdir( (unsigned char*) p ) -#define CMP_LOWER(s) ( s.ToLowerAscii() ) - -#define START_DRV 'a' - -inline BOOL DRIVE_EXISTS( char c ) -{ - ULONG nCur, nMap; - APIRET nRet = DosQueryCurrentDisk( &nCur, &nMap ); - return ( nMap & 1 << (c - 'a') ) != 0; -} - -#include <time.h> - -inline Time MsDos2Time( FTIME* aTime ) -{ - return Time( aTime->hours, aTime->minutes, 2*aTime->twosecs ); -} - -inline Date MsDos2Date( FDATE* aDate ) -{ - return Date( aDate->day, aDate->month, aDate->year ); -} - -Time MsDos2Time( const time_t *pTimeT ); - -Date MsDos2Date( const time_t *pTimeT ); - -#define FSysFailOnErrorImpl() - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx index 575d2c492c5b..6d16a5ed605a 100644 --- a/tools/source/fsys/tdir.cxx +++ b/tools/source/fsys/tdir.cxx @@ -334,7 +334,7 @@ void Dir::Reset() #endif // gibt es das zu oeffnende Verzeichnis ueberhaupt? -#if !defined(UNX) && !defined(OS2) //explanation: see DirReader_Impl::Read() in unx.cxx +#if !defined(UNX) //explanation: see DirReader_Impl::Read() in unx.cxx if( !pReader->pDosDir ) { nError = FSYS_ERR_NOTADIRECTORY; diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx index 53d319800319..ccfe6b92f39f 100644 --- a/tools/source/fsys/unx.cxx +++ b/tools/source/fsys/unx.cxx @@ -191,81 +191,6 @@ static sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab) #endif -/************************************************************************ -|* -|* DirEntry::IsCaseSensitive() -|* -*************************************************************************/ - -sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const -{ - - if (eFormatter==FSYS_STYLE_HOST) - { -#if defined(NETBSD) || defined(DRAGONFLY) - return sal_True; -#else - struct stat buf; - DirEntry aPath(*this); - aPath.ToAbs(); - - while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf)) - { - if (aPath.Level() == 1) - { - return sal_True; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv - } - aPath = aPath [1]; - } - - struct mymnttab fsmnt; - GetMountEntry(buf.st_dev, &fsmnt); - if ((fsmnt.mymnttab_filesystem.CompareTo("msdos")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("umsdos")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("vfat")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("hpfs")==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("smb") ==COMPARE_EQUAL) || - (fsmnt.mymnttab_filesystem.CompareTo("ncpfs")==COMPARE_EQUAL)) - { - return sal_False; - } - else - { - return sal_True; - } -#endif - } - else - { - sal_Bool isCaseSensitive = sal_True; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: - { - isCaseSensitive = sal_False; - break; - } - case FSYS_STYLE_SYSV: - case FSYS_STYLE_BSD: - case FSYS_STYLE_DETECT: - { - isCaseSensitive = sal_True; - break; - } - default: - { - isCaseSensitive = sal_True; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv - break; - } - } - return isCaseSensitive; - } -} /************************************************************************ |* diff --git a/tools/source/fsys/unx.hxx b/tools/source/fsys/unx.hxx index bb87f157069d..b0cb3d2e77c9 100644 --- a/tools/source/fsys/unx.hxx +++ b/tools/source/fsys/unx.hxx @@ -47,11 +47,7 @@ #define _getcwd getcwd #define _access access -#ifdef SYSV3 -#define DEFSTYLE FSYS_STYLE_SYSV -#else #define DEFSTYLE FSYS_STYLE_BSD -#endif #define CMP_LOWER(s) (s) #define TEMPNAME() tmpnam(0) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 57531aa4b05e..50ade63a46cd 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -2219,6 +2219,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, { "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV, PrefixInfo::OFFICIAL }, { "sftp:", 0, INET_PROT_SFTP, PrefixInfo::OFFICIAL } }; + /* This list needs to be sorted, or you'll introduce serious bugs */ PrefixInfo const * pFirst = aMap + 1; PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1; diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx index cfe64bea12f8..fa18aa46fcf1 100644 --- a/tools/source/fsys/wntmsc.cxx +++ b/tools/source/fsys/wntmsc.cxx @@ -114,142 +114,9 @@ int closedir( DIR *pDir ) |* *************************************************************************/ -ErrCode GetPathStyle_Impl( const String &rDevice, FSysPathStyle &rStyle ) +FSysPathStyle DirEntry::GetPathStyle( const String & ) { - ByteString aRootDir(rDevice, osl_getThreadTextEncoding()); - if ( aRootDir.Len() && aRootDir.GetBuffer()[aRootDir.Len()-1] != '\\' ) - aRootDir += '\\'; - - char sVolumeName[256]; - char sFileSysName[16]; - DWORD nSerial[2]; - DWORD nMaxCompLen[2]; - DWORD nFlags[2]; - - // Windows95 hat VFAT, WindowsNT nicht - DWORD nVer = GetVersion(); - sal_Bool bW95 = ( nVer & 0xFF ) >= 4; - - FSysFailOnErrorImpl(); - rStyle = FSYS_STYLE_UNKNOWN; - if ( GetVolumeInformation( - (char*) aRootDir.GetBuffer(), - sVolumeName, 256, (LPDWORD) &nSerial, (LPDWORD) &nMaxCompLen, - (LPDWORD) &nFlags, sFileSysName, 16 ) ) - { - // FAT/VFAT? - if ( 0 == strcmp( "FAT", sFileSysName ) ) - rStyle = bW95 ? FSYS_STYLE_VFAT : FSYS_STYLE_FAT; - - // NTFS? - else if ( 0 == strcmp( "NTFS", sFileSysName ) ) - rStyle = FSYS_STYLE_NTFS; - - // HPFS? - else if ( 0 == strcmp( "HPFS", sFileSysName ) ) - rStyle = FSYS_STYLE_HPFS; - - // NWCOMPA/NWFS? - else if ( 0 == strncmp( "NW", sFileSysName, 2 ) ) - rStyle = FSYS_STYLE_NWFS; - - return ERRCODE_NONE; - } - - return ERRCODE_IO_INVALIDDEVICE; -} - -FSysPathStyle DirEntry::GetPathStyle( const String &rDevice ) -{ - - FSysPathStyle eStyle; - GetPathStyle_Impl( rDevice, eStyle ); - return eStyle; -} - -/************************************************************************* -|* -|* DirEntry::IsCaseSensitive() -|* -*************************************************************************/ - -sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const -{ - - if (eFormatter==FSYS_STYLE_HOST) - { -/* - DirEntry aRoot(*this); - aRoot.ToAbs(); - aRoot = aRoot[Level()-1]; - String aRootDir = aRoot.GetFull(FSYS_STYLE_HOST, sal_True); - - char sVolumeName[256]; - DWORD nVolumeSerial; - DWORD nMaxCompLen; - DWORD nFlags; - char sFileSysName[16]; - - if ( GetVolumeInformation( (char*) aRootDir.GetStr(), - sVolumeName, - 256, - (LPDWORD) &nVolumeSerial, - (LPDWORD) &nMaxCompLen, - (LPDWORD) &nFlags, - sFileSysName, - 16 )) - { - return (nFlags & FS_CASE_SENSITIVE) ? sal_True : sal_False; - } - else - { - return sal_False; - } -*/ - // - // guter versuch, aber FS_CASE_SENSITIVE ist D?nnsinn in T?ten: - // - // sFileSysName FS_CASE_SENSITIVE - // FAT sal_False - // NTFS sal_True !!! - // NWCompat sal_False - // Samba sal_False - // - // NT spricht auch NTFS lediglich case preserving an, also ist unter NT alles case insensitiv - // - - return sal_False; - } - else - { - sal_Bool isCaseSensitive = sal_False; // ich bin unter win32, also ist der default case insensitiv - switch ( eFormatter ) - { - case FSYS_STYLE_MAC: - case FSYS_STYLE_FAT: - case FSYS_STYLE_VFAT: - case FSYS_STYLE_NTFS: - case FSYS_STYLE_NWFS: - case FSYS_STYLE_HPFS: - case FSYS_STYLE_DETECT: - { - isCaseSensitive = sal_False; - break; - } - case FSYS_STYLE_SYSV: - case FSYS_STYLE_BSD: - { - isCaseSensitive = sal_True; - break; - } - default: - { - isCaseSensitive = sal_False; // ich bin unter win32, also ist der default case insensitiv - break; - } - } - return isCaseSensitive; - } + return FSYS_STYLE_NTFS; } /************************************************************************* diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index 9a209b38f754..5560e631767a 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -261,6 +261,53 @@ ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) // ----------------------------------------------------------------------- +// CMYK values from 0 to 1 +ColorData Color::CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ) +{ + fCyan = (fCyan * ( 1.0 - fKey )) + fKey; + fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey; + fYellow = (fYellow * ( 1.0 - fKey )) + fKey; + + sal_uInt8 nRed = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fCyan ) * 255.0, 255.0), 0.0 ) ); + sal_uInt8 nGreen = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fMagenta ) * 255.0, 255.0), 0.0 ) ); + sal_uInt8 nBlue = static_cast< sal_uInt8 >( std::max( std::min( ( 1.0 - fYellow ) * 255.0, 255.0), 0.0 ) ); + + return RGB_COLORDATA( nRed, nGreen, nBlue ); +} + +// ----------------------------------------------------------------------- + +// RGB values from 0 to 255 +// CMY results from 0 to 1 +void Color::RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ) +{ + fCyan = 1 - ( GetRed() / 255.0 ); + fMagenta = 1 - ( GetGreen() / 255.0 ); + fYellow = 1 - ( GetBlue() / 255.0 ); + + //CMYK and CMY values from 0 to 1 + fKey = 1.0; + if( fCyan < fKey ) fKey = fCyan; + if( fMagenta < fKey ) fKey = fMagenta; + if( fYellow < fKey ) fKey = fYellow; + + if ( fKey == 1.0 ) + { + //Black + fCyan = 0.0; + fMagenta = 0.0; + fYellow = 0.0; + } + else + { + fCyan = ( fCyan - fKey ) / ( 1.0 - fKey ); + fMagenta = ( fMagenta - fKey ) / ( 1.0 - fKey ); + fYellow = ( fYellow - fKey ) / ( 1.0 - fKey ); + } +} + +// ----------------------------------------------------------------------- + SvStream& Color::Read( SvStream& rIStm, sal_Bool bNewFormat ) { if ( bNewFormat ) diff --git a/tools/source/generic/toolsin.cxx b/tools/source/generic/toolsin.cxx index 1ffded2d1013..36ae30096f59 100644 --- a/tools/source/generic/toolsin.cxx +++ b/tools/source/generic/toolsin.cxx @@ -36,7 +36,7 @@ #include <tools/debug.hxx> #include <toolsin.hxx> -#if defined WNT || defined OS2 +#if defined WNT #include <dll.hxx> #endif @@ -90,9 +90,6 @@ void GlobalDeInitTools() #if defined WNT ImpDeInitWinTools(); #endif -#ifdef OS2 - ImpDeInitOS2Tools(); -#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 9390cdd12a9e..07d404b090ad 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -1686,9 +1686,9 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) for( pOldPos = pChar = (const sal_Char *) pMsgBuffer->GetData(); nBufSize--; pChar++ ) { - int status; if( *pChar == '\r' || *pChar == '\n' ) { + int status; if( aDelim.CompareTo (pOldPos, aDelim.Len()) != COMPARE_EQUAL && aClose.CompareTo (pOldPos, aClose.Len()) diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index d68b71f255ae..fc31ffc69b74 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -33,7 +33,6 @@ #include <stdio.h> #include <stdlib.h> #include <tools/debug.hxx> -#include <tools/table.hxx> #include <tools/stream.hxx> #include <tools/resmgr.hxx> #include <tools/rc.hxx> @@ -121,7 +120,7 @@ class InternalResMgr void * LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, void **pResHandle ); public: - void FreeGlobalRes( void *, void * ); + static void FreeGlobalRes( void *, void * ); SvStream * GetBitmapStream( sal_uInt32 nResId ); }; @@ -242,7 +241,7 @@ void ResMgrContainer::init() DirectoryItem aItem; while( aDir.getNextItem( aItem ) == FileBase::E_None ) { - FileStatus aStatus(FileStatusMask_FileName); + FileStatus aStatus(osl_FileStatus_Mask_FileName); if( aItem.getFileStatus( aStatus ) == FileBase::E_None ) { OUString aFileName = aStatus.getFileName(); @@ -662,9 +661,7 @@ sal_Bool InternalResMgr::Create() } } rtl_freeMemory( pContentBuf ); -#ifndef OS2 OSL_ENSURE( bSorted, "content not sorted" ); -#endif OSL_ENSURE( bEqual2Content, "resource structure wrong" ); if( !bSorted ) ::std::sort(pContent,pContent+nEntries,ImpContentLessCompare()); @@ -965,7 +962,7 @@ void ResMgr::Init( const OUString& rFileName ) pVoid = pImpRes->LoadGlobalRes( RSC_VERSIONCONTROL, RSCVERSION_ID, &aResHandle ); if ( pVoid ) - pImpRes->FreeGlobalRes( aResHandle, pVoid ); + InternalResMgr::FreeGlobalRes( aResHandle, pVoid ); else { ByteString aStr( "Wrong version:\n" ); @@ -1000,7 +997,7 @@ ResMgr::~ResMgr() while( nCurStack > 0 ) { if( ( aStack[nCurStack].Flags & (RC_GLOBAL | RC_NOTFOUND) ) == RC_GLOBAL ) - pImpRes->FreeGlobalRes( aStack[nCurStack].aResHandle, + InternalResMgr::FreeGlobalRes( aStack[nCurStack].aResHandle, aStack[nCurStack].pResource ); nCurStack--; } @@ -1287,7 +1284,7 @@ void ResMgr::PopContext( const Resource* pResObj ) // Resource freigeben if( (pTop->Flags & (RC_GLOBAL | RC_NOTFOUND)) == RC_GLOBAL ) // kann auch Fremd-Ressource sein - pImpRes->FreeGlobalRes( pTop->aResHandle, pTop->pResource ); + InternalResMgr::FreeGlobalRes( pTop->aResHandle, pTop->pResource ); decStack(); } } @@ -2030,7 +2027,7 @@ UniString SimpleResMgr::ReadString( sal_uInt32 nId ) // not neccessary with te current implementation which holds the string table permanently, but to be sure .... // note: pFallback cannot be NULL here and is either the fallback or m_pResImpl - pFallback->FreeGlobalRes( pResHeader, pResHandle ); + InternalResMgr::FreeGlobalRes( pResHeader, pResHandle ); if( m_pResImpl != pFallback ) { osl::Guard<osl::Mutex> aGuard2( getResMgrMutex() ); diff --git a/tools/source/stream/strmos2.cxx b/tools/source/stream/strmos2.cxx deleted file mode 100644 index 3957910cbfdb..000000000000 --- a/tools/source/stream/strmos2.cxx +++ /dev/null @@ -1,615 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <limits.h> - -#define INCL_PM -#define INCL_DOS -#define INCL_DOSERRORS -#include <svpm.h> - -#include <tools/debug.hxx> -#include <tools/fsys.hxx> -#include <tools/stream.hxx> - -// class FileBase -#include <osl/file.hxx> - -using namespace osl; - -// class FileBase -#include <osl/file.hxx> - -using namespace osl; - -// ----------------------------------------------------------------------- - -// -------------- -// - StreamData - -// -------------- - -class StreamData -{ -public: - HFILE hFile; - sal_Bool bIsEof; - - StreamData() - { - hFile = 0; - bIsEof = sal_True; - } -}; - -// ----------------------------------------------------------------------- - -sal_uIntPtr GetSvError( APIRET nPMError ) -{ - static struct { APIRET pm; sal_uIntPtr sv; } errArr[] = - { - { ERROR_FILE_NOT_FOUND, SVSTREAM_FILE_NOT_FOUND }, - { ERROR_PATH_NOT_FOUND, SVSTREAM_PATH_NOT_FOUND }, - { ERROR_TOO_MANY_OPEN_FILES, SVSTREAM_TOO_MANY_OPEN_FILES }, - { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED }, - { ERROR_INVALID_ACCESS, SVSTREAM_INVALID_ACCESS }, - { ERROR_SHARING_VIOLATION, SVSTREAM_SHARING_VIOLATION }, - { ERROR_SHARING_BUFFER_EXCEEDED,SVSTREAM_SHARE_BUFF_EXCEEDED }, - { ERROR_CANNOT_MAKE, SVSTREAM_CANNOT_MAKE }, - { ERROR_INVALID_PARAMETER, SVSTREAM_INVALID_PARAMETER }, - { ERROR_DRIVE_LOCKED, SVSTREAM_LOCKING_VIOLATION }, - { ERROR_LOCK_VIOLATION, SVSTREAM_LOCKING_VIOLATION }, - { ERROR_FILENAME_EXCED_RANGE, SVSTREAM_INVALID_PARAMETER }, - { ERROR_ATOMIC_LOCK_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER }, - { ERROR_READ_LOCKS_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER }, - - - { 0xFFFF, SVSTREAM_GENERALERROR } - }; - - sal_uIntPtr nRetVal = SVSTREAM_GENERALERROR; // Standardfehler - int i=0; - do - { - if( errArr[i].pm == nPMError ) - { - nRetVal = errArr[i].sv; - break; - } - i++; - } - while( errArr[i].pm != 0xFFFF ); - return nRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::SvFileStream() -|* -*************************************************************************/ - -SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) -{ - bIsOpen = sal_False; - nLockCounter = 0; - bIsWritable = sal_False; - pInstanceData = new StreamData; - - SetBufferSize( 8192 ); - // convert URL to SystemPath, if necessary - ::rtl::OUString aFileName, aNormPath; - - if ( FileBase::getSystemPathFromFileURL( rFileName, aFileName ) != FileBase::E_None ) - aFileName = rFileName; - Open( aFileName, nOpenMode ); -} - -/************************************************************************* -|* -|* SvFileStream::SvFileStream() -|* -*************************************************************************/ - -SvFileStream::SvFileStream() -{ - bIsOpen = sal_False; - nLockCounter = 0; - bIsWritable = sal_False; - pInstanceData = new StreamData; - SetBufferSize( 8192 ); -} - -/************************************************************************* -|* -|* SvFileStream::~SvFileStream() -|* -*************************************************************************/ - -SvFileStream::~SvFileStream() -{ - Close(); - if( pInstanceData ) - delete pInstanceData; -} - -/************************************************************************* -|* -|* SvFileStream::GetFileHandle() -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::GetFileHandle() const -{ - return (sal_uIntPtr)pInstanceData->hFile; -} - -/************************************************************************* -|* -|* SvFileStream::IsA() -|* -*************************************************************************/ - -sal_uInt16 SvFileStream::IsA() const -{ - return ID_FILESTREAM; -} - -/************************************************************************* -|* -|* SvFileStream::GetData() -|* -|* Beschreibung STREAM.SDW, Prueft nicht Eof; IsEof danach rufbar -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::GetData( void* pData, sal_uIntPtr nSize ) -{ -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::GetData(): " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes from "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); -#endif - - sal_uIntPtr nCount = 0L; - if( IsOpen() ) - { - APIRET nResult; - nResult = DosRead( pInstanceData->hFile,(PVOID)pData,nSize,&nCount ); - if( nResult ) - SetError(::GetSvError(nResult) ); - } - return nCount; -} - -/************************************************************************* -|* -|* SvFileStream::PutData() -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::PutData( const void* pData, sal_uIntPtr nSize ) -{ -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStrean::PutData: " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes to "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); -#endif - - sal_uIntPtr nCount = 0L; - if( IsOpen() ) - { - APIRET nResult; - nResult = DosWrite( pInstanceData->hFile,(PVOID)pData,nSize,&nCount ); - if( nResult ) - SetError(::GetSvError(nResult) ); - else if( !nCount ) - SetError( SVSTREAM_DISK_FULL ); - } - return nCount; -} - -/************************************************************************* -|* -|* SvFileStream::SeekPos() -|* -*************************************************************************/ - -sal_uIntPtr SvFileStream::SeekPos( sal_uIntPtr nPos ) -{ - sal_uIntPtr nNewPos = 0L; - if( IsOpen() ) - { - APIRET nResult; - - if( nPos != STREAM_SEEK_TO_END ) - nResult = DosSetFilePtr( pInstanceData->hFile,(long)nPos, - FILE_BEGIN, &nNewPos ); - else - nResult = DosSetFilePtr( pInstanceData->hFile,0L, - FILE_END, &nNewPos ); - - if( nResult ) - SetError(::GetSvError(nResult) ); - } - else - SetError( SVSTREAM_GENERALERROR ); - return nNewPos; -} - -/************************************************************************* -|* -|* SvFileStream::Tell() -|* -*************************************************************************/ -/* -sal_uIntPtr SvFileStream::Tell() -{ - sal_uIntPtr nPos = 0L; - - if( IsOpen() ) - { - APIRET nResult; - nResult = DosSetFilePtr(pInstanceData->hFile,0L,FILE_CURRENT,&nPos); - if( nResult ) - SetError(::GetSvError(nResult) ); - } - return nPos; -} -*/ - -/************************************************************************* -|* -|* SvFileStream::FlushData() -|* -*************************************************************************/ - -void SvFileStream::FlushData() -{ - if( IsOpen() ) - { - APIRET nResult; - nResult = DosResetBuffer(pInstanceData->hFile ); - if( nResult ) - SetError(::GetSvError(nResult) ); - } -} - -/************************************************************************* -|* -|* SvFileStream::LockRange() -|* -*************************************************************************/ - -sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) -{ - sal_Bool bRetVal = sal_False; - if( IsOpen() ) - { - APIRET nResult; - FILELOCK aLockArea, aUnlockArea; - aUnlockArea.lOffset = 0L; - aUnlockArea.lRange = 0L; - aLockArea.lOffset = (long)nByteOffset; - aLockArea.lRange = (long)nBytes; - - nResult = DosSetFileLocks(pInstanceData->hFile, - &aUnlockArea, &aLockArea, - 1000UL, // Zeit in ms bis Abbruch - 0L // kein Atomic-Lock - ); - - if( nResult ) - SetError(::GetSvError(nResult) ); - else - bRetVal = sal_True; - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::UnlockRange() -|* -*************************************************************************/ - -sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) -{ - sal_Bool bRetVal = sal_False; - if( IsOpen() ) - { - APIRET nResult; - FILELOCK aLockArea, aUnlockArea; - aLockArea.lOffset = 0L; - aLockArea.lRange = 0L; - aUnlockArea.lOffset = (long)nByteOffset; - aUnlockArea.lRange = (long)nBytes; - - nResult = DosSetFileLocks(pInstanceData->hFile, - &aUnlockArea, &aLockArea, - 1000UL, // Zeit in ms bis Abbruch - 0L // kein Atomic-Lock - ); - - if( nResult ) - SetError(::GetSvError(nResult) ); - else - bRetVal = sal_True; - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::LockFile() -|* -*************************************************************************/ - -sal_Bool SvFileStream::LockFile() -{ - sal_Bool bRetVal = sal_False; - if( !nLockCounter ) - { - if( LockRange( 0L, LONG_MAX ) ) - { - nLockCounter = 1; - bRetVal = sal_True; - } - } - else - { - nLockCounter++; - bRetVal = sal_True; - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::UnlockFile() -|* -*************************************************************************/ - -sal_Bool SvFileStream::UnlockFile() -{ - sal_Bool bRetVal = sal_False; - if( nLockCounter > 0) - { - if( nLockCounter == 1) - { - if( UnlockRange( 0L, LONG_MAX ) ) - { - nLockCounter = 0; - bRetVal = sal_True; - } - } - else - { - nLockCounter--; - bRetVal = sal_True; - } - } - return bRetVal; -} - -/************************************************************************* -|* -|* SvFileStream::Open() -|* -*************************************************************************/ - -void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) -{ - String aParsedFilename; - - { - aParsedFilename = rFilename; - } - - Close(); - SvStream::ClearBuffer(); - - sal_uIntPtr nActionTaken; - sal_uIntPtr nOpenAction = 0L; - sal_uIntPtr nShareBits = 0L; - sal_uIntPtr nReadWriteBits = 0L; - - eStreamMode = nOpenMode; - eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten - - nOpenMode |= STREAM_SHARE_DENYNONE; // definierten Zustand garantieren - - // ********* Zugriffsflags *********** - if( nOpenMode & STREAM_SHARE_DENYNONE) - nShareBits = OPEN_SHARE_DENYNONE; - - if( nOpenMode & STREAM_SHARE_DENYREAD) - nShareBits = OPEN_SHARE_DENYREAD; - - if( nOpenMode & STREAM_SHARE_DENYWRITE) - nShareBits = OPEN_SHARE_DENYWRITE; - - if( nOpenMode & STREAM_SHARE_DENYALL) - nShareBits = OPEN_SHARE_DENYREADWRITE; - - if( (nOpenMode & STREAM_READ) ) - { - if( nOpenMode & STREAM_WRITE ) - nReadWriteBits |= OPEN_ACCESS_READWRITE; - else - { - nReadWriteBits |= OPEN_ACCESS_READONLY; - nOpenMode |= STREAM_NOCREATE; - } - } - else - nReadWriteBits |= OPEN_ACCESS_WRITEONLY; - - - if( nOpenMode & STREAM_NOCREATE ) - { - // Datei nicht erzeugen - nOpenAction = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; - } - else - { - // Datei erzeugen, wenn nicht vorhanden - nOpenAction = OPEN_ACTION_CREATE_IF_NEW; - if( nOpenMode & STREAM_TRUNC ) - // Auf Nullaenge kuerzen, wenn existiert - nOpenAction |= OPEN_ACTION_REPLACE_IF_EXISTS; - else - // Inhalt der Datei nicht wegwerfen - nOpenAction |= OPEN_ACTION_OPEN_IF_EXISTS; - } - - aFilename = aParsedFilename; - ByteString aFileNameA( aFilename, gsl_getSystemTextEncoding()); - FSysRedirector::DoRedirect( aFilename ); - -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::Open(): " ); - aTraceStr += aFileNameA; - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); -#endif - - APIRET nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, - &nActionTaken, 0L, FILE_NORMAL, nOpenAction, - nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); - - if( nRet == ERROR_TOO_MANY_OPEN_FILES ) - { - long nToAdd = 10; - sal_uIntPtr nCurMaxFH; - nRet = DosSetRelMaxFH( &nToAdd, &nCurMaxFH ); - nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, - &nActionTaken, 0L, FILE_NORMAL, nOpenAction, - nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); - } - - // Bei Fehler pruefen, ob wir lesen duerfen - if( nRet==ERROR_ACCESS_DENIED || nRet==ERROR_SHARING_VIOLATION ) - { - nReadWriteBits = OPEN_ACCESS_READONLY; - nRet = DosOpen( aFileNameA.GetBuffer(), &pInstanceData->hFile, - &nActionTaken, 0L, FILE_NORMAL, nOpenAction, - nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L); - } - - if( nRet ) - { - bIsOpen = sal_False; - SetError(::GetSvError(nRet) ); - } - else - { - bIsOpen = sal_True; - pInstanceData->bIsEof = sal_False; - if( nReadWriteBits != OPEN_ACCESS_READONLY ) - bIsWritable = sal_True; - } -} - -/************************************************************************* -|* -|* SvFileStream::ReOpen() -|* -*************************************************************************/ - -void SvFileStream::ReOpen() -{ - if( !bIsOpen && aFilename.Len() ) - Open( aFilename, eStreamMode ); -} - -/************************************************************************* -|* -|* SvFileStream::Close() -|* -*************************************************************************/ - -void SvFileStream::Close() -{ - if( IsOpen() ) - { -#ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::Close(): " ); - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); -#endif - - if( nLockCounter ) - { - nLockCounter = 1; - UnlockFile(); - } - Flush(); - DosClose( pInstanceData->hFile ); - } - - bIsOpen = sal_False; - nLockCounter= 0; - bIsWritable = sal_False; - pInstanceData->bIsEof = sal_True; - SvStream::ClearBuffer(); - SvStream::ClearError(); -} - -/************************************************************************* -|* -|* SvFileStream::ResetError() -|* -|* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang -|* -*************************************************************************/ - -void SvFileStream::ResetError() -{ - SvStream::ClearError(); -} - -/************************************************************************* -|* -|* SvFileStream::SetSize() -|* -*************************************************************************/ - -void SvFileStream::SetSize( sal_uIntPtr nSize ) -{ - if( IsOpen() ) - { - APIRET nRet = DosSetFileSize( pInstanceData->hFile, nSize ); - if( nRet ) - SetError( ::GetSvError( nRet ) ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/stream/strmsys.cxx b/tools/source/stream/strmsys.cxx index 664d4c96f236..65b4eb454387 100644 --- a/tools/source/stream/strmsys.cxx +++ b/tools/source/stream/strmsys.cxx @@ -33,8 +33,6 @@ #include "strmwnt.cxx" #elif defined UNX #include "strmunx.cxx" -#elif defined OS2 -#include "strmos2.cxx" #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/workben/makefile.mk b/tools/workben/makefile.mk index d97156c7f66c..129360e70fba 100644 --- a/tools/workben/makefile.mk +++ b/tools/workben/makefile.mk @@ -42,7 +42,7 @@ OBJFILES = \ APP1TARGET = solar APP1OBJS = $(OBJ)$/solar.obj -.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2" +.IF "$(GUI)" == "UNX" APP1STDLIBS = $(TOOLSLIB) .ELSE APP1LIBS = $(LB)$/itools.lib @@ -50,7 +50,7 @@ APP1LIBS = $(LB)$/itools.lib APP2TARGET = urltest APP2OBJS = $(OBJ)$/urltest.obj -.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2" +.IF "$(GUI)" == "UNX" APP2STDLIBS = $(TOOLSLIB) $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) .ELSE APP2STDLIBS = $(LB)$/itools.lib $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) diff --git a/tools/workben/solar.c b/tools/workben/solar.c index 283234220245..9ebece78ea12 100644 --- a/tools/workben/solar.c +++ b/tools/workben/solar.c @@ -43,7 +43,7 @@ int GetStackAlignment(void); void PrintArgs( int p, ... ); int check( TestFunc func, Type eT, void* p ); -#if defined (UNX) || defined (WNT) || defined (OS2) +#if defined (UNX) || defined (WNT) #ifdef UNX #include <unistd.h> @@ -123,7 +123,7 @@ int GetStackAlignment() -#if defined (UNX) || defined (WNT) || defined (OS2) +#if defined (UNX) || defined (WNT) #ifdef I_STDARG void PrintArgs( int p, ... ) @@ -154,7 +154,7 @@ va_dcl #ifndef USE_FORK_TO_CHECK static jmp_buf check_env; static int bSignal; -#if defined (UNX) || defined (OS2) +#if defined (UNX) void SignalHandler( int sig ) #else void __cdecl SignalHandler( int sig ) diff --git a/tools/workben/tldem.cxx b/tools/workben/tldem.cxx deleted file mode 100644 index b23686e82479..000000000000 --- a/tools/workben/tldem.cxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#include <tools/fsys.hxx> -#include <tools/stream.hxx> -#include <sstring.hxx> - -int -#ifdef WNT -__cdecl -#endif -main( int argc, char **argv ) -{ - String aString; - aString = "*.*"; - Dir aDir(aString); - SvFileStream aFile; - SvFileStream aSortedFile; - - StringList *pList = new StringList; - SStringList *pSortedList = new SStringList; - ULONG nCount = aDir.Count(); - - for ( ULONG i=0; i<nCount; i++ ) - { - aString = aDir[i].GetName(); - pList->Insert( new String( aString ), LIST_APPEND ); - pSortedList->PutString( new String( aString )); - } - - aFile.Open( "test.dir", STREAM_WRITE ); - for ( ULONG j=0; j<nCount; j++ ) - { - aFile.WriteLine( *pList->GetObject(j) ); - } - aFile.Close(); - - - aSortedFile.Open( "stest.dir", STREAM_WRITE ); - for ( ULONG k=0; k<nCount; k++ ) - { - aSortedFile.WriteLine( *pSortedList->GetObject(k) ); - } - if ( pSortedList->IsString( new String("bloedString")) != NOT_THERE ) - aSortedFile.WriteLine( "Fehler !" ); - if ( pSortedList->IsString( new String(".")) == NOT_THERE ) - aSortedFile.WriteLine( "Fehler ?!?" ); - aSortedFile.Close(); - - delete pList; - delete pSortedList; - return 0; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucbhelper/util/makefile.mk b/ucbhelper/util/makefile.mk index b7a195ab0bea..41cd0e5b4190 100644 --- a/ucbhelper/util/makefile.mk +++ b/ucbhelper/util/makefile.mk @@ -42,9 +42,6 @@ LIB1FILES= $(SLB)$/client.lib \ $(SLB)$/provider.lib SHL1TARGET= $(TARGET)$(UCBHELPER_MAJOR)$(COMID) -.IF "$(GUI)" == "OS2" -SHL1TARGET= ucbh$(UCBHELPER_MAJOR) -.ENDIF SHL1STDLIBS = \ $(CPPUHELPERLIB) \ $(CPPULIB) \ diff --git a/ucbhelper/workben/myucp/myucp_services.cxx b/ucbhelper/workben/myucp/myucp_services.cxx index 56be6f1a4243..6551ca755a12 100644 --- a/ucbhelper/workben/myucp/myucp_services.cxx +++ b/ucbhelper/workben/myucp/myucp_services.cxx @@ -81,7 +81,7 @@ sal_Bool writeInfo( void * pRegistryKey, } //========================================================================= -extern "C" void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -104,7 +104,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( } //========================================================================= -extern "C" void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/unotools/JunitTest_unotools_complex.mk b/unotools/JunitTest_unotools_complex.mk index 18af03408953..cc968c7f49c9 100644 --- a/unotools/JunitTest_unotools_complex.mk +++ b/unotools/JunitTest_unotools_complex.mk @@ -36,15 +36,15 @@ $(eval $(call gb_JunitTest_add_jars,unotools_complex,\ )) $(eval $(call gb_JunitTest_add_sourcefiles,unotools_complex,\ - unotools/qa/complex/tempfile/TempFileUnitTest \ - unotools/qa/complex/tempfile/Test01 \ - unotools/qa/complex/tempfile/Test02 \ - unotools/qa/complex/tempfile/TempFileTest \ - unotools/qa/complex/tempfile/TestHelper \ + unotools/qa/complex/tempfile/TempFileUnitTest \ + unotools/qa/complex/tempfile/Test01 \ + unotools/qa/complex/tempfile/Test02 \ + unotools/qa/complex/tempfile/TempFileTest \ + unotools/qa/complex/tempfile/TestHelper \ )) $(eval $(call gb_JunitTest_add_classes,unotools_complex,\ - complex.tempfile.TempFileUnitTest \ + complex.tempfile.TempFileUnitTest \ )) # vim: set noet sw=4 ts=4: diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk new file mode 100644 index 000000000000..1a86c469996c --- /dev/null +++ b/unotools/Library_utl.mk @@ -0,0 +1,140 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# David Tardon, Red Hat Inc. <dtardon@redhat.com> +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_Library_Library,utl)) + +$(eval $(call gb_Library_add_package_headers,utl,unotools_inc)) + +$(eval $(call gb_Library_add_precompiled_header,utl,$(SRCDIR)/unotools/inc/pch/precompiled_unotools)) + +$(eval $(call gb_Library_set_include,utl,\ + $$(INCLUDE) \ + -I$(realpath $(SRCDIR)/unotools/inc/pch) \ + -I$(OUTDIR)/inc \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_set_defs,utl,\ + $$(DEFS) \ + -DUNOTOOLS_DLLIMPLEMENTATION \ +)) + +$(eval $(call gb_Library_add_linked_libs,utl,\ + comphelper \ + cppu \ + cppuhelper \ + i18nisolang1 \ + sal \ + salhelper \ + tl \ + ucbhelper \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_Library_set_componentfile,utl,unotools/util/utl)) + +$(eval $(call gb_Library_add_exception_objects,utl,\ + unotools/source/accessibility/accessiblerelationsethelper \ + unotools/source/accessibility/accessiblestatesethelper \ + unotools/source/config/accelcfg \ + unotools/source/config/bootstrap \ + unotools/source/config/cacheoptions \ + unotools/source/config/cmdoptions \ + unotools/source/config/compatibility \ + unotools/source/config/configitem \ + unotools/source/config/configmgr \ + unotools/source/config/confignode \ + unotools/source/config/configpathes \ + unotools/source/config/configvaluecontainer \ + unotools/source/config/defaultoptions \ + unotools/source/config/docinfohelper \ + unotools/source/config/dynamicmenuoptions \ + unotools/source/config/eventcfg \ + unotools/source/config/extendedsecurityoptions \ + unotools/source/config/fltrcfg \ + unotools/source/config/fontcfg \ + unotools/source/config/fontoptions \ + unotools/source/config/historyoptions \ + unotools/source/config/inetoptions \ + unotools/source/config/internaloptions \ + unotools/source/config/itemholder1 \ + unotools/source/config/javaoptions \ + unotools/source/config/lingucfg \ + unotools/source/config/localisationoptions \ + unotools/source/config/misccfg \ + unotools/source/config/moduleoptions \ + unotools/source/config/options \ + unotools/source/config/optionsdlg \ + unotools/source/config/pathoptions \ + unotools/source/config/printwarningoptions \ + unotools/source/config/regoptions \ + unotools/source/config/saveopt \ + unotools/source/config/searchopt \ + unotools/source/config/securityoptions \ + unotools/source/config/sourceviewconfig \ + unotools/source/config/startoptions \ + unotools/source/config/syslocaleoptions \ + unotools/source/config/undoopt \ + unotools/source/config/useroptions \ + unotools/source/config/viewoptions \ + unotools/source/config/workingsetoptions \ + unotools/source/config/xmlaccelcfg \ + unotools/source/i18n/calendarwrapper \ + unotools/source/i18n/caserotate \ + unotools/source/i18n/charclass \ + unotools/source/i18n/collatorwrapper \ + unotools/source/i18n/intlwrapper \ + unotools/source/i18n/localedatawrapper \ + unotools/source/i18n/nativenumberwrapper \ + unotools/source/i18n/numberformatcodewrapper \ + unotools/source/i18n/readwritemutexguard \ + unotools/source/i18n/textsearch \ + unotools/source/i18n/transliterationwrapper \ + unotools/source/misc/atom \ + unotools/source/misc/componentresmodule \ + unotools/source/misc/datetime \ + unotools/source/misc/desktopterminationobserver \ + unotools/source/misc/eventlisteneradapter \ + unotools/source/misc/fontcvt \ + unotools/source/misc/fontdefs \ + unotools/source/misc/sharedunocomponent \ + unotools/source/misc/syslocale \ + unotools/source/processfactory/processfactory \ + unotools/source/property/propertysethelper \ + unotools/source/property/propertysetinfo \ + unotools/source/streaming/streamhelper \ + unotools/source/streaming/streamwrap \ + unotools/source/ucbhelper/localfilehelper \ + unotools/source/ucbhelper/progresshandlerwrap \ + unotools/source/ucbhelper/tempfile \ + unotools/source/ucbhelper/ucbhelper \ + unotools/source/ucbhelper/ucblockbytes \ + unotools/source/ucbhelper/ucbstreamhelper \ + unotools/source/ucbhelper/xtempfile \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/unotools/Module_unotools.mk b/unotools/Module_unotools.mk index e5d92eb677a6..849767cfe636 100644 --- a/unotools/Module_unotools.mk +++ b/unotools/Module_unotools.mk @@ -27,6 +27,11 @@ $(eval $(call gb_Module_Module,unotools)) +$(eval $(call gb_Module_add_targets,unotools,\ + Library_utl \ + Package_inc \ +)) + $(eval $(call gb_Module_add_subsequentcheck_targets,unotools,\ JunitTest_unotools_complex \ )) diff --git a/unotools/Package_inc.mk b/unotools/Package_inc.mk new file mode 100644 index 000000000000..13a8165e3ba6 --- /dev/null +++ b/unotools/Package_inc.mk @@ -0,0 +1,118 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# David Tardon, Red Hat Inc. <dtardon@redhat.com> +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_Package_Package,unotools_inc,$(SRCDIR)/unotools/inc)) + +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accelcfg.hxx,unotools/accelcfg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accessiblerelationsethelper.hxx,unotools/accessiblerelationsethelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/accessiblestatesethelper.hxx,unotools/accessiblestatesethelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/atom.hxx,unotools/atom.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/bootstrap.hxx,unotools/bootstrap.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/cacheoptions.hxx,unotools/cacheoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/calendarwrapper.hxx,unotools/calendarwrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/caserotate.hxx,unotools/caserotate.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/charclass.hxx,unotools/charclass.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/cmdoptions.hxx,unotools/cmdoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/collatorwrapper.hxx,unotools/collatorwrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/compatibility.hxx,unotools/compatibility.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/componentresmodule.hxx,unotools/componentresmodule.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/configitem.hxx,unotools/configitem.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/configmgr.hxx,unotools/configmgr.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/confignode.hxx,unotools/confignode.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/configpathes.hxx,unotools/configpathes.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/configvaluecontainer.hxx,unotools/configvaluecontainer.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/datetime.hxx,unotools/datetime.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/defaultoptions.hxx,unotools/defaultoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/desktopterminationobserver.hxx,unotools/desktopterminationobserver.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/digitgroupingiterator.hxx,unotools/digitgroupingiterator.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/docinfohelper.hxx,unotools/docinfohelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/dynamicmenuoptions.hxx,unotools/dynamicmenuoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/eventcfg.hxx,unotools/eventcfg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/eventlisteneradapter.hxx,unotools/eventlisteneradapter.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/extendedsecurityoptions.hxx,unotools/extendedsecurityoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/fltrcfg.hxx,unotools/fltrcfg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/fontcfg.hxx,unotools/fontcfg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/fontcvt.hxx,unotools/fontcvt.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/fontdefs.hxx,unotools/fontdefs.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/fontoptions.hxx,unotools/fontoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/historyoptions_const.hxx,unotools/historyoptions_const.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/historyoptions.hxx,unotools/historyoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/idhelper.hxx,unotools/idhelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/inetoptions.hxx,unotools/inetoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/internaloptions.hxx,unotools/internaloptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/intlwrapper.hxx,unotools/intlwrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/itemholderbase.hxx,unotools/itemholderbase.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/javaoptions.hxx,unotools/javaoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/lingucfg.hxx,unotools/lingucfg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/linguprops.hxx,unotools/linguprops.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/localedatawrapper.hxx,unotools/localedatawrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/localfilehelper.hxx,unotools/localfilehelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/localisationoptions.hxx,unotools/localisationoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/loghelper.hxx,unotools/loghelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/misccfg.hxx,unotools/misccfg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/moduleoptions.hxx,unotools/moduleoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/nativenumberwrapper.hxx,unotools/nativenumberwrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/numberformatcodewrapper.hxx,unotools/numberformatcodewrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/optionsdlg.hxx,unotools/optionsdlg.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/options.hxx,unotools/options.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/pathoptions.hxx,unotools/pathoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/printwarningoptions.hxx,unotools/printwarningoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/processfactory.hxx,unotools/processfactory.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/progresshandlerwrap.hxx,unotools/progresshandlerwrap.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/propertysethelper.hxx,unotools/propertysethelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/propertysetinfo.hxx,unotools/propertysetinfo.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/querydeep.hxx,unotools/querydeep.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/readwritemutexguard.hxx,unotools/readwritemutexguard.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/regoptions.hxx,unotools/regoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/regpathhelper.hxx,unotools/regpathhelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/saveopt.hxx,unotools/saveopt.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/searchopt.hxx,unotools/searchopt.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/securityoptions.hxx,unotools/securityoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/sharedunocomponent.hxx,unotools/sharedunocomponent.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/sourceviewconfig.hxx,unotools/sourceviewconfig.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/startoptions.hxx,unotools/startoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/streamhelper.hxx,unotools/streamhelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/streamsection.hxx,unotools/streamsection.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/streamwrap.hxx,unotools/streamwrap.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/syslocale.hxx,unotools/syslocale.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/syslocaleoptions.hxx,unotools/syslocaleoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/tempfile.hxx,unotools/tempfile.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/textsearch.hxx,unotools/textsearch.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/transliterationwrapper.hxx,unotools/transliterationwrapper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbhelper.hxx,unotools/ucbhelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucblockbytes.hxx,unotools/ucblockbytes.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/ucbstreamhelper.hxx,unotools/ucbstreamhelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/undoopt.hxx,unotools/undoopt.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotoolsdllapi.h,unotools/unotoolsdllapi.h)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/unotunnelhelper.hxx,unotools/unotunnelhelper.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions_const.hxx,unotools/useroptions_const.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/useroptions.hxx,unotools/useroptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/viewoptions.hxx,unotools/viewoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/workingsetoptions.hxx,unotools/workingsetoptions.hxx)) +$(eval $(call gb_Package_add_file,unotools_inc,inc/unotools/xmlaccelcfg.hxx,unotools/xmlaccelcfg.hxx)) + +# vim: set noet sw=4 ts=4: diff --git a/unotools/inc/makefile.mk b/unotools/inc/makefile.mk deleted file mode 100644 index e28adc7305e5..000000000000 --- a/unotools/inc/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=.. - -PRJNAME=unotools -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" - diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx index d17e2940890d..38a5a117c045 100644 --- a/unotools/inc/unotools/bootstrap.hxx +++ b/unotools/inc/unotools/bootstrap.hxx @@ -131,7 +131,7 @@ namespace utl public: // singleton impl-class class Impl; - static Impl const& data(); // the data related to the bootstrap.ini file + static const Impl& data(); // the data related to the bootstrap.ini file }; //----------------------------------------------------------------------------- } // namespace utl diff --git a/unotools/inc/unotools/componentresmodule.hxx b/unotools/inc/unotools/componentresmodule.hxx index 5fa704951ac0..0ac796f33d73 100644 --- a/unotools/inc/unotools/componentresmodule.hxx +++ b/unotools/inc/unotools/componentresmodule.hxx @@ -149,22 +149,8 @@ namespace utl OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ { \ } \ - }; \ - \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OLegacySingletonRegistration< TYPE > BaseClass; \ - \ - public: \ - OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ }; - //==================================================================== //= implementing a concrete module //==================================================================== diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index ff85b878e5b5..dd1ab6964b93 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -115,7 +115,7 @@ namespace utl GetTree(); protected: - ConfigItem(const rtl::OUString rSubTree, + ConfigItem(const rtl::OUString &rSubTree, sal_Int16 nMode = CONFIG_MODE_DELAYED_UPDATE); ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTree); diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx index d370350484c1..136147a095d4 100644 --- a/unotools/inc/unotools/fontcfg.hxx +++ b/unotools/inc/unotools/fontcfg.hxx @@ -97,7 +97,7 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration public: ~DefaultFontConfiguration(); - static DefaultFontConfiguration* get(); + static DefaultFontConfiguration& get(); rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const; rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const; @@ -211,7 +211,7 @@ private: public: ~FontSubstConfiguration(); - static FontSubstConfiguration* get(); + static FontSubstConfiguration& get(); const FontNameAttr* getSubstInfo( const String& rFontName, diff --git a/unotools/prj/build.lst b/unotools/prj/build.lst index 2d57eb6754aa..b7883fa2e3dd 100644 --- a/unotools/prj/build.lst +++ b/unotools/prj/build.lst @@ -1,12 +1,3 @@ -ut unotools : LIBXSLT:libxslt comphelper cppuhelper offuh tools ucbhelper NULL -ut unotools usr1 - all ut_mkout NULL -ut unotools\inc nmake - all ut_inc NULL -ut unotools\source\misc nmake - all ut_misc ut_config ut_inc NULL -ut unotools\source\streaming nmake - all ut_streaming ut_inc NULL -ut unotools\source\config nmake - all ut_config ut_i18n ut_inc NULL -ut unotools\source\ucbhelper nmake - all ut_ucbhelper ut_inc NULL -ut unotools\source\processfactory nmake - all ut_procfact ut_inc NULL -ut unotools\source\i18n nmake - all ut_i18n ut_inc NULL -ut unotools\source\property nmake - all ut_property ut_inc NULL -ut unotools\source\accessibility nmake - all ut_accessibility ut_inc NULL -ut unotools\util nmake - all ut_util ut_config ut_i18n ut_misc ut_procfact ut_streaming ut_ucbhelper ut_property ut_accessibility NULL +ut unotools : LIBXSLT:libxslt comphelper cppuhelper offuh tools ucbhelper NULL +ut unotools\prj nmake - all ut_prj NULL + diff --git a/unotools/prj/d.lst b/unotools/prj/d.lst index 38cafd0cc1f8..e69de29bb2d1 100644 --- a/unotools/prj/d.lst +++ b/unotools/prj/d.lst @@ -1,12 +0,0 @@ -..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll -..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib -..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT% -..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib -..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl -..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin -..\%__SRC%\inc\*.bin %_DEST%\bin%_EXT%\*.bin - -mkdir: %_DEST%\inc%_EXT%\unotools -..\inc\unotools\*.hxx %_DEST%\inc%_EXT%\unotools\*.hxx -..\inc\unotools\unotoolsdllapi.h %_DEST%\inc%_EXT%\unotools\unotoolsdllapi.h -..\%__SRC%\misc\utl.component %_DEST%\xml%_EXT%\utl.component diff --git a/unotools/util/makefile.pmk b/unotools/prj/makefile.mk index 0c0e54319f0e..e312a7ccab65 100644..100755 --- a/unotools/util/makefile.pmk +++ b/unotools/prj/makefile.mk @@ -25,7 +25,16 @@ # #************************************************************************* -# define UNOTOOLS_DLLIMPLEMENTATION (see @ unotoolsdllapi.h) -CDEFS += -DUNOTOOLS_DLLIMPLEMENTATION +PRJ=.. +TARGET=prj -VISIBILITY_HIDDEN=TRUE +.INCLUDE : settings.mk + +.IF "$(VERBOSE)"!="" +VERBOSEFLAG := +.ELSE +VERBOSEFLAG := -s +.ENDIF + +all: + cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog diff --git a/unotools/source/accessibility/makefile.mk b/unotools/source/accessibility/makefile.mk deleted file mode 100644 index 59536b12e517..000000000000 --- a/unotools/source/accessibility/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=accessibility - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/accessiblestatesethelper.obj \ - $(SLO)$/accessiblerelationsethelper.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index b19ee6a3683f..b3e2a3416ca1 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -41,6 +41,7 @@ #include <osl/diagnose.h> // --------------------------------------------------------------------------------------- #include <rtl/bootstrap.hxx> +#include <rtl/instance.hxx> #include <osl/process.h> // for osl_getExecutableFile #include "tools/getprocessworkingdir.hxx" @@ -86,9 +87,21 @@ namespace utl // Implementation class: Bootstrap::Impl // --------------------------------------------------------------------------------------- + namespace + { + rtl::OUString makeImplName() + { + rtl::OUString uri; + rtl::Bootstrap::get( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")), + uri); + return uri + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME)); + } + } + class Bootstrap::Impl { - OUString const m_aImplName; + const OUString m_aImplName; public: // struct to cache the result of a path lookup struct PathData { @@ -115,14 +128,12 @@ namespace utl Status status_; public: // construction and initialization - explicit - Impl(OUString const& _aImplName) - : m_aImplName(_aImplName) + Impl() : m_aImplName(makeImplName()) { - status_ = initialize(); + initialize(); } - Status initialize(); + void initialize(); // access helper OUString getBootstrapValue(OUString const& _sName, OUString const& _sDefault) const; @@ -134,36 +145,20 @@ namespace utl bool initBaseInstallationData(rtl::Bootstrap& _rData); bool initUserInstallationData(rtl::Bootstrap& _rData); }; -// --------------------------------------------------------------------------------------- - static OUString getExecutableDirectory(); -// --------------------------------------------------------------------------------------- - - static Bootstrap::Impl* s_pData = NULL; - Bootstrap::Impl const& Bootstrap::data() + namespace { + class theImpl : public rtl::Static<Bootstrap::Impl, theImpl> {}; + } - if (!s_pData) - { - using namespace osl; - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // static Impl s_theData(getExecutableDirectory() + OUString(RTL_CONSTASCII_USTRINGPARAM("/"BOOTSTRAP_DATA_NAME))); - // s_pData = &s_theData; - rtl::OUString uri; - rtl::Bootstrap::get( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")), uri); - s_pData = new Impl(uri + OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME))); - } - return *s_pData; + const Bootstrap::Impl& Bootstrap::data() + { + return theImpl::get(); } void Bootstrap::reloadData() { - if (s_pData != NULL) { - delete s_pData; - s_pData = NULL; - } + theImpl::get().initialize(); } // --------------------------------------------------------------------------------------- @@ -233,9 +228,9 @@ bool implNormalizeURL(OUString & _sURL, osl::DirectoryItem& aDirItem) OSL_PRECOND(aDirItem.is(), "Opened DirItem required"); - static const sal_uInt32 cFileStatusMask = FileStatusMask_FileURL; + static const sal_uInt32 cosl_FileStatus_Mask = osl_FileStatus_Mask_FileURL; - FileStatus aFileStatus(cFileStatusMask); + FileStatus aFileStatus(cosl_FileStatus_Mask); if (aDirItem.getFileStatus(aFileStatus) != DirectoryItem::E_None) return false; @@ -841,19 +836,17 @@ bool Bootstrap::Impl::initUserInstallationData(rtl::Bootstrap& _rData) } // --------------------------------------------------------------------------------------- -Bootstrap::Status Bootstrap::Impl::initialize() +void Bootstrap::Impl::initialize() { - Bootstrap::Status result; - rtl::Bootstrap aData( m_aImplName ); if (!initBaseInstallationData(aData)) { - result = INVALID_BASE_INSTALL; + status_ = INVALID_BASE_INSTALL; } else if (!initUserInstallationData(aData)) { - result = INVALID_USER_INSTALL; + status_ = INVALID_USER_INSTALL; if (aUserInstall_.status >= DATA_MISSING) { @@ -861,12 +854,12 @@ Bootstrap::Status Bootstrap::Impl::initialize() { case PATH_EXISTS: case PATH_VALID: - result = MISSING_USER_INSTALL; + status_ = MISSING_USER_INSTALL; break; case DATA_INVALID: case DATA_MISSING: - result = INVALID_BASE_INSTALL; + status_ = INVALID_BASE_INSTALL; break; default: break; @@ -875,9 +868,8 @@ Bootstrap::Status Bootstrap::Impl::initialize() } else { - result = DATA_OK; + status_ = DATA_OK; } - return result; } // --------------------------------------------------------------------------------------- diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx index 45f0850e8969..a7dc14b6845b 100644 --- a/unotools/source/config/cacheoptions.cxx +++ b/unotools/source/config/cacheoptions.cxx @@ -32,6 +32,7 @@ #include <unotools/cacheoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> +#include <rtl/instance.hxx> #include <tools/debug.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -481,29 +482,17 @@ void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjec m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime ); } +namespace +{ + class theCacheOptionsMutex : public rtl::Static<osl::Mutex, theCacheOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtCacheOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theCacheOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx index b17771cb4369..c110148c069f 100644 --- a/unotools/source/config/cmdoptions.cxx +++ b/unotools/source/config/cmdoptions.cxx @@ -42,6 +42,7 @@ #include <cppuhelper/weakref.hxx> #include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/instance.hxx> #include <itemholder1.hxx> @@ -593,29 +594,17 @@ void SvtCommandOptions::EstablisFrameCallback(const ::com::sun::star::uno::Refer m_pDataContainer->EstablisFrameCallback(xFrame); } +namespace +{ + class theCommandOptionsMutex : public rtl::Static<osl::Mutex, theCommandOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtCommandOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theCommandOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx index 275230452919..6a5087089490 100644 --- a/unotools/source/config/compatibility.cxx +++ b/unotools/source/config/compatibility.cxx @@ -817,29 +817,17 @@ Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const return m_pDataContainer->GetList(); } +namespace +{ + class theCompatibilityOptionsMutex : public rtl::Static<osl::Mutex, theCompatibilityOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtCompatibilityOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theCompatibilityOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 4a3809c222fb..0832b203ab2c 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -219,7 +219,7 @@ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) thro pParent->RemoveChangesListener(); } -ConfigItem::ConfigItem(const OUString rSubTree, sal_Int16 nSetMode ) : +ConfigItem::ConfigItem(const OUString &rSubTree, sal_Int16 nSetMode ) : sSubTree(rSubTree), pImpl(new ConfigItem_Impl) { diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index 97c1776bf95b..6704046fad54 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -47,6 +47,8 @@ #include <list> +#include <stdio.h> + //----------------------------------------------------------------------------- using namespace utl; @@ -120,10 +122,7 @@ ConfigManager::ConfigManager(Reference< XMultiServiceFactory > xConfigProv) : ConfigManager::~ConfigManager() { //check list content -> should be empty! -#if OSL_DEBUG_LEVEL > 1 - // I think this is a pointless assertion, the code seems to cope - // fine with it being empty, no need to crash in a dbglevel=1 - // build. +#if OSL_DEBUG_LEVEL > 0 OSL_ENSURE(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive"); #endif if(!pMgrImpl->aItemList.empty()) @@ -132,6 +131,9 @@ ConfigManager::~ConfigManager() for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) { ConfigItemListEntry_Impl& rEntry = *aListIter; +#if OSL_DEBUG_LEVEL > 0 + fprintf(stderr, "Dangling config item of %s\n", rtl::OUStringToOString(rEntry.pConfigItem->GetSubTreeName(), RTL_TEXTENCODING_UTF8).getStr()); +#endif rEntry.pConfigItem->ReleaseConfigMgr(); } pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end()); @@ -378,13 +380,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) Any aRet; ::rtl::OUString sBrandName; -#ifdef ENABLE_BROFFICE - LanguageType nType = MsLangId::getRealLanguage( LANGUAGE_NONE ); - if ( nType == LANGUAGE_PORTUGUESE_BRAZILIAN ) - sBrandName = OUString(RTL_CONSTASCII_USTRINGPARAM("BrOffice")); - else -#endif - sBrandName = BrandName::get(); + sBrandName = BrandName::get(); if ( eProp == PRODUCTNAME && sBrandName.getLength() ) { diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 76950ee441bc..ec80822b4d65 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -887,29 +887,17 @@ void SvtDynamicMenuOptions::AppendItem( EDynamicMenuType eMenu m_pDataContainer->AppendItem( eMenu, sURL, sTitle, sImageIdentifier, sTargetName ); } +namespace +{ + class theDynamicMenuOptionsMutex : public rtl::Static<osl::Mutex, theDynamicMenuOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtDynamicMenuOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theDynamicMenuOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index a1dbcda74e0b..a6de56a6a5d6 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -423,28 +423,14 @@ sal_Bool SAL_CALL GlobalEventConfig::hasElements( ) throw (RuntimeException) return m_pImpl->hasElements( ); } +namespace +{ + class theGlobalEventConfigMutex : public rtl::Static<osl::Mutex, theGlobalEventConfigMutex>{}; +} + Mutex& GlobalEventConfig::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect following code with - // the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that - // another instance of our class will be faster then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theGlobalEventConfigMutex::get(); } ::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex ) diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx index d64958b15b4e..fe5cc90d28cb 100644 --- a/unotools/source/config/extendedsecurityoptions.cxx +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -509,29 +509,17 @@ void SvtExtendedSecurityOptions::SetOpenHyperlinkMode( SvtExtendedSecurityOption m_pDataContainer->SetOpenHyperlinkMode( eMode ); } +namespace +{ + class theExtendedSecurityOptionsMutex : public rtl::Static<osl::Mutex, theExtendedSecurityOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtExtendedSecurityOptions::GetInitMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theExtendedSecurityOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 6ff32c0b6e71..5786e96af8cc 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -59,10 +59,6 @@ using namespace com::sun::star::container; using ::rtl::OUString; -static DefaultFontConfiguration* mpDefaultFontConfiguration = 0; - -static FontSubstConfiguration* mpFontSubstConfiguration = 0; - /* * DefaultFontConfiguration */ @@ -100,11 +96,10 @@ static const char* getKeyType( int nKeyType ) } } -DefaultFontConfiguration* DefaultFontConfiguration::get() +DefaultFontConfiguration& DefaultFontConfiguration::get() { - if( !mpDefaultFontConfiguration ) - mpDefaultFontConfiguration = new DefaultFontConfiguration(); - return mpDefaultFontConfiguration; + static DefaultFontConfiguration aDefaultFontConfiguration; + return aDefaultFontConfiguration; } DefaultFontConfiguration::DefaultFontConfiguration() @@ -375,11 +370,10 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) * FontSubstConfigItem::get */ -FontSubstConfiguration* FontSubstConfiguration::get() +FontSubstConfiguration& FontSubstConfiguration::get() { - if( !mpFontSubstConfiguration ) - mpFontSubstConfiguration = new FontSubstConfiguration(); - return mpFontSubstConfiguration; + static FontSubstConfiguration aFontSubstConfiguration; + return aFontSubstConfiguration; } /* diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx index 13126e5612b9..9cb8a1831e97 100644 --- a/unotools/source/config/fontoptions.cxx +++ b/unotools/source/config/fontoptions.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> #include "itemholder1.hxx" //_________________________________________________________________________________________________________________ @@ -480,29 +481,17 @@ void SvtFontOptions::EnableFontWYSIWYG( sal_Bool bState ) m_pDataContainer->EnableFontWYSIWYG( bState ); } +namespace +{ + class theFontOptionsMutex : public rtl::Static<osl::Mutex, theFontOptionsMutex> {}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtFontOptions::impl_GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theFontOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 7cc8d4eedefd..d6990fb40fa8 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -699,29 +699,17 @@ void SvtHistoryOptions::AppendItem( EHistoryType eHistory , m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword ); } +namespace +{ + class theHistoryOptionsMutex : public rtl::Static<osl::Mutex, theHistoryOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtHistoryOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theHistoryOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/internaloptions.cxx b/unotools/source/config/internaloptions.cxx index d1501a612128..63f4827c760c 100644 --- a/unotools/source/config/internaloptions.cxx +++ b/unotools/source/config/internaloptions.cxx @@ -560,29 +560,17 @@ void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL ) m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL ); } +namespace +{ + class theInternalOptionsMutex : public rtl::Static<osl::Mutex, theInternalOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtInternalOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theInternalOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx index 3f7713e3b854..d3392ea6cc92 100644 --- a/unotools/source/config/localisationoptions.cxx +++ b/unotools/source/config/localisationoptions.cxx @@ -427,29 +427,17 @@ void SvtLocalisationOptions::SetDialogScale( sal_Int32 nScale ) m_pDataContainer->SetDialogScale( nScale ); } +namespace +{ + class theLocalisationOptionsMutex : public rtl::Static<osl::Mutex, theLocalisationOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtLocalisationOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theLocalisationOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk deleted file mode 100644 index 9a8e8d2d3d92..000000000000 --- a/unotools/source/config/makefile.mk +++ /dev/null @@ -1,94 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=config - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -.IF "$(ENABLE_BROFFICE)"=="TRUE" -CDEFS+=-DENABLE_BROFFICE -.ENDIF - -# --- Files ------------------------------------- - -SLOFILES=\ - $(SLO)$/syslocaleoptions.obj \ - $(SLO)$/configvaluecontainer.obj \ - $(SLO)$/confignode.obj \ - $(SLO)$/configitem.obj \ - $(SLO)$/configmgr.obj \ - $(SLO)$/configpathes.obj \ - $(SLO)$/docinfohelper.obj \ - $(SLO)$/bootstrap.obj \ - $(SLO)$/accelcfg.obj \ - $(SLO)$/cacheoptions.obj \ - $(SLO)$/cmdoptions.obj \ - $(SLO)$/compatibility.obj \ - $(SLO)$/defaultoptions.obj \ - $(SLO)$/dynamicmenuoptions.obj \ - $(SLO)$/eventcfg.obj \ - $(SLO)$/extendedsecurityoptions.obj \ - $(SLO)$/fltrcfg.obj \ - $(SLO)$/fontcfg.obj \ - $(SLO)$/fontoptions.obj \ - $(SLO)$/historyoptions.obj \ - $(SLO)$/inetoptions.obj \ - $(SLO)$/internaloptions.obj \ - $(SLO)$/itemholder1.obj \ - $(SLO)$/javaoptions.obj \ - $(SLO)$/lingucfg.obj \ - $(SLO)$/localisationoptions.obj \ - $(SLO)$/misccfg.obj \ - $(SLO)$/moduleoptions.obj \ - $(SLO)$/options.obj \ - $(SLO)$/optionsdlg.obj \ - $(SLO)$/pathoptions.obj \ - $(SLO)$/printwarningoptions.obj \ - $(SLO)$/regoptions.obj \ - $(SLO)$/saveopt.obj \ - $(SLO)$/searchopt.obj \ - $(SLO)$/securityoptions.obj \ - $(SLO)$/sourceviewconfig.obj \ - $(SLO)$/startoptions.obj \ - $(SLO)$/undoopt.obj \ - $(SLO)$/useroptions.obj \ - $(SLO)$/viewoptions.obj \ - $(SLO)$/workingsetoptions.obj \ - $(SLO)$/xmlaccelcfg.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 4edb4fb0968e..c275a910510e 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -38,6 +38,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -1278,6 +1279,10 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const return nFeature; } +namespace +{ + class theModuleOptionsMutex : public rtl::Static<osl::Mutex, theModuleOptionsMutex> {}; +} /*-****************************************************************************************************//** @short return a reference to a static mutex @descr These class is threadsafe. @@ -1294,24 +1299,7 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const *//*-*****************************************************************************************************/ ::osl::Mutex& SvtModuleOptions::impl_GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static ::osl::Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static ::osl::Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theModuleOptionsMutex::get(); } ::rtl::OUString SvtModuleOptions::GetModuleName( EModule eModule ) const diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index c8a12c088804..4aeb603a6717 100644 --- a/unotools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -92,20 +92,14 @@ public: const OUString& _rGroup ) const; }; -::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex() +namespace { - static ::osl::Mutex *pMutex = 0; + class theOptionsDlgOptions_ImplMutex : public rtl::Static<osl::Mutex, theOptionsDlgOptions_ImplMutex>{}; +} - if( ! pMutex ) - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if( ! pMutex ) - { - static ::osl::Mutex mutex; - pMutex = &mutex; - } - } - return *pMutex; +::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex() +{ + return theOptionsDlgOptions_ImplMutex::get(); } // ----------------------------------------------------------------------- diff --git a/unotools/source/config/optionsdrawinglayer.cxx b/unotools/source/config/optionsdrawinglayer.cxx deleted file mode 100644 index c7fbad4a6db6..000000000000 --- a/unotools/source/config/optionsdrawinglayer.cxx +++ /dev/null @@ -1,1707 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifdef _MSC_VER -#pragma hdrstop -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include <unotools/optionsdrawinglayer.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/configitem.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <vcl/svapp.hxx> -#include <vcl/outdev.hxx> - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Drawinglayer" )) -#define DEFAULT_OVERLAYBUFFER sal_True -#define DEFAULT_PAINTBUFFER sal_True -#define DEFAULT_STRIPE_COLOR_A 0 -#define DEFAULT_STRIPE_COLOR_B 16581375 -#define DEFAULT_STRIPE_LENGTH 4 - -// #i73602# -// #i74769#, #i75172# : Change default for Calc and Writer to True -#define DEFAULT_OVERLAYBUFFER_CALC sal_True -#define DEFAULT_OVERLAYBUFFER_WRITER sal_True -#define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS sal_True - -// #i74769#, #i75172# -#define DEFAULT_PAINTBUFFER_CALC sal_True -#define DEFAULT_PAINTBUFFER_WRITER sal_True -#define DEFAULT_PAINTBUFFER_DRAWIMPRESS sal_True - -// #i4219# -#define DEFAULT_MAXIMUMPAPERWIDTH 300 -#define DEFAULT_MAXIMUMPAPERHEIGHT 300 -#define DEFAULT_MAXIMUMPAPERLEFTMARGIN 9999 -#define DEFAULT_MAXIMUMPAPERRIGHTMARGIN 9999 -#define DEFAULT_MAXIMUMPAPERTOPMARGIN 9999 -#define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999 - -// primitives -#define DEFAULT_ANTIALIASING sal_True -#define DEFAULT_SNAPHORVERLINESTODISCRETE sal_True -#define DEFAULT_SOLIDDRAGCREATE sal_True -#define DEFAULT_RENDERDECORATEDTEXTDIRECT sal_True -#define DEFAULT_RENDERSIMPLETEXTDIRECT sal_True -#define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000 -#define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000 - -// #i97672# selection settings -#define DEFAULT_TRANSPARENTSELECTION sal_True -#define DEFAULT_TRANSPARENTSELECTIONPERCENT 75 -#define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70 - -#define PROPERTYNAME_OVERLAYBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer" )) -#define PROPERTYNAME_PAINTBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer" )) -#define PROPERTYNAME_STRIPE_COLOR_A OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorA" )) -#define PROPERTYNAME_STRIPE_COLOR_B OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorB" )) -#define PROPERTYNAME_STRIPE_LENGTH OUString(RTL_CONSTASCII_USTRINGPARAM("StripeLength" )) - -// #i73602# -#define PROPERTYNAME_OVERLAYBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Calc")) -#define PROPERTYNAME_OVERLAYBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Writer")) -#define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_DrawImpress")) - -// #i74769#, #i75172# -#define PROPERTYNAME_PAINTBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Calc")) -#define PROPERTYNAME_PAINTBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Writer")) -#define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_DrawImpress")) - -// #i4219# -#define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperWidth")) -#define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperHeight")) -#define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperLeftMargin")) -#define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperRightMargin")) -#define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperTopMargin")) -#define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperBottomMargin")) - -// primitives -#define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing")) -#define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString(RTL_CONSTASCII_USTRINGPARAM("SnapHorVerLinesToDiscrete")) -#define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate")) -#define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderDecoratedTextDirect")) -#define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderSimpleTextDirect")) -#define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit")) -#define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit")) - -// #i97672# selection settings -#define PROPERTYNAME_TRANSPARENTSELECTION OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelection")) -#define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelectionPercent")) -#define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("SelectionMaximumLuminancePercent")) - -#define PROPERTYHANDLE_OVERLAYBUFFER 0 -#define PROPERTYHANDLE_PAINTBUFFER 1 -#define PROPERTYHANDLE_STRIPE_COLOR_A 2 -#define PROPERTYHANDLE_STRIPE_COLOR_B 3 -#define PROPERTYHANDLE_STRIPE_LENGTH 4 - -// #i73602# -#define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5 -#define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6 -#define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7 - -// #i74769#, #i75172# -#define PROPERTYHANDLE_PAINTBUFFER_CALC 8 -#define PROPERTYHANDLE_PAINTBUFFER_WRITER 9 -#define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10 - -// #i4219# -#define PROPERTYHANDLE_MAXIMUMPAPERWIDTH 11 -#define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT 12 -#define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN 13 -#define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN 14 -#define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN 15 -#define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN 16 - -// primitives -#define PROPERTYHANDLE_ANTIALIASING 17 -#define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE 18 -#define PROPERTYHANDLE_SOLIDDRAGCREATE 19 -#define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT 20 -#define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT 21 -#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 22 -#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 23 - -// #i97672# selection settings -#define PROPERTYHANDLE_TRANSPARENTSELECTION 24 -#define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25 -#define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26 - -#define PROPERTYCOUNT 27 - -class SvtOptionsDrawinglayer_Impl : public ConfigItem -{ -public: - -//--------------------------------------------------------------------------------------------------------- -// constructor / destructor -//--------------------------------------------------------------------------------------------------------- - - SvtOptionsDrawinglayer_Impl(); - ~SvtOptionsDrawinglayer_Impl(); - -//--------------------------------------------------------------------------------------------------------- -// overloaded methods of baseclass -//--------------------------------------------------------------------------------------------------------- - - virtual void Commit(); - -//--------------------------------------------------------------------------------------------------------- -// public interface -//--------------------------------------------------------------------------------------------------------- - - sal_Bool IsOverlayBuffer() const; - sal_Bool IsPaintBuffer() const; - Color GetStripeColorA() const; - Color GetStripeColorB() const; - sal_uInt16 GetStripeLength() const; - - // #i73602# - sal_Bool IsOverlayBuffer_Calc() const; - sal_Bool IsOverlayBuffer_Writer() const; - sal_Bool IsOverlayBuffer_DrawImpress() const; - - // #i74769#, #i75172# - sal_Bool IsPaintBuffer_Calc() const; - sal_Bool IsPaintBuffer_Writer() const; - sal_Bool IsPaintBuffer_DrawImpress() const; - - void SetOverlayBuffer( sal_Bool bState ); - void SetPaintBuffer( sal_Bool bState ); - void SetStripeColorA( Color aColor ); - void SetStripeColorB( Color aColor ); - void SetStripeLength( sal_uInt16 nLength ); - - // #i73602# - void SetOverlayBuffer_Calc( sal_Bool bState ); - void SetOverlayBuffer_Writer( sal_Bool bState ); - void SetOverlayBuffer_DrawImpress( sal_Bool bState ); - - // #i74769#, #i75172# - void SetPaintBuffer_Calc( sal_Bool bState ); - void SetPaintBuffer_Writer( sal_Bool bState ); - void SetPaintBuffer_DrawImpress( sal_Bool bState ); - - // #i4219# - sal_uInt32 GetMaximumPaperWidth() const; - sal_uInt32 GetMaximumPaperHeight() const; - sal_uInt32 GetMaximumPaperLeftMargin() const; - sal_uInt32 GetMaximumPaperRightMargin() const; - sal_uInt32 GetMaximumPaperTopMargin() const; - sal_uInt32 GetMaximumPaperBottomMargin() const; - - void SetMaximumPaperWidth(sal_uInt32 nNew); - void SetMaximumPaperHeight(sal_uInt32 nNew); - void SetMaximumPaperLeftMargin(sal_uInt32 nNew); - void SetMaximumPaperRightMargin(sal_uInt32 nNew); - void SetMaximumPaperTopMargin(sal_uInt32 nNew); - void SetMaximumPaperBottomMargin(sal_uInt32 nNew); - - // helper - sal_Bool IsAAPossibleOnThisSystem() const; - - // primitives - sal_Bool IsAntiAliasing() const; - sal_Bool IsSnapHorVerLinesToDiscrete() const; - sal_Bool IsSolidDragCreate() const; - sal_Bool IsRenderDecoratedTextDirect() const; - sal_Bool IsRenderSimpleTextDirect() const; - sal_uInt32 GetQuadratic3DRenderLimit() const; - sal_uInt32 GetQuadraticFormControlRenderLimit() const; - - void SetAntiAliasing( sal_Bool bState ); - void SetSnapHorVerLinesToDiscrete( sal_Bool bState ); - void SetSolidDragCreate( sal_Bool bState ); - void SetRenderDecoratedTextDirect( sal_Bool bState ); - void SetRenderSimpleTextDirect( sal_Bool bState ); - void SetQuadratic3DRenderLimit(sal_uInt32 nNew); - void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); - - // #i97672# selection settings - sal_Bool IsTransparentSelection() const; - sal_uInt16 GetTransparentSelectionPercent() const; - sal_uInt16 GetSelectionMaximumLuminancePercent() const; - - void SetTransparentSelection( sal_Bool bState ); - void SetTransparentSelectionPercent( sal_uInt16 nPercent ); - void SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ); - -//------------------------------------------------------------------------------------------------------------- -// private methods -//------------------------------------------------------------------------------------------------------------- - -private: - - static Sequence< OUString > impl_GetPropertyNames(); - -//------------------------------------------------------------------------------------------------------------- -// private member -//------------------------------------------------------------------------------------------------------------- - -private: - - sal_Bool m_bOverlayBuffer; - sal_Bool m_bPaintBuffer; - Color m_bStripeColorA; - Color m_bStripeColorB; - sal_uInt16 m_nStripeLength; - - // #i73602# - sal_Bool m_bOverlayBuffer_Calc; - sal_Bool m_bOverlayBuffer_Writer; - sal_Bool m_bOverlayBuffer_DrawImpress; - - // #i74769#, #i75172# - sal_Bool m_bPaintBuffer_Calc; - sal_Bool m_bPaintBuffer_Writer; - sal_Bool m_bPaintBuffer_DrawImpress; - - // #i4219# - sal_uInt32 m_nMaximumPaperWidth; - sal_uInt32 m_nMaximumPaperHeight; - sal_uInt32 m_nMaximumPaperLeftMargin; - sal_uInt32 m_nMaximumPaperRightMargin; - sal_uInt32 m_nMaximumPaperTopMargin; - sal_uInt32 m_nMaximumPaperBottomMargin; - - // primitives - sal_Bool m_bAntiAliasing; - sal_Bool m_bSnapHorVerLinesToDiscrete; - sal_Bool m_bSolidDragCreate; - sal_Bool m_bRenderDecoratedTextDirect; - sal_Bool m_bRenderSimpleTextDirect; - sal_uInt32 m_nQuadratic3DRenderLimit; - sal_uInt32 m_nQuadraticFormControlRenderLimit; - - // #i97672# selection settings - sal_uInt16 m_nTransparentSelectionPercent; - sal_uInt16 m_nSelectionMaximumLuminancePercent; - sal_Bool m_bTransparentSelection; - - // local values - bool m_bAllowAA : 1; - bool m_bAllowAAChecked : 1; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : - ConfigItem( ROOTNODE_START ), - m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ), - m_bPaintBuffer( DEFAULT_PAINTBUFFER ), - m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)), - m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)), - m_nStripeLength(DEFAULT_STRIPE_LENGTH), - - // #i73602# - m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ), - m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ), - m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ), - - // #i74769#, #i75172# - m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ), - m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ), - m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ), - - // #i4219# - m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH), - m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT), - m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN), - m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN), - m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN), - m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN), - - // primitives - m_bAntiAliasing(DEFAULT_ANTIALIASING), - m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE), - m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE), - m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT), - m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT), - m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT), - m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT), - - // #i97672# selection settings - m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT), - m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT), - m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION), - - // local values - m_bAllowAA(true), - m_bAllowAAChecked(false) -{ - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nInvalid property value for property detected!\n" ); - - switch( nProperty ) - { - case PROPERTYHANDLE_OVERLAYBUFFER: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" ); - seqValues[nProperty] >>= m_bOverlayBuffer; - } - break; - - case PROPERTYHANDLE_PAINTBUFFER: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" ); - seqValues[nProperty] >>= m_bPaintBuffer; - } - break; - - case PROPERTYHANDLE_STRIPE_COLOR_A: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" ); - sal_Int32 nValue = 0; - seqValues[nProperty] >>= nValue; - m_bStripeColorA = nValue; - } - break; - - case PROPERTYHANDLE_STRIPE_COLOR_B: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" ); - sal_Int32 nValue = 0; - seqValues[nProperty] >>= nValue; - m_bStripeColorB = nValue; - } - break; - - case PROPERTYHANDLE_STRIPE_LENGTH: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" ); - seqValues[nProperty] >>= m_nStripeLength; - } - break; - - // #i73602# - case PROPERTYHANDLE_OVERLAYBUFFER_CALC: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" ); - seqValues[nProperty] >>= m_bOverlayBuffer_Calc; - } - break; - - case PROPERTYHANDLE_OVERLAYBUFFER_WRITER: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" ); - seqValues[nProperty] >>= m_bOverlayBuffer_Writer; - } - break; - - case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" ); - seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress; - } - break; - - // #i74769#, #i75172# - case PROPERTYHANDLE_PAINTBUFFER_CALC: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" ); - seqValues[nProperty] >>= m_bPaintBuffer_Calc; - } - break; - - case PROPERTYHANDLE_PAINTBUFFER_WRITER: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" ); - seqValues[nProperty] >>= m_bPaintBuffer_Writer; - } - break; - - case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" ); - seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress; - } - break; - - // #i4219# - case PROPERTYHANDLE_MAXIMUMPAPERWIDTH: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" ); - seqValues[nProperty] >>= m_nMaximumPaperWidth; - } - break; - - case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" ); - seqValues[nProperty] >>= m_nMaximumPaperHeight; - } - break; - - case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" ); - seqValues[nProperty] >>= m_nMaximumPaperLeftMargin; - } - break; - - case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" ); - seqValues[nProperty] >>= m_nMaximumPaperRightMargin; - } - break; - - case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" ); - seqValues[nProperty] >>= m_nMaximumPaperTopMargin; - } - break; - - case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" ); - seqValues[nProperty] >>= m_nMaximumPaperBottomMargin; - } - break; - - // primitives - case PROPERTYHANDLE_ANTIALIASING: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" ); - seqValues[nProperty] >>= m_bAntiAliasing; - } - break; - - // primitives - case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" ); - seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete; - } - break; - - case PROPERTYHANDLE_SOLIDDRAGCREATE: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" ); - seqValues[nProperty] >>= m_bSolidDragCreate; - } - break; - - case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" ); - seqValues[nProperty] >>= m_bRenderDecoratedTextDirect; - } - break; - - case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" ); - seqValues[nProperty] >>= m_bRenderSimpleTextDirect; - } - break; - - case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" ); - seqValues[nProperty] >>= m_nQuadratic3DRenderLimit; - } - break; - - case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" ); - seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit; - } - break; - - // #i97672# selection settings - case PROPERTYHANDLE_TRANSPARENTSELECTION: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" ); - seqValues[nProperty] >>= m_bTransparentSelection; - } - break; - - case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" ); - seqValues[nProperty] >>= m_nTransparentSelectionPercent; - } - - case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" ); - seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent; - } - break; - } - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl() -{ - if( IsModified() ) - Commit(); -} - -//***************************************************************************************************************** -// Commit -//***************************************************************************************************************** -void SvtOptionsDrawinglayer_Impl::Commit() -{ - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); - - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_OVERLAYBUFFER: - aSeqValues[nProperty] <<= m_bOverlayBuffer; - break; - - case PROPERTYHANDLE_PAINTBUFFER: - aSeqValues[nProperty] <<= m_bPaintBuffer; - break; - - case PROPERTYHANDLE_STRIPE_COLOR_A: - aSeqValues[nProperty] <<= m_bStripeColorA.GetColor(); - break; - - case PROPERTYHANDLE_STRIPE_COLOR_B: - aSeqValues[nProperty] <<= m_bStripeColorB.GetColor(); - break; - - case PROPERTYHANDLE_STRIPE_LENGTH: - aSeqValues[nProperty] <<= m_nStripeLength; - break; - - // #i73602# - case PROPERTYHANDLE_OVERLAYBUFFER_CALC: - aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc; - break; - - case PROPERTYHANDLE_OVERLAYBUFFER_WRITER: - aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer; - break; - - case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS: - aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress; - break; - - // #i74769#, #i75172# - case PROPERTYHANDLE_PAINTBUFFER_CALC: - aSeqValues[nProperty] <<= m_bPaintBuffer_Calc; - break; - - case PROPERTYHANDLE_PAINTBUFFER_WRITER: - aSeqValues[nProperty] <<= m_bPaintBuffer_Writer; - break; - - case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS: - aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress; - break; - - // #i4219# - case PROPERTYHANDLE_MAXIMUMPAPERWIDTH: - aSeqValues[nProperty] <<= m_nMaximumPaperWidth; - break; - - case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT: - aSeqValues[nProperty] <<= m_nMaximumPaperHeight; - break; - - case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN: - aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin; - break; - - case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN: - aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin; - break; - - case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN: - aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin; - break; - - case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN: - aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin; - break; - - // primitives - case PROPERTYHANDLE_ANTIALIASING: - aSeqValues[nProperty] <<= m_bAntiAliasing; - break; - - case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: - aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete; - break; - - case PROPERTYHANDLE_SOLIDDRAGCREATE: - aSeqValues[nProperty] <<= m_bSolidDragCreate; - break; - - case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: - aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect; - break; - - case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: - aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect; - break; - - case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: - aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit; - break; - - case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT: - aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit; - break; - - // #i97672# selection settings - case PROPERTYHANDLE_TRANSPARENTSELECTION: - aSeqValues[nProperty] <<= m_bTransparentSelection; - break; - - case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT: - aSeqValues[nProperty] <<= m_nTransparentSelectionPercent; - break; - - case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT: - aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent; - break; - } - } - - PutProperties( aSeqNames, aSeqValues ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer() const -{ - return m_bOverlayBuffer; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer() const -{ - return m_bPaintBuffer; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Color SvtOptionsDrawinglayer_Impl::GetStripeColorA() const -{ - return m_bStripeColorA; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Color SvtOptionsDrawinglayer_Impl::GetStripeColorB() const -{ - return m_bStripeColorB; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_uInt16 SvtOptionsDrawinglayer_Impl::GetStripeLength() const -{ - return m_nStripeLength; -} - -// #i73602# -sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Calc() const -{ - return m_bOverlayBuffer_Calc; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Writer() const -{ - return m_bOverlayBuffer_Writer; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_DrawImpress() const -{ - return m_bOverlayBuffer_DrawImpress; -} - -// #i74769#, #i75172# -sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Calc() const -{ - return m_bPaintBuffer_Calc; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Writer() const -{ - return m_bPaintBuffer_Writer; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_DrawImpress() const -{ - return m_bPaintBuffer_DrawImpress; -} - -// #i4219# -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperWidth() const -{ - return m_nMaximumPaperWidth; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperHeight() const -{ - return m_nMaximumPaperHeight; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperLeftMargin() const -{ - return m_nMaximumPaperLeftMargin; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperRightMargin() const -{ - return m_nMaximumPaperRightMargin; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperTopMargin() const -{ - return m_nMaximumPaperTopMargin; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperBottomMargin() const -{ - return m_nMaximumPaperBottomMargin; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer( sal_Bool bState ) -{ - if(m_bOverlayBuffer != bState) - { - m_bOverlayBuffer = bState; - SetModified(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer_Impl::SetPaintBuffer( sal_Bool bState ) -{ - if(m_bPaintBuffer != bState) - { - m_bPaintBuffer = bState; - SetModified(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer_Impl::SetStripeColorA( Color aColor ) -{ - if(m_bStripeColorA != aColor) - { - m_bStripeColorA = aColor; - SetModified(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer_Impl::SetStripeColorB( Color aColor ) -{ - if(m_bStripeColorB != aColor) - { - m_bStripeColorB = aColor; - SetModified(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer_Impl::SetStripeLength( sal_uInt16 nLength ) -{ - if(m_nStripeLength != nLength) - { - m_nStripeLength = nLength; - SetModified(); - } -} - -// #i73602# -void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Calc( sal_Bool bState ) -{ - if(m_bOverlayBuffer_Calc != bState) - { - m_bOverlayBuffer_Calc = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Writer( sal_Bool bState ) -{ - if(m_bOverlayBuffer_Writer != bState) - { - m_bOverlayBuffer_Writer = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_DrawImpress( sal_Bool bState ) -{ - if(m_bOverlayBuffer_DrawImpress != bState) - { - m_bOverlayBuffer_DrawImpress = bState; - SetModified(); - } -} - -// #i74769#, #i75172# -void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Calc( sal_Bool bState ) -{ - if(m_bPaintBuffer_Calc != bState) - { - m_bPaintBuffer_Calc = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Writer( sal_Bool bState ) -{ - if(m_bPaintBuffer_Writer != bState) - { - m_bPaintBuffer_Writer = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_DrawImpress( sal_Bool bState ) -{ - if(m_bPaintBuffer_DrawImpress != bState) - { - m_bPaintBuffer_DrawImpress = bState; - SetModified(); - } -} - -// #i4219# -void SvtOptionsDrawinglayer_Impl::SetMaximumPaperWidth( sal_uInt32 nNew ) -{ - if(m_nMaximumPaperWidth != nNew) - { - m_nMaximumPaperWidth = nNew; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetMaximumPaperHeight( sal_uInt32 nNew ) -{ - if(m_nMaximumPaperHeight != nNew) - { - m_nMaximumPaperHeight = nNew; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) -{ - if(m_nMaximumPaperLeftMargin != nNew) - { - m_nMaximumPaperLeftMargin = nNew; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetMaximumPaperRightMargin( sal_uInt32 nNew ) -{ - if(m_nMaximumPaperRightMargin != nNew) - { - m_nMaximumPaperRightMargin = nNew; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetMaximumPaperTopMargin( sal_uInt32 nNew ) -{ - if(m_nMaximumPaperTopMargin != nNew) - { - m_nMaximumPaperTopMargin = nNew; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) -{ - if(m_nMaximumPaperBottomMargin != nNew) - { - m_nMaximumPaperBottomMargin = nNew; - SetModified(); - } -} - -// helper -sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const -{ - if(!m_bAllowAAChecked) - { - SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this); - pThat->m_bAllowAAChecked = true; - -#ifdef WIN32 - // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced - // in the future to use canvases and the canvas renderer, thus a AA-abled - // canvas needs to be checked here in the future. - // Currently, just allow AA for WIN32 -#endif - - // check XRenderExtension - if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect )) - { - pThat->m_bAllowAA = false; - } - } - - return m_bAllowAA; -} - -// primitives -sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const -{ - return m_bAntiAliasing; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsSnapHorVerLinesToDiscrete() const -{ - return m_bSnapHorVerLinesToDiscrete; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const -{ - return m_bSolidDragCreate; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const -{ - return m_bRenderDecoratedTextDirect; -} - -sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const -{ - return m_bRenderSimpleTextDirect; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const -{ - return m_nQuadratic3DRenderLimit; -} - -sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadraticFormControlRenderLimit() const -{ - return m_nQuadraticFormControlRenderLimit; -} - -void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState ) -{ - if(m_bAntiAliasing != bState) - { - m_bAntiAliasing = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) -{ - if(m_bSnapHorVerLinesToDiscrete != bState) - { - m_bSnapHorVerLinesToDiscrete = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) -{ - if(m_bSolidDragCreate != bState) - { - m_bSolidDragCreate = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetRenderDecoratedTextDirect( sal_Bool bState ) -{ - if(m_bRenderDecoratedTextDirect != bState) - { - m_bRenderDecoratedTextDirect = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetRenderSimpleTextDirect( sal_Bool bState ) -{ - if(m_bRenderSimpleTextDirect != bState) - { - m_bRenderSimpleTextDirect = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew) -{ - if(m_nQuadratic3DRenderLimit != nNew) - { - m_nQuadratic3DRenderLimit = nNew; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) -{ - if(m_nQuadraticFormControlRenderLimit != nNew) - { - m_nQuadraticFormControlRenderLimit = nNew; - SetModified(); - } -} - -// #i97672# selection settings -sal_Bool SvtOptionsDrawinglayer_Impl::IsTransparentSelection() const -{ - return m_bTransparentSelection; -} - -void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( sal_Bool bState ) -{ - if(m_bTransparentSelection != bState) - { - m_bTransparentSelection = bState; - SetModified(); - } -} - -void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent ) -{ - if(m_nTransparentSelectionPercent != nPercent) - { - m_nTransparentSelectionPercent = nPercent; - SetModified(); - } -} - -sal_uInt16 SvtOptionsDrawinglayer_Impl::GetTransparentSelectionPercent() const -{ - return m_nTransparentSelectionPercent; -} - -void SvtOptionsDrawinglayer_Impl::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) -{ - if(m_nSelectionMaximumLuminancePercent != nPercent) - { - m_nSelectionMaximumLuminancePercent = nPercent; - SetModified(); - } -} - -sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() const -{ - return m_nSelectionMaximumLuminancePercent; -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_OVERLAYBUFFER , - PROPERTYNAME_PAINTBUFFER , - PROPERTYNAME_STRIPE_COLOR_A , - PROPERTYNAME_STRIPE_COLOR_B , - PROPERTYNAME_STRIPE_LENGTH , - - // #i73602# - PROPERTYNAME_OVERLAYBUFFER_CALC, - PROPERTYNAME_OVERLAYBUFFER_WRITER, - PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS, - - // #i74769#, #i75172# - PROPERTYNAME_PAINTBUFFER_CALC, - PROPERTYNAME_PAINTBUFFER_WRITER, - PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS, - - // #i4219# - PROPERTYNAME_MAXIMUMPAPERWIDTH, - PROPERTYNAME_MAXIMUMPAPERHEIGHT, - PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN, - PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN, - PROPERTYNAME_MAXIMUMPAPERTOPMARGIN, - PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN, - - // primitives - PROPERTYNAME_ANTIALIASING, - PROPERTYNAME_SNAPHORVERLINESTODISCRETE, - PROPERTYNAME_SOLIDDRAGCREATE, - PROPERTYNAME_RENDERDECORATEDTEXTDIRECT, - PROPERTYNAME_RENDERSIMPLETEXTDIRECT, - PROPERTYNAME_QUADRATIC3DRENDERLIMIT, - PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT, - - // #i97672# selection settings - PROPERTYNAME_TRANSPARENTSELECTION, - PROPERTYNAME_TRANSPARENTSELECTIONPERCENT, - PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT - }; - - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL; -sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtOptionsDrawinglayer::SvtOptionsDrawinglayer() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtOptionsDrawinglayer_Impl(); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOverlayBuffer(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsPaintBuffer(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Color SvtOptionsDrawinglayer::GetStripeColorA() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetStripeColorA(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Color SvtOptionsDrawinglayer::GetStripeColorB() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetStripeColorB(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetStripeLength(); -} - -// #i73602# -sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOverlayBuffer_Calc(); -} - -sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOverlayBuffer_Writer(); -} - -sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOverlayBuffer_DrawImpress(); -} - -// #i74769#, #i75172# -sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsPaintBuffer_Calc(); -} - -sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsPaintBuffer_Writer(); -} - -sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsPaintBuffer_DrawImpress(); -} - -// #i4219# -sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMaximumPaperWidth(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMaximumPaperHeight(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMaximumPaperLeftMargin(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMaximumPaperRightMargin(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMaximumPaperTopMargin(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMaximumPaperBottomMargin(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetOverlayBuffer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetPaintBuffer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetStripeColorA( Color aColor ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetStripeColorA( aColor ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetStripeColorB( Color aColor ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetStripeColorB( aColor ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetStripeLength( sal_uInt16 nLength ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetStripeLength( nLength ); -} - -// #i73602# -void SvtOptionsDrawinglayer::SetOverlayBuffer_Calc( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer_Calc( bState ); -} - -void SvtOptionsDrawinglayer::SetOverlayBuffer_Writer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer_Writer( bState ); -} - -void SvtOptionsDrawinglayer::SetOverlayBuffer_DrawImpress( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer_DrawImpress( bState ); -} - -// #i74769#, #i75172# -void SvtOptionsDrawinglayer::SetPaintBuffer_Calc( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer_Calc( bState ); -} - -void SvtOptionsDrawinglayer::SetPaintBuffer_Writer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer_Writer( bState ); -} - -void SvtOptionsDrawinglayer::SetPaintBuffer_DrawImpress( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer_DrawImpress( bState ); -} - -// #i4219# -void SvtOptionsDrawinglayer::SetMaximumPaperWidth( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperWidth( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperHeight( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperHeight( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperLeftMargin( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperRightMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperRightMargin( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperTopMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperTopMargin( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperBottomMargin( nNew ); -} - -// helper -sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const -{ - return m_pDataContainer->IsAAPossibleOnThisSystem(); -} - -// primitives -sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem(); -} - -sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete(); -} - -sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsSolidDragCreate(); -} - -sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsRenderDecoratedTextDirect(); -} - -sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsRenderSimpleTextDirect(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetQuadratic3DRenderLimit(); -} - -sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetQuadraticFormControlRenderLimit(); -} - -void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetAntiAliasing( bState ); -} - -void SvtOptionsDrawinglayer::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetSnapHorVerLinesToDiscrete( bState ); -} - -void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetSolidDragCreate( bState ); -} - -void SvtOptionsDrawinglayer::SetRenderDecoratedTextDirect( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetRenderDecoratedTextDirect( bState ); -} - -void SvtOptionsDrawinglayer::SetRenderSimpleTextDirect( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetRenderSimpleTextDirect( bState ); -} - -void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetQuadratic3DRenderLimit( nNew ); -} - -void SvtOptionsDrawinglayer::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetQuadraticFormControlRenderLimit( nNew ); -} - -// #i97672# selection settings -sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsTransparentSelection(); -} - -void SvtOptionsDrawinglayer::SetTransparentSelection( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetTransparentSelection( bState ); -} - -sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent()); - - // crop to range [10% .. 90%] - if(aRetval < 10) - { - aRetval = 10; - } - - if(aRetval > 90) - { - aRetval = 90; - } - - return aRetval; -} - -void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - - // crop to range [10% .. 90%] - if(nPercent < 10) - { - nPercent = 10; - } - - if(nPercent > 90) - { - nPercent = 90; - } - - m_pDataContainer->SetTransparentSelectionPercent( nPercent ); -} - -sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent()); - - // crop to range [0% .. 100%] - if(aRetval > 90) - { - aRetval = 90; - } - - return aRetval; -} - -void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - - // crop to range [0% .. 100%] - if(nPercent > 90) - { - nPercent = 90; - } - - m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - -// eof - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx index 6f867c6b669c..11b656334454 100644 --- a/unotools/source/config/printwarningoptions.cxx +++ b/unotools/source/config/printwarningoptions.cxx @@ -390,29 +390,17 @@ void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( sal_Bool bState m_pDataContainer->SetModifyDocumentOnPrintingAllowed( bState ) ; } +namespace +{ + class thePrintWarningOptionsMutex : public rtl::Static<osl::Mutex, thePrintWarningOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtPrintWarningOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return thePrintWarningOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx index fcd4c767ef8a..9b0550a8cdc5 100644 --- a/unotools/source/config/regoptions.cxx +++ b/unotools/source/config/regoptions.cxx @@ -35,6 +35,7 @@ #include <osl/mutex.hxx> #include <unotools/bootstrap.hxx> #include <rtl/ustring.hxx> +#include <rtl/instance.hxx> //........................................................................ namespace utl @@ -196,20 +197,15 @@ namespace utl sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False; sal_Int32 RegOptionsImpl::s_nInstanceCount = 0; + namespace + { + class theRegOptionsImplMutex : public rtl::Static<osl::Mutex, theRegOptionsImplMutex>{}; + } + //-------------------------------------------------------------------- ::osl::Mutex& RegOptionsImpl::getStaticMutex() { - static ::osl::Mutex* s_pStaticMutex = NULL; - if ( !s_pStaticMutex ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !s_pStaticMutex ) - { - static ::osl::Mutex s_aStaticMutex; - s_pStaticMutex = &s_aStaticMutex; - } - } - return *s_pStaticMutex; + return theRegOptionsImplMutex::get(); } //-------------------------------------------------------------------- diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index fb0ea146b71c..21914d1a402f 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -1166,26 +1166,14 @@ bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const return m_pDataContainer->IsOptionEnabled( eOption ); } +namespace +{ + class theSecurityOptionsMutex : public rtl::Static<osl::Mutex, theSecurityOptionsMutex>{}; +} + Mutex& SvtSecurityOptions::GetInitMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be faster then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theSecurityOptionsMutex::get(); } diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx index 98d17b9a739b..c47b34946dd3 100644 --- a/unotools/source/config/startoptions.cxx +++ b/unotools/source/config/startoptions.cxx @@ -427,29 +427,17 @@ void SvtStartOptions::SetConnectionURL( const OUString& sURL ) m_pDataContainer->SetConnectionURL( sURL ); } +namespace +{ + class theStartOptionsMutex : public rtl::Static<osl::Mutex, theStartOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtStartOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theStartOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index 2b6f4f2cdc1b..9c071cea2dd1 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -273,19 +273,16 @@ void SvtSysLocaleOptions_Impl::MakeRealLocale() void SvtSysLocaleOptions_Impl::MakeRealUILocale() { - if ( !m_aRealUILocale.Language.getLength() ) + // as we can't switch UILocale at runtime, we only store changes in the configuration + m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString ); + if ( m_aRealUILocale.Language.getLength() ) { - // as we can't switch UILocale at runtime, we only store changes in the configuration - m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString ); - if ( m_aRealUILocale.Language.getLength() ) - { - m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale ); - } - else - { - m_eRealUILanguage = MsLangId::getSystemUILanguage(); - MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale ); - } + m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale ); + } + else + { + m_eRealUILanguage = MsLangId::getSystemUILanguage(); + MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale ); } } @@ -399,13 +396,12 @@ void SvtSysLocaleOptions_Impl::SetUILocaleString( const OUString& rStr ) if (!m_bROUILocale && rStr != m_aUILocaleString ) { m_aUILocaleString = rStr; -/* + // as we can't switch UILocale at runtime, we only store changes in the configuration MakeRealUILocale(); MsLangId::setConfiguredSystemLanguage( m_eRealUILanguage ); SetModified(); NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE ); -*/ } } diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index ee88691535a2..11a781213b4c 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -985,27 +985,14 @@ SvtUserOptions::~SvtUserOptions() // ----------------------------------------------------------------------- +namespace +{ + class theUserOptionsMutex : public rtl::Static<osl::Mutex, theUserOptionsMutex>{}; +} + ::osl::Mutex& SvtUserOptions::GetInitMutex() { - // Initialize static mutex only for one time! - static ::osl::Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if ( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - - // because another instance of our class will be faster then this instance! - if ( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static ::osl::Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theUserOptionsMutex::get(); } // ----------------------------------------------------------------------- diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx index c0eecd9e7edd..9fe4aba17ed7 100644 --- a/unotools/source/config/viewoptions.cxx +++ b/unotools/source/config/viewoptions.cxx @@ -1225,29 +1225,17 @@ void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName , } } +namespace +{ + class theViewOptionsMutex : public rtl::Static<osl::Mutex, theViewOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** ::osl::Mutex& SvtViewOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static ::osl::Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static ::osl::Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theViewOptionsMutex::get(); } void SvtViewOptions::AcquireOptions() diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx index fd498c7b7556..39f2ebef773d 100644 --- a/unotools/source/config/workingsetoptions.cxx +++ b/unotools/source/config/workingsetoptions.cxx @@ -362,29 +362,17 @@ void SvtWorkingSetOptions::SetWindowList( const Sequence< OUString >& seqWindowL m_pDataContainer->SetWindowList( seqWindowList ); } +namespace +{ + class theWorkingSetOptionsMutex : public rtl::Static<osl::Mutex, theWorkingSetOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtWorkingSetOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theWorkingSetOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx index 5c024bcc1c92..d4a9be17929a 100644 --- a/unotools/source/i18n/charclass.cxx +++ b/unotools/source/i18n/charclass.cxx @@ -61,7 +61,7 @@ CharClass::CharClass( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) ), uno::UNO_QUERY ); } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "CharClass ctor: Exception caught!" ); } @@ -101,7 +101,7 @@ void CharClass::getComponentInstance() x >>= xCC; } } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "getComponentInstance: Exception caught!" ); } @@ -186,7 +186,7 @@ sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isAlpha: Exception caught!" ); return sal_False; @@ -203,7 +203,7 @@ sal_Bool CharClass::isAlpha( const String& rStr ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isAlpha: Exception caught!" ); return sal_False; @@ -225,7 +225,7 @@ sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isLetter: Exception caught!" ); return sal_False; @@ -242,7 +242,7 @@ sal_Bool CharClass::isLetter( const String& rStr ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isLetter: Exception caught!" ); return sal_False; @@ -264,7 +264,7 @@ sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isDigit: Exception caught!" ); return sal_False; @@ -281,7 +281,7 @@ sal_Bool CharClass::isNumeric( const String& rStr ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isNumeric: Exception caught!" ); return sal_False; @@ -303,7 +303,7 @@ sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isAlphaNumeric: Exception caught!" ); return sal_False; @@ -320,7 +320,7 @@ sal_Bool CharClass::isAlphaNumeric( const String& rStr ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isAlphaNumeric: Exception caught!" ); return sal_False; @@ -342,7 +342,7 @@ sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isLetterNumeric: Exception caught!" ); return sal_False; @@ -359,7 +359,7 @@ sal_Bool CharClass::isLetterNumeric( const String& rStr ) const else return sal_False; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "isLetterNumeric: Exception caught!" ); return sal_False; @@ -388,7 +388,7 @@ String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCoun else return rStr.Copy( nPos, nCount ); } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "toTitle: Exception caught!" ); return rStr.Copy( nPos, nCount ); @@ -405,7 +405,7 @@ String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCoun else return rStr.copy( nPos, nCount ); } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "toUpper: Exception caught!" ); return rStr.copy( nPos, nCount ); @@ -422,7 +422,7 @@ String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCoun else return rStr.copy( nPos, nCount ); } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "toLower: Exception caught!" ); return rStr.copy( nPos, nCount ); @@ -439,7 +439,7 @@ sal_Int16 CharClass::getType( const String& rStr, xub_StrLen nPos ) const else return 0; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "getType: Exception caught!" ); return 0; @@ -456,7 +456,7 @@ sal_Int16 CharClass::getCharacterDirection( const String& rStr, xub_StrLen nPos else return 0; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "getCharacterDirection: Exception caught!" ); return 0; @@ -473,7 +473,7 @@ sal_Int16 CharClass::getScript( const String& rStr, xub_StrLen nPos ) const else return 0; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "getScript: Exception caught!" ); return 0; @@ -490,7 +490,7 @@ sal_Int32 CharClass::getCharacterType( const String& rStr, xub_StrLen nPos ) con else return 0; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "getCharacterType: Exception caught!" ); return 0; @@ -507,7 +507,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str else return 0; } - catch ( Exception& ) + catch ( const Exception& ) { DBG_ERRORFILE( "getStringType: Exception caught!" ); return 0; @@ -532,7 +532,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str else return ParseResult(); } - catch ( Exception& e ) + catch ( const Exception& e ) { #ifdef DBG_UTIL ByteString aMsg( "parseAnyToken: Exception caught\n" ); @@ -564,7 +564,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str else return ParseResult(); } - catch ( Exception& e ) + catch ( const Exception& e ) { #ifdef DBG_UTIL ByteString aMsg( "parsePredefinedToken: Exception caught\n" ); diff --git a/unotools/source/i18n/makefile.mk b/unotools/source/i18n/makefile.mk deleted file mode 100644 index cbe42e626b79..000000000000 --- a/unotools/source/i18n/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=i18n - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= \ - $(SLO)$/caserotate.obj \ - $(SLO)$/charclass.obj \ - $(SLO)$/calendarwrapper.obj \ - $(SLO)$/collatorwrapper.obj \ - $(SLO)$/intlwrapper.obj \ - $(SLO)$/localedatawrapper.obj \ - $(SLO)$/nativenumberwrapper.obj \ - $(SLO)$/numberformatcodewrapper.obj \ - $(SLO)$/readwritemutexguard.obj \ - $(SLO)$/transliterationwrapper.obj \ - $(SLO)$/textsearch.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index c89427dd27a2..d51c30ec7f58 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -542,7 +542,7 @@ String GetSubsFontName( const String& rName, sal_uLong nFlags ) || aOrgName.EqualsAscii( "opensymbol" ) ) ) return aName; - const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get()->getSubstInfo( aOrgName ); + const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get().getSubstInfo( aOrgName ); if ( pAttr ) { for( int i = 0; i < 3; i++ ) diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk deleted file mode 100644 index 46e173b9a055..000000000000 --- a/unotools/source/misc/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=misc - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/atom.obj \ - $(SLO)$/datetime.obj \ - $(SLO)$/syslocale.obj \ - $(SLO)$/eventlisteneradapter.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/fontdefs.obj \ - $(SLO)$/desktopterminationobserver.obj \ - $(SLO)$/sharedunocomponent.obj \ - $(SLO)$/componentresmodule.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/processfactory/componentfactory.cxx b/unotools/source/processfactory/componentfactory.cxx deleted file mode 100644 index eea66491fe0b..000000000000 --- a/unotools/source/processfactory/componentfactory.cxx +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_unotools.hxx" - -#include <unotools/componentfactory.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <com/sun/star/registry/XRegistryKey.hpp> - -#include <cppuhelper/factory.hxx> - -#include <uno/environment.h> -#include <uno/mapping.hxx> - -#include <rtl/ustring.hxx> -#include <osl/module.h> - - - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::rtl; - - -namespace utl -{ - -Reference< XInterface > getComponentInstance( - const OUString & rLibraryName, - const OUString & rImplementationName - ) -{ - Reference< XInterface > xI; - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - if ( xMSF.is() ) - xI = xMSF->createInstance( rImplementationName ); - if( !xI.is() ) - { - Reference< XSingleServiceFactory > xSSF = - loadLibComponentFactory( rLibraryName, rImplementationName, - Reference< XMultiServiceFactory >(), Reference< XRegistryKey >() ); - xI = xSSF->createInstance(); - } - return xI; -} - - -Reference< XSingleServiceFactory > loadLibComponentFactory( - const OUString & rLibName, - const OUString & rImplName, - const Reference< XMultiServiceFactory > & xSF, - const Reference< XRegistryKey > & xKey - ) -{ - Reference< XSingleServiceFactory > xRet; - - oslModule lib = osl_loadModule( rLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); - if (lib) - { - void * pSym; - - // ========================= LATEST VERSION ========================= - OUString aGetEnvName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETENV) ); - if (pSym = osl_getSymbol( lib, aGetEnvName.pData )) - { - uno_Environment * pCurrentEnv = 0; - uno_Environment * pEnv = 0; - const sal_Char * pEnvTypeName = 0; - (*((component_getImplementationEnvironmentFunc)pSym))( &pEnvTypeName, &pEnv ); - - sal_Bool bNeedsMapping = - (pEnv || 0 != rtl_str_compare( pEnvTypeName, CPPU_CURRENT_LANGUAGE_BINDING_NAME )); - - OUString aEnvTypeName( OUString::createFromAscii( pEnvTypeName ) ); - - if (bNeedsMapping) - { - if (! pEnv) - uno_getEnvironment( &pEnv, aEnvTypeName.pData, 0 ); - if (pEnv) - { - OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); - uno_getEnvironment( &pCurrentEnv, aCppEnvTypeName.pData, 0 ); - if (pCurrentEnv) - bNeedsMapping = (pEnv != pCurrentEnv); - } - } - - OUString aGetFactoryName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY) ); - if (pSym = osl_getSymbol( lib, aGetFactoryName.pData )) - { - OString aImplName( OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) ); - - if (bNeedsMapping) - { - if (pEnv && pCurrentEnv) - { - Mapping aCurrent2Env( pCurrentEnv, pEnv ); - Mapping aEnv2Current( pEnv, pCurrentEnv ); - - if (aCurrent2Env.is() && aEnv2Current.is()) - { - void * pSMgr = aCurrent2Env.mapInterface( - xSF.get(), ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) ); - void * pKey = aCurrent2Env.mapInterface( - xKey.get(), ::getCppuType( (const Reference< XRegistryKey > *)0 ) ); - - void * pSSF = (*((component_getFactoryFunc)pSym))( - aImplName.getStr(), pSMgr, pKey ); - - if (pKey) - (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pKey ); - if (pSMgr) - (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSMgr ); - - if (pSSF) - { - aEnv2Current.mapInterface( - reinterpret_cast< void ** >( &xRet ), - pSSF, ::getCppuType( (const Reference< XSingleServiceFactory > *)0 ) ); - (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSSF ); - } - } - } - } - else - { - XSingleServiceFactory * pRet = (XSingleServiceFactory *) - (*((component_getFactoryFunc)pSym))( - aImplName.getStr(), xSF.get(), xKey.get() ); - if (pRet) - { - xRet = pRet; - pRet->release(); - } - } - } - - if (pEnv) - (*pEnv->release)( pEnv ); - if (pCurrentEnv) - (*pCurrentEnv->release)( pCurrentEnv ); - } - - - if (! xRet.is()) - osl_unloadModule( lib ); - } - - return xRet; -} - -} // namespace utl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/processfactory/makefile.mk b/unotools/source/processfactory/makefile.mk deleted file mode 100644 index 0e1e4aeacca8..000000000000 --- a/unotools/source/processfactory/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=procfact - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings common for the whole project ----- - - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/processfactory.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/property/makefile.mk b/unotools/source/property/makefile.mk deleted file mode 100644 index c53f5a8d2cf5..000000000000 --- a/unotools/source/property/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=property - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/propertysetinfo.obj \ - $(SLO)$/propertysethelper.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/streaming/makefile.mk b/unotools/source/streaming/makefile.mk deleted file mode 100644 index b70d7fea4091..000000000000 --- a/unotools/source/streaming/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=streaming - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/streamhelper.obj \ - $(SLO)$/streamwrap.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx index fc29a63bb1ac..812397f63839 100644 --- a/unotools/source/streaming/streamwrap.cxx +++ b/unotools/source/streaming/streamwrap.cxx @@ -116,16 +116,8 @@ void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip) throw( star ::osl::MutexGuard aGuard( m_aMutex ); checkError(); -#ifdef DBG_UTIL - sal_uInt32 nCurrentPos = m_pSvStream->Tell(); -#endif - m_pSvStream->SeekRel(nBytesToSkip); checkError(); - -#ifdef DBG_UTIL - nCurrentPos = m_pSvStream->Tell(); -#endif } //------------------------------------------------------------------------------ diff --git a/unotools/source/ucbhelper/makefile.mk b/unotools/source/ucbhelper/makefile.mk deleted file mode 100644 index 57088c69ca5c..000000000000 --- a/unotools/source/ucbhelper/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJINC=..$/..$/inc -PRJNAME=unotools -TARGET=ucbhelp - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES=\ - $(SLO)$/ucblockbytes.obj \ - $(SLO)$/localfilehelper.obj \ - $(SLO)$/ucbhelper.obj \ - $(SLO)$/ucbstreamhelper.obj \ - $(SLO)$/tempfile.obj \ - $(SLO)$/xtempfile.obj \ - $(SLO)$/progresshandlerwrap.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index b0ceb14b1a57..99f0b85d68b8 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -259,7 +259,7 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru // but if there is a folder with such name proceed further DirectoryItem aTmpItem; - FileStatus aTmpStatus( FileStatusMask_Type ); + FileStatus aTmpStatus( osl_FileStatus_Mask_Type ); if ( DirectoryItem::get( aTmp, aTmpItem ) != FileBase::E_None || aTmpItem.getFileStatus( aTmpStatus ) != FileBase::E_None || aTmpStatus.getFileType() != FileStatus::Directory ) @@ -324,7 +324,7 @@ umask(old_mode); // but if there is a folder with such name proceed further DirectoryItem aTmpItem; - FileStatus aTmpStatus( FileStatusMask_Type ); + FileStatus aTmpStatus( osl_FileStatus_Mask_Type ); if ( DirectoryItem::get( aTmp, aTmpItem ) != FileBase::E_None || aTmpItem.getFileStatus( aTmpStatus ) != FileBase::E_None || aTmpStatus.getFileType() != FileStatus::Directory ) diff --git a/unotools/util/makefile.mk b/unotools/util/makefile.mk deleted file mode 100644 index dffbdf0b6953..000000000000 --- a/unotools/util/makefile.mk +++ /dev/null @@ -1,103 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. -PRJNAME=unotools -TARGET=utl -TARGETTYPE=CUI -USE_LDUMP2=TRUE - -USE_DEFFILE=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -# --- Library ----------------------------------- - -LIB1TARGET=$(SLB)$/untools.lib -LIB1FILES=\ - $(SLB)$/i18n.lib \ - $(SLB)$/misc.lib \ - $(SLB)$/streaming.lib \ - $(SLB)$/config.lib \ - $(SLB)$/ucbhelp.lib \ - $(SLB)$/procfact.lib \ - $(SLB)$/property.lib \ - $(SLB)$/accessibility.lib - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1IMPLIB=iutl -SHL1USE_EXPORTS=name - -SHL1STDLIBS= \ - $(SALHELPERLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(I18NISOLANGLIB) \ - $(TOOLSLIB) \ - $(SALLIB) - -SHL1LIBS=$(LIB1TARGET) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def - -SHL1DEPN=$(LIB1TARGET) - -DEF1NAME =$(SHL1TARGET) -DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt -DEFLIB1NAME =untools -DEF1DES =unotools - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - -# --- Filter-Datei --- - -$(MISC)$/$(SHL1TARGET).flt: makefile.mk - @echo ------------------------------ - @echo Making: $@ - @echo CLEAR_THE_FILE > $@ - @echo _TI >> $@ - @echo _real >> $@ - @echo NodeValueAccessor >> $@ - @echo SubNodeAccess >> $@ - @echo UpdateFromConfig >> $@ - @echo UpdateToConfig >> $@ - @echo _Impl >> $@ - - -ALLTAR : $(MISC)/utl.component - -$(MISC)/utl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - utl.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt utl.component diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index c8372fac3610..44df1f03ffde 100755 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -28,11 +28,11 @@ $(eval $(call gb_Library_Library,vcl)) ifeq ($(OS),MACOSX) -$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.macosx)) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.macosx,vcl/vcl)) else ifeq ($(OS),WNT) -$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.windows)) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.windows,vcl/vcl)) else -$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx)) +$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx,vcl/vcl)) endif $(eval $(call gb_Library_add_package_headers,vcl,vcl_inc)) diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index eda3f5af3051..095427cb1d23 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1324,6 +1324,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) // images in menus false for MacOSX aStyleSettings.SetPreferredUseImagesInMenus( false ); + aStyleSettings.SetHideDisabledMenuItems( sal_True ); aStyleSettings.SetAcceleratorsInContextMenus( sal_False ); rSettings.SetStyleSettings( aStyleSettings ); diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index 850531c64d9d..69d127a68d15 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -29,6 +29,8 @@ #ifndef _SV_ILSTBOX_HXX #define _SV_ILSTBOX_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include <vcl/sv.h> #include <vcl/image.hxx> #include <vcl/ctrl.hxx> @@ -104,7 +106,7 @@ struct ImplEntryType // - ImplEntryList - // ----------------- -class ImplEntryList : private List +class ImplEntryList { private: Window* mpWindow; // For getting the current locale when matching strings @@ -117,8 +119,14 @@ private: Link maSelectionChangedHdl; sal_Bool mbCallSelectionChangedHdl; + boost::ptr_vector<ImplEntryType> maEntries; - ImplEntryType* GetEntry( sal_uInt16 nPos ) const { return (ImplEntryType*)List::GetObject( nPos ); } + ImplEntryType* GetEntry( sal_uInt16 nPos ) const + { + if (nPos >= maEntries.size()) + return NULL; + return const_cast<ImplEntryType*>(&maEntries[nPos]); + } public: ImplEntryList( Window* pWindow ); @@ -126,8 +134,8 @@ public: sal_uInt16 InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort ); void RemoveEntry( sal_uInt16 nPos ); - const ImplEntryType* GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetObject( nPos ); } - ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return (ImplEntryType*) GetObject( nPos ); } + const ImplEntryType* GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetEntry( nPos ); } + ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return GetEntry( nPos ); } void Clear(); sal_uInt16 FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const; @@ -141,7 +149,7 @@ public: long GetAddedHeight( sal_uInt16 nEndIndex, sal_uInt16 nBeginIndex = 0, long nBeginHeight = 0 ) const; long GetEntryHeight( sal_uInt16 nPos ) const; - sal_uInt16 GetEntryCount() const { return (sal_uInt16)List::Count(); } + sal_uInt16 GetEntryCount() const { return (sal_uInt16)maEntries.size(); } sal_Bool HasImages() const { return mnImages ? sal_True : sal_False; } XubString GetEntryText( sal_uInt16 nPos ) const; diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 1683e1af150c..3f9dbcfc1af2 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -116,7 +116,6 @@ namespace vcl }; /** Value of the width member of the TTGlobalFontInfo struct */ -#ifndef OS2 enum WidthClass { FWIDTH_ULTRA_CONDENSED = 1, /**< 50% of normal */ FWIDTH_EXTRA_CONDENSED = 2, /**< 62.5% of normal */ @@ -128,7 +127,6 @@ namespace vcl FWIDTH_EXTRA_EXPANDED = 8, /**< 150% of normal */ FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */ }; -#endif // OS2 #endif /* FW_THIN */ /** Type of the 'kern' table, stored in _TrueTypeFont::kerntype */ @@ -292,7 +290,7 @@ namespace vcl * @ingroup sft */ int VCL_DLLPUBLIC OpenTTFontBuffer(void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); /*FOLD01*/ -#if !defined(WIN32) && !defined(OS2) +#if !defined(WIN32) /** * TrueTypeFont constructor. * Reads the font file and allocates the memory for the structure. diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 5fa0c10f9f56..571b5ca6fd86 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -78,9 +78,8 @@ public: virtual int GetDefaultMonitorNumber() const; - static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, - GdkEvent* event, - gpointer data ); + GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event, + GdkEvent* event ); inline bool HasMoreEvents() { return m_aUserEvents.size() > 1; } inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); } inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); } diff --git a/vcl/inc/unx/pspgraphics.h b/vcl/inc/unx/pspgraphics.h index 6a9a80647e42..bb9f67d05cde 100644 --- a/vcl/inc/unx/pspgraphics.h +++ b/vcl/inc/unx/pspgraphics.h @@ -34,7 +34,8 @@ #include "vclpluginapi.h" #include "salgdi.hxx" -#include "sallayout.hxx" +#include "vcl/vclenum.hxx" +#include <sallayout.hxx> namespace psp { struct JobData; class PrinterGfx; } @@ -77,11 +78,6 @@ public: static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& ); static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& ); - static FontWidth ToFontWidth (psp::width::type eWidth); - static FontWeight ToFontWeight (psp::weight::type eWeight); - static FontPitch ToFontPitch (psp::pitch::type ePitch); - static FontItalic ToFontItalic (psp::italic::type eItalic); - static FontFamily ToFontFamily (psp::family::type eFamily); // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); diff --git a/vcl/inc/vcl/alpha.hxx b/vcl/inc/vcl/alpha.hxx index 8bcaf3789528..c6f5dd8043fe 100644 --- a/vcl/inc/vcl/alpha.hxx +++ b/vcl/inc/vcl/alpha.hxx @@ -100,6 +100,11 @@ public: BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } void ReleaseAccess( BitmapReadAccess* pAccess ); + typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess > + ScopedReadAccess; + typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess > + ScopedWriteAccess; + public: sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ) { return Bitmap::Read( rIStm, bFileHeader ); } diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index d514977fda38..e25bb482f53c 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -34,6 +34,7 @@ #include <vcl/mapmod.hxx> #include <tools/rc.hxx> #include <vcl/region.hxx> +#include <vcl/scopedbitmapaccess.hxx> // ----------- // - Defines - @@ -230,7 +231,7 @@ class SalBitmap; struct BitmapSystemData { - #if defined( WNT ) || defined( OS2 ) + #if defined( WNT ) void* pDIB; // device independent byte buffer void* pDDB; // if not NULL then this is actually an HBITMAP #elif defined( QUARTZ ) @@ -752,6 +753,11 @@ public: BitmapWriteAccess* AcquireWriteAccess(); void ReleaseAccess( BitmapReadAccess* pAccess ); + typedef vcl::ScopedBitmapAccess< BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess > + ScopedReadAccess; + typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess > + ScopedWriteAccess; + public: sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True, sal_Bool bMSOFormat = sal_False ); diff --git a/vcl/inc/vcl/bmpacc.hxx b/vcl/inc/vcl/bmpacc.hxx index 650a60a69077..d98ff2cfe8dc 100644 --- a/vcl/inc/vcl/bmpacc.hxx +++ b/vcl/inc/vcl/bmpacc.hxx @@ -34,7 +34,6 @@ #include <vcl/salbtype.hxx> #include <vcl/bitmap.hxx> - // -------------------- // - Access defines - // -------------------- @@ -226,72 +225,6 @@ private: BitmapWriteAccess& operator=( const BitmapWriteAccess& ) { return *this; } }; -// ------------------- -// - Accessor Helper - -// ------------------- - -/** This template handles BitmapAccess the RAII way. - - Please don't use directly, but the ready-made typedefs for - BitmapReadAccess and BitmapWriteAccess below. - */ -template < class Access > class ScopedBitmapAccess -{ -public: - ScopedBitmapAccess( Access* pAccess, - Bitmap& rBitmap ) : - mpAccess( pAccess ), - mrBitmap( rBitmap ) - { - } - - ~ScopedBitmapAccess() - { - mrBitmap.ReleaseAccess( mpAccess ); - } - - Access* get() { return mpAccess; } - const Access* get() const { return mpAccess; } - - Access* operator->() { return mpAccess; } - const Access* operator->() const { return mpAccess; } - - Access& operator*() { return *mpAccess; } - const Access& operator*() const { return *mpAccess; } - -private: - Access* mpAccess; - Bitmap& mrBitmap; -}; - -/** This wrapper handles BitmapReadAccess the RAII way. - - Use as follows: - Bitmap aBitmap - ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), aBitmap ); - pReadAccess->SetPixel()... - - @attention for practical reasons, ScopedBitmapReadAccess stores a - reference to the provided bitmap, thus, make sure that the bitmap - specified at construction time lives at least as long as the - ScopedBitmapReadAccess. -*/ -typedef ScopedBitmapAccess< BitmapReadAccess > ScopedBitmapReadAccess; - -/** This wrapper handles BitmapWriteAccess the RAII way. - - Use as follows: - Bitmap aBitmap - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), aBitmap ); - pWriteAccess->SetPixel()... - - @attention for practical reasons, ScopedBitmapWriteAccess stores a - reference to the provided bitmap, thus, make sure that the bitmap - specified at construction time lives at least as long as the - ScopedBitmapWriteAccess. -*/ -typedef ScopedBitmapAccess< BitmapWriteAccess > ScopedBitmapWriteAccess; - // ----------- // - Inlines - // ----------- diff --git a/vcl/inc/vcl/cursor.hxx b/vcl/inc/vcl/cursor.hxx index 9c9bba21db80..7fd95454945e 100644 --- a/vcl/inc/vcl/cursor.hxx +++ b/vcl/inc/vcl/cursor.hxx @@ -62,15 +62,17 @@ private: Point maPos; // Position short mnOrientation; // Rotation sal_uInt16 mnStyle; // Style - sal_Bool mbVisible; // Ist Cursor sichtbar + bool mbVisible; // Ist Cursor sichtbar unsigned char mnDirection; // indicates direction public: SAL_DLLPRIVATE void ImplDraw(); SAL_DLLPRIVATE void ImplRestore(); DECL_DLLPRIVATE_LINK( ImplTimerHdl, AutoTimer* ); - SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true, bool bRestore = false ); - SAL_DLLPRIVATE bool ImplHide( bool bStopTimer ); + SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true ); + SAL_DLLPRIVATE void ImplHide(); + SAL_DLLPRIVATE void ImplResume( bool bRestore = false ); + SAL_DLLPRIVATE bool ImplSuspend(); SAL_DLLPRIVATE void ImplNew(); public: @@ -83,7 +85,7 @@ public: void Show(); void Hide(); - sal_Bool IsVisible() const { return mbVisible; } + bool IsVisible() const { return mbVisible; } void SetWindow( Window* pWindow ); Window* GetWindow() const { return mpWindow; } @@ -110,9 +112,13 @@ public: unsigned char GetDirection() const { return mnDirection; } Cursor& operator=( const Cursor& rCursor ); - sal_Bool operator==( const Cursor& rCursor ) const; - sal_Bool operator!=( const Cursor& rCursor ) const + bool operator==( const Cursor& rCursor ) const; + bool operator!=( const Cursor& rCursor ) const { return !(Cursor::operator==( rCursor )); } + +private: + void ImplDoShow( bool bDrawDirect, bool bRestore ); + bool ImplDoHide( bool bStop ); }; #endif // _SV_CURSOR_HXX diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index 25674b76ae8a..145c4d0a2169 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -36,7 +36,7 @@ #include "vcl/dllapi.h" #include "vcl/helper.hxx" - +#include "vcl/vclenum.hxx" #include "com/sun/star/lang/Locale.hpp" #include <vector> @@ -57,71 +57,6 @@ class ImplFontOptions; namespace psp { class PPDParser; // see ppdparser.hxx -namespace italic -{ -enum type { - Upright = 0, - Oblique = 1, - Italic = 2, - Unknown = 3 -}; -} - -namespace width -{ -enum type { - Unknown = 0, - UltraCondensed = 1, - ExtraCondensed = 2, - Condensed = 3, - SemiCondensed = 4, - Normal = 5, - SemiExpanded = 6, - Expanded = 7, - ExtraExpanded = 8, - UltraExpanded = 9 -}; -} - -namespace pitch -{ -enum type { - Unknown = 0, - Fixed = 1, - Variable = 2 -}; -} - -namespace weight -{ -enum type { - Unknown = 0, - Thin = 1, - UltraLight = 2, - Light = 3, - SemiLight = 4, - Normal = 5, - Medium = 6, - SemiBold = 7, - Bold = 8, - UltraBold = 9, - Black = 10 -}; -} - -namespace family -{ -enum type { - Unknown = 0, - Decorative = 1, - Modern = 2, - Roman = 3, - Script = 4, - Swiss = 5, - System = 6 -}; -} - namespace fonttype { enum type { @@ -132,15 +67,6 @@ enum type { }; } -namespace fcstatus -{ -enum type { - istrue, - isunset, - isfalse -}; -} - /* * the difference between FastPrintFontInfo and PrintFontInfo * is that the information in FastPrintFontInfo can usually @@ -160,11 +86,11 @@ struct FastPrintFontInfo rtl::OUString m_aFamilyName; rtl::OUString m_aStyleName; std::list< rtl::OUString > m_aAliases; - family::type m_eFamilyStyle; - italic::type m_eItalic; - width::type m_eWidth; - weight::type m_eWeight; - pitch::type m_ePitch; + FontFamily m_eFamilyStyle; + FontItalic m_eItalic; + FontWidth m_eWidth; + FontWeight m_eWeight; + FontPitch m_ePitch; rtl_TextEncoding m_aEncoding; bool m_bSubsettable; bool m_bEmbeddable; @@ -172,11 +98,11 @@ struct FastPrintFontInfo FastPrintFontInfo() : m_nID( 0 ), m_eType( fonttype::Unknown ), - m_eFamilyStyle( family::Unknown ), - m_eItalic( italic::Unknown ), - m_eWidth( width::Unknown ), - m_eWeight( weight::Unknown ), - m_ePitch( pitch::Unknown ), + m_eFamilyStyle( FAMILY_DONTKNOW ), + m_eItalic( ITALIC_DONTKNOW ), + m_eWidth( WIDTH_DONTKNOW ), + m_eWeight( WEIGHT_DONTKNOW ), + m_ePitch( PITCH_DONTKNOW ), m_aEncoding( RTL_TEXTENCODING_DONTKNOW ) {} }; @@ -275,10 +201,10 @@ class VCL_PLUGIN_PUBLIC PrintFontManager std::list< int > m_aAliases; int m_nPSName; // atom rtl::OUString m_aStyleName; - italic::type m_eItalic; - width::type m_eWidth; - weight::type m_eWeight; - pitch::type m_ePitch; + FontItalic m_eItalic; + FontWidth m_eWidth; + FontWeight m_eWeight; + FontPitch m_ePitch; rtl_TextEncoding m_aEncoding; bool m_bFontEncodingOnly; // set if font should be only accessed by builtin encoding CharacterMetric m_aGlobalMetricX; @@ -358,10 +284,10 @@ class VCL_PLUGIN_PUBLIC PrintFontManager rtl::OString aFoundry; rtl::OString aFamily; rtl::OString aAddStyle; - italic::type eItalic; - weight::type eWeight; - width::type eWidth; - pitch::type ePitch; + FontItalic eItalic; + FontWeight eWeight; + FontWidth eWidth; + FontPitch ePitch; rtl_TextEncoding aEncoding; XLFDEntry() { nMask = 0; } @@ -374,7 +300,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager fontID m_nNextFontID; boost::unordered_map< fontID, PrintFont* > m_aFonts; - boost::unordered_map< int, family::type > m_aFamilyTypes; + boost::unordered_map< int, FontFamily > m_aFamilyTypes; std::list< rtl::OUString > m_aPrinterDrivers; std::list< rtl::OString > m_aFontDirectories; std::list< int > m_aPrivateFontDirectories; @@ -416,7 +342,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager fontID findFontFileID( int nDirID, const rtl::OString& rFile ) const; fontID findFontBuiltinID( int nPSNameAtom ) const; - family::type matchFamilyName( const rtl::OUString& rFamily ) const; + FontFamily matchFamilyName( const rtl::OUString& rFamily ) const; PrintFont* getFont( fontID nID ) const { @@ -501,7 +427,7 @@ public: const rtl::OUString& getPSName( fontID nFontID ) const; // get a specific fonts style family - family::type getFontFamilyType( fontID nFontID ) const; + FontFamily getFontFamilyType( fontID nFontID ) const; // get a specific fonts family name aliases void getFontFamilyAliases( fontID nFontID ) const; @@ -514,31 +440,31 @@ public: } // get a specific fonts italic type - italic::type getFontItalic( fontID nFontID ) const + FontItalic getFontItalic( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_eItalic : italic::Unknown; + return pFont ? pFont->m_eItalic : ITALIC_DONTKNOW; } // get a specific fonts width type - width::type getFontWidth( fontID nFontID ) const + FontWidth getFontWidth( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_eWidth : width::Unknown; + return pFont ? pFont->m_eWidth : WIDTH_DONTKNOW; } // get a specific fonts weight type - weight::type getFontWeight( fontID nFontID ) const + FontWeight getFontWeight( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_eWeight : weight::Unknown; + return pFont ? pFont->m_eWeight : WEIGHT_DONTKNOW; } // get a specific fonts pitch type - pitch::type getFontPitch( fontID nFontID ) const + FontPitch getFontPitch( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); - return pFont ? pFont->m_ePitch : pitch::Unknown; + return pFont ? pFont->m_ePitch : PITCH_DONTKNOW; } // get a specific fonts encoding @@ -736,8 +662,8 @@ public: ImplFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*)) const; rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, - const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight, - width::type& rWidth, pitch::type& rPitch) const; + const rtl::OString& rLangAttrib, FontItalic& rItalic, FontWeight& rWeight, + FontWidth& rWidth, FontPitch& rPitch) const; bool hasFontconfig() const { return m_bFontconfigSuccess; } int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar ); diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index 4aaa2953d80b..86f8dc5cbc77 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -32,9 +32,9 @@ #include <vcl/dllapi.h> #include <tools/gen.hxx> #include <tools/link.hxx> -#include <tools/list.hxx> #include <tools/string.hxx> #include <vcl/mapmod.hxx> +#include <vector> class OutputDevice; class ImpLabelList; @@ -51,8 +51,8 @@ class Gradient; // - GDIMetaFile-Types - // --------------------- -#define GDI_METAFILE_END ((sal_uLong)0xFFFFFFFF) -#define GDI_METAFILE_LABEL_NOTFOUND ((sal_uLong)0xFFFFFFFF) +#define GDI_METAFILE_END ((size_t)0xFFFFFFFF) +#define GDI_METAFILE_LABEL_NOTFOUND ((size_t)0xFFFFFFFF) #ifndef METAFILE_END #define METAFILE_END GDI_METAFILE_END @@ -102,9 +102,11 @@ typedef BitmapEx (*BmpExchangeFnc)( const BitmapEx& rBmpEx, const void* pBmpPara // - GDIMetaFile - // --------------- -class VCL_DLLPUBLIC GDIMetaFile : protected List +class VCL_DLLPUBLIC GDIMetaFile { private: + ::std::vector< MetaAction* > aList; + size_t nCurrentActionElement; MapMode aPrefMapMode; Size aPrefSize; @@ -143,7 +145,7 @@ private: const OutputDevice& rMapDev, const PolyPolygon& rPolyPoly, const Gradient& rGrad ); - SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize ); + SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize ); SAL_DLLPRIVATE void ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut ); @@ -157,15 +159,13 @@ public: GDIMetaFile( const GDIMetaFile& rMtf ); virtual ~GDIMetaFile(); - using List::operator==; - using List::operator!=; GDIMetaFile& operator=( const GDIMetaFile& rMtf ); - sal_Bool operator==( const GDIMetaFile& rMtf ) const; - sal_Bool operator!=( const GDIMetaFile& rMtf ) const { return !( *this == rMtf ); } + sal_Bool operator==( const GDIMetaFile& rMtf ) const; + sal_Bool operator!=( const GDIMetaFile& rMtf ) const { return !( *this == rMtf ); } void Clear(); sal_Bool IsEqual( const GDIMetaFile& rMtf ) const; - sal_Bool Mirror( sal_uLong nMirrorFlags ); + sal_Bool Mirror( sal_uLong nMirrorFlags ); void Move( long nX, long nY ); // additional Move method getting specifics how to handle MapMode( MAP_PIXEL ) void Move( long nX, long nY, long nDPIX, long nDPIY ); @@ -183,53 +183,59 @@ public: Rectangle GetBoundRect( OutputDevice& i_rReference ); void Adjust( short nLuminancePercent = 0, short nContrastPercent = 0, - short nChannelRPercent = 0, short nChannelGPercent = 0, - short nChannelBPercent = 0, double fGamma = 1.0, sal_Bool bInvert = sal_False ); + short nChannelRPercent = 0, short nChannelGPercent = 0, + short nChannelBPercent = 0, double fGamma = 1.0, + sal_Bool bInvert = sal_False + ); + void Convert( MtfConversion eConversion ); - void ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol = 0 ); + void ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol = 0 ); void ReplaceColors( const Color* pSearchColors, const Color* rReplaceColors, sal_uLong nColorCount, sal_uLong* pTols = NULL ); GDIMetaFile GetMonochromeMtf( const Color& rCol ) const; void Record( OutputDevice* pOutDev ); - sal_Bool IsRecord() const { return bRecord; } + sal_Bool IsRecord() const { return bRecord; } - void Play( GDIMetaFile& rMtf, sal_uLong nPos = GDI_METAFILE_END ); - void Play( OutputDevice* pOutDev, sal_uLong nPos = GDI_METAFILE_END ); + void Play( GDIMetaFile& rMtf, size_t nPos = GDI_METAFILE_END ); + void Play( OutputDevice* pOutDev, size_t nPos = GDI_METAFILE_END ); void Play( OutputDevice* pOutDev, const Point& rPos, - const Size& rSize, sal_uLong nPos = GDI_METAFILE_END ); + const Size& rSize, size_t nPos = GDI_METAFILE_END ); void Pause( sal_Bool bPause ); - sal_Bool IsPause() const { return bPause; } + sal_Bool IsPause() const { return bPause; } void Stop(); void WindStart(); void WindEnd(); - void Wind( sal_uLong nAction ); + void Wind( size_t nAction ); void WindPrev(); void WindNext(); - sal_uLong GetActionCount() const { return Count(); } + size_t GetActionSize() const; + size_t GetActionPos( const String& rLabel ); + void AddAction( MetaAction* pAction ); - void AddAction( MetaAction* pAction, sal_uLong nPos ); - void RemoveAction( sal_uLong nPos ); - MetaAction* CopyAction( sal_uLong nPos ) const; - MetaAction* GetCurAction() const { return (MetaAction*) GetCurObject(); } - MetaAction* GetAction( sal_uLong nAction ) const { return (MetaAction*) GetObject( nAction ); } - MetaAction* FirstAction() { return (MetaAction*) First(); } - MetaAction* NextAction() { return (MetaAction*) Next(); } - MetaAction* ReplaceAction( MetaAction* pAction, sal_uLong nAction ) { return (MetaAction*) Replace( pAction, nAction ); } - - sal_uLong GetActionPos( const String& rLabel ); - sal_Bool InsertLabel( const String& rLabel, sal_uLong nActionPos ); + void AddAction( MetaAction* pAction, size_t nPos ); + void RemoveAction( size_t nPos ); + void push_back( MetaAction* pAction ); + + MetaAction* FirstAction(); + MetaAction* NextAction(); + MetaAction* GetAction( size_t nAction ) const; + MetaAction* CopyAction( size_t nPos ) const; + MetaAction* GetCurAction() const { return GetAction( nCurrentActionElement ); } + MetaAction* ReplaceAction( MetaAction* pAction, size_t nAction ); + + sal_Bool InsertLabel( const String& rLabel, size_t nActionPos ); void RemoveLabel( const String& rLabel ); void RenameLabel( const String& rLabel, const String& rNewLabel ); - sal_uLong GetLabelCount() const; - String GetLabel( sal_uLong nLabel ); + size_t GetLabelCount() const; + String GetLabel( size_t nLabel ); - sal_Bool SaveStatus(); + sal_Bool SaveStatus(); const Size& GetPrefSize() const { return aPrefSize; } void SetPrefSize( const Size& rSize ) { aPrefSize = rSize; } @@ -240,8 +246,8 @@ public: void SetHookHdl( const Link& rLink ) { aHookHdlLink = rLink; } const Link& GetHookHdl() const { return aHookHdlLink; } - sal_uLong GetChecksum() const; - sal_uLong GetSizeBytes() const; + sal_uLong GetChecksum() const; + sal_uLong GetSizeBytes() const; // Methoden zum Lesen und Schreiben des neuen Formats; // die Read-Methode kann auch das alte Format lesen @@ -253,10 +259,10 @@ public: friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ); friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile ); - sal_Bool CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const; + sal_Bool CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const; - void UseCanvas( sal_Bool _bUseCanvas ); - sal_Bool GetUseCanvas() const { return bUseCanvas; } + void UseCanvas( sal_Bool _bUseCanvas ); + sal_Bool GetUseCanvas() const { return bUseCanvas; } }; /** Create a special metaaction that delegates rendering to specified diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx index 2712cefbb5d8..340311e9b55b 100644 --- a/vcl/inc/vcl/menu.hxx +++ b/vcl/inc/vcl/menu.hxx @@ -199,6 +199,10 @@ protected: // return value is Max( rCheckHeight, rRadioHeight ) SAL_DLLPRIVATE long ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const; + // returns native submenu arrow size and spacing from right border + // return value is whether it's supported natively + SAL_DLLPRIVATE sal_Bool ImplGetNativeSubmenuArrowSize( Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const; + SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel ); SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); public: diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index d36411714575..7082c020c7a2 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -326,8 +326,8 @@ public: void getUnconstrainedValues( const PPDKey*, ::std::list< const PPDValue* >& rValues ); // for printer setup - void* getStreamableBuffer( sal_uLong& rBytes ) const; - void rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes ); + char* getStreamableBuffer( sal_uLong& rBytes ) const; + void rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ); // convenience int getRenderResolution() const; diff --git a/vcl/inc/vcl/ptrstyle.hxx b/vcl/inc/vcl/ptrstyle.hxx index 1f6b375e81b5..174e590955a4 100644 --- a/vcl/inc/vcl/ptrstyle.hxx +++ b/vcl/inc/vcl/ptrstyle.hxx @@ -126,17 +126,15 @@ typedef sal_uInt16 PointerStyle; #define POINTER_TEXT_VERTICAL ((PointerStyle)86) #define POINTER_PIVOT_DELETE ((PointerStyle)87) -// --> FME 2004-07-30 #i32329# Enhanced table selection +// #i32329# #define POINTER_TAB_SELECT_S ((PointerStyle)88) #define POINTER_TAB_SELECT_E ((PointerStyle)89) #define POINTER_TAB_SELECT_SE ((PointerStyle)90) #define POINTER_TAB_SELECT_W ((PointerStyle)91) #define POINTER_TAB_SELECT_SW ((PointerStyle)92) -// <-- -// --> FME 2004-08-16 #i20119# Paintbrush tool +// #i20119# #define POINTER_PAINTBRUSH ((PointerStyle)93) -// <-- #define POINTER_COUNT 94 diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index 696a8660bb2f..af392854ee1d 100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -178,6 +178,7 @@ typedef sal_uInt32 ControlPart; #define PART_MENU_ITEM_CHECK_MARK 251 #define PART_MENU_ITEM_RADIO_MARK 252 #define PART_MENU_SEPARATOR 253 +#define PART_MENU_SUBMENU_ARROW 254 /* #i77549# HACK: for scrollbars in case of thumb rect, page up and page down rect we diff --git a/vcl/inc/vcl/scopedbitmapaccess.hxx b/vcl/inc/vcl/scopedbitmapaccess.hxx new file mode 100644 index 000000000000..4247324e4463 --- /dev/null +++ b/vcl/inc/vcl/scopedbitmapaccess.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef VCL_SCOPEDBITMAPACCESS_HXX_INCLUDED +#define VCL_SCOPEDBITMAPACCESS_HXX_INCLUDED + +namespace vcl +{ + +/** This template handles BitmapAccess the RAII way. + + Please don't use directly, but through the ready-made typedefs + ScopedReadAccess and ScopedWriteAccess in classes Bitmap and + AlphaMask. + + Use as follows: + Bitmap aBitmap; + Bitmap::ScopedReadAccess pReadAccess( aBitmap ); + pReadAccess->SetPixel()... + + Bitmap aBitmap2; + Bitmap::ScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 ); + if ( pWriteAccess )... + + @attention for practical reasons, ScopedBitmapAccess stores a + reference to the provided bitmap, thus, make sure that the bitmap + specified at construction time lives at least as long as the + ScopedBitmapAccess. + */ +template < class Access, class Bitmap, Access* (Bitmap::* Acquire)() > class ScopedBitmapAccess +{ + typedef ScopedBitmapAccess< Access, Bitmap, Acquire > self_type; + typedef bool (self_type::* unspecified_bool_type)() const; + +public: + explicit ScopedBitmapAccess( Bitmap& rBitmap ) : + mpAccess( 0 ), + mrBitmap( rBitmap ) + { + mpAccess = (mrBitmap.*Acquire)(); + } + + ScopedBitmapAccess( Access* pAccess, Bitmap& rBitmap ) : + mpAccess( pAccess ), + mrBitmap( rBitmap ) + { + } + + ~ScopedBitmapAccess() + { + mrBitmap.ReleaseAccess( mpAccess ); + } + + bool operator!() const { return !mpAccess; } + operator unspecified_bool_type() const + { + return mpAccess ? &self_type::operator! : 0; + } + + Access* get() { return mpAccess; } + const Access* get() const { return mpAccess; } + + Access* operator->() { return mpAccess; } + const Access* operator->() const { return mpAccess; } + + Access& operator*() { return *mpAccess; } + const Access& operator*() const { return *mpAccess; } + +private: + Access* mpAccess; + Bitmap& mrBitmap; +}; + +} + +#endif // VCL_SCOPEDBITMAPACCESS_HXX_INCLUDED + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index c35815506b98..0ade4c63f295 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -434,6 +434,7 @@ private: sal_uLong mnSymbolsStyle; sal_uLong mnPreferredSymbolsStyle; sal_uInt16 mnSkipDisabledInMenus; + sal_Bool mbHideDisabledMenuItems; sal_Bool mnAcceleratorsInContextMenus; Wallpaper maWorkspaceGradient; const void* mpFontOptions; @@ -456,7 +457,6 @@ private: #define STYLE_OPTION_SPINARROW ((sal_uLong)0x00000080) #define STYLE_OPTION_SPINUPDOWN ((sal_uLong)0x00000100) #define STYLE_OPTION_NOMNEMONICS ((sal_uLong)0x00000200) -#define STYLE_OPTION_HIDEDISABLED ((sal_uLong)0x00100000) #define DRAGFULL_OPTION_WINDOWMOVE ((sal_uLong)0x00000001) #define DRAGFULL_OPTION_WINDOWSIZE ((sal_uLong)0x00000002) @@ -527,6 +527,7 @@ public: Color GetSeparatorColor() const; void SetCheckedColor( const Color& rColor ) { CopyData(); mpData->maCheckedColor = rColor; } + void SetCheckedColorSpecialCase( ); const Color& GetCheckedColor() const { return mpData->maCheckedColor; } void SetLightColor( const Color& rColor ) @@ -736,6 +737,10 @@ public: { CopyData(); mpData->mnSkipDisabledInMenus = bSkipDisabledInMenus; } sal_Bool GetSkipDisabledInMenus() const { return (sal_Bool) mpData->mnSkipDisabledInMenus; } + void SetHideDisabledMenuItems( sal_Bool bHideDisabledMenuItems ) + { CopyData(); mpData->mbHideDisabledMenuItems = bHideDisabledMenuItems; } + sal_Bool GetHideDisabledMenuItems() const + { return mpData->mbHideDisabledMenuItems; } void SetAcceleratorsInContextMenus( sal_Bool bAcceleratorsInContextMenus ) { CopyData(); mpData->mnAcceleratorsInContextMenus = bAcceleratorsInContextMenus; } sal_Bool GetAcceleratorsInContextMenus() const diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx index 199f0ad67cac..cab614841e1d 100644 --- a/vcl/inc/vcl/sysdata.hxx +++ b/vcl/inc/vcl/sysdata.hxx @@ -41,7 +41,7 @@ typedef struct CGLayer *CGLayerRef; class NSView; #endif #endif -#if defined( WNT ) || defined( OS2 ) +#if defined( WNT ) #include <windef.h> #endif @@ -52,7 +52,7 @@ class NSView; struct SystemEnvData { unsigned long nSize; // size in bytes of this structure -#if defined( WNT ) || defined( OS2 ) +#if defined( WNT ) HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object @@ -80,7 +80,7 @@ struct SystemEnvData struct SystemParentData { unsigned long nSize; // size in bytes of this structure -#if defined( WNT ) || defined( OS2 ) +#if defined( WNT ) HWND hWnd; // the window hwnd #elif defined( QUARTZ ) NSView* pView; // the cocoa (NSView *) implementing this object diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index ccd7c229346b..a0842420f5a0 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -261,7 +261,7 @@ private: SAL_DLLPRIVATE void ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn ); SAL_DLLPRIVATE void ImplDrawNext( sal_Bool bIn ); SAL_DLLPRIVATE void ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect ); - SAL_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight = sal_False, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False ); + SAL_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight = 0, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False ); using Window::ImplInvalidate; SAL_DLLPRIVATE void ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False ); SAL_DLLPRIVATE void ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF ); diff --git a/vcl/inc/vcl/vclenum.hxx b/vcl/inc/vcl/vclenum.hxx index 80b84b2fb0f2..a833d0594f07 100644 --- a/vcl/inc/vcl/vclenum.hxx +++ b/vcl/inc/vcl/vclenum.hxx @@ -31,6 +31,7 @@ #include <sal/types.h> #include <tools/solar.h> +#include <tools/fontenum.hxx> #ifndef ENUM_TIMEFIELDFORMAT_DECLARED #define ENUM_TIMEFIELDFORMAT_DECLARED @@ -144,143 +145,6 @@ enum RasterOp { ROP_OVERPAINT, ROP_XOR, ROP_0, ROP_1, ROP_INVERT }; // ------------------------------------------------------------ -#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 kompability -#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 #ifndef ENUM_FONTAUTOHINT_DECLARED #define ENUM_FONTAUTOHINT_DECLARED diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index c7347f7cd978..51c5591f09f7 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -154,10 +154,9 @@ namespace com { namespace sun { namespace star { #define VCLEVENT_ROADMAP_ITEMSELECTED 1171 #define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout #define VCLEVENT_COMBOBOX_SETTEXT 1173 -// --> OD 2009-04-01 #i92103# +// #i92103# #define VCLEVENT_ITEM_EXPANDED 1174 #define VCLEVENT_ITEM_COLLAPSED 1175 -// <-- #define VCLEVENT_DROPDOWN_PRE_OPEN 1176 // VclMenuEvent diff --git a/vcl/os2/howto.txt b/vcl/os2/howto.txt deleted file mode 100644 index 8711e8ea3b09..000000000000 --- a/vcl/os2/howto.txt +++ /dev/null @@ -1,13 +0,0 @@ - -VCL positioning - -Window coordinates are parent relative, with exception of maState fields, they -have screen coordinates. - -Every window has a parent window, usually the client area of an existing window, -otherwise the desktop window. - -When a window is to be sized/moved, SetPosSize is called. -Since coordinates are the position/size of client area, we need to calculate -current window frame size/position and map to screen coordinates using the -owner window position as offset. diff --git a/vcl/os2/inc/salbmp.h b/vcl/os2/inc/salbmp.h deleted file mode 100644 index 50ba652c051b..000000000000 --- a/vcl/os2/inc/salbmp.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALBMP_H -#define _SV_SALBMP_H - -#include <tools/gen.hxx> -#include <vcl/sv.h> -#include <vcl/salbmp.hxx> - -// -------------- -// - SalBitmap - -// -------------- - -struct BitmapBuffer; -class BitmapColor; -class BitmapPalette; -class SalGraphics; - -#define HANDLE ULONG -#define HBITMAP ULONG - -class Os2SalBitmap : public SalBitmap -{ -private: - - Size maSize; - HANDLE mhDIB; - HANDLE mhDIB1Subst; - HBITMAP mhDDB; - USHORT mnBitCount; - -public: - - HANDLE ImplGethDIB() const { return mhDIB; } - HBITMAP ImplGethDDB() const { return mhDDB; } - HANDLE ImplGethDIB1Subst() const { return mhDIB1Subst; } - - void ImplReplacehDIB1Subst( HANDLE hDIB1Subst ); - - static HANDLE ImplCreateDIB( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - static HANDLE ImplCreateDIB4FromDIB1( HANDLE hDIB1 ); - static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB ); - static USHORT ImplGetDIBColorCount( HANDLE hDIB ); - static void ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, - const Size& rSizePixel, BOOL bRLE4 ); - - //BOOL Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle ); - -public: - - Os2SalBitmap(); - ~Os2SalBitmap(); - -public: - - //BOOL Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - //BOOL Create( const SalBitmap& rSalBmpImpl ); - //BOOL Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); - //BOOL Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount ); - - //void Destroy(); - - //Size GetSize() const { return maSize; } - //USHORT GetBitCount() const { return mnBitCount; } - - //BitmapBuffer* AcquireBuffer( bool bReadOnly ); - //void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); - bool Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ); - virtual bool Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); - virtual bool Create( const SalBitmap& rSalBmpImpl ); - virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); - virtual bool Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount ); - - virtual void Destroy(); - - virtual Size GetSize() const { return maSize; } - virtual USHORT GetBitCount() const { return mnBitCount; } - - virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); - virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); - virtual bool GetSystemData( BitmapSystemData& rData ); -}; - -#endif // _SV_SALBMP_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/saldata.hxx b/vcl/os2/inc/saldata.hxx deleted file mode 100644 index 2b2e3f03da7c..000000000000 --- a/vcl/os2/inc/saldata.hxx +++ /dev/null @@ -1,310 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALDATA_HXX -#define _SV_SALDATA_HXX - -#include <vcl/sv.h> -#include <vcl/svdata.hxx> -#include <vcl/salwtype.hxx> - -class Os2SalInstance; -class Os2SalFrame; -class Os2SalObject; - -extern "C" int debug_printf(const char *f, ...); - -// -------------- -// - SalIMEData - -// -------------- - -// YD FIXME #define ENABLE_IME - -#ifdef ENABLE_IME - -struct SalIMEData; - -#ifdef OS2IM_INCLUDED - -typedef APIRET (APIENTRY ImAssociateInstanceFunc)( HWND hwnd, HIMI himi, PHIMI phimiPrev ); -typedef APIRET (APIENTRY ImGetInstanceFunc)( HWND hwnd, PHIMI phimi ); -typedef APIRET (APIENTRY ImReleaseInstanceFunc)( HWND hwnd, HIMI himi ); -typedef APIRET (APIENTRY ImSetConversionFontFunc)( HIMI himi, PFATTRS pFontAttrs ); -typedef APIRET (APIENTRY ImSetConversionFontSizeFunc)( HIMI himi, PSIZEF psizfxBox ); -typedef APIRET (APIENTRY ImGetConversionStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen ); -typedef APIRET (APIENTRY ImGetResultStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen ); -typedef APIRET (APIENTRY ImSetCandidateWindowPosFunc)( HIMI himi, PCANDIDATEPOS pCandidatePos ); -typedef APIRET (APIENTRY ImQueryIMEPropertyFunc)( HIMI himi, ULONG ulIndex, PULONG pulProp ); -typedef APIRET (APIENTRY ImRequestIMEFunc)( HIMI himi, ULONG ulAction, ULONG ulIndex, ULONG ulValue ); -typedef APIRET (APIENTRY ImSetIMModeFunc)( HIMI himi, ULONG ulInputMode, ULONG ulConversionMode ); -typedef APIRET (APIENTRY ImQueryIMModeFunc)( HIMI himi, PULONG pulInputMode, PULONG pulConversionMode ); - -struct SalIMEData -{ - HMODULE mhModIME; - ImAssociateInstanceFunc* mpAssocIME; - ImGetInstanceFunc* mpGetIME; - ImReleaseInstanceFunc* mpReleaseIME; - ImSetConversionFontFunc* mpSetConversionFont; - ImSetConversionFontSizeFunc* mpSetConversionFontSize; - ImGetConversionStringFunc* mpGetConversionString; - ImGetResultStringFunc* mpGetResultString; - ImSetCandidateWindowPosFunc* mpSetCandidateWin; - ImQueryIMEPropertyFunc* mpQueryIMEProperty; - ImRequestIMEFunc* mpRequestIME; - ImSetIMModeFunc* mpSetIMEMode; - ImQueryIMModeFunc* mpQueryIMEMode; -}; - -#endif - -#endif - -// -------------------- -// - Icon cache - -// -------------------- - -struct SalIcon -{ - int nId; - HPOINTER hIcon; - SalIcon *pNext; -}; - -// ----------- -// - SalData - -// ----------- - -struct SalData -{ - HAB mhAB; // anchor block handle - HMQ mhMQ; // handle of os2 message queue - int mnArgc; // commandline param count - char** mpArgv; // commandline - ULONG mnNewTimerMS; // Neue Zeit, mit dem der Timer gestartet werden soll - ULONG mnTimerMS; // Current Time (in MS) of the Timer - ULONG mnTimerOrgMS; // Current Original Time (in MS) - ULONG mnNextTimerTime; - ULONG mnLastEventTime; - ULONG mnTimerId; // os2 timer id - BOOL mbInTimerProc; // timer event is currently being dispatched - //SALTIMERPROC mpTimerProc; // timer callback proc - HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message - AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test - Os2SalInstance* mpFirstInstance; // pointer of first instance - Os2SalFrame* mpFirstFrame; // pointer of first frame - Os2SalFrame* mpCreateFrame; // Create-Frame for WM_CREATE - Os2SalObject* mpFirstObject; // pointer of first object window - ULONG mnAppThreadId; // Id from Applikation-Thread - ULONG mnFontMetricCount; // number of entries in the font list - PFONTMETRICS mpFontMetrics; // cached font list - BOOL mbObjClassInit; // Ist SALOBJECTCLASS initialised -#ifdef ENABLE_IME - SalIMEData* mpIMEData; // SalIME-Data - BOOL mbIMEInit; // SalIME-Data-Init -#endif - - SalIcon* mpFirstIcon; // icon cache, points to first icon, NULL if none - -}; - -inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } -inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; } -inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; } - -// -------------- -// - SalShlData - -// -------------- - -#define OS2_VER_211 211 -#define OS2_VER_WARP3 230 -#define OS2_VER_WARP4 240 - -struct SalShlData -{ - HMODULE mhMod; // Module handle of SAL-DLL - USHORT mnVersion; // 211 = OS2 2.11; 230 = OS2 3.0; 240 = OS2 4.0 - PFNWP mpFrameProc; // old frame proc -}; - -extern SalShlData aSalShlData; - -BOOL SalImplHandleProcessMenu( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); - -// -------------------------------------------- -// - SALSHL.CXX - for accessing DLL resources - -// -------------------------------------------- - -HPOINTER ImplLoadSalCursor( int nId ); -HBITMAP ImplLoadSalBitmap( int nId ); -BOOL ImplLoadSalIcon( int nId, HPOINTER& rIcon); - -// SALGDI.CXX -void ImplInitSalGDI(); -void ImplFreeSalGDI(); - -// -------------- -// - Prototypes - -// -------------- - -// \\OS2\SOURCE\APP\SALINST.CXX -void ImplSalYieldMutexAcquireWithWait(); -ULONG ImplSalReleaseYieldMutex(); -void ImplSalAcquireYieldMutex( ULONG nCount ); -ULONG GetCurrentThreadId(); -BOOL ImplSalYieldMutexTryToAcquire(); -void ImplSalYieldMutexAcquire(); -void ImplSalYieldMutexRelease(); - -// \\OS2\SOURCE\WINDOW\SALFRAME.CXX -MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); -MRESULT EXPENTRY SalFrameFrameProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); -// \SV\WIN\SOURCE\APP\SALTIMER.CXX -#define SALTIMERPROC_RECURSIVE 0xffffffff -void SalTimerProc( HWND hWnd, UINT nMsg, UINT nId, ULONG nTime ); - -// \WIN\SOURCE\WINDOW\SALFRAME.CXX -void SalTestMouseLeave(); - -// \\OS2\SOURCE\WINDOW\SALFRAME.CXX -// return Frame for Message-Handling -Os2SalFrame* GetSalDefaultFrame(); - -// \\OS2\SOURCE\WINDOW\SALFRAME.CXX -// IME-Daten wieder freigeben -#ifdef ENABLE_IME -void ImplReleaseSALIMEData(); -#endif - -// ----------- -// - Defines - -// ----------- - -#define SAL_PROFILE_APPNAME ((PSZ)"StarOffice") -#define SAL_PROFILE_USEDJP ((PSZ)"UseDJP") -#define SAL_PROFILE_PRINTDJP ((PSZ)"PrintDJP") -#define SAL_PROFILE_PRINTRAW ((PSZ)"PrintRAW") - -#define SAL_FRAME_WNDEXTRA sizeof(ULONG) -#define SAL_FRAME_THIS 0 -#define SAL_FRAME_CLASSNAME "SALFRAME" -#define SAL_SUBFRAME_CLASSNAME "SALSUBFRAME" -#define SAL_OBJECT_WNDEXTRA sizeof(ULONG) -#define SAL_OBJECT_THIS 0 -#define SAL_OBJECT_CLASSNAME "SALOBJECT" -#define SAL_OBJECT_CHILDCLASSNAME "SALOBJECTCHILD" -#define SAL_OBJECT_CLIPCLASSNAME "SALOBJECTCLIP" -#define SAL_COM_CLASSNAME "SALCOMWND" - -#define SAL_MOUSELEAVE_TIMEOUT 300 - -// MP1 == 0; MP2 == pData -#define SAL_MSG_USEREVENT (WM_USER+111) -// MP1 == 0; MP2 == MousePosition relativ to upper left of screen -#define SAL_MSG_MOUSELEAVE (WM_USER+112) -// MP1 == hDC; MP2 == 0 -#define SAL_MSG_PRINTABORTJOB (WM_USER+113) -// MP1 == 0; MP2 == 0 -#define SAL_MSG_STARTTIMER (WM_USER+114) -// MP1 == nFrameStyle; MP2 == pParent; lResult pFrame -#define SAL_MSG_CREATEFRAME (WM_USER+115) -// MP1 == 0; MP2 == pParent; lResult pObject -#define SAL_MSG_CREATEOBJECT (WM_USER+116) -// MP1 == bWait; MP2 == pMutex -#define SAL_MSG_THREADYIELD (WM_USER+117) -// MP1 == 0; MP2 == 0 -#define SAL_MSG_RELEASEWAITYIELD (WM_USER+118) -// MP1 == 0; MP2 == pData -#define SAL_MSG_SYSPROCESSMENU (WM_USER+119) -// POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0) -#define SAL_MSG_POSTFOCUS (WM_USER+120) -// POSTSIZE-Message; MP1 == nMP1; MP2 == nMP2 -#define SAL_MSG_POSTSIZE (WM_USER+121) - -// wParam == wParam; lParam == lParam -#define SAL_MSG_POSTMOVE (WM_USER+136) -// wParam == pRECT; lParam == 0 -#define SAL_MSG_POSTPAINT (WM_USER+137) -// wParam == nFlags; lParam == 0 -#define SAL_MSG_TOTOP (WM_USER+142) -// wParam == bVisible; lParam == 0 -#define SAL_MSG_SHOW (WM_USER+143) - -// SysChild-ToTop; nMP1 = 0; nMP2 = 0 -#define SALOBJ_MSG_TOTOP (WM_USER+150) -// POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0) -#define SALOBJ_MSG_POSTFOCUS (WM_USER+151) - -// wParam == 0; lParam == 0 -#define SAL_MSG_DESTROYFRAME (WM_USER+160) -// wParam == 0; lParam == pObject; -#define SAL_MSG_DESTROYOBJECT (WM_USER+161) -// wParam == 0; lParam == this; lResult == bRet -#define SAL_MSG_CREATESOUND (WM_USER+162) -// wParam == 0; lParam == this -#define SAL_MSG_DESTROYSOUND (WM_USER+163) -// wParam == hWnd; lParam == 0; lResult == hDC -#define SAL_MSG_GETDC (WM_USER+164) -// wParam == hWnd; lParam == 0 -#define SAL_MSG_RELEASEDC (WM_USER+165) -// wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd -#define SAL_MSG_RECREATEHWND (WM_USER+166) -// wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd -#define SAL_MSG_RECREATECHILDHWND (WM_USER+167) -// wParam == 0; lParam == HWND; -#define SAL_MSG_DESTROYHWND (WM_USER+168) -// POSTTIMER-Message; wparam = 0, lParam == time -#define SAL_MSG_POSTTIMER (WM_USER+169) - -// ----------------- -// - Helpfunctions - -// ----------------- - -inline void SetWindowPtr( HWND hWnd, SalFrame* pThis ) -{ - WinSetWindowULong( hWnd, SAL_FRAME_THIS, (ULONG)pThis ); -} - -inline Os2SalFrame* GetWindowPtr( HWND hWnd ) -{ - return (Os2SalFrame*)WinQueryWindowULong( hWnd, SAL_FRAME_THIS ); -} - -inline void SetSalObjWindowPtr( HWND hWnd, SalObject* pThis ) -{ - WinSetWindowULong( hWnd, SAL_OBJECT_THIS, (ULONG)pThis ); -} - -inline Os2SalObject* GetSalObjWindowPtr( HWND hWnd ) -{ - return (Os2SalObject*)WinQueryWindowULong( hWnd, SAL_OBJECT_THIS ); -} - -#endif // _SV_SALDATA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salframe.h b/vcl/os2/inc/salframe.h deleted file mode 100644 index cd3d910a7d30..000000000000 --- a/vcl/os2/inc/salframe.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALFRAME_H -#define _SV_SALFRAME_H - -#include <vcl/sv.h> -#include <vcl/sysdata.hxx> -#include <vcl/salframe.hxx> - - -#ifndef PM_BIDI_INCLUDED -#include <pmbidi.h> -#endif - -#ifndef __UCONV_H__ -#include <uconv.h> -#endif - -#ifndef __UNIDEF_H__ -#include <unidef.h> -#endif - -#ifndef __UNIKBD_H__ -#include <unikbd.h> -#endif - -//class SalFrame; -class Os2SalGraphics; - -// ---------------- -// - SalFrameData - -// ---------------- - -//class SalFrameData -class Os2SalFrame : public SalFrame -{ -public: - HWND mhWndFrame; // HWND-Frame - HWND mhWndClient; // HWND-Client - HAB mhAB; // HAB - HPOINTER mhPointer; // Current MousePointer - void* mpInst; // VCL-Instance - //SALFRAMEPROC mpProc; // VCL-Proc - Os2SalGraphics* mpGraphics; // current frame graphics - Os2SalFrame* mpNextFrame; // pointer to next frame - SystemEnvData maSysData; // system data - SalFrameState maState; // frame state - int mnShowState; // show state - ULONG mnStyle; // SalFrameStyle - long mnWidth; // Window-Witdth - long mnHeight; // Window-Height - SWP maFullScreenRect; // WindowRect befor FullScreenMode - BOOL mbGraphics; // is Graphics used - BOOL mbAllwayOnTop; // Allways on top modus - BOOL mbVisible; // Visible Show/Hide-Status - BOOL mbMinHide; // hide called from OS2 - BOOL mbHandleIME; // TRUE: Wir handeln die IME-Messages - BOOL mbConversionMode; // TRUE: Wir befinden uns im Conversion-Modus - BOOL mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus - BOOL mbCaption; // has window a caption - BOOL mbBorder; // has window a border - BOOL mbFixBorder; // has window a fixed border - BOOL mbSizeBorder; // has window a sizeable border - BOOL mbNoIcon; // is an window without an icon - BOOL mbFloatWin; // is a FloatingWindow - BOOL mbFullScreen; // TRUE: in full screen mode - BOOL mbPresentation; // TRUE: Presentation Mode running - BOOL mbInShow; // innerhalb eines Show-Aufrufs - BOOL mbRestoreMaximize; // Restore-Maximize - BOOL mbInMoveMsg; // Move-Message wird verarbeitet - BOOL mbInSizeMsg; // Size-Message wird verarbeitet - BOOL mbFullScreenToolWin; // WS_EX_TOOLWINDOW reset in FullScreenMode - BOOL mbDefPos; // default-position - BOOL mbOverwriteState; // TRUE: WindowState darf umgesetzt werden - - int mnMinWidth; // min. client width in pixeln - int mnMinHeight; // min. client height in pixeln - int mnMaxWidth; // max. client width in pixeln - int mnMaxHeight; // max. client height in pixeln - static ULONG mnInputLang; // current Input Language - KHAND mnKeyboardHandle; // current unicode keyboard - static BOOL mbInReparent; // TRUE: ignore focus lost and gain due to reparenting - -private: - Os2SalFrame* mpParentFrame; // parent frame pointer - -public: - Os2SalFrame(); - virtual ~Os2SalFrame(); - - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL PostEvent( void* pData ); - virtual void SetTitle( const XubString& rTitle ); - virtual void SetIcon( USHORT nIcon ); - virtual void SetMenu( SalMenu* pSalMenu ); - virtual void DrawMenuBar(); - virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ); - virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); - virtual void Enable( BOOL bEnable ); - virtual void SetMinClientSize( long nWidth, long nHeight ); - virtual void SetMaxClientSize( long nWidth, long nHeight ); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); - virtual void GetClientSize( long& rWidth, long& rHeight ); - virtual void GetWorkArea( RECTL& rRect ); - virtual void GetWorkArea( Rectangle& rRect ); - virtual SalFrame* GetParent() const; - virtual void SetWindowState( const SalFrameState* pState ); - virtual BOOL GetWindowState( SalFrameState* pState ); - virtual void ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ); - virtual void StartPresentation( BOOL bStart ); - virtual void SetAlwaysOnTop( BOOL bOnTop ); - virtual void ToTop( USHORT nFlags ); - virtual void SetPointer( PointerStyle ePointerStyle ); - virtual void CaptureMouse( BOOL bMouse ); - virtual void SetPointerPos( long nX, long nY ); - virtual void Flush(); - virtual void Sync(); - virtual void SetInputContext( SalInputContext* pContext ); - virtual void EndExtTextInput( USHORT nFlags ); - virtual String GetKeyName( USHORT nKeyCode ); - virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ); - virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); - virtual LanguageType GetInputLanguage(); - virtual SalBitmap* SnapShot(); - virtual void UpdateSettings( AllSettings& rSettings ); - virtual void Beep( SoundType eSoundType ); - virtual const SystemEnvData* GetSystemData() const; - virtual SalPointerState GetPointerState(); - virtual SalIndicatorState GetIndicatorState(); - virtual void SimulateKeyPress( USHORT nKeyCode ); - virtual void SetParent( SalFrame* pNewParent ); - virtual bool SetPluginParent( SystemParentData* pNewParent ); - virtual void SetBackgroundBitmap( SalBitmap* ); - virtual void SetScreenNumber( unsigned int ); - virtual void SetApplicationID( const rtl::OUString &rApplicationID ); - virtual void ResetClipRegion(); - virtual void BeginSetClipRegion( ULONG nRects ); - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual void EndSetClipRegion(); - -}; - -#endif // _SV_SALFRAME_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h deleted file mode 100644 index 3c72695bc2f2..000000000000 --- a/vcl/os2/inc/salgdi.h +++ /dev/null @@ -1,355 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALGDI_H -#define _SV_SALGDI_H - -#include <vcl/sv.h> -#include <vcl/sallayout.hxx> -#include <vcl/salgdi.hxx> -#include <vcl/outfont.hxx> -#include <vcl/impfont.hxx> - -#include <boost/unordered_set.hpp> - -class ImplOs2FontEntry; - -// ----------- -// - Defines - -// ----------- - -// win32 platform specific options. Move them to the PMK file? -#define GCP_USEKERNING 0x0008 -#define USE_UNISCRIBE -#define GCP_KERN_HACK -#define GNG_VERT_HACK - -// os2 specific physically available font face -class ImplOs2FontData : public ImplFontData -{ -public: - ImplOs2FontData( PFONTMETRICS, - int nFontHeight, - BYTE nPitchAndFamily ); - ~ImplOs2FontData(); - - virtual ImplFontData* Clone() const; - virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; - virtual sal_IntPtr GetFontId() const; - void SetFontId( sal_IntPtr nId ) { mnId = nId; } - void UpdateFromHPS( HPS ) const; - - bool HasChar( sal_uInt32 cChar ) const; - - PFONTMETRICS GetFontMetrics() const { return pFontMetric; } - USHORT GetCharSet() const { return meOs2CharSet; } - BYTE GetPitchAndFamily() const { return mnPitchAndFamily; } - bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; } - bool SupportsKorean() const { return mbHasKoreanRange; } - bool SupportsCJK() const { return mbHasCJKSupport; } - bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } - bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } - - const ImplFontCharMap* GetImplFontCharMap() const; - -private: - sal_IntPtr mnId; - mutable bool mbDisableGlyphApi; - mutable bool mbHasKoreanRange; - mutable bool mbHasCJKSupport; - - mutable const ImplFontCharMap* mpUnicodeMap; - - // TODO: get rid of the members below needed to work with the Win9x non-unicode API - BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) - BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried - USHORT meOs2CharSet; - BYTE mnPitchAndFamily; - bool mbAliasSymbolsHigh; - bool mbAliasSymbolsLow; - PFONTMETRICS pFontMetric; - -private: - void ReadCmapTable( HDC ) const; - void ReadOs2Table( HDC ) const; - -#ifdef GNG_VERT_HACK - void ReadGsubTable( HDC ) const; - - typedef boost::unordered_set<int> IntHashSet; - mutable IntHashSet maGsubTable; - mutable bool mbGsubRead; -public: - bool HasGSUBstitutions( HDC ) const; - bool IsGSUBstituted( sal_Unicode ) const; -#endif // GNG_VERT_HACK - -}; - - -// ------------------- -// - SalGraphicsData - -// ------------------- - -class Os2SalGraphics : public SalGraphics -{ -public: - HPS mhPS; // HPS - HDC mhDC; // HDC - HWND mhWnd; // HWND - LONG mnHeight; // Height of frame Window - ULONG mnClipElementCount; // number of clip rects in clip rect array - RECTL* mpClipRectlAry; // clip rect array - ULONG mnFontMetricCount; // number of entries in the font list - PFONTMETRICS mpFontMetrics; // cached font list - LONG mnOrientationX; // X-Font orientation - LONG mnOrientationY; // Y-Font orientation - BOOL mbLine; // draw lines - BOOL mbFill; // fill areas - BOOL mbPrinter; // is Printer - BOOL mbVirDev; // is VirDev - BOOL mbWindow; // is Window - BOOL mbScreen; // is Screen compatible - bool mbXORMode; // _every_ output with RasterOp XOR - ULONG mhFonts[ MAX_FALLBACK ]; // Font + Fallbacks - const ImplOs2FontData* mpOs2FontData[ MAX_FALLBACK ]; // pointer to the most recent font face - ImplOs2FontEntry* mpOs2FontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance - ULONG mhDefFont; // DefaultFont - float mfFontScale; // allows metrics emulation of huge font sizes - BOOL mbFontKernInit; // FALSE: FontKerns must be queried - KERNINGPAIRS* mpFontKernPairs; // Kerning Pairs of the current Font - ULONG mnFontKernPairCount;// Number of Kerning Pairs of the current Font - - USHORT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, int ); - -public: - Os2SalGraphics(); - virtual ~Os2SalGraphics(); - -protected: - // draw --> LineColor and FillColor and RasterOp and ClipRegion - virtual void drawPixel( long nX, long nY ); - virtual void drawPixel( long nX, long nY, SalColor nSalColor ); - virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); - virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); - virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); - virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); - virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); - virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); - virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); - - // CopyArea --> No RasterOp, but ClipRegion - virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, - long nSrcHeight, USHORT nFlags ); - - // CopyBits and DrawBitmap --> RasterOp and ClipRegion - // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics - virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ); - virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ); - virtual void drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nTransparentColor ); - virtual void drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap ); - virtual void drawMask( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nMaskColor ); - - virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); - virtual SalColor getPixel( long nX, long nY ); - - // invert --> ClipRegion (only Windows or VirDevs) - virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags); - virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ); - - virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); - - virtual bool drawAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSourceBitmap, - const SalBitmap& rAlphaBitmap ); - virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ); - -public: - // public SalGraphics methods, the interface to teh independent vcl part - - // get device resolution - virtual void GetResolution( long& rDPIX, long& rDPIY ); - // get the depth of the device - virtual USHORT GetBitCount() const; - // get the width of the device - virtual long GetGraphicsWidth() const; - - // set the clip region to empty - virtual void ResetClipRegion(); - virtual bool setClipRegion( const Region& ); - - // set the line color to transparent (= don't draw lines) - virtual void SetLineColor(); - // set the line color to a specific color - virtual void SetLineColor( SalColor nSalColor ); - // set the fill color to transparent (= don't fill) - virtual void SetFillColor(); - // set the fill color to a specific color, shapes will be - // filled accordingly - virtual void SetFillColor( SalColor nSalColor ); - // enable/disable XOR drawing - virtual void SetXORMode( bool bSet, bool ); - // set line color for raster operations - virtual void SetROPLineColor( SalROPColor nROPColor ); - // set fill color for raster operations - virtual void SetROPFillColor( SalROPColor nROPColor ); - // set the text color to a specific color - virtual void SetTextColor( SalColor nSalColor ); - // set the font - virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ); - // get the current font's etrics - virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); - // get kernign pairs of the current font - // return only PairCount if (pKernPairs == NULL) - virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ); - // get the repertoire of the current font - virtual ImplFontCharMap* GetImplFontCharMap() const; - // graphics must fill supplied font list - virtual void GetDevFontList( ImplDevFontList* ); - // graphics should call ImplAddDevFontSubstitute on supplied - // OutputDevice for all its device specific preferred font substitutions - virtual void GetDevFontSubstList( OutputDevice* ); - virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); - // CreateFontSubset: a method to get a subset of glyhps of a font - // inside a new valid font file - // returns TRUE if creation of subset was successfull - // parameters: rToFile: contains a osl file URL to write the subset to - // pFont: describes from which font to create a subset - // pGlyphIDs: the glyph ids to be extracted - // pEncoding: the character code corresponding to each glyph - // pWidths: the advance widths of the correspoding glyphs (in PS font units) - // nGlyphs: the number of glyphs - // rInfo: additional outgoing information - // implementation note: encoding 0 with glyph id 0 should be added implicitly - // as "undefined character" - virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, - const ImplFontData* pFont, - long* pGlyphIDs, - sal_uInt8* pEncoding, - sal_Int32* pWidths, - int nGlyphs, - FontSubsetInfo& rInfo // out parameter - ); - - // GetFontEncodingVector: a method to get the encoding map Unicode - // to font encoded character; this is only used for type1 fonts and - // may return NULL in case of unknown encoding vector - // if ppNonEncoded is set and non encoded characters (that is type1 - // glyphs with only a name) exist it is set to the corresponding - // map for non encoded glyphs; the encoding vector contains -1 - // as encoding for these cases - virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded ); - - // GetEmbedFontData: gets the font data for a font marked - // embeddable by GetDevFontList or NULL in case of error - // parameters: pFont: describes the font in question - // pWidths: the widths of all glyphs from char code 0 to 255 - // pWidths MUST support at least 256 members; - // rInfo: additional outgoing information - // pDataLen: out parameter, contains the byte length of the returned buffer - virtual const void* GetEmbedFontData( const ImplFontData*, - const sal_Ucs* pUnicodes, - sal_Int32* pWidths, - FontSubsetInfo& rInfo, - long* pDataLen ); - // frees the font data again - virtual void FreeEmbedFontData( const void* pData, long nDataLen ); - - virtual void GetGlyphWidths( const ImplFontData* pFont, - bool bVertical, - Int32Vector& rWidths, - Ucs2UIntMap& rUnicodeEnc ); - - virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); - virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); - - virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); - virtual void DrawServerFontLayout( const ServerFontLayout& ); - virtual bool supportsOperation( OutDevSupportType ) const; - - // Query the platform layer for control support - virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - - virtual SystemGraphicsData GetGraphicsData() const; - virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; -}; - -// Init/Deinit Graphics -void ImplSalInitGraphics( Os2SalGraphics* mpData ); -void ImplSalDeInitGraphics( Os2SalGraphics* mpData ); - -// ----------- -// - Defines - -// ----------- - -#define RGBCOLOR(r,g,b) ((ULONG)(((BYTE)(b)|((USHORT)(g)<<8))|(((ULONG)(BYTE)(r))<<16))) -#define TY( y ) (mnHeight-(y)-1) - -// offset for lcid field, used for fallback font selection -#define LCID_BASE 100 - -// ----------- -// - Inlines - -// ----------- - -// #102411# Win's GCP mishandles kerning => we need to do it ourselves -// SalGraphicsData::mpFontKernPairs is sorted by -inline bool ImplCmpKernData( const KERNINGPAIRS& a, const KERNINGPAIRS& b ) -{ - if( a.sFirstChar < b.sFirstChar ) - return true; - if( a.sFirstChar > b.sFirstChar ) - return false; - return (a.sSecondChar < b.sSecondChar); -} - -// called extremely often from just one spot => inline -inline bool ImplOs2FontData::HasChar( sal_uInt32 cChar ) const -{ - if( mpUnicodeMap->HasChar( cChar ) ) - return true; - // second chance to allow symbol aliasing - if( mbAliasSymbolsLow && ((cChar-0xF000) <= 0xFF) ) - cChar -= 0xF000; - else if( mbAliasSymbolsHigh && (cChar <= 0xFF) ) - cChar += 0xF000; - return mpUnicodeMap->HasChar( cChar ); -} - -#endif // _SV_SALGDI_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salids.hrc b/vcl/os2/inc/salids.hrc deleted file mode 100644 index b5f2260d307f..000000000000 --- a/vcl/os2/inc/salids.hrc +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALIDS_HRC -#define _SV_SALIDS_HRC - -// Pointer -#define SAL_RESID_POINTER_NULL 10000 -#define SAL_RESID_POINTER_HELP 10001 -#define SAL_RESID_POINTER_CROSS 10002 -#define SAL_RESID_POINTER_MOVE 10003 -#define SAL_RESID_POINTER_HSPLIT 10004 -#define SAL_RESID_POINTER_VSPLIT 10005 -#define SAL_RESID_POINTER_HSIZEBAR 10006 -#define SAL_RESID_POINTER_VSIZEBAR 10007 -#define SAL_RESID_POINTER_HAND 10008 -#define SAL_RESID_POINTER_REFHAND 10009 -#define SAL_RESID_POINTER_PEN 10010 -#define SAL_RESID_POINTER_MAGNIFY 10011 -#define SAL_RESID_POINTER_FILL 10012 -#define SAL_RESID_POINTER_ROTATE 10013 -#define SAL_RESID_POINTER_HSHEAR 10014 -#define SAL_RESID_POINTER_VSHEAR 10015 -#define SAL_RESID_POINTER_MIRROR 10016 -#define SAL_RESID_POINTER_CROOK 10017 -#define SAL_RESID_POINTER_CROP 10018 -#define SAL_RESID_POINTER_MOVEPOINT 10019 -#define SAL_RESID_POINTER_MOVEBEZIERWEIGHT 10020 -#define SAL_RESID_POINTER_MOVEDATA 10021 -#define SAL_RESID_POINTER_COPYDATA 10022 -#define SAL_RESID_POINTER_LINKDATA 10023 -#define SAL_RESID_POINTER_MOVEDATALINK 10024 -#define SAL_RESID_POINTER_COPYDATALINK 10025 -#define SAL_RESID_POINTER_MOVEFILE 10026 -#define SAL_RESID_POINTER_COPYFILE 10027 -#define SAL_RESID_POINTER_LINKFILE 10028 -#define SAL_RESID_POINTER_MOVEFILELINK 10029 -#define SAL_RESID_POINTER_COPYFILELINK 10030 -#define SAL_RESID_POINTER_MOVEFILES 10031 -#define SAL_RESID_POINTER_COPYFILES 10032 -#define SAL_RESID_POINTER_DRAW_LINE 10033 -#define SAL_RESID_POINTER_DRAW_RECT 10034 -#define SAL_RESID_POINTER_DRAW_POLYGON 10035 -#define SAL_RESID_POINTER_DRAW_BEZIER 10036 -#define SAL_RESID_POINTER_DRAW_ARC 10037 -#define SAL_RESID_POINTER_DRAW_PIE 10038 -#define SAL_RESID_POINTER_DRAW_CIRCLECUT 10039 -#define SAL_RESID_POINTER_DRAW_ELLIPSE 10040 -#define SAL_RESID_POINTER_DRAW_FREEHAND 10041 -#define SAL_RESID_POINTER_DRAW_CONNECT 10042 -#define SAL_RESID_POINTER_DRAW_TEXT 10043 -#define SAL_RESID_POINTER_DRAW_CAPTION 10044 -#define SAL_RESID_POINTER_CHART 10045 -#define SAL_RESID_POINTER_DETECTIVE 10046 -#define SAL_RESID_POINTER_PIVOT_COL 10047 -#define SAL_RESID_POINTER_PIVOT_ROW 10048 -#define SAL_RESID_POINTER_PIVOT_FIELD 10049 -#define SAL_RESID_POINTER_CHAIN 10050 -#define SAL_RESID_POINTER_CHAIN_NOTALLOWED 10051 -#define SAL_RESID_POINTER_TIMEEVENT_MOVE 10052 -#define SAL_RESID_POINTER_TIMEEVENT_SIZE 10053 -#define SAL_RESID_POINTER_AUTOSCROLL_N 10054 -#define SAL_RESID_POINTER_AUTOSCROLL_S 10055 -#define SAL_RESID_POINTER_AUTOSCROLL_W 10056 -#define SAL_RESID_POINTER_AUTOSCROLL_E 10057 -#define SAL_RESID_POINTER_AUTOSCROLL_NW 10058 -#define SAL_RESID_POINTER_AUTOSCROLL_NE 10059 -#define SAL_RESID_POINTER_AUTOSCROLL_SW 10060 -#define SAL_RESID_POINTER_AUTOSCROLL_SE 10061 -#define SAL_RESID_POINTER_AUTOSCROLL_NS 10062 -#define SAL_RESID_POINTER_AUTOSCROLL_WE 10063 -#define SAL_RESID_POINTER_AUTOSCROLL_NSWE 10064 -#define SAL_RESID_POINTER_AIRBRUSH 10070 -#define SAL_RESID_POINTER_TEXT_VERTICAL 10071 -#define SAL_RESID_POINTER_PIVOT_DELETE 10072 -#define SAL_RESID_POINTER_TAB_SELECT_S 10073 -#define SAL_RESID_POINTER_TAB_SELECT_E 10074 -#define SAL_RESID_POINTER_TAB_SELECT_SE 10075 -#define SAL_RESID_POINTER_TAB_SELECT_W 10076 -#define SAL_RESID_POINTER_TAB_SELECT_SW 10077 -#define SAL_RESID_POINTER_PAINTBRUSH 10078 - -#define SAL_RESID_ICON_DEFAULT 1 - -#endif // _SV_SALIDS_HRC diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h deleted file mode 100644 index 4d98b803dfba..000000000000 --- a/vcl/os2/inc/salinst.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALINST_H -#define _SV_SALINST_H - -#include <vcl/sv.h> -#include <vcl/salinst.hxx> -#include <vcl/solarmutex.hxx> - -// ------------------- -// - SalInstanceData - -// ------------------- - -class SalYieldMutex; - -#define SAL_COMMANDLINENOINIT ((USHORT)0xFFFF) -#define SAL_MAXPARAM 40 - -class Os2SalInstance : public SalInstance -{ -public: - HAB mhAB; // anchor block handle - HMQ mhMQ; // handle of os2 message queue - HPOINTER mhAppIcon; // app icon - int mnArgc; // commandline param count - char** mpArgv; // commandline - HWND mhComWnd; // window, for communication (between threads and the main thread) - SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex - osl::Mutex* mpSalWaitMutex; // Sal-Wait-Mutex - USHORT mnYieldWaitCount; // Wait-Count - -public: - Os2SalInstance(); - virtual ~Os2SalInstance(); - - virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ); - virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ); - virtual void DestroyFrame( SalFrame* pFrame ); - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ); - virtual void DestroyObject( SalObject* pObject ); - virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, - long nDX, long nDY, - USHORT nBitCount, const SystemGraphicsData *pData ); - virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ); - - virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pSetupData ); - virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ); - virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ); - virtual void DestroyPrinter( SalPrinter* pPrinter ); - virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ); - virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ); - virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ); - virtual String GetDefaultPrinter(); - virtual SalTimer* CreateSalTimer(); - virtual SalI18NImeStatus* CreateI18NImeStatus(); - virtual SalSystem* CreateSalSystem(); - virtual SalBitmap* CreateSalBitmap(); - virtual osl::SolarMutex* GetYieldMutex(); - virtual ULONG ReleaseYieldMutex(); - virtual void AcquireYieldMutex( ULONG nCount ); - virtual bool CheckYieldMutex(); - virtual void Yield( bool, bool ); - virtual bool AnyInput( USHORT nType ); - virtual SalSession* CreateSalSession(); - virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); - virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); -}; - -SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ); -SalObject* ImplSalCreateObject( Os2SalInstance* pInst, Os2SalFrame* pParent ); -void ImplSalStartTimer( ULONG nMS, BOOL bMutex = FALSE ); - -#endif // _SV_SALINST_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/sallang.hxx b/vcl/os2/inc/sallang.hxx deleted file mode 100644 index f9122cf2b3a4..000000000000 --- a/vcl/os2/inc/sallang.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SALLANG_HXX -#define _SALLANG_HXX - -#include <i18npool/mslangid.hxx> - -// -------------------- -// - Language Strings - -// -------------------- - -// --- Key-Namen --- -#define LSTR_KEY_SHIFT 0 -#define LSTR_KEY_CTRL 1 -#define LSTR_KEY_ALT 2 -#define LSTR_KEY_UP 3 -#define LSTR_KEY_DOWN 4 -#define LSTR_KEY_LEFT 5 -#define LSTR_KEY_RIGHT 6 -#define LSTR_KEY_HOME 7 -#define LSTR_KEY_END 8 -#define LSTR_KEY_PAGEUP 9 -#define LSTR_KEY_PAGEDOWN 10 -#define LSTR_KEY_RETURN 11 -#define LSTR_KEY_ESC 12 -#define LSTR_KEY_TAB 13 -#define LSTR_KEY_BACKSPACE 14 -#define LSTR_KEY_SPACE 15 -#define LSTR_KEY_INSERT 16 -#define LSTR_KEY_DELETE 17 - -// --- Anzahl der Texte --- - -#define LSTR_COUNT 18 - -// -------------------------------------------- -// - Methoden zum Abfragen der Sprach-Strings - -// -------------------------------------------- - -const sal_Unicode** ImplGetLangTab( LanguageType eLang ); - -#endif // _SALLANG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/sallayout.h b/vcl/os2/inc/sallayout.h deleted file mode 100644 index d08c36420405..000000000000 --- a/vcl/os2/inc/sallayout.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALLAYOUT_H -#define _SV_SALLAYOUT_H - -#endif // _SV_SALLAYOUT_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salmenu.h b/vcl/os2/inc/salmenu.h deleted file mode 100644 index 8c46b638f063..000000000000 --- a/vcl/os2/inc/salmenu.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALMENU_H -#define _SV_SALMENU_H - -#include <vcl/sv.h> -#include <vcl/bitmap.hxx> -#include <vcl/salmenu.hxx> - - -class Os2SalMenu : public SalMenu -{ -public: - Os2SalMenu() {} - virtual ~Os2SalMenu(); - - virtual BOOL VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars - // otherwise only menu messages are processed (eg, OLE on Windows) - - virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ); - virtual void RemoveItem( unsigned nPos ); - virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ); - virtual void SetFrame( const SalFrame* pFrame ); - virtual void CheckItem( unsigned nPos, BOOL bCheck ); - virtual void EnableItem( unsigned nPos, BOOL bEnable ); - virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ); - virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage); - virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ); - virtual void GetSystemMenuData( SystemMenuData* pData ); -}; - -class Os2SalMenuItem : public SalMenuItem -{ -public: - Os2SalMenuItem() {} - virtual ~Os2SalMenuItem(); -}; - -#endif // _SV_SALMENU_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salobj.h b/vcl/os2/inc/salobj.h deleted file mode 100644 index 467c4537dc2a..000000000000 --- a/vcl/os2/inc/salobj.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALOBJ_H -#define _SV_SALOBJ_H - -#include <vcl/sv.h> -#include <vcl/salobj.hxx> - -// ----------------- -// - SalObjectData - -// ----------------- - -class Os2SalObject : public SalObject -{ -public: - HWND mhWnd; // Window handle - HWND mhWndChild; // Child Window handle - HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte - SystemChildData maSysData; // SystemEnvData - HWND mhLastClipWnd; // LastClip-Window - HWND mhOldLastClipWnd; // LastClip-Window befor BeginSetClipRegion - long mnHeight; // Fenster-Hoehe fuer Positionsumrechnung - Os2SalObject* mpNextObject; // pointer to next object - void* mpInst; // instance handle for callback - SALOBJECTPROC mpProc; // callback proc - - Os2SalObject(); - virtual ~Os2SalObject(); - - virtual void ResetClipRegion(); - virtual USHORT GetClipRegionType(); - virtual void BeginSetClipRegion( ULONG nRects ); - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); - virtual void EndSetClipRegion(); - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ); - virtual void Show( BOOL bVisible ); - virtual void Enable( BOOL nEnable ); - virtual void GrabFocus(); - virtual void SetBackground(); - virtual void SetBackground( SalColor nSalColor ); - virtual const SystemEnvData* GetSystemData() const; - virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); -}; - -#endif // _SV_SALOBJ_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salprn.h b/vcl/os2/inc/salprn.h deleted file mode 100644 index 1bcd47465aab..000000000000 --- a/vcl/os2/inc/salprn.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALPRN_H -#define _SV_SALPRN_H - -#include <vcl/sv.h> -#include <vcl/salprn.hxx> - -class SalGraphics; -class SalInfoPrinter; - -struct ImplFormInfo; -typedef ImplFormInfo* PIMPLFORMINFO; -struct ImplTrayInfo; -typedef ImplTrayInfo* PIMPLTRAYINFO; - -// ---------------------- -// - SalInfoPrinterData - -// ---------------------- - -//class SalInfoPrinterData -class Os2SalInfoPrinter : public SalInfoPrinter -{ -public: - Os2SalGraphics* mpGraphics; // Graphics - HDC mhDC; // printer hdc - HPS mhPS; // printer hps - ByteString maPrinterName; // pszPrinters - ByteString maName; // pszName bzw. LogAdress - ByteString maDriverName; // pszDriverName nach . - ByteString maDeviceName; // pszDriverName bis . - ByteString maJobSetupDeviceName; // DeviceName aus pDriverData - PIMPLFORMINFO* mpFormArray; // PaperForm-Names - USHORT mnFormCount; // PaperForm-Count - PIMPLTRAYINFO* mpTrayArray; // PaperTray-Names - USHORT mnTrayCount; // PaperTray-Count - BOOL mbDJPSupported; // is driver DJP enabled - BOOL mbGraphics; // is Graphics used - -public: - Os2SalInfoPrinter(); - virtual ~Os2SalInfoPrinter(); - - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ); - virtual BOOL SetPrinterData( ImplJobSetup* pSetupData ); - virtual BOOL SetData( ULONG nFlags, ImplJobSetup* pSetupData ); - virtual void GetPageInfo( const ImplJobSetup* pSetupData, - long& rOutWidth, long& rOutHeight, - long& rPageOffX, long& rPageOffY, - long& rPageWidth, long& rPageHeight ); - virtual ULONG GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ); - virtual ULONG GetPaperBinCount( const ImplJobSetup* pSetupData ); - virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); - virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); - virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); -}; - -// ------------------ -// - SalPrinterData - -// ------------------ - -class SalPrinterData00 -{ -public: - Os2SalGraphics* mpGraphics; // current Printer graphics - SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter - HDC mhDC; // printer hdc - HPS mhPS; // printer hps - ULONG mnError; // Error Code - BOOL mbFirstPage; // IsFirstPage - BOOL mbAbort; // JobAborted - BOOL mbPrintDJPSupported; // is driver PrintDJP enabled (DEVESC_NEWFRAME_WPROP) - char maCommentBuf[33]; // Comment - char maCopyBuf[10]; // Kopien -}; - -// ----------------- -// - Os2SalPrinter - -// ----------------- - -class Os2SalPrinter : public SalPrinter -{ -public: - Os2SalGraphics* mpGraphics; // current Printer graphics - Os2SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter - Os2SalPrinter* mpNextPrinter; // next printing printer - HDC mhDC; // printer hdc - HPS mhPS; // printer hps - ULONG mnError; // Error Code - BOOL mbFirstPage; // IsFirstPage - BOOL mbAbort; // JobAborted - BOOL mbPrintDJPSupported; // is driver PrintDJP enabled (DEVESC_NEWFRAME_WPROP) - char maCommentBuf[33]; // Comment - char maCopyBuf[16]; // Kopien - //HDC mhDC; // printer hdc - //ULONG mnError; // Error Code - //ULONG mnCopies; // Kopien - //BOOL mbCollate; // Sortierte Kopien - //BOOL mbAbort; // Job Aborted - -public: - Os2SalPrinter(); - virtual ~Os2SalPrinter(); - - virtual BOOL StartJob( const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - ULONG nCopies, - bool bCollate, - bool bDirect, - ImplJobSetup* pSetupData ); - virtual BOOL EndJob(); - virtual BOOL AbortJob(); - virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ); - virtual BOOL EndPage(); - virtual ULONG GetErrorCode(); -}; - -#endif // _SV_SALPRN_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salsound.h b/vcl/os2/inc/salsound.h deleted file mode 100644 index 2445bbe3c1a0..000000000000 --- a/vcl/os2/inc/salsound.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALSOUND_H -#define _SV_SALSOUND_H - -#include <tools/gen.hxx> -#include <sv.h> -#include <tools/string.hxx> -#include <vcl/salframe.hxx> -#ifndef _SV_SALSTYPE_HXX -#include <vcl/salstype.hxx> -#endif -#include <vcl/salsound.hxx> - -// ------------ -// - SalSound - -// ------------ - -//class SalSound -class Os2SalSound : public SalSound -{ -private: - - static HMODULE mhMCILib; - static ULONG mnSoundState; - static void* mpMCIFnc; - SALSOUNDPROC mpProc; - void* mpInst; - ULONG mnStartTime; - ULONG mnPlayLen; - HWND mhSoundWnd; - USHORT mnDeviceId; - BOOL mbLoop; - BOOL mbPaused; - -public: - - void ImplSetError( ULONG nMciErr ); - void ImplNotify( SoundNotification eNotification, ULONG nError ); - -public: - - BOOL Create(); - //static BOOL IsValid() { return( SOUND_STATE_VALID == Os2SalSound::mnSoundState ); } - //BOOL Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen ); - //BOOL Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ); - - void SetNotifyProc( void* pInst, SALSOUNDPROC pProc ) - { mpInst = pInst; mpProc = pProc; } -public: - Os2SalSound(); - virtual ~Os2SalSound(); - - virtual bool IsValid(); - virtual bool Init( const String& rSoundName, ULONG& rSoundLen ); - virtual void Play( ULONG nStartTime, ULONG nPlayTime, bool bLoop ); - virtual void Stop(); - virtual void Pause(); - virtual void Continue(); - virtual bool IsLoopMode() const; - virtual bool IsPlaying() const; - virtual bool IsPaused() const; - - bool ImplCreate(); - void ImplDestroy(); - static void Release(); -}; - -#endif // _SV_SALSOUND_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salsound.hxx b/vcl/os2/inc/salsound.hxx deleted file mode 100644 index e46e3e666a2c..000000000000 --- a/vcl/os2/inc/salsound.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALSOUND_HXX -#define _SV_SALSOUND_HXX - -#include <tools/gen.hxx> -#include <sv.h> -#include <tools/string.hxx> -#include <salframe.hxx> -#include <salstype.hxx> -#include <salsound.hxx> - -// ------------ -// - SalSound - -// ------------ - -class SalSound -{ -private: - - static HMODULE mhMCILib; - static ULONG mnSoundState; - static void* mpMCIFnc; - SALSOUNDPROC mpProc; - void* mpInst; - ULONG mnStartTime; - ULONG mnPlayLen; - HWND mhSoundWnd; - USHORT mnDeviceId; - BOOL mbLoop; - BOOL mbPaused; - -public: - - void ImplSetError( ULONG nMciErr ); - void ImplNotify( SoundNotification eNotification, ULONG nError ); - -public: - - SalSound(); - ~SalSound(); - - BOOL Create(); - static void Release(); - static BOOL IsValid() { return( SOUND_STATE_VALID == SalSound::mnSoundState ); } - - BOOL Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen ); - BOOL Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ); - void Play( ULONG nStartTime, ULONG nPlayTime, BOOL bLoop ); - void Stop(); - void Pause(); - - void SetNotifyProc( void* pInst, SALSOUNDPROC pProc ) - { mpInst = pInst; mpProc = pProc; } -}; - -#endif // _SV_SALSOUND_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salsys.h b/vcl/os2/inc/salsys.h deleted file mode 100644 index 24472a4c43d4..000000000000 --- a/vcl/os2/inc/salsys.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALSYS_H -#define _SV_SALSYS_H - -#include <vcl/salsys.hxx> -#include <vcl/sv.h> - -class SalFrame; - -// ----------------- -// - SalSystemData - -// ----------------- - -class SalSystemData -{ -}; - -#endif // _SV_SALSYS_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/saltimer.h b/vcl/os2/inc/saltimer.h deleted file mode 100644 index de150fcfb10c..000000000000 --- a/vcl/os2/inc/saltimer.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALTIMER_H -#define _SV_SALTIMER_H - -#include <vcl/saltimer.hxx> - -class Os2SalTimer : public SalTimer -{ -public: - Os2SalTimer() {} - virtual ~Os2SalTimer(); - - // overload all pure virtual methods - void Start( ULONG nMS ); - void Stop(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/salvd.h b/vcl/os2/inc/salvd.h deleted file mode 100644 index b5250c913c7e..000000000000 --- a/vcl/os2/inc/salvd.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALVD_H -#define _SV_SALVD_H - -#include <vcl/sv.h> -#include <vcl/salvd.hxx> - -class Os2SalGraphics; - -// ----------------- -// - SalVirDevData - -// ----------------- - -//class SalVirDevData -class Os2SalVirtualDevice : public SalVirtualDevice -{ -public: - HPS mhPS; // HPS - HDC mhDC; // HDC - HBITMAP mhBmp; // Memory Bitmap - HBITMAP mhDefBmp; // Default Bitmap - Os2SalGraphics* mpGraphics; // current VirDev graphics - USHORT mnBitCount; // BitCount (0 or 1) - BOOL mbGraphics; // is Graphics used - - Os2SalVirtualDevice(); - virtual ~Os2SalVirtualDevice(); - - virtual SalGraphics* GetGraphics(); - virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual BOOL SetSize( long nNewDX, long nNewDY ); - virtual void GetSize( long& rWidth, long& rHeight ); -}; - -// Help-Functions -HBITMAP ImplCreateVirDevBitmap( HDC hDC, HPS hPS, long nDX, long nDY, - USHORT nBitCount ); - -#endif // _SV_SALVD_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/svsys.h b/vcl/os2/inc/svsys.h deleted file mode 100644 index 354f53fb6d3a..000000000000 --- a/vcl/os2/inc/svsys.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SVSYS_H -#define _SV_SVSYS_H - -#ifndef _SVPM_H -#include <svpm.h> -#endif - -#endif // _SV_SVSYS_H - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/wingdi.h b/vcl/os2/inc/wingdi.h deleted file mode 100644 index c6cf93964df7..000000000000 --- a/vcl/os2/inc/wingdi.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#ifndef _WINGDI_ -#define _WINGDI_ - -typedef struct tagPOINT -{ - LONG x; - LONG y; -} POINT, *PPOINT, *LPPOINT; - - -typedef unsigned long DWORD; -typedef unsigned short WORD; -typedef struct -{ - WORD fract; - SHORT value; -} W32FIXED; - -typedef struct tagPOINTFX -{ - W32FIXED x; - W32FIXED y; -} POINTFX, *LPPOINTFX; - -typedef struct tagTTPOLYCURVE -{ - WORD wType; - WORD cpfx; - POINTFX apfx[1]; -} TTPOLYCURVE, *LPTTPOLYCURVE; - -typedef struct tagTTPOLYGONHEADER -{ - DWORD cb; - DWORD dwType; - POINTFX pfxStart; -} TTPOLYGONHEADER, *LPTTPOLYGONHEADER; - -typedef struct -{ - UINT gmBlackBoxX; - UINT gmBlackBoxY; - POINT gmptGlyphOrigin; - SHORT gmCellIncX; - SHORT gmCellIncY; -} GLYPHMETRICS, *LPGLYPHMETRICS; - -#define GGO_METRICS 0 -#define GGO_BITMAP 1 -#define GGO_NATIVE 2 -#define GGO_BEZIER 3 -#define GGO_GRAY2_BITMAP 4 -#define GGO_GRAY4_BITMAP 5 -#define GGO_GRAY8_BITMAP 6 -#define GGO_GLYPH_INDEX 0x80 - -#define TT_PRIM_LINE 1 -#define TT_PRIM_QSPLINE 2 -#define TT_PRIM_CSPLINE 3 -#define TT_POLYGON_TYPE 24 - -typedef struct -{ - W32FIXED eM11; - W32FIXED eM12; - W32FIXED eM21; - W32FIXED eM22; -} MAT2, *LPMAT2; - -#endif // _WINGDI_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/inc/xwphook.h b/vcl/os2/inc/xwphook.h deleted file mode 100644 index 3bbd849b2d9f..000000000000 --- a/vcl/os2/inc/xwphook.h +++ /dev/null @@ -1,622 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * xwphook.h: - * header for both xwphook.c and xwpdaemon.c. This is also - * included from a number of sources for XFLDR.DLL which need - * to interface (configure) the daemon. - */ - -/* - * Copyright (C) 1999-2002 Ulrich Mller. - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, in version 2 as it comes in the COPYING - * file of the XWorkplace main distribution. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef XWPHOOK_HEADER_INCLUDED - #define XWPHOOK_HEADER_INCLUDED - - /* ****************************************************************** - * - * OS2.INI applications and keys - * - ********************************************************************/ - - #define INIAPP_XWPHOOK "XWorkplace:Hook" // added V0.9.0 - #define INIKEY_HOOK_HOTKEYS "Hotkeys" // added V0.9.0 - #define INIKEY_HOOK_CONFIG "Config" // added V0.9.0 - #define INIKEY_HOOK_PAGERCONFIG "PagerConfig" // V0.9.2 (2000-02-25) [umoeller] - // changed V0.9.19 (2002-05-07) [umoeller] - #define INIKEY_HOOK_PAGERWINPOS "PagerWinPos" - // changed V0.9.19 (2002-05-07) [umoeller] - #define INIKEY_HOOK_FUNCTIONKEYS "FuncKeys" // added V0.9.3 (2000-04-19) [umoeller] - #define INIKEY_HOOK_MOUSEMAPPINGS "MouseMappings" // added V0.9.19 (2002-04-20) [lafaix] - - /* ****************************************************************** - * - * Structures - * - ********************************************************************/ - - // do not change the following, or this will break - // binary compatibility of the XPager OS2.INI data - #define MAX_STICKIES 64 - #define STICKYLEN 50 - -#ifndef __NOPAGER__ - - // flags for PAGERCONFIG.aulStickyFlags - #define SF_CONTAINS 0x00000000L // default - #define SF_BEGINSWITH 0x00000001L - #define SF_ENDSWITH 0x00000002L - #define SF_EQUALS 0x00000004L - #define SF_MATCHES 0x00000008L // V0.9.19 (2002-04-17) [umoeller] - #define SF_OPERATOR_MASK 0x0000FFFFL - - #define SF_INCLUDE 0x00000000L // default - #define SF_EXCLUDE 0x00010000L - #define SF_CRITERIA_MASK 0x00010000L - - #define SF_TITLE 0x00000000L // default - #define SF_ATTRIBUTE_MASK 0xFFFE0000L - - #pragma pack(1) - - /* - *@@ PAGERCONFIG: - * XPager configuration data. - * This is stored within the HOOKDATA structure - * (statically in the hook DLL) so that both - * the daemon and the hook have access to this. - * - *@@added V0.9.2 (2000-02-25) [umoeller] - */ - - typedef struct _PAGERCONFIG - { - BYTE cDesktopsX, - cDesktopsY, - // no. of virtual Desktops (x and y) - bStartX, - bStartY; - // initial desktop at startup - - ULONG flPager; - // flags for "XPager" settings page 1 - #define PGRFL_WRAPAROUND 0x0001 - #define PGRFL_HOTKEYS 0x0002 - #define PGRFL_NOFOLLOWFOCUS 0x0004 - - #define PGRMASK_PAGE1 (PGRFL_WRAPAROUND | PGRFL_HOTKEYS) - #define PGRFL_PAGE1_DEFAULTS 0 - - // flags for "XPager" settings page 2 - #define PGRFL_PRESERVEPROPS 0x0010 - // preserve proportions of XPager win when resizing? - #define PGRFL_STAYONTOP 0x0020 - // stay on top? - #define PGRFL_FLASHTOTOP 0x0040 - #define PGRFL_MINIWINDOWS 0x0080 - // show mini windows in XPager? - #define PGRFL_MINIWIN_TITLES 0x0100 - // show mini window titles? - #define PGRFL_MINIWIN_MOUSE 0x0200 - // allow activate/lower by mouse clicks? - #define PGRFL_INCLUDESECONDARY 0x0400 - #define PGRFL_INCLUDESTICKY 0x0800 - #define PGRFL_MINIWIN_ICONS 0x1000 - // show mini window icons? - // V0.9.19 (2002-06-13) [umoeller] - - #define PGRMASK_PAGE2 ( PGRFL_PRESERVEPROPS \ - | PGRFL_STAYONTOP \ - | PGRFL_FLASHTOTOP \ - | PGRFL_MINIWINDOWS \ - | PGRFL_MINIWIN_TITLES \ - | PGRFL_MINIWIN_MOUSE \ - | PGRFL_INCLUDESECONDARY \ - | PGRFL_INCLUDESTICKY \ - | PGRFL_MINIWIN_ICONS ) - #define PGRFL_PAGE2_DEFAULTS ( PGRFL_PRESERVEPROPS \ - | PGRFL_MINIWINDOWS \ - | PGRFL_MINIWIN_TITLES \ - | PGRFL_MINIWIN_MOUSE) - - // flags for "XPager" settings page 3 - #define PGRFL_ADDSTICKYTOGGLE 0x2000 - // add "sticky" option to system menu? - // V1.0.0 (2002-09-14) [lafaix] - - #define PGRMASK_PAGE3 ( PGRFL_ADDSTICKYTOGGLE ) - #define PGRFL_PAGE3_DEFAULTS 0 - #define PGRFL_WINDOWS_KEYS 0x00010000 - // V1.0.3 (2004-10-14) [bird]: Use windows keys for left / right - - ULONG ulFlashDelay; - // "flash" delay in milliseconds, if PGRFL_FLASHTOTOP - ULONG flKeyShift; // KC_* values - - // paint settings - ULONG flPaintMode; // as in BKGNDINFO (gpih.h) - LONG lcolDesktop1, // as in BKGNDINFO (gpih.h) - lcolDesktop2; // as in BKGNDINFO (gpih.h) - - LONG lcolActiveDesktop; // color of hatching for active desktop - - LONG lcolGrid; // grid color (separators between desktops) - - LONG lcolInactiveWindow, - lcolActiveWindow, - lcolWindowFrame, - lcolInactiveText, - lcolActiveText; - - // sticky windows - ULONG cStickies; - ULONG aulStickyFlags[MAX_STICKIES]; // SF_* flags per sticky - CHAR aszStickies[MAX_STICKIES][STICKYLEN]; - - } PAGERCONFIG, *PPAGERCONFIG; - - #pragma pack() - -#endif - - // flags for HOOKCONFIG.usScrollMode - #define SM_LINEWISE 0 - #define SM_AMPLIFIED 1 - - // flags for HOOKCONFIG.ulAutoHideFlags - #define AHF_IGNOREMENUS 0x00000001L - #define AHF_IGNOREBUTTONS 0x00000002L - - // flags for HOOKCONFIG.ulAutoMoveFlags - #define AMF_ALWAYSMOVE 0x00000001L - #define AMF_IGNORENOBUTTON 0x00000002L - #define AMF_ANIMATE 0x00000004L - - /* - *@@ HOOKCONFIG: - * configuration data for the hook and the daemon. - * - * This is stored within the HOOKDATA structure - * (statically in the hook DLL) so that both - * the daemon and the hook have access to this. - * - * A mirror of this structure is put into OS2.INI - * which gets loaded by the XWorkplace settings - * objects in XFLDR.DLL to configure the hook. - * This gets (re)loaded by the daemon when XFLDR.DLL - * posts XDM_HOOKCONFIG to fnwpDaemonObject. - * - * So this is seen by the hook and the daemon; - * XFLDR.DLL only writes this back to OS2.INI and - * notifies the daemon to reload this. - * - * For every item, the safe default value is null - * so the structure can be zeroed to disable - * everything. - * - * If settings are added to this structure, they - * must be added to the bottom in order not to - * break binary compatibility between XWP versions. - * - * Note that the object hotkey _definitions_ are - * not part of this structure. Those are set using - * XDM_HOTKEYSCHANGED instead. However, object - * hotkeys are globally enabled in here (fGlobalHotkeys). - */ -#pragma pack(4) - typedef struct _HOOKCONFIG - { - // Sliding focus: - - PM_BOOL __fSlidingFocus; - // enabled? - ULONG __ulSlidingFocusDelay; - // delay in ms; 0 = off - - PM_BOOL __fSlidingBring2Top; - // bring windows to top or preserve Z-order - PM_BOOL __fSlidingIgnoreDesktop; - // ignore Desktop windows - PM_BOOL __fSlidingIgnoreSeamless; - // TRUE: ignore seamless Win-OS/2 windows - // FALSE: always bring them to top - - // Screen corner objects: - HOBJECT ahobjDummy[4]; // was four screen corner objects; - // we extended the array to 8 items - // so the array had to be moved to the - // bottom in order not to break binary - // compatibility - - BYTE bMonitorDrives[30]; // array of 1-byte BOOLs; if any of these - // is "1", the corresponding drive letter - // will be monitored for media change - // (index 1 = A, index 2 = B, index 3 = C, ...). - // Index 0 is unused to match logical drive numbers. - - // More mouse mappings: V0.9.1 (99-12-03) - - PM_BOOL fChordWinList; // deprecated V0.9.19 (2002-04-20) [lafaix] - // show window list on mb1+2 chord - PM_BOOL fSysMenuMB2TitleBar; // deprecated V0.9.19 (2002-04-20) [lafaix] - // show system menu on mb2 title-bar click - - // Mouse-button-3 scrolling: V0.9.1 (99-12-03) - - PM_BOOL fMB3Scroll; // deprecated V0.9.19 (2002-04-20) [lafaix] - // scroll window contents on MB3Drag - PM_BOOL fMB3ScrollReverse; // deprecated V0.9.19 (2002-04-20) [lafaix] - // reverse scrolling - USHORT usScrollMode; // deprecated V0.9.19 (2002-04-20) [lafaix] - // one of the following: - // -- SM_LINEWISE (0): scroll fixed, line-wise - // -- SM_AMPLIFIED (1): scroll amplified, relative to window size - USHORT usMB3ScrollMin; - // minimum pixels that mouse must be moved; - // 0 means 1, 1 means 2, ... - SHORT sAmplification; - // amplification (-9 thru +10) - // the amplification in percent is calculated like this: - // percent = 100 + (sAmplification * 10) - // so we get: - // 0 --> 100% - // 2 --> 120% - // 10 --> 200% - // -2 --> 80% - // -9 --> 10% - - // Auto-hide mouse pointer: V0.9.1 (99-12-03) - PM_BOOL __fAutoHideMouse; - ULONG __ulAutoHideDelay; - // delay in seconds; 0 means 1 second, 2 means 3, ... - - // Global object hotkeys enabled: - // this can be disabled even if any hotkeys are defined - // because the hotkeys themselves are stored separately - // in shared memory - PM_BOOL __fGlobalHotkeys; - - // XPager configuration - PM_BOOL fRemoved1, // _fXPagerStayOnTop, - fRemoved2; //__fSlidingIgnoreXPager; - // removed V0.9.19 (2002-05-07) [umoeller] - - // Sliding menus - PM_BOOL fSlidingMenus; - // enabled? - ULONG ulSubmenuDelay; - // delay in ms; 0 = off - PM_BOOL fMenuImmediateHilite; - - // Mouse-button-3 single-clicks to MB1 double-clicks - // V0.9.4 (2000-06-12) [umoeller] - PM_BOOL fMB3Click2MB1DblClk; // deprecated V0.9.19 (2002-04-20) [lafaix] - - // Screen corner objects: - // moved the array down here (there's a dummy above) - // V0.9.4 (2000-06-12) [umoeller] - HOBJECT ahobjHotCornerObjects[8]; - // Indices: - // 0 = lower left corner, - // 1 = top left corner, - // 2 = lower right corner, - // 3 = top right corner; - // borders added V0.9.4 (2000-06-12) [umoeller]: - // 4 = top border, - // 5 = left border, - // 6 = right border, - // 7 = bottom border. - // V0.9.18 (2002-02-12) [pr] - #define SCREENCORNER_MIN 0 - #define SCREENCORNER_BOTTOMLEFT 0 - #define SCREENCORNER_TOPLEFT 1 - #define SCREENCORNER_BOTTOMRIGHT 2 - #define SCREENCORNER_TOPRIGHT 3 - #define SCREENCORNER_TOP 4 - #define SCREENCORNER_LEFT 5 - #define SCREENCORNER_RIGHT 6 - #define SCREENCORNER_BOTTOM 7 - #define SCREENCORNER_MAX 7 - // If any item is NULLHANDLE, it means the - // corner is inactive (no function defined). - // If the hiword of the item is 0xFFFF, this - // means a special function has been defined: - // (#define's added V0.9.19 (2002-04-17) [umoeller]): - #define SPECIALOBJ_FIRST 0xFFFF0000 - #define SPECIALOBJ_SHOWWINDOWLIST 0xFFFF0000 - #define SPECIALOBJ_DESKTOPCONTEXTMENU 0xFFFF0001 - #define SPECIALOBJ_PAGER_SHOW 0xFFFF0002 - // the following added (2001-01-26) [lafaix] - #define SPECIALOBJ_PAGER_UP 0xFFFF0003 - #define SPECIALOBJ_PAGER_RIGHT 0xFFFF0004 - #define SPECIALOBJ_PAGER_DOWN 0xFFFF0005 - #define SPECIALOBJ_PAGER_LEFT 0xFFFF0006 - // the following added V0.9.18 [pr] - #define SPECIALOBJ_SCREENWRAP 0xFFFF0007 - // Otherwise (> 0 and < 0xFFFF0000), we have - // a "real" object handle, and a regular WPS - // object is to be opened. - - // special treatment for conditional-cascade submenus when - // using sliding menus (V0.9.6 (2000-10-27) [umoeller]) - PM_BOOL fConditionalCascadeSensitive; - - // more XPager configuration V0.9.7 (2000-12-08) [umoeller] - PM_BOOL fRemoved3; // __fSlidingIgnoreXCenter; - // removed V0.9.19 (2002-05-07) [umoeller] - - // screen corner objects sensitivity; in percent of the - // adjacents borders. 0 = off, 50 = borders objects disabled - // V0.9.9 (2001-03-15) [lafaix] - ULONG ulCornerSensitivity; - - // Mouse-button-3 autoscroll and push to bottom features - PM_BOOL fMB3AutoScroll; // deprecated V0.9.19 (2002-04-20) [lafaix] - PM_BOOL fMB3Push2Bottom; // deprecated V0.9.19 (2002-04-20) [lafaix] - - // Auto hide and automatic pointer movement options - // V0.9.14 (2001-08-02) [lafaix] - ULONG __ulAutoHideFlags; - PM_BOOL __fAutoMoveMouse; - ULONG __ulAutoMoveFlags; - ULONG __ulAutoMoveDelay; // V0.9.14 (2001-08-21) [umoeller] - ULONG __ulMouseMappingsCount; // V0.9.19 (2002-04-20) [lafaix] - } HOOKCONFIG, *PHOOKCONFIG; -#pragma pack() - - /* - *@@ GLOBALHOTKEY: - * single XWorkplace object hotkey definition. - * Arrays of this are allocated in shared memory and - * used by xwphook.c, xwpdaemn.c, and also XFldObject - * for hotkey manipulation and detection. - */ - - typedef struct _GLOBALHOTKEY - { - USHORT usFlags; - // Keyboard control codes: - // SHORT1FROMMP(mp1) of WM_CHAR, filtered. - // Only the following flags will be set: - // -- KC_CTRL - // -- KC_ALT - // -- KC_SHIFT - // -- KC_VIRTUALKEY - // -- KC_INVALIDCOMP: special flag used if the - // scan code represents one of the user-defined - // function keys in the XWPKeyboard object. - // KC_CTRL, KC_ALT, KC_SHIFT work always, - // no matter if we're in a PM or VIO session. - // However, for some reason, KC_VIRTUALKEY is - // never set in VIO sessions. We still store it - // in this structure though to be able to display - // the hotkey in the configuration pages. - // The hook will filter that out since the scan - // code is good enough to identify the key. - UCHAR ucScanCode; - // Hardware scan code: - // CHAR4FROMMP(mp1) of WM_CHAR. - // As opposed to what we do with folder hotkeys, - // this must be stored also, because we must use - // the scan code for WM_CHAR processing in the hook - // to identify hotkeys. We cannot use usKeyCode - // because that's different in VIO sessions, while - // this one is always the same. - // Even if any of Ctrl, Alt, Shift are pressed, this - // has the scan code of the additional key which was - // pressed. - USHORT usKeyCode; - // key code: - // if KC_VIRTUALKEY is set in usFlags, this has usvk, - // otherwise usch from WM_CHAR. - // This is only used to be able to display the hotkey - // in the hotkey configuration dialogs; we do _not_ use - // this to check WM_CHAR messages in the hook, because - // this is different between PM and VIO sessions. - ULONG ulHandle; - // handle to post to thread-1 object window (kernel.c); - // this is normally the HOBJECT of the object to be - // opened. - } GLOBALHOTKEY, *PGLOBALHOTKEY; - - /* - *@@ MOUSEMAPPING: - * single XWorkplace mouse mapping definition. - * Arrays of this are allocated in shared memory and - * used by xwphook.c, xwpdaemn.c, and also XWPMouse - * for mouse mappings manipulation and detection. - * - *@@added V0.9.19 (2002-04-20) [lafaix] - */ - - typedef struct _MOUSEMAPPING - { - USHORT usEvent; - // One of the MME_* values (or MME_XBUTTON_FIRST+n - // to denote extra button n, 0 <= n < 32). - // standard mouse events - #define MME_BUTTON1CLICK 0x0001 - #define MME_BUTTON2CLICK 0x0002 - #define MME_BUTTON3CLICK 0x0003 - #define MME_BUTTON1DRAG 0x0004 - #define MME_BUTTON2DRAG 0x0005 - #define MME_BUTTON3DRAG 0x0006 - #define MME_CHORD 0x0007 - // wheel/stick events - #define MME_UP 0x1001 - #define MME_DOWN 0x1002 - #define MME_LEFT 0x1003 - #define MME_RIGHT 0x1004 - // the 2X and 3X variants are handy when mapping an action - // to a wheel/stick movement. They map at least 2 (or 3) - // consecutive events, and hence disambiguate an unexpected - // wheel/stick event. - #define MME_UP2X 0x2001 - #define MME_DOWN2X 0x2002 - #define MME_LEFT2X 0x2003 - #define MME_RIGHT2X 0x2004 - #define MME_UP3X 0x3001 - #define MME_DOWN3X 0x3002 - #define MME_LEFT3X 0x3003 - #define MME_RIGHT3X 0x3004 - // extra buttons - #define MME_XBUTTON_FIRST 0x4000 - // type helpers - #define MME_TYPE_MASK 0xF000 - #define MME_TYPE_STANDARD 0x0000 - #define MME_TYPE_WHEEL 0x1000 - #define MME_TYPE_WHEEL2X 0x2000 - #define MME_TYPE_WHEEL3X 0x3000 - #define MME_TYPE_XBUTTON 0x4000 - #define MME_TYPE_DISABLED 0x8000 - - USHORT usModifiers; - // A possibly empty combination of KC_SHIFT, KC_CTRL, - // and KC_ALT. - CHAR achLocation[32]; - // The class name upon which this mapping applies. - // An empty location (i.e., achLocation[0] = 0) means - // a global mapping. - CHAR achPluginName[8]; - // The plugin library providing the action defined for - // this mapping. An empty location (i.e., - // achPluginName[0] = 0) means a buildin action. - USHORT usAction; - // The action (relative to the plugin) defined for - // this event. - BYTE abSetup[16]; - // A private area possibly refining the action. - } MOUSEMAPPING, *PMOUSEMAPPING; - - /* - *@@ FUNCTIONKEY: - * XWorkplace function key description. - * An array of these is returned by - * hifQueryFunctionKeys(). - * - *@@added V0.9.3 (2000-04-19) [umoeller] - */ - - typedef struct _FUNCTIONKEY - { - UCHAR ucScanCode; // hardware scan code; - // CHAR4FROMMP(mp1) of WM_CHAR - CHAR szDescription[30]; // key description (e.g. "Win left") - PM_BOOL fModifier; // TRUE if the scan code represents - // a modifier key which can be pressed - // together with another key, similar - // to Ctrl or Alt or Del; this will - // allow us to do things like "WinLeft + C" - } FUNCTIONKEY, *PFUNCTIONKEY; - - /* ****************************************************************** - * - * Messages - * - ********************************************************************/ - - #define XDM_HOOKINSTALL (WM_USER + 400) - - #define XDM_DESKTOPREADY (WM_USER + 401) - - #define XDM_HOOKCONFIG (WM_USER + 402) - -#ifndef __NOPAGER__ - #define XDM_STARTSTOPPAGER (WM_USER + 403) - - #define XDM_PAGERCONFIG (WM_USER + 404) - // flags for XDM_PAGERCONFIG: - #define PGRCFG_REPAINT 0x0001 // invalidates mini windows - #define PGRCFG_REFORMAT 0x0004 // causes PGRM_POSITIONFRAME, - // repaints background too - #define PGRCFG_STICKIES 0x0008 // sticky windows have changed -#endif - - #define XDM_HOTKEYPRESSED (WM_USER + 405) - - #define XDM_HOTKEYSCHANGED (WM_USER + 406) - - #define XDM_FUNCTIONKEYSCHANGED (WM_USER + 407) - -#ifndef __NOSLIDINGFOCUS__ - #define XDM_SLIDINGFOCUS (WM_USER + 408) -#endif - - #define XDM_SLIDINGMENU (WM_USER + 409) - - #define XDM_HOTCORNER (WM_USER + 410) - - #define XDM_WMCHORDWINLIST (WM_USER + 411) - - // added V0.9.9 (2001-03-18) [lafaix] - #define XDM_BEGINSCROLL (WM_USER + 413) - #define XDM_SETPOINTER (WM_USER + 414) - #define XDM_ENDSCROLL (WM_USER + 415) - - // added V0.9.12 (2001-05-12) [umoeller] - #define XDM_RECOVERWINDOWS (WM_USER + 416) - - #define XDM_ADDDISKWATCH (WM_USER + 417) - - /* - *@@ ADDDISKWATCH: - * struct used with XDM_ADDDISKWATCH. - * - *@@added V0.9.14 (2001-08-01) [umoeller] - */ - - typedef struct _ADDDISKWATCH - { - ULONG ulLogicalDrive; // disk to be monitored - HWND hwndNotify; // window to be notified on change - ULONG ulMessage; // message to be posted to window - } ADDDISKWATCH, *PADDDISKWATCH; - - #define XDM_REMOVEDISKWATCH (WM_USER + 418) - - #define XDM_QUERYDISKS (WM_USER + 419) - - #define XDM_ADDCLICKWATCH (WM_USER + 420) - - #define XDM_MOUSECLICKED (WM_USER + 421) - -#ifndef __NOMOVEMENT2FEATURES__ - #define XDM_MOVEPTRTOBUTTON (WM_USER + 422) -#endif - - #define XDM_DISABLEHOTKEYSTEMP (WM_USER + 423) - - #define XDM_STARTAPP (WM_USER + 424) - - #define XDM_ADDWINLISTWATCH (WM_USER + 425) - - #define XDM_WINDOWCHANGE (WM_USER + 426) - - #define XDM_ICONCHANGE (WM_USER + 427) - - #define XDM_QUERYWINLIST (WM_USER + 428) - - #define XDM_REMOVEWINLISTWATCH (WM_USER + 429) // V0.9.19 (2002-06-14) [lafaix] - - #define XDM_REMOVECLICKWATCH (WM_USER + 430) // V0.9.19 (2002-06-14) [lafaix] - -#ifndef __NOPAGER__ - #define XDM_TOGGLETRANSIENTSTICKY (WM_USER + 431) // V1.0.0 (2002-07-26) [lafaix] - #define XDM_ISTRANSIENTSTICKY (WM_USER + 432) -#endif - - #define XDM_NLSCHANGED (WM_USER + 433) // V1.0.0 (2002-09-15) [lafaix] -#endif - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/app/makefile.mk b/vcl/os2/source/app/makefile.mk deleted file mode 100644 index 9f3bfd7e89d8..000000000000 --- a/vcl/os2/source/app/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=SV -TARGET=salapp - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -# --- Files -------------------------------------------------------- - -YD00_CXXFILES=\ - salshl.cxx \ - salinst.cxx \ - sallang.cxx \ - saltimer.cxx \ - salsys.cxx - -SLOFILES= $(SLO)$/salshl.obj \ - $(SLO)$/printf.obj \ - $(SLO)$/salinfo.obj \ - $(SLO)$/salinst.obj \ - $(SLO)$/sallang.obj \ - $(SLO)$/saltimer.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/app/printf.c b/vcl/os2/source/app/printf.c deleted file mode 100644 index 06e75b6b8446..000000000000 --- a/vcl/os2/source/app/printf.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ----------------------------------------------------------------- */ -/* PRINTF: diverts PRINTF calls to an OS/2 Named Queue */ -/* Copyright (c) IBM Corporation, 1991, 1992 */ -/* ----------------------------------------------------------------- */ -/* This version for OS/2 2.x, 32-bit programs. Mike Cowlishaw */ -/* */ -/* This routine, when linked into an .EXE instead of the usual C */ -/* runtime, sends the edited result string to a named queue (if */ -/* it exists). If the queue does not exist, then all printf data */ -/* are discarded (ignored). */ -/* */ -/* The result string is accumulated until a line feed (LF) character */ -/* is received; the whole line is then sent to the queue. Lines are */ -/* automatically broken at a set (tailorable) length, if necessary. */ -/* */ -/* This routine may be tailored by altering the #defines at the */ -/* top: */ -/* */ -/* PRINTFID - An ID string that is prefixed to each line of */ -/* data before being sent to the queue. This */ -/* can be any string, or the null string. */ -/* PRINTFMAXLEN - Maximum length of string that can be formatted */ -/* in a single call. */ -/* Results are unpredictable if this length is */ -/* exceeded. Default is 250. */ -/* PRINTFLINELEN - Maximum length of a line that will be sent. */ -/* This excludes the prefix and its blank. If the */ -/* calls to printf cause a line to be generated */ -/* that is longer than this, the line will be */ -/* broken at this point. */ -/* PRINTFTHREADS - Maximum number of threads expected. This may */ -/* need to be increased if the process limitation */ -/* is removed, or you can save a little storage */ -/* by decreasing it. PRINTFs from threads larger */ -/* than this number are ignored. */ -/* PRINTFQNAME - The name of the public queue that the result */ -/* is to be sent to. Normally '\QUEUES\PRINTF32'. */ -/* Note that the \QUEUES\ part is required. */ -/* */ -/* Returns: */ -/* n: Count of data characters, if successfully received */ -/* 0: If no queue existed (i.e., no server) */ -/* <0: An error occurred (e.g., out of memory) */ -/* */ -/* Restrictions: */ -/* 1. Total length of data (length of PRINTFID, + PRINTFMAXLEN) */ -/* must be less than 32K-1. */ -/* 2. This has only been tested under IBM C Set/2 compiler. It */ -/* may need modification for other compilers. */ -/* 3. This version uses a static array to point to the per-thread */ -/* data. The code could be made read-only by hanging this */ -/* array (and the other static information) off a system-owned */ -/* anchor of some kind. */ -/* 4. To use PRINTF within other than the main thread in a */ -/* program, that thread must be started with _beginthread */ -/* (not DosCreateThread). This restriction is a consequence of */ -/* the use of C library routines (sprintf) in PRINTF, and may */ -/* not apply to all compilers. */ -/* 5. If the last PRINTF done by a thread does not end in '\n' */ -/* then the final part-line may be lost, or appear later. */ -/* */ -/* Protocol: */ -/* PRINTF writes its data to the named queue using the following */ -/* protocol: */ -/* Address -- Holds the address of the string to be sent. This */ -/* is a 0-terminated string) starting at offset 0. */ -/* Length -- The length of the data, including terminator. */ -/* A negative length indicates a BELL in the data. */ -/* Request -- Timestamp (when queue was written) in C long */ -/* integer format (as returned by time()). */ -/* This may be 0L if not required. */ -/* */ -/* Notes: */ -/* 1. PMPRINTF uses a queue and shared memory messages because: */ -/* (a) It makes collection at the receiving end very easy. */ -/* (b) I wanted to experiment with queues and shared memory. */ -/* This make not be the most cost-effective method. */ -/* 2. Typical IBM C Set/2 compiler invocation: */ -/* icc /c /Gm /O+ /Q /J /Kabgop */ -/* If you get linking errors (duplicate symbols, etc.), try */ -/* recompiling PRINTF.C with the same options as you use for */ -/* your main program. */ -/* 3. PRINTF sends the timestamp across the queue as a GMT long */ -/* integer, the result from a call to the C function time(). */ -/* This will only be correct if the environment variable TZ has */ -/* been set (e.g., TZ=EST5EDT), or you are in the same time */ -/* zone as the default for your compiler. */ -/* For more information, see the tzset() function description */ -/* in your C compiler manual. */ - -/* ----- Customization variables ----- */ -#define PRINTFID "" -#define PRINTFMAXLEN 300 -#define PRINTFLINELEN 100 -#define PRINTFTHREADS 54 -#define PRINTFQNAME "\\QUEUES\\PRINTF32" - -/* ----- Includes and externals ----- */ -#include <stdlib.h> /* standard C functions */ -#include <stddef.h> /* .. */ -#include <string.h> /* .. */ -#include <time.h> /* .. */ -#include <stdarg.h> /* .. */ -#include <stdio.h> /* (needed to pick up real name) */ -#define INCL_DOS /* Operating system definitions */ -#include <os2.h> /* For OS/2 functions */ - -#define max(a,b) (a>b ? a : b) - -/* ----- Local defines ----- */ -#define PRINTFIDSIZE sizeof(PRINTFID) -#define PRINTFMAXBUF PRINTFIDSIZE+PRINTFLINELEN - -/* ----- Per-thread output buffer and current indices into line ---- */ -struct perthread { - LONG lineindex; /* where next char */ - LONG tidemark; /* rightmost char */ - int bell; /* TRUE if line has bell */ - UCHAR line[PRINTFMAXBUF]; /* accumulator */ - }; - -/* ----- Local static variables ----- */ -static ULONG ourpid=0; /* our process ID */ -static ULONG servepid=0; /* process IDs of the server */ -static HQUEUE qhandle=0; /* handle for the queue */ -static struct perthread *tps[PRINTFTHREADS+1]; /* -> per-thread data */ - -/* ----- Local subroutine ----- */ -static int printf_(struct perthread *); - -/* ----------------------------------------------------------------- */ -/* The "printf" function. Note this has a variable number of */ -/* arguments. */ -/* ----------------------------------------------------------------- */ -int debug_printf(const char *f, ...) - { - TIB *ptib; /* process/thread id structures */ - PIB *ppib; /* .. */ - TID ourtid; /* thread ID */ - struct perthread *tp; /* pointer to per-thread data */ - int rc; /* returncode */ - ULONG urc; /* returncode */ - - urc=DosOpenQueue(&servepid, &qhandle, PRINTFQNAME); /* Open the Q */ - /* Non-0 RC means Q does not exist or cannot be opened */ - if (urc==343) return 0; /* queue does not exist, so quit */ - if (urc!=0) return -1; /* report any other error */ - - /* First determine our thread ID (and hence get access to the */ - /* correct per-thread data. If the per-thread data has not been */ - /* allocated, then allocate it now. It is never freed, once */ - /* allocated, as PRINTF is not notified of end-of-thread. */ - DosGetInfoBlocks(&ptib,&ppib); /* get process/thread info */ - ourtid=ptib->tib_ptib2->tib2_ultid; /* .. and copy TID */ - if (ourtid>PRINTFTHREADS) /* too many threads .. */ - return 0; /* .. so quit, quietly */ - tp=tps[ourtid]; /* copy to local pointer */ - if (tp==NULL) { /* uninitialized (NULL=0) */ - /* allocate a per-thread structure */ - tp=(struct perthread *)malloc(sizeof(struct perthread)); - if (tp==NULL) return -1; /* out of memory -- return error */ - tps[ourtid]=tp; /* save for future calls */ - strcpy(tp->line,PRINTFID); /* initialize: line.. */ - tp->lineindex=PRINTFIDSIZE-1; /* ..where next char */ - tp->tidemark =PRINTFIDSIZE-2; /* ..rightmost char */ - tp->bell=FALSE; /* ..if line has bell */ - if (ourpid==0) ourpid=ppib->pib_ulpid; /* save PID for all to use */ - } - - { /* Block for declarations -- only needed if queue exists, etc. */ - LONG count; /* count of characters formatted */ - UCHAR buffer[PRINTFMAXLEN+1]; /* formatting area */ - LONG i, newind; /* work */ - UCHAR ch; /* .. */ - va_list argptr; /* -> variable argument list */ - - va_start(argptr, f); /* get pointer to argument list */ - count=vsprintf(buffer, f, argptr); - va_end(argptr); /* done with variable arguments */ - - if (count<0) return count-1000;/* bad start */ - - if (count>PRINTFMAXLEN) { - /* Disaster -- we are probably "dead", but just in case we */ - /* are not, carry on with truncated data. */ - count=PRINTFMAXLEN; - } - buffer[count]='\0'; /* ensure terminated */ - /* OK, ready to go with the data now in BUFFER */ - /* We copy from the formatted string to the output (line) buffer, */ - /* taking note of certain control characters and sending a line */ - /* the queue whenever we see a LF control, or when the line */ - /* fills (causing a forced break). */ - for (i=0; ; i++) { - ch=buffer[i]; if (!ch) break; - switch(ch) { - case '\r': /* carriage return */ - tp->lineindex=PRINTFIDSIZE-1; /* back to start of line */ - break; - case '\n': /* new line */ - case '\f': /* form feed */ - rc=printf_(tp); /* print a line */ - if (rc!=0) return rc; /* error */ - break; - case '\t': /* tab */ - newind=tp->lineindex-PRINTFIDSIZE+1; /* offset into data */ - newind=tp->lineindex+5-newind%5; /* new index requested */ - if (newind>=PRINTFMAXBUF) newind=PRINTFMAXBUF; /* clamp */ - for (; tp->lineindex<newind; tp->lineindex++) { - if (tp->lineindex>tp->tidemark) { /* beyond current end */ - tp->line[tp->lineindex]=' '; /* add space */ - tp->tidemark=tp->lineindex; - } - } - break; - case '\v': /* vertical tab */ - /* ignore it */ - break; - case '\b': /* backspace */ - tp->lineindex=max(tp->lineindex-1,PRINTFIDSIZE); - break; - case '\a': /* alert (bell) */ - tp->bell=TRUE; - break; - default: /* ordinary character */ - tp->line[tp->lineindex]=ch; - if (tp->lineindex>tp->tidemark) /* is rightmost.. */ - tp->tidemark=tp->lineindex; - tp->lineindex++; /* step for next */ - } /* switch */ - if (tp->lineindex>=PRINTFMAXBUF) { - rc=printf_(tp); /* print a line */ - if (rc!=0) return rc; /* error */ - } - - } /* copy loop */ - return count; /* all formatted data processed */ - } /* block */ - } /* printf */ - -/* ----- printf_(tp) -- Local subroutine to send a line ------------ */ -/* A line has been completed (or overflowed): write it to the queue. */ -int printf_(struct perthread *tp) /* pointer to per-thread data */ - { - ULONG urc; /* unsigned returncode */ - PSZ pszTo, pszFrom; /* character pointers */ - PVOID addr; /* address of output data */ - long size; /* total size of output data */ - time_t timenow; /* holds current time */ - - tp->line[tp->tidemark+1]='\0'; /* add terminator */ - size=tp->tidemark+2; /* total length of data */ - - /* Get some shared memory that can be given away */ - urc=DosAllocSharedMem(&addr, NULL, (unsigned)size, - OBJ_GIVEABLE|PAG_WRITE|PAG_COMMIT); - if (urc!=0) return -2; /* error */ - - pszTo=addr; /* copy for clarity */ - pszFrom=&(tp->line[0]); /* pointer to source */ - strcpy(pszTo,pszFrom); /* copy the string to shared memory */ - - if (ourpid!=servepid) { /* (no giveaway needed if to self) */ - urc=DosGiveSharedMem(addr, servepid, PAG_READ); /* give access */ - if (urc!=0) return -3;} /* error */ - - /* Write the selector, size, and timestamp to the queue */ - if (tp->bell) size=-size; /* BELL passed by negation */ - time(&timenow); /* optional - else use 0 */ - urc=DosWriteQueue(qhandle, /* handle */ - (unsigned)timenow, /* 'request' (timestamp) */ - (unsigned)size, /* 'length' (length/bell) */ - addr, /* 'address' (address) */ - 0); /* priority (FIFO if enabled) */ - if (urc!=0) return -4; /* error */ - if (ourpid!=servepid) { /* if given away.. */ - urc=DosFreeMem(addr); /* .. *we* are done with it */ - if (urc!=0) return -5;} /* error */ - /* Reset the line buffer and indices */ - tp->lineindex=PRINTFIDSIZE-1; /* where next char */ - tp->tidemark =PRINTFIDSIZE-2; /* rightmost char */ - tp->bell =FALSE; /* true if line has bell */ - return 0; /* success! */ - } /* printf_ */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/app/salinfo.cxx b/vcl/os2/source/app/salinfo.cxx deleted file mode 100644 index 08ca8b031982..000000000000 --- a/vcl/os2/source/app/salinfo.cxx +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_PM -#define INCL_DOS -#define INCL_GPI -#include <svpm.h> - -#include <tools/string.hxx> -#include <salsys.h> -#include <salframe.h> -#include <salinst.h> -#include "saldata.hxx" -#include <tools/debug.hxx> -#include <vcl/svdata.hxx> -#include <rtl/ustrbuf.hxx> -#include "vcl/window.hxx" - -#define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer - -class Os2SalSystem : public SalSystem -{ -public: - Os2SalSystem() {} - virtual ~Os2SalSystem(); - - virtual unsigned int GetDisplayScreenCount(); - virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ); - //virtual bool GetSalSystemDisplayInfo( DisplayInfo& rInfo ); - - virtual bool IsMultiDisplay(); - virtual unsigned int GetDefaultDisplayNumber(); - virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ); - virtual rtl::OUString GetScreenName( unsigned int nScreen ); - - virtual int ShowNativeMessageBox( const String& rTitle, - const String& rMessage, - int nButtonCombination, - int nDefaultButton); -}; - -SalSystem* Os2SalInstance::CreateSalSystem() -{ - return new Os2SalSystem(); -} - -Os2SalSystem::~Os2SalSystem() -{ -} - -// ----------------------------------------------------------------------- - -unsigned int Os2SalSystem::GetDisplayScreenCount() -{ - return 1; -} - -Rectangle Os2SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) -{ - Rectangle aRet; - aRet = Rectangle( Point(), Point( WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ), - WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) ) ); - return aRet; -} - -// ----------------------------------------------------------------------- -/* We have to map the button identifier to the identifier used by the Os232 - Platform SDK to specify the default button for the MessageBox API. - The first dimension is the button combination, the second dimension - is the button identifier. -*/ -static int DEFAULT_BTN_MAPPING_TABLE[][8] = -{ - // Undefined OK CANCEL ABORT RETRY IGNORE YES NO - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //OK - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //OK_CANCEL - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_DEFBUTTON1, MB_DEFBUTTON1 }, //ABORT_RETRY_IGNO - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON3, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2 }, //YES_NO_CANCEL - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2 }, //YES_NO - { MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1, MB_DEFBUTTON1 } //RETRY_CANCEL -}; - -static int COMBI_BTN_MAPPING_TABLE[] = -{ - MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNO, MB_YESNOCANCEL, MB_RETRYCANCEL -}; - -int Os2SalSystem::ShowNativeMessageBox(const String& rTitle, const String& rMessage, int nButtonCombination, int nDefaultButton) -{ - DBG_ASSERT( nButtonCombination >= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK && - nButtonCombination <= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL && - nDefaultButton >= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK && - nDefaultButton <= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, "Invalid arguments!" ); - - int nFlags = MB_APPLMODAL | MB_WARNING | COMBI_BTN_MAPPING_TABLE[nButtonCombination]; - - if (nButtonCombination >= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK && - nButtonCombination <= SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL && - nDefaultButton >= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK && - nDefaultButton <= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO) - nFlags |= DEFAULT_BTN_MAPPING_TABLE[nButtonCombination][nDefaultButton]; - - //#107209 hide the splash screen if active - ImplSVData* pSVData = ImplGetSVData(); - if (pSVData->mpIntroWindow) - pSVData->mpIntroWindow->Hide(); - - return WinMessageBox( - HWND_DESKTOP, HWND_DESKTOP, - (PSZ)CHAR_POINTER(rMessage), - (PSZ)CHAR_POINTER(rTitle), - 0, nFlags); -} - - -unsigned int Os2SalSystem::GetDefaultDisplayNumber() -{ - return 0; -} - -bool Os2SalSystem::IsMultiDisplay() -{ - return false; -} - -Rectangle Os2SalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) -{ - return GetDisplayScreenPosSizePixel( nScreen ); -} - -rtl::OUString Os2SalSystem::GetScreenName( unsigned int nScreen ) -{ - rtl::OUStringBuffer aBuf( 32 ); - aBuf.appendAscii( "VirtualScreen " ); - aBuf.append( sal_Int32(nScreen) ); - return aBuf.makeStringAndClear(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx deleted file mode 100644 index e4fd783ccb27..000000000000 --- a/vcl/os2/source/app/salinst.cxx +++ /dev/null @@ -1,859 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_DOSMISC -#define INCL_DOSMODULEMGR -#define INCL_DOSPROCESS - -#include <string.h> -#include <svpm.h> -#include <process.h> - -#define _SV_SALINST_CXX - -#include <vcl/solarmutex.hxx> -#include <tools/debug.hxx> - -#include <salids.hrc> -#include <vcl/apptypes.hxx> -#include <saldata.hxx> -#include <salinst.h> -#include <salframe.h> -#include <salobj.h> -#include <saltimer.h> -#include <salbmp.h> -#include <vcl/salimestatus.hxx> -#include <vcl/timer.hxx> -#include <tools/solarmutex.hxx> - -// ======================================================================= - -void SalAbort( const XubString& rErrorText ) -{ - ImplFreeSalGDI(); - - if( !rErrorText.Len() ) - fprintf( stderr, "Application Error " ); - else - fprintf( stderr, "%s ", - ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() ); - abort(); -} - -// ======================================================================= - -ULONG GetCurrentThreadId() -{ - PTIB pptib = NULL; - PPIB pppib = NULL; - - DosGetInfoBlocks( &pptib, &pppib ); - return pptib->tib_ptib2->tib2_ultid; -} - -// ======================================================================= - -MRESULT EXPENTRY SalComWndProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 ); - -// ======================================================================= - -class SalYieldMutex : public vcl::SolarMutexObject -{ -public: - Os2SalInstance* mpInstData; - ULONG mnCount; - ULONG mnThreadId; - -public: - SalYieldMutex( Os2SalInstance* pInstData ); - - virtual void SAL_CALL acquire(); - virtual void SAL_CALL release(); - virtual sal_Bool SAL_CALL tryToAcquire(); - - ULONG GetAcquireCount( ULONG nThreadId ); -}; - -// ----------------------------------------------------------------------- - -SalYieldMutex::SalYieldMutex( Os2SalInstance* pInstData ) -{ - mpInstData = pInstData; - mnCount = 0; - mnThreadId = 0; -} - -// ----------------------------------------------------------------------- - -void SalYieldMutex::acquire() -{ - SolarMutexObject::acquire(); - mnCount++; - mnThreadId = GetCurrentThreadId(); -} - -// ----------------------------------------------------------------------- - -void SalYieldMutex::release() -{ - ULONG nThreadId = GetCurrentThreadId(); - if ( mnThreadId != nThreadId ) - SolarMutexObject::release(); - else - { - SalData* pSalData = GetSalData(); - if ( pSalData->mnAppThreadId != nThreadId ) - { - if ( mnCount == 1 ) - { - mpInstData->mpSalWaitMutex->acquire(); - if ( mpInstData->mnYieldWaitCount ) - WinPostMsg( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 ); - mnThreadId = 0; - mnCount--; - SolarMutexObject::release(); - mpInstData->mpSalWaitMutex->release(); - } - else - { - mnCount--; - SolarMutexObject::release(); - } - } - else - { - if ( mnCount == 1 ) - mnThreadId = 0; - mnCount--; - SolarMutexObject::release(); - } - } -} - -// ----------------------------------------------------------------------- - -sal_Bool SalYieldMutex::tryToAcquire() -{ - if ( SolarMutexObject::tryToAcquire() ) - { - mnCount++; - mnThreadId = GetCurrentThreadId(); - return sal_True; - } - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId ) -{ - if ( nThreadId == mnThreadId ) - return mnCount; - else - return 0; -} - -// ----------------------------------------------------------------------- - -void ImplSalYieldMutexAcquireWithWait() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( !pInst ) - return; - - // If we are the main thread, then we must wait with wait, because - // in if we don't reschedule, then we create deadlocks if a Windows - // Function is called from another thread. If we arn't the main thread, - // than we call qcquire directly. - ULONG nThreadId = GetCurrentThreadId(); - SalData* pSalData = GetSalData(); - if ( pSalData->mnAppThreadId == nThreadId ) - { - // Wenn wir den Mutex nicht bekommen, muessen wir solange - // warten, bis wir Ihn bekommen - BOOL bAcquire = FALSE; - do - { - if ( pInst->mpSalYieldMutex->tryToAcquire() ) - bAcquire = TRUE; - else - { - pInst->mpSalWaitMutex->acquire(); - if ( pInst->mpSalYieldMutex->tryToAcquire() ) - { - bAcquire = TRUE; - pInst->mpSalWaitMutex->release(); - } - else - { - pInst->mnYieldWaitCount++; - pInst->mpSalWaitMutex->release(); - QMSG aTmpMsg; - WinGetMsg( pSalData->mhAB, &aTmpMsg, pInst->mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD ); - pInst->mnYieldWaitCount--; - if ( pInst->mnYieldWaitCount ) - WinPostMsg( pInst->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0 , 0 ); - } - } - } - while ( !bAcquire ); - } - else - pInst->mpSalYieldMutex->acquire(); -} - -// ----------------------------------------------------------------------- - -BOOL ImplSalYieldMutexTryToAcquire() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst ) - return pInst->mpSalYieldMutex->tryToAcquire(); - else - return FALSE; -} - -// ----------------------------------------------------------------------- - -void ImplSalYieldMutexAcquire() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst ) - pInst->mpSalYieldMutex->acquire(); -} - -// ----------------------------------------------------------------------- - -void ImplSalYieldMutexRelease() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst ) - pInst->mpSalYieldMutex->release(); -} - -// ----------------------------------------------------------------------- - -ULONG ImplSalReleaseYieldMutex() -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( !pInst ) - return 0; - - SalYieldMutex* pYieldMutex = pInst->mpSalYieldMutex; - ULONG nCount = pYieldMutex->GetAcquireCount( GetCurrentThreadId() ); - ULONG n = nCount; - while ( n ) - { - pYieldMutex->release(); - n--; - } - - return nCount; -} - -// ----------------------------------------------------------------------- - -void ImplSalAcquireYieldMutex( ULONG nCount ) -{ - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( !pInst ) - return; - - SalYieldMutex* pYieldMutex = pInst->mpSalYieldMutex; - while ( nCount ) - { - pYieldMutex->acquire(); - nCount--; - } -} - -// ----------------------------------------------------------------------- - -bool Os2SalInstance::CheckYieldMutex() -{ - bool bRet = true; - SalData* pSalData = GetSalData(); - ULONG nCurThreadId = GetCurrentThreadId(); - if ( pSalData->mnAppThreadId != nCurThreadId ) - { - if ( pSalData->mpFirstInstance ) - { - SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; - if ( pYieldMutex->mnThreadId != nCurThreadId ) - { - bRet = false; - } - } - } - else - { - if ( pSalData->mpFirstInstance ) - { - SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; - if ( pYieldMutex->mnThreadId != nCurThreadId ) - { - bRet = false; - } - } - } - return bRet; -} - -// ======================================================================= - -void InitSalData() -{ - SalData* pSalData = new SalData; - memset( pSalData, 0, sizeof( SalData ) ); - SetSalData( pSalData ); -} - -// ----------------------------------------------------------------------- - -void DeInitSalData() -{ - SalData* pSalData = GetSalData(); - if ( pSalData->mpFontMetrics ) - delete pSalData->mpFontMetrics; - delete pSalData; - SetSalData( NULL ); -} - -// ----------------------------------------------------------------------- - -void InitSalMain() -{ - PPIB pib; - PTIB tib; - HAB hAB; - HMQ hMQ; - SalData* pData = GetAppSalData(); -#if OSL_DEBUG_LEVEL > 0 -printf("InitSalMain\n"); -#endif - - // morph application to PM - DosGetInfoBlocks(&tib, &pib); - // Change flag from VIO to PM: - if (pib->pib_ultype==2) pib->pib_ultype = 3; - - // create anchor block - hAB = WinInitialize( 0 ); - if ( !hAB ) - return; - - // create message queue - hMQ = WinCreateMsgQueue( hAB, 60 ); - if ( !hMQ ) - { - WinTerminate( hAB ); - return; - } - - if ( pData ) // Im AppServer NULL - { - // Ankerblock und Messagequeue merken - pData->mhAB = hAB; - pData->mhMQ = hMQ; - } - -} - -void DeInitSalMain() -{ -#if OSL_DEBUG_LEVEL > 0 -printf("DeInitSalMain\n"); -#endif - - SalData* pData = GetAppSalData(); - // destroy message queue and anchor block - WinDestroyMsgQueue( pData->mhMQ ); - WinTerminate( pData->mhAB ); - -} - -// ----------------------------------------------------------------------- - -SalInstance* CreateSalInstance() -{ - SalData* pSalData = GetSalData(); - - // determine the os2 version - ULONG nMayor; - ULONG nMinor; - DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &nMayor, sizeof( nMayor ) ); - DosQuerySysInfo( QSV_VERSION_MINOR, QSV_VERSION_MINOR, &nMinor, sizeof( nMinor ) ); - aSalShlData.mnVersion = (USHORT)(nMayor*10 + nMinor); - - pSalData->mnAppThreadId = GetCurrentThreadId(); - - // register frame class - if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_FRAME_CLASSNAME, - (PFNWP)SalFrameWndProc, CS_MOVENOTIFY /* 17/08 CS_HITTEST | CS_MOVENOTIFY */, - SAL_FRAME_WNDEXTRA ) ) - { - return NULL; - } - // register subframe class - if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_SUBFRAME_CLASSNAME, - (PFNWP)SalFrameWndProc, CS_SAVEBITS| CS_MOVENOTIFY, - SAL_FRAME_WNDEXTRA ) ) - { - return NULL; - } - // register object class - if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_COM_CLASSNAME, - (PFNWP)SalComWndProc, 0, 0 )) - { - return NULL; - } - - HWND hComWnd = WinCreateWindow( HWND_OBJECT, (PCSZ)SAL_COM_CLASSNAME, - (PCSZ)"", 0, 0, 0, 0, 0, - HWND_OBJECT, HWND_TOP, - 222, NULL, NULL); - if ( !hComWnd ) - return NULL; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("CreateSalInstance hComWnd %x\n", hComWnd); -#endif - Os2SalInstance* pInst = new Os2SalInstance; - - // init instance (only one instance in this version !!!) - pSalData->mpFirstInstance = pInst; - pInst->mhAB = pSalData->mhAB; - pInst->mhMQ = pSalData->mhMQ; - pInst->mnArgc = pSalData->mnArgc; - pInst->mpArgv = pSalData->mpArgv; - pInst->mhComWnd = hComWnd; - - // AppIcon ermitteln - ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, pInst->mhAppIcon); - - // init static GDI Data - ImplInitSalGDI(); - - return pInst; -} - -// ----------------------------------------------------------------------- - -void DestroySalInstance( SalInstance* pInst ) -{ - SalData* pSalData = GetSalData(); - - // (only one instance in this version !!!) - ImplFreeSalGDI(); - -#ifdef ENABLE_IME - // IME-Daten freigeben - if ( pSalData->mpIMEData ) - ImplReleaseSALIMEData(); -#endif - - // reset instance - if ( pSalData->mpFirstInstance == pInst ) - pSalData->mpFirstInstance = NULL; - - delete pInst; -} - -// ----------------------------------------------------------------------- - -Os2SalInstance::Os2SalInstance() -{ - mhComWnd = 0; - mpSalYieldMutex = new SalYieldMutex( this ); - mpSalWaitMutex = new osl::Mutex; - mnYieldWaitCount = 0; - mpSalYieldMutex->acquire(); - ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); -} - -// ----------------------------------------------------------------------- - -Os2SalInstance::~Os2SalInstance() -{ - ::tools::SolarMutex::SetSolarMutex( 0 ); - mpSalYieldMutex->release(); - delete mpSalYieldMutex; - delete mpSalWaitMutex; - WinDestroyWindow( mhComWnd); -} - -// ----------------------------------------------------------------------- - -osl::SolarMutex* Os2SalInstance::GetYieldMutex() -{ - return mpSalYieldMutex; -} -// ----------------------------------------------------------------------- - -ULONG Os2SalInstance::ReleaseYieldMutex() -{ - return ImplSalReleaseYieldMutex(); -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::AcquireYieldMutex( ULONG nCount ) -{ - ImplSalAcquireYieldMutex( nCount ); -} - -// ----------------------------------------------------------------------- - -static void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) -{ - QMSG aMsg; - bool bWasMsg = false, bOneEvent = false; - bool bQuit = false; - - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; - do - { - if ( WinPeekMsg( pInst->mhAB, &aMsg, 0, 0, 0, PM_REMOVE ) ) - { - WinDispatchMsg( pInst->mhAB, &aMsg ); - bOneEvent = bWasMsg = true; - if (aMsg.msg == WM_QUIT) - bQuit = true; - } - else - bOneEvent = false; - } while( --nMaxEvents && bOneEvent ); - - if ( bWait && ! bWasMsg ) - { - if ( WinGetMsg( pInst->mhAB, &aMsg, 0, 0, 0 ) ) - WinDispatchMsg( pInst->mhAB, &aMsg ); - else - bQuit = true; - } - - if (bQuit) - { - ImplSalYieldMutexAcquireWithWait(); - Os2SalFrame* pFrame = GetSalData()->mpFirstFrame; - if ( pFrame ) - { - if (pFrame->CallCallback( SALEVENT_SHUTDOWN, 0 )) - WinCancelShutdown( pFrame->mhAB, FALSE ); - } - ImplSalYieldMutexRelease(); - } - -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) -{ - SalYieldMutex* pYieldMutex = mpSalYieldMutex; - SalData* pSalData = GetSalData(); - ULONG nCurThreadId = GetCurrentThreadId(); - ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId ); - ULONG n = nCount; - while ( n ) - { - pYieldMutex->release(); - n--; - } - if ( pSalData->mnAppThreadId != nCurThreadId ) - { - // #97739# A SendMessage call blocks until the called thread (here: the main thread) - // returns. During a yield however, messages are processed in the main thread that might - // result in a new message loop due to opening a dialog. Thus, SendMessage would not - // return which will block this thread! - // Solution: just give up the time slice and hope that messages are processed - // by the main thread anyway (where all windows are created) - // If the mainthread is not currently handling messages, then our SendMessage would - // also do nothing, so this seems to be reasonable. - - // #i18883# only sleep if potential deadlock scenario, ie, when a dialog is open - if( ImplGetSVData()->maAppData.mnModalMode ) - DosSleep(1); - else - WinSendMsg( mhComWnd, SAL_MSG_THREADYIELD, (MPARAM)bWait, (MPARAM)bHandleAllCurrentEvents ); - - n = nCount; - while ( n ) - { - pYieldMutex->acquire(); - n--; - } - } - else - { - ImplSalYield( bWait, bHandleAllCurrentEvents ); - - n = nCount; - while ( n ) - { - ImplSalYieldMutexAcquireWithWait(); - n--; - } - } -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalComWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - //debug_printf( "SalComWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); - - switch ( nMsg ) - { - case SAL_MSG_PRINTABORTJOB: - //ImplSalPrinterAbortJobAsync( (HDC)wParam ); - break; - case SAL_MSG_THREADYIELD: - ImplSalYield( (bool)nMP1, (bool) nMP2); - return 0; - // If we get this message, because another GetMessage() call - // has recieved this message, we must post this message to - // us again, because in the other case we wait forever. - case SAL_MSG_RELEASEWAITYIELD: - { - Os2SalInstance* pInst = GetSalData()->mpFirstInstance; - if ( pInst && pInst->mnYieldWaitCount ) - WinPostMsg( hWnd, SAL_MSG_RELEASEWAITYIELD, nMP1, nMP2 ); - } - return 0; - case SAL_MSG_STARTTIMER: - ImplSalStartTimer( (ULONG)nMP2, FALSE); - return 0; - case SAL_MSG_CREATEFRAME: - return (MRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)nMP2, (ULONG)nMP1 ); - case SAL_MSG_DESTROYFRAME: - delete (SalFrame*)nMP2; - return 0; - case SAL_MSG_DESTROYHWND: - //We only destroy the native window here. We do NOT destroy the SalFrame contained - //in the structure (GetWindowPtr()). - if (WinDestroyWindow((HWND)nMP2) == 0) - { - OSL_FAIL("DestroyWindow failed!"); - //Failure: We remove the SalFrame from the window structure. So we avoid that - // the window structure may contain an invalid pointer, once the SalFrame is deleted. - SetWindowPtr((HWND)nMP2, 0); - } - return 0; - case SAL_MSG_CREATEOBJECT: - return (MRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (Os2SalFrame*)(ULONG)nMP2 ); - case SAL_MSG_DESTROYOBJECT: - delete (SalObject*)nMP2; - return 0; - case SAL_MSG_CREATESOUND: - //return (MRESULT)((Os2SalSound*)nMP2)->ImplCreate(); - return 0; - case SAL_MSG_DESTROYSOUND: - //((Os2SalSound*)nMP2)->ImplDestroy(); - return 0; - case SAL_MSG_POSTTIMER: - SalTimerProc( 0, 0, SALTIMERPROC_RECURSIVE, (ULONG)nMP2 ); - break; - case WM_TIMER: - SalTimerProc( hWnd, 0, 0, 0 ); - break; - } - - return WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); -} - -// ----------------------------------------------------------------------- - -bool Os2SalInstance::AnyInput( USHORT nType ) -{ - SalData* pSalData = GetSalData(); - QMSG aQMSG; - - if ( (nType & (INPUT_ANY)) == INPUT_ANY ) - { - // Any Input - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) ) - return TRUE; - } - else - { - if ( nType & INPUT_MOUSE ) - { - // Test auf Mouseinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) ) - return TRUE; - } - - if ( nType & INPUT_KEYBOARD ) - { - // Test auf Keyinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_CHAR, WM_CHAR, PM_NOREMOVE ) ) - return !(SHORT1FROMMP( aQMSG.mp1 ) & KC_KEYUP); - } - - if ( nType & INPUT_PAINT ) - { - // Test auf Paintinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_PAINT, WM_PAINT, PM_NOREMOVE ) ) - return TRUE; - } - - if ( nType & INPUT_TIMER ) - { - // Test auf Timerinput - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, - WM_TIMER, WM_TIMER, PM_NOREMOVE ) ) - return TRUE; - } - - if ( nType & INPUT_OTHER ) - { - // Test auf sonstigen Input - if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) ) - return TRUE; - } - } - - return FALSE; -} - -// ----------------------------------------------------------------------- - -SalFrame* Os2SalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) -{ - // Um auf Main-Thread umzuschalten - return (SalFrame*)WinSendMsg( mhComWnd, SAL_MSG_CREATEFRAME, (MPARAM)nSalFrameStyle, (MPARAM)pSystemParentData->hWnd ); -} - -// ----------------------------------------------------------------------- - -SalFrame* Os2SalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) -{ - // Um auf Main-Thread umzuschalten - HWND mhWndClient; -//31/05/06 YD use client as owner(parent) so positioning will not need to -// take care of borders and captions - if ( pParent ) - mhWndClient = static_cast<Os2SalFrame*>(pParent)->mhWndClient; - else - mhWndClient = 0; - return (SalFrame*)WinSendMsg( mhComWnd, SAL_MSG_CREATEFRAME, (MPARAM)nSalFrameStyle, (MPARAM)mhWndClient ); -} - - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyFrame( SalFrame* pFrame ) -{ - WinSendMsg( mhComWnd, SAL_MSG_DESTROYFRAME, 0, (MPARAM)pFrame ); -} - -// ----------------------------------------------------------------------- - -SalObject* Os2SalInstance::CreateObject( SalFrame* pParent, - SystemWindowData* /*pWindowData*/, // SystemWindowData meaningless on Windows - BOOL /*bShow*/ ) -{ - // Um auf Main-Thread umzuschalten - return (SalObject*)WinSendMsg( mhComWnd, SAL_MSG_CREATEOBJECT, 0, (MPARAM)pParent ); -} - - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyObject( SalObject* pObject ) -{ - WinSendMsg( mhComWnd, SAL_MSG_DESTROYOBJECT, 0, (MPARAM)pObject ); -} - -// ----------------------------------------------------------------------- - -void* Os2SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) -{ - rReturnedBytes = 1; - rReturnedType = AsciiCString; - return (void*) ""; -} - -void Os2SalInstance::AddToRecentDocumentList(const rtl::OUString& /*rFileUrl*/, const rtl::OUString& /*rMimeType*/) -{ -} - -// ----------------------------------------------------------------------- - -SalTimer* Os2SalInstance::CreateSalTimer() -{ - return new Os2SalTimer(); -} - -// ----------------------------------------------------------------------- - -SalBitmap* Os2SalInstance::CreateSalBitmap() -{ - return new Os2SalBitmap(); -} - -// ----------------------------------------------------------------------- - -class Os2ImeStatus : public SalI18NImeStatus -{ - public: - Os2ImeStatus() {} - virtual ~Os2ImeStatus() {} - - // asks whether there is a status window available - // to toggle into menubar - virtual bool canToggle() { return false; } - virtual void toggle() {} -}; - -SalI18NImeStatus* Os2SalInstance::CreateI18NImeStatus() -{ - return new Os2ImeStatus(); -} - -// ----------------------------------------------------------------------- - -const ::rtl::OUString& SalGetDesktopEnvironment() -{ - static ::rtl::OUString aDesktopEnvironment( RTL_CONSTASCII_USTRINGPARAM( "OS/2" ) ); - return aDesktopEnvironment; -} - -SalSession* Os2SalInstance::CreateSalSession() -{ - return NULL; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/app/sallang.cxx b/vcl/os2/source/app/sallang.cxx deleted file mode 100644 index b93787013bbb..000000000000 --- a/vcl/os2/source/app/sallang.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sallang.hxx> - -// ======================================================================= - -// ----------------------------------------------------------------------- -// English (US/UK/AUS/CAN/NZ/EIRE/SAFRICA/JAMAICA/CARRIBEAN) -static const wchar_t* aImplLangEnglishTab[LSTR_COUNT] = -{ - L"Shift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Up", // LSTR_KEY_UP - L"Down", // LSTR_KEY_DOWN - L"Left", // LSTR_KEY_LEFT - L"Right", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backspace", // LSTR_KEY_BACKSPACE - L"Space", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Del", // LSTR_KEY_DELETE -}; - -// ======================================================================= - -const sal_Unicode** ImplGetLangTab( LanguageType eLang ) -{ - // Sprachtabelle ermitteln - const wchar_t** pLangTab; - //switch ( International::GetNeutralLanguage( eLang ) ) - switch ( eLang ) - { - default: - pLangTab = aImplLangEnglishTab; - break; - } - - return (const sal_Unicode**)pLangTab; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/app/salshl.cxx b/vcl/os2/source/app/salshl.cxx deleted file mode 100644 index 5974fbde8bd9..000000000000 --- a/vcl/os2/source/app/salshl.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALSHL_CXX -#include <saldata.hxx> -#include <tools/debug.hxx> - -// ======================================================================= - -SalShlData aSalShlData; - -HMODULE ImplGetModule(void); -static HMODULE mhMod = ImplGetModule(); - -// ======================================================================= - -APIRET APIENTRY DosQueryModFromEIP (HMODULE *phMod, ULONG *pObjNum, - ULONG BuffLen, PCHAR pBuff, ULONG *pOffset, ULONG Address); - -HMODULE ImplGetModule(void) -{ - HMODULE hMod; - ULONG ObjNum; - CHAR Buff[2*_MAX_PATH]; - ULONG Offset; - APIRET rc; - - // get module handle (and name) - rc = DosQueryModFromEIP( &hMod, &ObjNum, sizeof( Buff), Buff, &Offset, (ULONG)ImplGetModule); - if (rc) - return NULL; - // return module handle - aSalShlData.mhMod = hMod; - return hMod; -} - -// ======================================================================= - -HPOINTER ImplLoadSalCursor( int nId ) -{ - DBG_ASSERT( aSalShlData.mhMod, "no DLL instance handle" ); - - HPOINTER hPointer = WinLoadPointer( HWND_DESKTOP, aSalShlData.mhMod, nId ); - - DBG_ASSERT( hPointer, "pointer not found in sal resource" ); -#if OSL_DEBUG_LEVEL > 1 - if (!hPointer) - debug_printf( "ImplLoadSalCursor: pointer %d not found in sal resource\n", nId); -#endif - return hPointer; -} - -// ----------------------------------------------------------------------- - -BOOL ImplLoadSalIcon( int nId, HPOINTER& rIcon) -{ - DBG_ASSERT( aSalShlData.mhMod, "no DLL instance handle" ); - - SalData* pSalData = GetSalData(); - - // check the cache first - SalIcon *pSalIcon = pSalData->mpFirstIcon; - while( pSalIcon ) - { - if( pSalIcon->nId != nId ) - pSalIcon = pSalIcon->pNext; - else - { - rIcon = pSalIcon->hIcon; - return (rIcon != 0); - } - } - - // Try at first to load the icons from the application exe file - rIcon = WinLoadPointer( HWND_DESKTOP, NULL, nId ); - if ( !rIcon ) - { - // If the application don't provide these icons, then we try - // to load the icon from the VCL resource - rIcon = WinLoadPointer( HWND_DESKTOP, aSalShlData.mhMod, nId ); - } - - if( rIcon ) - { - // add to icon cache - pSalIcon = new SalIcon(); - pSalIcon->nId = nId; - pSalIcon->hIcon = rIcon; - pSalIcon->pNext = pSalData->mpFirstIcon; - pSalData->mpFirstIcon = pSalIcon; - } - - return (rIcon != 0); -} - -// ======================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/app/saltimer.cxx b/vcl/os2/source/app/saltimer.cxx deleted file mode 100644 index a27458edd793..000000000000 --- a/vcl/os2/source/app/saltimer.cxx +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALTIMER_CXX -#include <saldata.hxx> -#include <saltimer.h> -#include <salinst.h> - -// ======================================================================= - -// Maximale Periode -#define MAX_SYSPERIOD 65533 -#define IDTIMER 10 - -// ======================================================================= - -void ImplSalStartTimer( ULONG nMS, BOOL bMutex ) -{ - SalData* pSalData = GetSalData(); - - // Periode darf nicht zu gross sein, da OS2 2.11 mit USHORT arbeitet - // Remenber the time of the timer - pSalData->mnTimerMS = nMS; - if ( !bMutex ) - pSalData->mnTimerOrgMS = nMS; - - // Periode darf nicht zu gross sein, da Windows mit USHORT arbeitet - if ( nMS > MAX_SYSPERIOD ) - nMS = MAX_SYSPERIOD; - - // Gibt es einen Timer, dann zerstoren - if ( pSalData->mnTimerId ) - WinStopTimer( pSalData->mhAB, pSalData->mpFirstInstance->mhComWnd, pSalData->mnTimerId ); - - // Make a new timer with new period - pSalData->mnTimerId = WinStartTimer( pSalData->mhAB, pSalData->mpFirstInstance->mhComWnd, IDTIMER, nMS ); - pSalData->mnNextTimerTime = pSalData->mnLastEventTime + nMS; -} - -// ----------------------------------------------------------------------- - -Os2SalTimer::~Os2SalTimer() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalTimer::Start( ULONG nMS ) -{ - // Um auf Main-Thread umzuschalten - SalData* pSalData = GetSalData(); - if ( pSalData->mpFirstInstance ) - { - if ( pSalData->mnAppThreadId != GetCurrentThreadId() ) - WinPostMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (MPARAM)nMS ); - else - WinSendMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (MPARAM)nMS ); - } - else - ImplSalStartTimer( nMS, FALSE); -} - -// ----------------------------------------------------------------------- - -void Os2SalTimer::Stop() -{ - SalData* pSalData = GetSalData(); - - // Exitstiert ein Timer, dann diesen zerstoeren - if ( pSalData->mnTimerId ) { - WinStopTimer( pSalData->mhAB, pSalData->mpFirstInstance->mhComWnd, pSalData->mnTimerId ); - pSalData->mnTimerId = 0; - pSalData->mnNextTimerTime = 0; - } -} - -// ----------------------------------------------------------------------- - -void SalTimerProc( HWND, UINT, UINT nId, ULONG ) -{ - SalData* pSalData = GetSalData(); - ImplSVData* pSVData = ImplGetSVData(); - - // Test for MouseLeave - SalTestMouseLeave(); - - bool bRecursive = pSalData->mbInTimerProc && (nId != SALTIMERPROC_RECURSIVE); - if ( pSVData->mpSalTimer && ! bRecursive ) - { - // Try to aquire the mutex. If we don't get the mutex then we - // try this a short time later again. - if ( ImplSalYieldMutexTryToAcquire() ) - { - bRecursive = pSalData->mbInTimerProc && (nId != SALTIMERPROC_RECURSIVE); - if ( pSVData->mpSalTimer && ! bRecursive ) - { - pSalData->mbInTimerProc = TRUE; - pSVData->mpSalTimer->CallCallback(); - pSalData->mbInTimerProc = FALSE; - ImplSalYieldMutexRelease(); - - // Run the timer in the correct time, if we start this - // with a small timeout, because we don't get the mutex - if ( pSalData->mnTimerId && - (pSalData->mnTimerMS != pSalData->mnTimerOrgMS) ) - ImplSalStartTimer( pSalData->mnTimerOrgMS, FALSE ); - } - } - else - ImplSalStartTimer( 10, TRUE ); - } - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/makefile.mk b/vcl/os2/source/gdi/makefile.mk deleted file mode 100644 index b411c1eb2ce2..000000000000 --- a/vcl/os2/source/gdi/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=SV -TARGET=salgdi - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -YD00_CXXFILES= salgdi.cxx \ - salgdi2.cxx \ - salgdi3.cxx \ - salvd.cxx \ - salprn.cxx \ - salbmp.cxx - -SLOFILES= $(SLO)$/salgdi.obj \ - $(SLO)$/salgdi2.obj \ - $(SLO)$/salgdi3.obj \ - $(SLO)$/salvd.obj \ - $(SLO)$/salprn.obj \ - $(SLO)$/salbmp.obj \ - $(SLO)$/os2layout.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/gdi/os2layout.cxx b/vcl/os2/source/gdi/os2layout.cxx deleted file mode 100644 index a6574c3a2171..000000000000 --- a/vcl/os2/source/gdi/os2layout.cxx +++ /dev/null @@ -1,1041 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <rtl/ustring.hxx> -#include <osl/module.h> -#include <salgdi.h> -#include <saldata.hxx> -#include <vcl/sallayout.hxx> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -#include <cstdio> -#include <malloc.h> - -#ifdef GCP_KERN_HACK - #include <algorithm> -#endif // GCP_KERN_HACK - -// for GetMirroredChar -#include <vcl/svapp.hxx> - -#include <boost/unordered_map.hpp> -typedef boost::unordered_map<int,int> IntMap; - -#define DROPPED_OUTGLYPH 0xFFFF - -// ======================================================================= - -// OS/2 specific physical font instance -class ImplOs2FontEntry : public ImplFontEntry -{ -public: - ImplOs2FontEntry( ImplFontSelectData& ); - ~ImplOs2FontEntry(); - -private: - // TODO: also add HFONT??? Watch out for issues with too many active fonts... - -#ifdef GCP_KERN_HACK -public: - bool HasKernData() const; - void SetKernData( int, const KERNINGPAIRS* ); - int GetKerning( sal_Unicode, sal_Unicode ) const; -private: - KERNINGPAIRS* mpKerningPairs; - int mnKerningPairs; -#endif // GCP_KERN_HACK - -public: - int GetCachedGlyphWidth( int nCharCode ) const; - void CacheGlyphWidth( int nCharCode, int nCharWidth ); -private: - IntMap maWidthMap; -}; - -// ----------------------------------------------------------------------- - -inline void ImplOs2FontEntry::CacheGlyphWidth( int nCharCode, int nCharWidth ) -{ - maWidthMap[ nCharCode ] = nCharWidth; -} - -inline int ImplOs2FontEntry::GetCachedGlyphWidth( int nCharCode ) const -{ - IntMap::const_iterator it = maWidthMap.find( nCharCode ); - if( it == maWidthMap.end() ) - return -1; - return it->second; -} - -// ======================================================================= - -class Os2Layout : public SalLayout -{ -public: - Os2Layout( HDC, const ImplOs2FontData&, ImplOs2FontEntry& ); - virtual void InitFont() const; - void SetFontScale( float f ) { mfFontScale = f; } - float GetFontScale() const { return mfFontScale; } - -protected: - HPS mhPS; // OS2 device handle - FATTRS mhFont; - int mnBaseAdv; // x-offset relative to Layout origin - float mfFontScale; // allows metrics emulation of huge font sizes - - const ImplOs2FontData& mrOs2FontData; - ImplOs2FontEntry& mrOs2FontEntry; -}; - -// ======================================================================= - -class Os2SalLayout : public Os2Layout -{ -public: - Os2SalLayout( HPS, BYTE nCharSet, const ImplOs2FontData&, ImplOs2FontEntry& ); - virtual ~Os2SalLayout(); - - virtual bool LayoutText( ImplLayoutArgs& ); - virtual void AdjustLayout( ImplLayoutArgs& ); - virtual void DrawText( SalGraphics& ) const; - - virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&, - sal_Int32* pGlyphAdvances, int* pCharIndexes ) const; - - virtual long FillDXArray( long* pDXArray ) const; - virtual int GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const; - virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const; - - // for glyph+font+script fallback - virtual void MoveGlyph( int nStart, long nNewXPos ); - virtual void DropGlyph( int nStart ); - virtual void Simplify( bool bIsBase ); - -protected: - void Justify( long nNewWidth ); - void ApplyDXArray( const ImplLayoutArgs& ); - -protected: - -private: - int mnGlyphCount; - int mnCharCount; - sal_Unicode* mpOutGlyphs; - int* mpGlyphAdvances; // if possible this is shared with mpGlyphAdvances[] - int* mpGlyphOrigAdvs; - int* mpCharWidths; // map rel char pos to char width - int* mpChars2Glyphs; // map rel char pos to abs glyph pos - int* mpGlyphs2Chars; // map abs glyph pos to abs char pos - bool* mpGlyphRTLFlags; // BiDi status for glyphs: true=>RTL - mutable long mnWidth; - bool mbDisableGlyphs; - - int mnNotdefWidth; - BYTE mnCharSet; - -}; - -// ======================================================================= - -Os2Layout::Os2Layout( HPS hPS, const ImplOs2FontData& rWFD, ImplOs2FontEntry& rWFE ) -: mhPS( hPS ), - mnBaseAdv( 0 ), - mfFontScale( 1.0 ), - mrOs2FontData( rWFD ), - mrOs2FontEntry( rWFE ) -{ - BOOL fSuccess; - fSuccess = Ft2QueryLogicalFont( mhPS, LCID_BASE, NULL, &mhFont, sizeof(FATTRS)); -} - -// ----------------------------------------------------------------------- - -void Os2Layout::InitFont() const -{ - // select fallback level 0 font - APIRET rc = Ft2CreateLogFont( mhPS, NULL, LCID_BASE, (PFATTRS)&mhFont); -} - -// ======================================================================= - -Os2SalLayout::Os2SalLayout( HPS hPS, BYTE nCharSet, - const ImplOs2FontData& rOs2FontData, ImplOs2FontEntry& rOs2FontEntry ) -: Os2Layout( hPS, rOs2FontData, rOs2FontEntry ), - mnGlyphCount( 0 ), - mnCharCount( 0 ), - mpOutGlyphs( NULL ), - mpGlyphAdvances( NULL ), - mpGlyphOrigAdvs( NULL ), - mpCharWidths( NULL ), - mpChars2Glyphs( NULL ), - mpGlyphs2Chars( NULL ), - mpGlyphRTLFlags( NULL ), - mnWidth( 0 ), - mnNotdefWidth( -1 ), - mnCharSet( nCharSet ), - mbDisableGlyphs( false ) -{ - mbDisableGlyphs = true; -} - -// ----------------------------------------------------------------------- - -Os2SalLayout::~Os2SalLayout() -{ - delete[] mpGlyphRTLFlags; - delete[] mpGlyphs2Chars; - delete[] mpChars2Glyphs; - if( mpCharWidths != mpGlyphAdvances ) - delete[] mpCharWidths; - delete[] mpGlyphOrigAdvs; - delete[] mpGlyphAdvances; - delete[] mpOutGlyphs; -} - -// ----------------------------------------------------------------------- - -bool Os2SalLayout::LayoutText( ImplLayoutArgs& rArgs ) -{ - // prepare layout - // TODO: fix case when recyclying old Os2SalLayout object - mbDisableGlyphs |= ((rArgs.mnFlags & SAL_LAYOUT_DISABLE_GLYPH_PROCESSING) != 0); - mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos; - - if( !mbDisableGlyphs ) - { - // Win32 glyph APIs have serious problems with vertical layout - // => workaround is to use the unicode methods then - if( rArgs.mnFlags & SAL_LAYOUT_VERTICAL ) - mbDisableGlyphs = true; - else - // use cached value from font face - mbDisableGlyphs = mrOs2FontData.IsGlyphApiDisabled(); - } - - // TODO: use a cached value for bDisableAsianKern from upper layers - - // layout text - int i, j; - - mnGlyphCount = 0; - bool bVertical = (rArgs.mnFlags & SAL_LAYOUT_VERTICAL) != 0; - - // count the number of chars to process if no RTL run - rArgs.ResetPos(); - bool bHasRTL = false; - while( rArgs.GetNextRun( &i, &j, &bHasRTL ) && !bHasRTL ) - mnGlyphCount += j - i; - - // if there are RTL runs we need room to remember individual BiDi flags - if( bHasRTL ) - { - mpGlyphRTLFlags = new bool[ mnCharCount ]; - for( i = 0; i < mnCharCount; ++i ) - mpGlyphRTLFlags[i] = false; - } - - // rewrite the logical string if needed to prepare for the API calls - const sal_Unicode* pBidiStr = rArgs.mpStr + rArgs.mnMinCharPos; - if( (mnGlyphCount != mnCharCount) || bVertical ) - { - // we need to rewrite the pBidiStr when any of - // - BiDirectional layout - // - vertical layout - // - partial runs (e.g. with control chars or for glyph fallback) - // are involved - sal_Unicode* pRewrittenStr = (sal_Unicode*)alloca( mnCharCount * sizeof(sal_Unicode) ); - pBidiStr = pRewrittenStr; - - // note: glyph to char mapping is relative to first character - mpChars2Glyphs = new int[ mnCharCount ]; - mpGlyphs2Chars = new int[ mnCharCount ]; - for( i = 0; i < mnCharCount; ++i ) - mpChars2Glyphs[i] = mpGlyphs2Chars[i] = -1; - - mnGlyphCount = 0; - rArgs.ResetPos(); - bool bIsRTL = false; - while( rArgs.GetNextRun( &i, &j, &bIsRTL ) ) - { - do - { - // get the next leftmost character in this run - int nCharPos = bIsRTL ? --j : i++; - sal_Unicode cChar = rArgs.mpStr[ nCharPos ]; - - // in the RTL case mirror the character and remember its RTL status - if( bIsRTL ) - { - cChar = ::GetMirroredChar( cChar ); - mpGlyphRTLFlags[ mnGlyphCount ] = true; - } - - // for vertical writing use vertical alternatives - if( bVertical ) - { - sal_Unicode cVert = ::GetVerticalChar( cChar ); - if( cVert ) - cChar = cVert; - } - - // rewrite the original string - // update the mappings between original and rewritten string - pRewrittenStr[ mnGlyphCount ] = cChar; - mpGlyphs2Chars[ mnGlyphCount ] = nCharPos; - mpChars2Glyphs[ nCharPos - rArgs.mnMinCharPos ] = mnGlyphCount; - ++mnGlyphCount; - } while( i < j ); - } - } - - mpOutGlyphs = new sal_Unicode[ mnGlyphCount ]; - mpGlyphAdvances = new int[ mnGlyphCount ]; - - if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_PAIRS | SAL_LAYOUT_KERNING_ASIAN) ) - mpGlyphOrigAdvs = new int[ mnGlyphCount ]; - -#ifndef GCP_KERN_HACK - DWORD nGcpOption = 0; - // enable kerning if requested - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS ) - nGcpOption |= GCP_USEKERNING; -#endif // GCP_KERN_HACK - - LONG lLcid = Ft2QueryCharSet( mhPS); - - for( i = 0; i < mnGlyphCount; ++i ) - mpOutGlyphs[i] = pBidiStr[ i ]; - mnWidth = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - const sal_Unicode* pCodes = &pBidiStr[i]; - // check for surrogate pairs - if( (pCodes[0] & 0xFC00) == 0xDC00 ) - continue; - bool bSurrogate = ((pCodes[0] & 0xFC00) == 0xD800); - - // get the width of the corresponding code point - int nCharCode = pCodes[0]; - if( bSurrogate ) - nCharCode = 0x10000 + ((pCodes[0] & 0x03FF) << 10) + (pCodes[1] & 0x03FF); - int nGlyphWidth = mrOs2FontEntry.GetCachedGlyphWidth( nCharCode ); - if( nGlyphWidth == -1 ) - { - if (!Ft2QueryStringWidthW( mhPS, (LPWSTR)&pCodes[0], 1, (LONG*)&nGlyphWidth)) - nGlyphWidth = 0; - mrOs2FontEntry.CacheGlyphWidth( nCharCode, nGlyphWidth ); - } - mpGlyphAdvances[ i ] = nGlyphWidth; - mnWidth += nGlyphWidth; - - // remaining codes of surrogate pair get a zero width - if( bSurrogate ) - mpGlyphAdvances[ i+1 ] = 0; - - // check with the font face if glyph fallback is needed - if( mrOs2FontData.HasChar( nCharCode ) ) - continue; - // Type1 charmaps are not complete (or buggy), use FT2 to check again - if (Ft2FontSupportsUnicodeChar( mhPS, lLcid, TRUE, nCharCode)) - continue; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalLayout::LayoutText font does not support unicode char\n"); -#endif - // request glyph fallback at this position in the string - bool bRTL = mpGlyphRTLFlags ? mpGlyphRTLFlags[i] : false; - int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[i]: i + rArgs.mnMinCharPos; - rArgs.NeedFallback( nCharPos, bRTL ); - if( bSurrogate ) - rArgs.NeedFallback( nCharPos+1, bRTL ); - - if( rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK ) - { - // when we already are layouting for glyph fallback - // then a new unresolved glyph is not interesting - mnNotdefWidth = 0; - mpOutGlyphs[i] = DROPPED_OUTGLYPH; - if( mbDisableGlyphs && bSurrogate ) - mpOutGlyphs[i+1] = DROPPED_OUTGLYPH; - } - else - { - if( mnNotdefWidth < 0 ) - { - // get the width of the NotDef glyph - LONG aExtent; - mnNotdefWidth = 0; - if (Ft2QueryStringWidthW( mhPS, (LPWSTR)&rArgs.mpStr[ nCharPos ], 1, &aExtent)) - mnNotdefWidth = aExtent; - } - // use a better NotDef glyph - if( !mbDisableGlyphs ) - mpOutGlyphs[i] = 0; - } - - // replace the current glyph with the NotDef glyph - mnWidth += mnNotdefWidth - mpGlyphAdvances[i]; - mpGlyphAdvances[i] = mnNotdefWidth; - if( mpGlyphOrigAdvs ) - mpGlyphOrigAdvs[i] = mnNotdefWidth; - } - -#ifdef GCP_KERN_HACK - // apply kerning if the layout engine has not yet done it - if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_ASIAN|SAL_LAYOUT_KERNING_PAIRS) ) - { -#else // GCP_KERN_HACK - // apply just asian kerning - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) - { - if( !(rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) ) -#endif // GCP_KERN_HACK - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphOrigAdvs[i] = mpGlyphAdvances[i]; - - // #99658# also apply asian kerning on the substring border - int nLen = mnGlyphCount; - if( rArgs.mnMinCharPos + nLen < rArgs.mnLength ) - ++nLen; - for( i = 1; i < nLen; ++i ) - { -#ifdef GCP_KERN_HACK - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS ) - { - int nKernAmount = mrOs2FontEntry.GetKerning( pBidiStr[i-1], pBidiStr[i] ); - mpGlyphAdvances[ i-1 ] += nKernAmount; - mnWidth += nKernAmount; - } - else if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) -#endif // GCP_KERN_HACK - - if( (0x3000 == (0xFF00 & pBidiStr[i-1])) - && (0x3000 == (0xFF00 & pBidiStr[i])) ) - { - long nKernFirst = +CalcAsianKerning( pBidiStr[i-1], true, bVertical ); - long nKernNext = -CalcAsianKerning( pBidiStr[i], false, bVertical ); - - long nDelta = (nKernFirst < nKernNext) ? nKernFirst : nKernNext; - if( nDelta<0 && nKernFirst!=0 && nKernNext!=0 ) - { - nDelta = (nDelta * mpGlyphAdvances[i-1] + 2) / 4; - mpGlyphAdvances[i-1] += nDelta; - mnWidth += nDelta; - } - } - } - } - - // calculate virtual char widths - if( !mpGlyphs2Chars ) - mpCharWidths = mpGlyphAdvances; - else - { - mpCharWidths = new int[ mnCharCount ]; - for( i = 0; i < mnCharCount; ++i ) - mpCharWidths[ i ] = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - int j = mpGlyphs2Chars[ i ] - rArgs.mnMinCharPos; - if( j >= 0 ) - mpCharWidths[ j ] += mpGlyphAdvances[ i ]; - } - } - - // scale layout metrics if needed - if( mfFontScale != 1.0 ) - { - mnWidth *= mfFontScale; - mnBaseAdv *= mfFontScale; - for( i = 0; i < mnCharCount; ++i ) - mpCharWidths[ i ] *= mfFontScale; - if( mpGlyphAdvances != mpCharWidths ) - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphAdvances[ i ] *= mfFontScale; - if( mpGlyphOrigAdvs && (mpGlyphOrigAdvs != mpGlyphAdvances) ) - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphOrigAdvs[ i ] *= mfFontScale; - } - - return true; -} - -// ----------------------------------------------------------------------- - -int Os2SalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int& nStart, - sal_Int32* pGlyphAdvances, int* pCharIndexes ) const -{ - // return zero if no more glyph found - if( nStart >= mnGlyphCount ) - return 0; - - // calculate glyph position relative to layout base - // TODO: avoid for nStart!=0 case by reusing rPos - long nXOffset = mnBaseAdv; - for( int i = 0; i < nStart; ++i ) - nXOffset += mpGlyphAdvances[ i ]; - - // calculate absolute position in pixel units - Point aRelativePos( nXOffset, 0 ); - rPos = GetDrawPosition( aRelativePos ); - - int nCount = 0; - while( nCount < nLen ) - { - // update return values {nGlyphIndex,nCharPos,nGlyphAdvance} - long nGlyphIndex = mpOutGlyphs[ nStart ]; - if( mbDisableGlyphs ) - { - if( mnLayoutFlags & SAL_LAYOUT_VERTICAL ) - { - sal_Unicode cChar = (sal_Unicode)(nGlyphIndex & GF_IDXMASK); -#ifdef GNG_VERT_HACK - if( mrOs2FontData.HasGSUBstitutions( mhPS ) - && mrOs2FontData.IsGSUBstituted( cChar ) ) - nGlyphIndex |= GF_ROTL | GF_GSUB; - else -#endif // GNG_VERT_HACK - { - nGlyphIndex |= GetVerticalFlags( cChar ); - if( !(nGlyphIndex & GF_ROTMASK) ) - nGlyphIndex |= GF_VERT; - } - } - nGlyphIndex |= GF_ISCHAR; - } - ++nCount; - *(pGlyphs++) = nGlyphIndex; - if( pGlyphAdvances ) - *(pGlyphAdvances++) = mpGlyphAdvances[ nStart ]; - if( pCharIndexes ) - { - int nCharPos; - if( !mpGlyphs2Chars ) - nCharPos = nStart + mnMinCharPos; - else - nCharPos = mpGlyphs2Chars[nStart]; - *(pCharIndexes++) = nCharPos; - } - - // stop at last glyph - if( ++nStart >= mnGlyphCount ) - break; - - // stop when next x-position is unexpected - if( !pGlyphAdvances && mpGlyphOrigAdvs ) - if( mpGlyphAdvances[nStart-1] != mpGlyphOrigAdvs[nStart-1] ) - break; - } - - return nCount; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::DrawText( SalGraphics& rGraphics ) const -{ - if( mnGlyphCount <= 0 ) - return; - - Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) ); - POINTL aPt; - APIRET rc; - - aPt.x = aPos.X(); - aPt.y = static_cast<Os2SalGraphics&>(rGraphics).mnHeight - aPos.Y(); - - // ft2lib doesn't work with printer hps, so we fallback to codepage printing - // until cp1200 support will work. - if (static_cast<Os2SalGraphics&>(rGraphics).mbPrinter) { - // convert to codepage - ByteString str( mpOutGlyphs, gsl_getSystemTextEncoding() ); - // gliph size is not recalculated, so it could be wrong! - rc = Ft2CharStringPosAtA( static_cast<Os2SalGraphics&>(rGraphics).mhPS, - &aPt, NULL, CHS_VECTOR, mnGlyphCount, (PSZ)str.GetBuffer(), - (LONG*)mpGlyphAdvances, 0); - } else { - // try unicode rendering to screen - rc = Ft2CharStringPosAtW( static_cast<Os2SalGraphics&>(rGraphics).mhPS, - &aPt, NULL, CHS_VECTOR, mnGlyphCount, (LPWSTR)mpOutGlyphs, - (LONG*)mpGlyphAdvances, 0); - if (rc == GPI_ERROR) { - // if *W fails, convert to codepage and use *A (fallback to GPI into ft2) - ByteString str( mpOutGlyphs, gsl_getSystemTextEncoding() ); -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalLayout::DrawText HPS %08x PosAtW failed '%s'!\n",static_cast<Os2SalGraphics&>(rGraphics).mhPS,str.GetBuffer()); -#endif - // gliph size is not recalculated, so it could be wrong! - rc = Ft2CharStringPosAtA( static_cast<Os2SalGraphics&>(rGraphics).mhPS, - &aPt, NULL, CHS_VECTOR, mnGlyphCount, (PSZ)str.GetBuffer(), - (LONG*)mpGlyphAdvances, 0); - } - } -} - -// ----------------------------------------------------------------------- - -long Os2SalLayout::FillDXArray( long* pDXArray ) const -{ - if( !mnWidth ) - { - long mnWidth = mnBaseAdv; - for( int i = 0; i < mnGlyphCount; ++i ) - mnWidth += mpGlyphAdvances[ i ]; - } - - if( pDXArray != NULL ) - { - for( int i = 0; i < mnCharCount; ++i ) - pDXArray[ i ] = mpCharWidths[ i ]; - } - - return mnWidth; -} - -// ----------------------------------------------------------------------- - -int Os2SalLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const -// NOTE: the nFactor is used to prevent rounding errors for small nCharExtra values -{ - if( mnWidth ) - if( (mnWidth * nFactor + mnCharCount * nCharExtra) <= nMaxWidth ) - return STRING_LEN; - - long nExtraWidth = mnBaseAdv * nFactor; - for( int n = 0; n < mnCharCount; ++n ) - { - // skip unused characters - if( mpChars2Glyphs && (mpChars2Glyphs[n] < 0) ) - continue; - // add char widths until max - nExtraWidth += mpCharWidths[ n ] * nFactor; - if( nExtraWidth >= nMaxWidth ) - return (mnMinCharPos + n); - nExtraWidth += nCharExtra; - } - - return STRING_LEN; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const -{ - long nXPos = mnBaseAdv; - - if( !mpGlyphs2Chars ) - { - for( int i = 0; i < nMaxIdx; i += 2 ) - { - pCaretXArray[ i ] = nXPos; - nXPos += mpGlyphAdvances[ i>>1 ]; - pCaretXArray[ i+1 ] = nXPos; - } - } - else - { - int i; - for( i = 0; i < nMaxIdx; ++i ) - pCaretXArray[ i ] = -1; - - // assign glyph positions to character positions - for( i = 0; i < mnGlyphCount; ++i ) - { - int nCurrIdx = mpGlyphs2Chars[ i ] - mnMinCharPos; - long nXRight = nXPos + mpCharWidths[ nCurrIdx ]; - nCurrIdx *= 2; - if( !(mpGlyphRTLFlags && mpGlyphRTLFlags[i]) ) - { - // normal positions for LTR case - pCaretXArray[ nCurrIdx ] = nXPos; - pCaretXArray[ nCurrIdx+1 ] = nXRight; - } - else - { - // reverse positions for RTL case - pCaretXArray[ nCurrIdx ] = nXRight; - pCaretXArray[ nCurrIdx+1 ] = nXPos; - } - nXPos += mpGlyphAdvances[ i ]; - } - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::Justify( long nNewWidth ) -{ - long nOldWidth = mnWidth; - mnWidth = nNewWidth; - - if( mnGlyphCount <= 0 ) - return; - - if( nNewWidth == nOldWidth ) - return; - - // the rightmost glyph cannot be stretched - const int nRight = mnGlyphCount - 1; - nOldWidth -= mpGlyphAdvances[ nRight ]; - nNewWidth -= mpGlyphAdvances[ nRight ]; - - // count stretchable glyphs - int nStretchable = 0, i; - for( i = 0; i < nRight; ++i ) - if( mpGlyphAdvances[i] >= 0 ) - ++nStretchable; - - // stretch these glyphs - int nDiffWidth = nNewWidth - nOldWidth; - for( i = 0; (i < nRight) && (nStretchable > 0); ++i ) - { - if( mpGlyphAdvances[i] <= 0 ) - continue; - int nDeltaWidth = nDiffWidth / nStretchable; - mpGlyphAdvances[i] += nDeltaWidth; - --nStretchable; - nDiffWidth -= nDeltaWidth; - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) -{ - SalLayout::AdjustLayout( rArgs ); - - // adjust positions if requested - if( rArgs.mpDXArray ) - ApplyDXArray( rArgs ); - else if( rArgs.mnLayoutWidth ) - Justify( rArgs.mnLayoutWidth ); - else - return; - - // recalculate virtual char widths if they were changed - if( mpCharWidths != mpGlyphAdvances ) - { - int i; - if( !mpGlyphs2Chars ) - { - // standard LTR case - for( i = 0; i < mnGlyphCount; ++i ) - mpCharWidths[ i ] = mpGlyphAdvances[ i ]; - } - else - { - // BiDi or complex case - for( i = 0; i < mnCharCount; ++i ) - mpCharWidths[ i ] = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - int j = mpGlyphs2Chars[ i ] - rArgs.mnMinCharPos; - if( j >= 0 ) - mpCharWidths[ j ] += mpGlyphAdvances[ i ]; - } - } - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) -{ - // try to avoid disturbance of text flow for LSB rounding case; - const long* pDXArray = rArgs.mpDXArray; - - int i = 0; - long nOldWidth = mnBaseAdv; - for(; i < mnCharCount; ++i ) - { - int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i]; - if( j >= 0 ) - { - nOldWidth += mpGlyphAdvances[ j ]; - int nDiff = nOldWidth - pDXArray[ i ]; - - // disabled because of #104768# - // works great for static text, but problems when typing - // if( nDiff>+1 || nDiff<-1 ) - // only bother with changing anything when something moved - if( nDiff != 0 ) - break; - } - } - if( i >= mnCharCount ) - return; - - if( !mpGlyphOrigAdvs ) - { - mpGlyphOrigAdvs = new int[ mnGlyphCount ]; - for( i = 0; i < mnGlyphCount; ++i ) - mpGlyphOrigAdvs[ i ] = mpGlyphAdvances[ i ]; - } - - mnWidth = mnBaseAdv; - for( i = 0; i < mnCharCount; ++i ) - { - int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i]; - if( j >= 0 ) - mpGlyphAdvances[j] = pDXArray[i] - mnWidth; - mnWidth = pDXArray[i]; - } -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::MoveGlyph( int nStart, long nNewXPos ) -{ - if( nStart > mnGlyphCount ) - return; - - // calculate the current x-position of the requested glyph - // TODO: cache absolute positions - int nXPos = mnBaseAdv; - for( int i = 0; i < nStart; ++i ) - nXPos += mpGlyphAdvances[i]; - - // calculate the difference to the current glyph position - int nDelta = nNewXPos - nXPos; - - // adjust the width of the layout if it was already cached - if( mnWidth ) - mnWidth += nDelta; - - // depending on whether the requested glyph is leftmost in the layout - // adjust either the layout's or the requested glyph's relative position - if( nStart > 0 ) - mpGlyphAdvances[ nStart-1 ] += nDelta; - else - mnBaseAdv += nDelta; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::DropGlyph( int nStart ) -{ - mpOutGlyphs[ nStart ] = DROPPED_OUTGLYPH; -} - -// ----------------------------------------------------------------------- - -void Os2SalLayout::Simplify( bool bIsBase ) -{ - // return early if no glyph has been dropped - int i = mnGlyphCount; - while( (--i >= 0) && (mpOutGlyphs[ i ] != DROPPED_OUTGLYPH) ); - if( i < 0 ) - return; - - // convert the layout to a sparse layout if it is not already - if( !mpGlyphs2Chars ) - { - mpGlyphs2Chars = new int[ mnGlyphCount ]; - mpCharWidths = new int[ mnCharCount ]; - // assertion: mnGlyphCount == mnCharCount - for( int k = 0; k < mnGlyphCount; ++k ) - { - mpGlyphs2Chars[ k ] = mnMinCharPos + k; - mpCharWidths[ k ] = mpGlyphAdvances[ k ]; - } - } - - // remove dropped glyphs that are rightmost in the layout - for( i = mnGlyphCount; --i >= 0; ) - { - if( mpOutGlyphs[ i ] != DROPPED_OUTGLYPH ) - break; - if( mnWidth ) - mnWidth -= mpGlyphAdvances[ i ]; - int nRelCharPos = mpGlyphs2Chars[ i ] - mnMinCharPos; - if( nRelCharPos >= 0 ) - mpCharWidths[ nRelCharPos ] = 0; - } - mnGlyphCount = i + 1; - - // keep original glyph widths around - if( !mpGlyphOrigAdvs ) - { - mpGlyphOrigAdvs = new int[ mnGlyphCount ]; - for( int k = 0; k < mnGlyphCount; ++k ) - mpGlyphOrigAdvs[ k ] = mpGlyphAdvances[ k ]; - } - - // remove dropped glyphs inside the layout - int nNewGC = 0; - for( i = 0; i < mnGlyphCount; ++i ) - { - if( mpOutGlyphs[ i ] == DROPPED_OUTGLYPH ) - { - // adjust relative position to last valid glyph - int nDroppedWidth = mpGlyphAdvances[ i ]; - mpGlyphAdvances[ i ] = 0; - if( nNewGC > 0 ) - mpGlyphAdvances[ nNewGC-1 ] += nDroppedWidth; - else - mnBaseAdv += nDroppedWidth; - - // zero the virtual char width for the char that has a fallback - int nRelCharPos = mpGlyphs2Chars[ i ] - mnMinCharPos; - if( nRelCharPos >= 0 ) - mpCharWidths[ nRelCharPos ] = 0; - } - else - { - if( nNewGC != i ) - { - // rearrange the glyph array to get rid of the dropped glyph - mpOutGlyphs[ nNewGC ] = mpOutGlyphs[ i ]; - mpGlyphAdvances[ nNewGC ] = mpGlyphAdvances[ i ]; - mpGlyphOrigAdvs[ nNewGC ] = mpGlyphOrigAdvs[ i ]; - mpGlyphs2Chars[ nNewGC ] = mpGlyphs2Chars[ i ]; - } - ++nNewGC; - } - } - - mnGlyphCount = nNewGC; - if( mnGlyphCount <= 0 ) - mnWidth = mnBaseAdv = 0; -} - -// ======================================================================= - -SalLayout* Os2SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) -{ - Os2SalLayout* pLayout = NULL; - DBG_ASSERT( mpOs2FontEntry[nFallbackLevel], "WinSalGraphics mpWinFontEntry==NULL"); - - const ImplOs2FontData& rFontFace = *mpOs2FontData[ nFallbackLevel ]; - ImplOs2FontEntry& rFontInstance = *mpOs2FontEntry[ nFallbackLevel ]; - - { -#ifdef GCP_KERN_HACK - if( (rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) && !rFontInstance.HasKernData() ) - { - // TODO: directly cache kerning info in the rFontInstance - // TODO: get rid of kerning methods+data in WinSalGraphics object - GetKernPairs( 0, NULL ); - rFontInstance.SetKernData( mnFontKernPairCount, mpFontKernPairs ); - } -#endif // GCP_KERN_HACK - - pLayout = new Os2SalLayout( mhPS, 0, rFontFace, rFontInstance ); - } - - if( mfFontScale != 1.0 ) - pLayout->SetFontScale( mfFontScale ); - - return pLayout; -} - -// ======================================================================= - -ImplOs2FontEntry::ImplOs2FontEntry( ImplFontSelectData& rFSD ) -: ImplFontEntry( rFSD ), - maWidthMap( 512 ) -#ifdef GCP_KERN_HACK - ,mpKerningPairs( NULL ) - ,mnKerningPairs( -1 ) -#endif // GCP_KERN_HACK -{ -} - -// ----------------------------------------------------------------------- - -ImplOs2FontEntry::~ImplOs2FontEntry() -{ -#ifdef GCP_KERN_HACK - delete[] mpKerningPairs; -#endif // GCP_KERN_HACK -} - -// ----------------------------------------------------------------------- - -#ifdef GCP_KERN_HACK -bool ImplOs2FontEntry::HasKernData() const -{ - return (mnKerningPairs >= 0); -} - -// ----------------------------------------------------------------------- - -void ImplOs2FontEntry::SetKernData( int nPairCount, const KERNINGPAIRS* pPairData ) -{ - mnKerningPairs = nPairCount; - mpKerningPairs = new KERNINGPAIRS[ mnKerningPairs ]; - ::memcpy( mpKerningPairs, (const void*)pPairData, nPairCount*sizeof(KERNINGPAIRS) ); -} - -// ----------------------------------------------------------------------- - -int ImplOs2FontEntry::GetKerning( sal_Unicode cLeft, sal_Unicode cRight ) const -{ - int nKernAmount = 0; - if( mpKerningPairs ) - { - const KERNINGPAIRS aRefPair = { cLeft, cRight, 0 }; - const KERNINGPAIRS* pFirstPair = mpKerningPairs; - const KERNINGPAIRS* pEndPair = mpKerningPairs + mnKerningPairs; - const KERNINGPAIRS* pPair = std::lower_bound( pFirstPair, - pEndPair, aRefPair, ImplCmpKernData ); - if( (pPair != pEndPair) - && (pPair->sFirstChar == aRefPair.sFirstChar) - && (pPair->sSecondChar == aRefPair.sSecondChar) ) - nKernAmount = pPair->lKerningAmount; - } - - return nKernAmount; -} -#endif // GCP_KERN_HACK - -// ======================================================================= - -ImplFontData* ImplOs2FontData::Clone() const -{ - if( mpUnicodeMap ) - mpUnicodeMap->AddReference(); - ImplFontData* pClone = new ImplOs2FontData( *this ); - return pClone; -} - -// ----------------------------------------------------------------------- - -ImplFontEntry* ImplOs2FontData::CreateFontInstance( ImplFontSelectData& rFSD ) const -{ - ImplFontEntry* pEntry = new ImplOs2FontEntry( rFSD ); - return pEntry; -} - -// ======================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/salbmp.cxx b/vcl/os2/source/gdi/salbmp.cxx deleted file mode 100644 index c6ee24011212..000000000000 --- a/vcl/os2/source/gdi/salbmp.cxx +++ /dev/null @@ -1,740 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALBMP_CXX -#include <rtl/alloc.h> -#include <vcl/salbtype.hxx> -#include <salgdi.h> -#include <saldata.hxx> -#include <salbmp.h> -#include <vcl/bitmap.hxx> // for BitmapSystemData -#include <string.h> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ----------- -// - Inlines - -// ----------- - -inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex ) -{ - BYTE& rByte = pScanline[ nX >> 1 ]; - - ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( cIndex & 0x0f ) ) : - ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) ); -} - -// ------------- -// - Os2SalBitmap - -// ------------- - -Os2SalBitmap::Os2SalBitmap() : - mhDIB ( 0 ), - mhDIB1Subst ( 0 ), - mhDDB ( 0 ), - mnBitCount ( 0 ) -{ -} - -// ------------------------------------------------------------------ - -Os2SalBitmap::~Os2SalBitmap() -{ - Destroy(); -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ) -{ - BOOL bRet = TRUE; - - if( bDIB ) - mhDIB = (HANDLE) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, TRUE ) : hBitmap ); - else - mhDDB = (HBITMAP) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, FALSE ) : hBitmap ); - - if( mhDIB ) - { - // bitmap-header is the beginning of memory block - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) mhDIB; - - maSize = Size( pBIH->cx, pBIH->cy ); - mnBitCount = pBIH->cBitCount; - - if( mnBitCount ) - mnBitCount = ( mnBitCount <= 1 ) ? 1 : ( mnBitCount <= 4 ) ? 4 : ( mnBitCount <= 8 ) ? 8 : 24; - } - else if( mhDDB ) - { - BITMAPINFOHEADER2 aDDBInfoHeader; - - aDDBInfoHeader.cbFix = sizeof( aDDBInfoHeader ); - - if( GpiQueryBitmapInfoHeader( mhDDB, &aDDBInfoHeader ) ) - { - maSize = Size( aDDBInfoHeader.cx, aDDBInfoHeader.cy ); - mnBitCount = aDDBInfoHeader.cPlanes * aDDBInfoHeader.cBitCount; - - if( mnBitCount ) - { - mnBitCount = ( mnBitCount <= 1 ) ? 1 : - ( mnBitCount <= 4 ) ? 4 : - ( mnBitCount <= 8 ) ? 8 : 24; - } - } - else - { - mhDDB = 0; - bRet = FALSE; - } - - } - else - bRet = FALSE; - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ) -{ - bool bRet = FALSE; - - mhDIB = ImplCreateDIB( rSize, nBitCount, rPal ); - - if( mhDIB ) - { - maSize = rSize; - mnBitCount = nBitCount; - bRet = TRUE; - } - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const SalBitmap& rSSalBitmap ) -{ - bool bRet = FALSE; - const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - - if ( rSalBitmap.mhDIB || rSalBitmap.mhDDB ) - { - HANDLE hNewHdl = ImplCopyDIBOrDDB( rSalBitmap.mhDIB ? rSalBitmap.mhDIB : rSalBitmap.mhDDB, - rSalBitmap.mhDIB != 0 ); - - if( hNewHdl ) - { - if( rSalBitmap.mhDIB ) - mhDIB = (HANDLE) hNewHdl; - else if( rSalBitmap.mhDDB ) - mhDDB = (HBITMAP) hNewHdl; - - maSize = rSalBitmap.maSize; - mnBitCount = rSalBitmap.mnBitCount; - bRet = TRUE; - } - } - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const SalBitmap& rSSalBmp, SalGraphics* pSGraphics ) -{ - bool bRet = FALSE; - const Os2SalBitmap& rSalBmp = static_cast<const Os2SalBitmap&>(rSSalBmp); - Os2SalGraphics* pGraphics = static_cast<Os2SalGraphics*>(pSGraphics); - - if( rSalBmp.mhDIB ) - { - HPS hPS = pGraphics->mhPS; - HBITMAP hNewDDB; - BITMAPINFOHEADER2 aInfoHeader; - const Size aSize( rSalBmp.GetSize() ); - long nFormat[ 2 ]; - - memset( &aInfoHeader, 0, sizeof( aInfoHeader ) ); - aInfoHeader.cbFix = 16; - aInfoHeader.cx = aSize.Width(); - aInfoHeader.cy = aSize.Height(); - - GpiQueryDeviceBitmapFormats( hPS, 2L, (PLONG) &nFormat ); - aInfoHeader.cPlanes = nFormat[ 0 ]; - aInfoHeader.cBitCount = nFormat[ 1 ]; - - // ! wegen Postscript-Treiber - if( !aInfoHeader.cBitCount ) - aInfoHeader.cBitCount = 24; - else if( ( aInfoHeader.cPlanes == 1 ) && ( aInfoHeader.cBitCount == 1 ) ) - aInfoHeader.cBitCount = 4; - - // BitCount == 1 ist wegen aller moeglichen Treiberfehler nicht moeglich - if( rSalBmp.GetBitCount() == 1 ) - { - HANDLE hTmp = ImplCreateDIB4FromDIB1( rSalBmp.mhDIB ); - PBYTE pBits = (PBYTE) hTmp + *(ULONG*) hTmp + ImplGetDIBColorCount( hTmp ) * sizeof( RGB2 ); - - hNewDDB = GpiCreateBitmap( hPS, &aInfoHeader, CBM_INIT, pBits, (PBITMAPINFO2) hTmp ); - rtl_freeMemory( (void*)hTmp ); - } - else - { - PBYTE pBits = (PBYTE) rSalBmp.mhDIB + *(ULONG*) rSalBmp.mhDIB + ImplGetDIBColorCount( rSalBmp.mhDIB ) * sizeof( RGB2 ); - hNewDDB = GpiCreateBitmap( hPS, &aInfoHeader, CBM_INIT, pBits, (PBITMAPINFO2) rSalBmp.mhDIB ); - } - - aInfoHeader.cbFix = sizeof( aInfoHeader ); - - if( hNewDDB && GpiQueryBitmapInfoHeader( hNewDDB, &aInfoHeader ) ) - { - mhDDB = hNewDDB; - maSize = Size( aInfoHeader.cx, aInfoHeader.cy ); - mnBitCount = aInfoHeader.cPlanes * aInfoHeader.cBitCount; - - if( mnBitCount ) - { - mnBitCount = ( mnBitCount <= 1 ) ? 1 : - ( mnBitCount <= 4 ) ? 4 : - ( mnBitCount <= 8 ) ? 8 : 24; - } - - bRet = TRUE; - } - else if( hNewDDB ) - GpiDeleteBitmap( hNewDDB ); - } - - return bRet; -} - -// ------------------------------------------------------------------ - -bool Os2SalBitmap::Create( const SalBitmap& rSSalBmp, USHORT nNewBitCount ) -{ - bool bRet = FALSE; - const Os2SalBitmap& rSalBmp = static_cast<const Os2SalBitmap&>(rSSalBmp); - - if( rSalBmp.mhDDB ) - { - mhDIB = ImplCreateDIB( rSalBmp.maSize, nNewBitCount, BitmapPalette() ); - - if( mhDIB ) - { - // bitmap-header is the beginning of memory block - PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB; - const int nLines = (int) rSalBmp.maSize.Height(); - PBYTE pBits = (PBYTE) pBI + *(ULONG*) pBI + ImplGetDIBColorCount( mhDIB ) * sizeof( RGB2 ); - SIZEL aSizeL = { rSalBmp.maSize.Width(), nLines }; - HAB hAB = GetSalData()->mhAB; - DEVOPENSTRUC aDevOpenStruc = { NULL, (PSZ)"DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMemPS = Ft2CreatePS( hAB, hMemDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMemOld = (HBITMAP) Ft2SetBitmap( hMemPS, rSalBmp.mhDDB ); - - if( GpiQueryBitmapBits( hMemPS, 0, nLines, pBits, pBI ) == nLines ) - { - maSize = rSalBmp.maSize; - mnBitCount = nNewBitCount; - bRet = TRUE; - } - else - { - rtl_freeMemory( (void*)mhDIB ); - mhDIB = 0; - } - - Ft2SetBitmap( hMemPS, hMemOld ); - Ft2DestroyPS( hMemPS ); - DevCloseDC( hMemDC ); - } - } - - return bRet; -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::Destroy() -{ - if( mhDIB ) - rtl_freeMemory( (void*)mhDIB ); - else if( mhDDB ) - GpiDeleteBitmap( mhDDB ); - - if( mhDIB1Subst ) - { - rtl_freeMemory( (void*)mhDIB1Subst ); - mhDIB1Subst = NULL; - } - - maSize = Size(); - mnBitCount = 0; -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::ImplReplacehDIB1Subst( HANDLE hDIB1Subst ) -{ - if( mhDIB1Subst ) - rtl_freeMemory( (void*)mhDIB1Subst ); - - mhDIB1Subst = hDIB1Subst; -} - -// ------------------------------------------------------------------ - -USHORT Os2SalBitmap::ImplGetDIBColorCount( HANDLE hDIB ) -{ - USHORT nColors = 0; - - if( hDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) hDIB; - - if( pBIH->cBitCount <= 8 ) - { - if( pBIH->cclrUsed ) - nColors = (USHORT) pBIH->cclrUsed; - else - nColors = 1 << pBIH->cBitCount; - } - } - - return nColors; -} - -// ------------------------------------------------------------------ - -HANDLE Os2SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const BitmapPalette& rPal ) -{ - DBG_ASSERT( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24, "Unsupported BitCount!" ); - - HANDLE hDIB = 0; - - if ( rSize.Width() && rSize.Height() && ( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24 ) ) - { - const ULONG nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height(); - const USHORT nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0; - - hDIB = (HANDLE) rtl_allocateZeroMemory( sizeof( BITMAPINFOHEADER2 ) + nColors * sizeof( RGB2 ) + nImageSize ); - - if( hDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pBI = (PBITMAPINFO2) hDIB; - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI; - - pBIH->cbFix = sizeof( BITMAPINFOHEADER2 ); - pBIH->cx = rSize.Width(); - pBIH->cy = rSize.Height(); - pBIH->cPlanes = 1; - pBIH->cBitCount = nBits; - pBIH->ulCompression = BCA_UNCOMP; // BI_RGB; - pBIH->cbImage = nImageSize; - pBIH->cxResolution = 0; - pBIH->cyResolution = 0; - pBIH->cclrUsed = 0; - pBIH->cclrImportant = 0; - - // Rest auf 0 setzen - memset( (PBYTE) &pBIH->usUnits, 0, (PBYTE) pBI->argbColor - (PBYTE) &pBIH->usUnits ); - - if( nColors ) - { - const USHORT nMinCount = Min( nColors, rPal.GetEntryCount() ); - - if( nMinCount ) - memcpy( pBI->argbColor, rPal.ImplGetColorBuffer(), nMinCount * sizeof( RGB2 ) ); - } - } - } - - return hDIB; -} - -// ------------------------------------------------------------------ - -HANDLE Os2SalBitmap::ImplCreateDIB4FromDIB1( HANDLE hDIB1 ) -{ - PBITMAPINFO2 pBI = (PBITMAPINFO2) hDIB1; - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI; - PBYTE pBits = (PBYTE) pBI + *(ULONG*) pBIH + Os2SalBitmap::ImplGetDIBColorCount( hDIB1 ) * sizeof( RGB2 ); - ULONG nWidth = pBIH->cx, nHeight = pBIH->cy; - ULONG nAligned = AlignedWidth4Bytes( nWidth ); - ULONG nAligned4 = AlignedWidth4Bytes( nWidth << 2 ); - ULONG nSize4 = sizeof( BITMAPINFOHEADER2 ) + ( sizeof( RGB2 ) << 4 ) + nAligned4 * nHeight; - PBYTE pDIB4 = (PBYTE) rtl_allocateZeroMemory( nSize4 ); - PBITMAPINFO2 pBI4 = (PBITMAPINFO2) pDIB4; - PBITMAPINFOHEADER2 pBIH4 = (PBITMAPINFOHEADER2) pBI4; - BYTE aMap[ 4 ] = { 0x00, 0x01, 0x10, 0x11 }; - - memset( pBIH4, 0, sizeof( BITMAPINFOHEADER2 ) ); - pBIH4->cbFix = sizeof( BITMAPINFOHEADER2 ); - pBIH4->cx = nWidth; - pBIH4->cy = nHeight; - pBIH4->cPlanes = 1; - pBIH4->cBitCount = 4; - - // die ersten beiden Eintraege der 1Bit-Farbtabelle kopieren - memcpy( pBI4->argbColor, pBI->argbColor, sizeof( RGB2 ) << 1 ); - - PBYTE pBits4 = (PBYTE) pBI4 + *(ULONG*) pBIH4 + ( sizeof( RGB2 ) << 4 ); - - // 4Bit-DIB-Bilddaten setzen - for( ULONG nY = 0UL; nY < nHeight; nY++ ) - { - PBYTE pTmp = pBits; pBits += nAligned; - PBYTE pTmp4 = pBits4; pBits4 += nAligned4; - - for( ULONG nX = 0UL; nX < nWidth; nX += 8UL ) - { - *pTmp4++ = aMap[ ( *pTmp >> 6 ) & 3 ]; - *pTmp4++ = aMap[ ( *pTmp >> 4 ) & 3 ]; - *pTmp4++ = aMap[ ( *pTmp >> 2 ) & 3 ]; - *pTmp4++ = aMap[ *pTmp++ & 3 ]; - } - } - - return (HANDLE) pDIB4; -} - -// ------------------------------------------------------------------ - -HANDLE Os2SalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB ) -{ - HANDLE hCopy = 0; - - if( bDIB && hHdl ) - { - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) hHdl; - const ULONG nSize = sizeof( BITMAPINFOHEADER2 ) - + ImplGetDIBColorCount( hHdl ) * sizeof( RGB2 ) + - ( pBIH->cbImage ? pBIH->cbImage : AlignedWidth4Bytes( pBIH->cx * pBIH->cBitCount ) ); - - BYTE* pCopy = (BYTE*)rtl_allocateZeroMemory( nSize ); - memcpy( pCopy, (BYTE*) hHdl, nSize ); - hCopy = (HANDLE) pCopy; - } - else if( hHdl ) - { - HAB hAB = GetSalData()->mhAB; - HDC hSrcMemDC; - HDC hDestMemDC; - HPS hSrcMemPS; - HPS hDestMemPS; - HBITMAP hCopyBitmap; - BITMAPINFOHEADER2 aInfoHeader; - DEVOPENSTRUC aDevOpenStruc; - SIZEL size; - - aInfoHeader.cbFix = sizeof( BITMAPINFOHEADER2 ); - GpiQueryBitmapInfoHeader( hHdl, &aInfoHeader ); - size.cx = aInfoHeader.cx; - size.cy = aInfoHeader.cy; - - // Memory DCs erzeugen - aDevOpenStruc.pszLogAddress = 0; - aDevOpenStruc.pszDriverName = (PSZ)"DISPLAY"; - - hSrcMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 2, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - hDestMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 2, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - - // Memory PSs erzeugen - hSrcMemPS = Ft2CreatePS( hAB, hSrcMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - hDestMemPS = Ft2CreatePS( hAB, hDestMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - - Ft2SetBitmap( hSrcMemPS, hHdl ); - - if( !hHdl ) - { - memset( &aInfoHeader, 0, sizeof( BITMAPINFOHEADER2 ) ); - aInfoHeader.cbFix = sizeof( BITMAPINFOHEADER2 ); - aInfoHeader.cx = 0; - aInfoHeader.cy = 0; - aInfoHeader.cPlanes = 1; - aInfoHeader.cBitCount = 1; - } - - hCopy = GpiCreateBitmap( hDestMemPS, &aInfoHeader, 0, NULL, NULL ); - Ft2SetBitmap( hDestMemPS, hCopy ); - - POINTL pts[3]; - - pts[0].x = 0; - pts[0].y = 0; - pts[1].x = size.cx; - pts[1].y = size.cy; - pts[2].x = 0; - pts[2].y = 0; - - GpiBitBlt( hDestMemPS, hSrcMemPS, 3, pts, ROP_SRCCOPY, BBO_IGNORE ); - - Ft2SetBitmap( hSrcMemPS, (HBITMAP)0L); - Ft2SetBitmap( hDestMemPS, (HBITMAP)0L); - Ft2Associate( hSrcMemPS, NULLHANDLE ); - Ft2Associate( hDestMemPS, NULLHANDLE ); - Ft2DestroyPS( hSrcMemPS ); - Ft2DestroyPS( hDestMemPS ); - DevCloseDC( hSrcMemDC ); - DevCloseDC( hDestMemDC ); - } - - return hCopy; -} - -// ------------------------------------------------------------------ - -BitmapBuffer* Os2SalBitmap::AcquireBuffer( bool bReadOnly ) -{ - BitmapBuffer* pBuffer = NULL; - - if( mhDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB; - PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI; - - if( ( pBIH->ulCompression == BCA_RLE4 ) || ( pBIH->ulCompression == BCA_RLE8 ) ) - { - Size aSizePix( pBIH->cx, pBIH->cy ); - HANDLE hNewDIB = ImplCreateDIB( aSizePix, pBIH->cBitCount, BitmapPalette() ); - - if( hNewDIB ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pNewBI = (PBITMAPINFO2) hNewDIB; - PBITMAPINFOHEADER2 pNewBIH = (PBITMAPINFOHEADER2) pNewBI; - const USHORT nColorCount = ImplGetDIBColorCount( hNewDIB ); - const ULONG nOffset = *(ULONG*) pBI + nColorCount * sizeof( RGB2 ); - BYTE* pOldBits = (BYTE*) pBI + nOffset; - BYTE* pNewBits = (BYTE*) pNewBI + nOffset; - - memcpy( pNewBI, pBI, nOffset ); - pNewBIH->ulCompression = 0; - ImplDecodeRLEBuffer( pOldBits, pNewBits, aSizePix, pBIH->ulCompression == BCA_RLE4 ); - - rtl_freeMemory( (void*)mhDIB ); - - mhDIB = hNewDIB; - pBI = pNewBI; - pBIH = pNewBIH; - } - } - - if( pBIH->cPlanes == 1 ) - { - pBuffer = new BitmapBuffer; - - pBuffer->mnFormat = BMP_FORMAT_BOTTOM_UP | - ( pBIH->cBitCount == 1 ? BMP_FORMAT_1BIT_MSB_PAL : - pBIH->cBitCount == 4 ? BMP_FORMAT_4BIT_MSN_PAL : - pBIH->cBitCount == 8 ? BMP_FORMAT_8BIT_PAL : - pBIH->cBitCount == 16 ? BMP_FORMAT_16BIT_TC_LSB_MASK : - pBIH->cBitCount == 24 ? BMP_FORMAT_24BIT_TC_BGR : - pBIH->cBitCount == 32 ? BMP_FORMAT_32BIT_TC_MASK : 0UL ); - - if( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) ) - { - pBuffer->mnWidth = maSize.Width(); - pBuffer->mnHeight = maSize.Height(); - pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->cBitCount ); - pBuffer->mnBitCount = (USHORT) pBIH->cBitCount; - - if( pBuffer->mnBitCount <= 8 ) - { - const USHORT nPalCount = ImplGetDIBColorCount( mhDIB ); - - pBuffer->maPalette.SetEntryCount( nPalCount ); - - if( nPalCount ) - memcpy( pBuffer->maPalette.ImplGetColorBuffer(), pBI->argbColor, nPalCount * sizeof( RGB2 ) ); - - pBuffer->mpBits = (BYTE*) pBI + *(ULONG*) pBI + nPalCount * sizeof( RGB2 ); - } - else - pBuffer->mpBits = (BYTE*) pBI + *(ULONG*) pBI; - } - else - { - delete pBuffer; - pBuffer = NULL; - } - } - } - - if( pBuffer && mhDIB1Subst ) - { - rtl_freeMemory( (void*)mhDIB1Subst ); - mhDIB1Subst = 0; - } - - return pBuffer; -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) -{ - if( pBuffer ) - { - if( mhDIB ) - { - if( !bReadOnly && !!pBuffer->maPalette ) - { - // bitmap infos can be found at the beginning of the memory - PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB; - const USHORT nCount = pBuffer->maPalette.GetEntryCount(); - - if( nCount ) - memcpy( pBI->argbColor, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGB2 ) ); - } - } - - delete pBuffer; - } -} - -// ------------------------------------------------------------------ - -void Os2SalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, - const Size& rSizePixel, BOOL bRLE4 ) -{ - HPBYTE pRLE = (HPBYTE) pSrcBuf; - HPBYTE pDIB = (HPBYTE) pDstBuf; - HPBYTE pRow = (HPBYTE) pDstBuf; - ULONG nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) ); - HPBYTE pLast = pDIB + rSizePixel.Height() * nWidthAl - 1; - ULONG nCountByte; - ULONG nRunByte; - ULONG nX = 0; - ULONG i; - BYTE cTmp; - BOOL bEndDecoding = FALSE; - - if( pRLE && pDIB ) - { - do - { - if( !( nCountByte = *pRLE++ ) ) - { - nRunByte = *pRLE++; - - if( nRunByte > 2UL ) - { - if( bRLE4 ) - { - nCountByte = nRunByte >> 1UL; - - for( i = 0; i < nCountByte; i++ ) - { - cTmp = *pRLE++; - ImplSetPixel4( pDIB, nX++, cTmp >> 4 ); - ImplSetPixel4( pDIB, nX++, cTmp & 0x0f ); - } - - if( nRunByte & 1 ) - ImplSetPixel4( pDIB, nX++, *pRLE++ >> 4 ); - - if( ( ( nRunByte + 1 ) >> 1 ) & 1 ) - pRLE++; - } - else - { - memcpy( &pDIB[ nX ], pRLE, nRunByte ); - pRLE += nRunByte; - nX += nRunByte; - - if( nRunByte & 1 ) - pRLE++; - } - } - else if( !nRunByte ) - { - pDIB = ( pRow += nWidthAl ); - nX = 0UL; - } - else if( nRunByte == 1 ) - bEndDecoding = TRUE; - else - { - nX += *pRLE++; - pDIB = ( pRow += ( *pRLE++ ) * nWidthAl ); - } - } - else - { - cTmp = *pRLE++; - - if( bRLE4 ) - { - nRunByte = nCountByte >> 1; - - for( i = 0; i < nRunByte; i++ ) - { - ImplSetPixel4( pDIB, nX++, cTmp >> 4 ); - ImplSetPixel4( pDIB, nX++, cTmp & 0x0f ); - } - - if( nCountByte & 1 ) - ImplSetPixel4( pDIB, nX++, cTmp >> 4 ); - } - else - { - for( i = 0; i < nCountByte; i++ ) - pDIB[ nX++ ] = cTmp; - } - } - } - while( !bEndDecoding && ( pDIB <= pLast ) ); - } -} - -bool Os2SalBitmap::GetSystemData( BitmapSystemData& rData ) -{ - bool bRet = false; - if( mhDIB || mhDDB ) - { - bRet = true; - rData.pDIB = (void*)mhDIB; - rData.pDDB = (void*)mhDDB; - } - return bRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx deleted file mode 100644 index efd913c251b2..000000000000 --- a/vcl/os2/source/gdi/salgdi.cxx +++ /dev/null @@ -1,938 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <svpm.h> - -#define _SV_SALGDI_CXX -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salgdi.h> -#include <tools/debug.hxx> -#include <salframe.h> -#include <tools/poly.hxx> -#include <rtl/strbuf.hxx> -#include "vcl/region.h" - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ----------- -// - Defines - -// ----------- - -// ClipRegions funktionieren immer noch nicht auf allen getesteten Druckern -#define SAL_PRINTER_CLIPPATH 1 -// #define SAL_PRINTER_POLYPATH 1 - -// ======================================================================= - -void ImplInitSalGDI() -{ -} - -// ----------------------------------------------------------------------- - -void ImplFreeSalGDI() -{ - SalData* pSalData = GetSalData(); - - // delete icon cache - SalIcon* pIcon = pSalData->mpFirstIcon; - while( pIcon ) - { - SalIcon* pTmp = pIcon->pNext; - WinDestroyPointer( pIcon->hIcon ); - delete pIcon; - pIcon = pTmp; - } - -} - -// ======================================================================= - -void ImplSalInitGraphics( Os2SalGraphics* pData ) -{ - GpiCreateLogColorTable( pData->mhPS, LCOL_RESET, LCOLF_RGB, 0, 0, NULL ); -} - -// ----------------------------------------------------------------------- - -void ImplSalDeInitGraphics( Os2SalGraphics* pData ) -{ -} - -// ======================================================================= - -Os2SalGraphics::Os2SalGraphics() -{ - for( int i = 0; i < MAX_FALLBACK; ++i ) - { - mhFonts[ i ] = 0; - mpOs2FontData[ i ] = NULL; - mpOs2FontEntry[ i ] = NULL; - } - - mfFontScale = 1.0; - - mhPS = 0; - mhDC = 0; - mbLine = FALSE; - mbFill = FALSE; - mbXORMode = FALSE; - mnFontMetricCount = 0; - mpFontMetrics = NULL; - mpClipRectlAry = NULL; - - mhDefFont = 0; - mpFontKernPairs = NULL; - mnFontKernPairCount = 0; - mbFontKernInit = FALSE; - -} - -// ----------------------------------------------------------------------- - -Os2SalGraphics::~Os2SalGraphics() -{ - Ft2DeleteSetId( mhPS, LCID_BASE); - - if ( mpFontMetrics ) - delete mpFontMetrics; - - if ( mpFontKernPairs ) - delete mpFontKernPairs; - -} - -// ----------------------------------------------------------------------- - -static SalColor ImplGetROPSalColor( SalROPColor nROPColor ) -{ - SalColor nSalColor; - - switch( nROPColor ) - { - case SAL_ROP_0: - nSalColor = MAKE_SALCOLOR( 0, 0, 0 ); - break; - - case SAL_ROP_1: - case SAL_ROP_INVERT: - nSalColor = MAKE_SALCOLOR( 255, 255, 255 ); - break; - } - - return nSalColor; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::GetResolution( long& rDPIX, long& rDPIY ) -{ - // since OOo asks for DPI, I will query FONT_RES, which seems to be - // more correct than _RESOLUTION fields (on my wide screen lcd) - // and does not require conversion - DevQueryCaps( mhDC, CAPS_HORIZONTAL_FONT_RES, 1, &rDPIX ); - DevQueryCaps( mhDC, CAPS_VERTICAL_FONT_RES, 1, &rDPIY ); -} - -// ----------------------------------------------------------------------- - -USHORT Os2SalGraphics::GetBitCount() const -{ - LONG nBitCount; - DevQueryCaps( mhDC, CAPS_COLOR_BITCOUNT, 1, &nBitCount ); - return (USHORT)nBitCount; -} - -// ----------------------------------------------------------------------- - -long Os2SalGraphics::GetGraphicsWidth() const -{ - if( mhWnd ) - { - Os2SalFrame* pFrame = (Os2SalFrame*)GetWindowPtr( mhWnd ); - if( pFrame ) - { - if( pFrame->maGeometry.nWidth ) - return pFrame->maGeometry.nWidth; - else - { - // TODO: perhaps not needed, maGeometry should always be up-to-date - RECTL aRect; - WinQueryWindowRect( mhWnd, &aRect ); - return aRect.xRight; - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::ResetClipRegion() -{ -#ifdef SAL_PRINTER_CLIPPATH - if ( mbPrinter ) - GpiSetClipPath( mhPS, 0, SCP_RESET ); - else -#endif - { - HRGN hOldRegion; - - GpiSetClipRegion( mhPS, NULL, &hOldRegion ); - if ( hOldRegion ) - GpiDestroyRegion( mhPS, hOldRegion ); - } -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::setClipRegion( const Region& i_rClip ) -{ - ULONG nCount = i_rClip.GetRectCount(); - - mpClipRectlAry = new RECTL[ nCount ]; - mnClipElementCount = 0; - - ImplRegionInfo aInfo; - long nX, nY, nW, nH; - bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); - while( bRegionRect ) - { - if ( nW && nH ) - { - RECTL* pClipRect = &mpClipRectlAry[ mnClipElementCount ]; - pClipRect->xLeft = nX; - pClipRect->yTop = mnHeight - nY; - pClipRect->xRight = nX + nW; - pClipRect->yBottom = mnHeight - (nY + nH); - mnClipElementCount++; - } - bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); - } -#ifdef SAL_PRINTER_CLIPPATH - if ( mbPrinter ) - { - GpiSetClipPath( mhPS, 0, SCP_RESET ); - GpiBeginPath( mhPS, 1L ); - - for( int i = 0; i < mnClipElementCount; i++ ) - { - POINTL aPt; - RECTL* pClipRect = &mpClipRectlAry[ i ]; - - aPt.x = pClipRect->xLeft; - aPt.y = pClipRect->yTop-1; - Ft2Move( mhPS, &aPt ); - - aPt.x = pClipRect->xRight-1; - aPt.y = pClipRect->yBottom; - - Ft2Box( mhPS, DRO_OUTLINE, &aPt, 0, 0 ); - } - - GpiEndPath( mhPS ); - GpiSetClipPath( mhPS, 1L, SCP_ALTERNATE | SCP_AND ); - } - else -#endif - { - HRGN hClipRegion = GpiCreateRegion( mhPS, - mnClipElementCount, - mpClipRectlAry ); - HRGN hOldRegion; - - GpiSetClipRegion( mhPS, hClipRegion, &hOldRegion ); - if( hOldRegion ) - GpiDestroyRegion( mhPS, hOldRegion ); - } - - delete [] mpClipRectlAry; - - return true; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetLineColor() -{ - // don't draw line! - mbLine = FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetLineColor( SalColor nSalColor ) -{ - LINEBUNDLE lb; - - // set color - lb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - 0, - &lb ); - - // draw line! - mbLine = TRUE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetFillColor() -{ - // don't fill area! - mbFill = FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetFillColor( SalColor nSalColor ) -{ - AREABUNDLE ab; - - // set color - ab.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - - Ft2SetAttrs( mhPS, - PRIM_AREA, - ABB_COLOR, - 0, - &ab ); - - // fill area! - mbFill = TRUE; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetXORMode( bool bSet, bool ) -{ - mbXORMode = bSet; - LONG nMixMode = bSet ? FM_XOR : FM_OVERPAINT; - - // set mix mode for lines - LINEBUNDLE lb; - lb.usMixMode = nMixMode; - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_MIX_MODE, - 0, - &lb ); - - // set mix mode for areas - AREABUNDLE ab; - ab.usMixMode = nMixMode; - Ft2SetAttrs( mhPS, - PRIM_AREA, - ABB_MIX_MODE, - 0, - &ab ); - - // set mix mode for text - CHARBUNDLE cb; - cb.usMixMode = nMixMode; - Ft2SetAttrs( mhPS, - PRIM_CHAR, - CBB_MIX_MODE, - 0, - &cb ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetROPLineColor( SalROPColor nROPColor ) -{ - SetLineColor( ImplGetROPSalColor( nROPColor ) ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::SetROPFillColor( SalROPColor nROPColor ) -{ - SetFillColor( ImplGetROPSalColor( nROPColor ) ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPixel( long nX, long nY ) -{ - POINTL aPt; - - aPt.x = nX; - aPt.y = TY( nY ); - - // set color - Ft2SetPel( mhPS, &aPt ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) -{ - // save old color - LINEBUNDLE oldLb; - GpiQueryAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - &oldLb ); - - // set new color - LINEBUNDLE lb; - lb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - 0, - &lb ); - - // set color of pixel - POINTL aPt; - aPt.x = nX; - aPt.y = TY( nY ); - Ft2SetPel( mhPS, &aPt ); - - // restore old color - Ft2SetAttrs( mhPS, - PRIM_LINE, - LBB_COLOR, - 0, - &oldLb ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) -{ - // OS2 zeichnet den Endpunkt mit - POINTL aPt; - aPt.x = nX1; - aPt.y = TY( nY1 ); - Ft2Move( mhPS, &aPt ); - aPt.x = nX2; - aPt.y = TY( nY2 ); - GpiLine( mhPS, &aPt ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) -{ - POINTL aPt; - long lControl; - - if ( mbFill ) - { - if ( mbLine ) - lControl = DRO_OUTLINEFILL; - else - lControl = DRO_FILL; - } - else - { - if ( mbLine ) - lControl = DRO_OUTLINE; - else - return; - } - - aPt.x = nX; - aPt.y = TY( nY ); - Ft2Move( mhPS, &aPt ); - aPt.x = nX + nWidth - 1; - aPt.y = TY( nY + nHeight - 1 ); - Ft2Box( mhPS, lControl, &aPt, 0, 0 ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) -{ - // convert all points to sys orientation - POINTL* pOS2PtAry = new POINTL[ nPoints ]; - POINTL* pTempOS2PtAry = pOS2PtAry; - const SalPoint* pTempPtAry = pPtAry; - ULONG nTempPoints = nPoints; - long nHeight = mnHeight - 1; - - while( nTempPoints-- ) - { - (*pTempOS2PtAry).x = (*pTempPtAry).mnX; - (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY; - pTempOS2PtAry++; - pTempPtAry++; - } - - Ft2Move( mhPS, pOS2PtAry ); - GpiPolyLine( mhPS, nPoints, pOS2PtAry ); - delete [] pOS2PtAry; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) -{ - PM_POLYGON aPolygon; - - // create polygon - aPolygon.aPointl = new POINTL[ nPoints ]; - aPolygon.ulPoints = nPoints; - - // convert all points to sys orientation - POINTL* pTempOS2PtAry = aPolygon.aPointl; - const SalPoint* pTempPtAry = pPtAry; - ULONG nTempPoints = nPoints; - long nHeight = mnHeight - 1; - - while( nTempPoints-- ) - { - (*pTempOS2PtAry).x = (*pTempPtAry).mnX; - (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY; - pTempOS2PtAry++; - pTempPtAry++; - } - - // Innenleben zeichnen - if ( mbFill ) - { -#ifdef SAL_PRINTER_POLYPATH - if ( mbPrinter ) - { - Ft2BeginPath( mhPS, 1 ); - Ft2Move( mhPS, aPolygon.aPointl ); - Ft2PolyLine( mhPS, aPolygon.ulPoints, aPolygon.aPointl ); - Ft2EndPath( mhPS ); - Ft2FillPath( mhPS, 1, 0 ); - - if ( mbLine ) - { - Ft2Move( mhPS, aPolygon.aPointl ); - Ft2PolyLine( mhPS, aPolygon.ulPoints, aPolygon.aPointl ); - } - } - else -#endif - { - ULONG nOptions = POLYGON_ALTERNATE; - - if ( mbLine ) - nOptions |= POLYGON_BOUNDARY; - else - nOptions |= POLYGON_NOBOUNDARY; - - Ft2Move( mhPS, aPolygon.aPointl ); - GpiPolygons( mhPS, 1, &aPolygon, nOptions, POLYGON_EXCL ); - } - } - else - { - if ( mbLine ) - { - Ft2Move( mhPS, aPolygon.aPointl ); - GpiPolyLine( mhPS, nPoints, aPolygon.aPointl ); - } - } - - delete [] aPolygon.aPointl; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, - PCONSTSALPOINT* pPtAry ) -{ - ULONG i; - long nHeight = mnHeight - 1; - PM_POLYGON* aPolygonAry = new PM_POLYGON[ nPoly ]; - - for( i = 0; i < nPoly; i++ ) - { - const SalPoint * pTempPtAry = (const SalPoint*)pPtAry[ i ]; - - // create polygon - ULONG nTempPoints = pPoints[ i ]; - POINTL * pTempOS2PtAry = new POINTL[ nTempPoints ]; - - // convert all points to sys orientation - aPolygonAry[ i ].ulPoints = nTempPoints; - aPolygonAry[ i ].aPointl = pTempOS2PtAry; - - while( nTempPoints-- ) - { - (*pTempOS2PtAry).x = (*pTempPtAry).mnX; - (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY; - pTempOS2PtAry++; - pTempPtAry++; - } - } - - // Innenleben zeichnen - if ( mbFill ) - { -#ifdef SAL_PRINTER_POLYPATH - if ( mbPrinter ) - { - Ft2BeginPath( mhPS, 1 ); - for ( i = 0; i < nPoly; i++ ) - { - Ft2Move( mhPS, aPolygonAry[i].aPointl ); - Ft2PolyLine( mhPS, aPolygonAry[i].ulPoints, aPolygonAry[i].aPointl ); - } - Ft2EndPath( mhPS ); - Ft2FillPath( mhPS, 1, 0 ); - } - else -#endif - { - ULONG nOptions = POLYGON_ALTERNATE; - - if ( mbLine ) - nOptions |= POLYGON_BOUNDARY; - else - nOptions |= POLYGON_NOBOUNDARY; - - Ft2Move( mhPS, aPolygonAry[ 0 ].aPointl ); - GpiPolygons( mhPS, nPoly, aPolygonAry, nOptions, POLYGON_EXCL ); - } - } - else - { - if ( mbLine ) - { - for( i = 0; i < nPoly; i++ ) - { - Ft2Move( mhPS, aPolygonAry[ i ].aPointl ); - GpiPolyLine( mhPS, aPolygonAry[ i ].ulPoints, aPolygonAry[ i ].aPointl ); - } - } - } - - // cleanup - for( i = 0; i < nPoly; i++ ) - delete [] aPolygonAry[ i ].aPointl; - delete [] aPolygonAry; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/ ) -{ - // TODO: implement and advertise OutDevSupport_B2DDraw support - return false; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawPolyLine( - const basegfx::B2DPolygon& /*rPolygon*/, - double /*fTransparency*/, - const basegfx::B2DVector& /*rLineWidths*/, - basegfx::B2DLineJoin /*eLineJoin*/) -{ - // TODO: implement - return false; -} - -// ----------------------------------------------------------------------- - -sal_Bool Os2SalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool Os2SalGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool Os2SalGraphics::drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, - const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) -{ - return sal_False; -} - -// ======================================================================= - -// MAXIMUM BUFSIZE EQ 0xFFFF -#define POSTSCRIPT_BUFSIZE 0x4000 -// we only try to get the BoundingBox in the first 4096 bytes -#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 - -static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize ) -{ - while ( nComp-- >= nSize ) - { - ULONG i; - for ( i = 0; i < nSize; i++ ) - { - if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) - break; - } - if ( i == nSize ) - return pSource; - pSource++; - } - return NULL; -} - - -static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ) -{ - BOOL bRetValue = FALSE; - BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nSize, 14 ); - if ( pDest ) - { - nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0; - pDest += 14; - - int nSizeLeft = nSize - ( pDest - pSource ); - if ( nSizeLeft > 100 ) - nSizeLeft = 100; // only 100 bytes following the bounding box will be checked - - int i; - for ( i = 0; ( i < 4 ) && nSizeLeft; i++ ) - { - int nDivision = 1; - BOOL bDivision = FALSE; - BOOL bNegative = FALSE; - BOOL bValid = TRUE; - - while ( ( --nSizeLeft ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++; - BYTE nByte = *pDest; - while ( nSizeLeft && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) ) - { - switch ( nByte ) - { - case '.' : - if ( bDivision ) - bValid = FALSE; - else - bDivision = TRUE; - break; - case '-' : - bNegative = TRUE; - break; - default : - if ( ( nByte < '0' ) || ( nByte > '9' ) ) - nSizeLeft = 1; // error parsing the bounding box values - else if ( bValid ) - { - if ( bDivision ) - nDivision*=10; - nNumb[i] *= 10; - nNumb[i] += nByte - '0'; - } - break; - } - nSizeLeft--; - nByte = *(++pDest); - } - if ( bNegative ) - nNumb[i] = -nNumb[i]; - if ( bDivision && ( nDivision != 1 ) ) - nNumb[i] /= nDivision; - } - if ( i == 4 ) - bRetValue = TRUE; - } - return bRetValue; -} - -inline void ImplWriteString( BYTE** pBuf, const char* sString ) -{ - strcpy( (char*)*pBuf, sString ); - *pBuf += strlen( sString ); -} - -BOOL Os2SalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) -{ - if ( !mbPrinter ) - return FALSE; - - BOOL bRet = FALSE; - LONG nLong = 0; - if ( !(DevQueryCaps( mhDC, CAPS_TECHNOLOGY, 1, &nLong ) && - (CAPS_TECH_POSTSCRIPT == nLong)) ) - return FALSE; - - BYTE* pBuf = new BYTE[ POSTSCRIPT_BUFSIZE ]; - double nBoundingBox[4]; - - if ( pBuf && ImplGetBoundingBox( nBoundingBox, (BYTE*)pPtr, nSize ) ) - { - LONG pOS2DXAry[4]; // hack -> print always 2 white space - POINTL aPt; - aPt.x = 0; - aPt.y = 0; - PCH pStr = (PCH) " "; - for( long i = 0; i < 4; i++ ) - pOS2DXAry[i] = i; - Ft2CharStringPosAt( mhPS, &aPt, NULL, 0, 2, (PCH)pStr,(PLONG)&pOS2DXAry[0] ); - - OStringBuffer aBuf( POSTSCRIPT_BUFSIZE ); - - // reserve place for a USHORT - aBuf.append( "aa" ); - - // #107797# Write out EPS encapsulation header - // ---------------------------------------------------------------------------------- - - // directly taken from the PLRM 3.0, p. 726. Note: - // this will definitely cause problems when - // recursively creating and embedding PostScript files - // in OOo, since we use statically-named variables - // here (namely, b4_Inc_state_salWin, dict_count_salWin and - // op_count_salWin). Currently, I have no idea on how to - // work around that, except from scanning and - // interpreting the EPS for unused identifiers. - - // append the real text - aBuf.append( "\n\n/b4_Inc_state_salWin save def\n" - "/dict_count_salWin countdictstack def\n" - "/op_count_salWin count 1 sub def\n" - "userdict begin\n" - "/showpage {} def\n" - "0 setgray 0 setlinecap\n" - "1 setlinewidth 0 setlinejoin\n" - "10 setmiterlimit [] 0 setdash newpath\n" - "/languagelevel where\n" - "{\n" - " pop languagelevel\n" - " 1 ne\n" - " {\n" - " false setstrokeadjust false setoverprint\n" - " } if\n" - "} if\n\n" ); - - // #107797# Write out buffer - // ---------------------------------------------------------------------------------- - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); - //Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); - DevEscape( mhDC, DEVESC_RAWDATA, aBuf.getLength(), - (PBYTE)aBuf.getStr(), 0, NULL ); - - double dM11 = nWidth / ( nBoundingBox[2] - nBoundingBox[0] ); - double dM22 = - ( nHeight / (nBoundingBox[1] - nBoundingBox[3] ) ); - - // reserve a USHORT again - aBuf.setLength( 2 ); - aBuf.append( "\n\n[" ); - aBuf.append( dM11 ); - aBuf.append( " 0 0 " ); - aBuf.append( dM22 ); - aBuf.append( ' ' ); - aBuf.append( nX - ( dM11 * nBoundingBox[0] ) ); - aBuf.append( ' ' ); - aBuf.append( nY - ( dM22 * nBoundingBox[3] ) ); - aBuf.append( "] concat\n" - "%%BeginDocument:\n" ); - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); - DevEscape( mhDC, DEVESC_RAWDATA, aBuf.getLength(), - (PBYTE)aBuf.getStr(), 0, NULL ); - { - UINT32 nToDo = nSize; - UINT32 nDoNow; - bRet = TRUE; - while( nToDo && bRet ) - { - nDoNow = 0x4000; - if ( nToDo < nDoNow ) - nDoNow = nToDo; - - if ( DevEscape( mhDC, DEVESC_RAWDATA, nDoNow, (PBYTE)pPtr + nSize - nToDo, - 0, NULL ) == -1 ) - bRet = FALSE; - nToDo -= nDoNow; - } - - if ( bRet ) - { - strcpy ( (char*)pBuf, "\nrestore\n" ); - if ( DevEscape( mhDC, DEVESC_RAWDATA, 9, (PBYTE)pBuf, - 0, NULL ) == DEV_OK ) bRet = TRUE; - } - - // #107797# Write out EPS encapsulation footer - // ---------------------------------------------------------------------------------- - // reserve a USHORT again - aBuf.setLength( 2 ); - aBuf.append( "%%EndDocument\n" - "count op_count_salWin sub {pop} repeat\n" - "countdictstack dict_count_salWin sub {end} repeat\n" - "b4_Inc_state_salWin restore\n\n" ); - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); - DevEscape( mhDC, DEVESC_RAWDATA, aBuf.getLength(), - (PBYTE)aBuf.getStr(), 0, NULL ); - bRet = TRUE; - - } - } - delete [] pBuf; - return bRet; -} - -/* - * IsNativeControlSupported() - * - * Returns TRUE if the platform supports native - * drawing of the control defined by nPart - */ -BOOL Os2SalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) -{ - return( FALSE ); -} - -// ----------------------------------------------------------------------- - -SystemGraphicsData Os2SalGraphics::GetGraphicsData() const -{ - SystemGraphicsData aRes; - aRes.nSize = sizeof(aRes); - return aRes; -} - -// ----------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/salgdi2.cxx b/vcl/os2/source/gdi/salgdi2.cxx deleted file mode 100644 index 2ab59b8a3c46..000000000000 --- a/vcl/os2/source/gdi/salgdi2.cxx +++ /dev/null @@ -1,786 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include <svpm.h> - -#define _SV_SALGDI2_CXX -#include <salbmp.h> -#include <saldata.hxx> -#include <salids.hrc> -#include <salgdi.h> -#include <salvd.h> -#include <vcl/salbtype.hxx> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -BOOL bFastTransparent = FALSE; - -// ----------- -// - Defines - -// ----------- - -#define RGBCOLOR( r, g, b ) ((ULONG)(((BYTE)(b)|((USHORT)(g)<<8))|(((ULONG)(BYTE)(r))<<16))) -#define TY( y ) (mnHeight-(y)-1) - -// --------------- -// - SalGraphics - -// --------------- - -bool Os2SalGraphics::supportsOperation( OutDevSupportType ) const -{ - return false; -} - - -void Os2SalGraphics::copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ) -{ - HPS hSrcPS; - POINTL thePoints[4]; - long nSrcHeight; - - if ( pSrcGraphics ) - { - //hSrcPS = pSrcGraphics->mhPS; - //nSrcHeight = pSrcGraphics->mnHeight; - hSrcPS = static_cast<Os2SalGraphics*>(pSrcGraphics)->mhPS; - nSrcHeight = static_cast<Os2SalGraphics*>(pSrcGraphics)->mnHeight; - } - else - { - hSrcPS = mhPS; - nSrcHeight = mnHeight; - } - - // lower-left corner of target - thePoints[0].x = pPosAry->mnDestX; - thePoints[0].y = TY( pPosAry->mnDestY + pPosAry->mnDestHeight - 1 ); - - // upper-right corner of target - thePoints[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth; - thePoints[1].y = TY( pPosAry->mnDestY - 1 ); - - // lower-left corner of source - thePoints[2].x = pPosAry->mnSrcX; - thePoints[2].y = nSrcHeight - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight ); - - if ( ( pPosAry->mnDestWidth != pPosAry->mnSrcWidth ) || ( pPosAry->mnDestHeight != pPosAry->mnSrcHeight ) ) - { - // upper-right corner of Source - thePoints[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth; - thePoints[3].y = nSrcHeight - pPosAry->mnSrcY + pPosAry->mnSrcHeight; - - GpiBitBlt( mhPS, hSrcPS, 4, thePoints, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE ); - } - else - { - GpiBitBlt( mhPS, hSrcPS, 3, thePoints, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::copyArea( long nDestX, long nDestY, - long nSrcX, long nSrcY, - long nSrcWidth, long nSrcHeight, - USHORT nFlags ) -{ - POINTL thePoints[3]; - - // lower-left corner of target - thePoints[0].x = nDestX; - thePoints[0].y = TY( nDestY + nSrcHeight - 1 ); - - // upper-right corner of target - thePoints[1].x = nDestX + nSrcWidth; - thePoints[1].y = TY( nDestY - 1 ); - - // lower-left corner of source - thePoints[2].x = nSrcX; - thePoints[2].y = TY( nSrcY + nSrcHeight - 1); - - if ( (nFlags & SAL_COPYAREA_WINDOWINVALIDATE) && mbWindow ) - { - // Overlap-Bereich berechnen und invalidieren - Point aVCLSrcPos( nSrcX, nSrcY ); - Size aVCLSrcSize( nSrcWidth, nSrcHeight ); - Rectangle aVCLSrcRect( aVCLSrcPos, aVCLSrcSize ); - Rectangle aVCLClipRect; - SWP aSWP; - - WinQueryWindowPos( mhWnd, &aSWP ); - aVCLClipRect.Right() = aSWP.cx-1; - aVCLClipRect.Bottom() = aSWP.cy-1; - if ( !aVCLSrcRect.Intersection( aVCLClipRect ).IsEmpty() ) - { - RECTL aSrcRect; - RECTL aTempRect; - HRGN hInvalidateRgn; - HRGN hTempRgn; - HWND hWnd; - long nRgnType; - - long nVCLScrHeight = aVCLSrcRect.GetHeight(); - aSrcRect.xLeft = aVCLSrcRect.Left(); - aSrcRect.yBottom = TY( aVCLSrcRect.Top()+nVCLScrHeight-1 ); - aSrcRect.xRight = aSrcRect.xLeft+aVCLSrcRect.GetWidth(); - aSrcRect.yTop = aSrcRect.yBottom+nVCLScrHeight; - - // Rechteck in Screen-Koordinaaten umrechnen - POINTL aPt; - long nScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - long nScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); - aPt.x = 0; - aPt.y = 0; - WinMapWindowPoints( mhWnd, HWND_DESKTOP, &aPt, 1 ); - aSrcRect.xLeft += aPt.x; - aSrcRect.yTop += aPt.y; - aSrcRect.xRight += aPt.x; - aSrcRect.yBottom += aPt.y; - hInvalidateRgn = 0; - // Bereiche ausserhalb des sichtbaren Bereiches berechnen - if ( aSrcRect.xLeft < 0 ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = -31999; - aTempRect.yBottom = 0; - aTempRect.xRight = 0; - aTempRect.yTop = 31999; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - if ( aSrcRect.yBottom < 0 ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = 0; - aTempRect.yBottom = -31999; - aTempRect.xRight = 31999; - aTempRect.yTop = 0; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - if ( aSrcRect.xRight > nScreenDX ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = nScreenDX; - aTempRect.yBottom = 0; - aTempRect.xRight = 31999; - aTempRect.yTop = 31999; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - if ( aSrcRect.yTop > nScreenDY ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = 0; - aTempRect.yBottom = nScreenDY; - aTempRect.xRight = 31999; - aTempRect.yTop = 31999; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - - // Bereiche die von anderen Fenstern ueberlagert werden berechnen - // Calculate areas that are overlapped by other windows - HWND hWndParent = WinQueryWindow( mhWnd, QW_PARENT ); - hWnd = WinQueryWindow( HWND_DESKTOP, QW_TOP ); - aVCLSrcRect = Rectangle( aSrcRect.xLeft, aSrcRect.yBottom, aSrcRect.xRight, aSrcRect.yTop ); - while ( hWnd ) - { - if ( hWnd == hWndParent ) - break; - if ( WinIsWindowVisible( hWnd ) ) - { - WinQueryWindowPos( hWnd, &aSWP ); - if ( !(aSWP.fl & SWP_MINIMIZE) ) - { - aVCLClipRect = Rectangle( Point( aSWP.x, aSWP.y ), Size( aSWP.cx, aSWP.cy ) ); - if ( aVCLSrcRect.IsOver( aVCLClipRect ) ) - { - if ( !hInvalidateRgn ) - hInvalidateRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - aTempRect.xLeft = aSWP.x; - aTempRect.yBottom = aSWP.y; - aTempRect.xRight = aTempRect.xLeft+aSWP.cx; - aTempRect.yTop = aTempRect.yBottom+aSWP.cy; - hTempRgn = GpiCreateRegion( mhPS, 1, &aTempRect ); - GpiCombineRegion( mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - } - } - } - hWnd = WinQueryWindow( hWnd, QW_NEXT ); - } - - if ( hInvalidateRgn ) - { - hTempRgn = GpiCreateRegion( mhPS, 1, &aSrcRect ); - nRgnType = GpiCombineRegion( mhPS, hInvalidateRgn, hTempRgn, hInvalidateRgn, CRGN_DIFF ); - GpiDestroyRegion( mhPS, hTempRgn ); - if ( (nRgnType != RGN_ERROR) && (nRgnType != RGN_NULL) ) - { - long nOffX = (nDestX-nSrcX); - long nOffY = (nSrcY-nDestY); - aPt.x = nOffX-aPt.x; - aPt.y = nOffY-aPt.y; - GpiOffsetRegion( mhPS, hInvalidateRgn, &aPt ); - WinInvalidateRegion( mhWnd, hInvalidateRgn, TRUE ); - // Hier loesen wir nur ein Update aus, wenn es der - // MainThread ist, damit es beim Bearbeiten der - // Paint-Message keinen Deadlock gibt, da der - // SolarMutex durch diesen Thread schon gelockt ist - SalData* pSalData = GetSalData(); - ULONG nCurThreadId = GetCurrentThreadId(); - if ( pSalData->mnAppThreadId == nCurThreadId ) - WinUpdateWindow( mhWnd ); - } - GpiDestroyRegion( mhPS, hInvalidateRgn ); - } - } - } - - GpiBitBlt( mhPS, mhPS, 3, thePoints, - ROP_SRCCOPY, BBO_IGNORE ); - -} - -// ----------------------------------------------------------------------- - -void ImplDrawBitmap( HPS hPS, long nScreenHeight, - const SalTwoRect* pPosAry, const Os2SalBitmap& rSalBitmap, - BOOL bPrinter, int nDrawMode ) -{ - if( hPS ) - { - HANDLE hDrawDIB; - HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB(); - Os2SalBitmap* pTmpSalBmp = NULL; - BOOL bPrintDDB = ( bPrinter && hDrawDDB ); - BOOL bDrawDDB1 = ( ( rSalBitmap.GetBitCount() == 1 ) && hDrawDDB ); - - if( bPrintDDB || bDrawDDB1 ) - { - pTmpSalBmp = new Os2SalBitmap; - pTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() ); - hDrawDIB = pTmpSalBmp->ImplGethDIB(); - } - else - hDrawDIB = rSalBitmap.ImplGethDIB(); - - if( hDrawDIB ) - { - HANDLE hSubst = rSalBitmap.ImplGethDIB1Subst(); - POINTL pts[ 4 ]; - BITMAPINFO2* pBI = (BITMAPINFO2*) hDrawDIB; - BITMAPINFOHEADER2* pBIH = (BITMAPINFOHEADER2*) pBI; - const long nHeight = pBIH->cy; - long nInfoSize = *(ULONG*) pBI + rSalBitmap.ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGB2 ); - BYTE* pBits = (BYTE*) pBI + nInfoSize; - - pts[0].x = pPosAry->mnDestX; - pts[0].y = nScreenHeight - pPosAry->mnDestY - pPosAry->mnDestHeight; - pts[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth - 1; - pts[1].y = nScreenHeight - pPosAry->mnDestY - 1; - - pts[2].x = pPosAry->mnSrcX; - pts[2].y = nHeight - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight ); - pts[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth; - pts[3].y = nHeight - pPosAry->mnSrcY; - - // if we've got a 1Bit DIB, we create a 4Bit substitute - if( ( pBIH->cBitCount == 1 ) && !hSubst ) - { - // create 4Bit substitute - hSubst = Os2SalBitmap::ImplCreateDIB4FromDIB1( hDrawDIB ); - - // replace substitute only, if it is no temporary SalBitmap - if( !( bPrintDDB || bDrawDDB1 ) ) - ( (Os2SalBitmap&) rSalBitmap ).ImplReplacehDIB1Subst( hSubst ); - } - - if( hSubst ) - { - pBI = (BITMAPINFO2*) hSubst; - pBIH = (BITMAPINFOHEADER2*) pBI; - nInfoSize = *(ULONG*) pBI + rSalBitmap.ImplGetDIBColorCount( hSubst ) * sizeof( RGB2 ); - pBits = (BYTE*) pBI + nInfoSize; - } - - if( bPrinter ) - { - BYTE* pDummy; - - // expand 8Bit-DIB's to 24Bit-DIB's, because some printer drivers - // have problems to print these DIB's (strange) - if( pBIH->cBitCount == 8 && pBIH->ulCompression == BCA_UNCOMP ) - { - const long nWidth = pBIH->cx; - const long nHeight = pBIH->cy; - const long nWidthAl8 = AlignedWidth4Bytes( nWidth * 8 ); - const long nWidthAl24 = AlignedWidth4Bytes( nWidth * 24 ); - const long nNewImageSize = nHeight * nWidthAl24; - BITMAPINFOHEADER2* pNewInfo; - - pDummy = new BYTE[ sizeof( BITMAPINFO2 ) + nNewImageSize ]; - memset( pDummy, 0, sizeof( BITMAPINFO2 ) ); - - pNewInfo = (BITMAPINFOHEADER2*) pDummy; - pNewInfo->cbFix = sizeof( BITMAPINFOHEADER2 ); - pNewInfo->cx = nWidth; - pNewInfo->cy = nHeight; - pNewInfo->cPlanes = 1; - pNewInfo->cBitCount = 24; - pNewInfo->ulCompression = BCA_UNCOMP; - pNewInfo->cbImage = nNewImageSize; - - BYTE* pBitsSrc = (BYTE*) pBIH + nInfoSize; - BYTE* pBitsDst = pDummy + sizeof( BITMAPINFO2 ); - - for( long nY = 0UL; nY < nHeight; nY++ ) - { - BYTE* pSrcLine = pBitsSrc + nY * nWidthAl8; - BYTE* pDstLine = pBitsDst + nY * nWidthAl24; - - for( long nX = 0UL; nX < nWidth; nX++ ) - { - const RGB2& rQuad = pBI->argbColor[ *pSrcLine++ ]; - - *pDstLine++ = rQuad.bBlue; - *pDstLine++ = rQuad.bGreen; - *pDstLine++ = rQuad.bRed; - } - } - - nInfoSize = sizeof( BITMAPINFO2 ); - } - else - { - const long nImageSize = ( pBIH->cbImage ? pBIH->cbImage : ( pBIH->cy * AlignedWidth4Bytes( pBIH->cx * pBIH->cBitCount ) ) ); - const long nTotalSize = nInfoSize + nImageSize; - - pDummy = new BYTE[ nTotalSize ]; - memcpy( pDummy, pBI, nTotalSize ); - } - - GpiDrawBits( hPS, pDummy + nInfoSize, (BITMAPINFO2*) pDummy, 4L, pts, nDrawMode, BBO_IGNORE ); - delete[] pDummy; - } - else - GpiDrawBits( hPS, pBits, pBI, 4L, pts, nDrawMode, BBO_IGNORE ); - } - else if( hDrawDDB && !bPrintDDB ) - { - POINTL pts[ 4 ]; - - pts[0].x = pPosAry->mnDestX; - pts[0].y = nScreenHeight - pPosAry->mnDestY - pPosAry->mnDestHeight; - pts[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth - 1; - pts[1].y = nScreenHeight - pPosAry->mnDestY - 1; - - pts[2].x = pPosAry->mnSrcX; - pts[2].y = rSalBitmap.GetSize().Height() - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight ); - pts[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth; - pts[3].y = rSalBitmap.GetSize().Height() - pPosAry->mnSrcY; - - GpiWCBitBlt( hPS, hDrawDDB, 4L, pts, nDrawMode, BBO_IGNORE ); -/* - HPS hDrawPS = ImplGetCachedPS( CACHED_HPS_DRAW, hDrawDDB ); - Ft2BitBlt( hPS, hDrawPS, 4, pts, nDrawMode, BBO_IGNORE ); - ImplReleaseCachedPS( CACHED_HPS_DRAW ); -*/ - } - - if( bPrintDDB || bDrawDDB1 ) - delete pTmpSalBmp; - } -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap ) -{ - ImplDrawBitmap( mhPS, mnHeight, - pPosAry, static_cast<const Os2SalBitmap&>(rSalBitmap), - mbPrinter, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSalBitmap, - SalColor nTransparentColor ) -{ - DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); - //const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - // an FM: kann erst einmal unberuecksichtigt bleiben - drawBitmap( pPosAry, rSalBitmap ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawBitmap( const SalTwoRect* pPosAry, - const SalBitmap& rSSalBitmap, - const SalBitmap& rSTransparentBitmap ) -{ - DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); - - const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - const Os2SalBitmap& rTransparentBitmap = static_cast<const Os2SalBitmap&>(rSTransparentBitmap); - - if( bFastTransparent ) - { - ImplDrawBitmap( mhPS, mnHeight, pPosAry, rTransparentBitmap, FALSE, ROP_SRCAND ); - ImplDrawBitmap( mhPS, mnHeight, pPosAry, rSalBitmap, FALSE, ROP_SRCPAINT ); - } - else - { - SalTwoRect aPosAry = *pPosAry; - int nDstX = (int) aPosAry.mnDestX; - int nDstY = (int) aPosAry.mnDestY; - int nDstWidth = (int) aPosAry.mnDestWidth; - int nDstHeight = (int) aPosAry.mnDestHeight; - HAB hAB = GetSalData()->mhAB; - HPS hPS = mhPS; - DEVOPENSTRUC aDevOpenStruc = { NULL, (PSZ)"DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - SIZEL aSizeL = { nDstWidth, nDstHeight }; - POINTL aPtL[ 3 ]; - - HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMemPS = Ft2CreatePS( hAB, hMemDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMemBitmap = ImplCreateVirDevBitmap( hMemDC, hMemPS, nDstWidth, nDstHeight, 0 ); - HBITMAP hMemOld = (HBITMAP) Ft2SetBitmap( hMemPS, hMemBitmap ); - HDC hMaskDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMaskPS = Ft2CreatePS( hAB, hMaskDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMaskBitmap = ImplCreateVirDevBitmap( hMaskDC, hMaskPS, nDstWidth, nDstHeight, 0 ); - HBITMAP hMaskOld = (HBITMAP) Ft2SetBitmap( hMaskPS, hMaskBitmap ); -/* - HPS hMemPS = ImplGetCachedPS( CACHED_HPS_1, 0 ); - HPS hMaskPS = ImplGetCachedPS( CACHED_HPS_2, 0 ); -*/ - aPosAry.mnDestX = aPosAry.mnDestY = 0L; - - aPtL[ 0 ].x = 0; - aPtL[ 0 ].y = 0; - aPtL[ 1 ].x = nDstWidth; - aPtL[ 1 ].y = nDstHeight; - aPtL[ 2 ].x = nDstX; - aPtL[ 2 ].y = TY( nDstY + nDstHeight - 1 ); - - GpiBitBlt( hMemPS, hPS, 3, aPtL, ROP_SRCCOPY, BBO_IGNORE ); - ImplDrawBitmap( hMaskPS, nDstHeight, &aPosAry, rTransparentBitmap, FALSE, ROP_SRCCOPY ); - - aPtL[ 2 ].x = 0; - aPtL[ 2 ].y = 0; - - GpiBitBlt( hMemPS, hMaskPS, 3, aPtL, ROP_SRCAND, BBO_IGNORE ); - ImplDrawBitmap( hMaskPS, nDstHeight, &aPosAry, rSalBitmap, FALSE, ROP_SRCERASE ); - GpiBitBlt( hMemPS, hMaskPS, 3, aPtL, ROP_SRCPAINT, BBO_IGNORE ); - - aPtL[ 0 ].x = nDstX; - aPtL[ 0 ].y = TY( nDstY + nDstHeight - 1 ); - aPtL[ 1 ].x = nDstX + nDstWidth; - aPtL[ 1 ].y = TY( nDstY - 1 ); - - GpiBitBlt( hPS, hMemPS, 3, aPtL, ROP_SRCCOPY, BBO_IGNORE ); - - Ft2SetBitmap( hMaskPS, hMaskOld ); - Ft2DestroyPS( hMaskPS ); - DevCloseDC( hMaskDC ); - GpiDeleteBitmap( hMaskBitmap ); - - Ft2SetBitmap( hMemPS, hMemOld ); - Ft2DestroyPS( hMemPS ); - DevCloseDC( hMemDC ); - GpiDeleteBitmap( hMemBitmap ); - -/* - ImplReleaseCachedPS( CACHED_HPS_1 ); - ImplReleaseCachedPS( CACHED_HPS_2 ); -*/ - } -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, - const SalBitmap& rSrcBitmap, - const SalBitmap& rAlphaBmp ) -{ - // TODO(P3) implement alpha blending - return false; -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::drawAlphaRect( long nX, long nY, long nWidth, - long nHeight, sal_uInt8 nTransparency ) -{ - // TODO(P3) implement alpha blending - return false; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::drawMask( const SalTwoRect* pPosAry, - const SalBitmap& rSSalBitmap, - SalColor nMaskColor ) -{ - DBG_ASSERT( !mbPrinter, "No transparency print possible!" ); - - const Os2SalBitmap& rSalBitmap = static_cast<const Os2SalBitmap&>(rSSalBitmap); - - SalTwoRect aPosAry = *pPosAry; - HPS hPS = mhPS; - IMAGEBUNDLE aBundle, aOldBundle; - AREABUNDLE aAreaBundle, aOldAreaBundle; - const ULONG nColor = RGBCOLOR( SALCOLOR_RED( nMaskColor ), - SALCOLOR_GREEN( nMaskColor ), - SALCOLOR_BLUE( nMaskColor ) ); - - GpiQueryAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, &aOldBundle ); - aBundle.lColor = RGBCOLOR( 0, 0, 0 ); - aBundle.lBackColor = RGBCOLOR( 0xFF, 0xFF, 0xFF ); - Ft2SetAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, 0, &aBundle ); - - GpiQueryAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL | - ABB_MIX_MODE | ABB_BACK_MIX_MODE, &aOldAreaBundle ); - aAreaBundle.lColor = nColor; - aAreaBundle.lBackColor = nColor; - aAreaBundle.usSymbol = PATSYM_SOLID; - aAreaBundle.usMixMode = FM_OVERPAINT; - aAreaBundle.usBackMixMode = BM_OVERPAINT; - Ft2SetAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL | - ABB_MIX_MODE | ABB_BACK_MIX_MODE, 0, &aAreaBundle ); - - ImplDrawBitmap( hPS, mnHeight, &aPosAry, rSalBitmap, FALSE, 0x00B8L ); - - Ft2SetAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, 0, &aOldBundle ); - Ft2SetAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL | - ABB_MIX_MODE | ABB_BACK_MIX_MODE, 0, &aOldAreaBundle ); -} - -// ----------------------------------------------------------------------- - -SalBitmap* Os2SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) -{ - HAB hAB = GetSalData()->mhAB; - SIZEL size = { nDX, nDY }; - Os2SalBitmap* pSalBitmap = NULL; - - // create device context (at this time allways display compatible) - DEVOPENSTRUC aDevOpenStruc = { NULL, (PSZ)"DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - HPS hMemPS = Ft2CreatePS( hAB, hMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - HBITMAP hMemBmp = ImplCreateVirDevBitmap( hMemDC, hMemPS, nDX, nDY, 0 ); - HBITMAP hMemOld = Ft2SetBitmap( hMemPS, hMemBmp ); - - // creation successfull? - if( hMemDC && hMemPS && hMemBmp ) - { - POINTL thePoints[ 3 ]; - - // lower-left corner of target - thePoints[ 0 ].x = 0; - thePoints[ 0 ].y = 0; - - // upper-right corner of target - thePoints[ 1 ].x = nDX; - thePoints[ 1 ].y = nDY; - - // lower-left corner of source - thePoints[ 2 ].x = nX; - thePoints[ 2 ].y = TY( nY + nDY - 1 ); - - long lHits = GpiBitBlt( hMemPS, mhPS, 3, thePoints, - mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE ); - - if( hMemPS ) - { - Ft2SetBitmap( hMemPS, hMemOld ); - Ft2DestroyPS( hMemPS ); - } - - if( hMemDC ) - DevCloseDC( hMemDC ); - - if( lHits == GPI_OK ) - { - pSalBitmap = new Os2SalBitmap; - - if( !pSalBitmap->Create( hMemBmp, FALSE, FALSE ) ) - { - delete pSalBitmap; - pSalBitmap = NULL; - } - } - } - - if( !pSalBitmap ) - GpiDeleteBitmap( hMemBmp ); - - // return pointer to SAL-Bitmap - return pSalBitmap; -} - -// ----------------------------------------------------------------------- - -SalColor Os2SalGraphics::getPixel( long nX, long nY ) -{ - POINTL aPt = { nX, TY( nY ) }; - LONG nColor = Ft2QueryPel( mhPS, &aPt ); - - return MAKE_SALCOLOR( (BYTE) ( nColor >> 16 ), (BYTE) ( nColor >> 8 ), (BYTE) nColor ); -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) -{ - if( nFlags & SAL_INVERT_TRACKFRAME ) - { - // save old vylues - LINEBUNDLE oldLb; - LINEBUNDLE lb; - GpiQueryAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, &oldLb ); - - // set linetype to short dash - lb.lColor = RGBCOLOR( 255, 255, 255 ); - lb.usMixMode = FM_XOR; - lb.usType = LINETYPE_ALTERNATE; - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &lb ); - - // draw inverted box - POINTL aPt; - - aPt.x = nX; - aPt.y = TY( nY ); - - Ft2Move( mhPS, &aPt ); - - aPt.x = nX + nWidth - 1; - aPt.y = TY( nY + nHeight - 1 ); - - Ft2Box( mhPS, DRO_OUTLINE, &aPt, 0, 0 ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &oldLb ); - - } - else - { - // save old values - AREABUNDLE oldAb; - AREABUNDLE ab; - - GpiQueryAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, &oldAb ); - - // set fill color to black - ab.lColor = RGBCOLOR( 255, 255, 255 ); - ab.usMixMode = FM_XOR; - ab.usSymbol = (nFlags & SAL_INVERT_50) ? PATSYM_DENSE5 : PATSYM_SOLID; - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &ab ); - - // draw inverted box - POINTL aPt; - - aPt.x = nX; - aPt.y = TY( nY ); - - Ft2Move( mhPS, &aPt ); - - aPt.x = nX + nWidth - 1; - aPt.y = TY( nY + nHeight - 1 ); - - Ft2Box( mhPS, DRO_FILL, &aPt, 0, 0 ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &oldAb ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ) -{ - if( nFlags & SAL_INVERT_TRACKFRAME ) - { - // save old vylues - LINEBUNDLE oldLb; - LINEBUNDLE lb; - GpiQueryAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, &oldLb ); - - // set linetype to short dash - lb.lColor = RGBCOLOR( 255, 255, 255 ); - lb.usMixMode = FM_XOR; - lb.usType = LINETYPE_ALTERNATE; - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &lb ); - - // Draw Polyline - drawPolyLine( nPoints, pPtAry ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &oldLb ); - } - else - { - // save old values - AREABUNDLE oldAb; - AREABUNDLE ab; - - GpiQueryAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, &oldAb ); - - // set fill color to black - ab.lColor = RGBCOLOR( 255, 255, 255 ); - ab.usMixMode = FM_XOR; - ab.usSymbol = (nFlags & SAL_INVERT_50) ? PATSYM_DENSE5 : PATSYM_SOLID; - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &ab ); - - // Draw Polyline - drawPolygon( nPoints, pPtAry ); - - // restore old values - Ft2SetAttrs( mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &oldAb ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx deleted file mode 100644 index 63fd79b8fa2e..000000000000 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ /dev/null @@ -1,1701 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define INCL_GRE_STRINGS -#define INCL_GPI -#define INCL_DOS - -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <svpm.h> - -#define _SV_SALGDI3_CXX -#include <rtl/tencinfo.h> -#include <osl/file.hxx> -#include <osl/thread.hxx> -#include <osl/process.h> -#include <vcl/svapp.hxx> -#include <saldata.hxx> -#include <salgdi.h> -#include <vcl/font.hxx> -#include <vcl/sallayout.hxx> -#include <tools/poly.hxx> -#include <tools/debug.hxx> -#include <rtl/textcvt.h> -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salgdi.h> -#include <vcl/outfont.hxx> -#include <sallayout.h> -#include <tools/poly.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -#include "sft.hxx" - -#ifdef GCP_KERN_HACK -#include <algorithm> -#endif - -using namespace vcl; - -// ----------- -// - Inlines - -// ----------- - - -inline W32FIXED FixedFromDouble( double d ) -{ - const long l = (long) ( d * 65536. ); - return *(W32FIXED*) &l; -} - -// ----------------------------------------------------------------------- - -inline int IntTimes256FromFixed(W32FIXED f) -{ - int nFixedTimes256 = (f.value << 8) + ((f.fract+0x80) >> 8); - return nFixedTimes256; -} - -// ----------- -// - Defines - -// ----------- - -// this is a special codepage code, used to identify OS/2 symbol font. -#define SYMBOL_CHARSET 65400 - -// ======================================================================= - -UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen = STRING_LEN) -{ - return UniString( pStr, nLen, gsl_getSystemTextEncoding(), - RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT ); -} - -// ======================================================================= - -static USHORT ImplSalToCharSet( CharSet eCharSet ) -{ - // !!! Fuer DBCS-Systeme muss dieser Code auskommentiert werden und 0 - // !!! zurueckgegeben werden, solange die DBCS-Charsets nicht - // !!! durchgereicht werden - - switch ( eCharSet ) - { - case RTL_TEXTENCODING_IBM_437: - return 437; - - case RTL_TEXTENCODING_IBM_850: - return 850; - - case RTL_TEXTENCODING_IBM_860: - return 860; - - case RTL_TEXTENCODING_IBM_861: - return 861; - - case RTL_TEXTENCODING_IBM_863: - return 863; - - case RTL_TEXTENCODING_IBM_865: - return 865; - case RTL_TEXTENCODING_MS_1252: - return 1004; - case RTL_TEXTENCODING_SYMBOL: - return 65400; - } - - return 0; -} - -// ----------------------------------------------------------------------- - -static CharSet ImplCharSetToSal( USHORT usCodePage ) -{ - switch ( usCodePage ) - { - case 437: - return RTL_TEXTENCODING_IBM_437; - - case 850: - return RTL_TEXTENCODING_IBM_850; - - case 860: - return RTL_TEXTENCODING_IBM_860; - - case 861: - return RTL_TEXTENCODING_IBM_861; - - case 863: - return RTL_TEXTENCODING_IBM_863; - - case 865: - return RTL_TEXTENCODING_IBM_865; - case 1004: - return RTL_TEXTENCODING_MS_1252; - case 65400: - return RTL_TEXTENCODING_SYMBOL; - } - - return RTL_TEXTENCODING_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -static FontFamily ImplFamilyToSal( BYTE bFamilyType ) -{ - switch ( bFamilyType ) - { - case 4: - return FAMILY_DECORATIVE; - case 3: - return FAMILY_SCRIPT; - } - - return FAMILY_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -static FontWeight ImplWeightToSal( USHORT nWeight ) -{ - // Falls sich jemand an die alte Doku gehalten hat - if ( nWeight > 999 ) - nWeight /= 1000; - - switch ( nWeight ) - { - case 1: - return WEIGHT_THIN; - - case 2: - return WEIGHT_ULTRALIGHT; - - case 3: - return WEIGHT_LIGHT; - - case 4: - return WEIGHT_SEMILIGHT; - - case 5: - return WEIGHT_NORMAL; - - case 6: - return WEIGHT_SEMIBOLD; - - case 7: - return WEIGHT_BOLD; - - case 8: - return WEIGHT_ULTRABOLD; - - case 9: - return WEIGHT_BLACK; - } - - return WEIGHT_DONTKNOW; -} - -// ----------------------------------------------------------------------- - -static UniString ImpStyleNameToSal( const char* pFamilyName, - const char* pFaceName, - USHORT nLen ) -{ - if ( !nLen ) - nLen = strlen(pFamilyName); - - // strip FamilyName from FaceName - if ( strncmp( pFamilyName, pFaceName, nLen ) == 0 ) - { - USHORT nFaceLen = (USHORT)strlen( pFaceName+nLen ); - // Ist Facename laenger, schneiden wir den FamilyName ab - if ( nFaceLen > 1 ) - return UniString( pFaceName+(nLen+1), gsl_getSystemTextEncoding()); - else - return UniString(); - } - else - return UniString( pFaceName, gsl_getSystemTextEncoding()); -} - -// ----------------------------------------------------------------------- - -inline FontPitch ImplLogPitchToSal( BYTE fsType ) -{ - if ( fsType & FM_TYPE_FIXED ) - return PITCH_FIXED; - else - return PITCH_VARIABLE; -} - -// ----------------------------------------------------------------------- - -inline BYTE ImplPitchToWin( FontPitch ePitch ) -{ - if ( ePitch == PITCH_FIXED ) - return FM_TYPE_FIXED; - //else if ( ePitch == PITCH_VARIABLE ) - - return 0; -} - -// ----------------------------------------------------------------------- - -static ImplDevFontAttributes Os2Font2DevFontAttributes( const PFONTMETRICS pFontMetric) -{ - ImplDevFontAttributes aDFA; - - // get font face attributes - aDFA.meFamily = ImplFamilyToSal( pFontMetric->panose.bFamilyType); - aDFA.meWidthType = WIDTH_DONTKNOW; - aDFA.meWeight = ImplWeightToSal( pFontMetric->usWeightClass); - aDFA.meItalic = (pFontMetric->fsSelection & FM_SEL_ITALIC) ? ITALIC_NORMAL : ITALIC_NONE; - aDFA.mePitch = ImplLogPitchToSal( pFontMetric->fsType ); - aDFA.mbSymbolFlag = (pFontMetric->usCodePage == SYMBOL_CHARSET); - - // get the font face name - // the maName field stores the font name without the style, so under OS/2 - // we must use the family name - aDFA.maName = UniString( pFontMetric->szFamilyname, gsl_getSystemTextEncoding()); - - aDFA.maStyleName = ImpStyleNameToSal( pFontMetric->szFamilyname, - pFontMetric->szFacename, - strlen( pFontMetric->szFamilyname) ); - - // get device specific font attributes - aDFA.mbOrientation = (pFontMetric->fsDefn & FM_DEFN_OUTLINE) != 0; - aDFA.mbDevice = (pFontMetric->fsDefn & FM_DEFN_GENERIC) ? FALSE : TRUE; - - aDFA.mbEmbeddable = false; - aDFA.mbSubsettable = false; - DWORD fontType = Ft2QueryFontType( 0, pFontMetric->szFamilyname); - if( fontType == FT2_FONTTYPE_TRUETYPE && !aDFA.mbDevice) - aDFA.mbSubsettable = true; - // for now we can only embed Type1 fonts - if( fontType == FT2_FONTTYPE_TYPE1 ) - aDFA.mbEmbeddable = true; - - // heuristics for font quality - // - standard-type1 > opentypeTT > truetype > non-standard-type1 > raster - // - subsetting > embedding > none - aDFA.mnQuality = 0; - if( fontType == FT2_FONTTYPE_TRUETYPE ) - aDFA.mnQuality += 50; - if( aDFA.mbSubsettable ) - aDFA.mnQuality += 200; - else if( aDFA.mbEmbeddable ) - aDFA.mnQuality += 100; - - // #i38665# prefer Type1 versions of the standard postscript fonts - if( aDFA.mbEmbeddable ) - { - if( aDFA.maName.EqualsAscii( "AvantGarde" ) - || aDFA.maName.EqualsAscii( "Bookman" ) - || aDFA.maName.EqualsAscii( "Courier" ) - || aDFA.maName.EqualsAscii( "Helvetica" ) - || aDFA.maName.EqualsAscii( "NewCenturySchlbk" ) - || aDFA.maName.EqualsAscii( "Palatino" ) - || aDFA.maName.EqualsAscii( "Symbol" ) - || aDFA.maName.EqualsAscii( "Times" ) - || aDFA.maName.EqualsAscii( "ZapfChancery" ) - || aDFA.maName.EqualsAscii( "ZapfDingbats" ) ) - aDFA.mnQuality += 500; - } - - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW; - aDFA.meAntiAlias = ANTIALIAS_DONTKNOW; - - // TODO: add alias names - - return aDFA; -} - -// ======================================================================= - -// ----------------------------------------------------------------------- - -// ======================================================================= - -ImplOs2FontData::ImplOs2FontData( PFONTMETRICS _pFontMetric, - int nHeight, BYTE nPitchAndFamily ) -: ImplFontData( Os2Font2DevFontAttributes(_pFontMetric), 0 ), - pFontMetric( _pFontMetric ), - meOs2CharSet( _pFontMetric->usCodePage), - mnPitchAndFamily( nPitchAndFamily ), - mpFontCharSets( NULL ), - mpUnicodeMap( NULL ), - mbDisableGlyphApi( false ), - mbHasKoreanRange( false ), - mbHasCJKSupport( false ), - mbAliasSymbolsLow( false ), - mbAliasSymbolsHigh( false ), - mnId( 0 ) -{ - SetBitmapSize( 0, nHeight ); -} - -// ----------------------------------------------------------------------- - -ImplOs2FontData::~ImplOs2FontData() -{ - delete[] mpFontCharSets; - - if( mpUnicodeMap ) - mpUnicodeMap->DeReference(); -} - -// ----------------------------------------------------------------------- - -sal_IntPtr ImplOs2FontData::GetFontId() const -{ - return mnId; -} - -// ----------------------------------------------------------------------- - -void ImplOs2FontData::UpdateFromHPS( HPS hPS ) const -{ - // short circuit if already initialized - if( mpUnicodeMap != NULL ) - return; - - ReadCmapTable( hPS ); - ReadOs2Table( hPS ); - - // even if the font works some fonts have problems with the glyph API - // => the heuristic below tries to figure out which fonts have the problem - DWORD fontType = Ft2QueryFontType( 0, pFontMetric->szFacename); - if( fontType != FT2_FONTTYPE_TRUETYPE - && (pFontMetric->fsDefn & FM_DEFN_GENERIC) == 0) - mbDisableGlyphApi = true; -} - -// ----------------------------------------------------------------------- - -#ifdef GNG_VERT_HACK -bool ImplOs2FontData::HasGSUBstitutions( HPS hPS ) const -{ - if( !mbGsubRead ) - ReadGsubTable( hPS ); - return !maGsubTable.empty(); -} - -// ----------------------------------------------------------------------- - -bool ImplOs2FontData::IsGSUBstituted( sal_Ucs cChar ) const -{ - return( maGsubTable.find( cChar ) != maGsubTable.end() ); -} -#endif // GNG_VERT_HACK - -// ----------------------------------------------------------------------- - -const ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const -{ - return mpUnicodeMap; -} - -// ----------------------------------------------------------------------- - -static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);} -static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} -static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));} -static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16)+(p[3]<<24)); } - -void ImplOs2FontData::ReadOs2Table( HPS hPS ) const -{ - const DWORD Os2Tag = CalcTag( "OS/2" ); - DWORD nLength = Ft2GetFontData( hPS, Os2Tag, 0, NULL, 0 ); - if( (nLength == FT2_ERROR) || !nLength ) - return; - std::vector<unsigned char> aOS2map( nLength ); - unsigned char* pOS2map = &aOS2map[0]; - DWORD nRC = Ft2GetFontData( hPS, Os2Tag, 0, pOS2map, nLength ); - sal_uInt32 nVersion = GetUShort( pOS2map ); - if ( nVersion >= 0x0001 && nLength >= 58 ) - { - // We need at least version 0x0001 (TrueType rev 1.66) - // to have access to the needed struct members. - sal_uInt32 ulUnicodeRange1 = GetUInt( pOS2map + 42 ); - sal_uInt32 ulUnicodeRange2 = GetUInt( pOS2map + 46 ); - sal_uInt32 ulUnicodeRange3 = GetUInt( pOS2map + 50 ); - sal_uInt32 ulUnicodeRange4 = GetUInt( pOS2map + 54 ); - - // Check for CJK capabilities of the current font - mbHasCJKSupport = (ulUnicodeRange2 & 0x2fff0000) - | (ulUnicodeRange3 & 0x00000001); - mbHasKoreanRange= (ulUnicodeRange1 & 0x10000000) - | (ulUnicodeRange2 & 0x01100000); - } -} - - -// ----------------------------------------------------------------------- - -#ifdef GNG_VERT_HACK -void ImplOs2FontData::ReadGsubTable( HPS hPS ) const -{ - mbGsubRead = true; - - // check the existence of a GSUB table - const DWORD GsubTag = CalcTag( "GSUB" ); - DWORD nRC = Ft2GetFontData( hPS, GsubTag, 0, NULL, 0 ); - if( (nRC == FT2_ERROR) || !nRC ) - return; - - // TODO: directly read the GSUB table instead of going through sft - - // get raw font file data - DWORD nFontSize = Ft2GetFontData( hPS, 0, 0, NULL, 0 ); - if( nFontSize == FT2_ERROR ) - return; - std::vector<char> aRawFont( nFontSize+1 ); - aRawFont[ nFontSize ] = 0; - DWORD nFontSize2 = Ft2GetFontData( hPS, 0, 0, (void*)&aRawFont[0], nFontSize ); - if( nFontSize != nFontSize2 ) - return; - - // open font file - sal_uInt32 nFaceNum = 0; - if( !aRawFont[0] ) // TTC candidate - nFaceNum = ~0U; // indicate "TTC font extracts only" - - TrueTypeFont* pTTFont = NULL; - ::OpenTTFontBuffer( &aRawFont[0], nFontSize, nFaceNum, &pTTFont ); - if( !pTTFont ) - return; - - // add vertically substituted characters to list - static const sal_Unicode aGSUBCandidates[] = { - 0x0020, 0x0080, // ASCII - 0x2000, 0x2600, // misc - 0x3000, 0x3100, // CJK punctutation - 0x3300, 0x3400, // squared words - 0xFF00, 0xFFF0, // halfwidth|fullwidth forms - 0 }; - - for( const sal_Unicode* pPair = aGSUBCandidates; *pPair; pPair += 2 ) - for( sal_Unicode cChar = pPair[0]; cChar < pPair[1]; ++cChar ) - if( ::MapChar( pTTFont, cChar, 0 ) != ::MapChar( pTTFont, cChar, 1 ) ) - maGsubTable.insert( cChar ); // insert GSUBbed unicodes - - CloseTTFont( pTTFont ); -} -#endif // GNG_VERT_HACK - -// ----------------------------------------------------------------------- - -void ImplOs2FontData::ReadCmapTable( HPS hPS ) const -{ - CmapResult aResult; - aResult.mnPairCount = 0; - aResult.mbSymbolic = (meOs2CharSet == SYMBOL_CHARSET); - aResult.mbRecoded = true; - - // get the CMAP table from the font which is selected into the DC - const DWORD CmapTag = CalcTag( "cmap" ); - DWORD nRC = Ft2GetFontData( hPS, CmapTag, 0, NULL, 0 ); - // read the CMAP table if available - if( nRC != FT2_ERROR ) - { - const int nLength = nRC; - std::vector<unsigned char> aCmap( nLength ); - unsigned char* pCmap = &aCmap[0]; - nRC = Ft2GetFontData( hPS, CmapTag, 0, pCmap, nLength ); - // parse the CMAP table - if( nRC == nLength ) - ParseCMAP( pCmap, nLength, aResult ); - } else { - // we need to define at least a simple charmap, otherwise this font - // will be mapped to default charmap, and OOo doesn't accept the - // system font to match the default charmap - aResult.mnPairCount = 1; - // ImplFontCharMap destructor will free this memory - aResult.mpPairCodes = new sal_uInt32[ 2 * aResult.mnPairCount ]; - aResult.mpPairCodes[0] = 0x0020; - aResult.mpPairCodes[1] = 0x00FF; - aResult.mpStartGlyphs = NULL; - } - - mbDisableGlyphApi |= aResult.mbRecoded; - - if( aResult.mnPairCount > 0 ) - mpUnicodeMap = new ImplFontCharMap( aResult.mnPairCount, - aResult.mpPairCodes, aResult.mpStartGlyphs ); - else - mpUnicodeMap = ImplFontCharMap::GetDefaultMap(); - mpUnicodeMap->AddReference(); -} - -// ======================================================================= - -void Os2SalGraphics::SetTextColor( SalColor nSalColor ) -{ - CHARBUNDLE cb; - - cb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); - - // set default color attributes - Ft2SetAttrs( mhPS, - PRIM_CHAR, - CBB_COLOR, - 0, - &cb ); -} - -// ----------------------------------------------------------------------- - -USHORT Os2SalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, int nFallbackLevel) -{ - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "Os2SalGraphics::ImplDoSetFont\n"); -#endif - - ImplOs2FontData* pFontData = (ImplOs2FontData*)i_pFont->mpFontData; - PFONTMETRICS pFontMetric = NULL; - FATTRS aFAttrs; - BOOL bOutline = FALSE; - APIRET rc; - - memset( &aFAttrs, 0, sizeof( FATTRS ) ); - aFAttrs.usRecordLength = sizeof( FATTRS ); - - aFAttrs.lMaxBaselineExt = i_pFont->mnHeight; - aFAttrs.lAveCharWidth = i_pFont->mnWidth; - - // do we have a pointer to the FONTMETRICS of the selected font? -> use it! - if ( pFontData ) - { - pFontMetric = pFontData->GetFontMetrics(); - - bOutline = (pFontMetric->fsDefn & FM_DEFN_OUTLINE) != 0; - - // use match®istry fields to get correct match - aFAttrs.lMatch = pFontMetric->lMatch; - aFAttrs.idRegistry = pFontMetric->idRegistry; - aFAttrs.usCodePage = pFontMetric->usCodePage; - - if ( bOutline ) - { - aFAttrs.fsFontUse |= FATTR_FONTUSE_OUTLINE; - if ( i_pFont->mnOrientation ) - aFAttrs.fsFontUse |= FATTR_FONTUSE_TRANSFORMABLE; - } - else - { - aFAttrs.lMaxBaselineExt = pFontMetric->lMaxBaselineExt; - aFAttrs.lAveCharWidth = pFontMetric->lAveCharWidth; - } - - } - - // use family name for outline fonts - if ( mbPrinter ) { - // use font face name for printers because otherwise ft2lib will fail - // to select the correct font for GPI (ticket#117) - strncpy( (char*)(aFAttrs.szFacename), pFontMetric->szFacename, sizeof( aFAttrs.szFacename ) ); - } else if ( !pFontMetric) { - // use OOo name if fontmetrics not available! - ByteString aName( i_pFont->maName.GetToken( 0 ), gsl_getSystemTextEncoding()); - strncpy( (char*)(aFAttrs.szFacename), aName.GetBuffer(), sizeof( aFAttrs.szFacename ) ); - } else if ( bOutline) { - // use fontmetric family name for outline fonts - strncpy( (char*)(aFAttrs.szFacename), pFontMetric->szFamilyname, sizeof( aFAttrs.szFacename ) ); - } else { - // use real font face name for bitmaps (WarpSans only) - strncpy( (char*)(aFAttrs.szFacename), pFontMetric->szFacename, sizeof( aFAttrs.szFacename ) ); - } - - if ( i_pFont->meItalic != ITALIC_NONE ) - aFAttrs.fsSelection |= FATTR_SEL_ITALIC; - if ( i_pFont->meWeight > WEIGHT_MEDIUM ) - aFAttrs.fsSelection |= FATTR_SEL_BOLD; - -#if OSL_DEBUG_LEVEL > 1 - if (pFontMetric->szFacename[0] == 'A') { - debug_printf( "Os2SalGraphics::SetFont hps %x lMatch '%d'\n", mhPS, pFontMetric->lMatch); - debug_printf( "Os2SalGraphics::SetFont hps %x fontmetrics facename '%s'\n", mhPS, pFontMetric->szFacename); - debug_printf( "Os2SalGraphics::SetFont hps %x fattrs facename '%s'\n", mhPS, aFAttrs.szFacename); - } -#endif - - Ft2DeleteSetId( mhPS, nFallbackLevel + LCID_BASE); - if ( (rc=Ft2CreateLogFont( mhPS, NULL, nFallbackLevel + LCID_BASE, &aFAttrs)) == GPI_ERROR ) { -#if OSL_DEBUG_LEVEL > 1 - ERRORID nLastError = WinGetLastError( GetSalData()->mhAB ); - debug_printf( "Os2SalGraphics::SetFont hps %x Ft2CreateLogFont failed err %x\n", mhPS, nLastError ); -#endif - return SAL_SETFONT_REMOVEANDMATCHNEW; - } - - CHARBUNDLE aBundle; - - ULONG nAttrsDefault = 0; - ULONG nAttrs = CBB_SET; - aBundle.usSet = nFallbackLevel + LCID_BASE; - - if ( bOutline ) - { - nAttrs |= CBB_BOX; - aBundle.sizfxCell.cy = MAKEFIXED( i_pFont->mnHeight, 0 ); - - if ( !i_pFont->mnWidth ) - { - LONG nXFontRes; - LONG nYFontRes; - LONG nHeight; - - // Auf die Aufloesung achten, damit das Ergebnis auch auf - // Drucken mit 180*360 DPI stimmt. Ausserdem muss gerundet - // werden, da auf meinem OS2 beispielsweise als - // Bildschirmaufloesung 3618*3622 PixelPerMeter zurueck- - // gegeben wird - GetResolution( nXFontRes, nYFontRes ); - nHeight = i_pFont->mnHeight; - nHeight *= nXFontRes; - nHeight += nYFontRes/2; - nHeight /= nYFontRes; - aBundle.sizfxCell.cx = MAKEFIXED( nHeight, 0 ); - } - else - aBundle.sizfxCell.cx = MAKEFIXED( i_pFont->mnWidth, 0 ); - } - - // set orientation for outlinefonts - if ( i_pFont->mnOrientation ) - { - if ( bOutline ) - { - nAttrs |= CBB_ANGLE; - double alpha = (double)(i_pFont->mnOrientation); - alpha *= 0.0017453292; // *PI / 1800 - mnOrientationY = (long) (1000.0 * sin( alpha )); - mnOrientationX = (long) (1000.0 * cos( alpha )); - aBundle.ptlAngle.x = mnOrientationX; - aBundle.ptlAngle.y = mnOrientationY; - } - else - { - mnOrientationX = 1; - mnOrientationY = 0; - nAttrs |= CBB_ANGLE; - aBundle.ptlAngle.x = 1; - aBundle.ptlAngle.y = 0; - } - } - else - { - mnOrientationX = 1; - mnOrientationY = 0; - nAttrs |= CBB_ANGLE; - aBundle.ptlAngle.x = 1; - aBundle.ptlAngle.y = 0; - } - - rc = Ft2SetAttrs( mhPS, PRIM_CHAR, nAttrs, nAttrsDefault, &aBundle ); - -#if OSL_DEBUG_LEVEL > 1 - FONTMETRICS aOS2Metric = {0}; - Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ); -#endif - - return 0; -} - - -USHORT Os2SalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel ) -{ - - // return early if there is no new font - if( !pFont ) - { - mhDefFont = 0; - return 0; - } - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "Os2SalGraphics::SetFont\n"); -#endif - - DBG_ASSERT( pFont->mpFontData, "WinSalGraphics mpFontData==NULL"); - mpOs2FontEntry[ nFallbackLevel ] = reinterpret_cast<ImplOs2FontEntry*>( pFont->mpFontEntry ); - mpOs2FontData[ nFallbackLevel ] = static_cast<const ImplOs2FontData*>( pFont->mpFontData ); - - ImplDoSetFont( pFont, mfFontScale, nFallbackLevel); - - if( !mhDefFont ) - { - // keep default font - mhDefFont = nFallbackLevel + LCID_BASE; - } - else - { - // release no longer referenced font handles - for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) - { - if( mhFonts[i] ) - { - mhFonts[i] = 0; - } - } - } - - // store new font in correct layer - mhFonts[ nFallbackLevel ] = nFallbackLevel + LCID_BASE; - - // now the font is live => update font face - if( mpOs2FontData[ nFallbackLevel ] ) - mpOs2FontData[ nFallbackLevel ]->UpdateFromHPS( mhPS ); - - if( !nFallbackLevel ) - { - mbFontKernInit = TRUE; - if ( mpFontKernPairs ) - { - delete[] mpFontKernPairs; - mpFontKernPairs = NULL; - } - mnFontKernPairCount = 0; - } - - // some printers have higher internal resolution, so their - // text output would be different from what we calculated - // => suggest DrawTextArray to workaround this problem - if ( mbPrinter ) - return SAL_SETFONT_USEDRAWTEXTARRAY; - else - return 0; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel ) -{ - FONTMETRICS aOS2Metric; - Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ); - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "Os2SalGraphics::GetFontMetric hps %x\n", mhPS); - if (aOS2Metric.szFacename[0] == 'A') { - debug_printf( "Os2SalGraphics::GetFontMetric hps %x fontmetrics facename '%s'\n", mhPS, aOS2Metric.szFacename); - debug_printf( "Os2SalGraphics::GetFontMetric hps %x fontmetrics lMatch '%d'\n", mhPS, aOS2Metric.lMatch); - } -#endif - - pMetric->maName = UniString( aOS2Metric.szFamilyname, gsl_getSystemTextEncoding()); - pMetric->maStyleName = ImpStyleNameToSal( aOS2Metric.szFamilyname, - aOS2Metric.szFacename, - strlen( aOS2Metric.szFamilyname ) ); - - // device independent font attributes - pMetric->meFamily = ImplFamilyToSal( aOS2Metric.panose.bFamilyType); - pMetric->mbSymbolFlag = (aOS2Metric.usCodePage == SYMBOL_CHARSET); - pMetric->meWeight = ImplWeightToSal( aOS2Metric.usWeightClass ); - pMetric->mePitch = ImplLogPitchToSal( aOS2Metric.fsType ); - pMetric->meItalic = (aOS2Metric.fsSelection & FM_SEL_ITALIC) ? ITALIC_NORMAL : ITALIC_NONE; - pMetric->mnSlant = 0; - - // device dependend font attributes - pMetric->mbDevice = (aOS2Metric.fsDefn & FM_DEFN_GENERIC) ? FALSE : TRUE; - pMetric->mbScalableFont = (aOS2Metric.fsDefn & FM_DEFN_OUTLINE) ? true : false; - if( pMetric->mbScalableFont ) - { - // check if there are kern pairs - // TODO: does this work with GPOS kerning? - pMetric->mbKernableFont = (aOS2Metric.sKerningPairs > 0); - } - else - { - // bitmap fonts cannot be rotated directly - pMetric->mnOrientation = 0; - // bitmap fonts have no kerning - pMetric->mbKernableFont = false; - } - - // transformation dependend font metrics - if ( aOS2Metric.fsDefn & FM_DEFN_OUTLINE ) - { - pMetric->mnWidth = aOS2Metric.lEmInc; - } - else - { - pMetric->mnWidth = aOS2Metric.lAveCharWidth; - pMetric->mnOrientation = 0; - } - pMetric->mnIntLeading = aOS2Metric.lInternalLeading; - pMetric->mnExtLeading = aOS2Metric.lExternalLeading; - pMetric->mnAscent = aOS2Metric.lMaxAscender; - pMetric->mnDescent = aOS2Metric.lMaxDescender; - - // #107888# improved metric compatibility for Asian fonts... - // TODO: assess workaround below for CWS >= extleading - // TODO: evaluate use of aWinMetric.sTypo* members for CJK - if( mpOs2FontData[nFallbackLevel] && mpOs2FontData[nFallbackLevel]->SupportsCJK() ) - { - pMetric->mnIntLeading += pMetric->mnExtLeading; - - // #109280# The line height for Asian fonts is too small. - // Therefore we add half of the external leading to the - // ascent, the other half is added to the descent. - const long nHalfTmpExtLeading = pMetric->mnExtLeading / 2; - const long nOtherHalfTmpExtLeading = pMetric->mnExtLeading - nHalfTmpExtLeading; - - // #110641# external leading for Asian fonts. - // The factor 0.3 has been confirmed with experiments. - long nCJKExtLeading = static_cast<long>(0.30 * (pMetric->mnAscent + pMetric->mnDescent)); - nCJKExtLeading -= pMetric->mnExtLeading; - pMetric->mnExtLeading = (nCJKExtLeading > 0) ? nCJKExtLeading : 0; - - pMetric->mnAscent += nHalfTmpExtLeading; - pMetric->mnDescent += nOtherHalfTmpExtLeading; - - // #109280# HACK korean only: increase descent for wavelines and impr - // YD win9x only - } - -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) -{ - DBG_ASSERT( sizeof( KERNINGPAIRS ) == sizeof( ImplKernPairData ), - "Os2SalGraphics::GetKernPairs(): KERNINGPAIRS != ImplKernPairData" ); - - if ( mbFontKernInit ) - { - if( mpFontKernPairs ) - { - delete[] mpFontKernPairs; - mpFontKernPairs = NULL; - } - mnFontKernPairCount = 0; - - { - KERNINGPAIRS* pPairs = NULL; - FONTMETRICS aOS2Metric; - Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ); - int nCount = aOS2Metric.sKerningPairs; - if( nCount ) - { -#ifdef GCP_KERN_HACK - pPairs = new KERNINGPAIRS[ nCount+1 ]; - mpFontKernPairs = pPairs; - mnFontKernPairCount = nCount; - Ft2QueryKerningPairs( mhPS, nCount, (KERNINGPAIRS*)pPairs ); -#else // GCP_KERN_HACK - pPairs = (KERNINGPAIRS*)pKernPairs; - nCount = (nCount < nPairs) ? nCount : nPairs; - Ft2QueryKerningPairs( mhPS, nCount, (KERNINGPAIRS*)pPairs ); - return nCount; -#endif // GCP_KERN_HACK - } - } - - mbFontKernInit = FALSE; - - std::sort( mpFontKernPairs, mpFontKernPairs + mnFontKernPairCount, ImplCmpKernData ); - } - - if( !pKernPairs ) - return mnFontKernPairCount; - else if( mpFontKernPairs ) - { - if ( nPairs < mnFontKernPairCount ) - nPairs = mnFontKernPairCount; - memcpy( pKernPairs, mpFontKernPairs, - nPairs*sizeof( ImplKernPairData ) ); - return nPairs; - } - - return 0; -} - - -// ----------------------------------------------------------------------- - -static const ImplFontCharMap* pOs2DefaultImplFontCharMap = NULL; -static const sal_uInt32 pOs2DefaultRangeCodes[] = {0x0020,0x00FF}; - -const ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const -{ - if( !mpOs2FontData[0] ) - return ImplFontCharMap::GetDefaultMap(); - return mpOs2FontData[0]->GetImplFontCharMap(); -} - -// ----------------------------------------------------------------------- - -bool Os2SalGraphics::AddTempDevFont( ImplDevFontList* pFontList, - const String& rFontFileURL, const String& rFontName ) -{ -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalGraphics::AddTempDevFont\n"); -#endif - return false; -} - -// ----------------------------------------------------------------------- - -void Os2SalGraphics::GetDevFontList( ImplDevFontList* pList ) -{ - PFONTMETRICS pFontMetrics; - ULONG nFontMetricCount; - SalData* pSalData; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalGraphics::GetDevFontList\n"); -#endif - - // install OpenSymbol - HMODULE hMod; - ULONG ObjNum, Offset, rc; - CHAR Buff[2*_MAX_PATH]; - // get module handle (and name) - rc = DosQueryModFromEIP( &hMod, &ObjNum, sizeof( Buff), Buff, - &Offset, (ULONG)ImplSalGetUniString); - DosQueryModuleName(hMod, sizeof(Buff), Buff); - // replace module path with font path - char* slash = strrchr( Buff, '\\'); - *slash = '\0'; - slash = strrchr( Buff, '\\'); - *slash = '\0'; - strcat( Buff, "\\SHARE\\FONTS\\TRUETYPE\\OPENS___.TTF"); - rc = GpiLoadPublicFonts( GetSalData()->mhAB, Buff); - - if ( !mbPrinter ) - { - // Bei Bildschirm-Devices cachen wir die Liste global, da - // dies im unabhaengigen Teil auch so gemacht wird und wir - // ansonsten auf geloeschten Systemdaten arbeiten koennten - pSalData = GetSalData(); - nFontMetricCount = pSalData->mnFontMetricCount; - pFontMetrics = pSalData->mpFontMetrics; - // Bei Bildschirm-Devices holen wir uns die Fontliste jedesmal neu - if ( pFontMetrics ) - { - delete pFontMetrics; - pFontMetrics = NULL; - nFontMetricCount = 0; - } - } - else - { - nFontMetricCount = mnFontMetricCount; - pFontMetrics = mpFontMetrics; - } - - // do we have to create the cached font list first? - if ( !pFontMetrics ) - { - // query the number of fonts available - LONG nTemp = 0; - nFontMetricCount = Ft2QueryFonts( mhPS, - QF_PUBLIC | QF_PRIVATE, - NULL, &nTemp, - sizeof( FONTMETRICS ), NULL ); - - // procede only if at least one is available! - if ( nFontMetricCount ) - { - // allocate memory for font list - pFontMetrics = new FONTMETRICS[nFontMetricCount]; - - // query font list - Ft2QueryFonts( mhPS, - QF_PUBLIC | QF_PRIVATE, - NULL, - (PLONG)&nFontMetricCount, - (LONG) sizeof( FONTMETRICS ), - pFontMetrics ); - } - - if ( !mbPrinter ) - { - pSalData->mnFontMetricCount = nFontMetricCount; - pSalData->mpFontMetrics = pFontMetrics; - } - else - { - mnFontMetricCount = nFontMetricCount; - mpFontMetrics = pFontMetrics; - } - } - - // copy data from the font list - for( ULONG i = 0; i < nFontMetricCount; i++ ) - { - PFONTMETRICS pFontMetric = &pFontMetrics[i]; - - // skip font starting with '@', this is an alias internally - // used by truetype engine. - if (pFontMetric->szFacename[0] == '@') - continue; - - // skip bitmap fonts (but keep WarpSans) - if ( (pFontMetric->fsDefn & FM_DEFN_OUTLINE) == 0 - && strncmp( pFontMetric->szFacename, "WarpSans", 8) ) - // Font nicht aufnehmen - continue; - - // replace '-' in facename with ' ' (for ft2lib) - char* dash = pFontMetric->szFacename; - while( (dash=strchr( dash, '-'))) - *dash++ = ' '; - - // create new font list element - ImplOs2FontData* pData = new ImplOs2FontData( pFontMetric, 0, 0 ); - - // add font list element to font list - pList->Add( pData ); - - } -} - -// ---------------------------------------------------------------------------- - -void Os2SalGraphics::GetDevFontSubstList( OutputDevice* pOutDev ) -{ -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) -{ - // use unity matrix - MAT2 aMat; - aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 ); - aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 ); - - UINT nGGOFlags = GGO_METRICS; - if( !(nIndex & GF_ISCHAR) ) - nGGOFlags |= GGO_GLYPH_INDEX; - nIndex &= GF_IDXMASK; - - GLYPHMETRICS aGM; - DWORD nSize = FT2_ERROR; - nSize = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - if( nSize == FT2_ERROR ) - return false; - - rRect = Rectangle( Point( +aGM.gmptGlyphOrigin.x, -aGM.gmptGlyphOrigin.y ), - Size( aGM.gmBlackBoxX, aGM.gmBlackBoxY ) ); - rRect.Left() = static_cast<int>( mfFontScale * rRect.Left() ); - rRect.Right() = static_cast<int>( mfFontScale * rRect.Right() ); - rRect.Top() = static_cast<int>( mfFontScale * rRect.Top() ); - rRect.Bottom() = static_cast<int>( mfFontScale * rRect.Bottom() ); - return true; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) -{ -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalGraphics::GetGlyphOutline\n"); -#endif - rB2DPolyPoly.clear(); - - BOOL bRet = FALSE; - - // use unity matrix - MAT2 aMat; - aMat.eM11 = aMat.eM22 = FixedFromDouble( 1.0 ); - aMat.eM12 = aMat.eM21 = FixedFromDouble( 0.0 ); - - UINT nGGOFlags = GGO_NATIVE; - if( !(nIndex & GF_ISCHAR) ) - nGGOFlags |= GGO_GLYPH_INDEX; - nIndex &= GF_IDXMASK; - - GLYPHMETRICS aGlyphMetrics; - DWORD nSize1 = FT2_ERROR; - nSize1 = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); - - if( !nSize1 ) // blank glyphs are ok - bRet = TRUE; - else if( nSize1 != FT2_ERROR ) - { - BYTE* pData = new BYTE[ nSize1 ]; - ULONG nTotalCount = 0; - DWORD nSize2; - nSize2 = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); - - if( nSize1 == nSize2 ) - { - bRet = TRUE; - - int nPtSize = 512; - Point* pPoints = new Point[ nPtSize ]; - BYTE* pFlags = new BYTE[ nPtSize ]; - - TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; - while( (BYTE*)pHeader < pData+nSize2 ) - { - // only outline data is interesting - if( pHeader->dwType != TT_POLYGON_TYPE ) - break; - - // get start point; next start points are end points - // of previous segment - int nPnt = 0; - - long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); - long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt++ ] = POLY_NORMAL; - - bool bHasOfflinePoints = false; - TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 ); - pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb ); - while( (BYTE*)pCurve < (BYTE*)pHeader ) - { - int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx; - if( nPtSize < nNeededSize ) - { - Point* pOldPoints = pPoints; - BYTE* pOldFlags = pFlags; - nPtSize = 2 * nNeededSize; - pPoints = new Point[ nPtSize ]; - pFlags = new BYTE[ nPtSize ]; - for( int i = 0; i < nPnt; ++i ) - { - pPoints[ i ] = pOldPoints[ i ]; - pFlags[ i ] = pOldFlags[ i ]; - } - delete[] pOldPoints; - delete[] pOldFlags; - } - - int i = 0; - if( TT_PRIM_LINE == pCurve->wType ) - { - while( i < pCurve->cpfx ) - { - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt ] = POLY_NORMAL; - ++nPnt; - } - } - else if( TT_PRIM_QSPLINE == pCurve->wType ) - { - bHasOfflinePoints = true; - while( i < pCurve->cpfx ) - { - // get control point of quadratic bezier spline - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - Point aControlP( nX, nY ); - - // calculate first cubic control point - // P0 = 1/3 * (PBeg + 2 * PQControl) - nX = pPoints[ nPnt-1 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt-1 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+0 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+0 ] = POLY_CONTROL; - - // calculate endpoint of segment - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - - if ( i+1 >= pCurve->cpfx ) - { - // endpoint is either last point in segment => advance - ++i; - } - else - { - // or endpoint is the middle of two control points - nX += IntTimes256FromFixed( pCurve->apfx[ i-1 ].x ); - nY += IntTimes256FromFixed( pCurve->apfx[ i-1 ].y ); - nX = (nX + 1) / 2; - nY = (nY + 1) / 2; - // no need to advance, because the current point - // is the control point in next bezier spline - } - - pPoints[ nPnt+2 ] = Point( nX, nY ); - pFlags[ nPnt+2 ] = POLY_NORMAL; - - // calculate second cubic control point - // P1 = 1/3 * (PEnd + 2 * PQControl) - nX = pPoints[ nPnt+2 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt+2 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+1 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+1 ] = POLY_CONTROL; - - nPnt += 3; - } - } - - // next curve segment - pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ]; - } - - // end point is start point for closed contour - // disabled, because Polygon class closes the contour itself - // pPoints[nPnt++] = pPoints[0]; - // #i35928# - // Added again, but add only when not yet closed - if(pPoints[nPnt - 1] != pPoints[0]) - { - if( bHasOfflinePoints ) - pFlags[nPnt] = pFlags[0]; - - pPoints[nPnt++] = pPoints[0]; - } - - // convert y-coordinates W32 -> VCL - for( int i = 0; i < nPnt; ++i ) - pPoints[i].Y() = -pPoints[i].Y(); - - // insert into polypolygon - Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) ); - // convert to B2DPolyPolygon - // TODO: get rid of the intermediate PolyPolygon - rB2DPolyPoly.append( aPoly.getB2DPolygon() ); - } - - delete[] pPoints; - delete[] pFlags; - } - - delete[] pData; - } - - // rescaling needed for the PolyPolygon conversion - if( rB2DPolyPoly.count() ) - { - const double fFactor((1.0/256) * mfFontScale); - rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -// TODO: Replace this class with boost::scoped_array -class ScopedCharArray -{ -public: - inline explicit ScopedCharArray(char * pArray): m_pArray(pArray) {} - - inline ~ScopedCharArray() { delete[] m_pArray; } - - inline char * get() const { return m_pArray; } - -private: - char * m_pArray; -}; - -class ScopedFont -{ -public: - explicit ScopedFont(Os2SalGraphics & rData); - - ~ScopedFont(); - -private: - Os2SalGraphics & m_rData; - ULONG m_hOrigFont; -}; - -ScopedFont::ScopedFont(Os2SalGraphics & rData): m_rData(rData) -{ -} - -ScopedFont::~ScopedFont() -{ -} - -class ScopedTrueTypeFont -{ -public: - inline ScopedTrueTypeFont(): m_pFont(0) {} - - ~ScopedTrueTypeFont(); - - int open(void * pBuffer, sal_uInt32 nLen, sal_uInt32 nFaceNum); - - inline TrueTypeFont * get() const { return m_pFont; } - -private: - TrueTypeFont * m_pFont; -}; - -ScopedTrueTypeFont::~ScopedTrueTypeFont() -{ - if (m_pFont != 0) - CloseTTFont(m_pFont); -} - -int ScopedTrueTypeFont::open(void * pBuffer, sal_uInt32 nLen, - sal_uInt32 nFaceNum) -{ - OSL_ENSURE(m_pFont == 0, "already open"); - return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont); -} - -BOOL Os2SalGraphics::CreateFontSubset( const rtl::OUString& rToFile, - const ImplFontData* pFont, long* pGlyphIDs, sal_uInt8* pEncoding, - sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo ) -{ - // create matching ImplFontSelectData - // we need just enough to get to the font file data - // use height=1000 for easier debugging (to match psprint's font units) - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - - // TODO: much better solution: move SetFont and restoration of old font to caller - ScopedFont aOldFont(*this); - SetFont( &aIFSD, 0 ); - -#if OSL_DEBUG_LEVEL > 1 - // get font metrics - TEXTMETRICA aWinMetric; - if( !::GetTextMetricsA( mhDC, &aWinMetric ) ) - return FALSE; - - DBG_ASSERT( !(aWinMetric.tmPitchAndFamily & TMPF_DEVICE), "cannot subset device font" ); - DBG_ASSERT( aWinMetric.tmPitchAndFamily & TMPF_TRUETYPE, "can only subset TT font" ); -#endif - - // get raw font file data - DWORD nFontSize1 = Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); - if( nFontSize1 == FT2_ERROR ) - return FALSE; - ScopedCharArray xRawFontData(new char[ nFontSize1 ]); - DWORD nFontSize2 = Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 ); - if( nFontSize1 != nFontSize2 ) - return FALSE; - - // open font file - sal_uInt32 nFaceNum = 0; - if( !*xRawFontData.get() ) // TTC candidate - nFaceNum = ~0U; // indicate "TTC font extracts only" - - ScopedTrueTypeFont aSftTTF; - int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum ); - if( nRC != SF_OK ) - return FALSE; - - TTGlobalFontInfo aTTInfo; - ::GetTTGlobalFontInfo( aSftTTF.get(), &aTTInfo ); - rInfo.m_nFontType = SAL_FONTSUBSETINFO_TYPE_TRUETYPE; - rInfo.m_aPSName = ImplSalGetUniString( aTTInfo.psname ); - rInfo.m_nAscent = +aTTInfo.winAscent; - rInfo.m_nDescent = -aTTInfo.winDescent; - rInfo.m_aFontBBox = Rectangle( Point( aTTInfo.xMin, aTTInfo.yMin ), - Point( aTTInfo.xMax, aTTInfo.yMax ) ); - rInfo.m_nCapHeight = aTTInfo.yMax; // Well ... - - // subset glyphs and get their properties - // take care that subset fonts require the NotDef glyph in pos 0 - int nOrigCount = nGlyphCount; - USHORT aShortIDs[ 256 ]; - sal_uInt8 aTempEncs[ 256 ]; - - int nNotDef=-1, i; - for( i = 0; i < nGlyphCount; ++i ) - { - aTempEncs[i] = pEncoding[i]; - sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK; - if( pGlyphIDs[i] & GF_ISCHAR ) - { - bool bVertical = (pGlyphIDs[i] & GF_ROTMASK) != 0; - nGlyphIdx = ::MapChar( aSftTTF.get(), sal::static_int_cast<sal_uInt16>(nGlyphIdx), bVertical ); - if( nGlyphIdx == 0 && pFont->IsSymbolFont() ) - { - // #i12824# emulate symbol aliasing U+FXXX <-> U+0XXX - nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK; - nGlyphIdx = (nGlyphIdx & 0xF000) ? (nGlyphIdx & 0x00FF) : (nGlyphIdx | 0xF000 ); - nGlyphIdx = ::MapChar( aSftTTF.get(), sal::static_int_cast<sal_uInt16>(nGlyphIdx), bVertical ); - } - } - aShortIDs[i] = static_cast<USHORT>( nGlyphIdx ); - if( !nGlyphIdx ) - if( nNotDef < 0 ) - nNotDef = i; // first NotDef glyph found - } - - if( nNotDef != 0 ) - { - // add fake NotDef glyph if needed - if( nNotDef < 0 ) - nNotDef = nGlyphCount++; - - // NotDef glyph must be in pos 0 => swap glyphids - aShortIDs[ nNotDef ] = aShortIDs[0]; - aTempEncs[ nNotDef ] = aTempEncs[0]; - aShortIDs[0] = 0; - aTempEncs[0] = 0; - } - DBG_ASSERT( nGlyphCount < 257, "too many glyphs for subsetting" ); - - // fill pWidth array - TTSimpleGlyphMetrics* pMetrics = - ::GetTTSimpleGlyphMetrics( aSftTTF.get(), aShortIDs, nGlyphCount, aIFSD.mbVertical ); - if( !pMetrics ) - return FALSE; - sal_uInt16 nNotDefAdv = pMetrics[0].adv; - pMetrics[0].adv = pMetrics[nNotDef].adv; - pMetrics[nNotDef].adv = nNotDefAdv; - for( i = 0; i < nOrigCount; ++i ) - pGlyphWidths[i] = pMetrics[i].adv; - free( pMetrics ); - - // write subset into destination file - rtl::OUString aSysPath; - if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) ) - return FALSE; - rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding(); - ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) ); - nRC = ::CreateTTFromTTGlyphs( aSftTTF.get(), aToFile.GetBuffer(), aShortIDs, - aTempEncs, nGlyphCount, 0, NULL, 0 ); - return nRC == SF_OK; -} - -//-------------------------------------------------------------------------- - -const void* Os2SalGraphics::GetEmbedFontData( const ImplFontData* pFont, - const sal_Ucs* pUnicodes, sal_Int32* pCharWidths, - FontSubsetInfo& rInfo, long* pDataLen ) -{ - // create matching ImplFontSelectData - // we need just enough to get to the font file data - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - - // TODO: much better solution: move SetFont and restoration of old font to caller - ScopedFont aOldFont(*this); - SetFont( &aIFSD, 0 ); - - // get the raw font file data - DWORD nFontSize1 = Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); - if( nFontSize1 == FT2_ERROR || nFontSize1 <= 0 ) - return NULL; - *pDataLen = nFontSize1; - void* pData = reinterpret_cast<void*>(new char[ nFontSize1 ]); - DWORD nFontSize2 = Ft2GetFontData( mhPS, 0, 0, pData, nFontSize1 ); - if( nFontSize1 != nFontSize2 ) - *pDataLen = 0; - - // get important font properties - FONTMETRICS aOS2Metric; - if (Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ) == GPI_ERROR) - *pDataLen = 0; - rInfo.m_nFontType = SAL_FONTSUBSETINFO_TYPE_TYPE1; - rInfo.m_aPSName = ImplSalGetUniString( aOS2Metric.szFacename ); - rInfo.m_nAscent = +aOS2Metric.lMaxAscender; - rInfo.m_nDescent = -aOS2Metric.lMaxDescender; - rInfo.m_aFontBBox = Rectangle( Point( 0, -aOS2Metric.lMaxDescender ), - Point( aOS2Metric.lMaxCharInc, aOS2Metric.lMaxAscender+aOS2Metric.lExternalLeading ) ); - rInfo.m_nCapHeight = aOS2Metric.lMaxAscender; // Well ... - - // get individual character widths - for( int i = 0; i < 256; ++i ) - { - LONG nCharWidth = 0; - const sal_Ucs cChar = pUnicodes[i]; - if( !Ft2QueryStringWidthW( mhPS, (LPWSTR)&cChar, 1, &nCharWidth ) ) - *pDataLen = 0; - pCharWidths[i] = nCharWidth; - } - - if( !*pDataLen ) - { - FreeEmbedFontData( pData, nFontSize1 ); - pData = NULL; - } - - return pData; -} - -//-------------------------------------------------------------------------- - -void Os2SalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ ) -{ - delete[] reinterpret_cast<char*>(const_cast<void*>(pData)); -} - -const Ucs2SIntMap* Os2SalGraphics::GetFontEncodingVector( const ImplFontData* pFont, const Ucs2OStrMap** pNonEncoded ) -{ - // TODO: even for builtin fonts we get here... why? - if( !pFont->IsEmbeddable() ) - return NULL; - - // fill the encoding vector - Ucs2SIntMap& rMap = *new Ucs2SIntMap; - - for( sal_Unicode i = 32; i < 256; ++i ) - rMap[i] = i; - if( pNonEncoded ) - *pNonEncoded = NULL; - - return &rMap; -} - -//-------------------------------------------------------------------------- - -void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont, - bool bVertical, - Int32Vector& rWidths, - Ucs2UIntMap& rUnicodeEnc ) -{ - // create matching ImplFontSelectData - // we need just enough to get to the font file data - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); - - // TODO: much better solution: move SetFont and restoration of old font to caller - ScopedFont aOldFont(*this); - - float fScale = 0.0; - ImplDoSetFont( &aIFSD, fScale, 0); - - if( pFont->IsSubsettable() ) - { - // get raw font file data - DWORD nFontSize1 = ::Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); - if( nFontSize1 == FT2_ERROR ) - return; - ScopedCharArray xRawFontData(new char[ nFontSize1 ]); - DWORD nFontSize2 = ::Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 ); - if( nFontSize1 != nFontSize2 ) - return; - - // open font file - sal_uInt32 nFaceNum = 0; - if( !*xRawFontData.get() ) // TTC candidate - nFaceNum = ~0U; // indicate "TTC font extracts only" - - ScopedTrueTypeFont aSftTTF; - int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum ); - if( nRC != SF_OK ) - return; - - int nGlyphs = GetTTGlyphCount( aSftTTF.get() ); - if( nGlyphs > 0 ) - { - rWidths.resize(nGlyphs); - std::vector<sal_uInt16> aGlyphIds(nGlyphs); - for( int i = 0; i < nGlyphs; i++ ) - aGlyphIds[i] = sal_uInt16(i); - TTSimpleGlyphMetrics* pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(), - &aGlyphIds[0], - nGlyphs, - bVertical ? 1 : 0 ); - if( pMetrics ) - { - for( int i = 0; i< nGlyphs; i++ ) - rWidths[i] = pMetrics[i].adv; - free( pMetrics ); - rUnicodeEnc.clear(); - } - const ImplOs2FontData* pWinFont = static_cast<const ImplOs2FontData*>(pFont); - const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); - DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); - - int nCharCount = pMap->GetCharCount(); - sal_uInt32 nChar = pMap->GetFirstChar(); - for( int i = 0; i < nCharCount; i++ ) - { - if( nChar < 0x00010000 ) - { - sal_uInt16 nGlyph = ::MapChar( aSftTTF.get(), - static_cast<sal_uInt16>(nChar), - bVertical ? 1 : 0 ); - if( nGlyph ) - rUnicodeEnc[ static_cast<sal_Unicode>(nChar) ] = nGlyph; - } - nChar = pMap->GetNextChar( nChar ); - } - } - } - else if( pFont->IsEmbeddable() ) - { - // get individual character widths - rWidths.clear(); - rUnicodeEnc.clear(); - rWidths.reserve( 224 ); - for( sal_Unicode i = 32; i < 256; ++i ) - { - int nCharWidth = 0; - if( Ft2QueryStringWidthW( mhPS, (LPWSTR)&i, 1, (LONG*)&nCharWidth ) ) - { - rUnicodeEnc[ i ] = rWidths.size(); - rWidths.push_back( nCharWidth ); - } - } - } -} - -//-------------------------------------------------------------------------- - -void Os2SalGraphics::DrawServerFontLayout( const ServerFontLayout& ) -{} - -//-------------------------------------------------------------------------- - -SystemFontData Os2SalGraphics::GetSysFontData( int nFallbacklevel ) const -{ - SystemFontData aSysFontData; - - if (nFallbacklevel >= MAX_FALLBACK) nFallbacklevel = MAX_FALLBACK - 1; - if (nFallbacklevel < 0 ) nFallbacklevel = 0; - - aSysFontData.nSize = sizeof( SystemFontData ); - aSysFontData.hFont = mhFonts[nFallbacklevel]; - aSysFontData.bFakeBold = false; - aSysFontData.bFakeItalic = false; - aSysFontData.bAntialias = true; - aSysFontData.bVerticalCharacterType = false; - - return aSysFontData; -} - -//-------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/salprn.cxx b/vcl/os2/source/gdi/salprn.cxx deleted file mode 100644 index 7290cdbcb9fe..000000000000 --- a/vcl/os2/source/gdi/salprn.cxx +++ /dev/null @@ -1,1818 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// use this define to disable the DJP support -// #define NO_DJP - -#define INCL_DOSMODULEMGR -#define INCL_DEV -#define INCL_SPL -#define INCL_SPLERRORS -#define INCL_SPLDOSPRINT -#define INCL_DEVDJP - -#define INCL_GPI -#define INCL_DOSSEMAPHORES -#define INCL_PM -#include <svpm.h> -#include <pmdjp.h> - -#include <string.h> - -#define _SV_SALPRN_CXX -#include <tools/debug.hxx> -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salframe.h> -#include <vcl/salptype.hxx> -#include <salprn.h> -#include <vcl/print.h> -#include <vcl/jobset.h> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ======================================================================= - -// ----------------------- -// - struct ImplFormInfo - -// ----------------------- - -struct ImplFormInfo -{ - long mnPaperWidth; - long mnPaperHeight; -#ifndef NO_DJP - DJPT_PAPERSIZE mnId; -#endif -}; - -// ======================================================================= - -// ----------------------- -// - struct ImplTrayInfo - -// ----------------------- - -struct ImplTrayInfo -{ - CHAR maName[32]; - CHAR maDisplayName[64]; - DJPT_TRAYTYPE mnId; - - ImplTrayInfo( const char* pTrayName, - const char* pTrayDisplayName ) - { - strcpy( maName, pTrayName); - strcpy( maDisplayName, pTrayDisplayName); - } -}; - -// ======================================================================= - -struct ImplQueueSalSysData -{ - ByteString maPrinterName; // pszPrinters - ByteString maName; // pszName bzw. LogAddress - ByteString maOrgDriverName; // pszDriverName (maDriverName.maDeviceName) - ByteString maDriverName; // pszDriverName bis . - ByteString maDeviceName; // pszDriverName nach . - PDRIVDATA mpDrivData; - - ImplQueueSalSysData( const ByteString& rPrinterName, - const ByteString& rName, - const ByteString& rDriverName, - const ByteString& rDeviceName, - const ByteString& rOrgDriverName, - PDRIVDATA pDrivData ); - ~ImplQueueSalSysData(); -}; - -// ----------------------------------------------------------------------- - -ImplQueueSalSysData::ImplQueueSalSysData( const ByteString& rPrinterName, - const ByteString& rName, - const ByteString& rOrgDriverName, - const ByteString& rDriverName, - const ByteString& rDeviceName, - PDRIVDATA pDrivData ) : - maPrinterName( rPrinterName ), - maName( rName ), - maOrgDriverName( rName ), - maDriverName( rDriverName ), - maDeviceName( rDeviceName ) -{ - if ( pDrivData ) - { - mpDrivData = (PDRIVDATA)new BYTE[pDrivData->cb]; - memcpy( mpDrivData, pDrivData, pDrivData->cb ); - } - else - mpDrivData = NULL; -} - -// ----------------------------------------------------------------------- - -ImplQueueSalSysData::~ImplQueueSalSysData() -{ - delete mpDrivData; -} - -// ======================================================================= - -static ULONG ImplPMQueueStatusToSal( USHORT nPMStatus ) -{ - ULONG nStatus = 0; - if ( nPMStatus & PRQ3_PAUSED ) - nStatus |= QUEUE_STATUS_PAUSED; - if ( nPMStatus & PRQ3_PENDING ) - nStatus |= QUEUE_STATUS_PENDING_DELETION; - if ( !nStatus ) - nStatus |= QUEUE_STATUS_READY; - return nStatus; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) -{ - APIRET rc; - ULONG nNeeded; - ULONG nReturned; - ULONG nTotal; - - // query needed size of the buffer for the QueueInfo - rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); - if( nNeeded == 0 ) - return; - - // create the buffer for the QueueInfo - PCHAR pQueueData = new CHAR[nNeeded]; - - // query QueueInfos - rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); - - PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData; - for ( int i = 0; i < nReturned; i++ ) - { - // create entry for the QueueInfo array - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - - ByteString aOrgDriverName( pPrqInfo->pszDriverName); - ByteString aName( pPrqInfo->pszName); - pInfo->maDriver = ::rtl::OStringToOUString (aOrgDriverName, gsl_getSystemTextEncoding()); - pInfo->maPrinterName = ::rtl::OStringToOUString (pPrqInfo->pszComment, gsl_getSystemTextEncoding()); - pInfo->maLocation = ::rtl::OStringToOUString (aName, gsl_getSystemTextEncoding()); - pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus ); - pInfo->mnJobs = pPrqInfo->cJobs; - // pInfo->maComment = !!! - - // Feststellen, ob Name doppelt - PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData; - for ( int j = 0; j < nReturned; j++ ) - { - // Wenn Name doppelt, erweitern wir diesen um die Location - if ( (j != i) && - (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) ) - { - pInfo->maPrinterName += ';'; - pInfo->maPrinterName += pInfo->maLocation; - } - pTempPrqInfo++; - } - - // pszDriver in DriverName (bis .) und DeviceName (nach .) aufsplitten - PSZ pDriverName; - PSZ pDeviceName; - if ( (pDriverName = strchr( pPrqInfo->pszDriverName, '.' )) != 0 ) - { - *pDriverName = 0; - pDeviceName = pDriverName + 1; - } - else - pDeviceName = NULL; - - // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit - // ein memcmp vom JobSetup auch funktioniert - if ( pPrqInfo->pDriverData && - (pPrqInfo->pDriverData->cb >= sizeof( pPrqInfo->pDriverData )) ) - { - int nDeviceNameLen = strlen( pPrqInfo->pDriverData->szDeviceName ); - memset( pPrqInfo->pDriverData->szDeviceName+nDeviceNameLen, - 0, - sizeof( pPrqInfo->pDriverData->szDeviceName )-nDeviceNameLen ); - } - - // save driver data and driver names - ByteString aPrinterName( pPrqInfo->pszPrinters); - ByteString aDriverName( pPrqInfo->pszDriverName); - ByteString aDeviceName; - if ( pDeviceName ) - aDeviceName = pDeviceName; - pInfo->mpSysData = new ImplQueueSalSysData( aPrinterName, aName, - aOrgDriverName, - aDriverName, aDeviceName, - pPrqInfo->pDriverData ); - - // add queue to the list - pList->Add( pInfo ); - - // increment to next element of the QueueInfo array - pPrqInfo++; - } - - delete [] pQueueData; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) -{ - APIRET rc; - ULONG nNeeded; - ULONG nReturned; - ULONG nTotal; - - // query needed size of the buffer for the QueueInfo - rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); - if( nNeeded == 0 ) - return; - - // create the buffer for the QueueInfo - PCHAR pQueueData = new CHAR[nNeeded]; - - // query QueueInfos - rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); - - PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData; - for ( int i = 0; i < nReturned; i++ ) - { - ImplQueueSalSysData* pSysData = (ImplQueueSalSysData*)(pInfo->mpSysData); - if ( pSysData->maPrinterName.Equals( pPrqInfo->pszPrinters ) && - pSysData->maName.Equals( pPrqInfo->pszName ) && - pSysData->maOrgDriverName.Equals( pPrqInfo->pszDriverName ) ) - { - pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus ); - pInfo->mnJobs = pPrqInfo->cJobs; - break; - } - - // increment to next element of the QueueInfo array - pPrqInfo++; - } - - delete [] pQueueData; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) -{ - delete ((ImplQueueSalSysData*)(pInfo->mpSysData)); - delete pInfo; -} - -// ----------------------------------------------------------------------- - -XubString Os2SalInstance::GetDefaultPrinter() -{ - APIRET rc; - ULONG nNeeded; - ULONG nReturned; - ULONG nTotal; - char szQueueName[255]; - XubString aDefaultName; - - // query default queue - if ( !PrfQueryProfileString( HINI_PROFILE, SPL_INI_SPOOLER, "QUEUE", 0, szQueueName, sizeof( szQueueName ) ) ) - return aDefaultName; - - // extract first queue name - PSZ pStr; - if ( (pStr = strchr( szQueueName, ';' )) != 0 ) - *pStr = 0; - - // query needed size of the buffer for the QueueInfo - rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); - if ( nNeeded == 0 ) - return aDefaultName; - - // create the buffer for the QueueInfo - PCHAR pQueueData = new CHAR[ nNeeded ]; - - // query QueueInfos - rc = SplEnumQueue ((PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); - - // find printer name for default queue - PPRQINFO3 pPrqInfo = (PPRQINFO3) pQueueData; - for ( int i = 0; i < nReturned; i++ ) - { - if ( strcmp( pPrqInfo->pszName, szQueueName ) == 0 ) - { - aDefaultName = ::rtl::OStringToOUString (pPrqInfo->pszComment, gsl_getSystemTextEncoding()); - - // Feststellen, ob Name doppelt - PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData; - for ( int j = 0; j < nReturned; j++ ) - { - // Wenn Name doppelt, erweitern wir diesen um die Location - if ( (j != i) && - (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) ) - { - String pszName( ::rtl::OStringToOUString (pPrqInfo->pszName, gsl_getSystemTextEncoding())); - aDefaultName += ';'; - aDefaultName += pszName; - } - pTempPrqInfo++; - } - break; - } - - // increment to next element of the QueueInfo array - pPrqInfo++; - } - - delete [] pQueueData; - - return aDefaultName; -} - -// ======================================================================= - -static void* ImplAllocPrnMemory( size_t n ) -{ - return calloc( n, 1); -} - -// ----------------------------------------------------------------------- - -inline void ImplFreePrnMemory( void* p ) -{ - free( p ); -} - -// ----------------------------------------------------------------------- - -static PDRIVDATA ImplPrnDrivData( const ImplJobSetup* pSetupData ) -{ - // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf - // unseren Daten arbeiten, da es durch Konfigurationsprobleme - // sein kann, das der Druckertreiber bei uns Daten ueberschreibt. - // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw. - // sind dadurch leichter zu finden - - if ( !pSetupData->mpDriverData ) - return NULL; - - DBG_ASSERT( ((PDRIVDATA)(pSetupData->mpDriverData))->cb == pSetupData->mnDriverDataLen, - "ImplPrnDrivData() - SetupDataLen != DriverDataLen" ); - - PDRIVDATA pDrivData = (PDRIVDATA)ImplAllocPrnMemory( pSetupData->mnDriverDataLen ); - memcpy( pDrivData, pSetupData->mpDriverData, pSetupData->mnDriverDataLen ); - return pDrivData; -} - -// ----------------------------------------------------------------------- - -static void ImplUpdateSetupData( const PDRIVDATA pDrivData, ImplJobSetup* pSetupData ) -{ - // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf - // unseren Daten arbeiten, da es durch Konfigurationsprobleme - // sein kann, das der Druckertreiber bei uns Daten ueberschreibt. - // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw. - // sind dadurch leichter zu finden - - if ( !pDrivData || !pDrivData->cb ) - { - if ( pSetupData->mpDriverData ) - rtl_freeMemory( pSetupData->mpDriverData ); - pSetupData->mpDriverData = NULL; - pSetupData->mnDriverDataLen = 0; - } - else - { - // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit - // ein memcmp vom JobSetup auch funktioniert - if ( pDrivData->cb >= sizeof( pDrivData ) ) - { - int nDeviceNameLen = strlen( pDrivData->szDeviceName ); - memset( pDrivData->szDeviceName+nDeviceNameLen, - 0, - sizeof( pDrivData->szDeviceName )-nDeviceNameLen ); - } - - if ( pSetupData->mpDriverData ) - { - if ( pSetupData->mnDriverDataLen != pDrivData->cb ) - rtl_freeMemory( pSetupData->mpDriverData ); - pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb); - } - else - pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb); - pSetupData->mnDriverDataLen = pDrivData->cb; - memcpy( pSetupData->mpDriverData, pDrivData, pDrivData->cb ); - } - - if ( pDrivData ) - ImplFreePrnMemory( pDrivData ); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplPaperSizeEqual( long nPaperWidth1, long nPaperHeight1, - long nPaperWidth2, long nPaperHeight2 ) -{ - return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) && - ((nPaperHeight1 >= nPaperHeight2-1) && (nPaperHeight1 <= nPaperHeight2+1))); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplIsDriverDJPEnabled( HDC hDC ) -{ -#ifdef NO_DJP - return FALSE; -#else - // Ueber OS2-Ini kann DJP disablte werden - if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_USEDJP, 1 ) ) - return FALSE; - - // Testen, ob DJP-Interface am Drucker vorhanden - LONG lQuery; - APIRET rc; - - lQuery = DEVESC_QUERYSIZE; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - lQuery = DEVESC_QUERYJOBPROPERTIES; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - lQuery = DEVESC_SETJOBPROPERTIES; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - return TRUE; -#endif -} - -// ----------------------------------------------------------------------- - -static void ImplFormatInputList( PDJP_ITEM pDJP, PQUERYTUPLE pTuple ) -{ - // Loop through the query elements - BOOL fContinue = TRUE; - do - { - pDJP->cb = sizeof (DJP_ITEM); - pDJP->ulProperty = pTuple->ulProperty; - pDJP->lType = pTuple->lType; - pDJP->ulNumReturned = 0; - pDJP->ulValue = DJP_NONE; - - // at EOL? - fContinue = DJP_NONE != pTuple->ulProperty; - - // Move to next item structure and tuplet - pDJP++; - pTuple++; - } - while ( fContinue ); -} - -// ----------------------------------------------------------------------- - -static void ImplFreeFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter ) -{ - if ( pOs2SalInfoPrinter->mnFormCount ) - { - for ( USHORT i = 0; i < pOs2SalInfoPrinter->mnFormCount; i++ ) - delete pOs2SalInfoPrinter->mpFormArray[i]; - delete [] pOs2SalInfoPrinter->mpFormArray; - pOs2SalInfoPrinter->mnFormCount = 0; - } - - if ( pOs2SalInfoPrinter->mnTrayCount ) - { - for ( USHORT i = 0; i < pOs2SalInfoPrinter->mnTrayCount; i++ ) - delete pOs2SalInfoPrinter->mpTrayArray[i]; - delete [] pOs2SalInfoPrinter->mpTrayArray; - pOs2SalInfoPrinter->mnTrayCount = 0; - } -} - -// ----------------------------------------------------------------------- - -static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData ) -{ - ImplFreeFormAndTrayList( pOs2SalInfoPrinter ); - - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_CJ_FORM, DJP_ALL, - DJP_CJ_TRAYNAME, DJP_ALL, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData ); - LONG nDrivDataSize = pCopyDrivData->cb; - PBYTE pDrivData = (PBYTE)pCopyDrivData; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - pDrivData ); - if ( DEV_OK != rc ) - { - ImplFreePrnMemory( pCopyDrivData ); - return; - } - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - // do it! - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - pDrivData ); - ImplFreePrnMemory( pCopyDrivData ); - - if ( (DEV_OK == rc) || (DEV_WARNING == rc) ) - { - // Loop through the query elements - PQUERYTUPLE pTuple = pQuerySize->aTuples; - while ( DJP_NONE != pTuple->ulProperty ) - { - if ( pDJP->ulProperty == DJP_CJ_FORM ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM ); - - pOs2SalInfoPrinter->mnFormCount = pDJP->ulNumReturned; - pOs2SalInfoPrinter->mpFormArray = new PIMPLFORMINFO[pOs2SalInfoPrinter->mnFormCount]; - for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) - { - ImplFormInfo* pInfo = new ImplFormInfo; - pInfo->mnPaperWidth = pElm->hcInfo.cx; - pInfo->mnPaperHeight = pElm->hcInfo.cy; - pInfo->mnId = pElm->djppsFormID; - pOs2SalInfoPrinter->mpFormArray[i] = pInfo; - } - } - } - else if ( pDJP->ulProperty == DJP_CJ_TRAYNAME ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_TRAYNAME pElm = DJP_ELEMENTP( *pDJP, DJPT_TRAYNAME ); - - pOs2SalInfoPrinter->mnTrayCount = pDJP->ulNumReturned; - pOs2SalInfoPrinter->mpTrayArray = new PIMPLTRAYINFO[pOs2SalInfoPrinter->mnTrayCount]; - for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) - { - ImplTrayInfo* pInfo = new ImplTrayInfo( pElm->szTrayname, pElm->szDisplayTrayname ); - pInfo->mnId = pElm->djpttTrayID; - pOs2SalInfoPrinter->mpTrayArray[i] = pInfo; - } - } - } - - pDJP = DJP_NEXT_STRUCTP( pDJP ); - pTuple++; - } - } - - delete [] pBuffer; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplGetCurrentSettings( Os2SalInfoPrinter* pOs2SalInfoPrinter, ImplJobSetup* pSetupData ) -{ - // Um den aktuellen Tray zu ermitteln, brauchen wir auch die Listen dazu - if ( !pOs2SalInfoPrinter->mnFormCount ) - ImplGetFormAndTrayList( pOs2SalInfoPrinter, pSetupData ); - - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_ORIENTATION, DJP_CURRENT, - DJP_CJ_FORM, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData ); - LONG nDrivDataSize = pCopyDrivData->cb; - PBYTE pDrivData = (PBYTE)pCopyDrivData; - BOOL bResult; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - pDrivData ); - if ( DEV_OK != rc ) - { - ImplFreePrnMemory( pCopyDrivData ); - return FALSE; - } - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - rc = DevEscape( pOs2SalInfoPrinter->mhDC, - DEVESC_QUERYJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - pDrivData ); - if ( (DEV_OK == rc) || (DEV_WARNING == rc) ) - { - // aktuelle Setup-Daten uebernehmen - ImplUpdateSetupData( pCopyDrivData, pSetupData ); - - // Loop through the query elements - PQUERYTUPLE pTuple = pQuerySize->aTuples; - while ( DJP_NONE != pTuple->ulProperty ) - { - if ( pDJP->ulProperty == DJP_SJ_ORIENTATION ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION ); - if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) ) - pSetupData->meOrientation = ORIENTATION_PORTRAIT; - else - pSetupData->meOrientation = ORIENTATION_LANDSCAPE; - } - } - else if ( pDJP->ulProperty == DJP_CJ_FORM ) - { - if ( pDJP->ulNumReturned ) - { - PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM ); - - pSetupData->mnPaperWidth = pElm->hcInfo.cx*100; - pSetupData->mnPaperHeight = pElm->hcInfo.cy*100; - switch( pElm->djppsFormID ) - { - case DJP_PSI_A3: - pSetupData->mePaperFormat = PAPER_A3; - break; - - case DJP_PSI_A4: - pSetupData->mePaperFormat = PAPER_A4; - break; - - case DJP_PSI_A5: - pSetupData->mePaperFormat = PAPER_A5; - break; - - case DJP_PSI_B4: - pSetupData->mePaperFormat = PAPER_B4; - break; - - case DJP_PSI_B5: - pSetupData->mePaperFormat = PAPER_B5; - break; - - case DJP_PSI_LETTER: - pSetupData->mePaperFormat = PAPER_LETTER; - break; - - case DJP_PSI_LEGAL: - pSetupData->mePaperFormat = PAPER_LEGAL; - break; - - case DJP_PSI_TABLOID: - pSetupData->mePaperFormat = PAPER_TABLOID; - break; - - default: - pSetupData->mePaperFormat = PAPER_USER; - break; - } - - // Wir suchen zuerst ueber den Namen/Id und dann ueber die Id - BOOL bTrayFound = FALSE; - USHORT j; - for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ ) - { - if ( (pOs2SalInfoPrinter->mpTrayArray[j]->mnId == pElm->djpttTrayID) && - (pOs2SalInfoPrinter->mpTrayArray[j]->maName == pElm->szTrayname) ) - { - pSetupData->mnPaperBin = j; - bTrayFound = TRUE; - break; - } - } - if ( !bTrayFound ) - { - for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ ) - { - if ( pOs2SalInfoPrinter->mpTrayArray[j]->mnId == pElm->djpttTrayID ) - { - pSetupData->mnPaperBin = j; - bTrayFound = TRUE; - break; - } - } - } - // Wenn wir Ihn immer noch nicht gefunden haben, setzen - // wir ihn auf DontKnow - if ( !bTrayFound ) - pSetupData->mnPaperBin = 0xFFFF; - } - } - - pDJP = DJP_NEXT_STRUCTP( pDJP ); - pTuple++; - } - - bResult = TRUE; - } - else - { - ImplFreePrnMemory( pCopyDrivData ); - bResult = FALSE; - } - - delete [] pBuffer; - - return bResult; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData, - Orientation eOrientation ) -{ - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_ORIENTATION, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - LONG nDrivDataSize = pDriverData->cb; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( hPrinterDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - (PBYTE)pDriverData ); - if ( DEV_OK != rc ) - return FALSE; - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - pDJP->cb = sizeof( DJP_ITEM ); - pDJP->ulProperty = DJP_SJ_ORIENTATION; - pDJP->lType = DJP_CURRENT; - pDJP->ulValue = (eOrientation == ORIENTATION_PORTRAIT) - ? DJP_ORI_PORTRAIT - : DJP_ORI_LANDSCAPE; - - // do it! - rc = DevEscape( hPrinterDC, - DEVESC_SETJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - (PBYTE)pDriverData ); - - delete [] pBuffer; - - return ((DEV_OK == rc) || (DEV_WARNING == rc)); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSetPaperSize( HDC hPrinterDC, PDRIVDATA pDriverData, - DJPT_PAPERSIZE nOS2PaperFormat ) -{ - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_PAPERSIZE, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - LONG nDrivDataSize = pDriverData->cb; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( hPrinterDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - (PBYTE)pDriverData ); - if ( DEV_OK != rc ) - return FALSE; - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - PDJP_ITEM pStartDJP = pDJP; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - // Neue Daten zuweisen - pDJP->cb = sizeof( DJP_ITEM ); - pDJP->ulProperty = DJP_SJ_PAPERSIZE; - pDJP->lType = DJP_CURRENT; - pDJP->ulValue = nOS2PaperFormat; - - // und setzen - rc = DevEscape( hPrinterDC, - DEVESC_SETJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - (PBYTE)pDriverData ); - - delete [] pBuffer; - - return ((DEV_OK == rc) || (DEV_WARNING == rc)); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSetPaperBin( HDC hPrinterDC, PDRIVDATA pDriverData, - ImplTrayInfo* pTrayInfo ) -{ - LONG alQuery[] = - { - 0, 0, // First two members of QUERYSIZE - DJP_SJ_TRAYTYPE, DJP_CURRENT, - DJP_NONE, DJP_NONE // EOL marker - }; - - APIRET rc; - PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; - PBYTE pBuffer = NULL; - LONG nAlloc = 0; - LONG nDrivDataSize = pDriverData->cb; - - // find out how many bytes to allocate - pQuerySize->cb = sizeof( alQuery ); - rc = DevEscape( hPrinterDC, - DEVESC_QUERYSIZE, - sizeof( alQuery ), - (PBYTE)pQuerySize, - &nDrivDataSize, - (PBYTE)pDriverData ); - if ( DEV_OK != rc ) - return FALSE; - - // allocate the memory - nAlloc = pQuerySize->ulSizeNeeded; - pBuffer = (PBYTE)new BYTE[nAlloc]; - - // set up the input - PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; - ImplFormatInputList( pDJP, pQuerySize->aTuples ); - - // Neue Daten zuweisen - pDJP->cb = sizeof( DJP_ITEM ); - pDJP->ulProperty = DJP_SJ_TRAYTYPE; - pDJP->lType = DJP_CURRENT; - pDJP->ulValue = pTrayInfo->mnId; - - // und setzen - rc = DevEscape( hPrinterDC, - DEVESC_SETJOBPROPERTIES, - nAlloc, - pBuffer, - &nDrivDataSize, - (PBYTE)pDriverData ); - - delete [] pBuffer; - - return ((DEV_OK == rc) || (DEV_WARNING == rc)); -} - -// ======================================================================= - -static BOOL ImplSalCreateInfoPrn( Os2SalInfoPrinter* pPrinter, PDRIVDATA pDriverData, - HDC& rDC, HPS& rPS ) -{ - SalData* pSalData = GetSalData(); - - // create info context - DEVOPENSTRUC devOpenStruc; - memset( &devOpenStruc, 0, sizeof( devOpenStruc ) ); - devOpenStruc.pszLogAddress = (char*)pPrinter->maName.GetBuffer(); - devOpenStruc.pszDriverName = (char*)pPrinter->maDriverName.GetBuffer(); - devOpenStruc.pdriv = pDriverData; - devOpenStruc.pszDataType = "PM_Q_STD"; - - HDC hDC = DevOpenDC( pSalData->mhAB, OD_INFO, "*", - 4, (PDEVOPENDATA)&devOpenStruc, (HDC)NULL); - if ( !hDC ) - return FALSE; - - // create presentation space - SIZEL sizel; - sizel.cx = 0; - sizel.cy = 0; - HPS hPS = Ft2CreatePS( pSalData->mhAB, hDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS ); - if ( !hPS ) - { - DevCloseDC( hDC ); - return FALSE; - } - - rDC = hDC; - rPS = hPS; - return TRUE; -} - -// ----------------------------------------------------------------------- - -static void ImplSalDestroyInfoPrn( Os2SalInfoPrinter* pPrinter ) -{ - ImplSalDeInitGraphics( pPrinter->mpGraphics); - Ft2Associate( pPrinter->mhPS, 0 ); - Ft2DestroyPS( pPrinter->mhPS ); - DevCloseDC( pPrinter->mhDC ); -} - -// ======================================================================= - -SalInfoPrinter* Os2SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pSetupData ) -{ - ImplQueueSalSysData* pSysQueueData = (ImplQueueSalSysData*)(pQueueInfo->mpSysData); - Os2SalInfoPrinter* pPrinter = new Os2SalInfoPrinter; - pPrinter->maPrinterName = pSysQueueData->maPrinterName; - pPrinter->maName = pSysQueueData->maName; - pPrinter->maDriverName = pSysQueueData->maDriverName; - pPrinter->maDeviceName = pSysQueueData->maDeviceName; - - // Nur Setup-Daten uebernehmen, wenn Treiber und Laenge der Treiberdaten - // uebereinstimmt - PDRIVDATA pDriverData; - BOOL bUpdateDriverData; - if ( pSetupData->mpDriverData && pSysQueueData->mpDrivData && - (pSetupData->mnSystem == JOBSETUP_SYSTEM_OS2) && - (pSetupData->mnDriverDataLen == pSysQueueData->mpDrivData->cb) && - (strcmp( ((PDRIVDATA)pSetupData->mpDriverData)->szDeviceName, - pSysQueueData->mpDrivData->szDeviceName ) == 0) ) - { - pDriverData = PDRIVDATA( pSetupData->mpDriverData ); - bUpdateDriverData = FALSE; - } - else - { - pDriverData = pSysQueueData->mpDrivData; - bUpdateDriverData = TRUE; - } - if ( pDriverData ) - pPrinter->maJobSetupDeviceName = pDriverData->szDeviceName; - - if ( !ImplSalCreateInfoPrn( pPrinter, pDriverData, - pPrinter->mhDC, - pPrinter->mhPS ) ) - { - delete pPrinter; - return NULL; - } - - // create graphics object for output - Os2SalGraphics* pGraphics = new Os2SalGraphics; - pGraphics->mhDC = pPrinter->mhDC; - pGraphics->mhPS = pPrinter->mhPS; - pGraphics->mhWnd = 0; - pGraphics->mbPrinter = TRUE; - pGraphics->mbVirDev = FALSE; - pGraphics->mbWindow = FALSE; - pGraphics->mbScreen = FALSE; - - ImplSalInitGraphics( pGraphics ); - pPrinter->mpGraphics = pGraphics; - - // check printer driver for DJP support - pPrinter->mbDJPSupported = ImplIsDriverDJPEnabled( pPrinter->mhDC ); - - if ( bUpdateDriverData ) - { - if ( pSetupData->mpDriverData ) - rtl_freeMemory( pSetupData->mpDriverData); - pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDriverData->cb); - memcpy( pSetupData->mpDriverData, pDriverData, pDriverData->cb ); - pSetupData->mnDriverDataLen = pDriverData->cb; - } - - // retrieve current settings from printer driver and store them to system independend data! - if ( pPrinter->mbDJPSupported ) - ImplGetCurrentSettings( pPrinter, pSetupData ); - pSetupData->mnSystem = JOBSETUP_SYSTEM_OS2; - - return pPrinter; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) -{ - delete pPrinter; -} - -// ======================================================================= - -Os2SalInfoPrinter::Os2SalInfoPrinter() -{ - mhDC = 0; - mhPS = 0; - mpGraphics = NULL; - mbGraphics = FALSE; - mbDJPSupported = FALSE; - mnFormCount = 0; - mpFormArray = NULL; - mnTrayCount = 0; - mpTrayArray = NULL; -} - -// ----------------------------------------------------------------------- - -Os2SalInfoPrinter::~Os2SalInfoPrinter() -{ - if ( mpGraphics ) - { - ImplSalDestroyInfoPrn( this ); - delete mpGraphics; - } - - ImplFreeFormAndTrayList( this ); -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalInfoPrinter::GetGraphics() -{ - if ( mbGraphics ) - return NULL; - - if ( mpGraphics ) - mbGraphics = TRUE; - - return mpGraphics; -} - -// ----------------------------------------------------------------------- - -void Os2SalInfoPrinter::ReleaseGraphics( SalGraphics* ) -{ - mbGraphics = FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) -{ - PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData ); - if ( !pDrivData ) - return FALSE; - - APIRET rc = DevPostDeviceModes( GetSalData()->mhAB, pDrivData, - maDriverName.GetBuffer(), - maDeviceName.GetBuffer(), - maPrinterName.GetBuffer(), - DPDM_POSTJOBPROP ); - if ( rc == DEV_OK ) - { - ImplUpdateSetupData( pDrivData, pSetupData ); - - // update DC and PS - HDC hDC; - HPS hPS; - if ( !ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) ) - return FALSE; - - // Alten Printer DC/PS zerstoeren - ImplSalDestroyInfoPrn( this ); - - // Neue Daten setzen und initialisieren - mhDC = hDC; - mhPS = hPS; - mpGraphics->mhDC = mhDC; - mpGraphics->mhPS = mhPS; - ImplSalInitGraphics( mpGraphics ); - - // retrieve current settings from printer driver and store them to system independend data! - ImplFreeFormAndTrayList( this ); - if ( mbDJPSupported ) - ImplGetCurrentSettings( this, pSetupData ); - - return TRUE; - } - else - { - ImplFreePrnMemory( pDrivData ); - return FALSE; - } -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) -{ - // Wir koennen nur Treiberdaten von OS2 setzen - if ( pSetupData->mnSystem != JOBSETUP_SYSTEM_OS2 ) - return FALSE; - - PDRIVDATA pNewDrivData = (PDRIVDATA)(pSetupData->mpDriverData); - if ( !pNewDrivData ) - return FALSE; - - // Testen, ob Printerdaten fuer den gleichen Printer uebergeben werden, - // da einige Treiber zu Abstuerzen neigen, wenn Daten von einem anderen - // Printer gesetzt werden - if ( !maJobSetupDeviceName.Equals( pNewDrivData->szDeviceName )) - return FALSE; - - // update DC and PS - HDC hDC; - HPS hPS; - if ( !ImplSalCreateInfoPrn( this, pNewDrivData, hDC, hPS ) ) - return FALSE; - - // Alten Printer DC/PS zerstoeren - ImplSalDestroyInfoPrn( this ); - - // Neue Daten setzen und initialisieren - mhDC = hDC; - mhPS = hPS; - mpGraphics->mhDC = mhDC; - mpGraphics->mhPS = mhPS; - ImplSalInitGraphics( mpGraphics ); - - // retrieve current settings from printer driver and store them to system independend data! - ImplFreeFormAndTrayList( this ); - if ( mbDJPSupported ) - ImplGetCurrentSettings( this, pSetupData ); - - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) -{ - // needs DJP support - if ( !mbDJPSupported ) - return FALSE; - - PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData ); - - if ( !pDrivData ) - return FALSE; - - BOOL bOK = FALSE; - - // set orientation - if ( nFlags & SAL_JOBSET_ORIENTATION ) - { - if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) ) - bOK = TRUE; - } - - // set paper size - if ( nFlags & SAL_JOBSET_PAPERSIZE ) - { - // Papierformat ermitteln - DJPT_PAPERSIZE nOS2PaperFormat; - switch ( pSetupData->mePaperFormat ) - { - case PAPER_A3: - nOS2PaperFormat = DJP_PSI_A3; - break; - - case PAPER_A4: - nOS2PaperFormat = DJP_PSI_A4; - break; - - case PAPER_A5: - nOS2PaperFormat = DJP_PSI_A5; - break; - - case PAPER_B4: - nOS2PaperFormat = DJP_PSI_B4; - break; - - case PAPER_B5: - nOS2PaperFormat = DJP_PSI_B5; - break; - - case PAPER_LETTER: - nOS2PaperFormat = DJP_PSI_LETTER; - break; - - case PAPER_LEGAL: - nOS2PaperFormat = DJP_PSI_LEGAL; - break; - - case PAPER_TABLOID: - nOS2PaperFormat = DJP_PSI_TABLOID; - break; - - default: - { - nOS2PaperFormat = DJP_PSI_NONE; - // OS2 rechnet in Millimetern - long nPaperWidth = pSetupData->mnPaperWidth / 100; - long nPaperHeight = pSetupData->mnPaperHeight / 100; - // Ansonsten ueber die Papiergroesse suchen - for( int i = 0; i < mnFormCount; i++ ) - { - ImplFormInfo* pFormInfo = mpFormArray[i]; - if ( ImplPaperSizeEqual( nPaperWidth, nPaperHeight, - pFormInfo->mnPaperWidth, pFormInfo->mnPaperHeight ) ) - { - nOS2PaperFormat = pFormInfo->mnId; - break; - } - } - } - break; - } - - if ( nOS2PaperFormat != DJP_PSI_NONE ) - { - if ( ImplSetPaperSize( mhDC, pDrivData, nOS2PaperFormat ) ) - bOK = TRUE; - } - } - - // set paper tray - if ( (nFlags & SAL_JOBSET_PAPERBIN) && (pSetupData->mnPaperBin < mnTrayCount) ) - { - if ( ImplSetPaperBin( mhDC, pDrivData, - mpTrayArray[pSetupData->mnPaperBin] ) ) - bOK = TRUE; - } - - if ( bOK ) - { - ImplUpdateSetupData( pDrivData, pSetupData ); - - // query current driver settings - ImplFreeFormAndTrayList( this ); - if ( ImplGetCurrentSettings( this, pSetupData ) ) - { - // update DC and PS - HDC hDC; - HPS hPS; - if ( ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) ) - { - // Alten Printer DC/PS zerstoeren - ImplSalDestroyInfoPrn( this ); - - // Neue Daten setzen und initialisieren - mhDC = hDC; - mhPS = hPS; - mpGraphics->mhDC = mhDC; - mpGraphics->mhPS = mhPS; - ImplSalInitGraphics( mpGraphics ); - } - else - bOK = FALSE; - } - else - bOK = FALSE; - } - - return bOK; -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) -{ - if ( !mbDJPSupported ) - return 1; - - // init paperbinlist if empty - if ( !mnTrayCount ) - ImplGetFormAndTrayList( this, pJobSetup ); - - // Wir haben immer einen PaperTray und wenn, das eben einen ohne - // Namen - if ( !mnTrayCount ) - return 1; - else - return mnTrayCount; -} - -// ----------------------------------------------------------------------- - -XubString Os2SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, - ULONG nPaperBin ) -{ - XubString aPaperBinName; - - if ( mbDJPSupported ) - { - // init paperbinlist if empty - if ( !mnTrayCount ) - ImplGetFormAndTrayList( this, pJobSetup ); - - if ( nPaperBin < mnTrayCount ) - aPaperBinName = ::rtl::OStringToOUString (mpTrayArray[nPaperBin]->maDisplayName, gsl_getSystemTextEncoding()); - } - - return aPaperBinName; -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalInfoPrinter::GetCapabilities( const ImplJobSetup*, USHORT nType ) -{ - switch ( nType ) - { - case PRINTER_CAPABILITIES_SUPPORTDIALOG: - return TRUE; - case PRINTER_CAPABILITIES_COPIES: - return 0xFFFF; - case PRINTER_CAPABILITIES_COLLATECOPIES: - return 0; - case PRINTER_CAPABILITIES_SETORIENTATION: - case PRINTER_CAPABILITIES_SETPAPERBIN: - case PRINTER_CAPABILITIES_SETPAPERSIZE: - case PRINTER_CAPABILITIES_SETPAPER: - return mbDJPSupported; - } - - return 0; -} - -// ----------------------------------------------------------------------- - -void Os2SalInfoPrinter::GetPageInfo( const ImplJobSetup*, - long& rOutWidth, long& rOutHeight, - long& rPageOffX, long& rPageOffY, - long& rPageWidth, long& rPageHeight ) -{ - HDC hDC = mhDC; - - // search current form - HCINFO aInfo; - int nForms = DevQueryHardcopyCaps( hDC, 0, 0, &aInfo ); - for( int i = 0; i < nForms; i++ ) - { - if ( DevQueryHardcopyCaps( hDC, i, 1, &aInfo ) >= 0 ) - { - if ( aInfo.flAttributes & HCAPS_CURRENT ) - { - // query resolution - long nXResolution; - long nYResolution; - DevQueryCaps( hDC, CAPS_HORIZONTAL_RESOLUTION, 1, &nXResolution ); - DevQueryCaps( hDC, CAPS_VERTICAL_RESOLUTION, 1, &nYResolution ); - rPageOffX = aInfo.xLeftClip * nXResolution / 1000; - rPageOffY = (aInfo.cy-aInfo.yTopClip) * nYResolution / 1000; - rPageWidth = aInfo.cx * nXResolution / 1000; - rPageHeight = aInfo.cy * nYResolution / 1000; - rOutWidth = aInfo.xPels; - rOutHeight = aInfo.yPels; - return; - } - } - } - - // use device caps if no form selected/found - long lCapsWidth = 0; - long lCapsHeight = 0; - DevQueryCaps( hDC, CAPS_WIDTH, 1L, &lCapsWidth ); - DevQueryCaps( hDC, CAPS_HEIGHT, 1L, &lCapsHeight ); - rPageOffX = 0; - rPageOffY = 0; - rOutWidth = lCapsWidth; - rOutHeight = lCapsHeight; - rPageWidth = rOutWidth; - rPageHeight = rOutHeight; -} - -// ======================================================================= - -static BOOL ImplIsDriverPrintDJPEnabled( HDC hDC ) -{ -#ifdef NO_DJP - return FALSE; -#else - // Ueber OS2-Ini kann DJP disablte werden - if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTDJP, 1 ) ) - return FALSE; - - // Testen, ob DJP-Interface am Drucker vorhanden - LONG lQuery; - APIRET rc; - - lQuery = DEVESC_QUERYSIZE; - rc = DevEscape( hDC, - DEVESC_QUERYESCSUPPORT, - sizeof( lQuery ), - (PBYTE)&lQuery, - 0, - (PBYTE)NULL ); - if ( DEV_OK != rc ) - return FALSE; - - return TRUE; -#endif -} - -// ======================================================================= - -SalPrinter* Os2SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) -{ - Os2SalPrinter* pPrinter = new Os2SalPrinter; - pPrinter->mpInfoPrinter = static_cast<Os2SalInfoPrinter*>(pInfoPrinter); - return pPrinter; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyPrinter( SalPrinter* pPrinter ) -{ - delete pPrinter; -} - -// ======================================================================= - -Os2SalPrinter::Os2SalPrinter() -{ - mhDC = 0; - mhPS = 0; - mpGraphics = NULL; - mbAbort = FALSE; - mbPrintDJPSupported = FALSE; -} - -// ----------------------------------------------------------------------- - -Os2SalPrinter::~Os2SalPrinter() -{ -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::StartJob( const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - ULONG nCopies, - bool bCollate, - bool bDirect, - ImplJobSetup* pSetupData ) -{ - DEVOPENSTRUC aDevOpenStruc; - LONG lType; - APIRET rc; - - // prepare queue information - memset( &aDevOpenStruc, 0, sizeof( aDevOpenStruc ) ); - aDevOpenStruc.pszDriverName = (PSZ)(mpInfoPrinter->maDriverName.GetBuffer()); - - // print into file? - if ( pFileName ) - { - aDevOpenStruc.pszLogAddress = (PSZ)pFileName->GetBuffer(); - aDevOpenStruc.pszDataType = "PM_Q_RAW"; - lType = OD_DIRECT; - } - else - { - aDevOpenStruc.pszLogAddress = (PSZ)(mpInfoPrinter->maName.GetBuffer()); - if ( PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTRAW, 0 ) ) - aDevOpenStruc.pszDataType = "PM_Q_RAW"; - else - aDevOpenStruc.pszDataType = "PM_Q_STD"; - lType = OD_QUEUED; - } - - ByteString jobName( rJobName, gsl_getSystemTextEncoding()); - aDevOpenStruc.pszComment = (PSZ)jobName.GetBuffer(); - - // Kopien - if ( nCopies > 1 ) - { - // OS2 kann maximal 999 Kopien - if ( nCopies > 999 ) - nCopies = 999; - sprintf( maCopyBuf, "COP=%d", nCopies); - aDevOpenStruc.pszQueueProcParams = (PSZ)maCopyBuf; - } - - // open device context - SalData* pSalData = GetSalData(); - HAB hAB = pSalData->mhAB; - aDevOpenStruc.pdriv = (PDRIVDATA)pSetupData->mpDriverData; - mhDC = DevOpenDC( hAB, - lType, - "*", - 7, - (PDEVOPENDATA)&aDevOpenStruc, - 0 ); - if ( mhDC == 0 ) - { - ERRORID nLastError = WinGetLastError( hAB ); - if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } - - // open presentation space - SIZEL sizel; - sizel.cx = 0; - sizel.cy = 0; - mhPS = Ft2CreatePS( hAB, mhDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS ); - if ( !mhPS ) - { - DevCloseDC( mhDC ); - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return NULL; - } - - // Can we print with DJP - mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC ); - - // JobName ermitteln und Job starten - PSZ pszJobName = NULL; - int nJobNameLen = 0; - if ( jobName.Len() > 0 ) - { - pszJobName = (PSZ)jobName.GetBuffer(); - nJobNameLen = jobName.Len(); - } - rc = DevEscape( mhDC, - DEVESC_STARTDOC, - nJobNameLen, (PBYTE)pszJobName, - 0, (PBYTE)NULL ); - - if ( rc != DEV_OK ) - { - ERRORID nLastError = WinGetLastError( hAB ); - if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - return FALSE; - } - - // init for first page - mbFirstPage = TRUE; - mnError = 0; - - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::EndJob() -{ - APIRET rc; - rc = DevEscape( mhDC, - DEVESC_ENDDOC, - 0, NULL, - 0, NULL); - - // destroy presentation space and device context - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::AbortJob() -{ - APIRET rc; - - rc = DevEscape( mhDC, - DEVESC_ABORTDOC, - 0, NULL, - 0, NULL ); - - // destroy SalGraphics - if ( mpGraphics ) - { - ImplSalDeInitGraphics( mpGraphics ); - delete mpGraphics; - mpGraphics = NULL; - } - - // destroy presentation space and device context - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobSetup ) -{ - APIRET rc; - - if ( mbFirstPage ) - mbFirstPage = FALSE; - else - { - PBYTE pJobData; - LONG nJobDataSize; - LONG nEscape; - if ( mbPrintDJPSupported && bNewJobSetup ) - { - nEscape = DEVESC_NEWFRAME_WPROP; - nJobDataSize = ((PDRIVDATA)(pSetupData->mpDriverData))->cb; - pJobData = (PBYTE)(pSetupData->mpDriverData); - } - else - { - nEscape = DEVESC_NEWFRAME; - nJobDataSize = 0; - pJobData = NULL; - } - rc = DevEscape( mhDC, - nEscape, - 0, NULL, - &nJobDataSize, pJobData ); - - if ( rc != DEV_OK ) - { - DevEscape( mhDC, DEVESC_ENDDOC, 0, NULL, 0, NULL); - Ft2Associate( mhPS, NULL ); - Ft2DestroyPS( mhPS ); - DevCloseDC( mhDC ); - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return NULL; - } - } - - // create SalGraphics with copy of hPS - Os2SalGraphics* pGraphics = new Os2SalGraphics; - pGraphics->mhDC = mhDC; - pGraphics->mhPS = mhPS; - pGraphics->mhWnd = 0; - pGraphics->mbPrinter = TRUE; - pGraphics->mbVirDev = FALSE; - pGraphics->mbWindow = FALSE; - pGraphics->mbScreen = FALSE; - pGraphics->mnHeight = 0; - // search current form for actual page height - HCINFO aInfo; - int nForms = DevQueryHardcopyCaps( mhDC, 0, 0, &aInfo ); - for( int i = 0; i < nForms; i++ ) - { - if ( DevQueryHardcopyCaps( mhDC, i, 1, &aInfo ) >= 0 ) - { - if ( aInfo.flAttributes & HCAPS_CURRENT ) - pGraphics->mnHeight = aInfo.yPels; - } - } - // use device caps if no form selected/found - if ( !pGraphics->mnHeight ) - DevQueryCaps( mhDC, CAPS_HEIGHT, 1L, &pGraphics->mnHeight ); - - ImplSalInitGraphics( pGraphics ); - mpGraphics = pGraphics; - - return pGraphics; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalPrinter::EndPage() -{ - if ( mpGraphics ) - { - // destroy SalGraphics - ImplSalDeInitGraphics( mpGraphics ); - delete mpGraphics; - mpGraphics = NULL; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -ULONG Os2SalPrinter::GetErrorCode() -{ - return mnError; -} - -void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) -{ - printf("Os2SalInfoPrinter::InitPaperFormats\n"); -} -int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) -{ - printf("Os2SalInfoPrinter::GetLandscapeAngle\n"); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/gdi/salvd.cxx b/vcl/os2/source/gdi/salvd.cxx deleted file mode 100644 index 5f7ab7bb0cf0..000000000000 --- a/vcl/os2/source/gdi/salvd.cxx +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> - -#include <svpm.h> - -#define _SV_SALVD_CXX -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salvd.h> - -#ifndef __H_FT2LIB -#include <wingdi.h> -#include <ft2lib.h> -#endif - -// ======================================================================= - -HBITMAP ImplCreateVirDevBitmap( HDC hDC, HPS hPS, long nDX, long nDY, - USHORT nBitCount ) -{ - if( !nBitCount ) - { - LONG nDevBitCount; - DevQueryCaps( hDC, CAPS_COLOR_BITCOUNT, 1, &nDevBitCount ); - nBitCount = nDevBitCount; - } - - LONG nPlanes; - DevQueryCaps( hDC, CAPS_COLOR_PLANES, 1, &nPlanes ); - - // entsprechende Bitmap zum OutputDevice erzeugen - HBITMAP hBitmap; - BITMAPINFOHEADER2 aBitmapInfo; - memset( &aBitmapInfo, 0, sizeof( BITMAPINFOHEADER2 ) ); - aBitmapInfo.cbFix = sizeof( BITMAPINFOHEADER2 ); - aBitmapInfo.cx = nDX; - aBitmapInfo.cy = nDY; - aBitmapInfo.cPlanes = nPlanes; - aBitmapInfo.cBitCount = (nBitCount < 4) ? 4 : nBitCount; - hBitmap = GpiCreateBitmap( hPS, &aBitmapInfo, 0, NULL, NULL ); - return hBitmap; -} - -// ----------------------------------------------------------------------- - -SalVirtualDevice* Os2SalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, - long nDX, long nDY, - USHORT nBitCount, - const SystemGraphicsData* pData ) -{ - Os2SalGraphics* pGraphics = static_cast<Os2SalGraphics*>(pSGraphics); - HAB hAB = GetSalData()->mhAB; - SIZEL size; - - // create device context (at this time allways display compatible) - DEVOPENSTRUC aDevOpenStruc = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - HDC hDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5, (PDEVOPENDATA)&aDevOpenStruc, 0 ); - if ( !hDC ) - return NULL; - - // create presentation space - size.cx = nDX; - size.cy = nDY; - HPS hPS = Ft2CreatePS( hAB, hDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS ); - if ( !hPS ) - { - DevCloseDC( hDC ); - return NULL; - } - - // create bitmap for the virtual device - HBITMAP hBmp = ImplCreateVirDevBitmap( hDC, hPS, nDX, nDY, nBitCount ); - if ( !hBmp ) - { - Ft2DestroyPS( hPS ); - DevCloseDC( hDC ); - return NULL; - } - - // init data - Os2SalVirtualDevice* pVDev = new Os2SalVirtualDevice; - Os2SalGraphics* pVirGraphics = new Os2SalGraphics; - - pVirGraphics->mhDC = hDC; - pVirGraphics->mhPS = hPS; - pVirGraphics->mhWnd = 0; - pVirGraphics->mnHeight = nDY; - pVirGraphics->mbPrinter = FALSE; - pVirGraphics->mbVirDev = TRUE; - pVirGraphics->mbWindow = FALSE; - pVirGraphics->mbScreen = pGraphics->mbScreen; - ImplSalInitGraphics( pVirGraphics ); - - pVDev->mhDC = hDC; - pVDev->mhPS = hPS; - pVDev->mhBmp = hBmp; - pVDev->mhDefBmp = Ft2SetBitmap( hPS, hBmp ); - pVDev->mpGraphics = pVirGraphics; - pVDev->mnBitCount = nBitCount; - pVDev->mbGraphics = FALSE; - return pVDev; -} - -// ----------------------------------------------------------------------- - -void Os2SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) -{ - delete pDevice; -} - -// ======================================================================= - -Os2SalVirtualDevice::Os2SalVirtualDevice() -{ -} - -// ----------------------------------------------------------------------- - -Os2SalVirtualDevice::~Os2SalVirtualDevice() -{ - ImplSalDeInitGraphics( mpGraphics ); - - Ft2SetBitmap( mpGraphics->mhPS, mhDefBmp ); - GpiDeleteBitmap( mhBmp ); - Ft2DestroyPS( mpGraphics->mhPS ); - DevCloseDC( mpGraphics->mhDC ); - delete mpGraphics; -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalVirtualDevice::GetGraphics() -{ - if ( mbGraphics ) - return NULL; - - if ( mpGraphics ) - mbGraphics = TRUE; - - return mpGraphics; -} - -// ----------------------------------------------------------------------- - -void Os2SalVirtualDevice::ReleaseGraphics( SalGraphics* ) -{ - mbGraphics = FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalVirtualDevice::SetSize( long nDX, long nDY ) -{ - HBITMAP hNewBmp = ImplCreateVirDevBitmap( mhDC, - mhPS, nDX, nDY, - mnBitCount ); - if ( hNewBmp ) - { - Ft2SetBitmap( mhPS, hNewBmp ); - GpiDeleteBitmap( mhBmp ); - mhBmp = hNewBmp; - mpGraphics->mnHeight = nDY; - return TRUE; - } - else - return FALSE; -} - -void Os2SalVirtualDevice::GetSize( long& rWidth, long& rHeight ) -{ - DevQueryCaps( mpGraphics->mhDC, CAPS_WIDTH, CAPS_WIDTH, (LONG*)rWidth ); - DevQueryCaps( mpGraphics->mhDC, CAPS_HEIGHT, CAPS_HEIGHT, (LONG*)rHeight ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/src/airbrush.ptr b/vcl/os2/source/src/airbrush.ptr Binary files differdeleted file mode 100644 index 89a99d763d94..000000000000 --- a/vcl/os2/source/src/airbrush.ptr +++ /dev/null diff --git a/vcl/os2/source/src/ase.ptr b/vcl/os2/source/src/ase.ptr Binary files differdeleted file mode 100755 index 1f6c4e764901..000000000000 --- a/vcl/os2/source/src/ase.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asn.ptr b/vcl/os2/source/src/asn.ptr Binary files differdeleted file mode 100755 index b526c17a83e0..000000000000 --- a/vcl/os2/source/src/asn.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asne.ptr b/vcl/os2/source/src/asne.ptr Binary files differdeleted file mode 100755 index 4ed44679918f..000000000000 --- a/vcl/os2/source/src/asne.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asns.ptr b/vcl/os2/source/src/asns.ptr Binary files differdeleted file mode 100755 index 12395e641b4f..000000000000 --- a/vcl/os2/source/src/asns.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asnswe.ptr b/vcl/os2/source/src/asnswe.ptr Binary files differdeleted file mode 100755 index 46f1f790b474..000000000000 --- a/vcl/os2/source/src/asnswe.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asnw.ptr b/vcl/os2/source/src/asnw.ptr Binary files differdeleted file mode 100755 index d934c3b69a79..000000000000 --- a/vcl/os2/source/src/asnw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/ass.ptr b/vcl/os2/source/src/ass.ptr Binary files differdeleted file mode 100755 index 059ce40126cd..000000000000 --- a/vcl/os2/source/src/ass.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asse.ptr b/vcl/os2/source/src/asse.ptr Binary files differdeleted file mode 100755 index 78a1f7ff5c64..000000000000 --- a/vcl/os2/source/src/asse.ptr +++ /dev/null diff --git a/vcl/os2/source/src/assw.ptr b/vcl/os2/source/src/assw.ptr Binary files differdeleted file mode 100755 index 5adf85360e30..000000000000 --- a/vcl/os2/source/src/assw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/asw.ptr b/vcl/os2/source/src/asw.ptr Binary files differdeleted file mode 100755 index 160a775abe22..000000000000 --- a/vcl/os2/source/src/asw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/aswe.ptr b/vcl/os2/source/src/aswe.ptr Binary files differdeleted file mode 100755 index b4e6580c560d..000000000000 --- a/vcl/os2/source/src/aswe.ptr +++ /dev/null diff --git a/vcl/os2/source/src/chain.ptr b/vcl/os2/source/src/chain.ptr Binary files differdeleted file mode 100644 index 0e248b324daa..000000000000 --- a/vcl/os2/source/src/chain.ptr +++ /dev/null diff --git a/vcl/os2/source/src/chainnot.ptr b/vcl/os2/source/src/chainnot.ptr Binary files differdeleted file mode 100644 index 0e248b324daa..000000000000 --- a/vcl/os2/source/src/chainnot.ptr +++ /dev/null diff --git a/vcl/os2/source/src/chart.ptr b/vcl/os2/source/src/chart.ptr Binary files differdeleted file mode 100644 index 66c685d111c7..000000000000 --- a/vcl/os2/source/src/chart.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copydata.ptr b/vcl/os2/source/src/copydata.ptr Binary files differdeleted file mode 100644 index e7e7ccd17e41..000000000000 --- a/vcl/os2/source/src/copydata.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copydlnk.ptr b/vcl/os2/source/src/copydlnk.ptr Binary files differdeleted file mode 100644 index acbf27b3462e..000000000000 --- a/vcl/os2/source/src/copydlnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copyf.ptr b/vcl/os2/source/src/copyf.ptr Binary files differdeleted file mode 100644 index 8ebcbded233b..000000000000 --- a/vcl/os2/source/src/copyf.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copyf2.ptr b/vcl/os2/source/src/copyf2.ptr Binary files differdeleted file mode 100644 index dcfa6c089c10..000000000000 --- a/vcl/os2/source/src/copyf2.ptr +++ /dev/null diff --git a/vcl/os2/source/src/copyflnk.ptr b/vcl/os2/source/src/copyflnk.ptr Binary files differdeleted file mode 100644 index 3bd6e9d4706e..000000000000 --- a/vcl/os2/source/src/copyflnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/crook.ptr b/vcl/os2/source/src/crook.ptr Binary files differdeleted file mode 100644 index 0b639614ddb3..000000000000 --- a/vcl/os2/source/src/crook.ptr +++ /dev/null diff --git a/vcl/os2/source/src/crop.ptr b/vcl/os2/source/src/crop.ptr Binary files differdeleted file mode 100644 index 076e522e1b7f..000000000000 --- a/vcl/os2/source/src/crop.ptr +++ /dev/null diff --git a/vcl/os2/source/src/cross.ptr b/vcl/os2/source/src/cross.ptr Binary files differdeleted file mode 100644 index 1a2cd8dae5f6..000000000000 --- a/vcl/os2/source/src/cross.ptr +++ /dev/null diff --git a/vcl/os2/source/src/darc.ptr b/vcl/os2/source/src/darc.ptr Binary files differdeleted file mode 100644 index eba024e6a09a..000000000000 --- a/vcl/os2/source/src/darc.ptr +++ /dev/null diff --git a/vcl/os2/source/src/data.ptr b/vcl/os2/source/src/data.ptr Binary files differdeleted file mode 100644 index 4c3c9eeb5e7a..000000000000 --- a/vcl/os2/source/src/data.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dbezier.ptr b/vcl/os2/source/src/dbezier.ptr Binary files differdeleted file mode 100644 index 8972b0007c13..000000000000 --- a/vcl/os2/source/src/dbezier.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dcapt.ptr b/vcl/os2/source/src/dcapt.ptr Binary files differdeleted file mode 100644 index b04b21bad1a7..000000000000 --- a/vcl/os2/source/src/dcapt.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dcirccut.ptr b/vcl/os2/source/src/dcirccut.ptr Binary files differdeleted file mode 100644 index 936b337ebcc7..000000000000 --- a/vcl/os2/source/src/dcirccut.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dconnect.ptr b/vcl/os2/source/src/dconnect.ptr Binary files differdeleted file mode 100644 index f8bc2cf454aa..000000000000 --- a/vcl/os2/source/src/dconnect.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dellipse.ptr b/vcl/os2/source/src/dellipse.ptr Binary files differdeleted file mode 100644 index 388bc2f2b00c..000000000000 --- a/vcl/os2/source/src/dellipse.ptr +++ /dev/null diff --git a/vcl/os2/source/src/detectiv.ptr b/vcl/os2/source/src/detectiv.ptr Binary files differdeleted file mode 100644 index 44ca1546a93b..000000000000 --- a/vcl/os2/source/src/detectiv.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dfree.ptr b/vcl/os2/source/src/dfree.ptr Binary files differdeleted file mode 100644 index 52d95d814d98..000000000000 --- a/vcl/os2/source/src/dfree.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dline.ptr b/vcl/os2/source/src/dline.ptr Binary files differdeleted file mode 100644 index e7b80ae56735..000000000000 --- a/vcl/os2/source/src/dline.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dpie.ptr b/vcl/os2/source/src/dpie.ptr Binary files differdeleted file mode 100644 index abd68b899f3a..000000000000 --- a/vcl/os2/source/src/dpie.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dpolygon.ptr b/vcl/os2/source/src/dpolygon.ptr Binary files differdeleted file mode 100644 index 94fa158b4186..000000000000 --- a/vcl/os2/source/src/dpolygon.ptr +++ /dev/null diff --git a/vcl/os2/source/src/drect.ptr b/vcl/os2/source/src/drect.ptr Binary files differdeleted file mode 100644 index 3ec044f267d6..000000000000 --- a/vcl/os2/source/src/drect.ptr +++ /dev/null diff --git a/vcl/os2/source/src/dtext.ptr b/vcl/os2/source/src/dtext.ptr Binary files differdeleted file mode 100644 index 8c221303b0b6..000000000000 --- a/vcl/os2/source/src/dtext.ptr +++ /dev/null diff --git a/vcl/os2/source/src/fill.ptr b/vcl/os2/source/src/fill.ptr Binary files differdeleted file mode 100644 index e7247a6d107b..000000000000 --- a/vcl/os2/source/src/fill.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hand.ptr b/vcl/os2/source/src/hand.ptr Binary files differdeleted file mode 100644 index b1d65c7f19d0..000000000000 --- a/vcl/os2/source/src/hand.ptr +++ /dev/null diff --git a/vcl/os2/source/src/help.ptr b/vcl/os2/source/src/help.ptr Binary files differdeleted file mode 100644 index 3df4d88bddc4..000000000000 --- a/vcl/os2/source/src/help.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hshear.ptr b/vcl/os2/source/src/hshear.ptr Binary files differdeleted file mode 100644 index 76bbebba5865..000000000000 --- a/vcl/os2/source/src/hshear.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hsizebar.ptr b/vcl/os2/source/src/hsizebar.ptr Binary files differdeleted file mode 100644 index 9b78ff9ee9a9..000000000000 --- a/vcl/os2/source/src/hsizebar.ptr +++ /dev/null diff --git a/vcl/os2/source/src/hsplit.ptr b/vcl/os2/source/src/hsplit.ptr Binary files differdeleted file mode 100644 index 62f3b590a414..000000000000 --- a/vcl/os2/source/src/hsplit.ptr +++ /dev/null diff --git a/vcl/os2/source/src/linkdata.ptr b/vcl/os2/source/src/linkdata.ptr Binary files differdeleted file mode 100644 index e5e6ace59be3..000000000000 --- a/vcl/os2/source/src/linkdata.ptr +++ /dev/null diff --git a/vcl/os2/source/src/linkf.ptr b/vcl/os2/source/src/linkf.ptr Binary files differdeleted file mode 100644 index 62bf7e739e32..000000000000 --- a/vcl/os2/source/src/linkf.ptr +++ /dev/null diff --git a/vcl/os2/source/src/magnify.ptr b/vcl/os2/source/src/magnify.ptr Binary files differdeleted file mode 100644 index 1d9a0c149ebd..000000000000 --- a/vcl/os2/source/src/magnify.ptr +++ /dev/null diff --git a/vcl/os2/source/src/makefile.mk b/vcl/os2/source/src/makefile.mk deleted file mode 100644 index 1dba7496be65..000000000000 --- a/vcl/os2/source/src/makefile.mk +++ /dev/null @@ -1,111 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=vcl -TARGET=salsrc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile2.pmk - -# --- Files -------------------------------------------------------- - -RCDEPN= nullptr.ptr \ - help.ptr \ - cross.ptr \ - move.ptr \ - hsplit.ptr \ - vsplit.ptr \ - hsizebar.ptr \ - vsizebar.ptr \ - hand.ptr \ - refhand.ptr \ - pen.ptr \ - magnify.ptr \ - fill.ptr \ - rotate.ptr \ - hshear.ptr \ - vshear.ptr \ - mirror.ptr \ - crook.ptr \ - crop.ptr \ - movept.ptr \ - movebw.ptr \ - movedata.ptr \ - copydata.ptr \ - linkdata.ptr \ - movedlnk.ptr \ - copydlnk.ptr \ - movef.ptr \ - copyf.ptr \ - linkf.ptr \ - moveflnk.ptr \ - copyflnk.ptr \ - movef2.ptr \ - copyf2.ptr \ - dline.ptr \ - drect.ptr \ - dpolygon.ptr \ - dbezier.ptr \ - darc.ptr \ - dpie.ptr \ - dcirccut.ptr \ - dellipse.ptr \ - dfree.ptr \ - dconnect.ptr \ - dtext.ptr \ - dcapt.ptr \ - chart.ptr \ - detectiv.ptr \ - pivotcol.ptr \ - pivotrow.ptr \ - pivotfld.ptr \ - chain.ptr \ - chainnot.ptr \ - timemove.ptr \ - timesize.ptr \ - asn.ptr \ - ass.ptr \ - asw.ptr \ - ase.ptr \ - asnw.ptr \ - asne.ptr \ - assw.ptr \ - asse.ptr \ - asns.ptr \ - aswe.ptr \ - asnswe.ptr \ - sd.ico - -RCFILES= salsrc.rc - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/src/mirror.ptr b/vcl/os2/source/src/mirror.ptr Binary files differdeleted file mode 100644 index 9135331048c9..000000000000 --- a/vcl/os2/source/src/mirror.ptr +++ /dev/null diff --git a/vcl/os2/source/src/move.ptr b/vcl/os2/source/src/move.ptr Binary files differdeleted file mode 100644 index 6b5a11d31219..000000000000 --- a/vcl/os2/source/src/move.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movebw.ptr b/vcl/os2/source/src/movebw.ptr Binary files differdeleted file mode 100644 index e766b885db0a..000000000000 --- a/vcl/os2/source/src/movebw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movedata.ptr b/vcl/os2/source/src/movedata.ptr Binary files differdeleted file mode 100644 index 689f38da772f..000000000000 --- a/vcl/os2/source/src/movedata.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movedlnk.ptr b/vcl/os2/source/src/movedlnk.ptr Binary files differdeleted file mode 100644 index d533e7135ad0..000000000000 --- a/vcl/os2/source/src/movedlnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movef.ptr b/vcl/os2/source/src/movef.ptr Binary files differdeleted file mode 100644 index e9fabda359c8..000000000000 --- a/vcl/os2/source/src/movef.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movef2.ptr b/vcl/os2/source/src/movef2.ptr Binary files differdeleted file mode 100644 index 9940890840cb..000000000000 --- a/vcl/os2/source/src/movef2.ptr +++ /dev/null diff --git a/vcl/os2/source/src/moveflnk.ptr b/vcl/os2/source/src/moveflnk.ptr Binary files differdeleted file mode 100644 index d651491ad001..000000000000 --- a/vcl/os2/source/src/moveflnk.ptr +++ /dev/null diff --git a/vcl/os2/source/src/movept.ptr b/vcl/os2/source/src/movept.ptr Binary files differdeleted file mode 100644 index d34332dd89e5..000000000000 --- a/vcl/os2/source/src/movept.ptr +++ /dev/null diff --git a/vcl/os2/source/src/nullptr.ptr b/vcl/os2/source/src/nullptr.ptr Binary files differdeleted file mode 100644 index f8b0f784ba7a..000000000000 --- a/vcl/os2/source/src/nullptr.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pen.ptr b/vcl/os2/source/src/pen.ptr Binary files differdeleted file mode 100644 index 3b4495697597..000000000000 --- a/vcl/os2/source/src/pen.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pivotcol.ptr b/vcl/os2/source/src/pivotcol.ptr Binary files differdeleted file mode 100644 index 369fdeebf2d0..000000000000 --- a/vcl/os2/source/src/pivotcol.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pivotfld.ptr b/vcl/os2/source/src/pivotfld.ptr Binary files differdeleted file mode 100644 index 047c45a711df..000000000000 --- a/vcl/os2/source/src/pivotfld.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pivotrow.ptr b/vcl/os2/source/src/pivotrow.ptr Binary files differdeleted file mode 100644 index e66e752e51d0..000000000000 --- a/vcl/os2/source/src/pivotrow.ptr +++ /dev/null diff --git a/vcl/os2/source/src/pntbrsh.ptr b/vcl/os2/source/src/pntbrsh.ptr Binary files differdeleted file mode 100644 index 506965e6b52d..000000000000 --- a/vcl/os2/source/src/pntbrsh.ptr +++ /dev/null diff --git a/vcl/os2/source/src/refhand.ptr b/vcl/os2/source/src/refhand.ptr Binary files differdeleted file mode 100644 index 33d613134cb5..000000000000 --- a/vcl/os2/source/src/refhand.ptr +++ /dev/null diff --git a/vcl/os2/source/src/rotate.ptr b/vcl/os2/source/src/rotate.ptr Binary files differdeleted file mode 100644 index 622b05346cfc..000000000000 --- a/vcl/os2/source/src/rotate.ptr +++ /dev/null diff --git a/vcl/os2/source/src/salsrc.rc b/vcl/os2/source/src/salsrc.rc deleted file mode 100644 index 6e3b40c76da0..000000000000 --- a/vcl/os2/source/src/salsrc.rc +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALIDS_HRC -#include <salids.hrc> -#endif - -POINTER SAL_RESID_POINTER_NULL NULLPTR.PTR -POINTER SAL_RESID_POINTER_HELP HELP.PTR -POINTER SAL_RESID_POINTER_CROSS CROSS.PTR -POINTER SAL_RESID_POINTER_MOVE MOVE.PTR -POINTER SAL_RESID_POINTER_HSPLIT HSPLIT.PTR -POINTER SAL_RESID_POINTER_VSPLIT VSPLIT.PTR -POINTER SAL_RESID_POINTER_HSIZEBAR HSIZEBAR.PTR -POINTER SAL_RESID_POINTER_VSIZEBAR VSIZEBAR.PTR -POINTER SAL_RESID_POINTER_HAND HAND.PTR -POINTER SAL_RESID_POINTER_REFHAND REFHAND.PTR -POINTER SAL_RESID_POINTER_PEN PEN.PTR -POINTER SAL_RESID_POINTER_MAGNIFY MAGNIFY.PTR -POINTER SAL_RESID_POINTER_FILL FILL.PTR -POINTER SAL_RESID_POINTER_ROTATE ROTATE.PTR -POINTER SAL_RESID_POINTER_HSHEAR HSHEAR.PTR -POINTER SAL_RESID_POINTER_VSHEAR VSHEAR.PTR -POINTER SAL_RESID_POINTER_MIRROR MIRROR.PTR -POINTER SAL_RESID_POINTER_CROOK CROOK.PTR -POINTER SAL_RESID_POINTER_CROP CROP.PTR -POINTER SAL_RESID_POINTER_MOVEPOINT MOVEPT.PTR -POINTER SAL_RESID_POINTER_MOVEBEZIERWEIGHT MOVEBW.PTR -POINTER SAL_RESID_POINTER_MOVEDATA MOVEDATA.PTR -POINTER SAL_RESID_POINTER_COPYDATA COPYDATA.PTR -POINTER SAL_RESID_POINTER_LINKDATA LINKDATA.PTR -POINTER SAL_RESID_POINTER_MOVEDATALINK MOVEDLNK.PTR -POINTER SAL_RESID_POINTER_COPYDATALINK COPYDLNK.PTR -POINTER SAL_RESID_POINTER_MOVEFILE MOVEF.PTR -POINTER SAL_RESID_POINTER_COPYFILE COPYF.PTR -POINTER SAL_RESID_POINTER_LINKFILE LINKF.PTR -POINTER SAL_RESID_POINTER_MOVEFILELINK MOVEFLNK.PTR -POINTER SAL_RESID_POINTER_COPYFILELINK COPYFLNK.PTR -POINTER SAL_RESID_POINTER_MOVEFILES MOVEF2.PTR -POINTER SAL_RESID_POINTER_COPYFILES COPYF2.PTR -POINTER SAL_RESID_POINTER_DRAW_LINE DLINE.PTR -POINTER SAL_RESID_POINTER_DRAW_RECT DRECT.PTR -POINTER SAL_RESID_POINTER_DRAW_POLYGON DPOLYGON.PTR -POINTER SAL_RESID_POINTER_DRAW_BEZIER DBEZIER.PTR -POINTER SAL_RESID_POINTER_DRAW_ARC DARC.PTR -POINTER SAL_RESID_POINTER_DRAW_PIE DPIE.PTR -POINTER SAL_RESID_POINTER_DRAW_CIRCLECUT DCIRCCUT.PTR -POINTER SAL_RESID_POINTER_DRAW_ELLIPSE DELLIPSE.PTR -POINTER SAL_RESID_POINTER_DRAW_FREEHAND DFREE.PTR -POINTER SAL_RESID_POINTER_DRAW_CONNECT DCONNECT.PTR -POINTER SAL_RESID_POINTER_DRAW_TEXT DTEXT.PTR -POINTER SAL_RESID_POINTER_DRAW_CAPTION DCAPT.PTR -POINTER SAL_RESID_POINTER_CHART CHART.PTR -POINTER SAL_RESID_POINTER_DETECTIVE DETECTIV.PTR -POINTER SAL_RESID_POINTER_PIVOT_COL PIVOTCOL.PTR -POINTER SAL_RESID_POINTER_PIVOT_ROW PIVOTROW.PTR -POINTER SAL_RESID_POINTER_PIVOT_FIELD PIVOTFLD.PTR -POINTER SAL_RESID_POINTER_CHAIN CHAIN.PTR -POINTER SAL_RESID_POINTER_CHAIN_NOTALLOWED CHAINNOT.PTR -POINTER SAL_RESID_POINTER_TIMEEVENT_MOVE TIMEMOVE.PTR -POINTER SAL_RESID_POINTER_TIMEEVENT_SIZE TIMESIZE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_N ASN.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_S ASS.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_W ASW.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_E ASE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NW ASNW.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NE ASNE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_SW ASSW.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_SE ASSE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NS ASNS.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_WE ASWE.PTR -POINTER SAL_RESID_POINTER_AUTOSCROLL_NSWE ASNSWE.PTR - -POINTER SAL_RESID_POINTER_AIRBRUSH AIRBRUSH.PTR -POINTER SAL_RESID_POINTER_TEXT_VERTICAL VTEXT.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_S TBLSELS.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_E TBLSELE.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_SE TBLSELSE.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_W TBLSELW.PTR -POINTER SAL_RESID_POINTER_TAB_SELECT_SW TBLSELSW.PTR -POINTER SAL_RESID_POINTER_PAINTBRUSH PNTBRSH.PTR - -ICON SAL_RESID_ICON_DEFAULT SD2.ICO - diff --git a/vcl/os2/source/src/sd.ico b/vcl/os2/source/src/sd.ico Binary files differdeleted file mode 100644 index 22cb33630b85..000000000000 --- a/vcl/os2/source/src/sd.ico +++ /dev/null diff --git a/vcl/os2/source/src/sd2.ico b/vcl/os2/source/src/sd2.ico Binary files differdeleted file mode 100644 index f7edd4524bc1..000000000000 --- a/vcl/os2/source/src/sd2.ico +++ /dev/null diff --git a/vcl/os2/source/src/tblsele.ptr b/vcl/os2/source/src/tblsele.ptr Binary files differdeleted file mode 100644 index 627c2f61662b..000000000000 --- a/vcl/os2/source/src/tblsele.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblsels.ptr b/vcl/os2/source/src/tblsels.ptr Binary files differdeleted file mode 100644 index 3553c0d1f5ae..000000000000 --- a/vcl/os2/source/src/tblsels.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblselse.ptr b/vcl/os2/source/src/tblselse.ptr Binary files differdeleted file mode 100644 index 355e5105f58f..000000000000 --- a/vcl/os2/source/src/tblselse.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblselsw.ptr b/vcl/os2/source/src/tblselsw.ptr Binary files differdeleted file mode 100644 index 435dec00c3e1..000000000000 --- a/vcl/os2/source/src/tblselsw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/tblselw.ptr b/vcl/os2/source/src/tblselw.ptr Binary files differdeleted file mode 100644 index de64ad06d6a2..000000000000 --- a/vcl/os2/source/src/tblselw.ptr +++ /dev/null diff --git a/vcl/os2/source/src/timemove.ptr b/vcl/os2/source/src/timemove.ptr Binary files differdeleted file mode 100755 index a9298cee867b..000000000000 --- a/vcl/os2/source/src/timemove.ptr +++ /dev/null diff --git a/vcl/os2/source/src/timesize.ptr b/vcl/os2/source/src/timesize.ptr Binary files differdeleted file mode 100755 index e543c1ff790c..000000000000 --- a/vcl/os2/source/src/timesize.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vshear.ptr b/vcl/os2/source/src/vshear.ptr Binary files differdeleted file mode 100644 index f335d5ea949b..000000000000 --- a/vcl/os2/source/src/vshear.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vsizebar.ptr b/vcl/os2/source/src/vsizebar.ptr Binary files differdeleted file mode 100644 index b238889c594c..000000000000 --- a/vcl/os2/source/src/vsizebar.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vsplit.ptr b/vcl/os2/source/src/vsplit.ptr Binary files differdeleted file mode 100644 index 662d760b0b2f..000000000000 --- a/vcl/os2/source/src/vsplit.ptr +++ /dev/null diff --git a/vcl/os2/source/src/vtext.ptr b/vcl/os2/source/src/vtext.ptr Binary files differdeleted file mode 100644 index a7f9901bdf68..000000000000 --- a/vcl/os2/source/src/vtext.ptr +++ /dev/null diff --git a/vcl/os2/source/window/makefile b/vcl/os2/source/window/makefile deleted file mode 100644 index e9aba563d9e8..000000000000 --- a/vcl/os2/source/window/makefile +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..\..\.. - -PRJNAME=SV -TARGET=salwin - -# --- Settings ----------------------------------------------------- - -!INCLUDE <svpre.mak> -!INCLUDE <settings.mak> -!INCLUDE <sv.mak> - -!IF "$(COM)"=="ICC" -ENVCFLAGS=$(ENVCFLAGS) -D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE -!ENDIF - -# --- Files -------------------------------------------------------- - -CXXFILES= salframe.cxx \ - salobj.cxx - -SLOFILES= $(SLO)\salframe.obj \ - $(SLO)\salobj.obj - -# --- Targets ------------------------------------------------------ - -!INCLUDE <target.mak> diff --git a/vcl/os2/source/window/makefile.mk b/vcl/os2/source/window/makefile.mk deleted file mode 100644 index 560d35880b21..000000000000 --- a/vcl/os2/source/window/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=SV -TARGET=salwin - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -CXXFILES__YD= salframe.cxx \ - salobj.cxx - -SLOFILES= $(SLO)$/salframe.obj \ - $(SLO)$/salobj.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx deleted file mode 100644 index ebc557faafb2..000000000000 --- a/vcl/os2/source/window/salframe.cxx +++ /dev/null @@ -1,3575 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> - -#define INCL_DOS -#define INCL_PM -#define INCL_WIN -#include <svpm.h> - -// ======================================================================= - -#define _SV_SALFRAME_CXX - -#include <tools/debug.hxx> - -#define private public - -#include <sallang.hxx> -#include <salids.hrc> -#include <saldata.hxx> -#include <salinst.h> -#include <salgdi.h> -#include <salframe.h> -#include <vcl/timer.hxx> -#include <vcl/settings.hxx> -#include <vcl/keycodes.hxx> -#include <saltimer.h> - -#if OSL_DEBUG_LEVEL > 1 -extern "C" int debug_printf(const char *f, ...); - -static BOOL _bCapture; - -#else -#define debug_printf( ...) { 1; } -#endif - -// ======================================================================= - -HPOINTER ImplLoadPointer( ULONG nId ); - -static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); -static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); -static void ImplSalCalcFrameSize( HWND hWnd, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); -static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); -MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ); - -// ======================================================================= - -static LanguageType eImplKeyboardLanguage = LANGUAGE_DONTKNOW; -BOOL Os2SalFrame::mbInReparent = FALSE; -ULONG Os2SalFrame::mnInputLang = 0; - -// ======================================================================= - -// define a new flag -#define SWP_CENTER (SWP_NOAUTOCLOSE<<4) -#define SWP_SHOWMAXIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MAXIMIZE) -#define SWP_SHOWMINIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MINIMIZE) -#define SWP_SHOWNORMAL (SWP_ACTIVATE | SWP_SHOW | SWP_RESTORE) - -static LONG nScreenHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN); -static LONG nScreenWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - -BOOL APIENTRY _WinQueryWindowRect( HWND hwnd, PRECTL prclDest) -{ - BOOL rc = WinQueryWindowRect( hwnd, prclDest); - ULONG tmp = prclDest->yBottom; - prclDest->yBottom = prclDest->yTop; - prclDest->yTop = tmp; - return rc; -} - -BOOL APIENTRY _WinQueryPointerPos (HWND hwndDesktop, PPOINTL pptl) -{ - BOOL rc = WinQueryPointerPos( hwndDesktop, pptl); - pptl->y = nScreenHeight - pptl->y; - return rc; -} - -BOOL APIENTRY _WinQueryWindowPos( Os2SalFrame* pFrame, PSWP pswp) -{ - SWP swpOwner; - BOOL rc = WinQueryWindowPos( pFrame->mhWndFrame, pswp); - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "> WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", - pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); -#endif - - Os2SalFrame* pParentFrame = pFrame->mpParentFrame; - - //YD adjust to owner coordinates - if ( pParentFrame ) - { - POINTL ptlOwner = {0}; - - // coords are relative to screen, map to parent frame client area - ptlOwner.x = pswp->x; - ptlOwner.y = pswp->y; - WinMapWindowPoints( HWND_DESKTOP, pParentFrame->mhWndClient, &ptlOwner, 1); - pswp->x = ptlOwner.x; - pswp->y = ptlOwner.y; - // get parent client area size - WinQueryWindowPos( pParentFrame->mhWndClient, &swpOwner); - } else - { - // no owner info, use DESKTOP???? - swpOwner.cx = nScreenWidth; - swpOwner.cy = nScreenHeight; - } - - // invert Y coordinate - pswp->y = swpOwner.cy - (pswp->y + pswp->cy); - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "< WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", - pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); -#endif - return rc; -} - -BOOL APIENTRY _WinSetWindowPos( Os2SalFrame* pFrame, HWND hwndInsertBehind, LONG x, LONG y, - LONG cx, LONG cy, ULONG fl) -{ - SWP swpOwner = {0}; - POINTL ptlOwner = {0}; - HWND hParent = NULL; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( ">WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl 0x%08x\n", - pFrame->mhWndFrame, x, y, cx, cy, fl); -#endif - - // first resize window if requested - if ( (fl & SWP_SIZE) ) { - ULONG flag = SWP_SIZE; - LONG nX = 0, nY = 0; - LONG frameFrameX, frameFrameY, frameCaptionY; - - ImplSalCalcFrameSize( pFrame, frameFrameX, frameFrameY, frameCaptionY ); - // if we change y size, we need to move the window down - // because os2 window origin is lower left corner - if (pFrame->maGeometry.nHeight != cy) { - SWP aSWP; - WinQueryWindowPos( pFrame->mhWndFrame, &aSWP); - nX = aSWP.x; - nY = aSWP.y - (cy + 2*frameFrameY + frameCaptionY - aSWP.cy); - flag |= SWP_MOVE; - } - WinSetWindowPos( pFrame->mhWndFrame, NULL, nX, nY, - cx+2*frameFrameX, cy+2*frameFrameY+frameCaptionY, flag); - fl = fl & ~SWP_SIZE; - } - else // otherwise get current size - { - SWP swp = {0}; - WinQueryWindowPos( pFrame->mhWndClient, &swp); - cx = swp.cx; - cy = swp.cy; - } - - // get parent window handle - Os2SalFrame* pParentFrame = pFrame->mpParentFrame; - - // use desktop if parent is not defined - hParent = pParentFrame ? pParentFrame->mhWndClient : HWND_DESKTOP; - // if parent is not visible, use desktop as reference - hParent = WinIsWindowVisible( hParent) ? hParent : HWND_DESKTOP; - - WinQueryWindowPos( hParent, &swpOwner); - - //YD adjust to owner coordinates only when moving and not centering - //if (!(fl & SWP_CENTER) && (fl & SWP_MOVE)) - if ((fl & SWP_MOVE)) - { - - // if SWP_CENTER is specified, change position to parent center - if (fl & SWP_CENTER) { - ptlOwner.x = (swpOwner.cx - cx) / 2; - ptlOwner.y = (swpOwner.cy - cy) / 2; -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "_WinSetWindowPos SWP_CENTER\n"); -#endif - fl = fl & ~SWP_CENTER; - } else { - // coords are relative to parent frame client area, map to screen - // map Y to OS/2 system coordinates - ptlOwner.x = x; - ptlOwner.y = swpOwner.cy - (y + cy); - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) OS2\n", - hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); -#endif - } - // map from client area to screen - WinMapWindowPoints( hParent, HWND_DESKTOP, &ptlOwner, 1); - x = ptlOwner.x; - y = ptlOwner.y; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) MAPPED OS2\n", - hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); -#endif - } - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "<WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl=%x\n", - pFrame->mhWndFrame, x, y, cx, cy, fl); -#endif - return WinSetWindowPos( pFrame->mhWndFrame, hwndInsertBehind, x, y, 0, 0, fl); -} - -// ======================================================================= - -#if OSL_DEBUG_LEVEL > 1 -static void dumpWindowInfo( char* fnc, HWND hwnd) -{ - SWP aSWP; - HWND hwnd2; - char szTitle[256]; -} -#endif - -// ======================================================================= - -#ifdef ENABLE_IME - -struct ImplSalIMEProc -{ - ULONG nOrd; - PFN* pProc; -}; - -#define SAL_IME_PROC_COUNT 12 - -// ----------------------------------------------------------------------- - -static SalIMEData* GetSalIMEData() -{ - SalData* pSalData = GetSalData(); - - if ( !pSalData->mbIMEInit ) - { - pSalData->mbIMEInit = TRUE; - - HMODULE hMod = 0; - if ( 0 == DosLoadModule( NULL, 0, "OS2IM", &hMod ) ) - { - SalIMEData* pIMEData = new SalIMEData; - BOOL bError = FALSE; - ImplSalIMEProc aProcAry[SAL_IME_PROC_COUNT] = - { - { 101, (PFN*)&(pIMEData->mpAssocIME) }, - { 104, (PFN*)&(pIMEData->mpGetIME) }, - { 106, (PFN*)&(pIMEData->mpReleaseIME) }, - { 117, (PFN*)&(pIMEData->mpSetConversionFont) }, - { 144, (PFN*)&(pIMEData->mpSetConversionFontSize) }, - { 118, (PFN*)&(pIMEData->mpGetConversionString) }, - { 122, (PFN*)&(pIMEData->mpGetResultString) }, - { 115, (PFN*)&(pIMEData->mpSetCandidateWin) }, - { 130, (PFN*)&(pIMEData->mpQueryIMEProperty) }, - { 131, (PFN*)&(pIMEData->mpRequestIME) }, - { 128, (PFN*)&(pIMEData->mpSetIMEMode) }, - { 127, (PFN*)&(pIMEData->mpQueryIMEMode) } - }; - - pIMEData->mhModIME = hMod; - for ( USHORT i = 0; i < SAL_IME_PROC_COUNT; i++ ) - { - if ( 0 != DosQueryProcAddr( pIMEData->mhModIME, aProcAry[i].nOrd, 0, aProcAry[i].pProc ) ) - { - bError = TRUE; - break; - } - } - - if ( bError ) - { - DosFreeModule( pIMEData->mhModIME ); - delete pIMEData; - } - else - pSalData->mpIMEData = pIMEData; - } - } - - return pSalData->mpIMEData; -} - -// ----------------------------------------------------------------------- - -void ImplReleaseSALIMEData() -{ - SalData* pSalData = GetSalData(); - - if ( pSalData->mpIMEData ) - { - DosFreeModule( pSalData->mpIMEData->mhModIME ); - delete pSalData->mpIMEData; - } -} - -#endif - -// ======================================================================= - -static void ImplSaveFrameState( Os2SalFrame* pFrame ) -{ - // Position, Groesse und Status fuer GetWindowState() merken - if ( !pFrame->mbFullScreen ) - { - SWP aSWP; - BOOL bVisible = WinIsWindowVisible( pFrame->mhWndFrame); - - // Query actual state (maState uses screen coords) - WinQueryWindowPos( pFrame->mhWndFrame, &aSWP ); - - if ( aSWP.fl & SWP_MINIMIZE ) - { -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MINIMIZED\n", - pFrame->mhWndFrame); -#endif - pFrame->maState.mnState |= SAL_FRAMESTATE_MINIMIZED; - if ( bVisible ) - pFrame->mnShowState = SWP_SHOWMAXIMIZED; - } - else if ( aSWP.fl & SWP_MAXIMIZE ) - { -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MAXIMIZED\n", - pFrame->mhWndFrame); -#endif - pFrame->maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED; - pFrame->maState.mnState |= SAL_FRAMESTATE_MAXIMIZED; - if ( bVisible ) - pFrame->mnShowState = SWP_SHOWMINIMIZED; - pFrame->mbRestoreMaximize = TRUE; - } - else - { - LONG nFrameX, nFrameY, nCaptionY; - ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); - // to be consistent with Unix, the frame state is without(!) decoration - long nTopDeco = nFrameY + nCaptionY; - long nLeftDeco = nFrameX; - long nBottomDeco = nFrameY; - long nRightDeco = nFrameX; - - pFrame->maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED); - // subtract decoration, store screen coords - pFrame->maState.mnX = aSWP.x+nLeftDeco; - pFrame->maState.mnY = nScreenHeight - (aSWP.y+aSWP.cy)+nTopDeco; - pFrame->maState.mnWidth = aSWP.cx-nLeftDeco-nRightDeco; - pFrame->maState.mnHeight = aSWP.cy-nTopDeco-nBottomDeco; -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::GetWindowState %08x (%dx%d) at %d,%d VCL\n", - pFrame->mhWndFrame, - pFrame->maState.mnWidth,pFrame->maState.mnHeight,pFrame->maState.mnX,pFrame->maState.mnY); -#endif - if ( bVisible ) - pFrame->mnShowState = SWP_SHOWNORMAL; - pFrame->mbRestoreMaximize = FALSE; - } - } -} - -// ----------------------------------------------------------------------- - -long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* ) -{ - return 0; -} - -// ----------------------------------------------------------------------- - -static void ImplSalCalcFrameSize( HWND hWnd, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return; - return ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); -} - -static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, - LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) -{ - if ( pFrame->mbSizeBorder ) - { - nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER ); - nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER ); - } - else if ( pFrame->mbFixBorder ) - { - nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXDLGFRAME ); - nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME ); - } - else if ( pFrame->mbBorder ) - { - nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER ); - nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER ); - } - else - { - nFrameX = 0; - nFrameY = 0; - } - if ( pFrame->mbCaption ) - nCaptionY = WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ); - else - nCaptionY = 0; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("ImplSalCalcFrameSize 0x%08x x=%d y=%d t=%d\n", pFrame->mhWndFrame, nFrameX, nFrameY, nCaptionY); -#endif -} - -// ----------------------------------------------------------------------- - -static void ImplSalCalcFullScreenSize( const Os2SalFrame* pFrame, - LONG& rX, LONG& rY, LONG& rDX, LONG& rDY ) -{ - // set window to screen size - LONG nFrameX, nFrameY, nCaptionY; - LONG rScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); - LONG rScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); - - // Framegroessen berechnen - ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); - - rX = -nFrameX; - rY = -(nFrameY+nCaptionY); - rDX = rScreenDX+(nFrameX*2); - rDY = rScreenDY+(nFrameY*2)+nCaptionY; -} - -// ----------------------------------------------------------------------- - -static void ImplSalFrameFullScreenPos( Os2SalFrame* pFrame, BOOL bAlways = FALSE ) -{ - SWP aSWP; - _WinQueryWindowPos( pFrame, &aSWP ); - if ( bAlways || !(aSWP.fl & SWP_MINIMIZE) ) - { - // set window to screen size - LONG nX; - LONG nY; - LONG nWidth; - LONG nHeight; - ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight ); - _WinSetWindowPos( pFrame, 0, - nX, nY, nWidth, nHeight, - SWP_MOVE | SWP_SIZE ); - } -} - -// ----------------------------------------------------------------------- - -// Uebersetzungstabelle von System-Keycodes in StarView-Keycodes -#define KEY_TAB_SIZE (VK_ENDDRAG+1) - -static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] = -{ - // StarView-Code System-Code Index - 0, // 0x00 - 0, // VK_BUTTON1 0x01 - 0, // VK_BUTTON2 0x02 - 0, // VK_BUTTON3 0x03 - 0, // VK_BREAK 0x04 - KEY_BACKSPACE, // VK_BACKSPACE 0x05 - KEY_TAB, // VK_TAB 0x06 - KEY_TAB, // VK_BACKTAB 0x07 - KEY_RETURN, // VK_NEWLINE 0x08 - 0, // VK_SHIFT 0x09 - 0, // VK_CTRL 0x0A - 0, // VK_ALT 0x0B - 0, // VK_ALTGRAF 0x0C - 0, // VK_PAUSE 0x0D - 0, // VK_CAPSLOCK 0x0E - KEY_ESCAPE, // VK_ESC 0x0F - KEY_SPACE, // VK_SPACE 0x10 - KEY_PAGEUP, // VK_PAGEUP 0x11 - KEY_PAGEDOWN, // VK_PAGEDOWN 0x12 - KEY_END, // VK_END 0x13 - KEY_HOME, // VK_HOME 0x14 - KEY_LEFT, // VK_LEFT 0x15 - KEY_UP, // VK_UP 0x16 - KEY_RIGHT, // VK_RIGHT 0x17 - KEY_DOWN, // VK_DOWN 0x18 - 0, // VK_PRINTSCRN 0x19 - KEY_INSERT, // VK_INSERT 0x1A - KEY_DELETE, // VK_DELETE 0x1B - 0, // VK_SCRLLOCK 0x1C - 0, // VK_NUMLOCK 0x1D - KEY_RETURN, // VK_ENTER 0x1E - 0, // VK_SYSRQ 0x1F - KEY_F1, // VK_F1 0x20 - KEY_F2, // VK_F2 0x21 - KEY_F3, // VK_F3 0x22 - KEY_F4, // VK_F4 0x23 - KEY_F5, // VK_F5 0x24 - KEY_F6, // VK_F6 0x25 - KEY_F7, // VK_F7 0x26 - KEY_F8, // VK_F8 0x27 - KEY_F9, // VK_F9 0x28 - KEY_F10, // VK_F10 0x29 - KEY_F11, // VK_F11 0x2A - KEY_F12, // VK_F12 0x2B - KEY_F13, // VK_F13 0x2C - KEY_F14, // VK_F14 0x2D - KEY_F15, // VK_F15 0x2E - KEY_F16, // VK_F16 0x2F - KEY_F17, // VK_F17 0x30 - KEY_F18, // VK_F18 0x31 - KEY_F19, // VK_F19 0x32 - KEY_F20, // VK_F20 0x33 - KEY_F21, // VK_F21 0x34 - KEY_F22, // VK_F22 0x35 - KEY_F23, // VK_F23 0x36 - KEY_F24, // VK_F24 0x37 - 0 // VK_ENDDRAG 0x38 -}; - -// ======================================================================= - -SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ) -{ - SalData* pSalData = GetSalData(); - Os2SalFrame* pFrame = new Os2SalFrame; - HWND hWndFrame; - HWND hWndClient; - ULONG nFrameFlags = FCF_NOBYTEALIGN | FCF_SCREENALIGN; - ULONG nFrameStyle = 0; - ULONG nClientStyle = WS_CLIPSIBLINGS; - BOOL bSubFrame = FALSE; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf(">ImplSalCreateFrame hWndParent 0x%x, nSalFrameStyle 0x%x\n", hWndParent, nSalFrameStyle); -#endif - - if ( hWndParent ) - { - bSubFrame = TRUE; - pFrame->mbNoIcon = TRUE; - } - - // determine creation data (bei Moveable nehmen wir DLG-Border, damit - // es besser aussieht) - if ( nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE ) - nFrameFlags |= FCF_CLOSEBUTTON; - - if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE ) { - pFrame->mbCaption = TRUE; - nFrameStyle = WS_ANIMATE; - nFrameFlags |= FCF_SYSMENU | FCF_TITLEBAR | FCF_DLGBORDER; - if ( !hWndParent ) - nFrameFlags |= FCF_MINBUTTON; - - if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE ) - { - pFrame->mbSizeBorder = TRUE; - nFrameFlags |= FCF_SIZEBORDER; - if ( !hWndParent ) - nFrameFlags |= FCF_MAXBUTTON; - } - else - pFrame->mbFixBorder = TRUE; - - // add task list style if not a tool window - if ( !(nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) { - nFrameFlags |= FCF_TASKLIST; - } - } - - if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW ) - { - pFrame->mbNoIcon = TRUE; - // YD gives small caption -> nExSysStyle |= WS_EX_TOOLWINDOW; - } - - if ( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) - { - pFrame->mbFloatWin = TRUE; - } - // init frame data - pFrame->mnStyle = nSalFrameStyle; - - // determine show style - pFrame->mnShowState = SWP_SHOWNORMAL; - - // create frame - //YD FIXME this is a potential bug with multiple threads and cuncurrent - //window creation, because this field is accessed in - //WM_CREATE to get window data, - pSalData->mpCreateFrame = pFrame; - - //YD FIXME if SAL_FRAME_CHILD is specified, use hWndParent as parent handle... - hWndFrame = WinCreateStdWindow( HWND_DESKTOP, nFrameStyle, &nFrameFlags, - (PSZ)(bSubFrame ? SAL_SUBFRAME_CLASSNAME : SAL_FRAME_CLASSNAME), - NULL, - nClientStyle, 0, 0, &hWndClient ); - debug_printf("ImplSalCreateFrame hWndParent 0x%x, hWndFrame 0x%x, hWndClient 0x%x\n", hWndParent, hWndFrame, hWndClient); - if ( !hWndFrame ) - { - delete pFrame; - return NULL; - } - - // Parent setzen (Owner) - if ( hWndParent != 0 && hWndParent != HWND_DESKTOP ) - WinSetOwner( hWndFrame, hWndParent ); - - Os2SalFrame* pParentFrame = GetWindowPtr( hWndParent ); - if ( pParentFrame ) - pFrame->mpParentFrame = pParentFrame; - - // Icon setzen (YD win32 does it in the class registration) - if ( nFrameFlags & FCF_MINBUTTON ) - WinSendMsg( hWndFrame, WM_SETICON, (MPARAM)pInst->mhAppIcon, (MPARAM)0 ); - - // If we have an Window with an Caption Bar and without - // an MaximizeBox, we change the SystemMenu - if ( (nFrameFlags & (FCF_TITLEBAR | FCF_MAXBUTTON)) == (FCF_TITLEBAR) ) - { - HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); - if ( hSysMenu ) - { - if ( !(nFrameFlags & (FCF_MINBUTTON | FCF_MAXBUTTON)) ) - WinEnableMenuItem(hSysMenu, SC_RESTORE, FALSE); - if ( !(nFrameFlags & FCF_MINBUTTON) ) - WinEnableMenuItem(hSysMenu, SC_MINIMIZE, FALSE); - if ( !(nFrameFlags & FCF_MAXBUTTON) ) - WinEnableMenuItem(hSysMenu, SC_MAXIMIZE, FALSE); - if ( !(nFrameFlags & FCF_SIZEBORDER) ) - WinEnableMenuItem(hSysMenu, SC_SIZE, FALSE); - } - } - if ( (nFrameFlags & FCF_SYSMENU) && !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) ) - { - HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); - if ( hSysMenu ) - { - WinEnableMenuItem(hSysMenu, SC_CLOSE, FALSE); - } - } - - // ticket#124 subclass frame window: we need to intercept TRACK message - aSalShlData.mpFrameProc = WinSubclassWindow( hWndFrame, SalFrameSubClassWndProc); - - // init OS/2 frame data - pFrame->mhAB = pInst->mhAB; - - // YD 18/08 under OS/2, invisible frames have size 0,0 at 0,0, so - // we need to set an initial size/position manually - SWP aSWP; - memset( &aSWP, 0, sizeof( aSWP ) ); - WinQueryTaskSizePos( pInst->mhAB, 0, &aSWP ); - WinSetWindowPos( hWndFrame, NULL, aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, - SWP_MOVE | SWP_SIZE); - -#ifdef ENABLE_IME - // Input-Context einstellen - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - pFrame->mhIMEContext = 0; - if ( 0 != pIMEData->mpAssocIME( hWndClient, pFrame->mhIMEContext, &pFrame->mhDefIMEContext ) ) - pFrame->mhDefIMEContext = 0; - } - else - { - pFrame->mhIMEContext = 0; - pFrame->mhDefIMEContext = 0; - } -#endif - - RECTL rectl; - _WinQueryWindowRect( hWndClient, &rectl ); - pFrame->mnWidth = rectl.xRight; - pFrame->mnHeight = rectl.yBottom; - debug_printf( "ImplSalCreateFrame %dx%d\n", pFrame->mnWidth, pFrame->mnHeight); - ImplSaveFrameState( pFrame ); - pFrame->mbDefPos = TRUE; - - UpdateFrameGeometry( hWndFrame, pFrame ); - - if( pFrame->mnShowState == SWP_SHOWMAXIMIZED ) - { - // #96084 set a useful internal window size because - // the window will not be maximized (and the size updated) before show() - SetMaximizedFrameGeometry( hWndFrame, pFrame ); - } - -#if OSL_DEBUG_LEVEL > 1 - dumpWindowInfo( "<ImplSalCreateFrame (exit)", hWndFrame); -#endif - - return pFrame; -} - -// ======================================================================= - -Os2SalFrame::Os2SalFrame() -{ - SalData* pSalData = GetSalData(); - - mbGraphics = NULL; - mhPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE ); - mpGraphics = NULL; - mpInst = NULL; - mbFullScreen = FALSE; - mbAllwayOnTop = FALSE; - mbVisible = FALSE; - mbMinHide = FALSE; - mbInShow = FALSE; - mbRestoreMaximize = FALSE; - mbInMoveMsg = FALSE; - mbInSizeMsg = FALSE; - mbDefPos = TRUE; - mbOverwriteState = TRUE; - mbHandleIME = FALSE; - mbConversionMode = FALSE; - mbCandidateMode = FALSE; - mbCaption = FALSE; - mpGraphics = NULL; - mnShowState = SWP_SHOWNORMAL; - mnWidth = 0; - mnHeight = 0; - mnMinWidth = 0; - mnMinHeight = 0; - mnMaxWidth = SHRT_MAX; - mnMaxHeight = SHRT_MAX; - mnInputLang = 0; - mnKeyboardHandle = 0; - mbGraphics = FALSE; - mbCaption = FALSE; - mbBorder = FALSE; - mbFixBorder = FALSE; - mbSizeBorder = FALSE; - mbFullScreen = FALSE; - mbInShow = FALSE; - mbRestoreMaximize = FALSE; - mbInMoveMsg = FALSE; - mbInSizeMsg = FALSE; - mbDefPos = TRUE; - mbOverwriteState = TRUE; - mbHandleIME = FALSE; - mbCandidateMode = FALSE; - mbFloatWin = FALSE; - mbNoIcon = FALSE; - mpParentFrame = NULL; - - memset( &maState, 0, sizeof( SalFrameState ) ); - maSysData.nSize = sizeof( SystemEnvData ); - memset( &maGeometry, 0, sizeof( maGeometry ) ); - - // insert frame in framelist - mpNextFrame = pSalData->mpFirstFrame; - pSalData->mpFirstFrame = this; -} - -// ----------------------------------------------------------------------- - -Os2SalFrame::~Os2SalFrame() -{ - SalData* pSalData = GetSalData(); - - // destroy DC - if ( mpGraphics ) - { - ImplSalDeInitGraphics( mpGraphics ); - WinReleasePS( mpGraphics->mhPS ); - delete mpGraphics; - } - - // destroy system frame - WinDestroyWindow( mhWndFrame ); - - // remove frame from framelist - if ( this == pSalData->mpFirstFrame ) - pSalData->mpFirstFrame = mpNextFrame; - else - { - Os2SalFrame* pTempFrame = pSalData->mpFirstFrame; - while ( pTempFrame->mpNextFrame != this ) - pTempFrame = pTempFrame->mpNextFrame; - - pTempFrame->mpNextFrame = mpNextFrame; - } -} - -// ----------------------------------------------------------------------- - -static HDC ImplWinGetDC( HWND hWnd ) -{ - HDC hDC = WinQueryWindowDC( hWnd ); - if ( !hDC ) - hDC = WinOpenWindowDC( hWnd ); - return hDC; -} - -// ----------------------------------------------------------------------- - -SalGraphics* Os2SalFrame::GetGraphics() -{ - if ( mbGraphics ) - return NULL; - - if ( !mpGraphics ) - { - SalData* pSalData = GetSalData(); - mpGraphics = new Os2SalGraphics; - mpGraphics->mhPS = WinGetPS( mhWndClient ); - mpGraphics->mhDC = ImplWinGetDC( mhWndClient ); - mpGraphics->mhWnd = mhWndClient; - mpGraphics->mnHeight = mnHeight; - mpGraphics->mbPrinter = FALSE; - mpGraphics->mbVirDev = FALSE; - mpGraphics->mbWindow = TRUE; - mpGraphics->mbScreen = TRUE; - ImplSalInitGraphics( mpGraphics ); - mbGraphics = TRUE; - } - else - mbGraphics = TRUE; - - return mpGraphics; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ReleaseGraphics( SalGraphics* ) -{ - mbGraphics = FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalFrame::PostEvent( void* pData ) -{ - return (BOOL)WinPostMsg( mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetTitle( const XubString& rTitle ) -{ - // set window title - ByteString title( rTitle, gsl_getSystemTextEncoding() ); - debug_printf("Os2SalFrame::SetTitle %x '%s'\n", mhWndFrame, title.GetBuffer() ); - WinSetWindowText( mhWndFrame, title.GetBuffer() ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetIcon( USHORT nIcon ) -{ - debug_printf("Os2SalFrame::SetIcon\n"); - - // If we have a window without an Icon (for example a dialog), ignore this call - if ( mbNoIcon ) - return; - - // 0 means default (class) icon - HPOINTER hIcon = NULL; - if ( !nIcon ) - nIcon = 1; - - ImplLoadSalIcon( nIcon, hIcon ); - - DBG_ASSERT( hIcon , "Os2SalFrame::SetIcon(): Could not load icon !" ); - - // Icon setzen - WinSendMsg( mhWndFrame, WM_SETICON, (MPARAM)hIcon, (MPARAM)0 ); -} - -// ----------------------------------------------------------------------- - -SalFrame* Os2SalFrame::GetParent() const -{ - //debug_printf("Os2SalFrame::GetParent\n"); - return GetWindowPtr( WinQueryWindow(mhWndFrame, QW_OWNER) ); -} - -// ----------------------------------------------------------------------- - -static void ImplSalShow( HWND hWnd, ULONG bVisible, ULONG bNoActivate ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return; - - if ( bVisible ) - { - pFrame->mbDefPos = FALSE; - pFrame->mbOverwriteState = TRUE; - pFrame->mbInShow = TRUE; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "ImplSalShow hwnd %x visible flag %d, no activate: flag %d\n", hWnd, bVisible, bNoActivate); -#endif - - if( bNoActivate ) - WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_SHOW); - else - WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, pFrame->mnShowState); - - pFrame->mbInShow = FALSE; - - // Direct Paint only, if we get the SolarMutx - if ( ImplSalYieldMutexTryToAcquire() ) - { - WinUpdateWindow( hWnd ); - ImplSalYieldMutexRelease(); - } - } - else - { -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "ImplSalShow hwnd %x HIDE\n"); -#endif - WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_HIDE); - } -} - - -// ----------------------------------------------------------------------- - - -void Os2SalFrame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) -{ - // Post this Message to the window, because this only works - // in the thread of the window, which has create this window. - // We post this message to avoid deadlocks - if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) - WinPostMsg( mhWndFrame, SAL_MSG_SHOW, (MPARAM)bVisible, (MPARAM)bNoActivate ); - else - ImplSalShow( mhWndFrame, bVisible, bNoActivate ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Enable( BOOL bEnable ) -{ - WinEnableWindow( mhWndFrame, bEnable ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetMinClientSize( long nWidth, long nHeight ) -{ - debug_printf("Os2SalFrame::SetMinClientSize\n"); - mnMinWidth = nWidth; - mnMinHeight = nHeight; -} - -void Os2SalFrame::SetMaxClientSize( long nWidth, long nHeight ) -{ - debug_printf("Os2SalFrame::SetMaxClientSize\n"); - mnMaxWidth = nWidth; - mnMaxHeight = nHeight; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) -{ - // calculation frame size - USHORT nEvent = 0; - ULONG nPosFlags = 0; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( ">Os2SalFrame::SetPosSize go to %d,%d (%dx%d) VCL\n",nX,nY,nWidth,nHeight); -#endif - - SWP aSWP; - _WinQueryWindowPos( this, &aSWP ); - BOOL bVisible = WinIsWindowVisible( mhWndFrame ); - if ( !bVisible ) - { - if ( mbFloatWin ) - mnShowState = SWP_SHOW; - else - mnShowState = SWP_SHOWNORMAL; - } - else - { - if ( (aSWP.fl & SWP_MINIMIZE) || (aSWP.fl & SWP_MAXIMIZE) ) - WinSetWindowPos(mhWndFrame, NULL, 0, 0, 0, 0, SWP_RESTORE ); - } - - if ( (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) ) { - nPosFlags |= SWP_MOVE; -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "-Os2SalFrame::SetPosSize MOVE to %d,%d\n", nX, nY); -#endif - nEvent = SALEVENT_MOVE; - } - - if ( (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) ) { - nPosFlags |= SWP_SIZE; -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "-Os2SalFrame::SetPosSize SIZE to %d,%d\n", nWidth,nHeight); -#endif - nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE; - } - - // Default-Position, dann zentrieren, ansonsten Position beibehalten - if ( mbDefPos && !(nPosFlags & SWP_MOVE)) - { - // calculate bottom left corner of frame - mbDefPos = FALSE; - nPosFlags |= SWP_MOVE | SWP_CENTER; - nEvent = SALEVENT_MOVERESIZE; -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "-Os2SalFrame::SetPosSize CENTER\n"); - debug_printf( "-Os2SalFrame::SetPosSize default position to %d,%d\n", nX, nY); -#endif - } - - // Adjust Window in the screen - BOOL bCheckOffScreen = TRUE; - - // but don't do this for floaters or ownerdraw windows that are currently moved interactively - if( (mnStyle & SAL_FRAME_STYLE_FLOAT) && !(mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) - bCheckOffScreen = FALSE; - - if( mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) - { - // may be the window is currently being moved (mouse is captured), then no check is required - if( mhWndClient == WinQueryCapture( HWND_DESKTOP) ) - bCheckOffScreen = FALSE; - else - bCheckOffScreen = TRUE; - } - - if( bCheckOffScreen ) - { - if ( nX+nWidth > nScreenWidth ) - nX = nScreenWidth - nWidth; - if ( nY+nHeight > nScreenHeight ) - nY = nScreenHeight - nHeight; - if ( nX < 0 ) - nX = 0; - if ( nY < 0 ) - nY = 0; - } - - // set new position - _WinSetWindowPos( this, HWND_TOP, nX, nY, nWidth, nHeight, nPosFlags); // | SWP_RESTORE - - UpdateFrameGeometry( mhWndFrame, this ); - - // Notification -- really ??? - if( nEvent ) - CallCallback( nEvent, NULL ); - -#if OSL_DEBUG_LEVEL > 1 - dumpWindowInfo( "<Os2SalFrame::SetPosSize (exit)", mhWndFrame); -#endif - -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetParent( SalFrame* pNewParent ) -{ - APIRET rc; -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::SetParent mhWndFrame 0x%08x to 0x%08x\n", - static_cast<Os2SalFrame*>(this)->mhWndFrame, - static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); -#endif - Os2SalFrame::mbInReparent = TRUE; - rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, - static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); - mpParentFrame = static_cast<Os2SalFrame*>(pNewParent); - Os2SalFrame::mbInReparent = FALSE; -} - -bool Os2SalFrame::SetPluginParent( SystemParentData* pNewParent ) -{ - APIRET rc; - if ( pNewParent->hWnd == 0 ) - { - pNewParent->hWnd = HWND_DESKTOP; - } - - Os2SalFrame::mbInReparent = TRUE; - rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, - pNewParent->hWnd); - Os2SalFrame::mbInReparent = FALSE; - return true; -} - - -// ----------------------------------------------------------------------- - -void Os2SalFrame::GetWorkArea( RECTL &rRect ) -{ - rRect.xLeft = rRect.yTop = 0; - rRect.xRight = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN )-1; - rRect.yBottom = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN )-1; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::GetWorkArea( Rectangle &rRect ) -{ - RECTL aRect; - GetWorkArea( aRect); - rRect.nLeft = aRect.xLeft; - rRect.nRight = aRect.xRight; // win -1; - rRect.nTop = aRect.yTop; - rRect.nBottom = aRect.yBottom; // win -1; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::GetClientSize( long& rWidth, long& rHeight ) -{ - rWidth = maGeometry.nWidth; - rHeight = maGeometry.nHeight; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetWindowState( const SalFrameState* pState ) -{ - LONG nX; - LONG nY; - LONG nWidth; - LONG nHeight; - ULONG nPosSize = 0; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::SetWindowState\n"); - debug_printf("Os2SalFrame::SetWindowState %08x (%dx%d) at %d,%d VCL\n", - mhWndFrame, - pState->mnWidth,pState->mnHeight,pState->mnX,pState->mnY); -#endif - - BOOL bVisible = WinIsWindowVisible( mhWndFrame ); - - // get screen coordinates - SWP aSWP; - WinQueryWindowPos( mhWndFrame, &aSWP ); - LONG nFrameX, nFrameY, nCaptionY; - ImplSalCalcFrameSize( this, nFrameX, nFrameY, nCaptionY ); - - long nTopDeco = nFrameY + nCaptionY; - long nLeftDeco = nFrameX; - long nBottomDeco = nFrameY; - long nRightDeco = nFrameX; - - // Fenster-Position/Groesse in den Bildschirm einpassen - if ((pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y)) ) - nPosSize |= SWP_MOVE; - if ((pState->mnMask & (SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT)) ) - nPosSize |= SWP_SIZE; - - if ( pState->mnMask & SAL_FRAMESTATE_MASK_X ) - nX = (int)pState->mnX - nLeftDeco; - else - nX = aSWP.x; - - // keep Y inverted since height is still unknown, will invert later - if ( pState->mnMask & SAL_FRAMESTATE_MASK_Y ) - nY = (int)pState->mnY - nTopDeco; - else - nY = nScreenHeight - (aSWP.y+aSWP.cy); - - if ( pState->mnMask & SAL_FRAMESTATE_MASK_WIDTH ) - nWidth = (int)pState->mnWidth + nLeftDeco + nRightDeco; - else - nWidth = aSWP.cx; - if ( pState->mnMask & SAL_FRAMESTATE_MASK_HEIGHT ) - nHeight = (int)pState->mnHeight + nTopDeco + nBottomDeco; - else - nHeight = aSWP.cy; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::SetWindowState (%dx%d) at %d,%d\n", nWidth,nHeight,nX,nY); -#endif - - // Adjust Window in the screen: - // if it does not fit into the screen do nothing, ie default pos/size will be used - // if there is an overlap with the screen border move the window while keeping its size - - if ( nX+nWidth > nScreenWidth ) - nX = (nScreenWidth) - nWidth; - if ( nY+nHeight > nScreenHeight ) - nY = (nScreenHeight) - nHeight; - if ( nX < 0 ) - nX = 0; - if ( nY < 0 ) - nY = 0; - - // Restore-Position setzen - SWP aPlacement; - WinQueryWindowPos( mhWndFrame, &aPlacement ); - - // Status setzen - bVisible = WinIsWindowVisible( mhWndFrame); - BOOL bUpdateHiddenFramePos = FALSE; - if ( !bVisible ) - { - aPlacement.fl = SWP_HIDE; - - if ( mbOverwriteState ) - { - if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) - { - if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) - mnShowState = SWP_SHOWMINIMIZED; - else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) - { - mnShowState = SWP_SHOWMAXIMIZED; - bUpdateHiddenFramePos = TRUE; - } - else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) - mnShowState = SWP_SHOWNORMAL; - } - } - } - else - { - if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) - { - if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) - { - aPlacement.fl = SWP_SHOWMINIMIZED; - } - else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) - aPlacement.fl = SWP_SHOWMAXIMIZED; - else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) - aPlacement.fl = SWP_RESTORE; - } - } - - // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch - // umgesetzt werden muss, dann SetWindowPos() benutzen, da - // SetWindowPlacement() die TaskBar mit einrechnet - if ( !(aPlacement.fl & SWP_MINIMIZE) - && !( aPlacement.fl & SWP_MAXIMIZE ) - && (!bVisible || (aPlacement.fl == SWP_RESTORE)) ) - { - if( bUpdateHiddenFramePos ) - { - // #96084 set a useful internal window size because - // the window will not be maximized (and the size updated) before show() - SetMaximizedFrameGeometry( mhWndFrame, this ); - } - else - WinSetWindowPos( mhWndFrame, 0, nX, - nScreenHeight - (nY+nHeight), nWidth, nHeight, nPosSize); - } - else - { - if( (nPosSize & (SWP_MOVE|SWP_SIZE)) ) - { - aPlacement.x = nX; - aPlacement.y = nScreenHeight-(nY+nHeight); - aPlacement.cx = nWidth; - aPlacement.cy = nHeight; - } - WinSetWindowPos( mhWndFrame, 0, aPlacement.x, aPlacement.y, - aPlacement.cx, aPlacement.cy, aPlacement.fl ); - } - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Os2SalFrame::SetWindowState DONE\n"); -#endif -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalFrame::GetWindowState( SalFrameState* pState ) -{ - if ( maState.mnWidth && maState.mnHeight ) - { - *pState = maState; - if ( !(pState->mnState & (SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED)) ) - pState->mnState |= SAL_FRAMESTATE_NORMAL; - return TRUE; - } - - return FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetScreenNumber( unsigned int nNewScreen ) -{ -} - -void Os2SalFrame::SetApplicationID( const rtl::OUString &/*rApplicationID*/ ) -{ -} - -// ----------------------------------------------------------------------- - -// native menu implementation - currently empty -void Os2SalFrame::DrawMenuBar() -{ -} - -void Os2SalFrame::SetMenu( SalMenu* pSalMenu ) -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) -{ - if ( mbFullScreen == bFullScreen ) - return; - - mbFullScreen = bFullScreen; - if ( bFullScreen ) - { - // save old position - memset( &maFullScreenRect, 0, sizeof( SWP ) ); - _WinQueryWindowPos( this, &maFullScreenRect ); - - // set window to screen size - ImplSalFrameFullScreenPos( this, TRUE ); - } - else - { - _WinSetWindowPos( this, - 0, - maFullScreenRect.x, maFullScreenRect.y, - maFullScreenRect.cx, maFullScreenRect.cy, - SWP_MOVE | SWP_SIZE ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::StartPresentation( BOOL bStart ) -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetAlwaysOnTop( BOOL bOnTop ) -{ - mbAllwayOnTop = bOnTop; -} - - -// ----------------------------------------------------------------------- - -static void ImplSalToTop( HWND hWnd, ULONG nFlags ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); -#if OSL_DEBUG_LEVEL > 1 - debug_printf("ImplSalToTop hWnd %08x, nFlags %x\n", hWnd, nFlags); -#endif - - // if window is minimized, first restore it - SWP aSWP; - WinQueryWindowPos( hWnd, &aSWP ); - if ( aSWP.fl & SWP_MINIMIZE ) - WinSetWindowPos( hWnd, NULL, 0, 0, 0, 0, SWP_RESTORE ); - - if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) - WinSetWindowPos( pFrame->mhWndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER); - - if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) - { - ULONG nStyle; - if ( pFrame->mbRestoreMaximize ) - nStyle = SWP_MAXIMIZE; - else - nStyle = SWP_RESTORE; - - WinSetWindowPos( pFrame->mhWndFrame, NULL, 0, 0, 0, 0, nStyle ); - } - WinSetFocus( HWND_DESKTOP, pFrame->mhWndClient ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ToTop( USHORT nFlags ) -{ - nFlags &= ~SAL_FRAME_TOTOP_GRABFOCUS; // this flag is not needed on win32 - // Post this Message to the window, because this only works - // in the thread of the window, which has create this window. - // We post this message to avoid deadlocks - if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) - WinPostMsg( mhWndFrame, SAL_MSG_TOTOP, (MPARAM)nFlags, 0 ); - else - ImplSalToTop( mhWndFrame, nFlags ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetPointer( PointerStyle ePointerStyle ) -{ - struct ImplPtrData - { - HPOINTER mhPointer; - ULONG mnSysId; - ULONG mnOwnId; - }; - - static ImplPtrData aImplPtrTab[POINTER_COUNT] = - { - { 0, SPTR_ARROW, 0 }, // POINTER_ARROW - { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL - { 0, SPTR_WAIT, 0 }, // POINTER_WAIT - { 0, SPTR_TEXT, 0 }, // POINTER_BEAM - { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP - { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS - { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE - { 0, SPTR_SIZENS, 0 }, // POINTER_NSIZE - { 0, SPTR_SIZENS, 0 }, // POINTER_SSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_WSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_ESIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_NWSIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_NESIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_SWSIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_SESIZE - { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_NSIZE - { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_SSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE - { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE - { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE - { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE - { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT - { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT - { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR - { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR - { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND - { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND - { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN - { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY - { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL - { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE - { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR - { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR - { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR - { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK - { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP - { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT - { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT - { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA - { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA - { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA - { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK - { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK - { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE - { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE - { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE - { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK - { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK - { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES - { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES - { 0, SPTR_ILLEGAL, 0 }, // POINTER_NOTALLOWED - { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE - { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT - { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON - { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER - { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC - { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE - { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT - { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE - { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND - { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT - { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT - { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION - { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART - { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE - { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL - { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW - { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD - { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN - { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED - { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE - { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE - { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE - { 0, 0, SAL_RESID_POINTER_AIRBRUSH }, // POINTER_AIRBRUSH - { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL - { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE - - // --> FME 2004-07-30 #i32329# Enhanced table selection - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W - { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW - // <-- - - // --> FME 2004-08-16 #i20119# Paintbrush tool - { 0, 0, SAL_RESID_POINTER_PAINTBRUSH } // POINTER_PAINTBRUSH - // <-- - }; - -#if POINTER_COUNT != 94 -#error New Pointer must be defined! -#endif - - // Mousepointer loaded ? - if ( !aImplPtrTab[ePointerStyle].mhPointer ) - { - if ( aImplPtrTab[ePointerStyle].mnOwnId ) - aImplPtrTab[ePointerStyle].mhPointer = ImplLoadSalCursor( (ULONG)aImplPtrTab[ePointerStyle].mnOwnId ); - else - aImplPtrTab[ePointerStyle].mhPointer = WinQuerySysPointer( HWND_DESKTOP, aImplPtrTab[ePointerStyle].mnSysId, FALSE ); - } - if (aImplPtrTab[ePointerStyle].mhPointer == 0) { - debug_printf( "SetPointer ePointerStyle %d unknown\n", ePointerStyle); - aImplPtrTab[ePointerStyle].mhPointer = SPTR_ICONERROR; - } - - // Unterscheidet sich der Mauspointer, dann den neuen setzen - if ( mhPointer != aImplPtrTab[ePointerStyle].mhPointer ) - { - mhPointer = aImplPtrTab[ePointerStyle].mhPointer; - WinSetPointer( HWND_DESKTOP, mhPointer ); - } -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::CaptureMouse( BOOL bCapture ) -{ -#if OSL_DEBUG_LEVEL > 1 - _bCapture=bCapture; - debug_printf("Os2SalFrame::CaptureMouse bCapture %d\n", bCapture); -#endif - if ( bCapture ) - WinSetCapture( HWND_DESKTOP, mhWndClient ); - else - WinSetCapture( HWND_DESKTOP, 0 ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetPointerPos( long nX, long nY ) -{ - POINTL aPt; - aPt.x = nX; - aPt.y = mnHeight - nY - 1; // convert sal coords to sys - WinMapWindowPoints( mhWndClient, HWND_DESKTOP, &aPt, 1 ); - WinSetPointerPos( HWND_DESKTOP, aPt.x, aPt.y ); -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Flush() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Sync() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetInputContext( SalInputContext* pContext ) -{ -#ifdef ENABLE_IME - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nInputMode; - ULONG nConversionMode; - if ( 0 == pIMEData->mpQueryIMEMode( hIMI, &nInputMode, &nConversionMode ) ) - { - if ( pContext->mnOptions & SAL_INPUTCONTEXT_TEXT ) - { - nInputMode &= ~IMI_IM_IME_DISABLE; - if ( pContext->mnOptions & SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF ) - nInputMode &= ~IMI_IM_IME_ON; - nInputMode |= IMI_IM_IME_ON; - } - else - nInputMode |= IMI_IM_IME_DISABLE; - pIMEData->mpSetIMEMode( hIMI, nInputMode, nConversionMode ); - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } -#endif -} - -// ----------------------------------------------------------------------- - -// ----------------------------------------------------------------------- - -void Os2SalFrame::EndExtTextInput( USHORT nFlags ) -{ -#ifdef ENABLE_IME - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nIndex; - if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE ) - nIndex = CNV_COMPLETE; - else - nIndex = CNV_CANCEL; - - pIMEData->mpRequestIME( hIMI, REQ_CONVERSIONSTRING, nIndex, 0 ); - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } -#endif -} - -// ----------------------------------------------------------------------- - -XubString Os2SalFrame::GetKeyName( USHORT nCode ) -{ - if ( eImplKeyboardLanguage == LANGUAGE_DONTKNOW ) - eImplKeyboardLanguage = MsLangId::getSystemLanguage(); - - XubString aKeyCode; - XubString aCode; - const sal_Unicode** pLangTab = ImplGetLangTab( eImplKeyboardLanguage ); - - if ( nCode & KEY_SHIFT ) - aKeyCode = pLangTab[LSTR_KEY_SHIFT]; - - if ( nCode & KEY_MOD1 ) - { - if ( aKeyCode.Len() == 0 ) - aKeyCode = pLangTab[LSTR_KEY_CTRL]; - else - { - aKeyCode += '+'; - aKeyCode += pLangTab[LSTR_KEY_CTRL]; - } - } - - if ( nCode & KEY_MOD2 ) - { - if ( aKeyCode.Len() == 0 ) - aKeyCode = pLangTab[LSTR_KEY_ALT]; - else - { - aKeyCode += '+'; - aKeyCode += pLangTab[LSTR_KEY_ALT]; - } - } - - USHORT nKeyCode = nCode & 0x0FFF; - if ( (nKeyCode >= KEY_0) && (nKeyCode <= KEY_9) ) - aCode = sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_0)); - else if ( (nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z) ) - aCode = sal::static_int_cast<sal_Char>('A' + (nKeyCode - KEY_A)); - else if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F26) ) - { - aCode += 'F'; - if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F9) ) - { - aCode += sal::static_int_cast<sal_Char>('1' + (nKeyCode - KEY_F1)); - } - else if ( (nKeyCode >= KEY_F10) && (nKeyCode <= KEY_F19) ) - { - aCode += '1'; - aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F10)); - } - else - { - aCode += '2'; - aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F20)); - } - } - else - { - switch ( nKeyCode ) - { - case KEY_DOWN: - aCode = pLangTab[LSTR_KEY_DOWN]; - break; - case KEY_UP: - aCode = pLangTab[LSTR_KEY_UP]; - break; - case KEY_LEFT: - aCode = pLangTab[LSTR_KEY_LEFT]; - break; - case KEY_RIGHT: - aCode = pLangTab[LSTR_KEY_RIGHT]; - break; - case KEY_HOME: - aCode = pLangTab[LSTR_KEY_HOME]; - break; - case KEY_END: - aCode = pLangTab[LSTR_KEY_END]; - break; - case KEY_PAGEUP: - aCode = pLangTab[LSTR_KEY_PAGEUP]; - break; - case KEY_PAGEDOWN: - aCode = pLangTab[LSTR_KEY_PAGEDOWN]; - break; - case KEY_RETURN: - aCode = pLangTab[LSTR_KEY_RETURN]; - break; - case KEY_ESCAPE: - aCode = pLangTab[LSTR_KEY_ESC]; - break; - case KEY_TAB: - aCode = pLangTab[LSTR_KEY_TAB]; - break; - case KEY_BACKSPACE: - aCode = pLangTab[LSTR_KEY_BACKSPACE]; - break; - case KEY_SPACE: - aCode = pLangTab[LSTR_KEY_SPACE]; - break; - case KEY_INSERT: - aCode = pLangTab[LSTR_KEY_INSERT]; - break; - case KEY_DELETE: - aCode = pLangTab[LSTR_KEY_DELETE]; - break; - - case KEY_ADD: - aCode += '+'; - break; - case KEY_SUBTRACT: - aCode += '-'; - break; - case KEY_MULTIPLY: - aCode += '*'; - break; - case KEY_DIVIDE: - aCode += '/'; - break; - case KEY_POINT: - aCode += '.'; - break; - case KEY_COMMA: - aCode += ','; - break; - case KEY_LESS: - aCode += '<'; - break; - case KEY_GREATER: - aCode += '>'; - break; - case KEY_EQUAL: - aCode += '='; - break; - } - } - - if ( aCode.Len() ) - { - if ( aKeyCode.Len() == 0 ) - aKeyCode = aCode; - else - { - aKeyCode += '+'; - aKeyCode += aCode; - } - } - - return aKeyCode; -} - -// ----------------------------------------------------------------------- - -XubString Os2SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) -{ - return GetKeyName( nKeyCode ); -} - -// ----------------------------------------------------------------------- - -inline long ImplOS2ColorToSal( long nOS2Color ) -{ - return MAKE_SALCOLOR( (BYTE)( nOS2Color>>16), (BYTE)(nOS2Color>>8), (BYTE)nOS2Color ); -} - -// ----------------------------------------------------------------------- - -static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, BOOL& rDown ) -{ - LONG lValue = WinQuerySysValue( HWND_DESKTOP, iSysValue ); - - rCode = 0; - rClicks = 1; - rDown = TRUE; - - switch ( lValue & 0xFFFF ) - { - case WM_BUTTON1UP: - case WM_BUTTON1CLICK: - rCode = MOUSE_LEFT; - rDown = FALSE; - break; - case WM_BUTTON1DOWN: - case WM_BUTTON1MOTIONSTART: - rCode = MOUSE_LEFT; - break; - case WM_BUTTON1DBLCLK: - rCode = MOUSE_LEFT; - rClicks = 2; - break; - - case WM_BUTTON2UP: - case WM_BUTTON2CLICK: - rCode = MOUSE_RIGHT; - rDown = FALSE; - break; - case WM_BUTTON2DOWN: - case WM_BUTTON2MOTIONSTART: - rCode = MOUSE_RIGHT; - break; - case WM_BUTTON2DBLCLK: - rCode = MOUSE_RIGHT; - rClicks = 2; - break; - - case WM_BUTTON3UP: - case WM_BUTTON3CLICK: - rCode = MOUSE_MIDDLE; - rDown = FALSE; - break; - case WM_BUTTON3DOWN: - case WM_BUTTON3MOTIONSTART: - rCode = MOUSE_MIDDLE; - break; - case WM_BUTTON3DBLCLK: - rCode = MOUSE_MIDDLE; - rClicks = 2; - break; - } - - if ( !rCode ) - return FALSE; - - lValue = (lValue & 0xFFFF0000) >> 16; - if ( lValue != 0xFFFF ) - { - if ( lValue & KC_SHIFT ) - rCode |= KEY_SHIFT; - if ( lValue & KC_CTRL ) - rCode |= KEY_MOD1; - if ( lValue & KC_ALT ) - rCode |= KEY_MOD2; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 ) -{ - ULONG nWrong = 0; - nWrong += Abs( (short)rColor1.GetRed()-(short)rColor2.GetRed() ); - nWrong += Abs( (short)rColor1.GetGreen()-(short)rColor2.GetGreen() ); - nWrong += Abs( (short)rColor1.GetBlue()-(short)rColor2.GetBlue() ); - return (nWrong < 30); -} - -// ----------------------------------------------------------------------- - -static BOOL ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont ) -{ - char aNumBuf[10]; - int nNumBufLen = 0; - - while ( *pFontName && (*pFontName != '.') && - (nNumBufLen < sizeof(aNumBuf)-1) ) - { - aNumBuf[nNumBufLen] = *pFontName; - nNumBufLen++; - pFontName++; - } - aNumBuf[nNumBufLen] = '\0'; - - pFontName++; - while ( *pFontName == ' ' ) - pFontName++; - - int nFontHeight = atoi( aNumBuf ); - int nFontNameLen = strlen( pFontName ); - if ( nFontHeight && nFontNameLen ) - { - rFont.SetFamily( FAMILY_DONTKNOW ); - rFont.SetWeight( WEIGHT_NORMAL ); - rFont.SetItalic( ITALIC_NONE ); - // search for a style embedded in the name, e.g. 'WarpSans Bold' - // because we need to split the style from the family name - if (strstr( pFontName, " Bold") - || strstr( pFontName, " Italic") - || strstr( pFontName, "-Normal")) - { - char* fontName = strdup( pFontName); - char* style = strstr( fontName, " Bold"); - if (style) - rFont.SetWeight( WEIGHT_BOLD ); - - if (!style) - style = strstr( fontName, " Italic"); - if (style) - rFont.SetItalic( ITALIC_NORMAL ); - - if (!style) - style = strstr( fontName, "-Normal"); - // store style, skip whitespace char - rFont.SetStyleName( ::rtl::OStringToOUString ( style+1, gsl_getSystemTextEncoding()) ); - // truncate name - *style = 0; - // store family name - rFont.SetName( ::rtl::OStringToOUString ( fontName, gsl_getSystemTextEncoding()) ); - free( fontName); - } - else - { - rFont.SetName( ::rtl::OStringToOUString (pFontName, gsl_getSystemTextEncoding()) ); - rFont.SetStyleName( ::rtl::OStringToOUString ("", gsl_getSystemTextEncoding()) ); - } - - rFont.SetSize( Size( 0, nFontHeight ) ); - return TRUE; - } - else - return FALSE; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) -{ - static char aControlPanel[] = "PM_ControlPanel"; - static char aSystemFonts[] = "PM_SystemFonts"; - char aDummyStr[] = ""; - - // --- Mouse setting --- - USHORT nCode; - USHORT nClicks; - BOOL bDown; - MouseSettings aMouseSettings = rSettings.GetMouseSettings(); - aMouseSettings.SetDoubleClickTime( WinQuerySysValue( HWND_DESKTOP, SV_DBLCLKTIME ) ); - if ( ImplMouseSysValueToSAL( SV_BEGINDRAG, nCode, nClicks, bDown ) ) - aMouseSettings.SetStartDragCode( nCode ); - if ( ImplMouseSysValueToSAL( SV_CONTEXTMENU, nCode, nClicks, bDown ) ) - { - aMouseSettings.SetContextMenuCode( nCode ); - aMouseSettings.SetContextMenuClicks( nClicks ); - aMouseSettings.SetContextMenuDown( bDown ); - } - aMouseSettings.SetButtonStartRepeat( WinQuerySysValue( HWND_DESKTOP, SV_FIRSTSCROLLRATE ) ); - aMouseSettings.SetButtonRepeat( WinQuerySysValue( HWND_DESKTOP, SV_SCROLLRATE ) ); - rSettings.SetMouseSettings( aMouseSettings ); - - // --- Style settings --- - StyleSettings aStyleSettings = rSettings.GetStyleSettings(); - // General settings - LONG nDisplayTime = PrfQueryProfileInt( HINI_PROFILE, (PSZ)aControlPanel, (PSZ)"LogoDisplayTime", -1 ); - ULONG nSalDisplayTime; - if ( nDisplayTime < 0 ) - nSalDisplayTime = LOGO_DISPLAYTIME_STARTTIME; - else if ( !nDisplayTime ) - nSalDisplayTime = LOGO_DISPLAYTIME_NOLOGO; - else - nSalDisplayTime = (ULONG)nDisplayTime; - aStyleSettings.SetLogoDisplayTime( nSalDisplayTime ); - - aStyleSettings.SetCursorBlinkTime( WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE ) ); - ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions(); - if ( WinQuerySysValue( HWND_DESKTOP, SV_DYNAMICDRAG ) ) - nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT; - else - nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT); - aStyleSettings.SetDragFullOptions( nDragFullOptions ); - - // Size settings - aStyleSettings.SetScrollBarSize( WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL ) ); - aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) ); - - // Color settings - aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); - aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); - aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) ); - aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); - aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) ); - aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) ); - aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) ); - aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) ); - aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) ); - aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) ); - aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) ); - aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) ); - aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); - aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); - aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); - aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); - aStyleSettings.SetGroupTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWSTATICTEXT, 0 ) ) ); - aStyleSettings.SetLabelTextColor( aStyleSettings.GetGroupTextColor() ); - aStyleSettings.SetInfoTextColor( aStyleSettings.GetGroupTextColor() ); - aStyleSettings.SetWindowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOW, 0 ) ) ); - aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() ); - aStyleSettings.SetWindowTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWTEXT, 0 ) ) ); - aStyleSettings.SetFieldColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ENTRYFIELD, 0 ) ) ); - aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() ); - aStyleSettings.SetDisableColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUDISABLEDTEXT, 0 ) ) ); - aStyleSettings.SetHighlightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEBACKGROUND, 0 ) ) ); - aStyleSettings.SetHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEFOREGROUND, 0 ) ) ); - Color aMenuHighColor = ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITEBGND, 0 ) ); - if ( ImplSalIsSameColor( aMenuHighColor, aStyleSettings.GetMenuColor() ) ) - { - aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) ); - aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) ); - } - else - { - aStyleSettings.SetMenuHighlightColor( aMenuHighColor ); - aStyleSettings.SetMenuHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITE, 0 ) ) ); - } - // Checked-Color berechnen - Color aColor1 = aStyleSettings.GetFaceColor(); - Color aColor2 = aStyleSettings.GetLightColor(); - BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2); - BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2); - BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - - // Fonts updaten - Font aFont; - char aFontNameBuf[255]; - aFont = aStyleSettings.GetMenuFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"Menus", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) { - aStyleSettings.SetMenuFont( aFont ); - } - } - aFont = aStyleSettings.GetIconFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"IconText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) - aStyleSettings.SetIconFont( aFont ); - } - aFont = aStyleSettings.GetTitleFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowTitles", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) - { - // Add Workplace Sans if not already listed - if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) - { - XubString aFontName = aFont.GetName(); - aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); - aFont.SetName( aFontName ); - aFont.SetSize( Size( 0, 9 ) ); - aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetItalic( ITALIC_NONE ); - } - aStyleSettings.SetTitleFont( aFont ); - aStyleSettings.SetFloatTitleFont( aFont ); - } - } - aFont = aStyleSettings.GetAppFont(); - if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) - { - if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) - { - Font aHelpFont = aFont; - aHelpFont.SetName( (sal_Unicode*)L"Helv;WarpSans" ); - aHelpFont.SetSize( Size( 0, 8 ) ); - aHelpFont.SetWeight( WEIGHT_NORMAL ); - aHelpFont.SetItalic( ITALIC_NONE ); - aStyleSettings.SetHelpFont( aHelpFont ); - - // Add Workplace Sans if not already listed - if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) - { - XubString aFontName = aFont.GetName(); - aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); - aFont.SetName( aFontName ); - aFont.SetSize( Size( 0, 9 ) ); - } - aStyleSettings.SetAppFont( aFont ); - aStyleSettings.SetToolFont( aFont ); - aStyleSettings.SetLabelFont( aFont ); - aStyleSettings.SetInfoFont( aFont ); - aStyleSettings.SetRadioCheckFont( aFont ); - aStyleSettings.SetPushButtonFont( aFont ); - aStyleSettings.SetFieldFont( aFont ); - aStyleSettings.SetGroupFont( aFont ); - } - } - - rSettings.SetStyleSettings( aStyleSettings ); -} - -// ----------------------------------------------------------------------- - -SalBitmap* Os2SalFrame::SnapShot() -{ -debug_printf("Os2SalFrame::SnapShot\n"); -return NULL; -} - -// ----------------------------------------------------------------------- - -const SystemEnvData* Os2SalFrame::GetSystemData() const -{ - return &maSysData; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::Beep( SoundType eSoundType ) -{ - static ULONG aImplSoundTab[5] = - { - WA_NOTE, // SOUND_DEFAULT - WA_NOTE, // SOUND_INFO - WA_WARNING, // SOUND_WARNING - WA_ERROR, // SOUND_ERROR - WA_NOTE // SOUND_QUERY - }; - - debug_printf("Os2SalFrame::Beep %d\n", eSoundType); - WinAlarm( HWND_DESKTOP, aImplSoundTab[eSoundType] ); -} - -// ----------------------------------------------------------------------- - -SalFrame::SalPointerState Os2SalFrame::GetPointerState() -{ - SalPointerState aState; - aState.mnState = 0; - - // MausModus feststellen und setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) - aState.mnState |= MOUSE_LEFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) - aState.mnState |= MOUSE_RIGHT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) - aState.mnState |= MOUSE_MIDDLE; - // Modifier-Tasten setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) - aState.mnState |= KEY_SHIFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) - aState.mnState |= KEY_MOD1; - if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) - aState.mnState |= KEY_MOD2; - - POINTL pt; - _WinQueryPointerPos( HWND_DESKTOP, &pt ); - - aState.maPos = Point( pt.x - maGeometry.nX, pt.y - maGeometry.nY ); - return aState; -} - -// ----------------------------------------------------------------------- - -SalFrame::SalIndicatorState Os2SalFrame::GetIndicatorState() -{ - SalIndicatorState aState; - aState.mnState = 0; - return aState; -} - -void Os2SalFrame::SimulateKeyPress( USHORT /*nKeyCode*/ ) -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::SetBackgroundBitmap( SalBitmap* ) -{ -} - -// ----------------------------------------------------------------------- - -void SalTestMouseLeave() -{ - SalData* pSalData = GetSalData(); - - if ( pSalData->mhWantLeaveMsg && !::WinQueryCapture( HWND_DESKTOP ) ) - { - POINTL aPt; - WinQueryPointerPos( HWND_DESKTOP, &aPt ); - if ( pSalData->mhWantLeaveMsg != WinWindowFromPoint( HWND_DESKTOP, &aPt, TRUE ) ) - WinSendMsg( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MPFROM2SHORT( aPt.x, aPt.y ) ); - } -} - -// ----------------------------------------------------------------------- - -static long ImplHandleMouseMsg( HWND hWnd, - UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - SalMouseEvent aMouseEvt; - long nRet; - USHORT nEvent; - BOOL bCall = TRUE; - USHORT nFlags = SHORT2FROMMP( nMP2 ); - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return 0; - - aMouseEvt.mnX = (short)SHORT1FROMMP( nMP1 ); - aMouseEvt.mnY = pFrame->mnHeight - (short)SHORT2FROMMP( nMP1 ) - 1; - aMouseEvt.mnCode = 0; - aMouseEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - - // MausModus feststellen und setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) - aMouseEvt.mnCode |= MOUSE_LEFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) - aMouseEvt.mnCode |= MOUSE_RIGHT; - if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) - aMouseEvt.mnCode |= MOUSE_MIDDLE; - // Modifier-Tasten setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) - aMouseEvt.mnCode |= KEY_SHIFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) - aMouseEvt.mnCode |= KEY_MOD1; - if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) - aMouseEvt.mnCode |= KEY_MOD2; - - switch ( nMsg ) - { - case WM_MOUSEMOVE: - { - SalData* pSalData = GetSalData(); - - // Da bei Druecken von Modifier-Tasten die MouseEvents - // nicht zusammengefast werden (da diese durch KeyEvents - // unterbrochen werden), machen wir dieses hier selber - if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) ) - { - QMSG aTempMsg; - if ( WinPeekMsg( pSalData->mhAB, &aTempMsg, - pFrame->mhWndClient, - WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) ) - { - if ( (aTempMsg.msg == WM_MOUSEMOVE) && - (aTempMsg.mp2 == nMP2) ) - return 1; - } - } - - // Test for MouseLeave - if ( pSalData->mhWantLeaveMsg && - (pSalData->mhWantLeaveMsg != pFrame->mhWndClient) ) - { - POINTL aMousePoint; - WinQueryMsgPos( pFrame->mhAB, &aMousePoint ); - WinSendMsg( pSalData->mhWantLeaveMsg, - SAL_MSG_MOUSELEAVE, - 0, MPFROM2SHORT( aMousePoint.x, aMousePoint.y ) ); - } - pSalData->mhWantLeaveMsg = pFrame->mhWndClient; - // Start MouseLeave-Timer - if ( !pSalData->mpMouseLeaveTimer ) - { - pSalData->mpMouseLeaveTimer = new AutoTimer; - pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT ); - pSalData->mpMouseLeaveTimer->Start(); - // We dont need to set a timeout handler, because we test - // for mouseleave in the timeout callback - } - aMouseEvt.mnButton = 0; - nEvent = SALEVENT_MOUSEMOVE; - } - break; - - case SAL_MSG_MOUSELEAVE: - { - SalData* pSalData = GetSalData(); - if ( pSalData->mhWantLeaveMsg == pFrame->mhWndClient ) - { - pSalData->mhWantLeaveMsg = 0; - if ( pSalData->mpMouseLeaveTimer ) - { - delete pSalData->mpMouseLeaveTimer; - pSalData->mpMouseLeaveTimer = NULL; - } - - // Mouse-Coordinaates are relativ to the screen - POINTL aPt; - aPt.x = (short)SHORT1FROMMP( nMP2 ); - aPt.y = (short)SHORT2FROMMP( nMP2 ); - WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); - aPt.y = pFrame->mnHeight - aPt.y - 1; - aMouseEvt.mnX = aPt.x; - aMouseEvt.mnY = aPt.y; - aMouseEvt.mnButton = 0; - nEvent = SALEVENT_MOUSELEAVE; - } - else - bCall = FALSE; - } - break; - - case WM_BUTTON1DBLCLK: - case WM_BUTTON1DOWN: - aMouseEvt.mnButton = MOUSE_LEFT; - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - - case WM_BUTTON2DBLCLK: - case WM_BUTTON2DOWN: - aMouseEvt.mnButton = MOUSE_RIGHT; - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - - case WM_BUTTON3DBLCLK: - case WM_BUTTON3DOWN: - aMouseEvt.mnButton = MOUSE_MIDDLE; - nEvent = SALEVENT_MOUSEBUTTONDOWN; - break; - - case WM_BUTTON1UP: - aMouseEvt.mnButton = MOUSE_LEFT; - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - - case WM_BUTTON2UP: - aMouseEvt.mnButton = MOUSE_RIGHT; - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - - case WM_BUTTON3UP: - aMouseEvt.mnButton = MOUSE_MIDDLE; - nEvent = SALEVENT_MOUSEBUTTONUP; - break; - } - - // check if this window was destroyed - this might happen if we are the help window - // and sent a mouse leave message to the application which killed the help window, ie ourself - if( !WinIsWindow( pFrame->mhAB, hWnd ) ) - return 0; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf("ImplHandleMouseMsg mouse %d,%d\n",aMouseEvt.mnX,aMouseEvt.mnY); -#endif - - if ( bCall ) - { - if ( nEvent == SALEVENT_MOUSEBUTTONDOWN ) - WinUpdateWindow( pFrame->mhWndClient ); - - nRet = pFrame->CallCallback( nEvent, &aMouseEvt ); - if ( nMsg == WM_MOUSEMOVE ) - { - WinSetPointer( HWND_DESKTOP, pFrame->mhPointer ); - nRet = TRUE; - } - } - else - nRet = 0; - - return nRet; -} - -// ----------------------------------------------------------------------- - -static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - - ImplSalYieldMutexAcquireWithWait(); - - long nRet = 0; - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - - // Mouse-Coordinaates are relativ to the screen - POINTL aPt; - WinQueryMsgPos( pFrame->mhAB, &aPt ); - WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); - aPt.y = pFrame->mnHeight - aPt.y - 1; - - SalWheelMouseEvent aWheelEvt; - aWheelEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aWheelEvt.mnX = aPt.x; - aWheelEvt.mnY = aPt.y; - aWheelEvt.mnCode = 0; - bool bNeg = (SHORT2FROMMP(nMP2) == SB_LINEDOWN || SHORT2FROMMP(nMP2) == SB_PAGEDOWN ); - aWheelEvt.mnDelta = bNeg ? -120 : 120; - aWheelEvt.mnNotchDelta = bNeg ? -1 : 1; - if (SHORT2FROMMP(nMP2) == SB_PAGEUP || SHORT2FROMMP(nMP2) == SB_PAGEDOWN) - aWheelEvt.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; - else - aWheelEvt.mnScrollLines = 1; - - if( nMsg == WM_HSCROLL ) - aWheelEvt.mbHorz = TRUE; - - // Modifier-Tasten setzen - if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) - aWheelEvt.mnCode |= KEY_SHIFT; - if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) - aWheelEvt.mnCode |= KEY_MOD1; - if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) - aWheelEvt.mnCode |= KEY_MOD2; - - nRet = pFrame->CallCallback( SALEVENT_WHEELMOUSE, &aWheelEvt ); - } - - ImplSalYieldMutexRelease(); - - return nRet; -} - - -// ----------------------------------------------------------------------- - -static USHORT ImplSalGetKeyCode( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) -{ - USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); - UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); - USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); - UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); - USHORT rSVCode = 0; - - // Ist virtueller KeyCode gesetzt und befindet sich der KeyCode in der - // Tabelle, dann mappen - if ( (nKeyFlags & KC_VIRTUALKEY) && (nKeyCode < KEY_TAB_SIZE) ) - rSVCode = aImplTranslateKeyTab[nKeyCode]; - - // Wenn kein KeyCode ermittelt werden konnte, versuchen wir aus dem - // CharCode einen zu erzeugen - if ( !rSVCode && nCharCode ) - { - // Bei 0-9, a-z und A-Z auch KeyCode setzen - if ( (nCharCode >= '0') && (nCharCode <= '9') && (!rSVCode || !(nKeyFlags & KC_SHIFT)) ) - rSVCode = KEYGROUP_NUM + (nCharCode-'0'); - else if ( (nCharCode >= 'a') && (nCharCode <= 'z') ) - rSVCode = KEYGROUP_ALPHA + (nCharCode-'a'); - else if ( (nCharCode >= 'A') && (nCharCode <= 'Z') ) - rSVCode = KEYGROUP_ALPHA + (nCharCode-'A'); - else - { - switch ( nCharCode ) - { - case '+': - rSVCode = KEY_ADD; - break; - case '-': - rSVCode = KEY_SUBTRACT; - break; - case '*': - rSVCode = KEY_MULTIPLY; - break; - case '/': - rSVCode = KEY_DIVIDE; - break; - case '.': - rSVCode = KEY_POINT; - break; - case ',': - rSVCode = KEY_COMMA; - break; - case '<': - rSVCode = KEY_LESS; - break; - case '>': - rSVCode = KEY_GREATER; - break; - case '=': - rSVCode = KEY_EQUAL; - break; - } - } - } - - // "Numlock-Hack": we want to get correct keycodes from the numpad - if ( (nCharCode >= '0') && (nCharCode <= '9') && !(nKeyFlags & KC_SHIFT) ) - rSVCode = KEYGROUP_NUM + (nCharCode-'0'); - if ( nCharCode == ',' ) - rSVCode = KEY_COMMA; - if ( nCharCode == '.' ) - rSVCode = KEY_POINT; - - return rSVCode; -} - -// ----------------------------------------------------------------------- - -static void ImplUpdateInputLang( Os2SalFrame* pFrame ) -{ - BOOL bLanguageChange = FALSE; - ULONG nLang = 0; - APIRET rc; - UconvObject uconv_object = NULL; - LocaleObject locale_object = NULL; - UniChar *pinfo_item; - - // we do not support change of input language while working, - // so exit if already defined (mnInputLang is a static class field) - if (pFrame->mnInputLang) - return; - - // get current locale - rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); - // get Win32 locale id and sublanguage (hex uni string) - rc = UniQueryLocaleItem(locale_object, LOCI_xWinLocale, &pinfo_item); - // convert uni string to integer - rc = UniStrtoul(locale_object, pinfo_item, &pinfo_item, 16, &nLang); - rc = UniFreeMem(pinfo_item); -#if OSL_DEBUG_LEVEL > 1 - debug_printf("ImplUpdateInputLang nLang %04x\n", nLang); - char char_buffer[256]; - rc = UniCreateUconvObject((UniChar *)L"", &uconv_object); - rc = UniQueryLocaleItem(locale_object, LOCI_sKeyboard, &pinfo_item); - rc = UniStrFromUcs(uconv_object, char_buffer, pinfo_item, sizeof(char_buffer)); - debug_printf("Keyboard name is: %s\n", char_buffer ); - rc = UniFreeMem(pinfo_item); -#endif - rc = UniFreeLocaleObject(locale_object); - - // keep input lang up-to-date -#if OSL_DEBUG_LEVEL > 1 - debug_printf("ImplUpdateInputLang pFrame %08x lang changed from %d to %d\n", - pFrame, pFrame->mnInputLang, nLang); -#endif - pFrame->mnInputLang = nLang; -} - - -static sal_Unicode ImplGetCharCode( Os2SalFrame* pFrame, USHORT nKeyFlags, - sal_Char nCharCode, UCHAR nScanCode ) -{ - ImplUpdateInputLang( pFrame ); -#if OSL_DEBUG_LEVEL > 1 - debug_printf("ImplGetCharCode nCharCode %c, %04x\n", nCharCode, nCharCode); -#endif - return OUString( &nCharCode, 1, gsl_getSystemTextEncoding()).toChar(); -} - -// ----------------------------------------------------------------------- - -LanguageType Os2SalFrame::GetInputLanguage() -{ - if( !mnInputLang ) - ImplUpdateInputLang( this ); - - if( !mnInputLang ) - return LANGUAGE_DONTKNOW; - else - return (LanguageType) mnInputLang; -} - -// ----------------------------------------------------------------------- - -BOOL Os2SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) -{ - // not supported yet - return FALSE; -} - -// ----------------------------------------------------------------------- - -static sal_Unicode ImplConvertKey( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) -{ - USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); - UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); - USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); - UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); - sal_Unicode rSVCharCode = 0; - - // Ist Character-Code gesetzt - // !!! Bei CTRL/ALT ist KC_CHAR nicht gesetzt, jedoch moechten wir - // !!! dann auch einen CharCode und machen die Behandlung deshalb - // !!! selber - if ( (nKeyFlags & KC_CHAR) || (nKeyFlags & KC_CTRL) || (nKeyFlags & KC_ALT) ) - rSVCharCode = ImplGetCharCode( pFrame, nKeyFlags, nCharCode, nScanCode); - - // ret unicode - return rSVCharCode; -} - -// ----------------------------------------------------------------------- - -static long ImplHandleKeyMsg( HWND hWnd, - UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) -{ - static USHORT nLastOS2KeyChar = 0; - static sal_Unicode nLastChar = 0; - USHORT nRepeat = CHAR3FROMMP( nMP1 ) - 1; - SHORT nFlags = SHORT1FROMMP( nMP1 ); - USHORT nModCode = 0; - USHORT nSVCode = 0; - USHORT nOS2KeyCode = (UCHAR)SHORT2FROMMP( nMP2 ); - sal_Unicode nSVCharCode = 0; - long nRet = 0; - - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( !pFrame ) - return 0; - - // determine modifiers - if ( nFlags & KC_SHIFT ) - nModCode |= KEY_SHIFT; - if ( nFlags & KC_CTRL ) - nModCode |= KEY_MOD1; - if ( nFlags & KC_ALT ) - nModCode |= KEY_MOD2; - - // Bei Shift, Control und Alt schicken wir einen KeyModChange-Event - if ( (nOS2KeyCode == VK_SHIFT) || (nOS2KeyCode == VK_CTRL) || - (nOS2KeyCode == VK_ALT) || (nOS2KeyCode == VK_ALTGRAF) ) - { - SalKeyModEvent aModEvt; - aModEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aModEvt.mnCode = nModCode; -#if OSL_DEBUG_LEVEL > 1 - debug_printf("SALEVENT_KEYMODCHANGE\n"); -#endif - nRet = pFrame->CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt ); - } - else - { - nSVCode = ImplSalGetKeyCode( pFrame, nMP1, nMP2 ); - nSVCharCode = ImplConvertKey( pFrame, nMP1, nMP2 ); -#if OSL_DEBUG_LEVEL > 1 - debug_printf("nSVCode %04x nSVCharCode %04x\n",nSVCode,nSVCharCode ); -#endif - - // Fuer Java muessen wir bei KeyUp einen CharCode liefern - if ( nFlags & KC_KEYUP ) - { - if ( !nSVCharCode ) - { - if ( nLastOS2KeyChar == nOS2KeyCode ) - { - nSVCharCode = nLastChar; - nLastOS2KeyChar = 0; - nLastChar = 0; - } - } - else - { - nLastOS2KeyChar = 0; - nLastChar = 0; - } - } - else - { - nLastOS2KeyChar = nOS2KeyCode; - nLastChar = nSVCharCode; - } - - if ( nSVCode || nSVCharCode ) - { - SalKeyEvent aKeyEvt; - aKeyEvt.mnCode = nSVCode; - aKeyEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aKeyEvt.mnCode |= nModCode; - aKeyEvt.mnCharCode = nSVCharCode; - aKeyEvt.mnRepeat = nRepeat; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( (nFlags & KC_KEYUP) ? "SALEVENT_KEYUP\n" : "SALEVENT_KEYINPUT\n"); -#endif - nRet = pFrame->CallCallback( (nFlags & KC_KEYUP) ? SALEVENT_KEYUP : SALEVENT_KEYINPUT, - &aKeyEvt ); - } - } - - return nRet; -} - -// ----------------------------------------------------------------------- - -static bool ImplHandlePaintMsg( HWND hWnd ) -{ - BOOL bMutex = FALSE; - - if ( ImplSalYieldMutexTryToAcquire() ) - bMutex = TRUE; - - // if we don't get the mutex, we can also change the clip region, - // because other threads doesn't use the mutex from the main - // thread --> see GetGraphics() - - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine - // Paint-Region anliegt - if ( WinQueryUpdateRect( hWnd, NULL ) ) - { - // Call BeginPaint/EndPaint to query the rect and send - // this Notofication to rect - HPS hPS; - RECTL aUpdateRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aUpdateRect ); - WinEndPaint( hPS ); - - // Paint - if ( bMutex ) - { - SalPaintEvent aPEvt( aUpdateRect.xLeft, pFrame->mnHeight - aUpdateRect.yTop, aUpdateRect.xRight- aUpdateRect.xLeft, aUpdateRect.yTop - aUpdateRect.yBottom ); - - pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); - } - else - { - RECTL* pRect = new RECTL; - WinCopyRect( pFrame->mhAB, pRect, &aUpdateRect ); - WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); - } - } - } - - if ( bMutex ) - ImplSalYieldMutexRelease(); - - return bMutex ? true : false; -} - -// ----------------------------------------------------------------------- - -static void ImplHandlePaintMsg2( HWND hWnd, RECTL* pRect ) -{ - // Paint - if ( ImplSalYieldMutexTryToAcquire() ) - { - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - SalPaintEvent aPEvt( pRect->xLeft, pFrame->mnHeight - pRect->yTop, pRect->xRight - pRect->xLeft, pRect->yTop - pRect->yBottom ); - pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); - } - ImplSalYieldMutexRelease(); - delete pRect; - } - else - WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); -} - -// ----------------------------------------------------------------------- - -static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) -{ - // calculate and set frame geometry of a maximized window - useful if the window is still hidden - - RECTL aRect; - pFrame->GetWorkArea( aRect); - - // a maximized window has no other borders than the caption - pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0; - pFrame->maGeometry.nTopDecoration = pFrame->mbCaption ? WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) : 0; - - aRect.yTop += pFrame->maGeometry.nTopDecoration; - pFrame->maGeometry.nX = aRect.xLeft; - pFrame->maGeometry.nY = aRect.yBottom; - pFrame->maGeometry.nWidth = aRect.xRight - aRect.xLeft + 1; - pFrame->maGeometry.nHeight = aRect.yBottom - aRect.yTop + 1; -} - -static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) -{ - if( !pFrame ) - return; - - //SalFrame has a - //maGeometry member that holds absolute screen positions (and needs to be - //updated if the window is moved by the way). - - // reset data - memset(&pFrame->maGeometry, 0, sizeof(SalFrameGeometry) ); - - SWP swp; - LONG nFrameX, nFrameY, nCaptionY; - - // get frame size - WinQueryWindowPos(pFrame->mhWndFrame, &swp); - if (swp.fl & SWP_MINIMIZE) - return; - - // map from client area to screen - ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY); - pFrame->maGeometry.nTopDecoration = nFrameY + nCaptionY; - pFrame->maGeometry.nLeftDecoration = nFrameX; - pFrame->maGeometry.nRightDecoration = nFrameX; - pFrame->maGeometry.nBottomDecoration = nFrameY; - - // position of client area, not of frame corner! - pFrame->maGeometry.nX = swp.x + nFrameX; - pFrame->maGeometry.nY = nScreenHeight - (swp.y + swp.cy) + nFrameY + nCaptionY; - - int nWidth = swp.cx - pFrame->maGeometry.nRightDecoration - pFrame->maGeometry.nLeftDecoration; - int nHeight = swp.cy - pFrame->maGeometry.nBottomDecoration - pFrame->maGeometry.nTopDecoration; - - // clamp to zero - pFrame->maGeometry.nHeight = nHeight < 0 ? 0 : nHeight; - pFrame->maGeometry.nWidth = nWidth < 0 ? 0 : nWidth; -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "UpdateFrameGeometry: hwnd %x, frame %x at %d,%d (%dx%d)\n", - hWnd, pFrame->mhWndFrame, - pFrame->maGeometry.nX, pFrame->maGeometry.nY, - pFrame->maGeometry.nWidth,pFrame->maGeometry.nHeight); -#endif -} - -// ----------------------------------------------------------------------- - -static void ImplHandleMoveMsg( HWND hWnd) -{ - if ( ImplSalYieldMutexTryToAcquire() ) - { - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - UpdateFrameGeometry( hWnd, pFrame ); - - if ( WinIsWindowVisible( hWnd )) - pFrame->mbDefPos = FALSE; - - // Gegen moegliche Rekursionen sichern - if ( !pFrame->mbInMoveMsg ) - { - // Fenster im FullScreenModus wieder einpassen - pFrame->mbInMoveMsg = TRUE; - if ( pFrame->mbFullScreen ) - ImplSalFrameFullScreenPos( pFrame ); - pFrame->mbInMoveMsg = FALSE; - } - - // Status merken - ImplSaveFrameState( pFrame ); - - // Call Hdl - //#93851 if we call this handler, VCL floating windows are not updated correctly - //ImplCallMoveHdl( hWnd ); - - } - - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTMOVE, 0, 0 ); -} - -// ----------------------------------------------------------------------- - -static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) -{ - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - UpdateFrameGeometry( hWnd, pFrame ); - pFrame->mbDefPos = FALSE; - pFrame->mnWidth = (short)SHORT1FROMMP( nMP2 ); - pFrame->mnHeight = (short)SHORT2FROMMP( nMP2 ); - if ( pFrame->mpGraphics ) - pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2); - // Status merken - ImplSaveFrameState( pFrame ); - pFrame->CallCallback( SALEVENT_RESIZE, 0 ); - if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) - WinUpdateWindow( pFrame->mhWndClient ); - } -} - -// ----------------------------------------------------------------------- - -static long ImplHandleFocusMsg( Os2SalFrame* pFrame, MPARAM nMP2 ) -{ -if ( pFrame && !Os2SalFrame::mbInReparent ) -{ - if ( SHORT1FROMMP( nMP2 ) ) - { - if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) - WinUpdateWindow( pFrame->mhWndClient ); - return pFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); - } - else - { - return pFrame->CallCallback( SALEVENT_LOSEFOCUS, 0 ); - } -} -} - -// ----------------------------------------------------------------------- - -static void ImplHandleCloseMsg( HWND hWnd ) -{ - if ( ImplSalYieldMutexTryToAcquire() ) - { - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - pFrame->CallCallback( SALEVENT_CLOSE, 0 ); - } - - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, WM_CLOSE, 0, 0 ); -} - -// ----------------------------------------------------------------------- - -inline void ImplHandleUserEvent( HWND hWnd, MPARAM nMP2 ) -{ - ImplSalYieldMutexAcquireWithWait(); - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame ) - { - pFrame->CallCallback( SALEVENT_USEREVENT, (void*)nMP2 ); - } - ImplSalYieldMutexRelease(); -} - -// ----------------------------------------------------------------------- - -static int SalImplHandleProcessMenu( Os2SalFrame* pFrame, ULONG nMsg, MPARAM nMP1, MPARAM nMP2) -{ - long nRet = 0; -debug_printf("SalImplHandleProcessMenu\n"); - return (nRet == 0); -} - -// ----------------------------------------------------------------------- - -static void ImplHandleInputLangChange( HWND hWnd ) -{ - ImplSalYieldMutexAcquireWithWait(); - - // Feststellen, ob wir IME unterstuetzen - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); - - // trigger input language and codepage update - UINT nLang = pFrame->mnInputLang; - ImplUpdateInputLang( pFrame ); - debug_printf("ImplHandleInputLangChange new language 0x%04x\n",pFrame->mnInputLang); - - // notify change - if( nLang != pFrame->mnInputLang ) - pFrame->CallCallback( SALEVENT_INPUTLANGUAGECHANGE, 0 ); - - ImplSalYieldMutexRelease(); -} - -// ----------------------------------------------------------------------- - -#ifdef ENABLE_IME - -static long ImplHandleIMEStartConversion( Os2SalFrame* pFrame ) -{ - long nRet = FALSE; - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = pFrame->mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nProp; - if ( 0 != pIMEData->mpQueryIMEProperty( hIMI, QIP_PROPERTY, &nProp ) ) - pFrame->mbHandleIME = FALSE; - else - { - pFrame->mbHandleIME = !(nProp & PRP_SPECIALUI); - - } - if ( pFrame->mbHandleIME ) - { - pFrame->mbConversionMode = TRUE; - pFrame->CallCallback( SALEVENT_STARTEXTTEXTINPUT, (void*)NULL ); - nRet = TRUE; - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } - - return nRet; -} - -// ----------------------------------------------------------------------- - -static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) -{ - long nRet = FALSE; - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = pFrame->mhWndClient; - HIMI hIMI = 0; - ULONG nMP2 = (ULONG)nMP2Param; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - if ( nMP2 & (IMR_RESULT_RESULTSTRING | - IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | - IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) - { - SalExtTextInputEvent aEvt; - aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aEvt.mpTextAttr = NULL; - aEvt.mnCursorPos = 0; - aEvt.mnDeltaStart = 0; - aEvt.mbOnlyCursor = FALSE; - aEvt.mbCursorVisible = TRUE; - - ULONG nBufLen = 0; - xub_Unicode* pBuf = NULL; - ULONG nAttrBufLen = 0; - PM_BYTE* pAttrBuf = NULL; - BOOL bLastCursor = FALSE; - if ( nMP2 & IMR_RESULT_RESULTSTRING ) - { - pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, 0, &nBufLen ); - if ( nBufLen > 0 ) - { - pBuf = new xub_Unicode[nBufLen]; - pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, pBuf, &nBufLen ); - } - - bLastCursor = TRUE; - aEvt.mbCursorVisible = TRUE; - } - else if ( nMP2 & (IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | - IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) - { - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); - if ( nBufLen > 0 ) - { - pBuf = new xub_Unicode[nBufLen]; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, pBuf, &nBufLen ); - } - - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, 0, &nAttrBufLen ); - if ( nAttrBufLen > 0 ) - { - pAttrBuf = new PM_BYTE[nAttrBufLen]; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, pAttrBuf, &nAttrBufLen ); - } - - aEvt.mnCursorPos = 0; - aEvt.mnDeltaStart = 0; - aEvt.mbCursorVisible = FALSE; - - if ( (nMP2 == IMR_CONV_CURSORPOS) || - (nMP2 == IMR_CONV_CURSORATTR) ) - aEvt.mbOnlyCursor = TRUE; - } - - USHORT* pSalAttrAry = NULL; - if ( pBuf ) - { - aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); - delete [] pBuf; - if ( pAttrBuf ) - { - USHORT nTextLen = aEvt.maText.Len(); - if ( nTextLen ) - { - pSalAttrAry = new USHORT[nTextLen]; - memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) ); - for ( USHORT i = 0; (i < nTextLen) && (i < nAttrBufLen); i++ ) - { - PM_BYTE nOS2Attr = pAttrBuf[i]; - USHORT nSalAttr; - if ( nOS2Attr == CP_ATTR_TARGET_CONVERTED ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT; - else if ( nOS2Attr == CP_ATTR_CONVERTED ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE; - else if ( nOS2Attr == CP_ATTR_TARGET_NOTCONVERTED ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; - else if ( nOS2Attr == CP_ATTR_INPUT_ERROR ) - nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; - else /* ( nOS2Attr == CP_ATTR_INPUT ) */ - nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; - pSalAttrAry[i] = nSalAttr; - } - aEvt.mpTextAttr = pSalAttrAry; - } - delete [] pAttrBuf; - } - if ( bLastCursor ) - aEvt.mnCursorPos = aEvt.maText.Len(); - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - - // Handler rufen und wenn wir ein Attribute-Array haben, danach - // wieder zerstoeren - pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); - if ( pSalAttrAry ) - delete [] pSalAttrAry; - } - else - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - - nRet = TRUE; - } - - return nRet; -} - -// ----------------------------------------------------------------------- - -inline long ImplHandleIMEEndConversion( Os2SalFrame* pFrame ) -{ - pFrame->mbConversionMode = FALSE; - pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, (void*)NULL ); - return TRUE; -} - -// ----------------------------------------------------------------------- - -static void ImplHandleIMEOpenCandidate( Os2SalFrame* pFrame ) -{ - pFrame->mbCandidateMode = TRUE; - - long nRet = FALSE; - SalIMEData* pIMEData = GetSalIMEData(); - if ( pIMEData ) - { - HWND hWnd = pFrame->mhWndClient; - HIMI hIMI = 0; - pIMEData->mpGetIME( hWnd, &hIMI ); - if ( hIMI ) - { - ULONG nBufLen = 0; - pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); - if ( nBufLen > 0 ) - { - ULONG nCursorPos = 0; - - SalExtTextInputPosEvent aEvt; - aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); - aEvt.mnFirstPos = nCursorPos; - aEvt.mnChars = nBufLen-nCursorPos; - aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars]; - memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) ); - - pFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt ); - - long nMinLeft = aEvt.mpPosAry[0].mnX; - long nMinTop = aEvt.mpPosAry[0].mnY; - long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight; - long nMaxRight = nMinLeft; - USHORT i = 0; - while ( i < aEvt.mnChars ) - { - // Solange wir uns auf der gleichen Zeile bewegen, - // ermitteln wir die Rechteck-Grenzen - if ( !aEvt.mpPosAry[i].mnHeight || - (aEvt.mpPosAry[i].mnY < nMaxBottom-1) ) - { - if ( aEvt.mpPosAry[i].mnX < nMinLeft ) - nMinLeft = aEvt.mpPosAry[i].mnX; - if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight ) - nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth; - if ( aEvt.mpPosAry[i].mnY < nMinTop ) - nMinTop = aEvt.mpPosAry[i].mnY; - i++; - } - else - break; - } - - CANDIDATEPOS aForm; - aForm.ulIndex = 0; - aForm.ulStyle = CPS_EXCLUDE; - aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX; - aForm.ptCurrentPos.y = pFrame->mnHeight - (nMaxBottom+1) - 1; - aForm.rcArea.xLeft = nMinLeft; - aForm.rcArea.yBottom = pFrame->mnHeight - nMaxBottom - 1; - aForm.rcArea.xRight = nMaxRight+1; - aForm.rcArea.yTop = pFrame->mnHeight - nMinTop - 1; - pIMEData->mpSetCandidateWin( hIMI, &aForm ); - - delete aEvt.mpPosAry; - } - - pIMEData->mpReleaseIME( hWnd, hIMI ); - } - } -} - -// ----------------------------------------------------------------------- - -inline void ImplHandleIMECloseCandidate( Os2SalFrame* pFrame ) -{ - pFrame->mbCandidateMode = FALSE; -} - -#endif - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - Os2SalFrame* pFrame = (Os2SalFrame*)GetWindowPtr( hWnd ); - MRESULT nRet = (MRESULT)0; - BOOL bDef = TRUE; - bool bCheckTimers= false; - -#if OSL_DEBUG_LEVEL > 1 - if (nMsg!=WM_TIMER && nMsg!=WM_MOUSEMOVE) - debug_printf( "SalFrameWndProc hWnd 0x%x nMsg 0x%x\n", hWnd, nMsg); -#endif - - switch( nMsg ) - { - case WM_MOUSEMOVE: - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: - case WM_BUTTON1DBLCLK: - case WM_BUTTON2DBLCLK: - case WM_BUTTON3DBLCLK: - case WM_BUTTON1UP: - case WM_BUTTON2UP: - case WM_BUTTON3UP: - case SAL_MSG_MOUSELEAVE: - // ButtonUp/Down nie an die WinDefWindowProc weiterleiten, weil sonst - // die Message an den Owner weitergeleitet wird - ImplSalYieldMutexAcquireWithWait(); - bDef = !ImplHandleMouseMsg( hWnd, nMsg, nMP1, nMP2 ); - ImplSalYieldMutexRelease(); - break; - - case WM_CHAR: - if ( pFrame->mbConversionMode ) - bDef = FALSE; - else - bDef = !ImplHandleKeyMsg( hWnd, nMsg, nMP1, nMP2 ); - break; - - case WM_ERASEBACKGROUND: - nRet = (MRESULT)FALSE; - bDef = FALSE; - break; - - case WM_PAINT: - bCheckTimers = ImplHandlePaintMsg( hWnd ); - bDef = FALSE; - break; - case SAL_MSG_POSTPAINT: - ImplHandlePaintMsg2( hWnd, (RECTL*)nMP1 ); - bCheckTimers = true; - bDef = FALSE; - break; - - case WM_MOVE: - case SAL_MSG_POSTMOVE: - ImplHandleMoveMsg( hWnd ); - bDef = FALSE; - break; - - case WM_SIZE: - if ( ImplSalYieldMutexTryToAcquire() ) - { - ImplHandleSizeMsg( hWnd, nMP2 ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTSIZE, nMP1, nMP2 ); - break; - case SAL_MSG_POSTSIZE: - ImplHandleSizeMsg( hWnd, nMP2 ); - break; - case WM_MINMAXFRAME: - if ( ImplSalYieldMutexTryToAcquire() ) - { - PSWP pswp = (PSWP) nMP1; - ImplHandleSizeMsg( hWnd, MPFROM2SHORT( pswp->cx, pswp->cy) ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTSIZE, 0, nMP2 ); - break; - - case WM_CALCVALIDRECTS: - return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); - - case WM_SETFOCUS: - if ( ImplSalYieldMutexTryToAcquire() ) - { - ImplHandleFocusMsg( pFrame, nMP2 ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SAL_MSG_POSTFOCUS, 0, nMP2 ); - break; - case SAL_MSG_POSTFOCUS: - ImplHandleFocusMsg( pFrame, nMP2 ); - break; - - case WM_TRANSLATEACCEL: - { - // Da uns OS/2 zu viele Tasten abfaegnt, unternehmen wir etwas, - // damit wir Shift+F1, Shift+F10 und Shift+Enter bekommen - PQMSG pMsg = (PQMSG)nMP1; - USHORT nKeyFlags = SHORT1FROMMP( pMsg->mp1 ); - USHORT nKeyCode = (UCHAR)SHORT2FROMMP( pMsg->mp2 ); - - if ( !(nKeyFlags & KC_KEYUP) && (nKeyFlags & KC_VIRTUALKEY) && - (nKeyFlags & KC_SHIFT) && (nKeyCode != VK_ESC) ) - return (MRESULT)FALSE; - - if ( nKeyCode == VK_F1 ) - return (MRESULT)FALSE; - } - break; - - case WM_CREATE: - { - HWND hWndFrame = WinQueryWindow(hWnd, QW_PARENT); - if (hWndFrame == 0) - debug_printf(" WARNING NULL FRAME!!\n"); - SalData* pSalData = GetSalData(); - // Window-Instanz am Windowhandle speichern - pFrame = pSalData->mpCreateFrame; - pSalData->mpCreateFrame = NULL; - SetWindowPtr( hWnd, pFrame ); - SetWindowPtr( hWndFrame, pFrame); - // HWND schon hier setzen, da schon auf den Instanzdaten - // gearbeitet werden kann, wenn Messages waehrend - // CreateWindow() gesendet werden - pFrame->mhWndClient = hWnd; - pFrame->mhWndFrame = hWndFrame; - pFrame->maSysData.hWnd = hWnd; - } - break; - - case WM_CLOSE: - ImplHandleCloseMsg( hWnd ); - bDef = FALSE; - break; - - case WM_SYSVALUECHANGED: - if ( pFrame->mbFullScreen ) - ImplSalFrameFullScreenPos( pFrame ); - // kein break, da der Rest auch noch verarbeitet werden soll - case PL_ALTERED: - case WM_SYSCOLORCHANGE: - ImplSalYieldMutexAcquire(); - pFrame->CallCallback( SALEVENT_SETTINGSCHANGED, 0 ); - ImplSalYieldMutexRelease(); - break; - - case SAL_MSG_USEREVENT: - ImplHandleUserEvent( hWnd, nMP2 ); - bDef = FALSE; - break; - case SAL_MSG_TOTOP: - ImplSalToTop( hWnd, (ULONG)nMP1 ); - bDef = FALSE; - break; - case SAL_MSG_SHOW: - ImplSalShow( hWnd, (ULONG)nMP1, (ULONG)nMP2 ); - bDef = FALSE; - break; - - case WM_KBDLAYERCHANGED: - debug_printf("hWnd 0x%08x WM_KBDLAYERCHANGED\n", hWnd); - ImplHandleInputLangChange( hWnd ); - break; - - case WM_HSCROLL: - case WM_VSCROLL: - ImplHandleWheelMsg( hWnd, nMsg, nMP1, nMP2 ); - bDef = FALSE; - break; - - case WM_COMMAND: - case SAL_MSG_SYSPROCESSMENU: - if ( SalImplHandleProcessMenu( pFrame, nMsg, nMP1, nMP2 ) ) - { - bDef = FALSE; - nRet = (MRESULT)1; - } - break; - -#ifdef ENABLE_IME - case WM_IMEREQUEST: - if ( (ULONG)nMP1 == IMR_CONVRESULT ) - { - if ( pFrame->mbHandleIME ) - { - // Nur im Conversionmodus akzeptieren wir den IME-Input - if ( pFrame->mbConversionMode ) - { - ImplSalYieldMutexAcquire(); - if ( ImplHandleIMEConversion( pFrame, nMP2 ) ) - { - bDef = FALSE; - nRet = (MRESULT)TRUE; - } - ImplSalYieldMutexRelease(); - } - } - } - else if ( (ULONG)nMP1 == IMR_CANDIDATE ) - { - if ( pFrame->mbHandleIME ) - { - ImplSalYieldMutexAcquire(); - if ( (ULONG)nMP2 & IMR_CANDIDATE_SHOW ) - ImplHandleIMEOpenCandidate( pFrame ); - else if ( (ULONG)nMP2 & IMR_CANDIDATE_HIDE ) - ImplHandleIMECloseCandidate( pFrame ); - ImplSalYieldMutexRelease(); - } - } - break; - - case WM_IMENOTIFY: - if ( (ULONG)nMP1 == IMN_STARTCONVERSION ) - { - ImplSalYieldMutexAcquire(); - if ( ImplHandleIMEStartConversion( pFrame ) ) - { - bDef = FALSE; - nRet = (MRESULT)TRUE; - } - ImplSalYieldMutexRelease(); - } - else if ( (ULONG)nMP1 == IMN_ENDCONVERSION ) - { - if ( pFrame->mbHandleIME ) - { - ImplSalYieldMutexAcquire(); - if ( ImplHandleIMEEndConversion( pFrame ) ) - { - bDef = FALSE; - nRet = (MRESULT)TRUE; - } - ImplSalYieldMutexRelease(); - } - } - break; -#endif - } - - if( bCheckTimers ) - { - SalData* pSalData = GetSalData(); - if( pSalData->mnNextTimerTime ) - { - ULONG nCurTime; - DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, (PVOID)&nCurTime, sizeof(ULONG)); - if( pSalData->mnNextTimerTime < nCurTime ) - { - QMSG aMsg; - if (!WinPeekMsg( pFrame->mhAB, &aMsg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE ) ) - WinPostMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, (MPARAM)nCurTime ); - } - } - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - - return nRet; -} - -// ----------------------------------------------------------------------- - -void Os2SalFrame::ResetClipRegion() -{ -} - -void Os2SalFrame::BeginSetClipRegion( ULONG ) -{ -} - -void Os2SalFrame::UnionClipRegion( long, long, long, long ) -{ -} - -void Os2SalFrame::EndSetClipRegion() -{ -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - MRESULT mReturn = 0L; - - // ticket#124 min size of 132 px is too much - if (nMsg == WM_QUERYTRACKINFO) { - PTRACKINFO pti; - // first, let PM initialize TRACKINFO - mReturn = aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); - // now change default min size - pti = (PTRACKINFO) nMP2; - pti->ptlMinTrackSize.x = 64L; - // now return to PM - return mReturn; - } - - return aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); -} - -// ----------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/os2/source/window/salobj.cxx b/vcl/os2/source/window/salobj.cxx deleted file mode 100644 index 5c1e9ed03358..000000000000 --- a/vcl/os2/source/window/salobj.cxx +++ /dev/null @@ -1,559 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <svpm.h> - -#define _SV_SALOBJ_CXX -#include <saldata.hxx> -#include <salinst.h> -#include <salframe.h> -#include <salobj.h> - -// ======================================================================= - -static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild ) -{ - if ( hWndParent == hWndChild ) - return TRUE; - - HWND hTempWnd = WinQueryWindow( hWndChild, QW_PARENT ); - while ( hTempWnd ) - { - if ( hTempWnd == hWndParent ) - return TRUE; - hTempWnd = WinQueryWindow( hTempWnd, QW_PARENT ); - } - - return FALSE; -} - -// ----------------------------------------------------------------------- - -static Os2SalObject* ImplFindOs2SalObject( HWND hWndChild ) -{ - SalData* pSalData = GetSalData(); - Os2SalObject* pObject = pSalData->mpFirstObject; - while ( pObject ) - { - if ( ImplIsSysWindowOrChild( pObject->mhWndChild, hWndChild ) ) - return pObject; - - pObject = pObject->mpNextObject; - } - - return NULL; -} - -// ======================================================================= - -BOOL EXPENTRY SalSysMsgProc( HAB /* hAB */, QMSG* pMsg, ULONG /* fs */ ) -{ - if ( (pMsg->msg == WM_BUTTON1DOWN) || - (pMsg->msg == WM_BUTTON2DOWN) || - (pMsg->msg == WM_BUTTON3DOWN) ) - { - SalData* pSalData = GetSalData(); - Os2SalObject* pObject = ImplFindOs2SalObject( pMsg->hwnd ); - if ( pObject ) - WinPostMsg( pObject->mhWnd, SALOBJ_MSG_TOTOP, 0, 0 ); - } - - // Focus fangen wir hier nicht ab, da wir erstmal davon ausgehen, - // das unser Os2SalObject-Fenster immer eine WM_FOCUSCHANGE-Message - // bekommt. - - return FALSE; -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalSysObjWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - Os2SalObject* pSysObj; - MRESULT nRet = 0; - int bDef = TRUE; - -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "SalSysObjWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); -#endif - - switch( nMsg ) - { - case WM_ERASEBACKGROUND: - nRet = (MRESULT)FALSE; - bDef = FALSE; - break; - case WM_PAINT: - { - HPS hPS; - RECTL aRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); - WinEndPaint( hPS ); - bDef = FALSE; - } - bDef = FALSE; - break; - - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: - case SALOBJ_MSG_TOTOP: - if ( ImplSalYieldMutexTryToAcquire() ) - { - pSysObj = GetSalObjWindowPtr( hWnd ); - pSysObj->mpProc( pSysObj->mpInst, pSysObj, - SALOBJ_EVENT_TOTOP, 0 ); - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); - break; - - case WM_FOCUSCHANGE: - case SALOBJ_MSG_POSTFOCUS: - if ( ImplSalYieldMutexTryToAcquire() ) - { - pSysObj = GetSalObjWindowPtr( hWnd ); - if ( SHORT1FROMMP( nMP2 ) ) - { - pSysObj->mhLastFocusWnd = WinQueryFocus( HWND_DESKTOP ); - pSysObj->mpProc( pSysObj->mpInst, pSysObj, - SALOBJ_EVENT_GETFOCUS, 0 ); - } - else - { - HWND hWndFocus = HWNDFROMMP( nMP1 ); - if ( !hWndFocus || !ImplIsSysWindowOrChild( hWnd, hWndFocus ) ) - { - pSysObj->mpProc( pSysObj->mpInst, pSysObj, - SALOBJ_EVENT_LOSEFOCUS, 0 ); - } - } - ImplSalYieldMutexRelease(); - } - else - WinPostMsg( hWnd, SALOBJ_MSG_POSTFOCUS, nMP1, nMP2 ); - break; - - case WM_SIZE: - { - pSysObj = GetSalObjWindowPtr( hWnd ); - pSysObj->mnHeight = (short)SHORT2FROMMP( nMP2 ); - WinSetWindowPos( pSysObj->mhWndChild, 0, - 0, 0, - (short)SHORT1FROMMP( nMP2 ), (short)SHORT2FROMMP( nMP2 ), - SWP_SIZE | SWP_MOVE ); - bDef = FALSE; - } - break; - - case WM_CREATE: - { - // Window-Instanz am Windowhandle speichern - CREATESTRUCT* pStruct = (CREATESTRUCT*)nMP2; - pSysObj = (Os2SalObject*)pStruct->pPresParams; - SetSalObjWindowPtr( hWnd, pSysObj ); - bDef = FALSE; - } - break; - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - return nRet; -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalSysObjChildWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - MRESULT nRet = 0; - int bDef = TRUE; - - debug_printf( "SalSysObjChildWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); - - switch( nMsg ) - { - case WM_ERASEBACKGROUND: - break; - case WM_PAINT: - { - HPS hPS; - RECTL aRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); - WinEndPaint( hPS ); - bDef = FALSE; - } - break; - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - return nRet; -} - -// ----------------------------------------------------------------------- - -MRESULT EXPENTRY SalSysObjClipWndProc( HWND hWnd, ULONG nMsg, - MPARAM nMP1, MPARAM nMP2 ) -{ - MRESULT nRet = 0; - int bDef = TRUE; - - debug_printf( "SalSysObjClipWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); - - switch( nMsg ) - { - case WM_MOUSEMOVE: - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: - case WM_BUTTON1DBLCLK: - case WM_BUTTON2DBLCLK: - case WM_BUTTON3DBLCLK: - case WM_BUTTON1UP: - case WM_BUTTON2UP: - case WM_BUTTON3UP: - { - // Alle Events an den Frame weiterreichen, da diese Bereiche - // dem Frame gehoeren. Dazu muessen die Mouse-Koordinaaten - // entsprechend umgerechnet werden - HWND hWndParent = WinQueryWindow( hWnd, QW_PARENT ); // ergibt SysChild-Fenster - hWndParent = WinQueryWindow( hWndParent, QW_PARENT ); - short nX = (short)SHORT1FROMMP( nMP1 ); - short nY = (short)SHORT2FROMMP( nMP1 ); - POINTL aPos; - aPos.x = nX; - aPos.y = nY; - WinMapWindowPoints( hWnd, hWndParent, &aPos, 1 ); - nMP1 = MPFROM2SHORT( (short)aPos.x, (short)aPos.y ); - bDef = FALSE; - nRet = WinSendMsg( hWndParent, nMsg, nMP1, nMP2 ); - } - break; - - case WM_HITTEST: - // Damit im disablten Zustand die MouseKlicks immer noch - // an den Frame geschickt werden - // Dieser Code reicht leider nicht aus, deshalb wir unter - // OS2 immer das Child-Fenster disablen, im Gegensatz - // zu Windows, wo immer der Parent disablte wird, da - // sich das Fenster evtl. anders Darstellen koennte, - // wenn es disablte wird. Da dieser Fall uns bisher - // nicht bekannt ist, ignorieren wir das. - nRet = HT_NORMAL; - bDef = FALSE; - break; - - case WM_ERASEBACKGROUND: - nRet = (MRESULT)FALSE; - bDef = FALSE; - break; - case WM_PAINT: - { - HPS hPS; - RECTL aRect; - hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); - WinEndPaint( hPS ); - bDef = FALSE; - } - break; - } - - if ( bDef ) - nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); - return nRet; -} - -// ======================================================================= - -void ImplDestroyAllClipWindows( HWND hWndLast ) -{ - if ( hWndLast == HWND_TOP ) - return; - - HWND hWndPrev; - while ( hWndLast ) - { - hWndPrev = WinQueryWindow( hWndLast, QW_PREV ); - WinDestroyWindow( hWndLast ); - hWndLast = hWndPrev; - } -} - -// ======================================================================= - -SalObject* ImplSalCreateObject( Os2SalInstance* pInst, Os2SalFrame* pParent ) -{ - SalData* pSalData = GetSalData(); - - if ( !pSalData->mbObjClassInit ) - { - if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLASSNAME, - (PFNWP)SalSysObjWndProc, CS_MOVENOTIFY, - SAL_OBJECT_WNDEXTRA ) ) - { - if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLIPCLASSNAME, - (PFNWP)SalSysObjClipWndProc, CS_HITTEST | CS_MOVENOTIFY, 0 ) ) - { - if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CHILDCLASSNAME, - (PFNWP)SalSysObjChildWndProc, CS_HITTEST | CS_MOVENOTIFY, 32 ) ) - pSalData->mbObjClassInit = TRUE; - } - } - } - - if ( pSalData->mbObjClassInit ) - { - Os2SalObject* pObject = new Os2SalObject; - HWND hWnd = WinCreateWindow( pParent->mhWndClient, SAL_OBJECT_CLASSNAME, "", - 0, - 0, 0, 0, 0, - pParent->mhWndClient, HWND_TOP, - 0, NULL, (void*)pObject ); - HWND hWndChild = WinCreateWindow( hWnd, SAL_OBJECT_CHILDCLASSNAME, "", - WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, - 0, 0, 0, 0, - hWnd, HWND_TOP, - 0, NULL, NULL ); - - if ( !hWndChild ) - { - if ( hWnd ) - WinDestroyWindow( hWnd ); - delete pObject; - return NULL; - } - - if ( hWnd ) - { - debug_printf("ImplSalCreateObject hWndChild %x\n", hWndChild); - debug_printf("ImplSalCreateObject hWnd %x\n", hWnd); - pObject->mhWnd = hWnd; - pObject->mhWndChild = hWndChild; - pObject->maSysData.hWnd = hWndChild; - return pObject; - } - } - - return NULL; -} - -// ======================================================================= - -long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* ) -{ - return 0; -} - -// ======================================================================= - -Os2SalObject::Os2SalObject() -{ - SalData* pSalData = GetSalData(); - - mhLastClipWnd = HWND_TOP; - - mhWnd = 0; - mhWndChild = 0; - mhLastFocusWnd = 0; - maSysData.nSize = sizeof( SystemEnvData ); - mnHeight = 0; - mpInst = NULL; - mpProc = ImplSalObjCallbackDummy; - - // Hook installieren, wenn es das erste Os2SalObject ist - if ( !pSalData->mpFirstObject ) - { - WinSetHook( pSalData->mhAB, pSalData->mhMQ, - HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 ); - } - - // Insert object in objectlist - mpNextObject = pSalData->mpFirstObject; - pSalData->mpFirstObject = this; -} - -// ----------------------------------------------------------------------- - -Os2SalObject::~Os2SalObject() -{ - SalData* pSalData = GetSalData(); - - // remove frame from framelist - if ( this == pSalData->mpFirstObject ) - { - pSalData->mpFirstObject = mpNextObject; - - // Wenn letztes Os2SalObject, dann Hook wieder entfernen - if ( !pSalData->mpFirstObject ) - { - WinReleaseHook( pSalData->mhAB, pSalData->mhMQ, - HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 ); - } - } - else - { - Os2SalObject* pTempObject = pSalData->mpFirstObject; - while ( pTempObject->mpNextObject != this ) - pTempObject = pTempObject->mpNextObject; - - pTempObject->mpNextObject = mpNextObject; - } - - // Cache-Daten zerstoeren - ImplDestroyAllClipWindows( mhLastClipWnd ); - - if ( mhWndChild ) - WinDestroyWindow( mhWndChild ); - if ( mhWnd ) - WinDestroyWindow( mhWnd ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::ResetClipRegion() -{ - ImplDestroyAllClipWindows( mhLastClipWnd ); - mhLastClipWnd = HWND_TOP; -} - -// ----------------------------------------------------------------------- - -USHORT Os2SalObject::GetClipRegionType() -{ - return SAL_OBJECT_CLIP_EXCLUDERECTS; -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::BeginSetClipRegion( ULONG nRectCount ) -{ - mhOldLastClipWnd = mhLastClipWnd; -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - HWND hClipWnd = WinCreateWindow( mhWnd, SAL_OBJECT_CLIPCLASSNAME, "", - WS_VISIBLE, - nX, mnHeight-(nY+nHeight), nWidth, nHeight, - mhWnd, mhLastClipWnd, - 0, NULL, NULL ); - debug_printf("Os2SalObject::UnionClipRegion hClipWnd %x\n", hClipWnd); - mhLastClipWnd = hClipWnd; -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::EndSetClipRegion() -{ - ImplDestroyAllClipWindows( mhOldLastClipWnd ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) -{ - ULONG nStyle = 0; - BOOL bVisible = WinIsWindowVisible( mhWnd ); - if ( bVisible ) - { - WinShowWindow( mhWnd, FALSE ); - nStyle |= SWP_SHOW; - } - SWP aParentSWP; - WinQueryWindowPos( WinQueryWindow( mhWnd, QW_PARENT ), &aParentSWP ); - WinSetWindowPos( mhWnd, 0, nX, aParentSWP.cy-(nY+nHeight), nWidth, nHeight, - SWP_MOVE | SWP_SIZE | nStyle ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::Show( BOOL bVisible ) -{ - WinShowWindow( mhWnd, bVisible ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::Enable( BOOL bEnable ) -{ - // Im Gegensatz zu Windows disablen wir das Childfenster, - // da ansonsten unser Clippen nicht mehr funktioniert, da - // wir keine Events mehr bekommen. Dadurch kann sich evtl. - // das Fenster anders darstellen, was wir eigentlich nicht - // wollen. Aber da uns bisher kein Fall bekannt ist, - // ignorieren wir dies. Ansonsten muss ein Fenster dazwischen - // gezogen werden oder getestet werden, wie wir die - // Maustransparenz erreichen, wenn mhWnd - // disablte wird. - WinEnableWindow( mhWndChild, bEnable ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::GrabFocus() -{ - if ( mhLastFocusWnd && - WinIsWindow( GetSalData()->mhAB, mhLastFocusWnd ) && - ImplIsSysWindowOrChild( mhWndChild, mhLastFocusWnd ) ) - WinSetFocus( HWND_DESKTOP, mhLastFocusWnd ); - else - WinSetFocus( HWND_DESKTOP, mhWndChild ); -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::SetBackground() -{ -} - -// ----------------------------------------------------------------------- - -void Os2SalObject::SetBackground( SalColor nSalColor ) -{ -} - -// ----------------------------------------------------------------------- - -const SystemChildData* Os2SalObject::GetSystemData() const -{ - return &maSysData; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -// ----------------------------------------------------------------------- - -void Os2SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) -{ -} - diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 44207ff15e12..0d5befed1e78 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -1,3 +1,4 @@ ..\inc\vcl\fontcapabilities.hxx %_DEST%\inc%_EXT%\vcl\fontcapabilities.hxx +..\inc\vcl\scopedbitmapaccess.hxx %_DEST%\inc%_EXT%\vcl\scopedbitmapaccess.hxx ..\inc\vcl\solarmutex.hxx %_DEST%\inc%_EXT%\vcl\solarmutex.hxx diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 64cdeab7b61f..9ffb8bc373da 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -533,6 +533,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : mnUseImagesInMenus = rData.mnUseImagesInMenus; mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus; mnSkipDisabledInMenus = rData.mnSkipDisabledInMenus; + mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems; mnAcceleratorsInContextMenus = rData.mnAcceleratorsInContextMenus; mnToolbarIconSize = rData.mnToolbarIconSize; mnSymbolsStyle = rData.mnSymbolsStyle; @@ -547,7 +548,7 @@ void ImplStyleData::SetStandardStyles() Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); aStdFont.SetCharSet( gsl_getSystemTextEncoding() ); aStdFont.SetWeight( WEIGHT_NORMAL ); - aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); + aStdFont.SetName( utl::DefaultFontConfiguration::get().getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); maAppFont = aStdFont; maHelpFont = aStdFont; maMenuFont = aStdFont; @@ -622,6 +623,7 @@ void ImplStyleData::SetStandardStyles() mnUseFlatMenues = 0; mbPreferredUseImagesInMenus = sal_True; mnSkipDisabledInMenus = (sal_uInt16)sal_False; + mbHideDisabledMenuItems = sal_False; mnAcceleratorsInContextMenus = sal_True; Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR ); @@ -751,6 +753,21 @@ void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ) } } +void StyleSettings::SetCheckedColorSpecialCase( ) +{ + CopyData(); + // Light gray checked color special case + if ( GetFaceColor() == COL_LIGHTGRAY ) + mpData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC ); + else + { + sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetRed() + (sal_uInt16)mpData->maLightColor.GetRed())/2); + sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetGreen() + (sal_uInt16)mpData->maLightColor.GetGreen())/2); + sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetBlue() + (sal_uInt16)mpData->maLightColor.GetBlue())/2); + mpData->maCheckedColor = Color( nRed, nGreen, nBlue ); + } +} + // ----------------------------------------------------------------------- sal_uLong StyleSettings::GetCurrentSymbolsStyle() const @@ -1083,6 +1100,7 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->mnUseImagesInMenus == rSet.mpData->mnUseImagesInMenus) && (mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) && (mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) && + (mpData->mbHideDisabledMenuItems == rSet.mpData->mbHideDisabledMenuItems) && (mpData->mnAcceleratorsInContextMenus == rSet.mpData->mnAcceleratorsInContextMenus) && (mpData->maFontColor == rSet.mpData->maFontColor )) return sal_True; diff --git a/vcl/source/app/solarmutex.cxx b/vcl/source/app/solarmutex.cxx index 6423a74e6c61..ab07911fca32 100644 --- a/vcl/source/app/solarmutex.cxx +++ b/vcl/source/app/solarmutex.cxx @@ -54,4 +54,4 @@ void SolarMutexObject::release() osl_releaseMutex( m_solarMutex ); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index 57508219d8de..096321e05cfe 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -75,7 +75,7 @@ static VCLRegServiceInfo aVCLComponentsArray[] = {"dtransX11", sal_True}, #endif #endif -#if defined(WNT) || defined(OS2) +#if defined(WNT) {"sysdtrans", sal_False}, #endif {"dtrans", sal_False}, @@ -175,7 +175,7 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte OUString aLibName; -#if defined( WNT) || defined(OS2) +#if defined( WNT) aLibName = OUString::createFromAscii( pModName ); if ( bSUPD ) { diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 665448c4f3c9..e36cdaf9a0df 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2095,9 +2095,6 @@ void Edit::Command( const CommandEvent& rCEvt ) if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) { PopupMenu* pPopup = Edit::CreatePopupMenu(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED ) - pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES ); if ( !maSelection.Len() ) { @@ -2935,6 +2932,10 @@ PopupMenu* Edit::CreatePopupMenu() PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) ); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + if ( rStyleSettings.GetHideDisabledMenuItems() ) + pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES ); + else + pPopup->SetMenuFlags ( MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ); if ( rStyleSettings.GetAcceleratorsInContextMenus() ) { pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) ); diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index a6cd7b980620..77a1650bcdd1 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -127,26 +127,24 @@ ImplEntryList::~ImplEntryList() void ImplEntryList::Clear() { mnImages = 0; - for ( sal_uInt16 n = GetEntryCount(); n; ) - { - ImplEntryType* pImplEntry = GetEntry( --n ); - delete pImplEntry; - } - List::Clear(); + maEntries.clear(); } // ----------------------------------------------------------------------- void ImplEntryList::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect ) { - ImplEntryType* pImplEntry = GetEntry( nPos ); - if ( pImplEntry && - ( pImplEntry->mbIsSelected != bSelect ) && - ( (pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0 ) ) + if (nPos < maEntries.size()) { - pImplEntry->mbIsSelected = bSelect; - if ( mbCallSelectionChangedHdl ) - maSelectionChangedHdl.Call( (void*)sal_IntPtr(nPos) ); + boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+nPos; + + if ( ( iter->mbIsSelected != bSelect ) && + ( (iter->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0 ) ) + { + iter->mbIsSelected = bSelect; + if ( mbCallSelectionChangedHdl ) + maSelectionChangedHdl.Call( (void*)sal_IntPtr(nPos) ); + } } } @@ -180,9 +178,20 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry if ( !!pNewEntry->maImage ) mnImages++; - if ( !bSort || !Count() ) + sal_uInt16 insPos = 0; + + if ( !bSort || maEntries.empty()) { - Insert( pNewEntry, nPos ); + if (nPos < maEntries.size()) + { + insPos = nPos; + maEntries.insert( maEntries.begin() + nPos, pNewEntry ); + } + else + { + insPos = maEntries.size(); + maEntries.push_back(pNewEntry); + } } else { @@ -191,7 +200,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry const XubString& rStr = pNewEntry->maStr; sal_uLong nLow, nHigh, nMid; - nHigh = Count(); + nHigh = maEntries.size(); ImplEntryType* pTemp = GetEntry( (sal_uInt16)(nHigh-1) ); @@ -204,7 +213,8 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry // Schnelles Einfuegen bei sortierten Daten if ( eComp != COMPARE_LESS ) { - Insert( pNewEntry, LIST_APPEND ); + insPos = maEntries.size(); + maEntries.push_back(pNewEntry); } else { @@ -214,7 +224,8 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); if ( eComp != COMPARE_GREATER ) { - Insert( pNewEntry, (sal_uLong)0 ); + insPos = 0; + maEntries.insert(maEntries.begin(),pNewEntry); } else { @@ -223,7 +234,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry do { nMid = (nLow + nHigh) / 2; - pTemp = (ImplEntryType*)GetObject( nMid ); + pTemp = (ImplEntryType*)GetEntry( nMid ); eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr); @@ -242,7 +253,8 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry if ( eComp != COMPARE_LESS ) nMid++; - Insert( pNewEntry, nMid ); + insPos = nMid; + maEntries.insert(maEntries.begin()+nMid,pNewEntry); } } } @@ -252,25 +264,27 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry // garbage you wouldn't insert it. If the exception occurred because the // Collator implementation is garbage then give the user a chance to see // his stuff - Insert( pNewEntry, (sal_uLong)0 ); + insPos = 0; + maEntries.insert(maEntries.begin(),pNewEntry); } } - return (sal_uInt16)GetPos( pNewEntry ); + return insPos; } // ----------------------------------------------------------------------- void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) { - ImplEntryType* pImplEntry = (ImplEntryType*)List::Remove( nPos ); - if ( pImplEntry ) + boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+ nPos; + + if (iter != maEntries.end()) { - if ( !!pImplEntry->maImage ) + if ( !!iter->maImage ) mnImages--; - delete pImplEntry; + maEntries.erase(iter); } } @@ -278,11 +292,10 @@ void ImplEntryList::RemoveEntry( sal_uInt16 nPos ) sal_uInt16 ImplEntryList::FindEntry( const XubString& rString, sal_Bool bSearchMRUArea ) const { - sal_uInt16 nEntries = GetEntryCount(); + sal_uInt16 nEntries = maEntries.size(); for ( sal_uInt16 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) { - ImplEntryType* pImplEntry = GetEntry( n ); - String aComp( vcl::I18nHelper::filterFormattingChars( pImplEntry->maStr ) ); + String aComp( vcl::I18nHelper::filterFormattingChars( maEntries[n].maStr ) ); if ( aComp == rString ) return n; } @@ -388,7 +401,7 @@ XubString ImplEntryList::GetEntryText( sal_uInt16 nPos ) const sal_Bool ImplEntryList::HasEntryImage( sal_uInt16 nPos ) const { sal_Bool bImage = sal_False; - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) bImage = !!pImplEntry->maImage; return bImage; @@ -399,7 +412,7 @@ sal_Bool ImplEntryList::HasEntryImage( sal_uInt16 nPos ) const Image ImplEntryList::GetEntryImage( sal_uInt16 nPos ) const { Image aImage; - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) aImage = pImplEntry->maImage; return aImage; @@ -409,7 +422,7 @@ Image ImplEntryList::GetEntryImage( sal_uInt16 nPos ) const void ImplEntryList::SetEntryData( sal_uInt16 nPos, void* pNewData ) { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) pImplEntry->mpUserData = pNewData; } @@ -418,7 +431,7 @@ void ImplEntryList::SetEntryData( sal_uInt16 nPos, void* pNewData ) void* ImplEntryList::GetEntryData( sal_uInt16 nPos ) const { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); return pImplEntry ? pImplEntry->mpUserData : NULL; } @@ -426,7 +439,7 @@ void* ImplEntryList::GetEntryData( sal_uInt16 nPos ) const void ImplEntryList::SetEntryFlags( sal_uInt16 nPos, long nFlags ) { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); if ( pImplEntry ) pImplEntry->mnFlags = nFlags; } @@ -435,7 +448,7 @@ void ImplEntryList::SetEntryFlags( sal_uInt16 nPos, long nFlags ) long ImplEntryList::GetEntryFlags( sal_uInt16 nPos ) const { - ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos ); + ImplEntryType* pImplEntry = GetEntry( nPos ); return pImplEntry ? pImplEntry->mnFlags : 0; } diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 4e3f8ceb0cf2..44ac9414534f 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1515,7 +1515,7 @@ static void allocTrueTypeFont( TrueTypeFont** ttf ) /* forward declariotn for the two entry points to use*/ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ); -#if !defined(WIN32) && !defined(OS2) +#if !defined(WIN32) int OpenTTFontFile( const char* fname, sal_uInt32 facenum, TrueTypeFont** ttf ) { int ret, fd = -1; @@ -1777,7 +1777,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t ) void CloseTTFont(TrueTypeFont *ttf) /*FOLD01*/ { -#if !defined(WIN32) && !defined(OS2) +#if !defined(WIN32) if( ttf->fname ) munmap((char *) ttf->ptr, ttf->fsize); #endif diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index 7a785b9bf99f..4356636e90a2 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -399,16 +399,19 @@ int StreamToFile(TrueTypeCreator *_this, const char* fname) FILE* fd; if ((r = StreamToMemory(_this, &ptr, &length)) != SF_OK) return r; - if (!fname) return SF_BADFILE; - if ((fd = fopen(fname, "wb")) == NULL) return SF_BADFILE; - - if (fwrite(ptr, 1, length, fd) != length) { - r = SF_FILEIO; - } else { - r = SF_OK; + if (fname && (fd = fopen(fname, "wb")) != NULL) + { + if (fwrite(ptr, 1, length, fd) != length) { + r = SF_FILEIO; + } else { + r = SF_OK; + } + fclose(fd); + } + else + { + r = SF_BADFILE; } - - fclose(fd); free(ptr); return r; } diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 2d9fbef36e44..21f977a45396 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -562,7 +562,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.SetPrefSize( aPrefSz ); rMtf.SetPrefMapMode( aMapMode ); - sal_uInt32 nLastPolygonAction(0); + size_t nLastPolygonAction(0); for( sal_Int32 i = 0L; i < nActions; i++ ) { @@ -631,7 +631,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon); // now check if it can be set somewhere - if(nLastPolygonAction < rMtf.GetActionCount()) + if(nLastPolygonAction < rMtf.GetActionSize()) { MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction)); @@ -779,7 +779,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_POLYLINE_ACTION ): { ImplReadPoly( rIStm, aActionPoly ); - nLastPolygonAction = rMtf.GetActionCount(); + nLastPolygonAction = rMtf.GetActionSize(); if( bFatLine ) rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); @@ -802,7 +802,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } else { - nLastPolygonAction = rMtf.GetActionCount(); + nLastPolygonAction = rMtf.GetActionSize(); rMtf.AddAction( new MetaPolygonAction( aActionPoly ) ); } } @@ -826,7 +826,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } else { - nLastPolygonAction = rMtf.GetActionCount(); + nLastPolygonAction = rMtf.GetActionSize(); rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) ); } } @@ -1425,7 +1425,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rtl_TextEncoding& rActualCharSet ) { sal_uLong nCount = 0; - for( sal_uLong i = 0, nActionCount = rMtf.GetActionCount(); i < nActionCount; i++ ) + for( size_t i = 0, nActionCount = rMtf.GetActionSize(); i < nActionCount; i++ ) { const MetaAction* pAction = rMtf.GetAction( i ); diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 9102f693c025..8ed39ea10fed 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -171,7 +171,7 @@ void Impl_Font::AskConfig() mbConfigLookup = true; // prepare the FontSubst configuration lookup - const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get(); + const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get(); String aShortName; String aFamilyName; @@ -184,11 +184,11 @@ void Impl_Font::AskConfig() aShortName, aFamilyName, eWeight, eWidthType, nType ); // lookup the font name in the configuration - const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); + const utl::FontNameAttr* pFontAttr = rFontSubst.getSubstInfo( aMapName ); // if the direct lookup failed try again with an alias name if ( !pFontAttr && (aShortName != aMapName) ) - pFontAttr = pFontSubst->getSubstInfo( aShortName ); + pFontAttr = rFontSubst.getSubstInfo( aShortName ); if( pFontAttr ) { diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 93496bd2c2de..984386028cdc 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -153,52 +153,95 @@ struct ImpLabel // - LabelList - // ------------- -class ImpLabelList : private List +typedef ::std::vector< ImpLabel* > ImpLabelVector; + +class ImpLabelList { +private: + ImpLabelVector aList; + size_t nListPos; + public: - ImpLabelList() : List( 8, 4, 4 ) {} - ImpLabelList( const ImpLabelList& rList ); - ~ImpLabelList(); - - void ImplInsert( ImpLabel* p ) { Insert( p, LIST_APPEND ); } - ImpLabel* ImplRemove( sal_uLong nPos ) { return (ImpLabel*) Remove( nPos ); } - void ImplReplace( ImpLabel* p ) { Replace( (void*)p ); } - ImpLabel* ImplFirst() { return (ImpLabel*) First(); } - ImpLabel* ImplNext() { return (ImpLabel*) Next(); } - ImpLabel* ImplGetLabel( sal_uLong nPos ) const { return (ImpLabel*) GetObject( nPos ); } - sal_uLong ImplGetLabelPos( const String& rLabelName ); - sal_uLong ImplCount() const { return Count(); } + ImpLabelList() {} + ImpLabelList( const ImpLabelList& rList ); + ~ImpLabelList(); + + void ImplInsert( ImpLabel* p ) { aList.push_back( p ); } + + ImpLabel* ImplFirst(); + ImpLabel* ImplNext(); + ImpLabel* ImplGetLabel( size_t nPos ) const; + ImpLabel* ImplRemove( size_t nPos ); + + size_t ImplGetLabelPos( const String& rLabelName ); + size_t ImplCount() const { return aList.size(); } }; // ------------------------------------------------------------------------ -ImpLabelList::ImpLabelList( const ImpLabelList& rList ) : - List( rList ) +ImpLabelList::ImpLabelList( const ImpLabelList& rList ) { - for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) - ImplReplace( new ImpLabel( *pLabel ) ); + for( size_t i = 0, n = rList.ImplCount(); i < n; ++i ) + aList.push_back( new ImpLabel( *rList.ImplGetLabel( i ) ) ); + nListPos = 0; } // ------------------------------------------------------------------------ ImpLabelList::~ImpLabelList() { - for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) - delete pLabel; + for( size_t i = 0, n = aList.size(); i < n; ++i ) + delete aList[ i ]; + aList.clear(); } // ------------------------------------------------------------------------ +ImpLabel* ImpLabelList::ImplFirst() +{ + nListPos = 0; + return ( aList.empty() ) ? NULL : aList[ nListPos ]; +} -sal_uLong ImpLabelList::ImplGetLabelPos( const String& rLabelName ) +// ------------------------------------------------------------------------ +ImpLabel* ImpLabelList::ImplNext() { - sal_uLong nLabelPos = METAFILE_LABEL_NOTFOUND; + return ( nListPos + 1 < aList.size() ) ? aList[ ++nListPos ] : NULL; +} - for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() ) +// ------------------------------------------------------------------------ + +ImpLabel* ImpLabelList::ImplGetLabel( size_t nPos ) const +{ + return ( nPos < aList.size() ) ? aList[ nPos ] : NULL; +} + +// ------------------------------------------------------------------------ + +ImpLabel* ImpLabelList::ImplRemove( size_t nPos ) +{ + ImpLabel* return_value = NULL; + if ( nPos < aList.size() ) { - if ( rLabelName == pLabel->aLabelName ) + ImpLabelVector::iterator it = aList.begin(); + ::std::advance( it, nPos ); + return_value = *it; + aList.erase( it ); + } + return return_value; +} + +// ------------------------------------------------------------------------ + +size_t ImpLabelList::ImplGetLabelPos( const String& rLabelName ) +{ + size_t nLabelPos = METAFILE_LABEL_NOTFOUND; + + for ( size_t i = 0, n = aList.size(); i < n; ++i ) + { + if ( rLabelName == aList[ i ]->aLabelName ) { - nLabelPos = GetCurPos(); + nLabelPos = i; break; } } @@ -211,7 +254,6 @@ sal_uLong ImpLabelList::ImplGetLabelPos( const String& rLabelName ) // --------------- GDIMetaFile::GDIMetaFile() : - List ( 0x3EFF, 64, 64 ), aPrefSize ( 1, 1 ), pPrev ( NULL ), pNext ( NULL ), @@ -226,7 +268,6 @@ GDIMetaFile::GDIMetaFile() : // ------------------------------------------------------------------------ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : - List ( rMtf ), aPrefMapMode ( rMtf.aPrefMapMode ), aPrefSize ( rMtf.aPrefSize ), aHookHdlLink ( rMtf.aHookHdlLink ), @@ -238,8 +279,11 @@ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) : bUseCanvas ( rMtf.bUseCanvas ) { // RefCount der MetaActions erhoehen - for( void* pAct = First(); pAct; pAct = Next() ) - ( (MetaAction*) pAct )->Duplicate(); + for( size_t i = 0, n = rMtf.GetActionSize(); i < n; ++i ) + { + rMtf.GetAction( i )->Duplicate(); + aList.push_back( rMtf.GetAction( i ) ); + } if( rMtf.pLabelList ) pLabelList = new ImpLabelList( *rMtf.pLabelList ); @@ -264,17 +308,62 @@ GDIMetaFile::~GDIMetaFile() // ------------------------------------------------------------------------ +size_t GDIMetaFile::GetActionSize() const +{ + return aList.size(); +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::GetAction( size_t nAction ) const +{ + return (nAction < aList.size()) ? aList[ nAction ] : NULL; +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::FirstAction() +{ + nCurrentActionElement = 0; + return aList.empty() ? NULL : aList[ 0 ]; +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::NextAction() +{ + return ( nCurrentActionElement + 1 < aList.size() ) ? aList[ ++nCurrentActionElement ] : NULL; +} + +// ------------------------------------------------------------------------ + +MetaAction* GDIMetaFile::ReplaceAction( MetaAction* pAction, size_t nAction ) +{ + if ( nAction < aList.size() ) + { + ::std::vector< MetaAction* >::iterator it = aList.begin(); + ::std::advance( it, nAction ); + (*it)->Delete(); + *it = pAction; + } + return pAction; +} + + +// ------------------------------------------------------------------------ + GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) { if( this != &rMtf ) { Clear(); - List::operator=( rMtf ); - // RefCount der MetaActions erhoehen - for( void* pAct = First(); pAct; pAct = Next() ) - ( (MetaAction*) pAct )->Duplicate(); + for( size_t i = 0, n = rMtf.GetActionSize(); i < n; ++i ) + { + rMtf.GetAction( i )->Duplicate(); + aList.push_back( rMtf.GetAction( i ) ); + } if( rMtf.pLabelList ) pLabelList = new ImpLabelList( *rMtf.pLabelList ); @@ -307,20 +396,20 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf ) sal_Bool GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const { - const sal_uLong nObjCount = Count(); + const size_t nObjCount = aList.size(); sal_Bool bRet = sal_False; if( this == &rMtf ) bRet = sal_True; - else if( rMtf.GetActionCount() == nObjCount && - rMtf.GetPrefSize() == aPrefSize && + else if( rMtf.GetActionSize() == nObjCount && + rMtf.GetPrefSize() == aPrefSize && rMtf.GetPrefMapMode() == aPrefMapMode ) { bRet = sal_True; - for( sal_uLong n = 0UL; n < nObjCount; n++ ) + for( size_t n = 0; n < nObjCount; n++ ) { - if( GetObject( n ) != rMtf.GetObject( n ) ) + if( aList[ n ] != rMtf.GetAction( n ) ) { bRet = sal_False; break; @@ -335,20 +424,20 @@ sal_Bool GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const sal_Bool GDIMetaFile::IsEqual( const GDIMetaFile& rMtf ) const { - const sal_uLong nObjCount = Count(); + const size_t nObjCount = aList.size(); sal_Bool bRet = sal_False; if( this == &rMtf ) bRet = sal_True; - else if( rMtf.GetActionCount() == nObjCount && - rMtf.GetPrefSize() == aPrefSize && + else if( rMtf.GetActionSize() == nObjCount && + rMtf.GetPrefSize() == aPrefSize && rMtf.GetPrefMapMode() == aPrefMapMode ) { bRet = sal_True; - for( sal_uLong n = 0UL; n < nObjCount; n++ ) + for( size_t n = 0; n < nObjCount; n++ ) { - if(!((MetaAction*)GetObject( n ))->IsEqual(*((MetaAction*)rMtf.GetObject( n )))) + if( !aList[ n ]->IsEqual( *(rMtf.GetAction( n )) ) ) { bRet = sal_False; break; @@ -366,10 +455,9 @@ void GDIMetaFile::Clear() if( bRecord ) Stop(); - for( void* pAct = First(); pAct; pAct = Next() ) - ( (MetaAction*) pAct )->Delete(); - - List::Clear(); + for( size_t i = 0, n = aList.size(); i < n; ++i ) + aList[ i ]->Delete(); + aList.clear(); delete pLabelList; pLabelList = NULL; @@ -424,7 +512,7 @@ void GDIMetaFile::Record( OutputDevice* pOut ) if( bRecord ) Stop(); - Last(); + nCurrentActionElement = aList.empty() ? 0 : (aList.size() - 1); pOutDev = pOut; bRecord = sal_True; Linker( pOut, sal_True ); @@ -432,19 +520,19 @@ void GDIMetaFile::Record( OutputDevice* pOut ) // ------------------------------------------------------------------------ -void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) +void GDIMetaFile::Play( GDIMetaFile& rMtf, size_t nPos ) { if ( !bRecord && !rMtf.bRecord ) { MetaAction* pAction = GetCurAction(); - const sal_uLong nObjCount = Count(); + const size_t nObjCount = aList.size(); rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas ); if( nPos > nObjCount ) nPos = nObjCount; - for( sal_uLong nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) + for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ ) { if( !Hook() ) { @@ -452,20 +540,21 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) rMtf.AddAction( pAction ); } - pAction = (MetaAction*) Next(); + pAction = NextAction(); } } } // ------------------------------------------------------------------------ -void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) +void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos ) { if( !bRecord ) { MetaAction* pAction = GetCurAction(); - const sal_uLong nObjCount = Count(); - sal_uLong i = 0, nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff; + const size_t nObjCount = aList.size(); + size_t i = 0; + size_t nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff; if( nPos > nObjCount ) nPos = nObjCount; @@ -478,7 +567,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) pOut->SetLayoutMode( 0 ); pOut->SetDigitLanguage( 0 ); - for( sal_uLong nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ ) + for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ ) { if( !Hook() ) { @@ -498,7 +587,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos ) ( (Window*) pOut )->Flush(), i = 0; } - pAction = (MetaAction*) Next(); + pAction = NextAction(); } pOut->Pop(); @@ -656,7 +745,7 @@ void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, // ------------------------------------------------------------------------ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos, - const Size& rSize, sal_uLong nPos ) + const Size& rSize, size_t nPos ) { Region aDrawClipRegion; MapMode aDrawMap( GetPrefMapMode() ); @@ -760,7 +849,7 @@ void GDIMetaFile::Stop() void GDIMetaFile::WindStart() { if( !bRecord ) - First(); + nCurrentActionElement = 0; } // ------------------------------------------------------------------------ @@ -768,15 +857,15 @@ void GDIMetaFile::WindStart() void GDIMetaFile::WindEnd() { if( !bRecord ) - Last(); + nCurrentActionElement = aList.empty() ? 0 : (aList.size() - 1); } // ------------------------------------------------------------------------ -void GDIMetaFile::Wind( sal_uLong nActionPos ) +void GDIMetaFile::Wind( size_t nActionPos ) { if( !bRecord ) - Seek( nActionPos ); + nCurrentActionElement = nActionPos < aList.size() ? nActionPos : nCurrentActionElement; } // ------------------------------------------------------------------------ @@ -784,7 +873,8 @@ void GDIMetaFile::Wind( sal_uLong nActionPos ) void GDIMetaFile::WindPrev() { if( !bRecord ) - Prev(); + if ( nCurrentActionElement > 0 ) + --nCurrentActionElement; } // ------------------------------------------------------------------------ @@ -792,14 +882,15 @@ void GDIMetaFile::WindPrev() void GDIMetaFile::WindNext() { if( !bRecord ) - Next(); + if ( nCurrentActionElement + 1 < aList.size() ) + ++nCurrentActionElement; } // ------------------------------------------------------------------------ void GDIMetaFile::AddAction( MetaAction* pAction ) { - Insert( pAction, LIST_APPEND ); + aList.push_back( pAction ); if( pPrev ) { @@ -810,9 +901,18 @@ void GDIMetaFile::AddAction( MetaAction* pAction ) // ------------------------------------------------------------------------ -void GDIMetaFile::AddAction( MetaAction* pAction, sal_uLong nPos ) +void GDIMetaFile::AddAction( MetaAction* pAction, size_t nPos ) { - Insert( pAction, nPos ); + if ( nPos < aList.size() ) + { + ::std::vector< MetaAction* >::iterator it = aList.begin(); + ::std::advance( it, nPos ); + aList.insert( it, pAction ); + } + else + { + aList.push_back( pAction ); + } if( pPrev ) { @@ -823,10 +923,24 @@ void GDIMetaFile::AddAction( MetaAction* pAction, sal_uLong nPos ) // ------------------------------------------------------------------------ +void GDIMetaFile::push_back( MetaAction* pAction ) +{ + aList.push_back( pAction ); +} + +// ------------------------------------------------------------------------ + // @since #110496# -void GDIMetaFile::RemoveAction( sal_uLong nPos ) +void GDIMetaFile::RemoveAction( size_t nPos ) { - Remove( nPos ); + if ( nPos < aList.size() ) + { + ::std::vector< MetaAction* >::iterator it = aList.begin(); + ::std::advance( it, nPos ); + (*it)->Delete(); + aList.erase( it ); + + } if( pPrev ) pPrev->RemoveAction( nPos ); @@ -834,14 +948,14 @@ void GDIMetaFile::RemoveAction( sal_uLong nPos ) // ------------------------------------------------------------------------ -MetaAction* GDIMetaFile::CopyAction( sal_uLong nPos ) const +MetaAction* GDIMetaFile::CopyAction( size_t nPos ) const { - return ( (MetaAction*) GetObject( nPos ) )->Clone(); + return ( nPos < aList.size() ) ? aList[ nPos ]->Clone() : NULL; } // ------------------------------------------------------------------------ -sal_uLong GDIMetaFile::GetActionPos( const String& rLabel ) +size_t GDIMetaFile::GetActionPos( const String& rLabel ) { ImpLabel* pLabel = NULL; @@ -855,7 +969,7 @@ sal_uLong GDIMetaFile::GetActionPos( const String& rLabel ) // ------------------------------------------------------------------------ -sal_Bool GDIMetaFile::InsertLabel( const String& rLabel, sal_uLong nActionPos ) +sal_Bool GDIMetaFile::InsertLabel( const String& rLabel, size_t nActionPos ) { sal_Bool bRet = sal_False; @@ -899,14 +1013,14 @@ void GDIMetaFile::RenameLabel( const String& rLabel, const String& rNewLabel ) // ------------------------------------------------------------------------ -sal_uLong GDIMetaFile::GetLabelCount() const +size_t GDIMetaFile::GetLabelCount() const { return( pLabelList ? pLabelList->ImplCount() : 0UL ); } // ------------------------------------------------------------------------ -String GDIMetaFile::GetLabel( sal_uLong nLabel ) +String GDIMetaFile::GetLabel( size_t nLabel ) { String aString; @@ -1000,14 +1114,14 @@ void GDIMetaFile::Move( long nX, long nY ) aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { const long nType = pAct->GetType(); MetaAction* pModAct; if( pAct->GetRefCount() > 1 ) { - Replace( pModAct = pAct->Clone(), GetCurPos() ); + aList[ nCurrentActionElement ] = pModAct = pAct->Clone(); pAct->Delete(); } else @@ -1035,14 +1149,14 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) aMapVDev.SetReferenceDevice( nDPIX, nDPIY ); aMapVDev.SetMapMode( GetPrefMapMode() ); - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { const long nType = pAct->GetType(); MetaAction* pModAct; if( pAct->GetRefCount() > 1 ) { - Replace( pModAct = pAct->Clone(), GetCurPos() ); + aList[ nCurrentActionElement ] = pModAct = pAct->Clone(); pAct->Delete(); } else @@ -1072,13 +1186,13 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) void GDIMetaFile::Scale( double fScaleX, double fScaleY ) { - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { MetaAction* pModAct; if( pAct->GetRefCount() > 1 ) { - Replace( pModAct = pAct->Clone(), GetCurPos() ); + aList[ nCurrentActionElement ] = pModAct = pAct->Clone(); pAct->Delete(); } else @@ -1108,7 +1222,7 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) aMapVDev.EnableOutput( sal_False ); aMapVDev.SetMapMode( GetPrefMapMode() ); - for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { const long nType = pAct->GetType(); @@ -1126,7 +1240,7 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) if( pOldAct->IsClipping() ) aNewReg.Intersect( pOldAct->GetRegion() ); MetaClipRegionAction* pNewAct = new MetaClipRegionAction( aNewReg, sal_True ); - Replace( pNewAct, GetCurPos() ); + aList[ nCurrentActionElement ] = pNewAct; pOldAct->Delete(); } } @@ -1187,10 +1301,10 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf, aVDev.DrawGradient( rPolyPoly, rGrad ); aGradMtf.Stop(); - int i, nAct( aGradMtf.GetActionCount() ); - for( i=0; i<nAct; ++i ) + size_t i, nAct( aGradMtf.GetActionSize() ); + for( i=0; i < nAct; ++i ) { - MetaAction* pMetaAct = aGradMtf.GetAction(i); + MetaAction* pMetaAct = aGradMtf.GetAction( i ); pMetaAct->Duplicate(); rMtf.AddAction( pMetaAct ); } @@ -1226,7 +1340,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) Point aRotAnchor( aOrigin ); Size aRotOffset( aOffset ); - for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() ) { const sal_uInt16 nActionType = pAction->GetType(); @@ -1440,7 +1554,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) if( pCommentAct->GetComment().Equals( "XGRAD_SEQ_BEGIN" ) ) { int nBeginComments( 1 ); - pAction = (MetaAction*) Next(); + pAction = NextAction(); // skip everything, except gradientex action while( pAction ) @@ -1475,7 +1589,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) } - pAction = (MetaAction*) Next(); + pAction =NextAction(); } } else @@ -1699,7 +1813,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference ) Rectangle aBound; - for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() ) { const sal_uInt16 nActionType = pAction->GetType(); @@ -2226,7 +2340,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aMtf.aPrefSize = aPrefSize; aMtf.aPrefMapMode = aPrefMapMode; - for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() ) + for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() ) { const sal_uInt16 nType = pAction->GetType(); @@ -2235,7 +2349,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol case( META_PIXEL_ACTION ): { MetaPixelAction* pAct = (MetaPixelAction*) pAction; - aMtf.Insert( new MetaPixelAction( pAct->GetPoint(), pFncCol( pAct->GetColor(), pColParam ) ), LIST_APPEND ); + aMtf.push_back( new MetaPixelAction( pAct->GetPoint(), pFncCol( pAct->GetColor(), pColParam ) ) ); } break; @@ -2248,7 +2362,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaLineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2261,14 +2375,14 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaFillColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; case( META_TEXTCOLOR_ACTION ): { MetaTextColorAction* pAct = (MetaTextColorAction*) pAction; - aMtf.Insert( new MetaTextColorAction( pFncCol( pAct->GetColor(), pColParam ) ), LIST_APPEND ); + aMtf.push_back( new MetaTextColorAction( pFncCol( pAct->GetColor(), pColParam ) ) ); } break; @@ -2281,7 +2395,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaTextFillColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2294,7 +2408,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaTextLineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2307,7 +2421,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol else pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), sal_True ); - aMtf.Insert( pAct, LIST_APPEND ); + aMtf.push_back( pAct ); } break; @@ -2318,7 +2432,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aFont.SetColor( pFncCol( aFont.GetColor(), pColParam ) ); aFont.SetFillColor( pFncCol( aFont.GetFillColor(), pColParam ) ); - aMtf.Insert( new MetaFontAction( aFont ), LIST_APPEND ); + aMtf.push_back( new MetaFontAction( aFont ) ); } break; @@ -2342,7 +2456,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aWall.SetGradient( aGradient ); } - aMtf.Insert( new MetaWallpaperAction( rRect, aWall ), LIST_APPEND ); + aMtf.push_back( new MetaWallpaperAction( rRect, aWall ) ); } break; @@ -2357,59 +2471,58 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol case( META_BMPSCALE_ACTION ): { MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction; - aMtf.Insert( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), - pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), + pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ) ); } break; case( META_BMPSCALEPART_ACTION ): { MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction; - aMtf.Insert( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), - pAct->GetSrcPoint(), pAct->GetSrcSize(), - pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), + pAct->GetSrcPoint(), pAct->GetSrcSize(), + pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ) + ); } break; case( META_BMPEXSCALE_ACTION ): { MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction; - aMtf.Insert( new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), - pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), + pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ) + ); } break; case( META_BMPEXSCALEPART_ACTION ): { MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction; - aMtf.Insert( new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), - pAct->GetSrcPoint(), pAct->GetSrcSize(), - pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), + pAct->GetSrcPoint(), pAct->GetSrcSize(), + pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ) + ); } break; case( META_MASKSCALE_ACTION ): { MetaMaskScaleAction* pAct = (MetaMaskScaleAction*) pAction; - aMtf.Insert( new MetaMaskScaleAction( pAct->GetPoint(), pAct->GetSize(), - pAct->GetBitmap(), - pFncCol( pAct->GetColor(), pColParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaMaskScaleAction( pAct->GetPoint(), pAct->GetSize(), + pAct->GetBitmap(), + pFncCol( pAct->GetColor(), pColParam ) ) + ); } break; case( META_MASKSCALEPART_ACTION ): { MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction; - aMtf.Insert( new MetaMaskScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), - pAct->GetSrcPoint(), pAct->GetSrcSize(), - pAct->GetBitmap(), - pFncCol( pAct->GetColor(), pColParam ) ), - LIST_APPEND ); + aMtf.push_back( new MetaMaskScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), + pAct->GetSrcPoint(), pAct->GetSrcSize(), + pAct->GetBitmap(), + pFncCol( pAct->GetColor(), pColParam ) ) + ); } break; @@ -2420,7 +2533,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) ); aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) ); - aMtf.Insert( new MetaGradientAction( pAct->GetRect(), aGradient ), LIST_APPEND ); + aMtf.push_back( new MetaGradientAction( pAct->GetRect(), aGradient ) ); } break; @@ -2431,7 +2544,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) ); aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) ); - aMtf.Insert( new MetaGradientExAction( pAct->GetPolyPolygon(), aGradient ), LIST_APPEND ); + aMtf.push_back( new MetaGradientExAction( pAct->GetPolyPolygon(), aGradient ) ); } break; @@ -2441,7 +2554,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol Hatch aHatch( pAct->GetHatch() ); aHatch.SetColor( pFncCol( aHatch.GetColor(), pColParam ) ); - aMtf.Insert( new MetaHatchAction( pAct->GetPolyPolygon(), aHatch ), LIST_APPEND ); + aMtf.push_back( new MetaHatchAction( pAct->GetPolyPolygon(), aHatch ) ); } break; @@ -2451,10 +2564,10 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() ); aTransMtf.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam ); - aMtf.Insert( new MetaFloatTransparentAction( aTransMtf, - pAct->GetPoint(), pAct->GetSize(), - pAct->GetGradient() ), - LIST_APPEND ); + aMtf.push_back( new MetaFloatTransparentAction( aTransMtf, + pAct->GetPoint(), pAct->GetSize(), + pAct->GetGradient() ) + ); } break; @@ -2464,9 +2577,9 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol GDIMetaFile aSubst( pAct->GetSubstitute() ); aSubst.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam ); - aMtf.Insert( new MetaEPSAction( pAct->GetPoint(), pAct->GetSize(), - pAct->GetLink(), aSubst ), - LIST_APPEND ); + aMtf.push_back( new MetaEPSAction( pAct->GetPoint(), pAct->GetSize(), + pAct->GetLink(), aSubst ) + ); } break; @@ -2475,14 +2588,14 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol OSL_TRACE( "ExchangeColors not supported for RenderGraphic MetaActions yet" ); pAction->Duplicate(); - aMtf.Insert( pAction, LIST_APPEND ); + aMtf.push_back( pAction ); } break; default: { pAction->Duplicate(); - aMtf.Insert( pAction, LIST_APPEND ); + aMtf.push_back( pAction ); } break; } @@ -2670,8 +2783,7 @@ sal_uLong GDIMetaFile::GetChecksum() const sal_uLong nCrc = 0; aWriteData.meActualCharSet = aMemStm.GetStreamCharSet(); - - for( sal_uLong i = 0, nObjCount = GetActionCount(); i < nObjCount; i++ ) + for( size_t i = 0, nObjCount = GetActionSize(); i < nObjCount; i++ ) { MetaAction* pAction = GetAction( i ); @@ -2970,7 +3082,7 @@ sal_uLong GDIMetaFile::GetSizeBytes() const { sal_uLong nSizeBytes = 0; - for( sal_uLong i = 0, nObjCount = GetActionCount(); i < nObjCount; ++i ) + for( size_t i = 0, nObjCount = GetActionSize(); i < nObjCount; ++i ) { MetaAction* pAction = GetAction( i ); @@ -3210,7 +3322,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm, GDIMetaFileWriteFlags nWriteFlags // additional RenderGraphic replacement actions, if the // GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC is set // and META_RENDERGRAPHIC_ACTION are encountered (KA 01/2011) - for( MetaAction* pAct = static_cast< MetaAction* >( First() ); pAct; pAct = static_cast< MetaAction* >( Next() ) ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { nActionCount += ( bRenderGraphicReplacements && ( META_RENDERGRAPHIC_ACTION == pAct->GetType() ) ? 2 : 1 ); } @@ -3235,7 +3347,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm, GDIMetaFileWriteFlags nWriteFlags aWriteData.meActualCharSet = rOStm.GetStreamCharSet(); aWriteData.mnWriteFlags = nWriteFlags; - for( MetaAction* pAct = static_cast< MetaAction* >( First() ); pAct; pAct = static_cast< MetaAction* >( Next() ) ) + for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { pAct->Write( rOStm, &aWriteData ); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 84e962bd2f6e..9d995f361329 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -486,7 +486,7 @@ sal_Bool ImpGraphic::ImplIsAnimated() const sal_Bool ImpGraphic::ImplIsEPS() const { return( ( meType == GRAPHIC_GDIMETAFILE ) && - ( maMetaFile.GetActionCount() > 0 ) && + ( maMetaFile.GetActionSize() > 0 ) && ( maMetaFile.GetAction( 0 )->GetType() == META_EPS_ACTION ) ); } @@ -495,7 +495,7 @@ sal_Bool ImpGraphic::ImplIsEPS() const sal_Bool ImpGraphic::ImplIsRenderGraphic() const { return( ( GRAPHIC_GDIMETAFILE == meType ) && - ( 1 == maMetaFile.GetActionCount() ) && + ( 1 == maMetaFile.GetActionSize() ) && ( META_RENDERGRAPHIC_ACTION == maMetaFile.GetAction( 0 )->GetType() ) ); } diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 21c0cbb0abd4..19dc306ca4d6 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -820,7 +820,7 @@ sal_Bool ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rM delete[] (sal_uInt8*) pColorSet; - if( rMtf.GetActionCount() ) + if( rMtf.GetActionSize() ) { MapMode aMap( MAP_100TH_MM ); VirtualDevice aVDev; diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index 4d87c06471ee..ecba7a97880b 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -63,6 +63,7 @@ OldStylePrintAdaptor::OldStylePrintAdaptor( const boost::shared_ptr< Printer >& OldStylePrintAdaptor::~OldStylePrintAdaptor() { + delete mpData; } void OldStylePrintAdaptor::StartPage() diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 6bbaec8e43f5..3e5e05904e57 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -995,7 +995,7 @@ void OutputDevice::ImplInitClipRegion() && GetOutDevType() != OUTDEV_PRINTER ); if( bClipDeviceBounds ) { - // #b6520266# Perform actual rect clip against outdev + // Perform actual rect clip against outdev // dimensions, to generate empty clips whenever one of the // values is completely off the device. Rectangle aDeviceBounds( mnOutOffX, mnOutOffY, diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index f5b493b7db4f..31ef2c5a8250 100755 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -90,8 +90,6 @@ #if defined UNX #define GLYPH_FONT_HEIGHT 128 -#elif defined OS2 -#define GLYPH_FONT_HEIGHT 176 #else #define GLYPH_FONT_HEIGHT 256 #endif @@ -520,7 +518,7 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, MsLangId::convertLanguageToLocale( eLang, aLocale ); } - utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get(); + utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get(); String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback String aDefault = rDefaults.getDefaultFont( aLocale, nType ); if( aDefault.Len() ) @@ -1673,7 +1671,7 @@ void ImplDevFontList::InitMatchData() const mbMatchData = true; // calculate MatchData for all entries - const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get(); + const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get(); DevFontList::const_iterator it = maDevFontList.begin(); for(; it != maDevFontList.end(); ++it ) @@ -1689,7 +1687,7 @@ void ImplDevFontList::InitMatchData() const ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const { // get the default font for a specified locale - const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get(); const String aDefault = rDefaults.getUserInterfaceFont( rLocale ); ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault ); if( pFontData ) @@ -2065,7 +2063,7 @@ ImplDevFontListData* ImplDevFontList::FindDefaultFont() const { // try to find one of the default fonts of the // UNICODE, SANSSERIF, SERIF or FIXED default font lists - const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + const DefaultFontConfiguration& rDefaults = DefaultFontConfiguration::get(); com::sun::star::lang::Locale aLocale( OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), OUString(), OUString() ); String aFontname = rDefaults.getDefaultFont( aLocale, DEFAULTFONT_SANS_UNICODE ); ImplDevFontListData* pFoundData = ImplFindByTokenNames( aFontname ); @@ -2599,7 +2597,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, { // get fallback info using FontSubstConfiguration and // the target name, it's shortened name and family name in that order - const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get(); + const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get(); pFontAttr = rFontSubst.getSubstInfo( aSearchName ); if ( !pFontAttr && (aSearchShortName != aSearchName) ) pFontAttr = rFontSubst.getSubstInfo( aSearchShortName ); @@ -2619,7 +2617,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, if( rFSD.IsSymbolFont() ) { com::sun::star::lang::Locale aDefaultLocale( OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), OUString(), OUString() ); - aSearchName = DefaultFontConfiguration::get()->getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL ); + aSearchName = DefaultFontConfiguration::get().getDefaultFont( aDefaultLocale, DEFAULTFONT_SYMBOL ); ImplDevFontListData* pFoundData = ImplFindByTokenNames( aSearchName ); if( pFoundData ) return pFoundData; @@ -2655,7 +2653,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, // get fallback info using FontSubstConfiguration and // the target name, it's shortened name and family name in that order - const FontSubstConfiguration& rFontSubst = *FontSubstConfiguration::get(); + const FontSubstConfiguration& rFontSubst = FontSubstConfiguration::get(); const FontNameAttr* pTempFontAttr = rFontSubst.getSubstInfo( aSearchName ); if ( !pTempFontAttr && (aTempShortName != aSearchName) ) pTempFontAttr = rFontSubst.getSubstInfo( aTempShortName ); @@ -6140,7 +6138,7 @@ void OutputDevice::forceFallbackFontToFit(SalLayout &rFallback, ImplFontEntry &r if (fScale < 1) { long nOrigHeight = rFontSelData.mnHeight; - rFontSelData.mnHeight *= fScale; + rFontSelData.mnHeight = static_cast<int>(static_cast<float>(rFontSelData.mnHeight) * fScale); rFallbackFont.mnSetFontFlags = mpGraphics->SetFont( &rFontSelData, nFallbackLevel ); rFontSelData.mnHeight = nOrigHeight; } diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index 2bdc4f84fb7b..52500a53e24f 100644 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -237,7 +237,7 @@ sal_Bool OutputDevice::DrawNativeControl( ControlType nType, if ( mbInitClipRegion ) ImplInitClipRegion(); - if ( mbOutputClipped || rControlRegion.IsEmpty() ) + if ( mbOutputClipped ) return sal_True; if ( mbInitLineColor ) diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index dd69e74d80fb..a7e138361200 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -1863,9 +1863,9 @@ Region OutputDevice::PixelToLogic( const Region& rDeviceRegion, #define ENTER3( eUnitSource, eUnitDest ) \ long nNumerator = 1; \ long nDenominator = 1; \ - DBG_ASSERT( eUnitSource < MAP_LASTENUMDUMMY, "Invalid source map unit"); \ - DBG_ASSERT( eUnitDest < MAP_LASTENUMDUMMY, "Invalid destination map unit"); \ - if( (eUnitSource < MAP_LASTENUMDUMMY) && (eUnitDest < MAP_LASTENUMDUMMY) ) \ + DBG_ASSERT( eUnitSource <= MAP_PIXEL, "nonpermitted source map unit"); \ + DBG_ASSERT( eUnitDest <= MAP_PIXEL, "nonpermitted destination map unit"); \ + if( (eUnitSource <= MAP_PIXEL) && (eUnitDest <= MAP_PIXEL) ) \ { \ nNumerator = aImplNumeratorAry[eUnitSource] * \ aImplDenominatorAry[eUnitDest]; \ diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 2736e321ea80..868163d5ded8 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -327,7 +327,7 @@ void PageSyncData::PushAction( const OutputDevice& rOutDev, const PDFExtOutDevDa PDFExtOutDevDataSync aSync; aSync.eAct = eAct; if ( pMtf ) - aSync.nIdx = pMtf->GetActionCount(); + aSync.nIdx = pMtf->GetActionSize(); else aSync.nIdx = 0x7fffffff; // sync not possible mActions.push_back( aSync ); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 244620bdafd5..481ad2be3aa4 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -430,7 +430,6 @@ sal_Int32 PDFWriter::CreateNamedDest( const rtl::OUString& sDestName, const Rect { return ((PDFWriterImpl*)pImplementation)->createNamedDest( sDestName, rRect, nPageNr, eType ); } -//<--- sal_Int32 PDFWriter::CreateDest( const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType ) { return ((PDFWriterImpl*)pImplementation)->createDest( rRect, nPageNr, eType ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 8bab1abf6d47..91aec0e83ba5 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3370,9 +3370,9 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont throw FontException(); // nLength3 is the rest of the file - excluding any section headers - // nIndex now points to the first of the 512 '0' characters marking the + // nIndex now points before the first of the 512 '0' characters marking the // fixed content portion - sal_Int32 nLength3 = nFontLen - nIndex; + sal_Int32 nLength3 = nFontLen - nIndex - 1; for( it = aSections.begin(); it != aSections.end(); ++it ) { if( *it >= nIndex ) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index d6f87f83a006..8649beff6ceb 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -386,7 +386,6 @@ public: PDFWriter::DestAreaType m_eType; Rectangle m_aRect; }; -//<--- struct PDFOutlineEntry { @@ -610,7 +609,6 @@ private: destination id is always the destination's position in this vector */ std::vector<PDFNamedDest> m_aNamedDests; - //<--- /* contains all dests ever set during the PDF creation, dest id is always the dest's position in this vector */ diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index eae543b1b65d..17b684e6a675 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -268,7 +268,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa } GDIMetaFile aMtf( i_rMtf ); - for( sal_uInt32 i = 0, nCount = aMtf.GetActionCount(); i < nCount; ) + for( sal_uInt32 i = 0, nCount = aMtf.GetActionSize(); i < (sal_uInt32)nCount; ) { if ( !i_pOutDevData || !i_pOutDevData->PlaySyncPageAct( m_rOuterFace, i ) ) { diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 66e3cd1bea1a..cd47967f760e 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -404,7 +404,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) sal_uInt32 nYPixelPerMeter = ImplReadsal_uInt32(); sal_uInt8 nUnitSpecifier = *maDataIter++; - if( (nUnitSpecifier == 1) && nXPixelPerMeter && nXPixelPerMeter ) + if( (nUnitSpecifier == 1) && nXPixelPerMeter && nYPixelPerMeter ) { mbpHYs = sal_True; diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index b87457c35054..35c0e13908dd 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -186,7 +186,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWriteTransparent(); ImplWriteIDAT(); } - aBmp.ReleaseAccess( mpAccess ); + aBmp.ReleaseAccess( mpAccess ), mpAccess = 0; } else mbStatus = sal_False; @@ -207,7 +207,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWritepHYs( rBmpEx ); ImplWriteIDAT(); } - aMask.ReleaseAccess( mpMaskAccess ); + aMask.ReleaseAccess( mpMaskAccess ), mpMaskAccess = 0; } else mbStatus = sal_False; @@ -223,12 +223,12 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWritepHYs( rBmpEx ); ImplWriteIDAT(); } - aMask.ReleaseAccess( mpMaskAccess ); + aMask.ReleaseAccess( mpMaskAccess ), mpMaskAccess = 0; } else mbStatus = sal_False; } - aBmp.ReleaseAccess( mpAccess ); + aBmp.ReleaseAccess( mpAccess ), mpAccess = 0; } else mbStatus = sal_False; @@ -247,7 +247,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, ImplWriteIDAT(); } - aBmp.ReleaseAccess( mpAccess ); + aBmp.ReleaseAccess( mpAccess ), mpAccess = 0; } else mbStatus = sal_False; diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 5a23eb406bc3..add5071ef2dd 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1140,7 +1140,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // settings for all cases. // maps mtf actions to CC list entries - ::std::vector< const ConnectedComponents* > aCCList_MemberMap( rInMtf.GetActionCount() ); + ::std::vector< const ConnectedComponents* > aCCList_MemberMap( rInMtf.GetActionSize() ); // iterate over all aCCList members and their contained metaactions ConnectedComponentsList::iterator aCurr( aCCList.begin() ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 0e99923ccc0f..61a40af43bdd 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -250,7 +250,7 @@ static rtl::OUString queryFile( Printer* pPrinter ) // add arbitrary files xFilterMgr->appendFilter( String( VclResId( SV_STDTEXT_ALLFILETYPES ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) ); } - catch( lang::IllegalArgumentException rExc ) + catch( lang::IllegalArgumentException ) { DBG_ERRORFILE( "caught IllegalArgumentException when registering filter\n" ); } diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 21c82cd51f3a..1cec295bda93 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -166,7 +166,7 @@ void ImplRegionBand::ProcessPoints() while ( pRegionBandPoint ) { // within list? - if ( pRegionBandPoint && pRegionBandPoint->mpNextBandPoint ) + if ( pRegionBandPoint->mpNextBandPoint ) { // start/stop? if ( pRegionBandPoint->mbEndPoint && pRegionBandPoint->mpNextBandPoint->mbEndPoint ) diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index b92deb89a928..79bcb608fb5f 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -630,7 +630,7 @@ long FreetypeManager::AddFontDir( const String& rUrlName ) rtl_TextEncoding theEncoding = osl_getThreadTextEncoding(); while( (rcOSL = aDir.getNextItem( aDirItem, 20 )) == osl::FileBase::E_None ) { - osl::FileStatus aFileStatus( FileStatusMask_FileURL ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); rcOSL = aDirItem.getFileStatus( aFileStatus ); ::rtl::OUString aUSytemPath; @@ -2430,7 +2430,7 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) sal_uLong nRequestedLangsys = 0; //MKTAG("ZHT"); //### TODO: where to get langsys? // TODO: request more features depending on script and language system - if( aReqFeatureTagList.size() == 0) // nothing to do + if( aReqFeatureTagList.empty()) // nothing to do return true; // load GSUB table into memory @@ -2510,7 +2510,7 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) } } - if( !aFeatureIndexList.size() ) + if( aFeatureIndexList.empty() ) return true; UshortList aLookupIndexList; diff --git a/vcl/source/glyphs/gcach_layout.cxx b/vcl/source/glyphs/gcach_layout.cxx index e5624b2910c1..311654586596 100644 --- a/vcl/source/glyphs/gcach_layout.cxx +++ b/vcl/source/glyphs/gcach_layout.cxx @@ -553,7 +553,7 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr { if ( j == nRawRunGlyphCount ) { - nNewWidth = pNextPos->fX - pPos->fX; + nNewWidth = static_cast<int>(pNextPos->fX - pPos->fX); break; } @@ -566,7 +566,7 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr int nNextGlyphWidth = rNextGM.GetCharWidth(); if ( nNextGlyphWidth > 0 ) { - nNewWidth = pNextPos->fX - pPos->fX; + nNewWidth = static_cast<int>(pNextPos->fX - pPos->fX); break; } } diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 44fab8c7a3e7..46de93aaac39 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -658,7 +658,7 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr_segment * pSegment) mvCharDxs[mvCharDxs.size() - 1] = mnWidth; } } - catch (std::exception e) + catch (std::exception &e) { #ifdef GRLAYOUT_DEBUG fprintf(grLog(),"LayoutGlyphs failed %s\n", e.what()); diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index 930be4d27931..ac8e658f7bd8 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -220,8 +220,8 @@ namespace vcl sal_Int32 nHeight, const rendering::IntegerBitmapLayout& rLayout, const uno::Reference< rendering::XIntegerReadOnlyBitmap >& xInputBitmap, - ScopedBitmapWriteAccess& rWriteAcc, - ScopedBitmapWriteAccess& rAlphaAcc ) + Bitmap::ScopedWriteAccess& rWriteAcc, + Bitmap::ScopedWriteAccess& rAlphaAcc ) { rendering::IntegerBitmapLayout aCurrLayout; geometry::IntegerRectangle2D aRect; @@ -433,9 +433,8 @@ namespace vcl sal::static_int_cast<sal_uInt16>(1L << nAlphaDepth)) ); { // limit scoped access - ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), - aBitmap ); - ScopedBitmapWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL, + Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); + Bitmap::ScopedWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL, aAlpha ); ENSURE_OR_THROW(pWriteAccess.get() != NULL, diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src index 44561a89f513..c0303aac0f1f 100644 --- a/vcl/source/src/btntext.src +++ b/vcl/source/src/btntext.src @@ -66,7 +66,7 @@ String SV_BUTTONTEXT_MORE String SV_BUTTONTEXT_LESS { - Text [ en-US ] = "~More"; + Text [ en-US ] = "~Less"; }; String SV_BUTTONTEXT_IGNORE diff --git a/vcl/source/src/units.src b/vcl/source/src/units.src index 57025c9b2a2f..24023569aaeb 100644 --- a/vcl/source/src/units.src +++ b/vcl/source/src/units.src @@ -40,7 +40,7 @@ StringArray SV_FUNIT_STRINGS < "twips" ; FUNIT_TWIP ; > ; < "twip" ; FUNIT_TWIP ; > ; < "pt" ; FUNIT_POINT ; > ; - < "pi" ; FUNIT_PICA ; > ; + < "pc" ; FUNIT_PICA ; > ; < "\"" ; FUNIT_INCH ; > ; < "in" ; FUNIT_INCH ; > ; < "inch" ; FUNIT_INCH ; > ; diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index a07c0ee17b28..525c8ad5a76a 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -119,7 +119,9 @@ static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry ) do { nIndex++; - ImplAccelEntry* pTempEntry = (*pList)[ nIndex ]; + ImplAccelEntry* pTempEntry = NULL; + if ( nIndex < pList->size() ) + pTempEntry = (*pList)[ nIndex ]; if ( !pTempEntry || (pTempEntry->mnId != pEntry->mnId) ) break; } diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 26397d7adf7f..d048b3ab6fba 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -373,9 +373,9 @@ sal_Bool ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, { pData->maMouseOff = rMEvt.GetPosPixel(); pData->mnHitTest = ImplHitTest( pData, pData->maMouseOff ); - sal_uInt16 nDragFullTest = 0; if ( pData->mnHitTest ) { + sal_uInt16 nDragFullTest = 0; sal_Bool bTracking = sal_True; sal_Bool bHitTest = sal_True; diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index 6cecea6a24a7..89bfe4f2d067 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -52,7 +52,7 @@ struct ImplCursorData short mnOrientation; // Pixel-Orientation unsigned char mnDirection; // indicates writing direction sal_uInt16 mnStyle; // Cursor-Style - sal_Bool mbCurVisible; // Ist Cursor aktuell sichtbar + bool mbCurVisible; // Ist Cursor aktuell sichtbar Window* mpWindow; // Zugeordnetes Windows }; @@ -61,8 +61,8 @@ struct ImplCursorData static void ImplCursorInvert( ImplCursorData* pData ) { Window* pWindow = pData->mpWindow; - sal_Bool bMapMode = pWindow->IsMapModeEnabled(); - pWindow->EnableMapMode( sal_False ); + bool bMapMode = pWindow->IsMapModeEnabled(); + pWindow->EnableMapMode( false ); sal_uInt16 nInvertStyle; if ( pData->mnStyle & CURSOR_SHADOW ) nInvertStyle = INVERT_50; @@ -158,7 +158,7 @@ void Cursor::ImplDraw() // Ausgabeflaeche berechnen und ausgeben ImplCursorInvert( mpData ); - mpData->mbCurVisible = sal_True; + mpData->mbCurVisible = true; } } @@ -169,13 +169,11 @@ void Cursor::ImplRestore() if ( mpData && mpData->mbCurVisible ) { ImplCursorInvert( mpData ); - mpData->mbCurVisible = sal_False; + mpData->mbCurVisible = false; } } -// ----------------------------------------------------------------------- - -void Cursor::ImplShow( bool bDrawDirect, bool bRestore ) +void Cursor::ImplDoShow( bool bDrawDirect, bool bRestore ) { if ( mbVisible ) { @@ -197,7 +195,7 @@ void Cursor::ImplShow( bool bDrawDirect, bool bRestore ) if ( !mpData ) { mpData = new ImplCursorData; - mpData->mbCurVisible = sal_False; + mpData->mbCurVisible = false; mpData->maTimer.SetTimeoutHdl( LINK( this, Cursor, ImplTimerHdl ) ); } @@ -218,9 +216,7 @@ void Cursor::ImplShow( bool bDrawDirect, bool bRestore ) } } -// ----------------------------------------------------------------------- - -bool Cursor::ImplHide( bool i_bStopTimer ) +bool Cursor::ImplDoHide( bool bSuspend ) { bool bWasCurVisible = false; if ( mpData && mpData->mpWindow ) @@ -228,18 +224,35 @@ bool Cursor::ImplHide( bool i_bStopTimer ) bWasCurVisible = mpData->mbCurVisible; if ( mpData->mbCurVisible ) ImplRestore(); - } - if( mpData && i_bStopTimer ) - { - mpData->maTimer.Stop(); - mpData->mpWindow = NULL; + if ( !bSuspend ) + { + mpData->maTimer.Stop(); + mpData->mpWindow = NULL; + } } - return bWasCurVisible; } -// ----------------------------------------------------------------------- +void Cursor::ImplShow( bool bDrawDirect ) +{ + ImplDoShow( bDrawDirect, false ); +} + +void Cursor::ImplHide() +{ + ImplDoHide( false ); +} + +void Cursor::ImplResume( bool bRestore ) +{ + ImplDoShow( false, bRestore ); +} + +bool Cursor::ImplSuspend() +{ + return ImplDoHide( true ); +} void Cursor::ImplNew() { @@ -279,7 +292,7 @@ Cursor::Cursor() mnOrientation = 0; mnDirection = 0; mnStyle = 0; - mbVisible = sal_False; + mbVisible = false; } // ----------------------------------------------------------------------- @@ -327,7 +340,7 @@ void Cursor::Show() { if ( !mbVisible ) { - mbVisible = sal_True; + mbVisible = true; ImplShow(); } } @@ -338,8 +351,8 @@ void Cursor::Hide() { if ( mbVisible ) { - mbVisible = sal_False; - ImplHide( true ); + mbVisible = false; + ImplHide(); } } @@ -459,17 +472,16 @@ Cursor& Cursor::operator=( const Cursor& rCursor ) // ----------------------------------------------------------------------- -sal_Bool Cursor::operator==( const Cursor& rCursor ) const +bool Cursor::operator==( const Cursor& rCursor ) const { - if ( (maPos == rCursor.maPos) && + return + ((maPos == rCursor.maPos) && (maSize == rCursor.maSize) && (mnSlant == rCursor.mnSlant) && (mnOrientation == rCursor.mnOrientation) && (mnDirection == rCursor.mnDirection) && - (mbVisible == rCursor.mbVisible) ) - return sal_True; - else - return sal_False; + (mbVisible == rCursor.mbVisible)) + ; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dndlcon.cxx b/vcl/source/window/dndlcon.cxx index 54013a9bca03..977e8611e70a 100644 --- a/vcl/source/window/dndlcon.cxx +++ b/vcl/source/window/dndlcon.cxx @@ -194,7 +194,7 @@ sal_uInt32 DNDListenerContainer::fireDropEvent( const Reference< XDropTargetDrop } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -254,7 +254,7 @@ sal_uInt32 DNDListenerContainer::fireDragExitEvent() } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -306,7 +306,7 @@ sal_uInt32 DNDListenerContainer::fireDragOverEvent( const Reference< XDropTarget } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -374,7 +374,7 @@ sal_uInt32 DNDListenerContainer::fireDragEnterEvent( const Reference< XDropTarge } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -441,7 +441,7 @@ sal_uInt32 DNDListenerContainer::fireDropActionChangedEvent( const Reference< XD } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } @@ -503,7 +503,7 @@ sal_uInt32 DNDListenerContainer::fireDragGestureEvent( sal_Int8 dragAction, sal_ } } - catch( RuntimeException exc ) + catch( RuntimeException ) { pContainer->removeInterface( xElement ); } diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 624a42593b07..6186514d2b88 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -369,7 +369,7 @@ ImplDockingWindowWrapper* DockingManager::GetDockingWindowWrapper( const Window if( (*p)->mpDockingWindow == pWindow ) return (*p); else - p++; + ++p; } return NULL; } @@ -483,7 +483,7 @@ void DockingManager::RemoveWindow( const Window *pWindow ) break; } else - p++; + ++p; } } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index af79642516f4..d4e16ed6c121 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -103,35 +103,6 @@ DBG_NAME( Menu ) // document closer #define IID_DOCUMENTCLOSE 1 -#ifdef OS2 - -#include <xwphook.h> - -// return sal_True if hilite should be executed: left mouse button down -// or xwp mouse hook enabled -static sal_Bool ImplHilite( const MouseEvent& rMEvt ) -{ - static sal_Bool init = sal_False; - static HOOKCONFIG hc; - - // read XWP settings at program startup - if (init == sal_False) { - sal_Bool rc; - sal_uLong cb = sizeof(HOOKCONFIG); - memset(&hc, 0, sizeof(HOOKCONFIG)); - rc = PrfQueryProfileData( HINI_USER, INIAPP_XWPHOOK, INIKEY_HOOK_CONFIG, - &hc, &cb); - init = sal_True; - } - // check mouse left button - if (rMEvt.GetButtons() == MOUSE_LEFT) - return sal_True; - // return xwp flag - return hc.fSlidingMenus; -} - -#endif - static sal_Bool ImplAccelDisabled() { // display of accelerator strings may be suppressed via configuration @@ -2306,6 +2277,37 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; } +sal_Bool Menu::ImplGetNativeSubmenuArrowSize( Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const +{ + ImplControlValue aVal; + Rectangle aNativeBounds; + Rectangle aNativeContent; + Point tmp( 0, 0 ); + Rectangle aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + PART_MENU_SUBMENU_ARROW ) ) + { + if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), + ControlPart(PART_MENU_SUBMENU_ARROW), + aCtrlRegion, + ControlState(CTRL_STATE_ENABLED), + aVal, + OUString(), + aNativeBounds, + aNativeContent ) + ) + { + Size aSize( Size ( aNativeContent.GetWidth(), + aNativeContent.GetHeight() ) ); + rArrowSize = aSize; + rArrowSpacing = aNativeBounds.GetWidth() - aNativeContent.GetWidth(); + + return sal_True; + } + } + return sal_False; +} + // ----------------------------------------------------------------------- void Menu::ImplAddDel( ImplMenuDelData& rDel ) @@ -2854,21 +2856,57 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa // SubMenu? if ( !bLayout && !bIsMenuBar && pData->pSubMenu ) { - aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += ( pData->aSz.Height() / 2 ) - ( nFontHeight/4 ); - if ( pData->nBits & MIB_POPUPSELECT ) + bool bNativeOk = false; + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + PART_MENU_SUBMENU_ARROW ) ) + { + ControlState nState = 0; + Size aTmpSz( 0, 0 ); + long aSpacing = 0; + + if( !ImplGetNativeSubmenuArrowSize( pWin, + aTmpSz, aSpacing ) ) + { + aTmpSz = Size( nFontHeight, nFontHeight ); + aSpacing = nOuterSpace; + } + + if ( pData->bEnabled ) + nState |= CTRL_STATE_ENABLED; + if ( bHighlighted ) + nState |= CTRL_STATE_SELECTED; + + aTmpPos.X() = aOutSz.Width() - aTmpSz.Width() - aSpacing - nOuterSpace; + aTmpPos.Y() = aPos.Y() + ( pData->aSz.Height() - aTmpSz.Height() ) / 2; + aTmpPos.Y() += nExtra/2; + + Rectangle aItemRect( aTmpPos, aTmpSz ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect ); + bNativeOk = pWin->DrawNativeControl( CTRL_MENU_POPUP, + PART_MENU_SUBMENU_ARROW, + aItemRect, + nState, + aVal, + OUString() ); + } + if( ! bNativeOk ) { - pWin->SetTextColor( rSettings.GetMenuTextColor() ); - Point aTmpPos2( aPos ); - aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; - aDecoView.DrawFrame( - Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), FRAME_DRAW_GROUP ); + aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += nExtra/2; + aTmpPos.Y() += ( pData->aSz.Height() / 2 ) - ( nFontHeight/4 ); + if ( pData->nBits & MIB_POPUPSELECT ) + { + pWin->SetTextColor( rSettings.GetMenuTextColor() ); + Point aTmpPos2( aPos ); + aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; + aDecoView.DrawFrame( + Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), FRAME_DRAW_GROUP ); + } + aDecoView.DrawSymbol( + Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), + SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle ); } - aDecoView.DrawSymbol( - Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), - SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle ); } if ( pThisItemOnly && bHighlighted ) @@ -4499,10 +4537,6 @@ void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt ) if ( rMEvt.IsLeaveWindow() ) { -#ifdef OS2 - if ( ImplHilite(rMEvt) ) - { -#endif // #102461# do not remove highlight if a popup menu is open at this position MenuItemData* pData = pMenu ? pMenu->pItemList->GetDataFromPos( nHighlightedItem ) : NULL; // close popup with some delayed if we leave somewhere else @@ -4511,17 +4545,11 @@ void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt ) if( !pActivePopup || (pData && pData->pSubMenu != pActivePopup ) ) ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); -#ifdef OS2 - } -#endif if ( IsScrollMenu() ) ImplScroll( rMEvt.GetPosPixel() ); } else -#ifdef OS2 - if ( ImplHilite(rMEvt) ) -#endif { aSubmenuCloseTimer.Stop(); if( bIgnoreFirstMove ) @@ -5484,9 +5512,6 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt ) sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); if ( ( nEntry != ITEMPOS_INVALID ) -#ifdef OS2 - && ( ImplHilite(rMEvt) ) -#endif && ( nEntry != nHighlightedItem ) ) ChangeHighlightItem( nEntry, sal_False ); } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index a0160f78f287..36293298172c 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1079,7 +1079,6 @@ void PrintDialog::setupOptionalUI() Sequence< rtl::OUString > aHelpTexts; Sequence< rtl::OUString > aHelpIds; sal_Int64 nMinValue = 0, nMaxValue = 0; - sal_Int32 nCurHelpText = 0; rtl::OUString aGroupingHint; rtl::OUString aDependsOnName; sal_Int32 nDependsOnValue = 0; @@ -1356,6 +1355,7 @@ void PrintDialog::setupOptionalUI() } else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Radio" ) ) && pCurParent ) { + sal_Int32 nCurHelpText = 0; boost::shared_ptr<vcl::RowOrColumn> pRadioColumn( pCurColumn ); if( aText.getLength() ) { @@ -1535,7 +1535,11 @@ void PrintDialog::setupOptionalUI() } else { - OSL_FAIL( "Unsupported UI option" ); + rtl::OStringBuffer sMessage; + sMessage.append(RTL_CONSTASCII_STRINGPARAM("Unsupported UI option: \"")); + sMessage.append(rtl::OUStringToOString(aCtrlType, RTL_TEXTENCODING_UTF8)); + sMessage.append('"'); + OSL_FAIL( sMessage.getStr() ); } pCurColumn = pSaveCurColumn; diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 02be128cd8dd..9c0f4699baa8 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -99,7 +99,7 @@ struct ImplSplitSet size has not lower or upper bound. */ namespace { - long ValidateSize (const long nSize, const ImplSplitItem rItem) + long ValidateSize (const long nSize, const ImplSplitItem &rItem) { if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize) return rItem.mnMinSize; diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 9bdbfd970ed7..341d7f3bfff8 100755 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -255,9 +255,11 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava ) (void)bUseJava; #if defined WNT nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd ); + (void)bUseJava; #elif defined QUARTZ // FIXME: this is wrong nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView ); + (void)bUseJava; #elif defined UNX if( !bUseJava ) { diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 9f796269014f..24c8ded6e4b4 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -238,7 +238,7 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent ) return sal_True; } else - p++; + ++p; } // the focus is not in the list: activate first float if F6 was pressed diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 50137643a2cc..3e83a1711a24 100755 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -573,7 +573,7 @@ void ToolBox::ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegi { // just invalidate to trigger paint of the parent - const bool bOldPaintLock = pThis->mpData->mbIsPaintLocked; + const bool bOldPaintLock = pThis->mpData->mbIsPaintLocked; pThis->mpData->mbIsPaintLocked = true; // send an invalidate to the first opaque parent and invalidate the whole hierarchy from there (noclipchildren) @@ -1578,7 +1578,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) ImplGetWindowImpl()->mbToolBox = sal_True; mpBtnDev = NULL; mpFloatSizeAry = NULL; - mpData = new ImplToolBoxPrivateData; + mpData = new ImplToolBoxPrivateData; mpFloatWin = NULL; mnDX = 0; mnDY = 0; @@ -1597,7 +1597,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) mnCurItemId = 0; mnDownItemId = 0; mnCurPos = TOOLBOX_ITEM_NOTFOUND; - mnFocusPos = TOOLBOX_ITEM_NOTFOUND; // current position during keyboard access + mnFocusPos = TOOLBOX_ITEM_NOTFOUND; // current position during keyboard access mnLines = 1; mnCurLine = 1; mnCurLines = 1; @@ -1622,7 +1622,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) mbCustomizeMode = sal_False; mbDragging = sal_False; mbMenuStrings = sal_False; - mbIsShift = sal_False; + mbIsShift = sal_False; mbIsKeyEvent = sal_False; mbChangingHighlight = sal_False; meButtonType = BUTTON_SYMBOL; @@ -1630,7 +1630,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle ) meLastStyle = POINTER_ARROW; mnWinStyle = nStyle; mnLastFocusItemId = 0; - mnKeyModifier = 0; + mnKeyModifier = 0; mnActivateCount = 0; maTimer.SetTimeout( 50 ); @@ -2932,7 +2932,7 @@ IMPL_LINK( ToolBox, ImplDropdownLongClickHdl, ToolBox*, EMPTYARG ) { // no floater was opened Deactivate(); - ImplDrawItem( mnCurPos, sal_False ); + ImplDrawItem( mnCurPos, 0 ); mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; @@ -3466,7 +3466,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 h ControlState nState = 0; if ( highlight == 1 ) nState |= CTRL_STATE_PRESSED; - if ( highlight == 2 ) nState |= CTRL_STATE_ROLLOVER; + if ( highlight == 2 ) nState |= CTRL_STATE_ROLLOVER; if ( bEnabled ) nState |= CTRL_STATE_ENABLED; aControlValue.setTristateVal( bChecked ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); @@ -3480,7 +3480,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 h pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, sal_True, bIsWindow, 2, NULL, NULL ); } -void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPaint, sal_Bool bLayout ) +void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPaint, sal_Bool bLayout ) { DBG_CHKTHIS( Window, ImplDbgCheckWindow ); @@ -3498,7 +3498,8 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain MetricVector* pVector = bLayout ? &mpData->m_pLayoutData->m_aUnicodeBoundRects : NULL; String* pDisplayText = bLayout ? &mpData->m_pLayoutData->m_aDisplayText : NULL; - bHighlight = bHighlight && pItem->mbEnabled; + if(!pItem->mbEnabled) + nHighlight = 0; // Falls Rechteck ausserhalb des sichbaren Bereichs liegt if ( pItem->maRect.IsEmpty() ) @@ -3621,7 +3622,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain { nStyle |= BUTTON_DRAW_DONTKNOW; } - if ( bHighlight == 1 ) + if ( nHighlight == 1 ) { nStyle |= BUTTON_DRAW_PRESSED; } @@ -3630,7 +3631,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain { nOffX = OUTBUTTON_OFF_NORMAL_X; nOffY = OUTBUTTON_OFF_NORMAL_Y; - if ( bHighlight ) + if ( nHighlight != 0 ) { nOffX++; nOffY++; @@ -3643,7 +3644,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain { if ( (pItem->meState != STATE_NOCHECK) || !bPaint ) { - ImplErase( this, pItem->maRect, bHighlight, bHasOpenPopup ); + ImplErase( this, pItem->maRect, nHighlight != 0, bHasOpenPopup ); } } else @@ -3682,7 +3683,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain if ( bImage && ! bLayout ) { const Image* pImage; - if ( bHighlight && (!(pItem->maHighImage)) == sal_False ) + if ( (nHighlight != 0) && (!(pItem->maHighImage)) == sal_False ) pImage = &(pItem->maHighImage); else pImage = &(pItem->maImage); @@ -3716,14 +3717,14 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain nImageOffX += (nBtnWidth-aImageSize.Width())/2; nImageOffY += (nBtnHeight-aImageSize.Height())/2; } - if ( bHighlight || (pItem->meState == STATE_CHECK) ) + if ( nHighlight != 0 || (pItem->meState == STATE_CHECK) ) { if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aButtonRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); + ImplDrawButton( this, aButtonRect, nHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); - if( bHighlight ) + if( nHighlight != 0 ) { if( bHighContrastWhite ) nImageStyle |= IMAGE_DRAW_COLORTRANSFORM; @@ -3782,12 +3783,12 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain } // draw selection only if not already drawn during image output (see above) - if ( !bLayout && !bImage && (bHighlight || (pItem->meState == STATE_CHECK) ) ) + if ( !bLayout && !bImage && (nHighlight != 0 || (pItem->meState == STATE_CHECK) ) ) { if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, pItem->maRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); + ImplDrawButton( this, pItem->maRect, nHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ? sal_True : sal_False ); } sal_uInt16 nTextStyle = 0; @@ -3822,14 +3823,14 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain // dropdown only will be painted without inner border if( (pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY ) { - ImplErase( this, aDropDownRect, bHighlight, bHasOpenPopup ); + ImplErase( this, aDropDownRect, nHighlight != 0, bHasOpenPopup ); - if( bHighlight || (pItem->meState == STATE_CHECK) ) + if( nHighlight != 0 || (pItem->meState == STATE_CHECK) ) { if( bHasOpenPopup ) ImplDrawFloatwinBorder( pItem ); else - ImplDrawButton( this, aDropDownRect, bHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), sal_False ); + ImplDrawButton( this, aDropDownRect, nHighlight, pItem->meState == STATE_CHECK, pItem->mbEnabled && IsEnabled(), sal_False ); } } ImplDrawDropdownArrow( this, aDropDownRect, bSetColor, bRotate ); @@ -3940,7 +3941,7 @@ void ToolBox::ImplFloatControl( sal_Bool bStart, FloatingWindow* pFloatWindow ) mpFloatWin = pFloatWindow; // redraw item, to trigger drawing of a special border - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); mbDrag = sal_False; EndTracking(); @@ -4021,7 +4022,7 @@ sal_Bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat { if ( !mnCurItemId ) { - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); mnCurItemId = pItem->mnId; Highlight(); } @@ -4160,17 +4161,17 @@ sal_Bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCa // Items nicht geloescht, im Select-Handler if ( mnCurItemId ) { - sal_Bool bHighlight; + sal_uInt16 nHighlight; if ( (mnCurItemId == mnHighItemId) && (mnOutStyle & TOOLBOX_STYLE_FLAT) ) - bHighlight = 2; + nHighlight = 2; else - bHighlight = sal_False; + nHighlight = 0; // Get current pos for the case that items are inserted/removed // in the toolBox mnCurPos = GetItemPos( mnCurItemId ); if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) { - ImplDrawItem( mnCurPos, bHighlight ); + ImplDrawItem( mnCurPos, nHighlight ); Flush(); } } @@ -4289,7 +4290,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND ) { mnCurItemId = mnHighItemId = it->mnId; - ImplDrawItem( mnCurPos, 2 /*sal_True*/ ); // always use shadow effect (2) + ImplDrawItem( mnCurPos, 2 ); // always use shadow effect (2) } else mnCurItemId = mnHighItemId = 0; @@ -4419,7 +4420,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt ) sal_uInt16 nClearPos = GetItemPos( mnHighItemId ); if ( nClearPos != TOOLBOX_ITEM_NOTFOUND ) { - ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? sal_True : sal_False ); + ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? 1 : 0 ); if( nClearPos != mnCurPos ) ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nClearPos ) ); } @@ -4531,7 +4532,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbSelection ) { - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); Highlight(); } else @@ -4548,7 +4549,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbDrag ) { - ImplDrawItem( mnCurPos, sal_True ); + ImplDrawItem( mnCurPos, 1 ); Highlight(); } @@ -4569,7 +4570,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) { // no floater was opened Deactivate(); - ImplDrawItem( mnCurPos, sal_False ); + ImplDrawItem( mnCurPos, 0 ); mnCurPos = TOOLBOX_ITEM_NOTFOUND; mnCurItemId = 0; @@ -4763,12 +4764,12 @@ void ToolBox::Paint( const Rectangle& rPaintRect ) // Nur malen, wenn Rechteck im PaintRectangle liegt if ( !pItem->maRect.IsEmpty() && rPaintRect.IsOver( pItem->maRect ) ) { - sal_Bool bHighlight = sal_False; + sal_uInt16 nHighlight = 0; if ( i == mnCurPos ) - bHighlight = 1; + nHighlight = 1; else if ( i == nHighPos ) - bHighlight = 2; - ImplDrawItem( i, bHighlight ); + nHighlight = 2; + ImplDrawItem( i, nHighlight ); } } ImplShowFocus(); @@ -6054,7 +6055,7 @@ void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus ) // which will in turn ImplShowFocus again // set mnHighItemId to 0 already to prevent this hen/egg problem mnHighItemId = 0; - ImplDrawItem( nPos, sal_False ); + ImplDrawItem( nPos, 0 ); ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHTOFF, reinterpret_cast< void* >( nPos ) ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 832515e4c5ad..6da22a6207eb 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -327,7 +327,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl if ( !bUseSystemFont ) { ImplInitFontList(); - String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); + String aConfigFont = utl::DefaultFontConfiguration::get().getUserInterfaceFont( rSettings.GetUILocale() ); xub_StrLen nIndex = 0; while( nIndex != STRING_NOTFOUND ) { @@ -2410,7 +2410,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags ) { bool bRestoreCursor = false; if ( mpWindowImpl->mpCursor ) - bRestoreCursor = mpWindowImpl->mpCursor->ImplHide( false ); + bRestoreCursor = mpWindowImpl->mpCursor->ImplSuspend(); mbInitClipRegion = sal_True; mpWindowImpl->mbInPaint = sal_True; @@ -2457,7 +2457,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags ) mbInitClipRegion = sal_True; mpWindowImpl->mpPaintRegion = NULL; if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplShow( false, bRestoreCursor ); + mpWindowImpl->mpCursor->ImplResume( bRestoreCursor ); } } else @@ -2899,7 +2899,7 @@ void Window::ImplScroll( const Rectangle& rRect, ImplInvalidateAllOverlapBackgrounds(); if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplHide( false ); + mpWindowImpl->mpCursor->ImplSuspend(); sal_uInt16 nOrgFlags = nFlags; if ( !(nFlags & (SCROLL_CHILDREN | SCROLL_NOCHILDREN)) ) @@ -3046,7 +3046,7 @@ void Window::ImplScroll( const Rectangle& rRect, Update(); if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplShow( false ); + mpWindowImpl->mpCursor->ImplResume(); } // ----------------------------------------------------------------------- @@ -4074,7 +4074,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags ) { // Cursor hiden if ( pOldFocusWindow->mpWindowImpl->mpCursor ) - pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide( true ); + pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide(); } // !!!!! Wegen altem SV-Office Activate/Deavtivate Handling @@ -4341,7 +4341,7 @@ Window::~Window() xComponent->dispose(); } - catch ( Exception exc ) + catch ( Exception ) { // can be safely ignored here. } @@ -6772,7 +6772,7 @@ void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild, sal_Bool bSysWin, if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), sal_True ) ) (*p)->EnableInput( bEnable, bChild ); } - p++; + ++p; } } } @@ -7912,7 +7912,7 @@ void Window::SetCursor( Cursor* pCursor ) if ( mpWindowImpl->mpCursor != pCursor ) { if ( mpWindowImpl->mpCursor ) - mpWindowImpl->mpCursor->ImplHide( true ); + mpWindowImpl->mpCursor->ImplHide(); mpWindowImpl->mpCursor = pCursor; if ( pCursor ) pCursor->ImplShow(); @@ -8379,7 +8379,7 @@ uno::Reference< XDropTarget > Window::GetDropTarget() } - catch( RuntimeException exc ) + catch( RuntimeException ) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8452,7 +8452,7 @@ uno::Reference< XDragSource > Window::GetDragSource() } // createInstance can throw any exception - catch( Exception exc ) + catch( Exception ) { // release all instances mpWindowImpl->mpFrameData->mxDropTarget.clear(); @@ -8532,7 +8532,7 @@ uno::Reference< XClipboard > Window::GetClipboard() } // createInstance can throw any exception - catch( Exception exc ) + catch( Exception ) { // release all instances mpWindowImpl->mpFrameData->mxClipboard.clear(); @@ -8584,7 +8584,7 @@ uno::Reference< XClipboard > Window::GetPrimarySelection() } // createInstance can throw any exception - catch( Exception exc ) + catch( Exception ) { // release all instances mpWindowImpl->mpFrameData->mxSelection.clear(); diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 81acb8ebd4b7..2e52891d18fc 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1797,7 +1797,7 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG ) pSVData->maWinData.mpFocusWin = NULL; if ( pFocusWin->ImplGetWindowImpl()->mpCursor ) - pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide( true ); + pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide(); // Deaktivate rufen Window* pOldFocusWindow = pFocusWin; @@ -1904,7 +1904,7 @@ static void ImplHandleLoseFocus( Window* pWindow ) Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin; if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor ) - pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide( true ); + pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide(); if( bCallDirect ) pWindow->ImplAsyncFocusHdl( NULL ); } diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx index 3763fb5b9d02..aa3d524fdf6c 100644 --- a/vcl/test/canvasbitmaptest.cxx +++ b/vcl/test/canvasbitmaptest.cxx @@ -173,8 +173,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, int nDepth = nOriginalDepth; { - ScopedBitmapReadAccess pAcc( aContainedBmp.AcquireReadAccess(), - aContainedBmp ); + Bitmap::ScopedReadAccess pAcc( aContainedBmp ); nDepth = pAcc->GetBitCount(); } @@ -324,8 +323,7 @@ void checkBitmapImport( const rtl::Reference<VclCanvasBitmap>& xBmp, int nDepth = nOriginalDepth; { - ScopedBitmapReadAccess pAcc( aContainedBmp.AcquireReadAccess(), - aContainedBmp ); + Bitmap::ScopedReadAccess pAcc( aContainedBmp ); nDepth = pAcc->GetBitCount(); } @@ -888,8 +886,7 @@ void TestWindow::Paint( const Rectangle& ) Bitmap aBitmap(Size(200,200),nDepth); aBitmap.Erase(COL_WHITE); { - ScopedBitmapWriteAccess pAcc(aBitmap.AcquireWriteAccess(), - aBitmap); + Bitmap::ScopedWriteAccess pAcc(aBitmap); if( pAcc.get() ) { BitmapColor aBlack(0); @@ -919,8 +916,7 @@ void TestWindow::Paint( const Rectangle& ) Bitmap aMask(Size(200,200),1); aMask.Erase(COL_WHITE); { - ScopedBitmapWriteAccess pAcc(aMask.AcquireWriteAccess(), - aMask); + Bitmap::ScopedWriteAccess pAcc(aMask); if( pAcc.get() ) { pAcc->SetFillColor(COL_BLACK); diff --git a/vcl/test/makefile.mk b/vcl/test/makefile.mk index 64ef8309dfe3..8815053829cc 100644 --- a/vcl/test/makefile.mk +++ b/vcl/test/makefile.mk @@ -32,10 +32,6 @@ TARGET=dndtest LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE -.IF "$(GUI)" == "OS2" -TARGETTYPE=GUI -.ENDIF - # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index 0615a2d44450..e164d06d5d07 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -95,8 +95,6 @@ namespace vcl_sal { { XK_Control_R, "Ctrl" }, { XK_Escape, "Esc" }, { XK_space, "Space" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Turkish[] = @@ -152,8 +150,6 @@ namespace vcl_sal { { SunXK_Paste, "Einsetzen" }, { SunXK_Find, "Suchen" }, { SunXK_Cut, "Ausschneiden" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_French[] = @@ -184,8 +180,6 @@ namespace vcl_sal { { SunXK_Paste, "Coller" }, { SunXK_Find, "Cher." }, { SunXK_Cut, "Couper" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Italian[] = @@ -215,8 +209,6 @@ namespace vcl_sal { { SunXK_Paste, "Incolla" }, { SunXK_Find, "Trova" }, { SunXK_Cut, "Taglia" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Dutch[] = @@ -241,8 +233,6 @@ namespace vcl_sal { { SunXK_Paste, "Paste" }, { SunXK_Find, "Find" }, { SunXK_Cut, "Cut" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Norwegian[] = @@ -268,8 +258,6 @@ namespace vcl_sal { { SunXK_Paste, "Lim" }, { SunXK_Find, "Søk" }, { SunXK_Cut, "Klipp" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Swedish[] = @@ -296,8 +284,6 @@ namespace vcl_sal { { SunXK_Paste, "Klistra in" }, { SunXK_Find, "Sök" }, { SunXK_Cut, "Klipp ut" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Portuguese[] = @@ -322,8 +308,6 @@ namespace vcl_sal { { SunXK_Paste, "Paste" }, { SunXK_Find, "Find" }, { SunXK_Cut, "Cut" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeysymNameReplacement aImplReplacements_Spanish[] = @@ -354,8 +338,6 @@ namespace vcl_sal { { SunXK_Paste, "Pegar" }, { SunXK_Find, "Buscar" }, { SunXK_Cut, "Cortar" }, - { XK_minus, "-" }, - { XK_plus, "+" } }; static const struct KeyboardReplacements aKeyboards[] = diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 5f94db2f1b37..358bbc205004 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -1290,10 +1290,10 @@ XubString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const nKeySym = GetServerVendor() == vendor_sun ? SunXK_Cut : XK_L10; break; case KEY_ADD: - nKeySym = XK_plus; + aCustomKeyName = '+'; break; case KEY_SUBTRACT: - nKeySym = XK_minus; + aCustomKeyName = '-'; break; case KEY_MULTIPLY: nKeySym = XK_asterisk; diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx index 4f1934397397..e2cc22b32198 100644 --- a/vcl/unx/generic/dtrans/X11_clipboard.cxx +++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx @@ -155,7 +155,7 @@ Reference< XTransferable > SAL_CALL X11Clipboard::getContents() MutexGuard aGuard(m_rSelectionManager.getMutex()); if( ! m_aContents.is() ) - m_aContents = new X11Transferable( SelectionManager::get(), static_cast< OWeakObject* >(this), m_aSelection ); + m_aContents = new X11Transferable( SelectionManager::get(), m_aSelection ); return m_aContents; } diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index facc134b3b56..22f109905b13 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -463,7 +463,7 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c // just interested in SelectionClear/Notify/Request and PropertyChange XSelectInput( m_pDisplay, m_aWindow, PropertyChangeMask ); // create the transferable for Drag operations - m_xDropTransferable = new X11Transferable( *this, static_cast< OWeakObject* >(this), m_nXdndSelection ); + m_xDropTransferable = new X11Transferable( *this, m_nXdndSelection ); registerHandler( m_nXdndSelection, *this ); m_aThread = osl_createSuspendedThread( call_SelectionManager_run, this ); @@ -518,12 +518,6 @@ SelectionManager::~SelectionManager() fprintf( stderr, "shutting down SelectionManager\n" ); #endif - if( m_xDisplayConnection.is() ) - { - m_xDisplayConnection->removeEventHandler( Any(), this ); - m_xDisplayConnection.clear(); - } - if( m_pDisplay ) { deregisterHandler( m_nXdndSelection ); @@ -1799,6 +1793,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest fprintf( stderr, " \"%s\"", OUStringToOString( getString( pProps[i]), RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); XFree( pProps ); } + fprintf( stderr, "\n" ); } #endif } @@ -3772,9 +3767,9 @@ void SelectionManager::run( void* pThis ) css::uno::Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); if( xFact.is() ) { - css::uno::Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY ); - if( xDesktop.is() ) - xDesktop->addTerminateListener(This); + This->m_xDesktop.set(xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY); + if (This->m_xDesktop.is()) + This->m_xDesktop->addTerminateListener(This); } while( osl_scheduleThread(This->m_aThread) ) @@ -3819,12 +3814,22 @@ void SelectionManager::run( void* pThis ) void SelectionManager::shutdown() throw() { + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "SelectionManager got app termination event\n" ); + #endif + osl::ResettableMutexGuard aGuard(m_aMutex); + if( m_bShutDown ) - { return; - } m_bShutDown = true; + + if ( m_xDesktop.is() ) + m_xDesktop->removeTerminateListener(this); + + if( m_xDisplayConnection.is() ) + m_xDisplayConnection->removeEventHandler(Any(), this); + // stop dispatching if( m_aThread ) { @@ -3855,8 +3860,9 @@ void SelectionManager::shutdown() throw() m_aThread = NULL; aGuard.reset(); } - m_xDisplayConnection->removeEventHandler( Any(), this ); + m_xDesktop.clear(); m_xDisplayConnection.clear(); + m_xDropTransferable.clear(); } // ------------------------------------------------------------------------ @@ -3896,9 +3902,11 @@ sal_Bool SelectionManager::handleEvent( const Any& event ) throw() return sal_True; } -void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& ) +void SAL_CALL SelectionManager::disposing( const ::com::sun::star::lang::EventObject& rEvt ) throw( ::com::sun::star::uno::RuntimeException ) { + if (rEvt.Source == m_xDesktop || rEvt.Source == m_xDisplayConnection) + shutdown(); } void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang::EventObject& ) @@ -3914,13 +3922,7 @@ void SAL_CALL SelectionManager::queryTermination( const ::com::sun::star::lang:: void SAL_CALL SelectionManager::notifyTermination( const ::com::sun::star::lang::EventObject& rEvent ) throw( ::com::sun::star::uno::RuntimeException ) { - css::uno::Reference< XDesktop > xDesktop( rEvent.Source, UNO_QUERY ); - if( xDesktop.is() == sal_True ) - xDesktop->removeTerminateListener( this ); - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "SelectionManager got app termination event\n" ); - #endif - shutdown(); + disposing(rEvent); } // ------------------------------------------------------------------------ diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx b/vcl/unx/generic/dtrans/X11_selection.hxx index 42158e99802b..ad02ca36c2c1 100644 --- a/vcl/unx/generic/dtrans/X11_selection.hxx +++ b/vcl/unx/generic/dtrans/X11_selection.hxx @@ -259,6 +259,7 @@ namespace x11 { oslThread m_aDragExecuteThread; ::osl::Condition m_aDragRunning; XLIB_Window m_aWindow; + com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > m_xDisplayConnection; com::sun::star::uno::Reference< com::sun::star::script::XInvocation > diff --git a/vcl/unx/generic/dtrans/X11_transferable.cxx b/vcl/unx/generic/dtrans/X11_transferable.cxx index 076da0917a40..fa4629f1c0f2 100644 --- a/vcl/unx/generic/dtrans/X11_transferable.cxx +++ b/vcl/unx/generic/dtrans/X11_transferable.cxx @@ -51,11 +51,9 @@ using ::rtl::OUString; X11Transferable::X11Transferable( SelectionManager& rManager, - const Reference< XInterface >& xCreator, Atom selection ) : m_rManager( rManager ), - m_xCreator( xCreator ), m_aSelection( selection ) { } diff --git a/vcl/unx/generic/dtrans/X11_transferable.hxx b/vcl/unx/generic/dtrans/X11_transferable.hxx index 683faa0a7f87..9eb4efba8dfc 100644 --- a/vcl/unx/generic/dtrans/X11_transferable.hxx +++ b/vcl/unx/generic/dtrans/X11_transferable.hxx @@ -43,10 +43,9 @@ namespace x11 { ::osl::Mutex m_aMutex; SelectionManager& m_rManager; - com::sun::star::uno::Reference< XInterface > m_xCreator; Atom m_aSelection; public: - X11Transferable( SelectionManager& rManager, const com::sun::star::uno::Reference< XInterface >& xCreator, Atom selection = None ); + X11Transferable( SelectionManager& rManager, Atom selection = None ); virtual ~X11Transferable(); /* diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index 96953ab9fc24..e7a4008f07f0 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -408,10 +408,10 @@ void FontCache::read() } int nCollEntry = atoi( pLine ); pFont->m_nPSName = pAtoms->getAtom( ATOM_PSNAME, OUString( pLine + nTokenPos[1], nTokenPos[2]-nTokenPos[1]-1, RTL_TEXTENCODING_UTF8 ), sal_True ); - pFont->m_eItalic = (italic::type)atoi( pLine+nTokenPos[2] ); - pFont->m_eWeight = (weight::type)atoi( pLine+nTokenPos[3] ); - pFont->m_eWidth = (width::type)atoi( pLine+nTokenPos[4] ); - pFont->m_ePitch = (pitch::type)atoi( pLine+nTokenPos[5] ); + pFont->m_eItalic = (FontItalic)atoi( pLine+nTokenPos[2] ); + pFont->m_eWeight = (FontWeight)atoi( pLine+nTokenPos[3] ); + pFont->m_eWidth = (FontWidth)atoi( pLine+nTokenPos[4] ); + pFont->m_ePitch = (FontPitch)atoi( pLine+nTokenPos[5] ); pFont->m_aEncoding = (rtl_TextEncoding)atoi( pLine+nTokenPos[6] ); pFont->m_nAscend = atoi( pLine + nTokenPos[7] ); pFont->m_nDescend = atoi( pLine + nTokenPos[8] ); diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index fe595290160a..c1d506d91d83 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -32,6 +32,7 @@ #include "fontcache.hxx" #include "impfont.hxx" #include "vcl/fontmanager.hxx" +#include "vcl/vclenum.hxx" using namespace psp; @@ -756,67 +757,68 @@ bool PrintFontManager::initFontconfig() namespace { - weight::type convertWeight(int weight) + FontWeight convertWeight(int weight) { // set weight if( weight <= FC_WEIGHT_THIN ) - return weight::Thin; + return WEIGHT_THIN; else if( weight <= FC_WEIGHT_ULTRALIGHT ) - return weight::UltraLight; + return WEIGHT_ULTRALIGHT; else if( weight <= FC_WEIGHT_LIGHT ) - return weight::Light; + return WEIGHT_LIGHT; else if( weight <= FC_WEIGHT_BOOK ) - return weight::SemiLight; + return WEIGHT_SEMILIGHT; else if( weight <= FC_WEIGHT_NORMAL ) - return weight::Normal; + return WEIGHT_NORMAL; else if( weight <= FC_WEIGHT_MEDIUM ) - return weight::Medium; + return WEIGHT_MEDIUM; else if( weight <= FC_WEIGHT_SEMIBOLD ) - return weight::SemiBold; + return WEIGHT_SEMIBOLD; else if( weight <= FC_WEIGHT_BOLD ) - return weight::Bold; + return WEIGHT_BOLD; else if( weight <= FC_WEIGHT_ULTRABOLD ) - return weight::UltraBold; - return weight::Black; + return WEIGHT_ULTRABOLD; + return WEIGHT_BLACK; } - italic::type convertSlant(int slant) + FontItalic convertSlant(int slant) { // set italic if( slant == FC_SLANT_ITALIC ) - return italic::Italic; + return ITALIC_NORMAL; else if( slant == FC_SLANT_OBLIQUE ) - return italic::Oblique; - return italic::Upright; + return ITALIC_OBLIQUE; + return ITALIC_NONE; } - pitch::type convertSpacing(int spacing) + FontPitch convertSpacing(int spacing) { // set pitch if( spacing == FC_MONO || spacing == FC_CHARCELL ) - return pitch::Fixed; - return pitch::Variable; + return PITCH_FIXED; + return PITCH_VARIABLE; } - width::type convertWidth(int width) + // translation: fontconfig enum -> vcl enum + FontWidth convertWidth(int width) { if (width == FC_WIDTH_ULTRACONDENSED) - return width::UltraCondensed; + return WIDTH_ULTRA_CONDENSED; else if (width == FC_WIDTH_EXTRACONDENSED) - return width::ExtraCondensed; + return WIDTH_EXTRA_CONDENSED; else if (width == FC_WIDTH_CONDENSED) - return width::Condensed; + return WIDTH_CONDENSED; else if (width == FC_WIDTH_SEMICONDENSED) - return width::SemiCondensed; + return WIDTH_SEMI_CONDENSED; else if (width == FC_WIDTH_SEMIEXPANDED) - return width::SemiExpanded; + return WIDTH_SEMI_EXPANDED; else if (width == FC_WIDTH_EXPANDED) - return width::Expanded; + return WIDTH_EXPANDED; else if (width == FC_WIDTH_EXTRAEXPANDED) - return width::ExtraExpanded; + return WIDTH_EXTRA_EXPANDED; else if (width == FC_WIDTH_ULTRAEXPANDED) - return width::UltraExpanded; - return width::Normal; + return WIDTH_ULTRA_EXPANDED; + return WIDTH_NORMAL; } } @@ -1045,66 +1047,66 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) } static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, - italic::type eItalic, weight::type eWeight, width::type eWidth, pitch::type ePitch) + FontItalic eItalic, FontWeight eWeight, FontWidth eWidth, FontPitch ePitch) { - if( eItalic != italic::Unknown ) + if( eItalic != ITALIC_DONTKNOW ) { int nSlant = FC_SLANT_ROMAN; switch( eItalic ) { - case italic::Italic: nSlant = FC_SLANT_ITALIC;break; - case italic::Oblique: nSlant = FC_SLANT_OBLIQUE;break; + case ITALIC_NORMAL: nSlant = FC_SLANT_ITALIC;break; + case ITALIC_OBLIQUE: nSlant = FC_SLANT_OBLIQUE;break; default: break; } rWrapper.FcPatternAddInteger( pPattern, FC_SLANT, nSlant ); } - if( eWeight != weight::Unknown ) + if( eWeight != WEIGHT_DONTKNOW ) { int nWeight = FC_WEIGHT_NORMAL; switch( eWeight ) { - case weight::Thin: nWeight = FC_WEIGHT_THIN;break; - case weight::UltraLight: nWeight = FC_WEIGHT_ULTRALIGHT;break; - case weight::Light: nWeight = FC_WEIGHT_LIGHT;break; - case weight::SemiLight: nWeight = FC_WEIGHT_BOOK;break; - case weight::Normal: nWeight = FC_WEIGHT_NORMAL;break; - case weight::Medium: nWeight = FC_WEIGHT_MEDIUM;break; - case weight::SemiBold: nWeight = FC_WEIGHT_SEMIBOLD;break; - case weight::Bold: nWeight = FC_WEIGHT_BOLD;break; - case weight::UltraBold: nWeight = FC_WEIGHT_ULTRABOLD;break; - case weight::Black: nWeight = FC_WEIGHT_BLACK;break; + case WEIGHT_THIN: nWeight = FC_WEIGHT_THIN;break; + case WEIGHT_ULTRALIGHT: nWeight = FC_WEIGHT_ULTRALIGHT;break; + case WEIGHT_LIGHT: nWeight = FC_WEIGHT_LIGHT;break; + case WEIGHT_SEMILIGHT: nWeight = FC_WEIGHT_BOOK;break; + case WEIGHT_NORMAL: nWeight = FC_WEIGHT_NORMAL;break; + case WEIGHT_MEDIUM: nWeight = FC_WEIGHT_MEDIUM;break; + case WEIGHT_SEMIBOLD: nWeight = FC_WEIGHT_SEMIBOLD;break; + case WEIGHT_BOLD: nWeight = FC_WEIGHT_BOLD;break; + case WEIGHT_ULTRABOLD: nWeight = FC_WEIGHT_ULTRABOLD;break; + case WEIGHT_BLACK: nWeight = FC_WEIGHT_BLACK;break; default: break; } rWrapper.FcPatternAddInteger( pPattern, FC_WEIGHT, nWeight ); } - if( eWidth != width::Unknown ) + if( eWidth != WIDTH_DONTKNOW ) { int nWidth = FC_WIDTH_NORMAL; switch( eWidth ) { - case width::UltraCondensed: nWidth = FC_WIDTH_ULTRACONDENSED;break; - case width::ExtraCondensed: nWidth = FC_WIDTH_EXTRACONDENSED;break; - case width::Condensed: nWidth = FC_WIDTH_CONDENSED;break; - case width::SemiCondensed: nWidth = FC_WIDTH_SEMICONDENSED;break; - case width::Normal: nWidth = FC_WIDTH_NORMAL;break; - case width::SemiExpanded: nWidth = FC_WIDTH_SEMIEXPANDED;break; - case width::Expanded: nWidth = FC_WIDTH_EXPANDED;break; - case width::ExtraExpanded: nWidth = FC_WIDTH_EXTRAEXPANDED;break; - case width::UltraExpanded: nWidth = FC_WIDTH_ULTRACONDENSED;break; + case WIDTH_ULTRA_CONDENSED: nWidth = FC_WIDTH_ULTRACONDENSED;break; + case WIDTH_EXTRA_CONDENSED: nWidth = FC_WIDTH_EXTRACONDENSED;break; + case WIDTH_CONDENSED: nWidth = FC_WIDTH_CONDENSED;break; + case WIDTH_SEMI_CONDENSED: nWidth = FC_WIDTH_SEMICONDENSED;break; + case WIDTH_NORMAL: nWidth = FC_WIDTH_NORMAL;break; + case WIDTH_SEMI_EXPANDED: nWidth = FC_WIDTH_SEMIEXPANDED;break; + case WIDTH_EXPANDED: nWidth = FC_WIDTH_EXPANDED;break; + case WIDTH_EXTRA_EXPANDED: nWidth = FC_WIDTH_EXTRAEXPANDED;break; + case WIDTH_ULTRA_EXPANDED: nWidth = FC_WIDTH_ULTRACONDENSED;break; default: break; } rWrapper.FcPatternAddInteger( pPattern, FC_WIDTH, nWidth ); } - if( ePitch != pitch::Unknown ) + if( ePitch != PITCH_DONTKNOW ) { int nSpacing = FC_PROPORTIONAL; switch( ePitch ) { - case pitch::Fixed: nSpacing = FC_MONO;break; - case pitch::Variable: nSpacing = FC_PROPORTIONAL;break; + case PITCH_FIXED: nSpacing = FC_MONO;break; + case PITCH_VARIABLE: nSpacing = FC_PROPORTIONAL;break; default: break; } @@ -1116,8 +1118,8 @@ static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, - italic::type &rItalic, weight::type &rWeight, - width::type &rWidth, pitch::type &rPitch) const + FontItalic &rItalic, FontWeight &rWeight, + FontWidth &rWidth, FontPitch &rPitch) const { rtl::OUString aName; FontCfgWrapper& rWrapper = FontCfgWrapper::get(); @@ -1433,7 +1435,7 @@ int PrintFontManager::FreeTypeCharIndex( void*, sal_uInt32 ) } rtl::OUString PrintFontManager::Substitute( const rtl::OUString&, - rtl::OUString&, const rtl::OString&, italic::type, weight::type, width::type, pitch::type) const + rtl::OUString&, const rtl::OString&, FontItalic, FontWeight, FontWidth, FontPitch) const { rtl::OUString aName; return aName; diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 5b7ef936d5ca..1427daedb193 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -134,83 +134,83 @@ inline sal_uInt32 getUInt32BE( const sal_uInt8*& pBuffer ) return nRet; } -static italic::type parseItalic( const ByteString& rItalic ) +static FontItalic parseItalic( const ByteString& rItalic ) { - italic::type eItalic = italic::Unknown; + FontItalic eItalic = ITALIC_DONTKNOW; if( rItalic.EqualsIgnoreCaseAscii( "i" ) ) - eItalic = italic::Italic; + eItalic = ITALIC_NORMAL; else if( rItalic.EqualsIgnoreCaseAscii( "o" ) ) - eItalic = italic::Oblique; + eItalic = ITALIC_OBLIQUE; else - eItalic = italic::Upright; + eItalic = ITALIC_NONE; return eItalic; } // ------------------------------------------------------------------------- -static weight::type parseWeight( const ByteString& rWeight ) +static FontWeight parseWeight( const ByteString& rWeight ) { - weight::type eWeight = weight::Unknown; + FontWeight eWeight = WEIGHT_DONTKNOW; if( rWeight.Search( "bold" ) != STRING_NOTFOUND ) { if( rWeight.Search( "emi" ) != STRING_NOTFOUND ) // semi, demi - eWeight = weight::SemiBold; + eWeight = WEIGHT_SEMIBOLD; else if( rWeight.Search( "ultra" ) != STRING_NOTFOUND ) - eWeight = weight::UltraBold; + eWeight = WEIGHT_ULTRABOLD; else - eWeight = weight::Bold; + eWeight = WEIGHT_BOLD; } else if( rWeight.Search( "heavy" ) != STRING_NOTFOUND ) - eWeight = weight::Bold; + eWeight = WEIGHT_BOLD; else if( rWeight.Search( "light" ) != STRING_NOTFOUND ) { if( rWeight.Search( "emi" ) != STRING_NOTFOUND ) // semi, demi - eWeight = weight::SemiLight; + eWeight = WEIGHT_SEMILIGHT; else if( rWeight.Search( "ultra" ) != STRING_NOTFOUND ) - eWeight = weight::UltraLight; + eWeight = WEIGHT_ULTRALIGHT; else - eWeight = weight::Light; + eWeight = WEIGHT_LIGHT; } else if( rWeight.Search( "black" ) != STRING_NOTFOUND ) - eWeight = weight::Black; + eWeight = WEIGHT_BLACK; else if( rWeight.Equals( "demi" ) ) - eWeight = weight::SemiBold; + eWeight = WEIGHT_SEMIBOLD; else if( rWeight.Equals( "book" ) || rWeight.Equals( "semicondensed" ) ) - eWeight = weight::Light; + eWeight = WEIGHT_LIGHT; else if( rWeight.Equals( "medium" ) || rWeight.Equals( "roman" ) ) - eWeight = weight::Medium; + eWeight = WEIGHT_MEDIUM; else - eWeight = weight::Normal; + eWeight = WEIGHT_NORMAL; return eWeight; } // ------------------------------------------------------------------------- -static width::type parseWidth( const ByteString& rWidth ) +static FontWidth parseWidth( const ByteString& rWidth ) { - width::type eWidth = width::Unknown; + FontWidth eWidth = WIDTH_DONTKNOW; if( rWidth.Equals( "bold" ) || rWidth.Equals( "semiexpanded" ) ) - eWidth = width::SemiExpanded; + eWidth = WIDTH_SEMI_EXPANDED; else if( rWidth.Equals( "condensed" ) || rWidth.Equals( "narrow" ) ) - eWidth = width::Condensed; + eWidth = WIDTH_CONDENSED; else if( rWidth.Equals( "double wide" ) || rWidth.Equals( "extraexpanded" ) || rWidth.Equals( "ultraexpanded" ) ) - eWidth = width::UltraExpanded; + eWidth = WIDTH_ULTRA_EXPANDED; else if( rWidth.Equals( "expanded" ) || rWidth.Equals( "wide" ) ) - eWidth = width::Expanded; + eWidth = WIDTH_EXPANDED; else if( rWidth.Equals( "extracondensed" ) ) - eWidth = width::ExtraCondensed; + eWidth = WIDTH_EXTRA_CONDENSED; else if( rWidth.Equals( "semicondensed" ) ) - eWidth = width::SemiCondensed; + eWidth = WIDTH_SEMI_CONDENSED; else if( rWidth.Equals( "ultracondensed" ) ) - eWidth = width::UltraCondensed; + eWidth = WIDTH_ULTRA_CONDENSED; else - eWidth = width::Normal; + eWidth = WIDTH_NORMAL; return eWidth; } @@ -355,10 +355,10 @@ PrintFontManager::PrintFont::PrintFont( fonttype::type eType ) : m_eType( eType ), m_nFamilyName( 0 ), m_nPSName( 0 ), - m_eItalic( italic::Unknown ), - m_eWidth( width::Unknown ), - m_eWeight( weight::Unknown ), - m_ePitch( pitch::Unknown ), + m_eItalic( ITALIC_DONTKNOW ), + m_eWidth( WIDTH_DONTKNOW ), + m_eWeight( WEIGHT_DONTKNOW ), + m_ePitch( PITCH_DONTKNOW ), m_aEncoding( RTL_TEXTENCODING_DONTKNOW ), m_bFontEncodingOnly( false ), m_pMetrics( NULL ), @@ -812,11 +812,11 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult // italic if( pInfo->gfi->italicAngle > 0 ) - m_eItalic = italic::Oblique; + m_eItalic = ITALIC_OBLIQUE; else if( pInfo->gfi->italicAngle < 0 ) - m_eItalic = italic::Italic; + m_eItalic = ITALIC_NORMAL; else - m_eItalic = italic::Upright; + m_eItalic = ITALIC_NONE; // weight ByteString aLowerWeight( pInfo->gfi->weight ); @@ -824,7 +824,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult m_eWeight = parseWeight( aLowerWeight ); // pitch - m_ePitch = pInfo->gfi->isFixedPitch ? pitch::Fixed : pitch::Variable; + m_ePitch = pInfo->gfi->isFixedPitch ? PITCH_FIXED : PITCH_VARIABLE; // encoding - only set if unknown int nAdobeEncoding = 0; @@ -1532,9 +1532,9 @@ bool PrintFontManager::parseXLFD( const OString& rXLFD, XLFDEntry& rEntry ) // evaluate pitch if( aPitch.toChar() == 'c' || aPitch.toChar() == 'm' ) - rEntry.ePitch = pitch::Fixed; + rEntry.ePitch = PITCH_FIXED; else - rEntry.ePitch = pitch::Variable; + rEntry.ePitch = PITCH_VARIABLE; OString aToken = aEnc.toAsciiLowerCase(); // get encoding @@ -1694,42 +1694,42 @@ OString PrintFontManager::getXLFD( PrintFont* pFont ) const aXLFD.append( '-' ); switch( pFont->m_eWeight ) { - case weight::Thin: aXLFD.append("thin");break; - case weight::UltraLight: aXLFD.append("ultralight");break; - case weight::Light: aXLFD.append("light");break; - case weight::SemiLight: aXLFD.append("semilight");break; - case weight::Normal: aXLFD.append("normal");break; - case weight::Medium: aXLFD.append("medium");break; - case weight::SemiBold: aXLFD.append("semibold");break; - case weight::Bold: aXLFD.append("bold");break; - case weight::UltraBold: aXLFD.append("ultrabold");break; - case weight::Black: aXLFD.append("black");break; + case WEIGHT_THIN: aXLFD.append("thin");break; + case WEIGHT_ULTRALIGHT: aXLFD.append("ultralight");break; + case WEIGHT_LIGHT: aXLFD.append("light");break; + case WEIGHT_SEMILIGHT: aXLFD.append("semilight");break; + case WEIGHT_NORMAL: aXLFD.append("normal");break; + case WEIGHT_MEDIUM: aXLFD.append("medium");break; + case WEIGHT_SEMIBOLD: aXLFD.append("semibold");break; + case WEIGHT_BOLD: aXLFD.append("bold");break; + case WEIGHT_ULTRABOLD: aXLFD.append("ultrabold");break; + case WEIGHT_BLACK: aXLFD.append("black");break; default: break; } aXLFD.append('-'); switch( pFont->m_eItalic ) { - case italic::Upright: aXLFD.append('r');break; - case italic::Oblique: aXLFD.append('o');break; - case italic::Italic: aXLFD.append('i');break; + case ITALIC_NONE: aXLFD.append('r');break; + case ITALIC_OBLIQUE: aXLFD.append('o');break; + case ITALIC_NORMAL: aXLFD.append('i');break; default: break; } aXLFD.append('-'); switch( pFont->m_eWidth ) { - case width::UltraCondensed: aXLFD.append("ultracondensed");break; - case width::ExtraCondensed: aXLFD.append("extracondensed");break; - case width::Condensed: aXLFD.append("condensed");break; - case width::SemiCondensed: aXLFD.append("semicondensed");break; - case width::Normal: aXLFD.append("normal");break; - case width::SemiExpanded: aXLFD.append("semiexpanded");break; - case width::Expanded: aXLFD.append("expanded");break; - case width::ExtraExpanded: aXLFD.append("extraexpanded");break; - case width::UltraExpanded: aXLFD.append("ultraexpanded");break; + case WIDTH_ULTRA_CONDENSED: aXLFD.append("ultracondensed");break; + case WIDTH_EXTRA_CONDENSED: aXLFD.append("extracondensed");break; + case WIDTH_CONDENSED: aXLFD.append("condensed");break; + case WIDTH_SEMI_CONDENSED: aXLFD.append("semicondensed");break; + case WIDTH_NORMAL: aXLFD.append("normal");break; + case WIDTH_SEMI_EXPANDED: aXLFD.append("semiexpanded");break; + case WIDTH_EXPANDED: aXLFD.append("expanded");break; + case WIDTH_EXTRA_EXPANDED: aXLFD.append("extraexpanded");break; + case WIDTH_ULTRA_EXPANDED: aXLFD.append("ultraexpanded");break; default: break; } aXLFD.append("-utf8-0-0-0-0-"); - aXLFD.append( pFont->m_ePitch == pitch::Fixed ? "m" : "p" ); + aXLFD.append( pFont->m_ePitch == PITCH_FIXED ? "m" : "p" ); aXLFD.append("-0-"); const char* pEnc = rtl_getBestUnixCharsetFromTextEncoding( pFont->m_aEncoding ); if( ! pEnc ) @@ -1946,40 +1946,40 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME, String( ByteString( aInfo.psname ), aEncoding ), sal_True ); switch( aInfo.weight ) { - case FW_THIN: pFont->m_eWeight = weight::Thin; break; - case FW_EXTRALIGHT: pFont->m_eWeight = weight::UltraLight; break; - case FW_LIGHT: pFont->m_eWeight = weight::Light; break; - case FW_MEDIUM: pFont->m_eWeight = weight::Medium; break; - case FW_SEMIBOLD: pFont->m_eWeight = weight::SemiBold; break; - case FW_BOLD: pFont->m_eWeight = weight::Bold; break; - case FW_EXTRABOLD: pFont->m_eWeight = weight::UltraBold; break; - case FW_BLACK: pFont->m_eWeight = weight::Black; break; + case FW_THIN: pFont->m_eWeight = WEIGHT_THIN; break; + case FW_EXTRALIGHT: pFont->m_eWeight = WEIGHT_ULTRALIGHT; break; + case FW_LIGHT: pFont->m_eWeight = WEIGHT_LIGHT; break; + case FW_MEDIUM: pFont->m_eWeight = WEIGHT_MEDIUM; break; + case FW_SEMIBOLD: pFont->m_eWeight = WEIGHT_SEMIBOLD; break; + case FW_BOLD: pFont->m_eWeight = WEIGHT_BOLD; break; + case FW_EXTRABOLD: pFont->m_eWeight = WEIGHT_ULTRABOLD; break; + case FW_BLACK: pFont->m_eWeight = WEIGHT_BLACK; break; case FW_NORMAL: - default: pFont->m_eWeight = weight::Normal; break; + default: pFont->m_eWeight = WEIGHT_NORMAL; break; } switch( aInfo.width ) { - case FWIDTH_ULTRA_CONDENSED: pFont->m_eWidth = width::UltraCondensed; break; - case FWIDTH_EXTRA_CONDENSED: pFont->m_eWidth = width::ExtraCondensed; break; - case FWIDTH_CONDENSED: pFont->m_eWidth = width::Condensed; break; - case FWIDTH_SEMI_CONDENSED: pFont->m_eWidth = width::SemiCondensed; break; - case FWIDTH_SEMI_EXPANDED: pFont->m_eWidth = width::SemiExpanded; break; - case FWIDTH_EXPANDED: pFont->m_eWidth = width::Expanded; break; - case FWIDTH_EXTRA_EXPANDED: pFont->m_eWidth = width::ExtraExpanded; break; - case FWIDTH_ULTRA_EXPANDED: pFont->m_eWidth = width::UltraExpanded; break; + case FWIDTH_ULTRA_CONDENSED: pFont->m_eWidth = WIDTH_ULTRA_CONDENSED; break; + case FWIDTH_EXTRA_CONDENSED: pFont->m_eWidth = WIDTH_EXTRA_CONDENSED; break; + case FWIDTH_CONDENSED: pFont->m_eWidth = WIDTH_CONDENSED; break; + case FWIDTH_SEMI_CONDENSED: pFont->m_eWidth = WIDTH_SEMI_CONDENSED; break; + case FWIDTH_SEMI_EXPANDED: pFont->m_eWidth = WIDTH_SEMI_EXPANDED; break; + case FWIDTH_EXPANDED: pFont->m_eWidth = WIDTH_EXPANDED; break; + case FWIDTH_EXTRA_EXPANDED: pFont->m_eWidth = WIDTH_EXTRA_EXPANDED; break; + case FWIDTH_ULTRA_EXPANDED: pFont->m_eWidth = WIDTH_ULTRA_EXPANDED; break; case FWIDTH_NORMAL: - default: pFont->m_eWidth = width::Normal; break; + default: pFont->m_eWidth = WIDTH_NORMAL; break; } - pFont->m_ePitch = aInfo.pitch ? pitch::Fixed : pitch::Variable; - pFont->m_eItalic = aInfo.italicAngle == 0 ? italic::Upright : ( aInfo.italicAngle < 0 ? italic::Italic : italic::Oblique ); + pFont->m_ePitch = aInfo.pitch ? PITCH_FIXED : PITCH_VARIABLE; + pFont->m_eItalic = aInfo.italicAngle == 0 ? ITALIC_NONE : ( aInfo.italicAngle < 0 ? ITALIC_NORMAL : ITALIC_OBLIQUE ); // #104264# there are fonts that set italic angle 0 although they are // italic; use macstyle bit here if( aInfo.italicAngle == 0 && (aInfo.macStyle & 2) ) - pFont->m_eItalic = italic::Italic; + pFont->m_eItalic = ITALIC_NORMAL; pFont->m_aEncoding = aInfo.symbolEncoded ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UCS2; @@ -2430,13 +2430,13 @@ void PrintFontManager::initialize() ::boost::unordered_map< fontID, PrintFont* >::iterator font_it; for (font_it = m_aFonts.begin(); font_it != m_aFonts.end(); ++font_it) { - ::boost::unordered_map< int, family::type >::const_iterator it = + ::boost::unordered_map< int, FontFamily >::const_iterator it = m_aFamilyTypes.find( font_it->second->m_nFamilyName ); if (it != m_aFamilyTypes.end()) continue; const ::rtl::OUString& rFamily = m_pAtoms->getString( ATOM_FAMILYNAME, font_it->second->m_nFamilyName); - family::type eType = matchFamilyName( rFamily ); + FontFamily eType = matchFamilyName( rFamily ); m_aFamilyTypes[ font_it->second->m_nFamilyName ] = eType; } @@ -2459,22 +2459,22 @@ void PrintFontManager::initialize() // ------------------------------------------------------------------------- inline bool -equalPitch (psp::pitch::type from, psp::pitch::type to) +equalPitch (FontPitch from, FontPitch to) { return from == to; } inline bool -equalWeight (psp::weight::type from, psp::weight::type to) +equalWeight (FontWeight from, FontWeight to) { return from > to ? (from - to) <= 3 : (to - from) <= 3; } inline bool -equalItalic (psp::italic::type from, psp::italic::type to) +equalItalic (FontItalic from, FontItalic to) { - if ( (from == psp::italic::Italic) || (from == psp::italic::Oblique) ) - return (to == psp::italic::Italic) || (to == psp::italic::Oblique); + if ( (from == ITALIC_NORMAL) || (from == ITALIC_OBLIQUE) ) + return (to == ITALIC_NORMAL) || (to == ITALIC_OBLIQUE); return to == from; } inline bool @@ -2489,15 +2489,15 @@ namespace { struct BuiltinFontIdentifier { OUString aFamily; - italic::type eItalic; - weight::type eWeight; - pitch::type ePitch; + FontItalic eItalic; + FontWeight eWeight; + FontPitch ePitch; rtl_TextEncoding aEncoding; BuiltinFontIdentifier( const OUString& rFam, - italic::type eIt, - weight::type eWg, - pitch::type ePt, + FontItalic eIt, + FontWeight eWg, + FontPitch ePt, rtl_TextEncoding enc ) : aFamily( rFam ), eItalic( eIt ), @@ -2651,12 +2651,12 @@ void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDPa void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& rInfo ) const { - ::boost::unordered_map< int, family::type >::const_iterator style_it = + ::boost::unordered_map< int, FontFamily >::const_iterator style_it = m_aFamilyTypes.find( pFont->m_nFamilyName ); rInfo.m_eType = pFont->m_eType; rInfo.m_aFamilyName = m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName ); rInfo.m_aStyleName = pFont->m_aStyleName; - rInfo.m_eFamilyStyle = style_it != m_aFamilyTypes.end() ? style_it->second : family::Unknown; + rInfo.m_eFamilyStyle = style_it != m_aFamilyTypes.end() ? style_it->second : FAMILY_DONTKNOW; rInfo.m_eItalic = pFont->m_eItalic; rInfo.m_eWidth = pFont->m_eWidth; rInfo.m_eWeight = pFont->m_eWeight; @@ -2795,42 +2795,42 @@ int PrintFontManager::getFontFaceNumber( fontID nFontID ) const // ------------------------------------------------------------------------- -family::type PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily ) const +FontFamily PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily ) const { typedef struct { const char* mpName; sal_uInt16 mnLength; - family::type meType; + FontFamily meType; } family_t; #define InitializeClass( p, a ) p, sizeof(p) - 1, a const family_t pFamilyMatch[] = { - { InitializeClass( "arial", family::Swiss ) }, - { InitializeClass( "arioso", family::Script ) }, - { InitializeClass( "avant garde", family::Swiss ) }, - { InitializeClass( "avantgarde", family::Swiss ) }, - { InitializeClass( "bembo", family::Roman ) }, - { InitializeClass( "bookman", family::Roman ) }, - { InitializeClass( "conga", family::Roman ) }, - { InitializeClass( "courier", family::Modern ) }, - { InitializeClass( "curl", family::Script ) }, - { InitializeClass( "fixed", family::Modern ) }, - { InitializeClass( "gill", family::Swiss ) }, - { InitializeClass( "helmet", family::Modern ) }, - { InitializeClass( "helvetica", family::Swiss ) }, - { InitializeClass( "international", family::Modern ) }, - { InitializeClass( "lucida", family::Swiss ) }, - { InitializeClass( "new century schoolbook", family::Roman ) }, - { InitializeClass( "palatino", family::Roman ) }, - { InitializeClass( "roman", family::Roman ) }, - { InitializeClass( "sans serif", family::Swiss ) }, - { InitializeClass( "sansserif", family::Swiss ) }, - { InitializeClass( "serf", family::Roman ) }, - { InitializeClass( "serif", family::Roman ) }, - { InitializeClass( "times", family::Roman ) }, - { InitializeClass( "utopia", family::Roman ) }, - { InitializeClass( "zapf chancery", family::Script ) }, - { InitializeClass( "zapfchancery", family::Script ) } + { InitializeClass( "arial", FAMILY_SWISS ) }, + { InitializeClass( "arioso", FAMILY_SCRIPT ) }, + { InitializeClass( "avant garde", FAMILY_SWISS ) }, + { InitializeClass( "avantgarde", FAMILY_SWISS ) }, + { InitializeClass( "bembo", FAMILY_ROMAN ) }, + { InitializeClass( "bookman", FAMILY_ROMAN ) }, + { InitializeClass( "conga", FAMILY_ROMAN ) }, + { InitializeClass( "courier", FAMILY_MODERN ) }, + { InitializeClass( "curl", FAMILY_SCRIPT ) }, + { InitializeClass( "fixed", FAMILY_MODERN ) }, + { InitializeClass( "gill", FAMILY_SWISS ) }, + { InitializeClass( "helmet", FAMILY_MODERN ) }, + { InitializeClass( "helvetica", FAMILY_SWISS ) }, + { InitializeClass( "international", FAMILY_MODERN ) }, + { InitializeClass( "lucida", FAMILY_SWISS ) }, + { InitializeClass( "new century schoolbook", FAMILY_ROMAN ) }, + { InitializeClass( "palatino", FAMILY_ROMAN ) }, + { InitializeClass( "roman", FAMILY_ROMAN ) }, + { InitializeClass( "sans serif", FAMILY_SWISS ) }, + { InitializeClass( "sansserif", FAMILY_SWISS ) }, + { InitializeClass( "serf", FAMILY_ROMAN ) }, + { InitializeClass( "serif", FAMILY_ROMAN ) }, + { InitializeClass( "times", FAMILY_ROMAN ) }, + { InitializeClass( "utopia", FAMILY_ROMAN ) }, + { InitializeClass( "zapf chancery", FAMILY_SCRIPT ) }, + { InitializeClass( "zapfchancery", FAMILY_SCRIPT ) } }; rtl::OString aFamily = rtl::OUStringToOString( rFamily, RTL_TEXTENCODING_ASCII_US ); @@ -2857,20 +2857,20 @@ family::type PrintFontManager::matchFamilyName( const ::rtl::OUString& rFamily ) return pHaystack->meType; } - return family::Unknown; + return FAMILY_DONTKNOW; } // ------------------------------------------------------------------------- -family::type PrintFontManager::getFontFamilyType( fontID nFontID ) const +FontFamily PrintFontManager::getFontFamilyType( fontID nFontID ) const { PrintFont* pFont = getFont( nFontID ); if( !pFont ) - return family::Unknown; + return FAMILY_DONTKNOW; - ::boost::unordered_map< int, family::type >::const_iterator it = + ::boost::unordered_map< int, FontFamily >::const_iterator it = m_aFamilyTypes.find( pFont->m_nFamilyName ); - return (it != m_aFamilyTypes.end()) ? it->second : family::Unknown; + return (it != m_aFamilyTypes.end()) ? it->second : FAMILY_DONTKNOW; } @@ -3167,6 +3167,10 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal_Unicode maxCharacter, CharacterMetric* pArray, bool bVertical ) const { + OSL_PRECOND(minCharacter <= maxCharacter, "invalid char. range"); + if (minCharacter > maxCharacter) + return false; + PrintFont* pFont = getFont( nFontID ); if( ! pFont ) return false; @@ -4013,13 +4017,13 @@ bool PrintFontManager::readOverrideMetrics() else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StyleName" ) ) ) pFont->m_aStyleName = getString(pProps[n].Value); else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Italic" ) ) ) - pFont->m_eItalic = static_cast<italic::type>(getInt(pProps[n].Value)); + pFont->m_eItalic = static_cast<FontItalic>(getInt(pProps[n].Value)); else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) ) - pFont->m_eWidth = static_cast<width::type>(getInt(pProps[n].Value)); + pFont->m_eWidth = static_cast<FontWidth>(getInt(pProps[n].Value)); else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Weight" ) ) ) - pFont->m_eWeight = static_cast<weight::type>(getInt(pProps[n].Value)); + pFont->m_eWeight = static_cast<FontWeight>(getInt(pProps[n].Value)); else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Pitch" ) ) ) - pFont->m_ePitch = static_cast<pitch::type>(getInt(pProps[n].Value)); + pFont->m_ePitch = static_cast<FontPitch>(getInt(pProps[n].Value)); else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Encoding" ) ) ) pFont->m_aEncoding = static_cast<rtl_TextEncoding>(getInt(pProps[n].Value)); else if( pProps[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FontEncodingOnly" ) ) ) diff --git a/vcl/unx/generic/gdi/cdeint.cxx b/vcl/unx/generic/gdi/cdeint.cxx index a6a37a178c48..fc516099630f 100644 --- a/vcl/unx/generic/gdi/cdeint.cxx +++ b/vcl/unx/generic/gdi/cdeint.cxx @@ -229,17 +229,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) aStyleSettings.SetDialogColor( aColors[1] ); aStyleSettings.SetMenuColor( aColors[1] ); aStyleSettings.SetMenuBarColor( aColors[1] ); - if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - // calculate Checked color - Color aColor2 = aStyleSettings.GetLightColor(); - sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)aColors[1].GetRed() + (sal_uInt16)aColor2.GetRed())/2); - sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)aColors[1].GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); - sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)aColors[1].GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); } rSettings.SetStyleSettings( aStyleSettings ); } diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx index 9da147dbec9c..a2b247fc231f 100644 --- a/vcl/unx/generic/gdi/gcach_xpeer.cxx +++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx @@ -650,27 +650,51 @@ X11GlyphCache::X11GlyphCache( X11GlyphPeer& rPeer ) // --------------------------------------------------------------------------- -static X11GlyphPeer* pX11GlyphPeer = NULL; -static X11GlyphCache* pX11GlyphCache = NULL; +namespace +{ + struct GlyphCacheHolder + { + private: + X11GlyphPeer* m_pX11GlyphPeer; + X11GlyphCache* m_pX11GlyphCache; + public: + GlyphCacheHolder() + { + m_pX11GlyphPeer = new X11GlyphPeer(); + m_pX11GlyphCache = new X11GlyphCache( *m_pX11GlyphPeer ); + } + void release() + { + delete m_pX11GlyphCache; + delete m_pX11GlyphPeer; + m_pX11GlyphCache = NULL; + m_pX11GlyphPeer = NULL; + } + X11GlyphCache& getGlyphCache() + { + return *m_pX11GlyphCache; + } + ~GlyphCacheHolder() + { + release(); + } + }; +} + +struct theGlyphCacheHolder : + public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder> +{}; X11GlyphCache& X11GlyphCache::GetInstance() { - if( !pX11GlyphCache ) - { - pX11GlyphPeer = new X11GlyphPeer(); - pX11GlyphCache = new X11GlyphCache( *pX11GlyphPeer ); - } - return *pX11GlyphCache; + return theGlyphCacheHolder::get().getGlyphCache(); } // --------------------------------------------------------------------------- void X11GlyphCache::KillInstance() { - delete pX11GlyphCache; - delete pX11GlyphPeer; - pX11GlyphCache = NULL; - pX11GlyphPeer = NULL; + return theGlyphCacheHolder::get().release(); } // =========================================================================== diff --git a/vcl/unx/generic/gdi/gcach_xpeer.hxx b/vcl/unx/generic/gdi/gcach_xpeer.hxx index 412c47f82de2..d2b4ec259e8e 100644 --- a/vcl/unx/generic/gdi/gcach_xpeer.hxx +++ b/vcl/unx/generic/gdi/gcach_xpeer.hxx @@ -82,12 +82,13 @@ private: class X11GlyphCache : public GlyphCache { public: - X11GlyphPeer& GetPeer() { return reinterpret_cast<X11GlyphPeer&>( mrPeer ); } -static X11GlyphCache& GetInstance(); -static void KillInstance(); - -private: - X11GlyphCache( X11GlyphPeer& ); + X11GlyphCache( X11GlyphPeer& ); + X11GlyphPeer& GetPeer() + { + return static_cast<X11GlyphPeer&>(mrPeer); + } + static X11GlyphCache& GetInstance(); + static void KillInstance(); }; #endif // _SV_GCACH_XPEER_HXX diff --git a/vcl/unx/generic/gdi/pspgraphics.cxx b/vcl/unx/generic/gdi/pspgraphics.cxx index 65c4c0ab41da..228c1ff7a606 100644 --- a/vcl/unx/generic/gdi/pspgraphics.cxx +++ b/vcl/unx/generic/gdi/pspgraphics.cxx @@ -812,13 +812,13 @@ sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel bool bArtBold = false; if( pEntry->meItalic == ITALIC_OBLIQUE || pEntry->meItalic == ITALIC_NORMAL ) { - psp::italic::type eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); - if( eItalic != psp::italic::Italic && eItalic != psp::italic::Oblique ) + FontItalic eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); + if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE ) bArtItalic = true; } int nWeight = (int)pEntry->meWeight; int nRealWeight = (int)m_pPrinterGfx->GetFontMgr().getFontWeight( nID ); - if( nRealWeight <= (int)psp::weight::Medium && nWeight > (int)WEIGHT_MEDIUM ) + if( nRealWeight <= (int)WEIGHT_MEDIUM && nWeight > (int)WEIGHT_MEDIUM ) { bArtBold = true; } @@ -1182,106 +1182,16 @@ void PspGraphics::DoGetGlyphWidths( psp::fontID aFont, } // ---------------------------------------------------------------------------- -FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth) -{ - switch (eWidth) - { - case psp::width::UltraCondensed: return WIDTH_ULTRA_CONDENSED; - case psp::width::ExtraCondensed: return WIDTH_EXTRA_CONDENSED; - case psp::width::Condensed: return WIDTH_CONDENSED; - case psp::width::SemiCondensed: return WIDTH_SEMI_CONDENSED; - case psp::width::Normal: return WIDTH_NORMAL; - case psp::width::SemiExpanded: return WIDTH_SEMI_EXPANDED; - case psp::width::Expanded: return WIDTH_EXPANDED; - case psp::width::ExtraExpanded: return WIDTH_EXTRA_EXPANDED; - case psp::width::UltraExpanded: return WIDTH_ULTRA_EXPANDED; - case psp::width::Unknown: return WIDTH_DONTKNOW; - default: - OSL_FAIL( "unknown width mapping" ); - break; - } - return WIDTH_DONTKNOW; -} - -FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight) -{ - switch (eWeight) - { - case psp::weight::Thin: return WEIGHT_THIN; - case psp::weight::UltraLight: return WEIGHT_ULTRALIGHT; - case psp::weight::Light: return WEIGHT_LIGHT; - case psp::weight::SemiLight: return WEIGHT_SEMILIGHT; - case psp::weight::Normal: return WEIGHT_NORMAL; - case psp::weight::Medium: return WEIGHT_MEDIUM; - case psp::weight::SemiBold: return WEIGHT_SEMIBOLD; - case psp::weight::Bold: return WEIGHT_BOLD; - case psp::weight::UltraBold: return WEIGHT_ULTRABOLD; - case psp::weight::Black: return WEIGHT_BLACK; - case psp::weight::Unknown: return WEIGHT_DONTKNOW; - default: - OSL_FAIL( "unknown weight mapping" ); - break; - } - return WEIGHT_DONTKNOW; -} - -FontPitch PspGraphics::ToFontPitch (psp::pitch::type ePitch) -{ - switch (ePitch) - { - case psp::pitch::Fixed: return PITCH_FIXED; - case psp::pitch::Variable: return PITCH_VARIABLE; - case psp::pitch::Unknown: return PITCH_DONTKNOW; - default: - OSL_FAIL( "unknown pitch mapping" ); - break; - } - return PITCH_DONTKNOW; -} - -FontItalic PspGraphics::ToFontItalic (psp::italic::type eItalic) -{ - switch (eItalic) - { - case psp::italic::Upright: return ITALIC_NONE; - case psp::italic::Oblique: return ITALIC_OBLIQUE; - case psp::italic::Italic: return ITALIC_NORMAL; - case psp::italic::Unknown: return ITALIC_DONTKNOW; - default: - OSL_FAIL( "unknown italic mapping" ); - break; - } - return ITALIC_DONTKNOW; -} - -FontFamily PspGraphics::ToFontFamily (psp::family::type eFamily) -{ - switch (eFamily) - { - case psp::family::Decorative: return FAMILY_DECORATIVE; - case psp::family::Modern: return FAMILY_MODERN; - case psp::family::Roman: return FAMILY_ROMAN; - case psp::family::Script: return FAMILY_SCRIPT; - case psp::family::Swiss: return FAMILY_SWISS; - case psp::family::System: return FAMILY_SYSTEM; - case psp::family::Unknown: return FAMILY_DONTKNOW; - default: - OSL_FAIL( "unknown family mapping" ); - break; - } - return FAMILY_DONTKNOW; -} - ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintFontInfo& rInfo ) { ImplDevFontAttributes aDFA; aDFA.maName = rInfo.m_aFamilyName; aDFA.maStyleName = rInfo.m_aStyleName; - aDFA.meFamily = ToFontFamily (rInfo.m_eFamilyStyle); - aDFA.meWeight = ToFontWeight (rInfo.m_eWeight); - aDFA.meItalic = ToFontItalic (rInfo.m_eItalic); - aDFA.meWidthType = ToFontWidth (rInfo.m_eWidth); - aDFA.mePitch = ToFontPitch (rInfo.m_ePitch); + aDFA.meFamily = rInfo.m_eFamilyStyle; + aDFA.meWeight = rInfo.m_eWeight; + aDFA.meItalic = rInfo.m_eItalic; + aDFA.meWidthType = rInfo.m_eWidth; + aDFA.mePitch = rInfo.m_ePitch; aDFA.mbSymbolFlag = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL); aDFA.mbSubsettable = rInfo.m_bSubsettable; aDFA.mbEmbeddable = rInfo.m_bEmbeddable; diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index 0c3babc48fdb..3349e6ef3c01 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -795,7 +795,7 @@ bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::s mbGrey = bMask; bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() ); - bool bFreePixmap; + bool bFreePixmap = false; if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap ) XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle ); diff --git a/vcl/unx/generic/gdi/salcvt.cxx b/vcl/unx/generic/gdi/salcvt.cxx index f757f3fc0ab3..b67b5828bf13 100644 --- a/vcl/unx/generic/gdi/salcvt.cxx +++ b/vcl/unx/generic/gdi/salcvt.cxx @@ -51,7 +51,6 @@ SalConverterCache::~SalConverterCache() // ---> FIXME #include <stdio.h> -// <--- rtl_UnicodeToTextConverter SalConverterCache::GetU2TConverter( rtl_TextEncoding nEncoding ) @@ -66,7 +65,6 @@ SalConverterCache::GetU2TConverter( rtl_TextEncoding nEncoding ) // ---> FIXME if ( rConverter.mpU2T == NULL ) fprintf( stderr, "failed to create Unicode -> %i converter\n", nEncoding); -// <--- } return rConverter.mpU2T; } @@ -86,7 +84,6 @@ SalConverterCache::GetT2UConverter( rtl_TextEncoding nEncoding ) // ---> FIXME if ( rConverter.mpT2U == NULL ) fprintf( stderr, "failed to create %i -> Unicode converter\n", nEncoding ); -// <--- } return rConverter.mpT2U; } @@ -289,7 +286,6 @@ SalConverterCache::EncodingHasChar( rtl_TextEncoding nEncoding, // ---> FIXME if ( aConverter == NULL ) return False; - // <--- sal_Char pConversionBuffer[ 32 ]; sal_uInt32 nConversionInfo; diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx index c60bf49fff0e..8f287521c18b 100644 --- a/vcl/unx/generic/gdi/salgdi3.cxx +++ b/vcl/unx/generic/gdi/salgdi3.cxx @@ -45,6 +45,7 @@ #include "rtl/tencinfo.h" #include "osl/file.hxx" +#include "osl/module.hxx" #include "tools/string.hxx" #include "tools/debug.hxx" @@ -253,7 +254,7 @@ namespace { class CairoWrapper { private: - oslModule mpCairoLib; + osl::Module mpCairoLib; cairo_surface_t* (*mp_xlib_surface_create_with_xrender_format)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int ); void (*mp_surface_destroy)(cairo_surface_t *); @@ -330,7 +331,6 @@ CairoWrapper& CairoWrapper::get() } CairoWrapper::CairoWrapper() -: mpCairoLib( NULL ) { static const char* pDisableCairoText = getenv( "SAL_DISABLE_CAIROTEXT" ); if( pDisableCairoText && (pDisableCairoText[0] != '0') ) @@ -345,8 +345,7 @@ CairoWrapper::CairoWrapper() #else OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" )); #endif - mpCairoLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT ); - if( !mpCairoLib ) + if ( !mpCairoLib.load( aLibName, SAL_LOADMODULE_DEFAULT ) ) return; #ifdef DEBUG @@ -414,8 +413,7 @@ CairoWrapper::CairoWrapper() mp_ft_font_options_substitute ) ) { - osl_unloadModule( mpCairoLib ); - mpCairoLib = NULL; + mpCairoLib.unload(); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "not all needed symbols were found\n" ); #endif @@ -1103,99 +1101,12 @@ void cairosubcallback( void* pPattern ) ImplFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize) { - // TODO: get rid of these insane enum-conversions - // e.g. by using the classic vclenum values inside VCL - psp::FastPrintFontInfo aInfo; - // set family name + aInfo.m_aFamilyName = rFontAttributes.GetFamilyName(); - // set italic - switch( rFontAttributes.GetSlant() ) - { - case ITALIC_NONE: - aInfo.m_eItalic = psp::italic::Upright; - break; - case ITALIC_NORMAL: - aInfo.m_eItalic = psp::italic::Italic; - break; - case ITALIC_OBLIQUE: - aInfo.m_eItalic = psp::italic::Oblique; - break; - default: - aInfo.m_eItalic = psp::italic::Unknown; - break; - } - // set weight - switch( rFontAttributes.GetWeight() ) - { - case WEIGHT_THIN: - aInfo.m_eWeight = psp::weight::Thin; - break; - case WEIGHT_ULTRALIGHT: - aInfo.m_eWeight = psp::weight::UltraLight; - break; - case WEIGHT_LIGHT: - aInfo.m_eWeight = psp::weight::Light; - break; - case WEIGHT_SEMILIGHT: - aInfo.m_eWeight = psp::weight::SemiLight; - break; - case WEIGHT_NORMAL: - aInfo.m_eWeight = psp::weight::Normal; - break; - case WEIGHT_MEDIUM: - aInfo.m_eWeight = psp::weight::Medium; - break; - case WEIGHT_SEMIBOLD: - aInfo.m_eWeight = psp::weight::SemiBold; - break; - case WEIGHT_BOLD: - aInfo.m_eWeight = psp::weight::Bold; - break; - case WEIGHT_ULTRABOLD: - aInfo.m_eWeight = psp::weight::UltraBold; - break; - case WEIGHT_BLACK: - aInfo.m_eWeight = psp::weight::Black; - break; - default: - aInfo.m_eWeight = psp::weight::Unknown; - break; - } - // set width - switch( rFontAttributes.GetWidthType() ) - { - case WIDTH_ULTRA_CONDENSED: - aInfo.m_eWidth = psp::width::UltraCondensed; - break; - case WIDTH_EXTRA_CONDENSED: - aInfo.m_eWidth = psp::width::ExtraCondensed; - break; - case WIDTH_CONDENSED: - aInfo.m_eWidth = psp::width::Condensed; - break; - case WIDTH_SEMI_CONDENSED: - aInfo.m_eWidth = psp::width::SemiCondensed; - break; - case WIDTH_NORMAL: - aInfo.m_eWidth = psp::width::Normal; - break; - case WIDTH_SEMI_EXPANDED: - aInfo.m_eWidth = psp::width::SemiExpanded; - break; - case WIDTH_EXPANDED: - aInfo.m_eWidth = psp::width::Expanded; - break; - case WIDTH_EXTRA_EXPANDED: - aInfo.m_eWidth = psp::width::ExtraExpanded; - break; - case WIDTH_ULTRA_EXPANDED: - aInfo.m_eWidth = psp::width::UltraExpanded; - break; - default: - aInfo.m_eWidth = psp::width::Unknown; - break; - } + aInfo.m_eItalic = rFontAttributes.GetSlant(); + aInfo.m_eWeight = rFontAttributes.GetWeight(); + aInfo.m_eWidth = rFontAttributes.GetWidthType(); const psp::PrintFontManager& rPFM = psp::PrintFontManager::get(); return rPFM.getFontOptions(aInfo, nSize, cairosubcallback); @@ -1465,120 +1376,18 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData const rtl::OString aLangAttrib = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage ); - psp::italic::type eItalic = psp::italic::Unknown; - if( rFontSelData.GetSlant() != ITALIC_DONTKNOW ) - { - switch( rFontSelData.GetSlant() ) - { - case ITALIC_NONE: eItalic = psp::italic::Upright; break; - case ITALIC_NORMAL: eItalic = psp::italic::Italic; break; - case ITALIC_OBLIQUE: eItalic = psp::italic::Oblique; break; - default: - break; - } - } - - psp::weight::type eWeight = psp::weight::Unknown; - if( rFontSelData.GetWeight() != WEIGHT_DONTKNOW ) - { - switch( rFontSelData.GetWeight() ) - { - case WEIGHT_THIN: eWeight = psp::weight::Thin; break; - case WEIGHT_ULTRALIGHT: eWeight = psp::weight::UltraLight; break; - case WEIGHT_LIGHT: eWeight = psp::weight::Light; break; - case WEIGHT_SEMILIGHT: eWeight = psp::weight::SemiLight; break; - case WEIGHT_NORMAL: eWeight = psp::weight::Normal; break; - case WEIGHT_MEDIUM: eWeight = psp::weight::Medium; break; - case WEIGHT_SEMIBOLD: eWeight = psp::weight::SemiBold; break; - case WEIGHT_BOLD: eWeight = psp::weight::Bold; break; - case WEIGHT_ULTRABOLD: eWeight = psp::weight::UltraBold; break; - case WEIGHT_BLACK: eWeight = psp::weight::Black; break; - default: - break; - } - } - - psp::width::type eWidth = psp::width::Unknown; - if( rFontSelData.GetWidthType() != WIDTH_DONTKNOW ) - { - switch( rFontSelData.GetWidthType() ) - { - case WIDTH_ULTRA_CONDENSED: eWidth = psp::width::UltraCondensed; break; - case WIDTH_EXTRA_CONDENSED: eWidth = psp::width::ExtraCondensed; break; - case WIDTH_CONDENSED: eWidth = psp::width::Condensed; break; - case WIDTH_SEMI_CONDENSED: eWidth = psp::width::SemiCondensed; break; - case WIDTH_NORMAL: eWidth = psp::width::Normal; break; - case WIDTH_SEMI_EXPANDED: eWidth = psp::width::SemiExpanded; break; - case WIDTH_EXPANDED: eWidth = psp::width::Expanded; break; - case WIDTH_EXTRA_EXPANDED: eWidth = psp::width::ExtraExpanded; break; - case WIDTH_ULTRA_EXPANDED: eWidth = psp::width::UltraExpanded; break; - default: - break; - } - } - - psp::pitch::type ePitch = psp::pitch::Unknown; - if( rFontSelData.GetPitch() != PITCH_DONTKNOW ) - { - switch( rFontSelData.GetPitch() ) - { - case PITCH_FIXED: ePitch=psp::pitch::Fixed; break; - case PITCH_VARIABLE: ePitch=psp::pitch::Variable; break; - default: - break; - } - } + FontItalic eItalic = rFontSelData.GetSlant(); + FontWeight eWeight = rFontSelData.GetWeight(); + FontWidth eWidth = rFontSelData.GetWidthType(); + FontPitch ePitch = rFontSelData.GetPitch(); const psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch); - switch (eItalic) - { - case psp::italic::Upright: aRet.meItalic = ITALIC_NONE; break; - case psp::italic::Italic: aRet.meItalic = ITALIC_NORMAL; break; - case psp::italic::Oblique: aRet.meItalic = ITALIC_OBLIQUE; break; - default: - break; - } - - switch (eWeight) - { - case psp::weight::Thin: aRet.meWeight = WEIGHT_THIN; break; - case psp::weight::UltraLight: aRet.meWeight = WEIGHT_ULTRALIGHT; break; - case psp::weight::Light: aRet.meWeight = WEIGHT_LIGHT; break; - case psp::weight::SemiLight: aRet.meWeight = WEIGHT_SEMILIGHT; break; - case psp::weight::Normal: aRet.meWeight = WEIGHT_NORMAL; break; - case psp::weight::Medium: aRet.meWeight = WEIGHT_MEDIUM; break; - case psp::weight::SemiBold: aRet.meWeight = WEIGHT_SEMIBOLD; break; - case psp::weight::Bold: aRet.meWeight = WEIGHT_BOLD; break; - case psp::weight::UltraBold: aRet.meWeight = WEIGHT_ULTRABOLD; break; - case psp::weight::Black: aRet.meWeight = WEIGHT_BLACK; break; - default: - break; - } - - switch (eWidth) - { - case psp::width::UltraCondensed: aRet.meWidthType = WIDTH_ULTRA_CONDENSED; break; - case psp::width::ExtraCondensed: aRet.meWidthType = WIDTH_EXTRA_CONDENSED; break; - case psp::width::Condensed: aRet.meWidthType = WIDTH_CONDENSED; break; - case psp::width::SemiCondensed: aRet.meWidthType = WIDTH_SEMI_CONDENSED; break; - case psp::width::Normal: aRet.meWidthType = WIDTH_NORMAL; break; - case psp::width::SemiExpanded: aRet.meWidthType = WIDTH_SEMI_EXPANDED; break; - case psp::width::Expanded: aRet.meWidthType = WIDTH_EXPANDED; break; - case psp::width::ExtraExpanded: aRet.meWidthType = WIDTH_EXTRA_EXPANDED; break; - case psp::width::UltraExpanded: aRet.meWidthType = WIDTH_ULTRA_EXPANDED; break; - default: - break; - } - - switch (ePitch) - { - case psp::pitch::Fixed: aRet.mePitch = PITCH_FIXED; break; - case psp::pitch::Variable: aRet.mePitch = PITCH_VARIABLE; break; - default: - break; - } + aRet.meItalic = eItalic; + aRet.meWeight = eWeight; + aRet.meWidthType = eWidth; + aRet.mePitch = ePitch; return aRet; } diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 476ea135e570..2f3b25e0ac6a 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -228,16 +228,16 @@ SalInstance *CreateSalInstance() static const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" ); - if( !(pUsePlugin && *pUsePlugin) ) - pInst = check_headless_plugin(); - else + pInst = check_headless_plugin(); + + if( !pInst && pUsePlugin && *pUsePlugin ) pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) ); if( ! pInst ) pInst = autodetect_plugin(); // fallback, try everything - const char* pPlugin[] = { "gtk", "kde", "gen", 0 }; + const char* pPlugin[] = { "gtk", "kde4", "kde", "gen", 0 }; for ( int i = 0; !pInst && pPlugin[ i ]; ++i ) pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) ); diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 0982b219bade..03d676470ecb 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -168,9 +168,10 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes ) // now append the PPDContext stream buffer aStream.WriteLine( "PPDContexData" ); sal_uLong nBytes; - void* pContextBuffer = m_aContext.getStreamableBuffer( nBytes ); + char* pContextBuffer = m_aContext.getStreamableBuffer( nBytes ); if( nBytes ) aStream.Write( pContextBuffer, nBytes ); + delete [] pContextBuffer; // success pData = rtl_allocateMemory( bytes = aStream.Tell() ); @@ -252,7 +253,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa { rJobData.m_aContext.setParser( rJobData.m_pParser ); int nBytes = bytes - aStream.Tell(); - void* pRemain = alloca( bytes - aStream.Tell() ); + char* pRemain = (char*)alloca( bytes - aStream.Tell() ); aStream.Read( pRemain, nBytes ); rJobData.m_aContext.rebuildFromStreamBuffer( pRemain, nBytes ); bContext = true; diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 30d4598568d2..6133df14c88b 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -401,7 +401,7 @@ static osl::FileBase::RC resolveLink( const rtl::OUString& i_rURL, rtl::OUString if( ( aRet = osl::DirectoryItem::get( i_rURL, aLinkItem ) ) == osl::FileBase::E_None ) { - osl::FileStatus aStatus( FileStatusMask_FileName | FileStatusMask_Type | FileStatusMask_LinkTargetURL ); + osl::FileStatus aStatus( osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL ); if( ( aRet = aLinkItem.getFileStatus( aStatus ) ) == osl::FileBase::E_None ) { if( aStatus.getFileType() == osl::FileStatus::Link ) @@ -443,7 +443,7 @@ void PPDParser::scanPPDDir( const String& rDir ) INetURLObject aPPDDir(rDir); while( aDir.getNextItem( aItem ) == osl::FileBase::E_None ) { - osl::FileStatus aStatus( FileStatusMask_FileName ); + osl::FileStatus aStatus( osl_FileStatus_Mask_FileName ); if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) { rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 ); @@ -655,7 +655,7 @@ const PPDParser* PPDParser::getParser( const String& rFile ) if( ! aFile.Len() ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Could not get printer PPD file \"%s\" !\n", OUStringToOString( rFile, osl_getThreadTextEncoding() ).getStr() ); + fprintf( stderr, "Could not get printer PPD file \"%s\" !\n", ::rtl::OUStringToOString( rFile, osl_getThreadTextEncoding() ).getStr() ); #endif return NULL; } @@ -2052,7 +2052,7 @@ void PPDContext::getUnconstrainedValues( const PPDKey* pKey, ::std::list< const // ------------------------------------------------------------------- -void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const +char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const { rBytes = 0; if( ! m_aCurrentValues.size() ) @@ -2073,9 +2073,9 @@ void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const rBytes += 1; // for '\0' } rBytes += 1; - void* pBuffer = new char[ rBytes ]; + char* pBuffer = new char[ rBytes ]; memset( pBuffer, 0, rBytes ); - char* pRun = (char*)pBuffer; + char* pRun = pBuffer; for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it ) { ByteString aCopy( it->first->getKey(), RTL_TEXTENCODING_MS_1252 ); @@ -2098,14 +2098,14 @@ void* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const // ------------------------------------------------------------------- -void PPDContext::rebuildFromStreamBuffer( void* pBuffer, sal_uLong nBytes ) +void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) { if( ! m_pParser ) return; m_aCurrentValues.clear(); - char* pRun = (char*)pBuffer; + char* pRun = pBuffer; while( nBytes && *pRun ) { ByteString aLine( pRun ); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 4a7374c41b7b..eda102cb54a7 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -195,7 +195,7 @@ bool PrinterInfoManager::checkPrintersChanged( bool bWait ) } else { - FileStatus aStatus( FileStatusMask_ModifyTime ); + FileStatus aStatus( osl_FileStatus_Mask_ModifyTime ); if( aItem.getFileStatus( aStatus ) ) bChanged = true; // unlikely but not impossible else @@ -371,7 +371,7 @@ void PrinterInfoManager::initialize() FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), aUniPath ); - FileStatus aStatus( FileStatusMask_ModifyTime ); + FileStatus aStatus( osl_FileStatus_Mask_ModifyTime ); DirectoryItem aItem; // setup WatchFile list @@ -1158,7 +1158,7 @@ void PrinterInfoManager::setDefaultPaper( PPDContext& rContext ) const { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "not setting default paper, already set %s\n", - OUStringToOString( rContext.getValue( pPageSizeKey )->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + ::rtl::OUStringToOString( rContext.getValue( pPageSizeKey )->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif return; } @@ -1175,12 +1175,12 @@ void PrinterInfoManager::setDefaultPaper( PPDContext& rContext ) const if( pPaperVal ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "setting default paper %s\n", OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + fprintf( stderr, "setting default paper %s\n", ::rtl::OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif rContext.setValue( pPageSizeKey, pPaperVal ); #if OSL_DEBUG_LEVEL > 1 pPaperVal = rContext.getValue( pPageSizeKey ); - fprintf( stderr, "-> got paper %s\n", OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); + fprintf( stderr, "-> got paper %s\n", ::rtl::OUStringToOString( pPaperVal->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); #endif } } diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 124c0f6cadbb..0164d27ba185 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -566,4 +566,4 @@ void X11SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) { } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx index 3adca0f55279..05d4cc279130 100644 --- a/vcl/unx/gtk/a11y/atklistener.cxx +++ b/vcl/unx/gtk/a11y/atklistener.cxx @@ -364,7 +364,7 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven break; } - // --> OD 2009-05-26 #i92103# + // #i92103# case accessibility::AccessibleEventId::LISTBOX_ENTRY_EXPANDED: { AtkObject *pChild = getObjFromAny( aEvent.NewValue ); @@ -388,7 +388,6 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven } break; } - // <-- // AtkAction signals ... case accessibility::AccessibleEventId::ACTION_CHANGED: diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index bcf880160224..359d2f0cc62c 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -144,9 +144,8 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] = "CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH "CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE "CharWeight", // TEXT_ATTRIBUTE_WEIGHT - // --> OD 2010-03-05 #i92233# + // #i92233# "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO - // <-- "ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION "ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN "ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index f7e849e44e87..78e0cb05d4de 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -41,7 +41,6 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> -// <-- #include <cppuhelper/implbase1.hxx> #include <osl/mutex.hxx> #include <rtl/ref.hxx> @@ -66,7 +65,14 @@ using namespace ::com::sun::star; -static uno::WeakReference< accessibility::XAccessible > xNextFocusObject; +namespace +{ + struct theNextFocusObject : + public rtl::Static< uno::WeakReference< accessibility::XAccessible >, theNextFocusObject> + { + }; +} + static guint focus_notify_handler = 0; /*****************************************************************************/ @@ -80,7 +86,7 @@ atk_wrapper_focus_idle_handler (gpointer data) focus_notify_handler = 0; - uno::Reference< accessibility::XAccessible > xAccessible = xNextFocusObject; + uno::Reference< accessibility::XAccessible > xAccessible = theNextFocusObject::get(); if( xAccessible.get() == reinterpret_cast < accessibility::XAccessible * > (data) ) { AtkObject *atk_obj = xAccessible.is() ? atk_object_wrapper_ref( xAccessible ) : NULL; @@ -135,7 +141,7 @@ atk_wrapper_focus_tracker_notify_when_idle( const uno::Reference< accessibility: if( focus_notify_handler ) g_source_remove(focus_notify_handler); - xNextFocusObject = xAccessible; + theNextFocusObject::get() = xAccessible; focus_notify_handler = g_idle_add (atk_wrapper_focus_idle_handler, xAccessible.get()); } @@ -664,7 +670,7 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) default: break; } - } catch(lang::IndexOutOfBoundsException e) + } catch(lang::IndexOutOfBoundsException) { g_warning("Focused object has invalid index in parent"); } diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index f4e0badab1f4..7ccf07b57488 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -313,7 +313,7 @@ static AtkRole mapToAtkRole( sal_Int16 nRole ) initialized = true; } - static const sal_Int32 nMapSize = sizeof(roleMap)/sizeof(sal_Int16); + static const sal_Int32 nMapSize = SAL_N_ELEMENTS(roleMap); if( 0 <= nRole && nMapSize > nRole ) role = roleMap[nRole]; diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index ab172a5ef3ef..c2c0b54faf78 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -71,6 +71,15 @@ using ::rtl::OUString; /*************************************************************************** * class GtkDisplay * ***************************************************************************/ +extern "C" { +GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event, + GdkEvent* event, + gpointer data ) +{ + GtkSalDisplay *pDisplay = (GtkSalDisplay *)data; + return pDisplay->filterGdkEvent( sys_event, event ); +} +} GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) : SalDisplay( gdk_x11_display_get_xdisplay( pDisplay ) ), @@ -81,10 +90,14 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) for(int i = 0; i < POINTER_COUNT; i++) m_aCursors[ i ] = NULL; Init (); + + gdk_window_add_filter( NULL, call_filterGdkEvent, this ); } GtkSalDisplay::~GtkSalDisplay() { + gdk_window_remove_filter( NULL, call_filterGdkEvent, this ); + if( !m_bStartupCompleted ) gdk_notify_startup_complete(); doDestruct(); @@ -107,12 +120,6 @@ void GtkSalDisplay::deregisterFrame( SalFrame* pFrame ) } extern "C" { -GdkFilterReturn call_filterGdkEvent( GdkXEvent* sys_event, - GdkEvent* event, - gpointer data ) -{ - return GtkSalDisplay::filterGdkEvent( sys_event, event, data ); -} void signalKeysChanged( GdkKeymap*, gpointer data ) { @@ -135,13 +142,10 @@ void signalMonitorsChanged( GdkScreen* pScreen, gpointer data ) } GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, - GdkEvent*, - gpointer data ) + GdkEvent* ) { GdkFilterReturn aFilterReturn = GDK_FILTER_CONTINUE; - XEvent *pEvent = (XEvent *)sys_event; - GtkSalDisplay *pDisplay = (GtkSalDisplay *)data; // dispatch all XEvents to event callback if( GetSalData()->m_pInstance-> @@ -150,7 +154,7 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, GTK_YIELD_GRAB(); - if (pDisplay->GetDisplay() == pEvent->xany.display ) + if (GetDisplay() == pEvent->xany.display ) { // #i53471# gtk has no callback mechanism that lets us be notified // when settings (as in XSETTING and opposed to styles) are changed. @@ -158,16 +162,16 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, // these should be rare enough so that we can assume that the settings // actually change when a corresponding PropertyNotify occurs if( pEvent->type == PropertyNotify && - pEvent->xproperty.atom == pDisplay->getWMAdaptor()->getAtom( WMAdaptor::XSETTINGS ) && - ! pDisplay->m_aFrames.empty() + pEvent->xproperty.atom == getWMAdaptor()->getAtom( WMAdaptor::XSETTINGS ) && + ! m_aFrames.empty() ) { - pDisplay->SendInternalEvent( pDisplay->m_aFrames.front(), NULL, SALEVENT_SETTINGSCHANGED ); + SendInternalEvent( m_aFrames.front(), NULL, SALEVENT_SETTINGSCHANGED ); } // let's see if one of our frames wants to swallow these events // get the frame - for( std::list< SalFrame* >::const_iterator it = pDisplay->m_aFrames.begin(); - it != pDisplay->m_aFrames.end(); ++it ) + for( std::list< SalFrame* >::const_iterator it = m_aFrames.begin(); + it != m_aFrames.end(); ++it ) { GtkSalFrame* pFrame = static_cast<GtkSalFrame*>(*it); if( (GdkNativeWindow)pFrame->GetSystemData()->aWindow == pEvent->xany.window || @@ -358,7 +362,7 @@ GdkCursor* GtkSalDisplay::getFromXPM( const unsigned char *pBitmap, GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle ) { - if( ePointerStyle > POINTER_COUNT ) + if( ePointerStyle >= POINTER_COUNT ) return NULL; if ( !m_aCursors[ ePointerStyle ] ) @@ -465,17 +469,15 @@ GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle ) MAKE_CURSOR( POINTER_AIRBRUSH, airbrush_ ); MAKE_CURSOR( POINTER_TEXT_VERTICAL, vertcurs_ ); - // --> FME 2004-07-30 #i32329# Enhanced table selection + // #i32329# MAKE_CURSOR( POINTER_TAB_SELECT_S, tblsels_ ); MAKE_CURSOR( POINTER_TAB_SELECT_E, tblsele_ ); MAKE_CURSOR( POINTER_TAB_SELECT_SE, tblselse_ ); MAKE_CURSOR( POINTER_TAB_SELECT_W, tblselw_ ); MAKE_CURSOR( POINTER_TAB_SELECT_SW, tblselsw_ ); - // <-- - // --> FME 2004-08-16 #i20119# Paintbrush tool + // #i20119# MAKE_CURSOR( POINTER_PAINTBRUSH, paintbrush_ ); - // <-- default: fprintf( stderr, "pointer %d not implemented", ePointerStyle ); @@ -686,8 +688,6 @@ void GtkXLib::Init() m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp ); - gdk_window_add_filter( NULL, call_filterGdkEvent, m_pGtkSalDisplay ); - PushXErrorLevel( true ); SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp ); XSync( pDisp, False ); diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index ca578dccead9..4f3677b742b1 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -46,6 +46,7 @@ #include <algorithm> #include <boost/unordered_map.hpp> +#include "vcl/vclenum.hxx" typedef struct _cairo_font_options cairo_font_options_t; // initialize statics @@ -95,6 +96,7 @@ struct NWFWidgetData GtkWidget * gMenuItemMenuWidget; GtkWidget * gMenuItemCheckMenuWidget; GtkWidget * gMenuItemRadioMenuWidget; + GtkWidget * gMenuItemSeparatorMenuWidget; GtkWidget * gImageMenuItem; GtkWidget * gTooltipPopup; GtkWidget * gProgressBar; @@ -134,6 +136,7 @@ struct NWFWidgetData gMenuItemMenuWidget( NULL ), gMenuItemCheckMenuWidget( NULL ), gMenuItemRadioMenuWidget( NULL ), + gMenuItemSeparatorMenuWidget( NULL ), gImageMenuItem( NULL ), gTooltipPopup( NULL ), gProgressBar( NULL ), @@ -374,7 +377,7 @@ void NWPixmapCacheList::ThemeChanged( ) while( p != mCaches.end() ) { (*p)->ThemeChanged(); - p++; + ++p; } } @@ -582,6 +585,8 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar || (nPart==PART_MENU_ITEM) || (nPart==PART_MENU_ITEM_CHECK_MARK) || (nPart==PART_MENU_ITEM_RADIO_MARK) + || (nPart==PART_MENU_SEPARATOR) + || (nPart==PART_MENU_SUBMENU_ARROW) ) ) || ((nType == CTRL_PROGRESS) && @@ -848,6 +853,8 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, || (nPart == PART_MENU_ITEM) || (nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == PART_MENU_ITEM_RADIO_MARK) + || (nPart == PART_MENU_SEPARATOR) + || (nPart == PART_MENU_SUBMENU_ARROW) ) ) { @@ -1021,6 +1028,42 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = aIndicatorRect; returnVal = sal_True; } + else if( nPart == PART_MENU_SUBMENU_ARROW ) + { + GtkWidget* widget = gWidgetData[m_nScreen].gMenuItemMenuWidget; + GtkWidget* child; + PangoContext *context; + PangoFontMetrics *metrics; + gint arrow_size; + gint arrow_extent; + guint horizontal_padding; + gfloat arrow_scaling; + + gtk_widget_style_get( widget, + "horizontal-padding", &horizontal_padding, + "arrow-scaling", &arrow_scaling, + NULL ); + + child = GTK_BIN( widget )->child; + + context = gtk_widget_get_pango_context( child ); + metrics = pango_context_get_metrics( context, + child->style->font_desc, + pango_context_get_language( context ) ); + + arrow_size = ( PANGO_PIXELS( pango_font_metrics_get_ascent( metrics ) + + pango_font_metrics_get_descent( metrics ) )); + + pango_font_metrics_unref( metrics ); + + arrow_extent = static_cast<gint>(arrow_size * arrow_scaling); + + rNativeContentRegion = Rectangle( Point( 0, 0 ), + Size( arrow_extent, arrow_extent )); + rNativeBoundingRegion = Rectangle( Point( 0, 0 ), + Size( arrow_extent + horizontal_padding, arrow_extent )); + returnVal = sal_True; + } } if( (nType == CTRL_RADIOBUTTON || nType == CTRL_CHECKBOX) ) { @@ -2804,6 +2847,42 @@ sal_Bool GtkSalGraphics::NWPaintGTKPopupMenu( x, y, w, h ); } } + else if( nPart == PART_MENU_SEPARATOR ) + { + gtk_paint_hline( gWidgetData[m_nScreen].gMenuItemSeparatorMenuWidget->style, + gdkDrawable, + GTK_STATE_NORMAL, + &clipRect, + gWidgetData[m_nScreen].gMenuItemSeparatorMenuWidget, + "menuitem", + x, x + w, y + h / 2); + } + else if( nPart == PART_MENU_SUBMENU_ARROW ) + { + GtkStateType nStateType = GTK_STATE_NORMAL; + GtkShadowType nShadowType; + + if ( nState & CTRL_STATE_SELECTED ) + nStateType = GTK_STATE_PRELIGHT; + + NWSetWidgetState( gWidgetData[m_nScreen].gMenuItemMenuWidget, + nState, nStateType ); + + if ( nState & CTRL_STATE_PRESSED ) + nShadowType = GTK_SHADOW_IN; + else + nShadowType = GTK_SHADOW_OUT; + + gtk_paint_arrow( gWidgetData[m_nScreen].gMenuItemMenuWidget->style, + gdkDrawable, + nStateType, + nShadowType, + &clipRect, + gWidgetData[m_nScreen].gMenuItemMenuWidget, + "menuitem", + GTK_ARROW_RIGHT, TRUE, + x, y, w, h); + } } return( sal_True ); @@ -3245,6 +3324,12 @@ void printStyleColors( GtkStyle* pStyle ) void GtkSalGraphics::updateSettings( AllSettings& rSettings ) { + GdkScreen* pScreen = gtk_widget_get_screen( m_pWindow ); + gtk_widget_ensure_style( m_pWindow ); + GtkStyle* pStyle = gtk_widget_get_style( m_pWindow ); + GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow ); + StyleSettings aStyleSet = rSettings.GetStyleSettings(); + // get the widgets in place NWEnsureGTKMenu( m_nScreen ); NWEnsureGTKMenubar( m_nScreen ); @@ -3252,11 +3337,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) NWEnsureGTKEditBox( m_nScreen ); NWEnsureGTKTooltip( m_nScreen ); - gtk_widget_ensure_style( m_pWindow ); - GtkStyle* pStyle = gtk_widget_get_style( m_pWindow ); - - StyleSettings aStyleSet = rSettings.GetStyleSettings(); - #if OSL_DEBUG_LEVEL > 2 printStyleColors( pStyle ); #endif @@ -3291,19 +3371,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetWorkspaceColor( aBackColor ); aStyleSet.SetFieldColor( aBackFieldColor ); aStyleSet.SetWindowColor( aBackFieldColor ); -// aStyleSet.SetHelpColor( aBackColor ); - // ancient wisdom tells us a mystic algorithm how to set checked color - if( aBackColor == COL_LIGHTGRAY ) - aStyleSet.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = aStyleSet.GetLightColor(); - Color aCheck( (sal_uInt8)(((sal_uInt16)aBackColor.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBackColor.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBackColor.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ); - aStyleSet.SetCheckedColor( aCheck ); - } + aStyleSet.SetCheckedColorSpecialCase( ); // highlighting colors Color aHighlightColor = getColor( pStyle->base[GTK_STATE_SELECTED] ); @@ -3399,33 +3467,33 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // set italic switch( eStyle ) { - case PANGO_STYLE_NORMAL: aInfo.m_eItalic = psp::italic::Upright;break; - case PANGO_STYLE_ITALIC: aInfo.m_eItalic = psp::italic::Italic;break; - case PANGO_STYLE_OBLIQUE: aInfo.m_eItalic = psp::italic::Oblique;break; + case PANGO_STYLE_NORMAL: aInfo.m_eItalic = ITALIC_NONE;break; + case PANGO_STYLE_ITALIC: aInfo.m_eItalic = ITALIC_NORMAL;break; + case PANGO_STYLE_OBLIQUE: aInfo.m_eItalic = ITALIC_OBLIQUE;break; } // set weight if( eWeight <= PANGO_WEIGHT_ULTRALIGHT ) - aInfo.m_eWeight = psp::weight::UltraLight; + aInfo.m_eWeight = WEIGHT_ULTRALIGHT; else if( eWeight <= PANGO_WEIGHT_LIGHT ) - aInfo.m_eWeight = psp::weight::Light; + aInfo.m_eWeight = WEIGHT_LIGHT; else if( eWeight <= PANGO_WEIGHT_NORMAL ) - aInfo.m_eWeight = psp::weight::Normal; + aInfo.m_eWeight = WEIGHT_NORMAL; else if( eWeight <= PANGO_WEIGHT_BOLD ) - aInfo.m_eWeight = psp::weight::Bold; + aInfo.m_eWeight = WEIGHT_BOLD; else - aInfo.m_eWeight = psp::weight::UltraBold; + aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width switch( eStretch ) { - case PANGO_STRETCH_ULTRA_CONDENSED: aInfo.m_eWidth = psp::width::UltraCondensed;break; - case PANGO_STRETCH_EXTRA_CONDENSED: aInfo.m_eWidth = psp::width::ExtraCondensed;break; - case PANGO_STRETCH_CONDENSED: aInfo.m_eWidth = psp::width::Condensed;break; - case PANGO_STRETCH_SEMI_CONDENSED: aInfo.m_eWidth = psp::width::SemiCondensed;break; - case PANGO_STRETCH_NORMAL: aInfo.m_eWidth = psp::width::Normal;break; - case PANGO_STRETCH_SEMI_EXPANDED: aInfo.m_eWidth = psp::width::SemiExpanded;break; - case PANGO_STRETCH_EXPANDED: aInfo.m_eWidth = psp::width::Expanded;break; - case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = psp::width::ExtraExpanded;break; - case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = psp::width::UltraExpanded;break; + case PANGO_STRETCH_ULTRA_CONDENSED: aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;break; + case PANGO_STRETCH_EXTRA_CONDENSED: aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;break; + case PANGO_STRETCH_CONDENSED: aInfo.m_eWidth = WIDTH_CONDENSED;break; + case PANGO_STRETCH_SEMI_CONDENSED: aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;break; + case PANGO_STRETCH_NORMAL: aInfo.m_eWidth = WIDTH_NORMAL;break; + case PANGO_STRETCH_SEMI_EXPANDED: aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;break; + case PANGO_STRETCH_EXPANDED: aInfo.m_eWidth = WIDTH_EXPANDED;break; + case PANGO_STRETCH_EXTRA_EXPANDED: aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;break; + case PANGO_STRETCH_ULTRA_EXPANDED: aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;break; } #if OSL_DEBUG_LEVEL > 1 @@ -3452,14 +3520,14 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) nPointHeight = nPangoHeight/PANGO_SCALE; Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != psp::weight::Unknown ) - aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); - if( aInfo.m_eWidth != psp::width::Unknown ) - aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) ); - if( aInfo.m_eItalic != psp::italic::Unknown ) - aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) ); - if( aInfo.m_ePitch != psp::pitch::Unknown ) - aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) ); + if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) + aFont.SetWeight( aInfo.m_eWeight ); + if( aInfo.m_eWidth != WIDTH_DONTKNOW ) + aFont.SetWidthType( aInfo.m_eWidth ); + if( aInfo.m_eItalic != ITALIC_DONTKNOW ) + aFont.SetItalic( aInfo.m_eItalic ); + if( aInfo.m_ePitch != PITCH_DONTKNOW ) + aFont.SetPitch( aInfo.m_ePitch ); aStyleSet.SetAppFont( aFont ); aStyleSet.SetHelpFont( aFont ); @@ -3478,7 +3546,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetFloatTitleFont( aFont ); // get cursor blink time - GtkSettings *pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gEditBoxWidget ); gboolean blink = false; g_object_get( pSettings, "gtk-cursor-blink", &blink, (char *)NULL ); @@ -3494,8 +3561,23 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) else aStyleSet.SetCursorBlinkTime( STYLE_CURSOR_NOBLINKTIME ); + MouseSettings aMouseSettings = rSettings.GetMouseSettings(); + int iDoubleClickTime, iDoubleClickDistance, iDragThreshold, iMenuPopupDelay; + g_object_get( pSettings, + "gtk-double-click-time", &iDoubleClickTime, + "gtk-double-click-distance", &iDoubleClickDistance, + "gtk-dnd-drag-threshold", &iDragThreshold, + "gtk-menu-popup-delay", &iMenuPopupDelay, + (char *)NULL ); + aMouseSettings.SetDoubleClickTime( iDoubleClickTime ); + aMouseSettings.SetDoubleClickWidth( iDoubleClickDistance ); + aMouseSettings.SetDoubleClickHeight( iDoubleClickDistance ); + aMouseSettings.SetStartDragWidth( iDragThreshold ); + aMouseSettings.SetStartDragHeight( iDragThreshold ); + aMouseSettings.SetMenuDelay( iMenuPopupDelay ); + rSettings.SetMouseSettings( aMouseSettings ); + gboolean showmenuicons = true; - pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gImageMenuItem ); g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL ); aStyleSet.SetPreferredUseImagesInMenus( showmenuicons ); @@ -3516,45 +3598,29 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // preferred icon style gchar* pIconThemeName = NULL; - g_object_get( gtk_settings_get_default(), "gtk-icon-theme-name", &pIconThemeName, (char *)NULL ); + g_object_get( pSettings, "gtk-icon-theme-name", &pIconThemeName, (char *)NULL ); aStyleSet.SetPreferredSymbolsStyleName( OUString::createFromAscii( pIconThemeName ) ); g_free( pIconThemeName ); aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE ); const cairo_font_options_t* pNewOptions = NULL; - if( GdkScreen* pScreen = gdk_display_get_screen( gdk_display_get_default(), m_nScreen ) ) - { #if !GTK_CHECK_VERSION(2,9,0) static cairo_font_options_t* (*gdk_screen_get_font_options)(GdkScreen*) = (cairo_font_options_t*(*)(GdkScreen*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" ); if( gdk_screen_get_font_options != NULL ) #endif pNewOptions = gdk_screen_get_font_options( pScreen ); - } aStyleSet.SetCairoFontOptions( pNewOptions ); // finally update the collected settings rSettings.SetStyleSettings( aStyleSet ); + gchar* pThemeName = NULL; + g_object_get( pSettings, "gtk-theme-name", &pThemeName, (char *)NULL ); #if OSL_DEBUG_LEVEL > 1 - { - GtkSettings* pGtkSettings = gtk_settings_get_default(); - GValue aValue; - memset( &aValue, 0, sizeof(GValue) ); - g_value_init( &aValue, G_TYPE_STRING ); - g_object_get_property( G_OBJECT(pGtkSettings), "gtk-theme-name", &aValue ); - const gchar* pThemeName = g_value_get_string( &aValue ); - std::fprintf( stderr, "Theme name is \"%s\"\n", pThemeName ); - g_value_unset( &aValue ); - } + std::fprintf( stderr, "Theme name is \"%s\"\n", pThemeName ); #endif - GtkSettings* pGtkSettings = gtk_settings_get_default(); - GValue aValue; - memset( &aValue, 0, sizeof(GValue) ); - g_value_init( &aValue, G_TYPE_STRING ); - g_object_get_property( G_OBJECT(pGtkSettings), "gtk-theme-name", &aValue ); - const gchar* pThemeName = g_value_get_string( &aValue ); // default behaviour bNeedPixmapPaint = bGlobalNeedPixmapPaint; @@ -3579,7 +3645,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) } } // clean up - g_value_unset( &aValue ); + g_free (pThemeName); } @@ -3943,15 +4009,17 @@ static void NWEnsureGTKMenu( int nScreen ) { if( !gWidgetData[nScreen].gMenuWidget ) { - gWidgetData[nScreen].gMenuWidget = gtk_menu_new(); - gWidgetData[nScreen].gMenuItemMenuWidget = gtk_menu_item_new_with_label( "b" ); - gWidgetData[nScreen].gMenuItemCheckMenuWidget = gtk_check_menu_item_new_with_label( "b" ); - gWidgetData[nScreen].gMenuItemRadioMenuWidget = gtk_radio_menu_item_new_with_label( NULL, "b" ); - gWidgetData[nScreen].gImageMenuItem = gtk_image_menu_item_new(); + gWidgetData[nScreen].gMenuWidget = gtk_menu_new(); + gWidgetData[nScreen].gMenuItemMenuWidget = gtk_menu_item_new_with_label( "b" ); + gWidgetData[nScreen].gMenuItemCheckMenuWidget = gtk_check_menu_item_new_with_label( "b" ); + gWidgetData[nScreen].gMenuItemRadioMenuWidget = gtk_radio_menu_item_new_with_label( NULL, "b" ); + gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = gtk_menu_item_new(); + gWidgetData[nScreen].gImageMenuItem = gtk_image_menu_item_new(); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemMenuWidget ); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemCheckMenuWidget ); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemRadioMenuWidget ); + gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); gtk_menu_shell_append( GTK_MENU_SHELL( gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gImageMenuItem ); // do what NWAddWidgetToCacheWindow does except adding to def container @@ -3967,6 +4035,9 @@ static void NWEnsureGTKMenu( int nScreen ) gtk_widget_realize( gWidgetData[nScreen].gMenuItemRadioMenuWidget ); gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemRadioMenuWidget ); + gtk_widget_realize( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); + gtk_widget_ensure_style( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); + gtk_widget_realize( gWidgetData[nScreen].gImageMenuItem ); gtk_widget_ensure_style( gWidgetData[nScreen].gImageMenuItem ); @@ -3974,6 +4045,7 @@ static void NWEnsureGTKMenu( int nScreen ) gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemMenuWidget ); gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemCheckMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemCheckMenuWidget ); gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemRadioMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemRadioMenuWidget ); + gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gMenuItemSeparatorMenuWidget ); gWidgetDefaultFlags[ (long)gWidgetData[nScreen].gImageMenuItem ] = GTK_WIDGET_FLAGS( gWidgetData[nScreen].gImageMenuItem ); } } diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index fb0228c4339e..a15557ef0cab 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -725,13 +725,13 @@ sal_uInt16 PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel bool bArtBold = false; if( pEntry->meItalic == ITALIC_OBLIQUE || pEntry->meItalic == ITALIC_NORMAL ) { - psp::italic::type eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); - if( eItalic != psp::italic::Italic && eItalic != psp::italic::Oblique ) + FontItalic eItalic = m_pPrinterGfx->GetFontMgr().getFontItalic( nID ); + if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE ) bArtItalic = true; } int nWeight = (int)pEntry->meWeight; int nRealWeight = (int)m_pPrinterGfx->GetFontMgr().getFontWeight( nID ); - if( nRealWeight <= (int)psp::weight::Medium && nWeight > (int)WEIGHT_MEDIUM ) + if( nRealWeight <= (int)WEIGHT_MEDIUM && nWeight > (int)WEIGHT_MEDIUM ) { bArtBold = true; } @@ -1079,91 +1079,16 @@ void PspGraphics::DoGetGlyphWidths( psp::fontID aFont, // ---------------------------------------------------------------------------- -FontWidth PspGraphics::ToFontWidth (psp::width::type eWidth) -{ - switch (eWidth) - { - case psp::width::UltraCondensed: return WIDTH_ULTRA_CONDENSED; - case psp::width::ExtraCondensed: return WIDTH_EXTRA_CONDENSED; - case psp::width::Condensed: return WIDTH_CONDENSED; - case psp::width::SemiCondensed: return WIDTH_SEMI_CONDENSED; - case psp::width::Normal: return WIDTH_NORMAL; - case psp::width::SemiExpanded: return WIDTH_SEMI_EXPANDED; - case psp::width::Expanded: return WIDTH_EXPANDED; - case psp::width::ExtraExpanded: return WIDTH_EXTRA_EXPANDED; - case psp::width::UltraExpanded: return WIDTH_ULTRA_EXPANDED; - default: break; - } - return WIDTH_DONTKNOW; -} - -FontWeight PspGraphics::ToFontWeight (psp::weight::type eWeight) -{ - switch (eWeight) - { - case psp::weight::Thin: return WEIGHT_THIN; - case psp::weight::UltraLight: return WEIGHT_ULTRALIGHT; - case psp::weight::Light: return WEIGHT_LIGHT; - case psp::weight::SemiLight: return WEIGHT_SEMILIGHT; - case psp::weight::Normal: return WEIGHT_NORMAL; - case psp::weight::Medium: return WEIGHT_MEDIUM; - case psp::weight::SemiBold: return WEIGHT_SEMIBOLD; - case psp::weight::Bold: return WEIGHT_BOLD; - case psp::weight::UltraBold: return WEIGHT_ULTRABOLD; - case psp::weight::Black: return WEIGHT_BLACK; - default: break; - } - return WEIGHT_DONTKNOW; -} - -FontPitch PspGraphics::ToFontPitch (psp::pitch::type ePitch) -{ - switch (ePitch) - { - case psp::pitch::Fixed: return PITCH_FIXED; - case psp::pitch::Variable: return PITCH_VARIABLE; - default: break; - } - return PITCH_DONTKNOW; -} - -FontItalic PspGraphics::ToFontItalic (psp::italic::type eItalic) -{ - switch (eItalic) - { - case psp::italic::Upright: return ITALIC_NONE; - case psp::italic::Oblique: return ITALIC_OBLIQUE; - case psp::italic::Italic: return ITALIC_NORMAL; - default: break; - } - return ITALIC_DONTKNOW; -} - -FontFamily PspGraphics::ToFontFamily (psp::family::type eFamily) -{ - switch (eFamily) - { - case psp::family::Decorative: return FAMILY_DECORATIVE; - case psp::family::Modern: return FAMILY_MODERN; - case psp::family::Roman: return FAMILY_ROMAN; - case psp::family::Script: return FAMILY_SCRIPT; - case psp::family::Swiss: return FAMILY_SWISS; - case psp::family::System: return FAMILY_SYSTEM; - default: break; - } - return FAMILY_DONTKNOW; -} - ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintFontInfo& rInfo ) { ImplDevFontAttributes aDFA; aDFA.maName = rInfo.m_aFamilyName; aDFA.maStyleName = rInfo.m_aStyleName; - aDFA.meFamily = ToFontFamily (rInfo.m_eFamilyStyle); - aDFA.meWeight = ToFontWeight (rInfo.m_eWeight); - aDFA.meItalic = ToFontItalic (rInfo.m_eItalic); - aDFA.meWidthType = ToFontWidth (rInfo.m_eWidth); - aDFA.mePitch = ToFontPitch (rInfo.m_ePitch); + aDFA.meFamily = rInfo.m_eFamilyStyle; + aDFA.meWeight = rInfo.m_eWeight; + aDFA.meItalic = rInfo.m_eItalic; + aDFA.meWidthType = rInfo.m_eWidth; + aDFA.mePitch = rInfo.m_ePitch; aDFA.mbSymbolFlag = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL); switch( rInfo.m_eType ) diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 1e6f1b1b1747..736ab9b3c83e 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -80,11 +80,6 @@ public: Ucs2UIntMap& rUnicodeEnc ); static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& ); static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& ); - static FontWidth ToFontWidth (psp::width::type eWidth); - static FontWeight ToFontWeight (psp::weight::type eWeight); - static FontPitch ToFontPitch (psp::pitch::type ePitch); - static FontItalic ToFontItalic (psp::italic::type eItalic); - static FontFamily ToFontFamily (psp::family::type eFamily); // overload all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 4c4922be8b1e..a7857119c16a 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -40,6 +40,7 @@ #include <unx/kde/kdedata.hxx> #include <vcl/settings.hxx> +#include <vcl/vclenum.hxx> #include <rtl/ustrbuf.hxx> @@ -1757,41 +1758,41 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r aInfo.m_aFamilyName = String( rQFont.family().utf8(), RTL_TEXTENCODING_UTF8 ); // set italic - aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright ); + aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE ); // set weight int nWeight = qFontInfo.weight(); if ( nWeight <= QFont::Light ) - aInfo.m_eWeight = psp::weight::Light; + aInfo.m_eWeight = WEIGHT_LIGHT; else if ( nWeight <= QFont::Normal ) - aInfo.m_eWeight = psp::weight::Normal; + aInfo.m_eWeight = WEIGHT_NORMAL; else if ( nWeight <= QFont::DemiBold ) - aInfo.m_eWeight = psp::weight::SemiBold; + aInfo.m_eWeight = WEIGHT_SEMIBOLD; else if ( nWeight <= QFont::Bold ) - aInfo.m_eWeight = psp::weight::Bold; + aInfo.m_eWeight = WEIGHT_BOLD; else - aInfo.m_eWeight = psp::weight::UltraBold; + aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width int nStretch = rQFont.stretch(); if ( nStretch <= QFont::UltraCondensed ) - aInfo.m_eWidth = psp::width::UltraCondensed; + aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; else if ( nStretch <= QFont::ExtraCondensed ) - aInfo.m_eWidth = psp::width::ExtraCondensed; + aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED; else if ( nStretch <= QFont::Condensed ) - aInfo.m_eWidth = psp::width::Condensed; + aInfo.m_eWidth = WIDTH_CONDENSED; else if ( nStretch <= QFont::SemiCondensed ) - aInfo.m_eWidth = psp::width::SemiCondensed; + aInfo.m_eWidth = WIDTH_SEMI_CONDENSED; else if ( nStretch <= QFont::Unstretched ) - aInfo.m_eWidth = psp::width::Normal; + aInfo.m_eWidth = WIDTH_NORMAL; else if ( nStretch <= QFont::SemiExpanded ) - aInfo.m_eWidth = psp::width::SemiExpanded; + aInfo.m_eWidth = WIDTH_SEMI_EXPANDED; else if ( nStretch <= QFont::Expanded ) - aInfo.m_eWidth = psp::width::Expanded; + aInfo.m_eWidth = WIDTH_EXPANDED; else if ( nStretch <= QFont::ExtraExpanded ) - aInfo.m_eWidth = psp::width::ExtraExpanded; + aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED; else - aInfo.m_eWidth = psp::width::UltraExpanded; + aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); @@ -1813,14 +1814,14 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r // Create the font Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != psp::weight::Unknown ) - aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); - if( aInfo.m_eWidth != psp::width::Unknown ) - aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) ); - if( aInfo.m_eItalic != psp::italic::Unknown ) - aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) ); - if( aInfo.m_ePitch != psp::pitch::Unknown ) - aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) ); + if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) + aFont.SetWeight( aInfo.m_eWeight ); + if( aInfo.m_eWidth != WIDTH_DONTKNOW ) + aFont.SetWidthType( aInfo.m_eWidth ); + if( aInfo.m_eItalic != ITALIC_DONTKNOW ) + aFont.SetItalic( aInfo.m_eItalic ); + if( aInfo.m_ePitch != PITCH_DONTKNOW ) + aFont.SetPitch( aInfo.m_ePitch ); return aFont; } @@ -1922,17 +1923,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetFaceColor( aBack ); aStyleSettings.SetInactiveTabColor( aBack ); aStyleSettings.SetDialogColor( aBack ); - if( aBack == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = aStyleSettings.GetLightColor(); - aStyleSettings. - SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); // Selection aStyleSettings.SetHighlightColor( toColor( qColorGroup.highlight() ) ); diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 40146434ba84..98b84ce54d7a 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -103,41 +103,41 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 ); // set italic - aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright ); + aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE ); // set weight int nWeight = qFontInfo.weight(); if ( nWeight <= QFont::Light ) - aInfo.m_eWeight = psp::weight::Light; + aInfo.m_eWeight = WEIGHT_LIGHT; else if ( nWeight <= QFont::Normal ) - aInfo.m_eWeight = psp::weight::Normal; + aInfo.m_eWeight = WEIGHT_NORMAL; else if ( nWeight <= QFont::DemiBold ) - aInfo.m_eWeight = psp::weight::SemiBold; + aInfo.m_eWeight = WEIGHT_SEMIBOLD; else if ( nWeight <= QFont::Bold ) - aInfo.m_eWeight = psp::weight::Bold; + aInfo.m_eWeight = WEIGHT_BOLD; else - aInfo.m_eWeight = psp::weight::UltraBold; + aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width int nStretch = rQFont.stretch(); if ( nStretch <= QFont::UltraCondensed ) - aInfo.m_eWidth = psp::width::UltraCondensed; + aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; else if ( nStretch <= QFont::ExtraCondensed ) - aInfo.m_eWidth = psp::width::ExtraCondensed; + aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED; else if ( nStretch <= QFont::Condensed ) - aInfo.m_eWidth = psp::width::Condensed; + aInfo.m_eWidth = WIDTH_CONDENSED; else if ( nStretch <= QFont::SemiCondensed ) - aInfo.m_eWidth = psp::width::SemiCondensed; + aInfo.m_eWidth = WIDTH_SEMI_CONDENSED; else if ( nStretch <= QFont::Unstretched ) - aInfo.m_eWidth = psp::width::Normal; + aInfo.m_eWidth = WIDTH_NORMAL; else if ( nStretch <= QFont::SemiExpanded ) - aInfo.m_eWidth = psp::width::SemiExpanded; + aInfo.m_eWidth = WIDTH_SEMI_EXPANDED; else if ( nStretch <= QFont::Expanded ) - aInfo.m_eWidth = psp::width::Expanded; + aInfo.m_eWidth = WIDTH_EXPANDED; else if ( nStretch <= QFont::ExtraExpanded ) - aInfo.m_eWidth = psp::width::ExtraExpanded; + aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED; else - aInfo.m_eWidth = psp::width::UltraExpanded; + aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED; #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() ); @@ -159,14 +159,14 @@ static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& r // Create the font Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != psp::weight::Unknown ) - aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) ); - if( aInfo.m_eWidth != psp::width::Unknown ) - aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) ); - if( aInfo.m_eItalic != psp::italic::Unknown ) - aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) ); - if( aInfo.m_ePitch != psp::pitch::Unknown ) - aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) ); + if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) + aFont.SetWeight( aInfo.m_eWeight ); + if( aInfo.m_eWidth != WIDTH_DONTKNOW ) + aFont.SetWidthType( aInfo.m_eWidth ); + if( aInfo.m_eItalic != ITALIC_DONTKNOW ) + aFont.SetItalic( aInfo.m_eItalic ); + if( aInfo.m_ePitch != PITCH_DONTKNOW ) + aFont.SetPitch( aInfo.m_ePitch ); return aFont; } @@ -264,18 +264,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetFaceColor( aBack ); style.SetInactiveTabColor( aBack ); style.SetDialogColor( aBack ); - - if( aBack == COL_LIGHTGRAY ) - style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = style.GetLightColor(); - style. - SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ) ); - } + style.SetCheckedColorSpecialCase( ); // Selection style.SetHighlightColor( aHigh ); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 04f71bfbed3d..5075db4fe27d 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -901,14 +901,14 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p if( part == PART_TRACK_VERT_AREA || part == PART_TRACK_HORZ_AREA ) { QStyleOptionSlider option; - OSL_ASSERT( val.getType() == CTRL_SCROLLBAR ); - const ScrollbarValue* sbVal = static_cast<const ScrollbarValue *>(&val); option.orientation = ( part == PART_TRACK_HORZ_AREA ) ? Qt::Horizontal : Qt::Vertical; - option.minimum = sbVal->mnMin; - option.maximum = sbVal->mnMax; - option.sliderValue = sbVal->mnCur; - option.sliderPosition = sbVal->mnCur; - option.pageStep = sbVal->mnVisibleSize; + // getNativeControlRegion usually gets ImplControlValue as 'val' (i.e. not the proper + // subclass), so use random sensible values (doesn't matter anyway, as the wanted + // geometry here depends only on button sizes) + option.maximum = 10; + option.minimum = 0; + option.sliderPosition = option.sliderValue = 4; + option.pageStep = 2; // Adjust coordinates to make the widget appear to be at (0,0), i.e. make // widget and screen coordinates the same. QStyle functions should use screen // coordinates but at least QPlastiqueStyle::subControlRect() is buggy diff --git a/vcl/unx/kde4/main.cxx b/vcl/unx/kde4/main.cxx index 6bc06f3fa880..791d155d7de4 100644 --- a/vcl/unx/kde4/main.cxx +++ b/vcl/unx/kde4/main.cxx @@ -64,15 +64,16 @@ extern "C" { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() ); #endif - sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0; + sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0; nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32(); if( nIndex > 0 ) nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32(); - if( nIndex > 0 ) - nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32(); if( nMajor != 4 || nMinor < 1 ) { #if OSL_DEBUG_LEVEL > 1 + sal_Int32 nMicro = 0; + if( nIndex > 0 ) + nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32(); fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro ); #endif return NULL; diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 77616b21d5ec..c8dc1012dd8f 100755 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -257,12 +257,6 @@ LINKFLAGSSHL += /ENTRY:LibMain@12 .ENDIF .ENDIF -# --- OS2 ---------------------------------------------------------------- - -.IF "$(GUI)" == "OS2" -STDSHL1 += ft2lib.lib -.ENDIF - # --- UNX ---------------------------------------------------------------- # UNX sal plugins diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index d17eb504bc8a..17774dab7026 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -2445,7 +2445,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) while( aFontDir.getNextItem( aDirItem, 10 ) == osl::FileBase::E_None ) { - osl::FileStatus aFileStatus( FileStatusMask_FileURL ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); rcOSL = aDirItem.getFileStatus( aFileStatus ); if ( rcOSL == osl::FileBase::E_None ) AddTempDevFont( pFontList, aFileStatus.getFileURL(), aEmptyString ); diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 3d9799028ff0..429b3f082217 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -1542,11 +1542,10 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) { if( mpLogClusters[ c ] == i ) { - // --> HDU/FME 2005-10-25 #i55716# skip WORDJOINER + // #i55716# if( rArgs.mpStr[ c ] == 0x2060 ) mpOutGlyphs[ i + rVisualItem.mnMinGlyphPos ] = 1; else - // <-- rArgs.NeedFallback( c, false ); } } @@ -1558,11 +1557,10 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) { if( mpLogClusters[ c ] == i ) { - // --> HDU/FME 2005-10-25 #i55716# skip WORDJOINER + // #i55716# if( rArgs.mpStr[ c ] == 0x2060 ) mpOutGlyphs[ i + rVisualItem.mnMinGlyphPos ] = 1; else - // <-- rArgs.NeedFallback( c, true ); } } @@ -1860,6 +1858,28 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, const VisualItem& rVI = mpVisualItems[ nItem ]; if( rVI.IsEmpty() ) continue; + + //Resolves: fdo#33090 Ensure that all glyph slots, even if 0-width + //or empty due to combining chars etc, map back to a character + //position so that iterating over glyph slots one at a time for + //glyph fallback can keep context as to what characters are the + //inputs that caused a missing glyph in a given font. + { + int dir = 1; + int out = rVI.mnMinCharPos; + if (rVI.IsRTL()) + { + dir = -1; + out = rVI.mnEndCharPos-1; + } + for(c = rVI.mnMinCharPos; c < rVI.mnEndCharPos; ++c) + { + int i = out; + mpGlyphs2Chars[i] = c; + out += dir; + } + } + // calculate the mapping by using mpLogClusters[] // mpGlyphs2Chars[] should obey the logical order // => reversing the loop does this by overwriting higher logicals diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index f1aa169d5d8c..bff9d136fe84 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2293,17 +2293,15 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle ) { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE - // --> FME 2004-07-30 #i32329# Enhanced table selection + // #i32329# { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW - // <-- - // --> FME 2004-08-16 #i20119# Paintbrush tool + // #i20119# { 0, 0, SAL_RESID_POINTER_PAINTBRUSH } // POINTER_PAINTBRUSH - // <-- }; @@ -2947,19 +2945,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); GetSalData()->mbThemeMenuSupport = TRUE; } - // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht - if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - // Checked-Color berechnen - Color aColor1 = aStyleSettings.GetFaceColor(); - Color aColor2 = aStyleSettings.GetLightColor(); - BYTE nRed = (BYTE)(((sal_uInt16)aColor1.GetRed() + (sal_uInt16)aColor2.GetRed())/2); - BYTE nGreen = (BYTE)(((sal_uInt16)aColor1.GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); - BYTE nBlue = (BYTE)(((sal_uInt16)aColor1.GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); // caret width DWORD nCaretWidth = 2; @@ -3547,6 +3533,10 @@ static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar { aWheelEvt.mnScrollLines = aSalShlData.mnWheelScrollChars; aWheelEvt.mbHorz = TRUE; + + // fdo#36380 - seems horiz scrolling has swapped direction + aWheelEvt.mnDelta *= -1; + aWheelEvt.mnNotchDelta *= -1; } if ( nWinModCode & MK_SHIFT ) @@ -4754,14 +4744,12 @@ static int ImplHandleMinMax( HWND hWnd, LPARAM lParam ) // if bByPosition is FALSE then nPos denotes a menu id instead of a position static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByPosition=TRUE ) { - DWORD err=0; - MENUITEMINFOW mi; memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof( mi ); mi.fMask = MIIM_DATA; if( !GetMenuItemInfoW( hMenu, nPos, bByPosition, &mi) ) - err = GetLastError(); + ImplWriteLastError( GetLastError(), "ImplGetSalMenuItem" ); return (WinSalMenuItem *) mi.dwItemData; } @@ -4769,8 +4757,6 @@ static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByP // returns the index of the currently selected item if any or -1 static int ImplGetSelectedIndex( HMENU hMenu ) { - DWORD err=0; - MENUITEMINFOW mi; memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof( mi ); @@ -4781,7 +4767,7 @@ static int ImplGetSelectedIndex( HMENU hMenu ) for(int i=0; i<n; i++ ) { if( !GetMenuItemInfoW( hMenu, i, TRUE, &mi) ) - err = GetLastError(); + ImplWriteLastError( GetLastError(), "ImplGetSelectedIndex" ); else { if( mi.fState & MFS_HILITE ) @@ -4891,7 +4877,6 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam ) static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) { int nRet = 0; - DWORD err = 0; if( !wParam ) { // request was sent by a menu @@ -4931,7 +4916,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) // Fill background if(!PatBlt( pDI->hDC, aRect.left, aRect.top, aRect.right-aRect.left, aRect.bottom-aRect.top, PATCOPY )) - err = GetLastError(); + ImplWriteLastError(GetLastError(), "ImplDrawItem"); int lineHeight = aRect.bottom-aRect.top; @@ -5015,7 +5000,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) (LPARAM)(LPWSTR) aStr.GetBuffer(), (WPARAM)0, aRect.left, aRect.top + (lineHeight - strSize.cy)/2, 0, 0, DST_PREFIXTEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) ) - err = GetLastError(); + ImplWriteLastError(GetLastError(), "ImplDrawItem"); if( pSalMenuItem->mAccelText.Len() ) { @@ -5032,7 +5017,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) (LPARAM)(LPWSTR) aStr.GetBuffer(), (WPARAM)0, aRect.right-strSizeA.cx-tm.tmMaxCharWidth, aRect.top + (lineHeight - strSizeA.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) ) - err = GetLastError(); + ImplWriteLastError(GetLastError(), "ImplDrawItem"); } // Restore the original font and colors. |