diff options
Diffstat (limited to 'vcl/inc/vcl')
205 files changed, 42335 insertions, 0 deletions
diff --git a/vcl/inc/vcl/ImageListProvider.hxx b/vcl/inc/vcl/ImageListProvider.hxx new file mode 100644 index 000000000000..5c0640d21ea4 --- /dev/null +++ b/vcl/inc/vcl/ImageListProvider.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_IMAGELISTPROVIDER_HXX +#define _SV_IMAGELISTPROVIDER_HXX + +#include <sal/types.h> + +namespace com { namespace sun { namespace star { namespace lang { class IllegalArgumentException; }}}} + +class ImageList; + + +namespace vcl +{ + enum ImageListType + { + IMAGELISTTYPE_UNKNOWN = 0, + HIGHCONTRAST_NO = 1, + HIGHCONTRAST_YES = 2 + }; + + /* abstract */ class IImageListProvider + { + public: + virtual ImageList getImageList(ImageListType) SAL_THROW (( com::sun::star::lang::IllegalArgumentException )) = 0; + }; +} /* vcl */ + +#endif /* _SV_IMAGELISTPROVIDER_HXX */ diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx new file mode 100755 index 000000000000..2fa134af5078 --- /dev/null +++ b/vcl/inc/vcl/abstdlg.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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_ABSTDLG_HXX +#define _VCL_ABSTDLG_HXX + +// include --------------------------------------------------------------- + +#include <tools/solar.h> +#include <tools/string.hxx> +#include <vcl/dllapi.h> + +class Window; +class ResId; +class Link; + +class VCL_DLLPUBLIC VclAbstractDialog +{ +public: + virtual short Execute() = 0; + //virtual void Show( BOOL bVisible = TRUE, USHORT nFlags = 0 ) = 0; + virtual ~VclAbstractDialog(); +}; + +class VCL_DLLPUBLIC VclAbstractDialog2 +{ +public: + virtual void StartExecuteModal( const Link& rEndDialogHdl ) = 0; + virtual long GetResult() = 0; + virtual ~VclAbstractDialog2(); +}; + +class VCL_DLLPUBLIC VclAbstractTerminatedDialog : public VclAbstractDialog +{ +public: + virtual void EndDialog(long nResult =0) = 0; +}; + +class VCL_DLLPUBLIC VclAbstractRefreshableDialog : public VclAbstractDialog +{ +public: + virtual void Update() = 0; + virtual void Sync() = 0; +}; + +class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public VclAbstractDialog +{ +public: + virtual String GetPasswordToOpen() const = 0; + virtual String GetPasswordToModify() const = 0; + virtual bool IsRecommendToOpenReadonly() const = 0; +}; + +//------------------------------------------------------------- + +class VCL_DLLPUBLIC VclAbstractDialogFactory +{ +public: + virtual ~VclAbstractDialogFactory(); // needed for export of vtable + static VclAbstractDialogFactory* Create(); + // nDialogId was previously a ResId without ResMgr; the ResourceId is now + // an implementation detail of the factory + virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId ) = 0; + + // creates instance of PasswordToOpenModifyDialog from cui + virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) = 0; +}; + +#endif + diff --git a/vcl/inc/vcl/accel.h b/vcl/inc/vcl/accel.h new file mode 100644 index 000000000000..e726d04e7c99 --- /dev/null +++ b/vcl/inc/vcl/accel.h @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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_ACCEL_H +#define _SV_ACCEL_H + +#include <vcl/sv.h> +#ifndef _SV_KEYCOD_HXX +#include <vcl/keycod.hxx> +#endif + +class Accelerator; + +// ------------------ +// - ImplAccelEntry - +// ------------------ + +class ImplAccelEntry +{ +public: + USHORT mnId; + KeyCode maKeyCode; + Accelerator* mpAccel; + Accelerator* mpAutoAccel; + BOOL mbEnabled; +}; + +// ----------------- +// - Hilfemethoden - +// ----------------- + +// in KEYCOD.CXX +void ImplGetKeyCode( KeyFuncType eFunc, USHORT& rCode1, USHORT& rCode2, USHORT& rCode3, USHORT& rCode4 ); + +#endif // _SV_ACCEL_H diff --git a/vcl/inc/vcl/accel.hxx b/vcl/inc/vcl/accel.hxx new file mode 100644 index 000000000000..ad2f03dfd942 --- /dev/null +++ b/vcl/inc/vcl/accel.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * 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_ACCEL_HXX +#define _SV_ACCEL_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/resid.hxx> +#include <tools/rc.hxx> +#include <vcl/keycod.hxx> + +class ImplAccelData; +class ImplAccelEntry; + +// --------------- +// - Accelerator - +// --------------- + +class VCL_DLLPUBLIC Accelerator : public Resource +{ + friend class ImplAccelManager; + +private: + ImplAccelData* mpData; + XubString maHelpStr; + Link maActivateHdl; + Link maDeactivateHdl; + Link maSelectHdl; + + // Werden vom AcceleratorManager gesetzt + KeyCode maCurKeyCode; + USHORT mnCurId; + USHORT mnCurRepeat; + BOOL mbIsCancel; + BOOL* mpDel; + +//#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE void ImplInit(); + SAL_DLLPRIVATE void ImplCopyData( ImplAccelData& rAccelData ); + SAL_DLLPRIVATE void ImplDeleteData(); + SAL_DLLPRIVATE void ImplInsertAccel( USHORT nItemId, const KeyCode& rKeyCode, + BOOL bEnable, Accelerator* pAutoAccel ); + + SAL_DLLPRIVATE ImplAccelEntry* ImplGetAccelData( const KeyCode& rKeyCode ) const; +//#endif + +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + Accelerator(); + Accelerator( const Accelerator& rAccel ); + Accelerator( const ResId& rResId ); + virtual ~Accelerator(); + + virtual void Activate(); + virtual void Deactivate(); + virtual void Select(); + + void InsertItem( USHORT nItemId, const KeyCode& rKeyCode ); + void InsertItem( const ResId& rResId ); + void RemoveItem( USHORT nItemId ); + void RemoveItem( const KeyCode rKeyCode ); + void Clear(); + + USHORT GetCurItemId() const { return mnCurId; } + const KeyCode& GetCurKeyCode() const { return maCurKeyCode; } + USHORT GetCurRepeat() const { return mnCurRepeat; } + BOOL IsCancel() const { return mbIsCancel; } + + USHORT GetItemCount() const; + USHORT GetItemId( USHORT nPos ) const; + KeyCode GetItemKeyCode( USHORT nPos ) const; + USHORT GetItemId( const KeyCode& rKeyCode ) const; + KeyCode GetKeyCode( USHORT nItemId ) const; + BOOL IsIdValid( USHORT nItemId ) const; + BOOL IsKeyCodeValid( const KeyCode rKeyCode ) const; + BOOL Call( const KeyCode& rKeyCode, USHORT nRepeat = 0 ); + + void SetAccel( USHORT nItemId, Accelerator* pAccel ); + Accelerator* GetAccel( USHORT nItemId ) const; + void SetAccel( const KeyCode rKeyCode, Accelerator* pAccel ); + Accelerator* GetAccel( const KeyCode rKeyCode ) const; + + void EnableItem( USHORT nItemId, BOOL bEnable = TRUE ); + BOOL IsItemEnabled( USHORT nItemId ) const; + void EnableItem( const KeyCode rKeyCode, BOOL bEnable = TRUE ); + BOOL IsItemEnabled( const KeyCode rKeyCode ) const; + + void SetHelpText( const XubString& rHelpText ) { maHelpStr = rHelpText; } + const XubString& GetHelpText() const { return maHelpStr; } + + void SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; } + const Link& GetActivateHdl() const { return maActivateHdl; } + void SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; } + const Link& GetDeactivateHdl() const { return maDeactivateHdl; } + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + + Accelerator& operator=( const Accelerator& rAccel ); +}; + +#endif // _SV_ACCEL_HXX diff --git a/vcl/inc/vcl/accmgr.hxx b/vcl/inc/vcl/accmgr.hxx new file mode 100644 index 000000000000..a60322eac403 --- /dev/null +++ b/vcl/inc/vcl/accmgr.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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_ACCMGR_HXX +#define _SV_ACCMGR_HXX + +#include <vcl/sv.h> + +class ImplAccelList; +class Accelerator; +class KeyCode; + +// -------------------- +// - ImplAccelManager - +// -------------------- + +class ImplAccelManager +{ +private: + ImplAccelList* mpAccelList; + ImplAccelList* mpSequenceList; + +public: + ImplAccelManager() + { + mpAccelList = NULL; + mpSequenceList = NULL; + } + ~ImplAccelManager(); + + BOOL InsertAccel( Accelerator* pAccel ); + void RemoveAccel( Accelerator* pAccel ); + + void EndSequence( BOOL bCancel = FALSE ); + void FlushAccel() { EndSequence( TRUE ); } + + BOOL IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat ); +}; + +#endif // _SV_ACCMGR_HXX diff --git a/vcl/inc/vcl/alpha.hxx b/vcl/inc/vcl/alpha.hxx new file mode 100644 index 000000000000..ef48793cf8ce --- /dev/null +++ b/vcl/inc/vcl/alpha.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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_ALPHA_HXX +#define _SV_ALPHA_HXX + +#include <vcl/dllapi.h> +#include <vcl/bitmap.hxx> + +// ------------- +// - AlphaMask - +// ------------- + +class ImageList; +class BitmapEx; + +class VCL_DLLPUBLIC AlphaMask : private Bitmap +{ + friend class BitmapEx; + friend class OutputDevice; + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream&, const ImageList& ); + +private: + + SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const; + SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap ); + +public: + + AlphaMask(); + AlphaMask( const Bitmap& rBitmap ); + AlphaMask( const AlphaMask& rAlphaMask ); + AlphaMask( const Size& rSizePixel, BYTE* pEraseTransparency = NULL ); + ~AlphaMask(); + + AlphaMask& operator=( const Bitmap& rBitmap ); + AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return (AlphaMask&) Bitmap::operator=( rAlphaMask ); } + BOOL operator!() const { return Bitmap::operator!(); } + BOOL operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); } + BOOL operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); } + + const MapMode& GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); } + void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); } + + const Size& GetPrefSize() const { return Bitmap::GetPrefSize(); } + void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); } + + Size GetSizePixel() const { return Bitmap::GetSizePixel(); } + void SetSizePixel( const Size& rNewSize ) { Bitmap::SetSizePixel( rNewSize ); } + + ULONG GetSizeBytes() const { return Bitmap::GetSizeBytes(); } + ULONG GetChecksum() const { return Bitmap::GetChecksum(); } + + Bitmap GetBitmap() const; + +public: + + BOOL Crop( const Rectangle& rRectPixel ); + BOOL Expand( ULONG nDX, ULONG nDY, BYTE* pInitTransparency = NULL ); + BOOL CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const AlphaMask* pAlphaSrc = NULL ); + BOOL Erase( BYTE cTransparency ); + BOOL Invert(); + BOOL Mirror( ULONG nMirrorFlags ); + BOOL Scale( const Size& rNewSize, ULONG nScaleFlag = BMP_SCALE_FAST ); + BOOL Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag = BMP_SCALE_FAST ); + BOOL Rotate( long nAngle10, BYTE cFillTransparency ); + BOOL Replace( const Bitmap& rMask, BYTE rReplaceTransparency ); + BOOL Replace( BYTE cSearchTransparency, BYTE cReplaceTransparency, ULONG nTol = 0UL ); + BOOL Replace( BYTE* pSearchTransparencies, BYTE* pReplaceTransparencies, + ULONG nColorCount, ULONG* pTols = NULL ); + +public: + + BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); } + BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } + void ReleaseAccess( BitmapReadAccess* pAccess ); + +public: + + BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE ) { return Bitmap::Read( rIStm, bFileHeader ); } + BOOL Write( SvStream& rOStm, BOOL bCompressed = TRUE, BOOL bFileHeader = TRUE ) const { return Bitmap::Write( rOStm, bCompressed, bFileHeader ); } + + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ); +}; + +#endif // _SV_ALPHA_HXX diff --git a/vcl/inc/vcl/animate.hxx b/vcl/inc/vcl/animate.hxx new file mode 100644 index 000000000000..fc793fc12714 --- /dev/null +++ b/vcl/inc/vcl/animate.hxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * 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_ANIMATE_HXX +#define _SV_ANIMATE_HXX + +#include <vcl/dllapi.h> +#include <vcl/timer.hxx> +#include <vcl/bitmapex.hxx> + +// ----------- +// - Defines - +// ----------- + +#define ANIMATION_TIMEOUT_ON_CLICK 2147483647L + +// --------- +// - Enums - +// --------- + +enum Disposal +{ + DISPOSE_NOT, + DISPOSE_BACK, + DISPOSE_FULL, + DISPOSE_PREVIOUS +}; + +enum CycleMode +{ + CYCLE_NOT, + CYCLE_NORMAL, + CYCLE_FALLBACK, + CYCLE_REVERS, + CYCLE_REVERS_FALLBACK +}; + +// ------------------- +// - AnimationBitmap - +// ------------------- + +struct VCL_DLLPUBLIC AnimationBitmap +{ + BitmapEx aBmpEx; + Point aPosPix; + Size aSizePix; + long nWait; + Disposal eDisposal; + BOOL bUserInput; + + AnimationBitmap() {} + AnimationBitmap( const BitmapEx& rBmpEx, const Point& rPosPix, + const Size& rSizePix, long _nWait = 0L, + Disposal _eDisposal = DISPOSE_NOT ) : + aBmpEx ( rBmpEx ), + aPosPix ( rPosPix ), + aSizePix ( rSizePix ), + nWait ( _nWait ), + eDisposal ( _eDisposal ), + bUserInput ( FALSE ) {} + + BOOL operator==( const AnimationBitmap& rAnimBmp ) const + { + return( rAnimBmp.aBmpEx == aBmpEx && + rAnimBmp.aPosPix == aPosPix && + rAnimBmp.aSizePix == aSizePix && + rAnimBmp.nWait == nWait && + rAnimBmp.eDisposal == eDisposal && + rAnimBmp.bUserInput == bUserInput ); + } + + BOOL operator!=( const AnimationBitmap& rAnimBmp ) const { return !( *this == rAnimBmp ); } + + BOOL IsEqual( const AnimationBitmap& rAnimBmp ) const + { + return( rAnimBmp.aPosPix == aPosPix && + rAnimBmp.aSizePix == aSizePix && + rAnimBmp.nWait == nWait && + rAnimBmp.eDisposal == eDisposal && + rAnimBmp.bUserInput == bUserInput && + rAnimBmp.aBmpEx.IsEqual( aBmpEx ) ); + } + + ULONG GetChecksum() const; +}; + +// ------------------- +// - AnimationBitmap - +// ------------------- + +struct AInfo +{ + Bitmap aLastSaveBitmap; + Bitmap aBackBitmap; + Rectangle aClipRect; + Size aLastSaveSize; + Point aLastSavePoint; + Point aStartOrg; + Size aStartSize; + OutputDevice* pOutDev; + void* pViewData; + long nExtraData; + BOOL bWithSize; + BOOL bPause; + + AInfo() : pOutDev( NULL ), + pViewData( NULL ), + nExtraData( 0L ), + bWithSize( FALSE ), + bPause( FALSE ) {} +}; + +// ------------------- +// - AnimationBitmap - +// ------------------- + +class VCL_DLLPUBLIC Animation +{ + SAL_DLLPRIVATE static ULONG mnAnimCount; + + List maList; + List maAInfoList; + Link maNotifyLink; + BitmapEx maBitmapEx; + Timer maTimer; + Size maGlobalSize; + List* mpViewList; + void* mpExtraData; + long mnLoopCount; + long mnLoops; + long mnPos; + Disposal meLastDisposal; + CycleMode meCycleMode; + BOOL mbFirst; + BOOL mbIsInAnimation; + BOOL mbWithSize; + BOOL mbLoopTerminated; + BOOL mbIsWaiting; + +//#if 0 // _SOLAR__PRIVATE + + SAL_DLLPRIVATE void ImplRestartTimer( ULONG nTimeout ); + DECL_DLLPRIVATE_LINK( ImplTimeoutHdl, Timer* ); + +public: + + SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; } + SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; } + SAL_DLLPRIVATE ULONG ImplGetCurPos() const { return mnPos; } + +//#endif + +public: + Animation(); + Animation( const Animation& rAnimation ); + ~Animation(); + + Animation& operator=( const Animation& rAnimation ); + BOOL operator==( const Animation& rAnimation ) const; + BOOL operator!=( const Animation& rAnimation ) const { return !(*this==rAnimation); } + + BOOL IsEqual( const Animation& rAnimation ) const; + + BOOL IsEmpty() const; + void SetEmpty(); + + void Clear(); + + BOOL Start( OutputDevice* pOutDev, const Point& rDestPt, long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL ); + BOOL Start( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz, long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL ); + void Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 ); + + void Draw( OutputDevice* pOutDev, const Point& rDestPt ) const; + void Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const; + + BOOL IsInAnimation() const { return mbIsInAnimation; } + BOOL IsTransparent() const; + BOOL IsTerminated() const { return mbLoopTerminated; } + + const Size& GetDisplaySizePixel() const { return maGlobalSize; } + void SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; } + + const BitmapEx& GetBitmapEx() const { return maBitmapEx; } + void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; } + + ULONG GetLoopCount() const { return mnLoopCount; } + void SetLoopCount( const ULONG nLoopCount ); + void ResetLoopCount(); + + void SetCycleMode( CycleMode eMode ); + CycleMode GetCycleMode() const { return meCycleMode; } + + void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; } + const Link& GetNotifyHdl() const { return maNotifyLink; } + + USHORT Count() const { return (USHORT) maList.Count(); } + BOOL Insert( const AnimationBitmap& rAnimationBitmap ); + const AnimationBitmap& Get( USHORT nAnimation ) const; + void Replace( const AnimationBitmap& rNewAnimationBmp, USHORT nAnimation ); + + List* GetAInfoList() { return &maAInfoList; } + ULONG GetSizeBytes() const; + ULONG GetChecksum() const; + +public: + + BOOL Convert( BmpConversion eConversion ); + BOOL ReduceColors( USHORT nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE ); + BOOL Invert(); + BOOL Mirror( ULONG nMirrorFlags ); + BOOL Dither( ULONG nDitherFlags = BMP_DITHER_MATRIX ); + BOOL Adjust( short nLuminancePercent = 0, + short nContrastPercent = 0, + short nChannelRPercent = 0, + short nChannelGPercent = 0, + short nChannelBPercent = 0, + double fGamma = 1.0, + BOOL bInvert = FALSE ); + BOOL Filter( BmpFilter eFilter, + const BmpFilterParam* pFilterParam = NULL, + const Link* pProgress = NULL ); + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Animation& rAnimation ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Animation& rAnimation ); +}; + +#endif // _SV_ANIMATE_HXX diff --git a/vcl/inc/vcl/apptypes.hxx b/vcl/inc/vcl/apptypes.hxx new file mode 100644 index 000000000000..a2d02dcbb066 --- /dev/null +++ b/vcl/inc/vcl/apptypes.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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_APPTYPES_HXX +#define _VCL_APPTYPES_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/rtti.hxx> + +// --------------------- +// - Application-Types - +// --------------------- + +#define EXC_RSCNOTLOADED ((USHORT)0x0100) +#define EXC_SYSOBJNOTCREATED ((USHORT)0x0200) +#define EXC_SYSTEM ((USHORT)0x0300) +#define EXC_DISPLAY ((USHORT)0x0400) +#define EXC_REMOTE ((USHORT)0x0500) +#define EXC_USER ((USHORT)0x1000) +#define EXC_MAJORTYPE ((USHORT)0xFF00) +#define EXC_MINORTYPE ((USHORT)0x00FF) + +#define UNIQUEID_SV_BEGIN 64000 + +class VCL_DLLPUBLIC ApplicationProperty +{ +public: + + TYPEINFO(); +}; + +#define INPUT_MOUSE 0x0001 +#define INPUT_KEYBOARD 0x0002 +#define INPUT_PAINT 0x0004 +#define INPUT_TIMER 0x0008 +#define INPUT_OTHER 0x0010 +#define INPUT_APPEVENT 0x0020 +#define INPUT_MOUSEANDKEYBOARD (INPUT_MOUSE | INPUT_KEYBOARD) +#define INPUT_ANY (INPUT_MOUSEANDKEYBOARD | INPUT_PAINT | INPUT_TIMER | INPUT_OTHER | INPUT_APPEVENT) + +#define DISPATCH_OPEN 0x0001 +#define DISPATCH_PRINT 0x0002 +#define DISPATCH_SERVER 0x0004 + +// -------------- +// - UserActive - +// -------------- + +#define USERACTIVE_MOUSEDRAG ((USHORT)0x0001) +#define USERACTIVE_INPUT ((USHORT)0x0002) +#define USERACTIVE_MODALDIALOG ((USHORT)0x0004) +#define USERACTIVE_ALL ((USHORT)0xFFFF) + +#endif // _VCL_APPTYPES_HXX diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx new file mode 100644 index 000000000000..83568609f87b --- /dev/null +++ b/vcl/inc/vcl/arrange.hxx @@ -0,0 +1,422 @@ +/************************************************************************* + * + * 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_ARRANGE_HXX +#define _VCL_ARRANGE_HXX + +#include "vcl/window.hxx" + +#include <vector> +#include <map> +#include <boost/shared_ptr.hpp> + +namespace vcl +{ + /* some helper classes for simple window layouting + guidelines: + - a WindowArranger is not a Window + - a WindowArranger hierarchy manages exactly one level of child windows inside a common parent + this is to keep the vcl Window hierarchy flat, as some code like accelerators depend on such behavior + - a WindowArranger never becomes owner of a Window, windows need to be destroyed separately + - a WindowArranger however always is owner of its child WindowArrangers, that is the + WindowArranger hierarchy will keep track of its objects and delete them + - a managed element of a WindowArranger can either be a Window (a leaf in the hierarchy) + or a child WindowArranger (a node in the hierarchy), but never both + */ + + class VCL_DLLPUBLIC WindowArranger + { + protected: + struct Element + { + Window* m_pElement; + boost::shared_ptr<WindowArranger> m_pChild; + sal_Int32 m_nExpandPriority; + Size m_aMinSize; + bool m_bHidden; + long m_nLeftBorder; + long m_nTopBorder; + long m_nRightBorder; + long m_nBottomBorder; + + Element() + : m_pElement( NULL ) + , m_pChild() + , m_nExpandPriority( 0 ) + , m_bHidden( false ) + , m_nLeftBorder( 0 ) + , m_nTopBorder( 0 ) + , m_nRightBorder( 0 ) + , m_nBottomBorder( 0 ) + {} + + Element( Window* i_pWin, + boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(), + sal_Int32 i_nExpandPriority = 0 + ) + : m_pElement( i_pWin ) + , m_pChild( i_pChild ) + , m_nExpandPriority( i_nExpandPriority ) + , m_bHidden( false ) + , m_nLeftBorder( 0 ) + , m_nTopBorder( 0 ) + , m_nRightBorder( 0 ) + , m_nBottomBorder( 0 ) + {} + + void deleteChild() { m_pChild.reset(); } + + sal_Int32 getExpandPriority() const; + Size getOptimalSize( WindowSizeType ) const; + bool isVisible() const; + void setPosSize( const Point&, const Size& ); + }; + + Window* m_pParentWindow; + WindowArranger* m_pParentArranger; + Rectangle m_aManagedArea; + long m_nOuterBorder; + + virtual Element* getElement( size_t i_nIndex ) = 0; + const Element* getConstElement( size_t i_nIndex ) const + { return const_cast<WindowArranger*>(this)->getElement( i_nIndex ); } + + + public: + WindowArranger( WindowArranger* i_pParent = NULL ) + : m_pParentWindow( i_pParent ? i_pParent->m_pParentWindow : NULL ) + , m_pParentArranger( i_pParent ) + , m_nOuterBorder( 0 ) + {} + virtual ~WindowArranger(); + + // ask what would be the optimal size + virtual Size getOptimalSize( WindowSizeType ) const = 0; + // call Resize to trigger layouting inside the managed area + // without function while parent window is unset + virtual void resize() = 0; + // avoid this if possible, using the constructor instead + // there can be only one parent window and all managed windows MUST + // be direct children of that window + // violating that condition will result in undefined behavior + virtual void setParentWindow( Window* ); + + virtual void setParent( WindowArranger* ); + + virtual size_t countElements() const = 0; + boost::shared_ptr<WindowArranger> getChild( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->m_pChild : boost::shared_ptr<WindowArranger>(); + } + Window* getWindow( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->m_pElement : NULL; + } + + virtual bool isVisible() const; // true if any element is visible + + sal_Int32 getExpandPriority( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->getExpandPriority() : 0; + } + + Size getMinimumSize( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->m_aMinSize : Size(); + } + + bool setMinimumSize( size_t i_nIndex, const Size& i_rMinSize ) + { + Element* pEle = getElement( i_nIndex ); + if( pEle ) + pEle->m_aMinSize = i_rMinSize; + return pEle != NULL; + } + + void setBorders( size_t i_nIndex, long i_nLeft, long i_nTop, long i_nRight, long i_nBottom ) + { + Element* pEle = getElement( i_nIndex ); + if( pEle ) + { + pEle->m_nLeftBorder = i_nLeft; + pEle->m_nRightBorder = i_nRight; + pEle->m_nTopBorder = i_nTop; + pEle->m_nBottomBorder = i_nBottom; + } + } + + void show( bool i_bShow = true, bool i_bImmediateUpdate = true ); + + void setManagedArea( const Rectangle& i_rArea ) + { + m_aManagedArea = i_rArea; + resize(); + } + const Rectangle& getManagedArea() const { return m_aManagedArea; } + + void setOuterBorder( long i_nBorder ) + { + m_nOuterBorder = i_nBorder; + resize(); + } + }; + + class VCL_DLLPUBLIC RowOrColumn : public WindowArranger + { + long m_nBorderWidth; + bool m_bColumn; + + std::vector< WindowArranger::Element > m_aElements; + + void distributeRowWidth( std::vector< Size >& io_rSizes, long i_nUsedWidth, long i_nExtraWidth ); + void distributeColumnHeight( std::vector< Size >& io_rSizes, long i_nUsedHeight, long i_nExtraHeight ); + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; } + + public: + RowOrColumn( WindowArranger* i_pParent = NULL, + bool bColumn = true, long i_nBorderWidth = 5 ) + : WindowArranger( i_pParent ) + , m_nBorderWidth( i_nBorderWidth ) + , m_bColumn( bColumn ) + {} + + virtual ~RowOrColumn(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return m_aElements.size(); } + + // add a managed window at the given index + // an index smaller than zero means add the window at the end + size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ); + void remove( Window* ); + + size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ); + // convenience: use for addChild( new WindowArranger( ... ) ) constructs + size_t addChild( WindowArranger* i_pNewChild, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ) + { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nExpandPrio, i_nIndex ); } + void remove( boost::shared_ptr<WindowArranger> const & ); + + long getBorderWidth() const { return m_nBorderWidth; } + }; + + class VCL_DLLPUBLIC LabeledElement : public WindowArranger + { + WindowArranger::Element m_aLabel; + WindowArranger::Element m_aElement; + long m_nDistance; + long m_nLabelColumnWidth; + int m_nLabelStyle; + protected: + virtual Element* getElement( size_t i_nIndex ) + { + if( i_nIndex == 0 ) + return &m_aLabel; + else if( i_nIndex == 1 ) + return &m_aElement; + return 0; + } + + public: + LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = 5 ) + : WindowArranger( i_pParent ) + , m_nDistance( i_nDistance ) + , m_nLabelColumnWidth( 0 ) + , m_nLabelStyle( i_nLabelStyle ) + {} + + virtual ~LabeledElement(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return 2; } + + void setLabel( Window* ); + void setLabel( boost::shared_ptr<WindowArranger> const & ); + void setElement( Window* ); + void setElement( boost::shared_ptr<WindowArranger> const & ); + void setLabelColumnWidth( long i_nWidth ) + { m_nLabelColumnWidth = i_nWidth; } + + Size getLabelSize( WindowSizeType i_eType ) const + { return m_aLabel.getOptimalSize( i_eType ); } + Size getElementSize( WindowSizeType i_eType ) const + { return m_aElement.getOptimalSize( i_eType ); } + }; + + class VCL_DLLPUBLIC LabelColumn : public RowOrColumn + { + long getLabelWidth() const; + public: + LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = 5 ) + : RowOrColumn( i_pParent, true, i_nBorderWidth ) + {} + virtual ~LabelColumn(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + + // returns the index of the added label + size_t addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent = 0 ); + size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 ); + }; + + class VCL_DLLPUBLIC Indenter : public WindowArranger + { + long m_nIndent; + WindowArranger::Element m_aElement; + + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex == 0 ? &m_aElement : NULL; } + + public: + Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 15 ) + : WindowArranger( i_pParent ) + , m_nIndent( i_nIndent ) + {} + + virtual ~Indenter(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return (m_aElement.m_pElement != 0 || m_aElement.m_pChild != 0) ? 1 : 0; } + + void setIndent( long i_nIndent ) + { + m_nIndent = i_nIndent; + resize(); + } + + void setWindow( Window*, sal_Int32 i_nExpandPrio = 0 ); + void setChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0 ); + // convenience: use for setChild( new WindowArranger( ... ) ) constructs + void setChild( WindowArranger* i_pChild, sal_Int32 i_nExpandPrio = 0 ) + { setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); } + }; + + class VCL_DLLPUBLIC Spacer : public WindowArranger + { + WindowArranger::Element m_aElement; + Size m_aSize; + + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex == 0 ? &m_aElement : NULL; } + + public: + Spacer( WindowArranger* i_pParent = NULL, sal_Int32 i_nPrio = 20, const Size& i_rSize = Size( 0, 0 ) ) + : WindowArranger( i_pParent ) + , m_aElement( NULL, boost::shared_ptr<WindowArranger>(), i_nPrio ) + , m_aSize( i_rSize ) + {} + + virtual ~Spacer() {} + + virtual Size getOptimalSize( WindowSizeType ) const + { return m_aSize; } + virtual void resize() {} + virtual void setParentWindow( Window* ) {} + virtual size_t countElements() const { return 1; } + virtual bool isVisible() const { return true; } + }; + + class VCL_DLLPUBLIC MatrixArranger : public WindowArranger + { + long m_nBorderX; + long m_nBorderY; + + struct MatrixElement : public WindowArranger::Element + { + sal_uInt32 m_nX; + sal_uInt32 m_nY; + + MatrixElement() + : WindowArranger::Element() + , m_nX( 0 ) + , m_nY( 0 ) + {} + + MatrixElement( Window* i_pWin, + sal_uInt32 i_nX, sal_uInt32 i_nY, + boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(), + sal_Int32 i_nExpandPriority = 0 + ) + : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority ) + , m_nX( i_nX ) + , m_nY( i_nY ) + { + } + }; + + std::vector< MatrixElement > m_aElements; + std::map< sal_uInt64, size_t > m_aMatrixMap; // maps (x | (y << 32)) to index in m_aElements + + sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY ) + { return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); } + + Size getOptimalSize( WindowSizeType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const; + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; } + + public: + MatrixArranger( WindowArranger* i_pParent = NULL, + long i_nBorderX = 5, + long i_nBorderY = 5 ) + : WindowArranger( i_pParent ) + , m_nBorderX( i_nBorderX ) + , m_nBorderY( i_nBorderY ) + {} + + virtual ~MatrixArranger(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return m_aElements.size(); } + + // add a managed window at the given matrix position + size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ); + void remove( Window* ); + + size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ); + // convenience: use for addChild( new WindowArranger( ... ) ) constructs + size_t addChild( WindowArranger* i_pNewChild, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ) + { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nX, i_nY, i_nExpandPrio ); } + void remove( boost::shared_ptr<WindowArranger> const & ); + }; + +} + +#endif + diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx new file mode 100644 index 000000000000..7483f54014a4 --- /dev/null +++ b/vcl/inc/vcl/bitmap.hxx @@ -0,0 +1,854 @@ +/************************************************************************* + * + * 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_BITMAP_HXX +#define _SV_BITMAP_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/mapmod.hxx> +#include <tools/rc.hxx> +#include <vcl/region.hxx> + +// ----------- +// - Defines - +// ----------- + +#define BMP_MIRROR_NONE 0x00000000UL +#define BMP_MIRROR_HORZ 0x00000001UL +#define BMP_MIRROR_VERT 0x00000002UL + +// ----------------------------------------------------------------------------- + +#define BMP_SCALE_NONE 0x00000000UL +#define BMP_SCALE_FAST 0x00000001UL +#define BMP_SCALE_INTERPOLATE 0x00000002UL + +// ----------------------------------------------------------------------------- + +#define BMP_DITHER_NONE 0x00000000UL +#define BMP_DITHER_MATRIX 0x00000001UL +#define BMP_DITHER_FLOYD 0x00000002UL +#define BMP_DITHER_FLOYD_16 0x00000004UL + +// ----------------------------------------------------------------------------- + +#define BMP_VECTORIZE_NONE BMP_VECTORIZE_OUTER +#define BMP_VECTORIZE_INNER 0x00000001UL +#define BMP_VECTORIZE_OUTER 0x00000002UL +#define BMP_VECTORIZE_BOUND_ONLY 0x00000004UL +#define BMP_VECTORIZE_REDUCE_EDGES 0x00000008UL + +// ----------------------------------------------------------------------------- + +#define BMP_COL_TRANS Color( 252, 3, 251 ) +#define BMP_COLOR_MONOCHROME_THRESHOLD 128 + +// --------- +// - Enums - +// --------- + +enum BmpConversion +{ + BMP_CONVERSION_NONE = 0, + BMP_CONVERSION_1BIT_THRESHOLD = 1, + BMP_CONVERSION_1BIT_MATRIX = 2, + BMP_CONVERSION_4BIT_GREYS = 3, + BMP_CONVERSION_4BIT_COLORS = 4, + BMP_CONVERSION_8BIT_GREYS = 5, + BMP_CONVERSION_8BIT_COLORS = 6, + BMP_CONVERSION_24BIT = 7, + BMP_CONVERSION_4BIT_TRANS = 8, + BMP_CONVERSION_8BIT_TRANS = 9, + BMP_CONVERSION_GHOSTED = 10 +}; + +// ------------------------------------------------------------------------ + +enum BmpCombine +{ + BMP_COMBINE_COPY = 0, + BMP_COMBINE_INVERT = 1, + BMP_COMBINE_AND = 2, + BMP_COMBINE_NAND = 3, + BMP_COMBINE_OR = 4, + BMP_COMBINE_NOR = 5, + BMP_COMBINE_XOR = 6, + BMP_COMBINE_NXOR = 7 +}; + +// ------------------------------------------------------------------------ + +enum BmpReduce +{ + BMP_REDUCE_SIMPLE = 0, + BMP_REDUCE_POPULAR = 1, + BMP_REDUCE_MEDIAN = 2 +}; + +// ------------------------------------------------------------------------ + +enum BmpEmboss +{ + BMP_EMBOSS_TOPLEFT = 0, + BMP_EMBOSS_TOP = 1, + BMP_EMBOSS_TOPRIGHT = 2, + BMP_EMBOSS_LEFT = 3, + BMP_EMBOSS_MIDDLE = 4, + BMP_EMBOSS_RIGHT = 5, + BMP_EMBOSS_BOTTOMLEFT = 6, + BMP_EMBOSS_BOTTOM = 7, + BMP_EMBOSS_BOTTOMRIGHT = 8 +}; + +// ------------------------------------------------------------------------ + +enum BmpFilter +{ + BMP_FILTER_SMOOTH = 0, + BMP_FILTER_SHARPEN = 1, + BMP_FILTER_REMOVENOISE = 2, + BMP_FILTER_SOBEL_GREY = 3, + BMP_FILTER_EMBOSS_GREY = 4, + BMP_FILTER_SOLARIZE = 5, + BMP_FILTER_SEPIA = 6, + BMP_FILTER_MOSAIC = 7, + BMP_FILTER_POPART = 8, + + BMP_FILTER_UNKNOWN = 65535 +}; + +// ------------------------------------------------------------------------ + +enum BmpColorMode +{ + BMP_COLOR_NORMAL = 0, + BMP_COLOR_HIGHCONTRAST = 1, + BMP_COLOR_MONOCHROME_BLACK = 2, + BMP_COLOR_MONOCHROME_WHITE = 3 +}; + +// -------------------- +// - FilterParameters - +// -------------------- + +class VCL_DLLPUBLIC BmpFilterParam +{ + friend class Bitmap; + friend class BitmapEx; + friend class Animation; + +private: + BmpFilter meFilter; + ULONG mnProgressStart; + ULONG mnProgressEnd; + +public: + struct MosaicTileSize + { + ULONG mnTileWidth; + ULONG mnTileHeight; + }; + + struct EmbossAngles + { + USHORT mnAzimuthAngle100; + USHORT mnElevationAngle100; + }; + +private: + union + { + USHORT mnSepiaPercent; + BYTE mcSolarGreyThreshold; + + MosaicTileSize maMosaicTileSize; + EmbossAngles maEmbossAngles; + }; + +public: + + BmpFilterParam( ULONG nProgressStart = 0, ULONG nProgressEnd = 0 ) : + meFilter( BMP_FILTER_UNKNOWN ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) {} + + BmpFilterParam( BYTE cSolarGreyThreshold, ULONG nProgressStart = 0, ULONG nProgressEnd = 0 ) : + meFilter( BMP_FILTER_SOLARIZE ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ), + mcSolarGreyThreshold( cSolarGreyThreshold ) {} + + BmpFilterParam( USHORT nSepiaPercent, ULONG nProgressStart = 0, ULONG nProgressEnd = 0 ) : + meFilter( BMP_FILTER_SEPIA ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ), + mnSepiaPercent( nSepiaPercent ) {} + + BmpFilterParam( const Size& rMosaicTileSize, ULONG nProgressStart = 0, ULONG nProgressEnd = 0 ) : + meFilter( BMP_FILTER_MOSAIC ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) + { + maMosaicTileSize.mnTileWidth = rMosaicTileSize.Width(); + maMosaicTileSize.mnTileHeight= rMosaicTileSize.Height(); + } + BmpFilterParam( USHORT nEmbossAzimuthAngle100, USHORT nEmbossElevationAngle100, + ULONG nProgressStart = 0, ULONG nProgressEnd = 0 ) : + meFilter( BMP_FILTER_EMBOSS_GREY ), mnProgressStart( nProgressStart ), mnProgressEnd( nProgressEnd ) + { + maEmbossAngles.mnAzimuthAngle100 = nEmbossAzimuthAngle100; + maEmbossAngles.mnElevationAngle100 = nEmbossElevationAngle100; + } +}; + +// ---------- +// - Bitmap - +// ---------- + +class BitmapReadAccess; +class BitmapWriteAccess; +class BitmapPalette; +class ImpBitmap; +class Color; +class SvStream; +struct DIBInfoHeader; +class ResId; +class GDIMetaFile; +class AlphaMask; +class OutputDevice; +class SalBitmap; + +struct BitmapSystemData +{ + #if defined( WNT ) || defined( OS2 ) + void* pDIB; // device independent byte buffer + void* pDDB; // if not NULL then this is actually an HBITMAP + #elif defined( QUARTZ ) + void* rImageContext; //Image context (CGContextRef) + #else + void* aPixmap; + #endif + int mnWidth; + int mnHeight; +}; + +class VCL_DLLPUBLIC Bitmap +{ +private: + + ImpBitmap* mpImpBmp; + MapMode maPrefMapMode; + Size maPrefSize; + +//#if 0 // _SOLAR__PRIVATE + +public: + + SAL_DLLPRIVATE void ImplReleaseRef(); + SAL_DLLPRIVATE void ImplMakeUnique(); + ImpBitmap* ImplGetImpBitmap() const; + SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp ); + SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap ); + + SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset ); + SAL_DLLPRIVATE static BOOL ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset ); + SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown ); + SAL_DLLPRIVATE static BOOL ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad ); + SAL_DLLPRIVATE static BOOL ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown ); + SAL_DLLPRIVATE BOOL ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const; + SAL_DLLPRIVATE static BOOL ImplWriteDIBFileHeader( SvStream& rOStm, BitmapReadAccess& rAcc ); + SAL_DLLPRIVATE static BOOL ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc ); + SAL_DLLPRIVATE static BOOL ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, + ULONG nCompression, sal_uInt32& rImageSize ); + SAL_DLLPRIVATE static void ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader, + BitmapWriteAccess& rAcc, BOOL bRLE4 ); + SAL_DLLPRIVATE static BOOL ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 ); + + SAL_DLLPRIVATE BOOL ImplScaleFast( const double& rScaleX, const double& rScaleY ); + SAL_DLLPRIVATE BOOL ImplScaleInterpolate( const double& rScaleX, const double& rScaleY ); + SAL_DLLPRIVATE BOOL ImplMakeMono( BYTE cThreshold ); + SAL_DLLPRIVATE BOOL ImplMakeMonoDither(); + SAL_DLLPRIVATE BOOL ImplMakeGreyscales( USHORT nGreyscales ); + SAL_DLLPRIVATE BOOL ImplConvertUp( USHORT nBitCount, Color* pExtColor = NULL ); + SAL_DLLPRIVATE BOOL ImplConvertDown( USHORT nBitCount, Color* pExtColor = NULL ); + SAL_DLLPRIVATE BOOL ImplConvertGhosted(); + SAL_DLLPRIVATE BOOL ImplDitherMatrix(); + SAL_DLLPRIVATE BOOL ImplDitherFloyd(); + SAL_DLLPRIVATE BOOL ImplDitherFloyd16(); + SAL_DLLPRIVATE BOOL ImplReduceSimple( USHORT nColorCount ); + SAL_DLLPRIVATE BOOL ImplReducePopular( USHORT nColorCount ); + SAL_DLLPRIVATE BOOL ImplReduceMedian( USHORT nColorCount ); + SAL_DLLPRIVATE void ImplMedianCut( ULONG* pColBuf, BitmapPalette& rPal, + long nR1, long nR2, long nG1, long nG2, long nB1, long nB2, + long nColors, long nPixels, long& rIndex ); + SAL_DLLPRIVATE BOOL ImplConvolute3( const long* pMatrix, long nDivisor, + const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplMedianFilter( const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplSobelGrey( const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplSolarize( const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplSepia( const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplMosaic( const BmpFilterParam* pFilterParam, const Link* pProgress ); + SAL_DLLPRIVATE BOOL ImplPopArt( const BmpFilterParam* pFilterParam, const Link* pProgress ); + +//#endif // PRIVATE + +public: + + Bitmap(); + Bitmap( const Bitmap& rBitmap ); + Bitmap( const Size& rSizePixel, USHORT nBitCount, const BitmapPalette* pPal = NULL ); + Bitmap( const ResId& rResId ); + Bitmap( SalBitmap* pSalBitmap ); + ~Bitmap(); + + Bitmap& operator=( const Bitmap& rBitmap ); + inline BOOL operator!() const; + inline BOOL operator==( const Bitmap& rBitmap ) const; + inline BOOL operator!=( const Bitmap& rBitmap ) const; + + inline BOOL IsSameInstance( const Bitmap& rBmp ) const; + BOOL IsEqual( const Bitmap& rBmp ) const; + + inline BOOL IsEmpty() const; + void SetEmpty(); + + inline const MapMode& GetPrefMapMode() const; + inline void SetPrefMapMode( const MapMode& rMapMode ); + + inline const Size& GetPrefSize() const; + inline void SetPrefSize( const Size& rSize ); + + Size GetSizePixel() const; + void SetSizePixel( const Size& rNewSize ); + + /** + * The pixel size of a bitmap's source (e.g. an image file) + * and the pixel size of its resulting bitmap can differ, + * e.g. when the image reader has its preview mode enabled. + */ + Size GetSourceSizePixel() const; + void SetSourceSizePixel( const Size& ); + + + USHORT GetBitCount() const; + inline ULONG GetColorCount() const; + inline ULONG GetSizeBytes() const; + BOOL HasGreyPalette() const; + /** get system dependent bitmap data + + @param rData + The system dependent BitmapSystemData structure to be filled + + @return TRUE if the bitmap has a valid system object (e.g. not empty) + */ + bool GetSystemData( BitmapSystemData& rData ) const; + + ULONG GetChecksum() const; + + Bitmap CreateDisplayBitmap( OutputDevice* pDisplay ); + Bitmap GetColorTransformedBitmap( BmpColorMode eColorMode ) const; + + static const BitmapPalette& GetGreyPalette( int nEntries ); + +public: + + BOOL MakeMono( BYTE cThreshold ); + + + /** Convert bitmap format + + @param eConversion + The format this bitmap should be converted to. + + @return TRUE, if the conversion was completed successfully. + */ + BOOL Convert( BmpConversion eConversion ); + + /** Reduce number of colors for the bitmap + + @param nNewColorCount + Maximal number of bitmap colors after the reduce operation + + @param eReduce + Algorithm to use for color reduction + + @return TRUE, if the color reduction operation was completed successfully. + */ + BOOL ReduceColors( USHORT nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE ); + + /** Apply a dither algorithm to the bitmap + + This method dithers the bitmap inplace, i.e. a true color + bitmap is converted to a paletted bitmap, reducing the color + deviation by error diffusion. + + @param nDitherFlags + The algorithm to be used for dithering + + @param pDitherPal + A custom palette to be used when dithering (not yet implemented, leave NULL) + */ + BOOL Dither( ULONG nDitherFlags = BMP_DITHER_MATRIX ); + + /** Crop the bitmap + + @param rRectPixel + A rectangle specifying the crop amounts on all four sides of + the bitmap. If the upper left corner of the bitmap is assigned + (0,0), then this method cuts out the given rectangle from the + bitmap. Note that the rectangle is clipped to the bitmap's + dimension, i.e. negative left,top rectangle coordinates or + exceeding width or height is ignored. + + @return TRUE, if cropping was performed successfully. If + nothing had to be cropped, because e.g. the crop rectangle + included the bitmap, FALSE is returned, too! + */ + BOOL Crop( const Rectangle& rRectPixel ); + + /** Expand the bitmap by pixel padding + + @param nDX + Number of pixel to pad at the right border of the bitmap + + @param nDY + Number of scanlines to pad at the bottom border of the bitmap + + @param pInitColor + Color to use for padded pixel + + @return TRUE, if padding was performed successfully. FALSE is + not only returned when the operation failed, but also if + nothing had to be done, e.g. because nDX and nDY were zero. + */ + BOOL Expand( ULONG nDX, ULONG nDY, + const Color* pInitColor = NULL ); + + /** Copy a rectangular area from another bitmap + + @param rRectDst + Destination rectangle in this bitmap. This is clipped to the + bitmap dimensions. + + @param rRectSrc + Source rectangle in pBmpSrc. This is clipped to the source + bitmap dimensions. Note further that no scaling takes place + during this copy operation, i.e. only the minimum of source + and destination rectangle's width and height are used. + + @param pBmpSrc + The source bitmap to copy from. If this argument is NULL, or + equal to the object this method is called on, copying takes + place within the same bitmap. + + @return TRUE, if the operation completed successfully. FALSE + is not only returned when the operation failed, but also if + nothing had to be done, e.g. because one of the rectangles are + empty. + */ + BOOL CopyPixel( const Rectangle& rRectDst, + const Rectangle& rRectSrc, + const Bitmap* pBmpSrc = NULL ); + + /** Perform boolean operations with another bitmap + + @param rMask + The mask bitmap in the selected combine operation + + @param eCombine + The combine operation to perform on the bitmap + + @return TRUE, if the operation was completed successfully. + */ + BOOL CombineSimple( const Bitmap& rMask, + BmpCombine eCombine ); + + /** Alpha-blend the given bitmap against a specified uniform + background color. + + @attention This method might convert paletted bitmaps to + truecolor, to be able to represent every necessary color. Note + that during alpha blending, lots of colors not originally + included in the bitmap can be generated. + + @param rAlpha + Alpha mask to blend with + + @param rBackgroundColor + Background color to use for every pixel during alpha blending + + @return TRUE, if blending was successful, FALSE otherwise + */ + BOOL Blend( const AlphaMask& rAlpha, + const Color& rBackgroundColor ); + + /** Fill the entire bitmap with the given color + + @param rFillColor + Color value to use for filling + + @return TRUE, if the operation was completed successfully. + */ + BOOL Erase( const Color& rFillColor ); + + /** Perform the Invert operation on every pixel + + @return TRUE, if the operation was completed successfully. + */ + BOOL Invert(); + + /** Mirror the bitmap + + @param nMirrorFlags + About which axis (horizontal, vertical, or both) to mirror + + @return TRUE, if the operation was completed successfully. + */ + BOOL Mirror( ULONG nMirrorFlags ); + + /** Scale the bitmap + + @param rNewSize + The resulting size of the scaled bitmap + + @param nScaleFlag + The algorithm to be used for scaling + + @return TRUE, if the operation was completed successfully. + */ + BOOL Scale( const Size& rNewSize, + ULONG nScaleFlag = BMP_SCALE_FAST ); + + /** Scale the bitmap + + @param rScaleX + The scale factor in x direction. + + @param rScaleY + The scale factor in y direction. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Scale( const double& rScaleX, const double& rScaleY, + ULONG nScaleFlag = BMP_SCALE_FAST ); + + /** Rotate bitmap by the specified angle + + @param nAngle10 + The rotation angle in tenth of a degree. The bitmap is always rotated around its center. + + @param rFillColor + The color to use for filling blank areas. During rotation, the + bitmap is enlarged such that the whole rotation result fits + in. The empty spaces around that rotated original bitmap are + then filled with this color. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Rotate( long nAngle10, const Color& rFillColor ); + + /** Create on-off mask from bitmap + + This method creates a bitmask from the bitmap, where every + pixel that equals rTransColor is set transparent, the rest + opaque. + + @param rTransColor + Color value where the bitmask should be transparent + + @param nTol + Tolerance value. Specifies the maximal difference between + rTransColor and the individual pixel values, such that the + corresponding pixel is still regarded transparent. + + @return the resulting bitmask. + */ + Bitmap CreateMask( const Color& rTransColor, ULONG nTol = 0UL ) const; + + /** Create region of similar colors in a given rectangle + + @param rColor + All pixel which have this color are included in the calculated region + + @param rRect + The rectangle within which matching pixel are looked for. This + rectangle is always clipped to the bitmap dimensions. + + @return the generated region. + */ + Region CreateRegion( const Color& rColor, const Rectangle& rRect ) const; + + /** Replace all pixel where the given mask is on with the specified color + + @param rMask + Mask specifying which pixel should be replaced + + @param rReplaceColor + Color to be placed in all changed pixel + + @return TRUE, if the operation was completed successfully. + */ + BOOL Replace( const Bitmap& rMask, const Color& rReplaceColor ); + + /** Merge bitmap with given background color according to specified alpha mask + + @param rAlpha + Alpha mask specifying the amount of background color to merge in + + @param rMergeColor + Background color to be used for merging + + @return TRUE, if the operation was completed successfully. + */ + BOOL Replace( const AlphaMask& rAlpha, const Color& rMergeColor ); + + /** Replace all pixel having the search color with the specified color + + @param rSearchColor + Color specifying which pixel should be replaced + + @param rReplaceColor + Color to be placed in all changed pixel + + @param nTol + Tolerance value. Specifies the maximal difference between + rSearchColor and the individual pixel values, such that the + corresponding pixel is still regarded a match. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol = 0 ); + + /** Replace all pixel having one the search colors with the corresponding replace color + + @param pSearchColor + Array of colors specifying which pixel should be replaced + + @param pReplaceColor + Array of colors to be placed in all changed pixel + + @param nColorCount + Size of the aforementioned color arrays + + @param nTol + Tolerance value. Specifies the maximal difference between + pSearchColor colors and the individual pixel values, such that + the corresponding pixel is still regarded a match. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Replace( const Color* pSearchColors, const Color* rReplaceColors, + ULONG nColorCount, ULONG* pTols = NULL ); + + /** Convert the bitmap to a PolyPolygon + + This works by putting continuous areas of the same color into + a polygon, by tracing its bounding line. + + @param rPolyPoly + The resulting PolyPolygon + + @param nFlags + Whether the inline or the outline of the color areas should be + represented by the polygon + + @param pProgress + A callback for showing the progress of the vectorization + + @return TRUE, if the operation was completed successfully. + */ + BOOL Vectorize( PolyPolygon& rPolyPoly, + ULONG nFlags = BMP_VECTORIZE_OUTER, + const Link* pProgress = NULL ); + + /** Convert the bitmap to a meta file + + This works by putting continuous areas of the same color into + polygons painted in this color, by tracing the area's bounding + line. + + @param rMtf + The resulting meta file + + @param cReduce + If non-null, minimal size of bound rects for individual polygons. Smaller ones are ignored. + + @param nFlags + Whether the inline or the outline of the color areas should be + represented by the polygon + + @param pProgress + A callback for showing the progress of the vectorization + + @return TRUE, if the operation was completed successfully. + */ + BOOL Vectorize( GDIMetaFile& rMtf, BYTE cReduce = 0, + ULONG nFlags = BMP_VECTORIZE_INNER, + const Link* pProgress = NULL ); + + /** Change various global color characteristics + + @param nLuminancePercent + Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nContrastPercent + Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nChannelRPercent + Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nChannelGPercent + Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nChannelBPercent + Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param fGamma + Exponent of the gamma function applied to the bitmap. The + value 1.0 results in no change, the valid range is + (0.0,10.0]. Values outside this range are regarded as 1.0. + + @param bInvert + If TRUE, invert the channel values with the logical 'not' operator + + @return TRUE, if the operation was completed successfully. + */ + BOOL Adjust( short nLuminancePercent = 0, + short nContrastPercent = 0, + short nChannelRPercent = 0, + short nChannelGPercent = 0, + short nChannelBPercent = 0, + double fGamma = 1.0, + BOOL bInvert = FALSE ); + + /** Apply specified filter to the bitmap + + @param eFilter + The filter algorithm to apply + + @param pFilterParam + Various parameter for the different bitmap filter algorithms + + @param pProgress + A callback for showing the progress of the vectorization + + @return TRUE, if the operation was completed successfully. + */ + BOOL Filter( BmpFilter eFilter, + const BmpFilterParam* pFilterParam = NULL, + const Link* pProgress = NULL ); + +public: + BitmapReadAccess* AcquireReadAccess(); + BitmapWriteAccess* AcquireWriteAccess(); + void ReleaseAccess( BitmapReadAccess* pAccess ); + +public: + + BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE ); + BOOL Write( SvStream& rOStm, BOOL bCompressed = TRUE, BOOL bFileHeader = TRUE ) const; + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap ); +}; + +// ----------- +// - Inlines - +// ----------- + +inline BOOL Bitmap::operator!() const +{ + return( mpImpBmp == NULL ); +} + +// ------------------------------------------------------------------ + +inline BOOL Bitmap::operator==( const Bitmap& rBitmap ) const +{ + return( rBitmap.mpImpBmp == mpImpBmp ); +} + +// ------------------------------------------------------------------ + +inline BOOL Bitmap::operator!=( const Bitmap& rBitmap ) const +{ + return( rBitmap.mpImpBmp != mpImpBmp ); +} + +// ------------------------------------------------------------------ + +inline BOOL Bitmap::IsSameInstance( const Bitmap& rBitmap ) const +{ + return( rBitmap.mpImpBmp == mpImpBmp ); +} + +// ------------------------------------------------------------------ + +inline BOOL Bitmap::IsEmpty() const +{ + return( mpImpBmp == NULL ); +} + +// ------------------------------------------------------------------ + +inline const MapMode& Bitmap::GetPrefMapMode() const +{ + return maPrefMapMode; +} + +// ------------------------------------------------------------------ + +inline void Bitmap::SetPrefMapMode( const MapMode& rMapMode ) +{ + maPrefMapMode = rMapMode; +} + +// ------------------------------------------------------------------ + +inline const Size& Bitmap::GetPrefSize() const +{ + return maPrefSize; +} + +// ------------------------------------------------------------------ + +inline void Bitmap::SetPrefSize( const Size& rSize ) +{ + maPrefSize = rSize; +} + +// ------------------------------------------------------------------ + +inline ULONG Bitmap::GetColorCount() const +{ + return( 1UL << (ULONG) GetBitCount() ); +} + +// ------------------------------------------------------------------ + +inline ULONG Bitmap::GetSizeBytes() const +{ + const Size aSizePix( GetSizePixel() ); + return( ( (ULONG) aSizePix.Width() * aSizePix.Height() * GetBitCount() ) >> 3UL ); +} + +#endif // _SV_BITMAP_HXX diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx new file mode 100644 index 000000000000..c19e1a9cbc39 --- /dev/null +++ b/vcl/inc/vcl/bitmapex.hxx @@ -0,0 +1,400 @@ +/************************************************************************* + * + * 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_BITMAPEX_HXX +#define _SV_BITMAPEX_HXX + +#include <vcl/dllapi.h> +#include <vcl/bitmap.hxx> +#include <vcl/alpha.hxx> +#include <tools/color.hxx> + +// ------------------- +// - TransparentType - +// ------------------- + +enum TransparentType +{ + TRANSPARENT_NONE, + TRANSPARENT_COLOR, + TRANSPARENT_BITMAP +}; + +// ------------ +// - BitmapEx - +// ------------ + +class VCL_DLLPUBLIC BitmapEx +{ + friend class ImpGraphic; + +private: + + Bitmap aBitmap; + Bitmap aMask; + Size aBitmapSize; + Color aTransparentColor; + TransparentType eTransparent; + BOOL bAlpha; + +public: + +//#if 0 // _SOLAR__PRIVATE + + SAL_DLLPRIVATE ImpBitmap* ImplGetBitmapImpBitmap() const { return aBitmap.ImplGetImpBitmap(); } + SAL_DLLPRIVATE ImpBitmap* ImplGetMaskImpBitmap() const { return aMask.ImplGetImpBitmap(); } + +//#endif // PRIVATE + +public: + + BitmapEx(); + BitmapEx( const ResId& rResId ); + BitmapEx( const BitmapEx& rBitmapEx ); + BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ); + BitmapEx( const Bitmap& rBmp ); + BitmapEx( const Bitmap& rBmp, const Bitmap& rMask ); + BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ); + BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor ); + ~BitmapEx(); + + BitmapEx& operator=( const BitmapEx& rBitmapEx ); + BOOL operator==( const BitmapEx& rBitmapEx ) const; + BOOL operator!=( const BitmapEx& rBitmapEx ) const { return !(*this==rBitmapEx); } + BOOL operator!() const { return !aBitmap; } + + BOOL IsEqual( const BitmapEx& rBmpEx ) const; + + BOOL IsEmpty() const; + void SetEmpty(); + void Clear(); + + void Draw( OutputDevice* pOutDev, + const Point& rDestPt ) const; + void Draw( OutputDevice* pOutDev, + const Point& rDestPt, const Size& rDestSize ) const; + void Draw( OutputDevice* pOutDev, + const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel ) const; + + BOOL IsTransparent() const; + TransparentType GetTransparentType() const { return eTransparent; } + + Bitmap GetBitmap( const Color* pTransReplaceColor = NULL ) const; + Bitmap GetMask() const; + + BitmapEx GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const; + + BOOL IsAlpha() const; + AlphaMask GetAlpha() const; + + const Size& GetSizePixel() const { return aBitmapSize; } + void SetSizePixel( const Size& rNewSize ); + + const Size& GetPrefSize() const { return aBitmap.GetPrefSize(); } + void SetPrefSize( const Size& rPrefSize ) { aBitmap.SetPrefSize( rPrefSize ); } + + const MapMode& GetPrefMapMode() const { return aBitmap.GetPrefMapMode(); } + void SetPrefMapMode( const MapMode& rPrefMapMode ) { aBitmap.SetPrefMapMode( rPrefMapMode ); } + + const Color& GetTransparentColor() const { return aTransparentColor; } + void SetTransparentColor( const Color& rColor ) { aTransparentColor = rColor; } + + USHORT GetBitCount() const { return aBitmap.GetBitCount(); } + ULONG GetSizeBytes() const; + ULONG GetChecksum() const; + +public: + + /** Convert bitmap format + + @param eConversion + The format this bitmap should be converted to. + + @return TRUE, if the conversion was completed successfully. + */ + BOOL Convert( BmpConversion eConversion ); + + /** Reduce number of colors for the bitmap + + @param nNewColorCount + Maximal number of bitmap colors after the reduce operation + + @param eReduce + Algorithm to use for color reduction + + @return TRUE, if the color reduction operation was completed successfully. + */ + BOOL ReduceColors( USHORT nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE ); + + /** Apply a dither algorithm to the bitmap + + This method dithers the bitmap inplace, i.e. a true color + bitmap is converted to a paletted bitmap, reducing the color + deviation by error diffusion. + + @param nDitherFlags + The algorithm to be used for dithering + */ + BOOL Dither( ULONG nDitherFlags = BMP_DITHER_MATRIX ); + + /** Crop the bitmap + + @param rRectPixel + A rectangle specifying the crop amounts on all four sides of + the bitmap. If the upper left corner of the bitmap is assigned + (0,0), then this method cuts out the given rectangle from the + bitmap. Note that the rectangle is clipped to the bitmap's + dimension, i.e. negative left,top rectangle coordinates or + exceeding width or height is ignored. + + @return TRUE, if cropping was performed successfully. If + nothing had to be cropped, because e.g. the crop rectangle + included the bitmap, FALSE is returned, too! + */ + BOOL Crop( const Rectangle& rRectPixel ); + + /** Expand the bitmap by pixel padding + + @param nDX + Number of pixel to pad at the right border of the bitmap + + @param nDY + Number of scanlines to pad at the bottom border of the bitmap + + @param pInitColor + Color to use for padded pixel + + @return TRUE, if padding was performed successfully. FALSE is + not only returned when the operation failed, but also if + nothing had to be done, e.g. because nDX and nDY were zero. + */ + BOOL Expand( ULONG nDX, ULONG nDY, + const Color* pInitColor = NULL, + BOOL bExpandTransparent = FALSE ); + + /** Copy a rectangular area from another bitmap + + @param rRectDst + Destination rectangle in this bitmap. This is clipped to the + bitmap dimensions. + + @param rRectSrc + Source rectangle in pBmpSrc. This is clipped to the source + bitmap dimensions. Note further that no scaling takes place + during this copy operation, i.e. only the minimum of source + and destination rectangle's width and height are used. + + @param pBmpSrc + The source bitmap to copy from. If this argument is NULL, or + equal to the object this method is called on, copying takes + place within the same bitmap. + + @return TRUE, if the operation completed successfully. FALSE + is not only returned when the operation failed, but also if + nothing had to be done, e.g. because one of the rectangles are + empty. + */ + BOOL CopyPixel( const Rectangle& rRectDst, + const Rectangle& rRectSrc, + const BitmapEx* pBmpExSrc = NULL ); + + /** Fill the entire bitmap with the given color + + @param rFillColor + Color value to use for filling. Set the transparency part of + the color to fill the mask. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Erase( const Color& rFillColor ); + + /** Perform the Invert operation on every pixel + + @return TRUE, if the operation was completed successfully. + */ + BOOL Invert(); + + /** Mirror the bitmap + + @param nMirrorFlags + About which axis (horizontal, vertical, or both) to mirror + + @return TRUE, if the operation was completed successfully. + */ + BOOL Mirror( ULONG nMirrorFlags ); + + /** Scale the bitmap + + @param rNewSize + The resulting size of the scaled bitmap + + @param nScaleFlag + The algorithm to be used for scaling + + @return TRUE, if the operation was completed successfully. + */ + BOOL Scale( const Size& rNewSize, ULONG nScaleFlag = BMP_SCALE_FAST ); + + /** Scale the bitmap + + @param rScaleX + The scale factor in x direction. + + @param rScaleY + The scale factor in y direction. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag = BMP_SCALE_FAST ); + + /** Rotate bitmap by the specified angle + + @param nAngle10 + The rotation angle in tenth of a degree. The bitmap is always rotated around its center. + + @param rFillColor + The color to use for filling blank areas. During rotation, the + bitmap is enlarged such that the whole rotation result fits + in. The empty spaces around that rotated original bitmap are + then filled with this color. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Rotate( long nAngle10, const Color& rFillColor ); + + /** Replace all pixel having the search color with the specified color + + @param rSearchColor + Color specifying which pixel should be replaced + + @param rReplaceColor + Color to be placed in all changed pixel + + @param nTol + Tolerance value. Specifies the maximal difference between + rSearchColor and the individual pixel values, such that the + corresponding pixel is still regarded a match. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol = 0 ); + + /** Replace all pixel having one the search colors with the corresponding replace color + + @param pSearchColor + Array of colors specifying which pixel should be replaced + + @param pReplaceColor + Array of colors to be placed in all changed pixel + + @param nColorCount + Size of the aforementioned color arrays + + @param nTol + Tolerance value. Specifies the maximal difference between + pSearchColor colors and the individual pixel values, such that + the corresponding pixel is still regarded a match. + + @return TRUE, if the operation was completed successfully. + */ + BOOL Replace( const Color* pSearchColors, const Color* pReplaceColors, + ULONG nColorCount, const ULONG* pTols = NULL ); + + /** Change various global color characteristics + + @param nLuminancePercent + Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nContrastPercent + Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nChannelRPercent + Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nChannelGPercent + Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param nChannelBPercent + Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range. + + @param fGamma + Exponent of the gamma function applied to the bitmap. The + value 1.0 results in no change, the valid range is + (0.0,10.0]. Values outside this range are regarded as 1.0. + + @param bInvert + If TRUE, invert the channel values with the logical 'not' operator + + @return TRUE, if the operation was completed successfully. + */ + BOOL Adjust( short nLuminancePercent = 0, + short nContrastPercent = 0, + short nChannelRPercent = 0, + short nChannelGPercent = 0, + short nChannelBPercent = 0, + double fGamma = 1.0, + BOOL bInvert = FALSE ); + + /** Apply specified filter to the bitmap + + @param eFilter + The filter algorithm to apply + + @param pFilterParam + Various parameter for the different bitmap filter algorithms + + @param pProgress + A callback for showing the progress of the vectorization + + @return TRUE, if the operation was completed successfully. + */ + BOOL Filter( BmpFilter eFilter, + const BmpFilterParam* pFilterParam = NULL, + const Link* pProgress = NULL ); + + /** Get transparency at given position + + @param nX + integer X-Position in Bitmap + + @param nY + integer Y-Position in Bitmap + + @return transparency value in the range of [0 .. 255] where + 0 is not transparent, 255 is fully transparent + */ + sal_uInt8 GetTransparency(sal_Int32 nX, sal_Int32 nY) const; + +public: + + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ); +}; + +#endif // _SV_BITMAPEX_HXX diff --git a/vcl/inc/vcl/bmpacc.hxx b/vcl/inc/vcl/bmpacc.hxx new file mode 100644 index 000000000000..f83b4c73a903 --- /dev/null +++ b/vcl/inc/vcl/bmpacc.hxx @@ -0,0 +1,545 @@ +/************************************************************************* + * + * 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_BMPACC_HXX +#define _SV_BMPACC_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/salbtype.hxx> +#include <vcl/bitmap.hxx> + +//#if 0 // _SOLAR__PRIVATE + +// -------------------- +// - Access defines - +// -------------------- + +#define DECL_FORMAT_GETPIXEL( Format ) \ +static BitmapColor GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask ); + +#define DECL_FORMAT_SETPIXEL( Format ) \ +static void SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask ); + +#define DECL_FORMAT( Format ) \ +DECL_FORMAT_GETPIXEL( Format ) \ +DECL_FORMAT_SETPIXEL( Format ) + +#define IMPL_FORMAT_GETPIXEL( Format ) \ +BitmapColor BitmapReadAccess::GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& rMask ) + +#define IMPL_FORMAT_GETPIXEL_NOMASK( Format ) \ +BitmapColor BitmapReadAccess::GetPixelFor##Format( ConstScanline pScanline, long nX, const ColorMask& ) + +#define IMPL_FORMAT_SETPIXEL( Format ) \ +void BitmapReadAccess::SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask ) + +#define IMPL_FORMAT_SETPIXEL_NOMASK( Format ) \ +void BitmapReadAccess::SetPixelFor##Format( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& ) + +#define CASE_FORMAT( Format ) \ +case( BMP_FORMAT##Format ): \ +{ \ + mFncGetPixel = GetPixelFor##Format;\ + mFncSetPixel = SetPixelFor##Format;\ +} \ +break; + +//#endif // __PRIVATE + +// -------------------- +// - Access functions - +// -------------------- + +typedef BitmapColor (*FncGetPixel)( ConstScanline pScanline, long nX, const ColorMask& rMask ); +typedef void (*FncSetPixel)( Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask& rMask ); + +// -------------------- +// - BitmapReadAccess - +// -------------------- + +class VCL_DLLPUBLIC BitmapReadAccess +{ + friend class BitmapWriteAccess; + +private: + + BitmapReadAccess() {} + BitmapReadAccess( const BitmapReadAccess& ) {} + BitmapReadAccess& operator=( const BitmapReadAccess& ) { return *this; } + +protected: + Bitmap maBitmap; + BitmapBuffer* mpBuffer; + Scanline* mpScanBuf; + ColorMask maColorMask; + FncGetPixel mFncGetPixel; + FncSetPixel mFncSetPixel; + BOOL mbModify; + +//#if 0 // _SOLAR__PRIVATE + +SAL_DLLPRIVATE void ImplCreate( Bitmap& rBitmap ); +SAL_DLLPRIVATE void ImplDestroy(); +SAL_DLLPRIVATE BOOL ImplSetAccessPointers( ULONG nFormat ); + +public: + +SAL_DLLPRIVATE void ImplZeroInitUnusedBits(); +SAL_DLLPRIVATE BitmapBuffer* ImplGetBitmapBuffer() const { return mpBuffer; } + + DECL_FORMAT( _1BIT_MSB_PAL ) + DECL_FORMAT( _1BIT_LSB_PAL ) + DECL_FORMAT( _4BIT_MSN_PAL ) + DECL_FORMAT( _4BIT_LSN_PAL ) + DECL_FORMAT( _8BIT_PAL ) + DECL_FORMAT( _8BIT_TC_MASK ) + DECL_FORMAT( _16BIT_TC_MSB_MASK ) + DECL_FORMAT( _16BIT_TC_LSB_MASK ) + DECL_FORMAT( _24BIT_TC_BGR ) + DECL_FORMAT( _24BIT_TC_RGB ) + DECL_FORMAT( _24BIT_TC_MASK ) + DECL_FORMAT( _32BIT_TC_ABGR ) + DECL_FORMAT( _32BIT_TC_ARGB ) + DECL_FORMAT( _32BIT_TC_BGRA ) + DECL_FORMAT( _32BIT_TC_RGBA ) + DECL_FORMAT( _32BIT_TC_MASK ) +//#endif // __PRIVATE + +protected: + BitmapReadAccess( Bitmap& rBitmap, BOOL bModify ); + + void Flush(); + void ReAccess( BOOL bModify ); + +public: + BitmapReadAccess( Bitmap& rBitmap ); + virtual ~BitmapReadAccess(); + + inline BOOL operator!() const; + + inline long Width() const; + inline long Height() const; + inline Point TopLeft() const; + inline Point BottomRight() const; + + inline BOOL IsTopDown() const; + inline BOOL IsBottomUp() const; + + inline ULONG GetScanlineFormat() const; + inline ULONG GetScanlineSize() const; + + inline USHORT GetBitCount() const; + inline BitmapColor GetBestMatchingColor( const BitmapColor& rBitmapColor ); + + inline Scanline GetBuffer() const; + inline Scanline GetScanline( long nY ) const; + + inline BOOL HasPalette() const; + inline const BitmapPalette& GetPalette() const; + inline USHORT GetPaletteEntryCount() const; + inline const BitmapColor& GetPaletteColor( USHORT nColor ) const; + inline const BitmapColor& GetBestPaletteColor( const BitmapColor& rBitmapColor ) const; + USHORT GetBestPaletteIndex( const BitmapColor& rBitmapColor ) const; + + inline BOOL HasColorMask() const; + inline ColorMask& GetColorMask() const; + + inline BitmapColor GetPixelFromData( const BYTE* pData, long nX ) const; + inline void SetPixelOnData( BYTE* pData, long nX, const BitmapColor& rBitmapColor ); + inline BitmapColor GetPixel( long nY, long nX ) const; + inline BitmapColor GetColor( long nY, long nX ) const; + inline BYTE GetLuminance( long nY, long nX ) const; +}; + +// --------------------- +// - BitmapWriteAccess - +// --------------------- + +class VCL_DLLPUBLIC BitmapWriteAccess : public BitmapReadAccess +{ +public: + + BitmapWriteAccess( Bitmap& rBitmap ); + virtual ~BitmapWriteAccess(); + + void CopyScanline( long nY, const BitmapReadAccess& rReadAcc ); + void CopyScanline( long nY, ConstScanline aSrcScanline, + ULONG nSrcScanlineFormat, ULONG nSrcScanlineSize ); + + void CopyBuffer( const BitmapReadAccess& rReadAcc ); + + inline void SetPalette( const BitmapPalette& rPalette ); + inline void SetPaletteEntryCount( USHORT nCount ); + inline void SetPaletteColor( USHORT nColor, const BitmapColor& rBitmapColor ); + + inline void SetPixel( long nY, long nX, const BitmapColor& rBitmapColor ); + + void SetLineColor(); + void SetLineColor( const Color& rColor ); + Color GetLineColor() const; + + void SetFillColor(); + void SetFillColor( const Color& rColor ); + Color GetFillColor() const; + + void Erase( const Color& rColor ); + + void DrawLine( const Point& rStart, const Point& rEnd ); + + void FillRect( const Rectangle& rRect ); + void DrawRect( const Rectangle& rRect ); + + void FillPolygon( const Polygon& rPoly ); + void DrawPolygon( const Polygon& rPoly ); + + void FillPolyPolygon( const PolyPolygon& rPoly ); + void DrawPolyPolygon( const PolyPolygon& rPolyPoly ); + +private: + + BitmapColor* mpLineColor; + BitmapColor* mpFillColor; + + BitmapWriteAccess() {} + BitmapWriteAccess( const BitmapWriteAccess& ) : BitmapReadAccess() {} + 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 - +// ----------- + +inline BOOL BitmapReadAccess::operator!() const +{ + return( mpBuffer == NULL ); +} + +// ------------------------------------------------------------------ + +inline long BitmapReadAccess::Width() const +{ + return( mpBuffer ? mpBuffer->mnWidth : 0L ); +} + +// ------------------------------------------------------------------ + +inline long BitmapReadAccess::Height() const +{ + return( mpBuffer ? mpBuffer->mnHeight : 0L ); +} + +// ------------------------------------------------------------------ + +inline Point BitmapReadAccess::TopLeft() const +{ + return Point(); +} + +// ------------------------------------------------------------------ + +inline Point BitmapReadAccess::BottomRight() const +{ + return Point( Width() - 1L, Height() - 1L ); +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapReadAccess::IsTopDown() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return( mpBuffer ? sal::static_int_cast<BOOL>( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) : FALSE ); +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapReadAccess::IsBottomUp() const +{ + return !IsTopDown(); +} + +// ------------------------------------------------------------------ + +inline ULONG BitmapReadAccess::GetScanlineFormat() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return( mpBuffer ? BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ) : 0UL ); +} + +// ------------------------------------------------------------------ + +inline ULONG BitmapReadAccess::GetScanlineSize() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return( mpBuffer ? mpBuffer->mnScanlineSize : 0UL ); +} + +// ------------------------------------------------------------------ + +inline USHORT BitmapReadAccess::GetBitCount() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return( mpBuffer ? mpBuffer->mnBitCount : 0 ); +} + +// ------------------------------------------------------------------ + +inline BitmapColor BitmapReadAccess::GetBestMatchingColor( const BitmapColor& rBitmapColor ) +{ + if( HasPalette() ) + return BitmapColor( (BYTE) GetBestPaletteIndex( rBitmapColor ) ); + else + return rBitmapColor; +} + +// ------------------------------------------------------------------ + +inline Scanline BitmapReadAccess::GetBuffer() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return( mpBuffer ? mpBuffer->mpBits : NULL ); +} + +// ------------------------------------------------------------------ + +inline Scanline BitmapReadAccess::GetScanline( long nY ) const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + DBG_ASSERT( nY < mpBuffer->mnHeight, "y-coordinate out of range!" ); + return( mpBuffer ? mpScanBuf[ nY ] : NULL ); +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapReadAccess::HasPalette() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return( mpBuffer && !!mpBuffer->maPalette ); +} + +// ------------------------------------------------------------------ + +inline const BitmapPalette& BitmapReadAccess::GetPalette() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return mpBuffer->maPalette; +} + +// ------------------------------------------------------------------ + +inline USHORT BitmapReadAccess::GetPaletteEntryCount() const +{ + DBG_ASSERT( HasPalette(), "Bitmap has no palette!" ); + return( HasPalette() ? mpBuffer->maPalette.GetEntryCount() : 0 ); +} + +// ------------------------------------------------------------------ + +inline const BitmapColor& BitmapReadAccess::GetPaletteColor( USHORT nColor ) const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + DBG_ASSERT( HasPalette(), "Bitmap has no palette!" ); + return mpBuffer->maPalette[ nColor ]; +} + +// ------------------------------------------------------------------ + +inline const BitmapColor& BitmapReadAccess::GetBestPaletteColor( const BitmapColor& rBitmapColor ) const +{ + return GetPaletteColor( GetBestPaletteIndex( rBitmapColor ) ); +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapReadAccess::HasColorMask() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + const ULONG nFormat = BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ); + + return( nFormat == BMP_FORMAT_8BIT_TC_MASK || + nFormat == BMP_FORMAT_16BIT_TC_MSB_MASK || + nFormat == BMP_FORMAT_16BIT_TC_LSB_MASK || + nFormat == BMP_FORMAT_24BIT_TC_MASK || + nFormat == BMP_FORMAT_32BIT_TC_MASK ); +} + +// ------------------------------------------------------------------ + +inline ColorMask& BitmapReadAccess::GetColorMask() const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return mpBuffer->maColorMask; +} + +// ------------------------------------------------------------------ + +inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + DBG_ASSERT( nX < mpBuffer->mnWidth, "x-coordinate out of range!" ); + DBG_ASSERT( nY < mpBuffer->mnHeight, "y-coordinate out of range!" ); + return mFncGetPixel( mpScanBuf[ nY ], nX, maColorMask ); +} + +// ------------------------------------------------------------------ + +inline BitmapColor BitmapReadAccess::GetPixelFromData( const BYTE* pData, long nX ) const +{ + DBG_ASSERT( pData, "Access is not valid!" ); + return mFncGetPixel( pData, nX, maColorMask ); +} + +// ------------------------------------------------------------------ + +inline void BitmapReadAccess::SetPixelOnData( BYTE* pData, long nX, const BitmapColor& rBitmapColor ) +{ + DBG_ASSERT( pData, "Access is not valid!" ); + mFncSetPixel( pData, nX, rBitmapColor, maColorMask ); +} + +// ------------------------------------------------------------------ + +inline BitmapColor BitmapReadAccess::GetColor( long nY, long nX ) const +{ + if( !!mpBuffer->maPalette ) + { + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + return mpBuffer->maPalette[ GetPixel( nY, nX ).GetIndex() ]; + } + else + return GetPixel( nY, nX ); +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapReadAccess::GetLuminance( long nY, long nX ) const +{ + return GetColor( nY, nX ).GetLuminance(); +} + +// ------------------------------------------------------------------ + +inline void BitmapWriteAccess::SetPalette( const BitmapPalette& rPalette ) +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + mpBuffer->maPalette = rPalette; +} + +// ------------------------------------------------------------------ + +inline void BitmapWriteAccess::SetPaletteEntryCount( USHORT nCount ) +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + mpBuffer->maPalette.SetEntryCount( nCount ); +} + +// ------------------------------------------------------------------ + +inline void BitmapWriteAccess::SetPaletteColor( USHORT nColor, const BitmapColor& rBitmapColor ) +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + DBG_ASSERT( HasPalette(), "Bitmap has no palette!" ); + mpBuffer->maPalette[ nColor ] = rBitmapColor; +} + +// ------------------------------------------------------------------ + +inline void BitmapWriteAccess::SetPixel( long nY, long nX, const BitmapColor& rBitmapColor ) +{ + DBG_ASSERT( mpBuffer, "Access is not valid!" ); + DBG_ASSERT( nX < mpBuffer->mnWidth, "x-coordinate out of range!" ); + DBG_ASSERT( nY < mpBuffer->mnHeight, "y-coordinate out of range!" ); + mFncSetPixel( mpScanBuf[ nY ], nX, rBitmapColor, maColorMask ); +} + +#endif // _SV_BMPACC_HXX diff --git a/vcl/inc/vcl/bmpfast.hxx b/vcl/inc/vcl/bmpfast.hxx new file mode 100644 index 000000000000..de330704b74f --- /dev/null +++ b/vcl/inc/vcl/bmpfast.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_BMPFAST_HXX +#define _SV_BMPFAST_HXX + +class BitmapWriteAccess; +class BitmapReadAccess; +struct BitmapBuffer; +class BitmapColor; +class Size; +class Point; +struct SalTwoRect; + +// the bmpfast functions have signatures with good compatibility to +// their canonic counterparts, which employ the GetPixel/SetPixel methods + +bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc, + const SalTwoRect& rTwoRect ); + +bool ImplFastBitmapBlending( BitmapWriteAccess& rDst, + const BitmapReadAccess& rSrc, const BitmapReadAccess& rMask, + const SalTwoRect& rTwoRect ); + +bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& ); + +#endif // _SV_BMPFAST_HXX diff --git a/vcl/inc/vcl/brdwin.hxx b/vcl/inc/vcl/brdwin.hxx new file mode 100644 index 000000000000..bf76174150e2 --- /dev/null +++ b/vcl/inc/vcl/brdwin.hxx @@ -0,0 +1,352 @@ +/************************************************************************* + * + * 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_BRDWIN_HXX +#define _SV_BRDWIN_HXX + +#include <vcl/sv.h> +#include <vcl/window.hxx> + +class ImplBorderWindowView; + +// -------------------------- +// - ImplBorderWindow-Types - +// -------------------------- + +#define BORDERWINDOW_STYLE_OVERLAP ((USHORT)0x0001) +#define BORDERWINDOW_STYLE_BORDER ((USHORT)0x0002) +#define BORDERWINDOW_STYLE_FLOAT ((USHORT)0x0004) +#define BORDERWINDOW_STYLE_FRAME ((USHORT)0x0008) +#define BORDERWINDOW_STYLE_APP ((USHORT)0x0010) + +#define BORDERWINDOW_HITTEST_TITLE ((USHORT)0x0001) +#define BORDERWINDOW_HITTEST_LEFT ((USHORT)0x0002) +#define BORDERWINDOW_HITTEST_MENU ((USHORT)0x0004) +#define BORDERWINDOW_HITTEST_TOP ((USHORT)0x0008) +#define BORDERWINDOW_HITTEST_RIGHT ((USHORT)0x0010) +#define BORDERWINDOW_HITTEST_BOTTOM ((USHORT)0x0020) +#define BORDERWINDOW_HITTEST_TOPLEFT ((USHORT)0x0040) +#define BORDERWINDOW_HITTEST_TOPRIGHT ((USHORT)0x0080) +#define BORDERWINDOW_HITTEST_BOTTOMLEFT ((USHORT)0x0100) +#define BORDERWINDOW_HITTEST_BOTTOMRIGHT ((USHORT)0x0200) +#define BORDERWINDOW_HITTEST_CLOSE ((USHORT)0x0400) +#define BORDERWINDOW_HITTEST_ROLL ((USHORT)0x0800) +#define BORDERWINDOW_HITTEST_DOCK ((USHORT)0x1000) +#define BORDERWINDOW_HITTEST_HIDE ((USHORT)0x2000) +#define BORDERWINDOW_HITTEST_HELP ((USHORT)0x4000) +#define BORDERWINDOW_HITTEST_PIN ((USHORT)0x8000) + +#define BORDERWINDOW_DRAW_TITLE ((USHORT)0x0001) +#define BORDERWINDOW_DRAW_BORDER ((USHORT)0x0002) +#define BORDERWINDOW_DRAW_FRAME ((USHORT)0x0004) +#define BORDERWINDOW_DRAW_CLOSE ((USHORT)0x0008) +#define BORDERWINDOW_DRAW_ROLL ((USHORT)0x0010) +#define BORDERWINDOW_DRAW_DOCK ((USHORT)0x0020) +#define BORDERWINDOW_DRAW_HIDE ((USHORT)0x0040) +#define BORDERWINDOW_DRAW_HELP ((USHORT)0x0080) +#define BORDERWINDOW_DRAW_PIN ((USHORT)0x0100) +#define BORDERWINDOW_DRAW_MENU ((USHORT)0x0200) +#define BORDERWINDOW_DRAW_ALL (BORDERWINDOW_DRAW_TITLE | \ + BORDERWINDOW_DRAW_BORDER | \ + BORDERWINDOW_DRAW_FRAME | \ + BORDERWINDOW_DRAW_CLOSE | \ + BORDERWINDOW_DRAW_ROLL | \ + BORDERWINDOW_DRAW_DOCK | \ + BORDERWINDOW_DRAW_HIDE | \ + BORDERWINDOW_DRAW_HELP | \ + BORDERWINDOW_DRAW_PIN | \ + BORDERWINDOW_DRAW_MENU) + +#define BORDERWINDOW_TITLE_NORMAL ((USHORT)0x0001) +#define BORDERWINDOW_TITLE_SMALL ((USHORT)0x0002) +#define BORDERWINDOW_TITLE_TEAROFF ((USHORT)0x0004) +#define BORDERWINDOW_TITLE_NONE ((USHORT)0x0008) + +// -------------------- +// - ImplBorderWindow - +// -------------------- + +class ImplBorderWindow : public Window +{ + friend class Window; + friend class ImplBorderWindowView; + friend class ImplSmallBorderWindowView; + friend class ImplStdBorderWindowView; + +private: + ImplBorderWindowView* mpBorderView; + Window* mpMenuBarWindow; + long mnMinWidth; + long mnMinHeight; + long mnMaxWidth; + long mnMaxHeight; + long mnRollHeight; + long mnOrgMenuHeight; + USHORT mnTitleType; + USHORT mnBorderStyle; + BOOL mbFloatWindow; + BOOL mbSmallOutBorder; + BOOL mbFrameBorder; + BOOL mbPined; + BOOL mbRollUp; + BOOL mbMenuHide; + BOOL mbDockBtn; + BOOL mbHideBtn; + BOOL mbHelpBtn; + BOOL mbMenuBtn; + BOOL mbDisplayActive; + + using Window::ImplInit; + void ImplInit( Window* pParent, + WinBits nStyle, USHORT nTypeStyle, + SystemParentData* pParentData ); + void ImplInit( Window* pParent, + WinBits nStyle, USHORT nTypeStyle, + const ::com::sun::star::uno::Any& ); + + // Copy assignment is forbidden and not implemented. + ImplBorderWindow (const ImplBorderWindow &); + ImplBorderWindow& operator= (const ImplBorderWindow &); + +public: + ImplBorderWindow( Window* pParent, + SystemParentData* pParentData, + WinBits nStyle = 0, + USHORT nTypeStyle = 0 ); + ImplBorderWindow( Window* pParent, WinBits nStyle = 0, + USHORT nTypeStyle = 0 ); + ImplBorderWindow( Window* pParent, + WinBits nStyle, USHORT nTypeStyle, + const ::com::sun::star::uno::Any& ); + ~ImplBorderWindow(); + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Activate(); + virtual void Deactivate(); + virtual void Resize(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + void InitView(); + void UpdateView( BOOL bNewView, const Size& rNewOutSize ); + void InvalidateBorder(); + + using Window::Draw; + void Draw( const Rectangle& rRect, OutputDevice* pDev, const Point& rPos ); + + void SetDisplayActive( BOOL bActive ); + BOOL IsDisplayActive() const { return mbDisplayActive; } + void SetTitleType( USHORT nTitleType, const Size& rSize ); + void SetBorderStyle( USHORT nStyle ); + USHORT GetBorderStyle() const { return mnBorderStyle; } + void SetPin( BOOL bPin ); + void SetRollUp( BOOL bRollUp, const Size& rSize ); + void SetCloser(); + void SetDockButton( BOOL bDockButton ); + void SetHideButton( BOOL bHideButton ); + void SetHelpButton( BOOL bHelpButton ); + void SetMenuButton( BOOL bMenuButton ); + + void UpdateMenuHeight(); + void SetMenuBarWindow( Window* pWindow ); + void SetMenuBarMode( BOOL bHide ); + + void SetMinOutputSize( long nWidth, long nHeight ) + { mnMinWidth = nWidth; mnMinHeight = nHeight; } + void SetMaxOutputSize( long nWidth, long nHeight ) + { mnMaxWidth = nWidth; mnMaxHeight = nHeight; } + + void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + long CalcTitleWidth() const; + + Rectangle GetMenuRect() const; +}; + +// ======================================================================= + +// ----------------------- +// - ImplBorderFrameData - +// ----------------------- + +struct ImplBorderFrameData +{ + ImplBorderWindow* mpBorderWindow; + OutputDevice* mpOutDev; + Rectangle maTitleRect; + Rectangle maPinRect; + Rectangle maCloseRect; + Rectangle maRollRect; + Rectangle maDockRect; + Rectangle maMenuRect; + Rectangle maHideRect; + Rectangle maHelpRect; + Point maMouseOff; + long mnWidth; + long mnHeight; + long mnTrackX; + long mnTrackY; + long mnTrackWidth; + long mnTrackHeight; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + long mnNoTitleTop; + long mnBorderSize; + long mnTitleHeight; + long mnTitleOff; + USHORT mnHitTest; + USHORT mnPinState; + USHORT mnCloseState; + USHORT mnRollState; + USHORT mnDockState; + USHORT mnMenuState; + USHORT mnHideState; + USHORT mnHelpState; + USHORT mnTitleType; + BOOL mbFloatWindow; + BOOL mbDragFull; + BOOL mbTitleClipped; +}; + +// ======================================================================= + +// ------------------------ +// - ImplBorderWindowView - +// ------------------------ + +class ImplBorderWindowView +{ +public: + virtual ~ImplBorderWindowView(); + + virtual BOOL MouseMove( const MouseEvent& rMEvt ); + virtual BOOL MouseButtonDown( const MouseEvent& rMEvt ); + virtual BOOL Tracking( const TrackingEvent& rTEvt ); + virtual String RequestHelp( const Point& rPos, Rectangle& rHelpRect ); + + virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) = 0; + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0; + virtual long CalcTitleWidth() const = 0; + virtual void DrawWindow( USHORT nDrawFlags, OutputDevice* pOutDev = NULL, const Point* pOffset = NULL ) = 0; + virtual Rectangle GetMenuRect() const; + + void ImplInitTitle( ImplBorderFrameData* pData ); + USHORT ImplHitTest( ImplBorderFrameData* pData, const Point& rPos ); + BOOL ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt ); + BOOL ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt ); + BOOL ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt ); + String ImplRequestHelp( ImplBorderFrameData* pData, const Point& rPos, Rectangle& rHelpRect ); + long ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const; +}; + +// ======================================================================= + +// -------------------------- +// - ImplNoBorderWindowView - +// -------------------------- + +class ImplNoBorderWindowView : public ImplBorderWindowView +{ +public: + ImplNoBorderWindowView( ImplBorderWindow* pBorderWindow ); + + virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ); + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + virtual long CalcTitleWidth() const; + virtual void DrawWindow( USHORT nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ); +}; + + +// ======================================================================= + +// ----------------------------- +// - ImplSmallBorderWindowView - +// ----------------------------- + +class ImplSmallBorderWindowView : public ImplBorderWindowView +{ + ImplBorderWindow* mpBorderWindow; + OutputDevice* mpOutDev; + long mnWidth; + long mnHeight; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + bool mbNWFBorder; + +public: + ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow ); + + virtual void Init( OutputDevice* pOutDev, long nWidth, long nHeight ); + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + virtual long CalcTitleWidth() const; + virtual void DrawWindow( USHORT nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ); +}; + + +// ======================================================================= + +// --------------------------- +// - ImplStdBorderWindowView - +// --------------------------- + + +class ImplStdBorderWindowView : public ImplBorderWindowView +{ + ImplBorderFrameData maFrameData; + VirtualDevice* mpATitleVirDev; + VirtualDevice* mpDTitleVirDev; + +public: + ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow ); + ~ImplStdBorderWindowView(); + + virtual BOOL MouseMove( const MouseEvent& rMEvt ); + virtual BOOL MouseButtonDown( const MouseEvent& rMEvt ); + virtual BOOL Tracking( const TrackingEvent& rTEvt ); + virtual String RequestHelp( const Point& rPos, Rectangle& rHelpRect ); + virtual Rectangle GetMenuRect() const; + + virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ); + virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + virtual long CalcTitleWidth() const; + virtual void DrawWindow( USHORT nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ); +}; + + +#endif // _SV_BRDWIN_HXX diff --git a/vcl/inc/vcl/btndlg.hxx b/vcl/inc/vcl/btndlg.hxx new file mode 100644 index 000000000000..dbeb8350a0d4 --- /dev/null +++ b/vcl/inc/vcl/btndlg.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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_BTNDLG_HXX +#define _SV_BTNDLG_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/dialog.hxx> + +struct ImplBtnDlgItem; +class ImplBtnDlgItemList; +class PushButton; + +// ---------------------- +// - ButtonDialog-Types - +// ---------------------- + +#define BUTTONDIALOG_BUTTON_NOTFOUND ((USHORT)0xFFFF) + +#define BUTTONDIALOG_DEFBUTTON ((USHORT)0x0001) +#define BUTTONDIALOG_OKBUTTON ((USHORT)0x0002) +#define BUTTONDIALOG_CANCELBUTTON ((USHORT)0x0004) +#define BUTTONDIALOG_HELPBUTTON ((USHORT)0x0008) +#define BUTTONDIALOG_FOCUSBUTTON ((USHORT)0x0010) + +// ---------------- +// - ButtonDialog - +// ---------------- + +class VCL_DLLPUBLIC ButtonDialog : public Dialog +{ +private: + ImplBtnDlgItemList* mpItemList; + Size maPageSize; + Size maCtrlSize; + long mnButtonSize; + USHORT mnCurButtonId; + USHORT mnFocusButtonId; + BOOL mbFormat; + Link maClickHdl; + + SAL_DLLPRIVATE void ImplInitButtonDialogData(); + SAL_DLLPRIVATE PushButton* ImplCreatePushButton( USHORT nBtnFlags ); + SAL_DLLPRIVATE ImplBtnDlgItem* ImplGetItem( USHORT nId ) const; + DECL_DLLPRIVATE_LINK( ImplClickHdl, PushButton* pBtn ); + SAL_DLLPRIVATE void ImplPosControls(); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE ButtonDialog( const ButtonDialog & ); + SAL_DLLPRIVATE ButtonDialog& operator=( const ButtonDialog& ); +protected: + ButtonDialog( WindowType nType ); + SAL_DLLPRIVATE long ImplGetButtonSize(); + +public: + ButtonDialog( Window* pParent, WinBits nStyle = WB_STDDIALOG ); + ButtonDialog( Window* pParent, const ResId& rResId ); + ~ButtonDialog(); + + virtual void Resize(); + virtual void StateChanged( StateChangedType nStateChange ); + + virtual void Click(); + + void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } + const Size& GetPageSizePixel() const { return maPageSize; } + + USHORT GetCurButtonId() const { return mnCurButtonId; } + + void AddButton( const XubString& rText, USHORT nId, USHORT nBtnFlags, long nSepPixel = 0 ); + void AddButton( StandardButtonType eType, USHORT nId, USHORT nBtnFlags, long nSepPixel = 0 ); + void AddButton( PushButton* pBtn, USHORT nId, USHORT nBtnFlags, long nSepPixel = 0 ); + void RemoveButton( USHORT nId ); + void Clear(); + USHORT GetButtonCount() const; + USHORT GetButtonId( USHORT nButton ) const; + PushButton* GetPushButton( USHORT nId ) const; + void SetButtonText( USHORT nId, const XubString& rText ); + XubString GetButtonText( USHORT nId ) const; + void SetButtonHelpText( USHORT nId, const XubString& rText ); + XubString GetButtonHelpText( USHORT nId ) const; + void SetButtonHelpId( USHORT nId, ULONG nHelpId ); + ULONG GetButtonHelpId( USHORT nId ) const; + + void SetFocusButton( USHORT nId = BUTTONDIALOG_BUTTON_NOTFOUND ) { mnFocusButtonId = nId; } + USHORT GetFocusButton() const { return mnFocusButtonId; } + + void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } + const Link& GetClickHdl() const { return maClickHdl; } +}; + +#endif // _SV_BTNDLG_HXX diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx new file mode 100644 index 000000000000..ab92445b5e03 --- /dev/null +++ b/vcl/inc/vcl/button.hxx @@ -0,0 +1,566 @@ +/************************************************************************* + * + * 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_BUTTON_HXX +#define _SV_BUTTON_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/image.hxx> +#include <vcl/symbol.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/salnativewidgets.hxx> + +#include <vector> + +class UserDrawEvent; +class ImplCommonButtonData; + +// ---------- +// - Button - +// ---------- + +class VCL_DLLPUBLIC Button : public Control +{ +private: + ImplCommonButtonData *mpButtonData; + Link maClickHdl; + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE Button (const Button &); + SAL_DLLPRIVATE Button & operator= (const Button &); +public: + SAL_DLLPRIVATE USHORT ImplGetButtonState() const; + SAL_DLLPRIVATE USHORT& ImplGetButtonState(); + SAL_DLLPRIVATE USHORT ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags ); + SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, + BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, + USHORT nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false ); + SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect ); + SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const; + SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign ); + SAL_DLLPRIVATE SymbolAlign ImplGetSymbolAlign() const; + SAL_DLLPRIVATE void ImplSetSmallSymbol( BOOL bSmall = TRUE ); + SAL_DLLPRIVATE const Rectangle& ImplGetSymbolRect() const; + SAL_DLLPRIVATE void ImplSetSymbolRect(const Rectangle&); + +protected: + Button( WindowType nType ); + +public: + Button( Window* pParent, WinBits nStyle = 0 ); + Button( Window* pParent, const ResId& rResId ); + ~Button(); + + virtual void Click(); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } + const Link& GetClickHdl() const { return maClickHdl; } + + static XubString GetStandardText( StandardButtonType eButton ); + static XubString GetStandardHelpText( StandardButtonType eButton ); + + BOOL SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const Image GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + BOOL HasImage() const; + void SetImageAlign( ImageAlign eAlign ); + ImageAlign GetImageAlign() const; + + BOOL SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL ); + BitmapEx GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + + void EnableImageDisplay( BOOL bEnable ); + BOOL IsImageDisplayEnabled(); + void EnableTextDisplay( BOOL bEnable ); + BOOL IsTextDisplayEnabled(); + + void SetFocusRect( const Rectangle& rFocusRect ); + const Rectangle& GetFocusRect() const; + void SetSmallSymbol (bool bSmall=true); + bool IsSmallSymbol () const; +}; + +// -------------------- +// - PushButton-Types - +// -------------------- + +#define PUSHBUTTON_DROPDOWN_TOOLBOX ((USHORT)0x0001) +#define PUSHBUTTON_DROPDOWN_MENUBUTTON ((USHORT)0x0002) + +// -------------- +// - PushButton - +// -------------- + +class VCL_DLLPUBLIC PushButton : public Button +{ +protected: + SymbolType meSymbol; + TriState meState; + TriState meSaveValue; + USHORT mnDDStyle; + BOOL mbPressed; + BOOL mbInUserDraw; + Link maToggleHdl; + + SAL_DLLPRIVATE void ImplInitPushButtonData(); + SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags, + const Rectangle& rRect, bool bLayout, bool bMenuBtnSep ); + SAL_DLLPRIVATE void ImplDrawPushButton( bool bLayout = false ); + using Button::ImplGetTextStyle; + SAL_DLLPRIVATE USHORT ImplGetTextStyle( ULONG nDrawFlags ) const; + SAL_DLLPRIVATE BOOL IsSymbol() const { return ( (meSymbol != SYMBOL_NOSYMBOL) && (meSymbol != SYMBOL_IMAGE) ); } + SAL_DLLPRIVATE BOOL IsImage() const { return Button::HasImage(); } + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE PushButton( const PushButton & ); + SAL_DLLPRIVATE PushButton& operator=( const PushButton & ); + + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + + using Control::ImplInitSettings; + using Window::ImplInit; +public: + SAL_DLLPRIVATE void ImplSetDefButton( BOOL bSet ); + SAL_DLLPRIVATE static void ImplDrawPushButtonFrame( Window* pDev, Rectangle& rRect, USHORT nStyle ); + SAL_DLLPRIVATE static BOOL ImplHitTestPushButton( Window* pDev, const Point& rPos ); + SAL_DLLPRIVATE BOOL ImplIsDefButton() const; + +protected: + PushButton( WindowType nType ); + + virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; +public: + PushButton( Window* pParent, WinBits nStyle = 0 ); + PushButton( Window* pParent, const ResId& rResId ); + ~PushButton(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyUp( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + virtual void Toggle(); + + void SetSymbol( SymbolType eSymbol ); + SymbolType GetSymbol() const { return meSymbol; } + void SetSymbolAlign( SymbolAlign eAlign ); + SymbolAlign GetSymbolAlign() const; + + void SetDropDown( USHORT nStyle ); + USHORT GetDropDown() const { return mnDDStyle; } + + void SetState( TriState eState ); + TriState GetState() const { return meState; } + + void Check( BOOL bCheck = TRUE ); + BOOL IsChecked() const; + + void SetPressed( BOOL bPressed ); + BOOL IsPressed() const { return mbPressed; } + + void EndSelection(); + + void SaveValue() { meSaveValue = GetState(); } + TriState GetSavedValue() const { return meSaveValue; } + + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + + void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; } + const Link& GetToggleHdl() const { return maToggleHdl; } +}; + +inline void PushButton::Check( BOOL bCheck ) +{ + SetState( (bCheck) ? STATE_CHECK : STATE_NOCHECK ); +} + +inline BOOL PushButton::IsChecked() const +{ + return (GetState() == STATE_CHECK); +} + +// ------------ +// - OKButton - +// ------------ + +class VCL_DLLPUBLIC OKButton : public PushButton +{ +protected: + using PushButton::ImplInit; +private: + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE OKButton (const OKButton &); + SAL_DLLPRIVATE OKButton & operator= (const OKButton &); + +public: + OKButton( Window* pParent, WinBits nStyle = WB_DEFBUTTON ); + OKButton( Window* pParent, const ResId& rResId ); + + virtual void Click(); +}; + +// ---------------- +// - CancelButton - +// ---------------- + +class VCL_DLLPUBLIC CancelButton : public PushButton +{ +protected: + using PushButton::ImplInit; +private: + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE CancelButton (const CancelButton &); + SAL_DLLPRIVATE CancelButton & operator= (const CancelButton &); + +public: + CancelButton( Window* pParent, WinBits nStyle = 0 ); + CancelButton( Window* pParent, const ResId& rResId ); + + virtual void Click(); +}; + +// -------------- +// - HelpButton - +// -------------- + +class VCL_DLLPUBLIC HelpButton : public PushButton +{ +protected: + using PushButton::ImplInit; +private: + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE HelpButton( const HelpButton & ); + SAL_DLLPRIVATE HelpButton & operator= ( const HelpButton & ); + +public: + HelpButton( Window* pParent, WinBits nStyle = 0 ); + HelpButton( Window* pParent, const ResId& rResId ); + + virtual void Click(); +}; + +// --------------- +// - RadioButton - +// --------------- + +class VCL_DLLPUBLIC RadioButton : public Button +{ +private: + Rectangle maStateRect; + Rectangle maMouseRect; + Image maImage; + Image maImageHC; + BOOL mbChecked; + BOOL mbSaveValue; + BOOL mbRadioCheck; + BOOL mbStateChanged; + Link maToggleHdl; + + SAL_DLLPRIVATE void ImplInitRadioButtonData(); + SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplDrawRadioButtonState(); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize, + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout = false ); + SAL_DLLPRIVATE void ImplDrawRadioButton( bool bLayout = false ); + SAL_DLLPRIVATE void ImplInvalidateOrDrawRadioButtonState(); + SAL_DLLPRIVATE void ImplUncheckAllOther(); + SAL_DLLPRIVATE Size ImplGetRadioImageSize() const; + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE RadioButton(const RadioButton &); + SAL_DLLPRIVATE RadioButton& operator= (const RadioButton &); + +protected: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + SAL_DLLPRIVATE void ImplCallClick( BOOL bGrabFocus = FALSE, USHORT nFocusFlags = 0 ); + SAL_DLLPRIVATE void ImplSetMinimumNWFSize(); + +protected: + virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + inline void SetMouseRect( const Rectangle& _rMouseRect ) { maMouseRect = _rMouseRect; } + inline const Rectangle& GetMouseRect( ) const { return maMouseRect; } + inline void SetStateRect( const Rectangle& _rStateRect ) { maStateRect = _rStateRect; } + inline const Rectangle& GetStateRect( ) const { return maStateRect; } + + // draws the radio button (the knob image), in it's current state (pressed/checked) + // at the usual location, which can be overridden with SetStateRect + void DrawRadioButtonState( ); + +public: + RadioButton( Window* pParent, WinBits nWinStyle = 0 ); + RadioButton( Window* pParent, const ResId& rResId ); + ~RadioButton(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyUp( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + virtual void Toggle(); + + BOOL IsStateChanged() const { return mbStateChanged; } + + void EnableRadioCheck( BOOL bRadioCheck = TRUE ) { mbRadioCheck = bRadioCheck; } + BOOL IsRadioCheckEnabled() const { return mbRadioCheck; } + + BOOL SetModeRadioImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const Image& GetModeRadioImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + + void SetState( BOOL bCheck ); + void Check( BOOL bCheck = TRUE ); + BOOL IsChecked() const { return mbChecked; } + + void SaveValue() { mbSaveValue = IsChecked(); } + BOOL GetSavedValue() const { return mbSaveValue; } + + static Image GetRadioImage( const AllSettings& rSettings, USHORT nFlags ); + + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + + void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; } + const Link& GetToggleHdl() const { return maToggleHdl; } + + /** GetRadioButtonGroup returns a list of pointers to <code>RadioButton</code>s in the same group. + + The pointers in the returned list are valid at the time call returns. However rescheduling + or giving up the SolarMutex may mean events get executed that lead to the pointers getting + invalid. + + @param io_rGroup + gets cleared on entering the function. on return contains the <code>RadioButton</code>s + in the same group as this <code>RadioButton</code>. + + @param bIncludeThis + defines whether <code>this</code> is contained in the returned list + */ + void GetRadioButtonGroup( std::vector<RadioButton*>& io_rGroup, bool bIncludeThis ) const; +}; + +// ------------ +// - CheckBox - +// ------------ + +class VCL_DLLPUBLIC CheckBox : public Button +{ +private: + Rectangle maStateRect; + Rectangle maMouseRect; + TriState meState; + TriState meSaveValue; + BOOL mbTriState; + Link maToggleHdl; + + SAL_DLLPRIVATE void ImplInitCheckBoxData(); + SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState(); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize, + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ); + SAL_DLLPRIVATE void ImplDrawCheckBox( bool bLayout = false ); + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; + SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE CheckBox(const CheckBox &); + SAL_DLLPRIVATE CheckBox& operator= (const CheckBox &); + +protected: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE virtual void FillLayoutData() const; + SAL_DLLPRIVATE virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + SAL_DLLPRIVATE virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(); + SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; } + SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; } +public: + SAL_DLLPRIVATE void ImplCheck(); + SAL_DLLPRIVATE void ImplSetMinimumNWFSize(); +public: + CheckBox( Window* pParent, WinBits nStyle = 0 ); + CheckBox( Window* pParent, const ResId& rResId ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyUp( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + virtual void Toggle(); + + void SetState( TriState eState ); + TriState GetState() const { return meState; } + + void Check( BOOL bCheck = TRUE ); + BOOL IsChecked() const; + + void EnableTriState( BOOL bTriState = TRUE ); + BOOL IsTriStateEnabled() const { return mbTriState; } + + void SaveValue() { meSaveValue = GetState(); } + TriState GetSavedValue() const { return meSaveValue; } + + static Image GetCheckImage( const AllSettings& rSettings, USHORT nFlags ); + + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + + void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; } + const Link& GetToggleHdl() const { return maToggleHdl; } +}; + +inline void CheckBox::Check( BOOL bCheck ) +{ + SetState( (bCheck) ? STATE_CHECK : STATE_NOCHECK ); +} + +inline BOOL CheckBox::IsChecked() const +{ + return (GetState() == STATE_CHECK); +} + +// --------------------------------- +// - Control-Layer fuer alten Code - +// --------------------------------- + +class VCL_DLLPUBLIC ImageButton : public PushButton +{ +protected: + using PushButton::ImplInitStyle; +private: + SAL_DLLPRIVATE void ImplInitStyle(); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE ImageButton( const ImageButton & ); + SAL_DLLPRIVATE ImageButton & operator= ( const ImageButton & ); + +protected: + ImageButton( WindowType nType ); + +public: + ImageButton( Window* pParent, WinBits nStyle = 0 ); + ImageButton( Window* pParent, const ResId& rResId ); + ~ImageButton(); +}; + +class VCL_DLLPUBLIC ImageRadioButton : public RadioButton +{ + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE ImageRadioButton( const ImageRadioButton & ); + SAL_DLLPRIVATE ImageRadioButton & operator= ( const ImageRadioButton & ); + +public: + ImageRadioButton( Window* pParent, WinBits nStyle = 0 ); + ImageRadioButton( Window* pParent, const ResId& rResId ); + ~ImageRadioButton(); +}; + +class VCL_DLLPUBLIC TriStateBox : public CheckBox +{ + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE TriStateBox( const TriStateBox & ); + SAL_DLLPRIVATE TriStateBox & operator= ( const TriStateBox & ); + +public: + TriStateBox( Window* pParent, WinBits nStyle = 0 ); + TriStateBox( Window* pParent, const ResId& rResId ); + ~TriStateBox(); +}; + +class VCL_DLLPUBLIC DisclosureButton : public CheckBox +{ +protected: + SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(); +public: + DisclosureButton( Window* pParent, WinBits nStyle = 0 ); + DisclosureButton( Window* pParent, const ResId& rResId ); + + virtual void KeyInput( const KeyEvent& rKEvt ); +}; + +#endif // _SV_BUTTON_HXX diff --git a/vcl/inc/vcl/canvasbitmap.hxx b/vcl/inc/vcl/canvasbitmap.hxx new file mode 100644 index 000000000000..85c0aa795c8c --- /dev/null +++ b/vcl/inc/vcl/canvasbitmap.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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_CANVASBITMAP_HXX +#define _VCL_CANVASBITMAP_HXX + +#include <cppuhelper/compbase3.hxx> +#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp> +#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp> +#include <com/sun/star/rendering/XIntegerBitmap.hpp> +#include <com/sun/star/rendering/XBitmapPalette.hpp> + +#include <vcl/bitmapex.hxx> +#include <vcl/bmpacc.hxx> + +namespace vcl +{ +namespace unotools +{ + class VCL_DLLPUBLIC VclCanvasBitmap : + public cppu::WeakImplHelper3< com::sun::star::rendering::XIntegerReadOnlyBitmap, + com::sun::star::rendering::XBitmapPalette, + com::sun::star::rendering::XIntegerBitmapColorSpace > + { + private: + BitmapEx m_aBmpEx; + Bitmap m_aBitmap; + Bitmap m_aAlpha; + BitmapReadAccess* m_pBmpAcc; + BitmapReadAccess* m_pAlphaAcc; + com::sun::star::uno::Sequence<sal_Int8> m_aComponentTags; + com::sun::star::uno::Sequence<sal_Int32> m_aComponentBitCounts; + com::sun::star::rendering::IntegerBitmapLayout m_aLayout; + sal_Int32 m_nBitsPerInputPixel; + sal_Int32 m_nBitsPerOutputPixel; + sal_Int32 m_nRedIndex; + sal_Int32 m_nGreenIndex; + sal_Int32 m_nBlueIndex; + sal_Int32 m_nAlphaIndex; + sal_Int32 m_nIndexIndex; + sal_Int8 m_nEndianness; + bool m_bSwap; + bool m_bPalette; + + SAL_DLLPRIVATE void setComponentInfo( ULONG redShift, ULONG greenShift, ULONG blueShift ); + + virtual ~VclCanvasBitmap(); + + public: + // XBitmap + virtual com::sun::star::geometry::IntegerSize2D SAL_CALL getSize() throw (com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Reference< com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const com::sun::star::geometry::RealSize2D& newSize, sal_Bool beFast ) throw (com::sun::star::uno::RuntimeException); + + // XIntegerReadOnlyBitmap + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapPalette > SAL_CALL getPalette( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) throw (::com::sun::star::uno::RuntimeException); + + // XBitmapPalette + virtual sal_Int32 SAL_CALL getNumberOfEntries() throw (com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getIndex( ::com::sun::star::uno::Sequence< double >& entry, ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL setIndex( const ::com::sun::star::uno::Sequence< double >& color, ::sal_Bool transparency, ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getColorSpace( ) throw (::com::sun::star::uno::RuntimeException); + + // XIntegerBitmapColorSpace + virtual ::sal_Int8 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getComponentTags( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int8 SAL_CALL getRenderingIntent( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertColorSpace( const ::com::sun::star::uno::Sequence< double >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace >& targetColorSpace ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertToRGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToPARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace >& targetColorSpace ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertIntegerToRGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + /** Create API wrapper for given BitmapEx + + @param rBitmap + Bitmap to wrap. As usual, changes to the original bitmap + are not reflected in this object (copy on write). + */ + explicit VclCanvasBitmap( const BitmapEx& rBitmap ); + + /// Retrieve contained bitmap. Call me with locked Solar mutex! + BitmapEx getBitmapEx() const; + }; +} +} + +#endif diff --git a/vcl/inc/vcl/canvastools.hxx b/vcl/inc/vcl/canvastools.hxx new file mode 100644 index 000000000000..c6f1710cdae5 --- /dev/null +++ b/vcl/inc/vcl/canvastools.hxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * 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_CANVASTOOLS_HXX +#define _VCL_CANVASTOOLS_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/rendering/XColorSpace.hpp> +#include <basegfx/numeric/ftools.hxx> + +#include <vcl/dllapi.h> + +class Point; +class Size; +class Rectangle; +class Polygon; +class PolyPolygon; +class Bitmap; +class BitmapEx; +class Color; + +namespace basegfx +{ + class B2DVector; + class B2DPoint; + class B2DRange; + class B2IVector; + class B2IPoint; + class B2IRange; + class B2DPolygon; + class B2DPolyPolygon; +} + +namespace com { namespace sun { namespace star { namespace geometry +{ + struct RealPoint2D; + struct RealSize2D; + struct RealRectangle2D; + struct IntegerPoint2D; + struct IntegerSize2D; + struct IntegerRectangle2D; + struct RealBezierSegment2D; +} } } } + +namespace com { namespace sun { namespace star { namespace rendering +{ + class XGraphicDevice; + class XBitmap; + class XIntegerBitmap; + class XIntegerReadOnlyBitmap; + class XPolyPolygon2D; +} } } } + +namespace vcl +{ + namespace unotools + { + // Polygon conversions + // =================================================================== + + /** Create an XPolyPolygon from VCL/Tools polygon + */ + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > + VCL_DLLPUBLIC xPolyPolygonFromPolygon( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, + const ::Polygon& inputPolygon ); + + /** Create an XPolyPolygon from VCL/Tools polyPolygon + */ + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > + VCL_DLLPUBLIC xPolyPolygonFromPolyPolygon( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, + const ::PolyPolygon& inputPolyPolygon ); + + /** Create an VCL/Tools polygon from a point sequence + */ + ::Polygon VCL_DLLPUBLIC polygonFromPoint2DSequence( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::geometry::RealPoint2D >& rPoints ); + + /** Create an VCL/Tools polyPolygon from a point sequence sequence + */ + ::PolyPolygon VCL_DLLPUBLIC polyPolygonFromPoint2DSequenceSequence( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& rPoints ); + + /** Create an VCL/Tools polygon from a bezier segment sequence + */ + ::Polygon VCL_DLLPUBLIC polygonFromBezier2DSequence( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::geometry::RealBezierSegment2D >& rPoints ); + + /** Create an VCL/Tools polyPolygon from a bezier segment sequence sequence + */ + ::PolyPolygon VCL_DLLPUBLIC polyPolygonFromBezier2DSequenceSequence( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& rPoints ); + + // Bitmap conversions + // =================================================================== + + /** Create an XBitmap from VCL Bitmap + */ + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > + VCL_DLLPUBLIC xBitmapFromBitmap( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, + const ::Bitmap& inputBitmap ); + + /** Create an XBitmap from VCL BitmapEx + */ + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > + VCL_DLLPUBLIC xBitmapFromBitmapEx( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, + const ::BitmapEx& inputBitmap ); + + /** Create a BitmapEx from an XBitmap + */ + ::BitmapEx VCL_DLLPUBLIC bitmapExFromXBitmap( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XIntegerReadOnlyBitmap >& xInputBitmap ); + + /** get a unique identifier for identification in XUnoTunnel interface + */ + enum TunnelIdentifierType { Id_BitmapEx = 0 }; + const com::sun::star::uno::Sequence< sal_Int8 > VCL_DLLPUBLIC getTunnelIdentifier( TunnelIdentifierType eType ); + + // Color conversions (vcl/tools Color <-> canvas standard color space) + // =================================================================== + + /** Create a device-specific color sequence from VCL/Tools color + + Note that this method assumes a color space equivalent to + the one returned from createStandardColorSpace() + */ + ::com::sun::star::uno::Sequence< double > + VCL_DLLPUBLIC colorToStdColorSpaceSequence( const Color& rColor ); + + /** Convert color to device color sequence + + @param rColor + Color to convert + + @param xColorSpace + Color space to convert into + */ + ::com::sun::star::uno::Sequence< double > + VCL_DLLPUBLIC colorToDoubleSequence( const Color& rColor, + const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XColorSpace >& xColorSpace ); + + /** Convert from standard device color space to VCL/Tools color + + Note that this method assumes a color space equivalent to + the one returned from createStandardColorSpace() + */ + Color VCL_DLLPUBLIC stdColorSpaceSequenceToColor( + const ::com::sun::star::uno::Sequence< double >& rColor ); + + /** Convert color to device color sequence + + @param rColor + Color sequence to convert from + + @param xColorSpace + Color space to convert from + */ + Color VCL_DLLPUBLIC doubleSequenceToColor( const ::com::sun::star::uno::Sequence< double > rColor, + const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XColorSpace >& xColorSpace ); + + /// Convert [0,1] double value to [0,255] int + inline sal_Int8 toByteColor( double val ) + { + return sal::static_int_cast<sal_Int8>( + basegfx::fround(val*255.0)); + } + + /// Convert [0,255] int value to [0,1] double value + inline double toDoubleColor( sal_uInt8 val ) + { + return val / 255.0; + } + + /// Create a standard color space suitable for VCL RGB color + ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XColorSpace> VCL_DLLPUBLIC createStandardColorSpace(); + + // Geometry conversions (vcl/tools <-> x) + // =================================================================== + + // geometry::Real + ::com::sun::star::geometry::RealSize2D VCL_DLLPUBLIC size2DFromSize( const Size& ); + ::com::sun::star::geometry::RealPoint2D VCL_DLLPUBLIC point2DFromPoint( const Point& ); + ::com::sun::star::geometry::RealRectangle2D VCL_DLLPUBLIC rectangle2DFromRectangle( const Rectangle& ); + + Size VCL_DLLPUBLIC sizeFromRealSize2D( const ::com::sun::star::geometry::RealSize2D& ); + Point VCL_DLLPUBLIC pointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& ); + Rectangle VCL_DLLPUBLIC rectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& ); + + // geometry::Integer + ::com::sun::star::geometry::IntegerSize2D VCL_DLLPUBLIC integerSize2DFromSize( const Size& ); + ::com::sun::star::geometry::IntegerPoint2D VCL_DLLPUBLIC integerPoint2DFromPoint( const Point& ); + ::com::sun::star::geometry::IntegerRectangle2D VCL_DLLPUBLIC integerRectangle2DFromRectangle( const Rectangle& ); + + Size VCL_DLLPUBLIC sizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& ); + Point VCL_DLLPUBLIC pointFromIntegerPoint2D( const ::com::sun::star::geometry::IntegerPoint2D& ); + Rectangle VCL_DLLPUBLIC rectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& ); + + // basegfx::B2D + Size VCL_DLLPUBLIC sizeFromB2DSize( const ::basegfx::B2DVector& ); + Point VCL_DLLPUBLIC pointFromB2DPoint( const ::basegfx::B2DPoint& ); + Rectangle VCL_DLLPUBLIC rectangleFromB2DRectangle( const ::basegfx::B2DRange& ); + + basegfx::B2DVector VCL_DLLPUBLIC b2DSizeFromSize( const Size& ); + basegfx::B2DPoint VCL_DLLPUBLIC b2DPointFromPoint( const Point& ); + basegfx::B2DRange VCL_DLLPUBLIC b2DRectangleFromRectangle( const Rectangle& ); + + // basegfx::B2I + Size VCL_DLLPUBLIC sizeFromB2ISize( const ::basegfx::B2IVector& ); + Point VCL_DLLPUBLIC pointFromB2IPoint( const ::basegfx::B2IPoint& ); + Rectangle VCL_DLLPUBLIC rectangleFromB2IRectangle( const ::basegfx::B2IRange& ); + + basegfx::B2IVector VCL_DLLPUBLIC b2ISizeFromSize( const Size& ); + basegfx::B2IPoint VCL_DLLPUBLIC b2IPointFromPoint( const Point& ); + basegfx::B2IRange VCL_DLLPUBLIC b2IRectangleFromRectangle( const Rectangle& ); + } +} + +#endif /* _VCL_CANVASTOOLS_HXX */ diff --git a/vcl/inc/vcl/cmdevt.h b/vcl/inc/vcl/cmdevt.h new file mode 100644 index 000000000000..4594da8b7d56 --- /dev/null +++ b/vcl/inc/vcl/cmdevt.h @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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_CMDEVT_H +#define _VCL_CMDEVT_H + +// -------------------- +// - CommandVoiceData - +// -------------------- + +#define DICTATIONCOMMAND_SYSTEM 0x1000 +#define DICTATIONCOMMAND_USER 0x2000 + +#define DICTATIONCOMMAND_UNKNOWN 0x0001 +#define DICTATIONCOMMAND_NEWPARAGRAPH 0x0002 +#define DICTATIONCOMMAND_NEWLINE 0x0003 +#define DICTATIONCOMMAND_BOLD_ON 0x0004 +#define DICTATIONCOMMAND_BOLD_OFF 0x0005 +#define DICTATIONCOMMAND_ITALIC_ON 0x0006 +#define DICTATIONCOMMAND_ITALIC_OFF 0x0007 +#define DICTATIONCOMMAND_UNDERLINE_ON 0x0008 +#define DICTATIONCOMMAND_UNDERLINE_OFF 0x0009 +#define DICTATIONCOMMAND_NUMBERING_ON 0x0010 +#define DICTATIONCOMMAND_NUMBERING_OFF 0x0011 +#define DICTATIONCOMMAND_TAB 0x0012 +#define DICTATIONCOMMAND_LEFT 0x0013 +#define DICTATIONCOMMAND_RIGHT 0x0014 +#define DICTATIONCOMMAND_UP 0x0015 +#define DICTATIONCOMMAND_DOWN 0x0016 +#define DICTATIONCOMMAND_UNDO 0x0017 +#define DICTATIONCOMMAND_REPEAT 0x0018 +#define DICTATIONCOMMAND_DEL 0x0019 + +#define DICTATIONCOMMAND_COMMANDMODE (DICTATIONCOMMAND_SYSTEM + 1) +#define DICTATIONCOMMAND_DICTATIONMODE (DICTATIONCOMMAND_SYSTEM + 2) + +#endif // _VCL_CMDEVT_H + + diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx new file mode 100644 index 000000000000..7e968b6c7a54 --- /dev/null +++ b/vcl/inc/vcl/cmdevt.hxx @@ -0,0 +1,526 @@ +/************************************************************************* + * + * 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_CMDEVT_HXX +#define _VCL_CMDEVT_HXX + +#include <tools/gen.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/keycod.hxx> +#include <vcl/font.hxx> + +// --------------------------- +// - CommandExtTextInputData - +// --------------------------- + +#define EXTTEXTINPUT_ATTR_GRAYWAVELINE ((USHORT)0x0100) +#define EXTTEXTINPUT_ATTR_UNDERLINE ((USHORT)0x0200) +#define EXTTEXTINPUT_ATTR_BOLDUNDERLINE ((USHORT)0x0400) +#define EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE ((USHORT)0x0800) +#define EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE ((USHORT)0x1000) +#define EXTTEXTINPUT_ATTR_HIGHLIGHT ((USHORT)0x2000) +#define EXTTEXTINPUT_ATTR_REDTEXT ((USHORT)0x4000) +#define EXTTEXTINPUT_ATTR_HALFTONETEXT ((USHORT)0x8000) + +#define EXTTEXTINPUT_CURSOR_INVISIBLE ((USHORT)0x0001) +#define EXTTEXTINPUT_CURSOR_OVERWRITE ((USHORT)0x0002) + +class VCL_DLLPUBLIC CommandExtTextInputData +{ +private: + XubString maText; + USHORT* mpTextAttr; + xub_StrLen mnCursorPos; + xub_StrLen mnDeltaStart; + xub_StrLen mnOldTextLen; + USHORT mnCursorFlags; + BOOL mbOnlyCursor; + +public: + CommandExtTextInputData(); + CommandExtTextInputData( const XubString& rText, + const USHORT* pTextAttr, + xub_StrLen nCursorPos, + USHORT nCursorFlags, + xub_StrLen nDeltaStart, + xub_StrLen nOldTextLen, + BOOL bOnlyCursor ); + CommandExtTextInputData( const CommandExtTextInputData& rData ); + ~CommandExtTextInputData(); + + const XubString& GetText() const { return maText; } + const USHORT* GetTextAttr() const { return mpTextAttr; } + USHORT GetCharTextAttr( USHORT nIndex ) const; + xub_StrLen GetCursorPos() const { return mnCursorPos; } + BOOL IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; } + BOOL IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE) != 0; } + USHORT GetCursorFlags() const { return mnCursorFlags; } + xub_StrLen GetDeltaStart() const { return mnDeltaStart; } + xub_StrLen GetOldTextLen() const { return mnOldTextLen; } + BOOL IsOnlyCursorChanged() const { return mbOnlyCursor; } +}; + +inline USHORT CommandExtTextInputData::GetCharTextAttr( USHORT nIndex ) const +{ + if ( mpTextAttr && (nIndex < maText.Len()) ) + return mpTextAttr[nIndex]; + else + return 0; +} + +// --------------------------- +// - CommandInputContextData - +// --------------------------- + +class VCL_DLLPUBLIC CommandInputContextData +{ +private: + LanguageType meLanguage; + +public: + CommandInputContextData(); + CommandInputContextData( LanguageType eLang ); + + LanguageType GetLanguage() const { return meLanguage; } +}; + +inline CommandInputContextData::CommandInputContextData() +{ + meLanguage = LANGUAGE_DONTKNOW; +} + +inline CommandInputContextData::CommandInputContextData( LanguageType eLang ) +{ + meLanguage = eLang; +} + +// -------------------- +// - CommandWheelData - +// -------------------- + +#define COMMAND_WHEEL_SCROLL ((USHORT)0x0001) +#define COMMAND_WHEEL_ZOOM ((USHORT)0x0002) +#define COMMAND_WHEEL_DATAZOOM ((USHORT)0x0004) + +#define COMMAND_WHEEL_PAGESCROLL ((ULONG)0xFFFFFFFF) + +class VCL_DLLPUBLIC CommandWheelData +{ +private: + long mnDelta; + long mnNotchDelta; + ULONG mnLines; + USHORT mnMode; + USHORT mnCode; + BOOL mbHorz; + BOOL mbDeltaIsPixel; + +public: + CommandWheelData(); + CommandWheelData( long nWheelDelta, long nWheelNotchDelta, + ULONG nScrollLines, + USHORT nWheelMode, USHORT nKeyModifier, + BOOL bHorz = FALSE, BOOL bDeltaIsPixel = FALSE ); + + long GetDelta() const { return mnDelta; } + long GetNotchDelta() const { return mnNotchDelta; } + ULONG GetScrollLines() const { return mnLines; } + BOOL IsHorz() const { return mbHorz; } + BOOL IsDeltaPixel() const { return mbDeltaIsPixel; } + + USHORT GetMode() const { return mnMode; } + + USHORT GetModifier() const + { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); } + BOOL IsShift() const + { return ((mnCode & KEY_SHIFT) != 0); } + BOOL IsMod1() const + { return ((mnCode & KEY_MOD1) != 0); } + BOOL IsMod2() const + { return ((mnCode & KEY_MOD2) != 0); } + BOOL IsMod3() const + { return ((mnCode & KEY_MOD3) != 0); } +}; + +inline CommandWheelData::CommandWheelData() +{ + mnDelta = 0; + mnNotchDelta = 0; + mnLines = 0; + mnMode = 0; + mnCode = 0; + mbHorz = FALSE; + mbDeltaIsPixel = FALSE; +} + +inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta, + ULONG nScrollLines, + USHORT nWheelMode, USHORT nKeyModifier, + BOOL bHorz, BOOL bDeltaIsPixel ) +{ + mnDelta = nWheelDelta; + mnNotchDelta = nWheelNotchDelta; + mnLines = nScrollLines; + mnMode = nWheelMode; + mnCode = nKeyModifier; + mbHorz = bHorz; + mbDeltaIsPixel = bDeltaIsPixel; +} + +// --------------------- +// - CommandScrollData - +// --------------------- + +class VCL_DLLPUBLIC CommandScrollData +{ +private: + long mnDeltaX; + long mnDeltaY; + +public: + CommandScrollData(); + CommandScrollData( long nDeltaX, long nDeltaY ); + + long GetDeltaX() const { return mnDeltaX; } + long GetDeltaY() const { return mnDeltaY; } +}; + +inline CommandScrollData::CommandScrollData() +{ + mnDeltaX = 0; + mnDeltaY = 0; +} + +inline CommandScrollData::CommandScrollData( long nDeltaX, long nDeltaY ) +{ + mnDeltaX = nDeltaX; + mnDeltaY = nDeltaY; +} + +// -------------------- +// - CommandVoiceData - +// -------------------- + +enum DictationCommandType +{ + VOICECOMMANDTYPE_DICTATION, + VOICECOMMANDTYPE_CONTROL +}; + +class VCL_DLLPUBLIC CommandVoiceData +{ +private: + XubString maText; + USHORT mnCommand; + DictationCommandType meType; + +public: + CommandVoiceData(); + CommandVoiceData( const XubString& rStr, + DictationCommandType eType, + USHORT nCommand ); + + const XubString& GetText() const { return maText; } + USHORT GetCommand() const { return mnCommand; } + DictationCommandType GetType() const { return meType; } +}; + +inline CommandVoiceData::CommandVoiceData() +{ + meType = VOICECOMMANDTYPE_DICTATION; + mnCommand = 0; +} + +inline CommandVoiceData::CommandVoiceData( const XubString& rStr, + DictationCommandType eType, + USHORT nCommand ) : + maText( rStr ), + mnCommand( nCommand ), + meType( eType ) +{ +} + +// --------------------- +// - CommandModKeyData - +// --------------------- + +class VCL_DLLPUBLIC CommandModKeyData +{ +private: + USHORT mnCode; + +public: + CommandModKeyData(); + CommandModKeyData( USHORT nCode ); + + BOOL IsShift() const { return (mnCode & MODKEY_SHIFT) ? TRUE : FALSE; } + BOOL IsMod1() const { return (mnCode & MODKEY_MOD1) ? TRUE : FALSE; } + BOOL IsMod2() const { return (mnCode & MODKEY_MOD2) ? TRUE : FALSE; } + BOOL IsMod3() const { return (mnCode & MODKEY_MOD3) ? TRUE : FALSE; } + + BOOL IsLeftShift() const { return (mnCode & MODKEY_LSHIFT) ? TRUE : FALSE; } + BOOL IsLeftMod1() const { return (mnCode & MODKEY_LMOD1) ? TRUE : FALSE; } + BOOL IsLeftMod2() const { return (mnCode & MODKEY_LMOD2) ? TRUE : FALSE; } + BOOL IsLeftMod3() const { return (mnCode & MODKEY_LMOD3) ? TRUE : FALSE; } + + BOOL IsRightShift() const { return (mnCode & MODKEY_RSHIFT) ? TRUE : FALSE; } + BOOL IsRightMod1() const { return (mnCode & MODKEY_RMOD1) ? TRUE : FALSE; } + BOOL IsRightMod2() const { return (mnCode & MODKEY_RMOD2) ? TRUE : FALSE; } + BOOL IsRightMod3() const { return (mnCode & MODKEY_RMOD3) ? TRUE : FALSE; } +}; + +inline CommandModKeyData::CommandModKeyData() +{ + mnCode = 0L; +} + +inline CommandModKeyData::CommandModKeyData( USHORT nCode ) +{ + mnCode = nCode; +} + +// -------------------- +// - CommanDialogData - +// -------------------- + +#define SHOWDIALOG_ID_PREFERENCES 1 +#define SHOWDIALOG_ID_ABOUT 2 + +class VCL_DLLPUBLIC CommandDialogData +{ + int m_nDialogId; + public: + CommandDialogData( int nDialogId = SHOWDIALOG_ID_PREFERENCES ) + : m_nDialogId( nDialogId ) + {} + + int GetDialogId() const { return m_nDialogId; } +}; + +// -------------- +// Media Commands +// -------------- + +#define MEDIA_COMMAND_CHANNEL_DOWN ((sal_Int16)1) // Decrement the channel value, for example, for a TV or radio tuner. +#define MEDIA_COMMAND_CHANNEL_UP ((sal_Int16)2) // Increment the channel value, for example, for a TV or radio tuner. +#define MEDIA_COMMAND_NEXTTRACK ((sal_Int16)3) // Go to next media track/slide. +#define MEDIA_COMMAND_PAUSE ((sal_Int16)4) // Pause. If already paused, take no further action. This is a direct PAUSE command that has no state. +#define MEDIA_COMMAND_PLAY ((sal_Int16)5) // Begin playing at the current position. If already paused, it will resume. This is a direct PLAY command that has no state. +#define MEDIA_COMMAND_PLAY_PAUSE ((sal_Int16)6) // Play or pause playback. +#define MEDIA_COMMAND_PREVIOUSTRACK ((sal_Int16)7) // Go to previous media track/slide. +#define MEDIA_COMMAND_RECORD ((sal_Int16)8) // Begin recording the current stream. +#define MEDIA_COMMAND_REWIND ((sal_Int16)9)// Go backward in a stream at a higher rate of speed. +#define MEDIA_COMMAND_STOP ((sal_Int16)10)// Stop playback. +#define MEDIA_COMMAND_MIC_ON_OFF_TOGGLE ((sal_Int16)11)// Toggle the microphone. +#define MEDIA_COMMAND_MICROPHONE_VOLUME_DOWN ((sal_Int16)12)// Increase microphone volume. +#define MEDIA_COMMAND_MICROPHONE_VOLUME_MUTE ((sal_Int16)13)// Mute the microphone. +#define MEDIA_COMMAND_MICROPHONE_VOLUME_UP ((sal_Int16)14)// Decrease microphone volume. +#define MEDIA_COMMAND_VOLUME_DOWN ((sal_Int16)15)// Lower the volume. +#define MEDIA_COMMAND_VOLUME_MUTE ((sal_Int16)16)// Mute the volume. +#define MEDIA_COMMAND_VOLUME_UP ((sal_Int16)17)// Raise the volume. +#define MEDIA_COMMAND_MENU ((sal_Int16)18)// Button Menu pressed. +#define MEDIA_COMMAND_MENU_HOLD ((sal_Int16)19)// Button Menu (long) pressed. +#define MEDIA_COMMAND_PLAY_HOLD ((sal_Int16)20)// Button Play (long) pressed. +#define MEDIA_COMMAND_NEXTTRACK_HOLD ((sal_Int16)21)// Button Right holding pressed. +#define MEDIA_COMMAND_PREVIOUSTRACK_HOLD ((sal_Int16)22)// Button Left holding pressed. + + +// ------------------------------ +// - CommandSelectionChangeData - +// ------------------------------ + +class VCL_DLLPUBLIC CommandSelectionChangeData +{ +private: + ULONG mnStart; + ULONG mnEnd; + +public: + CommandSelectionChangeData(); + CommandSelectionChangeData( ULONG nStart, ULONG nEnd ); + + ULONG GetStart() const { return mnStart; } + ULONG GetEnd() const { return mnEnd; } +}; + +inline CommandSelectionChangeData::CommandSelectionChangeData() +{ + mnStart = mnEnd = 0; +} + +inline CommandSelectionChangeData::CommandSelectionChangeData( ULONG nStart, + ULONG nEnd ) +{ + mnStart = nStart; + mnEnd = nEnd; +} + +// ---------------- +// - CommandEvent - +// ---------------- + +#define COMMAND_CONTEXTMENU ((USHORT)1) +#define COMMAND_STARTDRAG ((USHORT)2) +#define COMMAND_WHEEL ((USHORT)3) +#define COMMAND_STARTAUTOSCROLL ((USHORT)4) +#define COMMAND_AUTOSCROLL ((USHORT)5) +#define COMMAND_VOICE ((USHORT)6) +#define COMMAND_STARTEXTTEXTINPUT ((USHORT)7) +#define COMMAND_EXTTEXTINPUT ((USHORT)8) +#define COMMAND_ENDEXTTEXTINPUT ((USHORT)9) +#define COMMAND_INPUTCONTEXTCHANGE ((USHORT)10) +#define COMMAND_CURSORPOS ((USHORT)11) +#define COMMAND_PASTESELECTION ((USHORT)12) +#define COMMAND_MODKEYCHANGE ((USHORT)13) +#define COMMAND_HANGUL_HANJA_CONVERSION ((USHORT)14) +#define COMMAND_INPUTLANGUAGECHANGE ((USHORT)15) +#define COMMAND_SHOWDIALOG ((USHORT)16) +#define COMMAND_MEDIA ((USHORT)17) +#define COMMAND_SELECTIONCHANGE ((USHORT)18) +#define COMMAND_PREPARERECONVERSION ((USHORT)19) +#define COMMAND_USER ((USHORT)4096) + +class VCL_DLLPUBLIC CommandEvent +{ +private: + Point maPos; + void* mpData; + USHORT mnCommand; + BOOL mbMouseEvent; + +public: + CommandEvent(); + CommandEvent( const Point& rMousePos, USHORT nCmd, + BOOL bMEvt = FALSE, const void* pCmdData = NULL ); + + USHORT GetCommand() const { return mnCommand; } + const Point& GetMousePosPixel() const { return maPos; } + BOOL IsMouseEvent() const { return mbMouseEvent; } + void* GetData() const { return mpData; } + + const CommandExtTextInputData* GetExtTextInputData() const; + const CommandInputContextData* GetInputContextChangeData() const; + const CommandWheelData* GetWheelData() const; + const CommandScrollData* GetAutoScrollData() const; + const CommandVoiceData* GetVoiceData() const; + const CommandModKeyData* GetModKeyData() const; + const CommandDialogData* GetDialogData() const; + sal_Int16 GetMediaCommand() const; + const CommandSelectionChangeData* GetSelectionChangeData() const; +}; + +inline CommandEvent::CommandEvent() +{ + mpData = NULL; + mnCommand = 0; + mbMouseEvent = FALSE; +} + +inline CommandEvent::CommandEvent( const Point& rMousePos, + USHORT nCmd, BOOL bMEvt, const void* pCmdData ) : + maPos( rMousePos ) +{ + mpData = (void*)pCmdData; + mnCommand = nCmd; + mbMouseEvent = bMEvt; +} + +inline const CommandExtTextInputData* CommandEvent::GetExtTextInputData() const +{ + if ( mnCommand == COMMAND_EXTTEXTINPUT ) + return (const CommandExtTextInputData*)mpData; + else + return NULL; +} + +inline const CommandInputContextData* CommandEvent::GetInputContextChangeData() const +{ + if ( mnCommand == COMMAND_INPUTCONTEXTCHANGE ) + return (const CommandInputContextData*)mpData; + else + return NULL; +} + +inline const CommandWheelData* CommandEvent::GetWheelData() const +{ + if ( mnCommand == COMMAND_WHEEL ) + return (const CommandWheelData*)mpData; + else + return NULL; +} + +inline const CommandScrollData* CommandEvent::GetAutoScrollData() const +{ + if ( mnCommand == COMMAND_AUTOSCROLL ) + return (const CommandScrollData*)mpData; + else + return NULL; +} + +inline const CommandVoiceData* CommandEvent::GetVoiceData() const +{ + if ( mnCommand == COMMAND_VOICE ) + return (const CommandVoiceData*)mpData; + else + return NULL; +} + +inline const CommandModKeyData* CommandEvent::GetModKeyData() const +{ + if( mnCommand == COMMAND_MODKEYCHANGE ) + return (const CommandModKeyData*)mpData; + else + return NULL; +} + +inline const CommandDialogData* CommandEvent::GetDialogData() const +{ + if( mnCommand == COMMAND_SHOWDIALOG ) + return (const CommandDialogData*)mpData; + else + return NULL; +} + +inline sal_Int16 CommandEvent::GetMediaCommand() const +{ + if( mnCommand == COMMAND_MEDIA ) + return *(const sal_Int16*)(mpData); + else + return 0; +} + +inline const CommandSelectionChangeData* CommandEvent::GetSelectionChangeData() const +{ + if( mnCommand == COMMAND_SELECTIONCHANGE ) + return (const CommandSelectionChangeData*)mpData; + else + return NULL; +} + + +#endif // _VCL_CMDEVT_HXX diff --git a/vcl/inc/vcl/combobox.h b/vcl/inc/vcl/combobox.h new file mode 100644 index 000000000000..f4fc39f021b2 --- /dev/null +++ b/vcl/inc/vcl/combobox.h @@ -0,0 +1,37 @@ +/************************************************************************* + * + * 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_COMBOBOX_H +#define _SV_COMBOBOX_H + +#define COMBOBOX_APPEND ((USHORT)0xFFFF) +#define COMBOBOX_ENTRY_NOTFOUND ((USHORT)0xFFFF) +#define COMBOBOX_ERROR ((USHORT)0xFFFF) + +#define COMBOBOX_USERDRAW_SELECTED ((USHORT)0x0001) + +#endif // _SV_COMBOBOX_H diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx new file mode 100644 index 000000000000..640c70e7116f --- /dev/null +++ b/vcl/inc/vcl/combobox.hxx @@ -0,0 +1,230 @@ +/************************************************************************* + * + * 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_COMBOBOX_HXX +#define _SV_COMBOBOX_HXX + +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +#include <vcl/combobox.h> +#include <vcl/edit.hxx> + +class UserDrawEvent; + +class ImplListBoxFloatingWindow; +class ImplListBox; +class ImplBtn; + +// ------------ +// - ComboBox - +// ------------ + +class VCL_DLLPUBLIC ComboBox : public Edit +{ +private: + Edit* mpSubEdit; + ImplListBox* mpImplLB; + ImplBtn* mpBtn; + ImplListBoxFloatingWindow* mpFloatWin; + USHORT mnDDHeight; + xub_Unicode mcMultiSep; + BOOL mbDDAutoSize : 1; + BOOL mbSyntheticModify : 1; + BOOL mbMatchCase : 1; + Link maSelectHdl; + Link maDoubleClickHdl; + +//#if 0 // _SOLAR__PRIVATE +private: + SAL_DLLPRIVATE void ImplInitComboBoxData(); + SAL_DLLPRIVATE void ImplUpdateFloatSelection(); + + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplCancelHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplClickBtnHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplUserDrawHdl, UserDrawEvent* ); + DECL_DLLPRIVATE_LINK( ImplAutocompleteHdl, Edit* ); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplCalcEditHeight(); +//#endif + +protected: + ComboBox( WindowType nType ); + BOOL IsDropDownBox() const { return mpFloatWin ? TRUE : FALSE; } + + virtual void FillLayoutData() const; +public: + ComboBox( Window* pParent, WinBits nStyle = 0 ); + ComboBox( Window* pParent, const ResId& rResId ); + ~ComboBox(); + + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + virtual void Select(); + virtual void DoubleClick(); + + virtual void Modify(); + + virtual const Wallpaper& GetDisplayBackground() const; + + virtual void SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, USHORT nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) + { Edit::SetPosSizePixel( rNewPos, rNewSize ); } + void SetDropDownSizePixel( const Size& rNewSize ) + { if( IsDropDownBox() ) SetPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(), WINDOW_POSSIZE_SIZE | WINDOW_POSSIZE_DROPDOWN ); } + + Rectangle GetDropDownPosSizePixel() const; + Rectangle GetListPosSizePixel() const; + // returns empty rectangle in DropDown mode, + // else it returns the PosSize of the ListBox + + void SetDropDownLineCount( USHORT nLines ); + USHORT GetDropDownLineCount() const; + + void EnableAutoSize( BOOL bAuto ); + BOOL IsAutoSizeEnabled() const { return mbDDAutoSize; } + + void EnableDDAutoWidth( BOOL b ); + BOOL IsDDAutoWidthEnabled() const; + + void SetText( const XubString& rStr ); + void SetText( const XubString& rStr, const Selection& rNewSelection ); + + USHORT InsertEntry( const XubString& rStr, USHORT nPos = COMBOBOX_APPEND ); + USHORT InsertEntry( const XubString& rStr, const Image& rImage, USHORT nPos = COMBOBOX_APPEND ); + + void RemoveEntry( const XubString& rStr ); + void RemoveEntry( USHORT nPos ); + + void Clear(); + + USHORT GetEntryPos( const XubString& rStr ) const; + USHORT GetEntryPos( const void* pData ) const; + Image GetEntryImage( USHORT nPos ) const; + XubString GetEntry( USHORT nPos ) const; + USHORT GetEntryCount() const; + + BOOL IsTravelSelect() const; + BOOL IsInDropDown() const; + void ToggleDropDown(); + + long CalcWindowSizePixel( USHORT nLines ) const; + + void SetUserItemSize( const Size& rSz ); + const Size& GetUserItemSize() const; + + void EnableUserDraw( BOOL bUserDraw ); + BOOL IsUserDrawEnabled() const; + + void DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos = FALSE ); + void SetBorderStyle( USHORT nBorderStyle ); + + void SetSeparatorPos( USHORT n ); + void SetSeparatorPos(); + USHORT GetSeparatorPos() const; + + void EnableAutocomplete( BOOL bEnable, BOOL bMatchCase = FALSE ); + BOOL IsAutocompleteEnabled() const; + + void EnableMultiSelection( BOOL bMulti ); + BOOL IsMultiSelectionEnabled() const; + void SetMultiSelectionSeparator( xub_Unicode cSep ) { mcMultiSep = cSep; } + xub_Unicode GetMultiSelectionSeparator() const { return mcMultiSep; } + + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } + const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + + Size CalcMinimumSize() const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + Size CalcAdjustedSize( const Size& rPrefSize ) const; + using Edit::CalcSize; + Size CalcSize( USHORT nColumns, USHORT nLines ) const; + void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const; + + void SetMRUEntries( const XubString& rEntries, xub_Unicode cSep = ';' ); + XubString GetMRUEntries( xub_Unicode cSep = ';' ) const; + void SetMaxMRUCount( USHORT n ); + USHORT GetMaxMRUCount() const; + + void SetEntryData( USHORT nPos, void* pNewData ); + void* GetEntryData( USHORT nPos ) const; + + void SetTopEntry( USHORT nPos ); + void ShowProminentEntry( USHORT nPos ); + USHORT GetTopEntry() const; + + void SetProminentEntryType( ProminentEntry eType ); + ProminentEntry GetProminentEntryType() const; + + USHORT GetDisplayLineCount() const; + + USHORT GetSelectEntryCount() const; + USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const; + BOOL IsEntryPosSelected( USHORT nPos ) const; + void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ); + void SetNoSelection(); + Rectangle GetBoundingRectangle( USHORT nItem ) const; + + /** checks whether a certain point lies within the bounds of + a list item and returns the item as well as the character position + the point is at. + + <p>If the point is inside an item the item pos is put into <code>rPos</code> and + the item-relative character index is returned. If the point is not inside + an item -1 is returned and rPos is unchanged.</p> + + @param rPoint + tells the point for which an item is requested. + + @param rPos + gets the item at the specified point <code>rPoint</code> + + @returns + the item-relative character index at point <code>rPos</code> or -1 + if no item is at that point. + */ + using Control::GetIndexForPoint; + long GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const; +}; + +#endif // _COMBOBOX_HXX diff --git a/vcl/inc/vcl/configsettings.hxx b/vcl/inc/vcl/configsettings.hxx new file mode 100644 index 000000000000..779c6450e804 --- /dev/null +++ b/vcl/inc/vcl/configsettings.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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_INC_CONFIGSETTINGS_HXX +#define VCL_INC_CONFIGSETTINGS_HXX + +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <unotools/configitem.hxx> +#include <vcl/dllapi.h> + +#include <hash_map> + +//........................................................................ +namespace vcl +{ +//........................................................................ + + typedef std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > OUStrMap; + class SmallOUStrMap : public OUStrMap { public: SmallOUStrMap() : OUStrMap(1) {} }; + + //==================================================================== + //= SettingsConfigItem + //==================================================================== + class VCL_DLLPUBLIC SettingsConfigItem : public ::utl::ConfigItem + { + + std::hash_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings; + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); + + void getValues(); + SettingsConfigItem(); + public: + virtual ~SettingsConfigItem(); + + static SettingsConfigItem* get(); + + const rtl::OUString& getValue( const rtl::OUString& rGroup, const rtl::OUString& rKey ) const; + void setValue( const rtl::OUString& rGroup, const rtl::OUString& rKey, const rtl::OUString& rValue ); + + virtual void Commit(); + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_INC_CONFIGSETTINGS_HXX + diff --git a/vcl/inc/vcl/controldata.hxx b/vcl/inc/vcl/controldata.hxx new file mode 100644 index 000000000000..0be0f5bd402e --- /dev/null +++ b/vcl/inc/vcl/controldata.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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_CONTROLDATA_HXX +#define VCL_CONTROLDATA_HXX + +#include <vcl/controllayout.hxx> + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ImplControlData + //==================================================================== + struct ImplControlData + { + mutable ControlLayoutData* mpLayoutData; + OutputDevice* mpReferenceDevice; + + ImplControlData() + :mpLayoutData( NULL ) + ,mpReferenceDevice( NULL ) + { + } + + ~ImplControlData() + { + delete mpLayoutData; + } + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_CONTROLDATA_HXX diff --git a/vcl/inc/vcl/controllayout.hxx b/vcl/inc/vcl/controllayout.hxx new file mode 100644 index 000000000000..574d80ea9e02 --- /dev/null +++ b/vcl/inc/vcl/controllayout.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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_CONTROLLAYOUT_HXX +#define _VCL_CONTROLLAYOUT_HXX + +#include <vector> +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <vcl/dllapi.h> + +class Control; + +namespace vcl +{ + +struct VCL_DLLPUBLIC ControlLayoutData +{ + // contains the string really displayed + // there must be exactly one bounding rectangle in m_aUnicodeBoundRects + // for every character in m_aDisplayText + String m_aDisplayText; + // the bounding rectangle of every character + // where one character may consist of many glyphs + std::vector< Rectangle > m_aUnicodeBoundRects; + // start indices of lines + std::vector< long > m_aLineIndices; + // notify parent control on destruction + const Control* m_pParent; + + ControlLayoutData() : m_pParent( NULL ) {} + ~ControlLayoutData(); + + Rectangle GetCharacterBounds( long nIndex ) const; + // returns the character index for corresponding to rPoint (in control coordinates) + // -1 is returned if no character is at that point + long GetIndexForPoint( const Point& rPoint ) const; + // returns the number of lines in the result of GetDisplayText() + long GetLineCount() const; + // returns the interval [start,end] of line nLine + // returns [-1,-1] for an invalid line + Pair GetLineStartEnd( long nLine ) const; + /** ToRelativeLineIndex changes a layout data index to a count relative to its line. + + <p>This is equivalent to getting the line start/end pairs with + <member>GetLineStartEnd</member> until the index lies within [start,end] of a line + </p> + + @param nIndex + the absolute index inside the display text to be changed to a relative index + + @returns + the relative index inside the displayed line or -1 if the absolute index does + not match any line + */ + long ToRelativeLineIndex( long nIndex ) const; +}; + +} // namespace vcl + +#endif // _VCL_CONTROLLAYOUT_HXX diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx new file mode 100644 index 000000000000..3838b29a6d0a --- /dev/null +++ b/vcl/inc/vcl/ctrl.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * 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_CTRL_HXX +#define _SV_CTRL_HXX + +#include <tools/link.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> +#include <vcl/salnativewidgets.hxx> + +// forward +namespace vcl { struct ImplControlData; struct ControlLayoutData; } + +// ----------- +// - Control - +// ----------- + +class VCL_DLLPUBLIC Control : public Window +{ +protected: + ::vcl::ImplControlData* mpControlData; + +private: + BOOL mbHasFocus; + Link maGetFocusHdl; + Link maLoseFocusHdl; + + SAL_DLLPRIVATE void ImplInitControlData(); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE Control (const Control &); + SAL_DLLPRIVATE Control & operator= (const Control &); + +protected: + Control( WindowType nType ); + virtual void FillLayoutData() const; + + // helper method for composite controls + void AppendLayoutData( const Control& rSubControl ) const; + + /// creates the mpData->mpLayoutData structure + void CreateLayoutData() const; + /// determines whether we currently have layout data + bool HasLayoutData() const; + /// returns the current layout data + ::vcl::ControlLayoutData* + GetLayoutData() const; + + /** this calls both our event listeners, and a specified handler + + If the Control instance is destroyed during any of those calls, the + method properly handles this (in particular, it doesn't crash :) + + @param nEvent + the event to notify to our event listeners + @param rHandler + the handler to call + @param pCaller + the parameter to pass to the handler call + @return + if the Control instance has been destroyed in any of the call + */ + BOOL ImplCallEventListenersAndHandler( + ULONG nEvent, const Link& rHandler, void* pCaller + ); + + /** draws the given text onto the given device + + If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise, + the text will be rendered according to the metrics at the reference device. + + Note that the given rectangle might be modified, it will contain the result of a GetTextRect call (either + directly at the target device, or taking the reference device into account) when returning. + */ + void DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, + const XubString& _rStr, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) const; + + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + void ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ); + +//#if 0 // _SOLAR__PRIVATE +public: + SAL_DLLPRIVATE void ImplClearLayoutData() const; + /** draws a frame around the give rectangle, onto the given device + + only to be used from within the <member>Window::Draw</member> method of your sub class. + + The frame is always drawn with a single line (without 3D effects). In addition, any mono + color set at the control's settings is respected. Yet more additionally, if we're living + in a themed desktop, this theming is ignored. + + Note that this makes sense, since the *only known* clients of <member>Window::Draw</member> + are form controls, when printed or print-previewed. For form controls embedded in office documents, + you don't want to have the theme look. + + @param pDev + the device to draw onto + @param rRect + the rect for drawing the frame. Upon returning from the call, the rect will be inflated + by the space occupied by the drawn pixels. + */ + SAL_DLLPRIVATE void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect ); +//#endif + +public: + Control( Window* pParent, WinBits nWinStyle = 0 ); + Control( Window* pParent, const ResId& rResId ); + ~Control(); + + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual void Resize(); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + // invalidates layout data + virtual void SetText( const String& rStr ); + // gets the displayed text + virtual String GetDisplayText() const; + // returns the bounding box for the character at index nIndex (in control coordinates) + Rectangle GetCharacterBounds( long nIndex ) const; + // returns the character index for corresponding to rPoint (in control coordinates) + // -1 is returned if no character is at that point + long GetIndexForPoint( const Point& rPoint ) const; + // returns the number of lines in the result of GetDisplayText() + long GetLineCount() const; + // returns the interval [start,end] of line nLine + // returns [-1,-1] for an invalid line + Pair GetLineStartEnd( long nLine ) const; + /** ToRelativeLineIndex changes a layout data index to a count relative to its line. + + <p>This is equivalent to getting the line start/end pairs with + <member>GetLineStartEnd</member> until the index lies within [start,end] of a line + </p> + + @param nIndex + the absolute index inside the display text to be changed to a relative index + + @returns + the relative index inside the displayed line or -1 if the absolute index does + not match any line + */ + long ToRelativeLineIndex( long nIndex ) const; + + void SetGetFocusHdl( const Link& rLink ) { maGetFocusHdl = rLink; } + const Link& GetGetFocusHdl() const { return maGetFocusHdl; } + void SetLoseFocusHdl( const Link& rLink ) { maLoseFocusHdl = rLink; } + const Link& GetLoseFocusHdl() const { return maLoseFocusHdl; } + + void SetLayoutDataParent( const Control* pParent ) const; + + virtual Size GetOptimalSize(WindowSizeType eType) const; + + /** sets a reference device used for rendering control text + @seealso DrawControlText + */ + void SetReferenceDevice( OutputDevice* _referenceDevice ); + OutputDevice* GetReferenceDevice() const; + + Font GetUnzoomedControlPointFont() const + { + Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + return aFont; + } +}; + +#endif // _SV_CTRL_HXX diff --git a/vcl/inc/vcl/cursor.hxx b/vcl/inc/vcl/cursor.hxx new file mode 100644 index 000000000000..db8f5efd0566 --- /dev/null +++ b/vcl/inc/vcl/cursor.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * 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_CURSOR_HXX +#define _SV_CURSOR_HXX + +#include <tools/gen.hxx> +#include <tools/link.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +class AutoTimer; +struct ImplCursorData; +class Window; + +// ----------------- +// - Cursor-Styles - +// ----------------- + +#define CURSOR_SHADOW ((USHORT)0x0001) +#define CURSOR_DIRECTION_NONE ((unsigned char)0x00) +#define CURSOR_DIRECTION_LTR ((unsigned char)0x01) +#define CURSOR_DIRECTION_RTL ((unsigned char)0x02) + +// ---------- +// - Cursor - +// ---------- + +class VCL_DLLPUBLIC Cursor +{ +private: + ImplCursorData* mpData; // Interne Daten + Window* mpWindow; // Window (only for shadow cursor) + long mnSlant; // Schraegstellung + long mnOffsetY; // Offset fuer Rotation + Size maSize; // Groesse + Point maPos; // Position + short mnOrientation; // Rotation + USHORT mnStyle; // Style + BOOL mbVisible; // Ist Cursor sichtbar + unsigned char mnDirection; // indicates direction + +//#if 0 // _SOLAR__PRIVATE +public: + SAL_DLLPRIVATE void ImplDraw(); + SAL_DLLPRIVATE void ImplRestore(); + DECL_DLLPRIVATE_LINK( ImplTimerHdl, AutoTimer* ); + SAL_DLLPRIVATE void ImplShow( BOOL bDrawDirect = TRUE ); + SAL_DLLPRIVATE void ImplHide(); + SAL_DLLPRIVATE void ImplNew(); +//#endif + +public: + Cursor(); + Cursor( const Cursor& rCursor ); + ~Cursor(); + + void SetStyle( USHORT nStyle ); + USHORT GetStyle() const { return mnStyle; } + + void Show(); + void Hide(); + BOOL IsVisible() const { return mbVisible; } + + void SetWindow( Window* pWindow ); + Window* GetWindow() const { return mpWindow; } + + void SetPos( const Point& rNewPos ); + const Point& GetPos() const { return maPos; } + void SetOffsetY( long mnOffsetY = 0 ); + long GetOffsetY() const { return mnOffsetY; } + + void SetSize( const Size& rNewSize ); + const Size& GetSize() const { return maSize; } + void SetWidth( long nNewWidth ); + long GetWidth() const { return maSize.Width(); } + void SetHeight( long nNewHeight ); + long GetHeight() const { return maSize.Height(); } + + void SetSlant( long nSlant = 0 ); + long GetSlant() const { return mnSlant; } + + void SetOrientation( short nOrientation = 0 ); + short GetOrientation() const { return mnOrientation; } + + void SetDirection( unsigned char nDirection = 0 ); + unsigned char GetDirection() const { return mnDirection; } + + Cursor& operator=( const Cursor& rCursor ); + BOOL operator==( const Cursor& rCursor ) const; + BOOL operator!=( const Cursor& rCursor ) const + { return !(Cursor::operator==( rCursor )); } +}; + +#endif // _SV_CURSOR_HXX diff --git a/vcl/inc/vcl/cvtgrf.hxx b/vcl/inc/vcl/cvtgrf.hxx new file mode 100644 index 000000000000..97541c1b8f9f --- /dev/null +++ b/vcl/inc/vcl/cvtgrf.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_CVTGRF_HXX +#define _SV_CVTGRF_HXX + +#include <vcl/dllapi.h> +#include <tools/link.hxx> +#include <vcl/salctype.hxx> + +// -------------------- +// - GraphicConverter - +// -------------------- + +struct ConvertData; +class Graphic; + +class VCL_DLLPUBLIC GraphicConverter +{ +private: + + Link maFilterHdl; + ConvertData* mpConvertData; + +//#if 0 // _SOLAR__PRIVATE +public: + SAL_DLLPRIVATE ULONG ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nInBufSize, + void** ppOutBuffer, ULONG nOutFormat ); +//#endif // __PRIVATE + +public: + + GraphicConverter(); + ~GraphicConverter(); + + static ULONG Import( SvStream& rIStm, Graphic& rGraphic, ULONG nFormat = CVT_UNKNOWN ); + static ULONG Export( SvStream& rOStm, const Graphic& rGraphic, ULONG nFormat ); + + ConvertData* GetConvertData() { return mpConvertData; } + + void SetFilterHdl( const Link& rLink ) { maFilterHdl = rLink; } + const Link& GetFilterHdl() const { return maFilterHdl; } +}; + +#endif // _SV_CVTGRF_HXX + diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx new file mode 100644 index 000000000000..03948ac56690 --- /dev/null +++ b/vcl/inc/vcl/cvtsvm.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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_CVTMTF_HXX +#define _SV_CVTMTF_HXX + +#include <vcl/dllapi.h> +#include <vcl/metaact.hxx> +#include <vcl/gdimtf.hxx> + +// ----------- +// - Defines - +// ----------- + +#define CONVERT_TO_SVM1 0x00000001UL +#define CONVERT_FROM_SVM1 0x00000002UL + +#define GDI_PIXEL_ACTION 1 +#define GDI_POINT_ACTION 2 +#define GDI_LINE_ACTION 3 +#define GDI_RECT_ACTION 4 +#define GDI_ELLIPSE_ACTION 5 +#define GDI_ARC_ACTION 6 +#define GDI_PIE_ACTION 7 +#define GDI_INVERTRECT_ACTION 8 +#define GDI_HIGHLIGHTRECT_ACTION 9 +#define GDI_POLYLINE_ACTION 10 +#define GDI_POLYGON_ACTION 11 +#define GDI_POLYPOLYGON_ACTION 12 +#define GDI_TEXT_ACTION 13 +#define GDI_TEXTARRAY_ACTION 14 +#define GDI_STRETCHTEXT_ACTION 15 +#define GDI_ICON_ACTION 16 +#define GDI_BITMAP_ACTION 17 +#define GDI_BITMAPSCALE_ACTION 18 +#define GDI_PEN_ACTION 19 +#define GDI_FONT_ACTION 20 +#define GDI_BACKBRUSH_ACTION 21 +#define GDI_FILLBRUSH_ACTION 22 +#define GDI_MAPMODE_ACTION 23 +#define GDI_CLIPREGION_ACTION 24 +#define GDI_RASTEROP_ACTION 25 +#define GDI_PUSH_ACTION 26 +#define GDI_POP_ACTION 27 +#define GDI_MOVECLIPREGION_ACTION 28 +#define GDI_ISECTCLIPREGION_ACTION 29 +#define GDI_MTF_ACTION 30 +#define GDI_BITMAPSCALEPART_ACTION 32 +#define GDI_GRADIENT_ACTION 33 + +#define GDI_TRANSPARENT_COMMENT 1024 +#define GDI_HATCH_COMMENT 1025 +#define GDI_REFPOINT_COMMENT 1026 +#define GDI_TEXTLINECOLOR_COMMENT 1027 +#define GDI_TEXTLINE_COMMENT 1028 +#define GDI_FLOATTRANSPARENT_COMMENT 1029 +#define GDI_GRADIENTEX_COMMENT 1030 +#define GDI_COMMENT_COMMENT 1031 +#define GDI_UNICODE_COMMENT 1032 + +#define GDI_LINEJOIN_ACTION 1033 +#define GDI_EXTENDEDPOLYGON_ACTION 1034 +#define GDI_LINEDASHDOT_ACTION 1035 + +// ---------------- +// - SVMConverter - +// ---------------- + +class Stack; + +class VCL_DLLPUBLIC SVMConverter +{ +private: +//#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE void ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ); + SAL_DLLPRIVATE void ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ); + SAL_DLLPRIVATE ULONG ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, + VirtualDevice& rSaveVDev, BOOL& rRop_0_1, + Color& rLineCol, Stack& rLineColStack, + rtl_TextEncoding& rActualCharSet ); +//#endif + +public: + SVMConverter( SvStream& rIStm, GDIMetaFile& rMtf, ULONG nConvertMode ); + ~SVMConverter() {} + +private: + // Not implemented + SVMConverter( const SVMConverter& ); + SVMConverter& operator=( const SVMConverter& ); +}; + +#endif // _SV_CVTMTF_HXX diff --git a/vcl/inc/vcl/dbggui.hxx b/vcl/inc/vcl/dbggui.hxx new file mode 100644 index 000000000000..7ed23706e6f3 --- /dev/null +++ b/vcl/inc/vcl/dbggui.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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_DBGGUI_HXX +#define _SV_DBGGUI_HXX + +#include <vcl/sv.h> + +// ------------ +// - DBG_UITL - +// ------------ + +#ifdef DBG_UTIL + +class Window; +class XubString; + +void DbgGUIInit(); +void DbgGUIDeInit(); +void DbgGUIStart(); +void DbgDialogTest( Window* pWindow ); + +/** registers a named user-defined channel for emitting the diagnostic messages + @return + a unique number for this channel, which can be used for ->DbgData::nErrorOut, + ->DbgData::nWarningOut and ->DbgData::nTraceOut + @see DBG_OUT_USER_CHANNEL_0 +*/ +USHORT DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPrintLine pProc ); + +#define DBGGUI_INIT() DbgGUIInit() +#define DBGGUI_DEINIT() DbgGUIDeInit() +#define DBGGUI_START() DbgGUIStart() + +#define DBG_DIALOGTEST( pWindow ) \ + if ( DbgIsDialog() ) \ + DbgDialogTest( pWindow ); + +#else + + +#define DBGGUI_INIT() +#define DBGGUI_DEINIT() +#define DBGGUI_START() + +#define DBG_DIALOGTEST( pWindow ) + +#endif + +#endif // _SV_DBGGUI_HXX diff --git a/vcl/inc/vcl/decoview.hxx b/vcl/inc/vcl/decoview.hxx new file mode 100644 index 000000000000..2412ceda8431 --- /dev/null +++ b/vcl/inc/vcl/decoview.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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_DECOVIEW_HXX +#define _SV_DECOVIEW_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/symbol.hxx> + +class Rectangle; +class Point; +class Color; +class OutputDevice; + +// ------------------------ +// - DecorationView-Types - +// ------------------------ + +// Flags for DrawSymbol() +#define SYMBOL_DRAW_MONO ((USHORT)0x0001) +#define SYMBOL_DRAW_DISABLE ((USHORT)0x0002) + +// Flags for DrawFrame() +#define FRAME_DRAW_IN ((USHORT)0x0001) +#define FRAME_DRAW_OUT ((USHORT)0x0002) +#define FRAME_DRAW_GROUP ((USHORT)0x0003) +#define FRAME_DRAW_DOUBLEIN ((USHORT)0x0004) +#define FRAME_DRAW_DOUBLEOUT ((USHORT)0x0005) +#define FRAME_DRAW_MENU ((USHORT)0x0010) +#define FRAME_DRAW_WINDOWBORDER ((USHORT)0x0020) +#define FRAME_DRAW_BORDERWINDOWBORDER ((USHORT)0x0040) +#define FRAME_DRAW_MONO ((USHORT)0x1000) +#define FRAME_DRAW_NODRAW ((USHORT)0x8000) +#define FRAME_DRAW_STYLE ((USHORT)0x000F) + +// Flags for DrawHighlightFrame() +#define FRAME_HIGHLIGHT_IN ((USHORT)0x0001) +#define FRAME_HIGHLIGHT_OUT ((USHORT)0x0002) +#define FRAME_HIGHLIGHT_TESTBACKGROUND ((USHORT)0x4000) +#define FRAME_HIGHLIGHT_STYLE ((USHORT)0x000F) + +// Flags for DrawButton() +#define BUTTON_DRAW_DEFAULT ((USHORT)0x0001) +#define BUTTON_DRAW_NOLIGHTBORDER ((USHORT)0x0002) +#define BUTTON_DRAW_PRESSED ((USHORT)0x0004) +#define BUTTON_DRAW_CHECKED ((USHORT)0x0008) +#define BUTTON_DRAW_DONTKNOW ((USHORT)0x0010) +#define BUTTON_DRAW_MONO ((USHORT)0x0020) +#define BUTTON_DRAW_NOFILL ((USHORT)0x0040) +#define BUTTON_DRAW_DISABLED ((USHORT)0x0080) +#define BUTTON_DRAW_HIGHLIGHT ((USHORT)0x0100) +#define BUTTON_DRAW_FLAT ((USHORT)0x0200) +#define BUTTON_DRAW_NOTOPLIGHTBORDER ((USHORT)0x0400) +#define BUTTON_DRAW_NOBOTTOMSHADOWBORDER ((USHORT)0x0800) +#define BUTTON_DRAW_NOLEFTLIGHTBORDER ((USHORT)0x1000) +#define BUTTON_DRAW_NOTEXT ((USHORT)0x2000) +#define BUTTON_DRAW_NOIMAGE ((USHORT)0x4000) +#define BUTTON_DRAW_NODRAW ((USHORT)0x8000) + +// ------------------ +// - DecorationView - +// ------------------ + +class VCL_DLLPUBLIC DecorationView +{ +private: + OutputDevice* mpOutDev; + +public: + DecorationView( OutputDevice* pOutDev ) + { mpOutDev = pOutDev; } + + void DrawSymbol( const Rectangle& rRect, SymbolType eType, + const Color& rColor, USHORT nStyle = 0 ); + void DrawFrame( const Rectangle& rRect, + const Color& rLeftTopColor, + const Color& rRightBottomColor ); + void DrawHighlightFrame( const Rectangle& rRect, + USHORT nStyle = FRAME_HIGHLIGHT_OUT ); + Rectangle DrawFrame( const Rectangle& rRect, USHORT nStyle = FRAME_DRAW_OUT ); + Rectangle DrawButton( const Rectangle& rRect, USHORT nStyle ); + void DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true ); +}; + +#endif // _SV_DECOVIEW_HXX diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx new file mode 100644 index 000000000000..60fe97225b4b --- /dev/null +++ b/vcl/inc/vcl/dialog.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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_DIALOG_HXX +#define _SV_DIALOG_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/syswin.hxx> + +// parameter to pass to the dialogue constructor if really no parent is wanted +// whereas NULL chooses the deafult dialogue parent +#define DIALOG_NO_PARENT ((Window*)0xffffffff) + +// ---------- +// - Dialog - +// ---------- + +struct DialogImpl; + +class VCL_DLLPUBLIC Dialog : public SystemWindow +{ +private: + Window* mpDialogParent; + Dialog* mpPrevExecuteDlg; + DialogImpl* mpDialogImpl; + long mnMousePositioned; + BOOL mbInExecute; + BOOL mbOldSaveBack; + BOOL mbInClose; + BOOL mbModalMode; + + SAL_DLLPRIVATE void ImplInitDialogData(); + SAL_DLLPRIVATE void ImplInitSettings(); + +//#if 0 // _SOLAR__PRIVATE + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE Dialog (const Dialog &); + SAL_DLLPRIVATE Dialog & operator= (const Dialog &); + + DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* ); +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplDialogRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplCenterDialog(); + +public: + SAL_DLLPRIVATE BOOL IsInClose() const { return mbInClose; } +//#endif + +protected: + Dialog( WindowType nType ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + +public: + Dialog( Window* pParent, WinBits nStyle = WB_STDDIALOG ); + Dialog( Window* pParent, const ResId& rResId ); + virtual ~Dialog(); + + virtual long Notify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual BOOL Close(); + + virtual short Execute(); + BOOL IsInExecute() const { return mbInExecute; } + + //////////////////////////////////////// + // Dialog::Execute replacement API +public: + // Link impl: DECL_LINK( MyEndDialogHdl, Dialog* ); <= param is dialog just ended + virtual void StartExecuteModal( const Link& rEndDialogHdl ); + BOOL IsStartedModal() const; + long GetResult() const; +private: + BOOL ImplStartExecuteModal(); + void ImplEndExecuteModal(); +public: + + // Dialog::Execute replacement API + //////////////////////////////////////// + + void EndDialog( long nResult = 0 ); + static void EndAllDialogs( Window* pParent=NULL ); + + void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + + void SetModalInputMode( BOOL bModal ); + void SetModalInputMode( BOOL bModal, BOOL bSubModalDialogs ); + BOOL IsModalInputMode() const { return mbModalMode; } + + void GrabFocusToFirstControl(); +}; + +// ------------------ +// - ModelessDialog - +// ------------------ + +class VCL_DLLPUBLIC ModelessDialog : public Dialog +{ +//#if 0 // _SOLAR__PRIVATE + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE ModelessDialog (const ModelessDialog &); + SAL_DLLPRIVATE ModelessDialog & operator= (const ModelessDialog &); +//#endif + +public: + ModelessDialog( Window* pParent, WinBits nStyle = WB_STDMODELESS ); + ModelessDialog( Window* pParent, const ResId& rResId ); +}; + +// --------------- +// - ModalDialog - +// --------------- + +class VCL_DLLPUBLIC ModalDialog : public Dialog +{ +public: + ModalDialog( Window* pParent, WinBits nStyle = WB_STDMODAL ); + ModalDialog( Window* pParent, const ResId& rResId ); + +private: + using Window::Show; + void Show( BOOL bVisible = TRUE ); + using Window::Hide; + void Hide(); + +//#if 0 // _SOLAR__PRIVATE + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE ModalDialog (const ModalDialog &); + SAL_DLLPRIVATE ModalDialog & operator= (const ModalDialog &); +//#endif +}; + +#endif // _SV_DIALOG_HXX diff --git a/vcl/inc/vcl/dllapi.h b/vcl/inc/vcl/dllapi.h new file mode 100644 index 000000000000..bcf4001aa671 --- /dev/null +++ b/vcl/inc/vcl/dllapi.h @@ -0,0 +1,40 @@ +/************************************************************************* + * + * 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_DLLAPI_H +#define _VCL_DLLAPI_H + +#include "sal/config.h" +#include "sal/types.h" + +#if defined VCL_DLLIMPLEMENTATION +#define VCL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#endif diff --git a/vcl/inc/vcl/dndevdis.hxx b/vcl/inc/vcl/dndevdis.hxx new file mode 100644 index 000000000000..5b91bd0713ec --- /dev/null +++ b/vcl/inc/vcl/dndevdis.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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 _DNDEVDIS_HXX_ +#define _DNDEVDIS_HXX_ + +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> + +#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDRAGESTURERECOGNIZER_HPP_ +#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> +#endif +#include <cppuhelper/implbase3.hxx> +#include <vcl/window.hxx> + +class DNDEventDispatcher: public ::cppu::WeakImplHelper3< + ::com::sun::star::datatransfer::dnd::XDropTargetListener, + ::com::sun::star::datatransfer::dnd::XDropTargetDragContext, + ::com::sun::star::datatransfer::dnd::XDragGestureListener > +{ + Window * m_pTopWindow; + Window * m_pCurrentWindow; + + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_aDataFlavorList; + + /* + * fire the events on the dnd listener container of the specified window + */ + + sal_Int32 fireDragEnterEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction, + const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& aFlavorList ) throw(::com::sun::star::uno::RuntimeException); + + sal_Int32 fireDragOverEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction ) throw(::com::sun::star::uno::RuntimeException); + + sal_Int32 fireDragExitEvent( Window *pWindow ) throw(::com::sun::star::uno::RuntimeException); + + sal_Int32 fireDropActionChangedEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction ) throw(::com::sun::star::uno::RuntimeException); + + sal_Int32 fireDropEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext >& xContext, + const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction, + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable ) throw(::com::sun::star::uno::RuntimeException); + + sal_Int32 fireDragGestureEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& xSource, + const ::com::sun::star::uno::Any event, const Point& rOrigin, const sal_Int8 nDragAction )throw(::com::sun::star::uno::RuntimeException); + +public: + + DNDEventDispatcher( Window * pTopWindow ); + virtual ~DNDEventDispatcher(); + + /* + * XDropTargetDragContext + */ + + virtual void SAL_CALL acceptDrag( sal_Int8 dropAction ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rejectDrag() throw(::com::sun::star::uno::RuntimeException); + + /* + * XDropTargetListener + */ + + virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException); + + /* + * XDragGestureListener + */ + + virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw(::com::sun::star::uno::RuntimeException); + + + /* + * XEventListener + */ + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& eo ) throw(::com::sun::star::uno::RuntimeException); +}; + +//================================================================================================== +// +//================================================================================================== + +#endif diff --git a/vcl/inc/vcl/dndhelp.hxx b/vcl/inc/vcl/dndhelp.hxx new file mode 100644 index 000000000000..3929bc1ebafc --- /dev/null +++ b/vcl/inc/vcl/dndhelp.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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_DNDHELP_HXX +#define _VCL_DNDHELP_HXX + +#include <vcl/dllapi.h> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> + +namespace com { +namespace sun { +namespace star { + +namespace datatransfer { +namespace dnd { + struct DragGestureEvent; + struct DragSourceDragEvent; + struct DragSourceDropEvent; + struct DragSourceEvent; + struct DropTargetDragEvent; + struct DropTargetDragEnterEvent; + struct DropTargetDropEvent; + struct DropTargetEvent; +}} + +}}} + +namespace vcl +{ + +namespace unohelper +{ + +class VCL_DLLPUBLIC DragAndDropClient +{ +public: + virtual ~DragAndDropClient(); + + // ::com::sun::star::datatransfer::dnd::XDragGestureListener + virtual void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::datatransfer::dnd::XDragSourceListener + virtual void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + virtual void dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::datatransfer::dnd::XDropTargetListener + virtual void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); + virtual void dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); +}; + +class VCL_DLLPUBLIC DragAndDropWrapper : + public ::com::sun::star::datatransfer::dnd::XDragGestureListener, + public ::com::sun::star::datatransfer::dnd::XDragSourceListener, + public ::com::sun::star::datatransfer::dnd::XDropTargetListener, + public ::cppu::OWeakObject +{ +private: + DragAndDropClient* mpClient; + +public: + DragAndDropWrapper( DragAndDropClient* pClient ); + ~DragAndDropWrapper(); + + // ::com::sun::star::uno::XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw() { OWeakObject::acquire(); } + void SAL_CALL release() throw() { OWeakObject::release(); } + + // ::com::sun::star::lang::XEventListener + void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::datatransfer::dnd::XDragGestureListener + void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::datatransfer::dnd::XDragSourceListener + void SAL_CALL dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::datatransfer::dnd::XDropTargetListener + void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); +}; + +}} // namespace vcl::unohelper + +#endif // _VCL_DNDHELP_HXX + diff --git a/vcl/inc/vcl/dndlcon.hxx b/vcl/inc/vcl/dndlcon.hxx new file mode 100644 index 000000000000..5a41a20e4271 --- /dev/null +++ b/vcl/inc/vcl/dndlcon.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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 _DNDLCON_HXX_ +#define _DNDLCON_HXX_ + +#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp> +#include <cppuhelper/compbase4.hxx> + +#include <vcl/unohelp2.hxx> + +class DNDListenerContainer : public ::vcl::unohelper::MutexHelper, + public ::cppu::WeakComponentImplHelper4< + ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer, \ + ::com::sun::star::datatransfer::dnd::XDropTargetDragContext, + ::com::sun::star::datatransfer::dnd::XDropTargetDropContext, + ::com::sun::star::datatransfer::dnd::XDropTarget > +{ + sal_Bool m_bActive; + sal_Int8 m_nDefaultActions; + + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext > m_xDropTargetDragContext; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext > m_xDropTargetDropContext; + +public: + + DNDListenerContainer( sal_Int8 nDefaultActions ); + virtual ~DNDListenerContainer(); + + sal_uInt32 fireDropEvent( + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions, + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable ); + + sal_uInt32 fireDragExitEvent(); + + sal_uInt32 fireDragOverEvent( + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions ); + + sal_uInt32 fireDragEnterEvent( + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions, + const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& dataFlavor ); + + sal_uInt32 fireDropActionChangedEvent( + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& context, + sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions ); + + sal_uInt32 fireDragGestureEvent( + sal_Int8 dragAction, sal_Int32 dragOriginX, sal_Int32 dragOriginY, + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& dragSource, + const ::com::sun::star::uno::Any& triggerEvent ); + + /* + * XDragGestureRecognizer + */ + + virtual void SAL_CALL addDragGestureListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener >& dgl ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeDragGestureListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener >& dgl ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL resetRecognizer( ) throw(::com::sun::star::uno::RuntimeException); + + /* + * XDropTargetDragContext + */ + + virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rejectDrag( ) throw (::com::sun::star::uno::RuntimeException); + + + /* + * XDropTargetDropContext + */ + + virtual void SAL_CALL acceptDrop( sal_Int8 dropOperation ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rejectDrop( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropComplete( sal_Bool success ) throw (::com::sun::star::uno::RuntimeException); + + /* + * XDropTarget + */ + + virtual void SAL_CALL addDropTargetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& dtl ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeDropTargetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& dtl ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isActive( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActive( sal_Bool active ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getDefaultActions( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) throw(::com::sun::star::uno::RuntimeException); +}; + + +//================================================================================================== +// +//================================================================================================== + +#endif diff --git a/vcl/inc/vcl/dockingarea.hxx b/vcl/inc/vcl/dockingarea.hxx new file mode 100644 index 000000000000..848ecac72770 --- /dev/null +++ b/vcl/inc/vcl/dockingarea.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_DOCKINGAREA_HXX +#define _SV_DOCKINGAREA_HXX + +#include <vcl/sv.h> +#include <vcl/window.hxx> + +// ------------------------------------------ +// A simple container for docked toolbars +// - its main purpose is theming support +// ------------------------------------------ + +class VCL_DLLPUBLIC DockingAreaWindow : public Window +{ + class ImplData; + +private: + ImplData* mpImplData; + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE DockingAreaWindow (const DockingAreaWindow &); + SAL_DLLPRIVATE DockingAreaWindow & operator= (const DockingAreaWindow &); + +public: + DockingAreaWindow( Window *pParent ); + ~DockingAreaWindow(); + + void SetAlign( WindowAlign eNewAlign ); + WindowAlign GetAlign() const; + BOOL IsHorizontal() const; + + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void StateChanged( StateChangedType nType ); + +}; + +#endif // _SV_SYSWIN_HXX diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx new file mode 100644 index 000000000000..61464400d595 --- /dev/null +++ b/vcl/inc/vcl/dockwin.hxx @@ -0,0 +1,452 @@ +/************************************************************************* + * + * 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_DOCKWIN_HXX +#define _SV_DOCKWIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/floatwin.hxx> +#include <vector> + +// data to be sent with docking events +struct DockingData +{ + Point maMousePos; // in + Rectangle maTrackRect; // in/out + BOOL mbFloating; // out + BOOL mbLivemode; // in + BOOL mbInteractive; // in + + DockingData() {}; + DockingData( const Point& rPt, const Rectangle& rRect, BOOL b) : + maMousePos( rPt ), maTrackRect( rRect ), mbFloating( b ), mbLivemode( FALSE ), mbInteractive( TRUE ) + {}; +}; + +struct EndDockingData +{ + Rectangle maWindowRect; // in + BOOL mbFloating; // in + BOOL mbCancelled; // in + + EndDockingData() {}; + EndDockingData( const Rectangle& rRect, BOOL b, BOOL bCancelled ) : + maWindowRect( rRect ), mbFloating( b ), mbCancelled( bCancelled ) + {}; +}; + +struct EndPopupModeData +{ + Point maFloatingPos; // in + BOOL mbTearoff; // in + + EndPopupModeData() {}; + EndPopupModeData( const Point& rPos, BOOL bTearoff ) : + maFloatingPos( rPos ), mbTearoff( bTearoff ) + {}; +}; + +/** ImplDockingWindowWrapper + * + * ImplDockingWindowWrapper obsoletes the DockingWindow class. + * It is better because it can make a "normal window" dockable. + * All DockingWindows should be converted the new class. + */ + +class ImplDockingWindowWrapper +{ + friend class Window; + friend class DockingManager; + friend class DockingWindow; + +private: + + // the original 'Docking'window + Window *mpDockingWindow; + + // the original DockingWindow members + FloatingWindow* mpFloatWin; + Window* mpOldBorderWin; + Window* mpParent; + Point maFloatPos; + Point maDockPos; + Point maMouseOff; + Point maMouseStart; + Size maRollUpOutSize; + Size maMinOutSize; + Size maMaxOutSize; + Rectangle maDragArea; + long mnTrackX; + long mnTrackY; + long mnTrackWidth; + long mnTrackHeight; + sal_Int32 mnDockLeft; + sal_Int32 mnDockTop; + sal_Int32 mnDockRight; + sal_Int32 mnDockBottom; + WinBits mnFloatBits; + BOOL mbDockCanceled:1, + mbFloatPrevented:1, + mbDockable:1, + mbDocking:1, + mbDragFull:1, + mbLastFloatMode:1, + mbStartFloat:1, + mbTrackDock:1, + mbPined:1, + mbRollUp:1, + mbDockBtn:1, + mbHideBtn:1, + mbStartDockingEnabled:1, + mbLocked:1; + + void ImplInitData(); + + DECL_LINK( PopupModeEnd, void* ); + void ImplEnableStartDocking( BOOL bEnable = TRUE ) { mbStartDockingEnabled = bEnable; } + BOOL ImplStartDockingEnabled() { return mbStartDockingEnabled; } + +public: + ImplDockingWindowWrapper( const Window *pWindow ); + virtual ~ImplDockingWindowWrapper(); + + Window* GetWindow() { return mpDockingWindow; } + BOOL ImplStartDocking( const Point& rPos ); + + // those methods actually call the corresponding handlers + void StartDocking( const Point& rPos, Rectangle& rRect ); + BOOL Docking( const Point& rPos, Rectangle& rRect ); + void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + BOOL PrepareToggleFloatingMode(); + void ToggleFloatingMode(); + + void SetDragArea( const Rectangle& rRect ); + Rectangle GetDragArea() const; + + void Lock(); + void Unlock(); + BOOL IsLocked() const; + + void StartPopupMode( ToolBox* pParentToolBox, ULONG nPopupModeFlags ); + BOOL IsInPopupMode() const; + + void TitleButtonClick( USHORT nButton ); + void Pin(); + void Roll(); + void PopupModeEnd(); + void Resizing( Size& rSize ); + BOOL Close(); + void Tracking( const TrackingEvent& rTEvt ); + long Notify( NotifyEvent& rNEvt ); + + void ShowTitleButton( USHORT nButton, BOOL bVisible = TRUE ); + BOOL IsTitleButtonVisible( USHORT nButton ) const; + + void SetPin( BOOL bPin ); + BOOL IsPined() const; + + void RollUp(); + void RollDown(); + BOOL IsRollUp() const; + + void SetRollUpOutputSizePixel( const Size& rSize ); + Size GetRollUpOutputSizePixel() const; + + void SetMinOutputSizePixel( const Size& rSize ); + const Size& GetMinOutputSizePixel() const; + + void SetMaxOutputSizePixel( const Size& rSize ); + const Size& GetMaxOutputSizePixel() const; + + BOOL IsDocking() const { return mbDocking; } + BOOL IsDockable() const { return mbDockable; } + BOOL IsDockingCanceled() const { return mbDockCanceled; } + BOOL IsFloatingPrevented() const { return mbFloatPrevented; } + + void SetFloatingMode( BOOL bFloatMode = FALSE ); + BOOL IsFloatingMode() const; + FloatingWindow* GetFloatingWindow() const { return mpFloatWin; } + + void SetFloatingPos( const Point& rNewPos ); + Point GetFloatingPos() const; + + void SetFloatStyle( WinBits nWinStyle ); + WinBits GetFloatStyle() const; + void SetTabStop(); + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, + USHORT nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, + const Size& rNewSize ) + { mpDockingWindow->SetPosSizePixel( rNewPos, rNewSize ); } + Point GetPosPixel() const; + Size GetSizePixel() const; + void SetOutputSizePixel( const Size& rNewSize ); + Size GetOutputSizePixel() const; +}; + +class VCL_DLLPUBLIC DockingManager +{ +protected: + ::std::vector<ImplDockingWindowWrapper *> mDockingWindows; + +public: + DockingManager(); + ~DockingManager(); + + void AddWindow( const Window *pWin ); + void RemoveWindow( const Window *pWin ); + + ImplDockingWindowWrapper* GetDockingWindowWrapper( const Window *pWin ); + BOOL IsDockable( const Window *pWin ); + + BOOL IsFloating( const Window *pWin ); + void SetFloatingMode( const Window *pWin, BOOL bFloating ); + + void Lock( const Window *pWin ); + void Unlock( const Window *pWin ); + BOOL IsLocked( const Window *pWin ); + + void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin ); + void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin, ULONG nPopupModeFlags ); + + BOOL IsInPopupMode( const Window *pWin ); + void EndPopupMode( const Window *pWin ); + + // required because those methods are not virtual in Window (!!!) and must + // be availbale from the toolkit + void SetPosSizePixel( Window *pWin, long nX, long nY, + long nWidth, long nHeight, + USHORT nFlags = WINDOW_POSSIZE_ALL ); + Rectangle GetPosSizePixel( const Window *pWin ); +}; + +// ----------------- +// - DockingWindow - +// ----------------- + +class VCL_DLLPUBLIC DockingWindow : public Window +{ + class ImplData; +private: + FloatingWindow* mpFloatWin; + Window* mpOldBorderWin; + ImplData* mpImplData; + Point maFloatPos; + Point maDockPos; + Point maMouseOff; + Point maMouseStart; + Size maRollUpOutSize; + Size maMinOutSize; + long mnTrackX; + long mnTrackY; + long mnTrackWidth; + long mnTrackHeight; + sal_Int32 mnDockLeft; + sal_Int32 mnDockTop; + sal_Int32 mnDockRight; + sal_Int32 mnDockBottom; + WinBits mnFloatBits; + BOOL mbDockCanceled:1, + mbDockPrevented:1, + mbFloatPrevented:1, + mbDockable:1, + mbDocking:1, + mbDragFull:1, + mbLastFloatMode:1, + mbStartFloat:1, + mbTrackDock:1, + mbPined:1, + mbRollUp:1, + mbDockBtn:1, + mbHideBtn:1; + +//#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE void ImplInitDockingWindowData(); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE DockingWindow (const DockingWindow &); + SAL_DLLPRIVATE DockingWindow & operator= (const DockingWindow &); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + SAL_DLLPRIVATE BOOL ImplStartDocking( const Point& rPos ); +//#endif + +protected: + DockingWindow( WindowType nType ); + +public: + DockingWindow( Window* pParent, WinBits nStyle = WB_STDDOCKWIN ); + DockingWindow( Window* pParent, const ResId& rResId ); + ~DockingWindow(); + + virtual void StartDocking(); + virtual BOOL Docking( const Point& rPos, Rectangle& rRect ); + virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + virtual BOOL PrepareToggleFloatingMode(); + virtual void ToggleFloatingMode(); + + virtual void TitleButtonClick( USHORT nButton ); + virtual void Pin(); + virtual void Roll(); + virtual void PopupModeEnd(); + virtual void Resizing( Size& rSize ); + virtual BOOL Close(); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + void ShowTitleButton( USHORT nButton, BOOL bVisible = TRUE ); + BOOL IsTitleButtonVisible( USHORT nButton ) const; + + void SetPin( BOOL bPin ); + BOOL IsPined() const; + + void RollUp(); + void RollDown(); + BOOL IsRollUp() const; + + void SetRollUpOutputSizePixel( const Size& rSize ); + Size GetRollUpOutputSizePixel() const; + + void SetMinOutputSizePixel( const Size& rSize ); + const Size& GetMinOutputSizePixel() const; + + void SetMaxOutputSizePixel( const Size& rSize ); + const Size& GetMaxOutputSizePixel() const; + + BOOL IsDocking() const { return mbDocking; } + BOOL IsDockable() const { return mbDockable; } + BOOL IsDockingCanceled() const { return mbDockCanceled; } + BOOL IsDockingPrevented() const { return mbDockPrevented; } + BOOL IsFloatingPrevented() const { return mbFloatPrevented; } + + void SetFloatingMode( BOOL bFloatMode = FALSE ); + BOOL IsFloatingMode() const; + FloatingWindow* GetFloatingWindow() const { return mpFloatWin; } + + void SetFloatingPos( const Point& rNewPos ); + Point GetFloatingPos() const; + + void SetFloatStyle( WinBits nWinStyle ); + WinBits GetFloatStyle() const; + void SetTabStop(); + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, + USHORT nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, + const Size& rNewSize ) + { Window::SetPosSizePixel( rNewPos, rNewSize ); } + Point GetPosPixel() const; + Size GetSizePixel() const; + void SetOutputSizePixel( const Size& rNewSize ); + Size GetOutputSizePixel() const; +}; + +inline void DockingWindow::SetPin( BOOL bPin ) +{ + if ( mpFloatWin ) + mpFloatWin->SetPin( bPin ); + mbPined = bPin; +} + +inline BOOL DockingWindow::IsPined() const +{ + if ( mpFloatWin ) + return mpFloatWin->IsPined(); + return mbPined; +} + +inline void DockingWindow::RollUp() +{ + if ( mpFloatWin ) + mpFloatWin->RollUp(); + mbRollUp = TRUE; +} + +inline void DockingWindow::RollDown() +{ + if ( mpFloatWin ) + mpFloatWin->RollDown(); + mbRollUp = FALSE; +} + +inline BOOL DockingWindow::IsRollUp() const +{ + if ( mpFloatWin ) + return mpFloatWin->IsRollUp(); + return mbRollUp; +} + +inline void DockingWindow::SetRollUpOutputSizePixel( const Size& rSize ) +{ + if ( mpFloatWin ) + mpFloatWin->SetRollUpOutputSizePixel( rSize ); + maRollUpOutSize = rSize; +} + +inline Size DockingWindow::GetRollUpOutputSizePixel() const +{ + if ( mpFloatWin ) + return mpFloatWin->GetRollUpOutputSizePixel(); + return maRollUpOutSize; +} + +inline void DockingWindow::SetMinOutputSizePixel( const Size& rSize ) +{ + if ( mpFloatWin ) + mpFloatWin->SetMinOutputSizePixel( rSize ); + maMinOutSize = rSize; +} + +inline const Size& DockingWindow::GetMinOutputSizePixel() const +{ + if ( mpFloatWin ) + return mpFloatWin->GetMinOutputSizePixel(); + return maMinOutSize; +} + +inline void DockingWindow::SetFloatingPos( const Point& rNewPos ) +{ + if ( mpFloatWin ) + mpFloatWin->SetPosPixel( rNewPos ); + else + maFloatPos = rNewPos; +} + + +#endif // _SV_DOCKWIN_HXX diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx new file mode 100755 index 000000000000..9dc427d83943 --- /dev/null +++ b/vcl/inc/vcl/edit.hxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * 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_EDIT_HXX +#define _SV_EDIT_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/timer.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/menu.hxx> +#include <vcl/dndhelp.hxx> +#include <com/sun/star/uno/Reference.h> + +namespace com { +namespace sun { +namespace star { +namespace i18n { + class XBreakIterator; + class XExtendedInputSequenceChecker; +}}}} + +class ImplSubEdit; +struct DDInfo; +struct Impl_IMEInfos; + +// -------------- +// - Edit-Types - +// -------------- + +#define EDIT_NOLIMIT STRING_LEN +#define EDIT_UPDATEDATA_TIMEOUT 350 + +typedef XubString (*FncGetSpecialChars)( Window* pWin, const Font& rFont ); + +// -------- +// - Edit - +// -------- + +enum AutocompleteAction{ AUTOCOMPLETE_KEYINPUT, AUTOCOMPLETE_TABFORWARD, AUTOCOMPLETE_TABBACKWARD }; + +class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient +{ +private: + Edit* mpSubEdit; + Timer* mpUpdateDataTimer; + DDInfo* mpDDInfo; + Impl_IMEInfos* mpIMEInfos; + XubString maText; + XubString maSaveValue; + XubString maUndoText; + XubString maRedoText; + long mnXOffset; + Selection maSelection; + USHORT mnAlign; + xub_StrLen mnMaxTextLen; + AutocompleteAction meAutocompleteAction; + xub_Unicode mcEchoChar; + BOOL mbModified:1, + mbInternModified:1, + mbReadOnly:1, + mbInsertMode:1, + mbClickedInSelection:1, + mbIsSubEdit:1, + mbInMBDown:1, + mbActivePopup:1; + Link maModifyHdl; + Link maUpdateDataHdl; + Link maAutocompleteHdl; + + DECL_DLLPRIVATE_LINK( ImplUpdateDataHdl, Timer* ); + + SAL_DLLPRIVATE bool ImplTruncateToMaxLen( rtl::OUString&, sal_uInt32 nSelectionLen ) const; + SAL_DLLPRIVATE void ImplInitEditData(); + SAL_DLLPRIVATE void ImplModified(); + SAL_DLLPRIVATE XubString ImplGetText() const; + SAL_DLLPRIVATE void ImplRepaint( xub_StrLen nStart = 0, xub_StrLen nEnd = STRING_LEN, bool bLayout = false ); + SAL_DLLPRIVATE void ImplInvalidateOrRepaint( xub_StrLen nStart = 0, xub_StrLen nEnd = STRING_LEN ); + SAL_DLLPRIVATE void ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode ); + SAL_DLLPRIVATE void ImplSetText( const XubString& rStr, const Selection* pNewSelection = 0 ); + SAL_DLLPRIVATE void ImplInsertText( const XubString& rStr, const Selection* pNewSelection = 0, sal_Bool bIsUserInput = sal_False ); + SAL_DLLPRIVATE String ImplGetValidString( const String& rString ) const; + SAL_DLLPRIVATE void ImplClearBackground( long nXStart, long nXEnd ); + SAL_DLLPRIVATE void ImplShowCursor( BOOL bOnlyIfVisible = TRUE ); + SAL_DLLPRIVATE void ImplAlign(); + SAL_DLLPRIVATE void ImplAlignAndPaint(); + SAL_DLLPRIVATE xub_StrLen ImplGetCharPos( const Point& rWindowPos ) const; + SAL_DLLPRIVATE void ImplSetCursorPos( xub_StrLen nChar, BOOL bSelect ); + SAL_DLLPRIVATE void ImplShowDDCursor(); + SAL_DLLPRIVATE void ImplHideDDCursor(); + SAL_DLLPRIVATE BOOL ImplHandleKeyEvent( const KeyEvent& rKEvt ); + SAL_DLLPRIVATE void ImplCopyToSelectionClipboard(); + SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard ); + SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard ); + SAL_DLLPRIVATE long ImplGetExtraOffset() const; + SAL_DLLPRIVATE long ImplGetTextYPosition() const; + SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const; + SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const; + +protected: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplSetSelection( const Selection& rSelection, BOOL bPaint = TRUE ); + SAL_DLLPRIVATE int ImplGetNativeControlType(); + static SAL_DLLPRIVATE void ImplInvalidateOutermostBorder( Window* pWin ); + + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > mxDnDListener; + + // DragAndDropClient + using vcl::unohelper::DragAndDropClient::dragEnter; + using vcl::unohelper::DragAndDropClient::dragExit; + using vcl::unohelper::DragAndDropClient::dragOver; + virtual void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); + virtual void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException); + virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual void FillLayoutData() const; + + Edit( WindowType nType ); + +public: + // public because needed in button.cxx + SAL_DLLPRIVATE bool ImplUseNativeBorder( WinBits nStyle ); + + Edit( Window* pParent, WinBits nStyle = WB_BORDER ); + Edit( Window* pParent, const ResId& rResId ); + Edit( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabeledByRelation ); + virtual ~Edit(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual Window* GetPreferredKeyInputWindow(); + + virtual void Modify(); + virtual void UpdateData(); + + static BOOL IsCharInput( const KeyEvent& rKEvt ); + + virtual void SetModifyFlag(); + virtual void ClearModifyFlag(); + virtual BOOL IsModified() const { return mpSubEdit ? mpSubEdit->mbModified : mbModified; } + + virtual void EnableUpdateData( ULONG nTimeout = EDIT_UPDATEDATA_TIMEOUT ); + virtual void DisableUpdateData() { delete mpUpdateDataTimer; mpUpdateDataTimer = NULL; } + virtual ULONG IsUpdateDataEnabled() const; + + void SetEchoChar( xub_Unicode c ); + xub_Unicode GetEchoChar() const { return mcEchoChar; } + + virtual void SetReadOnly( BOOL bReadOnly = TRUE ); + virtual BOOL IsReadOnly() const { return mbReadOnly; } + + void SetInsertMode( BOOL bInsert ); + BOOL IsInsertMode() const; + + virtual void SetMaxTextLen( xub_StrLen nMaxLen = EDIT_NOLIMIT ); + virtual xub_StrLen GetMaxTextLen() const { return mnMaxTextLen; } + + virtual void SetSelection( const Selection& rSelection ); + virtual const Selection& GetSelection() const; + + virtual void ReplaceSelected( const XubString& rStr ); + virtual void DeleteSelected(); + virtual XubString GetSelected() const; + + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); + void Undo(); + + virtual void SetText( const XubString& rStr ); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); + virtual XubString GetText() const; + + void SaveValue() { maSaveValue = GetText(); } + const XubString& GetSavedValue() const { return maSaveValue; } + + virtual void SetModifyHdl( const Link& rLink ) { maModifyHdl = rLink; } + virtual const Link& GetModifyHdl() const { return maModifyHdl; } + virtual void SetUpdateDataHdl( const Link& rLink ) { maUpdateDataHdl = rLink; } + virtual const Link& GetUpdateDataHdl() const { return maUpdateDataHdl; } + + void SetSubEdit( Edit* pEdit ); + Edit* GetSubEdit() const { return mpSubEdit; } + + void SetAutocompleteHdl( const Link& rHdl ); + const Link& GetAutocompleteHdl() const { return maAutocompleteHdl; } + AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; } + + virtual Size CalcMinimumSize() const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size CalcSize( USHORT nChars ) const; + virtual xub_StrLen GetMaxVisChars() const; + + xub_StrLen GetCharPos( const Point& rWindowPos ) const; + + // shows a warning box saying "text too long, truncated" + static void ShowTruncationWarning( Window* pParent ); + + static void SetGetSpecialCharsFunction( FncGetSpecialChars fn ); + static FncGetSpecialChars GetGetSpecialCharsFunction(); + + static PopupMenu* CreatePopupMenu(); + static void DeletePopupMenu( PopupMenu* pMenu ); + + virtual XubString GetSurroundingText() const; + virtual Selection GetSurroundingTextSelection() const; + + // returns the minimum size a bordered Edit should have given the current + // global style settings (needed by sc's inputwin.cxx) + static Size GetMinimumEditSize(); +}; + +inline ULONG Edit::IsUpdateDataEnabled() const +{ + if ( mpUpdateDataTimer ) + return mpUpdateDataTimer->GetTimeout(); + else + return FALSE; +} + +#endif // _SV_EDIT_HXX diff --git a/vcl/inc/vcl/event.hxx b/vcl/inc/vcl/event.hxx new file mode 100644 index 000000000000..9458a4298c33 --- /dev/null +++ b/vcl/inc/vcl/event.hxx @@ -0,0 +1,479 @@ +/************************************************************************* + * + * 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_EVENT_HXX +#define _SV_EVENT_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/gen.hxx> +#include <vcl/keycod.hxx> +#include <vcl/cmdevt.hxx> + +class AllSettings; +class OutputDevice; +class Window; +struct IDataObject; + +namespace com { namespace sun { namespace star { namespace awt { + struct KeyEvent; + struct MouseEvent; +} } } } + +enum TextDirectionality { + TextDirectionality_LeftToRight_TopToBottom, + TextDirectionality_RightToLeft_TopToBottom, + TextDirectionality_TopToBottom_RightToLeft +}; + +// ------------ +// - KeyEvent - +// ------------ +class VCL_DLLPUBLIC KeyEvent +{ +private: + KeyCode maKeyCode; + USHORT mnRepeat; + xub_Unicode mnCharCode; + +public: + KeyEvent(); + KeyEvent( xub_Unicode nChar, const KeyCode& rKeyCode, + USHORT nRepeat = 0 ); + + /** inits this vcl KeyEvent with all settings from the given awt event **/ + KeyEvent( const ::com::sun::star::awt::KeyEvent& rEvent ); + + /** fills out the given awt KeyEvent with all settings from this vcl event **/ + void InitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent ) const; + + xub_Unicode GetCharCode() const { return mnCharCode; } + const KeyCode& GetKeyCode() const { return maKeyCode; } + USHORT GetRepeat() const { return mnRepeat; } + + KeyEvent LogicalTextDirectionality (TextDirectionality eMode) const; + KeyEvent (const KeyEvent& rKeyEvent); + +}; + +inline KeyEvent::KeyEvent() +{ + mnCharCode = 0; + mnRepeat = 0; +} + +inline KeyEvent::KeyEvent( xub_Unicode nChar, const KeyCode& rKeyCode, + USHORT nRepeat ) : + maKeyCode( rKeyCode ) + +{ + mnCharCode = nChar; + mnRepeat = nRepeat; +} + +// -------------------- +// - MouseEvent-Types - +// -------------------- + +// Maus-Move-Modi +#define MOUSE_SIMPLEMOVE ((USHORT)0x0001) +#define MOUSE_DRAGMOVE ((USHORT)0x0002) +#define MOUSE_DRAGCOPY ((USHORT)0x0004) +#define MOUSE_ENTERWINDOW ((USHORT)0x0010) +#define MOUSE_LEAVEWINDOW ((USHORT)0x0020) +#define MOUSE_SYNTHETIC ((USHORT)0x0040) +#define MOUSE_MODIFIERCHANGED ((USHORT)0x0080) + +// Maus-Button-Down/Up-Modi +#define MOUSE_SIMPLECLICK ((USHORT)0x0001) +#define MOUSE_SELECT ((USHORT)0x0002) +#define MOUSE_MULTISELECT ((USHORT)0x0004) +#define MOUSE_RANGESELECT ((USHORT)0x0008) + +// Maus-Buttons +#define MOUSE_LEFT ((USHORT)0x0001) +#define MOUSE_MIDDLE ((USHORT)0x0002) +#define MOUSE_RIGHT ((USHORT)0x0004) + +// -------------- +// - MouseEvent - +// -------------- + +class VCL_DLLPUBLIC MouseEvent +{ +private: + Point maPos; + USHORT mnMode; + USHORT mnClicks; + USHORT mnCode; + +public: + MouseEvent(); + MouseEvent( const Point& rPos, USHORT nClicks = 1, + USHORT nMode = 0, USHORT nButtons = 0, + USHORT nModifier = 0 ); + + const Point& GetPosPixel() const { return maPos; } + USHORT GetMode() const { return mnMode; } + /** inits this vcl KeyEvent with all settings from the given awt event **/ + MouseEvent( const ::com::sun::star::awt::MouseEvent& rEvent ); + + /** fills out the given awt KeyEvent with all settings from this vcl event **/ + void InitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent ) const; + + USHORT GetClicks() const { return mnClicks; } + + BOOL IsEnterWindow() const + { return ((mnMode & MOUSE_ENTERWINDOW) != 0); } + BOOL IsLeaveWindow() const + { return ((mnMode & MOUSE_LEAVEWINDOW) != 0); } + BOOL IsSynthetic() const + { return ((mnMode & MOUSE_SYNTHETIC) != 0); } + BOOL IsModifierChanged() const + { return ((mnMode & MOUSE_MODIFIERCHANGED) != 0); } + + USHORT GetButtons() const + { return (mnCode & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)); } + BOOL IsLeft() const + { return ((mnCode & MOUSE_LEFT) != 0); } + BOOL IsMiddle() const + { return ((mnCode & MOUSE_MIDDLE) != 0); } + BOOL IsRight() const + { return ((mnCode & MOUSE_RIGHT) != 0); } + + USHORT GetModifier() const + { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); } + BOOL IsShift() const + { return ((mnCode & KEY_SHIFT) != 0); } + BOOL IsMod1() const + { return ((mnCode & KEY_MOD1) != 0); } + BOOL IsMod2() const + { return ((mnCode & KEY_MOD2) != 0); } + BOOL IsMod3() const + { return ((mnCode & KEY_MOD3) != 0); } +}; + +inline MouseEvent::MouseEvent() +{ + mnMode = 0; + mnClicks = 0; + mnCode = 0; +} + +inline MouseEvent::MouseEvent( const Point& rPos, USHORT nClicks, + USHORT nMode, + USHORT nButtons, USHORT nModifier ) : + maPos( rPos ) +{ + mnClicks = nClicks; + mnMode = nMode; + mnCode = nButtons | nModifier; +} + +// ------------- +// - HelpEvent - +// ------------- + +#define HELPMODE_CONTEXT ((USHORT)0x0001) +#define HELPMODE_EXTENDED ((USHORT)0x0002) +#define HELPMODE_BALLOON ((USHORT)0x0004) +#define HELPMODE_QUICK ((USHORT)0x0008) + +class VCL_DLLPUBLIC HelpEvent +{ +private: + Point maPos; + USHORT mnMode; + BOOL mbKeyboardActivated; + +public: + HelpEvent(); + HelpEvent( USHORT nHelpMode ); + HelpEvent( const Point& rMousePos, USHORT nHelpMode ); + + const Point& GetMousePosPixel() const; + USHORT GetMode() const { return mnMode; } + BOOL KeyboardActivated() const { return mbKeyboardActivated; } + void SetKeyboardActivated( BOOL bKeyboard ) { mbKeyboardActivated = bKeyboard; } +}; + +inline HelpEvent::HelpEvent() +{ + mnMode = HELPMODE_CONTEXT; + mbKeyboardActivated = TRUE; +} + +inline HelpEvent::HelpEvent( const Point& rMousePos, USHORT nHelpMode ) : + maPos( rMousePos ) +{ + mnMode = nHelpMode; + mbKeyboardActivated = FALSE; +} + +inline HelpEvent::HelpEvent( USHORT nHelpMode ) +{ + mnMode = nHelpMode; + mbKeyboardActivated = TRUE; +} + +// ----------------- +// - UserDrawEvent - +// ----------------- + +class VCL_DLLPUBLIC UserDrawEvent +{ +private: + OutputDevice* mpOutDev; + Rectangle maOutRect; + USHORT mnItemId; + USHORT mnStyle; + +public: + UserDrawEvent(); + UserDrawEvent( OutputDevice* pOut, + const Rectangle& rOutRect, + USHORT nId, USHORT nStyle = 0 ); + + OutputDevice* GetDevice() const { return mpOutDev; } + const Rectangle& GetRect() const { return maOutRect; } + USHORT GetItemId() const { return mnItemId; } + USHORT GetStyle() const { return mnStyle; } +}; + +inline UserDrawEvent::UserDrawEvent() +{ + mpOutDev = NULL; + mnItemId = 0; + mnStyle = 0; +} + +inline UserDrawEvent::UserDrawEvent( OutputDevice* pOut, + const Rectangle& rOutRect, + USHORT nId, USHORT nStyle ) : + maOutRect( rOutRect ) +{ + mpOutDev = pOut; + mnItemId = nId; + mnStyle = nStyle; +} + +// ------------------ +// - Tracking-Types - +// ------------------ + +#define ENDTRACK_CANCEL ((USHORT)0x0001) +#define ENDTRACK_KEY ((USHORT)0x0002) +#define ENDTRACK_FOCUS ((USHORT)0x0004) +#define ENDTRACK_END ((USHORT)0x1000) +#define ENDTRACK_DONTCALLHDL ((USHORT)0x8000) + +#define TRACKING_REPEAT ((USHORT)0x0100) + +// ----------------- +// - TrackingEvent - +// ----------------- + +class VCL_DLLPUBLIC TrackingEvent +{ +private: + MouseEvent maMEvt; + USHORT mnFlags; + +public: + TrackingEvent(); + TrackingEvent( const MouseEvent& rMEvt, + USHORT nTrackFlags = 0 ); + + const MouseEvent& GetMouseEvent() const { return maMEvt; } + + BOOL IsTrackingRepeat() const + { return ((mnFlags & TRACKING_REPEAT) != 0); } + + BOOL IsTrackingEnded() const + { return ((mnFlags & ENDTRACK_END) != 0); } + BOOL IsTrackingCanceled() const + { return ((mnFlags & ENDTRACK_CANCEL) != 0); } + USHORT GetTrackingFlags() const { return mnFlags; } +}; + +inline TrackingEvent::TrackingEvent() +{ + mnFlags = 0; +} + +inline TrackingEvent::TrackingEvent( const MouseEvent& rMEvt, + USHORT nTrackFlags ) : + maMEvt( rMEvt ) +{ + mnFlags = nTrackFlags; +} + +// --------------- +// - NotifyEvent - +// --------------- + +#define EVENT_MOUSEBUTTONDOWN 1 +#define EVENT_MOUSEBUTTONUP 2 +#define EVENT_MOUSEMOVE 3 +#define EVENT_KEYINPUT 4 +#define EVENT_KEYUP 5 +#define EVENT_GETFOCUS 6 +#define EVENT_LOSEFOCUS 7 +#define EVENT_COMMAND 8 +#define EVENT_DESTROY 9 +#define EVENT_INPUTENABLE 10 +#define EVENT_INPUTDISABLE 11 +#define EVENT_EXECUTEDIALOG 100 +#define EVENT_ENDEXECUTEDIALOG 101 +#define EVENT_USER 10000 + +class VCL_DLLPUBLIC NotifyEvent +{ +private: + Window* mpWindow; + void* mpData; + USHORT mnType; + long mnRetValue; + +public: + NotifyEvent(); + NotifyEvent( USHORT nType, + Window* pWindow, + const void* pEvent = NULL, + long nRet = 0 ); + + USHORT GetType() const { return mnType; } + Window* GetWindow() const { return mpWindow; } + void* GetData() const { return mpData; } + + void SetReturnValue( long nRet ) { mnRetValue = nRet; } + long GetReturnValue() const { return mnRetValue; } + + const KeyEvent* GetKeyEvent() const; + const MouseEvent* GetMouseEvent() const; + const CommandEvent* GetCommandEvent() const; +}; + +inline NotifyEvent::NotifyEvent() +{ + mpWindow = NULL; + mpData = NULL; + mnType = 0; + mnRetValue = 0; +} + +inline NotifyEvent::NotifyEvent( USHORT nType, Window* pWindow, + const void* pEvent, long nRet ) +{ + mpWindow = pWindow; + mpData = (void*)pEvent; + mnType = nType; + mnRetValue = nRet; +} + +inline const KeyEvent* NotifyEvent::GetKeyEvent() const +{ + if ( (mnType == EVENT_KEYINPUT) || (mnType == EVENT_KEYUP) ) + return (const KeyEvent*)mpData; + else + return NULL; +} + +inline const MouseEvent* NotifyEvent::GetMouseEvent() const +{ + if ( (mnType >= EVENT_MOUSEBUTTONDOWN) && (mnType <= EVENT_MOUSEMOVE) ) + return (const MouseEvent*)mpData; + else + return NULL; +} + +inline const CommandEvent* NotifyEvent::GetCommandEvent() const +{ + if ( mnType == EVENT_COMMAND ) + return (const CommandEvent*)mpData; + else + return NULL; +} + +// -------------------- +// - DataChangedEvent - +// -------------------- + +#define DATACHANGED_SETTINGS ((USHORT)1) +#define DATACHANGED_DISPLAY ((USHORT)2) +#define DATACHANGED_DATETIME ((USHORT)3) +#define DATACHANGED_FONTS ((USHORT)4) +#define DATACHANGED_PRINTER ((USHORT)5) +#define DATACHANGED_FONTSUBSTITUTION ((USHORT)6) +#define DATACHANGED_USER ((USHORT)10000) + +class VCL_DLLPUBLIC DataChangedEvent +{ +private: + void* mpData; + ULONG mnFlags; + USHORT mnType; + +public: + DataChangedEvent(); + DataChangedEvent( USHORT nType, + const void* pData = NULL, + ULONG nFlags = 0 ); + + USHORT GetType() const { return mnType; } + void* GetData() const { return mpData; } + ULONG GetFlags() const { return mnFlags; } + + const AllSettings* GetOldSettings() const; +}; + +inline DataChangedEvent::DataChangedEvent() +{ + mpData = NULL; + mnFlags = 0; + mnType = 0; +} + +inline DataChangedEvent::DataChangedEvent( USHORT nType, + const void* pData, + ULONG nChangeFlags ) +{ + mpData = (void*)pData; + mnFlags = nChangeFlags; + mnType = nType; +} + +inline const AllSettings* DataChangedEvent::GetOldSettings() const +{ + if ( mnType == DATACHANGED_SETTINGS ) + return (const AllSettings*)mpData; + else + return NULL; +} + +#endif // _SV_EVENT_HXX + diff --git a/vcl/inc/vcl/evntpost.hxx b/vcl/inc/vcl/evntpost.hxx new file mode 100644 index 000000000000..9e9badb7157b --- /dev/null +++ b/vcl/inc/vcl/evntpost.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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_EVNTPOST_HXX +#define _VCL_EVNTPOST_HXX + +#include <tools/link.hxx> +#include <vcl/dllapi.h> + +//=================================================================== + +namespace vcl +{ + struct UserEvent + { + ULONG m_nWhich; + void* m_pData; + }; + + class VCL_DLLPUBLIC EventPoster + { + ULONG m_nId; + Link m_aLink; + +//#if 0 // _SOLAR__PRIVATE + DECL_DLLPRIVATE_LINK( DoEvent_Impl, UserEvent* ); +//#endif + + public: + EventPoster( const Link& rLink ); + ~EventPoster(); + void Post( UserEvent* pEvent ); + }; +} + +#endif diff --git a/vcl/inc/vcl/extoutdevdata.hxx b/vcl/inc/vcl/extoutdevdata.hxx new file mode 100644 index 000000000000..cfe7b74533d8 --- /dev/null +++ b/vcl/inc/vcl/extoutdevdata.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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_EXTOUTDEVDATA_HXX +#define _VCL_EXTOUTDEVDATA_HXX + +#include <tools/rtti.hxx> +#include <vcl/dllapi.h> + +namespace vcl +{ + +class VCL_DLLPUBLIC ExtOutDevData +{ +public: + + TYPEINFO(); + virtual ~ExtOutDevData(); +}; + +} + +#endif // _VCL_PDFWRITER_HXX diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx new file mode 100644 index 000000000000..e1f39cc78966 --- /dev/null +++ b/vcl/inc/vcl/field.hxx @@ -0,0 +1,884 @@ +/************************************************************************* + * + * 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_FIELD_HXX +#define _SV_FIELD_HXX + +#include <vcl/dllapi.h> +#include <tools/link.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <vcl/spinfld.hxx> +#include <vcl/combobox.hxx> +#include <vcl/fldunit.hxx> + +namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } } + +class CalendarWrapper; +class LocaleDataWrapper; + +// ----------------- +// - FormatterBase - +// ----------------- + +class VCL_DLLPUBLIC FormatterBase +{ +private: + Edit* mpField; + LocaleDataWrapper* mpLocaleDataWrapper; + Link maErrorLink; + BOOL mbReformat; + BOOL mbStrictFormat; + BOOL mbEmptyFieldValue; + BOOL mbEmptyFieldValueEnabled; + BOOL mbDefaultLocale; + +protected: + SAL_DLLPRIVATE void ImplSetText( const XubString& rText, Selection* pNewSel = NULL ); + SAL_DLLPRIVATE BOOL ImplGetEmptyFieldValue() const { return mbEmptyFieldValue; } + + void SetFieldText( const XubString& rText, BOOL bKeepSelection ); + void SetEmptyFieldValueData( BOOL bValue ) { mbEmptyFieldValue = bValue; } + + SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const; + BOOL IsDefaultLocale() const { return mbDefaultLocale; } + +public: + FormatterBase( Edit* pField = NULL ); + virtual ~FormatterBase(); + + const LocaleDataWrapper& GetLocaleDataWrapper() const; + + void SetField( Edit* pField ) { mpField = pField; } + Edit* GetField() const { return mpField; } + + BOOL MustBeReformatted() const { return mbReformat; } + void MarkToBeReformatted( BOOL b ) { mbReformat = b; } + + void SetStrictFormat( BOOL bStrict ); + BOOL IsStrictFormat() const { return mbStrictFormat; } + + virtual void Reformat(); + virtual void ReformatAll(); + + virtual void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); + const ::com::sun::star::lang::Locale& GetLocale() const; + + const AllSettings& GetFieldSettings() const; + + void SetErrorHdl( const Link& rLink ) { maErrorLink = rLink; } + const Link& GetErrorHdl() const { return maErrorLink; } + + void SetEmptyFieldValue(); + BOOL IsEmptyFieldValue() const; + + void EnableEmptyFieldValue( BOOL bEnable ) { mbEmptyFieldValueEnabled = bEnable; } + BOOL IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled; } +}; + + +// -------------------- +// - PatternFormatter - +// -------------------- + +#define PATTERN_FORMAT_EMPTYLITERALS ((USHORT)0x0001) + +class VCL_DLLPUBLIC PatternFormatter : public FormatterBase +{ +private: + ByteString maEditMask; + XubString maFieldString; + XubString maLiteralMask; + USHORT mnFormatFlags; + BOOL mbSameMask; + BOOL mbInPattKeyInput; + +protected: + PatternFormatter(); + + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplSetMask( const ByteString& rEditMask, const XubString& rLiteralMask ); + SAL_DLLPRIVATE BOOL ImplIsSameMask() const { return mbSameMask; } + SAL_DLLPRIVATE BOOL& ImplGetInPattKeyInput() { return mbInPattKeyInput; } + +public: + ~PatternFormatter(); + + virtual void Reformat(); + + void SetMask( const ByteString& rEditMask, + const XubString& rLiteralMask ); + const ByteString& GetEditMask() const { return maEditMask; } + const XubString& GetLiteralMask() const { return maLiteralMask; } + + void SetFormatFlags( USHORT nFlags ) { mnFormatFlags = nFlags; } + USHORT GetFormatFlags() const { return mnFormatFlags; } + + void SetString( const XubString& rStr ); + XubString GetString() const; + BOOL IsStringModified() const { return !(GetString().Equals( maFieldString )); } + + void SelectFixedFont(); +}; + +// -------------------- +// - NumericFormatter - +// -------------------- + +class VCL_DLLPUBLIC NumericFormatter : public FormatterBase +{ +private: + SAL_DLLPRIVATE void ImplInit(); + +protected: + sal_Int64 mnFieldValue; + sal_Int64 mnLastValue; + sal_Int64 mnMin; + sal_Int64 mnMax; + sal_Int64 mnCorrectedValue; + USHORT mnType; + USHORT mnDecimalDigits; + BOOL mbThousandSep; + BOOL mbShowTrailingZeros; + + // the members below are used in all derivatives of NumericFormatter + // not in NumericFormatter itself. + sal_Int64 mnSpinSize; + sal_Int64 mnFirst; + sal_Int64 mnLast; + +protected: + NumericFormatter(); + + virtual XubString CreateFieldText( sal_Int64 nValue ) const; + + void FieldUp(); + void FieldDown(); + void FieldFirst(); + void FieldLast(); + + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE BOOL ImplNumericReformat( const XubString& rStr, double& rValue, XubString& rOutStr ); + SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue ); + SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection* pNewSelection = NULL ); + +public: + ~NumericFormatter(); + + virtual void Reformat(); + + void SetMin( sal_Int64 nNewMin ); + sal_Int64 GetMin() const { return mnMin; } + void SetMax( sal_Int64 nNewMax ); + sal_Int64 GetMax() const { return mnMax; } + + void SetFirst( sal_Int64 nNewFirst ) { mnFirst = nNewFirst; } + sal_Int64 GetFirst() const { return mnFirst; } + void SetLast( sal_Int64 nNewLast ) { mnLast = nNewLast; } + sal_Int64 GetLast() const { return mnLast; } + void SetSpinSize( sal_Int64 nNewSize ) { mnSpinSize = nNewSize; } + sal_Int64 GetSpinSize() const { return mnSpinSize; } + + void SetDecimalDigits( USHORT nDigits ); + USHORT GetDecimalDigits() const; + + void SetUseThousandSep( BOOL b ); + BOOL IsUseThousandSep() const { return mbThousandSep; } + + void SetShowTrailingZeros( BOOL bShowTrailingZeros ); + BOOL IsShowTrailingZeros() const { return mbShowTrailingZeros; } + + + void SetUserValue( sal_Int64 nNewValue ); + virtual void SetValue( sal_Int64 nNewValue ); + virtual sal_Int64 GetValue() const; + BOOL IsValueModified() const; + sal_Int64 GetCorrectedValue() const { return mnCorrectedValue; } + + Fraction ConvertToFraction( sal_Int64 nValue ); + sal_Int64 ConvertToLong( const Fraction& rValue ); + sal_Int64 Normalize( sal_Int64 nValue ) const; + sal_Int64 Denormalize( sal_Int64 nValue ) const; +}; + +// ------------------- +// - MetricFormatter - +// ------------------- + +class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter +{ +private: + SAL_DLLPRIVATE void ImplInit(); + +protected: + XubString maCustomUnitText; + XubString maCurUnitText; + sal_Int64 mnBaseValue; + FieldUnit meUnit; + Link maCustomConvertLink; + +protected: + MetricFormatter(); + + virtual XubString CreateFieldText( sal_Int64 nValue ) const; + + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE BOOL ImplMetricReformat( const XubString& rStr, double& rValue, XubString& rOutStr ); + +public: + ~MetricFormatter(); + + virtual void CustomConvert() = 0; + virtual void Reformat(); + + void SetUnit( FieldUnit meUnit ); + FieldUnit GetUnit() const { return meUnit; } + void SetCustomUnitText( const XubString& rStr ); + const XubString& GetCustomUnitText() const { return maCustomUnitText; } + const XubString& GetCurUnitText() const { return maCurUnitText; } + + using NumericFormatter::SetMax; + void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit ); + using NumericFormatter::GetMax; + sal_Int64 GetMax( FieldUnit eOutUnit ) const; + using NumericFormatter::SetMin; + void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ); + using NumericFormatter::GetMin; + sal_Int64 GetMin( FieldUnit eOutUnit ) const; + void SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit = FUNIT_NONE ); + sal_Int64 GetBaseValue( FieldUnit eOutUnit = FUNIT_NONE ) const; + + virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ); + virtual void SetValue( sal_Int64 nValue ); + using NumericFormatter::SetUserValue; + void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit ); + virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const; + virtual sal_Int64 GetValue() const; + using NumericFormatter::GetCorrectedValue; + sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const; + + void SetCustomConvertHdl( const Link& rLink ) { maCustomConvertLink = rLink; } + const Link& GetCustomConvertHdl() const { return maCustomConvertLink; } +}; + + +// --------------------- +// - CurrencyFormatter - +// --------------------- + +class VCL_DLLPUBLIC CurrencyFormatter : public NumericFormatter +{ +private: + String maCurrencySymbol; + + SAL_DLLPRIVATE void ImplInit(); + +protected: + CurrencyFormatter(); + virtual XubString CreateFieldText( sal_Int64 nValue ) const; + SAL_DLLPRIVATE BOOL ImplCurrencyReformat( const XubString& rStr, XubString& rOutStr ); + +public: + ~CurrencyFormatter(); + + virtual void Reformat(); + + void SetCurrencySymbol( const String& rStr ); + String GetCurrencySymbol() const; + + virtual void SetValue( sal_Int64 nNewValue ); + virtual sal_Int64 GetValue() const; +}; + + +// ----------------- +// - DateFormatter - +// ----------------- + +class VCL_DLLPUBLIC DateFormatter : public FormatterBase +{ +private: + CalendarWrapper* mpCalendarWrapper; + Date maFieldDate; + Date maLastDate; + Date maMin; + Date maMax; + Date maCorrectedDate; + BOOL mbLongFormat; + BOOL mbEmptyDate; + BOOL mbShowDateCentury; + USHORT mnDateFormat; + ULONG mnExtDateFormat; + BOOL mbEnforceValidValue; + + SAL_DLLPRIVATE void ImplInit(); + +protected: + DateFormatter(); + + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE const Date& ImplGetFieldDate() const { return maFieldDate; } + SAL_DLLPRIVATE BOOL ImplDateReformat( const XubString& rStr, XubString& rOutStr, + const AllSettings& rSettings ); + SAL_DLLPRIVATE void ImplSetUserDate( const Date& rNewDate, + Selection* pNewSelection = NULL ); + SAL_DLLPRIVATE XubString ImplGetDateAsText( const Date& rDate, + const AllSettings& rSettings ) const; + SAL_DLLPRIVATE void ImplNewFieldValue( const Date& rDate ); + CalendarWrapper& GetCalendarWrapper() const; + + SAL_DLLPRIVATE BOOL ImplAllowMalformedInput() const; + +public: + ~DateFormatter(); + + virtual void Reformat(); + virtual void ReformatAll(); + + virtual void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); + + + void SetExtDateFormat( ExtDateFieldFormat eFormat ); + ExtDateFieldFormat GetExtDateFormat( BOOL bResolveSystemFormat = FALSE ) const; + + void SetMin( const Date& rNewMin ); + const Date& GetMin() const { return maMin; } + + void SetMax( const Date& rNewMax ); + const Date& GetMax() const { return maMax; } + + + // -------------------------------------------------------------- + // MT: Remove these methods too, ExtDateFormat should be enough! + // What should happen if using DDMMYYYY, but ShowCentury=FALSE? + // -------------------------------------------------------------- + void SetLongFormat( BOOL bLong ); + BOOL IsLongFormat() const { return mbLongFormat; } + void SetShowDateCentury( BOOL bShowCentury ); + BOOL IsShowDateCentury() const { return mbShowDateCentury; } + // -------------------------------------------------------------- + + void SetDate( const Date& rNewDate ); + void SetUserDate( const Date& rNewDate ); + Date GetDate() const; + Date GetRealDate() const; + BOOL IsDateModified() const; + void SetEmptyDate(); + BOOL IsEmptyDate() const; + Date GetCorrectedDate() const { return maCorrectedDate; } + + void ResetLastDate() { maLastDate = Date( 0, 0, 0 ); } + + static void ExpandCentury( Date& rDate ); + static void ExpandCentury( Date& rDate, USHORT nTwoDigitYearStart ); + + static Date GetInvalidDate() { return Date( 0, 0, 0 ); } + + /** enables or disables the enforcement of valid values + + If this is set to <TRUE/> (which is the default), then GetDate will always return a valid + date, no matter whether the current text can really be interpreted as date. (Note: this + is the compatible bahavior). + + If this is set to <FALSE/>, the GetDate will return GetInvalidDate, in case the current text + cannot be interpreted as date. + + In addition, if this is set to <FALSE/>, the text in the field will <em>not</em> be corrected + when the control loses the focus - instead, the invalid input will be preserved. + */ + void EnforceValidValue( BOOL _bEnforce ) { mbEnforceValidValue = _bEnforce; } + inline BOOL IsEnforceValidValue( ) const { return mbEnforceValidValue; } +}; + + +// ----------------- +// - TimeFormatter - +// ----------------- + +class VCL_DLLPUBLIC TimeFormatter : public FormatterBase +{ +private: + Time maLastTime; + Time maMin; + Time maMax; + Time maCorrectedTime; + TimeFieldFormat meFormat; + USHORT mnTimeFormat; + BOOL mbDuration; + BOOL mbEmptyTime; + BOOL mbEnforceValidValue; + + SAL_DLLPRIVATE void ImplInit(); + +protected: + Time maFieldTime; + + TimeFormatter(); + + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE BOOL ImplTimeReformat( const XubString& rStr, XubString& rOutStr ); + SAL_DLLPRIVATE void ImplNewFieldValue( const Time& rTime ); + SAL_DLLPRIVATE void ImplSetUserTime( const Time& rNewTime, Selection* pNewSelection = NULL ); + SAL_DLLPRIVATE BOOL ImplAllowMalformedInput() const; + +public: + + enum TimeFormat { + HOUR_12, + HOUR_24 + }; + + ~TimeFormatter(); + + virtual void Reformat(); + virtual void ReformatAll(); + + void SetMin( const Time& rNewMin ); + const Time& GetMin() const { return maMin; } + void SetMax( const Time& rNewMax ); + const Time& GetMax() const { return maMax; } + + void SetTimeFormat( TimeFormat eNewFormat ); + TimeFormat GetTimeFormat() const; + + void SetFormat( TimeFieldFormat eNewFormat ); + TimeFieldFormat GetFormat() const { return meFormat; } + + void SetDuration( BOOL mbDuration ); + BOOL IsDuration() const { return mbDuration; } + + void SetTime( const Time& rNewTime ); + void SetUserTime( const Time& rNewTime ); + Time GetTime() const; + Time GetRealTime() const; + BOOL IsTimeModified() const; + void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); } + BOOL IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); } + Time GetCorrectedTime() const { return maCorrectedTime; } + + static Time GetInvalidTime() { return Time( 99, 99, 99 ); } + + /** enables or disables the enforcement of valid values + + If this is set to <TRUE/> (which is the default), then GetTime will always return a valid + time, no matter whether the current text can really be interpreted as time. (Note: this + is the compatible bahavior). + + If this is set to <FALSE/>, the GetTime will return GetInvalidTime, in case the current text + cannot be interpreted as time. + + In addition, if this is set to <FALSE/>, the text in the field will <em>not</em> be corrected + when the control loses the focus - instead, the invalid input will be preserved. + */ + void EnforceValidValue( BOOL _bEnforce ) { mbEnforceValidValue = _bEnforce; } + inline BOOL IsEnforceValidValue( ) const { return mbEnforceValidValue; } +}; + + +// ---------------- +// - PatternField - +// ---------------- + +class VCL_DLLPUBLIC PatternField : public SpinField, public PatternFormatter +{ +public: + PatternField( Window* pParent, WinBits nWinStyle ); + PatternField( Window* pParent, const ResId& rResId ); + ~PatternField(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void Modify(); +}; + + +// ---------------- +// - NumericField - +// ---------------- + +class VCL_DLLPUBLIC NumericField : public SpinField, public NumericFormatter +{ +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + NumericField( Window* pParent, WinBits nWinStyle ); + NumericField( Window* pParent, const ResId& rResId ); + ~NumericField(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); +}; + + +// ---------------- +// - MetricField - +// ---------------- + +class VCL_DLLPUBLIC MetricField : public SpinField, public MetricFormatter +{ +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + MetricField( Window* pParent, WinBits nWinStyle ); + MetricField( Window* pParent, const ResId& rResId ); + ~MetricField(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); + virtual void CustomConvert(); + + void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); + inline void SetFirst(sal_Int64 first) { SetFirst(first, FUNIT_NONE); } + sal_Int64 GetFirst( FieldUnit eOutUnit ) const; + inline sal_Int64 GetFirst() const { return GetFirst(FUNIT_NONE); } + void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit ); + inline void SetLast(sal_Int64 last) { SetLast(last, FUNIT_NONE); } + sal_Int64 GetLast( FieldUnit eOutUnit ) const; + inline sal_Int64 GetLast() const { return GetLast(FUNIT_NONE); } + + static void SetDefaultUnit( FieldUnit eDefaultUnit ); + static FieldUnit GetDefaultUnit(); + static sal_Int64 ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, USHORT nDecDigits, + FieldUnit eInUnit, FieldUnit eOutUnit ); + static sal_Int64 ConvertValue( sal_Int64 nValue, USHORT nDecDigits, + FieldUnit eInUnit, MapUnit eOutUnit ); + static sal_Int64 ConvertValue( sal_Int64 nValue, USHORT nDecDigits, + MapUnit eInUnit, FieldUnit eOutUnit ); + + // for backwards compatibility + // caution: conversion to double loses precision + static double ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, USHORT nDecDigits, + FieldUnit eInUnit, FieldUnit eOutUnit ); + static double ConvertDoubleValue( double nValue, USHORT nDecDigits, + FieldUnit eInUnit, MapUnit eOutUnit ); + static double ConvertDoubleValue( double nValue, USHORT nDecDigits, + MapUnit eInUnit, FieldUnit eOutUnit ); + + // for backwards compatibility + // caution: conversion to double loses precision + static double ConvertDoubleValue( sal_Int64 nValue, sal_Int64 nBaseValue, USHORT nDecDigits, + FieldUnit eInUnit, FieldUnit eOutUnit ) + { return ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit, eOutUnit ); } + static double ConvertDoubleValue( sal_Int64 nValue, USHORT nDecDigits, + FieldUnit eInUnit, MapUnit eOutUnit ) + { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); } + static double ConvertDoubleValue( sal_Int64 nValue, USHORT nDecDigits, + MapUnit eInUnit, FieldUnit eOutUnit ) + { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); } +}; + + +// ----------------- +// - CurrencyField - +// ----------------- + +class VCL_DLLPUBLIC CurrencyField : public SpinField, public CurrencyFormatter +{ +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + CurrencyField( Window* pParent, WinBits nWinStyle ); + CurrencyField( Window* pParent, const ResId& rResId ); + ~CurrencyField(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); +}; + + +// ------------- +// - DateField - +// ------------- + +class VCL_DLLPUBLIC DateField : public SpinField, public DateFormatter +{ +private: + Date maFirst; + Date maLast; + +protected: + SAL_DLLPRIVATE void ImplDateSpinArea( BOOL bUp ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + DateField( Window* pParent, WinBits nWinStyle ); + DateField( Window* pParent, const ResId& rResId ); + ~DateField(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); + + void SetFirst( const Date& rNewFirst ) { maFirst = rNewFirst; } + Date GetFirst() const { return maFirst; } + void SetLast( const Date& rNewLast ) { maLast = rNewLast; } + Date GetLast() const { return maLast; } +}; + +// ------------- +// - TimeField - +// ------------- + +class VCL_DLLPUBLIC TimeField : public SpinField, public TimeFormatter +{ +private: + Time maFirst; + Time maLast; + +protected: + SAL_DLLPRIVATE void ImplTimeSpinArea( BOOL bUp ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + TimeField( Window* pParent, WinBits nWinStyle ); + TimeField( Window* pParent, const ResId& rResId ); + ~TimeField(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); + + void SetFirst( const Time& rNewFirst ) { maFirst = rNewFirst; } + Time GetFirst() const { return maFirst; } + void SetLast( const Time& rNewLast ) { maLast = rNewLast; } + Time GetLast() const { return maLast; } + + void SetExtFormat( ExtTimeFieldFormat eFormat ); +}; + + +// -------------- +// - PatternBox - +// -------------- + +class VCL_DLLPUBLIC PatternBox : public ComboBox, public PatternFormatter +{ +public: + PatternBox( Window* pParent, WinBits nWinStyle ); + PatternBox( Window* pParent, const ResId& rResId ); + ~PatternBox(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + + virtual void Modify(); + + virtual void ReformatAll(); + + void InsertString( const XubString& rStr, + USHORT nPos = COMBOBOX_APPEND ); + void RemoveString( const XubString& rStr ); + using PatternFormatter::GetString; + XubString GetString( USHORT nPos ) const; + USHORT GetStringPos( const XubString& rStr ) const; +}; + + +// -------------- +// - NumericBox - +// -------------- + +class VCL_DLLPUBLIC NumericBox : public ComboBox, public NumericFormatter +{ +public: + NumericBox( Window* pParent, WinBits nWinStyle ); + NumericBox( Window* pParent, const ResId& rResId ); + ~NumericBox(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void ReformatAll(); + + void InsertValue( sal_Int64 nValue, USHORT nPos = COMBOBOX_APPEND ); + void RemoveValue( sal_Int64 nValue ); + using NumericFormatter::GetValue; + sal_Int64 GetValue( USHORT nPos ) const; + USHORT GetValuePos( sal_Int64 nPos ) const; +}; + + +// ------------- +// - MetricBox - +// ------------- + +class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter +{ +public: + MetricBox( Window* pParent, WinBits nWinStyle ); + MetricBox( Window* pParent, const ResId& rResId ); + ~MetricBox(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void CustomConvert(); + virtual void ReformatAll(); + + void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE, + USHORT nPos = COMBOBOX_APPEND ); + void RemoveValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE ); + sal_Int64 GetValue( USHORT nPos, FieldUnit eOutUnit = FUNIT_NONE ) const; + USHORT GetValuePos( sal_Int64 nValue, + FieldUnit eInUnit = FUNIT_NONE ) const; + + // Needed, because GetValue() with nPos hide these functions + virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const; + virtual sal_Int64 GetValue() const; +}; + + +// --------------- +// - CurrencyBox - +// --------------- + +class VCL_DLLPUBLIC CurrencyBox : public ComboBox, public CurrencyFormatter +{ +public: + CurrencyBox( Window* pParent, WinBits nWinStyle ); + CurrencyBox( Window* pParent, const ResId& rResId ); + ~CurrencyBox(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void ReformatAll(); + + void InsertValue( sal_Int64 nValue, USHORT nPos = COMBOBOX_APPEND ); + void RemoveValue( sal_Int64 nValue ); + sal_Int64 GetValue( USHORT nPos ) const; + USHORT GetValuePos( sal_Int64 nValue ) const; + + // Needed, because GetValue() with nPos hide this function + virtual sal_Int64 GetValue() const; +}; + + +// ----------- +// - DateBox - +// ----------- + +class VCL_DLLPUBLIC DateBox : public ComboBox, public DateFormatter +{ +public: + DateBox( Window* pParent, WinBits nWinStyle ); + DateBox( Window* pParent, const ResId& rResId ); + ~DateBox(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void ReformatAll(); + + void InsertDate( const Date& rDate, USHORT nPos = COMBOBOX_APPEND ); + void RemoveDate( const Date& rDate ); + using DateFormatter::GetDate; + Date GetDate( USHORT nPos ) const; + USHORT GetDatePos( const Date& rDate ) const; +}; + + +// ----------- +// - TimeBox - +// ----------- + +class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter +{ +public: + TimeBox( Window* pParent, WinBits nWinStyle ); + TimeBox( Window* pParent, const ResId& rResId ); + ~TimeBox(); + + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Modify(); + + virtual void ReformatAll(); + + void InsertTime( const Time& rTime, USHORT nPos = COMBOBOX_APPEND ); + void RemoveTime( const Time& rTime ); + using TimeFormatter::GetTime; + Time GetTime( USHORT nPos ) const; + USHORT GetTimePos( const Time& rTime ) const; +}; + +#endif // _SV_FIELD_HXX diff --git a/vcl/inc/vcl/fixbrd.hxx b/vcl/inc/vcl/fixbrd.hxx new file mode 100644 index 000000000000..2bf0d8e1cb31 --- /dev/null +++ b/vcl/inc/vcl/fixbrd.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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_FIXBRD_HXX +#define _SV_FIXBRD_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/decoview.hxx> +#include <vcl/ctrl.hxx> + +// --------------------- +// - FixedBorder-Types - +// --------------------- + +#define FIXEDBORDER_TYPE_IN (FRAME_DRAW_IN) +#define FIXEDBORDER_TYPE_OUT (FRAME_DRAW_OUT) +#define FIXEDBORDER_TYPE_GROUP (FRAME_DRAW_GROUP) +#define FIXEDBORDER_TYPE_DOUBLEIN (FRAME_DRAW_DOUBLEIN) +#define FIXEDBORDER_TYPE_DOUBLEOUT (FRAME_DRAW_DOUBLEOUT) + +// --------------- +// - FixedBorder - +// --------------- + +class VCL_DLLPUBLIC FixedBorder : public Control +{ +private: + USHORT mnType; + BOOL mbTransparent; + +private: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize ); + +public: + FixedBorder( Window* pParent, WinBits nStyle = 0 ); + FixedBorder( Window* pParent, const ResId& rResId ); + ~FixedBorder(); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + void SetTransparent( BOOL bTransparent ); + BOOL IsTransparent() const { return mbTransparent; } + void SetBorderType( USHORT nType ); + USHORT GetBorderType() const { return mnType; } +}; + +#endif // _SV_FIXBRD_HXX diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx new file mode 100644 index 000000000000..4460694420a0 --- /dev/null +++ b/vcl/inc/vcl/fixed.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * 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_FIXED_HXX +#define _SV_FIXED_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/bitmap.hxx> +#include <vcl/image.hxx> +#include <vcl/ctrl.hxx> + +class UserDrawEvent; + +// ------------- +// - FixedText - +// ------------- + +class VCL_DLLPUBLIC FixedText : public Control +{ +//#if 0 // _SOLAR__PRIVATE +private: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize, bool bFillLayout = false ) const; +public: + SAL_DLLPRIVATE static USHORT ImplGetTextStyle( WinBits nWinBits ); +//#endif +protected: + virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + +public: + FixedText( Window* pParent, WinBits nStyle = 0 ); + FixedText( Window* pParent, const ResId& rResId ); + FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabelForRelation ); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + static Size CalcMinimumTextSize( Control const* pControl, long nMaxWidth = 0 ); + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + virtual Size GetOptimalSize(WindowSizeType eType) const; +}; + +// ------------- +// - FixedLine - +// ------------- + +class VCL_DLLPUBLIC FixedLine : public Control +{ +private: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplDraw( bool bLayout = false ); + +protected: + virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + +public: + FixedLine( Window* pParent, WinBits nStyle = WB_HORZ ); + FixedLine( Window* pParent, const ResId& rResId ); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual Size GetOptimalSize(WindowSizeType eType) const; +}; + +// --------------- +// - FixedBitmap - +// --------------- + +class VCL_DLLPUBLIC FixedBitmap : public Control +{ +private: + Bitmap maBitmap; + Bitmap maBitmapHC; + + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize ); + +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + FixedBitmap( Window* pParent, WinBits nStyle = 0 ); + FixedBitmap( Window* pParent, const ResId& rResId ); + ~FixedBitmap(); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + void SetBitmap( const Bitmap& rBitmap ); + using OutputDevice::GetBitmap; + const Bitmap& GetBitmap() const { return maBitmap; } + BOOL SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const Bitmap& GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; +}; + +// -------------- +// - FixedImage - +// -------------- + +class VCL_DLLPUBLIC FixedImage : public Control +{ +private: + Image maImage; + Image maImageHC; + BOOL mbInUserDraw; + +private: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize ); + +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + FixedImage( Window* pParent, WinBits nStyle = 0 ); + FixedImage( Window* pParent, const ResId& rResId ); + ~FixedImage(); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + virtual Size GetOptimalSize(WindowSizeType eType) const; + + void SetImage( const Image& rImage ); + const Image& GetImage() const { return maImage; } + + BOOL SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const Image& GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + + Point CalcImagePos( const Point& rPos, + const Size& rObjSize, const Size& rWinSize ); +}; + +#endif // _SV_FIXED_HXX diff --git a/vcl/inc/vcl/fldunit.hxx b/vcl/inc/vcl/fldunit.hxx new file mode 100644 index 000000000000..aa76f34332d6 --- /dev/null +++ b/vcl/inc/vcl/fldunit.hxx @@ -0,0 +1,33 @@ +/************************************************************************* + * + * 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_FLDUNIT_HXX +#define _VCL_FLDUNIT_HXX + +#include <tools/fldunit.hxx> + +#endif // _VCL_FLDUNIT_HXX diff --git a/vcl/inc/vcl/floatwin.hxx b/vcl/inc/vcl/floatwin.hxx new file mode 100644 index 000000000000..8b7c9be6499c --- /dev/null +++ b/vcl/inc/vcl/floatwin.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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_FLOATWIN_HXX +#define _SV_FLOATWIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/syswin.hxx> + +class ToolBox; +class PopupModeEvent; + +// ------------------------ +// - FloatingWindow-Types - +// ------------------------ + +#define FLOATWIN_POPUPMODE_ALLOWTEAROFF ((ULONG)0x00000001) +#define FLOATWIN_POPUPMODE_ANIMATIONSLIDE ((ULONG)0x00000002) +#define FLOATWIN_POPUPMODE_NOAUTOARRANGE ((ULONG)0x00000004) +#define FLOATWIN_POPUPMODE_NOANIMATION ((ULONG)0x00000008) +#define FLOATWIN_POPUPMODE_DOWN ((ULONG)0x00000010) +#define FLOATWIN_POPUPMODE_UP ((ULONG)0x00000020) +#define FLOATWIN_POPUPMODE_LEFT ((ULONG)0x00000040) +#define FLOATWIN_POPUPMODE_RIGHT ((ULONG)0x00000080) +#define FLOATWIN_POPUPMODE_NOFOCUSCLOSE ((ULONG)0x00000100) +#define FLOATWIN_POPUPMODE_NOKEYCLOSE ((ULONG)0x00000200) +#define FLOATWIN_POPUPMODE_NOMOUSECLOSE ((ULONG)0x00000400) +#define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE ((ULONG)0x00000800) +#define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ((ULONG)0x00001000) +#define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ((ULONG)0x00002000) +#define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((ULONG)0x00004000) +#define FLOATWIN_POPUPMODE_NEWLEVEL ((ULONG)0x00008000) +#define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((ULONG)0x00010000) +#define FLOATWIN_POPUPMODE_GRABFOCUS ((ULONG)0x00020000) + +#define FLOATWIN_POPUPMODEEND_CANCEL ((USHORT)0x0001) +#define FLOATWIN_POPUPMODEEND_TEAROFF ((USHORT)0x0002) +#define FLOATWIN_POPUPMODEEND_DONTCALLHDL ((USHORT)0x0004) +#define FLOATWIN_POPUPMODEEND_CLOSEALL ((USHORT)0x0008) + +#define FLOATWIN_TITLE_NORMAL ((USHORT)0x0001) +#define FLOATWIN_TITLE_TEAROFF ((USHORT)0x0002) +#define FLOATWIN_TITLE_NONE ((USHORT)0x0004) + +// ------------------ +// - FloatingWindow - +// ------------------ + +class VCL_DLLPUBLIC FloatingWindow : public SystemWindow +{ + class ImplData; +private: + FloatingWindow* mpNextFloat; + Window* mpFirstPopupModeWin; + ImplData* mpImplData; + Rectangle maFloatRect; + ULONG mnPostId; + ULONG mnPopupModeFlags; + USHORT mnTitle; + USHORT mnOldTitle; + BOOL mbInPopupMode; + BOOL mbPopupMode; + BOOL mbPopupModeCanceled; + BOOL mbPopupModeTearOff; + BOOL mbMouseDown; + BOOL mbOldSaveBackMode; + BOOL mbGrabFocus; // act as key input window, although focus is not set + BOOL mbInCleanUp; + Link maPopupModeEndHdl; + +//#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE void ImplCallPopupModeEnd(); + DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void* ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE FloatingWindow (const FloatingWindow &); + SAL_DLLPRIVATE FloatingWindow & operator= (const FloatingWindow &); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: +#define IMPL_FLOATWIN_HITTEST_OUTSIDE ((USHORT)0x0001) +#define IMPL_FLOATWIN_HITTEST_WINDOW ((USHORT)0x0002) +#define IMPL_FLOATWIN_HITTEST_RECT ((USHORT)0x0004) + SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, USHORT& rHitTest ); + SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat(); + SAL_DLLPRIVATE BOOL ImplIsFloatPopupModeWindow( const Window* pWindow ); + SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = TRUE; } + SAL_DLLPRIVATE BOOL ImplIsMouseDown() const { return mbMouseDown; } + SAL_DLLPRIVATE static Point ImplCalcPos( Window* pWindow, + const Rectangle& rRect, ULONG nFlags, + USHORT& rArrangeIndex ); + SAL_DLLPRIVATE void ImplEndPopupMode( USHORT nFlags = 0, ULONG nFocusId = 0 ); + SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect(); + SAL_DLLPRIVATE BOOL ImplIsInPrivatePopupMode() const { return mbInPopupMode; } +//#endif + +public: + FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN ); + FloatingWindow( Window* pParent, const ResId& rResId ); + ~FloatingWindow(); + + virtual long Notify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void PopupModeEnd(); + + void SetTitleType( USHORT nTitle ); + USHORT GetTitleType() const { return mnTitle; } + + void StartPopupMode( const Rectangle& rRect, ULONG nFlags = 0 ); + void StartPopupMode( ToolBox* pBox, ULONG nFlags = 0 ); + void EndPopupMode( USHORT nFlags = 0 ); + void AddPopupModeWindow( Window* pWindow ); + void RemovePopupModeWindow( Window* pWindow ); + ULONG GetPopupModeFlags() const { return mnPopupModeFlags; } + void SetPopupModeFlags( ULONG nFlags ) { mnPopupModeFlags = nFlags; } + BOOL IsInPopupMode() const { return mbPopupMode; } + BOOL IsInCleanUp() const { return mbInCleanUp; } + BOOL IsPopupModeCanceled() const { return mbPopupModeCanceled; } + BOOL IsPopupModeTearOff() const { return mbPopupModeTearOff; } + + void SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; } + const Link& GetPopupModeEndHdl() const { return maPopupModeEndHdl; } + + BOOL GrabsFocus() const { return mbGrabFocus; } + + static Point CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, ULONG nFlags, USHORT& rArrangeIndex ); +}; + +#endif // _SV_FLOATWIN_HXX diff --git a/vcl/inc/vcl/fntstyle.hxx b/vcl/inc/vcl/fntstyle.hxx new file mode 100644 index 000000000000..4b4ccc9f6d02 --- /dev/null +++ b/vcl/inc/vcl/fntstyle.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_FNTSTYLE_HXX +#define _VCL_FNTSTYLE_HXX + +#include <tools/solar.h> +#include <sal/types.h> + +// -------------- +// - Font enums - +// -------------- + +#ifndef ENUM_FONTRELIEF_DECLARED +#define ENUM_FONTRELIEF_DECLARED + +enum FontRelief { RELIEF_NONE, RELIEF_EMBOSSED, RELIEF_ENGRAVED, FontRelief_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// -------------- +// - Font types - +// -------------- + +typedef BYTE FontKerning; +#define KERNING_FONTSPECIFIC ((FontKerning)0x01) +#define KERNING_ASIAN ((FontKerning)0x02) + +#endif // _VCL_FNTSTYLE_HXX diff --git a/vcl/inc/vcl/font.hxx b/vcl/inc/vcl/font.hxx new file mode 100644 index 000000000000..80fd31ebf6dc --- /dev/null +++ b/vcl/inc/vcl/font.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * 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_FONT_HXX +#define _SV_FONT_HXX + +#include <vcl/dllapi.h> +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <i18npool/lang.h> +#include <tools/color.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/fntstyle.hxx> + +class SvStream; +#define FontAlign TextAlign + +class Impl_Font; +class ImplFontAttributes; + +// -------- +// - Font - +// -------- + +class VCL_DLLPUBLIC Font +{ +private: + Impl_Font* mpImplFont; + void MakeUnique(); + +public: + Font(); + Font( const Font& ); + Font( const String& rFamilyName, const Size& ); + Font( const String& rFamilyName, const String& rStyleName, const Size& ); + Font( FontFamily eFamily, const Size& ); + ~Font(); + + void SetColor( const Color& ); + const Color& GetColor() const; + void SetFillColor( const Color& ); + const Color& GetFillColor() const; + void SetTransparent( BOOL bTransparent ); + BOOL IsTransparent() const; + void SetAlign( FontAlign ); + FontAlign GetAlign() const; + + void SetName( const String& rFamilyName ); + const String& GetName() const; + void SetStyleName( const String& rStyleName ); + const String& GetStyleName() const; + void SetSize( const Size& ); + const Size& GetSize() const; + void SetHeight( long nHeight ); + long GetHeight() const; + void SetWidth( long nWidth ); + long GetWidth() const; + + void SetFamily( FontFamily ); + FontFamily GetFamily() const; + void SetCharSet( rtl_TextEncoding ); + rtl_TextEncoding GetCharSet() const; + void SetLanguage( LanguageType ); + LanguageType GetLanguage() const; + void SetCJKContextLanguage( LanguageType ); + LanguageType GetCJKContextLanguage() const; + void SetPitch( FontPitch ePitch ); + FontPitch GetPitch() const; + + void SetOrientation( short nLineOrientation ); + short GetOrientation() const; + void SetVertical( BOOL bVertical ); + BOOL IsVertical() const; + void SetKerning( FontKerning nKerning ); + FontKerning GetKerning() const; + BOOL IsKerning() const; + + void SetWeight( FontWeight ); + FontWeight GetWeight() const; + void SetWidthType( FontWidth ); + FontWidth GetWidthType() const; + void SetItalic( FontItalic ); + FontItalic GetItalic() const; + void SetOutline( BOOL bOutline ); + BOOL IsOutline() const; + void SetShadow( BOOL bShadow ); + BOOL IsShadow() const; + void SetRelief( FontRelief ); + FontRelief GetRelief() const; + void SetUnderline( FontUnderline ); + FontUnderline GetUnderline() const; + void SetOverline( FontUnderline ); + FontUnderline GetOverline() const; + void SetStrikeout( FontStrikeout ); + FontStrikeout GetStrikeout() const; + void SetEmphasisMark( FontEmphasisMark ); + FontEmphasisMark GetEmphasisMark() const; + void SetWordLineMode( BOOL bWordLine ); + BOOL IsWordLineMode() const; + + void Merge( const Font& rFont ); + void GetFontAttributes( ImplFontAttributes& rAttrs ) const; + + Font& operator=( const Font& ); + BOOL operator==( const Font& ) const; + BOOL operator!=( const Font& rFont ) const + { return !(Font::operator==( rFont )); } + BOOL IsSameInstance( const Font& ) const; + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Font& ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Font& ); + + static Font identifyFont( const void* pBuffer, sal_uInt32 nLen ); +}; + +#endif // _VCL_FONT_HXX diff --git a/vcl/inc/vcl/fontcache.hxx b/vcl/inc/vcl/fontcache.hxx new file mode 100644 index 000000000000..b18748ed5791 --- /dev/null +++ b/vcl/inc/vcl/fontcache.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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 _PSPRINT_FONTCACHE_HXX +#define _PSPRINT_FONTCACHE_HXX + +#include "vcl/dllapi.h" +#include "vcl/fontmanager.hxx" + +#include "tools/string.hxx" + +#include <hash_map> + +namespace psp +{ + +class VCL_DLLPUBLIC FontCache +{ + struct FontDir; + friend class FontDir; + struct FontFile; + friend class FontFile; + + typedef std::list< PrintFontManager::PrintFont* > FontCacheEntry; + struct FontFile + { + FontCacheEntry m_aEntry; + }; + + typedef std::hash_map< ::rtl::OString, FontFile, ::rtl::OStringHash > FontDirMap; + struct FontDir + { + sal_Int64 m_nTimestamp; + bool m_bNoFiles; + bool m_bUserOverrideOnly; + FontDirMap m_aEntries; + + FontDir() : m_nTimestamp(0), m_bNoFiles(false), m_bUserOverrideOnly( false ) {} + }; + + typedef std::hash_map< int, FontDir > FontCacheData; + FontCacheData m_aCache; + String m_aCacheFile; + bool m_bDoFlush; + + void read(); + void clearCache(); + + void copyPrintFont( const PrintFontManager::PrintFont* pFrom, PrintFontManager::PrintFont* pTo ) const; + bool equalsPrintFont( const PrintFontManager::PrintFont* pLeft, PrintFontManager::PrintFont* pRight ) const; + PrintFontManager::PrintFont* clonePrintFont( const PrintFontManager::PrintFont* pFont ) const; + + void createCacheDir( int nDirID ); +public: + FontCache(); + ~FontCache(); + + bool getFontCacheFile( int nDirID, const rtl::OString& rFile, std::list< PrintFontManager::PrintFont* >& rNewFonts ) const; + void updateFontCacheEntry( const PrintFontManager::PrintFont*, bool bFlush ); + void markEmptyDir( int nDirID, bool bNoFiles = true ); + + // returns false for non cached directory + // a cached but empty directory will return true but not append anything + bool listDirectory( const rtl::OString& rDir, std::list< PrintFontManager::PrintFont* >& rNewFonts ) const; + // returns true for directoris that contain only user overridden fonts + bool scanAdditionalFiles( const rtl::OString& rDir ); + + void flush(); + + void updateDirTimestamp( int nDirID ); +}; + +} // namespace psp + +#endif // _PSPRINT_FONTCACHE_HXX diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx new file mode 100644 index 000000000000..33fece8d88e1 --- /dev/null +++ b/vcl/inc/vcl/fontmanager.hxx @@ -0,0 +1,745 @@ +/************************************************************************* + * + * 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 _PSPRINT_FONTMANAGER_HXX_ +#define _PSPRINT_FONTMANAGER_HXX_ + +#include <hash_map> +#include <map> +#include <list> +#include <set> + +#include "vcl/dllapi.h" +#include "vcl/helper.hxx" + +#include "com/sun/star/lang/Locale.hpp" + +#define ATOM_FAMILYNAME 2 +#define ATOM_PSNAME 3 + +/* + * some words on metrics: every length returned by PrintFontManager and + * friends are PostScript afm style, that is they are 1/1000 font height + */ + +// forward declarations +namespace utl { class MultiAtomProvider; } // see unotools/atom.hxx +class FontSubsetInfo; +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 { + Unknown = 0, + Type1 = 1, + TrueType = 2, + Builtin = 3 +}; +} + +namespace fcstatus +{ +enum type { + istrue, + isunset, + isfalse +}; +} + +/* + * the difference between FastPrintFontInfo and PrintFontInfo + * is that the information in FastPrintFontInfo can usually + * be gathered without openening either the font file or + * an afm metric file. they are gathered from fonts.dir alone. + * if only FastPrintFontInfo is gathered and PrintFontInfo + * on demand and for less fonts, then performance in startup + * increases considerably + */ + +struct FastPrintFontInfo +{ + fontID m_nID; // FontID + fonttype::type m_eType; + + // font attributes + 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; + rtl_TextEncoding m_aEncoding; + bool m_bSubsettable; + bool m_bEmbeddable; + + 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_aEncoding( RTL_TEXTENCODING_DONTKNOW ) + {} +}; + +struct PrintFontInfo : public FastPrintFontInfo +{ + int m_nAscend; + int m_nDescend; + int m_nLeading; + int m_nWidth; + + PrintFontInfo() : + FastPrintFontInfo(), + m_nAscend( 0 ), + m_nDescend( 0 ), + m_nLeading( 0 ), + m_nWidth( 0 ) + {} +}; + +// the values are per thousand of the font size +// note: width, height contain advances, not bounding box +struct CharacterMetric +{ + short int width, height; + + CharacterMetric() : width( 0 ), height( 0 ) {} + bool operator==( const CharacterMetric& rOther ) const + { return rOther.width == width && rOther.height == height; } + bool operator!=( const CharacterMetric& rOther ) const + { return rOther.width != width || rOther.height != height; } +}; + +struct KernPair +{ + sal_Unicode first, second; + short int kern_x, kern_y; + + KernPair() : first( 0 ), second( 0 ), kern_x( 0 ), kern_y( 0 ) {} +}; + +class FontCache; + +// a class to manage printable fonts +// aims are type1 and truetype fonts + +class FontCache; + +class VCL_DLLPUBLIC PrintFontManager +{ + struct PrintFont; + struct TrueTypeFontFile; + struct Type1FontFile; + struct BuiltinFont; + friend struct PrintFont; + friend struct TrueTypeFontFile; + friend struct Type1FontFile; + friend struct BuiltinFont; + friend class FontCache; + + struct PrintFontMetrics + { + // character metrics are stored by the following keys: + // lower two bytes contain a sal_Unicode (a UCS2 character) + // upper byte contains: 0 for horizontal metric + // 1 for vertical metric + // highest byte: 0 for now + std::hash_map< int, CharacterMetric > m_aMetrics; + // contains the unicode blocks for which metrics were queried + // this implies that metrics should be queried in terms of + // unicode blocks. here a unicode block is identified + // by the upper byte of the UCS2 encoding. + // note that the corresponding bit should be set even + // if the font does not support a single character of that page + // this map shows, which pages were queried already + // if (like in AFM metrics) all metrics are queried in + // a single pass, then all bits should be set + char m_aPages[32]; + + bool m_bKernPairsQueried; + std::list< KernPair > m_aXKernPairs; + std::list< KernPair > m_aYKernPairs; + std::hash_map< sal_Unicode, bool > m_bVerticalSubstitutions; + + PrintFontMetrics() : m_bKernPairsQueried( false ) {} + + bool isEmpty() const { return m_aMetrics.empty(); } + }; + + struct PrintFont + { + fonttype::type m_eType; + + // font attributes + int m_nFamilyName; // atom + 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; + rtl_TextEncoding m_aEncoding; + bool m_bFontEncodingOnly; // set if font should be only accessed by builtin encoding + CharacterMetric m_aGlobalMetricX; + CharacterMetric m_aGlobalMetricY; + PrintFontMetrics* m_pMetrics; + int m_nAscend; + int m_nDescend; + int m_nLeading; + int m_nXMin; // font bounding box + int m_nYMin; + int m_nXMax; + int m_nYMax; + bool m_bHaveVerticalSubstitutedGlyphs; + bool m_bUserOverride; + + std::map< sal_Unicode, sal_Int32 > m_aEncodingVector; + std::map< sal_Unicode, rtl::OString > m_aNonEncoded; + + PrintFont( fonttype::type eType ); + virtual ~PrintFont(); + virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ) = 0; + + bool readAfmMetrics( const rtl::OString& rFileName, utl::MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ); + }; + + struct Type1FontFile : public PrintFont + { + int m_nDirectory; // atom containing system dependent path + rtl::OString m_aFontFile; // relative to directory + rtl::OString m_aMetricFile; // dito + rtl::OString m_aXLFD; // mainly for administration, contains the XLFD from fonts.dir + + /* note: m_aFontFile and Metric file are not atoms + because they should be fairly unique */ + + Type1FontFile() : PrintFont( fonttype::Type1 ), m_nDirectory( 0 ) {} + virtual ~Type1FontFile(); + virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ); + }; + + struct TrueTypeFontFile : public PrintFont + { + int m_nDirectory; // atom containing system dependent path + rtl::OString m_aFontFile; // relative to directory + rtl::OString m_aXLFD; // mainly for administration, contains the XLFD from fonts.dir + int m_nCollectionEntry; // -1 for regular fonts, 0 to ... for fonts stemming from collections + unsigned int m_nTypeFlags; // copyright bits and PS-OpenType flag + + TrueTypeFontFile(); + virtual ~TrueTypeFontFile(); + virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ); + }; + + struct BuiltinFont : public PrintFont + { + int m_nDirectory; // atom containing system dependent path + rtl::OString m_aMetricFile; + + BuiltinFont() : PrintFont( fonttype::Builtin ) {} + virtual ~BuiltinFont(); + virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ); + }; + + struct XLFDEntry + { + static const int MaskFoundry = 1; + static const int MaskFamily = 2; + static const int MaskAddStyle = 4; + static const int MaskItalic = 8; + static const int MaskWeight = 16; + static const int MaskWidth = 32; + static const int MaskPitch = 64; + static const int MaskEncoding = 128; + + int nMask; // contains a bit set for every valid member + + rtl::OString aFoundry; + rtl::OString aFamily; + rtl::OString aAddStyle; + italic::type eItalic; + weight::type eWeight; + width::type eWidth; + pitch::type ePitch; + rtl_TextEncoding aEncoding; + + XLFDEntry() { nMask = 0; } + + bool operator<(const XLFDEntry& rRight) const; + bool operator==(const XLFDEntry& rRight) const; + }; + + static rtl::OString s_aEmptyOString; + + fontID m_nNextFontID; + std::hash_map< fontID, PrintFont* > m_aFonts; + std::hash_map< int, family::type > m_aFamilyTypes; + std::list< rtl::OUString > m_aPrinterDrivers; + std::list< rtl::OString > m_aFontDirectories; + std::list< int > m_aPrivateFontDirectories; + std::map< struct XLFDEntry, std::list< struct XLFDEntry > > + m_aXLFD_Aliases; + utl::MultiAtomProvider* m_pAtoms; + // for speeding up findFontFileID + std::hash_map< rtl::OString, std::set< fontID >, rtl::OStringHash > + m_aFontFileToFontID; + + std::hash_map< rtl::OString, int, rtl::OStringHash > + m_aDirToAtom; + std::hash_map< int, rtl::OString > m_aAtomToDir; + int m_nNextDirAtom; + + std::hash_multimap< rtl::OString, sal_Unicode, rtl::OStringHash > + m_aAdobenameToUnicode; + std::hash_multimap< sal_Unicode, rtl::OString > + m_aUnicodeToAdobename; + std::hash_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode; + std::hash_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode; + + mutable FontCache* m_pFontCache; + bool m_bFontconfigSuccess; + + mutable std::vector< fontID > m_aOverrideFonts; + + rtl::OString getAfmFile( PrintFont* pFont ) const; + rtl::OString getFontFile( PrintFont* pFont ) const; + + void getFontAttributesFromXLFD( PrintFont* pFont, const std::list< rtl::OString >& rXLFDs ) const; + + bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts ) const; + rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code + void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code + bool analyzeTrueTypeFile( PrintFont* pFont ) const; + // finds the FIRST id for this font file; there may be more + // for TrueType collections + fontID findFontFileID( int nDirID, const rtl::OString& rFile ) const; + fontID findFontBuiltinID( int nPSNameAtom ) const; + + family::type matchFamilyName( const rtl::OUString& rFamily ) const; + + PrintFont* getFont( fontID nID ) const + { + std::hash_map< fontID, PrintFont* >::const_iterator it; + it = m_aFonts.find( nID ); + return it == m_aFonts.end() ? NULL : it->second; + } + rtl::OString getXLFD( PrintFont* pFont ) const; + void fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& rInfo ) const; + void fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo ) const; + + const rtl::OString& getDirectory( int nAtom ) const; + int getDirectoryAtom( const rtl::OString& rDirectory, bool bCreate = false ); + + /* try to initialize fonts from libfontconfig + + called from <code>initialize()</code> + + @returns + true if at least one font was added by libfontconfig + false else (e.g. no libfontconfig found) + */ + bool initFontconfig(); + int countFontconfigFonts( std::hash_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths ); + /* deinitialize fontconfig + */ + void deinitFontconfig(); + + /* register an application specific font directory for libfontconfig + + since fontconfig is asked for font substitutes before OOo will check for font availability + and fontconfig will happily substitute fonts it doesn't know (e.g. "Arial Narrow" -> "DejaVu Sans Book"!) + it becomes necessary to tell the library about all the hidden font treasures + + @returns + true if libfontconfig accepted the directory + false else (e.g. no libfontconfig found) + */ + bool addFontconfigDir(const rtl::OString& rDirectory); + + static bool parseXLFD( const rtl::OString& rXLFD, XLFDEntry& rEntry ); + void parseXLFD_appendAliases( const std::list< rtl::OString >& rXLFDs, std::list< XLFDEntry >& rEntries ) const; + void initFontsAlias(); + + bool readOverrideMetrics(); + + PrintFontManager(); + ~PrintFontManager(); +public: + static PrintFontManager& get(); // one instance only + + int addFontFile( const rtl::OString& rFileName, int nFaceNum ); + + void initialize(); + + // returns the number of managed fonts + int getFontCount() const { return m_aFonts.size(); } + + // caution: the getFontList* methods can change the font list on demand + // depending on the pParser argument. That is getFontCount() may + // return a larger value after getFontList() + + // returns the ids of all managed fonts. on pParser != NULL + // all fonttype::Builtin type fonts are not listed + // which do not occur in the PPD of pParser + void getFontList( std::list< fontID >& rFontIDs, const PPDParser* pParser = NULL, bool bUseOverrideMetrics = false ); + // get the font list and detailed font info. see getFontList for pParser + void getFontListWithInfo( std::list< PrintFontInfo >& rFonts, const PPDParser* pParser = NULL, bool bUseOverrideMetrics = false ); + // get the font list and fast font info. see getFontList for pParser + void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser = NULL, bool bUseOverrideMetrics = false ); + + // get font info for a specific font + bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const; + // get fast font info for a specific font + bool getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo ) const; + + // routines to get font info in small pieces + + // get a specific fonts family name + const rtl::OUString& getFontFamily( fontID nFontID ) const; + // get a specific fonts PSName name + const rtl::OUString& getPSName( fontID nFontID ) const; + + // get a specific fonts style family + family::type getFontFamilyType( fontID nFontID ) const; + + // get a specific fonts family name aliases + void getFontFamilyAliases( fontID nFontID ) const; + + // get a specific fonts type + fonttype::type getFontType( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_eType : fonttype::Unknown; + } + + // get a specific fonts italic type + italic::type getFontItalic( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_eItalic : italic::Unknown; + } + + // get a specific fonts width type + width::type getFontWidth( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_eWidth : width::Unknown; + } + + // get a specific fonts weight type + weight::type getFontWeight( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_eWeight : weight::Unknown; + } + + // get a specific fonts pitch type + pitch::type getFontPitch( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_ePitch : pitch::Unknown; + } + + // get a specific fonts encoding + rtl_TextEncoding getFontEncoding( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_aEncoding : RTL_TEXTENCODING_DONTKNOW; + } + + // should i only use font's builtin encoding ? + bool getUseOnlyFontEncoding( fontID nFontID ) const + { + PrintFont* pFont = getFont( nFontID ); + return pFont ? pFont->m_bFontEncodingOnly : false; + } + + // get a specific fonts system dependent filename + rtl::OString getFontFileSysPath( fontID nFontID ) const + { + return getFontFile( getFont( nFontID ) ); + } + + // get the ttc face number + int getFontFaceNumber( fontID nFontID ) const; + + // get a specific fonts global metrics + const CharacterMetric& getGlobalFontMetric( fontID nFontID, bool bHorizontal ) const; + + // get a specific fonts ascend + int getFontAscend( fontID nFontID ) const; + + // get a specific fonts descent + int getFontDescend( fontID nFontID ) const; + + // get a specific fonts leading + int getFontLeading( fontID nFontID ) const; + + // get a fonts glyph bounding box + bool getFontBoundingBox( fontID nFont, int& xMin, int& yMin, int& xMax, int& yMax ); + + // info whether there are vertical substitutions + bool hasVerticalSubstitutions( fontID nFontID ) const; + + // info whether an array of glyphs has vertical substitutions + void hasVerticalSubstitutions( fontID nFontID, const sal_Unicode* pCharacters, + int nCharacters, bool* pHasSubst ) const; + + // get the XLFD for a font that originated from the X fontpath + // note: this may not be the original line that was in the fonts.dir + // returns a string for every font, but only TrueType and Type1 + // fonts originated from the X font path, so check for the font type + rtl::OUString getFontXLFD( fontID nFontID ) const; + + // get a specific fonts metrics + + // get metrics for a sal_Unicode range + // the user is responsible to allocate pArray large enough + bool getMetrics( fontID nFontID, sal_Unicode minCharacter, sal_Unicode maxCharacter, CharacterMetric* pArray, bool bVertical = false ) const; + // get metrics for an array of sal_Unicode characters + // the user is responsible to allocate pArray large enough + bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, CharacterMetric* pArray, bool bVertical = false ) const; + + // get encoding vector of font, currently only for Type1 and Builtin fonts + // returns NULL if encoding vector is empty or font is neither type1 or + // builtin; if ppNonEncoded is set and non encoded type1 glyphs exist + // then *ppNonEncoded is set to the mapping for nonencoded glyphs. + // the encoding vector contains -1 for non encoded glyphs + const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, rtl::OString >** ppNonEncoded ) const; + + // to get font substitution transparently use the + // getKernPairs method of PrinterGfx + const std::list< KernPair >& getKernPairs( fontID nFontID, bool bVertical = false ) const; + + // evaluates copyright flags for TrueType fonts + // type1 fonts do not have such a feature, so return for them is true + // returns true for builtin fonts (surprise!) + bool isFontDownloadingAllowed( fontID nFont ) const; + + // helper for type 1 fonts + std::list< rtl::OString > getAdobeNameFromUnicode( sal_Unicode aChar ) const; + + std::pair< std::hash_multimap< sal_Unicode, sal_uInt8 >::const_iterator, + std::hash_multimap< sal_Unicode, sal_uInt8 >::const_iterator > + getAdobeCodeFromUnicode( sal_Unicode aChar ) const + { + return m_aUnicodeToAdobecode.equal_range( aChar ); + } + std::list< sal_Unicode > getUnicodeFromAdobeName( const rtl::OString& rName ) const; + std::pair< std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator, + std::hash_multimap< sal_uInt8, sal_Unicode >::const_iterator > + getUnicodeFromAdobeCode( sal_uInt8 aChar ) const + { + return m_aAdobecodeToUnicode.equal_range( aChar ); + } + + // creates a new font subset of an existing TrueType font + // returns true in case of success, else false + // nFont: the font to be subsetted + // rOutFile: the file to put the new subset into; + // must be a valid osl file URL + // pGlyphIDs: input array of glyph ids for new font + // pNewEncoding: the corresponding encoding in the new font + // pWidths: output array of widths of requested glyphs + // nGlyphs: number of glyphs in arrays + // pCapHeight:: capital height of the produced font + // pXMin, pYMin, pXMax, pYMax: outgoing font bounding box + // TODO: callers of this method should use its FontSubsetInfo counterpart directly + bool createFontSubset( FontSubsetInfo&, + fontID nFont, + const rtl::OUString& rOutFile, + sal_Int32* pGlyphIDs, + sal_uInt8* pNewEncoding, + sal_Int32* pWidths, + int nGlyphs, + bool bVertical = false + ); + void getGlyphWidths( fontID nFont, + bool bVertical, + std::vector< sal_Int32 >& rWidths, + std::map< sal_Unicode, sal_uInt32 >& rUnicodeEnc ); + + + // font administration functions + + // for importFonts to provide the user feedback + class ImportFontCallback + { + public: + enum FailCondition { NoWritableDirectory, NoAfmMetric, AfmCopyFailed, FontCopyFailed }; + virtual void importFontsFailed( FailCondition eReason ) = 0; + virtual void progress( const rtl::OUString& rFile ) = 0; + virtual bool queryOverwriteFile( const rtl::OUString& rFile ) = 0; + virtual void importFontFailed( const rtl::OUString& rFile, FailCondition ) = 0; + virtual bool isCanceled() = 0; + }; + + // checks wether font import would fail due to no writeable directory + bool checkImportPossible() const; + // expects system paths not UNC paths + // returns the number of fonts successfully imported + int importFonts( const std::list< rtl::OString >& rFiles, bool bLinkOnly = false, ImportFontCallback* pCallback = NULL ); + + // check wether changeFontProperties would fail due to not writable fonts.dir + bool checkChangeFontPropertiesPossible( fontID nFont ) const; + // change fonts.dir entry for font + bool changeFontProperties( fontID nFont, const rtl::OUString& rXLFD ); + + // get properties of a not imported font file + bool getImportableFontProperties( const rtl::OString& rFile, std::list< FastPrintFontInfo >& rFontProps ); + + // get fonts that come from the same font file + bool getFileDuplicates( fontID nFont, std::list< fontID >& rFonts ) const; + // remove font files + bool removeFonts( const std::list< fontID >& rFonts ); + + bool isPrivateFontFile( fontID ) const; + + // returns false if there were not any + bool getAlternativeFamilyNames( fontID nFont, std::list< rtl::OUString >& rNames ) const; + + /* system dependendent font matching + + <p> + <code>matchFont</code> matches a pattern of font characteristics + and returns the closest match if possibe. If a match was found + the <code>FastPrintFontInfo</code> passed in as parameter + will be update to the found matching font. + </p> + <p> + implementation note: currently the function is only implemented + for fontconfig. + </p> + + @param rInfo + out of the FastPrintFontInfo structure the following + fields will be used for the match: + <ul> + <li>family name</li> + <li>italic</li> + <li>width</li> + <li>weight</li> + <li>pitch</li> + </ul> + + @param rLocale + if <code>rLocal</code> contains non empty strings the corresponding + locale will be used for font matching also; e.g. "Sans" can result + in different fonts in e.g. english and japanese + + @returns + true if a match was found + false else + */ + bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale ); + bool getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*), ImplFontOptions& rResult ) 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; + bool hasFontconfig() const { return m_bFontconfigSuccess; } + + int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar ); +}; + +} // namespace + +#endif // _PSPRINT_FONTMANAGER_HXX_ diff --git a/vcl/inc/vcl/fontsubset.hxx b/vcl/inc/vcl/fontsubset.hxx new file mode 100644 index 000000000000..a34212128741 --- /dev/null +++ b/vcl/inc/vcl/fontsubset.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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_FONTSUBSET_HXX +#define _SV_FONTSUBSET_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <cstdio> + +namespace vcl { struct _TrueTypeFont; } // SFT's idea of a TTF font + +class FontSubsetInfo +{ +public: + explicit FontSubsetInfo( void ); + virtual ~FontSubsetInfo( void ); + + enum FontType { + NO_FONT = 0, + SFNT_TTF = 1<<1, // SFNT container with TrueType glyphs + SFNT_CFF = 1<<2, // SFNT container with CFF-container + TYPE1_PFA = 1<<3, // PSType1 Postscript Font Ascii + TYPE1_PFB = 1<<4, // PSType1 Postscript Font Binary + CFF_FONT = 1<<5, // CFF-container with PSType2 glyphs + TYPE3_FONT = 1<<6, // PSType3 Postscript font + TYPE42_FONT = 1<<7, // PSType42 wrapper for an SFNT_TTF + ANY_SFNT = SFNT_TTF | SFNT_CFF, + ANY_TYPE1 = TYPE1_PFA | TYPE1_PFB, + ANY_FONT = 0xFF + }; + + bool LoadFont( FontType eInFontType, + const unsigned char* pFontBytes, int nByteLength ); + bool LoadFont( vcl::_TrueTypeFont* pSftTrueTypeFont ); + + bool CreateFontSubset( int nOutFontTypeMask, + FILE* pOutFile, const char* pOutFontName, + const long* pReqGlyphIds, const sal_uInt8* pEncodedIds, + int nReqGlyphCount, sal_Int32* pOutGlyphWidths = NULL ); + +public: // TODO: make subsetter results private and provide accessor methods instead + // subsetter-provided subset details needed by e.g. Postscript or PDF + String m_aPSName; + int m_nAscent; // all metrics in PS font units + int m_nDescent; + int m_nCapHeight; + Rectangle m_aFontBBox; + FontType m_nFontType; // font-type of subset result + +private: + // input-font-specific details + unsigned const char* mpInFontBytes; + int mnInByteLength; + FontType meInFontType; // allowed mask of input font-types + vcl::_TrueTypeFont* mpSftTTFont; + + // subset-request details + int mnReqFontTypeMask; // allowed subset-target font types + FILE* mpOutFile; + const char* mpReqFontName; + const long* mpReqGlyphIds; + const sal_uInt8* mpReqEncodedIds; + int mnReqGlyphCount; + +protected: + bool CreateFontSubsetFromCff( sal_Int32* pOutGlyphWidths = NULL ); + bool CreateFontSubsetFromSfnt( sal_Int32* pOutGlyphWidths = NULL ); + bool CreateFontSubsetFromType1( sal_Int32* pOutGlyphWidths = NULL ); +}; + +#endif // _SV_FONTSUBSET_HXX + diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx new file mode 100644 index 000000000000..636fc4a979f3 --- /dev/null +++ b/vcl/inc/vcl/gdimtf.hxx @@ -0,0 +1,251 @@ +/************************************************************************* + * + * 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_GDIMTF_HXX +#define _SV_GDIMTF_HXX + +#include <vcl/dllapi.h> +#include <tools/gen.hxx> +#include <tools/list.hxx> +#include <tools/link.hxx> +#include <tools/string.hxx> +#include <vcl/mapmod.hxx> + +class OutputDevice; +class ImpLabelList; +class MetaAction; +class SvStream; +class Color; +class BitmapEx; +class Polygon; +class PolyPolygon; +class Gradient; + +// --------------------- +// - GDIMetaFile-Types - +// --------------------- + +#define GDI_METAFILE_END ((ULONG)0xFFFFFFFF) +#define GDI_METAFILE_LABEL_NOTFOUND ((ULONG)0xFFFFFFFF) + +#ifndef METAFILE_END +#define METAFILE_END GDI_METAFILE_END +#endif + +#ifndef METAFILE_LABEL_NOTFOUND +#define METAFILE_LABEL_NOTFOUND GDI_METAFILE_LABEL_NOTFOUND +#endif + +// ----------- +// - Defines - +// ----------- + +#define MTF_MIRROR_NONE 0x00000000UL +#define MTF_MIRROR_HORZ 0x00000001UL +#define MTF_MIRROR_VERT 0x00000002UL + +// --------- +// - Enums - +// --------- + +enum MtfConversion +{ + MTF_CONVERSION_NONE = 0, + MTF_CONVERSION_1BIT_THRESHOLD = 1, + MTF_CONVERSION_8BIT_GREYS = 2 +}; + +// ----------------------------- +// - Color conversion routines - +// ----------------------------- + +//#if 0 // _SOLAR__PRIVATE + +typedef Color (*ColorExchangeFnc)( const Color& rColor, const void* pColParam ); +typedef BitmapEx (*BmpExchangeFnc)( const BitmapEx& rBmpEx, const void* pBmpParam ); + +//#endif // __PRIVATE + +// --------------- +// - GDIMetaFile - +// --------------- + +class VCL_DLLPUBLIC GDIMetaFile : protected List +{ +private: + + MapMode aPrefMapMode; + Size aPrefSize; + Link aHookHdlLink; + GDIMetaFile* pPrev; + GDIMetaFile* pNext; + OutputDevice* pOutDev; + ImpLabelList* pLabelList; + BOOL bPause; + BOOL bRecord; + +//#if 0 // _SOLAR__PRIVATE + + SAL_DLLPRIVATE static Color ImplColAdjustFnc( const Color& rColor, const void* pColParam ); + SAL_DLLPRIVATE static BitmapEx ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmpParam ); + + SAL_DLLPRIVATE static Color ImplColConvertFnc( const Color& rColor, const void* pColParam ); + SAL_DLLPRIVATE static BitmapEx ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBmpParam ); + + SAL_DLLPRIVATE static Color ImplColMonoFnc( const Color& rColor, const void* pColParam ); + SAL_DLLPRIVATE static BitmapEx ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpParam ); + + SAL_DLLPRIVATE static Color ImplColReplaceFnc( const Color& rColor, const void* pColParam ); + SAL_DLLPRIVATE static BitmapEx ImplBmpReplaceFnc( const BitmapEx& rBmpEx, const void* pBmpParam ); + + SAL_DLLPRIVATE void ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pColParam, + BmpExchangeFnc pFncBmp, const void* pBmpParam ); + + SAL_DLLPRIVATE Point ImplGetRotatedPoint( const Point& rPt, const Point& rRotatePt, + const Size& rOffset, double fSin, double fCos ); + SAL_DLLPRIVATE Polygon ImplGetRotatedPolygon( const Polygon& rPoly, const Point& rRotatePt, + const Size& rOffset, double fSin, double fCos ); + SAL_DLLPRIVATE PolyPolygon ImplGetRotatedPolyPolygon( const PolyPolygon& rPoly, const Point& rRotatePt, + const Size& rOffset, double fSin, double fCos ); + SAL_DLLPRIVATE void ImplAddGradientEx( GDIMetaFile& rMtf, + const OutputDevice& rMapDev, + const PolyPolygon& rPolyPoly, + const Gradient& rGrad ); + +//#endif // __PRIVATE + +protected: + + virtual void Linker( OutputDevice* pOut, BOOL bLink ); + virtual long Hook(); + +public: + GDIMetaFile(); + GDIMetaFile( const GDIMetaFile& rMtf ); + virtual ~GDIMetaFile(); + + using List::operator==; + using List::operator!=; + GDIMetaFile& operator=( const GDIMetaFile& rMtf ); + BOOL operator==( const GDIMetaFile& rMtf ) const; + BOOL operator!=( const GDIMetaFile& rMtf ) const { return !( *this == rMtf ); } + + void Clear(); + sal_Bool IsEqual( const GDIMetaFile& rMtf ) const; + BOOL Mirror( 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 ); + void Scale( double fScaleX, double fScaleY ); + void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); + void Rotate( long nAngle10 ); + void Clip( const Rectangle& ); + /* get the bound rect of the contained actions + * caveats: + * - clip actions will limit the contained actions, + * but the current clipregion of the passed OutputDevice will not + * - coordinates of actions will be transformed to preferred mapmode + * - the returned rectangle is relative to the preferred mapmode of the metafile + */ + 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, BOOL bInvert = FALSE ); + void Convert( MtfConversion eConversion ); + void ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol = 0 ); + void ReplaceColors( const Color* pSearchColors, const Color* rReplaceColors, + ULONG nColorCount, ULONG* pTols = NULL ); + + GDIMetaFile GetMonochromeMtf( const Color& rCol ) const; + + void Record( OutputDevice* pOutDev ); + BOOL IsRecord() const { return bRecord; } + + void Play( GDIMetaFile& rMtf, ULONG nPos = GDI_METAFILE_END ); + void Play( OutputDevice* pOutDev, ULONG nPos = GDI_METAFILE_END ); + void Play( OutputDevice* pOutDev, const Point& rPos, + const Size& rSize, ULONG nPos = GDI_METAFILE_END ); + + void Pause( BOOL bPause ); + BOOL IsPause() const { return bPause; } + + void Stop(); + + void WindStart(); + void WindEnd(); + void Wind( ULONG nAction ); + void WindPrev(); + void WindNext(); + + ULONG GetActionCount() const { return Count(); } + void AddAction( MetaAction* pAction ); + void AddAction( MetaAction* pAction, ULONG nPos ); + void RemoveAction( ULONG nPos ); + MetaAction* CopyAction( ULONG nPos ) const; + MetaAction* GetCurAction() const { return (MetaAction*) GetCurObject(); } + MetaAction* GetAction( ULONG nAction ) const { return (MetaAction*) GetObject( nAction ); } + MetaAction* FirstAction() { return (MetaAction*) First(); } + MetaAction* NextAction() { return (MetaAction*) Next(); } + MetaAction* ReplaceAction( MetaAction* pAction, ULONG nAction ) { return (MetaAction*) Replace( pAction, nAction ); } + + ULONG GetActionPos( const String& rLabel ); + BOOL InsertLabel( const String& rLabel, ULONG nActionPos ); + void RemoveLabel( const String& rLabel ); + void RenameLabel( const String& rLabel, const String& rNewLabel ); + ULONG GetLabelCount() const; + String GetLabel( ULONG nLabel ); + + BOOL SaveStatus(); + + const Size& GetPrefSize() const { return aPrefSize; } + void SetPrefSize( const Size& rSize ) { aPrefSize = rSize; } + + const MapMode& GetPrefMapMode() const { return aPrefMapMode; } + void SetPrefMapMode( const MapMode& rMapMode ) { aPrefMapMode = rMapMode; } + + void SetHookHdl( const Link& rLink ) { aHookHdlLink = rLink; } + const Link& GetHookHdl() const { return aHookHdlLink; } + + ULONG GetChecksum() const; + ULONG GetSizeBytes() const; + + // Methoden zum Lesen und Schreiben des neuen Formats; + // die Read-Methode kann auch das alte Format lesen + SvStream& Read( SvStream& rIStm ); + SvStream& Write( SvStream& rOStm ); + + // Stream-Operatoren schreiben das alte Format (noch) + // und lesen sowohl das alte wie auch das neue Format + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile ); + + BOOL CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const; +}; + +#endif // _SV_GDIMTF_HXX + diff --git a/vcl/inc/vcl/gfxlink.hxx b/vcl/inc/vcl/gfxlink.hxx new file mode 100644 index 000000000000..dced5a19c461 --- /dev/null +++ b/vcl/inc/vcl/gfxlink.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * 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_GFXLINK_HXX +#define _SV_GFXLINK_HXX + +#include <vcl/dllapi.h> +#include <vcl/sv.h> +#include <vcl/mapmod.hxx> +#include <tools/stream.hxx> + +// ------------- +// - ImpBuffer - +// ------------- + +struct ImpBuffer +{ + ULONG mnRefCount; + BYTE* mpBuffer; + + ImpBuffer( ULONG nSize ) + { + mnRefCount = 1UL; + mpBuffer = nSize ? new BYTE[ nSize ] : NULL; + } + + ImpBuffer( BYTE* pBuf ) { mnRefCount = 1UL; mpBuffer = pBuf; } + + ~ImpBuffer() { delete[] mpBuffer; } +}; + +// ----------- +// - ImpSwap - +// ----------- + +struct ImpSwap +{ + rtl::OUString maURL; + ULONG mnDataSize; + ULONG mnRefCount; + + ImpSwap( BYTE* pData, ULONG nDataSize ); + ~ImpSwap(); + + BYTE* GetData() const; + + BOOL IsSwapped() const { return maURL.getLength() > 0; } + + void WriteTo( SvStream& rOStm ) const; +}; + +// -------------- +// - ImpGfxLink - +// -------------- + +struct ImpGfxLink +{ + MapMode maPrefMapMode; + Size maPrefSize; + bool mbPrefMapModeValid; + bool mbPrefSizeValid; + + ImpGfxLink() : + maPrefMapMode(), + maPrefSize(), + mbPrefMapModeValid( false ), + mbPrefSizeValid( false ) + {} +}; + +//#endif // __PRIVATE + +// --------------- +// - GfxLinkType - +// --------------- + +enum GfxLinkType +{ + GFX_LINK_TYPE_NONE = 0, + GFX_LINK_TYPE_EPS_BUFFER = 1, + GFX_LINK_TYPE_NATIVE_GIF = 2, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_JPG = 3, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_PNG = 4, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_TIF = 5, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_WMF = 6, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_MET = 7, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_PCT = 8, // Don't forget to update the following defines + GFX_LINK_TYPE_USER = 0xffff +}; + +#define GFX_LINK_FIRST_NATIVE_ID GFX_LINK_TYPE_NATIVE_GIF +#define GFX_LINK_LAST_NATIVE_ID GFX_LINK_TYPE_NATIVE_PCT + +// ----------- +// - GfxLink - +// ----------- + +struct ImpBuffer; +struct ImpSwap; +struct ImpGfxLink; +class Graphic; + +class VCL_DLLPUBLIC GfxLink +{ +private: + + GfxLinkType meType; + ImpBuffer* mpBuf; + ImpSwap* mpSwap; + sal_uInt32 mnBufSize; + sal_uInt32 mnUserId; + ImpGfxLink* mpImpData; + ULONG mnExtra2; + + SAL_DLLPRIVATE void ImplCopy( const GfxLink& rGfxLink ); + +public: + GfxLink(); + GfxLink( const GfxLink& ); + GfxLink( const String& rPath, GfxLinkType nType ); + GfxLink( BYTE* pBuf, sal_uInt32 nBufSize, GfxLinkType nType, BOOL bOwns ); + ~GfxLink(); + + GfxLink& operator=( const GfxLink& ); + sal_Bool IsEqual( const GfxLink& ) const; + + GfxLinkType GetType() const; + + void SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; } + sal_uInt32 GetUserId() const { return mnUserId; } + + sal_uInt32 GetDataSize() const; + void SetData( BYTE* pBuf, sal_uInt32 nSize, GfxLinkType nType, BOOL bOwns ); + const BYTE* GetData() const; + + const Size& GetPrefSize() const; + void SetPrefSize( const Size& rPrefSize ); + bool IsPrefSizeValid(); + + const MapMode& GetPrefMapMode() const; + void SetPrefMapMode( const MapMode& rPrefMapMode ); + bool IsPrefMapModeValid(); + + BOOL IsNative() const; + BOOL IsUser() const { return( GFX_LINK_TYPE_USER == meType ); } + + BOOL LoadNative( Graphic& rGraphic ); + + BOOL ExportNative( SvStream& rOStream ) const; + + void SwapOut(); + void SwapIn(); + BOOL IsSwappedOut() const { return( mpSwap != NULL ); } + +public: + + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const GfxLink& rGfxLink ); + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, GfxLink& rGfxLink ); +}; + +#endif diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx new file mode 100644 index 000000000000..0e77d5dd6bc4 --- /dev/null +++ b/vcl/inc/vcl/glyphcache.hxx @@ -0,0 +1,380 @@ +/************************************************************************* + * + * 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_GLYPHCACHE_HXX +#define _SV_GLYPHCACHE_HXX + +#include <vcl/dllapi.h> + +class GlyphCache; +class GlyphMetric; +class GlyphData; +class ServerFont; +class GlyphCachePeer; +class ServerFontLayoutEngine; +class ServerFontLayout; +class ExtraKernInfo; +struct ImplKernPairData; +class ImplFontOptions; + +#include <tools/gen.hxx> +#include <hash_map> +#include <hash_set> + +namespace basegfx { class B2DPolyPolygon; } + +class RawBitmap; + +#include <vcl/outfont.hxx> +#include <vcl/impfont.hxx> + +class ServerFontLayout; +#include <vcl/sallayout.hxx> + +// ======================================================================= + +class VCL_DLLPUBLIC GlyphCache +{ +public: + explicit GlyphCache( GlyphCachePeer& ); + /*virtual*/ ~GlyphCache(); + + static GlyphCache& GetInstance(); + void LoadFonts(); + + void ClearFontPath(); + void AddFontPath( const String& rFontPath ); + void AddFontFile( const rtl::OString& rNormalizedName, + int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes&, + const ExtraKernInfo* = NULL ); + void AnnounceFonts( ImplDevFontList* ) const; + + ServerFont* CacheFont( const ImplFontSelectData& ); + void UncacheFont( ServerFont& ); + void InvalidateAllGlyphs(); + +protected: + GlyphCachePeer& mrPeer; + +private: + friend class ServerFont; + // used by ServerFont class only + void AddedGlyph( ServerFont&, GlyphData& ); + void RemovingGlyph( ServerFont&, GlyphData&, int nGlyphIndex ); + void UsingGlyph( ServerFont&, GlyphData& ); + void GrowNotify(); + +private: + ULONG CalcByteCount() const; + void GarbageCollect(); + + // the GlyphCache's FontList matches a font request to a serverfont instance + // the FontList key's mpFontData member is reinterpreted as integer font id + struct IFSD_Equal{ bool operator()( const ImplFontSelectData&, const ImplFontSelectData& ) const; }; + struct IFSD_Hash{ size_t operator()( const ImplFontSelectData& ) const; }; + typedef ::std::hash_map<ImplFontSelectData,ServerFont*,IFSD_Hash,IFSD_Equal > FontList; + FontList maFontList; + ULONG mnMaxSize; // max overall cache size in bytes + mutable ULONG mnBytesUsed; + mutable long mnLruIndex; + mutable int mnGlyphCount; + ServerFont* mpCurrentGCFont; + + class FreetypeManager* mpFtManager; +}; + +// ======================================================================= + +class GlyphMetric +{ +public: + Point GetOffset() const { return maOffset; } + Point GetDelta() const { return maDelta; } + Size GetSize() const { return maSize; } + long GetCharWidth() const { return mnAdvanceWidth; } + +protected: + friend class GlyphData; + void SetOffset( int nX, int nY ) { maOffset = Point( nX, nY); } + void SetDelta( int nX, int nY ) { maDelta = Point( nX, nY); } + void SetSize( const Size& s ) { maSize = s; } + void SetCharWidth( long nW ) { mnAdvanceWidth = nW; } + +private: + long mnAdvanceWidth; + Point maDelta; + Point maOffset; + Size maSize; +}; + +// ----------------------------------------------------------------------- + +// the glyph specific data needed by a GlyphCachePeer is usually trivial, +// not attaching it to the corresponding GlyphData would be overkill +struct ExtGlyphData +{ + int meInfo; + void* mpData; + + ExtGlyphData() : meInfo(0), mpData(NULL) {} +}; + +// ----------------------------------------------------------------------- + +class GlyphData +{ +public: + const GlyphMetric& GetMetric() const { return maMetric; } + Size GetSize() const { return maMetric.GetSize(); } + + void SetSize( const Size& s) { maMetric.SetSize( s ); } + void SetOffset( int nX, int nY ) { maMetric.SetOffset( nX, nY ); } + void SetDelta( int nX, int nY ) { maMetric.SetDelta( nX, nY ); } + void SetCharWidth( long nW ) { maMetric.SetCharWidth( nW ); } + + void SetLruValue( int n ) const { mnLruValue = n; } + long GetLruValue() const { return mnLruValue;} + + ExtGlyphData& ExtDataRef() { return maExtData; } + const ExtGlyphData& ExtDataRef() const { return maExtData; } + +private: + GlyphMetric maMetric; + ExtGlyphData maExtData; + + // used by GlyphCache for cache LRU algorithm + mutable long mnLruValue; +}; + +// ======================================================================= + +class VCL_DLLPUBLIC ServerFont +{ +public: + virtual const ::rtl::OString* GetFontFileName() const { return NULL; } + virtual int GetFontFaceNumber() const { return 0; } + virtual bool TestFont() const { return true; } + virtual void* GetFtFace() const { return 0; } + virtual int GetLoadFlags() const { return 0; } + virtual void SetFontOptions( const ImplFontOptions&) {} + virtual bool NeedsArtificialBold() const { return false; } + virtual bool NeedsArtificialItalic() const { return false; } + + const ImplFontSelectData& GetFontSelData() const { return maFontSelData; } + + virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const = 0; + virtual ULONG GetKernPairs( ImplKernPairData** ) const { return 0; } + virtual int GetGlyphKernValue( int, int ) const { return 0; } + virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; + Point TransformPoint( const Point& ) const; + + GlyphData& GetGlyphData( int nGlyphIndex ); + const GlyphMetric& GetGlyphMetric( int nGlyphIndex ) + { return GetGlyphData( nGlyphIndex ).GetMetric(); } + + virtual int GetGlyphIndex( sal_UCS4 ) const = 0; + virtual bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const = 0; + virtual bool GetAntialiasAdvice( void ) const = 0; + bool IsGlyphInvisible( int nGlyphIndex ); + virtual bool GetGlyphBitmap1( int nGlyphIndex, RawBitmap& ) const = 0; + virtual bool GetGlyphBitmap8( int nGlyphIndex, RawBitmap& ) const = 0; + + void SetExtended( int nInfo, void* ppVoid ); + int GetExtInfo() { return mnExtInfo; } + void* GetExtPointer() { return mpExtData; } + +protected: + friend class GlyphCache; + friend class ServerFontLayout; + explicit ServerFont( const ImplFontSelectData& ); + virtual ~ServerFont(); + + void AddRef() const { ++mnRefCount; } + long GetRefCount() const { return mnRefCount; } + long Release() const; + ULONG GetByteCount() const { return mnBytesUsed; } + + virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const = 0; + virtual void GarbageCollect( long ); + void ReleaseFromGarbageCollect(); + + virtual ServerFontLayoutEngine* GetLayoutEngine() { return NULL; } + +private: + typedef ::std::hash_map<int,GlyphData> GlyphList; + mutable GlyphList maGlyphList; + + const ImplFontSelectData maFontSelData; + + // info for GlyphcachePeer + int mnExtInfo; + void* mpExtData; + + // used by GlyphCache for cache LRU algorithm + mutable long mnRefCount; + mutable ULONG mnBytesUsed; + + ServerFont* mpPrevGCFont; + ServerFont* mpNextGCFont; + +protected: + // 16.16 fixed point values used for a rotated font + long mnCos; + long mnSin; +private: + int mnZWJ; + int mnZWNJ; + bool mbCollectedZW; +}; + +// ======================================================================= + +// a class for cache entries for physical font instances that are based on serverfonts +class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry +{ +private: + ServerFont* mpServerFont; + ImplFontOptions maFontOptions; + bool mbGotFontOptions; + bool mbValidFontOptions; + +public: + ImplServerFontEntry( ImplFontSelectData& ); + virtual ~ImplServerFontEntry(); + void SetServerFont( ServerFont* p) { mpServerFont = p; } + void HandleFontOptions(); +}; + +// ======================================================================= + +class VCL_DLLPUBLIC ServerFontLayout : public GenericSalLayout +{ +private: + ServerFont& mrServerFont; + + // enforce proper copy semantic + SAL_DLLPRIVATE ServerFontLayout( const ServerFontLayout& ); + SAL_DLLPRIVATE ServerFontLayout& operator=( const ServerFontLayout& ); + +public: + ServerFontLayout( ServerFont& ); + virtual bool LayoutText( ImplLayoutArgs& ); + virtual void AdjustLayout( ImplLayoutArgs& ); + virtual void DrawText( SalGraphics& ) const; + ServerFont& GetServerFont() const { return mrServerFont; } +}; + +// ======================================================================= + +class ServerFontLayoutEngine +{ +public: + virtual ~ServerFontLayoutEngine() {} + virtual bool operator()( ServerFontLayout&, ImplLayoutArgs& ); +}; + +// ======================================================================= + +class GlyphCachePeer +{ +protected: + GlyphCachePeer() : mnBytesUsed(0) {} + virtual ~GlyphCachePeer() {} + +public: + sal_Int32 GetByteCount() const { return mnBytesUsed; } + virtual void RemovingFont( ServerFont& ) {} + virtual void RemovingGlyph( ServerFont&, GlyphData&, int ) {} + +protected: + sal_Int32 mnBytesUsed; +}; + +// ======================================================================= + +class VCL_DLLPUBLIC RawBitmap +{ +public: + RawBitmap(); + ~RawBitmap(); + bool Rotate( int nAngle ); + +public: + unsigned char* mpBits; + ULONG mnAllocated; + + ULONG mnWidth; + ULONG mnHeight; + + ULONG mnScanlineSize; + ULONG mnBitCount; + + int mnXOffset; + int mnYOffset; +}; + +// ======================================================================= + +inline void ServerFont::SetExtended( int nInfo, void* pVoid ) +{ + mnExtInfo = nInfo; + mpExtData = pVoid; +} + +// ======================================================================= + +// ExtraKernInfo allows an on-demand query of extra kerning info #i29881# +// The kerning values have to be scaled to match the font size before use +class VCL_DLLPUBLIC ExtraKernInfo +{ +public: + ExtraKernInfo( sal_IntPtr nFontId ); + virtual ~ExtraKernInfo() {} + + bool HasKernPairs() const; + int GetUnscaledKernPairs( ImplKernPairData** ) const; + int GetUnscaledKernValue( sal_Unicode cLeft, sal_Unicode cRight ) const; + +protected: + mutable bool mbInitialized; + virtual void Initialize() const = 0; + +protected: + sal_IntPtr mnFontId; + + // container to map a unicode pair to an unscaled kerning value + struct PairEqual{ int operator()(const ImplKernPairData& rA, const ImplKernPairData& rB) const + { return (rA.mnChar1 == rB.mnChar1) && (rA.mnChar2 == rB.mnChar2); } }; + struct PairHash{ int operator()(const ImplKernPairData& rA) const + { return (rA.mnChar1) * 256 ^ rA.mnChar2; } }; + typedef std::hash_set< ImplKernPairData, PairHash, PairEqual > UnicodeKernPairs; + mutable UnicodeKernPairs maUnicodeKernPairs; +}; + +// ======================================================================= + +#endif // _SV_GLYPHCACHE_HXX diff --git a/vcl/inc/vcl/gradient.hxx b/vcl/inc/vcl/gradient.hxx new file mode 100644 index 000000000000..8938627cf684 --- /dev/null +++ b/vcl/inc/vcl/gradient.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * 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_GRADIENT_HXX +#define _SV_GRADIENT_HXX + +#include <vcl/dllapi.h> +#include <tools/color.hxx> + +#include <vcl/vclenum.hxx> + +// ------------------ +// - Gradient-Types - +// ------------------ + +/* +#ifndef ENUM_GRADIENTSTYLE_DECLARED +#define ENUM_GRADIENTSTYLE_DECLARED +enum GradientStyle { GRADIENT_LINEAR, GRADIENT_AXIAL, GRADIENT_RADIAL, + GRADIENT_ELLIPTICAL, GRADIENT_SQUARE, GRADIENT_RECT }; +#endif +*/ + +// ---------------- +// - Impl_Gradient - +// ---------------- + +class SvStream; + +class Impl_Gradient +{ +public: + ULONG mnRefCount; + GradientStyle meStyle; + Color maStartColor; + Color maEndColor; + USHORT mnAngle; + USHORT mnBorder; + USHORT mnOfsX; + USHORT mnOfsY; + USHORT mnIntensityStart; + USHORT mnIntensityEnd; + USHORT mnStepCount; + + friend SvStream& operator>>( SvStream& rIStm, Impl_Gradient& rImplGradient ); + friend SvStream& operator<<( SvStream& rOStm, const Impl_Gradient& rImplGradient ); + + Impl_Gradient(); + Impl_Gradient( const Impl_Gradient& rImplGradient ); +}; + +// ------------ +// - Gradient - +// ------------ + +class VCL_DLLPUBLIC Gradient +{ +private: + Impl_Gradient* mpImplGradient; + void MakeUnique(); + +public: + Gradient(); + Gradient( const Gradient& rGradient ); + Gradient( GradientStyle eStyle ); + Gradient( GradientStyle eStyle, + const Color& rStartColor, + const Color& rEndColor ); + ~Gradient(); + + void SetStyle( GradientStyle eStyle ); + GradientStyle GetStyle() const { return mpImplGradient->meStyle; } + + void SetStartColor( const Color& rColor ); + const Color& GetStartColor() const { return mpImplGradient->maStartColor; } + void SetEndColor( const Color& rColor ); + const Color& GetEndColor() const { return mpImplGradient->maEndColor; } + + void SetAngle( USHORT nAngle ); + USHORT GetAngle() const { return mpImplGradient->mnAngle; } + + void SetBorder( USHORT nBorder ); + USHORT GetBorder() const { return mpImplGradient->mnBorder; } + void SetOfsX( USHORT nOfsX ); + USHORT GetOfsX() const { return mpImplGradient->mnOfsX; } + void SetOfsY( USHORT nOfsY ); + USHORT GetOfsY() const { return mpImplGradient->mnOfsY; } + + void SetStartIntensity( USHORT nIntens ); + USHORT GetStartIntensity() const { return mpImplGradient->mnIntensityStart; } + void SetEndIntensity( USHORT nIntens ); + USHORT GetEndIntensity() const { return mpImplGradient->mnIntensityEnd; } + + void SetSteps( USHORT nSteps ); + USHORT GetSteps() const { return mpImplGradient->mnStepCount; } + + Gradient& operator=( const Gradient& rGradient ); + BOOL operator==( const Gradient& rGradient ) const; + BOOL operator!=( const Gradient& rGradient ) const + { return !(Gradient::operator==( rGradient )); } + BOOL IsSameInstance( const Gradient& rGradient ) const + { return (mpImplGradient == rGradient.mpImplGradient); } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Gradient& rGradient ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient ); +}; + +#endif // _SV_GRADIENT_HXX diff --git a/vcl/inc/vcl/graph.h b/vcl/inc/vcl/graph.h new file mode 100644 index 000000000000..c50a54b8802d --- /dev/null +++ b/vcl/inc/vcl/graph.h @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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_GRAPH_H +#define _SV_GRAPH_H + +#include <vcl/dllapi.h> +#include <tools/string.hxx> +#include <vcl/sv.h> + +// --------------- +// - GraphicType - +// --------------- + +enum GraphicType +{ + GRAPHIC_NONE, + GRAPHIC_BITMAP, + GRAPHIC_GDIMETAFILE, + GRAPHIC_DEFAULT +}; + +// ----------------- +// - GraphicReader - +// ----------------- + +class ReaderData; + +class VCL_DLLPUBLIC GraphicReader +{ +protected: + + String maUpperName; + ReaderData* mpReaderData; + BOOL mbIsReading; + + GraphicReader() : + mpReaderData( NULL ), + mbIsReading( FALSE ) {} + +public: + + virtual ~GraphicReader(); + + const String& GetUpperFilterName() const { return maUpperName; } + ReaderData* GetReaderData() const { return mpReaderData; } + BOOL IsReading() const { return mbIsReading; } + + // TODO: when incompatible changes are possible again + // the preview size hint should be redone + BOOL IsPreviewModeEnabled() const; + void DisablePreviewMode(); + void SetPreviewSize( const Size& ); + Size GetPreviewSize() const; +}; + +#endif // _SV_GRAPH_H diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx new file mode 100644 index 000000000000..aa860273fdb7 --- /dev/null +++ b/vcl/inc/vcl/graph.hxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * 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_GRAPH_HXX +#define _SV_GRAPH_HXX + +#include <tools/stream.hxx> +#include <vcl/dllapi.h> +#include <vcl/sv.h> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/animate.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/graph.h> +#include <vcl/gfxlink.hxx> +#include <com/sun/star/uno/Reference.hxx> + +namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } } + +// ----------- +// - Graphic - +// ----------- + +class ImpGraphic; +class OutputDevice; +class Font; +class GfxLink; + +class VCL_DLLPUBLIC GraphicConversionParameters +{ +private: + Size maSizePixel; // default is (0,0) + + // bitfield + unsigned mbUnlimitedSize : 1; // default is false + unsigned mbAntiAliase : 1; // default is false + unsigned mbSnapHorVerLines : 1; // default is false + +public: + GraphicConversionParameters( + const Size& rSizePixel = Size(), + bool bUnlimitedSize = false, + bool bAntiAliase = false, + bool bSnapHorVerLines = false) + : maSizePixel(rSizePixel), + mbUnlimitedSize(bUnlimitedSize), + mbAntiAliase(bAntiAliase), + mbSnapHorVerLines(bSnapHorVerLines) + { + } + + // data read access + const Size getSizePixel() const { return maSizePixel; } + bool getUnlimitedSize() const { return mbUnlimitedSize; } + bool getAntiAliase() const { return mbAntiAliase; } + bool getSnapHorVerLines() const { return mbSnapHorVerLines; } +}; + +class VCL_DLLPUBLIC Graphic : public SvDataCopyStream +{ +private: + + ImpGraphic* mpImpGraphic; + +//#if 0 // _SOLAR__PRIVATE + +public: + + SAL_DLLPRIVATE void ImplTestRefCount(); + SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mpImpGraphic; } + +//#endif + +public: + + TYPEINFO(); + + Graphic(); + Graphic( const Graphic& rGraphic ); + Graphic( const Bitmap& rBmp ); + Graphic( const BitmapEx& rBmpEx ); + Graphic( const Animation& rAnimation ); + Graphic( const GDIMetaFile& rMtf ); + Graphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ); + virtual ~Graphic(); + + Graphic& operator=( const Graphic& rGraphic ); + BOOL operator==( const Graphic& rGraphic ) const; + BOOL operator!=( const Graphic& rGraphic ) const; + BOOL operator!() const; + + void Clear(); + + GraphicType GetType() const; + void SetDefaultType(); + BOOL IsSupportedGraphic() const; + + BOOL IsTransparent() const; + BOOL IsAlpha() const; + BOOL IsAnimated() const; + + // #i102089# Access of Bitmap potentially will have to rasterconvert the Graphic + // if it is a MetaFile. To be able to control this conversion it is necessary to + // allow giving parameters which control AntiAliasing and LineSnapping of the + // MetaFile when played. Defaults will use a no-AAed, not snapped conversion as + // before. + Bitmap GetBitmap(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const; + BitmapEx GetBitmapEx(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const; + + Animation GetAnimation() const; + const GDIMetaFile& GetGDIMetaFile() const; + + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const; + + Size GetPrefSize() const; + void SetPrefSize( const Size& rPrefSize ); + + MapMode GetPrefMapMode() const; + void SetPrefMapMode( const MapMode& rPrefMapMode ); + + Size GetSizePixel( const OutputDevice* pRefDevice = NULL ) const; + + ULONG GetSizeBytes() const; + + void Draw( OutputDevice* pOutDev, + const Point& rDestPt ) const; + void Draw( OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSize ) const; + static void Draw( OutputDevice* pOutDev, const String& rText, + Font& rFont, const Bitmap& rBitmap, + const Point& rDestPt, const Size& rDestSize ); + static void DrawEx( OutputDevice* pOutDev, const String& rText, + Font& rFont, const BitmapEx& rBitmap, + const Point& rDestPt, const Size& rDestSize ); + + void StartAnimation( OutputDevice* pOutDev, + const Point& rDestPt, + long nExtraData = 0L, + OutputDevice* pFirstFrameOutDev = NULL ); + void StartAnimation( OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSize, + long nExtraData = 0L, + OutputDevice* pFirstFrameOutDev = NULL ); + void StopAnimation( OutputDevice* pOutputDevice = NULL, + long nExtraData = 0L ); + + void SetAnimationNotifyHdl( const Link& rLink ); + Link GetAnimationNotifyHdl() const; + + ULONG GetAnimationLoopCount() const; + void ResetAnimationLoopCount(); + + List* GetAnimationInfoList() const; + + ULONG GetChecksum() const; + +public: + + GraphicReader* GetContext(); + void SetContext( GraphicReader* pReader ); + +public: + + static USHORT GetGraphicsCompressMode( SvStream& rIStm ); + + void SetDocFileName( const String& rName, ULONG nFilePos ); + const String& GetDocFileName() const; + ULONG GetDocFilePos() const; + + BOOL ReadEmbedded( SvStream& rIStream, BOOL bSwap = FALSE ); + BOOL WriteEmbedded( SvStream& rOStream ); + + BOOL SwapOut(); + BOOL SwapOut( SvStream* pOStm ); + BOOL SwapIn(); + BOOL SwapIn( SvStream* pIStm ); + BOOL IsSwapOut() const; + + void SetLink( const GfxLink& ); + GfxLink GetLink() const; + BOOL IsLink() const; + + BOOL ExportNative( SvStream& rOStream ) const; + + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic ); + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Graphic& rGraphic ); + +public: + + virtual void Load( SvStream& ); + virtual void Save( SvStream& ); + virtual void Assign( const SvDataCopyStream& ); +}; + +#endif // _SV_GRAPH_HXX + diff --git a/vcl/inc/vcl/graphictools.hxx b/vcl/inc/vcl/graphictools.hxx new file mode 100644 index 000000000000..3e3b9b3dc5b5 --- /dev/null +++ b/vcl/inc/vcl/graphictools.hxx @@ -0,0 +1,462 @@ +/************************************************************************* + * + * 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_GRAPHICTOOLS_HXX_ +#define _VCL_GRAPHICTOOLS_HXX_ + +#include <vcl/dllapi.h> +#include <sal/types.h> +#include <rtl/string.hxx> +#include <tools/color.hxx> +#include <tools/poly.hxx> +#include <tools/stream.hxx> +#include <vcl/graph.hxx> + +#ifndef INCLUDED_MEMORY +#include <memory> +#define INCLUDED_MEMORY +#endif + +#ifndef INCLUDED_VECTOR +#include <vector> +#define INCLUDED_VECTOR +#endif + +/** Encapsulates geometry and associated attributes of a graphical 'pen stroke' + + @attention Widespread use is deprecated. See declarations above + for the way to go. Especially the copied enums from svx/xenum.hxx + are troublesome. + + Use this class to store geometry and attributes of a graphical + 'pen stroke', such as pen width, dashing etc. The geometry is the + so-called 'path' along which the stroke is traced, with the given + pen width. The cap type determines how the open ends of the path + should be drawn. If the geometry consists of more than one + segment, the join type determines in which way the segments are + joined. + */ +class VCL_DLLPUBLIC SvtGraphicStroke +{ +public: + /// Style for open stroke ends + enum CapType + { + /// No additional cap + capButt=0, + /// Half-round cap at the line end, the center lying at the end point + capRound, + /// Half-square cap at the line end, the center lying at the end point + capSquare + }; + /// Style for joins of individual stroke segments + enum JoinType + { + /// Extend segment edges, until they cross + joinMiter=0, + /// Connect segments by a filled round arc + joinRound, + /// Connect segments by a direct straight line + joinBevel, + /// Perform no join, leads to visible gaps between thick line segments + joinNone + }; + enum + { + /// Width of stroke start/end arrow to exactly fit the joining stroke + normalizedArrowWidth=65536 + }; + typedef ::std::vector< double > DashArray; + + SvtGraphicStroke(); + /** All in one constructor + + See accessor method descriptions for argument description + */ + SvtGraphicStroke( const Polygon& rPath, + const PolyPolygon& rStartArrow, + const PolyPolygon& rEndArrow, + double fTransparency, + double fStrokeWidth, + CapType aCap, + JoinType aJoin, + double fMiterLimit, + const DashArray& rDashArray ); // TODO: Dash array offset (position where to start, see PS) + + // accessors + /// Query path to stroke + void getPath ( Polygon& ) const; + /** Get the polygon that is put at the start of the line + + The polygon is in a special normalized position: the center of + the stroked path will meet the given polygon at (0,0) from + negative y values. Thus, an arrow would have its baseline on + the x axis, going upwards to positive y values. Furthermore, + the polygon is also scaled in a special way: the width of the + joining stroke is defined to be + SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging + from x=-0x8000 to x=0x8000. So, if the arrow does have this + width, it has to fit every stroke with every stroke width + exactly. + */ + void getStartArrow ( PolyPolygon& ) const; + /** Get the polygon that is put at the end of the line + + The polygon is in a special normalized position, and already + scaled to the desired size: the center of the stroked path + will meet the given polygon at (0,0) from negative y + values. Thus, an arrow would have its baseline on the x axis, + going upwards to positive y values. Furthermore, the polygon + is also scaled in a special way: the width of the joining + stroke is defined to be SvtGraphicStroke::normalizedArrowWidth + (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. So, if the + arrow does have this width, it has to fit every stroke with + every stroke width exactly. + */ + void getEndArrow ( PolyPolygon& ) const; + /** Get stroke transparency + + @return the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent) + */ + double getTransparency () const; + /// Get width of the stroke + double getStrokeWidth () const; + /// Get the style in which open stroke ends are drawn + CapType getCapType () const; + /// Get the style in which the stroke segments are joined + JoinType getJoinType () const; + /// Get the maximum length of mitered joins + double getMiterLimit () const; + /// Get an array of "on" and "off" lengths for stroke dashing + void getDashArray ( DashArray& ) const; + /// Query a textual representation of the object's content + ::rtl::OString toString () const; + + // mutators + /// Set path to stroke + void setPath ( const Polygon& ); + /** Set the polygon that is put at the start of the line + + The polygon has to be in a special normalized position, and + already scaled to the desired size: the center of the stroked + path will meet the given polygon at (0,0) from negative y + values. Thus, an arrow would have its baseline on the x axis, + going upwards to positive y values. Furthermore, the polygon + also has to be scaled appropriately: the width of the joining + stroke is defined to be SvtGraphicStroke::normalizedArrowWidth + (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your + arrow does have this width, it will fit every stroke with + every stroke width exactly. + */ + void setStartArrow ( const PolyPolygon& ); + /** Set the polygon that is put at the end of the line + + The polygon has to be in a special normalized position, and + already scaled to the desired size: the center of the stroked + path will meet the given polygon at (0,0) from negative y + values. Thus, an arrow would have its baseline on the x axis, + going upwards to positive y values. Furthermore, the polygon + also has to be scaled appropriately: the width of the joining + stroke is defined to be SvtGraphicStroke::normalizedArrowWidth + (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your + arrow does have this width, it will fit every stroke with + every stroke width exactly. + */ + void setEndArrow ( const PolyPolygon& ); + /** Set stroke transparency + + @param fTrans + The transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent) + */ + void setTransparency ( double fTrans ); + /// Set width of the stroke + void setStrokeWidth ( double ); + /// Set the style in which open stroke ends are drawn + void setCapType ( CapType ); + /// Set the style in which the stroke segments are joined + void setJoinType ( JoinType ); + /// Set the maximum length of mitered joins + void setMiterLimit ( double ); + /// Set the array of "on" and "off" lengths for stroke dashing + void setDashArray ( const DashArray& ); + +private: + // friends + VCL_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const SvtGraphicStroke& rClass ); + VCL_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, SvtGraphicStroke& rClass ); + + Polygon maPath; + PolyPolygon maStartArrow; + PolyPolygon maEndArrow; + double mfTransparency; + double mfStrokeWidth; + CapType maCapType; + JoinType maJoinType; + double mfMiterLimit; + DashArray maDashArray; +}; + +/** Encapsulates geometry and associated attributes of a filled area + + @attention Widespread use is deprecated. See declarations above + for the way to go. Especially the copied enums from svx/xenum.hxx + is troublesome. + + Use this class to store geometry and attributes of a filled area, + such as fill color, transparency, texture or hatch. The geometry + is the so-called 'path', whose inner area will get filled + according to the attributes set. If the path is intersecting, or + one part of the path is lying fully within another part, then the + fill rule determines which parts are filled and which are not. + */ +class VCL_DLLPUBLIC SvtGraphicFill +{ +public: + /// Type of fill algorithm used + enum FillRule + { + /** Non-zero winding rule + + Fill shape scanline-wise. Starting at the left, determine + the winding number as follows: every segment crossed that + runs counter-clockwise adds one to the winding number, + every segment crossed that runs clockwise subtracts + one. The part of the scanline where the winding number is + non-zero gets filled. + */ + fillNonZero=0, + /** Even-odd fill rule + + Fill shape scanline-wise. Starting at the left, count the + number of segments crossed. If this number is odd, the + part of the scanline is filled, otherwise not. + */ + fillEvenOdd + }; + /// Type of filling used + enum FillType + { + /// Fill with a specified solid color + fillSolid=0, + /// Fill with the specified gradient + fillGradient, + /// Fill with the specified hatch + fillHatch, + /// Fill with the specified texture (a Graphic object) + fillTexture + }; + /// Type of hatching used + enum HatchType + { + /// horizontal parallel lines, one unit apart + hatchSingle=0, + /// horizontal and verticall orthogonally crossing lines, one unit apart + hatchDouble, + /// three crossing lines, like HatchType::hatchDouble, but + /// with an additional diagonal line, rising to the upper + /// right corner. The first diagonal line goes through the + /// upper left corner, the other are each spaced a unit apart. + hatchTriple + }; + /// Type of gradient used + enum GradientType {gradientLinear=0, gradientRadial, gradientRectangular}; + /// Special values for gradient step count + enum { gradientStepsInfinite=0 }; + /** Homogeneous 2D transformation matrix + + This is a 2x3 matrix representing an affine transformation on + the R^2, in the usual C/C++ row major form. It is structured as follows: + <pre> + a b t_x + c d t_y + 0 0 1 + </pre> + where the lowest line is not stored in the matrix, since it is + constant. Variables t_x and t_y contain translational + components, a to d rotation, scale and shear (for details, + look up your favorite linear algebra/computer graphics book). + */ + struct VCL_DLLPUBLIC Transform + { + enum { MatrixSize=6 }; + Transform(); + double matrix[MatrixSize]; + }; + + SvtGraphicFill(); + /** All in one constructor + + See accessor method descriptions for argument description + */ + SvtGraphicFill( const PolyPolygon& rPath, + Color aFillColor, + double fTransparency, + FillRule aFillRule, + FillType aFillType, // TODO: Multitexturing + const Transform& aFillTransform, + bool bTiling, + HatchType aHatchType, // TODO: vector of directions and start points + Color aHatchColor, + GradientType aGradientType, // TODO: Transparent gradients (orthogonal to normal ones) + Color aGradient1stColor, // TODO: vector of colors and offsets + Color aGradient2ndColor, + int aGradientStepCount, // numbers of steps to render the gradient. gradientStepsInfinite means infinitely many. + const Graphic& aFillGraphic ); + + // accessors + /// Query path to fill + void getPath ( PolyPolygon& ) const; + /// Get color used for solid fills + Color getFillColor () const; + /** Get stroke transparency + + @return the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent) + */ + double getTransparency () const; + /// Get fill rule used + FillRule getFillRule () const; + /** Get fill type used + + Currently, only one of the fill types can be used + simultaneously. If you specify e.g. FillRule::fillGradient, + hatching, texture and solid fill color are ignored. + */ + FillType getFillType () const; + /** Get transformation applied to hatch, gradient or texture during fill + + A fill operation generally starts at the top left position of + the object's bounding box. At that position (if tiling is on, + also all successive positions), the specified fill graphic is + rendered, after applying the fill transformation to it. For + example, if the fill transformation contains a translation, + the fill graphic is rendered at the object's bounding box's + top left corner plus the translation components. + + */ + void getTransform ( Transform& ) const; + /// deprecated + bool IsTiling () const; + /** Query state of texture tiling + + @return true, if texture is tiled, false, if output only once. + */ + bool isTiling () const; + /// Get type of hatch used + HatchType getHatchType () const; + /// Get color used for drawing the hatch + Color getHatchColor () const; + /// Get type of gradient used + GradientType getGradientType () const; + /// Get start color of the gradient + Color getGradient1stColor () const; + /// Get end color of the gradient + Color getGradient2ndColor () const; + /** Get the numbers of steps to render the gradient. + + @return the step count. gradientStepsInfinite means infinitely many. + */ + int getGradientStepCount() const; + /** Get the texture graphic used + + The Graphic object returned is used to fill the geometry, if + the FillType is fillTexture. The Graphic object is always + assumed to be of size 1x1, the transformation is used to scale + it to the appropriate size. + */ + void getGraphic ( Graphic& ) const; + /// Query a textual representation of the object's content + ::rtl::OString toString () const; + + // mutators + /// Set path to fill + void setPath ( const PolyPolygon& rPath ); + /// Set color used for solid fills + void setFillColor ( Color aFillColor ); + /** Set stroke transparency + + @param fTransparency + The transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent) + */ + void setTransparency ( double fTransparency ); + /// Set fill rule used + void setFillRule ( FillRule aFillRule ); + /** Set fill type used + + Currently, only one of the fill types can be used + simultaneously. If you specify e.g. FillRule::fillGradient, + hatching, texture and solid fill color are ignored. + */ + void setFillType ( FillType aFillType ); + /// Set transformation applied to hatch, gradient or texture during fill + void setTransform ( const Transform& pTransform ); + /** Set state of texture tiling + + @param bTiling + If set to true, texture is tiled, if set to false, texture is output only once. + */ + void setTiling ( bool bTiling = true ); + /// Set type of hatch used + void setHatchType ( HatchType aHatchType ); + /// Set color used for drawing the hatch + void setHatchColor ( Color aHatchColor ); + /// Set type of gradient used + void setGradientType ( GradientType aGradType ); + /// Set start color of the gradient + void setGradient1stColor ( Color aColor ); + /// Set end color of the gradient + void setGradient2ndColor ( Color aColor ); + /** Set the numbers of steps to render the gradient. + + @param aCount + The step count. gradientStepsInfinite means use infinitely many. + */ + void setGradientStepCount( int aCount ); + /// Set the texture graphic used + void setGraphic ( const Graphic& rGraphic ); + +private: + // friends + VCL_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const SvtGraphicFill& rClass ); + VCL_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, SvtGraphicFill& rClass ); + + PolyPolygon maPath; + Color maFillColor; + double mfTransparency; + FillRule maFillRule; + FillType maFillType; + Transform maFillTransform; + bool mbTiling; + HatchType maHatchType; + Color maHatchColor; + GradientType maGradientType; + Color maGradient1stColor; + Color maGradient2ndColor; + int maGradientStepCount; + Graphic maFillGraphic; +}; + +#endif /* _VCL_GRAPHICTOOLS_HXX_ */ diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx new file mode 100644 index 000000000000..ae2ff2962adb --- /dev/null +++ b/vcl/inc/vcl/graphite_adaptors.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * 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_GRAPHITEADAPTORS_HXX +#define _SV_GRAPHITEADAPTORS_HXX + +// We need this to enable namespace support in libgrengine headers. +#define GR_NAMESPACE + +// Standard Library +#include <stdexcept> +// Platform + +#ifndef _SVWIN_H +#include <tools/svwin.h> +#endif + +#ifndef _SV_SVSYS_HXX +#include <svsys.h> +#endif + +#ifndef _SV_SALGDI_HXX +#include <vcl/salgdi.hxx> +#endif + +#ifndef _SV_SALLAYOUT_HXX +#include <vcl/sallayout.hxx> +#endif + +// Module +#include "vcl/dllapi.h" + +// Libraries +#include <preextstl.h> +#include <graphite/GrClient.h> +#include <graphite/Font.h> +#include <graphite/ITextSource.h> +#include <postextstl.h> + +// Module type definitions and forward declarations. +// +#ifndef MSC +// SAL/VCL types +class ServerFont; +class FreetypeServerFont; + +// Graphite types + +struct FontProperties : gr::FontProps +{ + FontProperties(const FreetypeServerFont & font) throw(); +}; + +namespace grutils +{ + class GrFeatureParser; +} + +// This class adapts the Sal font and graphics services to form required by +// the Graphite engine. +// @author tse +// +class VCL_DLLPUBLIC GraphiteFontAdaptor : public gr::Font +{ + typedef std::map<const gr::gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap; + friend class GrFontHasher; +public: + static bool IsGraphiteEnabledFont(ServerFont &) throw(); + + GraphiteFontAdaptor(ServerFont & font, const sal_Int32 dpi_x, const sal_Int32 dpi_y); + GraphiteFontAdaptor(const GraphiteFontAdaptor &) throw(); + ~GraphiteFontAdaptor() throw(); + + gr::Font * copyThis(); + + // Basic attribute accessors. + virtual float ascent(); + virtual float descent(); + virtual bool bold(); + virtual bool italic(); + virtual float height(); + virtual unsigned int getDPIx(); + virtual unsigned int getDPIy(); + + // Font access methods. + virtual const void * getTable(gr::fontTableId32 tableID, size_t * pcbSize); + virtual void getFontMetrics(float * ascent_out, float * descent_out = 0, float * em_square_out = 0); + + // Glyph metrics. + virtual void getGlyphMetrics(gr::gid16 glyphID, gr::Rect & boundingBox, gr::Point & advances); + + // Adaptor attributes. + const FontProperties & fontProperties() const throw(); + FreetypeServerFont & font() const throw(); + const grutils::GrFeatureParser * features() const { return mpFeatures; }; + +private: + virtual void UniqueCacheInfo(ext_std::wstring &, bool &, bool &); + + FreetypeServerFont& mrFont; + FontProperties maFontProperties; + const unsigned int mnDpiX, mnDpiY; + const float mfAscent, + mfDescent, + mfEmUnits; + grutils::GrFeatureParser * mpFeatures; + GlyphMetricMap maGlyphMetricMap; +}; + +// Partial implementation of class GraphiteFontAdaptor. +// +inline const FontProperties & GraphiteFontAdaptor::fontProperties() const throw() { + return maFontProperties; +} + +inline FreetypeServerFont & GraphiteFontAdaptor::font() const throw() { + return mrFont; +} +#endif // not MFC + +// Partial implementation of class TextSourceAdaptor. +// +//inline const ImplLayoutArgs & TextSourceAdaptor::layoutArgs() const throw() { +// return _layout_args; +//} + + +#endif // _SV_GRAPHITEADAPTORS_HXX diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx new file mode 100644 index 000000000000..af1392ed4d4b --- /dev/null +++ b/vcl/inc/vcl/graphite_cache.hxx @@ -0,0 +1,289 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// Description: Classes to cache Graphite Segments to try to improve +// rendering performance. + +#ifndef GraphiteSegmentCache_h +#define GraphiteSegmentCache_h + +#include <tools/solar.h> +#include <rtl/ustring.h> + +#define GRCACHE_REUSE_VECTORS 1 + +//#include <rope> +#include <hash_map> + +class TextSourceAdaptor; +/** +* GrSegRecord stores a Graphite Segment and its associated text +*/ +class GrSegRecord { +public: + GrSegRecord(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl); + + ~GrSegRecord(); + + void reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl); + + void clearVectors(); + void clear(); +#ifdef GRCACHE_REUSE_VECTORS + void setGlyphVectors(long nWidth, GraphiteLayout::Glyphs & vGlyphs, std::vector<int> vCharDxs, + std::vector<int> & vChar2Base, std::vector<int> & vGlyph2Char, float fScale) + { + clearVectors(); + mnWidth = nWidth; + m_fontScale = fScale; + mvGlyphs.insert(mvGlyphs.begin(), vGlyphs.begin(), vGlyphs.end()); + mvCharDxs.insert(mvCharDxs.begin(),vCharDxs.begin(),vCharDxs.end()); + mvChar2BaseGlyph.insert(mvChar2BaseGlyph.begin(),vChar2Base.begin(),vChar2Base.end()); + mvGlyph2Char.insert(mvGlyph2Char.begin(),vGlyph2Char.begin(),vGlyph2Char.end()); + } +#endif + gr::Segment * getSegment() { return m_seg; } + TextSourceAdaptor * getTextSrc() { return m_text; } + void unlock() { --m_lockCount; } + bool isRtl() const { return mbIsRtl; } +#ifdef GRCACHE_REUSE_VECTORS + const long & width() const { return mnWidth; } + const GraphiteLayout::Glyphs & glyphs() const { return mvGlyphs; } + const std::vector<int> & charDxs() const { return mvCharDxs; } + const std::vector<int> & char2BaseGlyph() const { return mvChar2BaseGlyph; } + const std::vector<int> & glyph2Char() const { return mvGlyph2Char; } + float & fontScale() { return m_fontScale; } +#endif +private: + rtl::OUString * m_rope; + TextSourceAdaptor * m_text; + gr::Segment * m_seg; + const xub_Unicode * m_nextKey; + const xub_Unicode* m_pStr; + size_t m_startChar; + float m_fontScale; + long mnWidth; + GraphiteLayout::Glyphs mvGlyphs; // glyphs in display order + std::vector<int> mvCharDxs; // right hand side x offset of each glyph + std::vector<int> mvChar2BaseGlyph; + std::vector<int> mvGlyph2Char; + bool mbIsRtl; + int m_lockCount; + friend class GraphiteSegmentCache; +}; + +typedef std::hash_map<long, GrSegRecord*, std::hash<long> > GraphiteSegMap; +typedef std::hash_multimap<size_t, GrSegRecord*> GraphiteRopeMap; +typedef std::pair<GraphiteRopeMap::iterator, GraphiteRopeMap::iterator> GrRMEntry; + +/** +* GraphiteSegmentCache contains the cached Segments for one particular font size +*/ +class GraphiteSegmentCache +{ +public: + enum { + // not really sure what good values are here, + // bucket size should be >> cache size + SEG_BUCKET_FACTOR = 4, + SEG_DEFAULT_CACHE_SIZE = 2047 + }; + GraphiteSegmentCache(sal_uInt32 nSegCacheSize) + : m_segMap(nSegCacheSize * SEG_BUCKET_FACTOR), + m_nSegCacheSize(nSegCacheSize), + m_oldestKey(NULL) {}; + ~GraphiteSegmentCache() + { + m_ropeMap.clear(); + GraphiteSegMap::iterator i = m_segMap.begin(); + while (i != m_segMap.end()) + { + GrSegRecord *r = i->second; + delete r; + ++i; + } + m_segMap.clear(); + }; + GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl, int segCharLimit) + { + GrSegRecord * found = NULL; + // try to find a segment starting at correct place, if not, try to find a + // match for the complete buffer + GraphiteSegMap::iterator iMap = + m_segMap.find(reinterpret_cast<long>(layoutArgs.mpStr + + layoutArgs.mnMinCharPos)); + if (iMap != m_segMap.end()) + { + found = iMap->second; + } + else + { + iMap = m_segMap.find(reinterpret_cast<long>(layoutArgs.mpStr)); + if (iMap != m_segMap.end()) + { + found = iMap->second; + } + } + if (found) + { + if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos && + found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos) + { + DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache"); + // restore original start character, in case it has changed + found->m_seg->setTextSourceOffset(found->m_startChar); + // check that characters are the same, at least in the range of + // interest + // We could use substr and ==, but substr does a copy, + // so its probably faster to do it like this + for (int i = layoutArgs.mnMinCharPos; i < segCharLimit; i++) + { + //if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter())) + if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i]) + return NULL; + } + if (found->isRtl() != bIsRtl) + { + return NULL; + } + if (found->m_seg->stopCharacter() > layoutArgs.mnEndCharPos && + static_cast<int>(found->char2BaseGlyph().size()) > layoutArgs.mnEndCharPos) + { + // check that the requested end character isn't mid cluster + if (found->char2BaseGlyph()[layoutArgs.mnEndCharPos-layoutArgs.mnMinCharPos] == -1) + { + return NULL; + } + } +// if (found->m_lockCount != 0) +// OutputDebugString("Multple users of SegRecord!"); + found->m_lockCount++; + } + else found = NULL; + } + else + { + // the pointers aren't the same, but we might still have the same text in a segment + // this is expecially needed when editing a large paragraph + // each edit changes the pointers, but if we don't reuse any segments it gets very + // slow. + rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos, + segCharLimit - layoutArgs.mnMinCharPos); + if (!rope) return NULL; + size_t nHash = (*(rope)).hashCode(); + GrRMEntry range = m_ropeMap.equal_range(nHash); + while (range.first != range.second) + { + found = range.first->second; + if (found->m_lockCount == 0) + { + if(rope->match(*(found->m_rope))) + { + // found, but the pointers are all wrong + found->m_seg->setTextSourceOffset(layoutArgs.mnMinCharPos); + // the switch is done in graphite_layout.cxx + //found->m_text->switchLayoutArgs(layoutArgs); + found->m_lockCount++; + break; + } + else + found = NULL; + } + else + found = NULL; + ++(range.first); + } + delete rope; + } + return found; + }; + GrSegRecord * cacheSegment(TextSourceAdaptor * adapter, gr::Segment * seg, bool bIsRtl); +private: + GraphiteSegMap m_segMap; + GraphiteRopeMap m_ropeMap; + sal_uInt32 m_nSegCacheSize; + const xub_Unicode * m_oldestKey; + const xub_Unicode * m_prevKey; +}; + +typedef std::hash_map<int, GraphiteSegmentCache *, std::hash<int> > GraphiteCacheMap; + +/** +* GraphiteCacheHandler maps a particular font, style, size to a GraphiteSegmentCache +*/ +class GraphiteCacheHandler +{ +public: + GraphiteCacheHandler() : m_cacheMap(255) + { + const char * pEnvCache = getenv( "SAL_GRAPHITE_CACHE_SIZE" ); + if (pEnvCache != NULL) + { + int envCacheSize = atoi(pEnvCache); + if (envCacheSize <= 0) + m_nSegCacheSize = GraphiteSegmentCache::SEG_DEFAULT_CACHE_SIZE; + else + { + m_nSegCacheSize = envCacheSize; + } + } + else + { + m_nSegCacheSize = GraphiteSegmentCache::SEG_DEFAULT_CACHE_SIZE; + } + }; + ~GraphiteCacheHandler() + { + GraphiteCacheMap::iterator i = m_cacheMap.begin(); + while (i != m_cacheMap.end()) + { + GraphiteSegmentCache *r = i->second; + delete r; + ++i; + } + m_cacheMap.clear(); + }; + + static GraphiteCacheHandler instance; + + GraphiteSegmentCache * getCache(sal_Int32 & fontHash) + { + if (m_cacheMap.count(fontHash) > 0) + { + return m_cacheMap.find(fontHash)->second; + } + GraphiteSegmentCache *pCache = new GraphiteSegmentCache(m_nSegCacheSize); + m_cacheMap[fontHash] = pCache; + return pCache; + } +private: + GraphiteCacheMap m_cacheMap; + sal_uInt32 m_nSegCacheSize; +}; + +#endif + diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx new file mode 100644 index 000000000000..47b8f062e299 --- /dev/null +++ b/vcl/inc/vcl/graphite_features.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// Description: +// Parse a string of features specified as ; separated pairs. +// e.g. +// 1001=1&2002=2&fav1=0 +#include <preextstl.h> +#include <graphite/GrClient.h> +#include <graphite/Font.h> +#include <graphite/GrFeature.h> +#include <postextstl.h> + +namespace grutils +{ + + class GrFeatureParser + { + public: + enum { MAX_FEATURES = 64 }; + static const char FEAT_PREFIX; + static const char FEAT_SEPARATOR; + static const char FEAT_ID_VALUE_SEPARATOR; + static const std::string ISO_LANG; + GrFeatureParser(gr::Font & font, const std::string features, const std::string lang); + GrFeatureParser(gr::Font & font, const std::string lang); + GrFeatureParser(const GrFeatureParser & copy); + ~GrFeatureParser(); + size_t getFontFeatures(gr::FeatureSetting settings[MAX_FEATURES]) const; + bool parseErrors() { return mbErrors; }; + static bool isValid(gr::Font & font, gr::FeatureSetting & setting); + gr::isocode getLanguage() const { return maLang; }; + bool hasLanguage() const { return (maLang.rgch[0] != '\0'); } + sal_Int32 hashCode() const; + private: + void setLang(gr::Font & font, const std::string & lang); + bool isCharId(const std::string & id, size_t offset, size_t length); + int getCharId(const std::string & id, size_t offset, size_t length); + int getIntValue(const std::string & id, size_t offset, size_t length); + size_t mnNumSettings; + gr::isocode maLang; + bool mbErrors; + gr::FeatureSetting maSettings[64]; + }; + + union FeatId + { + gr::featid num; + unsigned char label[5]; + }; +} diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx new file mode 100644 index 000000000000..cd22abdcdb26 --- /dev/null +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * 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_GRAPHITELAYOUT_HXX +#define _SV_GRAPHITELAYOUT_HXX +// Description: An implementation of the SalLayout interface that uses the +// Graphite engine. + +// We need this to enable namespace support in libgrengine headers. +#define GR_NAMESPACE + +#define GRCACHE 1 + +// Standard Library +#include <memory> +#include <vector> +#include <utility> +// Libraries +#include <preextstl.h> +#include <graphite/GrClient.h> +#include <graphite/Font.h> +#include <graphite/GrConstants.h> +#include <graphite/GrAppData.h> +#include <graphite/SegmentAux.h> +#include <postextstl.h> +// Platform +#include <vcl/sallayout.hxx> +#include <vcl/dllapi.h> +// Module + +// For backwards compatibility with 2.4.x +#if (SUPD == 680) +typedef sal_Int32 sal_GlyphId; +#endif + + +// Module type definitions and forward declarations. +// +class TextSourceAdaptor; +class GraphiteFontAdaptor; +class GrSegRecord; +// SAL/VCL types +class ServerFont; + +#ifdef WNT +// The GraphiteWinFont is just a wrapper to enable GrFontHasher to be a friend +// so that UniqueCacheInfo can be called. +#include <graphite/WinFont.h> +class GraphiteWinFont : public gr::WinFont +{ + friend class GrFontHasher; +public: + GraphiteWinFont(HDC hdc) : gr::WinFont(hdc) {}; + virtual ~GraphiteWinFont() {}; +}; +#endif +// Graphite types +namespace gr { class Segment; class GlyphIterator; } +namespace grutils { class GrFeatureParser; } + +// This class uses the SIL Graphite engine to provide complex text layout services to the VCL +// @author tse +// +class VCL_DLLPUBLIC GraphiteLayout : public SalLayout +{ +public: + // Mask to allow Word break status to be stored within mvChar2BaseGlyph + enum { + WORD_BREAK_BEFORE = 0x40000000, + HYPHEN_BREAK_BEFORE = 0x80000000, + BREAK_MASK = 0xC0000000, + GLYPH_INDEX_MASK = 0x3FFFFFFF + } LineBreakMask; + + class Glyphs : public std::vector<GlyphItem> + { + public: + typedef std::pair<Glyphs::const_iterator, Glyphs::const_iterator> iterator_pair_t; + + void fill_from(gr::Segment & rSeg, ImplLayoutArgs & rArgs, + bool bRtl, long &rWidth, float fScaling, + std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, + std::vector<int> & rCharDxs); + void move_glyph(Glyphs::iterator, long dx); + + const_iterator cluster_base(const_iterator) const; + iterator_pair_t neighbour_clusters(const_iterator) const; + private: + std::pair<float,float> appendCluster(gr::Segment & rSeg, ImplLayoutArgs & rArgs, + bool bRtl, float fSegmentAdvance, int nFirstCharInCluster, int nNextChar, + int nFirstGlyphInCluster, int nNextGlyph, float fScaling, + std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, + std::vector<int> & rCharDxs, long & rDXOffset); + void append(gr::Segment & rSeg, ImplLayoutArgs & rArgs, gr::GlyphInfo & rGi, float nextGlyphOrigin, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset, bool bIsBase); + }; + + mutable Glyphs mvGlyphs; + void clear(); + +private: + TextSourceAdaptor * mpTextSrc; // Text source. + gr::LayoutEnvironment maLayout; + const gr::Font &mrFont; + long mnWidth; + std::vector<int> mvCharDxs; + std::vector<int> mvChar2BaseGlyph; + std::vector<int> mvGlyph2Char; + float mfScaling; + const grutils::GrFeatureParser * mpFeatures; + +public: + GraphiteLayout(const gr::Font & font, const grutils::GrFeatureParser * features = NULL) throw(); + + // used by upper layers + virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout + // split into two stages to allow dc to be restored on the segment +#ifdef GRCACHE + gr::Segment * CreateSegment(ImplLayoutArgs& rArgs, GrSegRecord ** pRecord = NULL); + bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment, GrSegRecord * pSegRecord); +#else + gr::Segment * CreateSegment(ImplLayoutArgs& rArgs); + bool LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment); +#endif + + virtual void AdjustLayout( ImplLayoutArgs& ); // adjusting positions + + // methods using string indexing + virtual int GetTextBreak( long nMaxWidth, long nCharExtra=0, int nFactor=1 ) const; + virtual long FillDXArray( sal_Int32* pDXArray ) const; + virtual void ApplyDXArray(ImplLayoutArgs &rArgs, std::vector<int> & rDeltaWidth); + + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const; + + // methods using glyph indexing + virtual int GetNextGlyphs(int nLen, sal_GlyphId* pGlyphIdxAry, ::Point & rPos, int&, + sal_Int32* pGlyphAdvAry = 0, int* pCharPosAry = 0 ) const; + + // used by glyph+font+script fallback + virtual void MoveGlyph( int nStart, long nNewXPos ); + virtual void DropGlyph( int nStart ); + virtual void Simplify( bool bIsBase ); + + // Dummy implementation so layout can be shared between Linux/Windows + virtual void DrawText(SalGraphics&) const {}; + + virtual ~GraphiteLayout() throw(); + void SetFeatures(grutils::GrFeatureParser * aFeature) { mpFeatures = aFeature; } + void SetFontScale(float s) { mfScaling = s; }; + const TextSourceAdaptor * textSrc() const { return mpTextSrc; }; + virtual sal_GlyphId getKashidaGlyph(int & width) = 0; + void kashidaJustify(std::vector<int> & rDeltaWidth, sal_GlyphId, int width); + + static const int EXTRA_CONTEXT_LENGTH; +private: + int glyph_to_char(Glyphs::iterator); + std::pair<int,int> glyph_to_chars(const GlyphItem &) const; + + std::pair<long,long> caret_positions(size_t) const; + void expandOrCondense(ImplLayoutArgs &rArgs); +}; + + + +#endif // _SV_GRAPHITELAYOUT_HXX diff --git a/vcl/inc/vcl/graphite_serverfont.hxx b/vcl/inc/vcl/graphite_serverfont.hxx new file mode 100644 index 000000000000..19eb70b11908 --- /dev/null +++ b/vcl/inc/vcl/graphite_serverfont.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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_GRAPHITESERVERFONT_HXX +#define _SV_GRAPHITESERVERFONT_HXX + +// We need this to enable namespace support in libgrengine headers. +#define GR_NAMESPACE + +#ifndef MSC +#include <vcl/graphite_layout.hxx> +#include <vcl/graphite_adaptors.hxx> + +// Modules + +class VCL_DLLPUBLIC GraphiteLayoutImpl : public GraphiteLayout +{ +public: + GraphiteLayoutImpl(const gr::Font & font, const grutils::GrFeatureParser * features, GraphiteFontAdaptor * pFont) throw() + : GraphiteLayout(font, features), mpFont(pFont) {}; + virtual ~GraphiteLayoutImpl() throw() {}; + virtual sal_GlyphId getKashidaGlyph(int & width); +private: + GraphiteFontAdaptor * mpFont; +}; + +// This class implments the server font specific parts. +// @author tse +// +class VCL_DLLPUBLIC GraphiteServerFontLayout : public ServerFontLayout +{ +private: + mutable GraphiteFontAdaptor * mpFont; + // mutable so that the DrawOffset/DrawBase can be set + mutable GraphiteLayoutImpl maImpl; +public: + GraphiteServerFontLayout(GraphiteFontAdaptor * font) throw(); + + virtual bool LayoutText( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); return maImpl.LayoutText(rArgs); }; // first step of layout + virtual void AdjustLayout( ImplLayoutArgs& rArgs) + { + SalLayout::AdjustLayout(rArgs); + maImpl.DrawBase() = maDrawBase; + maImpl.DrawOffset() = maDrawOffset; + maImpl.AdjustLayout(rArgs); + }; + virtual long GetTextWidth() const { return maImpl.GetTextWidth(); } + virtual long FillDXArray( sal_Int32* dxa ) const { return maImpl.FillDXArray(dxa); } + virtual int GetTextBreak( long mw, long ce, int f ) const { return maImpl.GetTextBreak(mw, ce, f); } + virtual void GetCaretPositions( int as, sal_Int32* cxa ) const { maImpl.GetCaretPositions(as, cxa); } + + // used by display layers + virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s, + sal_Int32* gaa = NULL, int* cpa = NULL ) const + { + maImpl.DrawBase() = maDrawBase; + maImpl.DrawOffset() = maDrawOffset; + return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa); + } + + virtual void MoveGlyph( int nStart, long nNewXPos ) { maImpl.MoveGlyph(nStart, nNewXPos); }; + virtual void DropGlyph( int nStart ) { maImpl.DropGlyph(nStart); }; + virtual void Simplify( bool bIsBase ) { maImpl.Simplify(bIsBase); }; + + virtual ~GraphiteServerFontLayout() throw(); + +// For use with PspGraphics + const sal_Unicode* getTextPtr() const; + int getMinCharPos() const { return mnMinCharPos; } + int getMaxCharPos() const { return mnEndCharPos; } +}; + + + +#endif +#endif //_SV_GRAPHITESERVERFONT_HXX diff --git a/vcl/inc/vcl/group.hxx b/vcl/inc/vcl/group.hxx new file mode 100644 index 000000000000..48461ec18ac0 --- /dev/null +++ b/vcl/inc/vcl/group.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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_GROUP_HXX +#define _SV_GROUP_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> + +// ------------ +// - GroupBox - +// ------------ + +class VCL_DLLPUBLIC GroupBox : public Control +{ +private: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, + const Point& rPos, const Size& rSize, bool bLayout = false ); + + virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + +public: + GroupBox( Window* pParent, WinBits nStyle = 0 ); + GroupBox( Window* pParent, const ResId& rResId ); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; + +#endif // _SV_GROUP_HXX diff --git a/vcl/inc/vcl/hatch.hxx b/vcl/inc/vcl/hatch.hxx new file mode 100644 index 000000000000..5a8e36088f2e --- /dev/null +++ b/vcl/inc/vcl/hatch.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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_HATCH_HXX +#define _SV_HATCH_HXX + +#include <tools/color.hxx> +#include <vcl/dllapi.h> + +#include <vcl/vclenum.hxx> + +// -------------- +// - Impl_Hatch - +// -------------- + +class SvStream; + +struct ImplHatch +{ + ULONG mnRefCount; + Color maColor; + HatchStyle meStyle; + long mnDistance; + USHORT mnAngle; + + ImplHatch(); + ImplHatch( const ImplHatch& rImplHatch ); + + friend SvStream& operator>>( SvStream& rIStm, ImplHatch& rImplHatch ); + friend SvStream& operator<<( SvStream& rOStm, const ImplHatch& rImplHatch ); +}; + +// --------- +// - Hatch - +// --------- + +class VCL_DLLPUBLIC Hatch +{ +private: + + ImplHatch* mpImplHatch; + SAL_DLLPRIVATE void ImplMakeUnique(); + +public: + + Hatch(); + Hatch( const Hatch& rHatch ); + Hatch( HatchStyle eStyle, const Color& rHatchColor, long nDistance, USHORT nAngle10 = 0 ); + ~Hatch(); + + Hatch& operator=( const Hatch& rHatch ); + BOOL operator==( const Hatch& rHatch ) const; + BOOL operator!=( const Hatch& rHatch ) const { return !(Hatch::operator==( rHatch ) ); } + BOOL IsSameInstance( const Hatch& rHatch ) const { return( mpImplHatch == rHatch.mpImplHatch ); } + + void SetStyle( HatchStyle eStyle ); + HatchStyle GetStyle() const { return mpImplHatch->meStyle; } + + void SetColor( const Color& rColor ); + const Color& GetColor() const { return mpImplHatch->maColor; } + + void SetDistance( long nDistance ); + long GetDistance() const { return mpImplHatch->mnDistance; } + + void SetAngle( USHORT nAngle10 ); + USHORT GetAngle() const { return mpImplHatch->mnAngle; } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Hatch& rHatch ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch ); +}; + +#endif // _SV_HATCH_HXX diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx new file mode 100644 index 000000000000..30308aa8a723 --- /dev/null +++ b/vcl/inc/vcl/help.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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_HELP_HXX +#define _SV_HELP_HXX + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +class Point; +class Rectangle; +class Window; + +// -------------- +// - Help-Types - +// -------------- + +#define QUICKHELP_LEFT ((USHORT)0x0001) +#define QUICKHELP_CENTER ((USHORT)0x0002) +#define QUICKHELP_RIGHT ((USHORT)0x0004) +#define QUICKHELP_TOP ((USHORT)0x0008) +#define QUICKHELP_VCENTER ((USHORT)0x0010) +#define QUICKHELP_BOTTOM ((USHORT)0x0020) +#define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM) +#define QUICKHELP_CTRLTEXT ((USHORT)0x0040) +#define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000) +#define QUICKHELP_BIDI_RTL ((USHORT)0x8000) + +// By changes you must also change: rsc/vclrsc.hxx +#define OOO_HELP_INDEX ((ULONG)0xFFFFFFFF) +#define OOO_HELP_HELPONHELP ((ULONG)0xFFFFFFFE) + +// -------- +// - Help - +// -------- + +class VCL_DLLPUBLIC Help +{ +private: + String maHelpFile; + +public: + Help(); + virtual ~Help(); + + void SetHelpFile( const String& rFileName ) { maHelpFile = rFileName; } + const String& GetHelpFile() const { return maHelpFile; } + + virtual BOOL Start( ULONG nHelpId, const Window* pWindow ); + virtual BOOL Start( const XubString& rKeyWord, const Window* pWindow ); + virtual void OpenHelpAgent( ULONG nHelpId ); + virtual XubString GetHelpText( ULONG nHelpId, const Window* pWindow ); + virtual XubString GetHelpText( const String& aHelpURL, const Window* pWindow ); + + static void EnableContextHelp(); + static void DisableContextHelp(); + static BOOL IsContextHelpEnabled(); + static BOOL StartContextHelp(); + + static void EnableExtHelp(); + static void DisableExtHelp(); + static BOOL IsExtHelpEnabled(); + static BOOL StartExtHelp(); + static BOOL EndExtHelp(); + static BOOL IsExtHelpActive(); + + static void EnableBalloonHelp(); + static void DisableBalloonHelp(); + static BOOL IsBalloonHelpEnabled(); + static BOOL ShowBalloon( Window* pParent, + const Point& rScreenPos, + const XubString& rHelpText ); + static BOOL ShowBalloon( Window* pParent, + const Point& rScreenPos, + const Rectangle&, + const XubString& rHelpText ); + + static void EnableQuickHelp(); + static void DisableQuickHelp(); + static BOOL IsQuickHelpEnabled(); + static BOOL ShowQuickHelp( Window* pParent, + const Rectangle& rScreenRect, + const XubString& rHelpText, + const XubString& rLongHelpText, + USHORT nStyle = 0 ); + static BOOL ShowQuickHelp( Window* pParent, + const Rectangle& rScreenRect, + const XubString& rHelpText, + USHORT nStyle = 0 ) + { return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, XubString(), nStyle ); } + + static ULONG ShowTip( Window* pParent, + const Rectangle& rScreenRect, + const XubString& rText, USHORT nStyle = 0 ); + static void HideTip( ULONG nId ); +}; + +#endif // _SV_HELP_HXX diff --git a/vcl/inc/vcl/helper.hxx b/vcl/inc/vcl/helper.hxx new file mode 100644 index 000000000000..9047079f6be1 --- /dev/null +++ b/vcl/inc/vcl/helper.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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 _PSPRINT_HELPER_HXX_ +#define _PSPRINT_HELPER_HXX_ + +#include <list> + +#include "vcl/dllapi.h" + +#include "rtl/ustring.hxx" + + +// forwards +namespace osl { class File; } + +namespace psp { +typedef int fontID; + +void VCL_DLLPUBLIC getPrinterPathList( std::list< rtl::OUString >& rPathList, const char* pSubDir ); + +// note: gcc 3.4.1 warns about visibility if we retunr a const rtl::OUString& here +// seems to be a bug in gcc, now we return an object instead of a reference +rtl::OUString VCL_DLLPUBLIC getFontPath(); + +bool VCL_DLLPUBLIC convertPfbToPfa( osl::File& rInFile, osl::File& rOutFile ); + +// normalized path (equivalent to realpath) +void VCL_DLLPUBLIC normPath( rtl::OString& rPath ); + +// splits rOrgPath into dirname and basename +// rOrgPath will be subject to normPath +void VCL_DLLPUBLIC splitPath( rtl::OString& rOrgPath, rtl::OString& rDir, rtl::OString& rBase ); + +enum whichOfficePath { NetPath, UserPath, ConfigPath }; +// note: gcc 3.4.1 warns about visibility if we retunr a const rtl::OUString& here +// seems to be a bug in gcc, now we return an object instead of a reference +rtl::OUString VCL_DLLPUBLIC getOfficePath( enum whichOfficePath ePath ); +} // namespace + +#endif // _PSPRINT_HELPER_HXX_ diff --git a/vcl/inc/vcl/helpwin.hxx b/vcl/inc/vcl/helpwin.hxx new file mode 100644 index 000000000000..244ae1b7d846 --- /dev/null +++ b/vcl/inc/vcl/helpwin.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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_HELPWIN_HXX +#define _SV_HELPWIN_HXX + +#include <vcl/floatwin.hxx> +#include <vcl/timer.hxx> + +// ------------------ +// - HelpTextWindow - +// ------------------ + +class HelpTextWindow : public FloatingWindow +{ +private: + Point maPos; + Rectangle maHelpArea; // Wenn naechste Hilfe fuers gleiche Rectangle, gleicher Text, dann Fenster stehen lassen + + Rectangle maTextRect; // Bei umgebrochenen Text in QuickHelp + + String maHelpText; + String maStatusText; + + Timer maShowTimer; + Timer maHideTimer; + + USHORT mnHelpWinStyle; + USHORT mnStyle; + +protected: + DECL_LINK( TimerHdl, Timer* ); + virtual void Paint( const Rectangle& ); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual String GetText() const; + void ImplShow(); + +public: + HelpTextWindow( Window* pParent, const String& rText, USHORT nHelpWinStyle, USHORT nStyle ); + ~HelpTextWindow(); + + const String& GetHelpText() const { return maHelpText; } + void SetHelpText( const String& rHelpText ); + USHORT GetWinStyle() const { return mnHelpWinStyle; } + + // Nur merken: + void SetStatusText( const String& rStatusText ) { maStatusText = rStatusText; } + void SetHelpArea( const Rectangle& rRect ) { maHelpArea = rRect; } + + void ShowHelp( USHORT nDelayMode ); + + Size CalcOutSize() const; + const Rectangle& GetHelpArea() const { return maHelpArea; } + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + + BOOL RegisterAccessibleParent(); + void RevokeAccessibleParent(); +}; + +void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle, + const String& rHelpText, const String& rStatusText, + const Point& rScreenPos, const Rectangle* pHelpArea = NULL ); +void ImplDestroyHelpWindow( bool bUpdateHideTime ); +void ImplSetHelpWindowPos( Window* pHelpWindow, USHORT nHelpWinStyle, USHORT nStyle, + const Point& rPos, const Rectangle* pHelpArea ); + +#endif // _SV_HELPWIN_HXX diff --git a/vcl/inc/vcl/i18nhelp.hxx b/vcl/inc/vcl/i18nhelp.hxx new file mode 100644 index 000000000000..8f6a12f95761 --- /dev/null +++ b/vcl/inc/vcl/i18nhelp.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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_I18NHELP_HXX +#define _VCL_I18NHELP_HXX + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/lang/Locale.hpp> +#include <osl/mutex.hxx> +#include <tools/string.hxx> +#include <vcl/dllapi.h> + +namespace com { +namespace sun { +namespace star { +namespace lang { + class XMultiServiceFactory; +} +}}} + +namespace utl { + class TransliterationWrapper; +} + +class LocaleDataWrapper; + +class Date; + +namespace vcl +{ + +class VCL_DLLPUBLIC I18nHelper +{ +private: + ::osl::Mutex maMutex; + ::com::sun::star::lang::Locale maLocale; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; + + LocaleDataWrapper* mpLocaleDataWrapper; + utl::TransliterationWrapper* mpTransliterationWrapper; + + sal_Bool mbTransliterateIgnoreCase; + + SAL_DLLPRIVATE void ImplDestroyWrappers(); + +protected: + ::osl::Mutex& GetMutex() { return maMutex; } + + SAL_DLLPRIVATE utl::TransliterationWrapper& ImplGetTransliterationWrapper() const; + SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const; + +public: + + I18nHelper( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, const ::com::sun::star::lang::Locale& rLocale ); + ~I18nHelper(); + + const ::com::sun::star::lang::Locale& getLocale() const; + + sal_Int32 CompareString( const String& rStr1, const String& rStr2 ) const; + + sal_Bool MatchString( const String& rStr1, const String& rStr2 ) const; + sal_Bool MatchMnemonic( const String& rString, sal_Unicode cMnemonicChar ) const; + + String GetDate( const Date& rDate ) const; + String GetNum( long nNumber, USHORT nDecimals, BOOL bUseThousandSep = TRUE, BOOL bTrailingZeros = TRUE ) const; + + static String filterFormattingChars( const String& ); +}; + +} // namespace vcl + +#endif // _VCL_I18NHELP_HXX + diff --git a/vcl/inc/vcl/idlemgr.hxx b/vcl/inc/vcl/idlemgr.hxx new file mode 100644 index 000000000000..6d7d7c8e531f --- /dev/null +++ b/vcl/inc/vcl/idlemgr.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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_IDLEMGR_HXX +#define _SV_IDLEMGR_HXX + +#include <vcl/sv.h> +#include <vcl/timer.hxx> + +class ImplIdleList; + +// --------------- +// - ImplIdleMgr - +// --------------- + +class ImplIdleMgr +{ +private: + ImplIdleList* mpIdleList; + AutoTimer maTimer; + +public: + ImplIdleMgr(); + ~ImplIdleMgr(); + + BOOL InsertIdleHdl( const Link& rLink, USHORT nPriority ); + void RemoveIdleHdl( const Link& rLink ); + + void RestartIdler() + { if ( maTimer.IsActive() ) maTimer.Start(); } + + // Timer* kann auch NULL sein + DECL_LINK( TimeoutHdl, Timer* ); +}; + +#endif // _SV_IDLEMGR_HXX diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx new file mode 100644 index 000000000000..ac278f76f65b --- /dev/null +++ b/vcl/inc/vcl/ilstbox.hxx @@ -0,0 +1,643 @@ +/************************************************************************* + * + * 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_ILSTBOX_HXX +#define _SV_ILSTBOX_HXX + +#include <vcl/sv.h> +#include <vcl/image.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/button.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/lstbox.h> +#include <vcl/timer.hxx> + + +class ScrollBar; +class ScrollBarBox; + +// ----------------- +// - ListBox-Types - +// ----------------- + +#define HORZ_SCROLL 4 +#define IMG_TXT_DISTANCE 6 + +enum LB_EVENT_TYPE +{ + LET_MBDOWN, + LET_TRACKING, + LET_TRACKING_END, + LET_KEYMOVE, + LET_KEYSPACE +}; + +// ----------------- +// - ImplEntryType - +// ----------------- + +struct ImplEntryType +{ + XubString maStr; + Image maImage; + void* mpUserData; + BOOL mbIsSelected; + long mnFlags; + long mnHeight; + + ImplEntryType( const XubString& rStr, const Image& rImage ) : + maStr( rStr ), + maImage( rImage ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = FALSE; + mpUserData = NULL; + } + + ImplEntryType( const XubString& rStr ) : + maStr( rStr ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = FALSE; + mpUserData = NULL; + } + + ImplEntryType( const Image& rImage ) : + maImage( rImage ), + mnFlags( 0 ), + mnHeight( 0 ) + { + mbIsSelected = FALSE; + mpUserData = NULL; + } +}; + +// ----------------- +// - ImplEntryList - +// ----------------- + +class ImplEntryList : private List +{ +private: + Window* mpWindow; // For getting the current locale when matching strings + USHORT mnLastSelected; + USHORT mnSelectionAnchor; + USHORT mnImages; + + USHORT mnMRUCount; + USHORT mnMaxMRUCount; + + Link maSelectionChangedHdl; + BOOL mbCallSelectionChangedHdl; + + ImplEntryType* GetEntry( USHORT nPos ) const { return (ImplEntryType*)List::GetObject( nPos ); } + +public: + ImplEntryList( Window* pWindow ); + ~ImplEntryList(); + + USHORT InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL bSort ); + void RemoveEntry( USHORT nPos ); + const ImplEntryType* GetEntryPtr( USHORT nPos ) const { return (const ImplEntryType*) GetObject( nPos ); } + ImplEntryType* GetMutableEntryPtr( USHORT nPos ) const { return (ImplEntryType*) GetObject( nPos ); } + void Clear(); + + USHORT FindMatchingEntry( const XubString& rStr, USHORT nStart = 0, BOOL bForward = TRUE, BOOL bLazy = TRUE ) const; + USHORT FindEntry( const XubString& rStr, BOOL bSearchMRUArea = FALSE ) const; + USHORT FindEntry( const void* pData ) const; + + // helper: add up heights up to index nEndIndex. + // GetAddedHeight( 0 ) returns 0 + // GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) returns 0 + // GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i ) + long GetAddedHeight( USHORT nEndIndex, USHORT nBeginIndex = 0, long nBeginHeight = 0 ) const; + long GetEntryHeight( USHORT nPos ) const; + + USHORT GetEntryCount() const { return (USHORT)List::Count(); } + BOOL HasImages() const { return mnImages ? TRUE : FALSE; } + + XubString GetEntryText( USHORT nPos ) const; + + BOOL HasEntryImage( USHORT nPos ) const; + Image GetEntryImage( USHORT nPos ) const; + + void SetEntryData( USHORT nPos, void* pNewData ); + void* GetEntryData( USHORT nPos ) const; + + void SetEntryFlags( USHORT nPos, long nFlags ); + long GetEntryFlags( USHORT nPos ) const; + + void SelectEntry( USHORT nPos, BOOL bSelect ); + + USHORT GetSelectEntryCount() const; + XubString GetSelectEntry( USHORT nIndex ) const; + USHORT GetSelectEntryPos( USHORT nIndex ) const; + BOOL IsEntrySelected( const XubString& rStr ) const; + BOOL IsEntryPosSelected( USHORT nIndex ) const; + + void SetLastSelected( USHORT nPos ) { mnLastSelected = nPos; } + USHORT GetLastSelected() const { return mnLastSelected; } + + void SetSelectionAnchor( USHORT nPos ) { mnSelectionAnchor = nPos; } + USHORT GetSelectionAnchor() const { return mnSelectionAnchor; } + + + void SetSelectionChangedHdl( const Link& rLnk ) { maSelectionChangedHdl = rLnk; } + void SetCallSelectionChangedHdl( BOOL bCall ) { mbCallSelectionChangedHdl = bCall; } + + void SetMRUCount( USHORT n ) { mnMRUCount = n; } + USHORT GetMRUCount() const { return mnMRUCount; } + + void SetMaxMRUCount( USHORT n ) { mnMaxMRUCount = n; } + USHORT GetMaxMRUCount() const { return mnMaxMRUCount; } + + /** An Entry is selectable if its mnFlags does not have the + LISTBOX_ENTRY_FLAG_DISABLE_SELECTION flag set. */ + bool IsEntrySelectable( USHORT nPos ) const; + + /** returns the first entry found from the given position nPos that is selectable + or LISTBOX_ENTRY_NOTFOUND if non is found. If the entry at nPos is not selectable, + it returns the first selectable entry after nPos if bForward is true and the + first selectable entry after nPos is bForward is false. + */ + USHORT FindFirstSelectable( USHORT nPos, bool bForward = true ); +}; + +// --------------------- +// - ImplListBoxWindow - +// --------------------- + +class ImplListBoxWindow : public Control +{ +private: + ImplEntryList* mpEntryList; // EntryListe + Rectangle maFocusRect; + String maSearchStr; + Timer maSearchTimeout; + + Size maUserItemSize; + + long mnMaxTxtHeight; // Maximale Hoehe eines Text-Items + long mnMaxTxtWidth; // Maximale Breite eines Text-Items + // Entry ohne Image + long mnMaxImgTxtWidth;// Maximale Breite eines Text-Items + // Entry UND Image + long mnMaxImgWidth; // Maximale Breite eines Image-Items + long mnMaxImgHeight; // Maximale Hoehe eines Image-Items + long mnMaxWidth; // Maximale Breite eines Eintrags + long mnMaxHeight; // Maximale Hoehe eines Eintrags + + USHORT mnCurrentPos; // Position (Focus) + USHORT mnTrackingSaveSelection; // Selektion vor Tracking(); + + USHORT mnSeparatorPos; // Separator + + USHORT mnUserDrawEntry; + + USHORT mnTop; // Ausgabe ab Zeile + long mnLeft; // Ausgabe ab Spalte + long mnBorder; // Abstand Rahmen - Text + long mnTextHeight; // Texthoehe + ProminentEntry meProminentType; // where is the "prominent" entry + + USHORT mnSelectModifier; // Modifiers + + BOOL mbHasFocusRect: 1, + mbSort: 1, // ListBox sortiert + mbTrack: 1, // Tracking + mbMulti: 1, // MultiListBox + mbStackMode: 1, // StackSelection + mbSimpleMode: 1, // SimpleMode fuer MultiListBox + mbImgsDiffSz: 1, // Images haben verschiedene Groessen + mbTravelSelect: 1, // TravelSelect + mbTrackingSelect: 1, // Selektiert bei MouseMove + mbSelectionChanged: 1, // Select() nicht zu oft rufen... + mbMouseMoveSelect: 1, // Selektieren bei MouseMove + mbGrabFocus: 1, // Focus bei MBDown grabben + mbUserDrawEnabled: 1, // UserDraw possible + mbInUserDraw: 1, // In UserDraw + mbReadOnly: 1, // ReadOnly + mbMirroring: 1, // pb: #106948# explicit mirroring for calc + mbRight: 1, // right align Text output + mbCenter: 1; // center Text output + + Link maScrollHdl; + Link maSelectHdl; + Link maCancelHdl; + Link maDoubleClickHdl; + Link maUserDrawHdl; + Link maMRUChangedHdl; + +protected: + DECL_LINK( SearchStringTimeout, Timer* ); + + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + + BOOL SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL bShift = FALSE, BOOL bCtrl = FALSE ); + void ImplPaint( USHORT nPos, BOOL bErase = FALSE, bool bLayout = false ); + void ImplDoPaint( const Rectangle& rRect, bool bLayout = false ); + void ImplCalcMetrics(); + void ImplUpdateEntryMetrics( ImplEntryType& rEntry ); + void ImplCallSelect(); + + void ImplShowFocusRect(); + void ImplHideFocusRect(); + + + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +public: + virtual void FillLayoutData() const; + + ImplListBoxWindow( Window* pParent, WinBits nWinStyle ); + ~ImplListBoxWindow(); + + ImplEntryList* GetEntryList() const { return mpEntryList; } + + USHORT InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ); + void RemoveEntry( USHORT nPos ); + void Clear(); + void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; } + USHORT GetCurrentPos() const { return mnCurrentPos; } + USHORT GetDisplayLineCount() const; + void SetEntryFlags( USHORT nPos, long nFlags ); + + void DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos = FALSE, bool bLayout = false ); + + void SelectEntry( USHORT nPos, BOOL bSelect ); + void DeselectAll(); + USHORT GetEntryPosForPoint( const Point& rPoint ) const; + USHORT GetLastVisibleEntry() const; + + BOOL ProcessKeyInput( const KeyEvent& rKEvt ); + + void SetTopEntry( USHORT nTop ); + USHORT GetTopEntry() const { return mnTop; } + // ShowProminentEntry will set the entry correspoding to nEntryPos + // either at top or in the middle depending on the chosen style + void ShowProminentEntry( USHORT nEntryPos ); + void SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; } + ProminentEntry GetProminentEntryType() const { return meProminentType; } + using Window::IsVisible; + BOOL IsVisible( USHORT nEntry ) const; + + long GetLeftIndent() const { return mnLeft; } + void SetLeftIndent( long n ); + void ScrollHorz( long nDiff ); + + void AllowGrabFocus( BOOL b ) { mbGrabFocus = b; } + BOOL IsGrabFocusAllowed() const { return mbGrabFocus; } + + void SetSeparatorPos( USHORT n ) { mnSeparatorPos = n; } + USHORT GetSeparatorPos() const { return mnSeparatorPos; } + + void SetTravelSelect( BOOL bTravelSelect ) { mbTravelSelect = bTravelSelect; } + BOOL IsTravelSelect() const { return mbTravelSelect; } + BOOL IsTrackingSelect() const { return mbTrackingSelect; } + + void SetUserItemSize( const Size& rSz ); + const Size& GetUserItemSize() const { return maUserItemSize; } + + void EnableUserDraw( BOOL bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + BOOL IsUserDrawEnabled() const { return mbUserDrawEnabled; } + + void EnableMultiSelection( BOOL bMulti, BOOL bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; } + BOOL IsMultiSelectionEnabled() const { return mbMulti; } + + void SetMultiSelectionSimpleMode( BOOL bSimple ) { mbSimpleMode = bSimple; } + BOOL IsMultiSelectionSimpleMode() const { return mbSimpleMode; } + + void EnableMouseMoveSelect( BOOL bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; } + BOOL IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect; } + BOOL IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; } + + Size CalcSize( USHORT nMaxLines ) const; + Rectangle GetBoundingRectangle( USHORT nItem ) const; + + long GetEntryHeight() const { return mnMaxHeight; } + long GetMaxEntryWidth() const { return mnMaxWidth; } + + void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; } + const Link& GetScrollHdl() const { return maScrollHdl; } + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + void SetCancelHdl( const Link& rLink ) { maCancelHdl = rLink; } + const Link& GetCancelHdl() const { return maCancelHdl; } + void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } + const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; } + const Link& GetUserDrawHdl() const { return maUserDrawHdl; } + void SetMRUChangedHdl( const Link& rLink ) { maMRUChangedHdl = rLink; } + const Link& GetMRUChangedHdl() const { return maMRUChangedHdl; } + + BOOL IsSelectionChanged() const { return mbSelectionChanged; } + USHORT GetSelectModifier() const { return mnSelectModifier; } + + void EnableSort( BOOL b ) { mbSort = b; } + + void SetReadOnly( BOOL bReadOnly ) { mbReadOnly = bReadOnly; } + BOOL IsReadOnly() const { return mbReadOnly; } + + using Control::ImplInitSettings; + void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + USHORT ImplGetTextStyle() const; + + // pb: #106948# explicit mirroring for calc + inline void EnableMirroring() { mbMirroring = TRUE; } + inline BOOL IsMirroring() const { return mbMirroring; } +}; + +// --------------- +// - ImplListBox - +// --------------- + +class ImplListBox : public Control +{ +private: + ImplListBoxWindow maLBWindow; + ScrollBar* mpHScrollBar; + ScrollBar* mpVScrollBar; + ScrollBarBox* mpScrollBarBox; + BOOL mbVScroll : 1, // VScroll an oder aus + mbHScroll : 1, // HScroll an oder aus + mbAutoHScroll : 1; // AutoHScroll an oder aus + Link maScrollHdl; // Weil der vom ImplListBoxWindow selbst benoetigt wird. + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; + +protected: + virtual void GetFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + long Notify( NotifyEvent& rNEvt ); + + void ImplResizeControls(); + void ImplCheckScrollBars(); + void ImplInitScrollBars(); + + DECL_LINK( ScrollBarHdl, ScrollBar* ); + DECL_LINK( LBWindowScrolled, void* ); + DECL_LINK( MRUChanged, void* ); + +public: + ImplListBox( Window* pParent, WinBits nWinStyle ); + ~ImplListBox(); + + const ImplEntryList* GetEntryList() const { return maLBWindow.GetEntryList(); } + ImplListBoxWindow* GetMainWindow() { return &maLBWindow; } + + virtual void Resize(); + virtual const Wallpaper& GetDisplayBackground() const; + virtual Window* GetPreferredKeyInputWindow(); + + USHORT InsertEntry( USHORT nPos, const XubString& rStr ); + USHORT InsertEntry( USHORT nPos, const Image& rImage ); + USHORT InsertEntry( USHORT nPos, const XubString& rStr, const Image& rImage ); + void RemoveEntry( USHORT nPos ); + void SetEntryData( USHORT nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); } + void Clear(); + + void SetEntryFlags( USHORT nPos, long nFlags ); + long GetEntryFlags( USHORT nPos ) const; + + void SelectEntry( USHORT nPos, BOOL bSelect ); + void SetNoSelection(); + void ResetCurrentPos() { maLBWindow.ResetCurrentPos(); } + USHORT GetCurrentPos() const { return maLBWindow.GetCurrentPos(); } + + BOOL ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow.ProcessKeyInput( rKEvt ); } + BOOL HandleWheelAsCursorTravel( const CommandEvent& rCEvt ); + + void SetSeparatorPos( USHORT n ) { maLBWindow.SetSeparatorPos( n ); } + USHORT GetSeparatorPos() const { return maLBWindow.GetSeparatorPos(); } + + void SetTopEntry( USHORT nTop ) { maLBWindow.SetTopEntry( nTop ); } + USHORT GetTopEntry() const { return maLBWindow.GetTopEntry(); } + void ShowProminentEntry( USHORT nPos ) { maLBWindow.ShowProminentEntry( nPos ); } + using Window::IsVisible; + BOOL IsVisible( USHORT nEntry ) const { return maLBWindow.IsVisible( nEntry ); } + + void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); } + ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); } + + long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); } + void SetLeftIndent( USHORT n ) { maLBWindow.SetLeftIndent( n ); } + void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); } + + void SetTravelSelect( BOOL bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); } + BOOL IsTravelSelect() const { return maLBWindow.IsTravelSelect(); } + BOOL IsTrackingSelect() const { return maLBWindow.IsTrackingSelect(); } + + void EnableMultiSelection( BOOL bMulti, BOOL bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); } + BOOL IsMultiSelectionEnabled() const { return maLBWindow.IsMultiSelectionEnabled(); } + + void SetMultiSelectionSimpleMode( BOOL bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); } + BOOL IsMultiSelectionSimpleMode() const { return maLBWindow.IsMultiSelectionSimpleMode(); } + + void SetReadOnly( BOOL b ) { maLBWindow.SetReadOnly( b ); } + BOOL IsReadOnly() const { return maLBWindow.IsReadOnly(); } + + + Size CalcSize( USHORT nMaxLines ) const { return maLBWindow.CalcSize( nMaxLines ); } + long GetEntryHeight() const { return maLBWindow.GetEntryHeight(); } + long GetMaxEntryWidth() const { return maLBWindow.GetMaxEntryWidth(); } + + void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; } + const Link& GetScrollHdl() const { return maScrollHdl; } + void SetSelectHdl( const Link& rLink ) { maLBWindow.SetSelectHdl( rLink ); } + const Link& GetSelectHdl() const { return maLBWindow.GetSelectHdl(); } + void SetCancelHdl( const Link& rLink ) { maLBWindow.SetCancelHdl( rLink ); } + const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); } + void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); } + const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); } + void SetUserDrawHdl( const Link& rLink ) { maLBWindow.SetUserDrawHdl( rLink ); } + const Link& GetUserDrawHdl() const { return maLBWindow.GetUserDrawHdl(); } + + void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); } + void SetCallSelectionChangedHdl( BOOL bCall ) { maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); } + BOOL IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); } + USHORT GetSelectModifier() const { return maLBWindow.GetSelectModifier(); } + + void SetMRUEntries( const XubString& rEntries, xub_Unicode cSep ); + XubString GetMRUEntries( xub_Unicode cSep ) const; + void SetMaxMRUCount( USHORT n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); } + USHORT GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); } + USHORT GetDisplayLineCount() const + { return maLBWindow.GetDisplayLineCount(); } + + // pb: #106948# explicit mirroring for calc + inline void EnableMirroring() { maLBWindow.EnableMirroring(); } + inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; } +}; + +// ----------------------------- +// - ImplListBoxFloatingWindow - +// ----------------------------- + +class ImplListBoxFloatingWindow : public FloatingWindow +{ +private: + ImplListBox* mpImplLB; + Size maPrefSz; + USHORT mnDDLineCount; + USHORT mnPopupModeStartSaveSelection; + BOOL mbAutoWidth; + +protected: + long PreNotify( NotifyEvent& rNEvt ); + +public: + ImplListBoxFloatingWindow( Window* pParent ); + + void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; } + + void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; } + const Size& GetPrefSize() const { return maPrefSz; } + + void SetAutoWidth( BOOL b ) { mbAutoWidth = b; } + BOOL IsAutoWidth() const { return mbAutoWidth; } + + Size CalcFloatSize(); + void StartFloat( BOOL bStartTracking ); + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, USHORT nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) + { FloatingWindow::SetPosSizePixel( rNewPos, rNewSize ); } + + void SetDropDownLineCount( USHORT n ) { mnDDLineCount = n; } + USHORT GetDropDownLineCount() const { return mnDDLineCount; } + + USHORT GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; } + + virtual void Resize(); +}; + +// ----------- +// - ImplWin - +// ----------- + +class ImplWin : public Control +{ +private: + + USHORT mnItemPos; // wegen UserDraw muss ich wissen, welches Item ich darstelle. + XubString maString; + Image maImage; + Image maImageHC; + + Rectangle maFocusRect; + Size maUserItemSize; + + Link maMBDownHdl; + Link maUserDrawHdl; + + BOOL mbUserDrawEnabled : 1, + mbInUserDraw : 1; + + + void ImplDraw( bool bLayout = false ); +protected: + virtual void FillLayoutData() const; +public: + + ImplWin( Window* pParent, WinBits nWinStyle = 0 ); + ~ImplWin() {}; + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + USHORT GetItemPos() const { return mnItemPos; } + void SetItemPos( USHORT n ) { mnItemPos = n; } + + const XubString& GetString() const { return maString; } + void SetString( const XubString& rStr ) { maString = rStr; } + + const Image& GetImage() const { return maImage; } + void SetImage( const Image& rImg ) { maImage = rImg; } + + BOOL SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const Image& GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + + + virtual void MBDown(); + void SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; } + const Link& GetMBDownHdl() const { return maMBDownHdl; } + + void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; } + const Link& GetUserDrawHdl() const { return maUserDrawHdl; } + + void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; } + const Size& GetUserItemSize() const { return maUserItemSize; } + + void EnableUserDraw( BOOL bUserDraw ) { mbUserDrawEnabled = bUserDraw; } + BOOL IsUserDrawEnabled() const { return mbUserDrawEnabled; } + + void DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos = FALSE, bool bLayout = false ); +}; + +// ----------- +// - ImplBtn - +// ----------- + +class ImplBtn : public PushButton +{ +private: + BOOL mbDown; + + Link maMBDownHdl; + +public: + ImplBtn( Window* pParent, WinBits nWinStyle = 0 ); + ~ImplBtn() {}; + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + + virtual void MBDown(); + void SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; } + const Link& GetMBDownHdl() const { return maMBDownHdl; } +}; + + +void ImplInitFieldSettings( Window* pWin, BOOL bFont, BOOL bForeground, BOOL bBackground ); +void ImplInitDropDownButton( PushButton* pButton ); + +#endif // _SV_ILSTBOX_HXX diff --git a/vcl/inc/vcl/image.h b/vcl/inc/vcl/image.h new file mode 100644 index 000000000000..023b2c2d1a2c --- /dev/null +++ b/vcl/inc/vcl/image.h @@ -0,0 +1,182 @@ +/************************************************************************* + * + * 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_IMAGE_H +#define _SV_IMAGE_H + +#include <vcl/bitmapex.hxx> + +#include <hash_map> + +// ---------------- +// - ImplImageBmp - +// ---------------- + +class ImplImageBmp +{ +public: + + ImplImageBmp(); + ~ImplImageBmp(); + + void Create( long nItemWidth, long nItemHeight, USHORT nInitSize ); + void Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,USHORT nInitSize ); + + void Expand( USHORT nGrowSize ); + + void Replace( USHORT nPos, USHORT nSrcPos ); + void Replace( USHORT nPos, const ImplImageBmp& rImageBmp, USHORT nSrcPos ); + void Replace( USHORT nPos, const BitmapEx& rBmpEx ); + + void ReplaceColors( const Color* pSrcColors, const Color* pDstColors, ULONG nColorCount ); + void ColorTransform( BmpColorMode eColorMode ); + void Invert(); + + BitmapEx GetBitmapEx( USHORT nPosCount, USHORT* pPosAry ) const; + + void Draw( USHORT nPos, OutputDevice* pDev, const Point& rPos, USHORT nStyle, const Size* pSize = NULL ); + +private: + + BitmapEx maBmpEx; + BitmapEx maDisabledBmpEx; + BitmapEx* mpDisplayBmp; + Size maSize; + BYTE* mpInfoAry; + USHORT mnSize; + + void ImplUpdateDisplayBmp( OutputDevice* pOutDev ); + void ImplUpdateDisabledBmpEx( int nPos ); + +private: // prevent assignment and copy construction + ImplImageBmp( const ImplImageBmp& ); + void operator=( const ImplImageBmp& ); +}; + +// -------------- +// - ImageTypes - +// -------------- + +enum ImageType { IMAGETYPE_BITMAP, IMAGETYPE_IMAGE }; + +// ----------------- +// - ImplImageList - +// ----------------- + +struct ImageAryData +{ + ::rtl::OUString maName; + // Images identified by either name, or by id + USHORT mnId; + BitmapEx maBitmapEx; + + ImageAryData(); + ImageAryData( const rtl::OUString &aName, + USHORT nId, const BitmapEx &aBitmap ); + ImageAryData( const ImageAryData& rData ); + ~ImageAryData(); + + bool IsLoadable() { return maBitmapEx.IsEmpty() && maName.getLength(); } + void Load(const rtl::OUString &rPrefix); + + ImageAryData& operator=( const ImageAryData& rData ); +}; + +// ------------------------------------------------------------------------------ + +struct ImplImageList +{ + typedef std::vector<ImageAryData *> ImageAryDataVec; + typedef std::hash_map< rtl::OUString, ImageAryData *, rtl::OUStringHash > + ImageAryDataNameHash; + + ImageAryDataVec maImages; + ImageAryDataNameHash maNameHash; + rtl::OUString maPrefix; + Size maImageSize; + ULONG mnRefCount; + + ImplImageList(); + ImplImageList( const ImplImageList &aSrc ); + ~ImplImageList(); + + void AddImage( const ::rtl::OUString &aName, + USHORT nId, const BitmapEx &aBitmapEx ); + void RemoveImage( USHORT nPos ); + USHORT GetImageCount() const; +}; + +// -------------------- +// - ImplImageRefData - +// -------------------- + +struct ImplImageRefData +{ + ImplImageList* mpImplData; + USHORT mnIndex; + + ImplImageRefData() {} // Um Warning zu umgehen + ~ImplImageRefData(); + + BOOL IsEqual( const ImplImageRefData& rData ); +}; + +// ---------------- +// - ImpImageData - +// ---------------- + +struct ImplImageData +{ + ImplImageBmp* mpImageBitmap; + BitmapEx maBmpEx; + + ImplImageData( const BitmapEx& rBmpEx ); + ~ImplImageData(); + + BOOL IsEqual( const ImplImageData& rData ); +}; + +// ------------- +// - ImplImage - +// ------------- + +struct ImplImage +{ + ULONG mnRefCount; + // TODO: use inheritance to get rid of meType+mpData + void* mpData; + ImageType meType; + + ImplImage(); + ~ImplImage(); + +private: // prevent assignment and copy construction + ImplImage( const ImplImage&); + void operator=( const ImplImage&); +}; + +#endif // _SV_IMAGE_H diff --git a/vcl/inc/vcl/image.hxx b/vcl/inc/vcl/image.hxx new file mode 100644 index 000000000000..f4f642656783 --- /dev/null +++ b/vcl/inc/vcl/image.hxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * 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_IMAGE_HXX +#define _SV_IMAGE_HXX + +#include <vcl/dllapi.h> +#include <tools/gen.hxx> +#include <tools/resid.hxx> +#include <vcl/sv.h> +#include <vcl/bitmapex.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <vector> + +struct ImplImage; +struct ImplImageList; +namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } } + +// ----------- +// - Defines - +// ----------- + +#define IMAGE_STDBTN_COLOR Color( 0xC0, 0xC0, 0xC0 ) +#define IMAGELIST_IMAGE_NOTFOUND ((USHORT)0xFFFF) + +// ----------------------- +// - ImageColorTransform - +// ----------------------- + +enum ImageColorTransform +{ + IMAGECOLORTRANSFORM_NONE = 0, + IMAGECOLORTRANSFORM_HIGHCONTRAST = 1, + IMAGECOLORTRANSFORM_MONOCHROME_BLACK = 2, + IMAGECOLORTRANSFORM_MONOCHROME_WHITE = 3 +}; + +// --------- +// - Image - +// --------- + +class VCL_DLLPUBLIC Image +{ + friend class ImageList; + friend class OutputDevice; + +public: + Image(); + Image( const ResId& rResId ); + Image( const Image& rImage ); + Image( const BitmapEx& rBitmapEx ); + Image( const Bitmap& rBitmap ); + Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap ); + Image( const Bitmap& rBitmap, const Color& rColor ); + Image( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ); + ~Image(); + + Size GetSizePixel() const; + + BitmapEx GetBitmapEx() const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const; + + Image GetColorTransformedImage( ImageColorTransform eColorTransform ) const; + static void GetColorTransformArrays( ImageColorTransform eColorTransform, Color*& rpSrcColor, Color*& rpDstColor, ULONG& rColorCount ); + + void Invert(); + + BOOL operator!() const { return( !mpImplData ? true : false ); } + Image& operator=( const Image& rImage ); + BOOL operator==( const Image& rImage ) const; + BOOL operator!=( const Image& rImage ) const { return !(Image::operator==( rImage )); } + +private: + + ImplImage* mpImplData; + + SAL_DLLPRIVATE void ImplInit( const BitmapEx& rBmpEx ); +}; + +// ------------- +// - ImageList - +// ------------- + +class VCL_DLLPUBLIC ImageList +{ +public: + ImageList( USHORT nInit = 8, USHORT nGrow = 4 ); + ImageList( const ResId& rResId ); + ImageList( const ::std::vector< ::rtl::OUString >& rNameVector, + const ::rtl::OUString& rPrefix, + const Color* pMaskColor = NULL ); + ImageList( const ImageList& rImageList ); + ~ImageList(); + + void Clear(); + void InsertFromHorizontalStrip( const BitmapEx &rBitmapEx, + const std::vector< rtl::OUString > &rNameVector ); + void InsertFromHorizontalBitmap( const ResId& rResId, + USHORT nCount, + const Color *pNonAlphaMaskColor, + const Color *pSearchColors = NULL, + const Color *pReplaceColors = NULL, + ULONG nColorCount = 0); + BitmapEx GetAsHorizontalStrip() const; + USHORT GetImageCount() const; + Size GetImageSize() const; + + void AddImage( USHORT nNewId, const Image& rImage ); + void AddImage( const ::rtl::OUString& rImageName, const Image& rImage ); + + void ReplaceImage( USHORT nId, const Image& rImage ); + void ReplaceImage( const ::rtl::OUString& rImageName, const Image& rImage ); + + void ReplaceImage( USHORT nId, USHORT nReplaceId ); + void ReplaceImage( const ::rtl::OUString& rImageName, const ::rtl::OUString& rReplaceName ); + + void RemoveImage( USHORT nId ); + void RemoveImage( const ::rtl::OUString& rImageName ); + + Image GetImage( USHORT nId ) const; + Image GetImage( const ::rtl::OUString& rImageName ) const; + + USHORT GetImagePos( USHORT nId ) const; + bool HasImageAtPos( USHORT nId ) const; + USHORT GetImagePos( const ::rtl::OUString& rImageName ) const; + + USHORT GetImageId( USHORT nPos ) const; + void GetImageIds( ::std::vector< USHORT >& rIds ) const; + + ::rtl::OUString GetImageName( USHORT nPos ) const; + void GetImageNames( ::std::vector< ::rtl::OUString >& rNames ) const; + + ImageList& operator=( const ImageList& rImageList ); + BOOL operator==( const ImageList& rImageList ) const; + BOOL operator!=( const ImageList& rImageList ) const { return !(ImageList::operator==( rImageList )); } + +private: + + ImplImageList* mpImplData; + USHORT mnInitSize; + USHORT mnGrowSize; + + SAL_DLLPRIVATE void ImplInitBitmapEx( const ::rtl::OUString& rUserImageName, + const ::std::vector< ::rtl::OUString >& rImageNames, + const ::rtl::OUString& rSymbolsStyle, + BitmapEx& rBmpEx, + const Color* pMaskColor ) const; + SAL_DLLPRIVATE void ImplInit( USHORT nItems, const Size &rSize ); + SAL_DLLPRIVATE USHORT ImplGetImageId( const ::rtl::OUString& rImageName ) const; + SAL_DLLPRIVATE void ImplMakeUnique(); +}; + +#endif // _SV_IMAGE_HXX diff --git a/vcl/inc/vcl/imagerepository.hxx b/vcl/inc/vcl/imagerepository.hxx new file mode 100644 index 000000000000..f5809650fcf3 --- /dev/null +++ b/vcl/inc/vcl/imagerepository.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_IMAGEREPOSITORY_HXX +#define VCL_IMAGEREPOSITORY_HXX + +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> + +class BitmapEx; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ImageRepository + //==================================================================== + // provides access to the application's image repository (image.zip) + class VCL_DLLPUBLIC ImageRepository + { + public: + /** loads an image from the application's image repository + @param _rName + the name of the image to load. + @param _out_rImage + will take the image upon successful return. + @param bSearchLanguageDependent + determines whether a language-dependent image is to be searched. + @return + whether or not the image could be loaded successfully. + */ + static bool loadImage( + const ::rtl::OUString& _rName, + BitmapEx& _out_rImage, + bool bSearchLanguageDependent + ); + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_IMAGEREPOSITORY_HXX + diff --git a/vcl/inc/vcl/imgctrl.hxx b/vcl/inc/vcl/imgctrl.hxx new file mode 100644 index 000000000000..fa3b01463f34 --- /dev/null +++ b/vcl/inc/vcl/imgctrl.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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_IMGCTRL_HXX +#define _SV_IMGCTRL_HXX + +#include <vcl/dllapi.h> + +#include <vcl/fixed.hxx> +#include <vcl/bitmapex.hxx> + +// ---------------- +// - ImageControl - +// ---------------- + +class VCL_DLLPUBLIC ImageControl : public FixedImage +{ +private: + BitmapEx maBmp; + BitmapEx maBmpHC; + ::sal_Int16 mnScaleMode; + +public: + ImageControl( Window* pParent, WinBits nStyle = 0 ); + + // set/get the scale mode. This is one of the css.awt.ImageScaleMode constants + void SetScaleMode( const ::sal_Int16 _nMode ); + ::sal_Int16 GetScaleMode() const { return mnScaleMode; } + + virtual void Resize(); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void GetFocus(); + virtual void LoseFocus(); + + void SetBitmap( const BitmapEx& rBmp ); + using OutputDevice::GetBitmap; + const BitmapEx& GetBitmap() const { return maBmp; } + BOOL SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const BitmapEx& GetModeBitmap( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; +}; + +#endif // _SV_IMGCTRL_HXX diff --git a/vcl/inc/vcl/impbmp.hxx b/vcl/inc/vcl/impbmp.hxx new file mode 100644 index 000000000000..dc40fdcd3181 --- /dev/null +++ b/vcl/inc/vcl/impbmp.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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_IMPBMP_HXX +#define _SV_IMPBMP_HXX + +#include <tools/gen.hxx> +#include <vcl/sv.h> + +// --------------- +// - ImpBitmap - +// --------------- + +struct BitmapBuffer; +class SalBitmap; +class BitmapPalette; +class SalGraphics; +class ImplServerBitmap; +class Bitmap; +class OutputDevice; +class Color; +class AlphaMask; + +class ImpBitmap +{ +private: + + ULONG mnRefCount; + ULONG mnChecksum; + SalBitmap* mpSalBitmap; + Size maSourceSize; + +public: + + ImpBitmap(); + ~ImpBitmap(); + +#if _SOLAR__PRIVATE + +public: + + void ImplSetSalBitmap( SalBitmap* pSalBitmap ); + SalBitmap* ImplGetSalBitmap() const { return mpSalBitmap; } + +public: + + BOOL ImplCreate( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); + BOOL ImplCreate( const ImpBitmap& rImpBitmap ); + BOOL ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics ); + BOOL ImplCreate( const ImpBitmap& rImpBitmap, USHORT nNewBitCount ); + + void ImplDestroy(); + + Size ImplGetSize() const; + Size ImplGetSourceSize() const; + void ImplSetSourceSize( const Size&); + USHORT ImplGetBitCount() const; + + BitmapBuffer* ImplAcquireBuffer( BOOL bReadOnly ); + void ImplReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly ); + +public: + + ULONG ImplGetRefCount() const { return mnRefCount; } + void ImplIncRefCount() { mnRefCount++; } + void ImplDecRefCount() { mnRefCount--; } + + inline void ImplSetChecksum( ULONG nChecksum ) { mnChecksum = nChecksum; } + inline ULONG ImplGetChecksum() const { return mnChecksum; } + +#endif // PRIVATE +}; + +inline Size ImpBitmap::ImplGetSourceSize() const +{ + return maSourceSize; +} + +inline void ImpBitmap::ImplSetSourceSize( const Size& rSize) +{ + maSourceSize = rSize; +} + +#endif // _SV_IMPBMP_HXX diff --git a/vcl/inc/vcl/impbmpconv.hxx b/vcl/inc/vcl/impbmpconv.hxx new file mode 100644 index 000000000000..d95da9a4093a --- /dev/null +++ b/vcl/inc/vcl/impbmpconv.hxx @@ -0,0 +1,39 @@ +/************************************************************************* + * + * 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_IMPBMPCONV_HXX_ +#define _VCL_IMPBMPCONV_HXX_ + +#include <com/sun/star/script/XInvocation.hpp> +#include <com/sun/star/uno/Reference.hxx> + +namespace vcl +{ +com::sun::star::uno::Reference< com::sun::star::script::XInvocation > createBmpConverter(); +} + +#endif diff --git a/vcl/inc/vcl/impdel.hxx b/vcl/inc/vcl/impdel.hxx new file mode 100644 index 000000000000..fc1796f0e402 --- /dev/null +++ b/vcl/inc/vcl/impdel.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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_IMPDEL_HXX + #define _VCL_IMPDEL_HXX + + #include <list> + + namespace vcl + { + + class DeletionListener; + + class DeletionNotifier + { + std::list< DeletionListener* > m_aListeners; + protected: + DeletionNotifier() {} + + ~DeletionNotifier() + { notifyDelete(); } + + inline void notifyDelete(); + + public: + void addDel( DeletionListener* pListener ) + { m_aListeners.push_back( pListener ); } + + void removeDel( DeletionListener* pListener ) + { m_aListeners.remove( pListener ); } + }; + + class DeletionListener + { + DeletionNotifier* m_pNotifier; + public: + DeletionListener( DeletionNotifier* pNotifier ) + : m_pNotifier( pNotifier ) + { + if( m_pNotifier ) + m_pNotifier->addDel( this ); + } + ~DeletionListener() + { + if( m_pNotifier ) + m_pNotifier->removeDel( this ); + } + void deleted() { m_pNotifier = NULL; } + bool isDeleted() const { return (m_pNotifier == NULL); } + }; + + inline void DeletionNotifier::notifyDelete() + { + for( std::list< DeletionListener* >::const_iterator it = + m_aListeners.begin(); it != m_aListeners.end(); ++it ) + (*it)->deleted(); + + m_aListeners.clear(); + } + + } // namespace vcl + + #endif // _VCL_IMPDEL_HXX diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx new file mode 100644 index 000000000000..e38e1dea78d4 --- /dev/null +++ b/vcl/inc/vcl/impfont.hxx @@ -0,0 +1,243 @@ +/************************************************************************* + * + * 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_IMPFONT_HXX +#define _SV_IMPFONT_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <i18npool/lang.h> +#include <tools/color.hxx> +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> +#include <vcl/fntstyle.hxx> + +// ------------ +// - Impl_Font - +// ------------ + +class Impl_Font +{ +public: + Impl_Font(); + Impl_Font( const Impl_Font& ); + + bool operator==( const Impl_Font& ) const; + + FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; } + FontFamily GetFamily() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; } + FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; } + FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } + FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW)AskConfig(); return meWidthType; } + +private: + friend class Font; + void AskConfig(); + + int mnRefCount; + String maFamilyName; + String maStyleName; + Size maSize; + Color maColor; // compatibility, now on output device + Color maFillColor; // compatibility, now on output device + rtl_TextEncoding meCharSet; + LanguageType meLanguage; + LanguageType meCJKLanguage; + FontFamily meFamily; + FontPitch mePitch; + TextAlign meAlign; + FontWeight meWeight; + FontWidth meWidthType; + FontItalic meItalic; + FontUnderline meUnderline; + FontUnderline meOverline; + FontStrikeout meStrikeout; + FontRelief meRelief; + FontEmphasisMark meEmphasisMark; + FontType meType; // used by metrics only + short mnOrientation; + FontKerning mnKerning; + BOOL mbWordLine:1, + mbOutline:1, + mbConfigLookup:1, // there was a config lookup + mbShadow:1, + mbVertical:1, + mbTransparent:1; // compatibility, now on output device + + friend SvStream& operator>>( SvStream& rIStm, Impl_Font& ); + friend SvStream& operator<<( SvStream& rOStm, const Impl_Font& ); +}; + +// ------------------ +// - ImplFontMetric - +// ------------------ + +class ImplFontMetric +{ + friend class OutputDevice; + +private: + long mnAscent; // Ascent + long mnDescent; // Descent + long mnIntLeading; // Internal Leading + long mnExtLeading; // External Leading + long mnLineHeight; // Ascent+Descent+EmphasisMark + long mnSlant; // Slant + USHORT mnMiscFlags; // Misc Flags + UINT32 mnRefCount; // Reference Counter + + enum { DEVICE_FLAG=1, SCALABLE_FLAG=2, LATIN_FLAG=4, CJK_FLAG=8, CTL_FLAG=16 }; + +public: + ImplFontMetric(); + void AddReference(); + void DeReference(); + + long GetAscent() const { return mnAscent; } + long GetDescent() const { return mnDescent; } + long GetIntLeading() const { return mnIntLeading; } + long GetExtLeading() const { return mnExtLeading; } + long GetLineHeight() const { return mnLineHeight; } + long GetSlant() const { return mnSlant; } + + bool IsDeviceFont() const { return ((mnMiscFlags & DEVICE_FLAG) != 0); } + bool IsScalable() const { return ((mnMiscFlags & SCALABLE_FLAG) != 0); } + bool SupportsLatin() const { return ((mnMiscFlags & LATIN_FLAG) != 0); } + bool SupportsCJK() const { return ((mnMiscFlags & CJK_FLAG) != 0); } + bool SupportsCTL() const { return ((mnMiscFlags & CTL_FLAG) != 0); } + + bool operator==( const ImplFontMetric& ) const; +}; + +// ------------------ +// - ImplFontHints - +// ------------------ + +class ImplFontOptions +{ +public: + FontEmbeddedBitmap meEmbeddedBitmap; // whether the embedded bitmaps should be used + FontAntiAlias meAntiAlias; // whether the font should be antialiased + FontAutoHint meAutoHint; // whether the font should be autohinted + FontHinting meHinting; // whether the font should be hinted + FontHintStyle meHintStyle; // type of font hinting to be used +public: + ImplFontOptions() : + meEmbeddedBitmap(EMBEDDEDBITMAP_DONTKNOW), + meAntiAlias(ANTIALIAS_DONTKNOW), + meAutoHint(AUTOHINT_DONTKNOW), + meHinting(HINTING_DONTKNOW), + meHintStyle(HINT_SLIGHT) + {} + ImplFontOptions( FontEmbeddedBitmap eEmbeddedBitmap, FontAntiAlias eAntiAlias, + FontAutoHint eAutoHint, FontHinting eHinting, FontHintStyle eHintStyle) : + meEmbeddedBitmap(eEmbeddedBitmap), + meAntiAlias(eAntiAlias), + meAutoHint(eAutoHint), + meHinting(eHinting), + meHintStyle(eHintStyle) + {} + FontAutoHint GetUseAutoHint() const { return meAutoHint; } + FontHintStyle GetHintStyle() const { return meHintStyle; } + bool DontUseEmbeddedBitmaps() const { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; } + bool DontUseAntiAlias() const { return meAntiAlias == ANTIALIAS_FALSE; } + bool DontUseHinting() const { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); } +}; + +// ------------------- +// - ImplFontCharMap - +// ------------------- + +class CmapResult; + +class VCL_DLLPUBLIC ImplFontCharMap +{ +public: + explicit ImplFontCharMap( const CmapResult& ); + virtual ~ImplFontCharMap(); + + static ImplFontCharMap* GetDefaultMap( bool bSymbols=false); + + bool IsDefaultMap() const; + bool HasChar( sal_uInt32 ) const; + int CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const; + int GetCharCount() const; + + sal_uInt32 GetFirstChar() const; + sal_uInt32 GetLastChar() const; + + sal_uInt32 GetNextChar( sal_uInt32 ) const; + sal_uInt32 GetPrevChar( sal_uInt32 ) const; + + int GetIndexFromChar( sal_uInt32 ) const; + sal_uInt32 GetCharFromIndex( int ) const; + + void AddReference() const; + void DeReference() const; + + int GetGlyphIndex( sal_uInt32 ) const; + +private: + int ImplFindRangeIndex( sal_uInt32 ) const; + + // prevent assignment and copy construction + explicit ImplFontCharMap( const ImplFontCharMap& ); + void operator=( const ImplFontCharMap& ); + +private: + const sal_uInt32* mpRangeCodes; // pairs of StartCode/(EndCode+1) + const int* mpStartGlyphs; // range-specific mapper to glyphs + const USHORT* mpGlyphIds; // individual glyphid mappings + int mnRangeCount; + int mnCharCount; // covered codepoints + mutable int mnRefCount; +}; + +// CmapResult is a normalized version of the many CMAP formats +class +#ifdef UNX + VCL_DLLPUBLIC // vcl-plugins need it +#endif // UNX +CmapResult +{ +public: + explicit CmapResult( bool bSymbolic = false, + const sal_uInt32* pRangeCodes = NULL, int nRangeCount = 0, + const int* pStartGlyphs = 0, const USHORT* pGlyphIds = NULL ); + + const sal_uInt32* mpRangeCodes; + const int* mpStartGlyphs; + const USHORT* mpGlyphIds; + int mnRangeCount; + bool mbSymbolic; + bool mbRecoded; +}; + +bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& ); + +#endif // _SV_IMPFONT_HXX + diff --git a/vcl/inc/vcl/impgraph.hxx b/vcl/inc/vcl/impgraph.hxx new file mode 100644 index 000000000000..bb28d801fe12 --- /dev/null +++ b/vcl/inc/vcl/impgraph.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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_IMPGRAPH_HXX +#define _SV_IMPGRAPH_HXX + +#include <tools/urlobj.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/animate.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/graph.h> + +// --------------- +// - ImpSwapInfo - +// --------------- + +struct ImpSwapInfo +{ + MapMode maPrefMapMode; + Size maPrefSize; +}; + +// -------------- +// - ImpGraphic - +// -------------- + +class OutputDevice; +class GfxLink; +struct ImpSwapFile; +class GraphicConversionParameters; + +class ImpGraphic +{ + friend class Graphic; + +private: + + GDIMetaFile maMetaFile; + BitmapEx maEx; + ImpSwapInfo maSwapInfo; + Animation* mpAnimation; + GraphicReader* mpContext; + ImpSwapFile* mpSwapFile; + GfxLink* mpGfxLink; + GraphicType meType; + String maDocFileURLStr; + ULONG mnDocFilePos; + mutable ULONG mnSizeBytes; + ULONG mnRefCount; + BOOL mbSwapOut; + BOOL mbSwapUnderway; + +private: + + ImpGraphic(); + ImpGraphic( const ImpGraphic& rImpGraphic ); + ImpGraphic( const Bitmap& rBmp ); + ImpGraphic( const BitmapEx& rBmpEx ); + ImpGraphic( const Animation& rAnimation ); + ImpGraphic( const GDIMetaFile& rMtf ); + virtual ~ImpGraphic(); + + ImpGraphic& operator=( const ImpGraphic& rImpGraphic ); + BOOL operator==( const ImpGraphic& rImpGraphic ) const; + BOOL operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); } + + void ImplClearGraphics( BOOL bCreateSwapInfo ); + void ImplClear(); + + GraphicType ImplGetType() const; + void ImplSetDefaultType(); + BOOL ImplIsSupportedGraphic() const; + + BOOL ImplIsTransparent() const; + BOOL ImplIsAlpha() const; + BOOL ImplIsAnimated() const; + + Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const; + BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const; + Animation ImplGetAnimation() const; + const GDIMetaFile& ImplGetGDIMetaFile() const; + + Size ImplGetPrefSize() const; + void ImplSetPrefSize( const Size& rPrefSize ); + + MapMode ImplGetPrefMapMode() const; + void ImplSetPrefMapMode( const MapMode& rPrefMapMode ); + + ULONG ImplGetSizeBytes() const; + + void ImplDraw( OutputDevice* pOutDev, + const Point& rDestPt ) const; + void ImplDraw( OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSize ) const; + + void ImplStartAnimation( OutputDevice* pOutDev, + const Point& rDestPt, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL ); + void ImplStartAnimation( OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSize, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL ); + void ImplStopAnimation( OutputDevice* pOutputDevice = NULL, + long nExtraData = 0 ); + + void ImplSetAnimationNotifyHdl( const Link& rLink ); + Link ImplGetAnimationNotifyHdl() const; + + ULONG ImplGetAnimationLoopCount() const; + void ImplResetAnimationLoopCount(); + + List* ImplGetAnimationInfoList() const; + +private: + + GraphicReader* ImplGetContext(); + void ImplSetContext( GraphicReader* pReader ); + +private: + + void ImplSetDocFileName( const String& rName, ULONG nFilePos ); + const String& ImplGetDocFileName() const; + ULONG ImplGetDocFilePos() const; + + BOOL ImplReadEmbedded( SvStream& rIStream, BOOL bSwap = FALSE ); + BOOL ImplWriteEmbedded( SvStream& rOStream ); + + BOOL ImplSwapIn(); + BOOL ImplSwapIn( SvStream* pIStm ); + + BOOL ImplSwapOut(); + BOOL ImplSwapOut( SvStream* pOStm ); + + BOOL ImplIsSwapOut() const; + + void ImplSetLink( const GfxLink& ); + GfxLink ImplGetLink(); + BOOL ImplIsLink() const; + + ULONG ImplGetChecksum() const; + + BOOL ImplExportNative( SvStream& rOStm ) const; + + friend SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic ); + friend SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ); +}; + +#endif // _SV_IMPGRAPH_HXX diff --git a/vcl/inc/vcl/impimagetree.hxx b/vcl/inc/vcl/impimagetree.hxx new file mode 100644 index 000000000000..9649fe2f5ec8 --- /dev/null +++ b/vcl/inc/vcl/impimagetree.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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_VCL_IMPIMAGETREE_HXX +#define INCLUDED_VCL_IMPIMAGETREE_HXX + +#include "sal/config.h" + +#include <list> +#include <utility> +#include <vector> + +#include <hash_map> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "rtl/ustring.hxx" +#include "salhelper/singletonref.hxx" + +namespace com { namespace sun { namespace star { namespace container { + class XNameAccess; +} } } } +class BitmapEx; + +class ImplImageTree: private boost::noncopyable { +public: + ImplImageTree(); + + ~ImplImageTree(); + + // check whether the icon style is installed + bool checkStyle(rtl::OUString const & style); + + bool loadImage( + rtl::OUString const & name, rtl::OUString const & style, + BitmapEx & bitmap, bool localized = false ); + + void shutDown(); + // a crude form of life cycle control (called from DeInitVCL; otherwise, + // if the ImplImageTree singleton were destroyed during exit that would + // be too late for the destructors of the bitmaps in m_iconCache) + +private: + typedef std::list< + std::pair< + rtl::OUString, + com::sun::star::uno::Reference< + com::sun::star::container::XNameAccess > > > Zips; + + typedef std::hash_map< + rtl::OUString, bool, rtl::OUStringHash > CheckStyleCache; + typedef std::hash_map< + rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache; + + rtl::OUString m_style; + Zips m_zips; + CheckStyleCache m_checkStyleCache; + IconCache m_iconCache; + + void setStyle(rtl::OUString const & style ); + + void resetZips(); + + bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists ); + bool iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap ); + + bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap ); +}; + +typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef; + +#endif diff --git a/vcl/inc/vcl/impoct.hxx b/vcl/inc/vcl/impoct.hxx new file mode 100644 index 000000000000..543ab19d6a57 --- /dev/null +++ b/vcl/inc/vcl/impoct.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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_IMPOCT_HXX +#define _SV_IMPOCT_HXX + +#include <vcl/octree.hxx> + +// ---------------- +// - ImpErrorQuad - +// ---------------- + +class ImpErrorQuad +{ + long nRed; + long nGreen; + long nBlue; + long nReserved; + +public: + + inline ImpErrorQuad() {} + inline ImpErrorQuad( const BitmapColor& rColor ) : + nRed ( (long) rColor.GetRed() << 5L ), + nGreen ( (long) rColor.GetGreen() << 5L ), + nBlue ( (long) rColor.GetBlue() << 5L ) {} + + inline void operator=( const BitmapColor& rColor ); + inline ImpErrorQuad& operator-=( const BitmapColor& rColor ); + + inline void ImplAddColorError1( const ImpErrorQuad& rErrQuad ); + inline void ImplAddColorError3( const ImpErrorQuad& rErrQuad ); + inline void ImplAddColorError5( const ImpErrorQuad& rErrQuad ); + inline void ImplAddColorError7( const ImpErrorQuad& rErrQuad ); + + inline BitmapColor ImplGetColor(); +}; + +// ------------------------------------------------------------------------ + +inline void ImpErrorQuad::operator=( const BitmapColor& rColor ) +{ + nRed = (long) rColor.GetRed() << 5L; + nGreen = (long) rColor.GetGreen() << 5L; + nBlue = (long) rColor.GetBlue() << 5L; +} + +// ------------------------------------------------------------------------ + +inline ImpErrorQuad& ImpErrorQuad::operator-=( const BitmapColor& rColor ) +{ + nRed -= ( (long) rColor.GetRed() << 5L ); + nGreen -= ( (long) rColor.GetGreen() << 5L ); + nBlue -= ( (long) rColor.GetBlue() << 5L ); + + return *this; +} + +// ------------------------------------------------------------------------ + +inline void ImpErrorQuad::ImplAddColorError1( const ImpErrorQuad& rErrQuad ) +{ + nRed += ( rErrQuad.nRed >> 4L ); + nGreen += ( rErrQuad.nGreen >> 4L ); + nBlue += ( rErrQuad.nBlue >> 4L ); +} + +// ------------------------------------------------------------------------ + +inline void ImpErrorQuad::ImplAddColorError3( const ImpErrorQuad& rErrQuad ) +{ + nRed += ( rErrQuad.nRed * 3L >> 4L ); + nGreen += ( rErrQuad.nGreen * 3L >> 4L ); + nBlue += ( rErrQuad.nBlue * 3L >> 4L ); +} + +// ------------------------------------------------------------------------ + +inline void ImpErrorQuad::ImplAddColorError5( const ImpErrorQuad& rErrQuad ) +{ + nRed += ( rErrQuad.nRed * 5L >> 4L ); + nGreen += ( rErrQuad.nGreen * 5L >> 4L ); + nBlue += ( rErrQuad.nBlue * 5L >> 4L ); +} + +// ------------------------------------------------------------------------ + +inline void ImpErrorQuad::ImplAddColorError7( const ImpErrorQuad& rErrQuad ) +{ + nRed += ( rErrQuad.nRed * 7L >> 4L ); + nGreen += ( rErrQuad.nGreen * 7L >> 4L ); + nBlue += ( rErrQuad.nBlue *7L >> 4L ); +} + +// ------------------------------------------------------------------------ + +inline BitmapColor ImpErrorQuad::ImplGetColor() +{ + return BitmapColor( (BYTE) ( ( nRed < 0L ? 0L : nRed > 8160L ? 8160L : nRed ) >> 5L ), + (BYTE) ( ( nGreen < 0L ? 0L : nGreen > 8160L ? 8160L : nGreen ) >> 5L ), + (BYTE) ( ( nBlue < 0L ? 0L : nBlue > 8160L ? 8160L : nBlue ) >> 5L ) ); +} + +// ------------- +// - NodeCache - +// ------------- + +class ImpNodeCache +{ + OctreeNode* pActNode; + ULONG nNew; + ULONG nDelete; + ULONG nGet; + ULONG nRelease; + +public: + + ImpNodeCache( const ULONG nInitSize ); + ~ImpNodeCache(); + + inline OctreeNode* ImplGetFreeNode(); + inline void ImplReleaseNode( OctreeNode* pNode ); +}; + +// ------------------------------------------------------------------------ + +inline OctreeNode* ImpNodeCache::ImplGetFreeNode() +{ + OctreeNode* pNode; + + if ( !pActNode ) + { + pActNode = new NODE; + pActNode->pNextInCache = NULL; + } + + pNode = pActNode; + pActNode = pNode->pNextInCache; + memset( pNode, 0, sizeof( NODE ) ); + + return pNode; +} + +// ------------------------------------------------------------------------ + +inline void ImpNodeCache::ImplReleaseNode( OctreeNode* pNode ) +{ + pNode->pNextInCache = pActNode; + pActNode = pNode; +} + +#endif // _SV_IMPOCT_HXX diff --git a/vcl/inc/vcl/impprn.hxx b/vcl/inc/vcl/impprn.hxx new file mode 100644 index 000000000000..954b2340d0c7 --- /dev/null +++ b/vcl/inc/vcl/impprn.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * 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 0 +#define _SV_IMPPRN_HXX + +#include <vcl/print.hxx> +#include <vcl/timer.hxx> +#ifndef _VCL_IMPDEL_HXX +#include <vcl/impdel.hxx> +#endif + +#include <vector> + +struct QueuePage; + +// ---------------- +// - ImplQPrinter - +// ---------------- + +/* + ImplQPrinter is on most systems a simple buffer that allows a potential + lengthy print job to be printed in the background. For this it saves all + normal drawing operations for each printed page to a metafile, then spooling + the metafiles timer based to a normal printer. The application can act in the meantime + including changing the original document without influencing the print job. + + On some systems (currently Mac/Aqua Cocoa) ImplQPrinter has the additional + purpose of adapting to the print system: here theprint systems starts a + job and will not return from that function until it has ended; to do so + it queries for each consecutive page to be printed. Also the Cocoa print system + needs to know the number of pages BEFORE starting a print job. Since our Printer + does not know that, we need to do the completing spooling to ImplQPrinter before + we can actually print to the real print system. Let's call this the pull model + instead of the push model (because the systems pulls the pages). +*/ + +class ImplQPrinter : public Printer, public vcl::DeletionNotifier +{ +private: + Printer* mpParent; + std::vector< QueuePage* > maQueue; + AutoTimer maTimer; + bool mbAborted; + bool mbUserCopy; + bool mbDestroyAllowed; + bool mbDestroyed; + + GDIMetaFile maCurPageMetaFile; + long mnMaxBmpDPIX; + long mnMaxBmpDPIY; + ULONG mnRestoreDrawMode; + int mnCurCopyCount; + + DECL_LINK( ImplPrintHdl, Timer* ); + + ~ImplQPrinter(); + + void ImplPrintMtf( GDIMetaFile& rMtf, long nMaxBmpDPIX, long nMaxBmpDPIY ); + + ImplQPrinter( const ImplQPrinter& rPrinter ); + Printer& operator =( const ImplQPrinter& rPrinter ); + + void PrePrintPage( QueuePage* ); + void PostPrintPage(); + +public: + + ImplQPrinter( Printer* pParent ); + void Destroy(); + + void StartQueuePrint(); + void EndQueuePrint(); + void AbortQueuePrint(); + void AddQueuePage( GDIMetaFile* pPage, USHORT nPage, BOOL bNewJobSetup ); + + bool IsUserCopy() const { return mbUserCopy; } + void SetUserCopy( bool bSet ) { mbUserCopy = bSet; } + + /** + used by pull implementation to emit the next page + */ + void PrintPage( unsigned int nPage ); + /** + used by pull implementation to get the number of physical pages + (that is how often PrintNextPage should be called) + */ + ULONG GetPrintPageCount() const; + + /** + used by pull implementation to get ranges of physical pages that + are to be printed on the same paper. If bIncludeOrientationChanges is true + then orientation changes will not break a page run; the implementation has + to rotate the page contents accordingly in that case. + + The returned vector contains all pages indices beginning a new medium and additionally + the index that of the last page+1 (for convenience, so the length of a range + is always v[i+1] - v[i]) + + Example: 5 pages, all A4 + return: [0 5] + + Example: 6 pages, beginning A4, switching tol A5 on fourth page, back to A4 on fifth page + return [0 3 4 6] + + returns an false in push model (error condition) + */ + bool GetPaperRanges( std::vector< ULONG >& o_rRanges, bool i_bIncludeOrientationChanges ) const; + + /** + get the jobsetup for a page + */ + ImplJobSetup* GetPageSetup( unsigned int nPage ) const; +}; + +#endif // _SV_IMPPRN_HXX diff --git a/vcl/inc/vcl/inputctx.hxx b/vcl/inc/vcl/inputctx.hxx new file mode 100644 index 000000000000..5e7cffa29dc6 --- /dev/null +++ b/vcl/inc/vcl/inputctx.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_INPUTCTX_HXX +#define _VCL_INPUTCTX_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/font.hxx> + +// ---------------------- +// - InputContext-Flags - +// ---------------------- + +#define INPUTCONTEXT_TEXT ((ULONG)0x00000001) +#define INPUTCONTEXT_EXTTEXTINPUT ((ULONG)0x00000002) +#define INPUTCONTEXT_EXTTEXTINPUT_ON ((ULONG)0x00000004) +#define INPUTCONTEXT_EXTTEXTINPUT_OFF ((ULONG)0x00000008) + +// ---------------- +// - InputContext - +// ---------------- + +class VCL_DLLPUBLIC InputContext +{ +private: + Font maFont; + ULONG mnOptions; + +public: + InputContext() { mnOptions = 0; } + InputContext( const InputContext& rInputContext ) : + maFont( rInputContext.maFont ) + { mnOptions = rInputContext.mnOptions; } + InputContext( const Font& rFont, ULONG nOptions = 0 ) : + maFont( rFont ) + { mnOptions = nOptions; } + + void SetFont( const Font& rFont ) { maFont = rFont; } + const Font& GetFont() const { return maFont; } + + void SetOptions( ULONG nOptions ) { mnOptions = nOptions; } + ULONG GetOptions() const { return mnOptions; } + + InputContext& operator=( const InputContext& rInputContext ); + BOOL operator==( const InputContext& rInputContext ) const; + BOOL operator!=( const InputContext& rInputContext ) const + { return !(InputContext::operator==( rInputContext )); } +}; + +inline InputContext& InputContext::operator=( const InputContext& rInputContext ) +{ + maFont = rInputContext.maFont; + mnOptions = rInputContext.mnOptions; + return *this; +} + +inline BOOL InputContext::operator==( const InputContext& rInputContext ) const +{ + return ((mnOptions == rInputContext.mnOptions) && + (maFont == rInputContext.maFont)); +} + +#endif // _VCL_INPUTCTX_HXX diff --git a/vcl/inc/vcl/introwin.hxx b/vcl/inc/vcl/introwin.hxx new file mode 100644 index 000000000000..40644019bc15 --- /dev/null +++ b/vcl/inc/vcl/introwin.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_INTROWIN_HXX +#define _SV_INTROWIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/wrkwin.hxx> +#include <vcl/bitmapex.hxx> + +// -------------- +// - IntroWindow - +// -------------- + +class VCL_DLLPUBLIC IntroWindow : public WorkWindow +{ +private: + SAL_DLLPRIVATE void ImplInitIntroWindowData(); + +public: + IntroWindow(); + ~IntroWindow(); + + void SetBackgroundBitmap( const Bitmap& rBitmap ); + void SetBackgroundBitmap( const BitmapEx& rBitmapEx ); +}; + +#endif // _SV_INTROWIN_HXX diff --git a/vcl/inc/vcl/javachild.hxx b/vcl/inc/vcl/javachild.hxx new file mode 100644 index 000000000000..c5ec3c678900 --- /dev/null +++ b/vcl/inc/vcl/javachild.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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_JAVACHILD_HXX +#define _SV_JAVACHILD_HXX + +#include <vcl/dllapi.h> +#include <vcl/syschild.hxx> + +// ------------------- +// - JavaChildWindow - +// ------------------- + +class VCL_DLLPUBLIC JavaChildWindow : public SystemChildWindow +{ +public: + + JavaChildWindow( Window* pParent, WinBits nStyle = 0 ); + JavaChildWindow( Window* pParent, const ResId& rResId ); + ~JavaChildWindow(); + + sal_IntPtr getParentWindowHandleForJava(); + +private: + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE JavaChildWindow (const JavaChildWindow &); + SAL_DLLPRIVATE JavaChildWindow & operator= (const JavaChildWindow &); +}; + +#endif // _SV_JAVACHILD_HXX diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx new file mode 100644 index 000000000000..f576b816dab0 --- /dev/null +++ b/vcl/inc/vcl/jobdata.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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 _PSPRINT_JOBDATA_HXX_ +#define _PSPRINT_JOBDATA_HXX_ + +#include "vcl/ppdparser.hxx" + +namespace psp { + +namespace orientation { +enum type { + Portrait, + Landscape +}; +} + +struct JobData +{ + int m_nCopies; + int m_nLeftMarginAdjust; + int m_nRightMarginAdjust; + int m_nTopMarginAdjust; + int m_nBottomMarginAdjust; + // user overrides for PPD + int m_nColorDepth; + int m_nPSLevel; // 0: no override, else languaglevel to use + int m_nColorDevice; // 0: no override, -1 grey scale, +1 color + orientation::type m_eOrientation; + ::rtl::OUString m_aPrinterName; + const PPDParser* m_pParser; + PPDContext m_aContext; + + JobData() : + m_nCopies( 1 ), + m_nLeftMarginAdjust( 0 ), + m_nRightMarginAdjust( 0 ), + m_nTopMarginAdjust( 0 ), + m_nBottomMarginAdjust( 0 ), + m_nColorDepth( 24 ), + m_nPSLevel( 0 ), + m_nColorDevice( 0 ), + m_eOrientation( orientation::Portrait ), + m_pParser( NULL ) {} + + JobData& operator=(const psp::JobData& rRight); + + JobData( const JobData& rData ) { *this = rData; } + + void setCollate( bool bCollate ); + + // creates a new buffer using new + // it is up to the user to delete it again + bool getStreamBuffer( void*& pData, int& bytes ); + static bool constructFromStreamBuffer( void* pData, int bytes, JobData& rJobData ); +}; + +} // namespace + + +#endif // PSPRINT_JOBDATA_HXX diff --git a/vcl/inc/vcl/jobset.h b/vcl/inc/vcl/jobset.h new file mode 100644 index 000000000000..2a8be4a6999e --- /dev/null +++ b/vcl/inc/vcl/jobset.h @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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_JOBSET_H +#define _SV_JOBSET_H + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/prntypes.hxx> +#include <hash_map> +#include <rtl/ustring.hxx> + +// ------------------ +// - JobSetup-Types - +// ------------------ + +// see com.sun.star.portal.client.JobSetupSystem.idl: +#define JOBSETUP_SYSTEM_DONTKNOW 0 +#define JOBSETUP_SYSTEM_WINDOWS 1 +#define JOBSETUP_SYSTEM_OS2 2 +#define JOBSETUP_SYSTEM_UNIX 3 +#define JOBSETUP_SYSTEM_MAC 4 +#define JOBSETUP_SYSTEM_JAVA 5 + +// ---------------- +// - ImplJobSetup - +// ---------------- + +struct ImplJobSetup +{ + USHORT mnRefCount; // RefCount (only independ data) + USHORT mnSystem; // Sytem - JOBSETUP_SYSTEM_xxxx + String maPrinterName; // Printer-Name + String maDriver; // Driver-Name + Orientation meOrientation; // Orientation + DuplexMode meDuplexMode; // Duplex + USHORT mnPaperBin; // paper bin / in tray + Paper mePaperFormat; // paper format + long mnPaperWidth; // paper width (100th mm) + long mnPaperHeight; // paper height (100th mm) + ULONG mnDriverDataLen; // length of system specific data + BYTE* mpDriverData; // system specific data (will be streamed a byte block) + ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > maValueMap; + + ImplJobSetup(); + ImplJobSetup( const ImplJobSetup& rJobSetup ); + ~ImplJobSetup(); +}; + +// Papierformat wird wenn PAPER_USER im unabhaengigen Teil automatisch aus +// Papierbreite/hoehe berechnet +// Papierbreite/hoehe wird wenn 0 im unabhaengigen Teil automatisch aus +// Papierformat berechnet, wenn dieses ungleich PAPER_USER ist + +#endif // _SV_JOBSET_H diff --git a/vcl/inc/vcl/jobset.hxx b/vcl/inc/vcl/jobset.hxx new file mode 100644 index 000000000000..4228fc8e90e1 --- /dev/null +++ b/vcl/inc/vcl/jobset.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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_JOBSET_HXX +#define _SV_JOBSET_HXX + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/prntypes.hxx> + +class SvStream; +struct ImplJobSetup; + +// ------------ +// - JobSetup - +// ------------ + +class VCL_DLLPUBLIC JobSetup +{ + friend class Printer; + +private: + ImplJobSetup* mpData; + +//#if 0 // _SOLAR__PRIVATE +public: + SAL_DLLPRIVATE ImplJobSetup* ImplGetData(); + SAL_DLLPRIVATE ImplJobSetup* ImplGetConstData(); + SAL_DLLPRIVATE const ImplJobSetup* ImplGetConstData() const; +//#endif + +public: + JobSetup(); + JobSetup( const JobSetup& rJob ); + ~JobSetup(); + + String GetPrinterName() const; + String GetDriverName() const; + + /* Get/SetValue are used to read/store additional + * Parameters in the job setup that may be used + * by the printer driver. One possible use are phone + * numbers for faxes (which disguise as printers) + */ + String GetValue( const String& rKey ) const; + void SetValue( const String& rKey, const String& rValue ); + + JobSetup& operator=( const JobSetup& rJob ); + + BOOL operator==( const JobSetup& rJobSetup ) const; + BOOL operator!=( const JobSetup& rJobSetup ) const + { return !(JobSetup::operator==( rJobSetup )); } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ); +}; + +#endif // _SV_JOBSET_HXX diff --git a/vcl/inc/vcl/keycod.hxx b/vcl/inc/vcl/keycod.hxx new file mode 100644 index 000000000000..487dea1d7c2f --- /dev/null +++ b/vcl/inc/vcl/keycod.hxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * 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_KEYCODE_HXX +#define _SV_KEYCODE_HXX + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/resid.hxx> +#include <vcl/keycodes.hxx> + +#include <vcl/vclenum.hxx> + +class Window; + +// ------------- +// - Key-Types - +// ------------- + +// Logische KeyFunktionen +/* +#ifndef ENUM_KEYFUNCTYPE_DECLARED +#define ENUM_KEYFUNCTYPE_DECLARED +enum KeyFuncType { KEYFUNC_DONTKNOW, KEYFUNC_NEW, KEYFUNC_OPEN, + KEYFUNC_SAVE, KEYFUNC_SAVEAS, KEYFUNC_PRINT, + KEYFUNC_CLOSE, KEYFUNC_QUIT, + KEYFUNC_CUT, KEYFUNC_COPY, KEYFUNC_PASTE, KEYFUNC_UNDO, + KEYFUNC_REDO, KEYFUNC_DELETE, KEYFUNC_REPEAT, + KEYFUNC_FIND, KEYFUNC_FINDBACKWARD, KEYFUNC_PROPERTIES, + KEYFUNC_FRONT }; +#endif +*/ +// ----------- +// - KeyCode - +// ----------- + +class VCL_DLLPUBLIC KeyCode +{ +private: + USHORT nCode; + KeyFuncType eFunc; + +public: + KeyCode() { nCode = 0; eFunc = KEYFUNC_DONTKNOW; } + KeyCode( const ResId& rResId ); + KeyCode( USHORT nKey, USHORT nModifier = 0 ) + { nCode = nKey | nModifier; eFunc = KEYFUNC_DONTKNOW; } + KeyCode( USHORT nKey, BOOL bShift, BOOL bMod1, BOOL bMod2, BOOL bMod3 ); + KeyCode( KeyFuncType eFunction ); + + USHORT GetFullCode() const { return nCode; } + USHORT GetFullKeyCode() const { return (nCode) ; } + KeyFuncType GetFullFunction() const { return eFunc; } + BOOL IsDefinedKeyCodeEqual( const KeyCode& rKeyCode ) const; + + USHORT GetCode() const + { return (nCode & KEY_CODE); } + + USHORT GetModifier() const + { return (nCode & KEY_MODTYPE); } + USHORT GetAllModifier() const + { return (nCode & KEY_ALLMODTYPE); } + BOOL IsShift() const + { return ((nCode & KEY_SHIFT) != 0); } + BOOL IsMod1() const + { return ((nCode & KEY_MOD1) != 0); } + BOOL IsMod2() const + { return ((nCode & KEY_MOD2) != 0); } + BOOL IsMod3() const + { return ((nCode & KEY_MOD3) != 0); } + USHORT GetGroup() const + { return (nCode & KEYGROUP_TYPE); } + + XubString GetName( Window* pWindow = NULL ) const; + XubString GetSymbolName( const XubString& rFontName, Window* pWindow = NULL ) const; + + BOOL IsFunction() const + { return ((eFunc != KEYFUNC_DONTKNOW) ? TRUE : FALSE); } + + KeyFuncType GetFunction() const; + + KeyCode& operator = ( const KeyCode& rKeyCode ); + BOOL operator ==( const KeyCode& rKeyCode ) const; + BOOL operator !=( const KeyCode& rKeyCode ) const; +}; + +inline KeyCode::KeyCode( USHORT nKey, BOOL bShift, BOOL bMod1, BOOL bMod2, BOOL bMod3 ) +{ + nCode = nKey; + if( bShift ) + nCode |= KEY_SHIFT; + if( bMod1 ) + nCode |= KEY_MOD1; + if( bMod2 ) + nCode |= KEY_MOD2; + if( bMod3 ) + nCode |= KEY_MOD3; + eFunc = KEYFUNC_DONTKNOW; +} + +inline BOOL KeyCode::operator ==( const KeyCode& rKeyCode ) const +{ + if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc == KEYFUNC_DONTKNOW) ) + return (nCode == rKeyCode.nCode); + else + return (GetFunction() == rKeyCode.GetFunction()); +} + +inline BOOL KeyCode::operator !=( const KeyCode& rKeyCode ) const +{ + if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc == KEYFUNC_DONTKNOW) ) + return (nCode != rKeyCode.nCode); + else + return (GetFunction() != rKeyCode.GetFunction()); +} + +inline BOOL KeyCode::IsDefinedKeyCodeEqual( const KeyCode& rKeyCode ) const +{ + if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc == KEYFUNC_DONTKNOW) ) + return (GetFullKeyCode() == rKeyCode.GetFullKeyCode()); + return (GetFunction() == rKeyCode.GetFunction()); +} + +inline KeyCode& KeyCode::operator = ( const KeyCode& rKeyCode ) +{ + nCode = rKeyCode.nCode; + eFunc = rKeyCode.eFunc; + + return *this; +} + +#endif // _SV_KEYCODE_HXX diff --git a/vcl/inc/vcl/keycodes.hxx b/vcl/inc/vcl/keycodes.hxx new file mode 100644 index 000000000000..cfd4d11c9a7c --- /dev/null +++ b/vcl/inc/vcl/keycodes.hxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * 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_KEYCODES_HXX +#define _SV_KEYCODES_HXX + +#include <vcl/sv.h> +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> + +// ----------------- +// - KeyCode-Types - +// ----------------- + +// By changes you must also change: rsc/vclrsc.hxx + +// Key-Gruppen +#define KEYGROUP_NUM ((USHORT)::com::sun::star::awt::KeyGroup::NUM) +#define KEYGROUP_ALPHA ((USHORT)::com::sun::star::awt::KeyGroup::ALPHA) +#define KEYGROUP_FKEYS ((USHORT)::com::sun::star::awt::KeyGroup::FKEYS) +#define KEYGROUP_CURSOR ((USHORT)::com::sun::star::awt::KeyGroup::CURSOR) +#define KEYGROUP_MISC ((USHORT)::com::sun::star::awt::KeyGroup::MISC) +#define KEYGROUP_TYPE ((USHORT)::com::sun::star::awt::KeyGroup::TYPE) + +// Key-Codes +#define KEY_0 ((USHORT)::com::sun::star::awt::Key::NUM0) +#define KEY_1 ((USHORT)::com::sun::star::awt::Key::NUM1) +#define KEY_2 ((USHORT)::com::sun::star::awt::Key::NUM2) +#define KEY_3 ((USHORT)::com::sun::star::awt::Key::NUM3) +#define KEY_4 ((USHORT)::com::sun::star::awt::Key::NUM4) +#define KEY_5 ((USHORT)::com::sun::star::awt::Key::NUM5) +#define KEY_6 ((USHORT)::com::sun::star::awt::Key::NUM6) +#define KEY_7 ((USHORT)::com::sun::star::awt::Key::NUM7) +#define KEY_8 ((USHORT)::com::sun::star::awt::Key::NUM8) +#define KEY_9 ((USHORT)::com::sun::star::awt::Key::NUM9) + +#define KEY_A ((USHORT)::com::sun::star::awt::Key::A) +#define KEY_B ((USHORT)::com::sun::star::awt::Key::B) +#define KEY_C ((USHORT)::com::sun::star::awt::Key::C) +#define KEY_D ((USHORT)::com::sun::star::awt::Key::D) +#define KEY_E ((USHORT)::com::sun::star::awt::Key::E) +#define KEY_F ((USHORT)::com::sun::star::awt::Key::F) +#define KEY_G ((USHORT)::com::sun::star::awt::Key::G) +#define KEY_H ((USHORT)::com::sun::star::awt::Key::H) +#define KEY_I ((USHORT)::com::sun::star::awt::Key::I) +#define KEY_J ((USHORT)::com::sun::star::awt::Key::J) +#define KEY_K ((USHORT)::com::sun::star::awt::Key::K) +#define KEY_L ((USHORT)::com::sun::star::awt::Key::L) +#define KEY_M ((USHORT)::com::sun::star::awt::Key::M) +#define KEY_N ((USHORT)::com::sun::star::awt::Key::N) +#define KEY_O ((USHORT)::com::sun::star::awt::Key::O) +#define KEY_P ((USHORT)::com::sun::star::awt::Key::P) +#define KEY_Q ((USHORT)::com::sun::star::awt::Key::Q) +#define KEY_R ((USHORT)::com::sun::star::awt::Key::R) +#define KEY_S ((USHORT)::com::sun::star::awt::Key::S) +#define KEY_T ((USHORT)::com::sun::star::awt::Key::T) +#define KEY_U ((USHORT)::com::sun::star::awt::Key::U) +#define KEY_V ((USHORT)::com::sun::star::awt::Key::V) +#define KEY_W ((USHORT)::com::sun::star::awt::Key::W) +#define KEY_X ((USHORT)::com::sun::star::awt::Key::X) +#define KEY_Y ((USHORT)::com::sun::star::awt::Key::Y) +#define KEY_Z ((USHORT)::com::sun::star::awt::Key::Z) + +#define KEY_F1 ((USHORT)::com::sun::star::awt::Key::F1) +#define KEY_F2 ((USHORT)::com::sun::star::awt::Key::F2) +#define KEY_F3 ((USHORT)::com::sun::star::awt::Key::F3) +#define KEY_F4 ((USHORT)::com::sun::star::awt::Key::F4) +#define KEY_F5 ((USHORT)::com::sun::star::awt::Key::F5) +#define KEY_F6 ((USHORT)::com::sun::star::awt::Key::F6) +#define KEY_F7 ((USHORT)::com::sun::star::awt::Key::F7) +#define KEY_F8 ((USHORT)::com::sun::star::awt::Key::F8) +#define KEY_F9 ((USHORT)::com::sun::star::awt::Key::F9) +#define KEY_F10 ((USHORT)::com::sun::star::awt::Key::F10) +#define KEY_F11 ((USHORT)::com::sun::star::awt::Key::F11) +#define KEY_F12 ((USHORT)::com::sun::star::awt::Key::F12) +#define KEY_F13 ((USHORT)::com::sun::star::awt::Key::F13) +#define KEY_F14 ((USHORT)::com::sun::star::awt::Key::F14) +#define KEY_F15 ((USHORT)::com::sun::star::awt::Key::F15) +#define KEY_F16 ((USHORT)::com::sun::star::awt::Key::F16) +#define KEY_F17 ((USHORT)::com::sun::star::awt::Key::F17) +#define KEY_F18 ((USHORT)::com::sun::star::awt::Key::F18) +#define KEY_F19 ((USHORT)::com::sun::star::awt::Key::F19) +#define KEY_F20 ((USHORT)::com::sun::star::awt::Key::F20) +#define KEY_F21 ((USHORT)::com::sun::star::awt::Key::F21) +#define KEY_F22 ((USHORT)::com::sun::star::awt::Key::F22) +#define KEY_F23 ((USHORT)::com::sun::star::awt::Key::F23) +#define KEY_F24 ((USHORT)::com::sun::star::awt::Key::F24) +#define KEY_F25 ((USHORT)::com::sun::star::awt::Key::F25) +#define KEY_F26 ((USHORT)::com::sun::star::awt::Key::F26) + +#define KEY_DOWN ((USHORT)::com::sun::star::awt::Key::DOWN) +#define KEY_UP ((USHORT)::com::sun::star::awt::Key::UP) +#define KEY_LEFT ((USHORT)::com::sun::star::awt::Key::LEFT) +#define KEY_RIGHT ((USHORT)::com::sun::star::awt::Key::RIGHT) +#define KEY_HOME ((USHORT)::com::sun::star::awt::Key::HOME) +#define KEY_END ((USHORT)::com::sun::star::awt::Key::END) +#define KEY_PAGEUP ((USHORT)::com::sun::star::awt::Key::PAGEUP) +#define KEY_PAGEDOWN ((USHORT)::com::sun::star::awt::Key::PAGEDOWN) + +#define KEY_RETURN ((USHORT)::com::sun::star::awt::Key::RETURN) +#define KEY_ESCAPE ((USHORT)::com::sun::star::awt::Key::ESCAPE) +#define KEY_TAB ((USHORT)::com::sun::star::awt::Key::TAB) +#define KEY_BACKSPACE ((USHORT)::com::sun::star::awt::Key::BACKSPACE) +#define KEY_SPACE ((USHORT)::com::sun::star::awt::Key::SPACE) +#define KEY_INSERT ((USHORT)::com::sun::star::awt::Key::INSERT) +#define KEY_DELETE ((USHORT)::com::sun::star::awt::Key::DELETE) + +#define KEY_ADD ((USHORT)::com::sun::star::awt::Key::ADD) +#define KEY_SUBTRACT ((USHORT)::com::sun::star::awt::Key::SUBTRACT) +#define KEY_MULTIPLY ((USHORT)::com::sun::star::awt::Key::MULTIPLY) +#define KEY_DIVIDE ((USHORT)::com::sun::star::awt::Key::DIVIDE) +#define KEY_POINT ((USHORT)::com::sun::star::awt::Key::POINT) +#define KEY_COMMA ((USHORT)::com::sun::star::awt::Key::COMMA) +#define KEY_LESS ((USHORT)::com::sun::star::awt::Key::LESS) +#define KEY_GREATER ((USHORT)::com::sun::star::awt::Key::GREATER) +#define KEY_EQUAL ((USHORT)::com::sun::star::awt::Key::EQUAL) + +#define KEY_OPEN ((USHORT)::com::sun::star::awt::Key::OPEN) +#define KEY_CUT ((USHORT)::com::sun::star::awt::Key::CUT) +#define KEY_COPY ((USHORT)::com::sun::star::awt::Key::COPY) +#define KEY_PASTE ((USHORT)::com::sun::star::awt::Key::PASTE) +#define KEY_UNDO ((USHORT)::com::sun::star::awt::Key::UNDO) +#define KEY_REPEAT ((USHORT)::com::sun::star::awt::Key::REPEAT) +#define KEY_FIND ((USHORT)::com::sun::star::awt::Key::FIND) +#define KEY_PROPERTIES ((USHORT)::com::sun::star::awt::Key::PROPERTIES) +#define KEY_FRONT ((USHORT)::com::sun::star::awt::Key::FRONT) +#define KEY_CONTEXTMENU ((USHORT)::com::sun::star::awt::Key::CONTEXTMENU) +#define KEY_MENU ((USHORT)::com::sun::star::awt::Key::MENU) +#define KEY_HELP ((USHORT)::com::sun::star::awt::Key::HELP) +#define KEY_HANGUL_HANJA ((USHORT)::com::sun::star::awt::Key::HANGUL_HANJA) +#define KEY_DECIMAL ((USHORT)::com::sun::star::awt::Key::DECIMAL) +#define KEY_TILDE ((USHORT)::com::sun::star::awt::Key::TILDE) +#define KEY_QUOTELEFT ((USHORT)::com::sun::star::awt::Key::QUOTELEFT) + +#define KEY_CODE ((USHORT)0x0FFF) + +// Modifier-Tasten +#define KEY_SHIFT ((USHORT)0x1000) +#define KEY_MOD1 ((USHORT)0x2000) +#define KEY_MOD2 ((USHORT)0x4000) +#define KEY_MOD3 ((USHORT)0x8000) +#define KEY_MODTYPE ((USHORT)0xF000) +#define KEY_ALLMODTYPE ((USHORT)0xF000) + +// extended Modifier-Keys (only used for modkey events) +#define MODKEY_LSHIFT 0x0001 +#define MODKEY_RSHIFT 0x0002 +#define MODKEY_LMOD1 0x0004 +#define MODKEY_RMOD1 0x0008 +#define MODKEY_LMOD2 0x0010 +#define MODKEY_RMOD2 0x0020 +#define MODKEY_LMOD3 0x0040 +#define MODKEY_RMOD3 0x0080 +#define MODKEY_SHIFT (MODKEY_LSHIFT|MODKEY_RSHIFT) +#define MODKEY_MOD1 (MODKEY_LMOD1|MODKEY_RMOD1) +#define MODKEY_MOD2 (MODKEY_LMOD2|MODKEY_RMOD2) +#define MODKEY_MOD3 (MODKEY_LMOD3|MODKEY_RMOD3) + +// --------------- +// - Mouse-Types - +// --------------- + +#define MOUSE_LEFT ((USHORT)0x0001) +#define MOUSE_MIDDLE ((USHORT)0x0002) +#define MOUSE_RIGHT ((USHORT)0x0004) + +#endif // _SV_KEYCODES_HXX diff --git a/vcl/inc/vcl/lazydelete.hxx b/vcl/inc/vcl/lazydelete.hxx new file mode 100644 index 000000000000..4176d5b4454f --- /dev/null +++ b/vcl/inc/vcl/lazydelete.hxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * 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_LAZYDELETE_HXX +#define _VCL_LAZYDELETE_HXX + +#include "dllapi.h" + +#include <vector> +#include <hash_map> +#include <algorithm> + +#if OSL_DEBUG_LEVEL > 2 +#include <typeinfo> +#include <stdio.h> +#endif + +namespace vcl +{ + /* Helpers for lazy object deletion + + With vcl it is often necessary to delete objects (especially Windows) + in the right order as well as in a way ensuring that the deleted objects + are not still on the stack (e.g. deleting a Window in its key handler). To + make this easier a helper class is given here which takes care of both + sorting as well as lazy deletion. + + The grisly details: + LazyDelete is a class that LazyDeletor register to. When vcl's event + loop (that is Application::Yield or Application::Reschedule) comes out + of the last level, the LazyDelete::flush is called. This will cause + LazyDelete to delete all registered LazyDeletor objects. + + LazyDeletor<T> is a one instance object that contains a list of + <T> objects to be deleted in sorted order. It is derived from + LazyDeletorBase as to be able to register itself in LazyDelete. + + The user calls the static method LazyDeletor<T>::Delete( T* ) with the + object to be destroyed lazy. The static method creates the LazyDeletor<T> + (which in turn registers itself in LazyDelete) if this is the first time + a T* is to be destroyed lazy. It then inserts the object. When the LazyDeletor<T> + gets delte it will delete the stored objects in a fashion + that will ensure the correct order of deletion via the specialized is_less method + (e.g. if a Window is a child of another Window and therefore should be destroyed + first it is "less" in this sense) + + LazyDelete::flush will be called when the top of the nested event loop is + reached again and will then destroy each registered LazyDeletor<T> which + in turn destroys the objects needed to be destroyed lazily. After this + the state is as before entering the event loop. + + Preconditions: + - The class <T> of which objects are to be destroyed needs a virtual + destructor or must be final, else the wrong type will be destroyed. + - The destructor of <T> should call LazyDeletor<T>::Undelete( this ). This + prevents duplicate deletionin case someone destroys the object prematurely. + */ + + class LazyDeletorBase; + class VCL_DLLPUBLIC LazyDelete + { + public: + /** flush all registered object lists + */ + static void flush(); + /** register an object list to be destroyed + */ + static void addDeletor( LazyDeletorBase* pDeletor ); + }; + + class VCL_DLLPUBLIC LazyDeletorBase + { + friend void LazyDelete::flush(); + protected: + LazyDeletorBase(); + virtual ~LazyDeletorBase(); + }; + + template < typename T > + class VCL_DLLPUBLIC LazyDeletor : public LazyDeletorBase + { + static LazyDeletor< T >* s_pOneInstance; + + struct DeleteObjectEntry + { + T* m_pObject; + bool m_bDeleted; + + DeleteObjectEntry() : + m_pObject( NULL ), + m_bDeleted( false ) + {} + + DeleteObjectEntry( T* i_pObject ) : + m_pObject( i_pObject ), + m_bDeleted( false ) + {} + }; + + std::vector< DeleteObjectEntry > m_aObjects; + typedef std::hash_map< sal_IntPtr, unsigned int > PtrToIndexMap; + PtrToIndexMap m_aPtrToIndex; + + /** strict weak ordering funtion to bring objects to be destroyed lazily + in correct order, e.g. for Window objects children before parents + */ + static bool is_less( T* left, T* right ); + + LazyDeletor() { LazyDelete::addDeletor( this ); } + virtual ~LazyDeletor() + { + #if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "%s %p deleted\n", + typeid(*this).name(), this ); + #endif + if( s_pOneInstance == this ) // sanity check + s_pOneInstance = NULL; + + // do the actual work + unsigned int nCount = m_aObjects.size(); + std::vector<T*> aRealDelete; + aRealDelete.reserve( nCount ); + for( unsigned int i = 0; i < nCount; i++ ) + { + if( ! m_aObjects[i].m_bDeleted ) + { + aRealDelete.push_back( m_aObjects[i].m_pObject ); + } + } + // sort the vector of objects to be destroyed + std::sort( aRealDelete.begin(), aRealDelete.end(), is_less ); + nCount = aRealDelete.size(); + for( unsigned int n = 0; n < nCount; n++ ) + { + #if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "%s deletes object %p of type %s\n", + typeid(*this).name(), + aRealDelete[n], + typeid(*aRealDelete[n]).name() ); + #endif + // check if the object to be deleted is not already destroyed + // as a side effect of a previous lazily destroyed object + if( ! m_aObjects[ m_aPtrToIndex[ reinterpret_cast<sal_IntPtr>(aRealDelete[n]) ] ].m_bDeleted ) + delete aRealDelete[n]; + } + } + + public: + /** mark an object for lazy deletion + */ + static void Delete( T* i_pObject ) + { + if( s_pOneInstance == NULL ) + s_pOneInstance = new LazyDeletor<T>(); + + // is this object already in the list ? + // if so mark it as not to be deleted; else insert it + PtrToIndexMap::const_iterator dup = s_pOneInstance->m_aPtrToIndex.find( reinterpret_cast<sal_IntPtr>(i_pObject) ); + if( dup != s_pOneInstance->m_aPtrToIndex.end() ) + { + s_pOneInstance->m_aObjects[ dup->second ].m_bDeleted = false; + } + else + { + s_pOneInstance->m_aPtrToIndex[ reinterpret_cast<sal_IntPtr>(i_pObject) ] = s_pOneInstance->m_aObjects.size(); + s_pOneInstance->m_aObjects.push_back( DeleteObjectEntry( i_pObject ) ); + } + } + /** unmark an object already marked for lazy deletion + */ + static void Undelete( T* i_pObject ) + { + if( s_pOneInstance ) + { + PtrToIndexMap::const_iterator it = s_pOneInstance->m_aPtrToIndex.find( reinterpret_cast<sal_IntPtr>(i_pObject) ); + if( it != s_pOneInstance->m_aPtrToIndex.end() ) + s_pOneInstance->m_aObjects[ it->second ].m_bDeleted = true; + } + } + }; + + /* + class DeleteOnDeinit matches a similar need as LazyDelete for static objects: + you may not access vcl objects after DeInitVCL has been called this includes their destruction + therefore disallowing the existance of static vcl object like e.g. a static BitmapEx + To work around this use DeleteOnDeinit<BitmapEx> which will allow you to have a static object container, + that will have its contents destroyed on DeinitVCL. The single drawback is that you need to check on the + container object whether it still contains content before actually accessing it. + + caveat: when constructing a vcl object, you certainly want to ensure that InitVCL has run already. + However this is not necessarily the case when using a class static member or a file level static variable. + In these cases make judicious use of the set() method of DeleteOnDeinit, but beware of the changing + ownership. + + example use case: use a lazy initialized on call BitmapEx in a paint method. Of course a paint method + would not normally be called after DeInitVCL anyway, so the check might not be necessary in a + Window::Paint implementation, but always checking is a good idea. + + SomeWindow::Paint() + { + static vcl::DeleteOnDeinit< BitmapEx > aBmp( new BitmapEx( ResId( 1000, myResMgr ) ) ); + + if( aBmp.get() ) // check whether DeInitVCL has been called already + DrawBitmapEx( Point( 10, 10 ), *aBmp.get() ); + } + */ + + class VCL_DLLPUBLIC DeleteOnDeinitBase + { + public: + static void SAL_DLLPRIVATE ImplDeleteOnDeInit(); + virtual ~DeleteOnDeinitBase(); + protected: + static void addDeinitContainer( DeleteOnDeinitBase* i_pContainer ); + + virtual void doCleanup() = 0; + }; + + template < typename T > + class DeleteOnDeinit : public DeleteOnDeinitBase + { + T* m_pT; + virtual void doCleanup() { delete m_pT; m_pT = NULL; } + public: + DeleteOnDeinit( T* i_pT ) : m_pT( i_pT ) { addDeinitContainer( this ); } + virtual ~DeleteOnDeinit() {} + + // get contents + T* get() { return m_pT; } + + // set contents, returning old contents + // ownership is transfered ! + T* set( T* i_pNew ) { T* pOld = m_pT; m_pT = i_pNew; return pOld; } + }; +} + +#endif + diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx new file mode 100644 index 000000000000..9b12966a52ff --- /dev/null +++ b/vcl/inc/vcl/lineinfo.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * 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_LINEINFO_HXX +#define _SV_LINEINFO_HXX + +#include <vcl/dllapi.h> +#include <tools/gen.hxx> +#include <vcl/vclenum.hxx> +#include <basegfx/vector/b2enums.hxx> + +// ---------------- +// - ImplLineInfo - +// ---------------- + +class SvStream; +namespace basegfx { class B2DPolyPolygon; } + +struct ImplLineInfo +{ + ULONG mnRefCount; + LineStyle meStyle; + long mnWidth; + USHORT mnDashCount; + long mnDashLen; + USHORT mnDotCount; + long mnDotLen; + long mnDistance; + + basegfx::B2DLineJoin meLineJoin; + + ImplLineInfo(); + ImplLineInfo( const ImplLineInfo& rImplLineInfo ); + + friend SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ); + friend SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ); +}; + +// ------------ +// - LineInfo - +// ------------ + +class VCL_DLLPUBLIC LineInfo +{ +private: + + ImplLineInfo* mpImplLineInfo; + long n1; + long n2; + long n3; + + SAL_DLLPRIVATE void ImplMakeUnique(); + +public: + + LineInfo( LineStyle eLineStyle = LINE_SOLID, long nWidth = 0L ); + LineInfo( const LineInfo& rLineInfo ); + ~LineInfo(); + + LineInfo& operator=( const LineInfo& rLineInfo ); + BOOL operator==( const LineInfo& rLineInfo ) const; + BOOL operator!=( const LineInfo& rLineInfo ) const { return !(LineInfo::operator==( rLineInfo ) ); } + BOOL IsSameInstance( const LineInfo& rLineInfo ) const { return( mpImplLineInfo == rLineInfo.mpImplLineInfo ); } + + void SetStyle( LineStyle eStyle ); + LineStyle GetStyle() const { return mpImplLineInfo->meStyle; } + + void SetWidth( long nWidth ); + long GetWidth() const { return mpImplLineInfo->mnWidth; } + + void SetDashCount( USHORT nDashCount ); + USHORT GetDashCount() const { return mpImplLineInfo->mnDashCount; } + + void SetDashLen( long nDashLen ); + long GetDashLen() const { return mpImplLineInfo->mnDashLen; } + + void SetDotCount( USHORT nDotCount ); + USHORT GetDotCount() const { return mpImplLineInfo->mnDotCount; } + + void SetDotLen( long nDotLen ); + long GetDotLen() const { return mpImplLineInfo->mnDotLen; } + + void SetDistance( long nDistance ); + long GetDistance() const { return mpImplLineInfo->mnDistance; } + + void SetLineJoin(basegfx::B2DLineJoin eLineJoin); + basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; } + + BOOL IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo ); + + // helper to check if line width or DashDot is used + bool isDashDotOrFatLineUsed() const; + + // helper to get decomposed polygon data with the LineInfo applied. The source + // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may + // contain results; e.g. when no fat line but DasDot is defined, the resut will + // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line + // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will + // not be changed (but o_rFillPolyPolygon will be freed) + void applyToB2DPolyPolygon( + basegfx::B2DPolyPolygon& io_rLinePolyPolygon, + basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const; +}; + +#endif // _SV_LINEINFO_HXX diff --git a/vcl/inc/vcl/longcurr.hxx b/vcl/inc/vcl/longcurr.hxx new file mode 100644 index 000000000000..39bd75439ad9 --- /dev/null +++ b/vcl/inc/vcl/longcurr.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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 _LONGCURR_HXX +#define _LONGCURR_HXX + +#include <vcl/dllapi.h> +#include <tools/bigint.hxx> +#ifndef _FIELD_HXX +#include <vcl/field.hxx> +#endif + +class LocaleDataWrapper; + +// ------------------------- +// - LongCurrencyFormatter - +// ------------------------- + +class VCL_DLLPUBLIC LongCurrencyFormatter : public FormatterBase +{ +private: + SAL_DLLPRIVATE friend BOOL ImplLongCurrencyReformat( const XubString&, BigInt, BigInt, USHORT, const LocaleDataWrapper&, XubString&, LongCurrencyFormatter& ); + SAL_DLLPRIVATE void ImpInit(); + +protected: + BigInt mnFieldValue; + BigInt mnLastValue; + BigInt mnMin; + BigInt mnMax; + BigInt mnCorrectedValue; + String maCurrencySymbol; + USHORT mnType; + USHORT mnDecimalDigits; + BOOL mbThousandSep; + + LongCurrencyFormatter(); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + ~LongCurrencyFormatter(); + + virtual void Reformat(); + virtual void ReformatAll(); + + void SetUseThousandSep( BOOL b ); + BOOL IsUseThousandSep() const { return mbThousandSep; } + + void SetCurrencySymbol( const String& rStr ); + String GetCurrencySymbol() const; + + void SetMin( BigInt nNewMin ); + BigInt GetMin() const { return mnMin; } + void SetMax( BigInt nNewMax ); + BigInt GetMax() const { return mnMax; } + + void SetDecimalDigits( USHORT nDigits ); + USHORT GetDecimalDigits() const; + void SetValue( BigInt nNewValue ); + void SetUserValue( BigInt nNewValue ); + BigInt GetValue() const; + BOOL IsValueModified() const; + + void SetEmptyValue(); + BOOL IsEmptyValue() const { return !GetField()->GetText().Len(); } + + BigInt GetCorrectedValue() const { return mnCorrectedValue; } + + BigInt Normalize( BigInt nValue ) const; + BigInt Denormalize( BigInt nValue ) const; +}; + +// --------------------- +// - LongCurrencyField - +// --------------------- + +class VCL_DLLPUBLIC LongCurrencyField : public SpinField, public LongCurrencyFormatter +{ +//#if 0 // _SOLAR__PRIVATE + friend void ImplNewLongCurrencyFieldValue( LongCurrencyField*, BigInt ); +//#endif + +private: + BigInt mnSpinSize; + BigInt mnFirst; + BigInt mnLast; + +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + LongCurrencyField( Window* pParent, WinBits nWinStyle ); + LongCurrencyField( Window* pParent, const ResId& rResId ); + ~LongCurrencyField(); + + long PreNotify( NotifyEvent& rNEvt ); + long Notify( NotifyEvent& rNEvt ); + + void Modify(); + void Up(); + void Down(); + void First(); + void Last(); + + void SetFirst( BigInt nNewFirst ) { mnFirst = nNewFirst; } + BigInt GetFirst() const { return mnFirst; } + void SetLast( BigInt nNewLast ) { mnLast = nNewLast; } + BigInt GetLast() const { return mnLast; } + void SetSpinSize( BigInt nNewSize ) { mnSpinSize = nNewSize; } + BigInt GetSpinSize() const { return mnSpinSize; } +}; + +// ------------------- +// - LongCurrencyBox - +// ------------------- + +class VCL_DLLPUBLIC LongCurrencyBox : public ComboBox, public LongCurrencyFormatter +{ +public: + LongCurrencyBox( Window* pParent, WinBits nWinStyle ); + LongCurrencyBox( Window* pParent, const ResId& rResId ); + ~LongCurrencyBox(); + + long PreNotify( NotifyEvent& rNEvt ); + long Notify( NotifyEvent& rNEvt ); + + void Modify(); + void ReformatAll(); + + void InsertValue( BigInt nValue, + USHORT nPos = COMBOBOX_APPEND ); + void RemoveValue( BigInt nValue ); + BigInt GetValue() const + { return LongCurrencyFormatter::GetValue(); } + BigInt GetValue( USHORT nPos ) const; + USHORT GetValuePos( BigInt nValue ) const; +}; + +#endif // _LONGCURR_HXX diff --git a/vcl/inc/vcl/lstbox.h b/vcl/inc/vcl/lstbox.h new file mode 100644 index 000000000000..db800229b2d2 --- /dev/null +++ b/vcl/inc/vcl/lstbox.h @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_LSTBOX_H +#define _SV_LSTBOX_H + +#define LISTBOX_APPEND ((USHORT)0xFFFF) +#define LISTBOX_ENTRY_NOTFOUND ((USHORT)0xFFFF) +#define LISTBOX_ERROR ((USHORT)0xFFFF) + +#define LISTBOX_USERDRAW_SELECTED ((USHORT)0x0001) + +// -------------------------------------------------------------------- + +// the following defines can be used for the SetEntryFlags() +// and GetEntryFlags() methods + +// !! Do not use these flags for user data as they are reserved !! +// !! to change the internal behaviour of the ListBox implementation !! +// !! for specific entries. !! + +/** this flag disables a selection of an entry completly. It is not + possible to select such entries either from the user interface + nor from the ListBox methods. Cursor traveling is handled correctly. + This flag can be used to add titles to a ListBox. +*/ +#define LISTBOX_ENTRY_FLAG_DISABLE_SELECTION 0x0000001 + +/** this flag can be used to make an entry multine capable + A normal entry is single line and will therefore be clipped + at the right listbox border. Setting this flag enables + word breaks for the entry text. +*/ +#define LISTBOX_ENTRY_FLAG_MULTILINE 0x0000002 + +/** this flags lets the item be drawn disabled (e.g. in grey text) + usage only guaranteed with LISTBOX_ENTRY_FLAG_DISABLE_SELECTION +*/ +#define LISTBOX_ENTRY_FLAG_DRAW_DISABLED 0x0000004 + +#endif // _SV_LSTBOX_H diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx new file mode 100644 index 000000000000..3659e5aee485 --- /dev/null +++ b/vcl/inc/vcl/lstbox.hxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * 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_LSTBOX_HXX +#define _SV_LSTBOX_HXX + +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +#include <vcl/lstbox.h> + +class Image; +class ImplListBox; +class ImplListBoxFloatingWindow; +class ImplBtn; +class ImplWin; + +// -------------------------------------------------------------------- +// - ListBox - +// -------------------------------------------------------------------- + +class VCL_DLLPUBLIC ListBox : public Control +{ +private: + ImplListBox* mpImplLB; + ImplListBoxFloatingWindow* mpFloatWin; + ImplWin* mpImplWin; + ImplBtn* mpBtn; + USHORT mnDDHeight; + USHORT mnSaveValue; + BOOL mbDDAutoSize; + Link maSelectHdl; + Link maDoubleClickHdl; + USHORT mnLineCount; + +//#if 0 // _SOLAR__PRIVATE +private: + SAL_DLLPRIVATE void ImplInitListBoxData(); + + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplScrollHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplCancelHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplClickBtnHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplUserDrawHdl, UserDrawEvent* ); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); +//#endif + BOOL IsDropDownBox() const { return mpFloatWin ? TRUE : FALSE; } + +protected: + ListBox( WindowType nType ); + + virtual void FillLayoutData() const; + +public: + ListBox( Window* pParent, WinBits nStyle = WB_BORDER ); + ListBox( Window* pParent, const ResId& rResId ); + ~ListBox(); + + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + virtual void Select(); + virtual void DoubleClick(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual Window* GetPreferredKeyInputWindow(); + + virtual const Wallpaper& GetDisplayBackground() const; + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, USHORT nFlags = WINDOW_POSSIZE_ALL ); + void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) + { Control::SetPosSizePixel( rNewPos, rNewSize ); } + void SetDropDownSizePixel( const Size& rNewSize ) + { if( IsDropDownBox() ) SetPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(), WINDOW_POSSIZE_SIZE | WINDOW_POSSIZE_DROPDOWN ); } + + Rectangle GetDropDownPosSizePixel() const; + + void SetDropDownLineCount( USHORT nLines ); + USHORT GetDropDownLineCount() const; + + void EnableAutoSize( BOOL bAuto ); + BOOL IsAutoSizeEnabled() const { return mbDDAutoSize; } + + void EnableDDAutoWidth( BOOL b ); + BOOL IsDDAutoWidthEnabled() const; + + virtual USHORT InsertEntry( const XubString& rStr, USHORT nPos = LISTBOX_APPEND ); + virtual USHORT InsertEntry( const Image& rImage, USHORT nPos = LISTBOX_APPEND ); + virtual USHORT InsertEntry( const XubString& rStr, const Image& rImage, USHORT nPos = LISTBOX_APPEND ); + virtual void RemoveEntry( const XubString& rStr ); + virtual void RemoveEntry( USHORT nPos ); + + virtual void Clear(); + + virtual USHORT GetEntryPos( const XubString& rStr ) const; + virtual USHORT GetEntryPos( const void* pData ) const; + Image GetEntryImage( USHORT nPos ) const; + virtual XubString GetEntry( USHORT nPos ) const; + virtual USHORT GetEntryCount() const; + + virtual void SelectEntry( const XubString& rStr, BOOL bSelect = TRUE ); + virtual void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ); + + virtual USHORT GetSelectEntryCount() const; + virtual XubString GetSelectEntry( USHORT nSelIndex = 0 ) const; + virtual USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const; + + virtual BOOL IsEntrySelected( const XubString& rStr ) const; + virtual BOOL IsEntryPosSelected( USHORT nPos ) const; + virtual void SetNoSelection(); + + void SetEntryData( USHORT nPos, void* pNewData ); + void* GetEntryData( USHORT nPos ) const; + + /** this methods stores a combination of flags from the + LISTBOX_ENTRY_FLAG_* defines at the given entry. + See description of the possible LISTBOX_ENTRY_FLAG_* flags + for details. + Do not use these flags for user data as they are reserved + to change the internal behaviour of the ListBox implementation + for specific entries. + */ + void SetEntryFlags( USHORT nPos, long nFlags ); + + /** this methods gets the current combination of flags from the + LISTBOX_ENTRY_FLAG_* defines from the given entry. + See description of the possible LISTBOX_ENTRY_FLAG_* flags + for details. + */ + long GetEntryFlags( USHORT nPos ) const; + + void SetTopEntry( USHORT nPos ); + void ShowProminentEntry( USHORT nPos ); + void SetTopEntryStr( const XubString& rStr ); + USHORT GetTopEntry() const; + + void SetProminentEntryType( ProminentEntry eType ); + ProminentEntry GetProminentEntryType() const; + + void SaveValue() { mnSaveValue = GetSelectEntryPos(); } + USHORT GetSavedValue() const { return mnSaveValue; } + + void SetSeparatorPos( USHORT n ); + void SetSeparatorPos(); + USHORT GetSeparatorPos() const; + + BOOL IsTravelSelect() const; + BOOL IsInDropDown() const; + void ToggleDropDown(); + + void EnableMultiSelection( BOOL bMulti, BOOL bStackSelection ); + void EnableMultiSelection( BOOL bMulti ); + BOOL IsMultiSelectionEnabled() const; + + void SetReadOnly( BOOL bReadOnly = TRUE ); + BOOL IsReadOnly() const; + + long CalcWindowSizePixel( USHORT nLines ) const; + Rectangle GetBoundingRectangle( USHORT nItem ) const; + + void SetUserItemSize( const Size& rSz ); + const Size& GetUserItemSize() const; + + void EnableUserDraw( BOOL bUserDraw ); + BOOL IsUserDrawEnabled() const; + + void DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos = FALSE ); + + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } + const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + + Size CalcMinimumSize() const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + Size CalcAdjustedSize( const Size& rPrefSize ) const; + Size CalcSize( USHORT nColumns, USHORT nLines ) const; + void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const; + + void SetMRUEntries( const XubString& rEntries, xub_Unicode cSep = ';' ); + XubString GetMRUEntries( xub_Unicode cSep = ';' ) const; + void SetMaxMRUCount( USHORT n ); + USHORT GetMaxMRUCount() const; + + USHORT GetDisplayLineCount() const; + + void EnableMirroring(); + + /** checks whether a certain point lies within the bounds of + a listbox item and returns the item as well as the character position + the point is at. + + <p>If the point is inside an item the item pos is put into <code>rPos</code> and + the item-relative character index is returned. If the point is not inside + an item -1 is returned and rPos is unchanged.</p> + + @param rPoint + tells the point for which an item is requested. + + @param rPos + gets the item at the specified point <code>rPoint</code> + + @returns + the item-relative character index at point <code>rPos</code> or -1 + if no item is at that point. + */ + using Control::GetIndexForPoint; + long GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const; +}; + +// ---------------- +// - MultiListBox - +// ---------------- + +class VCL_DLLPUBLIC MultiListBox : public ListBox +{ +public: + using ListBox::SaveValue; + using ListBox::GetSavedValue; +private: + // Bei MultiListBox nicht erlaubt... + void SaveValue(); + USHORT GetSavedValue(); + +public: + MultiListBox( Window* pParent, WinBits nStyle = 0 ); + MultiListBox( Window* pParent, const ResId& rResId ); +}; + +#endif // _SV_LSTBOX_HXX diff --git a/vcl/inc/vcl/mapmod.hxx b/vcl/inc/vcl/mapmod.hxx new file mode 100644 index 000000000000..b2ea32958e90 --- /dev/null +++ b/vcl/inc/vcl/mapmod.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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_MAPMOD_HXX +#define _SV_MAPMOD_HXX + +#include <tools/gen.hxx> +#include <tools/fract.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/resid.hxx> +#include <vcl/mapunit.hxx> + +class SvStream; + +// -------------- +// - ImplMapMode - +// -------------- + +class OutputDevice; + +class ImplMapMode +{ + friend class MapMode; + friend class OutputDevice; + +private: + ULONG mnRefCount; + MapUnit meUnit; + Point maOrigin; + Fraction maScaleX; + Fraction maScaleY; + BOOL mbSimple; + + friend SvStream& operator>>( SvStream& rIStm, ImplMapMode& rMapMode ); + friend SvStream& operator<<( SvStream& rOStm, const ImplMapMode& rMapMode ); + + static ImplMapMode* ImplGetStaticMapMode( MapUnit eUnit ); +public: + ImplMapMode(); + ImplMapMode( const ImplMapMode& rImpMapMode ); +}; + +// ----------- +// - MapMode - +// ----------- + +class VCL_DLLPUBLIC MapMode +{ + friend class OutputDevice; + +private: + ImplMapMode* mpImplMapMode; + + SAL_DLLPRIVATE void ImplMakeUnique(); + +public: + MapMode(); + MapMode( const MapMode& rMapMode ); + MapMode( MapUnit eUnit ); + MapMode( MapUnit eUnit, const Point& rLogicOrg, + const Fraction& rScaleX, const Fraction& rScaleY ); + ~MapMode(); + + void SetMapUnit( MapUnit eUnit ); + MapUnit GetMapUnit() const + { return mpImplMapMode->meUnit; } + + void SetOrigin( const Point& rOrigin ); + const Point& GetOrigin() const + { return mpImplMapMode->maOrigin; } + + void SetScaleX( const Fraction& rScaleX ); + const Fraction& GetScaleX() const + { return mpImplMapMode->maScaleX; } + void SetScaleY( const Fraction& rScaleY ); + const Fraction& GetScaleY() const + { return mpImplMapMode->maScaleY; } + + MapMode& operator=( const MapMode& rMapMode ); + BOOL operator==( const MapMode& rMapMode ) const; + BOOL operator!=( const MapMode& rMapMode ) const + { return !(MapMode::operator==( rMapMode )); } + BOOL IsDefault() const; + BOOL IsSameInstance( const MapMode& rMapMode ) const + { return (mpImplMapMode == rMapMode.mpImplMapMode); } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, MapMode& rMapMode ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const MapMode& rMapMode ); +}; + +#endif // _SV_MAPMOD_HXX diff --git a/vcl/inc/vcl/mapunit.hxx b/vcl/inc/vcl/mapunit.hxx new file mode 100644 index 000000000000..b4c757c538e6 --- /dev/null +++ b/vcl/inc/vcl/mapunit.hxx @@ -0,0 +1,33 @@ +/************************************************************************* + * + * 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_MAPUNIT_HXX +#define _VCL_MAPUNIT_HXX + +#include <tools/mapunit.hxx> + +#endif // _VCL_MAPUNIT_HXX diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx new file mode 100644 index 000000000000..908f3e30319c --- /dev/null +++ b/vcl/inc/vcl/menu.hxx @@ -0,0 +1,534 @@ +/************************************************************************* + * + * 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_MENU_HXX +#define _SV_MENU_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/rc.hxx> +#include <tools/resid.hxx> +#include <vcl/bitmapex.hxx> +#include <tools/color.hxx> +#include <vcl/vclevent.hxx> +#include <com/sun/star/uno/Reference.hxx> + +struct MenuItemData; +class Point; +class Size; +class Rectangle; +class Menu; +class MenuItemList; +class HelpEvent; +class Image; +class PopupMenu; +class KeyCode; +class KeyEvent; +class AppBarWindow; +class MenuFloatingWindow; +class Window; +class SalMenu; +struct SystemMenuData; + +namespace com { +namespace sun { +namespace star { +namespace accessibility { + class XAccessible; +}}}} + +namespace vcl { struct MenuLayoutData; } + +// -------------- +// - Menu-Types - +// -------------- + +#define MENU_APPEND ((USHORT)0xFFFF) +#define MENU_ITEM_NOTFOUND ((USHORT)0xFFFF) + +#define POPUPMENU_EXECUTE_DOWN ((USHORT)0x0001) +#define POPUPMENU_EXECUTE_UP ((USHORT)0x0002) +#define POPUPMENU_EXECUTE_LEFT ((USHORT)0x0004) +#define POPUPMENU_EXECUTE_RIGHT ((USHORT)0x0008) + +#define POPUPMENU_NOMOUSEUPCLOSE ((USHORT)0x0010) + +// By changes you must also change: rsc/vclrsc.hxx +enum MenuItemType { MENUITEM_DONTKNOW, MENUITEM_STRING, MENUITEM_IMAGE, + MENUITEM_STRINGIMAGE, MENUITEM_SEPARATOR }; + +// By changes you must also change: rsc/vclrsc.hxx +typedef USHORT MenuItemBits; +#define MIB_CHECKABLE ((MenuItemBits)0x0001) +#define MIB_RADIOCHECK ((MenuItemBits)0x0002) +#define MIB_AUTOCHECK ((MenuItemBits)0x0004) +#define MIB_ABOUT ((MenuItemBits)0x0008) +#define MIB_HELP ((MenuItemBits)0x0010) +#define MIB_POPUPSELECT ((MenuItemBits)0x0020) +// not in rsc/vclsrc.hxx because only a prelimitary solution +#define MIB_NOSELECT ((MenuItemBits)0x0040) +#define MIB_ICON ((MenuItemBits)0x0080) +#define MIB_TEXT ((MenuItemBits)0x0100) + +#define MENU_FLAG_NOAUTOMNEMONICS 0x0001 +#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002 + +// overrides default hiding of disabled entries in popup menus +#define MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES 0x0004 + +// forces images & toggle visibility for toolbar config popup +#define MENU_FLAG_SHOWCHECKIMAGES 0x0008 + +struct ImplMenuDelData +{ + ImplMenuDelData* mpNext; + const Menu* mpMenu; + + ImplMenuDelData( const Menu* pMenu ); + ~ImplMenuDelData(); + + bool isDeleted() const { return mpMenu == 0; } +}; + +// -------- +// - Menu - +// -------- + +struct MenuLogo +{ + BitmapEx aBitmap; + Color aStartColor; + Color aEndColor; +}; + +class VCL_DLLPUBLIC Menu : public Resource +{ + friend class MenuBar; + friend class MenuBarWindow; + friend class MenuFloatingWindow; + friend class PopupMenu; + friend class SystemWindow; + friend struct ImplMenuDelData; +private: + ImplMenuDelData* mpFirstDel; + MenuItemList* pItemList; // Liste mit den MenuItems + MenuLogo* pLogo; + Menu* pStartedFrom; + Window* pWindow; + + Link aActivateHdl; // Active-Handler + Link aDeactivateHdl; // Deactivate-Handler + Link aHighlightHdl; // Highlight-Handler + Link aSelectHdl; // Highlight-Handler + + VclEventListeners maEventListeners; + VclEventListeners maChildEventListeners; + + XubString aTitleText; // PopupMenu-Text + + ULONG nEventId; + USHORT mnHighlightedItemPos; // for native menues: keeps track of the highlighted item + USHORT nMenuFlags; + USHORT nDefaultItem; // Id vom Default-Item + USHORT nSelectedId; + + // Fuer Ausgabe: + USHORT nCheckPos; + USHORT nImagePos; + USHORT nTextPos; + + BOOL bIsMenuBar : 1, // Handelt es sich um den MenuBar + bCanceled : 1, // Waehrend eines Callbacks abgebrochen + bInCallback : 1, // In Activate/Deactivate + bKilled : 1; // Gekillt... + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible; + mutable vcl::MenuLayoutData* mpLayoutData; + SalMenu* mpSalMenu; + +protected: + SAL_DLLPRIVATE void ImplInit(); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE Menu* ImplGetStartMenu(); + SAL_DLLPRIVATE Menu* ImplFindSelectMenu(); + SAL_DLLPRIVATE Menu* ImplFindMenu( USHORT nId ); + SAL_DLLPRIVATE Size ImplCalcSize( Window* pWin ); + SAL_DLLPRIVATE BOOL ImplIsVisible( USHORT nPos ) const; + SAL_DLLPRIVATE BOOL ImplIsSelectable( USHORT nPos ) const; + SAL_DLLPRIVATE USHORT ImplGetVisibleItemCount() const; + SAL_DLLPRIVATE USHORT ImplGetFirstVisible() const; + SAL_DLLPRIVATE USHORT ImplGetPrevVisible( USHORT nPos ) const; + SAL_DLLPRIVATE USHORT ImplGetNextVisible( USHORT nPos ) const; + SAL_DLLPRIVATE void ImplPaint( Window* pWin, USHORT nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0, BOOL bHighlighted = FALSE, bool bLayout = false ) const; + SAL_DLLPRIVATE void ImplSelect(); + SAL_DLLPRIVATE void ImplCallHighlight( USHORT nHighlightItem ); + SAL_DLLPRIVATE void ImplCallEventListeners( ULONG nEvent, USHORT nPos ); + DECL_DLLPRIVATE_LINK( ImplCallSelect, Menu* ); + + SAL_DLLPRIVATE void ImplFillLayoutData() const; + SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu; } + SAL_DLLPRIVATE void ImplSetSalMenu( SalMenu *pMenu ); + SAL_DLLPRIVATE const XubString& ImplGetHelpText( USHORT nItemId ) const; + + // returns native check and option menu symbol height; + // return value is Max( rCheckHeight, rRadioHeight ) + SAL_DLLPRIVATE long ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const; + + SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel ); + SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); +public: + SAL_DLLPRIVATE void ImplKillLayoutData() const; + SAL_DLLPRIVATE Menu* ImplGetStartedFrom() const; + + Menu(); + Menu( BOOL bMenuBar ); + SAL_DLLPRIVATE Window* ImplGetWindow() const { return pWindow; } + + + SAL_DLLPRIVATE void ImplSelectWithStart( Menu* pStartMenu = NULL ); +public: + virtual ~Menu(); + + virtual void Activate(); + virtual void Deactivate(); + virtual void Highlight(); + virtual void Select(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + + void InsertItem( USHORT nItemId, const XubString& rStr, + MenuItemBits nItemBits = 0, + USHORT nPos = MENU_APPEND ); + void InsertItem( USHORT nItemId, const Image& rImage, + MenuItemBits nItemBits = 0, + USHORT nPos = MENU_APPEND ); + void InsertItem( USHORT nItemId, + const XubString& rString, const Image& rImage, + MenuItemBits nItemBits = 0, + USHORT nPos = MENU_APPEND ); + void InsertItem( const ResId& rResId, USHORT nPos = MENU_APPEND ); + void InsertSeparator( USHORT nPos = MENU_APPEND ); + void RemoveItem( USHORT nPos ); + void CopyItem( const Menu& rMenu, USHORT nPos, + USHORT nNewPos = MENU_APPEND ); + void Clear(); + + void CreateAutoMnemonics(); + + void SetMenuFlags( USHORT nFlags ) { nMenuFlags = nFlags; } + USHORT GetMenuFlags() const { return nMenuFlags; } + + USHORT GetItemCount() const; + USHORT GetItemId( USHORT nPos ) const; + USHORT GetItemPos( USHORT nItemId ) const; + MenuItemType GetItemType( USHORT nPos ) const; + USHORT GetCurItemId() const; + + void SetDefaultItem( USHORT nItemId ) { nDefaultItem = nItemId; } + USHORT GetDefaultItem() const { return nDefaultItem; } + + void SetItemBits( USHORT nItemId, MenuItemBits nBits ); + MenuItemBits GetItemBits( USHORT nItemId ) const; + + void SetUserValue( USHORT nItemId, ULONG nValue ); + ULONG GetUserValue( USHORT nItemId ) const; + + void SetPopupMenu( USHORT nItemId, PopupMenu* pMenu ); + PopupMenu* GetPopupMenu( USHORT nItemId ) const; + + void SetAccelKey( USHORT nItemId, const KeyCode& rKeyCode ); + KeyCode GetAccelKey( USHORT nItemId ) const; + + void CheckItem( USHORT nItemId, BOOL bCheck = TRUE ); + BOOL IsItemChecked( USHORT nItemId ) const; + + void SelectItem( USHORT nItemId ); + void DeSelect() { SelectItem( 0xFFFF ); } // MENUITEMPOS_INVALID + + void EnableItem( USHORT nItemId, BOOL bEnable = TRUE ); + BOOL IsItemEnabled( USHORT nItemId ) const; + + void ShowItem( USHORT nItemId, BOOL bVisible = TRUE ); + void HideItem( USHORT nItemId ) { ShowItem( nItemId, FALSE ); } + + BOOL IsItemVisible( USHORT nItemId ) const; + BOOL IsItemPosVisible( USHORT nItemPos ) const; + BOOL IsMenuVisible() const; + BOOL IsMenuBar() const { return bIsMenuBar; } + + void RemoveDisabledEntries( BOOL bCheckPopups = TRUE, BOOL bRemoveEmptyPopups = FALSE ); + BOOL HasValidEntries( BOOL bCheckPopups = TRUE ); + + void SetItemText( USHORT nItemId, const XubString& rStr ); + XubString GetItemText( USHORT nItemId ) const; + + void SetItemImage( USHORT nItemId, const Image& rImage ); + Image GetItemImage( USHORT nItemId ) const; + void SetItemImageAngle( USHORT nItemId, long nAngle10 ); + long GetItemImageAngle( USHORT nItemId ) const; + void SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ); + BOOL GetItemImageMirrorMode( USHORT ) const; + + void SetItemCommand( USHORT nItemId, const XubString& rCommand ); + const XubString& GetItemCommand( USHORT nItemId ) const; + + void SetHelpText( USHORT nItemId, const XubString& rString ); + const XubString& GetHelpText( USHORT nItemId ) const; + + void SetTipHelpText( USHORT nItemId, const XubString& rString ); + const XubString& GetTipHelpText( USHORT nItemId ) const; + + void SetHelpCommand( USHORT nItemId, const XubString& rString ); + const XubString& GetHelpCommand( USHORT nItemId ) const; + + void SetHelpId( USHORT nItemId, ULONG nHelpId ); + ULONG GetHelpId( USHORT nItemId ) const; + + void SetActivateHdl( const Link& rLink ) { aActivateHdl = rLink; } + const Link& GetActivateHdl() const { return aActivateHdl; } + + void SetDeactivateHdl( const Link& rLink ) { aDeactivateHdl = rLink; } + const Link& GetDeactivateHdl() const { return aDeactivateHdl; } + + void SetHighlightHdl( const Link& rLink ) { aHighlightHdl = rLink; } + const Link& GetHighlightHdl() const { return aHighlightHdl; } + + void SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; } + const Link& GetSelectHdl() const { return aSelectHdl; } + + void SetLogo( const MenuLogo& rLogo ); + void SetLogo(); + BOOL HasLogo() const { return pLogo ? TRUE : FALSE; } + MenuLogo GetLogo() const; + + void AddEventListener( const Link& rEventListener ); + void RemoveEventListener( const Link& rEventListener ); + //void AddChildEventListener( const Link& rEventListener ); + //void RemoveChildEventListener( const Link& rEventListener ); + + Menu& operator =( const Menu& rMenu ); + + // Fuer Menu-'Funktionen' + MenuItemList* GetItemList() const { return pItemList; } + + // returns the system's menu handle if native menues are supported + // pData must point to a SystemMenuData structure + BOOL GetSystemMenuData( SystemMenuData* pData ) const; + + // accessibility helpers + + // gets the displayed text + String GetDisplayText() const; + // returns the bounding box for the character at index nIndex + // where nIndex is relative to the starting index of the item + // with id nItemId (in coordinates of the displaying window) + Rectangle GetCharacterBounds( USHORT nItemId, long nIndex ) const; + // -1 is returned if no character is at that point + // if an index is found the corresponding item id is filled in (else 0) + long GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const; + // returns the number of lines in the result of GetDisplayText() + long GetLineCount() const; + // returns the interval [start,end] of line nLine + // returns [-1,-1] for an invalid line + Pair GetLineStartEnd( long nLine ) const; + // like GetLineStartEnd but first finds the line number for the item + Pair GetItemStartEnd( USHORT nItemId ) const; + // returns the item id for line nLine or 0 if nLine is invalid + USHORT GetDisplayItemId( long nLine ) const; + // returns the bounding rectangle for an item at pos nItemPos + Rectangle GetBoundingRectangle( USHORT nItemPos ) const; + BOOL ConvertPoint( Point& rPoint, Window* pReferenceWindow ) const; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible(); + void SetAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible ); + + // gets the activation key of the specified item + KeyEvent GetActivationKey( USHORT nItemId ) const; + + Window* GetWindow() const { return pWindow; } + + void SetAccessibleName( USHORT nItemId, const XubString& rStr ); + XubString GetAccessibleName( USHORT nItemId ) const; + + void SetAccessibleDescription( USHORT nItemId, const XubString& rStr ); + XubString GetAccessibleDescription( USHORT nItemId ) const; + + // returns whether the item a position nItemPos is highlighted or not. + bool IsHighlighted( USHORT nItemPos ) const; + + void HighlightItem( USHORT nItemPos ); + void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID + + + void doLazyDelete(); +}; + +// ----------- +// - MenuBar - +// ----------- + +class VCL_DLLPUBLIC MenuBar : public Menu +{ + Link maCloserHdl; + Link maFloatHdl; + Link maHideHdl; + BOOL mbCloserVisible; + BOOL mbFloatBtnVisible; + BOOL mbHideBtnVisible; + BOOL mbDisplayable; + +//#if 0 // _SOLAR__PRIVATE + friend class Application; + friend class Menu; + friend class MenuBarWindow; + friend class MenuFloatingWindow; + friend class SystemWindow; + + SAL_DLLPRIVATE static Window* ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu ); + SAL_DLLPRIVATE static void ImplDestroy( MenuBar* pMenu, BOOL bDelete ); + SAL_DLLPRIVATE BOOL ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu = TRUE ); +//#endif + +public: + MenuBar(); + MenuBar( const ResId& rResId ); + MenuBar( const MenuBar& rMenu ); + ~MenuBar(); + + MenuBar& operator =( const MenuBar& rMenu ); + + void ShowCloser( BOOL bShow = TRUE ); + BOOL HasCloser() const { return mbCloserVisible; } + void ShowFloatButton( BOOL bShow = TRUE ); + BOOL HasFloatButton() const { return mbFloatBtnVisible; } + void ShowHideButton( BOOL bShow = TRUE ); + BOOL HasHideButton() const { return mbHideBtnVisible; } + void ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide ); + + void SelectEntry( USHORT nId ); + BOOL HandleMenuActivateEvent( Menu *pMenu ) const; + BOOL HandleMenuDeActivateEvent( Menu *pMenu ) const; + BOOL HandleMenuHighlightEvent( Menu *pMenu, USHORT nEventId ) const; + BOOL HandleMenuCommandEvent( Menu *pMenu, USHORT nEventId ) const; + BOOL HandleMenuButtonEvent( Menu *pMenu, USHORT nEventId ) const; + + void SetCloserHdl( const Link& rLink ) { maCloserHdl = rLink; } + const Link& GetCloserHdl() const { return maCloserHdl; } + void SetFloatButtonClickHdl( const Link& rLink ) { maFloatHdl = rLink; } + const Link& GetFloatButtonClickHdl() const { return maFloatHdl; } + void SetHideButtonClickHdl( const Link& rLink ) { maHideHdl = rLink; } + const Link& GetHideButtonClickHdl() const { return maHideHdl; } + + // - by default a menubar is displayable + // - if a menubar is not displayable, its MenuBarWindow will never be shown + // and it will be hidden if it was visible before + // - note: if a menubar is diplayable, this does not necessarily mean that it is currently visible + void SetDisplayable( BOOL bDisplayable ); + BOOL IsDisplayable() const { return mbDisplayable; } + + struct MenuBarButtonCallbackArg + { + USHORT nId; // Id of the button + bool bHighlight; // highlight on/off + MenuBar* pMenuBar; // menubar the button belongs to + }; + // add an arbitrary button to the menubar (will appear next to closer) + // passed link will be call with a MenuBarButtonCallbackArg on press + USHORT AddMenuBarButton( const Image&, const Link&, USHORT nPos = 0 ); + // add an arbitrary button to the menubar (will appear next to closer) + // passed link will be call with a MenuBarButtonCallbackArg on press + // passed string will be set as tooltip + USHORT AddMenuBarButton( const Image&, const Link&, const String&, USHORT nPos = 0 ); + // set the highlight link for additional button with ID nId + // highlight link will be called with a MenuBarButtonHighlightArg + // the bHighlight member of that struct shall contain the new state + void SetMenuBarButtonHighlightHdl( USHORT nId, const Link& ); + // returns the rectangle occupied by the additional button named nId + // coordinates are relative to the systemwindiow the menubar is attached to + // if the menubar is unattached an empty rectangle is returned + Rectangle GetMenuBarButtonRectPixel( USHORT nId ); + void RemoveMenuBarButton( USHORT nId ); +}; + +inline MenuBar& MenuBar::operator =( const MenuBar& rMenu ) +{ + Menu::operator =( rMenu ); + return *this; +} + + +// ------------- +// - PopupMenu - +// ------------- + +class VCL_DLLPUBLIC PopupMenu : public Menu +{ + friend class Menu; + friend class MenuFloatingWindow; + friend class MenuBarWindow; + friend struct MenuItemData; + +private: + Menu** pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData + + SAL_DLLPRIVATE MenuFloatingWindow* ImplGetFloatingWindow() const { return (MenuFloatingWindow*)Menu::ImplGetWindow(); } + +protected: + SAL_DLLPRIVATE USHORT ImplExecute( Window* pWindow, const Rectangle& rRect, ULONG nPopupFlags, Menu* pStaredFrom, BOOL bPreSelectFirst ); + SAL_DLLPRIVATE long ImplCalcHeight( USHORT nEntries ) const; + SAL_DLLPRIVATE USHORT ImplCalcVisEntries( long nMaxHeight, USHORT nStartEntry = 0, USHORT* pLastVisible = NULL ) const; + +public: + PopupMenu(); + PopupMenu( const PopupMenu& rMenu ); + PopupMenu( const ResId& rResId ); + ~PopupMenu(); + + void SetText( const XubString& rTitle ) { aTitleText = rTitle; } + const XubString& GetText() const { return aTitleText; } + + USHORT Execute( Window* pWindow, const Point& rPopupPos ); + USHORT Execute( Window* pWindow, const Rectangle& rRect, USHORT nFlags = 0 ); + + // Fuer das TestTool + void EndExecute( USHORT nSelect = 0 ); + void SelectEntry( USHORT nId ); + void SetSelectedEntry( USHORT nId ); // for use by native submenu only + + static BOOL IsInExecute(); + static PopupMenu* GetActivePopupMenu(); + + PopupMenu& operator =( const PopupMenu& rMenu ); +}; + +inline PopupMenu& PopupMenu::operator =( const PopupMenu& rMenu ) +{ + Menu::operator =( rMenu ); + return *this; +} + +#endif // _SV_MENU_HXX + diff --git a/vcl/inc/vcl/menubtn.hxx b/vcl/inc/vcl/menubtn.hxx new file mode 100644 index 000000000000..1c7122054a4f --- /dev/null +++ b/vcl/inc/vcl/menubtn.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * 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_MENUBTN_HXX +#define _SV_MENUBTN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/button.hxx> + +class Timer; +class PopupMenu; + +// -------------------- +// - MenuButton-Types - +// -------------------- + +#define MENUBUTTON_MENUMODE_TIMED ((USHORT)0x0001) + +// -------------- +// - MenuButton - +// -------------- + +class VCL_DLLPUBLIC MenuButton : public PushButton +{ +private: + Rectangle maFocusRect; + Timer* mpMenuTimer; + PopupMenu* mpOwnMenu; + PopupMenu* mpMenu; + USHORT mnCurItemId; + USHORT mnMenuMode; + Link maActivateHdl; + Link maSelectHdl; + + SAL_DLLPRIVATE void ImplInitMenuButtonData(); + SAL_DLLPRIVATE void ImplExecuteMenu(); + DECL_DLLPRIVATE_LINK( ImplMenuTimeoutHdl, Timer* ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE MenuButton( const MenuButton & ); + SAL_DLLPRIVATE MenuButton& operator=( const MenuButton & ); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + MenuButton( Window* pParent, WinBits nStyle = 0 ); + MenuButton( Window* pParent, const ResId& rResId ); + ~MenuButton(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + + virtual void Activate(); + virtual void Select(); + + void SetMenuMode( USHORT nMode ); + USHORT GetMenuMode() const { return mnMenuMode; } + + void SetPopupMenu( PopupMenu* pNewMenu ); + PopupMenu* GetPopupMenu() const { return mpMenu; } + + USHORT GetCurItemId() const { return mnCurItemId; } + + void SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; } + const Link& GetActivateHdl() const { return maActivateHdl; } + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } +}; + +#endif // _SV_MENUBTN_HXX diff --git a/vcl/inc/vcl/metaact.hxx b/vcl/inc/vcl/metaact.hxx new file mode 100644 index 000000000000..38ceff6e0690 --- /dev/null +++ b/vcl/inc/vcl/metaact.hxx @@ -0,0 +1,1546 @@ +/************************************************************************* + * + * 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_METAACT_HXX +#define _SV_METAACT_HXX + +#include <vcl/dllapi.h> +#include <vcl/gradient.hxx> +#include <vcl/hatch.hxx> +#include <vcl/wall.hxx> +#include <vcl/font.hxx> +#include <tools/poly.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/region.hxx> +#include <vcl/graph.hxx> +#include <vcl/outdev.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/gfxlink.hxx> +#include <vcl/lineinfo.hxx> + +class SvStream; + +// ----------- +// - Defines - +// ----------- + +#define META_NULL_ACTION (0) +#define META_PIXEL_ACTION (100) +#define META_POINT_ACTION (101) +#define META_LINE_ACTION (102) +#define META_RECT_ACTION (103) +#define META_ROUNDRECT_ACTION (104) +#define META_ELLIPSE_ACTION (105) +#define META_ARC_ACTION (106) +#define META_PIE_ACTION (107) +#define META_CHORD_ACTION (108) +#define META_POLYLINE_ACTION (109) +#define META_POLYGON_ACTION (110) +#define META_POLYPOLYGON_ACTION (111) +#define META_TEXT_ACTION (112) +#define META_TEXTARRAY_ACTION (113) +#define META_STRETCHTEXT_ACTION (114) +#define META_TEXTRECT_ACTION (115) +#define META_BMP_ACTION (116) +#define META_BMPSCALE_ACTION (117) +#define META_BMPSCALEPART_ACTION (118) +#define META_BMPEX_ACTION (119) +#define META_BMPEXSCALE_ACTION (120) +#define META_BMPEXSCALEPART_ACTION (121) +#define META_MASK_ACTION (122) +#define META_MASKSCALE_ACTION (123) +#define META_MASKSCALEPART_ACTION (124) +#define META_GRADIENT_ACTION (125) +#define META_HATCH_ACTION (126) +#define META_WALLPAPER_ACTION (127) +#define META_CLIPREGION_ACTION (128) +#define META_ISECTRECTCLIPREGION_ACTION (129) +#define META_ISECTREGIONCLIPREGION_ACTION (130) +#define META_MOVECLIPREGION_ACTION (131) +#define META_LINECOLOR_ACTION (132) +#define META_FILLCOLOR_ACTION (133) +#define META_TEXTCOLOR_ACTION (134) +#define META_TEXTFILLCOLOR_ACTION (135) +#define META_TEXTALIGN_ACTION (136) +#define META_MAPMODE_ACTION (137) +#define META_FONT_ACTION (138) +#define META_PUSH_ACTION (139) +#define META_POP_ACTION (140) +#define META_RASTEROP_ACTION (141) +#define META_TRANSPARENT_ACTION (142) +#define META_EPS_ACTION (143) +#define META_REFPOINT_ACTION (144) +#define META_TEXTLINECOLOR_ACTION (145) +#define META_TEXTLINE_ACTION (146) +#define META_FLOATTRANSPARENT_ACTION (147) +#define META_GRADIENTEX_ACTION (148) +#define META_LAYOUTMODE_ACTION (149) +#define META_TEXTLANGUAGE_ACTION (150) +#define META_OVERLINECOLOR_ACTION (151) + +#define META_COMMENT_ACTION (512) + +// ------------------------------------------------------------------------ + +struct ImplMetaReadData +{ + rtl_TextEncoding meActualCharSet; +}; + +// ------------------------------------------------------------------------ + +struct ImplMetaWriteData +{ + rtl_TextEncoding meActualCharSet; +}; + +// ------------------------------------------------------------------------ + +#define DECL_META_ACTION( Name, nType ) \ + Meta##Name##Action(); \ +protected: \ + virtual ~Meta##Name##Action(); \ +public: \ + virtual void Execute( OutputDevice* pOut ); \ + virtual MetaAction* Clone(); \ + virtual void Write( SvStream& rOStm, ImplMetaWriteData* pData ); \ + virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ); + +#define IMPL_META_ACTION( Name, nType ) \ +Meta##Name##Action::Meta##Name##Action() : \ + MetaAction( nType ) {} \ +Meta##Name##Action::~Meta##Name##Action() {} + +// -------------- +// - MetaAction - +// -------------- + +class VCL_DLLPUBLIC MetaAction +{ +private: + ULONG mnRefCount; + UINT16 mnType; + + virtual sal_Bool Compare( const MetaAction& ) const; + +protected: + virtual ~MetaAction(); + +public: + MetaAction(); + MetaAction( USHORT nType ); + + virtual void Execute( OutputDevice* pOut ); + + virtual MetaAction* Clone(); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + virtual void Write( SvStream& rOStm, ImplMetaWriteData* pData ); + virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ); + + sal_Bool IsEqual( const MetaAction& ) const; + + USHORT GetType() const { return mnType; } + ULONG GetRefCount() const { return mnRefCount; } + void ResetRefCount() { mnRefCount = 1; } + void Duplicate() { mnRefCount++; } + void Delete() { if ( 0 == --mnRefCount ) delete this; } + +public: + static MetaAction* ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData ); +}; + +// ------------------- +// - MetaPixelAction - +// ------------------- + +class VCL_DLLPUBLIC MetaPixelAction : public MetaAction +{ +private: + Point maPt; + Color maColor; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Pixel, META_PIXEL_ACTION ) + + MetaPixelAction( const Point& rPt, const Color& rColor ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Point& GetPoint() const { return maPt; } + const Color& GetColor() const { return maColor; } +}; + +// ------------------- +// - MetaPointAction - +// ------------------- + +class VCL_DLLPUBLIC MetaPointAction : public MetaAction +{ +private: + Point maPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Point, META_POINT_ACTION ) + + MetaPointAction( const Point& rPt ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Point& GetPoint() const { return maPt; } +}; + +// ------------------ +// - MetaLineAction - +// ------------------ + +class VCL_DLLPUBLIC MetaLineAction : public MetaAction +{ +private: + + LineInfo maLineInfo; + Point maStartPt; + Point maEndPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Line, META_LINE_ACTION ) + + MetaLineAction( const Point& rStart, const Point& rEnd ); + MetaLineAction( const Point& rStart, const Point& rEnd, + const LineInfo& rLineInfo ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Point& GetStartPoint() const { return maStartPt; } + const Point& GetEndPoint() const { return maEndPt; } + const LineInfo& GetLineInfo() const { return maLineInfo; } +}; + +// ------------------ +// - MetaRectAction - +// ------------------ + +class VCL_DLLPUBLIC MetaRectAction : public MetaAction +{ +private: + + Rectangle maRect; + + virtual sal_Bool Compare( const MetaAction& ) const; +public: + DECL_META_ACTION( Rect, META_RECT_ACTION ) + + MetaRectAction( const Rectangle& rRect ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } +}; + +// ----------------------- +// - MetaRoundRectAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaRoundRectAction : public MetaAction +{ +private: + + Rectangle maRect; + sal_uInt32 mnHorzRound; + sal_uInt32 mnVertRound; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( RoundRect, META_ROUNDRECT_ACTION ) + + MetaRoundRectAction( const Rectangle& rRect, + sal_uInt32 nHorzRound, sal_uInt32 nVertRound ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + sal_uInt32 GetHorzRound() const { return mnHorzRound; } + sal_uInt32 GetVertRound() const { return mnVertRound; } +}; + +// --------------------- +// - MetaEllipseAction - +// --------------------- + +class VCL_DLLPUBLIC MetaEllipseAction : public MetaAction +{ +private: + + Rectangle maRect; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Ellipse, META_ELLIPSE_ACTION ) + + MetaEllipseAction( const Rectangle& rRect ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } +}; + +// ----------------- +// - MetaArcAction - +// ----------------- + +class VCL_DLLPUBLIC MetaArcAction : public MetaAction +{ +private: + + Rectangle maRect; + Point maStartPt; + Point maEndPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Arc, META_ARC_ACTION ) + + MetaArcAction( const Rectangle& rRect, + const Point& rStart, const Point& rEnd ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + const Point& GetStartPoint() const { return maStartPt; } + const Point& GetEndPoint() const { return maEndPt; } +}; + +// ----------------- +// - MetaPieAction - +// ----------------- + +class VCL_DLLPUBLIC MetaPieAction : public MetaAction +{ +private: + + Rectangle maRect; + Point maStartPt; + Point maEndPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Pie, META_PIE_ACTION ) + + MetaPieAction( const Rectangle& rRect, + const Point& rStart, const Point& rEnd ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + const Point& GetStartPoint() const { return maStartPt; } + const Point& GetEndPoint() const { return maEndPt; } +}; + +// ------------------- +// - MetaChordAction - +// ------------------- + +class VCL_DLLPUBLIC MetaChordAction : public MetaAction +{ +private: + + Rectangle maRect; + Point maStartPt; + Point maEndPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Chord, META_CHORD_ACTION ) + + MetaChordAction( const Rectangle& rRect, + const Point& rStart, const Point& rEnd ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + const Point& GetStartPoint() const { return maStartPt; } + const Point& GetEndPoint() const { return maEndPt; } +}; + +// ---------------------- +// - MetaPolyLineAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaPolyLineAction : public MetaAction +{ +private: + + LineInfo maLineInfo; + Polygon maPoly; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( PolyLine, META_POLYLINE_ACTION ) + + MetaPolyLineAction( const Polygon& rPoly ); + MetaPolyLineAction( const Polygon& rPoly, const LineInfo& rLineInfo ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Polygon& GetPolygon() const { return maPoly; } + const LineInfo& GetLineInfo() const { return maLineInfo; } +}; + +// --------------------- +// - MetaPolygonAction - +// --------------------- + +class VCL_DLLPUBLIC MetaPolygonAction : public MetaAction +{ +private: + + Polygon maPoly; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Polygon, META_POLYGON_ACTION ) + + MetaPolygonAction( const Polygon& rPoly ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Polygon& GetPolygon() const { return maPoly; } +}; + +// ------------------------- +// - MetaPolyPolygonAction - +// ------------------------- + +class VCL_DLLPUBLIC MetaPolyPolygonAction : public MetaAction +{ +private: + + PolyPolygon maPolyPoly; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( PolyPolygon, META_POLYPOLYGON_ACTION ) + + MetaPolyPolygonAction( const PolyPolygon& rPolyPoly ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } +}; + +// ------------------ +// - MetaTextAction - +// ------------------ + +class VCL_DLLPUBLIC MetaTextAction : public MetaAction +{ +private: + + Point maPt; + XubString maStr; + USHORT mnIndex; + USHORT mnLen; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Text, META_TEXT_ACTION ) + + MetaTextAction( const Point& rPt, const XubString& rStr, + USHORT nIndex, USHORT nLen ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Point& GetPoint() const { return maPt; } + const XubString& GetText() const { return maStr; } + USHORT GetIndex() const { return mnIndex; } + USHORT GetLen() const { return mnLen; } +}; + +// ----------------------- +// - MetaTextArrayAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaTextArrayAction : public MetaAction +{ +private: + + Point maStartPt; + XubString maStr; + sal_Int32* mpDXAry; + USHORT mnIndex; + USHORT mnLen; + + virtual sal_Bool Compare( const MetaAction& ) const; + +protected: + virtual ~MetaTextArrayAction(); + +public: + MetaTextArrayAction(); + MetaTextArrayAction( const MetaTextArrayAction& rAction ); + MetaTextArrayAction( const Point& rStartPt, + const XubString& rStr, + const sal_Int32* pDXAry, + USHORT nIndex, + USHORT nLen ); + + virtual void Execute( OutputDevice* pOut ); + + virtual MetaAction* Clone(); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + virtual void Write( SvStream& rOStm, ImplMetaWriteData* pData ); + virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ); + + const Point& GetPoint() const { return maStartPt; } + const XubString& GetText() const { return maStr; } + USHORT GetIndex() const { return mnIndex; } + USHORT GetLen() const { return mnLen; } + sal_Int32* GetDXArray() const { return mpDXAry; } +}; + +// ------------------------- +// - MetaStretchTextAction - +// ------------------------- + +class VCL_DLLPUBLIC MetaStretchTextAction : public MetaAction +{ +private: + + Point maPt; + XubString maStr; + sal_uInt32 mnWidth; + USHORT mnIndex; + USHORT mnLen; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION ) + + MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth, + const XubString& rStr, + USHORT nIndex, USHORT nLen ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Point& GetPoint() const { return maPt; } + const XubString& GetText() const { return maStr; } + sal_uInt32 GetWidth() const { return mnWidth; } + USHORT GetIndex() const { return mnIndex; } + USHORT GetLen() const { return mnLen; } +}; + +// ---------------------- +// - MetaTextRectAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaTextRectAction : public MetaAction +{ +private: + + Rectangle maRect; + XubString maStr; + USHORT mnStyle; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextRect, META_TEXTRECT_ACTION ) + + MetaTextRectAction( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + const XubString& GetText() const { return maStr; } + USHORT GetStyle() const { return mnStyle; } +}; + +// ---------------------- +// - MetaTextLineAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaTextLineAction : public MetaAction +{ +private: + + Point maPos; + long mnWidth; + FontStrikeout meStrikeout; + FontUnderline meUnderline; + FontUnderline meOverline; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextLine, META_TEXTLINE_ACTION ) + + MetaTextLineAction( const Point& rPos, long nWidth, + FontStrikeout eStrikeout, + FontUnderline eUnderline, + FontUnderline eOverline ); + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Point& GetStartPoint() const { return maPos; } + long GetWidth() const { return mnWidth; } + FontStrikeout GetStrikeout() const { return meStrikeout; } + FontUnderline GetUnderline() const { return meUnderline; } + FontUnderline GetOverline() const { return meOverline; } +}; + +// ----------------- +// - MetaBmpAction - +// ----------------- + +class VCL_DLLPUBLIC MetaBmpAction : public MetaAction +{ +private: + + Bitmap maBmp; + Point maPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Bmp, META_BMP_ACTION ) + + MetaBmpAction( const Point& rPt, const Bitmap& rBmp ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Bitmap& GetBitmap() const { return maBmp; } + const Point& GetPoint() const { return maPt; } +}; + +// ---------------------- +// - MetaBmpScaleAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaBmpScaleAction : public MetaAction +{ +private: + + Bitmap maBmp; + Point maPt; + Size maSz; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( BmpScale, META_BMPSCALE_ACTION ) + + MetaBmpScaleAction( const Point& rPt, const Size& rSz, + const Bitmap& rBmp ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Bitmap& GetBitmap() const { return maBmp; } + const Point& GetPoint() const { return maPt; } + const Size& GetSize() const { return maSz; } +}; + +// -------------------------- +// - MetaBmpScalePartAction - +// -------------------------- + +class VCL_DLLPUBLIC MetaBmpScalePartAction : public MetaAction +{ +private: + + Bitmap maBmp; + Point maDstPt; + Size maDstSz; + Point maSrcPt; + Size maSrcSz; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( BmpScalePart, META_BMPSCALEPART_ACTION ) + + MetaBmpScalePartAction( const Point& rDstPt, const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const Bitmap& rBmp ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Bitmap& GetBitmap() const { return maBmp; } + const Point& GetDestPoint() const { return maDstPt; } + const Size& GetDestSize() const { return maDstSz; } + const Point& GetSrcPoint() const { return maSrcPt; } + const Size& GetSrcSize() const { return maSrcSz; } +}; + +// ----------------- +// - MetaBmpExAction - +// ----------------- + +class VCL_DLLPUBLIC MetaBmpExAction : public MetaAction +{ +private: + + BitmapEx maBmpEx; + Point maPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( BmpEx, META_BMPEX_ACTION ) + + MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const BitmapEx& GetBitmapEx() const { return maBmpEx; } + const Point& GetPoint() const { return maPt; } +}; + +// ---------------------- +// - MetaBmpExScaleAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaBmpExScaleAction : public MetaAction +{ +private: + + BitmapEx maBmpEx; + Point maPt; + Size maSz; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( BmpExScale, META_BMPEXSCALE_ACTION ) + + MetaBmpExScaleAction( const Point& rPt, const Size& rSz, + const BitmapEx& rBmpEx ) ; + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const BitmapEx& GetBitmapEx() const { return maBmpEx; } + const Point& GetPoint() const { return maPt; } + const Size& GetSize() const { return maSz; } +}; + +// ---------------------------- +// - MetaBmpExScalePartAction - +// ---------------------------- + +class VCL_DLLPUBLIC MetaBmpExScalePartAction : public MetaAction +{ +private: + + BitmapEx maBmpEx; + Point maDstPt; + Size maDstSz; + Point maSrcPt; + Size maSrcSz; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( BmpExScalePart, META_BMPEXSCALEPART_ACTION ) + + MetaBmpExScalePartAction( const Point& rDstPt, const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const BitmapEx& rBmpEx ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const BitmapEx& GetBitmapEx() const { return maBmpEx; } + const Point& GetDestPoint() const { return maDstPt; } + const Size& GetDestSize() const { return maDstSz; } + const Point& GetSrcPoint() const { return maSrcPt; } + const Size& GetSrcSize() const { return maSrcSz; } +}; + +// ------------------ +// - MetaMaskAction - +// ------------------ + +class VCL_DLLPUBLIC MetaMaskAction : public MetaAction +{ +private: + + Bitmap maBmp; + Color maColor; + Point maPt; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Mask, META_MASK_ACTION ) + + MetaMaskAction( const Point& rPt, + const Bitmap& rBmp, + const Color& rColor ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Bitmap& GetBitmap() const { return maBmp; } + const Color& GetColor() const { return maColor; } + const Point& GetPoint() const { return maPt; } +}; + +// ----------------------- +// - MetaMaskScaleAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaMaskScaleAction : public MetaAction +{ +private: + + Bitmap maBmp; + Color maColor; + Point maPt; + Size maSz; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( MaskScale, META_MASKSCALE_ACTION ) + + MetaMaskScaleAction( const Point& rPt, const Size& rSz, + const Bitmap& rBmp, + const Color& rColor ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Bitmap& GetBitmap() const { return maBmp; } + const Color& GetColor() const { return maColor; } + const Point& GetPoint() const { return maPt; } + const Size& GetSize() const { return maSz; } +}; + +// --------------------------- +// - MetaMaskScalePartAction - +// --------------------------- + +class VCL_DLLPUBLIC MetaMaskScalePartAction : public MetaAction +{ +private: + + Bitmap maBmp; + Color maColor; + Point maDstPt; + Size maDstSz; + Point maSrcPt; + Size maSrcSz; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( MaskScalePart, META_MASKSCALEPART_ACTION ) + + MetaMaskScalePartAction( const Point& rDstPt, const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const Bitmap& rBmp, + const Color& rColor ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Bitmap& GetBitmap() const { return maBmp; } + const Color& GetColor() const { return maColor; } + const Point& GetDestPoint() const { return maDstPt; } + const Size& GetDestSize() const { return maDstSz; } + const Point& GetSrcPoint() const { return maSrcPt; } + const Size& GetSrcSize() const { return maSrcSz; } +}; + +// ---------------------- +// - MetaGradientAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaGradientAction : public MetaAction +{ +private: + + Rectangle maRect; + Gradient maGradient; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Gradient, META_GRADIENT_ACTION ) + + MetaGradientAction( const Rectangle& rRect, const Gradient& rGradient ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + const Gradient& GetGradient() const { return maGradient; } +}; + +// ------------------------ +// - MetaGradientExAction - +// ------------------------ + +class VCL_DLLPUBLIC MetaGradientExAction : public MetaAction +{ +private: + + PolyPolygon maPolyPoly; + Gradient maGradient; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( GradientEx, META_GRADIENTEX_ACTION ) + + MetaGradientExAction( const PolyPolygon& rPolyPoly, const Gradient& rGradient ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } + const Gradient& GetGradient() const { return maGradient; } +}; + +// ------------------- +// - MetaHatchAction - +// ------------------- + +class VCL_DLLPUBLIC MetaHatchAction : public MetaAction +{ +private: + + PolyPolygon maPolyPoly; + Hatch maHatch; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Hatch, META_HATCH_ACTION ) + + MetaHatchAction( const PolyPolygon& rPolyPoly, const Hatch& rHatch ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } + const Hatch& GetHatch() const { return maHatch; } +}; + +// ----------------------- +// - MetaWallpaperAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaWallpaperAction : public MetaAction +{ +private: + + Rectangle maRect; + Wallpaper maWallpaper; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Wallpaper, META_WALLPAPER_ACTION ) + + MetaWallpaperAction( const Rectangle& rRect, + const Wallpaper& rPaper ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } + const Wallpaper& GetWallpaper() const { return maWallpaper; } +}; + +// ------------------------ +// - MetaClipRegionAction - +// ------------------------ + +class VCL_DLLPUBLIC MetaClipRegionAction : public MetaAction +{ +private: + + Region maRegion; + BOOL mbClip; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( ClipRegion, META_CLIPREGION_ACTION ) + + MetaClipRegionAction( const Region& rRegion, BOOL bClip ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Region& GetRegion() const { return maRegion; } + BOOL IsClipping() const { return mbClip; } +}; + +// --------------------------------- +// - MetaISectRectClipRegionAction - +// --------------------------------- + +class VCL_DLLPUBLIC MetaISectRectClipRegionAction : public MetaAction +{ +private: + + Rectangle maRect; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( ISectRectClipRegion, META_ISECTRECTCLIPREGION_ACTION ) + + MetaISectRectClipRegionAction( const Rectangle& rRect ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Rectangle& GetRect() const { return maRect; } +}; + +// ----------------------------------- +// - MetaISectRegionClipRegionAction - +// ----------------------------------- + +class VCL_DLLPUBLIC MetaISectRegionClipRegionAction : public MetaAction +{ +private: + + Region maRegion; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( ISectRegionClipRegion, META_ISECTREGIONCLIPREGION_ACTION ) + + MetaISectRegionClipRegionAction( const Region& rRegion ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const Region& GetRegion() const { return maRegion; } +}; + +// ---------------------------- +// - MetaMoveClipRegionAction - +// ---------------------------- + +class VCL_DLLPUBLIC MetaMoveClipRegionAction : public MetaAction +{ +private: + + long mnHorzMove; + long mnVertMove; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( MoveClipRegion, META_MOVECLIPREGION_ACTION ) + + MetaMoveClipRegionAction( long nHorzMove, long nVertMove ); + + virtual void Scale( double fScaleX, double fScaleY ); + + long GetHorzMove() const { return mnHorzMove; } + long GetVertMove() const { return mnVertMove; } +}; + +// ----------------------- +// - MetaLineColorAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaLineColorAction : public MetaAction +{ +private: + + Color maColor; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( LineColor, META_LINECOLOR_ACTION ) + + MetaLineColorAction( const Color& rColor, BOOL bSet ); + + const Color& GetColor() const { return maColor; } + BOOL IsSetting() const { return mbSet; } +}; + +// ----------------------- +// - MetaFillColorAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaFillColorAction : public MetaAction +{ +private: + + Color maColor; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( FillColor, META_FILLCOLOR_ACTION ) + + MetaFillColorAction( const Color& rColor, BOOL bSet ); + + const Color& GetColor() const { return maColor; } + BOOL IsSetting() const { return mbSet; } +}; + +// ----------------------- +// - MetaTextColorAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaTextColorAction : public MetaAction +{ +private: + + Color maColor; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextColor, META_TEXTCOLOR_ACTION ) + + MetaTextColorAction( const Color& rColor ); + + const Color& GetColor() const { return maColor; } +}; + +// --------------------------- +// - MetaTextFillColorAction - +// --------------------------- + +class VCL_DLLPUBLIC MetaTextFillColorAction : public MetaAction +{ +private: + + Color maColor; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextFillColor, META_TEXTFILLCOLOR_ACTION ) + + MetaTextFillColorAction( const Color& rColor, BOOL bSet ); + + const Color& GetColor() const { return maColor; } + BOOL IsSetting() const { return mbSet; } +}; + +// --------------------------- +// - MetaTextLineColorAction - +// --------------------------- + +class VCL_DLLPUBLIC MetaTextLineColorAction : public MetaAction +{ +private: + + Color maColor; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextLineColor, META_TEXTLINECOLOR_ACTION ) + + MetaTextLineColorAction( const Color& rColor, BOOL bSet ); + + const Color& GetColor() const { return maColor; } + BOOL IsSetting() const { return mbSet; } +}; + +// --------------------------- +// - MetaOverlineColorAction - +// --------------------------- + +class VCL_DLLPUBLIC MetaOverlineColorAction : public MetaAction +{ +private: + + Color maColor; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION ) + + MetaOverlineColorAction( const Color& rColor, BOOL bSet ); + + const Color& GetColor() const { return maColor; } + BOOL IsSetting() const { return mbSet; } +}; + +// ----------------------- +// - MetaTextAlignAction - +// ----------------------- + +class VCL_DLLPUBLIC MetaTextAlignAction : public MetaAction +{ +private: + + TextAlign maAlign; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextAlign, META_TEXTALIGN_ACTION ) + + MetaTextAlignAction( TextAlign aAlign ); + + TextAlign GetTextAlign() const { return maAlign; } +}; + +// --------------------- +// - MetaMapModeAction - +// --------------------- + +class VCL_DLLPUBLIC MetaMapModeAction : public MetaAction +{ +private: + + MapMode maMapMode; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( MapMode, META_MAPMODE_ACTION ) + + MetaMapModeAction( const MapMode& rMapMode ); + + virtual void Scale( double fScaleX, double fScaleY ); + + const MapMode& GetMapMode() const { return maMapMode; } +}; + +// --------------------- +// - MetaFontAction - +// --------------------- + +class VCL_DLLPUBLIC MetaFontAction : public MetaAction +{ +private: + + Font maFont; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Font, META_FONT_ACTION ) + + MetaFontAction( const Font& rFont ); + + virtual void Scale( double fScaleX, double fScaleY ); + + const Font& GetFont() const { return maFont; } +}; + +// ------------------ +// - MetaPushAction - +// ------------------ + +class VCL_DLLPUBLIC MetaPushAction : public MetaAction +{ +private: + + USHORT mnFlags; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Push, META_PUSH_ACTION ) + + MetaPushAction( USHORT nFlags ); + + USHORT GetFlags() const { return mnFlags; } +}; + +// ----------------- +// - MetaPopAction - +// ----------------- + +class VCL_DLLPUBLIC MetaPopAction : public MetaAction +{ +public: + + DECL_META_ACTION( Pop, META_POP_ACTION ) +}; + +// ---------------------- +// - MetaRasterOpAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaRasterOpAction : public MetaAction +{ +private: + + RasterOp meRasterOp; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( RasterOp, META_RASTEROP_ACTION ) + + MetaRasterOpAction( RasterOp eRasterOp ); + + RasterOp GetRasterOp() const { return meRasterOp; } +}; + +// ------------------------- +// - MetaTransparentAction - +// ------------------------- + +class VCL_DLLPUBLIC MetaTransparentAction : public MetaAction +{ +private: + + PolyPolygon maPolyPoly; + USHORT mnTransPercent; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( Transparent, META_TRANSPARENT_ACTION ) + + MetaTransparentAction( const PolyPolygon& rPolyPoly, USHORT nTransPercent ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const PolyPolygon& GetPolyPolygon() const { return maPolyPoly; } + USHORT GetTransparence() const { return mnTransPercent; } +}; + +// ------------------------------ +// - MetaFloatTransparentAction - +// ------------------------------ + +class VCL_DLLPUBLIC MetaFloatTransparentAction : public MetaAction +{ +private: + + GDIMetaFile maMtf; + Point maPoint; + Size maSize; + Gradient maGradient; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( FloatTransparent, META_FLOATTRANSPARENT_ACTION ) + + MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos, + const Size& rSize, const Gradient& rGradient ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const GDIMetaFile& GetGDIMetaFile() const { return maMtf; } + const Point& GetPoint() const { return maPoint; } + const Size& GetSize() const { return maSize; } + const Gradient& GetGradient() const { return maGradient; } +}; + +// --------------------- +// - MetaDrawEPSAction - +// --------------------- + +class VCL_DLLPUBLIC MetaEPSAction : public MetaAction +{ +private: + + GfxLink maGfxLink; + GDIMetaFile maSubst; + Point maPoint; + Size maSize; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( EPS, META_EPS_ACTION ) + + MetaEPSAction( const Point& rPoint, const Size& rSize, + const GfxLink& rGfxLink, const GDIMetaFile& rSubst ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + const GfxLink& GetLink() const { return maGfxLink; } + const GDIMetaFile& GetSubstitute() const { return maSubst; } + const Point& GetPoint() const { return maPoint; } + const Size& GetSize() const { return maSize; } +}; + +// ---------------------- +// - MetaRefPointAction - +// ---------------------- + +class VCL_DLLPUBLIC MetaRefPointAction : public MetaAction +{ +private: + + Point maRefPoint; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( RefPoint, META_REFPOINT_ACTION ) + + MetaRefPointAction( const Point& rRefPoint, BOOL bSet ); + + const Point& GetRefPoint() const { return maRefPoint; } + BOOL IsSetting() const { return mbSet; } +}; + +// --------------------- +// - MetaCommentAction - +// --------------------- + +class VCL_DLLPUBLIC MetaCommentAction : public MetaAction +{ +private: + + ByteString maComment; + sal_Int32 mnValue; + sal_uInt32 mnDataSize; + BYTE* mpData; + + SAL_DLLPRIVATE void ImplInitDynamicData( const BYTE* pData, sal_uInt32 nDataSize ); + virtual sal_Bool Compare( const MetaAction& ) const; + +protected: + ~MetaCommentAction(); + +public: + MetaCommentAction( sal_Int32 nValue = 0L ); + MetaCommentAction( const MetaCommentAction& rAct ); + MetaCommentAction( const ByteString& rComment, sal_Int32 nValue = 0L, const BYTE* pData = NULL, sal_uInt32 nDataSize = 0UL ); + MetaCommentAction( const BYTE* pData, sal_uInt32 nDataSize ); + + virtual void Move( long nHorzMove, long nVertMove ); + virtual void Scale( double fScaleX, double fScaleY ); + + virtual void Execute( OutputDevice* pOut ); + virtual MetaAction* Clone(); + virtual void Write( SvStream& rOStm, ImplMetaWriteData* pData ); + virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ); + + const ByteString& GetComment() const { return maComment; } + sal_Int32 GetValue() const { return mnValue; } + sal_uInt32 GetDataSize() const { return mnDataSize; } + const BYTE* GetData() const { return mpData; } +}; + +// ------------------------ +// - MetaLayoutModeAction - +// ------------------------ + +class VCL_DLLPUBLIC MetaLayoutModeAction : public MetaAction +{ +private: + + sal_uInt32 mnLayoutMode; + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( LayoutMode, META_LAYOUTMODE_ACTION ) + + MetaLayoutModeAction( sal_uInt32 nLayoutMode ); + + sal_uInt32 GetLayoutMode() const { return mnLayoutMode; } +}; + +// ------------------------ +// - MetaTextLanguageAction - +// ------------------------ + +class VCL_DLLPUBLIC MetaTextLanguageAction : public MetaAction +{ +private: + + LanguageType meTextLanguage; + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( TextLanguage, META_TEXTLANGUAGE_ACTION ) + + MetaTextLanguageAction( LanguageType ); + + LanguageType GetTextLanguage() const { return meTextLanguage; } +}; + +#endif // _SV_METAACT_HXX diff --git a/vcl/inc/vcl/metric.hxx b/vcl/inc/vcl/metric.hxx new file mode 100644 index 000000000000..6328890c1749 --- /dev/null +++ b/vcl/inc/vcl/metric.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * 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_METRIC_HXX +#define _SV_METRIC_HXX + +#include <vcl/dllapi.h> +#include <vcl/font.hxx> + +class ImplFontMetric; +class ImplFontCharMap; + +typedef sal_uInt32 sal_UCS4; + +// ------------ +// - FontInfo - +// ------------ + +class VCL_DLLPUBLIC FontInfo : public Font +{ + friend class OutputDevice; + +protected: + ImplFontMetric* mpImplMetric; // Implementation + +public: + FontInfo(); + FontInfo( const FontInfo& ); + ~FontInfo(); + + FontType GetType() const; + BOOL IsDeviceFont() const; + BOOL SupportsLatin() const; + BOOL SupportsCJK() const; + BOOL SupportsCTL() const; + + FontInfo& operator=( const FontInfo& ); + BOOL operator==( const FontInfo& ) const; + BOOL operator!=( const FontInfo& rInfo ) const + { return !operator==( rInfo ); } +}; + +// -------------- +// - FontMetric - +// -------------- + +class VCL_DLLPUBLIC FontMetric : public FontInfo +{ +public: + FontMetric() {} + FontMetric( const FontMetric& ); + ~FontMetric() {} + + long GetAscent() const; + long GetDescent() const; + long GetIntLeading() const; + long GetExtLeading() const; + long GetLineHeight() const; + long GetSlant() const; + + FontMetric& operator=( const FontMetric& rMetric ); + BOOL operator==( const FontMetric& rMetric ) const; + BOOL operator!=( const FontMetric& rMetric ) const + { return !operator==( rMetric ); } +}; + +// --------------- +// - FontCharMap - +// --------------- + +class VCL_DLLPUBLIC FontCharMap +{ +private: + const ImplFontCharMap* mpImpl; + +public: + FontCharMap(); + ~FontCharMap(); + + BOOL IsDefaultMap() const; + BOOL HasChar( sal_uInt32 ) const; + int CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const; + int GetCharCount() const; + + sal_uInt32 GetFirstChar() const; + sal_uInt32 GetLastChar() const; + + sal_uInt32 GetNextChar( sal_uInt32 ) const; + sal_uInt32 GetPrevChar( sal_uInt32 ) const; + + int GetIndexFromChar( sal_uInt32 ) const; + sal_uInt32 GetCharFromIndex( int ) const; + + +private: + friend class OutputDevice; + void Reset( const ImplFontCharMap* pNewMap = NULL ); + + // prevent assignment and copy construction + FontCharMap( const FontCharMap& ); + void operator=( const FontCharMap& ); +}; + +// ---------------- +// - TextRectInfo - +// ---------------- + +class VCL_DLLPUBLIC TextRectInfo +{ + friend class OutputDevice; + +private: + long mnMaxWidth; + USHORT mnLineCount; + BOOL mbEllipsis; + +public: + TextRectInfo(); + + USHORT GetLineCount() const { return mnLineCount; } + long GetMaxLineWidth() const { return mnMaxWidth; } + BOOL IsEllipses() const { return mbEllipsis; } + + BOOL operator ==( const TextRectInfo& rInfo ) const + { return ((mnMaxWidth == rInfo.mnMaxWidth) && + (mnLineCount == rInfo.mnLineCount) && + (mbEllipsis == rInfo.mbEllipsis)); } + BOOL operator !=( const TextRectInfo& rInfo ) const + { return !(TextRectInfo::operator==( rInfo )); } +}; + +inline TextRectInfo::TextRectInfo() +{ + mnMaxWidth = 0; + mnLineCount = 0; + mbEllipsis = FALSE; +} + +#endif // _SV_METRIC_HXX diff --git a/vcl/inc/vcl/mnemonic.hxx b/vcl/inc/vcl/mnemonic.hxx new file mode 100644 index 000000000000..804b261b79b4 --- /dev/null +++ b/vcl/inc/vcl/mnemonic.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_MNEMONIC_HXX +#define _SV_MNEMONIC_HXX + +#include <vcl/dllapi.h> +#include <tools/string.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/XCharacterClassification.hpp> + +// --------------------- +// - ImplMnemonicTypes - +// --------------------- + +// Mnemonic Chars, which we want support +// Latin 0-9 +#define MNEMONIC_RANGE_1_START 0x30 +#define MNEMONIC_RANGE_1_END 0x39 +// Latin A-Z +#define MNEMONIC_RANGE_2_START 0x41 +#define MNEMONIC_RANGE_2_END 0x5A +// Cyrillic +#define MNEMONIC_RANGE_3_START 0x0410 +#define MNEMONIC_RANGE_3_END 0x042F +// Greek +#define MNEMONIC_RANGE_4_START 0x0391 +#define MNEMONIC_RANGE_4_END 0x03AB +#define MNEMONIC_RANGES 4 +#define MAX_MNEMONICS ((MNEMONIC_RANGE_1_END-MNEMONIC_RANGE_1_START+1)+\ + (MNEMONIC_RANGE_2_END-MNEMONIC_RANGE_2_START+1)+\ + (MNEMONIC_RANGE_3_END-MNEMONIC_RANGE_3_START+1)+\ + (MNEMONIC_RANGE_4_END-MNEMONIC_RANGE_4_START+1)) + +#define MNEMONIC_CHAR ((sal_Unicode)'~') +#define MNEMONIC_INDEX_NOTFOUND ((USHORT)0xFFFF) + +// ------------------------- +// - MnemonicGenerator - +// ------------------------- + +class VCL_DLLPUBLIC MnemonicGenerator +{ +private: + // 0 == Mnemonic; >0 == count of characters + BYTE maMnemonics[MAX_MNEMONICS]; + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > mxCharClass; + +protected: + SAL_DLLPRIVATE USHORT ImplGetMnemonicIndex( sal_Unicode c ); + SAL_DLLPRIVATE sal_Unicode ImplFindMnemonic( const XubString& rKey ); + +public: + MnemonicGenerator(); + + void RegisterMnemonic( const XubString& rKey ); + BOOL CreateMnemonic( XubString& rKey ); + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > GetCharClass(); + + // returns a string where all '~'-characters and CJK mnemonics of the form (~A) are completely removed + static String EraseAllMnemonicChars( const String& rStr ); +}; + +#endif // _SV_MNEMONIC_HXX diff --git a/vcl/inc/vcl/mnemonicengine.hxx b/vcl/inc/vcl/mnemonicengine.hxx new file mode 100644 index 000000000000..d12b3db2417e --- /dev/null +++ b/vcl/inc/vcl/mnemonicengine.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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_MNEMONICENGINE_HXX +#define VCL_MNEMONICENGINE_HXX + +#include "dllapi.h" + +#include <sal/config.h> +#include <sal/types.h> + +#include <memory> + +class String; +class KeyEvent; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= IMnemonicEntryList + //==================================================================== + /// callback for a MnemonicEngine + class SAL_NO_VTABLE VCL_DLLPUBLIC IMnemonicEntryList + { + public: + /** returns the first list entry for the mnemonic search + + @return + a pointer which can be used to unuquely identify the entry. + The MenomonicEngine itself does not use this value, it + is only passed to other methods of this callback interface. + + If this value is <NULL/>, searching stops. + */ + virtual const void* FirstSearchEntry( String& _rEntryText ) = 0; + + /** returns the next list entry for the mnemonic search + + @return + a pointer which can be used to unuquely identify the entry. + The MenomonicEngine itself does not use this value, it + is only passed to other methods of this callback interface. + + If this value is <NULL/>, searching stops. + + If this value is the same as returned by the previous call + to <member>FirstSearchEntry</member> (i.e. you cycled + around), then searching stops, too. + */ + virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) = 0; + + /** "selects" a given entry. + + Note: The semantics of "select" depends on your implementation. You + might actually really select the entry (in the sense of a selected + list box entry, for example), you might make it the current entry, + if your implementation supports this - whatever. + + @param _pEntry + the entry to select. This is the return value of a previous call + to <member>FirstSearchEntry</member> or <member>NextSearchEntry</member>. + */ + virtual void SelectSearchEntry( const void* _pEntry ) = 0; + + /** "executes" the current search entry, i.e. the one returned + in the previous <member>NextSearchEntry</member> call. + + Note: The semantics of "execute" depends on your implementation. You + might even have a list of entries which cannot be executed at all. + + This method is called after <member>SelectSearchEntry</member>, + if and only if the current entry's mnemonic is unambiguous. + + For instance, imagine a list which has two entries with the same mnemonic + character, say "c". Now if the user presses <code>Alt-C</code>, the MnemonicEngine + will call <member>SelectCurrentEntry</member> as soon as it encounters + the first entry, but it'll never call <member>ExecuteSearchEntry</member>. + + If, however, "c" is a unique mnemonic character in your entry list, then the + call of <member>SelectSearchEntry</member> will be followed by a + call to <member>ExecuteSearchEntry</member>. + + This way, you can implement cyclic selection of entries: In + <member>FirstSearchEntry</member>, return the entry which was previously + selected, and in <member>NextSearchEntry</member>, interlly cycle around + in your list. Then, multiple user inputs of <code>Alt-C</code> will + cycle through all entries with the mnemonic being "c". + + @param _pEntry + the entry to select. This is the return value of a previous call + to <member>FirstSearchEntry</member> or <member>NextSearchEntry</member>. + */ + virtual void ExecuteSearchEntry( const void* _pEntry ) = 0; + }; + + //==================================================================== + //= MnemonicEngine + //==================================================================== + struct MnemonicEngine_Data; + class VCL_DLLPUBLIC MnemonicEngine + { + ::std::auto_ptr< MnemonicEngine_Data > m_pData; + + public: + MnemonicEngine( IMnemonicEntryList& _rEntryList ); + ~MnemonicEngine(); + + /** handles a key event + + If the key event denotes pressing an accelerator key, then the + entry list is searched for a matching entry. If such an entry is + found, <member>IMnemonicEntryList::SelectSearchEntry</member> + is called. + + If the entry is the only one with the given mnemonic character, then + also <member>IMnemonicEntryList::ExecuteSearchEntry</member> + is called. + + @return + if the key event has been handled, and should thus not be processed + further. + */ + bool HandleKeyEvent( const KeyEvent& _rKEvt ); + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_MNEMONICENGINE_HXX + diff --git a/vcl/inc/vcl/morebtn.hxx b/vcl/inc/vcl/morebtn.hxx new file mode 100644 index 000000000000..687ef7c40a01 --- /dev/null +++ b/vcl/inc/vcl/morebtn.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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_MOREBTN_HXX +#define _SV_MOREBTN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/mapmod.hxx> +#include <vcl/button.hxx> + +struct ImplMoreButtonData; + +// -------------- +// - MoreButton - +// -------------- + +class VCL_DLLPUBLIC MoreButton : public PushButton +{ +private: + ImplMoreButtonData* mpMBData; + ULONG mnDelta; + MapUnit meUnit; + BOOL mbState; + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE MoreButton( const MoreButton & ); + SAL_DLLPRIVATE MoreButton& operator=( const MoreButton & ); + SAL_DLLPRIVATE void ShowState(); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + +public: + MoreButton( Window* pParent, WinBits nStyle = 0 ); + MoreButton( Window* pParent, const ResId& rResId ); + ~MoreButton(); + + void Click(); + + void AddWindow( Window* pWindow ); + void RemoveWindow( Window* pWindow ); + + void SetDelta( ULONG nNewDelta ) { mnDelta = nNewDelta; } + ULONG GetDelta() const { return mnDelta; } + + void SetMapUnit( MapUnit eNewUnit = MAP_PIXEL ) { meUnit = eNewUnit; } + MapUnit GetMapUnit() const { return meUnit; } + + using PushButton::SetState; + void SetState( BOOL bNewState = TRUE ); + BOOL GetState() const { return mbState; } + + void SetText( const XubString& rNewText ); + XubString GetText() const; + + void SetMoreText( const XubString& rNewText ); + void SetLessText( const XubString& rNewText ); + XubString GetMoreText() const; + XubString GetLessText() const; +}; + +inline void MoreButton::SetState( BOOL bNewState ) +{ + if ( mbState != bNewState ) + Click(); +} + +#endif // _SV_MOREBTN_HXX diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx new file mode 100644 index 000000000000..a6cd60a9d5e3 --- /dev/null +++ b/vcl/inc/vcl/msgbox.hxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * 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_MSGBOX_HXX +#define _SV_MSGBOX_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/btndlg.hxx> +#include <vcl/image.hxx> +#include <vcl/bitmap.hxx> +class FixedText; +class FixedImage; +class CheckBox; + +// ----------------- +// - MessBox-Types - +// ----------------- + +// Return-Werte von Execute +//!!! bei Aenderungen \basic\source\runtime\methods.cxx msgbox anpassen + +#define RET_OK TRUE +#define RET_CANCEL FALSE +#define RET_YES 2 +#define RET_NO 3 +#define RET_RETRY 4 +#define RET_IGNORE 5 + +#define BUTTONID_OK RET_OK +#define BUTTONID_CANCEL RET_CANCEL +#define BUTTONID_YES RET_YES +#define BUTTONID_NO RET_NO +#define BUTTONID_RETRY RET_RETRY +#define BUTTONID_IGNORE RET_IGNORE +#define BUTTONID_HELP 10 + +// ----------- +// - MessBox - +// ----------- + +class VCL_DLLPUBLIC MessBox : public ButtonDialog +{ +protected: + FixedText* mpFixedText; + FixedImage* mpFixedImage; + XubString maMessText; + Image maImage; + Image maImageHC; + USHORT mnSoundType; + BOOL mbHelpBtn; + BOOL mbSound; + CheckBox* mpCheckBox; + XubString maCheckBoxText; + BOOL mbCheck; + + SAL_DLLPRIVATE void ImplInitMessBoxData(); + SAL_DLLPRIVATE void ImplInitButtons(); + SAL_DLLPRIVATE void ImplPosControls(); + +protected: + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + MessBox( WindowType nType ); + +public: + MessBox( Window* pParent, WinBits nStyle, + const XubString& rTitle, const XubString& rMessage ); + MessBox( Window* pParent, const ResId& rResId ); + ~MessBox(); + + virtual void StateChanged( StateChangedType nStateChange ); + + void SetMessText( const XubString& rText ) { maMessText = rText; } + const XubString& GetMessText() const { return maMessText; } + + void SetImage( const Image& rImage ) { maImage = rImage; } + const Image& GetImage() const { return maImage; } + + BOOL SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL ); + const Image& GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const; + + void SetDefaultCheckBoxText(); + void SetCheckBoxText( const XubString& rText ) { maCheckBoxText = rText;} + const XubString& GetCheckBoxText() const { return maCheckBoxText;} + void SetCheckBoxState( BOOL bCheck ); + BOOL GetCheckBoxState() const; + + virtual Size GetOptimalSize(WindowSizeType eType) const; +}; + +// ----------- +// - InfoBox - +// ----------- + +class VCL_DLLPUBLIC InfoBox : public MessBox +{ +private: + SAL_DLLPRIVATE void ImplInitInfoBoxData(); + +public: + InfoBox( Window* pParent, const XubString& rMessage ); + InfoBox( Window* pParent, const ResId & rResId ); + + static Image GetStandardImage(); + static Image GetStandardImageHC(); +}; + +// -------------- +// - WarningBox - +// -------------- + +class VCL_DLLPUBLIC WarningBox : public MessBox +{ +private: + SAL_DLLPRIVATE void ImplInitWarningBoxData(); + +public: + WarningBox( Window* pParent, WinBits nStyle, + const XubString& rMessage ); + WarningBox( Window* pParent, const ResId& rResId ); + + void SetDefaultCheckBoxText(); + + static Image GetStandardImage(); + static Image GetStandardImageHC(); +}; + +// ------------ +// - ErrorBox - +// ------------ + +class VCL_DLLPUBLIC ErrorBox : public MessBox +{ +private: + SAL_DLLPRIVATE void ImplInitErrorBoxData(); + +public: + ErrorBox( Window* pParent, WinBits nStyle, + const XubString& rMessage ); + ErrorBox( Window* pParent, const ResId& rResId ); + + static Image GetStandardImage(); + static Image GetStandardImageHC(); +}; + +// ------------ +// - QueryBox - +// ------------ + +class VCL_DLLPUBLIC QueryBox : public MessBox +{ +private: + SAL_DLLPRIVATE void ImplInitQueryBoxData(); + +public: + QueryBox( Window* pParent, WinBits nStyle, + const XubString& rMessage ); + QueryBox( Window* pParent, const ResId& rResId ); + + void SetDefaultCheckBoxText(); + + static Image GetStandardImage(); + static Image GetStandardImageHC(); +}; + +#endif // _SV_MSGBOX_HXX diff --git a/vcl/inc/vcl/octree.hxx b/vcl/inc/vcl/octree.hxx new file mode 100644 index 000000000000..a7ce5e49c31d --- /dev/null +++ b/vcl/inc/vcl/octree.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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_OCTREE_HXX +#define _SV_OCTREE_HXX + +#include <vcl/salbtype.hxx> +#include <vcl/dllapi.h> + +// ----------- +// - Defines - +// ----------- + +#define OCTREE_BITS 5 +#define OCTREE_BITS_1 10 + +// -------------- +// - OctreeNode - +// -------------- + +typedef struct OctreeNode +{ + ULONG nCount; + ULONG nRed; + ULONG nGreen; + ULONG nBlue; + OctreeNode* pChild[ 8 ]; + OctreeNode* pNext; + OctreeNode* pNextInCache; + USHORT nPalIndex; + BOOL bLeaf; +} NODE; + +typedef NODE* PNODE; +typedef PNODE* PPNODE; + +// ---------- +// - Octree - +// ---------- + +class ImpNodeCache; +class BitmapReadAccess; + +class VCL_DLLPUBLIC Octree +{ +private: + + BitmapPalette aPal; + ULONG nMax; + ULONG nLeafCount; + ULONG nLevel; + PNODE pTree; + PNODE pReduce[ OCTREE_BITS + 1 ]; + BitmapColor* pColor; + ImpNodeCache* pNodeCache; + const BitmapReadAccess* pAcc; + USHORT nPalIndex; + + Octree() {}; + + void CreatePalette( PNODE pNode ); + void GetPalIndex( PNODE pNode ); + + SAL_DLLPRIVATE void ImplCreateOctree(); + SAL_DLLPRIVATE void ImplDeleteOctree( PPNODE ppNode ); + SAL_DLLPRIVATE void ImplAdd( PPNODE ppNode ); + SAL_DLLPRIVATE void ImplReduce(); + +public: + + Octree( const BitmapReadAccess& rReadAcc, ULONG nColors ); + Octree( ULONG nColors ); + ~Octree(); + + void AddColor( const BitmapColor& rColor ); + + inline const BitmapPalette& GetPalette(); + inline USHORT GetBestPaletteIndex( const BitmapColor& rColor ); +}; + +// ------------------------------------------------------------------------ + +inline const BitmapPalette& Octree::GetPalette() +{ + aPal.SetEntryCount( (USHORT) nLeafCount ); + nPalIndex = 0; + CreatePalette( pTree ); + return aPal; +} + +// ------------------------------------------------------------------------ + +inline USHORT Octree::GetBestPaletteIndex( const BitmapColor& rColor ) +{ + pColor = &(BitmapColor&) rColor; + nPalIndex = 65535; + nLevel = 0L; + GetPalIndex( pTree ); + return nPalIndex; +} + +// ------------------- +// - InverseColorMap - +// ------------------- + +class VCL_DLLPUBLIC InverseColorMap +{ +private: + + BYTE* pBuffer; + BYTE* pMap; + const ULONG nBits; + +//#if 0 // _SOLAR__PRIVATE + + SAL_DLLPRIVATE void ImplCreateBuffers( const ULONG nMax ); + +//#endif // __PRIVATE + +public: + + InverseColorMap( const BitmapPalette& rPal ); + ~InverseColorMap(); + + inline USHORT GetBestPaletteIndex( const BitmapColor& rColor ); +}; + +// ------------------------------------------------------------------------ + +inline USHORT InverseColorMap::GetBestPaletteIndex( const BitmapColor& rColor ) +{ + return pMap[ ( ( (ULONG) rColor.GetRed() >> nBits ) << OCTREE_BITS_1 ) | + ( ( (ULONG) rColor.GetGreen() >> nBits ) << OCTREE_BITS ) | + ( (ULONG) rColor.GetBlue() >> nBits ) ]; +} + +#endif // _SV_OCTREE_HXX diff --git a/vcl/inc/vcl/oldprintadaptor.hxx b/vcl/inc/vcl/oldprintadaptor.hxx new file mode 100644 index 000000000000..3d7ccedc2ca1 --- /dev/null +++ b/vcl/inc/vcl/oldprintadaptor.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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_OLDPRINTADAPTOR +#define _VCL_OLDPRINTADAPTOR + +#include "vcl/print.hxx" + +namespace vcl +{ + struct ImplOldStyleAdaptorData; + class VCL_DLLPUBLIC OldStylePrintAdaptor : public PrinterController + { + ImplOldStyleAdaptorData* mpData; + public: + OldStylePrintAdaptor( const boost::shared_ptr< Printer >& ); + virtual ~OldStylePrintAdaptor(); + + void StartPage(); + void EndPage(); + + virtual int getPageCount() const; + virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const; + virtual void printPage( int i_nPage ) const; + }; +} + +#endif diff --git a/vcl/inc/vcl/outdata.hxx b/vcl/inc/vcl/outdata.hxx new file mode 100644 index 000000000000..5d2852444767 --- /dev/null +++ b/vcl/inc/vcl/outdata.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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_OUTDATA_HXX +#define _SV_OUTDATA_HXX + +#include <vcl/sv.h> +#include <tools/color.hxx> +#include <vcl/salgtype.hxx> + +// ----------------- +// - Hilfemethoden - +// ----------------- + +inline SalColor ImplColorToSal( Color aColor ) +{ + return MAKE_SALCOLOR( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() ); +} + +inline int ImplIsColorTransparent( Color aColor ) +{ + return aColor.GetTransparency(); +} + +#endif // _SV_OUTDATA_HXX diff --git a/vcl/inc/vcl/outdev.h b/vcl/inc/vcl/outdev.h new file mode 100644 index 000000000000..43a1e9cf2cea --- /dev/null +++ b/vcl/inc/vcl/outdev.h @@ -0,0 +1,264 @@ +/************************************************************************* + * + * 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_OUTDEV_H +#define _SV_OUTDEV_H + +#include <tools/solar.h> +#include <vcl/outfont.hxx> + +#include <vector> +#include <list> +#include <set> + +class Size; +class Font; +class VirtualDevice; +class ImplServerGraphics; +class ImplGetDevFontList; +class GetDevSizeList; + +// ----------------------- +// - ImplDevFontListData - +// ----------------------- + +// flags for mnMatchType member +#define IMPL_DEVFONT_SCALABLE ((ULONG)0x00000001) +#define IMPL_DEVFONT_SYMBOL ((ULONG)0x00000002) +#define IMPL_DEVFONT_NONESYMBOL ((ULONG)0x00000004) +#define IMPL_DEVFONT_LIGHT ((ULONG)0x00000010) +#define IMPL_DEVFONT_BOLD ((ULONG)0x00000020) +#define IMPL_DEVFONT_NORMAL ((ULONG)0x00000040) +#define IMPL_DEVFONT_NONEITALIC ((ULONG)0x00000100) +#define IMPL_DEVFONT_ITALIC ((ULONG)0x00000200) + +// TODO: rename ImplDevFontListData to PhysicalFontFamily +class ImplDevFontListData +{ +public: + ImplDevFontListData( const String& rSearchName ); + ~ImplDevFontListData(); + + const String& GetFamilyName() const { return maName; } + const String& GetSearchName() const { return maSearchName; } + const String& GetAliasNames() const { return maMapNames; } + bool IsScalable() const { return mpFirst->IsScalable(); } + int GetMinQuality() const { return mnMinQuality; } + + bool AddFontFace( ImplFontData* ); + void InitMatchData( const utl::FontSubstConfiguration&, + const String& rSearchName ); + ImplFontData* FindBestFontFace( const ImplFontSelectData& rFSD ) const; + + void GetFontHeights( std::set<int>& rHeights ) const; + void UpdateDevFontList( ImplGetDevFontList& ) const; + void UpdateCloneFontList( ImplDevFontList&, + bool bScalable, bool bEmbeddable ) const; + +private: +friend class ImplDevFontList; // TODO: remove soon + ImplFontData* mpFirst; // linked list of physical font faces + String maName; // Fontname (original font family name) + String maSearchName; // normalized font family name + String maMapNames; // fontname aliases + ULONG mnTypeFaces; // Typeface Flags + ULONG mnMatchType; // MATCH - Type + String maMatchFamilyName; // MATCH - FamilyName + FontWeight meMatchWeight; // MATCH - Weight + FontWidth meMatchWidth; // MATCH - Width + FontFamily meFamily; + FontPitch mePitch; + int mnMinQuality; // quality of the worst font face +}; + + +// ---------------------- +// - ImplGetDevFontList - +// ---------------------- + +// an ImplGetDevFontList is created by an ImplDevFontList +// it becomes invalid when original ImplDevFontList is modified +class ImplGetDevFontList +{ +private: + std::vector<ImplFontData*> maDevFontVector; + +public: + ImplGetDevFontList() { maDevFontVector.reserve(1024); } + void Add( ImplFontData* pFace ) { maDevFontVector.push_back( pFace ); } + ImplFontData* Get( int nIndex ) const { return maDevFontVector[ nIndex ]; } + int Count() const { return maDevFontVector.size(); } +}; + +// ---------------------- +// - ImplGetDevSizeList - +// ---------------------- + +class ImplGetDevSizeList +{ +private: + String maFontName; + std::vector<int> maSizeList; + +public: + ImplGetDevSizeList( const String& rFontName ) + : maFontName( rFontName ) { maSizeList.reserve( 32 ); } + void Add( int nHeight ) { maSizeList.push_back( nHeight ); } + int Count() const { return maSizeList.size(); } + int Get( int nIndex ) const { return maSizeList[ nIndex ]; } + const String& GetFontName() const { return maFontName; } +}; + +// ------------------------ +// - ImplFontSubstitution - +// ------------------------ +// nowadays these substitutions are needed for backward compatibility and tight platform integration: +// - substitutions from configuration entries (Tools->Options->FontReplacement and/or fontconfig) +// - device specific substitutions (e.g. for PS printer builtin fonts) +// - substitutions for missing fonts defined by configuration entries (generic and/or platform dependent fallbacks) +// - substitutions for missing fonts defined by multi-token fontnames (e.g. fontname="SpecialFont;FallbackA;FallbackB") +// - substitutions for incomplete fonts (implicit, generic, EUDC and/or platform dependent fallbacks) +// - substitutions for missing symbol fonts by translating code points into other symbol fonts + +class ImplFontSubstitution +{ + // TODO: there is more commonality between the different substitutions +protected: + virtual ~ImplFontSubstitution() {} +}; + +// ImplDirectFontSubstitution is for Tools->Options->FontReplacement and PsPrinter substitutions +// The clss is just a simple port of the unmaintainable manual-linked-list based mechanism +// TODO: get rid of this class when the Tools->Options->FontReplacement tabpage is gone for good + +struct ImplFontSubstEntry +{ + String maName; + String maReplaceName; + String maSearchName; + String maSearchReplaceName; + USHORT mnFlags; + + ImplFontSubstEntry( const String& rFontName, const String& rSubstFontName, USHORT nSubstFlags ); +}; + +class ImplDirectFontSubstitution +: public ImplFontSubstitution +{ +private: + typedef std::list<ImplFontSubstEntry> FontSubstList; + FontSubstList maFontSubstList; +public: + void AddFontSubstitute( const String& rFontName, const String& rSubstName, USHORT nFlags ); + void RemoveFontSubstitute( int nIndex ); + bool GetFontSubstitute( int nIndex, String& rFontName, String& rSubstName, USHORT& rFlags ) const; + int GetFontSubstituteCount() const { return maFontSubstList.size(); }; + bool Empty() const { return maFontSubstList.empty(); } + void Clear() { maFontSubstList.clear(); } + + bool FindFontSubstitute( String& rSubstName, const String& rFontName, USHORT nFlags ) const; +}; + +// PreMatchFontSubstitution +// abstracts the concept of a configured font substitution +// before the availability of the originally selected font has been checked +class ImplPreMatchFontSubstitution +: public ImplFontSubstitution +{ +public: + virtual bool FindFontSubstitute( ImplFontSelectData& ) const = 0; +}; + +// ImplGlyphFallbackFontSubstitution +// abstracts the concept of finding the best font to support an incomplete font +class ImplGlyphFallbackFontSubstitution +: public ImplFontSubstitution +{ +public: + virtual bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingCodes ) const = 0; +}; + +// ----------------- +// - ImplFontCache - +// ----------------- +// TODO: closely couple with ImplDevFontList + +class ImplFontCache +{ +private: + ImplFontEntry* mpFirstEntry; + int mnRef0Count; // number of unreferenced ImplFontEntries + bool mbPrinter; + + // cache of recently used font instances + struct IFSD_Equal { bool operator()( const ImplFontSelectData&, const ImplFontSelectData& ) const; }; + struct IFSD_Hash { size_t operator()( const ImplFontSelectData& ) const; }; + typedef ::std::hash_map<ImplFontSelectData,ImplFontEntry*,IFSD_Hash,IFSD_Equal > FontInstanceList; + FontInstanceList maFontInstanceList; + + // cache of recently requested font names vs. selected font names + typedef ::std::hash_map<String,String,FontNameHash> FontNameList; + FontNameList maFontNameList; + +public: + ImplFontCache( bool bPrinter ); + ~ImplFontCache(); + + ImplFontEntry* GetFontEntry( ImplDevFontList*, + const Font&, const Size& rPixelSize, float fExactHeight, + ImplDirectFontSubstitution* pDevSpecific ); + ImplFontEntry* GetFontEntry( ImplDevFontList*, + ImplFontSelectData&, ImplDirectFontSubstitution* pDevSpecific ); + ImplFontEntry* GetGlyphFallbackFont( ImplDevFontList*, ImplFontSelectData&, + int nFallbackLevel, rtl::OUString& rMissingCodes ); + void Release( ImplFontEntry* ); + void Invalidate(); +}; + +// ------------------ +// - ImplOutDevData - +// ------------------ + +namespace vcl { struct ControlLayoutData; } +// #i75163# +namespace basegfx { class B2DHomMatrix; } + +struct ImplOutDevData +{ + VirtualDevice* mpRotateDev; + vcl::ControlLayoutData* mpRecordLayout; + Rectangle maRecordRect; + ImplDirectFontSubstitution maDevFontSubst; + + // #i75163# + basegfx::B2DHomMatrix* mpViewTransform; + basegfx::B2DHomMatrix* mpInverseViewTransform; +}; + +void ImplFreeOutDevFontData(); + +#endif // _SV_OUTDEV_H diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx new file mode 100644 index 000000000000..f787df3692ce --- /dev/null +++ b/vcl/inc/vcl/outdev.hxx @@ -0,0 +1,1226 @@ +/************************************************************************* + * + * 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_OUTDEV_HXX +#define _SV_OUTDEV_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/rc.hxx> +#include <tools/color.hxx> +#include <vcl/font.hxx> +#include <vcl/region.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/wall.hxx> +#include <vcl/settings.hxx> +#include <vcl/salnativewidgets.hxx> +#include <tools/poly.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <com/sun/star/uno/Reference.h> +#include <unotools/fontdefs.hxx> + +#include <vector> + +struct ImplOutDevData; +class ImplFontEntry; +struct ImplObjStack; +struct ImplKernPairData; +struct SystemGraphicsData; +struct SystemFontData; +struct SystemTextLayoutData; +class ImplFontCache; +class ImplDevFontList; +class ImplGetDevFontList; +class ImplGetDevSizeList; +class ImplMultiTextLineInfo; +class SalGraphics; +class Gradient; +class Hatch; +class Bitmap; +class BitmapReadAccess; +class BitmapEx; +class Image; +class TextRectInfo; +class FontInfo; +class FontMetric; +class GDIMetaFile; +class List; +class GfxLink; +class Line; +class LineInfo; +class AlphaMask; +class FontCharMap; +class SalLayout; +class ImplLayoutArgs; +class ImplFontAttributes; +class VirtualDevice; + +namespace com { +namespace sun { +namespace star { +namespace rendering { + class XCanvas; +}}}} +namespace basegfx { + class B2DHomMatrix; + class B2DPolygon; + class B2DPolyPolygon; + typedef ::std::vector< B2DPolyPolygon > B2DPolyPolygonVector; +} + +namespace com { +namespace sun { +namespace star { +namespace awt { + class XGraphics; +} } } } + +typedef std::vector< Rectangle > MetricVector; + +namespace vcl +{ + class PDFWriterImpl; + class ExtOutDevData; + class ITextLayout; +} + +#define OUTDEV_BUFFER_SIZE 128 + + +// --------------------- +// - OutputDevice-Data - +// --------------------- + +struct ImplMapRes +{ + long mnMapOfsX; // Offset in X Richtung + long mnMapOfsY; // Offset in Y Richtung + long mnMapScNumX; // Skal.-faktor Zaehler X Richtung + long mnMapScNumY; // Skal.-faktor Zaehler Y Richtung + long mnMapScDenomX; // Skal.-faktor Nenner X Richtung + long mnMapScDenomY; // Skal.-faktor Nenner Y Richtung +}; + +struct ImplThresholdRes +{ + long mnThresLogToPixX; // Schwellenwerte fuer Berechnung + long mnThresLogToPixY; // mit BigInts + long mnThresPixToLogX; // "" + long mnThresPixToLogY; // "" +}; + +// --------------- +// - KerningPair - +// --------------- + +struct KerningPair +{ + sal_Unicode nChar1; + sal_Unicode nChar2; + long nKern; +}; + +// ---------------------- +// - OutputDevice-Types - +// ---------------------- + +// Flags for Push() +#define PUSH_LINECOLOR ((USHORT)0x0001) +#define PUSH_FILLCOLOR ((USHORT)0x0002) +#define PUSH_FONT ((USHORT)0x0004) +#define PUSH_TEXTCOLOR ((USHORT)0x0008) +#define PUSH_MAPMODE ((USHORT)0x0010) +#define PUSH_CLIPREGION ((USHORT)0x0020) +#define PUSH_RASTEROP ((USHORT)0x0040) +#define PUSH_TEXTFILLCOLOR ((USHORT)0x0080) +#define PUSH_TEXTALIGN ((USHORT)0x0100) +#define PUSH_REFPOINT ((USHORT)0x0200) +#define PUSH_TEXTLINECOLOR ((USHORT)0x0400) +#define PUSH_TEXTLAYOUTMODE ((USHORT)0x0800) +#define PUSH_TEXTLANGUAGE ((USHORT)0x1000) +#define PUSH_OVERLINECOLOR ((USHORT)0x2000) +#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE) +#define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT) +#define PUSH_ALL ((USHORT)0xFFFF) + +// Flags for DrawText() +#define TEXT_DRAW_DISABLE ((USHORT)0x0001) +#define TEXT_DRAW_MNEMONIC ((USHORT)0x0002) +#define TEXT_DRAW_MONO ((USHORT)0x0004) +#define TEXT_DRAW_CLIP ((USHORT)0x0008) +#define TEXT_DRAW_LEFT ((USHORT)0x0010) +#define TEXT_DRAW_CENTER ((USHORT)0x0020) +#define TEXT_DRAW_RIGHT ((USHORT)0x0040) +#define TEXT_DRAW_TOP ((USHORT)0x0080) +#define TEXT_DRAW_VCENTER ((USHORT)0x0100) +#define TEXT_DRAW_BOTTOM ((USHORT)0x0200) +#define TEXT_DRAW_ENDELLIPSIS ((USHORT)0x0400) +#define TEXT_DRAW_PATHELLIPSIS ((USHORT)0x0800) +#define TEXT_DRAW_MULTILINE ((USHORT)0x1000) +#define TEXT_DRAW_WORDBREAK ((USHORT)0x2000) +#define TEXT_DRAW_NEWSELLIPSIS ((USHORT)0x4000) + +#define TEXT_DRAW_WORDBREAK_HYPHENATION (((USHORT)0x8000) | TEXT_DRAW_WORDBREAK) + +// Flags for CopyArea() +#define COPYAREA_WINDOWINVALIDATE ((USHORT)0x0001) + +// Flags for DrawImage() +#define IMAGE_DRAW_DISABLE ((USHORT)0x0001) +#define IMAGE_DRAW_HIGHLIGHT ((USHORT)0x0002) +#define IMAGE_DRAW_DEACTIVE ((USHORT)0x0004) +#define IMAGE_DRAW_COLORTRANSFORM ((USHORT)0x0008) +#define IMAGE_DRAW_SEMITRANSPARENT ((USHORT)0x0010) +#define IMAGE_DRAW_MONOCHROME_BLACK ((USHORT)0x0020) +#define IMAGE_DRAW_MONOCHROME_WHITE ((USHORT)0x0040) +#define IMAGE_DRAW_3DLOOK 0 +#define IMAGE_DRAW_BTNLOOK 0 + +// WaveLine +#define WAVE_FLAT 1 +#define WAVE_SMALL 2 +#define WAVE_NORMAL 3 + +// Grid +#define GRID_DOTS ((ULONG)0x00000001) +#define GRID_HORZLINES ((ULONG)0x00000002) +#define GRID_VERTLINES ((ULONG)0x00000004) +#define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES) + +// LayoutModes for Complex Text Layout +#define TEXT_LAYOUT_DEFAULT ((ULONG)0x00000000) +#define TEXT_LAYOUT_BIDI_LTR ((ULONG)0x00000000) +#define TEXT_LAYOUT_BIDI_RTL ((ULONG)0x00000001) +#define TEXT_LAYOUT_BIDI_STRONG ((ULONG)0x00000002) +#define TEXT_LAYOUT_TEXTORIGIN_LEFT ((ULONG)0x00000004) +#define TEXT_LAYOUT_TEXTORIGIN_RIGHT ((ULONG)0x00000008) +#define TEXT_LAYOUT_COMPLEX_DISABLED ((ULONG)0x00000100) +#define TEXT_LAYOUT_ENABLE_LIGATURES ((ULONG)0x00000200) +#define TEXT_LAYOUT_SUBSTITUTE_DIGITS ((ULONG)0x00000400) + +// DrawModes +#define DRAWMODE_DEFAULT ((ULONG)0x00000000) +#define DRAWMODE_BLACKLINE ((ULONG)0x00000001) +#define DRAWMODE_BLACKFILL ((ULONG)0x00000002) +#define DRAWMODE_BLACKTEXT ((ULONG)0x00000004) +#define DRAWMODE_BLACKBITMAP ((ULONG)0x00000008) +#define DRAWMODE_BLACKGRADIENT ((ULONG)0x00000010) +#define DRAWMODE_GRAYLINE ((ULONG)0x00000020) +#define DRAWMODE_GRAYFILL ((ULONG)0x00000040) +#define DRAWMODE_GRAYTEXT ((ULONG)0x00000080) +#define DRAWMODE_GRAYBITMAP ((ULONG)0x00000100) +#define DRAWMODE_GRAYGRADIENT ((ULONG)0x00000200) +#define DRAWMODE_NOFILL ((ULONG)0x00000400) +#define DRAWMODE_NOBITMAP ((ULONG)0x00000800) +#define DRAWMODE_NOGRADIENT ((ULONG)0x00001000) +#define DRAWMODE_GHOSTEDLINE ((ULONG)0x00002000) +#define DRAWMODE_GHOSTEDFILL ((ULONG)0x00004000) +#define DRAWMODE_GHOSTEDTEXT ((ULONG)0x00008000) +#define DRAWMODE_GHOSTEDBITMAP ((ULONG)0x00010000) +#define DRAWMODE_GHOSTEDGRADIENT ((ULONG)0x00020000) +#define DRAWMODE_WHITELINE ((ULONG)0x00100000) +#define DRAWMODE_WHITEFILL ((ULONG)0x00200000) +#define DRAWMODE_WHITETEXT ((ULONG)0x00400000) +#define DRAWMODE_WHITEBITMAP ((ULONG)0x00800000) +#define DRAWMODE_WHITEGRADIENT ((ULONG)0x01000000) +#define DRAWMODE_SETTINGSLINE ((ULONG)0x02000000) +#define DRAWMODE_SETTINGSFILL ((ULONG)0x04000000) +#define DRAWMODE_SETTINGSTEXT ((ULONG)0x08000000) +#define DRAWMODE_SETTINGSGRADIENT ((ULONG)0x10000000) +#define DRAWMODE_NOTRANSPARENCY ((ULONG)0x80000000) + +// Antialiasing +#define ANTIALIASING_DISABLE_TEXT ((USHORT)0x0001) +#define ANTIALIASING_ENABLE_B2DDRAW ((USHORT)0x0002) +#define ANTIALIASING_PIXELSNAPHAIRLINE ((USHORT)0x0004) + +// AddFontSubstitute +#define FONT_SUBSTITUTE_ALWAYS ((USHORT)0x0001) +#define FONT_SUBSTITUTE_SCREENONLY ((USHORT)0x0002) + +#define DEFAULTFONT_FLAGS_ONLYONE ((ULONG)0x00000001) + +enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV }; + +enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW }; + +// ---------------- +// - OutputDevice - +// ---------------- + +class VirtualDevice; +class Printer; + +const char* ImplDbgCheckOutputDevice( const void* pObj ); + +class VCL_DLLPUBLIC OutputDevice : public Resource +{ + friend class Application; + friend class Bitmap; + friend class ImplImageBmp; + friend class ImplQPrinter; + friend class Printer; + friend class SalGraphicsLayout; + friend class System; + friend class VirtualDevice; + friend class Window; + friend class WorkWindow; + friend class vcl::PDFWriterImpl; + friend const char* ImplDbgCheckOutputDevice( const void* pObj ); + friend void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ); + +private: + mutable SalGraphics* mpGraphics; + mutable OutputDevice* mpPrevGraphics; + mutable OutputDevice* mpNextGraphics; + GDIMetaFile* mpMetaFile; + mutable ImplFontEntry* mpFontEntry; + mutable ImplFontCache* mpFontCache; + mutable ImplDevFontList* mpFontList; + mutable ImplGetDevFontList* mpGetDevFontList; + mutable ImplGetDevSizeList* mpGetDevSizeList; + ImplObjStack* mpObjStack; + ImplOutDevData* mpOutDevData; + List* mpUnoGraphicsList; + vcl::PDFWriterImpl* mpPDFWriter; + vcl::ExtOutDevData* mpExtOutDevData; + + // TEMP TEMP TEMP + VirtualDevice* mpAlphaVDev; + + /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset) + long mnOutOffOrigX; + /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset) + long mnOutOffLogicX; + /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset) + long mnOutOffOrigY; + /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset) + long mnOutOffLogicY; + /// Output offset for device output in pixel (pseudo window offset within window system's frames) + long mnOutOffX; + /// Output offset for device output in pixel (pseudo window offset within window system's frames) + long mnOutOffY; + long mnOutWidth; + long mnOutHeight; + sal_Int32 mnDPIX; + sal_Int32 mnDPIY; + /// font specific text alignment offsets in pixel units + mutable long mnTextOffX; + mutable long mnTextOffY; + mutable long mnEmphasisAscent; + mutable long mnEmphasisDescent; + ULONG mnDrawMode; + ULONG mnTextLayoutMode; + ImplMapRes maMapRes; + ImplThresholdRes maThresRes; + OutDevType meOutDevType; + OutDevViewType meOutDevViewType; + Region maRegion; // contains the clip region, see SetClipRegion(...) + Color maLineColor; + Color maFillColor; + Font maFont; + Color maTextColor; + Color maTextLineColor; + Color maOverlineColor; + TextAlign meTextAlign; + RasterOp meRasterOp; + Wallpaper maBackground; + AllSettings maSettings; + MapMode maMapMode; + Point maRefPoint; + USHORT mnAntialiasing; + LanguageType meTextLanguage; + mutable BOOL mbMap:1, + mbMapIsDefault:1, + mbClipRegion:1, + mbBackground:1, + mbOutput:1, + mbDevOutput:1, + mbOutputClipped:1, + mbLineColor:1, + mbFillColor:1, + mbInitLineColor:1, + mbInitFillColor:1, + mbInitFont:1, + mbInitTextColor:1, + mbInitClipRegion:1, + mbClipRegionSet:1, + mbKerning:1, + mbNewFont:1, + mbTextLines:1, + mbTextSpecial:1, + mbRefPoint:1, + mbEnableRTL:1; + +public: + SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; } + SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; } + SAL_DLLPRIVATE int ImplGetGraphics() const; + SAL_DLLPRIVATE void ImplReleaseGraphics( BOOL bRelease = TRUE ); + SAL_DLLPRIVATE BOOL ImplHasMirroredGraphics(); + SAL_DLLPRIVATE void ImplReMirror( Point &rPoint ) const; + SAL_DLLPRIVATE void ImplReMirror( Rectangle &rRect ) const; + SAL_DLLPRIVATE void ImplReMirror( Region &rRegion ) const; + SAL_DLLPRIVATE void ImplInitOutDevData(); + SAL_DLLPRIVATE void ImplDeInitOutDevData(); + SAL_DLLPRIVATE void ImplInitLineColor(); + SAL_DLLPRIVATE void ImplInitFillColor(); + SAL_DLLPRIVATE bool ImplNewFont() const; + SAL_DLLPRIVATE void ImplInitFont() const; + SAL_DLLPRIVATE void ImplInitTextColor(); + SAL_DLLPRIVATE void ImplInitClipRegion(); + SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL ); + SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion ); + SAL_DLLPRIVATE void ImplSetTriangleClipRegion( const PolyPolygon &rPolyPolygon ); + + SAL_DLLPRIVATE SalLayout* ImplLayout( const String&, xub_StrLen nIndex, + xub_StrLen nLen, const Point& rLogicPos = Point(0,0), + long nLogicWidth=0, const sal_Int32* pLogicDXArray=NULL, + bool bFilter = false ) const; + SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( String&, + xub_StrLen nIndex, xub_StrLen nLen, + long nPixelWidth, + const sal_Int32* pPixelDXArray ) const; + SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const; + + SAL_DLLPRIVATE long ImplGetTextWidth( const SalLayout& ) const; + static + SAL_DLLPRIVATE XubString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rStr, + long nMaxWidth, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + static + SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, + const String& rOrigStr, USHORT nStyle, + MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout& _rLayout ); + SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); + SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ); + SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& ); + SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, BOOL bTextLines ); + SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& ); + SAL_DLLPRIVATE void ImplDrawText( SalLayout& ); + SAL_DLLPRIVATE Rectangle ImplGetTextBoundRect( const SalLayout& ); + SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& ); + + SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight ); + + SAL_DLLPRIVATE void ImplInitTextLineSize(); + SAL_DLLPRIVATE void ImplInitAboveTextLineSize(); + SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor ); + SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, BOOL bIsAbove ); + SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, BOOL bIsAbove ); + SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor ); + SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor ); + SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bUnderlineAbove ); + SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); + SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); + SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); + static + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + SAL_DLLPRIVATE void ImplInitFontList() const; + SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); + SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); + + SAL_DLLPRIVATE long ImplLogicXToDevicePixel( long nX ) const; + SAL_DLLPRIVATE long ImplLogicYToDevicePixel( long nY ) const; + SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel( long nWidth ) const; + SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel( long nHeight ) const; + SAL_DLLPRIVATE long ImplDevicePixelToLogicWidth( long nWidth ) const; + SAL_DLLPRIVATE long ImplDevicePixelToLogicHeight( long nHeight ) const; + SAL_DLLPRIVATE float ImplFloatLogicWidthToDevicePixel( float ) const; + SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float ) const; + SAL_DLLPRIVATE float ImplFloatDevicePixelToLogicWidth( float ) const; + SAL_DLLPRIVATE float ImplFloatDevicePixelToLogicHeight( float ) const; + SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const; + SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const; + SAL_DLLPRIVATE Rectangle ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const; + SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& ) const; + SAL_DLLPRIVATE ::basegfx::B2DPolyPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolyPolygon& ) const; + SAL_DLLPRIVATE Polygon ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const; + SAL_DLLPRIVATE PolyPolygon ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyPoly ) const; + SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const; + SAL_DLLPRIVATE Rectangle ImplDevicePixelToLogic( const Rectangle& rLogicRect ) const; + SAL_DLLPRIVATE Region ImplPixelToDevicePixel( const Region& rRegion ) const; + SAL_DLLPRIVATE void ImplInvalidateViewTransform(); + SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const; + + SAL_DLLPRIVATE void ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pClipPolyPoly = NULL ); + SAL_DLLPRIVATE void ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const PolyPolygon* pClipPolyPoly = NULL ); + SAL_DLLPRIVATE void ImplDrawPolyPolygon( USHORT nPoly, const PolyPolygon& rPolyPoly ); + SAL_DLLPRIVATE void ImplDrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, BOOL bMtf, const PolyPolygon* pClipPolyPoly ); + SAL_DLLPRIVATE void ImplDrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, BOOL bMtf, const PolyPolygon* pClipPolyPoly ); + + SAL_DLLPRIVATE void ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, BOOL bMtf ); + SAL_DLLPRIVATE void ImplCalcHatchValues( const Rectangle& rRect, long nDist, USHORT nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ); + SAL_DLLPRIVATE void ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPolyPoly, Point* pPtBuffer, BOOL bMtf ); + + SAL_DLLPRIVATE void ImplDrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ); + SAL_DLLPRIVATE void ImplDrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ); + SAL_DLLPRIVATE void ImplDrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ); + SAL_DLLPRIVATE void ImplDrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ); + SAL_DLLPRIVATE void ImplDraw2ColorFrame( const Rectangle& rRect, const Color& rLeftTopColor, const Color& rRightBottomColor ); + + SAL_DLLPRIVATE void ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pPosAry ); + SAL_DLLPRIVATE void ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const Bitmap& rBitmap, const ULONG nAction ); + SAL_DLLPRIVATE void ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const BitmapEx& rBitmapEx, const ULONG nAction ); + SAL_DLLPRIVATE void ImplDrawMask( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const Bitmap& rBitmap, const Color& rMaskColor, + const ULONG nAction ); + SAL_DLLPRIVATE void ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha, + const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel ); + SAL_DLLPRIVATE Bitmap ImplBlend( Bitmap aBmp, + BitmapReadAccess* pP, + BitmapReadAccess* pA, + const sal_Int32 nOffY, + const sal_Int32 nDstHeight, + const sal_Int32 nOffX, + const sal_Int32 nDstWidth, + const Rectangle& aBmpRect, + const Size& aOutSz, + const bool bHMirr, + const bool bVMirr, + const long* pMapX, + const long* pMapY ); + SAL_DLLPRIVATE Bitmap ImplBlendWithAlpha( Bitmap aBmp, + BitmapReadAccess* pP, + BitmapReadAccess* pA, + const Rectangle& aDstRect, + const sal_Int32 nOffY, + const sal_Int32 nDstHeight, + const sal_Int32 nOffX, + const sal_Int32 nDstWidth, + const long* pMapX, + const long* pMapY ); + SAL_DLLPRIVATE void ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask, + const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel ); + SAL_DLLPRIVATE void ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor, + const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel ); + SAL_DLLPRIVATE void ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize, + const OutputDevice& rOutDev, const Region& rRegion ); + SAL_DLLPRIVATE void ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize, + OutputDevice& rOutDev ); + SAL_DLLPRIVATE void ImplGetFrameBitmap( const Point& rPt, const Size& rSize, + Bitmap& rBitmap ) const; + + SAL_DLLPRIVATE BOOL ImplIsRecordLayout() const; + + void ImplAddDevFontSubstitute( const XubString& rFontName, + const XubString& rReplaceFontName, + USHORT nFlags = 0 ); + + SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont ); + SAL_DLLPRIVATE static BOOL ImplIsUnderlineAbove( const Font& ); + + // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI + SAL_DLLPRIVATE bool ImplIsAntiparallel() const ; + + // #i101491# + // Helper which holds the old line geometry creation and is extended to use AA when + // switched on. Advantage is that line geometry is only temporarily used for paint + SAL_DLLPRIVATE void ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo); + + // #i101491# + // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon + // without MetaFile processing + SAL_DLLPRIVATE void ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly); + + // #i101491# + // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check. + SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, basegfx::B2DLineJoin eLineJoin); + + // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) + void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon); + +protected: + OutputDevice(); + +private: + SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev ); + SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev ); + +public: + virtual ~OutputDevice(); + + OutDevType GetOutDevType() const { return meOutDevType; } + + /** query an <code>OutputDevice</code> whether it spports a specific operation + + @return + true if operation supported, else false + */ + bool supportsOperation( OutDevSupportType ) const; + + vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; } + + void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; } + vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; } + + void DrawTextLine( const Point& rPos, long nWidth, + FontStrikeout eStrikeout, + FontUnderline eUnderline, + FontUnderline eOverline, + BOOL bUnderlineAbove = FALSE ); + static BOOL IsTextUnderlineAbove( const Font& rFont ); + + void DrawText( const Point& rStartPt, const XubString& rStr, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + MetricVector* pVector = NULL, String* pDisplayText = NULL ); + long GetTextWidth( const XubString& rStr, xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN ) const; + long GetTextHeight() const; + void DrawTextArray( const Point& rStartPt, const XubString& rStr, + const sal_Int32* pDXAry = NULL, + xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN ); + long GetTextArray( const XubString& rStr, sal_Int32* pDXAry = NULL, + xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN ) const; + bool GetCaretPositions( const XubString&, sal_Int32* pCaretXArray, + xub_StrLen nIndex, xub_StrLen nLen, + sal_Int32* pDXAry = NULL, long nWidth = 0, + BOOL bCellBreaking = TRUE ) const; + void DrawStretchText( const Point& rStartPt, ULONG nWidth, + const XubString& rStr, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ); + xub_StrLen GetTextBreak( const XubString& rStr, long nTextWidth, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + long nCharExtra = 0, BOOL bCellBreaking = TRUE ) const; + xub_StrLen GetTextBreak( const XubString& rStr, long nTextWidth, + USHORT nExtraChar, xub_StrLen& rExtraCharPos, + xub_StrLen nIndex, xub_StrLen nLen, + long nCharExtra = 0 ) const; + /** Generate MetaTextActions for the text rect + + This method splits up the text rect into multiple + MetaTextActions, one for each line of text. This is comparable + to AddGradientActions(), which splits up a gradient into its + constituing polygons. Parameter semantics fully compatible to + DrawText(). + */ + void AddTextRectActions( const Rectangle& rRect, + const String& rOrigStr, + USHORT nStyle, + GDIMetaFile& rMtf ); + void DrawText( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle = 0, + MetricVector* pVector = NULL, String* pDisplayText = NULL, + ::vcl::ITextLayout* _pTextLayout = NULL ); + Rectangle GetTextRect( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle = TEXT_DRAW_WORDBREAK, + TextRectInfo* pInfo = NULL, + const ::vcl::ITextLayout* _pTextLayout = NULL ) const; + XubString GetEllipsisString( const XubString& rStr, long nMaxWidth, + USHORT nStyle = TEXT_DRAW_ENDELLIPSIS ) const; + void DrawCtrlText( const Point& rPos, const XubString& rStr, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + USHORT nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, String* pDisplayText = NULL ); + long GetCtrlTextWidth( const XubString& rStr, xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN, + USHORT nStyle = TEXT_DRAW_MNEMONIC ) const; + static XubString GetNonMnemonicString( const XubString& rStr, xub_StrLen& rMnemonicPos ); + static XubString GetNonMnemonicString( const XubString& rStr ) + { xub_StrLen nDummy; return GetNonMnemonicString( rStr, nDummy ); } + + ULONG GetKerningPairCount() const; + void GetKerningPairs( ULONG nPairs, KerningPair* pKernPairs ) const; + + BOOL GetTextBoundRect( Rectangle& rRect, + const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; + BOOL GetTextOutline( PolyPolygon&, + const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; + BOOL GetTextOutlines( PolyPolyVector&, + const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; + BOOL GetTextOutlines( ::basegfx::B2DPolyPolygonVector&, + const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN, BOOL bOptimize = TRUE, + ULONG nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const; + BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, + int nLen, int nBase, MetricVector& rVector ); + + void DrawPixel( const Point& rPt ); + void DrawPixel( const Point& rPt, const Color& rColor ); + void DrawPixel( const Polygon& rPts, const Color* pColors = NULL ); + void DrawPixel( const Polygon& rPts, const Color& rColor ); + + void DrawLine( const Point& rStartPt, const Point& rEndPt ); + void DrawLine( const Point& rStartPt, const Point& rEndPt, + const LineInfo& rLineInfo ); + + /** Render the given polygon as a line stroke + + The given polygon is stroked with the current LineColor, start + and end point are not automatically connected + + @see DrawPolygon + @see DrawPolyPolygon + */ + void DrawPolyLine( const Polygon& rPoly ); + void DrawPolyLine( const basegfx::B2DPolygon&, double fLineWidth = 0.0, basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND ); + + /** Render the given polygon as a line stroke + + The given polygon is stroked with the current LineColor, start + and end point are not automatically connected. The line is + rendered according to the specified LineInfo, e.g. supplying a + dash pattern, or a line thickness. + + @see DrawPolygon + @see DrawPolyPolygon + */ + void DrawPolyLine( const Polygon& rPoly, + const LineInfo& rLineInfo ); + + /** Render the given polygon + + The given polygon is stroked with the current LineColor, and + filled with the current FillColor. If one of these colors are + transparent, the corresponding stroke or fill stays + invisible. Start and end point of the polygon are + automatically connected. + + @see DrawPolyLine + */ + void DrawPolygon( const Polygon& rPoly ); + void DrawPolygon( const basegfx::B2DPolygon& ); + + /** Render the given poly-polygon + + The given poly-polygon is stroked with the current LineColor, + and filled with the current FillColor. If one of these colors + are transparent, the corresponding stroke or fill stays + invisible. Start and end points of the contained polygons are + automatically connected. + + @see DrawPolyLine + */ + void DrawPolyPolygon( const PolyPolygon& rPolyPoly ); + void DrawPolyPolygon( const basegfx::B2DPolyPolygon& ); + + void DrawRect( const Rectangle& rRect ); + void DrawRect( const Rectangle& rRect, + ULONG nHorzRount, ULONG nVertRound ); + void DrawEllipse( const Rectangle& rRect ); + void DrawArc( const Rectangle& rRect, + const Point& rStartPt, const Point& rEndPt ); + void DrawPie( const Rectangle& rRect, + const Point& rStartPt, const Point& rEndPt ); + void DrawChord( const Rectangle& rRect, + const Point& rStartPt, const Point& rEndPt ); + + void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize ); + void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize, + const OutputDevice& rOutDev ); + void CopyArea( const Point& rDestPt, + const Point& rSrcPt, const Size& rSrcSize, + USHORT nFlags = 0 ); + + void DrawBitmap( const Point& rDestPt, + const Bitmap& rBitmap ); + void DrawBitmap( const Point& rDestPt, const Size& rDestSize, + const Bitmap& rBitmap ); + void DrawBitmap( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const Bitmap& rBitmap ); + + void DrawBitmapEx( const Point& rDestPt, + const BitmapEx& rBitmapEx ); + void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, + const BitmapEx& rBitmapEx ); + void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const BitmapEx& rBitmapEx ); + + void DrawMask( const Point& rDestPt, + const Bitmap& rBitmap, const Color& rMaskColor ); + void DrawMask( const Point& rDestPt, const Size& rDestSize, + const Bitmap& rBitmap, const Color& rMaskColor ); + void DrawMask( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const Bitmap& rBitmap, const Color& rMaskColor ); + + void DrawImage( const Point& rPos, + const Image& rImage, USHORT nStyle = 0 ); + void DrawImage( const Point& rPos, const Size& rSize, + const Image& rImage, USHORT nStyle = 0 ); + + void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); + void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient ); + void AddGradientActions( const Rectangle& rRect, + const Gradient& rGradient, + GDIMetaFile& rMtf ); + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + void DrawHatch( const PolyPolygon& rPolyPoly, const ::Hatch& rHatch ); + void AddHatchActions( const PolyPolygon& rPolyPoly, + const ::Hatch& rHatch, + GDIMetaFile& rMtf ); +#else + void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch ); + void AddHatchActions( const PolyPolygon& rPolyPoly, + const Hatch& rHatch, + GDIMetaFile& rMtf ); +#endif + + void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); + void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, USHORT nStyle ); + void DrawGrid( const Rectangle& rRect, const Size& rDist, ULONG nFlags ); + + void DrawTransparent( const PolyPolygon& rPolyPoly, USHORT nTransparencePercent ); + void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency); + void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize, const Gradient& rTransparenceGradient ); + + Color GetPixel( const Point& rPt ) const; + Color* GetPixel( const Polygon& rPts ) const; + + Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const; + + /** Query extended bitmap (with alpha channel, if available). + */ + BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const; + + void EnableMapMode( BOOL bEnable = TRUE ); + BOOL IsMapModeEnabled() const { return mbMap; } + + // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout + void EnableRTL( BOOL bEnable = TRUE); + BOOL IsRTLEnabled() const { return mbEnableRTL; } + + void SetConnectMetaFile( GDIMetaFile* pMtf ); + GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; } + + void EnableOutput( BOOL bEnable = TRUE ); + BOOL IsOutputEnabled() const { return mbOutput; } + BOOL IsDeviceOutput() const { return mbDevOutput; } + BOOL IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); } + BOOL IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); } + + void SetClipRegion(); + void SetClipRegion( const Region& rRegion ); + void SetTriangleClipRegion( const PolyPolygon &rRegion ); + Region GetClipRegion() const; + BOOL IsClipRegion() const { return mbClipRegion; } + Region GetActiveClipRegion() const; + + void MoveClipRegion( long nHorzMove, long nVertMove ); + void IntersectClipRegion( const Rectangle& rRect ); + void IntersectClipRegion( const Region& rRegion ); + + void SetAntialiasing( USHORT nMode = 0 ); + USHORT GetAntialiasing() const { return mnAntialiasing; } + + void SetDrawMode( ULONG nDrawMode ); + ULONG GetDrawMode() const { return mnDrawMode; } + + void SetLayoutMode( ULONG nTextLayoutMode ); + ULONG GetLayoutMode() const { return mnTextLayoutMode; } + + void SetDigitLanguage( LanguageType ); + LanguageType GetDigitLanguage() const { return meTextLanguage; } + + void SetRasterOp( RasterOp eRasterOp ); + RasterOp GetRasterOp() const { return meRasterOp; } + + /** + If this OutputDevice is used for displaying a Print Preview + the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'. + + A View than can make painting decisions dependent on this OutDevViewType. + E.g. text colors need to be handled different, dependent on wether it's a PrintPreview or not. (see #106611# for more) + */ + void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; } + OutDevViewType GetOutDevViewType() const { return meOutDevViewType; } + + void SetLineColor(); + void SetLineColor( const Color& rColor ); + const Color& GetLineColor() const { return maLineColor; } + BOOL IsLineColor() const { return mbLineColor; } + + void SetFillColor(); + void SetFillColor( const Color& rColor ); + const Color& GetFillColor() const { return maFillColor; } + BOOL IsFillColor() const { return mbFillColor; } + + void SetBackground(); + void SetBackground( const Wallpaper& rBackground ); + + const Wallpaper& GetBackground() const { return maBackground; } + BOOL IsBackground() const { return mbBackground; } + + void SetFont( const Font& rNewFont ); + const Font& GetFont() const { return maFont; } + + SystemFontData GetSysFontData( int nFallbacklevel ) const; + SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const XubString& rStr, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, + const sal_Int32* pDXAry = NULL ) const; + + void SetTextColor( const Color& rColor ); + const Color& GetTextColor() const { return maTextColor; } + void SetTextFillColor(); + void SetTextFillColor( const Color& rColor ); + + Color GetTextFillColor() const; + BOOL IsTextFillColor() const { return !maFont.IsTransparent(); } + void SetTextLineColor(); + void SetTextLineColor( const Color& rColor ); + const Color& GetTextLineColor() const { return maTextLineColor; } + BOOL IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); } + void SetOverlineColor(); + void SetOverlineColor( const Color& rColor ); + const Color& GetOverlineColor() const { return maOverlineColor; } + BOOL IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); } + void SetTextAlign( TextAlign eAlign ); + TextAlign GetTextAlign() const { return maFont.GetAlign(); } + + virtual void SetSettings( const AllSettings& rSettings ); + const AllSettings& GetSettings() const { return maSettings; } + + SystemGraphicsData GetSystemGfxData() const; + ::com::sun::star::uno::Any GetSystemGfxDataAny() const; + + virtual void SetMapMode(); + virtual void SetMapMode( const MapMode& rNewMapMode ); + virtual void SetRelativeMapMode( const MapMode& rNewMapMode ); + const MapMode& GetMapMode() const { return maMapMode; } + BOOL IsMapMode() const { return mbMap; } + + void SetRefPoint(); + void SetRefPoint( const Point& rRefPoint ); + const Point& GetRefPoint() const { return maRefPoint; } + BOOL IsRefPoint() const { return mbRefPoint; } + + // #i75163# + basegfx::B2DHomMatrix GetViewTransformation() const; + basegfx::B2DHomMatrix GetInverseViewTransformation() const; + + basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const; + basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const; + + + /** Set an offset in pixel + + This method offsets every drawing operation that converts its + coordinates to pixel by the given value. Normally, the effect + can be achieved by setting a MapMode with a different + origin. Unfortunately, this origin is in logical coordinates + and can lead to rounding errors (see #102532# for details). + + @attention This offset is only applied when converting to + pixel, i.e. some output modes such as metafile recordings + might be completely unaffected by this method! Use with + care. Furthermore, if the OutputDevice's MapMode is the + default (that's MAP_PIXEL), then, too, any pixel offset set is + ignored. This might be unintuitive for cases, but would have + been far more fragile to implement. What's more, the reason + why the pixel offset was introduced (avoiding rounding errors) + does not apply for MAP_PIXEL, because one can always use the + MapMode origin then. + + @param rOffset + The offset in pixel + */ + void SetPixelOffset( const Size& rOffset ); + + /** Get the offset in pixel + + @see OutputDevice::SetPixelOffset for details + + @return the current offset in pixel + */ + Size GetPixelOffset() const; + + Point LogicToPixel( const Point& rLogicPt ) const; + Size LogicToPixel( const Size& rLogicSize ) const; + Rectangle LogicToPixel( const Rectangle& rLogicRect ) const; + Polygon LogicToPixel( const Polygon& rLogicPoly ) const; + basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPolyPoly ) const; + PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const; + basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const; + Region LogicToPixel( const Region& rLogicRegion )const; + Point LogicToPixel( const Point& rLogicPt, + const MapMode& rMapMode ) const; + Size LogicToPixel( const Size& rLogicSize, + const MapMode& rMapMode ) const; + Rectangle LogicToPixel( const Rectangle& rLogicRect, + const MapMode& rMapMode ) const; + Polygon LogicToPixel( const Polygon& rLogicPoly, + const MapMode& rMapMode ) const; + basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly, + const MapMode& rMapMode ) const; + PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly, + const MapMode& rMapMode ) const; + basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly, + const MapMode& rMapMode ) const; + Region LogicToPixel( const Region& rLogicRegion, + const MapMode& rMapMode ) const; + Point PixelToLogic( const Point& rDevicePt ) const; + Size PixelToLogic( const Size& rDeviceSize ) const; + Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const; + Polygon PixelToLogic( const Polygon& rDevicePoly ) const; + basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly ) const; + PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const; + basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const; + Region PixelToLogic( const Region& rDeviceRegion ) const; + Point PixelToLogic( const Point& rDevicePt, + const MapMode& rMapMode ) const; + Size PixelToLogic( const Size& rDeviceSize, + const MapMode& rMapMode ) const; + Rectangle PixelToLogic( const Rectangle& rDeviceRect, + const MapMode& rMapMode ) const; + Polygon PixelToLogic( const Polygon& rDevicePoly, + const MapMode& rMapMode ) const; + basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly, + const MapMode& rMapMode ) const; + PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly, + const MapMode& rMapMode ) const; + basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly, + const MapMode& rMapMode ) const; + Region PixelToLogic( const Region& rDeviceRegion, + const MapMode& rMapMode ) const; + + Point LogicToLogic( const Point& rPtSource, + const MapMode* pMapModeSource, + const MapMode* pMapModeDest ) const; + Size LogicToLogic( const Size& rSzSource, + const MapMode* pMapModeSource, + const MapMode* pMapModeDest ) const; + Rectangle LogicToLogic( const Rectangle& rRectSource, + const MapMode* pMapModeSource, + const MapMode* pMapModeDest ) const; + long* LogicToLogic( long* pX, + USHORT nCount, + const MapMode* pMapModeSource, + const MapMode* pMapModeDest ) const; + static Point LogicToLogic( const Point& rPtSource, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + static Size LogicToLogic( const Size& rSzSource, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + static Rectangle LogicToLogic( const Rectangle& rRectSource, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + static long LogicToLogic( long nLongSource, + MapUnit eUnitSource, + MapUnit eUnitDest ); + + static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + + Size GetOutputSizePixel() const + { return Size( mnOutWidth, mnOutHeight ); } + long GetOutputWidthPixel() const { return mnOutWidth; } + long GetOutputHeightPixel() const { return mnOutHeight; } + long GetOutOffXPixel() const { return mnOutOffX; } + long GetOutOffYPixel() const { return mnOutOffY; } + + Size GetOutputSize() const + { return PixelToLogic( GetOutputSizePixel() ); } + + void Erase(); + void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); } + + BOOL AddTempDevFont( const String& rFileURL, const String& rFontName ); + int GetDevFontCount() const; + FontInfo GetDevFont( int nDevFontIndex ) const; + int GetDevFontSizeCount( const Font& ) const; + Size GetDevFontSize( const Font& rFont, int nSizeIndex ) const; + BOOL IsFontAvailable( const String& rFontName ) const; + + FontMetric GetFontMetric() const; + FontMetric GetFontMetric( const Font& rFont ) const; + BOOL GetFontCharMap( FontCharMap& rFontCharMap ) const; + + xub_StrLen HasGlyphs( const Font& rFont, const String& rStr, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const; + + long GetMinKashida() const; + long GetMinKashida( const Font& rFont ) const; + + // i60594 + // validate kashida positions against the current font + // returns count of invalid kashida positions + xub_StrLen ValidateKashidas ( const String& rTxt, + xub_StrLen nIdx, xub_StrLen nLen, + xub_StrLen nKashCount, // number of suggested kashida positions (in) + const xub_StrLen* pKashidaPos, // suggested kashida positions (in) + xub_StrLen* pKashidaPosDropped // invalid kashida positions (out) + ) const; + + USHORT GetBitCount() const; + + BOOL GetTextIsRTL( const String&, xub_StrLen nIndex, + xub_StrLen nLen ) const; + + /** Query the existence and depth of the alpha channel + + @return 0, if no alpha channel available, and the bit depth of + the alpha channel otherwise. + */ + USHORT GetAlphaBitCount() const; + ULONG GetColorCount() const; + + void Push( USHORT nFlags = PUSH_ALL ); + void Pop(); + + /** Query availability of alpha channel + + @return TRUE, if this device has an alpha channel. + */ + BOOL HasAlpha(); + + /** Added return value to see if EPS could be painted directly. + Theoreticaly, handing over a matrix would be needed to handle + painting rotated EPS files (e.g. contained mín Metafiles). This + would then need to be supported for Mac and PS printers, but + that's too much for now, wrote #i107046# for this */ + bool DrawEPS( const Point& rPt, const Size& rSz, + const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL ); + + /// request XCanvas render interface for this OutputDevice + ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XCanvas > GetCanvas() const; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateUnoGraphics(); + List* GetUnoGraphicsList() const { return mpUnoGraphicsList; } + List* CreateUnoGraphicsList() { mpUnoGraphicsList = new List; return mpUnoGraphicsList; } + + static void BeginFontSubstitution(); + static void EndFontSubstitution(); + static void AddFontSubstitute( const XubString& rFontName, + const XubString& rReplaceFontName, + USHORT nFlags = 0 ); + static void RemoveFontSubstitute( USHORT n ); + static USHORT GetFontSubstituteCount(); + static void GetFontSubstitute( USHORT n, + XubString& rFontName, + XubString& rReplaceFontName, + USHORT& rFlags ); + + static Font GetDefaultFont( USHORT nType, + LanguageType eLang, + ULONG nFlags, + const OutputDevice* pOutDev = NULL ); + + /** helper method removing transparencies from a metafile (e.g. for printing) + + @returns + true: transparencies were removed + false: output metafile is unchanged input metafile + + @attention this is a member method, so current state can influence the result ! + @attention the output metafile is prepared in pixel mode for the currentOutputDevice + state. It can not be moved or rotated reliably anymore. + */ + bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, + long nMaxBmpDPIX, long nMaxBmpDPIY, + bool bReduceTransparency, + bool bTransparencyAutoMode, + bool bDownsampleBitmaps, + const Color& rBackground = Color( COL_TRANSPARENT ) + ); + /** Retrieve downsampled and cropped bitmap + + @attention This method ignores negative rDstSz values, thus + mirroring must happen outside this method (e.g. in DrawBitmap) + */ + Bitmap GetDownsampledBitmap( const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY ); + /** Retrieve downsampled and cropped bitmapEx + + @attention This method ignores negative rDstSz values, thus + mirroring must happen outside this method (e.g. in DrawBitmapEx) + */ + BitmapEx GetDownsampledBitmapEx( const Size& rDstSz, + const Point& rSrcPt, const Size& rSrcSz, + const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ); + + //------------------------------------- + // Native Widget Rendering functions + //------------------------------------- + + // These all just call through to the private mpGraphics functions of the same name. + + // Query the platform layer for control support + BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + // Query the native control to determine if it was acted upon + BOOL HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + const Point& aPos, + BOOL& rIsInside ); + + // Request rendering of a particular control and/or part + BOOL DrawNativeControl( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ); + + // Request rendering of a caption string for a control + BOOL DrawNativeControlText( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ); + + // Query the native control's actual drawing region (including adornment) + BOOL GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption, + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion ); + +}; + +#endif // _SV_OUTDEV_HXX diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx new file mode 100644 index 000000000000..4bbf7176ddb2 --- /dev/null +++ b/vcl/inc/vcl/outfont.hxx @@ -0,0 +1,406 @@ +/************************************************************************* + * + * 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_OUTFONT_HXX +#define _SV_OUTFONT_HXX + +#include <tools/string.hxx> +#include <tools/list.hxx> +#include <i18npool/lang.h> +#include <tools/gen.hxx> +#include <tools/solar.h> +#include <vcl/dllapi.h> +#include <unotools/fontdefs.hxx> +#include <vcl/vclenum.hxx> + +#include <hash_map> + +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> + +class ImplDevFontListData; +class ImplGetDevFontList; +class ImplGetDevSizeList; +class ImplFontEntry; +class ImplDirectFontSubstitution; +class ImplPreMatchFontSubstitution; +class ImplGlyphFallbackFontSubstitution; +class ImplFontSelectData; +class Font; +class ConvertChar; +struct FontMatchStatus; +class OutputDevice; + +// ---------------------- +// - ImplFontAttributes - +// ---------------------- +// device independent font properties + +class ImplFontAttributes +{ +public: // TODO: create matching interface class + const String& GetFamilyName() const { return maName; } + const String& GetStyleName() const { return maStyleName; } + FontWeight GetWeight() const { return meWeight; } + FontItalic GetSlant() const { return meItalic; } + FontFamily GetFamilyType() const { return meFamily; } + FontPitch GetPitch() const { return mePitch; } + FontWidth GetWidthType() const { return meWidthType; } + bool IsSymbolFont() const { return mbSymbolFlag; } + +public: // TODO: hide members behind accessor methods + String maName; // Font Family Name + String maStyleName; // Font Style Name + FontWeight meWeight; // Weight Type + FontItalic meItalic; // Slant Type + FontFamily meFamily; // Family Type + FontPitch mePitch; // Pitch Type + FontWidth meWidthType; // Width Type + bool mbSymbolFlag; +}; + +// ------------------------- +// - ImplDevFontAttributes - +// ------------------------- +// device dependent font properties + +class ImplDevFontAttributes : public ImplFontAttributes +{ +public: // TODO: create matching interface class + const String& GetAliasNames() const { return maMapNames; } + int GetQuality() const { return mnQuality; } + bool IsRotatable() const { return mbOrientation; } + bool IsDeviceFont() const { return mbDevice; } + bool IsEmbeddable() const { return mbEmbeddable; } + bool IsSubsettable() const { return mbSubsettable; } + +public: // TODO: hide members behind accessor methods + String maMapNames; // List of family name aliass separated with ';' + int mnQuality; // Quality (used when similar fonts compete) + bool mbOrientation; // true: physical font can be rotated + bool mbDevice; // true: built in font + bool mbSubsettable; // true: a subset of the font can be created + bool mbEmbeddable; // true: the font can be embedded +}; + +// ---------------- +// - ImplFontData - +// ---------------- +// TODO: rename ImplFontData to PhysicalFontFace +// TODO: no more direct access to members +// TODO: add reference counting +// TODO: get rid of height/width for scalable fonts +// TODO: make cloning cheaper + +// abstract base class for physical font faces +class VCL_DLLPUBLIC ImplFontData : public ImplDevFontAttributes +{ +public: + // by using an ImplFontData object as a factory for its corresponding + // ImplFontEntry an ImplFontEntry can be extended to cache device and + // font instance specific data + virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const = 0; + + virtual int GetHeight() const { return mnHeight; } + virtual int GetWidth() const { return mnWidth; } + virtual sal_IntPtr GetFontId() const = 0; + int GetFontMagic() const { return mnMagic; } + bool IsScalable() const { return (mnHeight == 0); } + bool CheckMagic( int n ) const { return (n == mnMagic); } + ImplFontData* GetNextFace() const { return mpNext; } + ImplFontData* CreateAlias() const { return Clone(); } + + bool IsBetterMatch( const ImplFontSelectData&, FontMatchStatus& ) const; + StringCompare CompareWithSize( const ImplFontData& ) const; + StringCompare CompareIgnoreSize( const ImplFontData& ) const; + virtual ~ImplFontData() {} + virtual ImplFontData* Clone() const = 0; + +protected: + ImplFontData( const ImplDevFontAttributes&, int nMagic ); + void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; } + + long mnWidth; // Width (in pixels) + long mnHeight; // Height (in pixels) + +private: +friend class ImplDevFontListData; + const int mnMagic; // poor man's RTTI + ImplFontData* mpNext; +}; + +// ---------------------- +// - ImplFontSelectData - +// ---------------------- + +class ImplFontSelectData : public ImplFontAttributes +{ +public: + ImplFontSelectData( const Font&, const String& rSearchName, + const Size&, float fExactHeight ); + ImplFontSelectData( const ImplFontData&, const Size&, + float fExactHeight, int nOrientation, bool bVertical ); + +public: // TODO: change to private + String maTargetName; // name of the font name token that is chosen + String maSearchName; // name of the font that matches best + int mnWidth; // width of font in pixel units + int mnHeight; // height of font in pixel units + float mfExactHeight; // requested height (in pixels with subpixel details) + int mnOrientation; // text orientation in 3600 system + LanguageType meLanguage; // text language + bool mbVertical; // vertical mode of requested font + bool mbNonAntialiased; // true if antialiasing is disabled + + const ImplFontData* mpFontData; // a matching ImplFontData object + ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry +}; + +// ------------------- +// - ImplDevFontList - +// ------------------- +// TODO: merge with ImplFontCache +// TODO: rename to LogicalFontManager + +class VCL_DLLPUBLIC ImplDevFontList +{ +private: + friend class WinGlyphFallbackSubstititution; + mutable bool mbMatchData; // true if matching attributes are initialized + bool mbMapNames; // true if MapNames are available + + typedef std::hash_map<const String, ImplDevFontListData*,FontNameHash> DevFontList; + DevFontList maDevFontList; + + ImplPreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution + ImplGlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyh fallback substitution + +public: + ImplDevFontList(); + ~ImplDevFontList(); + + // fill the list with device fonts + void Add( ImplFontData* ); + void Clear(); + int Count() const { return maDevFontList.size(); } + + // find the device font + ImplDevFontListData* FindFontFamily( const String& rFontName ) const; + ImplDevFontListData* ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplDirectFontSubstitution* ) const; + ImplDevFontListData* ImplFindBySearchName( const String& ) const; + + // suggest fonts for glyph fallback + ImplDevFontListData* GetGlyphFallbackFont( ImplFontSelectData&, + rtl::OUString& rMissingCodes, int nFallbackLevel ) const; + + // prepare platform specific font substitutions + void SetPreMatchHook( ImplPreMatchFontSubstitution* ); + void SetFallbackHook( ImplGlyphFallbackFontSubstitution* ); + + // misc utilities + ImplDevFontList* Clone( bool bScalable, bool bEmbeddable ) const; + ImplGetDevFontList* GetDevFontList() const; + ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const; + + //used by 2-level font fallback + ImplDevFontListData* ImplFindByLocale(com::sun::star::lang::Locale lc) const; + +protected: + void InitMatchData() const; + bool AreMapNamesAvailable() const { return mbMapNames; } + + ImplDevFontListData* ImplFindByTokenNames( const String& ) const; + ImplDevFontListData* ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const; + ImplDevFontListData* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; + ImplDevFontListData* ImplFindByAttributes( ULONG nSearchType, FontWeight, FontWidth, + FontFamily, FontItalic, const String& rSearchFamily ) const; + ImplDevFontListData* FindDefaultFont() const; + +private: + void InitGenericGlyphFallback() const; + mutable ImplDevFontListData** mpFallbackList; + mutable int mnFallbackCount; +}; + +// -------------------- +// - ImplKernPairData - +// -------------------- +// TODO: get rid of ImplKernPairData and use outdev.hxx's KerningPair struct +// the problem is that outdev.hxx is too high level for the device layers +// and outdev.hxx's customers depend on KerningPair being defined there + +struct ImplKernPairData +{ + USHORT mnChar1; + USHORT mnChar2; + long mnKern; +}; + + +// ----------------------- +// - ImplFontMetricData - +// ----------------------- + +class ImplFontMetricData : public ImplFontAttributes +{ +public: + ImplFontMetricData( const ImplFontSelectData& ); + void ImplInitTextLineSize( const OutputDevice* pDev ); + void ImplInitAboveTextLineSize(); + +public: // TODO: hide members behind accessor methods + // font instance attributes from the font request + long mnWidth; // Reference Width + short mnOrientation; // Rotation in 1/10 degrees + + // font metrics measured for the font instance + long mnAscent; // Ascent + long mnDescent; // Descent + long mnIntLeading; // Internal Leading + long mnExtLeading; // External Leading + int mnSlant; // Slant (Italic/Oblique) + long mnMinKashida; // Minimal width of kashida (Arabic) + + // font attributes queried from the font instance + int meFamilyType; // Font Family Type + bool mbDevice; // Flag for Device Fonts + bool mbScalableFont; + bool mbKernableFont; + + // font metrics that are usually derived from the measurements + long mnUnderlineSize; // Lineheight of Underline + long mnUnderlineOffset; // Offset from Underline to Baseline + long mnBUnderlineSize; // Hoehe von fetter Unterstreichung + long mnBUnderlineOffset; // Offset von fetter Unterstreichung zur Baseline + long mnDUnderlineSize; // Hoehe von doppelter Unterstreichung + long mnDUnderlineOffset1; // Offset von doppelter Unterstreichung zur Baseline + long mnDUnderlineOffset2; // Offset von doppelter Unterstreichung zur Baseline + long mnWUnderlineSize; // Hoehe von WaveLine-Unterstreichung + long mnWUnderlineOffset; // Offset von WaveLine-Unterstreichung zur Baseline, jedoch zentriert zur WaveLine + long mnAboveUnderlineSize; // Hoehe von einfacher Unterstreichung (for Vertical Right) + long mnAboveUnderlineOffset; // Offset von einfacher Unterstreichung zur Baseline (for Vertical Right) + long mnAboveBUnderlineSize; // Hoehe von fetter Unterstreichung (for Vertical Right) + long mnAboveBUnderlineOffset; // Offset von fetter Unterstreichung zur Baseline (for Vertical Right) + long mnAboveDUnderlineSize; // Hoehe von doppelter Unterstreichung (for Vertical Right) + long mnAboveDUnderlineOffset1; // Offset von doppelter Unterstreichung zur Baseline (for Vertical Right) + long mnAboveDUnderlineOffset2; // Offset von doppelter Unterstreichung zur Baseline (for Vertical Right) + long mnAboveWUnderlineSize; // Hoehe von WaveLine-Unterstreichung (for Vertical Right) + long mnAboveWUnderlineOffset; // Offset von WaveLine-Unterstreichung zur Baseline, jedoch zentriert zur WaveLine (for Vertical Right) + long mnStrikeoutSize; // Hoehe von einfacher Durchstreichung + long mnStrikeoutOffset; // Offset von einfacher Durchstreichung zur Baseline + long mnBStrikeoutSize; // Hoehe von fetter Durchstreichung + long mnBStrikeoutOffset; // Offset von fetter Durchstreichung zur Baseline + long mnDStrikeoutSize; // Hoehe von doppelter Durchstreichung + long mnDStrikeoutOffset1; // Offset von doppelter Durchstreichung zur Baseline + long mnDStrikeoutOffset2; // Offset von doppelter Durchstreichung zur Baseline +}; + +// ----------------- +// - ImplFontEntry - +// ------------------ +// TODO: rename ImplFontEntry to LogicalFontInstance +// TODO: allow sharing of metrics for related fonts + +class VCL_DLLPUBLIC ImplFontEntry +{ +public: + ImplFontEntry( const ImplFontSelectData& ); + virtual ~ImplFontEntry(); + +public: // TODO: make data members private + ImplFontSelectData maFontSelData; // FontSelectionData + ImplFontMetricData maMetric; // Font Metric + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol + long mnLineHeight; + ULONG mnRefCount; + USHORT mnSetFontFlags; // Flags returned by SalGraphics::SetFont() + short mnOwnOrientation; // text angle if lower layers don't rotate text themselves + short mnOrientation; // text angle in 3600 system + bool mbInit; // true if maMetric member is valid + + void AddFallbackForUnicode( sal_UCS4, FontWeight eWeight, const String& rFontName ); + bool GetFallbackForUnicode( sal_UCS4, FontWeight eWeight, String* pFontName ) const; + void IgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, const String& rFontName ); + +private: + // cache of Unicode characters and replacement font names + // TODO: a fallback map can be shared with many other ImplFontEntries + // TODO: at least the ones which just differ in orientation, stretching or height + typedef ::std::pair<sal_UCS4,FontWeight> GFBCacheKey; + struct GFBCacheKey_Hash{ size_t operator()( const GFBCacheKey& ) const; }; + typedef ::std::hash_map<GFBCacheKey,String,GFBCacheKey_Hash> UnicodeFallbackList; + UnicodeFallbackList* mpUnicodeFallbackList; +}; + + +class ImplTextLineInfo +{ +private: + long mnWidth; + xub_StrLen mnIndex; + xub_StrLen mnLen; + +public: + ImplTextLineInfo( long nWidth, xub_StrLen nIndex, xub_StrLen nLen ) + { + mnWidth = nWidth; + mnIndex = nIndex; + mnLen = nLen; + } + + long GetWidth() const { return mnWidth; } + xub_StrLen GetIndex() const { return mnIndex; } + xub_StrLen GetLen() const { return mnLen; } +}; + +#define MULTITEXTLINEINFO_RESIZE 16 +typedef ImplTextLineInfo* PImplTextLineInfo; + +class ImplMultiTextLineInfo +{ +private: + PImplTextLineInfo* mpLines; + xub_StrLen mnLines; + xub_StrLen mnSize; + +public: + ImplMultiTextLineInfo(); + ~ImplMultiTextLineInfo(); + + void AddLine( ImplTextLineInfo* pLine ); + void Clear(); + + ImplTextLineInfo* GetLine( USHORT nLine ) const + { return mpLines[nLine]; } + xub_StrLen Count() const { return mnLines; } + +private: + ImplMultiTextLineInfo( const ImplMultiTextLineInfo& ); + ImplMultiTextLineInfo& operator=( const ImplMultiTextLineInfo& ); +}; + +#endif // _SV_OUTFONT_HXX + diff --git a/vcl/inc/vcl/pdfextoutdevdata.hxx b/vcl/inc/vcl/pdfextoutdevdata.hxx new file mode 100644 index 000000000000..5dda4b0f79fa --- /dev/null +++ b/vcl/inc/vcl/pdfextoutdevdata.hxx @@ -0,0 +1,518 @@ +/************************************************************************* + * + * 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_PDFEXTOUTDEVDATA_HXX +#define _VCL_PDFEXTOUTDEVDATA_HXX + +#include <vcl/dllapi.h> + +#include <vcl/pdfwriter.hxx> +#include <vcl/extoutdevdata.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/mapmod.hxx> +#include <tools/rtti.hxx> +#include <vector> +#include <deque> + +class Graphic; + +namespace vcl { class PDFWriter; } + +namespace vcl +{ + +/* + A PDFExtOutDevBookmarkEntry is being created by the EditEngine if + a bookmark URL has been parsed. The Application is requested to take + care of each bookmark entry by emptying out the bookmark vector. +*/ +struct PDFExtOutDevBookmarkEntry +{ + sal_Int32 nLinkId; + rtl::OUString aBookmark; +}; + +/* + Class that is being set at the OutputDevice allowing the + application to send enhanced PDF commands like CreateLink +*/ +struct PageSyncData; +struct GlobalSyncData; +class VCL_DLLPUBLIC PDFExtOutDevData : public ExtOutDevData +{ + + const OutputDevice& mrOutDev; + + sal_Bool mbTaggedPDF; + sal_Bool mbExportNotes; + sal_Bool mbTransitionEffects; + sal_Bool mbUseLosslessCompression; + sal_Bool mbReduceImageResolution; + sal_Bool mbExportFormFields; + sal_Bool mbExportBookmarks; + sal_Bool mbExportNDests; //i56629 + sal_Int32 mnFormsFormat; + sal_Int32 mnPage; + com::sun::star::lang::Locale maDocLocale; + + PageSyncData* mpPageSyncData; + GlobalSyncData* mpGlobalSyncData; + + std::vector< PDFExtOutDevBookmarkEntry > maBookmarks; + +public : + + TYPEINFO(); + PDFExtOutDevData( const OutputDevice& rOutDev ); + virtual ~PDFExtOutDevData(); + + sal_Bool PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction ); + void ResetSyncData(); + + void PlayGlobalActions( PDFWriter& rWriter ); + + + + sal_Bool GetIsExportNotes() const; + void SetIsExportNotes( const sal_Bool bExportNotes ); + + sal_Bool GetIsExportTaggedPDF() const; + void SetIsExportTaggedPDF( const sal_Bool bTaggedPDF ); + + sal_Bool GetIsExportTransitionEffects() const; + void SetIsExportTransitionEffects( const sal_Bool bTransitionalEffects ); + + sal_Bool GetIsExportFormFields() const; + void SetIsExportFormFields( const sal_Bool bExportFormFields ); + + sal_Int32 GetFormsFormat() const; + void SetFormsFormat( const sal_Int32 nFormsFormat ); + + sal_Bool GetIsExportBookmarks() const; + void SetIsExportBookmarks( const sal_Bool bExportBookmarks ); + + sal_Bool GetIsExportNamedDestinations() const; //i56629 + void SetIsExportNamedDestinations( const sal_Bool bExportNDests ); //i56629 + + // PageNumber, Compression is being set by the PDFExport + sal_Int32 GetCurrentPageNumber() const; + void SetCurrentPageNumber( const sal_Int32 nPage ); + + sal_Bool GetIsLosslessCompression() const; + void SetIsLosslessCompression( const sal_Bool bLosslessCompression ); + + sal_Bool GetIsReduceImageResolution() const; + void SetIsReduceImageResolution( const sal_Bool bReduceImageResolution ); + + const com::sun::star::lang::Locale& GetDocumentLocale() const; + void SetDocumentLocale( const com::sun::star::lang::Locale& rLoc ); + + std::vector< PDFExtOutDevBookmarkEntry >& GetBookmarks(); + + /** Start a new group of render output + + Use this method to group render output. + */ + void BeginGroup(); + + /** End render output + + This method ends grouped render output without + further actions. + */ + void EndGroup(); + + /** End render output + + This method ends grouped render output, that can be + represented by a GfxLink. This is typically used for + external graphic files, such as JPEGs, EPS files etc. + The BeginGroup/EndGroup calls must exactly enclose the + relevant OutputDevice calls issued to render the + graphic the normal way. + + @param rGraphic + The link to the original graphic + + @param nTransparency + Eight bit transparency value, with 0 denoting full opacity, + and 255 full transparency. + + @param rOutputRect + The output rectangle of the graphic. + + @param rVisibleOutputRect + The visible part of the output. This might be less than + rOutputRect, e.g. for cropped graphics. + */ + void EndGroup( const Graphic& rGraphic, + BYTE nTransparency, + const Rectangle& rOutputRect, + const Rectangle& rVisibleOutputRect ); +//--->i56629 + /** Create a new named destination to be used in a link to this document from another PDF document + (see PDF spec 1.4, 8.2.1) + + @parm sDestName + the name this destination will be addressed with from others PDF document + + @param rRect + target rectangle on page to be displayed if dest is jumped to + + @param nPageNr + number of page the dest is on (as returned by NewPage) + or -1 in which case the current page is used + + @param eType + what dest type to use + + @returns + the destination id (to be used in SetLinkDest) or + -1 if page id does not exist + */ + sal_Int32 CreateNamedDest( const String& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); +//<---i56629 + + /** Create a new destination to be used in a link + + @param rRect + target rectangle on page to be displayed if dest is jumped to + + @param nPageNr + number of page the dest is on (as returned by NewPage) + or -1 in which case the current page is used + + @param eType + what dest type to use + + @returns + the destination id (to be used in SetLinkDest) or + -1 if page id does not exist + */ + sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); + /** Create a new link on a page + + @param rRect + active rectangle of the link (that is the area that has to be + hit to activate the link) + + @param nPageNr + number of page the link is on (as returned by NewPage) + or -1 in which case the current page is used + + @returns + the link id (to be used in SetLinkDest, SetLinkURL) or + -1 if page id does not exist + */ + sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); + /** Set the destination for a link + <p>will change a URL type link to a dest link if necessary</p> + + @param nLinkId + the link to be changed + + @param nDestId + the dest the link shall point to + @returns + 0 for success + -1 in case the link id does not exist + -2 in case the dest id does not exist + */ + sal_Int32 SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ); + /** Set the URL for a link + <p>will change a dest type link to an URL type link if necessary</p> + @param nLinkId + the link to be changed + + @param rURL + the URL the link shall point to. + there will be no error checking or any kind of + conversion done to this parameter execept this: + it will be output as 7bit Ascii. The URL + will appear literally in the PDF file produced + + @returns + 0 for success + -1 in case the link id does not exist + */ + sal_Int32 SetLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL ); + /** Create a new outline item + + @param nParent + declares the parent of the new item in the outline hierarchy. + An invalid value will result in a new toplevel item. + + @param rText + sets the title text of the item + + @param nDestId + declares which Dest (created with CreateDest) the outline item + will point to + + @returns + the outline item id of the new item + */ + sal_Int32 CreateOutlineItem( sal_Int32 nParent = 0, const rtl::OUString& rText = rtl::OUString(), sal_Int32 nDestID = -1 ); + + /** Set an outline item's parent + + @param nItem + specififies which item should be reparented. + + @param nNewParent + specifies which outline item will be the item's new parent. + Use 0 for reparenting to top level. + + @returns + -1 if the item does not exist + -2 if the new parent does not exist, item will be reparented to top level. + */ + sal_Int32 SetOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent ); + + /** Set an outline item's title text + + @param nItem + specififies which item should get a new text + + @param rText + sets the title text of the item + + @returns + 0 if the item exists and the text was changed + -1 if the item does not exist + */ + sal_Int32 SetOutlineItemText( sal_Int32 nItem, const rtl::OUString& rText ); + + /** Set an outline item's destination + + @param nItem + specififies which item should get a new dest + + @param nDestID + specifies the item's new destination + + @returns + -1 if the item does not exist + -2 if the new dest does not exist, dest will remain unchanged + */ + sal_Int32 SetOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID ); + + /** Create a new note on a page + + @param rRect + active rectangle of the note (that is the area that has to be + hit to popup the annotation) + + @param rNote + specifies the contents of the note + + @param nPageNr + number of page the note is on (as returned by NewPage) + or -1 in which case the current page is used + */ + void CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 ); + + /** begin a new logical structure element + + BeginStructureElement/EndStructureElement calls build the logical structure + of the PDF - the basis for tagged PDF. Structural elements are implemented + using marked content tags. Each structural element can contain sub elements + (e.g. a section can contain a heading and a paragraph). The structure hierarchy + is build automatically from the Begin/EndStructureElement calls. + + A structural element need not be contained on one page; e.g. paragraphs often + run from one page to the next. In this case the corresponding EndStructureElement + must be called while drawing the next page. + + BeginStructureElement and EndStructureElement must be called only after + <member scope="vcl">PDFWriter::NewPage</member> has been called and before + <member scope="vcl">PDFWriter::Emit</member>gets called. The current page + number is an implicit context parameter for Begin/EndStructureElement. + + For pagination artifacts that are not part of the logical structure + of the document (like header, footer or page number) the special + StructElement <code>NonStructElement</code> exists. To place content + outside of the struture tree simply call + <code>BeginStructureElement( NonStructElement )</code> then draw your + content and then call <code>EndStructureElement()</code>. Any children + of a <code>NonStructElement</code> will not be part of the structure as well. + + @param eType + denotes what kind of element to begin (e.g. a heading or paragraph) + + @param rAlias + the specified alias will be used as structure tag. Also an entry in the PDF's + role map will be created mapping alias to regular structure type. + + @returns + the id of the newly created structural element + */ + sal_Int32 BeginStructureElement( PDFWriter::StructElement eType, const rtl::OUString& rAlias = rtl::OUString() ); + /** end a logical structure element + + @see BeginStructureElement + */ + void EndStructureElement(); + /** set the current structure element + + <p> + For different purposes it may be useful to paint a structure element's + content discontinously. In that case an already existing structure element + can be appended to by using <code>SetCurrentStructureElement</code>. The + refenrenced structure element becomes the current structure element with + all consequences: all following structure elements are appended as children + of the current element. + </p> + + @param nElement + the id of the new current structure element + + @returns + <true/> if the current structure element could be set successfully + <false/> if the current structure element could not be changed + (e.g. if the passed element id is invalid) + */ + bool SetCurrentStructureElement( sal_Int32 nElement ); + /** get the current structure element id + + @returns + the id of the current structure element + */ + sal_Int32 GetCurrentStructureElement(); + + /** set a structure attribute on the current structural element + + SetStructureAttribute sets an attribute of the current structural element to a + new value. A consistency check is performed before actually setting the value; + if the check fails, the function returns <FALSE/> and the attribute remains + unchanged. + + @param eAttr + denotes what attribute to change + + @param eVal + the value to set the attribute to + + @returns + <TRUE/> if the value was valid and the change has been performed, + <FALSE/> if the attribute or value was invalid; attribute remains unchanged + */ + bool SetStructureAttribute( PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal ); + /** set a structure attribute on the current structural element + + SetStructureAttributeNumerical sets an attribute of the current structural element + to a new numerical value. A consistency check is performed before actually setting + the value; if the check fails, the function returns <FALSE/> and the attribute + remains unchanged. + + @param eAttr + denotes what attribute to change + + @param nValue + the value to set the attribute to + + @returns + <TRUE/> if the value was valid and the change has been performed, + <FALSE/> if the attribute or value was invalid; attribute remains unchanged + */ + bool SetStructureAttributeNumerical( PDFWriter::StructAttribute eAttr, sal_Int32 nValue ); + /** set the bounding box of a structural element + + SetStructureBoundingBox sets the BBox attribute to a new value. Since the BBox + attribute can only be applied to <code>Table</code>, <code>Figure</code>, + <code>Form</code> and <code>Formula</code> elements, a call of this function + for other element types will be ignored and the BBox attribute not be set. + + @param rRect + the new bounding box for the structural element + */ + void SetStructureBoundingBox( const Rectangle& rRect ); + + /** set the ActualText attribute of a structural element + + ActualText contains the Unicode text without layout artifacts that is shown by + a structural element. For example if a line is ended prematurely with a break in + a word and continued on the next line (e.g. "happen-<newline>stance") the + corresponding ActualText would contain the unbroken line (e.g. "happenstance"). + + @param rText + contains the complete logical text the structural element displays. + */ + void SetActualText( const String& rText ); + + /** set the Alt attribute of a strutural element + + Alt is s replacement text describing the contents of a structural element. This + is mainly used by accessibility applications; e.g. a screen reader would read + the Alt replacement text for an image to a visually impaired user. + + @param rText + contains the replacement text for the structural element + */ + void SetAlternateText( const String& rText ); + + /** Sets the time in seconds a page will appear before the next + page is shown automatically + + @param nSeconds + time in seconds the current page will be shown; pass 0 for manual advancement + + @param nPageNr + the page number to apply the autoadvance time to; -1 denotes the current page + */ + void SetAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 ); + + /** Sets the transitional effect to be applied when the current page gets shown. + + @param eType + the kind of effect to be used; use Regular to disable transitional effects + for this page + + @param nMilliSec + the duration of the transitional effect in milliseconds; + set 0 to disable transitional effects + + @param nPageNr + the page number to apply the effect to; -1 denotes the current page + */ + void SetPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr = -1 ); + + /** create a new form control + + This function creates a new form control in the PDF and sets its various + properties. Do not pass an actual AnyWidget as <code>rControlType</code> + will be cast to the type described by the type member. + + @param rControlType + a descendant of <code>AnyWidget</code> determing the control's properties + */ + void CreateControl( const PDFWriter::AnyWidget& rControlType, sal_Int32 nPageNr = -1 ); +}; + +} + +#endif diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx new file mode 100644 index 000000000000..419814e5ce97 --- /dev/null +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -0,0 +1,1298 @@ +/************************************************************************* + * + * 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_PDFWRITER_HXX +#define _VCL_PDFWRITER_HXX + +#include <sal/types.h> + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <tools/color.hxx> + +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> +#include <vcl/font.hxx> +#include <vcl/graphictools.hxx> + +#include <com/sun/star/io/XOutputStream.hpp> + +#include <list> +#include <vector> +#include <set> + +class Font; +class Point; +class OutputDevice; +class MapMode; +class Polygon; +class LineInfo; +class PolyPolygon; +class Bitmap; +class BitmapEx; +class Image; +class Gradient; +class Hatch; +class Wallpaper; + +namespace vcl +{ + +struct PDFDocInfo +{ + String Title; // document title + String Author; // document author + String Subject; // subject + String Keywords; // keywords + String Creator; // application that created the original document + String Producer; // OpenOffice +}; + +struct PDFNote +{ + String Title; // optional title for the popup containing the note + String Contents; // contents of the note +}; + +class VCL_DLLPUBLIC PDFOutputStream +{ + public: + virtual ~PDFOutputStream(); + virtual void write( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xStream ) = 0; +}; + +class VCL_DLLPUBLIC PDFWriter +{ + void* pImplementation; +public: + // extended line info + enum CapType { capButt, capRound, capSquare }; + enum JoinType { joinMiter, joinRound, joinBevel }; + struct ExtLineInfo + { + double m_fLineWidth; + double m_fTransparency; + CapType m_eCap; + JoinType m_eJoin; + double m_fMiterLimit; + std::vector< double > m_aDashArray; + + ExtLineInfo() : m_fLineWidth( 0.0 ), + m_fTransparency( 0.0 ), + m_eCap( capButt ), + m_eJoin( joinMiter ), + m_fMiterLimit( 10.0 ) + {} + }; + + enum Orientation { Portrait, Landscape, Seascape, Inherit }; + + // in case the below enum is added PDF_1_6 PDF_1_7, please add them just after PDF_1_5 + enum PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_A_1 };//i59651, PDF/A-1b & -1a, only -1b implemented for now + // for the meaning of DestAreaType please look at PDF Reference Manual + // version 1.4 section 8.2.1, page 475 + enum DestAreaType { XYZ, Fit, FitHorizontal, FitVertical, + FitRectangle, FitPageBoundingBox, FitPageBoundingBoxHorizontal, + FitPageBoundingBoxVertical + }; + + // for a definition of structural element types please refer to + // PDF Reference, 3rd ed. section 9.7.4 + enum StructElement + { + // special element to place outside the structure hierarchy + NonStructElement, + // Grouping elements + Document, Part, Article, Section, Division, BlockQuote, + Caption, TOC, TOCI, Index, + + // block level elements + Paragraph, Heading, H1, H2, H3, H4, H5, H6, + List, ListItem, LILabel, LIBody, + Table, TableRow, TableHeader, TableData, + + // inline level elements + Span, Quote, Note, Reference, BibEntry, Code, Link, + + // illustration elements + Figure, Formula, Form + }; + + enum StructAttribute + { + Placement, WritingMode, SpaceBefore, SpaceAfter, StartIndent, EndIndent, + TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign, + LineHeight, BaselineShift, TextDecorationType, ListNumbering, + RowSpan, ColSpan, + + // link destination is an artificial attribute that sets + // the link annotation ID of a Link element + // further note: since structure attributes can only be + // set during content creation, but links can be + // created after the fact, it is possible to set + // an arbitrary id as structure attribute here. In this + // case the arbitrary id has to be passed again when the + // actual link annotation is created via SetLinkPropertyID + LinkAnnotation, + // Language currently sets a LanguageType (see i18npool/lang.h) + // which will be internally changed to a corresponding locale + Language + }; + + enum StructAttributeValue + { + Invalid, + NONE, + // Placement + Block, Inline, Before, After, Start, End, + // WritingMode + LrTb, RlTb, TbRl, + // TextAlign + Center, Justify, + // Width, Height, + Auto, + // BlockAlign + Middle, + // LineHeight + Normal, + // TextDecorationType + Underline, Overline, LineThrough, + // ListNumbering + Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, LowerAlpha + }; + + enum PageTransition + { + Regular, + SplitHorizontalInward, SplitHorizontalOutward, + SplitVerticalInward, SplitVerticalOutward, + BlindsHorizontal, BlindsVertical, + BoxInward, BoxOutward, + WipeLeftToRight, WipeBottomToTop, WipeRightToLeft, WipeTopToBottom, + Dissolve, + GlitterLeftToRight, GlitterTopToBottom, GlitterTopLeftToBottomRight + }; + + enum WidgetType + { + PushButton, RadioButton, CheckBox, Edit, ListBox, ComboBox, Hierarchy + }; + + enum WidgetState + { + // PushButton, RadioButton, CheckBox; Down means selected for + // RadioButton and CheckBox + Up, Down + }; + + enum ErrorCode + { + // transparent object occurred and was draw opaque because + // PDF/A does not allow transparency + Warning_Transparency_Omitted_PDFA, + + // transparent object occured but is only supported since + // PDF 1.4 + Warning_Transparency_Omitted_PDF13, + + // a form action was exported that is not suitable for PDF/A + // the action was skipped + Warning_FormAction_Omitted_PDFA, + + // transparent objects were converted to a bitmap in order + // to removetransparencies from the output + Warning_Transparency_Converted + }; + + struct VCL_DLLPUBLIC AnyWidget + { + protected: + WidgetType Type; // primitive RTTI + public: + rtl::OUString Name; // a distinct name to identify the control + rtl::OUString Description;// descriptive text for the contro (e.g. for tool tip) + rtl::OUString Text; // user text to appear on the control + USHORT TextStyle; // style flags + bool ReadOnly; + Rectangle Location; // describes the area filled by the control + bool Border; // true: widget should have a border, false: no border + Color BorderColor;// COL_TRANSPARENT and Border=true means get color from application settings + bool Background; // true: widget shall draw its background, false: no background + Color BackgroundColor; // COL_TRANSPARENT and Background=true means get color from application settings + Font TextFont; // an empty font will be replaced by the + // appropriate font from the user settings + Color TextColor; // COL_TRANSPARENT will be replaced by the appropriate color from application settings + sal_Int32 TabOrder; // lowest number is first in tab order + + /* style flags for text are those for OutputDevice::DrawText + allowed values are: + TEXT_DRAW_LEFT, TEXT_DRAW_CENTER, TEXT_DRAW_RIGHT, TEXT_DRAW_TOP, + TEXT_DRAW_VCENTER, TEXT_DRAW_BOTTOM, + TEXT_DRAW_MULTILINE, TEXT_DRAW_WORDBREAK + + if TextStyle is 0, then each control will fill in default values + */ + + // note: the Name member comprises the field name of the resulting + // PDF field names need to be globally unique. Therefore if any + // Widget with an already used name is created, the name will be + // made unique by adding an underscore ('_') and an ascending number + // to the name. + + AnyWidget( WidgetType eType ) : + Type( eType ), + TextStyle( 0 ), + ReadOnly( false ), + Border( false ), + BorderColor( COL_TRANSPARENT ), + Background( false ), + BackgroundColor( COL_TRANSPARENT ), + TextColor( COL_TRANSPARENT ), + TabOrder( -1 ) + {} + virtual ~AnyWidget(); + + WidgetType getType() const { return Type; } + + virtual AnyWidget* Clone() const = 0; + + protected: + // note that this equals the default compiler-generated copy-ctor, but we want to have it + // protected, to only allow sub classes to access it + AnyWidget( const AnyWidget& rSource ) + :Type( rSource.Type ) + ,Name( rSource.Name ) + ,Description( rSource.Description ) + ,Text( rSource.Text ) + ,TextStyle( rSource.TextStyle ) + ,ReadOnly( rSource.ReadOnly ) + ,Location( rSource.Location ) + ,Border( rSource.Border ) + ,BorderColor( rSource.BorderColor ) + ,Background( rSource.Background ) + ,BackgroundColor( rSource.BackgroundColor ) + ,TextFont( rSource.TextFont ) + ,TextColor( rSource.TextColor ) + ,TabOrder( rSource.TabOrder ) + { + } + AnyWidget& operator=( const AnyWidget& ); // never implemented + }; + + struct PushButtonWidget : public AnyWidget + { + /* If Dest is set to a valid link destination, + Then pressing the button will act as a goto + action within the docuemnt. + + Else: + An empty URL means this button will reset the form. + + If URL is not empty and Submit is set, then the URL + contained will be set as the URL to submit the + form to. In this case the submit method will be + either GET if SubmitGet is true or POST if + SubmitGet is false. + + If URL is not empty and Submit is clear, then + the URL contained will be interpreted as a + hyperlink to be executed on pushing the button. + + There will be no error checking or any kind of + conversion done to the URL parameter execept this: + it will be output as 7bit Ascii. The URL + will appear literally in the PDF file produced + */ + sal_Int32 Dest; + rtl::OUString URL; + bool Submit; + bool SubmitGet; + + PushButtonWidget() + : AnyWidget( vcl::PDFWriter::PushButton ), + Dest( -1 ), Submit( false ), SubmitGet( false ) + {} + + virtual AnyWidget* Clone() const + { + return new PushButtonWidget( *this ); + } + }; + + struct CheckBoxWidget : public AnyWidget + { + bool Checked; + bool ButtonIsLeft; + + CheckBoxWidget() + : AnyWidget( vcl::PDFWriter::CheckBox ), + Checked( false ), + ButtonIsLeft( true ) + {} + + virtual AnyWidget* Clone() const + { + return new CheckBoxWidget( *this ); + } + }; + + struct RadioButtonWidget : public AnyWidget + { + bool Selected; + sal_Int32 RadioGroup; + bool ButtonIsLeft; + rtl::OUString OnValue; // the value of the radio button if it is selected + + RadioButtonWidget() + : AnyWidget( vcl::PDFWriter::RadioButton ), + Selected( false ), + RadioGroup( 0 ), + ButtonIsLeft( true ) + {} + + virtual AnyWidget* Clone() const + { + return new RadioButtonWidget( *this ); + } + // radio buttons having the same RadioGroup id comprise one + // logical radio button group, that is at most one of the RadioButtons + // in a group can be checked at any time + // + // note: a PDF radio button field consists of a named field + // containing unnamed checkbox child fields. The name of the + // radio button field is taken from the first RadioButtonWidget created + // in the group + }; + + struct EditWidget : public AnyWidget + { + bool MultiLine; // whether multiple lines are allowed + bool Password; // visible echo off + bool FileSelect; // field is a file selector + sal_Int32 MaxLen; // maximum field length in characters, 0 means unlimited + + EditWidget() + : AnyWidget( vcl::PDFWriter::Edit ), + MultiLine( false ), + Password( false ), + FileSelect( false ), + MaxLen( 0 ) + {} + + virtual AnyWidget* Clone() const + { + return new EditWidget( *this ); + } + }; + + struct ListBoxWidget : public AnyWidget + { + bool DropDown; + bool Sort; + bool MultiSelect; + std::vector<rtl::OUString> Entries; + std::vector<sal_Int32> SelectedEntries; + // if MultiSelect is false only the first entry of SelectedEntries + // will be taken into account. the same is implicit for PDF < 1.4 + // since multiselect is a 1.4+ feature + + ListBoxWidget() + : AnyWidget( vcl::PDFWriter::ListBox ), + DropDown( false ), + Sort( false ), + MultiSelect( false ) + {} + + virtual AnyWidget* Clone() const + { + return new ListBoxWidget( *this ); + } + }; + + // note: PDF only supports dropdown comboboxes + struct ComboBoxWidget : public AnyWidget + { + bool Sort; + std::vector<rtl::OUString> Entries; + // set the current value in AnyWidget::Text + + ComboBoxWidget() + : AnyWidget( vcl::PDFWriter::ComboBox ), + Sort( false ) + {} + + virtual AnyWidget* Clone() const + { + return new ComboBoxWidget( *this ); + } + }; + + enum ExportDataFormat { HTML, XML, FDF, PDF }; +// see 3.6.1 of PDF 1.4 ref for details, used for 8.1 PDF v 1.4 ref also +// These emuns are treated as integer while reading/writing to configuration + enum PDFViewerPageMode + { + ModeDefault, + UseOutlines, + UseThumbs + }; +// These emuns are treated as integer while reading/writing to configuration + enum PDFViewerAction + { + ActionDefault, + FitInWindow, + FitWidth, + FitVisible, + ActionZoom + }; +// These emuns are treated as integer while reading/writing to configuration + enum PDFPageLayout + { + DefaultLayout, + SinglePage, + Continuous, + ContinuousFacing + }; + + // These emuns are treated as integer while reading/writing to configuration + //what default action to generate in a PDF hyperlink to external document/site + enum PDFLinkDefaultAction + { + URIAction, + URIActionDestination, + LaunchAction + }; + +/* +The following structure describes the permissions used in PDF security + */ + struct PDFSecPermissions + { +//for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20. + bool CanPrintTheDocument; + bool CanModifyTheContent; + bool CanCopyOrExtract; + bool CanAddOrModify; +//for revision 3 (bit 128 security) only + bool CanFillInteractive; + bool CanExtractForAccessibility; + bool CanAssemble; + bool CanPrintFull; +//permission default set for 128 bit, accessibility only + PDFSecPermissions() : + CanPrintTheDocument ( false ), + CanModifyTheContent ( false ), + CanCopyOrExtract ( false ), + CanAddOrModify ( false ), + CanFillInteractive ( false ), + CanExtractForAccessibility ( true ), + CanAssemble ( false ), + CanPrintFull ( false ) + {} + }; + + struct PDFWriterContext + { + /* must be a valid file: URL usable by osl */ + rtl::OUString URL; + /* the URL of the document being exported, used for relative links*/ + rtl::OUString BaseURL; + /*if relative to file system should be formed*/ + bool RelFsys;//i56629, i49415?, i64585? + /*the action to set the PDF hyperlink to*/ + PDFWriter::PDFLinkDefaultAction DefaultLinkAction; + //convert the .od? target file type in a link to a .pdf type + //this is examined before doing anything else + bool ConvertOOoTargetToPDFTarget; + //when the file type is .pdf, force the GoToR action + bool ForcePDFAction; + + /* decides the PDF language level to be produced */ + PDFVersion Version; + /* valid for PDF >= 1.4 + causes the MarkInfo entry in the document catalog to be set + */ + bool Tagged; + /* forces the embedding of PDF standard fonts */ + bool EmbedStandardFonts; + /* determines in which format a form + will be submitted. + */ + PDFWriter::ExportDataFormat SubmitFormat; + bool AllowDuplicateFieldNames; + bool FieldsUseSystemFonts; + /* the following data members are used to customize the PDF viewer + preferences + */ + /* see 3.6.1 PDF v 1.4 ref*/ + PDFWriter::PDFViewerPageMode PDFDocumentMode; + PDFWriter::PDFViewerAction PDFDocumentAction; + // in percent, valid only if PDFDocumentAction == ActionZoom + sal_Int32 Zoom; + + /* see 8.6 PDF v 1.4 ref + specifies whether to hide the viewer tool + bars when the document is active. + */ + bool HideViewerToolbar; + bool HideViewerMenubar; + bool HideViewerWindowControls; + bool FitWindow; + bool OpenInFullScreenMode; + bool CenterWindow; + bool DisplayPDFDocumentTitle; + PDFPageLayout PageLayout; + bool FirstPageLeft; + // intially visible page in viewer (starting with 0 for first page) + sal_Int32 InitialPage; + sal_Int32 OpenBookmarkLevels; // -1 means all levels + + struct PDFSecPermissions AccessPermissions; + + bool Encrypt; // main encryption flag, must be true to encript + bool Security128bit; // true to select 128 bit encryption, false for 40 bit + rtl::OUString OwnerPassword; // owner password for PDF, in clear text + rtl::OUString UserPassword; // user password for PDF, in clear text + + com::sun::star::lang::Locale DocumentLocale; // defines the document default language + + PDFWriterContext() : + RelFsys( false ), //i56629, i49415?, i64585? + DefaultLinkAction( PDFWriter::URIAction ), + ConvertOOoTargetToPDFTarget( false ), + ForcePDFAction( false ), + Version( PDFWriter::PDF_1_4 ), + Tagged( false ), + EmbedStandardFonts( false ), + SubmitFormat( PDFWriter::FDF ), + AllowDuplicateFieldNames( false ), + FieldsUseSystemFonts( true ), + PDFDocumentMode( PDFWriter::ModeDefault ), + PDFDocumentAction( PDFWriter::ActionDefault ), + Zoom( 100 ), + HideViewerToolbar( false ), + HideViewerMenubar( false ), + HideViewerWindowControls( false ), + FitWindow( false ), + OpenInFullScreenMode( false ), + CenterWindow( false ), + DisplayPDFDocumentTitle( true ), + PageLayout( PDFWriter::DefaultLayout ), + FirstPageLeft( false ), + InitialPage( 1 ), + OpenBookmarkLevels( -1 ), + AccessPermissions( ), + Encrypt( false ), + Security128bit( true ) + {} + }; + + PDFWriter( const PDFWriterContext& rContext ); + ~PDFWriter(); + + /** Returns an OutputDevice for formatting + <p>This Output device is guaranteed to use the same + font metrics as the resulting PDF file.</p> + + @returns + the reference output device + */ + OutputDevice* GetReferenceDevice(); + + /** Creates a new page to fill + <p>If width and height are not set the page size + is inherited from the page tree</p> + <p>other effects: + resets the graphics state: MapMode, Font + Colors and other state information MUST + be set again or are undefined. + </p> + + @returns + returns the page id of the new page + */ + sal_Int32 NewPage( sal_Int32 nPageWidth = 0, sal_Int32 nPageHeight = 0, Orientation eOrientation = Inherit ); + + /* + * set document info; due to the use of document information in building the PDF document ID, must be called before + * emitting anything. + */ + void SetDocInfo( const PDFDocInfo& rInfo ); + + /* + * get currently set document info + */ + const PDFDocInfo& GetDocInfo() const; + + /* sets the document locale originally passed with the context to a new value + * only affects the output if used before calling <code>Emit/code>. + */ + void SetDocumentLocale( const com::sun::star::lang::Locale& rDocLocale ); + + /* finishes the file */ + bool Emit(); + + /* + * Get a list of errors that occured during processing + * this should enable the producer to give feedback about + * any anomalies that might have occured + */ + std::set< ErrorCode > GetErrors(); + + PDFVersion GetVersion() const; + + /* functions for graphics state */ + /* flag values: see vcl/outdev.hxx */ + void Push( USHORT nFlags = 0xffff ); + void Pop(); + + void SetClipRegion(); + void SetClipRegion( const basegfx::B2DPolyPolygon& rRegion ); + void MoveClipRegion( long nHorzMove, long nVertMove ); + void IntersectClipRegion( const Rectangle& rRect ); + void IntersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ); + + void SetAntialiasing( USHORT nMode = 0 ); + + void SetLayoutMode( ULONG nMode ); + void SetDigitLanguage( LanguageType eLang ); + + void SetLineColor( const Color& rColor ); + void SetLineColor() { SetLineColor( Color( COL_TRANSPARENT ) ); } + + void SetFillColor( const Color& rColor ); + void SetFillColor() { SetFillColor( Color( COL_TRANSPARENT ) ); } + + void SetFont( const Font& rNewFont ); + void SetTextColor( const Color& rColor ); + void SetTextFillColor(); + void SetTextFillColor( const Color& rColor ); + + void SetTextLineColor(); + void SetTextLineColor( const Color& rColor ); + void SetOverlineColor(); + void SetOverlineColor( const Color& rColor ); + void SetTextAlign( ::TextAlign eAlign ); + + void SetMapMode(); + void SetMapMode( const MapMode& rNewMapMode ); + + + /* actual drawing functions */ + void DrawText( const Point& rPos, const String& rText ); + + void DrawTextLine( const Point& rPos, long nWidth, + FontStrikeout eStrikeout, + FontUnderline eUnderline, + FontUnderline eOverline, + BOOL bUnderlineAbove = FALSE ); + void DrawTextArray( const Point& rStartPt, const XubString& rStr, + const sal_Int32* pDXAry = NULL, + xub_StrLen nIndex = 0, + xub_StrLen nLen = STRING_LEN ); + void DrawStretchText( const Point& rStartPt, ULONG nWidth, + const XubString& rStr, + xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ); + void DrawText( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle = 0 ); + + void DrawPixel( const Point& rPt, const Color& rColor ); + void DrawPixel( const Point& rPt ) + { DrawPixel( rPt, Color( COL_TRANSPARENT ) ); } + void DrawPixel( const Polygon& rPts, const Color* pColors = NULL ); + void DrawPixel( const Polygon& rPts, const Color& rColor ) + { Push(); SetLineColor( rColor ); DrawPixel( rPts ); Pop(); } + + void DrawLine( const Point& rStartPt, const Point& rEndPt ); + void DrawLine( const Point& rStartPt, const Point& rEndPt, + const LineInfo& rLineInfo ); + void DrawPolyLine( const Polygon& rPoly ); + void DrawPolyLine( const Polygon& rPoly, + const LineInfo& rLineInfo ); + void DrawPolyLine( const Polygon& rPoly, const ExtLineInfo& rInfo ); + void DrawPolygon( const Polygon& rPoly ); + void DrawPolyPolygon( const PolyPolygon& rPolyPoly ); + void DrawRect( const Rectangle& rRect ); + void DrawRect( const Rectangle& rRect, + ULONG nHorzRount, ULONG nVertRound ); + void DrawEllipse( const Rectangle& rRect ); + void DrawArc( const Rectangle& rRect, + const Point& rStartPt, const Point& rEndPt ); + void DrawPie( const Rectangle& rRect, + const Point& rStartPt, const Point& rEndPt ); + void DrawChord( const Rectangle& rRect, + const Point& rStartPt, const Point& rEndPt ); + + void DrawBitmap( const Point& rDestPt, + const Bitmap& rBitmap ); + void DrawBitmap( const Point& rDestPt, const Size& rDestSize, + const Bitmap& rBitmap ); + void DrawBitmap( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const Bitmap& rBitmap ); + + void DrawBitmapEx( const Point& rDestPt, + const BitmapEx& rBitmapEx ); + void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, + const BitmapEx& rBitmapEx ); + void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const BitmapEx& rBitmapEx ); + + void DrawMask( const Point& rDestPt, + const Bitmap& rBitmap, const Color& rMaskColor ); + void DrawMask( const Point& rDestPt, const Size& rDestSize, + const Bitmap& rBitmap, const Color& rMaskColor ); + void DrawMask( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel, + const Bitmap& rBitmap, const Color& rMaskColor ); + + void DrawGradient( const Rectangle& rRect, const Gradient& rGradient ); + void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient ); + + void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch ); + + void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper ); + void DrawTransparent( const PolyPolygon& rPolyPoly, + USHORT nTransparencePercent ); + + /** Start a transparency group + + Drawing operations can be grouped together to acquire a common transparency + behaviour; after calling <code>BeginTransparencyGroup</code> all drawing + operations will be grouped together into a transparent object. + + The transparency behaviour is set with ond of the <code>EndTransparencyGroup</code> + calls and can be either a constant transparency factor or a transparent + soft mask in form of an 8 bit gray scale bitmap. + + It is permissible to nest transparency group. + + Transparency groups MUST NOT span multiple pages + + Transparency is a feature introduced in PDF1.4, so transparency group + will be ignored if the produced PDF has a lower version. The drawing + operations will be emitted normally. + */ + void BeginTransparencyGroup(); + + /** End a transparency group with constant transparency factor + + This ends a transparency group and inserts it on the current page. The + coordinates of the group result out of the grouped drawing operations. + + @param rBoundRect + The bounding rectangle of the group + + @param nTransparencePercent + The transparency factor + */ + void EndTransparencyGroup( const Rectangle& rBoundRect, USHORT nTransparencePercent ); + + /** End a transparency group with an alpha mask + + This ends a transparency group and inserts it on the current page. The + coordinates of the group result out of the grouped drawing operations. + + @param rBoundRect + The bounding rectangle of the group + + @param rAlphaMask + The transparency mask; must be an 8 bit grayscale image + */ + void EndTransparencyGroup( const Rectangle& rBoundRect, const Bitmap& rAlphaMask ); + + /** Insert a JPG encoded image (optionally with mask) + + @param rJPGData + a Stream containing the encoded image + + @param bIsTrueColor + true: jpeg is 24 bit true color, false: jpeg is 8 bit greyscale + + @param rSrcSizePixel + size in pixel of the image + + @param rTargetArea + where to put the image + + @param rMask + optional mask; if not empty it must have + the same pixel size as the image and + be either 1 bit black&white or 8 bit grey + */ + void DrawJPGBitmap( SvStream& rJPGData, bool bIsTrueColor, const Size& rSrcSizePixel, const Rectangle& rTargetArea, const Bitmap& rMask ); + + /** Create a new named destination to be used in a link from another PDF document + + @parm sDestName + the name (label) of the bookmark, to be used to jump to + + @param rRect + target rectangle on page to be displayed if dest is jumped to + + @param nPageNr + number of page the dest is on (as returned by NewPage) + or -1 in which case the current page is used + + @param eType + what dest type to use + + @returns + the destination id (to be used in SetLinkDest) or + -1 if page id does not exist + */ + sal_Int32 CreateNamedDest( const rtl::OUString& sDestName, const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ ); + /** Create a new destination to be used in a link + + @param rRect + target rectangle on page to be displayed if dest is jumped to + + @param nPageNr + number of page the dest is on (as returned by NewPage) + or -1 in which case the current page is used + + @param eType + what dest type to use + + @returns + the destination id (to be used in SetLinkDest) or + -1 if page id does not exist + */ + sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, DestAreaType eType = XYZ ); + /** Create a new link on a page + + @param rRect + active rectangle of the link (that is the area that has to be + hit to activate the link) + + @param nPageNr + number of page the link is on (as returned by NewPage) + or -1 in which case the current page is used + + @returns + the link id (to be used in SetLinkDest, SetLinkURL) or + -1 if page id does not exist + */ + sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); + /** Set the destination for a link + <p>will change a URL type link to a dest link if necessary</p> + + @param nLinkId + the link to be changed + + @param nDestId + the dest the link shall point to + @returns + 0 for success + -1 in case the link id does not exist + -2 in case the dest id does not exist + */ + sal_Int32 SetLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ); + /** Set the URL for a link + <p>will change a dest type link to an URL type link if necessary</p> + @param nLinkId + the link to be changed + + @param rURL + the URL the link shall point to. + The URL will be parsed (and corrected) by the <code>com.sun.star.util.URLTransformer</code> + service; the result will then appear literally in the PDF file produced + + @returns + 0 for success + -1 in case the link id does not exist + */ + sal_Int32 SetLinkURL( sal_Int32 nLinkId, const rtl::OUString& rURL ); + /** Resolve link in logical structure + <p> + If a link is created after the corresponding visual appearance was drawn + it is not possible to set the link id as a property attribute to the + link structure item that should be created in tagged PDF around the + visual appearance of a link. + </p> + <p> + For this reason an arbitrary id can be given to + <code>SetStructureAttributeNumerical</code> at the time the text for + the link is drawn. To resolve this arbitrary id again when the actual + link annotation is created use SetLinkPropertyID. When <code>Emit</code> + finally gets called all <code>LinkAnnotation</code> type structure attributes + will be replaced with the correct link id. + </p> + <p> + CAUTION: this technique must be used either for all or none of the links + in a document since the link id space and arbitrary property id space + could overlap and it would be impossible to resolve whether a <code>Link</code> + structure attribute value was arbitrary or already a real id. + </p> + + @param nLinkId + the link to be mapped + + @param nPropertyID + the arbitrary id set in a <code>Link</code> structure element to address + the link with real id <code>nLinkId</code> + */ + void SetLinkPropertyID( sal_Int32 nLinkId, sal_Int32 nPropertyID ); + /** Create a new outline item + + @param nParent + declares the parent of the new item in the outline hierarchy. + An invalid value will result in a new toplevel item. + + @param rText + sets the title text of the item + + @param nDestId + declares which Dest (created with CreateDest) the outline item + will point to + + @returns + the outline item id of the new item + */ + sal_Int32 CreateOutlineItem( sal_Int32 nParent = 0, const rtl::OUString& rText = rtl::OUString(), sal_Int32 nDestID = -1 ); + + /** Set an outline item's parent + + @param nItem + specififies which item should be reparented. + + @param nNewParent + specifies which outline item will be the item's new parent. + Use 0 for reparenting to top level. + + @returns + -1 if the item does not exist + -2 if the new parent does not exist, item will be reparented to top level. + */ + sal_Int32 SetOutlineItemParent( sal_Int32 nItem, sal_Int32 nNewParent ); + + /** Set an outline item's title text + + @param nItem + specififies which item should get a new text + + @param rText + sets the title text of the item + + @returns + 0 if the item exists and the text was changed + -1 if the item does not exist + */ + sal_Int32 SetOutlineItemText( sal_Int32 nItem, const rtl::OUString& rText ); + + /** Set an outline item's destination + + @param nItem + specififies which item should get a new dest + + @param nDestID + specifies the item's new destination + + @returns + -1 if the item does not exist + -2 if the new dest does not exist, dest will remain unchanged + */ + sal_Int32 SetOutlineItemDest( sal_Int32 nItem, sal_Int32 nDestID ); + + /** Create a new note on a page + + @param rRect + active rectangle of the note (that is the area that has to be + hit to popup the annotation) + + @param rNote + specifies the contents of the note + + @param nPageNr + number of page the note is on (as returned by NewPage) + or -1 in which case the current page is used + */ + void CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 ); + + /** begin a new logical structure element + + <p> + BeginStructureElement/EndStructureElement calls build the logical structure + of the PDF - the basis for tagged PDF. Structural elements are implemented + using marked content tags. Each structural element can contain sub elements + (e.g. a section can contain a heading and a paragraph). The structure hierarchy + is build automatically from the Begin/EndStructureElement calls. + + A structural element need not be contained on one page; e.g. paragraphs often + run from one page to the next. In this case the corresponding EndStructureElement + must be called while drawing the next page. + </p> + + <p> + BeginStructureElement and EndStructureElement must be called only after + <member scope="vcl">PDFWriter::NewPage</member> has been called and before + <member scope="vcl">PDFWriter::Emit</member>gets called. The current page + number is an implicit context parameter for Begin/EndStructureElement. + </p> + + <p> + For pagination artifacts that are not part of the logical structure + of the document (like header, footer or page number) the special + StructElement <code>NonStructElement</code> exists. To place content + outside of the struture tree simply call + <code>BeginStructureElement( NonStructElement )</code> then draw your + content and then call <code>EndStructureElement()</code>. All children + of a <code>NonStructElement</code> will not be part of the structure. + Nonetheless if you add a child structural element to a + <code>NonStructElement</code> you will still have to call + <code>EndStructureElement</code> for it. Best think of the structure + tree as a stack. + </p> + + <p> + Note: there is always one structural element in existance without having + called <code>BeginStructureElement</code>; this is the root of the structure + tree (called StructTreeRoot). The StructTreeRoot has always the id 0. + </p> + + @param eType + denotes what kind of element to begin (e.g. a heading or paragraph) + + @param rAlias + the specified alias will be used as structure tag. Also an entry in the PDF's + role map will be created mapping alias to regular structure type. + + @returns + the new structure element's id for use in <code>SetCurrentStructureElement</code> + */ + sal_Int32 BeginStructureElement( enum StructElement eType, const rtl::OUString& rAlias = rtl::OUString() ); + /** end the current logical structure element + + <p> + Close the current structure element. The current element's + parent becomes the current structure element again. + </p> + + @see BeginStructureElement + */ + void EndStructureElement(); + /** set the current structure element + + <p> + For different purposes it may be useful to paint a structure element's + content discontinously. In that case an already existing structure element + can be appended to by using <code>SetCurrentStructureElement</code>. The + refenrenced structure element becomes the current structure element with + all consequences: all following structure elements are appended as children + of the current element. + </p> + + @param nElement + the id of the new current structure element + + @returns + <true/> if the current structure element could be set successfully + <false/> if the current structure element could not be changed + (e.g. if the passed element id is invalid) + */ + bool SetCurrentStructureElement( sal_Int32 nElement ); + /** get the current structure element's id + + @returns + the id of the current structure element or -1 if no structure exists + (e.g. if no tagged PDF is being produced) + */ + sal_Int32 GetCurrentStructureElement(); + + /** set a structure attribute on the current structural element + + SetStructureAttribute sets an attribute of the current structural element to a + new value. A consistency check is performed before actually setting the value; + if the check fails, the function returns <FALSE/> and the attribute remains + unchanged. + + @param eAttr + denotes what attribute to change + + @param eVal + the value to set the attribute to + + @returns + <TRUE/> if the value was valid and the change has been performed, + <FALSE/> if the attribute or value was invalid; attribute remains unchanged + */ + bool SetStructureAttribute( enum StructAttribute eAttr, enum StructAttributeValue eVal ); + /** set a structure attribute on the current structural element + + SetStructureAttributeNumerical sets an attribute of the current structural element + to a new numerical value. A consistency check is performed before actually setting + the value; if the check fails, the function returns <FALSE/> and the attribute + remains unchanged. + + @param eAttr + denotes what attribute to change + + @param nValue + the value to set the attribute to + + @returns + <TRUE/> if the value was valid and the change has been performed, + <FALSE/> if the attribute or value was invalid; attribute remains unchanged + */ + bool SetStructureAttributeNumerical( enum StructAttribute eAttr, sal_Int32 nValue ); + /** set the bounding box of a structural element + + SetStructureBoundingBox sets the BBox attribute to a new value. Since the BBox + attribute can only be applied to <code>Table</code>, <code>Figure</code>, + <code>Form</code> and <code>Formula</code> elements, a call of this function + for other element types will be ignored and the BBox attribute not be set. + + @param rRect + the new bounding box for the structural element + */ + void SetStructureBoundingBox( const Rectangle& rRect ); + + /** set the ActualText attribute of a structural element + + ActualText contains the Unicode text without layout artifacts that is shown by + a structural element. For example if a line is ended prematurely with a break in + a word and continued on the next line (e.g. "happen-<newline>stance") the + corresponding ActualText would contain the unbroken line (e.g. "happenstance"). + + @param rText + contains the complete logical text the structural element displays. + */ + void SetActualText( const String& rText ); + + /** set the Alt attribute of a strutural element + + Alt is s replacement text describing the contents of a structural element. This + is mainly used by accessibility applications; e.g. a screen reader would read + the Alt replacement text for an image to a visually impaired user. + + @param rText + contains the replacement text for the structural element + */ + void SetAlternateText( const String& rText ); + + /** Sets the time in seconds a page will appear before the next + page is shown automatically + + @param nSeconds + time in seconds the current page will be shown; pass 0 for manual advancement + + @param nPageNr + the page number to apply the autoadvance time to; -1 denotes the current page + */ + void SetAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 ); + + /** Sets the transitional effect to be applied when the current page gets shown. + + @param eType + the kind of effect to be used; use Regular to disable transitional effects + for this page + + @param nMilliSec + the duration of the transitional effect in milliseconds; + set 0 to disable transitional effects + + @param nPageNr + the page number to apply the effect to; -1 denotes the current page + */ + void SetPageTransition( PageTransition eType, sal_uInt32 nMilliSec, sal_Int32 nPageNr = -1 ); + + /** create a new form control + + This function creates a new form control in the PDF and sets its various + properties. Do not pass an actual AnyWidget as <code>rControlType</code> + will be cast to the type described by the type member. + + @param rControlType + a descendant of <code>AnyWidget</code> determing the control's properties + + @returns + the new control's id for reference purposes + */ + sal_Int32 CreateControl( const AnyWidget& rControlType, sal_Int32 nPageNr = -1 ); + + /** Inserts an additional stream to the PDF file + + This function adds an arbitrary stream to the produced PDF file. May be called + any time before <code>Emit()</code>. The stream will be written during + <code>Emit</code> by calling the <code>PDFOutputStream</code> Object's <code>write</code> + method. After the call the <code>PDFOutputStream</code> will be deleted. + + All additional streams and their mimetypes will be entered into an array + in the trailer dictionary. + + @param rMimeType + the mimetype of the stream + + @param rStream + the interface to the additional stream + + @param bCompress + specifies whether the stream should be flate encoded by PDFWriter or not + */ + void AddStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress ); + + /** create a new pattern for filling operations + + This function creates a new pattern to be used for subsequent filling operations. + A pattern can consist of arbitrary drawing operations; all drawing operations + between <code>BeingPattern()</code> and <code>EndPattern()</code> calls + will be recorded and considered as forming up the pattern. + + @param rCellBounds + a rectangle defining the "cell" that will be repeated to form the pattern + */ + void BeginPattern( const Rectangle& ); + /** finish a new pattern for filling operations + + This functions finishes the pattern create begun with <code>BeginPattern()</code> + and returns a pattern id to be used in subsequent drawing operations. + + @param rMatrix + a transformation to be imposed on the drawing operations that make up the pattern + + @returns + the new pattern's id + */ + sal_Int32 EndPattern( const SvtGraphicFill::Transform& rTransformation ); + /** draw a polypolygon filled with a pattern + + @param rPolyPoly + PolyPolygon to filled + + @param nPatternId + the pattern previously obtained in the <code>EndPattern</code> call. + + @param bEOFill + true: polypolygon gets filled with EvenOdd method, + false: polypolygon gets filled with nonzero winding method + */ + void DrawPolyPolygon( const PolyPolygon& rPolyPoly, sal_Int32 nPatternId, bool bEOFill ); +}; + +} + +#endif // _VCL_PDFWRITER_HXX diff --git a/vcl/inc/vcl/pngread.hxx b/vcl/inc/vcl/pngread.hxx new file mode 100644 index 000000000000..d2879f8f182a --- /dev/null +++ b/vcl/inc/vcl/pngread.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_PNGREAD_HXX +#define _SV_PNGREAD_HXX + +#include <vcl/dllapi.h> +#include <vcl/bitmapex.hxx> +#include <vector> + +// ------------- +// - PNGReader - +// ------------- + +namespace vcl +{ + class PNGReaderImpl; + + class VCL_DLLPUBLIC PNGReader + { + PNGReaderImpl* mpImpl; + + public: + + /* the PNG chunks are read within the c'tor, so the stream will + be positioned at the end of the PNG */ + PNGReader( SvStream& rStm ); + ~PNGReader(); + + /* an empty preview size hint (=default) will read the whole image + */ + BitmapEx Read( const Size& i_rPreviewHint = Size() ); + + // retrieve every chunk that resides inside the PNG + struct ChunkData + { + sal_uInt32 nType; + std::vector< sal_uInt8 > aData; + }; + const std::vector< ChunkData >& GetChunks() const; + + void SetIgnoreGammaChunk( sal_Bool b ); + }; +} + +#endif // _SV_PNGREAD_HXX diff --git a/vcl/inc/vcl/pngwrite.hxx b/vcl/inc/vcl/pngwrite.hxx new file mode 100644 index 000000000000..38ca97a8c931 --- /dev/null +++ b/vcl/inc/vcl/pngwrite.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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_PNGWRITE_HXX +#define _SV_PNGWRITE_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <vcl/dllapi.h> +#include <vcl/bitmapex.hxx> +#include <vector> + +// ------------- +// - PNGWriter - +// ------------- + +namespace vcl +{ + class PNGWriterImpl; + + class VCL_DLLPUBLIC PNGWriter + { + PNGWriterImpl* mpImpl; + + public: + + PNGWriter( const BitmapEx& BmpEx, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData = NULL ); + ~PNGWriter(); + + sal_Bool Write( SvStream& rStm ); + + // additional method to be able to modify all chunk before they are stored + struct ChunkData + { + sal_uInt32 nType; + std::vector< sal_uInt8 > aData; + }; + std::vector< vcl::PNGWriter::ChunkData >& GetChunks(); + }; +} + +#endif // _SV_PNGWRITE_HXX diff --git a/vcl/inc/vcl/pointr.hxx b/vcl/inc/vcl/pointr.hxx new file mode 100644 index 000000000000..b90b3b04d134 --- /dev/null +++ b/vcl/inc/vcl/pointr.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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_POINTR_HXX +#define _VCL_POINTR_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/ptrstyle.hxx> + +class Point; + +// ----------- +// - Pointer - +// ----------- + +class VCL_DLLPUBLIC Pointer +{ + PointerStyle meStyle; + +public: + Pointer() + { meStyle = POINTER_ARROW; } + Pointer( PointerStyle eStyle ) + { meStyle = eStyle; } + + PointerStyle GetStyle() const { return meStyle; } + + BOOL operator==( const Pointer& rPointer ) const + { return (meStyle == rPointer.meStyle); } + BOOL operator!=( const Pointer& rPointer ) const + { return !(Pointer::operator==( rPointer )); } +}; + +#endif // _VCL_POINTR_HXX diff --git a/vcl/inc/vcl/polyscan.hxx b/vcl/inc/vcl/polyscan.hxx new file mode 100644 index 000000000000..1c699e36623d --- /dev/null +++ b/vcl/inc/vcl/polyscan.hxx @@ -0,0 +1,155 @@ +/************************************************************************* + * + * 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_POLYSCAN_HXX +#define _SV_POLYSCAN_HXX + +#include <tools/gen.hxx> + +// ----------------- +// - ScanlinePoint - +// ----------------- + +struct ScanlinePoint +{ + long mnX; + ScanlinePoint* mpNext; + + ScanlinePoint() : mnX( 0L ), mpNext( NULL ) {}; + ScanlinePoint( long nX, ScanlinePoint* pNext ) : mnX( nX ), mpNext( pNext ) {}; + ~ScanlinePoint() {}; + + void Set( long nX, ScanlinePoint* pNext ) { mnX = nX, mpNext = pNext; } +}; + +// ------------------- +// - PolyScanSegment - +// ------------------- + +struct PolyScanSegment +{ + long mnStart; + long mnEnd; + + PolyScanSegment() : mnStart( 0L ), mnEnd( 0L ) {}; + PolyScanSegment( long nStart, long nEnd ) : mnStart( nStart ), mnEnd( nEnd ) {}; + ~PolyScanSegment() {}; +}; + +// ---------------- +// - PolyScanline - +// ---------------- + +struct ScanlinePoint; +class Polygon; +class PolyPolygon; + +class PolyScanline +{ +private: + + ScanlinePoint* mpFirst; + ScanlinePoint* mpLast; + ScanlinePoint* mpAct; + long mnLeft; + long mnRight; + + void ImplDelete(); + +public: + + PolyScanline(); + ~PolyScanline(); + + void Insert( long nX ); + void Set( long nStart, long nEnd ); + void Set( const PolyScanSegment& rSegment ) { Set( rSegment.mnStart, rSegment.mnEnd ); } + + inline BOOL GetFirstX( long& rX ); + inline BOOL GetNextX( long& rX ); + + BOOL GetFirstSegment( PolyScanSegment& rSegment ); + BOOL GetNextSegment( PolyScanSegment& rSegment ); +}; + +// ------------------------------------------------------------------------ + +inline BOOL PolyScanline::GetFirstX( long& rX ) +{ + mpAct = mpFirst; + return( mpAct ? ( rX = mpAct->mnX, mpAct = mpAct->mpNext, TRUE ) : FALSE ); +} + +// ------------------------------------------------------------------------ + +inline BOOL PolyScanline::GetNextX( long& rX ) +{ + return( mpAct ? ( rX = mpAct->mnX, mpAct = mpAct->mpNext, TRUE ) : FALSE ); +} + +// --------------- +// - PolyScanner - +// --------------- + +class PolyScanner +{ +private: + + PolyScanline* mpArray; + long mnLeft; + long mnTop; + long mnRight; + long mnBottom; + + PolyScanner() {}; + +protected: + + void InsertLine( const Point& rStart, const Point& rEnd ); + +public: + + PolyScanner( const Rectangle& rRect ); + PolyScanner( const Polygon& rPoly ); + PolyScanner( const PolyPolygon& rPolyPoly ); + ~PolyScanner(); + + long Left() const { return mnLeft; } + long Top() const { return mnTop; } + long Right() const { return mnRight; } + long Bottom() const { return mnBottom; } + + long Width() const { return( mnRight - mnLeft + 1L ); } + long Height() const { return( mnBottom - mnTop + 1L ); } + + Rectangle GetBoundRect() const { return Rectangle( mnLeft, mnTop, mnRight, mnBottom ); } + + ULONG Count() const { return Height(); } + PolyScanline* operator[]( ULONG nPos ) const; +}; + +#endif // _SV_POLYSCAN_HXX diff --git a/vcl/inc/vcl/popupmenuwindow.hxx b/vcl/inc/vcl/popupmenuwindow.hxx new file mode 100644 index 000000000000..5ed794ff56ca --- /dev/null +++ b/vcl/inc/vcl/popupmenuwindow.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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 __POPUPMENUWINDOW_HXX__ +#define __POPUPMENUWINDOW_HXX__ + +#include "vcl/floatwin.hxx" + +class VCL_DLLPUBLIC PopupMenuFloatingWindow : public FloatingWindow +{ +private: + struct ImplData; + ImplData* mpImplData; +public: + PopupMenuFloatingWindow( Window* pParent, WinBits nStyle = (WB_SYSTEMFLOATWIN|WB_SYSTEMWINDOW|WB_NOBORDER) ); + ~PopupMenuFloatingWindow(); + + sal_uInt16 GetMenuStackLevel() const; + void SetMenuStackLevel( sal_uInt16 nLevel ); + bool IsPopupMenu() const; +}; + +#endif diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx new file mode 100644 index 000000000000..c7a1e09b81e4 --- /dev/null +++ b/vcl/inc/vcl/ppdparser.hxx @@ -0,0 +1,343 @@ +/************************************************************************* + * + * 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 _PSPRINT_PPDPARSER_HXX_ +#define _PSPRINT_PPDPARSER_HXX_ + +#include <list> +#include <vector> +#include <hash_map> + +#include "tools/string.hxx" +#include "tools/stream.hxx" + +#include "com/sun/star/lang/Locale.hpp" + +#define PRINTER_PPDDIR "driver" + +namespace psp { + +class PPDParser; +class PPDTranslator; + +enum PPDValueType { eInvocation, eQuoted, eSymbol, eString, eNo }; + +struct PPDValue +{ + PPDValueType m_eType; + String m_aOption; + String m_aValue; +}; + +// ---------------------------------------------------------------------- + +/* + * PPDKey - a container for the available options (=values) of a PPD keyword + */ + +class PPDKey +{ + friend class PPDParser; + + typedef ::std::hash_map< ::rtl::OUString, PPDValue, ::rtl::OUStringHash > hash_type; + typedef ::std::vector< PPDValue* > value_type; + + String m_aKey; + hash_type m_aValues; + value_type m_aOrderedValues; + const PPDValue* m_pDefaultValue; + bool m_bQueryValue; + PPDValue m_aQueryValue; + +public: + enum UIType { PickOne, PickMany, Boolean }; + enum SetupType { ExitServer, Prolog, DocumentSetup, PageSetup, JCLSetup, AnySetup }; +private: + + bool m_bUIOption; + UIType m_eUIType; + int m_nOrderDependency; + SetupType m_eSetupType; + + void eraseValue( const String& rOption ); +public: + PPDKey( const String& rKey ); + ~PPDKey(); + + PPDValue* insertValue( const String& rOption ); + int countValues() const + { return m_aValues.size(); } + // neither getValue will return the query option + const PPDValue* getValue( int n ) const; + const PPDValue* getValue( const String& rOption ) const; + const PPDValue* getValueCaseInsensitive( const String& rOption ) const; + const PPDValue* getDefaultValue() const { return m_pDefaultValue; } + const PPDValue* getQueryValue() const { return m_bQueryValue ? &m_aQueryValue : NULL; } + + const String& getKey() const { return m_aKey; } + bool isUIKey() const { return m_bUIOption; } + UIType getUIType() const { return m_eUIType; } + SetupType getSetupType() const { return m_eSetupType; } + int getOrderDependency() const { return m_nOrderDependency; } +}; + +// define a hash for PPDKey +struct PPDKeyhash +{ + size_t operator()( const PPDKey * pKey) const + { return (size_t)pKey; } +}; + +// ---------------------------------------------------------------------- + +/* + * PPDParser - parses a PPD file and contains all available keys from it + */ + +class PPDContext; +class CUPSManager; + +class PPDParser +{ + friend class PPDContext; + friend class CUPSManager; + + typedef ::std::hash_map< ::rtl::OUString, PPDKey*, ::rtl::OUStringHash > hash_type; + typedef ::std::vector< PPDKey* > value_type; + + void insertKey( const String& rKey, PPDKey* pKey ); +public: + struct PPDConstraint + { + const PPDKey* m_pKey1; + const PPDValue* m_pOption1; + const PPDKey* m_pKey2; + const PPDValue* m_pOption2; + + PPDConstraint() : m_pKey1( NULL ), m_pOption1( NULL ), m_pKey2( NULL ), m_pOption2( NULL ) {} + }; +private: + + static ::std::list< PPDParser* > aAllParsers; + static ::std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >* + pAllPPDFiles; + + hash_type m_aKeys; + value_type m_aOrderedKeys; + ::std::list< PPDConstraint > m_aConstraints; + + // some identifying fields + String m_aPrinterName; + String m_aNickName; + // the full path of the PPD file + String m_aFile; + // some basic attributes + bool m_bColorDevice; + bool m_bType42Capable; + ULONG m_nLanguageLevel; + rtl_TextEncoding m_aFileEncoding; + + + // shortcuts to important keys and their default values + // imageable area + const PPDValue* m_pDefaultImageableArea; + const PPDKey* m_pImageableAreas; + // paper dimensions + const PPDValue* m_pDefaultPaperDimension; + const PPDKey* m_pPaperDimensions; + // paper trays + const PPDValue* m_pDefaultInputSlot; + const PPDKey* m_pInputSlots; + // resolutions + const PPDValue* m_pDefaultResolution; + const PPDKey* m_pResolutions; + // duplex commands + const PPDValue* m_pDefaultDuplexType; + const PPDKey* m_pDuplexTypes; + + // fonts + const PPDKey* m_pFontList; + + // translations + PPDTranslator* m_pTranslator; + + PPDParser( const String& rFile ); + ~PPDParser(); + + void parseOrderDependency( const ByteString& rLine ); + void parseOpenUI( const ByteString& rLine ); + void parseConstraint( const ByteString& rLine ); + void parse( std::list< ByteString >& rLines ); + + String handleTranslation( const ByteString& i_rString, bool i_bIsGlobalized ); + + static void scanPPDDir( const String& rDir ); + static void initPPDFiles(); + static String getPPDFile( const String& rFile ); +public: + static const PPDParser* getParser( const String& rFile ); + static String getPPDPrinterName( const String& rFile ); + static void freeAll(); + static void getKnownPPDDrivers( std::list< rtl::OUString >& o_rDrivers, bool bRefresh = false ); + + const String& getFilename() const { return m_aFile; } + + const PPDKey* getKey( int n ) const; + const PPDKey* getKey( const String& rKey ) const; + int getKeys() const { return m_aKeys.size(); } + bool hasKey( const PPDKey* ) const; + + const ::std::list< PPDConstraint >& getConstraints() const { return m_aConstraints; } + + const String& getPrinterName() const + { return m_aPrinterName.Len() ? m_aPrinterName : m_aNickName; } + const String& getNickName() const + { return m_aNickName.Len() ? m_aNickName : m_aPrinterName; } + + bool isColorDevice() const { return m_bColorDevice; } + bool isType42Capable() const { return m_bType42Capable; } + ULONG getLanguageLevel() const { return m_nLanguageLevel; } + + String getDefaultPaperDimension() const; + void getDefaultPaperDimension( int& rWidth, int& rHeight ) const + { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); } + bool getPaperDimension( const String& rPaperName, + int& rWidth, int& rHeight ) const; + // width and height in pt + // returns false if paper not found + int getPaperDimensions() const + { return m_pPaperDimensions ? m_pPaperDimensions->countValues() : 0; } + String getPaperDimension( int ) const; + String getPaperDimensionCommand( int ) const; + String getPaperDimensionCommand( const String & ) const; + + // match the best paper for width and height + String matchPaper( int nWidth, int nHeight ) const; + + bool getMargins( const String& rPaperName, + int &rLeft, int& rRight, + int &rUpper, int& rLower ) const; + // values in pt + // returns true if paper found + + // values int pt + + String getDefaultInputSlot() const; + int getInputSlots() const + { return m_pInputSlots ? m_pInputSlots->countValues() : 0; } + String getSlot( int ) const; + String getSlotCommand( int ) const; + String getSlotCommand( const String& ) const; + + void getDefaultResolution( int& rXRes, int& rYRes ) const; + int getResolutions() const; + void getResolution( int, int& rXRes, int& rYRes ) const; + String getResolutionCommand( int nXRes, int nYRes ) const; + // values in dpi + void getResolutionFromString( const String&, int&, int& ) const; + // helper function + + String getDefaultDuplexType() const; + int getDuplexTypes() const + { return m_pDuplexTypes ? m_pDuplexTypes->countValues() : 0; } + String getDuplex( int ) const; + String getDuplexCommand( int ) const; + String getDuplexCommand( const String& ) const; + + int getFonts() const + { return m_pFontList ? m_pFontList->countValues() : 0; } + void getFontAttributes( int, + String& rEncoding, + String& rCharset ) const; + void getFontAttributes( const String&, + String& rEncoding, + String& rCharset ) const; + String getFont( int ) const; + + + rtl::OUString translateKey( const rtl::OUString& i_rKey, + const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const; + rtl::OUString translateOption( const rtl::OUString& i_rKey, + const rtl::OUString& i_rOption, + const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const; + rtl::OUString translateValue( const rtl::OUString& i_rKey, + const rtl::OUString& i_rOption, + const rtl::OUString& i_rValue, + const com::sun::star::lang::Locale& i_rLocale = com::sun::star::lang::Locale() ) const; +}; + +// ---------------------------------------------------------------------- + +/* + * PPDContext - a class to manage user definable states based on the + * contents of a PPDParser. + */ + +class PPDContext +{ + typedef ::std::hash_map< const PPDKey*, const PPDValue*, PPDKeyhash > hash_type; + hash_type m_aCurrentValues; + const PPDParser* m_pParser; + + // returns false: check failed, new value is constrained + // true: check succeded, new value can be set + bool checkConstraints( const PPDKey*, const PPDValue*, bool bDoReset ); + bool resetValue( const PPDKey*, bool bDefaultable = false ); +public: + PPDContext( const PPDParser* pParser = NULL ); + PPDContext( const PPDContext& rContext ) { operator=( rContext ); } + PPDContext& operator=( const PPDContext& rContext ); + ~PPDContext(); + + void setParser( const PPDParser* ); + const PPDParser* getParser() const { return m_pParser; } + + const PPDValue* getValue( const PPDKey* ) const; + const PPDValue* setValue( const PPDKey*, const PPDValue*, bool bDontCareForConstraints = false ); + + int countValuesModified() const { return m_aCurrentValues.size(); } + const PPDKey* getModifiedKey( int n ) const; + + // public wrapper for the private method + bool checkConstraints( const PPDKey*, const PPDValue* ); + + void getUnconstrainedValues( const PPDKey*, ::std::list< const PPDValue* >& rValues ); + + // for printer setup + void* getStreamableBuffer( ULONG& rBytes ) const; + void rebuildFromStreamBuffer( void* pBuffer, ULONG nBytes ); + + // convenience + int getRenderResolution() const; + + // width, height in points, paper will contain the name of the selected + // paper after the call + void getPageSize( String& rPaper, int& rWidth, int& rHeight ) const; +}; + +} // namespace + +#endif // _PSPRINT_PPDPARSER_HXX_ diff --git a/vcl/inc/vcl/print.h b/vcl/inc/vcl/print.h new file mode 100644 index 000000000000..78c1bb647575 --- /dev/null +++ b/vcl/inc/vcl/print.h @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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_PRINT_H +#define _SV_PRINT_H + +#include "vcl/sv.h" +#include "vcl/dllapi.h" + +#include <vector> +#include <hash_map> + +struct SalPrinterQueueInfo; +class QueueInfo; +class JobSetup; + +namespace vcl +{ class PrinterListener; } + +// -------------------- +// - ImplPrnQueueData - +// -------------------- + +struct ImplPrnQueueData +{ + QueueInfo* mpQueueInfo; + SalPrinterQueueInfo* mpSalQueueInfo; +}; + +// -------------------- +// - ImplPrnQueueList - +// -------------------- + +class VCL_DLLPUBLIC ImplPrnQueueList +{ +public: + std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash > + m_aNameToIndex; + std::vector< ImplPrnQueueData > m_aQueueInfos; + std::vector< rtl::OUString > m_aPrinterList; + + ImplPrnQueueList() {} + ~ImplPrnQueueList(); + + void Add( SalPrinterQueueInfo* pData ); + ImplPrnQueueData* Get( const rtl::OUString& rPrinter ); +}; + +// -------------- +// - Prototypes - +// -------------- + +void ImplDeletePrnQueueList(); +void SAL_DLLPRIVATE ImplUpdateJobSetupPaper( JobSetup& rJobSetup ); + + +#endif // _SV_PRINT_H diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx new file mode 100644 index 000000000000..be7633f13d53 --- /dev/null +++ b/vcl/inc/vcl/print.hxx @@ -0,0 +1,682 @@ +/************************************************************************* + * + * 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_PRINT_HXX +#define _SV_PRINT_HXX + +#include "tools/errcode.hxx" +#include "vcl/sv.h" +#include "vcl/dllapi.h" +#include "vcl/outdev.hxx" +#include "vcl/prntypes.hxx" +#include "vcl/jobset.hxx" +#include "vcl/gdimtf.hxx" +#include "tools/stream.hxx" +#include "tools/multisel.hxx" + +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/view/PrintableState.hpp" + +#include <boost/shared_ptr.hpp> +#include <hash_map> +#include <set> + +struct SalPrinterInfoQueue; +class SalInfoPrinter; +struct SalPrinterQueueInfo; +class SalPrinter; +class VirtualDevice; +class Window; + +namespace vcl { + class PrinterController; + class PrintDialog; +} + +// ----------------- +// - Printer-Types - +// ----------------- + +#define PAGEQUEUE_ALLPAGES 0xFFFF + +enum PrinterSupport { SUPPORT_SET_ORIENTATION, SUPPORT_SET_PAPERBIN, + SUPPORT_SET_PAPERSIZE, SUPPORT_SET_PAPER, + SUPPORT_COPY, SUPPORT_COLLATECOPY, + SUPPORT_SETUPDIALOG, SUPPORT_FAX, SUPPORT_PDF }; + +// --------------- +// - PrinterPage - +// --------------- + +class VCL_DLLPUBLIC PrinterPage +{ + GDIMetaFile* mpMtf; + JobSetup maJobSetup; + UINT16 mbNewJobSetup; + +public: + + PrinterPage() : mpMtf( new GDIMetaFile() ) {} + PrinterPage( GDIMetaFile* pMtf, BOOL bNewJobSetup, const JobSetup& rSetup ) : + mpMtf( pMtf ), maJobSetup( rSetup ), mbNewJobSetup( bNewJobSetup ) {} + ~PrinterPage() { delete mpMtf; } + + GDIMetaFile* GetGDIMetaFile() const { return mpMtf; } + const JobSetup& GetJobSetup() const { return maJobSetup; } + BOOL IsNewJobSetup() const { return (mbNewJobSetup != 0); } + + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const PrinterPage& rPage ) + { rOStm << rPage.mbNewJobSetup; rOStm << rPage.maJobSetup; rPage.mpMtf->Write( rOStm ); return rOStm; } + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, PrinterPage& rPage ) + { return rIStm >> rPage.mbNewJobSetup >> rPage.maJobSetup >> *rPage.mpMtf; } +}; + + +// ------------- +// - QueueInfo - +// ------------- + +class VCL_DLLPUBLIC QueueInfo +{ + friend class Printer; + +private: + XubString maPrinterName; + XubString maDriver; + XubString maLocation; + XubString maComment; + sal_uInt32 mnStatus; + sal_uInt32 mnJobs; + +public: + QueueInfo(); + QueueInfo( const QueueInfo& rInfo ); + ~QueueInfo(); + + const XubString& GetPrinterName() const { return maPrinterName; } + const XubString& GetDriver() const { return maDriver; } + const XubString& GetLocation() const { return maLocation; } + const XubString& GetComment() const { return maComment; } + sal_uInt32 GetStatus() const { return mnStatus; } + sal_uInt32 GetJobs() const { return mnJobs; } + + bool operator==( const QueueInfo& rInfo ) const; + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, QueueInfo& rInfo ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const QueueInfo& rInfo ); +}; + +// ------------------ +// - PrinterOptions - +// ------------------ + +enum PrinterTransparencyMode +{ + PRINTER_TRANSPARENCY_AUTO = 0, + PRINTER_TRANSPARENCY_NONE = 1 +}; + +// ----------------------------------------------------------------------------- + +enum PrinterGradientMode +{ + PRINTER_GRADIENT_STRIPES = 0, + PRINTER_GRADIENT_COLOR = 1 +}; + +// ----------------------------------------------------------------------------- + +enum PrinterBitmapMode +{ + PRINTER_BITMAP_OPTIMAL = 0, + PRINTER_BITMAP_NORMAL = 1, + PRINTER_BITMAP_RESOLUTION = 2 +}; + +// ----------------------------------------------------------------------------- + +class VCL_DLLPUBLIC PrinterOptions +{ +private: + + BOOL mbReduceTransparency; + PrinterTransparencyMode meReducedTransparencyMode; + BOOL mbReduceGradients; + PrinterGradientMode meReducedGradientsMode; + USHORT mnReducedGradientStepCount; + BOOL mbReduceBitmaps; + PrinterBitmapMode meReducedBitmapMode; + USHORT mnReducedBitmapResolution; + BOOL mbReducedBitmapsIncludeTransparency; + BOOL mbConvertToGreyscales; + +public: + + PrinterOptions(); + ~PrinterOptions(); + + BOOL IsReduceTransparency() const { return mbReduceTransparency; } + void SetReduceTransparency( BOOL bSet ) { mbReduceTransparency = bSet; } + + PrinterTransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; } + void SetReducedTransparencyMode( PrinterTransparencyMode eMode ) { meReducedTransparencyMode = eMode; } + + BOOL IsReduceGradients() const { return mbReduceGradients; } + void SetReduceGradients( BOOL bSet ) { mbReduceGradients = bSet; } + + PrinterGradientMode GetReducedGradientMode() const { return meReducedGradientsMode; } + void SetReducedGradientMode( PrinterGradientMode eMode ) { meReducedGradientsMode = eMode; } + + USHORT GetReducedGradientStepCount() const { return mnReducedGradientStepCount; } + void SetReducedGradientStepCount( USHORT nStepCount ) { mnReducedGradientStepCount = nStepCount; } + + BOOL IsReduceBitmaps() const { return mbReduceBitmaps; } + void SetReduceBitmaps( BOOL bSet ) { mbReduceBitmaps = bSet; } + + PrinterBitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; } + void SetReducedBitmapMode( PrinterBitmapMode eMode ) { meReducedBitmapMode = eMode; } + + USHORT GetReducedBitmapResolution() const { return mnReducedBitmapResolution; } + void SetReducedBitmapResolution( USHORT nResolution ) { mnReducedBitmapResolution = nResolution; } + + BOOL IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; } + void SetReducedBitmapIncludesTransparency( BOOL bSet ) { mbReducedBitmapsIncludeTransparency = bSet; } + + BOOL IsConvertToGreyscales() const { return mbConvertToGreyscales; } + void SetConvertToGreyscales( BOOL bSet ) { mbConvertToGreyscales = bSet; } +}; + +// ----------- +// - Printer - +// ----------- + +class VCL_DLLPUBLIC Printer : public OutputDevice +{ + friend class OutputDevice; + friend class ImplQPrinter; + +private: + SalInfoPrinter* mpInfoPrinter; + SalPrinter* mpPrinter; + SalGraphics* mpJobGraphics; + Printer* mpPrev; + Printer* mpNext; + VirtualDevice* mpDisplayDev; + PrinterOptions* mpPrinterOptions; + XubString maPrinterName; + XubString maDriver; + XubString maPrintFile; + XubString maJobName; + JobSetup maJobSetup; + Point maPageOffset; + Size maPaperSize; + ULONG mnError; + USHORT mnCurPage; + USHORT mnCurPrintPage; + USHORT mnPageQueueSize; + USHORT mnCopyCount; + BOOL mbDefPrinter; + BOOL mbPrinting; + BOOL mbJobActive; + BOOL mbCollateCopy; + BOOL mbPrintFile; + BOOL mbInPrintPage; + BOOL mbNewJobSetup; + BOOL mbIsQueuePrinter; + BOOL mbUserSetupCompleted; + BOOL mbUserSetupResult; + Link maErrorHdl; + + SAL_DLLPRIVATE void ImplInitData(); + SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); + SAL_DLLPRIVATE void ImplInitDisplay( const Window* pWindow ); + SAL_DLLPRIVATE static SalPrinterQueueInfo* ImplGetQueueInfo( const XubString& rPrinterName, + const XubString* pDriver ); + SAL_DLLPRIVATE void ImplUpdatePageData(); + SAL_DLLPRIVATE void ImplUpdateFontList(); + SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); + DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* ); + + SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterController>& ); + + static SAL_DLLPRIVATE ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError ); + +private: + SAL_DLLPRIVATE void ImplEndPrint(); + SAL_DLLPRIVATE BOOL EndJob(); + SAL_DLLPRIVATE Printer( const Printer& rPrinter ); + SAL_DLLPRIVATE Printer& operator =( const Printer& rPrinter ); +public: + SAL_DLLPRIVATE void ImplStartPage(); + SAL_DLLPRIVATE void ImplEndPage(); +public: + void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); + void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ); + +protected: + + void SetSelfAsQueuePrinter( BOOL bQueuePrinter ) { mbIsQueuePrinter = bQueuePrinter; } + BOOL IsQueuePrinter() const { return mbIsQueuePrinter; } + +public: + Printer(); + Printer( const Window* pWindow ); + Printer( const JobSetup& rJobSetup ); + Printer( const QueueInfo& rQueueInfo ); + Printer( const XubString& rPrinterName ); + virtual ~Printer(); + + static const std::vector< rtl::OUString >& GetPrinterQueues(); + static const QueueInfo* GetQueueInfo( const String& rPrinterName, bool bStatusUpdate ); + static XubString GetDefaultPrinterName(); + + virtual void Error(); + + const XubString& GetName() const { return maPrinterName; } + const XubString& GetDriverName() const { return maDriver; } + BOOL IsDefPrinter() const { return mbDefPrinter; } + BOOL IsDisplayPrinter() const { return mpDisplayDev != NULL; } + BOOL IsValid() const { return !IsDisplayPrinter(); } + + ULONG GetCapabilities( USHORT nType ) const; + BOOL HasSupport( PrinterSupport eFeature ) const; + + BOOL SetJobSetup( const JobSetup& rSetup ); + const JobSetup& GetJobSetup() const { return maJobSetup; } + String GetJobValue( const String& rKey ) const { return maJobSetup.GetValue( rKey ); } + void SetJobValue( const String& rKey, const String& rValue ) { maJobSetup.SetValue( rKey, rValue ); } + + BOOL Setup( Window* pWindow = NULL ); + BOOL SetPrinterProps( const Printer* pPrinter ); + + void SetPrinterOptions( const PrinterOptions& rOptions ) { *mpPrinterOptions = rOptions; } + const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); } + + BOOL SetOrientation( Orientation eOrient ); + Orientation GetOrientation() const; + DuplexMode GetDuplexMode() const; + BOOL SetDuplexMode( DuplexMode ); + // returns the angle that a landscape page will be turned counterclockwise + // wrt to portrait. The return value may be only valid for + // the current paper + int GetLandscapeAngle() const; + BOOL SetPaperBin( USHORT nPaperBin ); + USHORT GetPaperBin() const; + BOOL SetPaper( Paper ePaper ); + BOOL SetPaperSizeUser( const Size& rSize ); + BOOL SetPaperSizeUser( const Size& rSize, bool bMatchNearest ); + Paper GetPaper() const; + + // returns number of available paper formats + int GetPaperInfoCount() const; + // returns info about paper format nPaper + const PaperInfo& GetPaperInfo( int nPaper ) const; + USHORT GetPaperBinCount() const; + XubString GetPaperBinName( USHORT nPaperBin ) const; + + const Size& GetPaperSizePixel() const { return maPaperSize; } + Size GetPaperSize() const { return PixelToLogic( maPaperSize ); } + const Point& GetPageOffsetPixel() const { return maPageOffset; } + Point GetPageOffset() const { return PixelToLogic( maPageOffset ); } + + BOOL SetCopyCount( USHORT nCopy, BOOL bCollate = FALSE ); + USHORT GetCopyCount() const { return mnCopyCount; } + BOOL IsCollateCopy() const { return mbCollateCopy; } + + BOOL IsPrinting() const { return mbPrinting; } + + void SetPrintFile( const XubString& rFileName ) { maPrintFile = rFileName; } + const XubString& GetPrintFile() const { return maPrintFile; } + void EnablePrintFile( BOOL bEnable ) { mbPrintFile = bEnable; } + BOOL IsPrintFileEnabled() const { return mbPrintFile; } + BOOL AbortJob(); + const XubString& GetCurJobName() const { return maJobName; } + USHORT GetCurPage() const { return mnCurPage; } + BOOL IsJobActive() const { return mbJobActive; } + + ULONG GetError() const { return ERRCODE_TOERROR(mnError); } + ULONG GetErrorCode() const { return mnError; } + + void SetErrorHdl( const Link& rLink ) { maErrorHdl = rLink; } + const Link& GetErrorHdl() const { return maErrorHdl; } + + void Compat_OldPrinterMetrics( bool bSet ); + + /** checks the printer list and updates it necessary + * + * sends a DataChanged event of type DATACHANGED_PRINTER + * if the printer list changed + */ + static void updatePrinters(); + + /** execute a print job + + starts a print job asynchronously (that is will return + + */ + static void PrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ); + + // implementation detail of PrintJob being asynchronous + // not exported, not usable outside vcl + static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ); +}; + +namespace vcl +{ +class ImplPrinterControllerData; + +class VCL_DLLPUBLIC PrinterController +{ + ImplPrinterControllerData* mpImplData; +protected: + PrinterController( const boost::shared_ptr<Printer>& ); +public: + enum NupOrderType + { LRTB, TBLR }; + struct MultiPageSetup + { + // all metrics in 100th mm + int nRows; + int nColumns; + int nRepeat; + Size aPaperSize; + long nLeftMargin; + long nTopMargin; + long nRightMargin; + long nBottomMargin; + long nHorizontalSpacing; + long nVerticalSpacing; + bool bDrawBorder; + PrinterController::NupOrderType nOrder; + + MultiPageSetup() + : nRows( 1 ), nColumns( 1 ), nRepeat( 1 ), aPaperSize( 21000, 29700 ) + , nLeftMargin( 0 ), nTopMargin( 0 ) + , nRightMargin( 0 ), nBottomMargin( 0 ) + , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 ) + , bDrawBorder( false ) + , nOrder( LRTB ) + { + } + }; + + struct PageSize + { + Size aSize; // in 100th mm + bool bFullPaper; // full paper, not only imageable area is printed + + PageSize( const Size& i_rSize = Size( 21000, 29700 ), + bool i_bFullPaper = false + ) : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {} + }; + + PrinterController(); + virtual ~PrinterController(); + + const boost::shared_ptr<Printer>& getPrinter() const; + /* for implementations: get current job properties as changed by e.g. print dialog + this gets the current set of properties initially told to Printer::PrintJob + + For convenience a second sequence will be merged in to get a combined sequence. + In case of duplicate property names, the value of i_MergeList wins. + */ + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > + getJobProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rMergeList ) const; + + /* get the PropertyValue of a Property + */ + com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ); + const com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ) const; + // get a sequence of properties + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getValues( const com::sun::star::uno::Sequence< rtl::OUString >& ) const; + /* get a bool property + in case the property is unknown or not convertible to bool, i_bFallback is returned + */ + sal_Bool getBoolProperty( const rtl::OUString& i_rPropertyName, sal_Bool i_bFallback ) const; + + /* set a property value - can also be used to add another UI property + */ + void setValue( const rtl::OUString& i_rPropertyName, const com::sun::star::uno::Any& i_rValue ); + void setValue( const com::sun::star::beans::PropertyValue& i_rValue ); + + /* return the currently active UI options. These are the same that were passed to setUIOptions. + */ + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& getUIOptions() const; + /* set possible UI options. should only be done once before passing the PrinterListener + to Printer::PrintJob + */ + void setUIOptions( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& ); + /* enable/disable an option; this can be used to implement dialog logic. + */ + void enableUIOption( const rtl::OUString& rPropName, bool bEnable ); + bool isUIOptionEnabled( const rtl::OUString& rPropName ) const; + bool isUIChoiceEnabled( const rtl::OUString& rPropName, sal_Int32 nChoice ) const; + /* returns the property name rPropName depends on or an empty string + if no dependency exists. + */ + rtl::OUString getDependency( const rtl::OUString& rPropName ) const; + /* makeEnabled will chage the property rPropName depends on to the value + that makes rPropName enabled. If the dependency itself is also disabled, + no action will be performed. + + returns the property name rPropName depends on or an empty string + if no change was made. + */ + rtl::OUString makeEnabled( const rtl::OUString& rPropName ); + + virtual int getPageCount() const = 0; // must be overloaded by the app + /* get the page parameters, namely the jobsetup that should be active for the page + (describing among others the physical page size) and the "page size". In writer + case this would probably be the same as the JobSetup since writer sets the page size + draw/impress for example print their page on the paper set on the printer, + possibly adjusting the page size to fit. That means the page size can be different from + the paper size. + */ + // must be overloaded by the app, return page size in 1/100th mm + virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const = 0; + virtual void printPage( int i_nPage ) const = 0; // must be overloaded by the app + virtual void jobStarted(); // will be called after a possible dialog has been shown and the real printjob starts + virtual void jobFinished( com::sun::star::view::PrintableState ); + + com::sun::star::view::PrintableState getJobState() const; + + void abortJob(); + + bool isShowDialogs() const; + bool isDirectPrint() const; + + // implementation details, not usable outside vcl + SAL_DLLPRIVATE int getFilteredPageCount(); + SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); + SAL_DLLPRIVATE PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); + SAL_DLLPRIVATE void printFilteredPage( int i_nPage ); + SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& ); + SAL_DLLPRIVATE void setOptionChangeHdl( const Link& ); + SAL_DLLPRIVATE void createProgressDialog(); + SAL_DLLPRIVATE bool isProgressCanceled() const; + SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); + SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const; + SAL_DLLPRIVATE void setLastPage( sal_Bool i_bLastPage ); + SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse ); + SAL_DLLPRIVATE bool getReversePrint() const; + SAL_DLLPRIVATE void pushPropertiesToPrinter(); + SAL_DLLPRIVATE void setJobState( com::sun::star::view::PrintableState ); + SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent ); + + SAL_DLLPRIVATE int getPageCountProtected() const; + SAL_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParametersProtected( int i_nPage ) const; + + SAL_DLLPRIVATE ULONG removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ); +}; + +class VCL_DLLPUBLIC PrinterOptionsHelper +{ + protected: + std::hash_map< rtl::OUString, com::sun::star::uno::Any, rtl::OUStringHash > m_aPropertyMap; + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > m_aUIProperties; + + public: + PrinterOptionsHelper() {} // create without ui properties + PrinterOptionsHelper( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rUIProperties ) + : m_aUIProperties( i_rUIProperties ) + {} + ~PrinterOptionsHelper() + {} + + /* process a new set of properties + * merges changed properties and returns "true" if any occured + * if the optional output set is not NULL then the names of the changed properties are returned + **/ + bool processProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp, + std::set< rtl::OUString >* o_pChangeProp = NULL ); + /* append to a sequence of property values the ui property sequence passed at creation + * as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property + * will be appended. + **/ + void appendPrintUIOptions( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& io_rProps ) const; + + // check if a property exists + bool hasProperty( const rtl::OUString& i_rPropertyName ) const; + bool hasProperty( const char* i_pPropertyName ) const + { return hasProperty( rtl::OUString::createFromAscii( i_pPropertyName ) ); } + + // returns an empty Any for not existing properties + com::sun::star::uno::Any getValue( const rtl::OUString& i_rPropertyName ) const; + // change a value in the property set; this will not have an effect to an eventual PrinterController + // the user of setValue must decide whether it is necessary to set the value there also + void setValue( const rtl::OUString& i_rPropertyName, const com::sun::star::uno::Any& i_rValue ); + void setValue( const char* i_pPropertyName, const com::sun::star::uno::Any& i_rValue ) + { setValue( rtl::OUString::createFromAscii( i_pPropertyName ), i_rValue ); } + + sal_Bool getBoolValue( const rtl::OUString& i_rPropertyName, sal_Bool i_bDefault = sal_False ) const; + // convenience for fixed strings + sal_Bool getBoolValue( const char* i_pPropName, sal_Bool i_bDefault = sal_False ) const + { return getBoolValue( rtl::OUString::createFromAscii( i_pPropName ), i_bDefault ); } + + sal_Int64 getIntValue( const rtl::OUString& i_rPropertyName, sal_Int64 i_nDefault = 0 ) const; + // convenience for fixed strings + sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault = 0 ) const + { return getIntValue( rtl::OUString::createFromAscii( i_pPropName ), i_nDefault ); } + + rtl::OUString getStringValue( const rtl::OUString& i_rPropertyName, const rtl::OUString& i_rDefault = rtl::OUString() ) const; + // convenience for fixed strings + rtl::OUString getStringValue( const char* i_pPropName, const rtl::OUString& i_rDefault = rtl::OUString() ) const + { return getStringValue( rtl::OUString::createFromAscii( i_pPropName ), i_rDefault ); } + + // helper functions for user to create a single control + struct UIControlOptions + { + rtl::OUString maDependsOnName; + sal_Int32 mnDependsOnEntry; + sal_Bool mbAttachToDependency; + rtl::OUString maGroupHint; + sal_Bool mbInternalOnly; + sal_Bool mbEnabled; + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maAddProps; + + UIControlOptions( const rtl::OUString& i_rDependsOnName = rtl::OUString(), + sal_Int32 i_nDependsOnEntry = -1, + sal_Bool i_bAttachToDependency = sal_False, + const rtl::OUString& i_rGroupHint = rtl::OUString(), + sal_Bool i_bInternalOnly = sal_False, + sal_Bool i_bEnabled = sal_True + ) + : maDependsOnName( i_rDependsOnName ) + , mnDependsOnEntry( i_nDependsOnEntry ) + , mbAttachToDependency( i_bAttachToDependency ) + , maGroupHint( i_rGroupHint ) + , mbInternalOnly( i_bInternalOnly ) + , mbEnabled( i_bEnabled ) {} + }; + + // general control + static com::sun::star::uno::Any getUIControlOpt( const rtl::OUString& i_rTitle, + const com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpText, + const rtl::OUString& i_rType, + const com::sun::star::beans::PropertyValue* i_pValue = NULL, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + // create a group (e.g. a TabPage); following controls will be grouped in it until the next + // group begins + static com::sun::star::uno::Any getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText ); + + // create a subgroup (e.g. a FixedLine); following controls will be grouped in it until the next + // subgroup or group begins + // setting bJobPage = true will make the subgroup appear on the first page of the print dialog + static com::sun::star::uno::Any getSubgroupControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create a bool option (usually a checkbox) + static com::sun::star::uno::Any getBoolControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create a set of choices (either a radio button group or a list box) + static com::sun::star::uno::Any getChoiceControlOpt( const rtl::OUString& i_rTitle, + const com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpText, + const rtl::OUString& i_rProperty, + const com::sun::star::uno::Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, + const rtl::OUString& i_rType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), + const com::sun::star::uno::Sequence< sal_Bool >& i_rDisabledChoices = com::sun::star::uno::Sequence< sal_Bool >(), + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create an integer range (e.g. a spin field) + // note: max value < min value means do not apply min/max values + static com::sun::star::uno::Any getRangeControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + sal_Int32 i_nValue, + sal_Int32 i_nMinValue = -1, + sal_Int32 i_nMaxValue = -2, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create a string field + // note: max value < min value means do not apply min/max values + static com::sun::star::uno::Any getEditControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + const rtl::OUString& i_rValue, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); +}; + +} + + +#endif // _SV_PRINT_HXX diff --git a/vcl/inc/vcl/printergfx.hxx b/vcl/inc/vcl/printergfx.hxx new file mode 100644 index 000000000000..790021ae3adc --- /dev/null +++ b/vcl/inc/vcl/printergfx.hxx @@ -0,0 +1,442 @@ +/************************************************************************* + * + * 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 _PSPRINT_PRINTERGFX_HXX_ +#define _PSPRINT_PRINTERGFX_HXX_ + +#include "vcl/helper.hxx" +#include "vcl/sallayout.hxx" +#include "osl/file.hxx" +#include "tools/gen.hxx" + +#include <list> +#include <hash_map> + +namespace psp { + +// forwards +class JobData; + +/* + * lightweight container to handle RGB values + */ + +class PrinterColor +{ +public: + + enum ColorSpace { eInvalid, eRGB }; + +private: + + sal_uInt8 mnRed; + sal_uInt8 mnGreen; + sal_uInt8 mnBlue; + ColorSpace meColorspace; + +public: + + PrinterColor () : + meColorspace(eInvalid) + {} + PrinterColor (sal_uInt16 nRed, sal_uInt16 nGreen, + sal_uInt16 nBlue) : + mnRed (nRed), + mnGreen (nGreen), + mnBlue (nBlue), + meColorspace (eRGB) + {} + PrinterColor (sal_uInt32 nRGB) : + mnRed ((nRGB & 0x00ff0000) >> 16), + mnGreen ((nRGB & 0x0000ff00) >> 8), + mnBlue ((nRGB & 0x000000ff) ), + meColorspace (eRGB) + {} + ~PrinterColor () + {} + + sal_Bool Is () const + { return meColorspace != eInvalid; } + + ColorSpace GetColorSpace () const + { return meColorspace; } + sal_uInt16 GetRed () const + { return mnRed; } + sal_uInt16 GetGreen () const + { return mnGreen; } + sal_uInt16 GetBlue () const + { return mnBlue; } + sal_Bool operator== (const PrinterColor& aColor) const + { + return aColor.Is() && this->Is() + && mnRed == aColor.mnRed + && mnGreen == aColor.mnGreen + && mnBlue == aColor.mnBlue; + } + sal_Bool operator!= (const PrinterColor& aColor) const + { return ! (aColor==*this); } + PrinterColor& operator= (const PrinterColor& aColor) + { + meColorspace = aColor.meColorspace; + mnRed = aColor.mnRed; + mnGreen = aColor.mnGreen; + mnBlue = aColor.mnBlue; + + return *this; + } + + PrinterColor& operator= (sal_uInt32 nRGB) + { + meColorspace = eRGB; + mnBlue = (nRGB & 0x000000ff); + mnGreen = (nRGB & 0x0000ff00) >> 8; + mnRed = (nRGB & 0x00ff0000) >> 16; + + return *this; + } +}; + +/* + * forward declarations + */ + +class Font3; +class GlyphSet; +class PrinterJob; +class PrintFontManager; +class KernPair; +struct CharacterMetric; + +/* + * Bitmap Interface, this has to be filled with your actual bitmap implementation + * sample implementations can be found in: + * psprint/workben/cui/pspdem.cxx + * vcl/unx/source/gdi/salgdi2.cxx + */ + +class PrinterBmp +{ +public: + + virtual ~PrinterBmp () = 0; + virtual sal_uInt32 GetPaletteColor (sal_uInt32 nIdx) const = 0; + virtual sal_uInt32 GetPaletteEntryCount () const = 0; + virtual sal_uInt32 GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0; + virtual sal_uInt8 GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0; + virtual sal_uInt8 GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0; + virtual sal_uInt32 GetWidth () const = 0; + virtual sal_uInt32 GetHeight () const = 0; + virtual sal_uInt32 GetDepth () const = 0; +}; + +typedef enum { + InvalidType = 0, + TrueColorImage, + MonochromeImage, + PaletteImage, + GrayScaleImage +} ImageType; + +/* + * printer raster operations + */ + +struct GraphicsStatus +{ + rtl::OString maFont; + rtl_TextEncoding maEncoding; + bool mbArtItalic; + bool mbArtBold; + sal_Int32 mnTextHeight; + sal_Int32 mnTextWidth; + PrinterColor maColor; + double mfLineWidth; + + GraphicsStatus(); +}; + +class Font3; + +class PrinterGfx +{ +private: + + /* common settings */ + + double mfScaleX; + double mfScaleY; + + sal_uInt32 mnDpi; + sal_uInt16 mnDepth; + + sal_uInt16 mnPSLevel; + sal_Bool mbColor; + sal_Bool mbUploadPS42Fonts; + + osl::File* mpPageHeader; + osl::File* mpPageBody; + + void TranslateCoordinates (sal_Int32 &rXOut, sal_Int32 &rYOut, + sal_Int32 nXIn, sal_Int32 nYIn ) + { rXOut = nXIn; rYOut = nYIn; } + void TranslateCoordinates (Point& rOut, const Point& rIn) + { rOut = rIn; } + + /* text/font related data, for a type1 font it has to be checked + whether this font has already been downloaded. A TrueType font + will be converted into one or more Type3 fonts, containing glyphs + in no particular order. In addition to the existence of the + glyph in one of the subfonts, the mapping from unicode to the + glyph has to be remembered */ + + std::list< sal_Int32 > maPS1Font; + std::list< GlyphSet > maPS3Font; + + sal_Int32 mnFontID; + sal_Int32 mnFallbackID; + sal_Int32 mnTextAngle; + bool mbTextVertical; + PrintFontManager& mrFontMgr; + + /* bitmap drawing implementation */ + + sal_Bool mbCompressBmp; + + void DrawPS1GrayImage (const PrinterBmp& rBitmap, const Rectangle& rArea); + void writePS2ImageHeader (const Rectangle& rArea, psp::ImageType nType); + void writePS2Colorspace (const PrinterBmp& rBitmap, psp::ImageType nType); + void DrawPS2GrayImage (const PrinterBmp& rBitmap, const Rectangle& rArea); + void DrawPS2PaletteImage (const PrinterBmp& rBitmap, const Rectangle& rArea); + void DrawPS2TrueColorImage (const PrinterBmp& rBitmap, const Rectangle& rArea); + void DrawPS2MonoImage (const PrinterBmp& rBitmap, const Rectangle& rArea); + + /* clip region */ + + std::list< Rectangle > maClipRegion; + sal_Bool JoinVerticalClipRectangles( std::list< Rectangle >::iterator& it, + Point& aOldPoint, sal_Int32& nColumn ); + + /* color settings */ + PrinterColor maFillColor; + PrinterColor maTextColor; + PrinterColor maLineColor; + + /* graphics state */ + GraphicsStatus maVirtualStatus; + std::list< GraphicsStatus > maGraphicsStack; + GraphicsStatus& currentState() { return maGraphicsStack.front(); } + + /* font / font substitution */ + friend class Font3; + const ::std::hash_map< fontID, fontID >* mpFontSubstitutes; + int getCharWidth (sal_Bool b_vert, sal_Unicode n_char, + CharacterMetric *p_bbox); + fontID getCharMetric (const Font3 &rFont, sal_Unicode n_char, + CharacterMetric *p_bbox); + fontID getFontSubstitute () const; + fontID getFallbackID () const { return mnFallbackID; } + + bool mbStrictSO52Compatibility; +public: + /* grahics status update */ + void PSSetColor (); + void PSSetLineWidth (); + void PSSetFont (); + + /* graphics status functions */ + void PSSetColor (const PrinterColor& rColor) + { maVirtualStatus.maColor = rColor; } + + void PSUploadPS1Font (sal_Int32 nFontID); + void PSSetFont (const rtl::OString& rName, + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_DONTKNOW) + { maVirtualStatus.maFont = rName; maVirtualStatus.maEncoding = nEncoding; } + + /* graphics status stack */ + void PSGSave (); + void PSGRestore (); + + + /* PS helpers */ + enum pspath_t { moveto = 0, lineto = 1 }; + void PSBinLineTo (const Point& rCurrent, Point& rOld, + sal_Int32& nColumn); + void PSBinMoveTo (const Point& rCurrent, Point& rOld, + sal_Int32& nColumn); + void PSBinStartPath (); + void PSBinEndPath (); + void PSBinCurrentPath (sal_uInt32 nPoints, const Point* pPath); + void PSBinPath (const Point& rCurrent, Point& rOld, + pspath_t eType, sal_Int32& nColumn); + + void PSRotate (sal_Int32 nAngle); + void PSTranslate (const Point& rPoint); + void PSMoveTo (const Point& rPoint); + void PSRMoveTo (sal_Int32 nDx, sal_Int32 nDy = 0); + void PSScale (double fScaleX, double fScaleY); + void PSLineTo(const Point& rPoint ); + void PSPointOp (const Point& rPoint, const sal_Char* pOperator); + void PSHexString (const sal_uChar* pString, sal_Int16 nLen); + void PSDeltaArray (const sal_Int32 *pArray, sal_Int16 nEntries); + void PSShowText (const sal_uChar* pString, + sal_Int16 nGlyphs, sal_Int16 nBytes, + const sal_Int32* pDeltaArray = NULL); + void PSComment (const sal_Char* pComment ); + void LicenseWarning (const Point& rPoint, const sal_Unicode* pStr, + sal_Int16 nLen, const sal_Int32* pDeltaArray); + + void OnEndPage (); + void OnEndJob (); + void writeResources( osl::File* pFile, std::list< rtl::OString >& rSuppliedFonts, std::list< rtl::OString >& rNeededFonts ); + PrintFontManager& GetFontMgr () { return mrFontMgr; } + + void drawVerticalizedText (const Point& rPoint, + const sal_Unicode* pStr, + sal_Int16 nLen, + const sal_Int32* pDeltaArray ); + void drawText (const Point& rPoint, + const sal_Unicode* pStr, sal_Int16 nLen, + const sal_Int32* pDeltaArray = NULL); + + void drawGlyphs( const Point& rPoint, + sal_GlyphId* pGlyphIds, + sal_Unicode* pUnicodes, + sal_Int16 nLen, + sal_Int32* pDeltaArray ); +public: + PrinterGfx(); + ~PrinterGfx(); + sal_Bool Init (PrinterJob &rPrinterSpec); + sal_Bool Init (const JobData& rData); + void Clear(); + + // query depth and size + void GetResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const; + sal_uInt16 GetBitCount (); + + // clip region + void ResetClipRegion (); + void BeginSetClipRegion (sal_uInt32); + sal_Bool UnionClipRegion (sal_Int32 nX, sal_Int32 nY, + sal_Int32 nDX, sal_Int32 nDY); + void EndSetClipRegion (); + + // set xy color + void SetLineColor (const PrinterColor& rLineColor = PrinterColor()) + { maLineColor = rLineColor; } + void SetFillColor (const PrinterColor& rFillColor = PrinterColor()) + { maFillColor = rFillColor; } + + // drawing primitives + void DrawPixel (const Point& rPoint, const PrinterColor& rPixelColor); + void DrawPixel (const Point& rPoint) + { DrawPixel (rPoint, maLineColor); } + void DrawLine (const Point& rFrom, const Point& rTo); + void DrawRect (const Rectangle& rRectangle); + void DrawPolyLine (sal_uInt32 nPoints, const Point* pPath ); + void DrawPolygon (sal_uInt32 nPoints, const Point* pPath); + void DrawPolyPolygon (sal_uInt32 nPoly, + const sal_uInt32 *pPolygonSize, + const Point** pPolygonList); + void DrawPolyLineBezier (sal_uInt32 nPoints, + const Point* pPath, + const BYTE* pFlgAry ); + void DrawPolygonBezier (sal_uInt32 nPoints, + const Point* pPath, + const BYTE* pFlgAry); + void DrawPolyPolygonBezier (sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const Point* const* pPtAry, + const BYTE* const* pFlgAry); + + // eps + sal_Bool DrawEPS ( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize); + + // image drawing + void DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc, + const PrinterBmp& rBitmap); + void DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc, + const PrinterBmp& rBitmap, + const PrinterBmp& rTransBitmap); + void DrawMask (const Rectangle& rDest, const Rectangle& rSrc, + const PrinterBmp &rBitmap, PrinterColor& rMaskColor); + + // font and text handling + sal_uInt16 SetFont ( + sal_Int32 nFontID, + sal_Int32 nPointHeight, + sal_Int32 nPointWidth, + sal_Int32 nAngle, + bool bVertical, + bool bArtItalic, + bool bArtBold + ); + sal_uInt16 SetFallbackFont ( sal_Int32 nFontID ); + sal_Int32 GetFontAngle () const + { return mnTextAngle; } + sal_Int32 GetFontID () const + { return mnFontID; } + bool GetFontVertical() const + { return mbTextVertical; } + sal_Int32 GetFontHeight () const + { return maVirtualStatus.mnTextHeight; } + sal_Int32 GetFontWidth () const + { return maVirtualStatus.mnTextWidth; } + bool GetArtificialItalic() const + { return maVirtualStatus.mbArtItalic; } + bool GetArtificialBold() const + { return maVirtualStatus.mbArtBold; } + void DrawText (const Point& rPoint, + const sal_Unicode* pStr, sal_Int16 nLen, + const sal_Int32* pDeltaArray = NULL); + void SetTextColor (PrinterColor& rTextColor) + { maTextColor = rTextColor; } + sal_Int32 GetCharWidth (sal_uInt16 nFrom, sal_uInt16 nTo, + long *pWidthArray); + const ::std::list< KernPair >& getKernPairs( bool bVertical = false ) const; + // advanced font handling + sal_Bool GetGlyphBoundRect (sal_Unicode c, Rectangle& rOutRect); + sal_uInt32 GetGlyphOutline (sal_Unicode c, + sal_uInt16 **ppPolySizes, Point **ppPoints, + sal_uInt8 **ppFlags); + + // for CTL + void DrawGlyphs( const Point& rPoint, + sal_GlyphId* pGlyphIds, + sal_Unicode* pUnicodes, + sal_Int16 nLen, + sal_Int32* pDeltaArray ); + + bool getStrictSO52Compatibility() const; + void setStrictSO52Compatibility( bool ); +}; + +} /* namespace psp */ + + +#endif /* _PSPRINT_PRINTERGFX_HXX_ */ + diff --git a/vcl/inc/vcl/printerinfomanager.hxx b/vcl/inc/vcl/printerinfomanager.hxx new file mode 100644 index 000000000000..f2e0aad538c8 --- /dev/null +++ b/vcl/inc/vcl/printerinfomanager.hxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * 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 _PSPRINT_PRINTERINFOMANAGER_HXX_ +#define _PSPRINT_PRINTERINFOMANAGER_HXX_ + +#include <hash_map> +#include <list> + +#include "vcl/dllapi.h" +#include "vcl/helper.hxx" +#include "vcl/jobdata.hxx" +#include "vcl/helper.hxx" +#include "osl/file.hxx" + +#include <cstdio> + +namespace psp +{ + +class SystemQueueInfo; + +struct PrinterInfo : JobData +{ + // basename of PPD + rtl::OUString m_aDriverName; + // can be the queue + rtl::OUString m_aLocation; + // a user defined comment + rtl::OUString m_aComment; + // a command line to pipe a PS-file to + rtl::OUString m_aCommand; + // a command line to pipe a PS-file to in case of direct print + rtl::OUString m_aQuickCommand; + // a list of special features separated by ',' not used by psprint + // but assigned from the outside (currently for "fax","pdf=","autoqueue","external_dialog") + rtl::OUString m_aFeatures; + // a mapping of fonts to other fonts. + // this provides a method for the user + // to replace arbitrary fonts by printer builtin fonts + // currently this is only a mapping between font names + // assuming that only adbobe standard encoding fonts are + // built into the printer. in future it may be necessary + // to map to a font name and UCS2 vector which should be mapped + // this vector is currently implicitly given by the adobe + // standard encoding + bool m_bPerformFontSubstitution; + std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > + m_aFontSubstitutes; + std::hash_map< fontID, fontID > + m_aFontSubstitutions; + + PrinterInfo() : + JobData(), + m_bPerformFontSubstitution( false ) + {} +}; + +class VCL_DLLPUBLIC PrinterInfoManager +{ +public: + enum Type { Default = 0, CUPS = 1 }; + + struct SystemPrintQueue + { + rtl::OUString m_aQueue; + rtl::OUString m_aLocation; + rtl::OUString m_aComment; + }; +protected: + // needed for checkPrintersChanged: files (not necessarily existant) + // and their last known modification time + struct WatchFile + { + // the file in question + rtl::OUString m_aFilePath; + // the last know modification time or 0, if file did not exist + TimeValue m_aModified; + }; + + // internal data to describe a printer + struct Printer + { + // configuration file containing this printer + // empty means a freshly added printer that has to be saved yet + rtl::OUString m_aFile; + // details other config files that have this printer + // in case of removal all have to be removed + std::list< rtl::OUString > m_aAlternateFiles; + // group in m_aFile containing the printer + // this must be unique over all configuration files + // it usually should be the printer name + rtl::OString m_aGroup; + // whether changes need to be saved + bool m_bModified; + // the corresponding info and job data + PrinterInfo m_aInfo; + }; + + std::hash_map< rtl::OUString, Printer, rtl::OUStringHash > m_aPrinters; + PrinterInfo m_aGlobalDefaults; + std::list< WatchFile > m_aWatchFiles; + rtl::OUString m_aDefaultPrinter; + rtl::OUString m_aSystemPrintCommand; + + std::list< SystemPrintQueue > m_aSystemPrintQueues; + + SystemQueueInfo* m_pQueueInfo; + + Type m_eType; + bool m_bUseIncludeFeature; + bool m_bUseJobPatch; + rtl::OUString m_aSystemDefaultPaper; + + bool m_bDisableCUPS; + + PrinterInfoManager( Type eType = Default ); + virtual ~PrinterInfoManager(); + + virtual void initialize(); + + // fill in font substitutions + // the resulting hash_map maps from source to target font ids + void fillFontSubstitutions( PrinterInfo& rInfo ) const; + + // fill default paper if not configured in config file + // default paper is e.g. locale dependent + // if a paper is already set it will not be overwritten + void setDefaultPaper( PPDContext& rInfo ) const; + + void initSystemDefaultPaper(); +public: + + // there can only be one + static PrinterInfoManager& get(); + + // get PrinterInfoManager type + Type getType() const { return m_eType; } + + // lists the names of all known printers + void listPrinters( std::list< rtl::OUString >& rList ) const; + + // gets the number of known printers + int countPrinters() const { return m_aPrinters.size(); } + + // gets info about a named printer + const PrinterInfo& getPrinterInfo( const rtl::OUString& rPrinter ) const; + + // gets the name of the default printer + const rtl::OUString& getDefaultPrinter() const { return m_aDefaultPrinter; } + + virtual void setupJobContextData( JobData& rData ); + + // changes the info about a named printer + virtual void changePrinterInfo( const rtl::OUString& rPrinter, const PrinterInfo& rNewInfo ); + + // check if the printer configuration has changed + // if bwait is true, then this method waits for eventual asynchronous + // printer discovery to finish + virtual bool checkPrintersChanged( bool bWait ); + + // members for administration (->padmin) + + // add a named printer + // addPrinter fails if a printer with the same name already exists + // or the driver does not exist + virtual bool addPrinter( const rtl::OUString& rPrinterName, const rtl::OUString& rDriverName ); + + // remove a named printer + // this fails if the config file belonging to this printer + // is not writeable + // if bCheckOnly is true, the printer is not really removed; + // this is for checking if the removal would fail + virtual bool removePrinter( const rtl::OUString& rPrinterName, bool bCheckOnly = false ); + + // save the changes to all printers. this fails if there + // is no writable config file at all + virtual bool writePrinterConfig(); + + // set a new default printer + // fails if the specified printer does not exist + virtual bool setDefaultPrinter( const rtl::OUString& rPrinterName ); + + // primarily used internally but also by padmin + // returns the printer queue names + virtual const std::list< SystemPrintQueue >& getSystemPrintQueues(); + + // similar but returnse whole commandlines + virtual void getSystemPrintCommands( std::list< rtl::OUString >& rCommands ); + + // abstract print command + // returns a stdio FILE* that a postscript file may be written to + // this may either be a regular file or the result of popen() + virtual FILE* startSpool( const rtl::OUString& rPrinterName, bool bQuickCommand ); + // close the FILE* returned by startSpool and does the actual spooling + // returns a numerical job id + virtual int endSpool( const rtl::OUString& rPrinterName, const rtl::OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData ); + + // for spadmin: whether adding or removing a printer is possible + virtual bool addOrRemovePossible() const; + + bool getUseIncludeFeature() const { return m_bUseIncludeFeature; } + bool getUseJobPatch() const { return m_bUseJobPatch; } + + // check whether a printer's feature string contains a subfeature + bool checkFeatureToken( const rtl::OUString& rPrinterName, const char* pToken ) const; + + // set m_bDisableCUPS and update printer config + void setCUPSDisabled( bool ); + + // gets m_bDisableCUPS, initialized from printer config + bool isCUPSDisabled() const; +}; + +} // namespace + +#endif // _PSPRINT_PRINTERINFOMANAGER_HXX_ diff --git a/vcl/inc/vcl/printerjob.hxx b/vcl/inc/vcl/printerjob.hxx new file mode 100644 index 000000000000..cdf8745febcc --- /dev/null +++ b/vcl/inc/vcl/printerjob.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * 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 _PSPRINT_PRINTERJOB_HXX_ +#define _PSPRINT_PRINTERJOB_HXX_ + +#include "vcl/jobdata.hxx" +#include "osl/file.hxx" +#include "rtl/string.hxx" + +#include <list> + +namespace psp { + +// forward declarations +class PrinterGfx; + + +class PrinterJob +{ +private: // private data + + rtl::OUString maSpoolDirName; + rtl::OUString maFileName; // empty: spool to command, else spool to named file + rtl::OUString maJobTitle; + int mnFileMode; + + osl::File* mpJobHeader; + osl::File* mpJobTrailer; + + std::list< osl::File* > maPageList; + std::list< osl::File* > maHeaderList; + + JobData m_aDocumentJobData; + JobData m_aLastJobData; + PrinterGfx* m_pGraphics; + + sal_uInt32 mnResolution; + + sal_uInt32 mnWidthPt; + sal_uInt32 mnHeightPt; + sal_uInt32 mnMaxWidthPt; + sal_uInt32 mnMaxHeightPt; + + int mnLandscapes; + int mnPortraits; + + sal_uInt32 mnLMarginPt; + sal_uInt32 mnRMarginPt; + sal_uInt32 mnTMarginPt; + sal_uInt32 mnBMarginPt; + + double mfXScale; + double mfYScale; + + sal_Int32 mnErrorCode; + bool m_bQuickJob; + +private: // private methods + + osl::File* CreateSpoolFile (const rtl::OUString& rName, + const rtl::OUString& rExtension); + void InitPaperSize (const JobData& rJobSetup); + + bool writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup ); + bool writeSetup( osl::File* pFile, const JobData& ); + bool writePageSetup( osl::File* pFile, const JobData&, bool bWriteFeatures = true ); + void writeJobPatch( osl::File* File, const JobData& ); + bool writeProlog (osl::File* pFile, const JobData& ); + +public: // for usage in PrinterGfx + + sal_uInt32 GetResolution () const { return mnResolution; } + void GetScale (double &rXScale, double &rYScale) const; + sal_uInt16 GetDepth () const; + sal_uInt16 GetPostscriptLevel (const JobData *pJobData = NULL) const; + sal_Bool IsColorPrinter () const; + + osl::File* GetDocumentHeader (); + osl::File* GetDocumentTrailer (); + osl::File* GetCurrentPageHeader (); + osl::File* GetCurrentPageBody (); + + const ::rtl::OUString& GetPrinterName() const { return m_aLastJobData.m_aPrinterName; } + +public: + PrinterJob (); + ~PrinterJob (); + + /* rFileName: if length is greater than 0 save resulting PostScript + * to named file. + * nMode: only meaningful when saving to file: if nonzero, try + * to impose the mode on the resulting file's inode; for nonexistant + * files use open, for existant files try a chmod + * rJobName: text to appear in the %%Title comment + * rAppName: text to appear in the %%Creator comment + * rSetupData: JobData that apply to this job + * pGraphics: the graphics used to print this job; + * this graphics must live until End/AbortJob has returned + * bIsQuickJob: the job was started as "direct print" meaning + * the quick command for spooling should be used instead + * of the normal command + */ + sal_Bool StartJob (const rtl::OUString& rFileName, + int nMode, + const rtl::OUString& rJobName, + const rtl::OUString& rAppName, + const JobData& rSetupData, + PrinterGfx* pGraphics, + bool bIsQuickJob + ); + sal_Bool EndJob (); + + sal_Bool AbortJob (); + + sal_Bool StartPage (const JobData& rJobSetup); + sal_Bool EndPage (); + + sal_uInt32 GetErrorCode (); +}; + +} /* namespace psp */ + +#endif /* _PSPRINT_PRINTERJOB_HXX_ */ + diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx new file mode 100644 index 000000000000..fdaf06c9854e --- /dev/null +++ b/vcl/inc/vcl/prndlg.hxx @@ -0,0 +1,335 @@ +/************************************************************************* + * + * 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_PRNDLG_HXX +#define _SV_PRNDLG_HXX + +#include <vcl/dllapi.h> + +#include "vcl/print.hxx" +#include "vcl/print.h" + +#include "vcl/dialog.hxx" +#include "vcl/fixed.hxx" +#include "vcl/button.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/field.hxx" +#include "vcl/tabctrl.hxx" +#include "vcl/tabpage.hxx" +#include "vcl/arrange.hxx" +#include "vcl/virdev.hxx" + +#include <boost/shared_ptr.hpp> +#include <map> + +namespace vcl +{ + class PrintDialog : public ModalDialog + { + class PrintPreviewWindow : public Window + { + GDIMetaFile maMtf; + Size maOrigSize; + Size maPreviewSize; + VirtualDevice maPageVDev; + rtl::OUString maReplacementString; + rtl::OUString maToolTipString; + + bool useHCColorReplacement() const; + public: + PrintPreviewWindow( Window* pParent, const ResId& ); + virtual ~PrintPreviewWindow(); + + virtual void Paint( const Rectangle& rRect ); + virtual void Command( const CommandEvent& ); + virtual void Resize(); + virtual void DataChanged( const DataChangedEvent& ); + + void setPreview( const GDIMetaFile&, const Size&, const rtl::OUString&, + sal_Int32 i_nDPIX, sal_Int32 i_nDPIY + ); + }; + + class ShowNupOrderWindow : public Window + { + int mnOrderMode; + int mnRows; + int mnColumns; + void ImplInitSettings(); + public: + ShowNupOrderWindow( Window* pParent ); + virtual ~ShowNupOrderWindow(); + + virtual void Paint( const Rectangle& ); + + void setValues( int i_nOrderMode, int i_nColumns, int i_nRows ) + { + mnOrderMode = i_nOrderMode; + mnRows = i_nRows; + mnColumns = i_nColumns; + Invalidate(); + } + }; + + class NUpTabPage : public TabPage + { + public: + FixedLine maNupLine; + RadioButton maPagesBtn; + RadioButton maBrochureBtn; + FixedText maPagesBoxTitleTxt; + ListBox maNupPagesBox; + + // controls for "Custom" page mode + FixedText maNupNumPagesTxt; + NumericField maNupColEdt; + FixedText maNupTimesTxt; + NumericField maNupRowsEdt; + FixedText maPageMarginTxt1; + MetricField maPageMarginEdt; + FixedText maPageMarginTxt2; + FixedText maSheetMarginTxt1; + MetricField maSheetMarginEdt; + FixedText maSheetMarginTxt2; + FixedText maNupOrientationTxt; + ListBox maNupOrientationBox; + + // page order ("left to right, then down") + FixedText maNupOrderTxt; + ListBox maNupOrderBox; + ShowNupOrderWindow maNupOrderWin; + // border around each page + CheckBox maBorderCB; + + vcl::RowOrColumn maLayout; + boost::shared_ptr< vcl::RowOrColumn > mxBrochureDep; + boost::shared_ptr< vcl::LabeledElement >mxPagesBtnLabel; + + void setupLayout(); + + NUpTabPage( Window*, const ResId& ); + virtual ~NUpTabPage(); + + void readFromSettings(); + void storeToSettings(); + void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& ); + void enableNupControls( bool bEnable ); + + void showAdvancedControls( bool ); + + virtual void Resize(); + }; + + class JobTabPage : public TabPage + { + public: + FixedLine maPrinterFL; + ListBox maPrinters; + DisclosureButton maDetailsBtn; + FixedText maStatusLabel; + FixedText maStatusTxt; + FixedText maLocationLabel; + FixedText maLocationTxt; + FixedText maCommentLabel; + FixedText maCommentTxt; + + PushButton maSetupButton; + + FixedLine maCopies; + FixedLine maCopySpacer; + FixedText maCopyCount; + NumericField maCopyCountField; + CheckBox maCollateBox; + FixedImage maCollateImage; + + Image maCollateImg; + Image maCollateHCImg; + Image maNoCollateImg; + Image maNoCollateHCImg; + + long mnCollateUIMode; + + vcl::RowOrColumn maLayout; + boost::shared_ptr<vcl::RowOrColumn> mxPrintRange; + boost::shared_ptr<vcl::WindowArranger> mxDetails; + + JobTabPage( Window*, const ResId& ); + virtual ~JobTabPage(); + + void readFromSettings(); + void storeToSettings(); + + virtual void Resize(); + + void setupLayout(); + }; + + class OutputOptPage : public TabPage + { + public: + FixedLine maOptionsLine; + CheckBox maToFileBox; + CheckBox maCollateSingleJobsBox; + CheckBox maReverseOrderBox; + + vcl::RowOrColumn maLayout; + boost::shared_ptr<vcl::RowOrColumn> mxOptGroup; + + OutputOptPage( Window*, const ResId& ); + virtual ~OutputOptPage(); + + void readFromSettings(); + void storeToSettings(); + + virtual void Resize(); + + void setupLayout(); + }; + + OKButton maOKButton; + CancelButton maCancelButton; + HelpButton maHelpButton; + PrintPreviewWindow maPreviewWindow; + NumericField maPageEdit; + FixedText maNumPagesText; + PushButton maBackwardBtn; + PushButton maForwardBtn; + + TabControl maTabCtrl; + NUpTabPage maNUpPage; + JobTabPage maJobPage; + OutputOptPage maOptionsPage; + + FixedLine maButtonLine; + + boost::shared_ptr< PrinterController > maPController; + + rtl::OUString maPageStr; + rtl::OUString maNoPageStr; + sal_Int32 mnCurPage; + sal_Int32 mnCachedPages; + + std::list< Window* > maControls; + std::map< Window*, rtl::OUString > maControlToPropertyMap; + std::map< rtl::OUString, std::vector< Window* > > + maPropertyToWindowMap; + std::map< Window*, sal_Int32 > maControlToNumValMap; + std::set< rtl::OUString > maReverseDependencySet; + + Size maNupPortraitSize; + Size maNupLandscapeSize; + + // internal, used for automatic Nup-Portrait/landscape + Size maFirstPageSize; + + rtl::OUString maPrintToFileText; + rtl::OUString maPrintText; + rtl::OUString maDefPrtText; + + vcl::RowOrColumn maLayout; + boost::shared_ptr<vcl::RowOrColumn> mxPreviewCtrls; + + Size maDetailsCollapsedSize; + Size maDetailsExpandedSize; + + sal_Bool mbShowLayoutPage; + + Size getJobPageSize(); + void updateNup(); + void updateNupFromPages(); + void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false ); + void setPreviewText( sal_Int32 ); + void updatePrinterText(); + void checkControlDependencies(); + void checkOptionalControlDependencies(); + void makeEnabled( Window* ); + void updateWindowFromProperty( const rtl::OUString& ); + void setupOptionalUI(); + void readFromSettings(); + void storeToSettings(); + com::sun::star::beans::PropertyValue* getValueForWindow( Window* ) const; + + virtual void Resize(); + virtual void Command( const CommandEvent& ); + virtual void DataChanged( const DataChangedEvent& ); + + DECL_LINK( SelectHdl, ListBox* ); + DECL_LINK( ClickHdl, Button* ); + DECL_LINK( ModifyHdl, Edit* ); + DECL_LINK( UIOptionsChanged, void* ); + + DECL_LINK( UIOption_CheckHdl, CheckBox* ); + DECL_LINK( UIOption_RadioHdl, RadioButton* ); + DECL_LINK( UIOption_SelectHdl, ListBox* ); + DECL_LINK( UIOption_ModifyHdl, Edit* ); + + void setupLayout(); + public: + PrintDialog( Window*, const boost::shared_ptr< PrinterController >& ); + virtual ~PrintDialog(); + + bool isPrintToFile(); + int getCopyCount(); + bool isCollate(); + bool isSingleJobs(); + + void previewForward(); + void previewBackward(); + }; + + class PrintProgressDialog : public ModelessDialog + { + String maStr; + FixedText maText; + CancelButton maButton; + + bool mbCanceled; + sal_Int32 mnCur; + sal_Int32 mnMax; + long mnProgressHeight; + Rectangle maProgressRect; + bool mbNativeProgress; + + DECL_LINK( ClickHdl, Button* ); + + void implCalcProgressRect(); + public: + PrintProgressDialog( Window* i_pParent, int i_nMax ); + ~PrintProgressDialog(); + + bool isCanceled() const { return mbCanceled; } + void setProgress( int i_nCurrent, int i_nMax = -1 ); + void tick(); + void reset(); + + virtual void Paint( const Rectangle& ); + }; +} + + +#endif // _SV_PRNDLG_HXX diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx new file mode 100644 index 000000000000..6b2af991f2dd --- /dev/null +++ b/vcl/inc/vcl/prntypes.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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_PRNTYPES_HXX +#define _SV_PRNTYPES_HXX + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <i18npool/paper.hxx> + +// --------------- +// - Duplex Mode - +// --------------- + +enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_LONGEDGE, DUPLEX_SHORTEDGE }; + +// --------------- +// - Orientation - +// --------------- + +enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE }; + +// ------------------- +// - QueueInfo-Types - +// ------------------- + +#define QUEUE_STATUS_READY ((ULONG)0x00000001) +#define QUEUE_STATUS_PAUSED ((ULONG)0x00000002) +#define QUEUE_STATUS_PENDING_DELETION ((ULONG)0x00000004) +#define QUEUE_STATUS_BUSY ((ULONG)0x00000008) +#define QUEUE_STATUS_INITIALIZING ((ULONG)0x00000010) +#define QUEUE_STATUS_WAITING ((ULONG)0x00000020) +#define QUEUE_STATUS_WARMING_UP ((ULONG)0x00000040) +#define QUEUE_STATUS_PROCESSING ((ULONG)0x00000080) +#define QUEUE_STATUS_PRINTING ((ULONG)0x00000100) +#define QUEUE_STATUS_OFFLINE ((ULONG)0x00000200) +#define QUEUE_STATUS_ERROR ((ULONG)0x00000400) +#define QUEUE_STATUS_SERVER_UNKNOWN ((ULONG)0x00000800) +#define QUEUE_STATUS_PAPER_JAM ((ULONG)0x00001000) +#define QUEUE_STATUS_PAPER_OUT ((ULONG)0x00002000) +#define QUEUE_STATUS_MANUAL_FEED ((ULONG)0x00004000) +#define QUEUE_STATUS_PAPER_PROBLEM ((ULONG)0x00008000) +#define QUEUE_STATUS_IO_ACTIVE ((ULONG)0x00010000) +#define QUEUE_STATUS_OUTPUT_BIN_FULL ((ULONG)0x00020000) +#define QUEUE_STATUS_TONER_LOW ((ULONG)0x00040000) +#define QUEUE_STATUS_NO_TONER ((ULONG)0x00080000) +#define QUEUE_STATUS_PAGE_PUNT ((ULONG)0x00100000) +#define QUEUE_STATUS_USER_INTERVENTION ((ULONG)0x00200000) +#define QUEUE_STATUS_OUT_OF_MEMORY ((ULONG)0x00400000) +#define QUEUE_STATUS_DOOR_OPEN ((ULONG)0x00800000) +#define QUEUE_STATUS_POWER_SAVE ((ULONG)0x01000000) + +#define QUEUE_JOBS_DONTKNOW ((ULONG)0xFFFFFFFF) + +// ----------------- +// - Printer-Types - +// ----------------- + +#define PRINTER_CAPABILITIES_SUPPORTDIALOG ((USHORT)1) +#define PRINTER_CAPABILITIES_COPIES ((USHORT)2) +#define PRINTER_CAPABILITIES_COLLATECOPIES ((USHORT)3) +#define PRINTER_CAPABILITIES_SETORIENTATION ((USHORT)4) +#define PRINTER_CAPABILITIES_SETPAPERBIN ((USHORT)5) +#define PRINTER_CAPABILITIES_SETPAPERSIZE ((USHORT)6) +#define PRINTER_CAPABILITIES_SETPAPER ((USHORT)7) +#define PRINTER_CAPABILITIES_FAX ((USHORT)8) +#define PRINTER_CAPABILITIES_PDF ((USHORT)9) +#define PRINTER_CAPABILITIES_EXTERNALDIALOG ((USHORT)10) +#define PRINTER_CAPABILITIES_SETDUPLEX ((USHORT)11) + +#endif // _SV_PRNTYPES_HXX diff --git a/vcl/inc/vcl/ptrstyle.hxx b/vcl/inc/vcl/ptrstyle.hxx new file mode 100644 index 000000000000..796613bd5726 --- /dev/null +++ b/vcl/inc/vcl/ptrstyle.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * 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_PTRSTYLE_HXX +#define _VCL_PTRSTYLE_HXX + +#include <vcl/sv.h> + +// ----------------- +// - Pointer-Types - +// ----------------- + +typedef USHORT PointerStyle; + +#define POINTER_ARROW ((PointerStyle)0) +#define POINTER_NULL ((PointerStyle)1) +#define POINTER_WAIT ((PointerStyle)2) +#define POINTER_TEXT ((PointerStyle)3) +#define POINTER_HELP ((PointerStyle)4) +#define POINTER_CROSS ((PointerStyle)5) +#define POINTER_MOVE ((PointerStyle)6) +#define POINTER_NSIZE ((PointerStyle)7) +#define POINTER_SSIZE ((PointerStyle)8) +#define POINTER_WSIZE ((PointerStyle)9) +#define POINTER_ESIZE ((PointerStyle)10) +#define POINTER_NWSIZE ((PointerStyle)11) +#define POINTER_NESIZE ((PointerStyle)12) +#define POINTER_SWSIZE ((PointerStyle)13) +#define POINTER_SESIZE ((PointerStyle)14) +#define POINTER_WINDOW_NSIZE ((PointerStyle)15) +#define POINTER_WINDOW_SSIZE ((PointerStyle)16) +#define POINTER_WINDOW_WSIZE ((PointerStyle)17) +#define POINTER_WINDOW_ESIZE ((PointerStyle)18) +#define POINTER_WINDOW_NWSIZE ((PointerStyle)19) +#define POINTER_WINDOW_NESIZE ((PointerStyle)20) +#define POINTER_WINDOW_SWSIZE ((PointerStyle)21) +#define POINTER_WINDOW_SESIZE ((PointerStyle)22) +#define POINTER_HSPLIT ((PointerStyle)23) +#define POINTER_VSPLIT ((PointerStyle)24) +#define POINTER_HSIZEBAR ((PointerStyle)25) +#define POINTER_VSIZEBAR ((PointerStyle)26) +#define POINTER_HAND ((PointerStyle)27) +#define POINTER_REFHAND ((PointerStyle)28) +#define POINTER_PEN ((PointerStyle)29) +#define POINTER_MAGNIFY ((PointerStyle)30) +#define POINTER_FILL ((PointerStyle)31) +#define POINTER_ROTATE ((PointerStyle)32) +#define POINTER_HSHEAR ((PointerStyle)33) +#define POINTER_VSHEAR ((PointerStyle)34) +#define POINTER_MIRROR ((PointerStyle)35) +#define POINTER_CROOK ((PointerStyle)36) +#define POINTER_CROP ((PointerStyle)37) +#define POINTER_MOVEPOINT ((PointerStyle)38) +#define POINTER_MOVEBEZIERWEIGHT ((PointerStyle)39) +#define POINTER_MOVEDATA ((PointerStyle)40) +#define POINTER_COPYDATA ((PointerStyle)41) +#define POINTER_LINKDATA ((PointerStyle)42) +#define POINTER_MOVEDATALINK ((PointerStyle)43) +#define POINTER_COPYDATALINK ((PointerStyle)44) +#define POINTER_MOVEFILE ((PointerStyle)45) +#define POINTER_COPYFILE ((PointerStyle)46) +#define POINTER_LINKFILE ((PointerStyle)47) +#define POINTER_MOVEFILELINK ((PointerStyle)48) +#define POINTER_COPYFILELINK ((PointerStyle)49) +#define POINTER_MOVEFILES ((PointerStyle)50) +#define POINTER_COPYFILES ((PointerStyle)51) +#define POINTER_NOTALLOWED ((PointerStyle)52) +#define POINTER_DRAW_LINE ((PointerStyle)53) +#define POINTER_DRAW_RECT ((PointerStyle)54) +#define POINTER_DRAW_POLYGON ((PointerStyle)55) +#define POINTER_DRAW_BEZIER ((PointerStyle)56) +#define POINTER_DRAW_ARC ((PointerStyle)57) +#define POINTER_DRAW_PIE ((PointerStyle)58) +#define POINTER_DRAW_CIRCLECUT ((PointerStyle)59) +#define POINTER_DRAW_ELLIPSE ((PointerStyle)60) +#define POINTER_DRAW_FREEHAND ((PointerStyle)61) +#define POINTER_DRAW_CONNECT ((PointerStyle)62) +#define POINTER_DRAW_TEXT ((PointerStyle)63) +#define POINTER_DRAW_CAPTION ((PointerStyle)64) +#define POINTER_CHART ((PointerStyle)65) +#define POINTER_DETECTIVE ((PointerStyle)66) +#define POINTER_PIVOT_COL ((PointerStyle)67) +#define POINTER_PIVOT_ROW ((PointerStyle)68) +#define POINTER_PIVOT_FIELD ((PointerStyle)69) +#define POINTER_CHAIN ((PointerStyle)70) +#define POINTER_CHAIN_NOTALLOWED ((PointerStyle)71) +#define POINTER_TIMEEVENT_MOVE ((PointerStyle)72) +#define POINTER_TIMEEVENT_SIZE ((PointerStyle)73) +#define POINTER_AUTOSCROLL_N ((PointerStyle)74) +#define POINTER_AUTOSCROLL_S ((PointerStyle)75) +#define POINTER_AUTOSCROLL_W ((PointerStyle)76) +#define POINTER_AUTOSCROLL_E ((PointerStyle)77) +#define POINTER_AUTOSCROLL_NW ((PointerStyle)78) +#define POINTER_AUTOSCROLL_NE ((PointerStyle)79) +#define POINTER_AUTOSCROLL_SW ((PointerStyle)80) +#define POINTER_AUTOSCROLL_SE ((PointerStyle)81) +#define POINTER_AUTOSCROLL_NS ((PointerStyle)82) +#define POINTER_AUTOSCROLL_WE ((PointerStyle)83) +#define POINTER_AUTOSCROLL_NSWE ((PointerStyle)84) +#define POINTER_AIRBRUSH ((PointerStyle)85) +#define POINTER_TEXT_VERTICAL ((PointerStyle)86) +#define POINTER_PIVOT_DELETE ((PointerStyle)87) + +// --> FME 2004-07-30 #i32329# Enhanced table selection +#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 +#define POINTER_PAINTBRUSH ((PointerStyle)93) +// <-- + +#define POINTER_COUNT 94 + +#endif // _VCL_PTRSTYLE_HXX diff --git a/vcl/inc/vcl/regband.hxx b/vcl/inc/vcl/regband.hxx new file mode 100644 index 000000000000..2e34fdcd5677 --- /dev/null +++ b/vcl/inc/vcl/regband.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * 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_REGBAND_HXX +#define _SV_REGBAND_HXX + +#include <vcl/sv.h> +#include <tools/poly.hxx> + +/* ======================================================================= + +class ImplRegionBand + +This class handles one y-band of the region. In this band may contain one +or more seprarations in x-direction. The y-Band do not contain any +separation after creation. + +The separations are modified with basic clipping functions like Union and +Intersection - the Class will process the clipping for the actual band. + +The actual separations may be checked by functions like IsInside or +IsOver. + +======================================================================= */ + +// ------------------------ +// - ImplRegionBand-Types - +// ------------------------ + +// element for the list with x-separations +struct ImplRegionBandSep +{ + ImplRegionBandSep* mpNextSep; + long mnXLeft; + long mnXRight; + BOOL mbRemoved; +}; + +enum LineType { LINE_ASCENDING, LINE_DESCENDING, LINE_HORIZONTAL }; + +// element for the list with x-separations +struct ImplRegionBandPoint +{ + ImplRegionBandPoint* mpNextBandPoint; + long mnX; + long mnLineId; + BOOL mbEndPoint; + LineType meLineType; +}; + +// ------------------ +// - ImplRegionBand - +// ------------------ + +class ImplRegionBand +{ +public: + ImplRegionBand* mpNextBand; // pointer to the next element of the list + ImplRegionBand* mpPrevBand; // pointer to the previous element of the list (only used temporaery) + ImplRegionBandSep* mpFirstSep; // root of the list with x-separations + ImplRegionBandPoint* mpFirstBandPoint; // root of the list with lines + long mnYTop; // actual boundary of the band + long mnYBottom; + BOOL mbTouched; + + // create y-band with boundaries + ImplRegionBand( long nYTop, long nYBottom ); + /** copy y-band with with all data + @param theSourceBand + The new ImplRegionBand object will + be a copy of this band. + @param bIgnorePoints + When <TRUE/> (the default) the + band points pointed to by + mpFirstBandPoint are not copied. + When <FALSE/> they are copied. + You need the points when you are + planning to call ProcessPoints() + later on. + */ + ImplRegionBand( const ImplRegionBand & theSourceBand, + const bool bIgnorePoints = true); + ~ImplRegionBand(); + + long GetXLeftBoundary() const; + long GetXRightBoundary() const; + + // combine overlapping bands + BOOL OptimizeBand(); + + // generate separations from lines and process + // union with existing separations + void ProcessPoints(); + // insert point in the list for later processing + BOOL InsertPoint( long nX, long nLineID, + BOOL bEndPoint, LineType eLineType ); + + void Union( long nXLeft, long nXRight ); + void Intersect( long nXLeft, long nXRight ); + void Exclude( long nXLeft, long nXRight ); + void XOr( long nXLeft, long nXRight ); + + void MoveX( long nHorzMove ); + void ScaleX( double fHorzScale ); + + BOOL IsInside( long nX ); + BOOL IsInside( long nLeft, long nRight ); + BOOL IsOver( long nLeft, long nRight ); + + BOOL IsEmpty() const { return ((!mpFirstSep) && (!mpFirstBandPoint)); } + + BOOL operator==( const ImplRegionBand& rRegionBand ) const; + + /** Split the called band at the given vertical coordinate. After the + split the called band will cover the upper part not including nY. + The new band will cover the lower part including nY. + @param nY + The band is split at this y coordinate. The new, lower band + will include this very value. + @return + Returns the new, lower band. + */ + ImplRegionBand* SplitBand (const sal_Int32 nY); +}; + +#endif // _SV_REGBAND_HXX diff --git a/vcl/inc/vcl/region.h b/vcl/inc/vcl/region.h new file mode 100644 index 000000000000..b10f0eaf0f0f --- /dev/null +++ b/vcl/inc/vcl/region.h @@ -0,0 +1,134 @@ +/************************************************************************* + * + * 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_REGION_H +#define _SV_REGION_H + +#include <vcl/regband.hxx> +#include <tools/poly.hxx> +#include <vcl/region.hxx> + +// ----------------- +// - Hilfsmethoden - +// ----------------- + +#ifdef DBG_UTIL +const char* ImplDbgTestRegion( const void* pObj ); +#endif + +// -------------------- +// - ImplRegionHandle - +// -------------------- + +struct ImplRegionHandle +{ + Region* mpRegion; + ImplRegionBand* mpCurrRectBand; + ImplRegionBandSep* mpCurrRectBandSep; + BOOL mbFirst; +}; + +// ------------------ +// - ImplRegionInfo - +// ------------------ + +struct ImplRegionInfo +{ + void* mpVoidCurrRectBand; + void* mpVoidCurrRectBandSep; +}; + +// -------------- +// - ImplRegion - +// -------------- + +struct ImplRegionBase +{ +public: + ImplRegionBase( int nCount = 1 ); // TODO: replace manual refcounting + virtual ~ImplRegionBase(); +public: + ULONG mnRefCount; + ULONG mnRectCount; + PolyPolygon* mpPolyPoly; + basegfx::B2DPolyPolygon* mpB2DPolyPoly; +}; + +class ImplRegion : public ImplRegionBase +{ + friend class Region; + +private: + ImplRegionBand* mpFirstBand; // root of the list with y-bands + ImplRegionBand* mpLastCheckedBand; + +public: + ImplRegion(); + ImplRegion( const PolyPolygon& rPolyPoly ); + ImplRegion( const basegfx::B2DPolyPolygon& ); + ImplRegion( const ImplRegion& rImplRegion ); + ~ImplRegion(); + + ImplRegionBand* ImplGetFirstRegionBand() const { return mpFirstBand; } + PolyPolygon* ImplGetPolyPoly() const { return mpPolyPoly; } + + void CreateBandRange( long nYTop, long nYBottom ); + void InsertBands( long nYTop, long nYBottom ); + BOOL InsertSingleBand( ImplRegionBand* mpImplRegionBand, + long nYBandPosition ); + BOOL InsertLine( const Point & rFirstPoint, + const Point & rSecondPoint, + long nLineID ); + BOOL InsertPoint( const Point &rPoint, + long nLineID, + BOOL bEndPoint, LineType eLineType ); + + /** Insert one band either after another band or as the first or only + band. Both the forward as well as the backward links are updated. + @param pPreviousBand + When <NULL/> then pBandToInsert is inserted as first band or as + only band when there are no other bands. + When not <NULL/> then pBandToInsert is inserted directly after + pPreviousBand. + @param pBandToInsert + The band to insert. + */ + void InsertBand (ImplRegionBand* pPreviousBand, + ImplRegionBand* pBandToInsert); + + void Union( long nLeft, long nTop, long nRight, long nBottom ); + void Exclude( long nLeft, long nTop, long nRight, long nBottom ); + void XOr( long nLeft, long nTop, long nRight, long nBottom ); + + // remove emtpy rects + BOOL OptimizeBandList(); + + friend SvStream& operator>>( SvStream& rIStm, Region& rRegion ); + friend SvStream& operator<<( SvStream& rOStm, const Region& rRegion ); +}; + +#endif // _SV_REGION_H diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx new file mode 100644 index 000000000000..ddfba57ffdcf --- /dev/null +++ b/vcl/inc/vcl/region.hxx @@ -0,0 +1,155 @@ +/************************************************************************* + * + * 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_REGION_HXX +#define _SV_REGION_HXX + +#include <tools/gen.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +#include <basegfx/polygon/b2dpolypolygon.hxx> + +class ImplRegion; +class ImplRegionBand; +class Polygon; +class PolyPolygon; +struct ImplRegionInfo; + +// -------------- +// - RegionType - +// -------------- + +enum RegionType { REGION_NULL, REGION_EMPTY, REGION_RECTANGLE, REGION_COMPLEX }; +enum RegionOverlapType { REGION_INSIDE, REGION_OVER, REGION_OUTSIDE }; + +typedef long RegionHandle; + +// ---------- +// - Region - +// ---------- + +class VCL_DLLPUBLIC Region +{ + friend class OutputDevice; + friend class Window; + friend class Bitmap; + +private: + ImplRegion* mpImplRegion; + + SAL_DLLPRIVATE void ImplCopyData(); + SAL_DLLPRIVATE void ImplCreateRectRegion( const Rectangle& rRect ); + SAL_DLLPRIVATE void ImplCreatePolyPolyRegion( const PolyPolygon& rPolyPoly ); + SAL_DLLPRIVATE void ImplPolyPolyRegionToBandRegionFunc(); + SAL_DLLPRIVATE inline void ImplPolyPolyRegionToBandRegion(); + SAL_DLLPRIVATE const ImplRegion* ImplGetImplRegion() const { return mpImplRegion; } + SAL_DLLPRIVATE ImplRegion* ImplGetImplRegion() { return mpImplRegion; } + SAL_DLLPRIVATE BOOL ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, + long& nX, long& nY, long& nWidth, long& nHeight ) const; + SAL_DLLPRIVATE BOOL ImplGetNextRect( ImplRegionInfo& rImplRegionInfo, + long& nX, long& nY, long& nWidth, long& nHeight ) const; + SAL_DLLPRIVATE void ImplBeginAddRect( ); + SAL_DLLPRIVATE BOOL ImplAddRect( const Rectangle& rRect ); + SAL_DLLPRIVATE void ImplEndAddRect( ); + +#ifdef DBG_UTIL + friend const char* ImplDbgTestRegion( const void* pObj ); +#endif + +public: + Region(); + Region( RegionType eType ); + Region( const Rectangle& rRect ); + Region( const Polygon& rPolygon ); + Region( const PolyPolygon& rPolyPoly ); + Region( const basegfx::B2DPolyPolygon& ); + Region( const Region& rRegion ); + ~Region(); + + void Move( long nHorzMove, long nVertMove ); + void Scale( double fScaleX, double fScaleY ); + BOOL Union( const Rectangle& rRegion ); + BOOL Intersect( const Rectangle& rRegion ); + BOOL Exclude( const Rectangle& rRegion ); + BOOL XOr( const Rectangle& rRegion ); + BOOL Union( const Region& rRegion ); + BOOL Intersect( const Region& rRegion ); + BOOL Exclude( const Region& rRegion ); + BOOL XOr( const Region& rRegion ); + + RegionType GetType() const; + BOOL IsEmpty() const { return GetType() == REGION_EMPTY; }; + BOOL IsNull() const { return GetType() == REGION_NULL; }; + + void SetEmpty(); + void SetNull(); + + Rectangle GetBoundRect() const; + + BOOL HasPolyPolygon() const; + PolyPolygon GetPolyPolygon() const; + // returns an empty polypolygon in case HasPolyPolygon is FALSE + const basegfx::B2DPolyPolygon GetB2DPolyPolygon() const; + // returns a PolyPolygon either copied from the set PolyPolygon region + // or created from the constituent rectangles + basegfx::B2DPolyPolygon ConvertToB2DPolyPolygon(); + + ULONG GetRectCount() const; + RegionHandle BeginEnumRects(); + BOOL GetEnumRects( RegionHandle hRegionHandle, Rectangle& rRect ); + BOOL GetNextEnumRect( RegionHandle hRegionHandle, Rectangle& rRect ) + { return GetEnumRects( hRegionHandle, rRect ); } + void EndEnumRects( RegionHandle hRegionHandle ); + + BOOL IsInside( const Point& rPoint ) const; + BOOL IsInside( const Rectangle& rRect ) const; + BOOL IsOver( const Rectangle& rRect ) const; + + Region& operator=( const Region& rRegion ); + Region& operator=( const Rectangle& rRect ); + + BOOL operator==( const Region& rRegion ) const; + BOOL operator!=( const Region& rRegion ) const + { return !(Region::operator==( rRegion )); } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Region& rRegion ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Region& rRegion ); + + /* workaround: faster conversion for PolyPolygons + * if half of the Polygons contained in rPolyPoly are actually + * rectangles, then the returned Region will be constructed by + * XOr'ing the contained Polygons together; in the case of + * only Rectangles this can be up to eight times faster than + * Region( const PolyPolygon& ). + * Caution: this is only useful if the Region is known to be + * changed to rectangles; e.g. if being set as clip region + */ + static Region GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly ); +}; + +#endif // _SV_REGION_HXX diff --git a/vcl/inc/vcl/salatype.hxx b/vcl/inc/vcl/salatype.hxx new file mode 100644 index 000000000000..d9e25c0cada9 --- /dev/null +++ b/vcl/inc/vcl/salatype.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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_SALATYPE_HXX +#define _SV_SALATYPE_HXX + +#include <vcl/sv.h> + +// --------------------- +// - Application-Types - +// --------------------- + +// Derzeit doppelt und in apptypes.hxx auch vorhanden + +#define INPUT_MOUSE 0x0001 +#define INPUT_KEYBOARD 0x0002 +#define INPUT_PAINT 0x0004 +#define INPUT_TIMER 0x0008 +#define INPUT_OTHER 0x0010 +#define INPUT_MOUSEANDKEYBOARD (INPUT_MOUSE | INPUT_KEYBOARD) +#define INPUT_ANY (INPUT_MOUSEANDKEYBOARD | INPUT_PAINT | INPUT_TIMER | INPUT_OTHER) + +#endif // _SV_SALATYPE_HXX diff --git a/vcl/inc/vcl/salbmp.hxx b/vcl/inc/vcl/salbmp.hxx new file mode 100644 index 000000000000..4aca4a9277e9 --- /dev/null +++ b/vcl/inc/vcl/salbmp.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALBMP_HXX + +#ifndef _TL_GEN_HXX +#include <tools/gen.hxx> +#endif +#include <vcl/dllapi.h> + +struct BitmapBuffer; +class SalGraphics; +class BitmapPalette; +struct BitmapSystemData; + +class VCL_DLLPUBLIC SalBitmap +{ +public: + SalBitmap() {} + virtual ~SalBitmap(); + + virtual bool Create( const Size& rSize, + USHORT nBitCount, + const BitmapPalette& rPal ) = 0; + virtual bool Create( const SalBitmap& rSalBmp ) = 0; + virtual bool Create( const SalBitmap& rSalBmp, + SalGraphics* pGraphics ) = 0; + virtual bool Create( const SalBitmap& rSalBmp, + USHORT nNewBitCount ) = 0; + virtual void Destroy() = 0; + virtual Size GetSize() const = 0; + virtual USHORT GetBitCount() const = 0; + + virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ) = 0; + virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) = 0; + virtual bool GetSystemData( BitmapSystemData& rData ) = 0; + +}; + +#endif diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx new file mode 100644 index 000000000000..bbb70efcdf22 --- /dev/null +++ b/vcl/inc/vcl/salbtype.hxx @@ -0,0 +1,900 @@ +/************************************************************************* + * + * 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_SALBTYPE_HXX +#define _SV_SALBTYPE_HXX +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <osl/endian.h> +#include <tools/debug.hxx> +#include <vcl/salgtype.hxx> +#include <tools/color.hxx> +#include <tools/gen.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +// ---------- +// - Memory - +// ---------- + +typedef BYTE* HPBYTE; +typedef HPBYTE Scanline; +typedef const BYTE* ConstHPBYTE; +typedef ConstHPBYTE ConstScanline; + +// ------------------ +// - Bitmap formats - +// ------------------ + +#define BMP_FORMAT_BOTTOM_UP 0x00000000UL +#define BMP_FORMAT_TOP_DOWN 0x80000000UL + +#define BMP_FORMAT_1BIT_MSB_PAL 0x00000001UL +#define BMP_FORMAT_1BIT_LSB_PAL 0x00000002UL + +#define BMP_FORMAT_4BIT_MSN_PAL 0x00000004UL +#define BMP_FORMAT_4BIT_LSN_PAL 0x00000008UL + +#define BMP_FORMAT_8BIT_PAL 0x00000010UL +#define BMP_FORMAT_8BIT_TC_MASK 0x00000020UL + +// #define BMP_FORMAT_16BIT_TC_MASK 0x00000040UL + +#define BMP_FORMAT_24BIT_TC_BGR 0x00000080UL +#define BMP_FORMAT_24BIT_TC_RGB 0x00000100UL +#define BMP_FORMAT_24BIT_TC_MASK 0x00000200UL + +#define BMP_FORMAT_32BIT_TC_ABGR 0x00000400UL +#define BMP_FORMAT_32BIT_TC_ARGB 0x00000800UL +#define BMP_FORMAT_32BIT_TC_BGRA 0x00001000UL +#define BMP_FORMAT_32BIT_TC_RGBA 0x00002000UL +#define BMP_FORMAT_32BIT_TC_MASK 0x00004000UL + +#define BMP_FORMAT_16BIT_TC_MSB_MASK 0x00008000UL +#define BMP_FORMAT_16BIT_TC_LSB_MASK 0x00010000UL + +#define BMP_SCANLINE_ADJUSTMENT( Mac_nBmpFormat ) ( (Mac_nBmpFormat) & 0x80000000UL ) +#define BMP_SCANLINE_FORMAT( Mac_nBmpFormat ) ( (Mac_nBmpFormat) & 0x7FFFFFFFUL ) + +// ------------------------------------------------------------------ + +#define MASK_TO_COLOR( d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col ) \ +ULONG _def_cR = (BYTE) ( d_RS < 0L ? ( (d_nVal) & d_RM ) << -d_RS : ( (d_nVal) & d_RM ) >> d_RS ); \ +ULONG _def_cG = (BYTE) ( d_GS < 0L ? ( (d_nVal) & d_GM ) << -d_GS : ( (d_nVal) & d_GM ) >> d_GS ); \ +ULONG _def_cB = (BYTE) ( d_BS < 0L ? ( (d_nVal) & d_BM ) << -d_BS : ( (d_nVal) & d_BM ) >> d_BS ); \ +d_Col = BitmapColor( (BYTE) ( _def_cR | ( ( _def_cR & mnROr ) >> mnROrShift ) ), \ + (BYTE) ( _def_cG | ( ( _def_cG & mnGOr ) >> mnGOrShift ) ), \ + (BYTE) ( _def_cB | ( ( _def_cB & mnBOr ) >> mnBOrShift ) ) ); + +// ------------------------------------------------------------------ + +#define COLOR_TO_MASK( d_rCol, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS ) \ +( ( ( ( d_RS < 0L ) ? ( (UINT32) (d_rCol).GetRed() >> -d_RS ) : \ + ( (UINT32) (d_rCol).GetRed() << d_RS ) ) & d_RM ) | \ + ( ( ( d_GS < 0L ) ? ( (UINT32) (d_rCol).GetGreen() >> -d_GS ) : \ + ( (UINT32) (d_rCol).GetGreen() << d_GS ) ) & d_GM ) | \ + ( ( ( d_BS < 0L ) ? ( (UINT32) (d_rCol).GetBlue() >> -d_BS ) : \ + ( (UINT32) (d_rCol).GetBlue() << d_BS ) ) & d_BM ) ) + +// --------------- +// - BitmapColor - +// --------------- + +class Color; + +class VCL_DLLPUBLIC BitmapColor +{ +private: + +// !!! Achtung: +// !!! da auf die Member dieser Klasse via memcpy +// !!! zugegriffen wird, darf diese Klasse weder +// !!! in der Groesse noch der Reihenfolge der +// !!! Member veraendert werden (KA 02.09.97) + BYTE mcBlueOrIndex; + BYTE mcGreen; + BYTE mcRed; + BYTE mbIndex; + +public: + + inline BitmapColor(); + inline BitmapColor( const BitmapColor& rBitmapColor ); + inline BitmapColor( BYTE cRed, BYTE cGreen, BYTE cBlue ); + inline BitmapColor( const Color& rColor ); + inline BitmapColor( BYTE cIndex ); + inline ~BitmapColor() {}; + + inline BOOL operator==( const BitmapColor& rBitmapColor ) const; + inline BOOL operator!=( const BitmapColor& rBitmapColor ) const; + inline BitmapColor& operator=( const BitmapColor& rBitmapColor ); + + inline BOOL IsIndex() const; + + inline BYTE GetRed() const; + inline void SetRed( BYTE cRed ); + + inline BYTE GetGreen() const; + inline void SetGreen( BYTE cGreen ); + + inline BYTE GetBlue() const; + inline void SetBlue( BYTE cBlue ); + + inline BYTE GetIndex() const; + inline void SetIndex( BYTE cIndex ); + + operator Color() const; + inline operator BYTE() const; + + inline BYTE GetBlueOrIndex() const; + + inline BitmapColor& Invert(); + + inline BYTE GetLuminance() const; + inline BitmapColor& IncreaseLuminance( BYTE cGreyInc ); + inline BitmapColor& DecreaseLuminance( BYTE cGreyDec ); + + inline BitmapColor& Merge( const BitmapColor& rColor, BYTE cTransparency ); + inline BitmapColor& Merge( BYTE cR, BYTE cG, BYTE cB, BYTE cTransparency ); + + inline ULONG GetColorError( const BitmapColor& rBitmapColor ) const; +}; + +// --------------- +// - BitmapPalette - +// --------------- + +class Palette; + +class VCL_DLLPUBLIC BitmapPalette +{ + friend class SalBitmap; + friend class BitmapAccess; + +private: + + BitmapColor* mpBitmapColor; + USHORT mnCount; + +//#if 0 // _SOLAR__PRIVATE + +public: + + SAL_DLLPRIVATE inline BitmapColor* ImplGetColorBuffer() const; + +//#endif // __PRIVATE + +public: + + inline BitmapPalette(); + inline BitmapPalette( const BitmapPalette& rBitmapPalette ); + inline BitmapPalette( USHORT nCount ); + inline ~BitmapPalette(); + + inline BitmapPalette& operator=( const BitmapPalette& rBitmapPalette ); + inline BOOL operator==( const BitmapPalette& rBitmapPalette ) const; + inline BOOL operator!=( const BitmapPalette& rBitmapPalette ) const; + inline BOOL operator!(); + + inline USHORT GetEntryCount() const; + inline void SetEntryCount( USHORT nCount ); + + inline const BitmapColor& operator[]( USHORT nIndex ) const; + inline BitmapColor& operator[]( USHORT nIndex ); + + inline USHORT GetBestIndex( const BitmapColor& rCol ) const; + bool IsGreyPalette() const; +}; + +// --------------- +// - ColorMask - +// --------------- + +class VCL_DLLPUBLIC ColorMask +{ + ULONG mnRMask; + ULONG mnGMask; + ULONG mnBMask; + long mnRShift; + long mnGShift; + long mnBShift; + ULONG mnROrShift; + ULONG mnGOrShift; + ULONG mnBOrShift; + ULONG mnROr; + ULONG mnGOr; + ULONG mnBOr; + + SAL_DLLPRIVATE inline long ImplCalcMaskShift( ULONG nMask, ULONG& rOr, ULONG& rOrShift ) const; + +public: + + inline ColorMask( ULONG nRedMask = 0UL, ULONG nGreenMask = 0UL, ULONG nBlueMask = 0UL ); + inline ~ColorMask() {} + + inline ULONG GetRedMask() const; + inline ULONG GetGreenMask() const; + inline ULONG GetBlueMask() const; + + inline void GetColorFor8Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const; + inline void SetColorFor8Bit( const BitmapColor& rColor, HPBYTE pPixel ) const; + + inline void GetColorFor16BitMSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const; + inline void SetColorFor16BitMSB( const BitmapColor& rColor, HPBYTE pPixel ) const; + inline void GetColorFor16BitLSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const; + inline void SetColorFor16BitLSB( const BitmapColor& rColor, HPBYTE pPixel ) const; + + inline void GetColorFor24Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const; + inline void SetColorFor24Bit( const BitmapColor& rColor, HPBYTE pPixel ) const; + + inline void GetColorFor32Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const; + inline void SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixel ) const; +}; + +// --------------- +// - BitmapBuffer - +// --------------- + +struct VCL_DLLPUBLIC BitmapBuffer +{ + ULONG mnFormat; + long mnWidth; + long mnHeight; + long mnScanlineSize; + USHORT mnBitCount; + ColorMask maColorMask; + BitmapPalette maPalette; + BYTE* mpBits; + + BitmapBuffer(){} + ~BitmapBuffer() {} +}; + +// --------------------- +// - StretchAndConvert - +// --------------------- + +VCL_DLLPUBLIC BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect, + ULONG nDstBitmapFormat, BitmapPalette* pDstPal = NULL, ColorMask* pDstMask = NULL ); + +// ------------------------------------------------------------------ + +inline BitmapColor::BitmapColor() : + mcBlueOrIndex ( 0 ), + mcGreen ( 0 ), + mcRed ( 0 ), + mbIndex ( FALSE ) +{ +} + +// ------------------------------------------------------------------ + +inline BitmapColor::BitmapColor( BYTE cRed, BYTE cGreen, BYTE cBlue ) : + mcBlueOrIndex ( cBlue ), + mcGreen ( cGreen ), + mcRed ( cRed ), + mbIndex ( FALSE ) +{ +} + +// ------------------------------------------------------------------ + +inline BitmapColor::BitmapColor( const BitmapColor& rBitmapColor ) : + mcBlueOrIndex ( rBitmapColor.mcBlueOrIndex ), + mcGreen ( rBitmapColor.mcGreen ), + mcRed ( rBitmapColor.mcRed ), + mbIndex ( rBitmapColor.mbIndex ) +{ +} + +// ------------------------------------------------------------------ + +inline BitmapColor::BitmapColor( const Color& rColor ) : + mcBlueOrIndex ( rColor.GetBlue() ), + mcGreen ( rColor.GetGreen() ), + mcRed ( rColor.GetRed() ), + mbIndex ( 0 ) +{ +} + +// ------------------------------------------------------------------ + +inline BitmapColor::BitmapColor( BYTE cIndex ) : + mcBlueOrIndex ( cIndex ), + mcGreen ( 0 ), + mcRed ( 0 ), + mbIndex ( TRUE ) +{ +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapColor::operator==( const BitmapColor& rBitmapColor ) const +{ + return( ( mcBlueOrIndex == rBitmapColor.mcBlueOrIndex ) && + ( mbIndex ? rBitmapColor.mbIndex : + ( mcGreen == rBitmapColor.mcGreen && mcRed == rBitmapColor.mcRed ) ) ); +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapColor::operator!=( const BitmapColor& rBitmapColor ) const +{ + return !( *this == rBitmapColor ); +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapColor::operator=( const BitmapColor& rBitmapColor ) +{ + mcBlueOrIndex = rBitmapColor.mcBlueOrIndex; + mcGreen = rBitmapColor.mcGreen; + mcRed = rBitmapColor.mcRed; + mbIndex = rBitmapColor.mbIndex; + + return *this; +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapColor::IsIndex() const +{ + return mbIndex; +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapColor::GetRed() const +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + return mcRed; +} + +// ------------------------------------------------------------------ + +inline void BitmapColor::SetRed( BYTE cRed ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcRed = cRed; +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapColor::GetGreen() const +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + return mcGreen; +} + +// ------------------------------------------------------------------ + +inline void BitmapColor::SetGreen( BYTE cGreen ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcGreen = cGreen; +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapColor::GetBlue() const +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + return mcBlueOrIndex; +} + +// ------------------------------------------------------------------ + +inline void BitmapColor::SetBlue( BYTE cBlue ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcBlueOrIndex = cBlue; +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapColor::GetIndex() const +{ + DBG_ASSERT( mbIndex, "Pixel represents color values!" ); + return mcBlueOrIndex; +} + +// ------------------------------------------------------------------ + +inline void BitmapColor::SetIndex( BYTE cIndex ) +{ + DBG_ASSERT( mbIndex, "Pixel represents color values!" ); + mcBlueOrIndex = cIndex; +} + +// ------------------------------------------------------------------ + +inline BitmapColor::operator Color() const +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + return Color( mcRed, mcGreen, mcBlueOrIndex ); +} + +// ------------------------------------------------------------------ + +inline BitmapColor::operator BYTE() const +{ + DBG_ASSERT( mbIndex, "Pixel represents color values!" ); + return mcBlueOrIndex; +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapColor::GetBlueOrIndex() const +{ + // #i47518# Yield a value regardless of mbIndex + return mcBlueOrIndex; +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapColor::Invert() +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcBlueOrIndex = ~mcBlueOrIndex, mcGreen = ~mcGreen, mcRed = ~mcRed; + + return *this; +} + +// ------------------------------------------------------------------ + +inline BYTE BitmapColor::GetLuminance() const +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + return( (BYTE) ( ( mcBlueOrIndex * 28UL + mcGreen * 151UL + mcRed * 77UL ) >> 8UL ) ); +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapColor::IncreaseLuminance( BYTE cGreyInc ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcBlueOrIndex = (BYTE) MinMax( (long) mcBlueOrIndex + cGreyInc, 0L, 255L ); + mcGreen = (BYTE) MinMax( (long) mcGreen + cGreyInc, 0L, 255L ); + mcRed = (BYTE) MinMax( (long) mcRed + cGreyInc, 0L, 255L ); + + return *this; +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapColor::DecreaseLuminance( BYTE cGreyDec ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcBlueOrIndex = (BYTE) MinMax( (long) mcBlueOrIndex - cGreyDec, 0L, 255L ); + mcGreen = (BYTE) MinMax( (long) mcGreen - cGreyDec, 0L, 255L ); + mcRed = (BYTE) MinMax( (long) mcRed - cGreyDec, 0L, 255L ); + + return *this; +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, BYTE cTransparency ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + DBG_ASSERT( !rBitmapColor.mbIndex, "Pixel represents index into colortable!" ); + mcBlueOrIndex = COLOR_CHANNEL_MERGE( mcBlueOrIndex, rBitmapColor.mcBlueOrIndex, cTransparency ); + mcGreen = COLOR_CHANNEL_MERGE( mcGreen, rBitmapColor.mcGreen, cTransparency ); + mcRed = COLOR_CHANNEL_MERGE( mcRed, rBitmapColor.mcRed, cTransparency ); + + return *this; +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapColor::Merge( BYTE cR, BYTE cG, BYTE cB, BYTE cTransparency ) +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + mcBlueOrIndex = COLOR_CHANNEL_MERGE( mcBlueOrIndex, cB, cTransparency ); + mcGreen = COLOR_CHANNEL_MERGE( mcGreen, cG, cTransparency ); + mcRed = COLOR_CHANNEL_MERGE( mcRed, cR, cTransparency ); + + return *this; +} + +// ------------------------------------------------------------------ + +inline ULONG BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const +{ + DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); + DBG_ASSERT( !rBitmapColor.mbIndex, "Pixel represents index into colortable!" ); + return( (ULONG) ( labs( mcBlueOrIndex - rBitmapColor.mcBlueOrIndex ) + + labs( mcGreen - rBitmapColor.mcGreen ) + + labs( mcRed - rBitmapColor.mcRed ) ) ); +} + +// ------------------------------------------------------------------ + +inline BitmapPalette::BitmapPalette() : + mpBitmapColor ( NULL ), + mnCount ( 0 ) +{ +} + +// ------------------------------------------------------------------ + +inline BitmapPalette::BitmapPalette( const BitmapPalette& rBitmapPalette ) : + mnCount( rBitmapPalette.mnCount ) +{ + if( mnCount ) + { + const ULONG nSize = mnCount * sizeof( BitmapColor ); + mpBitmapColor = (BitmapColor*) new BYTE[ nSize ]; + memcpy( mpBitmapColor, rBitmapPalette.mpBitmapColor, nSize ); + } + else + mpBitmapColor = NULL; +} + +// ------------------------------------------------------------------ + +inline BitmapPalette::BitmapPalette( USHORT nCount ) : + mnCount( nCount ) +{ + if( mnCount ) + { + const ULONG nSize = mnCount * sizeof( BitmapColor ); + mpBitmapColor = (BitmapColor*) new BYTE[ nSize ]; + memset( mpBitmapColor, 0, nSize ); + } + else + mpBitmapColor = NULL; +} + +// ------------------------------------------------------------------ + +inline BitmapPalette::~BitmapPalette() +{ + delete[] (BYTE*) mpBitmapColor; +} + +// ------------------------------------------------------------------ + +inline BitmapPalette& BitmapPalette::operator=( const BitmapPalette& rBitmapPalette ) +{ + delete[] (BYTE*) mpBitmapColor; + mnCount = rBitmapPalette.mnCount; + + if( mnCount ) + { + const ULONG nSize = mnCount * sizeof( BitmapColor ); + mpBitmapColor = (BitmapColor*) new BYTE[ nSize ]; + memcpy( mpBitmapColor, rBitmapPalette.mpBitmapColor, nSize ); + } + else + mpBitmapColor = NULL; + + return *this; +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapPalette::operator==( const BitmapPalette& rBitmapPalette ) const +{ + BOOL bRet = FALSE; + + if( rBitmapPalette.mnCount == mnCount ) + { + bRet = TRUE; + + for( USHORT i = 0; i < mnCount; i++ ) + { + if( mpBitmapColor[ i ] != rBitmapPalette.mpBitmapColor[ i ] ) + { + bRet = FALSE; + break; + } + } + } + + return bRet; +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapPalette::operator!=( const BitmapPalette& rBitmapPalette ) const +{ + return !( *this == rBitmapPalette ); +} + +// ------------------------------------------------------------------ + +inline BOOL BitmapPalette::operator!() +{ + return( !mnCount || !mpBitmapColor ); +} + +// ------------------------------------------------------------------ + +inline USHORT BitmapPalette::GetEntryCount() const +{ + return mnCount; +} + +// ------------------------------------------------------------------ + +inline void BitmapPalette::SetEntryCount( USHORT nCount ) +{ + if( !nCount ) + { + delete[] (BYTE*) mpBitmapColor; + mpBitmapColor = NULL; + mnCount = 0; + } + else if( nCount != mnCount ) + { + const ULONG nNewSize = nCount * sizeof( BitmapColor ); + const ULONG nMinSize = Min( mnCount, nCount ) * sizeof( BitmapColor ); + BYTE* pNewColor = new BYTE[ nNewSize ]; + + if ( nMinSize && mpBitmapColor ) + memcpy( pNewColor, mpBitmapColor, nMinSize ); + delete[] (BYTE*) mpBitmapColor; + memset( pNewColor + nMinSize, 0, nNewSize - nMinSize ); + mpBitmapColor = (BitmapColor*) pNewColor; + mnCount = nCount; + } +} + +// ------------------------------------------------------------------ + +inline const BitmapColor& BitmapPalette::operator[]( USHORT nIndex ) const +{ + DBG_ASSERT( nIndex < mnCount, "Palette index is out of range!" ); + return mpBitmapColor[ nIndex ]; +} + +// ------------------------------------------------------------------ + +inline BitmapColor& BitmapPalette::operator[]( USHORT nIndex ) +{ + DBG_ASSERT( nIndex < mnCount, "Palette index is out of range!" ); + return mpBitmapColor[ nIndex ]; +} + +// ------------------------------------------------------------------ + +//#if 0 // _SOLAR__PRIVATE +inline BitmapColor* BitmapPalette::ImplGetColorBuffer() const +{ + DBG_ASSERT( mpBitmapColor, "No color buffer available!" ); + return mpBitmapColor; +} +//#endif +// ------------------------------------------------------------------ + +inline USHORT BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const +{ + USHORT nRetIndex = 0; + + if( mpBitmapColor && mnCount ) + { + BOOL bFound = FALSE; + + for( long j = 0L; ( j < mnCount ) && !bFound; j++ ) + if( rCol == mpBitmapColor[ j ] ) + nRetIndex = ( (USHORT) j ), bFound = TRUE; + + if( !bFound ) + { + long nActErr, nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex = mnCount - 1 ] ); + + for( long i = nRetIndex - 1; i >= 0L; i-- ) + if ( ( nActErr = rCol.GetColorError( mpBitmapColor[ i ] ) ) < nLastErr ) + nLastErr = nActErr, nRetIndex = (USHORT) i; + } + } + + return nRetIndex; +} + +// ------------------------------------------------------------------ + +inline ColorMask::ColorMask( ULONG nRedMask, ULONG nGreenMask, ULONG nBlueMask ) : + mnRMask( nRedMask ), + mnGMask( nGreenMask ), + mnBMask( nBlueMask ), + mnROrShift( 0L ), + mnGOrShift( 0L ), + mnBOrShift( 0L ), + mnROr( 0L ), + mnGOr( 0L ), + mnBOr( 0L ) +{ + mnRShift = ( mnRMask ? ImplCalcMaskShift( mnRMask, mnROr, mnROrShift ) : 0L ); + mnGShift = ( mnGMask ? ImplCalcMaskShift( mnGMask, mnGOr, mnGOrShift ) : 0L ); + mnBShift = ( mnBMask ? ImplCalcMaskShift( mnBMask, mnBOr, mnBOrShift ) : 0L ); +} + +// ------------------------------------------------------------------ + +inline long ColorMask::ImplCalcMaskShift( ULONG nMask, ULONG& rOr, ULONG& rOrShift ) const +{ + long nShift; + long nRet; + ULONG nLen = 0UL; + + // bei welchen Bits faengt die Maske an + for( nShift = 31L; ( nShift >= 0L ) && !( nMask & ( 1 << (ULONG) nShift ) ); nShift-- ) + {} + + nRet = nShift; + + // XXX Anzahl der gesetzten Bits ermitteln => nach rechts bis Null laufen + while( ( nShift >= 0L ) && ( nMask & ( 1 << (ULONG) nShift ) ) ) + { + nShift--; + nLen++; + } + + rOrShift = 8L - nLen; + rOr = (BYTE) ( ( 0xffUL >> nLen ) << rOrShift ); + + return( nRet -= 7 ); +} + +// ------------------------------------------------------------------ + +inline ULONG ColorMask::GetRedMask() const +{ + return mnRMask; +} + +// ------------------------------------------------------------------ + +inline ULONG ColorMask::GetGreenMask() const +{ + return mnGMask; +} + +// ------------------------------------------------------------------ + +inline ULONG ColorMask::GetBlueMask() const +{ + return mnBMask; +} + +// ------------------------------------------------------------------ + +inline void ColorMask::GetColorFor8Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const +{ + const UINT32 nVal = *pPixel; + MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::SetColorFor8Bit( const BitmapColor& rColor, HPBYTE pPixel ) const +{ + *pPixel = (BYTE) COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::GetColorFor16BitMSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const +{ +#ifdef OSL_BIGENDIAN + const UINT32 nVal = *(UINT16*) pPixel; +#else + const UINT32 nVal = pPixel[ 1 ] | ( (UINT32) pPixel[ 0 ] << 8UL ); +#endif + + MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::SetColorFor16BitMSB( const BitmapColor& rColor, HPBYTE pPixel ) const +{ + const UINT16 nVal = (UINT16)COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift ); + +#ifdef OSL_BIGENDIAN + *(UINT16*) pPixel = nVal; +#else + pPixel[ 0 ] = (BYTE)(nVal >> 8U); + pPixel[ 1 ] = (BYTE) nVal; +#endif +} + +// ------------------------------------------------------------------ + +inline void ColorMask::GetColorFor16BitLSB( BitmapColor& rColor, ConstHPBYTE pPixel ) const +{ +#ifdef OSL_BIGENDIAN + const UINT32 nVal = pPixel[ 0 ] | ( (UINT32) pPixel[ 1 ] << 8UL ); +#else + const UINT32 nVal = *(UINT16*) pPixel; +#endif + + MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::SetColorFor16BitLSB( const BitmapColor& rColor, HPBYTE pPixel ) const +{ + const UINT16 nVal = (UINT16)COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift ); + +#ifdef OSL_BIGENDIAN + pPixel[ 0 ] = (BYTE) nVal; + pPixel[ 1 ] = (BYTE)(nVal >> 8U); +#else + *(UINT16*) pPixel = nVal; +#endif +} + + +// ------------------------------------------------------------------ + +inline void ColorMask::GetColorFor24Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const +{ + const UINT32 nVal = pPixel[ 0 ] | ( (UINT32) pPixel[ 1 ] << 8UL ) | ( (UINT32) pPixel[ 2 ] << 16UL ); + MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::SetColorFor24Bit( const BitmapColor& rColor, HPBYTE pPixel ) const +{ + const UINT32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift ); + pPixel[ 0 ] = (BYTE) nVal; pPixel[ 1 ] = (BYTE) ( nVal >> 8UL ); pPixel[ 2 ] = (BYTE) ( nVal >> 16UL ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::GetColorFor32Bit( BitmapColor& rColor, ConstHPBYTE pPixel ) const +{ +#ifdef OSL_BIGENDIAN + const UINT32 nVal = (UINT32) pPixel[ 0 ] | ( (UINT32) pPixel[ 1 ] << 8UL ) | + ( (UINT32) pPixel[ 2 ] << 16UL ) | ( (UINT32) pPixel[ 3 ] << 24UL ); +#else + const UINT32 nVal = *(UINT32*) pPixel; +#endif + + MASK_TO_COLOR( nVal, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, rColor ); +} + +// ------------------------------------------------------------------ + +inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixel ) const +{ +#ifdef OSL_BIGENDIAN + const UINT32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift ); + pPixel[ 0 ] = (BYTE) nVal; pPixel[ 1 ] = (BYTE) ( nVal >> 8UL ); + pPixel[ 2 ] = (BYTE) ( nVal >> 16UL ); pPixel[ 3 ] = (BYTE) ( nVal >> 24UL ); +#else + *(UINT32*) pPixel = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift ); +#endif +} + +#endif // _SV_SALBTYPE_HXX diff --git a/vcl/inc/vcl/salctrlhandle.hxx b/vcl/inc/vcl/salctrlhandle.hxx new file mode 100644 index 000000000000..4a0a3a0f5b0a --- /dev/null +++ b/vcl/inc/vcl/salctrlhandle.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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_SALCTRLHANDLE_HXX +#define _SV_SALCTRLHANDLE_HXX + +/* SalControlHandle: + * + * Container for platform-specific handles and data + * about controls. Lives as long as the VCL control + * lives. + */ + +class SalControlHandle +{ + public: + SalControlHandle() {} + virtual ~SalControlHandle(); + + // TODO: derive Sal implementation + //SalControlHandleData maData; +}; + +#endif diff --git a/vcl/inc/vcl/salctype.hxx b/vcl/inc/vcl/salctype.hxx new file mode 100644 index 000000000000..1566f02a1299 --- /dev/null +++ b/vcl/inc/vcl/salctype.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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_SALCTYPE_HXX +#define _SV_SALCTYPE_HXX + +#include <vcl/graph.hxx> + +// ----------- +// - Defines - +// ----------- + +#define CVT_UNKNOWN (0x00000000UL) +#define CVT_BMP (0x00000001UL) +#define CVT_GIF (0x00000002UL) +#define CVT_JPG (0x00000003UL) +#define CVT_MET (0x00000004UL) +#define CVT_PCT (0x00000005UL) +#define CVT_PNG (0x00000006UL) +#define CVT_SVM (0x00000007UL) +#define CVT_TIF (0x00000008UL) +#define CVT_WMF (0x00000009UL) +#define CVT_EMF (0x0000000aUL) + +// --------------- +// - ConvertData - +// --------------- + +class SvStream; + +struct ConvertData +{ +private: + + ConvertData(); + +public: + + Graphic maGraphic; + SvStream& mrStm; + ULONG mnFormat; + + ConvertData( const Graphic& rGraphic, SvStream& rStm, ULONG nFormat ) : + maGraphic( rGraphic ), mrStm( rStm ), mnFormat( nFormat ) {} + ~ConvertData() {} +}; + +// ------------ +// - Callback - +// ------------ + +typedef ULONG (*SALGRFCVTPROC)( void* pInst, + ULONG nInFormat, void* pInBuffer, ULONG nInBufSize, + ULONG nOutFormat, void** ppOutBuffer ); + +#endif // _SV_SALCTYPE_HXX diff --git a/vcl/inc/vcl/saldatabasic.hxx b/vcl/inc/vcl/saldatabasic.hxx new file mode 100644 index 000000000000..1df2a701fd1a --- /dev/null +++ b/vcl/inc/vcl/saldatabasic.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_SALDATABASIC_HXX +#define _SV_SALDATABASIC_HXX + +#include <vcl/svdata.hxx> +#include <vcl/salinst.hxx> +#include <osl/module.h> + +class VCL_DLLPUBLIC SalData +{ +public: + SalInstance* m_pInstance; // pointer to instance + oslModule m_pPlugin; // plugin library handle + + SalData(); + virtual ~SalData(); + +}; + +// -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +inline void SetSalData( SalData* pData ) +{ ImplGetSVData()->mpSalData = (void*)pData; } + +inline SalData* GetSalData() +{ return (SalData*)ImplGetSVData()->mpSalData; } + +#endif diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx new file mode 100644 index 000000000000..08548d7dda40 --- /dev/null +++ b/vcl/inc/vcl/salframe.hxx @@ -0,0 +1,293 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALFRAME_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +#ifdef __cplusplus + +#ifndef _SV_PTRSTYLE_HXX +#include <vcl/ptrstyle.hxx> +#endif +#include <vcl/sndstyle.hxx> + +#endif // __cplusplus +#include <vcl/salwtype.hxx> +#include <vcl/salgeom.hxx> +#include <tools/gen.hxx> +#include <vcl/region.hxx> + +#ifndef _VCL_IMPDEL_HXX +#include <vcl/impdel.hxx> +#endif +#include <rtl/ustring.hxx> +#include <vcl/keycod.hxx> + +class AllSettings; +class SalGraphics; +class SalBitmap; +class SalMenu; +class Window; + + +struct SalFrameState; +struct SalInputContext; +struct SystemEnvData; + +// ----------------- +// - SalFrameTypes - +// ----------------- + +#define SAL_FRAME_TOTOP_RESTOREWHENMIN ((USHORT)0x0001) +#define SAL_FRAME_TOTOP_FOREGROUNDTASK ((USHORT)0x0002) +#define SAL_FRAME_TOTOP_GRABFOCUS ((USHORT)0x0004) +#define SAL_FRAME_TOTOP_GRABFOCUS_ONLY ((USHORT)0x0008) + +#define SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE ((USHORT)0x0001) +#define SAL_FRAME_ENDEXTTEXTINPUT_CANCEL ((USHORT)0x0002) + + +// ----------------- +// - SalFrameStyle - +// ----------------- + +#define SAL_FRAME_STYLE_DEFAULT ((ULONG)0x00000001) +#define SAL_FRAME_STYLE_MOVEABLE ((ULONG)0x00000002) +#define SAL_FRAME_STYLE_SIZEABLE ((ULONG)0x00000004) +#define SAL_FRAME_STYLE_CLOSEABLE ((ULONG)0x00000008) + +// no shadow effect on WindowsXP +#define SAL_FRAME_STYLE_NOSHADOW ((ULONG)0x00000010) +// indicate tooltip windows, so they can always be topmost +#define SAL_FRAME_STYLE_TOOLTIP ((ULONG)0x00000020) +// windows without windowmanager decoration, this typically only applies to floating windows +#define SAL_FRAME_STYLE_OWNERDRAWDECORATION ((ULONG)0x00000040) +// dialogs +#define SAL_FRAME_STYLE_DIALOG ((ULONG)0x00000080) +// partial fullscreen: fullscreen on one monitor of a multimonitor display +#define SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ((ULONG)0x00800000) +// plugged system child window +#define SAL_FRAME_STYLE_PLUG ((ULONG)0x10000000) +// system child window inside another SalFrame +#define SAL_FRAME_STYLE_SYSTEMCHILD ((ULONG)0x08000000) +// floating window +#define SAL_FRAME_STYLE_FLOAT ((ULONG)0x20000000) +// floating window that needs to be focusable +#define SAL_FRAME_STYLE_FLOAT_FOCUSABLE ((ULONG)0x04000000) +// toolwindows should be painted with a smaller decoration +#define SAL_FRAME_STYLE_TOOLWINDOW ((ULONG)0x40000000) +// the window containing the intro bitmap, aka splashscreen +#define SAL_FRAME_STYLE_INTRO ((ULONG)0x80000000) + +/* +#define SAL_FRAME_STYLE_MINABLE ((ULONG)0x00000008) +#define SAL_FRAME_STYLE_MAXABLE ((ULONG)0x00000010) +#define SAL_FRAME_STYLE_BORDER ((ULONG)0x00000040) +#define SAL_FRAME_STYLE_DOC ((ULONG)0x00004000) +#define SAL_FRAME_STYLE_DIALOG ((ULONG)0x00008000) +#define SAL_FRAME_STYLE_TOOL ((ULONG)0x00010000) +#define SAL_FRAME_STYLE_FULLSIZE ((ULONG)0x00020000) +*/ + +// ---------------------------------------- +// - extended frame style - +// - (sal equivalent to extended WinBits) - +// ---------------------------------------- +typedef sal_uInt64 SalExtStyle; +#define SAL_FRAME_EXT_STYLE_DOCUMENT SalExtStyle(0x00000001) +#define SAL_FRAME_EXT_STYLE_DOCMODIFIED SalExtStyle(0x00000002) + +// ------------------------ +// - Flags for SetPosSize - +// ------------------------ + +#define SAL_FRAME_POSSIZE_X ((USHORT)0x0001) +#define SAL_FRAME_POSSIZE_Y ((USHORT)0x0002) +#define SAL_FRAME_POSSIZE_WIDTH ((USHORT)0x0004) +#define SAL_FRAME_POSSIZE_HEIGHT ((USHORT)0x0008) + +#ifdef __cplusplus + +using namespace rtl; + +// ------------ +// - SalFrame - +// ------------ + +struct SystemParentData; + +class VCL_DLLPUBLIC SalFrame : public vcl::DeletionNotifier +{ + // the VCL window corresponding to this frame + Window* m_pWindow; + SALFRAMEPROC m_pProc; +public: // public for Sal Implementation + SalFrame() : m_pWindow( NULL ), m_pProc( NULL ) {} + virtual ~SalFrame(); + +public: // public for Sal Implementation + SalFrameGeometry maGeometry; + +public: + // SalGraphics or NULL, but two Graphics for all SalFrames + // must be returned + virtual SalGraphics* GetGraphics() = 0; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0; + + // Event must be destroyed, when Frame is destroyed + // When Event is called, SalInstance::Yield() must be returned + virtual BOOL PostEvent( void* pData ) = 0; + + virtual void SetTitle( const XubString& rTitle ) = 0; + virtual void SetIcon( USHORT nIcon ) = 0; + virtual void SetRepresentedURL( const rtl::OUString& ); + virtual void SetMenu( SalMenu *pSalMenu ) = 0; + virtual void DrawMenuBar() = 0; + + virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) = 0; + + // Before the window is visible, a resize event + // must be sent with the correct size + virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ) = 0; + virtual void Enable( BOOL bEnable ) = 0; + // Set ClientSize and Center the Window to the desktop + // and send/post a resize message + virtual void SetMinClientSize( long nWidth, long nHeight ) = 0; + virtual void SetMaxClientSize( long nWidth, long nHeight ) = 0; + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ) = 0; + virtual void GetClientSize( long& rWidth, long& rHeight ) = 0; + virtual void GetWorkArea( Rectangle& rRect ) = 0; + virtual SalFrame* GetParent() const = 0; + // Note: x will be mirrored at parent if UI mirroring is active + SalFrameGeometry GetGeometry(); + const SalFrameGeometry& GetUnmirroredGeometry() const { return maGeometry; } + virtual void SetWindowState( const SalFrameState* pState ) = 0; + virtual BOOL GetWindowState( SalFrameState* pState ) = 0; + virtual void ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) = 0; + // Enable/Disable ScreenSaver, SystemAgents, ... + virtual void StartPresentation( BOOL bStart ) = 0; + // Show Window over all other Windows + virtual void SetAlwaysOnTop( BOOL bOnTop ) = 0; + + // Window to top and grab focus + virtual void ToTop( USHORT nFlags ) = 0; + + // this function can call with the same + // pointer style + virtual void SetPointer( PointerStyle ePointerStyle ) = 0; + virtual void CaptureMouse( BOOL bMouse ) = 0; + virtual void SetPointerPos( long nX, long nY ) = 0; + + // flush output buffer + virtual void Flush( void) = 0; + virtual void Flush( const Rectangle& ); + // flush output buffer, wait till outstanding operations are done + virtual void Sync() = 0; + + virtual void SetInputContext( SalInputContext* pContext ) = 0; + virtual void EndExtTextInput( USHORT nFlags ) = 0; + + virtual String GetKeyName( USHORT nKeyCode ) = 0; + virtual String GetSymbolKeyName( const XubString& rFontName, USHORT nKeyCode ) = 0; + + // returns in 'rKeyCode' the single keycode that translates to the given unicode when using a keyboard layout of language 'aLangType' + // returns FALSE if no mapping exists or function not supported + // this is required for advanced menu support + virtual BOOL MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ) = 0; + + // returns the input language used for the last key stroke + // may be LANGUAGE_DONTKNOW if not supported by the OS + virtual LanguageType GetInputLanguage() = 0; + + virtual SalBitmap* SnapShot() = 0; + + virtual void UpdateSettings( AllSettings& rSettings ) = 0; + + virtual void Beep( SoundType eSoundType ) = 0; + + // returns system data (most prominent: window handle) + virtual const SystemEnvData* GetSystemData() const = 0; + + // sets a background bitmap on the frame; the implementation + // must not make assumptions about the lifetime of the passed SalBitmap + // but should copy its contents to an own buffer + virtual void SetBackgroundBitmap( SalBitmap* ) = 0; + + + // get current modifier, button mask and mouse position + struct SalPointerState + { + ULONG mnState; + Point maPos; // in frame coordinates + }; + + virtual SalPointerState GetPointerState() = 0; + + // set new parent window + virtual void SetParent( SalFrame* pNewParent ) = 0; + // reparent window to act as a plugin; implementation + // may choose to use a new system window inetrnally + // return false to indicate failure + virtual bool SetPluginParent( SystemParentData* pNewParent ) = 0; + + // move the frame to a new screen + virtual void SetScreenNumber( unsigned int nScreen ) = 0; + + // shaped system windows + // set clip region to none (-> rectangular windows, normal state) + virtual void ResetClipRegion() = 0; + // start setting the clipregion consisting of nRects rectangles + virtual void BeginSetClipRegion( ULONG nRects ) = 0; + // add a rectangle to the clip region + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0; + // done setting up the clipregion + virtual void EndSetClipRegion() = 0; + + + // Callbacks (indepent part in vcl/source/window/winproc.cxx) + // for default message handling return 0 + void SetCallback( Window* pWindow, SALFRAMEPROC pProc ) + { m_pWindow = pWindow; m_pProc = pProc; } + + // returns the instance set + Window* GetWindow() const { return m_pWindow; } + + // Call the callback set; this sometimes necessary for implementation classes + // that should not now more than necessary about the SalFrame implementation + // (e.g. input methods, printer update handlers). + long CallCallback( USHORT nEvent, const void* pEvent ) const + { return m_pProc ? m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent ) : 0; } +}; + + + +#endif // __cplusplus + +#endif // _SV_SALFRAME_HXX diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx new file mode 100644 index 000000000000..d8276406746e --- /dev/null +++ b/vcl/inc/vcl/salgdi.hxx @@ -0,0 +1,494 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALGDI_HXX + +#include "tools/string.hxx" +#include "rtl/ustring.hxx" +#include "vcl/sv.h" +#include "vcl/dllapi.h" +#include "vcl/salgtype.hxx" +#include "vos/thread.hxx" +#include "vcl/outdev.hxx" +#include "vcl/salnativewidgets.hxx" +#include "vcl/salctrlhandle.hxx" + +#include <map> + +class ImplDevFontList; +class SalBitmap; +class ImplFontSelectData; +class ImplFontMetricData; +struct ImplKernPairData; +class ImplFontData; +class ImplFontCharMap; +class SalLayout; +class ImplLayoutArgs; +class Rectangle; +class FontSubsetInfo; +class OutputDevice; +class ServerFontLayout; +struct SystemGraphicsData; +struct SystemFontData; + +namespace basegfx { + class B2DVector; + class B2DPolygon; + class B2DPolyPolygon; +} + +// --------------------- +// - SalGraphics-Codes - +// --------------------- + +#define SAL_SETFONT_REMOVEANDMATCHNEW ((USHORT)0x0001) +#define SAL_SETFONT_USEDRAWTEXT ((USHORT)0x0002) +#define SAL_SETFONT_USEDRAWTEXTARRAY ((USHORT)0x0004) +#define SAL_SETFONT_UNICODE ((USHORT)0x0008) +#define SAL_SETFONT_BADFONT ((USHORT)0x1000) + +#define SAL_COPYAREA_WINDOWINVALIDATE ((USHORT)0x0001) + +// ------------------- +// - common typedefs - +// ------------------- + +typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode +typedef std::map< sal_Ucs, sal_Int32 > Ucs2SIntMap; +typedef std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap; +typedef std::map< sal_Ucs, rtl::OString > Ucs2OStrMap; +typedef std::vector< sal_Int32 > Int32Vector; + +// --------------- +// - SalGraphics - +// --------------- + +// note: if you add any new methods to class SalGraphics using coordinates +// make sure they have a corresponding protected pure virtual method +// which has to be implemented by the platform dependent part. +// Add a method that performs coordinate mirroring if required, (see +// existing methods as sample) and then calls the equivalent pure method. + +// note: all positions are in pixel and relative to +// the top/left-position of the virtual output area + +class VCL_DLLPUBLIC SalGraphics +{ + int m_nLayout; // 0: mirroring off, 1: mirror x-axis + +protected: + // flags which hold the SetAntialiasing() value from OutputDevice + bool m_bAntiAliasB2DDraw; + +public: + // get/set AA + void setAntiAliasB2DDraw(bool bNew) { m_bAntiAliasB2DDraw = bNew; } + bool getAntiAliasB2DDraw() const { return m_bAntiAliasB2DDraw; } + + SalGraphics(); + virtual ~SalGraphics(); + +protected: + virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ) = 0; + // draw --> LineColor and FillColor and RasterOp and ClipRegion + virtual void drawPixel( long nX, long nY ) = 0; + virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0; + virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0; + virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) = 0; + virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) = 0; + virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0; + virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ) = 0; + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ) = 0; + virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) = 0; + virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) = 0; + virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) = 0; + + // CopyArea --> No RasterOp, but ClipRegion + virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, + long nSrcHeight, USHORT nFlags ) = 0; + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + virtual void copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ) = 0; + virtual void drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap ) = 0; + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nTransparentColor ) = 0; + virtual void drawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rMaskBitmap ) = 0; + virtual void drawMask( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nMaskColor ) = 0; + + virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual SalColor getPixel( long nX, long nY ) = 0; + + // invert --> ClipRegion (only Windows or VirDevs) + virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) = 0; + virtual void invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags ) = 0; + + virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) = 0; + + // native widget rendering methods that require mirroring + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + const Point& aPos, BOOL& rIsInside ); + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const rtl::OUString& aCaption ); + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, + ControlState nState, const ImplControlValue& aValue, + const rtl::OUString& aCaption ); + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, const rtl::OUString& aCaption, + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); + + /** Render bitmap with alpha channel + + @param rSourceBitmap + Source bitmap to blit + + @param rAlphaBitmap + Alpha channel to use for blitting + + @return true, if the operation succeeded, and false + otherwise. In this case, clients should try to emulate alpha + compositing themselves + */ + virtual bool drawAlphaBitmap( const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap ) = 0; + /** Render solid rectangle with given transparency + + @param nTransparency + Transparency value (0-255) to use. 0 blits and opaque, 255 a + fully transparent rectangle + */ + virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ) = 0; + +public: + // public SalGraphics methods, the interface to the independent vcl part + + // get device resolution + virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0; + // get the depth of the device + virtual USHORT GetBitCount() = 0; + // get the width of the device + virtual long GetGraphicsWidth() const = 0; + + // set the clip region to empty + virtual void ResetClipRegion() = 0; + // begin setting the clip region, add rectangles to the + // region with the UnionClipRegion call + virtual void BeginSetClipRegion( ULONG nCount ) = 0; + // all rectangles were added and the clip region should be set now + virtual void EndSetClipRegion() = 0; + + // set the line color to transparent (= don't draw lines) + virtual void SetLineColor() = 0; + // set the line color to a specific color + virtual void SetLineColor( SalColor nSalColor ) = 0; + // set the fill color to transparent (= don't fill) + virtual void SetFillColor() = 0; + // set the fill color to a specific color, shapes will be + // filled accordingly + virtual void SetFillColor( SalColor nSalColor ) = 0; + // enable/disable XOR drawing + virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0; + // set line color for raster operations + virtual void SetROPLineColor( SalROPColor nROPColor ) = 0; + // set fill color for raster operations + virtual void SetROPFillColor( SalROPColor nROPColor ) = 0; + // set the text color to a specific color + virtual void SetTextColor( SalColor nSalColor ) = 0; + // set the font + virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel ) = 0; + // release the fonts + void ReleaseFonts() { SetFont( NULL, 0 ); } + // get the current font's metrics + virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel = 0 ) = 0; + + // get kernign pairs of the current font + // return only PairCount if (pKernPairs == NULL) + virtual ULONG GetKernPairs( ULONG nMaxPairCount, ImplKernPairData* ) = 0; + // get the repertoire of the current font + virtual const ImplFontCharMap* GetImplFontCharMap() const = 0; + // graphics must fill supplied font list + virtual void GetDevFontList( ImplDevFontList* ) = 0; + // graphics should call ImplAddDevFontSubstitute on supplied + // OutputDevice for all its device specific preferred font substitutions + virtual void GetDevFontSubstList( OutputDevice* ) = 0; + virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ) = 0; + // 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, + sal_Int32* pGlyphIDs, + sal_uInt8* pEncoding, + sal_Int32* pWidths, + int nGlyphs, + FontSubsetInfo& rInfo // out parameter + ) = 0; + + // 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 ) = 0; + + // 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 + // pUnicodes: contains the Unicodes assigned to + // code points 0 to 255; must contain at least 256 members + // 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* pFont, + const sal_Ucs* pUnicodes, + sal_Int32* pWidths, + FontSubsetInfo& rInfo, + long* pDataLen ) = 0; + // frees the font data again + virtual void FreeEmbedFontData( const void* pData, long nDataLen ) = 0; + + // get the same widths as in CreateFontSubset and GetEmbedFontData + // in case of an embeddable font also fill the mapping + // between unicode and glyph id + // leave widths vector and mapping untouched in case of failure + virtual void GetGlyphWidths( const ImplFontData* pFont, + bool bVertical, + Int32Vector& rWidths, + Ucs2UIntMap& rUnicodeEnc ) = 0; + + virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ) = 0; + virtual BOOL GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& ) = 0; + + virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; + virtual void DrawServerFontLayout( const ServerFontLayout& ) = 0; + /** Filter text from DrawText commands in a device specific manner + <p> + This function allows a device (or rather the corresponding SalGraphics + implementation) to prevent text portions from being drawn. This currently + is used only for filtering out the fax number in a document that is printed + to one of psprint's specialized "fax" printers. + </p> + + @param rOrigText + The original text + + @param rNewText + A String that will be filled with the adjusted version + + @param nIndex + The index inside <code>rOrigText</code> that marks the first draw character + + @param rLen + in: length of text beginning at <code>nIndex</code> to be drawn + out: length of <code>rNewText</code> containing the substituted text + + @param rCutStart + out: index at which the cutout portion of <code>rOrigText</code> begins + + @param rCutStop + out: index at which the cutout portion of <code>rOrigText</code> ends + + @returns + true: a substitution has taken place and rNewText rLen, rCutStart and rCutStop have been filled accordingly + false: no substitution has taken place, rNewText, rLen, rCutStart, rCutStop remain unchanged + */ + virtual bool filterText( const String& rOrigText, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop ); + + virtual bool supportsOperation( OutDevSupportType ) const = 0; + + // mirroring specifica + int GetLayout() { return m_nLayout; } + void SetLayout( int aLayout ) { m_nLayout = aLayout;} + + void mirror( long& nX, const OutputDevice *pOutDev, bool bBack = false ) const; + void mirror( long& nX, long& nWidth, const OutputDevice *pOutDev, bool bBack = false ) const; + BOOL mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev, bool bBack = false ) const; + void mirror( Rectangle& rRect, const OutputDevice*, bool bBack = false ) const; + void mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack = false ) const; + void mirror( ControlType,const ImplControlValue&,const OutputDevice*,bool bBack = false) const; + basegfx::B2DPoint mirror( const basegfx::B2DPoint& i_rPoint, const OutputDevice *pOutDev, bool bBack = false ) const; + basegfx::B2DPolygon mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; + basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; + + // non virtual methods; these do eventual coordinate mirroring and + // then delegate to protected virtual methods + BOOL UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ); + BOOL UnionClipRegion( const ::basegfx::B2DPolyPolygon&, const OutputDevice* ); + + // draw --> LineColor and FillColor and RasterOp and ClipRegion + void DrawPixel( long nX, long nY, const OutputDevice *pOutDev ); + void DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ); + void DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ); + void DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ); + void DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ); + void DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ); + void DrawPolyPolygon( sal_uInt32 nPoly, + const sal_uInt32* pPoints, + PCONSTSALPOINT* pPtAry, + const OutputDevice *pOutDev ); + bool DrawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency, const OutputDevice* ); + bool DrawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, const OutputDevice* ); + sal_Bool DrawPolyLineBezier( ULONG nPoints, + const SalPoint* pPtAry, + const BYTE* pFlgAry, + const OutputDevice *pOutDev ); + sal_Bool DrawPolygonBezier( ULONG nPoints, + const SalPoint* pPtAry, + const BYTE* pFlgAry, + const OutputDevice *pOutDev ); + sal_Bool DrawPolyPolygonBezier( sal_uInt32 nPoly, + const sal_uInt32* pPoints, + const SalPoint* const* pPtAry, + const BYTE* const* pFlgAry, + const OutputDevice *pOutDev ); + + // CopyArea --> No RasterOp, but ClipRegion + void CopyArea( long nDestX, + long nDestY, + long nSrcX, + long nSrcY, + long nSrcWidth, + long nSrcHeight, + USHORT nFlags, + const OutputDevice *pOutDev ); + + // CopyBits and DrawBitmap --> RasterOp and ClipRegion + // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics + void CopyBits( const SalTwoRect* pPosAry, + SalGraphics* pSrcGraphics, + const OutputDevice *pOutDev, + const OutputDevice *pSrcOutDev ); + void DrawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + const OutputDevice *pOutDev ); + void DrawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nTransparentColor, + const OutputDevice *pOutDev ); + void DrawBitmap( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + const SalBitmap& rTransparentBitmap, + const OutputDevice *pOutDev ); + + void DrawMask( const SalTwoRect* pPosAry, + const SalBitmap& rSalBitmap, + SalColor nMaskColor, + const OutputDevice *pOutDev ); + + SalBitmap* GetBitmap( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ); + SalColor GetPixel( long nX, long nY, const OutputDevice *pOutDev ); + + // invert --> ClipRegion (only Windows) + void Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice *pOutDev ); + void Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ); + + BOOL DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize, const OutputDevice *pOutDev ); + + //------------------------------------- + // Native Widget Rendering functions + //------------------------------------- + + // Query the platform layer for control support + virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + // Query the native control to determine if it was acted upon + BOOL HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + const Point& aPos, + BOOL& rIsInside, + const OutputDevice *pOutDev ); + + // Request rendering of a particular control and/or part + BOOL DrawNativeControl( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const rtl::OUString& aCaption, + const OutputDevice *pOutDev ); + + // Request rendering of a caption string for a control + BOOL DrawNativeControlText( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const rtl::OUString& aCaption, + const OutputDevice *pOutDev ); + + // Query the native control's actual drawing region (including adornment) + BOOL GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Rectangle& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + const rtl::OUString& aCaption, + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion, + const OutputDevice *pOutDev ); + + static void AddDevFontSubstitute( OutputDevice* pOutDev, + const String& rFontName, + const String& rReplaceFontName, + USHORT nFlags = 0 ); + + bool DrawAlphaBitmap( const SalTwoRect&, + const SalBitmap& rSourceBitmap, + const SalBitmap& rAlphaBitmap, + const OutputDevice *pOutDev ); + + bool DrawAlphaRect( long nX, long nY, long nWidth, long nHeight, + sal_uInt8 nTransparency, const OutputDevice *pOutDev ); + + virtual SystemGraphicsData GetGraphicsData() const = 0; + virtual SystemFontData GetSysFontData( int nFallbacklevel ) const = 0; +}; + +#endif // _SV_SALGDI_HXX diff --git a/vcl/inc/vcl/salgeom.hxx b/vcl/inc/vcl/salgeom.hxx new file mode 100644 index 000000000000..3d59e6199fa7 --- /dev/null +++ b/vcl/inc/vcl/salgeom.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_SALGEOM_HXX +#define _SV_SALGEOM_HXX + +typedef struct _SalFrameGeometry { + // screen position of upper left corner of drawable area in pixel + long nX, nY; + // dimensions of the drawable area in pixel + unsigned long nWidth, nHeight; + // thickness of the decoration in pixel + unsigned long nLeftDecoration, + nTopDecoration, + nRightDecoration, + nBottomDecoration; + unsigned int nScreenNumber; + + _SalFrameGeometry() : + nX( 0 ), nY( 0 ), nWidth( 1 ), nHeight( 1 ), + nLeftDecoration( 0 ), nTopDecoration( 0 ), + nRightDecoration( 0 ), nBottomDecoration( 0 ), + nScreenNumber( 0 ) + {} +} SalFrameGeometry; + +#endif // _SV_SALGEOM_HXX diff --git a/vcl/inc/vcl/salgtype.hxx b/vcl/inc/vcl/salgtype.hxx new file mode 100644 index 000000000000..f70a5c532f73 --- /dev/null +++ b/vcl/inc/vcl/salgtype.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_SALGTYPE_HXX +#define _SV_SALGTYPE_HXX + +#include <vcl/sv.h> + +// ------------ +// - SalColor - +// ------------ + +typedef UINT32 SalColor; +#define MAKE_SALCOLOR( r, g, b ) ((SalColor)(((UINT32)((UINT8)(b))))|(((UINT32)((UINT8)(g)))<<8)|(((UINT32)((UINT8)(r)))<<16)) +#define SALCOLOR_RED( n ) ((UINT8)((n)>>16)) +#define SALCOLOR_GREEN( n ) ((UINT8)(((UINT16)(n)) >> 8)) +#define SALCOLOR_BLUE( n ) ((UINT8)(n)) +#define SALCOLOR_NONE (~(SalColor)0) +// ------------ +// - SalPoint - +// ------------ + +// must equal to class Point +struct SalPoint +{ + long mnX; + long mnY; +}; + +typedef const SalPoint* PCONSTSALPOINT; + +// -------------- +// - SalTwoRect - +// -------------- + +struct SalTwoRect +{ + long mnSrcX; + long mnSrcY; + long mnSrcWidth; + long mnSrcHeight; + long mnDestX; + long mnDestY; + long mnDestWidth; + long mnDestHeight; +}; + +// --------------- +// - SalROPColor - +// --------------- + +typedef USHORT SalROPColor; +#define SAL_ROP_0 ((SalROPColor)0) +#define SAL_ROP_1 ((SalROPColor)1) +#define SAL_ROP_INVERT ((SalROPColor)2) + +// ------------- +// - SalInvert - +// ------------- + +typedef USHORT SalInvert; +#define SAL_INVERT_HIGHLIGHT ((SalInvert)0x0001) +#define SAL_INVERT_50 ((SalInvert)0x0002) +#define SAL_INVERT_TRACKFRAME ((SalInvert)0x0004) + +#endif // _SV_SALGTYPE_HXX diff --git a/vcl/inc/vcl/salimestatus.hxx b/vcl/inc/vcl/salimestatus.hxx new file mode 100644 index 000000000000..779a75c9afaa --- /dev/null +++ b/vcl/inc/vcl/salimestatus.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * 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_SALIMESTATUS_HXX +#define _SV_SALIMESTATUS_HXX + +#include <vcl/dllapi.h> + +class VCL_DLLPUBLIC SalI18NImeStatus +{ +public: + SalI18NImeStatus() {} + virtual ~SalI18NImeStatus(); + + // asks whether there is a status window available + // to toggle into menubar + virtual bool canToggle() = 0; + virtual void toggle() = 0; +}; + +#endif diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx new file mode 100644 index 000000000000..9b92bf95e3fe --- /dev/null +++ b/vcl/inc/vcl/salinst.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALINST_HXX + +#include "com/sun/star/uno/Reference.hxx" + +#include "vcl/sv.h" +#include "vcl/dllapi.h" + +#include "tools/string.hxx" + +#include "rtl/string.hxx" + +#include <list> + +struct SystemParentData; +struct SalPrinterQueueInfo; +struct SalStatus; +struct ImplJobSetup; +class SalGraphics; +class SalFrame; +class SalObject; +class SalMenu; +class SalMenuItem; +class SalVirtualDevice; +class SalInfoPrinter; +class SalPrinter; +class SalTimer; +class ImplPrnQueueList; +class SalI18NImeStatus; +class SalSystem; +class SalBitmap; +struct SalItemParams; +class SalSession; +struct SystemGraphicsData; +struct SystemWindowData; + +namespace vos { class IMutex; } + +// --------------- +// - SalInstance - +// --------------- + +class VCL_DLLPUBLIC SalInstance +{ +public: + typedef bool(*Callback)(void*,void*,int); +private: + void* m_pEventInst; + void* m_pErrorInst; + Callback m_pEventCallback; + Callback m_pErrorCallback; + +public: + SalInstance() : + m_pEventInst( NULL ), + m_pErrorInst( NULL ), + m_pEventCallback( NULL ), + m_pErrorCallback( NULL ) + {} + virtual ~SalInstance(); + + // Frame + // DisplayName for Unix ??? + virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle ) = 0; + virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle ) = 0; + virtual void DestroyFrame( SalFrame* pFrame ) = 0; + + // Object (System Child Window) + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE ) = 0; + virtual void DestroyObject( SalObject* pObject ) = 0; + + // VirtualDevice + // nDX and nDY in Pixel + // nBitCount: 0 == Default(=as window) / 1 == Mono + // pData allows for using a system dependent graphics or device context + virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, + long nDX, long nDY, + USHORT nBitCount, const SystemGraphicsData *pData = NULL ) = 0; + virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0; + + // Printer + // pSetupData->mpDriverData can be 0 + // pSetupData must be updatet with the current + // JobSetup + virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ) = 0; + virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0; + virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0; + virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0; + + virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0; + virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0; + virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0; + virtual String GetDefaultPrinter() = 0; + + // SalTimer + virtual SalTimer* CreateSalTimer() = 0; + // SalI18NImeStatus + virtual SalI18NImeStatus* CreateI18NImeStatus() = 0; + // SalSystem + virtual SalSystem* CreateSalSystem() = 0; + // SalBitmap + virtual SalBitmap* CreateSalBitmap() = 0; + + // YieldMutex + virtual vos::IMutex* GetYieldMutex() = 0; + virtual ULONG ReleaseYieldMutex() = 0; + virtual void AcquireYieldMutex( ULONG nCount ) = 0; + + // wait next event and dispatch + // must returned by UserEvent (SalFrame::PostEvent) + // and timer + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0; + virtual bool AnyInput( USHORT nType ) = 0; + + // Menues + virtual SalMenu* CreateMenu( BOOL bMenuBar ) = 0; + virtual void DestroyMenu( SalMenu* pMenu) = 0; + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ) = 0; + virtual void DestroyMenuItem( SalMenuItem* pItem ) = 0; + + // may return NULL to disable session management + virtual SalSession* CreateSalSession() = 0; + + // methods for XDisplayConnection + + // the parameters for the callbacks are: + // void* pInst: pInstance form the SetCallback call + // void* pEvent: address of the system specific event structure + // int nBytes: length of the system specific event structure + void SetEventCallback( void* pInstance, Callback pCallback ) + { m_pEventInst = pInstance; m_pEventCallback = pCallback; } + Callback GetEventCallback() const + { return m_pEventCallback; } + bool CallEventCallback( void* pEvent, int nBytes ) + { return m_pEventCallback ? m_pEventCallback( m_pEventInst, pEvent, nBytes ) : false; } + void SetErrorEventCallback( void* pInstance, Callback pCallback ) + { m_pErrorInst = pInstance; m_pErrorCallback = pCallback; } + Callback GetErrorEventCallback() const + { return m_pErrorCallback; } + bool CallErrorCallback( void* pEvent, int nBytes ) + { return m_pErrorCallback ? m_pErrorCallback( m_pErrorInst, pEvent, nBytes ) : false; } + + enum ConnectionIdentifierType { AsciiCString, Blob }; + virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0; + + // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_* + // this is only necessary because PrintFontManager is an exported vcl API and therefore + // needs to be in libvcl while libvclplug_* do not contain exported C++ API + virtual void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); + + // dtrans implementation + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); + virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0; +}; + +// called from SVMain +SalInstance* CreateSalInstance(); +void DestroySalInstance( SalInstance* pInst ); + +// ------------------------- +// - SalInstance-Functions - +// ------------------------- + +void SalAbort( const XubString& rErrorText ); + +VCL_DLLPUBLIC const ::rtl::OUString& SalGetDesktopEnvironment(); + +// ----------- +// - SalData - +// ----------- + +void InitSalData(); // called from Application-Ctor +void DeInitSalData(); // called from Application-Dtor + +void InitSalMain(); +void DeInitSalMain(); + +// ---------- +// - SVMain - +// ---------- + +// Callbacks (indepen in \sv\source\app\svmain.cxx) +VCL_DLLPUBLIC BOOL SVMain(); + +#endif // _SV_SALINST_HXX diff --git a/vcl/inc/vcl/sallayout.hxx b/vcl/inc/vcl/sallayout.hxx new file mode 100755 index 000000000000..e23090c42392 --- /dev/null +++ b/vcl/inc/vcl/sallayout.hxx @@ -0,0 +1,390 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALLAYOUT_HXX + +#include <tools/gen.hxx> + +#include <vector> +namespace basegfx { + class B2DPolyPolygon; + typedef std::vector<B2DPolyPolygon> B2DPolyPolygonVector; +} + +#ifndef _TOOLS_LANG_HXX +typedef unsigned short LanguageType; +#endif + +#include <vector> +#include <list> +#include <vcl/dllapi.h> + +// for typedef sal_UCS4 +#include <vcl/vclenum.hxx> + +class SalGraphics; +class ImplFontData; + +#define MAX_FALLBACK 16 + +// ---------------- +// - LayoutOption - +// ---------------- + +#define SAL_LAYOUT_BIDI_RTL 0x0001 +#define SAL_LAYOUT_BIDI_STRONG 0x0002 +#define SAL_LAYOUT_RIGHT_ALIGN 0x0004 +#define SAL_LAYOUT_KERNING_PAIRS 0x0010 +#define SAL_LAYOUT_KERNING_ASIAN 0x0020 +#define SAL_LAYOUT_VERTICAL 0x0040 +#define SAL_LAYOUT_COMPLEX_DISABLED 0x0100 +#define SAL_LAYOUT_ENABLE_LIGATURES 0x0200 +#define SAL_LAYOUT_SUBSTITUTE_DIGITS 0x0400 +#define SAL_LAYOUT_KASHIDA_JUSTIFICATON 0x0800 +#define SAL_LAYOUT_DISABLE_GLYPH_PROCESSING 0x1000 +#define SAL_LAYOUT_FOR_FALLBACK 0x2000 + +// ----------------- + +// used for managing runs e.g. for BiDi, glyph and script fallback +class VCL_DLLPUBLIC ImplLayoutRuns +{ +private: + int mnRunIndex; + std::vector<int> maRuns; + +public: + ImplLayoutRuns() { mnRunIndex = 0; maRuns.reserve(8); } + + void Clear() { maRuns.clear(); } + bool AddPos( int nCharPos, bool bRTL ); + bool AddRun( int nMinRunPos, int nEndRunPos, bool bRTL ); + + bool IsEmpty() const { return maRuns.empty(); } + void ResetPos() { mnRunIndex = 0; } + void NextRun() { mnRunIndex += 2; } + bool GetRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ) const; + bool GetNextPos( int* nCharPos, bool* bRTL ); + bool PosIsInRun( int nCharPos ) const; + bool PosIsInAnyRun( int nCharPos ) const; +}; + +// ----------------- + +class ImplLayoutArgs +{ +public: + // string related inputs + int mnFlags; + int mnLength; + int mnMinCharPos; + int mnEndCharPos; + const xub_Unicode* mpStr; + + // positioning related inputs + const sal_Int32* mpDXArray; // in pixel units + long mnLayoutWidth; // in pixel units + int mnOrientation; // in 0-3600 system + + // data for bidi and glyph+script fallback + ImplLayoutRuns maRuns; + ImplLayoutRuns maReruns; + +public: + ImplLayoutArgs( const xub_Unicode* pStr, int nLength, + int nMinCharPos, int nEndCharPos, int nFlags ); + + void SetLayoutWidth( long nWidth ) { mnLayoutWidth = nWidth; } + void SetDXArray( const sal_Int32* pDXArray ) { mpDXArray = pDXArray; } + void SetOrientation( int nOrientation ) { mnOrientation = nOrientation; } + + void ResetPos() + { maRuns.ResetPos(); } + bool GetNextPos( int* nCharPos, bool* bRTL ) + { return maRuns.GetNextPos( nCharPos, bRTL ); } + bool GetNextRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ); + bool NeedFallback( int nCharPos, bool bRTL ) + { return maReruns.AddPos( nCharPos, bRTL ); } + bool NeedFallback( int nMinRunPos, int nEndRunPos, bool bRTL ) + { return maReruns.AddRun( nMinRunPos, nEndRunPos, bRTL ); } + // methods used by BiDi and glyph fallback + bool NeedFallback() const + { return !maReruns.IsEmpty(); } + bool PrepareFallback(); + +protected: + void AddRun( int nMinCharPos, int nEndCharPos, bool bRTL ); +}; + +// helper functions often used with ImplLayoutArgs +bool IsDiacritic( sal_UCS4 ); +int GetVerticalFlags( sal_UCS4 ); +sal_UCS4 GetVerticalChar( sal_UCS4 ); +// #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx +// VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 ); +sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType ); +VCL_DLLPUBLIC const char* GetAutofallback( sal_UCS4 ) ; + +// ------------- +// - SalLayout - +// ------------- + +typedef sal_uInt32 sal_GlyphId; + +// Glyph Flags +#define GF_NONE 0x00000000 +#define GF_FLAGMASK 0xFF800000 +#define GF_IDXMASK ~GF_FLAGMASK +#define GF_ISCHAR 0x00800000 +#define GF_ROTL 0x01000000 +// caution !!! +#define GF_VERT 0x02000000 +// GF_VERT is only for windows implementation +// (win/source/gdi/salgdi3.cxx, win/source/gdi/winlayout.cxx) +// don't use this elsewhere !!! +#define GF_ROTR 0x03000000 +#define GF_ROTMASK 0x03000000 +#define GF_UNHINTED 0x04000000 +#define GF_GSUB 0x08000000 +#define GF_FONTMASK 0xF0000000 +#define GF_FONTSHIFT 28 + +#define GF_DROPPED 0xFFFFFFFF + +// all positions/widths are in font units +// one exception: drawposition is in pixel units + +class VCL_DLLPUBLIC SalLayout +{ +public: + // used by upper layers + Point& DrawBase() { return maDrawBase; } + const Point& DrawBase() const { return maDrawBase; } + Point& DrawOffset() { return maDrawOffset; } + const Point& DrawOffset() const { return maDrawOffset; } + Point GetDrawPosition( const Point& rRelative = Point(0,0) ) const; + + virtual bool LayoutText( ImplLayoutArgs& ) = 0; // first step of layouting + virtual void AdjustLayout( ImplLayoutArgs& ); // adjusting after fallback etc. + virtual void InitFont() const {} + virtual void DrawText( SalGraphics& ) const = 0; + + int GetUnitsPerPixel() const { return mnUnitsPerPixel; } + int GetOrientation() const { return mnOrientation; } + + virtual const ImplFontData* GetFallbackFontData( sal_GlyphId ) const; + + // methods using string indexing + virtual int GetTextBreak( long nMaxWidth, long nCharExtra=0, int nFactor=1 ) const = 0; + virtual long FillDXArray( sal_Int32* pDXArray ) const = 0; + virtual long GetTextWidth() const { return FillDXArray( NULL ); } + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0; + virtual bool IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594 + + // methods using glyph indexing + virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdAry, Point& rPos, int&, + sal_Int32* pGlyphAdvAry = NULL, int* pCharPosAry = NULL ) const = 0; + virtual bool GetOutline( SalGraphics&, ::basegfx::B2DPolyPolygonVector& ) const; + virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const; + + virtual bool IsSpacingGlyph( sal_GlyphId ) const; + + // reference counting + void Reference() const; + void Release() const; + + // used by glyph+font+script fallback + virtual void MoveGlyph( int nStart, long nNewXPos ) = 0; + virtual void DropGlyph( int nStart ) = 0; + virtual void Simplify( bool bIsBase ) = 0; + virtual void DisableGlyphInjection( bool /*bDisable*/ ) {} + +protected: + // used by layout engines + SalLayout(); + virtual ~SalLayout(); + + // used by layout layers + void SetUnitsPerPixel( int n ) { mnUnitsPerPixel = n; } + void SetOrientation( int nOrientation ) // in 0-3600 system + { mnOrientation = nOrientation; } + + static int CalcAsianKerning( sal_UCS4, bool bLeft, bool bVertical ); + +private: + // enforce proper copy semantic + SAL_DLLPRIVATE SalLayout( const SalLayout& ); + SAL_DLLPRIVATE SalLayout& operator=( const SalLayout& ); + +protected: + int mnMinCharPos; + int mnEndCharPos; + int mnLayoutFlags; + + int mnUnitsPerPixel; + int mnOrientation; + + mutable int mnRefCount; + mutable Point maDrawOffset; + Point maDrawBase; +}; + +// ------------------ +// - MultiSalLayout - +// ------------------ + +class VCL_DLLPUBLIC MultiSalLayout : public SalLayout +{ +public: + virtual void DrawText( SalGraphics& ) const; + virtual int GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const; + virtual long FillDXArray( sal_Int32* pDXArray ) const; + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const; + virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos, + int&, sal_Int32* pGlyphAdvAry, int* pCharPosAry ) const; + virtual bool GetOutline( SalGraphics&, ::basegfx::B2DPolyPolygonVector& ) const; + virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const; + + // used only by OutputDevice::ImplLayout, TODO: make friend + MultiSalLayout( SalLayout& rBaseLayout, + const ImplFontData* pBaseFont = NULL ); + virtual bool AddFallback( SalLayout& rFallbackLayout, + ImplLayoutRuns&, const ImplFontData* pFallbackFont ); + virtual bool LayoutText( ImplLayoutArgs& ); + virtual void AdjustLayout( ImplLayoutArgs& ); + virtual void InitFont() const; + + virtual const ImplFontData* GetFallbackFontData( sal_GlyphId ) const; + + void SetInComplete(bool bInComplete = true); + +protected: + virtual ~MultiSalLayout(); + +private: + // dummy implementations + virtual void MoveGlyph( int, long ) {} + virtual void DropGlyph( int ) {} + virtual void Simplify( bool ) {} + + // enforce proper copy semantic + SAL_DLLPRIVATE MultiSalLayout( const MultiSalLayout& ); + SAL_DLLPRIVATE MultiSalLayout& operator=( const MultiSalLayout& ); + +private: + SalLayout* mpLayouts[ MAX_FALLBACK ]; + const ImplFontData* mpFallbackFonts[ MAX_FALLBACK ]; + ImplLayoutRuns maFallbackRuns[ MAX_FALLBACK ]; + int mnLevel; + bool mbInComplete; +}; + +// -------------------- +// - GenericSalLayout - +// -------------------- + +struct GlyphItem +{ + int mnFlags; + int mnCharPos; // index in string + int mnOrigWidth; // original glyph width + int mnNewWidth; // width after adjustments + sal_GlyphId mnGlyphIndex; + Point maLinearPos; // absolute position of non rotated string + +public: + GlyphItem() {} + + GlyphItem( int nCharPos, sal_GlyphId nGlyphIndex, const Point& rLinearPos, + long nFlags, int nOrigWidth ) + : mnFlags(nFlags), mnCharPos(nCharPos), + mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth), + mnGlyphIndex(nGlyphIndex), maLinearPos(rLinearPos) + {} + + enum{ FALLBACK_MASK=0xFF, IS_IN_CLUSTER=0x100, IS_RTL_GLYPH=0x200, IS_DIACRITIC=0x400 }; + + bool IsClusterStart() const { return ((mnFlags & IS_IN_CLUSTER) == 0); } + bool IsRTLGlyph() const { return ((mnFlags & IS_RTL_GLYPH) != 0); } + bool IsDiacritic() const { return ((mnFlags & IS_DIACRITIC) != 0); } +}; + +// --------------- + +typedef std::list<GlyphItem> GlyphList; +typedef std::vector<GlyphItem> GlyphVector; + +// --------------- + +class VCL_DLLPUBLIC GenericSalLayout : public SalLayout +{ +public: + // used by layout engines + void AppendGlyph( const GlyphItem& ); + virtual void AdjustLayout( ImplLayoutArgs& ); + virtual void ApplyDXArray( ImplLayoutArgs& ); + virtual void Justify( long nNewWidth ); + void KashidaJustify( long nIndex, int nWidth ); + void ApplyAsianKerning( const sal_Unicode*, int nLength ); + void SortGlyphItems(); + + // used by upper layers + virtual long GetTextWidth() const; + virtual long FillDXArray( sal_Int32* pDXArray ) const; + virtual int GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const; + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const; + + // used by display layers + virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos, int&, + sal_Int32* pGlyphAdvAry = NULL, int* pCharPosAry = NULL ) const; + +protected: + GenericSalLayout(); + virtual ~GenericSalLayout(); + + // for glyph+font+script fallback + virtual void MoveGlyph( int nStart, long nNewXPos ); + virtual void DropGlyph( int nStart ); + virtual void Simplify( bool bIsBase ); + + bool GetCharWidths( sal_Int32* pCharWidths ) const; + +private: + GlyphItem* mpGlyphItems; // TODO: change to GlyphList + int mnGlyphCount; + int mnGlyphCapacity; + mutable Point maBasePoint; + + // enforce proper copy semantic + SAL_DLLPRIVATE GenericSalLayout( const GenericSalLayout& ); + SAL_DLLPRIVATE GenericSalLayout& operator=( const GenericSalLayout& ); +}; + +#undef SalGraphics + +#endif // _SV_SALLAYOUT_HXX diff --git a/vcl/inc/vcl/salmenu.hxx b/vcl/inc/vcl/salmenu.hxx new file mode 100644 index 000000000000..cc0438c4e177 --- /dev/null +++ b/vcl/inc/vcl/salmenu.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALMENU_HXX + +#include <vcl/sv.h> +#include "vcl/dllapi.h" +#include <vcl/menu.hxx> +#include <vcl/keycod.hxx> +#include <vcl/image.hxx> + +struct SystemMenuData; +class FloatingWindow; +class SalFrame; + +struct SalItemParams +{ + USHORT nId; // item Id + MenuItemType eType; // MenuItem-Type + MenuItemBits nBits; // MenuItem-Bits + Menu* pMenu; // Pointer to Menu + XubString aText; // Menu-Text + Image aImage; // Image +}; + + +struct SalMenuButtonItem +{ + USHORT mnId; + Image maImage; + rtl::OUString maToolTipText; + + SalMenuButtonItem() : mnId( 0 ) {} + SalMenuButtonItem( USHORT i_nId, const Image& rImg, const rtl::OUString& i_rTTText = rtl::OUString() ) + : mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {} +}; + +class VCL_DLLPUBLIC SalMenuItem +{ +public: + SalMenuItem() {} + virtual ~SalMenuItem(); +}; + +class VCL_DLLPUBLIC SalMenu +{ +public: + SalMenu() {} + virtual ~SalMenu(); + + virtual BOOL VisibleMenuBar() = 0; // 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 ) = 0; + virtual void RemoveItem( unsigned nPos ) = 0; + virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0; + virtual void SetFrame( const SalFrame* pFrame ) = 0; + virtual void CheckItem( unsigned nPos, BOOL bCheck ) = 0; + virtual void EnableItem( unsigned nPos, BOOL bEnable ) = 0; + virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText )= 0; + virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0; + virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) = 0; + virtual void GetSystemMenuData( SystemMenuData* pData ) = 0; + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, ULONG nFlags); + virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure + virtual void RemoveMenuBarButton( USHORT nId ); + + // return an empty rectangle if not implemented + // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented + // but rectangle cannot be determined + virtual Rectangle GetMenuBarButtonRectPixel( USHORT i_nItemId, SalFrame* i_pReferenceFrame ); +}; + + +#endif // _SV_SALMENU_HXX + diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx new file mode 100644 index 000000000000..19c34cbc5e34 --- /dev/null +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -0,0 +1,453 @@ +/************************************************************************* + * + * 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_NATIVEWIDGETS_HXX +#define _SV_NATIVEWIDGETS_HXX + +#include <rtl/ustring.hxx> +#include <vcl/dllapi.h> +#include <tools/gen.hxx> + +/* Control Types: + * + * Specify the overall, whole control + * type (as opposed to parts of the + * control if it were composite). + */ + +typedef sal_uInt32 ControlType; + +// for use in general purpose ImplControlValue +#define CTRL_GENERIC 0 + +// Normal PushButton/Command Button +#define CTRL_PUSHBUTTON 1 + +// Normal single radio button +#define CTRL_RADIOBUTTON 2 + +// Normal single checkbox +#define CTRL_CHECKBOX 10 + +// Combobox, i.e. a ListBox +// that allows data entry by user +#define CTRL_COMBOBOX 20 + +// Control that allows text entry +#define CTRL_EDITBOX 30 + +// Control that allows text entry, but without the usual border +// Has to be handled separately, because this one cannot handle +// HAS_BACKGROUND_TEXTURE, which is drawn in the edit box'es +// border window. +#define CTRL_EDITBOX_NOBORDER 31 + +// Control that allows text entry +// ( some systems distingish between single and multi line edit boxes ) +#define CTRL_MULTILINE_EDITBOX 32 + +// Control that pops up a menu, +// but does NOT allow data entry +#define CTRL_LISTBOX 35 + +// An edit field together with two little +// buttons on the side (aka spin field) +#define CTRL_SPINBOX 40 + +// Two standalone spin buttons +// without an edit field +#define CTRL_SPINBUTTONS 45 + +// A single tab +#define CTRL_TAB_ITEM 50 + +// The border around a tab area, +// but without the tabs themselves. +// May have a gap at the top for +// the active tab +#define CTRL_TAB_PANE 55 + +// Background of a Tab Pane +#define CTRL_TAB_BODY 56 + +// Normal scrollbar, including +// all parts like slider, buttons +#define CTRL_SCROLLBAR 60 + +#define CTRL_SLIDER 65 + +// Border around a group of related +// items, perhaps also displaying +// a label of identification +#define CTRL_GROUPBOX 70 + +// A separator line +#define CTRL_FIXEDLINE 80 + +// A rectangular border, like a +// Tab Pane, but without the +// possible gap for a tab +#define CTRL_FIXEDBORDER 90 + +// A toolbar control with buttons and a grip +#define CTRL_TOOLBAR 100 + +// The menubar +#define CTRL_MENUBAR 120 +// popup menu +#define CTRL_MENU_POPUP 121 + +// The statusbar +#define CTRL_STATUSBAR 130 +#define CTRL_PROGRESS 131 +// Progress bar for the intro window +// (aka splash screen), in case some +// wants native progress bar in the +// application but not for the splash +// screen (used in desktop/) +#define CTRL_INTROPROGRESS 132 + +// tool tips +#define CTRL_TOOLTIP 140 + +// to draw the implemented theme +#define CTRL_WINDOW_BACKGROUND 150 + +//to draw border of frames natively +#define CTRL_FRAME 160 + +// for nodes in listviews +// used in svtools/source/contnr/svtreebx.cxx +#define CTRL_LISTNODE 170 +// nets between elements of listviews +// with nodes +#define CTRL_LISTNET 171 + + +/* Control Parts: + * + * Uniquely identify a part of a control, + * for example the slider of a scroll bar. + */ + +typedef sal_uInt32 ControlPart; + +#define PART_ENTIRE_CONTROL 1 +#define PART_WINDOW 5 // the static listbox window containing the list +#define PART_BUTTON 100 +#define PART_BUTTON_UP 101 +#define PART_BUTTON_DOWN 102 // Also for ComboBoxes/ListBoxes +#define PART_BUTTON_LEFT 103 +#define PART_BUTTON_RIGHT 104 +#define PART_ALL_BUTTONS 105 +#define PART_TRACK_HORZ_LEFT 200 +#define PART_TRACK_VERT_UPPER 201 +#define PART_TRACK_HORZ_RIGHT 202 +#define PART_TRACK_VERT_LOWER 203 +#define PART_TRACK_HORZ_AREA 204 +#define PART_TRACK_VERT_AREA 205 +#define PART_THUMB_HORZ 210 // Also used as toolbar grip +#define PART_THUMB_VERT 211 // Also used as toolbar grip +#define PART_MENU_ITEM 250 +#define PART_MENU_ITEM_CHECK_MARK 251 +#define PART_MENU_ITEM_RADIO_MARK 252 + +/* #i77549# + HACK: for scrollbars in case of thumb rect, page up and page down rect we + abuse the HitTestNativeControl interface. All theming engines but aqua + are actually able to draw the thumb according to our internal representation. + However aqua draws a little outside. The canonical way would be to enhance the + HitTestNativeControl passing a ScrollbarValue additionally so all necessary + information is available in the call. + . + However since there is only this one small exception we will deviate a little and + instead pass the respective rect as control region to allow for a small correction. + + So all places using HitTestNativeControl on PART_THUMB_HORZ, PART_THUMB_VERT, + PART_TRACK_HORZ_LEFT, PART_TRACK_HORZ_RIGHT, PART_TRACK_VERT_UPPER, PART_TRACK_VERT_LOWER + do not use the control rectangle as region but the actuall part rectangle, making + only small deviations feasible. +*/ + +/** The edit field part of a control, e.g. of the combo box. + + Currently used just for combo boxes and just for GetNativeControlRegion(). + It is valid only if GetNativeControlRegion() supports PART_BUTTON_DOWN as + well. +*/ +#define PART_SUB_EDIT 300 + +// For controls that require the entire background +// to be drawn first, and then other pieces over top. +// (GTK+ scrollbars for example). Control region passed +// in to draw this part is expected to be the entire +// area of the control. +// A control may respond to one or both. +#define PART_DRAW_BACKGROUND_HORZ 1000 +#define PART_DRAW_BACKGROUND_VERT 1001 + +// GTK+ also draws tabs right->left since there is a +// hardcoded 2 pixel overlap between adjacent tabs +#define PART_TABS_DRAW_RTL 3000 + +// For themes that do not want to have the focus +// rectangle part drawn by VCL but take care of the +// whole inner control part by themselves +// eg, listboxes or comboboxes or spinbuttons +#define HAS_BACKGROUND_TEXTURE 4000 + +// For scrollbars that have 3 buttons (most KDE themes) +#define HAS_THREE_BUTTONS 5000 + +#define PART_BACKGROUND_WINDOW 6000 +#define PART_BACKGROUND_DIALOG 6001 + +//to draw natively the border of frames +#define PART_BORDER 7000 + +/* Control State: + * + * Specify how a particular part of the control + * is to be drawn. Constants are bitwise OR-ed + * together to compose a final drawing state. + * A _disabled_ state is assumed by the drawing + * functions until an ENABLED or HIDDEN is passed + * in the ControlState. + */ + +typedef sal_uInt32 ControlState; + +#define CTRL_STATE_ENABLED 0x0001 +#define CTRL_STATE_FOCUSED 0x0002 +#define CTRL_STATE_PRESSED 0x0004 +#define CTRL_STATE_ROLLOVER 0x0008 +#define CTRL_STATE_HIDDEN 0x0010 +#define CTRL_STATE_DEFAULT 0x0020 +#define CTRL_STATE_SELECTED 0x0040 +#define CTRL_CACHING_ALLOWED 0x8000 // set when the control is completely visible (i.e. not clipped) + +/* ButtonValue: + * + * Identifies the tri-state value options + * that buttons allow + */ + +enum ButtonValue { + BUTTONVALUE_DONTKNOW, + BUTTONVALUE_ON, + BUTTONVALUE_OFF, + BUTTONVALUE_MIXED +}; + +/* ImplControlValue: + * + * Generic value container for all control parts. + */ + +class VCL_DLLPUBLIC ImplControlValue +{ + friend class SalFrame; + + private: + ControlType mType; + ButtonValue mTristate; // Tristate value: on, off, mixed + long mNumber; // numeric value + protected: + ImplControlValue( ControlType i_eType, ButtonValue i_eTriState, long i_nNumber ) + : mType( i_eType ) + , mTristate( i_eTriState ) + , mNumber( i_nNumber ) + {} + + public: + explicit ImplControlValue( ButtonValue nTristate ) + : mType( CTRL_GENERIC ), mTristate(nTristate), mNumber(0) {} + explicit ImplControlValue( long nNumeric ) + : mType( CTRL_GENERIC ), mTristate(BUTTONVALUE_DONTKNOW), mNumber( nNumeric) {} + inline ImplControlValue() + : mType( CTRL_GENERIC ), mTristate(BUTTONVALUE_DONTKNOW), mNumber(0) {} + + virtual ~ImplControlValue(); + + ControlType getType() const { return mType; } + + inline ButtonValue getTristateVal( void ) const { return mTristate; } + inline void setTristateVal( ButtonValue nTristate ) { mTristate = nTristate; } + + inline long getNumericVal( void ) const { return mNumber; } + inline void setNumericVal( long nNumeric ) { mNumber = nNumeric; } +}; + +/* ScrollbarValue: + * + * Value container for scrollbars. + */ + class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue +{ + public: + long mnMin; + long mnMax; + long mnCur; + long mnVisibleSize; + Rectangle maThumbRect; + Rectangle maButton1Rect; + Rectangle maButton2Rect; + ControlState mnButton1State; + ControlState mnButton2State; + ControlState mnThumbState; + ControlState mnPage1State; + ControlState mnPage2State; + + inline ScrollbarValue() + : ImplControlValue( CTRL_SCROLLBAR, BUTTONVALUE_DONTKNOW, 0 ) + { + mnMin = 0; mnMax = 0; mnCur = 0; mnVisibleSize = 0; + mnButton1State = 0; mnButton2State = 0; + mnThumbState = 0; mnPage1State = 0; mnPage2State = 0; + }; + virtual ~ScrollbarValue(); +}; + +class VCL_DLLPUBLIC SliderValue : public ImplControlValue +{ + public: + long mnMin; + long mnMax; + long mnCur; + Rectangle maThumbRect; + ControlState mnThumbState; + + SliderValue() + : ImplControlValue( CTRL_SLIDER, BUTTONVALUE_DONTKNOW, 0 ) + , mnMin( 0 ), mnMax( 0 ), mnCur( 0 ), mnThumbState( 0 ) + {} + virtual ~SliderValue(); +}; + +/* TabitemValue: + * + * Value container for tabitems. + */ + +/* TABITEM constants are OR-ed together */ +#define TABITEM_NOTALIGNED 0x000 // the tabitem is an inner item +#define TABITEM_LEFTALIGNED 0x001 // the tabitem is aligned with the left border of the TabControl +#define TABITEM_RIGHTALIGNED 0x002 // the tabitem is aligned with the right border of the TabControl +#define TABITEM_FIRST_IN_GROUP 0x004 // the tabitem is the first in group of tabitems +#define TABITEM_LAST_IN_GROUP 0x008 // the tabitem is the last in group of tabitems + +class VCL_DLLPUBLIC TabitemValue : public ImplControlValue +{ + public: + unsigned int mnAlignment; + + inline TabitemValue() + : ImplControlValue( CTRL_TAB_ITEM, BUTTONVALUE_DONTKNOW, 0 ) + { + mnAlignment = 0; + }; + virtual ~TabitemValue(); + + BOOL isLeftAligned() const { return (mnAlignment & TABITEM_LEFTALIGNED) != 0; } + BOOL isRightAligned() const { return (mnAlignment & TABITEM_RIGHTALIGNED) != 0; } + BOOL isBothAligned() const { return isLeftAligned() && isRightAligned(); } + BOOL isNotAligned() const { return (mnAlignment & (TABITEM_LEFTALIGNED | TABITEM_RIGHTALIGNED)) == 0; } + BOOL isFirst() const { return (mnAlignment & TABITEM_FIRST_IN_GROUP) != 0; } + BOOL isLast() const { return (mnAlignment & TABITEM_LAST_IN_GROUP) != 0; } +}; + +/* SpinbuttonValue: + * + * Value container for spinbuttons to paint both buttons at once. + * Note: the other parameters of DrawNativeControl will have no meaning + * all parameters for spinbuttons are carried here + */ +class VCL_DLLPUBLIC SpinbuttonValue : public ImplControlValue +{ + public: + Rectangle maUpperRect; + Rectangle maLowerRect; + ControlState mnUpperState; + ControlState mnLowerState; + int mnUpperPart; + int mnLowerPart; + + inline SpinbuttonValue() + : ImplControlValue( CTRL_SPINBUTTONS, BUTTONVALUE_DONTKNOW, 0 ) + { + mnUpperState = mnLowerState = 0; + }; + virtual ~SpinbuttonValue(); +}; + +/* Toolbarvalue: + * + * Value container for toolbars detailing the grip position + */ +class ToolbarValue : public ImplControlValue +{ +public: + ToolbarValue() : ImplControlValue( CTRL_TOOLBAR, BUTTONVALUE_DONTKNOW, 0 ) + { mbIsTopDockingArea = FALSE; } + virtual ~ToolbarValue(); + Rectangle maGripRect; + BOOL mbIsTopDockingArea; // indicates that this is the top aligned dockingarea + // adjacent to the menubar +}; + +/* MenubarValue: + * + * Value container for menubars specifying height of adjacent docking area + */ +class MenubarValue : public ImplControlValue +{ +public: + MenubarValue() : ImplControlValue( CTRL_MENUBAR, BUTTONVALUE_DONTKNOW, 0 ) + { maTopDockingAreaHeight=0; } + virtual ~MenubarValue(); + int maTopDockingAreaHeight; +}; + +/* PushButtonValue: + * + * Value container for pushbuttons specifying additional drawing hints + */ +class PushButtonValue : public ImplControlValue +{ +public: + PushButtonValue() + : ImplControlValue( CTRL_PUSHBUTTON, BUTTONVALUE_DONTKNOW, 0 ) + , mbBevelButton( false ), mbSingleLine( true ) {} + virtual ~PushButtonValue(); + + bool mbBevelButton:1; + bool mbSingleLine:1; +}; + + +#endif + diff --git a/vcl/inc/vcl/salobj.hxx b/vcl/inc/vcl/salobj.hxx new file mode 100644 index 000000000000..e453bf5c6f87 --- /dev/null +++ b/vcl/inc/vcl/salobj.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALOBJ_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/salgtype.hxx> +#include <vcl/salwtype.hxx> + +struct SystemEnvData; + +// ------------------- +// - SalObject-Types - +// ------------------- + +#define SAL_OBJECT_CLIP_INCLUDERECTS ((USHORT)0x0001) +#define SAL_OBJECT_CLIP_EXCLUDERECTS ((USHORT)0x0002) +#define SAL_OBJECT_CLIP_ABSOLUTE ((USHORT)0x0004) + +// ------------- +// - SalObject - +// ------------- + +class VCL_DLLPUBLIC SalObject +{ + void* m_pInst; + SALOBJECTPROC m_pCallback; + BOOL m_bMouseTransparent:1, + m_bEraseBackground:1; +public: + SalObject() : m_pInst( NULL ), m_pCallback( NULL ), m_bMouseTransparent( FALSE ), m_bEraseBackground( TRUE ) {} + virtual ~SalObject(); + + virtual void ResetClipRegion() = 0; + virtual USHORT GetClipRegionType() = 0; + virtual void BeginSetClipRegion( ULONG nRects ) = 0; + virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual void EndSetClipRegion() = 0; + + virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ) = 0; + virtual void Show( BOOL bVisible ) = 0; + virtual void Enable( BOOL nEnable ) = 0; + virtual void GrabFocus() = 0; + + virtual void SetBackground() = 0; + virtual void SetBackground( SalColor nSalColor ) = 0; + + virtual const SystemEnvData* GetSystemData() const = 0; + + void SetCallback( void* pInst, SALOBJECTPROC pProc ) + { m_pInst = pInst; m_pCallback = pProc; } + long CallCallback( USHORT nEvent, const void* pEvent ) + { return m_pCallback ? m_pCallback( m_pInst, this, nEvent, pEvent ) : 0; } + void SetMouseTransparent( BOOL bMouseTransparent ) + { m_bMouseTransparent = bMouseTransparent; } + BOOL IsMouseTransparent() + { return m_bMouseTransparent; } + void EnableEraseBackground( BOOL bEnable ) + { m_bEraseBackground = bEnable; } + BOOL IsEraseBackgroundEnabled() + { return m_bEraseBackground; } +}; + +#endif // _SV_SALOBJ_HXX diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx new file mode 100644 index 000000000000..19f023108349 --- /dev/null +++ b/vcl/inc/vcl/salprn.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALPRN_HXX + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/prntypes.hxx> + +#include <vector> + +class SalGraphics; +class SalFrame; +struct ImplJobSetup; +namespace vcl { class PrinterController; } + +// ----------------------- +// - SalPrinterQueueInfo - +// ----------------------- + +struct VCL_DLLPUBLIC SalPrinterQueueInfo +{ + XubString maPrinterName; + XubString maDriver; + XubString maLocation; + XubString maComment; + ULONG mnStatus; + ULONG mnJobs; + void* mpSysData; + + SalPrinterQueueInfo(); + ~SalPrinterQueueInfo(); +}; + +// ------------------ +// - SalInfoPrinter - +// ------------------ + +class VCL_DLLPUBLIC SalInfoPrinter +{ +public: + std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats + bool m_bPapersInit; // set to true after InitPaperFormats + bool m_bCompatMetrics; + + SalInfoPrinter() : m_bPapersInit( false ), m_bCompatMetrics( false ) {} + virtual ~SalInfoPrinter(); + + // SalGraphics or NULL, but two Graphics for all SalFrames + // must be returned + virtual SalGraphics* GetGraphics() = 0; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0; + + virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) = 0; + // This function set the driver data and + // set the new indepen data in pSetupData + virtual BOOL SetPrinterData( ImplJobSetup* pSetupData ) = 0; + // This function merged the indepen driver data + // and set the new indepen data in pSetupData + // Only the data must changed, where the bit + // in nFlags is set + virtual BOOL SetData( ULONG nFlags, ImplJobSetup* pSetupData ) = 0; + + virtual void GetPageInfo( const ImplJobSetup* pSetupData, + long& rOutWidth, long& rOutHeight, + long& rPageOffX, long& rPageOffY, + long& rPageWidth, long& rPageHeight ) = 0; + virtual ULONG GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ) = 0; + virtual ULONG GetPaperBinCount( const ImplJobSetup* pSetupData ) = 0; + virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ) = 0; + // fills m_aPaperFormats and sets m_bPapersInit to true + virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0; + // returns angle that a landscape page will be turned counterclockwise wrt to portrait + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0; +}; + +// -------------- +// - SalPrinter - +// -------------- + +class VCL_DLLPUBLIC SalPrinter +{ +public: // public for Sal Implementation + SalPrinter() {} + virtual ~SalPrinter(); + + virtual BOOL StartJob( const String* pFileName, + const String& rJobName, + const String& rAppName, + ULONG nCopies, + bool bCollate, + bool bDirect, + ImplJobSetup* pSetupData ) = 0; + + // implement for pull model print systems only, + // default implementations (see salvtables.cxx) just returns FALSE + virtual BOOL StartJob( const String* pFileName, + const String& rJobName, + const String& rAppName, + ImplJobSetup* pSetupData, + vcl::PrinterController& rController ); + + virtual BOOL EndJob() = 0; + virtual BOOL AbortJob() = 0; + virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) = 0; + virtual BOOL EndPage() = 0; + virtual ULONG GetErrorCode() = 0; + +}; + +#endif // _SV_SALPRN_HXX diff --git a/vcl/inc/vcl/salptype.hxx b/vcl/inc/vcl/salptype.hxx new file mode 100644 index 000000000000..8613ead5301a --- /dev/null +++ b/vcl/inc/vcl/salptype.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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_SALPTYPE_HXX +#define _SV_SALPTYPE_HXX + +#include <vcl/sv.h> + +// -------------------- +// - SalJobSetupFlags - +// -------------------- + +#define SAL_JOBSET_ORIENTATION ((ULONG)0x00000001) +#define SAL_JOBSET_PAPERBIN ((ULONG)0x00000002) +#define SAL_JOBSET_PAPERSIZE ((ULONG)0x00000004) +#define SAL_JOBSET_DUPLEXMODE ((ULONG)0x00000008) +#define SAL_JOBSET_ALL (SAL_JOBSET_ORIENTATION |\ + SAL_JOBSET_PAPERBIN |\ + SAL_JOBSET_PAPERSIZE |\ + SAL_JOBSET_DUPLEXMODE) + +// ------------------- +// - SalPrinterError - +// ------------------- + +#define SAL_PRINTER_ERROR_GENERALERROR 1 +#define SAL_PRINTER_ERROR_ABORT 2 + +// ------------------- +// - SalPrinterProcs - +// ------------------- + +class SalPrinter; +typedef long (*SALPRNABORTPROC)( void* pInst, SalPrinter* pPrinter ); + +#endif // _SV_SALPTYPE_HXX diff --git a/vcl/inc/vcl/salsession.hxx b/vcl/inc/vcl/salsession.hxx new file mode 100644 index 000000000000..2da1ae551074 --- /dev/null +++ b/vcl/inc/vcl/salsession.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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_SALSESSION_HXX +#define _VCL_SALSESSION_HXX + +#include "vcl/dllapi.h" + +enum SalSessionEventType +{ + Interaction, + SaveRequest, + ShutdownCancel, + Quit +}; + +struct SalSessionEvent +{ + SalSessionEventType m_eType; + + SalSessionEvent( SalSessionEventType eType ) + : m_eType( eType ) + {} +}; + +struct SalSessionInteractionEvent : public SalSessionEvent +{ + bool m_bInteractionGranted; + + SalSessionInteractionEvent( bool bGranted ) + : SalSessionEvent( Interaction ), + m_bInteractionGranted( bGranted ) + {} +}; + +struct SalSessionSaveRequestEvent : public SalSessionEvent +{ + bool m_bShutdown; + bool m_bCancelable; + + SalSessionSaveRequestEvent( bool bShutdown, bool bCancelable ) + : SalSessionEvent( SaveRequest ), + m_bShutdown( bShutdown ), + m_bCancelable( bCancelable ) + {} +}; + +struct SalSessionShutdownCancelEvent : public SalSessionEvent +{ + SalSessionShutdownCancelEvent() + : SalSessionEvent( ShutdownCancel ) + {} +}; + +struct SalSessionQuitEvent : public SalSessionEvent +{ + SalSessionQuitEvent() + : SalSessionEvent( Quit ) + {} +}; + +typedef void(*SessionProc)( SalSessionEvent *pEvent); + +class VCL_DLLPUBLIC SalSession +{ + SessionProc m_aProc; +public: + SalSession() + : m_aProc( 0 ) + {} + virtual ~SalSession(); + + void SetCallback( SessionProc aCallback ) + { + m_aProc = aCallback; + } + void CallCallback( SalSessionEvent* pEvent ) + { + if( m_aProc ) + m_aProc( pEvent ); + } + + // query the session manager for a user interaction slot + virtual void queryInteraction() = 0; + // signal the session manager that we're done with user interaction + virtual void interactionDone() = 0; + // signal that we're done saving + virtual void saveDone() = 0; + // try to cancel the sutdown in progress + virtual bool cancelShutdown() = 0; +}; + +#endif diff --git a/vcl/inc/vcl/salsys.hxx b/vcl/inc/vcl/salsys.hxx new file mode 100644 index 000000000000..310b0a27e30f --- /dev/null +++ b/vcl/inc/vcl/salsys.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALSYS_HXX + +#include <tools/string.hxx> +#include <tools/gen.hxx> +#include <vcl/dllapi.h> + + +/* Button combinations for ShowNativeMessageBox +*/ +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK = 0; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL = 1; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE = 2; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL = 3; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO = 4; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL = 5; + +/* Button identifier for ShowNativeMessageBox +*/ +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK = 1; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL = 2; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT = 3; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY = 4; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE = 5; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES = 6; +const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO = 7; + + + +// ------------- +// - SalSystem - +// ------------- + +class VCL_DLLPUBLIC SalSystem +{ +public: + SalSystem() {} + virtual ~SalSystem(); + + // get info about the display + + /* Gets the number of active screens attached to the display + + @returns the number of active screens + */ + virtual unsigned int GetDisplayScreenCount() = 0; + /* Queries whether multiple screens are truly separate + + @returns true if screens are distinct and windows cannot + be moved between them or span multiple of them + false if screens form up one big display + */ + virtual bool IsMultiDisplay() = 0; + /* Queries the default screen number. The default screen is the + screen on which windows will appear if no special positioning + is made. + + @returns the default screen number + */ + virtual unsigned int GetDefaultDisplayNumber() = 0; + /* Gets relative position and size of the screens attached to the display + + @param nScreen + The screen number to be queried + + @returns position: (0,0) in case of IsMultiscreen() == true + else position relative to whole display + size: size of the screen + */ + virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) = 0; + /* Gets position and size of the work area of a screen attached to the display + + @param nScreen + The screen number to be queried + + @returns position and size relative to the scree + */ + virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen ) = 0; + /* Gets the name of a screen + + @param nScreen + The screen number to be queried + + @returns the name of the screen + */ + virtual rtl::OUString GetScreenName( unsigned int nScreen ) = 0; + + /* Shows a native message box with the specified title, message and button + combination. + + @param rTitle + The title to be shown by the dialog box. + + @param rMessage + The message to be shown by the dialog box. + + @param nButtonCombination + Specify which button combination the message box should display. + See button combinations above. + + @param nDefaultButton + Specifies which button has the focus initially. + See button identifiers above. + The effect of specifying a button that doesn't belong + to the specified button combination is undefined. + + @returns the identifier of the button that was pressed by the user. + See button identifier above. If the function fails the + return value is 0. + */ + virtual int ShowNativeMessageBox( const String& rTitle, + const String& rMessage, + int nButtonCombination, + int nDefaultButton) = 0; +}; + +SalSystem* ImplGetSalSystem(); + +#endif // _SV_SALSYS_HXX diff --git a/vcl/inc/vcl/saltimer.hxx b/vcl/inc/vcl/saltimer.hxx new file mode 100644 index 000000000000..d693070138d2 --- /dev/null +++ b/vcl/inc/vcl/saltimer.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALTIMER_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/salwtype.hxx> + +// ------------ +// - SalTimer - +// ------------ + +/* + * note: there will be only a single instance of SalTimer + * SalTimer originally had only static methods, but + * this needed to be virtualized for the sal plugin migration + */ + +class VCL_DLLPUBLIC SalTimer +{ + SALTIMERPROC m_pProc; +public: + SalTimer() : m_pProc( NULL ) {} + virtual ~SalTimer(); + + // AutoRepeat and Restart + virtual void Start( ULONG nMS ) = 0; + virtual void Stop() = 0; + + // Callbacks (indepen in \sv\source\app\timer.cxx) + void SetCallback( SALTIMERPROC pProc ) + { + m_pProc = pProc; + } + + void CallCallback() + { + if( m_pProc ) + m_pProc(); + } +}; + +#endif // _SV_SALTIMER_HXX diff --git a/vcl/inc/vcl/salvd.hxx b/vcl/inc/vcl/salvd.hxx new file mode 100644 index 000000000000..fcbe1fb35383 --- /dev/null +++ b/vcl/inc/vcl/salvd.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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_HXX +#define _SV_SALVD_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +class SalGraphics; + +// -------------------- +// - SalVirtualDevice - +// -------------------- + +class VCL_DLLPUBLIC SalVirtualDevice +{ +public: // public for Sal Implementation + SalVirtualDevice() {} + virtual ~SalVirtualDevice(); + + // SalGraphics or NULL, but two Graphics for all SalVirtualDevices + // must be returned + virtual SalGraphics* GetGraphics() = 0; + virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0; + + // Set new size, without saving the old contents + virtual BOOL SetSize( long nNewDX, long nNewDY ) = 0; + + /// Get actual VDev size in pixel + virtual void GetSize( long& rWidth, long& rHeight ) = 0; +}; + +#endif // _SV_SALVD_HXX diff --git a/vcl/inc/vcl/salwtype.hxx b/vcl/inc/vcl/salwtype.hxx new file mode 100644 index 000000000000..95b3806d648b --- /dev/null +++ b/vcl/inc/vcl/salwtype.hxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * 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_SALWTYPE_HXX +#define _SV_SALWTYPE_HXX + +#include <i18npool/lang.h> +#include <tools/string.hxx> +#include <vcl/sv.h> + +class SalGraphics; +class SalFrame; +class SalObject; +class Window; + +class ImplFontSelectData; + +// --------------- +// - SalExtInput - +// --------------- + +// Muessen mit den Defines in cmdevt.hxx uebereinstimmen, da diese +// nicht konvertiert werden +#define SAL_EXTTEXTINPUT_ATTR_GRAYWAVELINE ((USHORT)0x0100) +#define SAL_EXTTEXTINPUT_ATTR_UNDERLINE ((USHORT)0x0200) +#define SAL_EXTTEXTINPUT_ATTR_BOLDUNDERLINE ((USHORT)0x0400) +#define SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE ((USHORT)0x0800) +#define SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE ((USHORT)0x1000) +#define SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT ((USHORT)0x2000) +#define SAL_EXTTEXTINPUT_ATTR_REDTEXT ((USHORT)0x4000) +#define SAL_EXTTEXTINPUT_ATTR_HALFTONETEXT ((USHORT)0x8000) + +#define SAL_EXTTEXTINPUT_CURSOR_INVISIBLE ((USHORT)0x0001) +#define SAL_EXTTEXTINPUT_CURSOR_OVERWRITE ((USHORT)0x0002) + +// ------------ +// - SalEvent - +// ------------ + +#define SALEVENT_MOUSEMOVE ((USHORT)1) +#define SALEVENT_MOUSELEAVE ((USHORT)2) +#define SALEVENT_MOUSEBUTTONDOWN ((USHORT)3) +#define SALEVENT_MOUSEBUTTONUP ((USHORT)4) +#define SALEVENT_KEYINPUT ((USHORT)5) +#define SALEVENT_KEYUP ((USHORT)6) +#define SALEVENT_KEYMODCHANGE ((USHORT)7) +#define SALEVENT_PAINT ((USHORT)8) +#define SALEVENT_RESIZE ((USHORT)9) +#define SALEVENT_GETFOCUS ((USHORT)10) +#define SALEVENT_LOSEFOCUS ((USHORT)11) +#define SALEVENT_CLOSE ((USHORT)12) +#define SALEVENT_SHUTDOWN ((USHORT)13) +#define SALEVENT_SETTINGSCHANGED ((USHORT)14) +#define SALEVENT_VOLUMECHANGED ((USHORT)15) +#define SALEVENT_PRINTERCHANGED ((USHORT)16) +#define SALEVENT_DISPLAYCHANGED ((USHORT)17) +#define SALEVENT_FONTCHANGED ((USHORT)18) +#define SALEVENT_DATETIMECHANGED ((USHORT)19) +#define SALEVENT_KEYBOARDCHANGED ((USHORT)20) +#define SALEVENT_WHEELMOUSE ((USHORT)21) +#define SALEVENT_USEREVENT ((USHORT)22) +#define SALEVENT_MOUSEACTIVATE ((USHORT)23) +#define SALEVENT_EXTTEXTINPUT ((USHORT)24) +#define SALEVENT_ENDEXTTEXTINPUT ((USHORT)25) +#define SALEVENT_EXTTEXTINPUTPOS ((USHORT)26) +#define SALEVENT_INPUTCONTEXTCHANGE ((USHORT)27) +#define SALEVENT_MOVE ((USHORT)28) +#define SALEVENT_MOVERESIZE ((USHORT)29) +#define SALEVENT_CLOSEPOPUPS ((USHORT)30) +#define SALEVENT_EXTERNALKEYINPUT ((USHORT)31) +#define SALEVENT_EXTERNALKEYUP ((USHORT)32) +#define SALEVENT_MENUCOMMAND ((USHORT)33) +#define SALEVENT_MENUHIGHLIGHT ((USHORT)34) +#define SALEVENT_MENUACTIVATE ((USHORT)35) +#define SALEVENT_MENUDEACTIVATE ((USHORT)36) +#define SALEVENT_EXTERNALMOUSEMOVE ((USHORT)37) +#define SALEVENT_EXTERNALMOUSEBUTTONDOWN ((USHORT)38) +#define SALEVENT_EXTERNALMOUSEBUTTONUP ((USHORT)39) +#define SALEVENT_INPUTLANGUAGECHANGE ((USHORT)40) +#define SALEVENT_SHOWDIALOG ((USHORT)41) +#define SALEVENT_MENUBUTTONCOMMAND ((USHORT)42) +#define SALEVENT_SURROUNDINGTEXTREQUEST ((USHORT)43) +#define SALEVENT_SURROUNDINGTEXTSELECTIONCHANGE ((USHORT)44) +#define SALEVENT_STARTRECONVERSION ((USHORT)45) +#define SALEVENT_COUNT ((USHORT)45) + +// MOUSELEAVE must send, when the pointer leave the client area and +// the mouse is not captured +// MOUSEMOVE, MOUSELEAVE, MOUSEBUTTONDOWN and MOUSEBUTTONUP +// MAC: Ctrl+Button is MOUSE_RIGHT +struct SalMouseEvent +{ + ULONG mnTime; // Time in ms, when event is created + long mnX; // X-Position (Pixel, TopLeft-Output) + long mnY; // Y-Position (Pixel, TopLeft-Output) + USHORT mnButton; // 0-MouseMove/MouseLeave, MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE + USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT) +}; + +// KEYINPUT and KEYUP +struct SalKeyEvent +{ + ULONG mnTime; // Time in ms, when event is created + USHORT mnCode; // SV-KeyCode (KEY_xxx | KEY_SHIFT | KEY_MOD1 | KEY_MOD2) + USHORT mnCharCode; // SV-CharCode + USHORT mnRepeat; // Repeat-Count (KeyInputs-1) +}; + +// MENUEVENT +struct SalMenuEvent +{ + USHORT mnId; // Menu item ID + void* mpMenu; // pointer to VCL menu (class Menu) + + SalMenuEvent() : mnId( 0 ), mpMenu( NULL ) {} + SalMenuEvent( USHORT i_nId, void* i_pMenu ) + : mnId( i_nId ), mpMenu( i_pMenu ) {} +}; + +// KEYMODCHANGE +struct SalKeyModEvent +{ + ULONG mnTime; // Time in ms, when event is created + USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) + USHORT mnModKeyCode; // extended Modifier (MODKEY_LEFT, MODKEY_RIGHT, MODKEY_PRESS, MODKEY_RELEASE) +}; + +// PAINT +struct SalPaintEvent +{ + long mnBoundX; // BoundRect - X + long mnBoundY; // BoundRect - Y + long mnBoundWidth; // BoundRect - Width + long mnBoundHeight; // BoundRect - Height + bool mbImmediateUpdate; // set to true to force an immediate update + + SalPaintEvent( long x, long y, long w, long h, bool bImmediate = false ) : + mnBoundX( x ), mnBoundY( y ), + mnBoundWidth( w ), mnBoundHeight( h ), + mbImmediateUpdate( bImmediate ) + {} +}; + +// USEREVENT +// pEvent == pData + +// WHEELMOUSE +#define SAL_WHEELMOUSE_EVENT_PAGESCROLL ((ULONG)0xFFFFFFFF) +struct SalWheelMouseEvent +{ + ULONG mnTime; // Time in ms, when event is created + long mnX; // X-Position (Pixel, TopLeft-Output) + long mnY; // Y-Position (Pixel, TopLeft-Output) + long mnDelta; // Anzahl Drehungen + long mnNotchDelta; // Anzahl feste Drehungen + ULONG mnScrollLines; // Aktuelle Anzahl zu scrollende Zeilen + USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT) + BOOL mbHorz; // Horizontal + BOOL mbDeltaIsPixel; // delta value is a pixel value (on mac) + + SalWheelMouseEvent() + : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( FALSE ), mbDeltaIsPixel( FALSE ) + {} +}; + +// MOUSEACTIVATE +struct SalMouseActivateEvent +{ + long mnX; // X-Position (Pixel, TopLeft-Output) + long mnY; // Y-Position (Pixel, TopLeft-Output) +}; + +#ifdef __cplusplus + +// EXTTEXTINPUT +struct SalExtTextInputEvent +{ + ULONG mnTime; // Time in ms, when event is created + UniString maText; // Text + const USHORT* mpTextAttr; // Text-Attribute + ULONG mnCursorPos; // Cursor-Position + ULONG mnDeltaStart; // Start-Position der letzten Aenderung + BYTE mnCursorFlags; // SAL_EXTTEXTINPUT_CURSOR_xxx + BOOL mbOnlyCursor; // TRUE: Nur Cursor-Position wurde geaendert +}; + +#endif // __cplusplus + +// EXTTEXTINPUTPOS +struct SalExtTextInputPosEvent +{ + long mnX; // Cursor-X-Position to upper left corner of frame + long mnY; // Cursor-Y-Position to upper left corner of frame + long mnWidth; // Cursor-Width in Pixel + long mnHeight; // Cursor-Height in Pixel + long mnExtWidth; // Width of the PreEdit area + bool mbVertical; // true if in vertical mode +}; + +#ifdef __cplusplus + +// INPUTCONTEXTCHANGE +struct SalInputContextChangeEvent +{ + LanguageType meLanguage; // Neue Sprache +}; + +#endif // __cplusplus + +#ifdef __cplusplus + +// SURROUNDINGTEXTREQUEST +struct SalSurroundingTextRequestEvent +{ + UniString maText; // Text + ULONG mnStart; // The beggining index of selected range + ULONG mnEnd; // The end index of selected range +}; + +#endif // __cplusplus + +#ifdef __cplusplus + +// SURROUNDINGTEXTSELECTIONCHANGE +struct SalSurroundingTextSelectionChangeEvent +{ + ULONG mnStart; // The beggining index of selected range + ULONG mnEnd; // The end index of selected range +}; + +#endif // __cplusplus + +// ------------------ +// - SalFrame-Types - +// ------------------ + +typedef long (*SALFRAMEPROC)( Window* pInst, SalFrame* pFrame, + USHORT nEvent, const void* pEvent ); + +// -------------------- +// - SalObject-Events - +// -------------------- + +#define SALOBJ_EVENT_GETFOCUS ((USHORT)1) +#define SALOBJ_EVENT_LOSEFOCUS ((USHORT)2) +#define SALOBJ_EVENT_TOTOP ((USHORT)3) +#define SALOBJ_EVENT_COUNT ((USHORT)4) + +// ------------------ +// - SalObject-Types - +// ------------------ + +typedef long (*SALOBJECTPROC)( void* pInst, SalObject* pObject, + USHORT nEvent, const void* pEvent ); + +// ----------------- +// - SalFrameState - +// ----------------- + +// Must be the same as in syswin.hxx +#define SAL_FRAMESTATE_MASK_X ((ULONG)0x00000001) +#define SAL_FRAMESTATE_MASK_Y ((ULONG)0x00000002) +#define SAL_FRAMESTATE_MASK_WIDTH ((ULONG)0x00000004) +#define SAL_FRAMESTATE_MASK_HEIGHT ((ULONG)0x00000008) +#define SAL_FRAMESTATE_MASK_MAXIMIZED_X ((ULONG)0x00000100) +#define SAL_FRAMESTATE_MASK_MAXIMIZED_Y ((ULONG)0x00000200) +#define SAL_FRAMESTATE_MASK_MAXIMIZED_WIDTH ((ULONG)0x00000400) +#define SAL_FRAMESTATE_MASK_MAXIMIZED_HEIGHT ((ULONG)0x00000800) +#define SAL_FRAMESTATE_MASK_STATE ((ULONG)0x00000010) + +#define SAL_FRAMESTATE_NORMAL ((ULONG)0x00000001) +#define SAL_FRAMESTATE_MINIMIZED ((ULONG)0x00000002) +#define SAL_FRAMESTATE_MAXIMIZED ((ULONG)0x00000004) +#define SAL_FRAMESTATE_ROLLUP ((ULONG)0x00000008) +#define SAL_FRAMESTATE_MAXIMIZED_HORZ ((ULONG)0x00000010) +#define SAL_FRAMESTATE_MAXIMIZED_VERT ((ULONG)0x00000020) +#define SAL_FRAMESTATE_SYSTEMMASK ((ULONG)0x0000FFFF) + +struct SalFrameState +{ + ULONG mnMask; + long mnX; + long mnY; + long mnWidth; + long mnHeight; + long mnMaximizedX; + long mnMaximizedY; + long mnMaximizedWidth; + long mnMaximizedHeight; + ULONG mnState; +}; + +// ------------------- +// - SalInputContext - +// ------------------- + +// Muessen mit den Defines in inputctx.hxx uebereinstimmen, da diese +// nicht konvertiert werden +#define SAL_INPUTCONTEXT_TEXT ((ULONG)0x00000001) +#define SAL_INPUTCONTEXT_EXTTEXTINPUT ((ULONG)0x00000002) +#define SAL_INPUTCONTEXT_EXTTEXTINPUT_ON ((ULONG)0x00000004) +#define SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF ((ULONG)0x00000008) +#define SAL_INPUTCONTEXT_CHANGELANGUAGE ((ULONG)0x00000010) + +#ifdef __cplusplus + +struct SalInputContext +{ + ImplFontSelectData* mpFont; + LanguageType meLanguage; + ULONG mnOptions; +}; + +#endif // __cplusplus + +// ------------------ +// - SalTimer-Types - +// ------------------ + +typedef void (*SALTIMERPROC)(); + +#endif // _SV_SALWTYPE_HXX diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx new file mode 100644 index 000000000000..f993cb7304e4 --- /dev/null +++ b/vcl/inc/vcl/scrbar.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * 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_SCRBAR_HXX +#define _SV_SCRBAR_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> + +class AutoTimer; + +// ------------------- +// - ScrollBar-Types - +// ------------------- + +enum ScrollType { SCROLL_DONTKNOW, SCROLL_LINEUP, SCROLL_LINEDOWN, + SCROLL_PAGEUP, SCROLL_PAGEDOWN, SCROLL_DRAG, SCROLL_SET }; + +// ------------- +// - ScrollBar - +// ------------- +struct ImplScrollBarData; + +class VCL_DLLPUBLIC ScrollBar : public Control +{ +private: + Rectangle maBtn1Rect; + Rectangle maBtn2Rect; + Rectangle maPage1Rect; + Rectangle maPage2Rect; + Rectangle maThumbRect; + ImplScrollBarData* mpData; + long mnStartPos; + long mnMouseOff; + long mnThumbPixRange; + long mnThumbPixPos; + long mnThumbPixSize; + long mnMinRange; + long mnMaxRange; + long mnThumbPos; + long mnVisibleSize; + long mnLineSize; + long mnPageSize; + long mnDelta; + USHORT mnDragDraw; + USHORT mnStateFlags; + ScrollType meScrollType; + ScrollType meDDScrollType; + BOOL mbCalcSize; + BOOL mbFullDrag; + Link maScrollHdl; + Link maEndScrollHdl; + + SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitStyle( WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplUpdateRects( BOOL bUpdate = TRUE ); + SAL_DLLPRIVATE long ImplCalcThumbPos( long nPixPos ); + SAL_DLLPRIVATE long ImplCalcThumbPosPix( long nPos ); + SAL_DLLPRIVATE void ImplCalc( BOOL bUpdate = TRUE ); + SAL_DLLPRIVATE void ImplDraw( USHORT nDrawFlags, OutputDevice* pOutDev ); + using Window::ImplScroll; + SAL_DLLPRIVATE long ImplScroll( long nNewPos, BOOL bCallEndScroll ); + SAL_DLLPRIVATE long ImplDoAction( BOOL bCallEndScroll ); + SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, BOOL bCallAction = TRUE ); + SAL_DLLPRIVATE void ImplInvert(); + SAL_DLLPRIVATE BOOL ImplDrawNative( USHORT nDrawFlags ); + SAL_DLLPRIVATE void ImplDragThumb( const Point& rMousePos ); + DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer* ); + DECL_DLLPRIVATE_LINK( ImplAutoTimerHdl, AutoTimer* ); + +public: + ScrollBar( Window* pParent, WinBits nStyle = WB_VERT ); + ScrollBar( Window* pParent, const ResId& rResId ); + ~ScrollBar(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + + using Window::Scroll; + virtual void Scroll(); + virtual void EndScroll(); + + long DoScroll( long nNewPos ); + long DoScrollAction( ScrollType eScrollType ); + + void EnableDrag( BOOL bEnable = TRUE ) + { mbFullDrag = bEnable; } + BOOL IsDragEnabled() const { return mbFullDrag; } + + void SetRangeMin( long nNewRange ); + long GetRangeMin() const { return mnMinRange; } + void SetRangeMax( long nNewRange ); + long GetRangeMax() const { return mnMaxRange; } + void SetRange( const Range& rRange ); + Range GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); } + void SetThumbPos( long nThumbPos ); + long GetThumbPos() const { return mnThumbPos; } + void SetLineSize( long nNewSize ) { mnLineSize = nNewSize; } + long GetLineSize() const { return mnLineSize; } + void SetPageSize( long nNewSize ) { mnPageSize = nNewSize; } + long GetPageSize() const { return mnPageSize; } + void SetVisibleSize( long nNewSize ); + long GetVisibleSize() const { return mnVisibleSize; } + + long GetDelta() const { return mnDelta; } + ScrollType GetType() const { return meScrollType; } + + void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; } + const Link& GetScrollHdl() const { return maScrollHdl; } + void SetEndScrollHdl( const Link& rLink ) { maEndScrollHdl = rLink; } + const Link& GetEndScrollHdl() const { return maEndScrollHdl; } +}; + +// ---------------- +// - ScrollBarBox - +// ---------------- + +class VCL_DLLPUBLIC ScrollBarBox : public Window +{ +private: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + +public: + ScrollBarBox( Window* pParent, WinBits nStyle = 0 ); + ScrollBarBox( Window* pParent, const ResId& rResId ); + + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; + +#endif // _SV_SCRBAR_HXX diff --git a/vcl/inc/vcl/seleng.hxx b/vcl/inc/vcl/seleng.hxx new file mode 100644 index 000000000000..65539c947778 --- /dev/null +++ b/vcl/inc/vcl/seleng.hxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * 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_SELENG_HXX +#define _SV_SELENG_HXX + +#include <vcl/dllapi.h> +#include <vcl/timer.hxx> +#include <vcl/event.hxx> + +class Window; +class CommandEvent; + +// Timerticks +#define SELENG_DRAGDROP_TIMEOUT 400 +#define SELENG_AUTOREPEAT_INTERVAL 50 + +enum SelectionMode { NO_SELECTION, SINGLE_SELECTION, RANGE_SELECTION, MULTIPLE_SELECTION }; + +// --------------- +// - FunctionSet - +// --------------- + +class VCL_DLLPUBLIC FunctionSet +{ +public: + virtual void BeginDrag() = 0; + + virtual void CreateAnchor() = 0; // Anker-Pos := Cursor-Pos + virtual void DestroyAnchor() = 0; + + // Cursor neu setzen, dabei die beim Anker beginnende + // Selektion der neuen Cursor-Position anpassen. TRUE == Ok + virtual BOOL SetCursorAtPoint( const Point& rPointPixel, + BOOL bDontSelectAtCursor = FALSE ) = 0; + + virtual BOOL IsSelectionAtPoint( const Point& rPointPixel ) = 0; + virtual void DeselectAtPoint( const Point& rPointPixel ) = 0; + // Anker loeschen & alles deselektieren + virtual void DeselectAll() = 0; +}; + +// ------------------- +// - SelectionEngine - +// ------------------- + +#define SELENG_DRG_ENAB 0x0001 +#define SELENG_IN_SEL 0x0002 +#define SELENG_IN_ADD 0x0004 +#define SELENG_ADD_ALW 0x0008 +#define SELENG_IN_DRG 0x0010 +#define SELENG_HAS_ANCH 0x0020 +#define SELENG_CMDEVT 0x0040 +#define SELENG_WAIT_UPEVT 0x0080 +#define SELENG_EXPANDONMOVE 0x0100 + +class VCL_DLLPUBLIC SelectionEngine +{ +private: + FunctionSet* pFunctionSet; + Window* pWin; + Rectangle aArea; + Timer aWTimer; // erzeugt kuenstliche Mouse-Moves + MouseEvent aLastMove; + SelectionMode eSelMode; + // Stufigkeit fuer Mausbewegungen waehrend einer Selektion + USHORT nMouseSensitivity; + USHORT nLockedMods; + USHORT nFlags; +//#if 0 // _SOLAR__PRIVATE + DECL_DLLPRIVATE_LINK( ImpWatchDog, Timer * ); +//#endif + + inline BOOL ShouldDeselect( BOOL bModifierKey1 ) const; + // determines to deselect or not when Ctrl-key is pressed on CursorPosChanging +public: + + SelectionEngine( Window* pWindow, + FunctionSet* pFunctions = NULL ); + ~SelectionEngine(); + + // TRUE: Event wurde von Selection-Engine verarbeitet. + BOOL SelMouseButtonDown( const MouseEvent& rMEvt ); + BOOL SelMouseButtonUp( const MouseEvent& rMEvt ); + BOOL SelMouseMove( const MouseEvent& rMEvt ); + + // Tastatur + void CursorPosChanging( BOOL bShift, BOOL bMod1 ); + + // wird benoetigt, um bei ausserhalb des Bereichs stehender + // Maus ueber einen Timer Move-Events zu erzeugen + void SetVisibleArea( const Rectangle rNewArea ) + { aArea = rNewArea; } + const Rectangle& GetVisibleArea() const { return aArea; } + + void SetAddMode( BOOL); + BOOL IsAddMode() const; + + void AddAlways( BOOL bOn ); + BOOL IsAlwaysAdding() const; + + void EnableDrag( BOOL bOn ); + BOOL IsDragEnabled() const; + void ActivateDragMode(); + BOOL IsInDragMode() const; + + void SetSelectionMode( SelectionMode eMode ); + SelectionMode GetSelectionMode() const { return eSelMode; } + + void SetFunctionSet( FunctionSet* pFuncs ) + { pFunctionSet = pFuncs; } + const FunctionSet* GetFunctionSet() const { return pFunctionSet; } + + void SetMouseSensitivity( USHORT nSensitivity ) + { nMouseSensitivity = nSensitivity; } + USHORT GetMouseSensitivity() const + { return nMouseSensitivity; } + + const Point& GetMousePosPixel() const + { return aLastMove.GetPosPixel(); } + const MouseEvent& GetMouseEvent() const { return aLastMove; } + + void SetWindow( Window*); + Window* GetWindow() const { return pWin; } + + void LockModifiers( USHORT nModifiers ) + { nLockedMods = nModifiers; } + USHORT GetLockedModifiers() const { return nLockedMods; } + + BOOL IsInSelection() const; + void Reset(); + + void Command( const CommandEvent& rCEvt ); + + BOOL HasAnchor() const; + void SetAnchor( BOOL bAnchor ); + + // wird im Ctor eingeschaltet + void ExpandSelectionOnMouseMove( BOOL bExpand = TRUE ) + { + if( bExpand ) + nFlags |= SELENG_EXPANDONMOVE; + else + nFlags &= ~SELENG_EXPANDONMOVE; + } +}; + +inline BOOL SelectionEngine::IsDragEnabled() const +{ + if ( nFlags & SELENG_DRG_ENAB ) + return TRUE; + else + return FALSE; +} + +inline BOOL SelectionEngine::IsAddMode() const +{ + if ( nFlags & (SELENG_IN_ADD | SELENG_ADD_ALW) ) + return TRUE; + else + return FALSE; +} + +inline void SelectionEngine::SetAddMode( BOOL bNewMode ) +{ + if ( bNewMode ) + nFlags |= SELENG_IN_ADD; + else + nFlags &= (~SELENG_IN_ADD); +} + +inline void SelectionEngine::EnableDrag( BOOL bOn ) +{ + if ( bOn ) + nFlags |= SELENG_DRG_ENAB; + else + nFlags &= (~SELENG_DRG_ENAB); +} + +inline void SelectionEngine::AddAlways( BOOL bOn ) +{ + if( bOn ) + nFlags |= SELENG_ADD_ALW; + else + nFlags &= (~SELENG_ADD_ALW); +} + +inline BOOL SelectionEngine::IsAlwaysAdding() const +{ + if ( nFlags & SELENG_ADD_ALW ) + return TRUE; + else + return FALSE; +} + +inline BOOL SelectionEngine::IsInDragMode() const +{ + if ( nFlags & SELENG_IN_DRG ) + return TRUE; + else + return FALSE; +} + +inline BOOL SelectionEngine::IsInSelection() const +{ + if ( nFlags & SELENG_IN_SEL ) + return TRUE; + else + return FALSE; +} + +inline BOOL SelectionEngine::HasAnchor() const +{ + if ( nFlags & SELENG_HAS_ANCH ) + return TRUE; + else + return FALSE; +} + +inline void SelectionEngine::SetAnchor( BOOL bAnchor ) +{ + if ( bAnchor ) + nFlags |= SELENG_HAS_ANCH; + else + nFlags &= (~SELENG_HAS_ANCH); +} + +#endif // _SV_SELENG_HXX + diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx new file mode 100644 index 000000000000..24fd30750501 --- /dev/null +++ b/vcl/inc/vcl/settings.hxx @@ -0,0 +1,1298 @@ +/************************************************************************* + * + * 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_SETTINGS_HXX +#define _SV_SETTINGS_HXX + +#include "vcl/sv.h" +#include "vcl/dllapi.h" +#include "tools/color.hxx" +#include "vcl/font.hxx" +#include "vcl/accel.hxx" +#include "vcl/wall.hxx" +#include "com/sun/star/lang/Locale.hpp" +#include <unotools/syslocale.hxx> + +class CollatorWrapper; +class LocaleDataWrapper; + +namespace vcl { + class I18nHelper; +} + +// ------------------- +// - ImplMachineData - +// ------------------- + +class ImplMachineData +{ + friend class MachineSettings; + + ImplMachineData(); + ImplMachineData( const ImplMachineData& rData ); + +private: + ULONG mnRefCount; + ULONG mnOptions; + ULONG mnScreenOptions; + ULONG mnPrintOptions; + long mnScreenRasterFontDeviation; +}; + +// ------------------- +// - MachineSettings - +// ------------------- + +class VCL_DLLPUBLIC MachineSettings +{ + void CopyData(); + +private: + ImplMachineData* mpData; + +public: + MachineSettings(); + MachineSettings( const MachineSettings& rSet ); + ~MachineSettings(); + + void SetOptions( ULONG nOptions ) + { CopyData(); mpData->mnOptions = nOptions; } + ULONG GetOptions() const + { return mpData->mnOptions; } + void SetScreenOptions( ULONG nOptions ) + { CopyData(); mpData->mnScreenOptions = nOptions; } + ULONG GetScreenOptions() const + { return mpData->mnScreenOptions; } + void SetPrintOptions( ULONG nOptions ) + { CopyData(); mpData->mnPrintOptions = nOptions; } + ULONG GetPrintOptions() const + { return mpData->mnPrintOptions; } + + void SetScreenRasterFontDeviation( long nDeviation ) + { CopyData(); mpData->mnScreenRasterFontDeviation = nDeviation; } + long GetScreenRasterFontDeviation() const + { return mpData->mnScreenRasterFontDeviation; } + + const MachineSettings& operator =( const MachineSettings& rSet ); + + BOOL operator ==( const MachineSettings& rSet ) const; + BOOL operator !=( const MachineSettings& rSet ) const + { return !(*this == rSet); } +}; + +// ----------------- +// - ImplMouseData - +// ----------------- + +class ImplMouseData +{ + friend class MouseSettings; + + ImplMouseData(); + ImplMouseData( const ImplMouseData& rData ); + +private: + ULONG mnRefCount; + ULONG mnOptions; + ULONG mnDoubleClkTime; + long mnDoubleClkWidth; + long mnDoubleClkHeight; + long mnStartDragWidth; + long mnStartDragHeight; + USHORT mnStartDragCode; + USHORT mnDragMoveCode; + USHORT mnDragCopyCode; + USHORT mnDragLinkCode; + USHORT mnContextMenuCode; + USHORT mnContextMenuClicks; + BOOL mbContextMenuDown; + ULONG mnScrollRepeat; + ULONG mnButtonStartRepeat; + ULONG mnButtonRepeat; + ULONG mnActionDelay; + ULONG mnMenuDelay; + ULONG mnFollow; + USHORT mnMiddleButtonAction; + USHORT mnWheelBehavior; + BOOL mbAlign1; +}; + +// ----------------- +// - MouseSettings - +// ----------------- + +#define MOUSE_OPTION_AUTOFOCUS ((ULONG)0x00000001) +#define MOUSE_OPTION_AUTOCENTERPOS ((ULONG)0x00000002) +#define MOUSE_OPTION_AUTODEFBTNPOS ((ULONG)0x00000004) + +#define MOUSE_FOLLOW_MENU ((ULONG)0x00000001) +#define MOUSE_FOLLOW_DDLIST ((ULONG)0x00000002) + +#define MOUSE_MIDDLE_NOTHING ((USHORT)0) +#define MOUSE_MIDDLE_AUTOSCROLL ((USHORT)1) +#define MOUSE_MIDDLE_PASTESELECTION ((USHORT)2) + +#define MOUSE_WHEEL_DISABLE ((USHORT)0) +#define MOUSE_WHEEL_FOCUS_ONLY ((USHORT)1) +#define MOUSE_WHEEL_ALWAYS ((USHORT)2) + +class VCL_DLLPUBLIC MouseSettings +{ + void CopyData(); + +private: + ImplMouseData* mpData; + +public: + MouseSettings(); + MouseSettings( const MouseSettings& rSet ); + ~MouseSettings(); + + void SetOptions( ULONG nOptions ) + { CopyData(); mpData->mnOptions = nOptions; } + ULONG GetOptions() const + { return mpData->mnOptions; } + + void SetDoubleClickTime( ULONG nDoubleClkTime ) + { CopyData(); mpData->mnDoubleClkTime = nDoubleClkTime; } + ULONG GetDoubleClickTime() const + { return mpData->mnDoubleClkTime; } + void SetDoubleClickWidth( long nDoubleClkWidth ) + { CopyData(); mpData->mnDoubleClkWidth = nDoubleClkWidth; } + long GetDoubleClickWidth() const + { return mpData->mnDoubleClkWidth; } + void SetDoubleClickHeight( long nDoubleClkHeight ) + { CopyData(); mpData->mnDoubleClkHeight = nDoubleClkHeight; } + long GetDoubleClickHeight() const + { return mpData->mnDoubleClkHeight; } + + void SetStartDragWidth( long nDragWidth ) + { CopyData(); mpData->mnStartDragWidth = nDragWidth; } + long GetStartDragWidth() const + { return mpData->mnStartDragWidth; } + void SetStartDragHeight( long nDragHeight ) + { CopyData(); mpData->mnStartDragHeight = nDragHeight; } + long GetStartDragHeight() const + { return mpData->mnStartDragHeight; } + void SetStartDragCode( USHORT nCode ) + { CopyData(); mpData->mnStartDragCode = nCode; } + USHORT GetStartDragCode() const + { return mpData->mnStartDragCode; } + void SetDragMoveCode( USHORT nCode ) + { CopyData(); mpData->mnDragMoveCode = nCode; } + USHORT GetDragMoveCode() const + { return mpData->mnDragMoveCode; } + void SetDragCopyCode( USHORT nCode ) + { CopyData(); mpData->mnDragCopyCode = nCode; } + USHORT GetDragCopyCode() const + { return mpData->mnDragCopyCode; } + void SetDragLinkCode( USHORT nCode ) + { CopyData(); mpData->mnDragLinkCode = nCode; } + USHORT GetDragLinkCode() const + { return mpData->mnDragLinkCode; } + + void SetContextMenuCode( USHORT nCode ) + { CopyData(); mpData->mnContextMenuCode = nCode; } + USHORT GetContextMenuCode() const + { return mpData->mnContextMenuCode; } + void SetContextMenuClicks( USHORT nClicks ) + { CopyData(); mpData->mnContextMenuClicks = nClicks; } + USHORT GetContextMenuClicks() const + { return mpData->mnContextMenuClicks; } + void SetContextMenuDown( BOOL bDown ) + { CopyData(); mpData->mbContextMenuDown = bDown; } + BOOL GetContextMenuDown() const + { return mpData->mbContextMenuDown; } + + void SetScrollRepeat( ULONG nRepeat ) + { CopyData(); mpData->mnScrollRepeat = nRepeat; } + ULONG GetScrollRepeat() const + { return mpData->mnScrollRepeat; } + void SetButtonStartRepeat( ULONG nRepeat ) + { CopyData(); mpData->mnButtonStartRepeat = nRepeat; } + ULONG GetButtonStartRepeat() const + { return mpData->mnButtonStartRepeat; } + void SetButtonRepeat( ULONG nRepeat ) + { CopyData(); mpData->mnButtonRepeat = nRepeat; } + ULONG GetButtonRepeat() const + { return mpData->mnButtonRepeat; } + void SetActionDelay( ULONG nDelay ) + { CopyData(); mpData->mnActionDelay = nDelay; } + ULONG GetActionDelay() const + { return mpData->mnActionDelay; } + void SetMenuDelay( ULONG nDelay ) + { CopyData(); mpData->mnMenuDelay = nDelay; } + ULONG GetMenuDelay() const + { return mpData->mnMenuDelay; } + + void SetFollow( ULONG nFollow ) + { CopyData(); mpData->mnFollow = nFollow; } + ULONG GetFollow() const + { return mpData->mnFollow; } + + void SetMiddleButtonAction( USHORT nAction ) + { CopyData(); mpData->mnMiddleButtonAction = nAction; } + USHORT GetMiddleButtonAction() const + { return mpData->mnMiddleButtonAction; } + + void SetWheelBehavior( USHORT nBehavior ) + { CopyData(); mpData->mnWheelBehavior = nBehavior; } + USHORT GetWheelBehavior() const + { return mpData->mnWheelBehavior; } + + const MouseSettings& operator =( const MouseSettings& rSet ); + + BOOL operator ==( const MouseSettings& rSet ) const; + BOOL operator !=( const MouseSettings& rSet ) const + { return !(*this == rSet); } +}; + +// -------------------- +// - ImplKeyboardData - +// -------------------- + +class ImplKeyboardData +{ + friend class KeyboardSettings; + + ImplKeyboardData(); + ImplKeyboardData( const ImplKeyboardData& rData ); + +private: + ULONG mnRefCount; + Accelerator maStandardAccel; + ULONG mnOptions; +}; + +// -------------------- +// - KeyboardSettings - +// -------------------- + +#define KEYBOARD_OPTION_QUICKCURSOR ((ULONG)0x00000001) + +class VCL_DLLPUBLIC KeyboardSettings +{ + void CopyData(); + +private: + ImplKeyboardData* mpData; + +public: + KeyboardSettings(); + KeyboardSettings( const KeyboardSettings& rSet ); + ~KeyboardSettings(); + + void SetStandardAccel( const Accelerator& rAccelerator ) + { CopyData(); mpData->maStandardAccel = rAccelerator; } + const Accelerator& GetStandardAccel() const + { return mpData->maStandardAccel; } + + void SetOptions( ULONG nOptions ) + { CopyData(); mpData->mnOptions = nOptions; } + ULONG GetOptions() const + { return mpData->mnOptions; } + + const KeyboardSettings& operator =( const KeyboardSettings& rSet ); + + BOOL operator ==( const KeyboardSettings& rSet ) const; + BOOL operator !=( const KeyboardSettings& rSet ) const + { return !(*this == rSet); } +}; + +// ----------------- +// - ImplStyleData - +// ----------------- + +class ImplStyleData +{ + friend class StyleSettings; + + ImplStyleData(); + ImplStyleData( const ImplStyleData& rData ); + void SetStandardStyles(); + +private: + ULONG mnRefCount; + + void* mpStyleData_NotUsedYet; + + Color maActiveBorderColor; + Color maActiveColor; + Color maActiveColor2; + Color maActiveTextColor; + Color maButtonTextColor; + Color maButtonRolloverTextColor; + Color maCheckedColor; + Color maDarkShadowColor; + Color maDeactiveBorderColor; + Color maDeactiveColor; + Color maDeactiveColor2; + Color maDeactiveTextColor; + Color maDialogColor; + Color maDialogTextColor; + Color maDisableColor; + Color maFaceColor; + Color maFieldColor; + Color maFieldTextColor; + Color maFieldRolloverTextColor; + Color maFontColor; + Color maGroupTextColor; + Color maHelpColor; + Color maHelpTextColor; + Color maHighlightColor; + Color maHighlightLinkColor; + Color maHighlightTextColor; + Color maInfoTextColor; + Color maLabelTextColor; + Color maLightBorderColor; + Color maLightColor; + Color maLinkColor; + Color maMenuBarColor; + Color maMenuBorderColor; + Color maMenuColor; + Color maMenuHighlightColor; + Color maMenuHighlightTextColor; + Color maMenuTextColor; + Color maMenuBarTextColor; + Color maMonoColor; + Color maRadioCheckTextColor; + Color maShadowColor; + Color maVisitedLinkColor; + Color maWindowColor; + Color maWindowTextColor; + Color maWorkspaceColor; + Color maActiveTabColor; + Color maInactiveTabColor; + Font maAppFont; + Font maHelpFont; + Font maTitleFont; + Font maFloatTitleFont; + Font maMenuFont; + Font maToolFont; + Font maLabelFont; + Font maInfoFont; + Font maRadioCheckFont; + Font maPushButtonFont; + Font maFieldFont; + Font maIconFont; + Font maGroupFont; + long mnBorderSize; + long mnTitleHeight; + long mnFloatTitleHeight; + long mnTearOffTitleHeight; + long mnScrollBarSize; + long mnSplitSize; + long mnSpinSize; + long mnCursorSize; + long mnMenuBarHeight; + long mnIconHorzSpace; + long mnIconVertSpace; + long mnAntialiasedMin; + ULONG mnCursorBlinkTime; + ULONG mnDragFullOptions; + ULONG mnAnimationOptions; + ULONG mnSelectionOptions; + ULONG mnLogoDisplayTime; + ULONG mnDisplayOptions; + ULONG mnToolbarIconSize; + ULONG mnUseFlatMenues; + ULONG mnOptions; + USHORT mnScreenZoom; + USHORT mnScreenFontZoom; + USHORT mnRadioButtonStyle; + USHORT mnCheckBoxStyle; + USHORT mnPushButtonStyle; + USHORT mnTabControlStyle; + USHORT mnHighContrast; + USHORT mnUseSystemUIFonts; + USHORT mnAutoMnemonic; + USHORT mnUseImagesInMenus; + ULONG mnUseFlatBorders; + long mnMinThumbSize; + ULONG mnSymbolsStyle; + ULONG mnPreferredSymbolsStyle; + USHORT mnSkipDisabledInMenus; + Wallpaper maWorkspaceGradient; + const void* mpFontOptions; +}; + +#define DEFAULT_WORKSPACE_GRADIENT_START_COLOR Color( 0xa3, 0xae, 0xb8 ) +#define DEFAULT_WORKSPACE_GRADIENT_END_COLOR Color( 0x73, 0x7e, 0x88 ) + +// ----------------- +// - StyleSettings - +// ----------------- + +#define STYLE_OPTION_MONO ((ULONG)0x00000001) +#define STYLE_OPTION_COLOR ((ULONG)0x00000002) +#define STYLE_OPTION_FLAT ((ULONG)0x00000004) +#define STYLE_OPTION_GREAT ((ULONG)0x00000008) +#define STYLE_OPTION_HIGHLIGHT ((ULONG)0x00000010) +#define STYLE_OPTION_ADVANCEDUSER ((ULONG)0x00000020) +#define STYLE_OPTION_SCROLLARROW ((ULONG)0x00000040) +#define STYLE_OPTION_SPINARROW ((ULONG)0x00000080) +#define STYLE_OPTION_SPINUPDOWN ((ULONG)0x00000100) +#define STYLE_OPTION_NOMNEMONICS ((ULONG)0x00000200) +#define STYLE_OPTION_WINSTYLE ((ULONG)0x00010000) +#define STYLE_OPTION_OS2STYLE ((ULONG)0x00020000) +#define STYLE_OPTION_MACSTYLE ((ULONG)0x00040000) +#define STYLE_OPTION_UNIXSTYLE ((ULONG)0x00080000) +#define STYLE_OPTION_SYSTEMSTYLE ((ULONG)0x000F0000) +#define STYLE_OPTION_HIDEDISABLED ((ULONG)0x00100000) + +#define DRAGFULL_OPTION_WINDOWMOVE ((ULONG)0x00000001) +#define DRAGFULL_OPTION_WINDOWSIZE ((ULONG)0x00000002) +#define DRAGFULL_OPTION_OBJECTMOVE ((ULONG)0x00000004) +#define DRAGFULL_OPTION_OBJECTSIZE ((ULONG)0x00000008) +#define DRAGFULL_OPTION_DOCKING ((ULONG)0x00000010) +#define DRAGFULL_OPTION_SPLIT ((ULONG)0x00000020) +#define DRAGFULL_OPTION_SCROLL ((ULONG)0x00000040) + +#define LOGO_DISPLAYTIME_NOLOGO ((ULONG)0) +#define LOGO_DISPLAYTIME_STARTTIME ((ULONG)0xFFFFFFFF) + +#define ANIMATION_OPTION_MINIMIZE ((ULONG)0x00000001) +#define ANIMATION_OPTION_POPUP ((ULONG)0x00000002) +#define ANIMATION_OPTION_DIALOG ((ULONG)0x00000004) +#define ANIMATION_OPTION_TREE ((ULONG)0x00000008) +#define ANIMATION_OPTION_SCROLL ((ULONG)0x00000010) + +#define SELECTION_OPTION_WORD ((ULONG)0x00000001) +#define SELECTION_OPTION_FOCUS ((ULONG)0x00000002) +#define SELECTION_OPTION_INVERT ((ULONG)0x00000004) +#define SELECTION_OPTION_SHOWFIRST ((ULONG)0x00000008) + +#define DISPLAY_OPTION_AA_DISABLE ((ULONG)0x00000001) + +#define STYLE_RADIOBUTTON_WIN ((USHORT)0x0001) +#define STYLE_RADIOBUTTON_OS2 ((USHORT)0x0002) +#define STYLE_RADIOBUTTON_MAC ((USHORT)0x0003) +#define STYLE_RADIOBUTTON_UNIX ((USHORT)0x0004) +#define STYLE_RADIOBUTTON_MONO ((USHORT)0x0005) +#define STYLE_RADIOBUTTON_STYLE ((USHORT)0x000F) + +#define STYLE_CHECKBOX_WIN ((USHORT)0x0001) +#define STYLE_CHECKBOX_OS2 ((USHORT)0x0002) +#define STYLE_CHECKBOX_MAC ((USHORT)0x0003) +#define STYLE_CHECKBOX_UNIX ((USHORT)0x0004) +#define STYLE_CHECKBOX_MONO ((USHORT)0x0005) +#define STYLE_CHECKBOX_STYLE ((USHORT)0x000F) + +#define STYLE_PUSHBUTTON_WIN ((USHORT)0x0001) +#define STYLE_PUSHBUTTON_OS2 ((USHORT)0x0002) +#define STYLE_PUSHBUTTON_MAC ((USHORT)0x0003) +#define STYLE_PUSHBUTTON_UNIX ((USHORT)0x0004) +#define STYLE_PUSHBUTTON_STYLE ((USHORT)0x000F) + +#define STYLE_TABCONTROL_SINGLELINE ((USHORT)0x0001) +#define STYLE_TABCONTROL_COLOR ((USHORT)0x0002) + +#define STYLE_TOOLBAR_ICONSIZE_UNKNOWN ((ULONG)0) +#define STYLE_TOOLBAR_ICONSIZE_SMALL ((ULONG)1) +#define STYLE_TOOLBAR_ICONSIZE_LARGE ((ULONG)2) + +#define STYLE_SYMBOLS_AUTO ((ULONG)0) +#define STYLE_SYMBOLS_DEFAULT ((ULONG)1) +#define STYLE_SYMBOLS_HICONTRAST ((ULONG)2) +#define STYLE_SYMBOLS_INDUSTRIAL ((ULONG)3) +#define STYLE_SYMBOLS_CRYSTAL ((ULONG)4) +#define STYLE_SYMBOLS_TANGO ((ULONG)5) +#define STYLE_SYMBOLS_OXYGEN ((ULONG)6) +#define STYLE_SYMBOLS_CLASSIC ((ULONG)7) +#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)8) + +#define STYLE_CURSOR_NOBLINKTIME ((ULONG)0xFFFFFFFF) + +class VCL_DLLPUBLIC StyleSettings +{ + void CopyData(); + +private: + ImplStyleData* mpData; + +public: + StyleSettings(); + StyleSettings( const StyleSettings& rSet ); + ~StyleSettings(); + + void Set3DColors( const Color& rColor ); + void SetFaceColor( const Color& rColor ) + { CopyData(); mpData->maFaceColor = rColor; } + const Color& GetFaceColor() const + { return mpData->maFaceColor; } + Color GetFaceGradientColor() const; + Color GetSeparatorColor() const; + void SetCheckedColor( const Color& rColor ) + { CopyData(); mpData->maCheckedColor = rColor; } + const Color& GetCheckedColor() const + { return mpData->maCheckedColor; } + void SetLightColor( const Color& rColor ) + { CopyData(); mpData->maLightColor = rColor; } + const Color& GetLightColor() const + { return mpData->maLightColor; } + void SetLightBorderColor( const Color& rColor ) + { CopyData(); mpData->maLightBorderColor = rColor; } + const Color& GetLightBorderColor() const + { return mpData->maLightBorderColor; } + void SetShadowColor( const Color& rColor ) + { CopyData(); mpData->maShadowColor = rColor; } + const Color& GetShadowColor() const + { return mpData->maShadowColor; } + void SetDarkShadowColor( const Color& rColor ) + { CopyData(); mpData->maDarkShadowColor = rColor; } + const Color& GetDarkShadowColor() const + { return mpData->maDarkShadowColor; } + void SetButtonTextColor( const Color& rColor ) + { CopyData(); mpData->maButtonTextColor = rColor; } + const Color& GetButtonTextColor() const + { return mpData->maButtonTextColor; } + void SetButtonRolloverTextColor( const Color& rColor ) + { CopyData(); mpData->maButtonRolloverTextColor = rColor; } + const Color& GetButtonRolloverTextColor() const + { return mpData->maButtonRolloverTextColor; } + void SetRadioCheckTextColor( const Color& rColor ) + { CopyData(); mpData->maRadioCheckTextColor = rColor; } + const Color& GetRadioCheckTextColor() const + { return mpData->maRadioCheckTextColor; } + void SetGroupTextColor( const Color& rColor ) + { CopyData(); mpData->maGroupTextColor = rColor; } + const Color& GetGroupTextColor() const + { return mpData->maGroupTextColor; } + void SetLabelTextColor( const Color& rColor ) + { CopyData(); mpData->maLabelTextColor = rColor; } + const Color& GetLabelTextColor() const + { return mpData->maLabelTextColor; } + void SetInfoTextColor( const Color& rColor ) + { CopyData(); mpData->maInfoTextColor = rColor; } + const Color& GetInfoTextColor() const + { return mpData->maInfoTextColor; } + void SetWindowColor( const Color& rColor ) + { CopyData(); mpData->maWindowColor = rColor; } + const Color& GetWindowColor() const + { return mpData->maWindowColor; } + void SetWindowTextColor( const Color& rColor ) + { CopyData(); mpData->maWindowTextColor = rColor; } + const Color& GetWindowTextColor() const + { return mpData->maWindowTextColor; } + void SetDialogColor( const Color& rColor ) + { CopyData(); mpData->maDialogColor = rColor; } + const Color& GetDialogColor() const + { return mpData->maDialogColor; } + void SetDialogTextColor( const Color& rColor ) + { CopyData(); mpData->maDialogTextColor = rColor; } + const Color& GetDialogTextColor() const + { return mpData->maDialogTextColor; } + void SetWorkspaceColor( const Color& rColor ) + { CopyData(); mpData->maWorkspaceColor = rColor; } + const Color& GetWorkspaceColor() const + { return mpData->maWorkspaceColor; } + void SetFieldColor( const Color& rColor ) + { CopyData(); mpData->maFieldColor = rColor; } + const Color& GetFieldColor() const + { return mpData->maFieldColor; } + void SetFieldTextColor( const Color& rColor ) + { CopyData(); mpData->maFieldTextColor = rColor; } + const Color& GetFieldTextColor() const + { return mpData->maFieldTextColor; } + void SetFieldRolloverTextColor( const Color& rColor ) + { CopyData(); mpData->maFieldRolloverTextColor = rColor; } + const Color& GetFieldRolloverTextColor() const + { return mpData->maFieldRolloverTextColor; } + void SetActiveColor( const Color& rColor ) + { CopyData(); mpData->maActiveColor = rColor; } + const Color& GetActiveColor() const + { return mpData->maActiveColor; } + void SetActiveColor2( const Color& rColor ) + { CopyData(); mpData->maActiveColor2 = rColor; } + const Color& GetActiveColor2() const + { return mpData->maActiveColor2; } + void SetActiveTextColor( const Color& rColor ) + { CopyData(); mpData->maActiveTextColor = rColor; } + const Color& GetActiveTextColor() const + { return mpData->maActiveTextColor; } + void SetActiveBorderColor( const Color& rColor ) + { CopyData(); mpData->maActiveBorderColor = rColor; } + const Color& GetActiveBorderColor() const + { return mpData->maActiveBorderColor; } + void SetDeactiveColor( const Color& rColor ) + { CopyData(); mpData->maDeactiveColor = rColor; } + const Color& GetDeactiveColor() const + { return mpData->maDeactiveColor; } + void SetDeactiveColor2( const Color& rColor ) + { CopyData(); mpData->maDeactiveColor2 = rColor; } + const Color& GetDeactiveColor2() const + { return mpData->maDeactiveColor2; } + void SetDeactiveTextColor( const Color& rColor ) + { CopyData(); mpData->maDeactiveTextColor = rColor; } + const Color& GetDeactiveTextColor() const + { return mpData->maDeactiveTextColor; } + void SetDeactiveBorderColor( const Color& rColor ) + { CopyData(); mpData->maDeactiveBorderColor = rColor; } + const Color& GetDeactiveBorderColor() const + { return mpData->maDeactiveBorderColor; } + void SetHighlightColor( const Color& rColor ) + { CopyData(); mpData->maHighlightColor = rColor; } + const Color& GetHighlightColor() const + { return mpData->maHighlightColor; } + void SetHighlightTextColor( const Color& rColor ) + { CopyData(); mpData->maHighlightTextColor = rColor; } + const Color& GetHighlightTextColor() const + { return mpData->maHighlightTextColor; } + void SetDisableColor( const Color& rColor ) + { CopyData(); mpData->maDisableColor = rColor; } + const Color& GetDisableColor() const + { return mpData->maDisableColor; } + void SetHelpColor( const Color& rColor ) + { CopyData(); mpData->maHelpColor = rColor; } + const Color& GetHelpColor() const + { return mpData->maHelpColor; } + void SetHelpTextColor( const Color& rColor ) + { CopyData(); mpData->maHelpTextColor = rColor; } + const Color& GetHelpTextColor() const + { return mpData->maHelpTextColor; } + void SetMenuColor( const Color& rColor ) + { CopyData(); mpData->maMenuColor = rColor; } + const Color& GetMenuColor() const + { return mpData->maMenuColor; } + void SetMenuBarColor( const Color& rColor ) + { CopyData(); mpData->maMenuBarColor = rColor; } + const Color& GetMenuBarColor() const + { return mpData->maMenuBarColor; } + void SetMenuBorderColor( const Color& rColor ) + { CopyData(); mpData->maMenuBorderColor = rColor; } + const Color& GetMenuBorderColor() const + { return mpData->maMenuBorderColor; } + void SetMenuTextColor( const Color& rColor ) + { CopyData(); mpData->maMenuTextColor = rColor; } + const Color& GetMenuTextColor() const + { return mpData->maMenuTextColor; } + void SetMenuBarTextColor( const Color& rColor ) + { CopyData(); mpData->maMenuBarTextColor = rColor; } + const Color& GetMenuBarTextColor() const + { return mpData->maMenuBarTextColor; } + void SetMenuHighlightColor( const Color& rColor ) + { CopyData(); mpData->maMenuHighlightColor = rColor; } + const Color& GetMenuHighlightColor() const + { return mpData->maMenuHighlightColor; } + void SetMenuHighlightTextColor( const Color& rColor ) + { CopyData(); mpData->maMenuHighlightTextColor = rColor; } + const Color& GetMenuHighlightTextColor() const + { return mpData->maMenuHighlightTextColor; } + void SetLinkColor( const Color& rColor ) + { CopyData(); mpData->maLinkColor = rColor; } + const Color& GetLinkColor() const + { return mpData->maLinkColor; } + void SetVisitedLinkColor( const Color& rColor ) + { CopyData(); mpData->maVisitedLinkColor = rColor; } + const Color& GetVisitedLinkColor() const + { return mpData->maVisitedLinkColor; } + void SetHighlightLinkColor( const Color& rColor ) + { CopyData(); mpData->maHighlightLinkColor = rColor; } + const Color& GetHighlightLinkColor() const + { return mpData->maHighlightLinkColor; } + + void SetMonoColor( const Color& rColor ) + { CopyData(); mpData->maMonoColor = rColor; } + const Color& GetMonoColor() const + { return mpData->maMonoColor; } + + void SetActiveTabColor( const Color& rColor ) + { CopyData(); mpData->maActiveTabColor = rColor; } + const Color& GetActiveTabColor() const + { return mpData->maActiveTabColor; } + void SetInactiveTabColor( const Color& rColor ) + { CopyData(); mpData->maInactiveTabColor = rColor; } + const Color& GetInactiveTabColor() const + { return mpData->maInactiveTabColor; } + + void SetHighContrastMode( BOOL bHighContrast ) + { CopyData(); mpData->mnHighContrast = bHighContrast; } + BOOL GetHighContrastMode() const + { return (BOOL) mpData->mnHighContrast; } + BOOL IsHighContrastBlackAndWhite() const; + void SetUseSystemUIFonts( BOOL bUseSystemUIFonts ) + { CopyData(); mpData->mnUseSystemUIFonts = bUseSystemUIFonts; } + BOOL GetUseSystemUIFonts() const + { return (BOOL) mpData->mnUseSystemUIFonts; } + void SetUseFlatBorders( BOOL bUseFlatBorders ) + { CopyData(); mpData->mnUseFlatBorders = bUseFlatBorders; } + BOOL GetUseFlatBorders() const + { return (BOOL) mpData->mnUseFlatBorders; } + void SetUseFlatMenues( BOOL bUseFlatMenues ) + { CopyData(); mpData->mnUseFlatMenues = bUseFlatMenues; } + BOOL GetUseFlatMenues() const + { return (BOOL) mpData->mnUseFlatMenues; } + void SetUseImagesInMenus( BOOL bUseImagesInMenus ) + { CopyData(); mpData->mnUseImagesInMenus = bUseImagesInMenus; } + BOOL GetUseImagesInMenus() const + { return (BOOL) mpData->mnUseImagesInMenus; } + void SetSkipDisabledInMenus( BOOL bSkipDisabledInMenus ) + { CopyData(); mpData->mnSkipDisabledInMenus = bSkipDisabledInMenus; } + BOOL GetSkipDisabledInMenus() const + { return (BOOL) mpData->mnSkipDisabledInMenus; } + + void SetCairoFontOptions( const void *pOptions ) + { CopyData(); mpData->mpFontOptions = pOptions; } + const void* GetCairoFontOptions() const + { return mpData->mpFontOptions; } + + void SetAppFont( const Font& rFont ) + { CopyData(); mpData->maAppFont = rFont; } + const Font& GetAppFont() const + { return mpData->maAppFont; } + void SetHelpFont( const Font& rFont ) + { CopyData(); mpData->maHelpFont = rFont; } + const Font& GetHelpFont() const + { return mpData->maHelpFont; } + void SetTitleFont( const Font& rFont ) + { CopyData(); mpData->maTitleFont = rFont; } + const Font& GetTitleFont() const + { return mpData->maTitleFont; } + void SetFloatTitleFont( const Font& rFont ) + { CopyData(); mpData->maFloatTitleFont = rFont; } + const Font& GetFloatTitleFont() const + { return mpData->maFloatTitleFont; } + void SetMenuFont( const Font& rFont ) + { CopyData(); mpData->maMenuFont = rFont; } + const Font& GetMenuFont() const + { return mpData->maMenuFont; } + void SetToolFont( const Font& rFont ) + { CopyData(); mpData->maToolFont = rFont; } + const Font& GetToolFont() const + { return mpData->maToolFont; } + void SetGroupFont( const Font& rFont ) + { CopyData(); mpData->maGroupFont = rFont; } + const Font& GetGroupFont() const + { return mpData->maGroupFont; } + void SetLabelFont( const Font& rFont ) + { CopyData(); mpData->maLabelFont = rFont; } + const Font& GetLabelFont() const + { return mpData->maLabelFont; } + void SetInfoFont( const Font& rFont ) + { CopyData(); mpData->maInfoFont = rFont; } + const Font& GetInfoFont() const + { return mpData->maInfoFont; } + void SetRadioCheckFont( const Font& rFont ) + { CopyData(); mpData->maRadioCheckFont = rFont; } + const Font& GetRadioCheckFont() const + { return mpData->maRadioCheckFont; } + void SetPushButtonFont( const Font& rFont ) + { CopyData(); mpData->maPushButtonFont = rFont; } + const Font& GetPushButtonFont() const + { return mpData->maPushButtonFont; } + void SetFieldFont( const Font& rFont ) + { CopyData(); mpData->maFieldFont = rFont; } + const Font& GetFieldFont() const + { return mpData->maFieldFont; } + void SetIconFont( const Font& rFont ) + { CopyData(); mpData->maIconFont = rFont; } + const Font& GetIconFont() const + { return mpData->maIconFont; } + + void SetRadioButtonStyle( USHORT nStyle ) + { CopyData(); mpData->mnRadioButtonStyle = nStyle; } + USHORT GetRadioButtonStyle() const + { return mpData->mnRadioButtonStyle; } + void SetCheckBoxStyle( USHORT nStyle ) + { CopyData(); mpData->mnCheckBoxStyle = nStyle; } + USHORT GetCheckBoxStyle() const + { return mpData->mnCheckBoxStyle; } + void SetPushButtonStyle( USHORT nStyle ) + { CopyData(); mpData->mnPushButtonStyle = nStyle; } + USHORT GetPushButtonStyle() const + { return mpData->mnPushButtonStyle; } + void SetTabControlStyle( USHORT nStyle ) + { CopyData(); mpData->mnTabControlStyle = nStyle; } + USHORT GetTabControlStyle() const + { return mpData->mnTabControlStyle; } + + void SetBorderSize( long nSize ) + { CopyData(); mpData->mnBorderSize = nSize; } + long GetBorderSize() const + { return mpData->mnBorderSize; } + void SetTitleHeight( long nSize ) + { CopyData(); mpData->mnTitleHeight = nSize; } + long GetTitleHeight() const + { return mpData->mnTitleHeight; } + void SetFloatTitleHeight( long nSize ) + { CopyData(); mpData->mnFloatTitleHeight = nSize; } + long GetFloatTitleHeight() const + { return mpData->mnFloatTitleHeight; } + void SetTearOffTitleHeight( long nSize ) + { CopyData(); mpData->mnTearOffTitleHeight = nSize; } + long GetTearOffTitleHeight() const + { return mpData->mnTearOffTitleHeight; } + void SetMenuBarHeight( long nSize ) + { CopyData(); mpData->mnMenuBarHeight = nSize; } + long GetMenuBarHeight() const + { return mpData->mnMenuBarHeight; } + void SetScrollBarSize( long nSize ) + { CopyData(); mpData->mnScrollBarSize = nSize; } + long GetScrollBarSize() const + { return mpData->mnScrollBarSize; } + void SetMinThumbSize( long nSize ) + { CopyData(); mpData->mnMinThumbSize = nSize; } + long GetMinThumbSize() const + { return mpData->mnMinThumbSize; } + void SetSpinSize( long nSize ) + { CopyData(); mpData->mnSpinSize = nSize; } + long GetSpinSize() const + { return mpData->mnSpinSize; } + void SetSplitSize( long nSize ) + { CopyData(); mpData->mnSplitSize = nSize; } + long GetSplitSize() const + { return mpData->mnSplitSize; } + + void SetIconHorzSpace( long nSpace ) + { CopyData(); mpData->mnIconHorzSpace = nSpace; } + long GetIconHorzSpace() const + { return mpData->mnIconHorzSpace; } + void SetIconVertSpace( long nSpace ) + { CopyData(); mpData->mnIconVertSpace = nSpace; } + long GetIconVertSpace() const + { return mpData->mnIconVertSpace; } + + void SetCursorSize( long nSize ) + { CopyData(); mpData->mnCursorSize = nSize; } + long GetCursorSize() const + { return mpData->mnCursorSize; } + void SetCursorBlinkTime( long nBlinkTime ) + { CopyData(); mpData->mnCursorBlinkTime = nBlinkTime; } + long GetCursorBlinkTime() const + { return mpData->mnCursorBlinkTime; } + + void SetScreenZoom( USHORT nPercent ) + { CopyData(); mpData->mnScreenZoom = nPercent; } + USHORT GetScreenZoom() const + { return mpData->mnScreenZoom; } + void SetScreenFontZoom( USHORT nPercent ) + { CopyData(); mpData->mnScreenFontZoom = nPercent; } + USHORT GetScreenFontZoom() const + { return mpData->mnScreenFontZoom; } + + void SetLogoDisplayTime( ULONG nDisplayTime ) + { CopyData(); mpData->mnLogoDisplayTime = nDisplayTime; } + ULONG GetLogoDisplayTime() const + { return mpData->mnLogoDisplayTime; } + + void SetDragFullOptions( ULONG nOptions ) + { CopyData(); mpData->mnDragFullOptions = nOptions; } + ULONG GetDragFullOptions() const + { return mpData->mnDragFullOptions; } + + void SetAnimationOptions( ULONG nOptions ) + { CopyData(); mpData->mnAnimationOptions = nOptions; } + ULONG GetAnimationOptions() const + { return mpData->mnAnimationOptions; } + + void SetSelectionOptions( ULONG nOptions ) + { CopyData(); mpData->mnSelectionOptions = nOptions; } + ULONG GetSelectionOptions() const + { return mpData->mnSelectionOptions; } + + void SetDisplayOptions( ULONG nOptions ) + { CopyData(); mpData->mnDisplayOptions = nOptions; } + ULONG GetDisplayOptions() const + { return mpData->mnDisplayOptions; } + void SetAntialiasingMinPixelHeight( long nMinPixel ) + { CopyData(); mpData->mnAntialiasedMin = nMinPixel; } + ULONG GetAntialiasingMinPixelHeight() const + { return mpData->mnAntialiasedMin; } + + void SetOptions( ULONG nOptions ) + { CopyData(); mpData->mnOptions = nOptions; } + ULONG GetOptions() const + { return mpData->mnOptions; } + void SetAutoMnemonic( BOOL bAutoMnemonic ) + { CopyData(); mpData->mnAutoMnemonic = (USHORT)bAutoMnemonic; } + BOOL GetAutoMnemonic() const + { return mpData->mnAutoMnemonic ? TRUE : FALSE; } + + void SetFontColor( const Color& rColor ) + { CopyData(); mpData->maFontColor = rColor; } + const Color& GetFontColor() const + { return mpData->maFontColor; } + + void SetToolbarIconSize( ULONG nSize ) + { CopyData(); mpData->mnToolbarIconSize = nSize; } + ULONG GetToolbarIconSize() const + { return mpData->mnToolbarIconSize; } + + void SetSymbolsStyle( ULONG nStyle ) + { CopyData(); mpData->mnSymbolsStyle = nStyle; } + ULONG GetSymbolsStyle() const + { return mpData->mnSymbolsStyle; } + + void SetPreferredSymbolsStyle( ULONG nStyle ) + { CopyData(); mpData->mnPreferredSymbolsStyle = nStyle; } + void SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ); + ULONG GetPreferredSymbolsStyle() const + { return mpData->mnPreferredSymbolsStyle; } + // check whether the symbols style is supported (icons are installed) + bool CheckSymbolStyle( ULONG nStyle ) const; + ULONG GetAutoSymbolsStyle() const; + + ULONG GetCurrentSymbolsStyle() const; + + void SetSymbolsStyleName( const ::rtl::OUString &rName ) + { return SetSymbolsStyle( ImplNameToSymbolsStyle( rName ) ); } + ::rtl::OUString GetSymbolsStyleName() const + { return ImplSymbolsStyleToName( GetSymbolsStyle() ); } + ::rtl::OUString GetCurrentSymbolsStyleName() const + { return ImplSymbolsStyleToName( GetCurrentSymbolsStyle() ); } + + const Wallpaper& GetWorkspaceGradient() const + { return mpData->maWorkspaceGradient; } + void SetWorkspaceGradient( const Wallpaper& rWall ) + { CopyData(); mpData->maWorkspaceGradient = rWall; } + + void SetStandardStyles(); + void SetStandardWinStyles(); + void SetStandardOS2Styles(); + void SetStandardMacStyles(); + void SetStandardUnixStyles(); + + const StyleSettings& operator =( const StyleSettings& rSet ); + + BOOL operator ==( const StyleSettings& rSet ) const; + BOOL operator !=( const StyleSettings& rSet ) const + { return !(*this == rSet); } + +protected: + ::rtl::OUString ImplSymbolsStyleToName( ULONG nStyle ) const; + ULONG ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const; +}; + +// ---------------- +// - ImplMiscData - +// ---------------- + +class ImplMiscData +{ + friend class MiscSettings; + + ImplMiscData(); + ImplMiscData( const ImplMiscData& rData ); + +private: + ULONG mnRefCount; + USHORT mnEnableATT; + BOOL mbEnableLocalizedDecimalSep; + USHORT mnDisablePrinting; +}; + +// ---------------- +// - MiscSettings - +// ---------------- + +class VCL_DLLPUBLIC MiscSettings +{ + void CopyData(); + +private: + ImplMiscData* mpData; + +public: + MiscSettings(); + MiscSettings( const MiscSettings& rSet ); + ~MiscSettings(); + + void SetEnableATToolSupport( BOOL bEnable ); + BOOL GetEnableATToolSupport() const; + void SetDisablePrinting( BOOL bEnable ); + BOOL GetDisablePrinting() const; + void SetEnableLocalizedDecimalSep( BOOL bEnable ); + BOOL GetEnableLocalizedDecimalSep() const; + const MiscSettings& operator =( const MiscSettings& rSet ); + + BOOL operator ==( const MiscSettings& rSet ) const; + BOOL operator !=( const MiscSettings& rSet ) const + { return !(*this == rSet); } +}; + +// ------------------------ +// - ImplNotificationData - +// ------------------------ + +class ImplNotificationData +{ + friend class NotificationSettings; + + ImplNotificationData(); + ImplNotificationData( const ImplNotificationData& rData ); + +private: + ULONG mnRefCount; + ULONG mnOptions; +}; + +// ------------------------ +// - NotificationSettings - +// ------------------------ + +class VCL_DLLPUBLIC NotificationSettings +{ + void CopyData(); + +private: + ImplNotificationData* mpData; + +public: + NotificationSettings(); + NotificationSettings( const NotificationSettings& rSet ); + ~NotificationSettings(); + + void SetOptions( ULONG nOptions ) + { CopyData(); mpData->mnOptions = nOptions; } + ULONG GetOptions() const + { return mpData->mnOptions; } + + const NotificationSettings& operator =( const NotificationSettings& rSet ); + + BOOL operator ==( const NotificationSettings& rSet ) const; + BOOL operator !=( const NotificationSettings& rSet ) const + { return !(*this == rSet); } +}; + +// ---------------- +// - ImplHelpData - +// ---------------- + +class ImplHelpData +{ + friend class HelpSettings; + + ImplHelpData(); + ImplHelpData( const ImplHelpData& rData ); + +private: + ULONG mnRefCount; + ULONG mnOptions; + ULONG mnTipDelay; + ULONG mnTipTimeout; + ULONG mnBalloonDelay; +}; + +// ---------------- +// - HelpSettings - +// ---------------- + +#define HELP_OPTION_QUICK ((ULONG)0x00000001) +#define HELP_OPTION_ACTIVE ((ULONG)0x00000002) + +class VCL_DLLPUBLIC HelpSettings +{ + void CopyData(); + +private: + ImplHelpData* mpData; + +public: + HelpSettings(); + HelpSettings( const HelpSettings& rSet ); + ~HelpSettings(); + + void SetOptions( ULONG nOptions ) + { CopyData(); mpData->mnOptions = nOptions; } + ULONG GetOptions() const + { return mpData->mnOptions; } + void SetTipDelay( ULONG nTipDelay ) + { CopyData(); mpData->mnTipDelay = nTipDelay; } + ULONG GetTipDelay() const + { return mpData->mnTipDelay; } + void SetTipTimeout( ULONG nTipTimeout ) + { CopyData(); mpData->mnTipTimeout = nTipTimeout; } + ULONG GetTipTimeout() const + { return mpData->mnTipTimeout; } + void SetBalloonDelay( ULONG nBalloonDelay ) + { CopyData(); mpData->mnBalloonDelay = nBalloonDelay; } + ULONG GetBalloonDelay() const + { return mpData->mnBalloonDelay; } + + const HelpSettings& operator =( const HelpSettings& rSet ); + + BOOL operator ==( const HelpSettings& rSet ) const; + BOOL operator !=( const HelpSettings& rSet ) const + { return !(*this == rSet); } +}; + +// ----------------------- +// - ImplAllSettingsData - +// ----------------------- +class LocaleConfigurationListener; +class ImplAllSettingsData +{ + friend class AllSettings; + + ImplAllSettingsData(); + ImplAllSettingsData( const ImplAllSettingsData& rData ); + ~ImplAllSettingsData(); + +private: + ULONG mnRefCount; + MachineSettings maMachineSettings; + MouseSettings maMouseSettings; + KeyboardSettings maKeyboardSettings; + StyleSettings maStyleSettings; + MiscSettings maMiscSettings; + NotificationSettings maNotificationSettings; + HelpSettings maHelpSettings; + ::com::sun::star::lang::Locale maLocale; + ULONG mnSystemUpdate; + ULONG mnWindowUpdate; + ::com::sun::star::lang::Locale maUILocale; + LanguageType meLanguage; + LanguageType meUILanguage; + LocaleDataWrapper* mpLocaleDataWrapper; + LocaleDataWrapper* mpUILocaleDataWrapper; + CollatorWrapper* mpCollatorWrapper; + CollatorWrapper* mpUICollatorWrapper; + vcl::I18nHelper* mpI18nHelper; + vcl::I18nHelper* mpUII18nHelper; + LocaleConfigurationListener* mpLocaleCfgListener; + SvtSysLocale maSysLocale; +}; + +// --------------- +// - AllSettings - +// --------------- + +#define SETTINGS_MACHINE ((ULONG)0x00000001) +#define SETTINGS_MOUSE ((ULONG)0x00000002) +#define SETTINGS_KEYBOARD ((ULONG)0x00000004) +#define SETTINGS_STYLE ((ULONG)0x00000008) +#define SETTINGS_MISC ((ULONG)0x00000010) +#define SETTINGS_SOUND ((ULONG)0x00000020) +#define SETTINGS_NOTIFICATION ((ULONG)0x00000040) +#define SETTINGS_HELP ((ULONG)0x00000080) +#define SETTINGS_INTERNATIONAL ((ULONG)0x00000100) /* was for class International, has no effect anymore */ +#define SETTINGS_LOCALE ((ULONG)0x00000200) +#define SETTINGS_UILOCALE ((ULONG)0x00000400) +#define SETTINGS_ALLSETTINGS (SETTINGS_MACHINE |\ + SETTINGS_MOUSE | SETTINGS_KEYBOARD |\ + SETTINGS_STYLE | SETTINGS_MISC |\ + SETTINGS_SOUND | SETTINGS_NOTIFICATION |\ + SETTINGS_HELP |\ + SETTINGS_LOCALE | SETTINGS_UILOCALE ) +#define SETTINGS_IN_UPDATE_SETTINGS ((ULONG)0x00000800) // this flag indicates that the data changed event was created + // in Windows::UpdateSettings probably because of a global + // settings changed + +class VCL_DLLPUBLIC AllSettings +{ + void CopyData(); + +private: + ImplAllSettingsData* mpData; + +public: + AllSettings(); + AllSettings( const AllSettings& rSet ); + ~AllSettings(); + + void SetMachineSettings( const MachineSettings& rSet ) + { CopyData(); mpData->maMachineSettings = rSet; } + const MachineSettings& GetMachineSettings() const + { return mpData->maMachineSettings; } + + void SetMouseSettings( const MouseSettings& rSet ) + { CopyData(); mpData->maMouseSettings = rSet; } + const MouseSettings& GetMouseSettings() const + { return mpData->maMouseSettings; } + + void SetKeyboardSettings( const KeyboardSettings& rSet ) + { CopyData(); mpData->maKeyboardSettings = rSet; } + const KeyboardSettings& GetKeyboardSettings() const + { return mpData->maKeyboardSettings; } + + void SetStyleSettings( const StyleSettings& rSet ) + { CopyData(); mpData->maStyleSettings = rSet; } + const StyleSettings& GetStyleSettings() const + { return mpData->maStyleSettings; } + + void SetMiscSettings( const MiscSettings& rSet ) + { CopyData(); mpData->maMiscSettings = rSet; } + const MiscSettings& GetMiscSettings() const + { return mpData->maMiscSettings; } + + void SetNotificationSettings( const NotificationSettings& rSet ) + { CopyData(); mpData->maNotificationSettings = rSet; } + const NotificationSettings& GetNotificationSettings() const + { return mpData->maNotificationSettings; } + + void SetHelpSettings( const HelpSettings& rSet ) + { CopyData(); mpData->maHelpSettings = rSet; } + const HelpSettings& GetHelpSettings() const + { return mpData->maHelpSettings; } + + void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); + const ::com::sun::star::lang::Locale& GetLocale() const; + void SetUILocale( const ::com::sun::star::lang::Locale& rLocale ); + const ::com::sun::star::lang::Locale& GetUILocale() const; + void SetLanguage( LanguageType eLang ); + LanguageType GetLanguage() const; + void SetUILanguage( LanguageType eLang ); + LanguageType GetUILanguage() const; + BOOL GetLayoutRTL() const; // returns TRUE if UI language requires right-to-left UI + const LocaleDataWrapper& GetLocaleDataWrapper() const; + const LocaleDataWrapper& GetUILocaleDataWrapper() const; + const vcl::I18nHelper& GetLocaleI18nHelper() const; + const vcl::I18nHelper& GetUILocaleI18nHelper() const; +/* + const CollatorWrapper& GetCollatorWrapper() const; + const CollatorWrapper& GetUICollatorWrapper() const; + sal_Unicode GetMnemonicMatchChar( sal_Unicode c ) const; + String GetMatchString( const String& rStr ) const; + String GetUIMatchString( const String& rStr ) const; + int MatchString( const String& rStr1, xub_StrLen nPos1, xub_StrLen nCount1, + const String& rStr2, xub_StrLen nPos2, xub_StrLen nCount2 ) const; + int MatchUIString( const String& rStr1, xub_StrLen nPos1, xub_StrLen nCount1, + const String& rStr2, xub_StrLen nPos2, xub_StrLen nCount2 ) const; +*/ + + void SetSystemUpdate( ULONG nUpdate ) + { CopyData(); mpData->mnSystemUpdate = nUpdate; } + ULONG GetSystemUpdate() const + { return mpData->mnSystemUpdate; } + void SetWindowUpdate( ULONG nUpdate ) + { CopyData(); mpData->mnWindowUpdate = nUpdate; } + ULONG GetWindowUpdate() const + { return mpData->mnWindowUpdate; } + + ULONG Update( ULONG nFlags, const AllSettings& rSettings ); + ULONG GetChangeFlags( const AllSettings& rSettings ) const; + + const AllSettings& operator =( const AllSettings& rSet ); + + BOOL operator ==( const AllSettings& rSet ) const; + BOOL operator !=( const AllSettings& rSet ) const + { return !(*this == rSet); } + static void LocaleSettingsChanged( sal_uInt32 nHint ); + SvtSysLocale& GetSysLocale() { return mpData->maSysLocale; } +}; + +#endif // _SV_SETTINGS_HXX diff --git a/vcl/inc/vcl/slider.hxx b/vcl/inc/vcl/slider.hxx new file mode 100644 index 000000000000..52af7a8bf343 --- /dev/null +++ b/vcl/inc/vcl/slider.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * 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_SLIDER_HXX +#define _SV_SLIDER_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +// for enum ScrollType +#include <vcl/scrbar.hxx> + +// ---------- +// - Slider - +// ---------- + +class VCL_DLLPUBLIC Slider : public Control +{ +private: + Rectangle maChannel1Rect; + Rectangle maChannel2Rect; + Rectangle maThumbRect; + long mnStartPos; + long mnMouseOff; + long mnThumbPixOffset; + long mnThumbPixRange; + long mnThumbPixPos; + long mnChannelPixOffset; + long mnChannelPixRange; + long mnChannelPixTop; + long mnChannelPixBottom; + long mnMinRange; + long mnMaxRange; + long mnThumbPos; + long mnLineSize; + long mnPageSize; + long mnDelta; + USHORT mnDragDraw; + USHORT mnStateFlags; + ScrollType meScrollType; + BOOL mbCalcSize; + BOOL mbFullDrag; + Link maSlideHdl; + Link maEndSlideHdl; + + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplUpdateRects( BOOL bUpdate = TRUE ); + SAL_DLLPRIVATE long ImplCalcThumbPos( long nPixPos ); + SAL_DLLPRIVATE long ImplCalcThumbPosPix( long nPos ); + SAL_DLLPRIVATE void ImplCalc( BOOL bUpdate = TRUE ); + SAL_DLLPRIVATE void ImplDraw( USHORT nDrawFlags ); + SAL_DLLPRIVATE BOOL ImplIsPageUp( const Point& rPos ); + SAL_DLLPRIVATE BOOL ImplIsPageDown( const Point& rPos ); + SAL_DLLPRIVATE long ImplSlide( long nNewPos, BOOL bCallEndSlide ); + SAL_DLLPRIVATE long ImplDoAction( BOOL bCallEndSlide ); + SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, BOOL bCallAction = TRUE ); + SAL_DLLPRIVATE long ImplDoSlide( long nNewPos ); + SAL_DLLPRIVATE long ImplDoSlideAction( ScrollType eScrollType ); + +public: + Slider( Window* pParent, WinBits nStyle = WB_HORZ ); + Slider( Window* pParent, const ResId& rResId ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Slide(); + virtual void EndSlide(); + + void EnableDrag( BOOL bEnable = TRUE ) + { mbFullDrag = bEnable; } + BOOL IsDragEnabled() const { return mbFullDrag; } + + void SetRangeMin( long nNewRange ); + long GetRangeMin() const { return mnMinRange; } + void SetRangeMax( long nNewRange ); + long GetRangeMax() const { return mnMaxRange; } + void SetRange( const Range& rRange ); + Range GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); } + void SetThumbPos( long nThumbPos ); + long GetThumbPos() const { return mnThumbPos; } + void SetLineSize( long nNewSize ) { mnLineSize = nNewSize; } + long GetLineSize() const { return mnLineSize; } + void SetPageSize( long nNewSize ) { mnPageSize = nNewSize; } + long GetPageSize() const { return mnPageSize; } + + long GetDelta() const { return mnDelta; } + + Size CalcWindowSizePixel(); + + void SetSlideHdl( const Link& rLink ) { maSlideHdl = rLink; } + const Link& GetSlideHdl() const { return maSlideHdl; } + void SetEndSlideHdl( const Link& rLink ) { maEndSlideHdl = rLink; } + const Link& GetEndSlideHdl() const { return maEndSlideHdl; } +}; + +#endif // _SV_SLIDER_HXX diff --git a/vcl/inc/vcl/smartid.hxx b/vcl/inc/vcl/smartid.hxx new file mode 100755 index 000000000000..2cc5f347b2cb --- /dev/null +++ b/vcl/inc/vcl/smartid.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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 _SMARTID_HXX_ +#define _SMARTID_HXX_ + +#include <tools/string.hxx> +#include <vcl/dllapi.h> + +/// SMART_SET_SMART only sets the Ids that are defined in the SmartId +/// the other types set whatever is given. This can also be used to reset an Id +enum SmartIdUpdateMode { SMART_SET_SMART, SMART_SET_NUM, SMART_SET_STR, SMART_SET_ALL }; + +struct ImplSmartIdData; + +/* + +SmartId is a substitute for Numeric HelpIds. They can handle Numeric and String HelpIds and offer commonly needed operators. + +Matching Ids: +if part of an Id is not set (HasNumeric HasString is False) then this part will never match to anything. Not even unset values + +*/ +class VCL_DLLPUBLIC SmartId +{ +private: + ImplSmartIdData* mpData; + SAL_DLLPRIVATE ImplSmartIdData* GetSmartIdData(); + +public: + explicit SmartId( const String& rId ); + explicit SmartId( ULONG nId ); + SmartId( const String& rId, ULONG nId ); + + SmartId(); + + SmartId( const SmartId& rId ); + SmartId& operator = ( const SmartId& rId ); + + ~SmartId(); + + void UpdateId( const SmartId& rId, SmartIdUpdateMode aMode = SMART_SET_SMART ); + + BOOL HasNumeric() const; + BOOL HasString() const; + BOOL HasAny() const; + ULONG GetNum() const; + String GetStr() const; + + String GetText() const; /// return String for UI usage + + BOOL Matches( const String &rId )const; + BOOL Matches( const ULONG nId ) const; +/// In case both Ids have both values set only the StringId is used for Matching + BOOL Matches( const SmartId &rId ) const; + + BOOL Equals( const SmartId &rId ) const; + + BOOL operator == ( const SmartId& rRight ) const; + BOOL operator < ( const SmartId& rRight ) const; +}; + +#endif diff --git a/vcl/inc/vcl/sndstyle.hxx b/vcl/inc/vcl/sndstyle.hxx new file mode 100644 index 000000000000..6e1401986b36 --- /dev/null +++ b/vcl/inc/vcl/sndstyle.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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_SNDSTYLE_HXX +#define _SV_SNDSTYLE_HXX + +#include <vcl/sv.h> + +// --------------- +// - Sound-Types - +// --------------- + +typedef USHORT SoundType; +#define SOUND_DEFAULT ((SoundType)0) +#define SOUND_INFO ((SoundType)1) +#define SOUND_WARNING ((SoundType)2) +#define SOUND_ERROR ((SoundType)3) +#define SOUND_QUERY ((SoundType)4) + +#define SOUND_DISABLE ((SoundType)5) + +#endif // _SV_SNDSTYLE_HXX diff --git a/vcl/inc/vcl/sound.hxx b/vcl/inc/vcl/sound.hxx new file mode 100644 index 000000000000..edab9d7d8655 --- /dev/null +++ b/vcl/inc/vcl/sound.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_SOUND_HXX +#define _SV_SOUND_HXX + +#include <vcl/dllapi.h> +#include <vcl/sndstyle.hxx> +#include <tools/string.hxx> +#include <tools/link.hxx> +#include <tools/time.hxx> + +class Window; +class Timer; + +// --------- +// - Sound - +// --------- + +class VCL_DLLPUBLIC Sound +{ +public: + static void Beep( SoundType eType = SOUND_DEFAULT, Window* pWindow = NULL ); +}; + +#endif // _SV_SOUND_HXX + diff --git a/vcl/inc/vcl/spin.h b/vcl/inc/vcl/spin.h new file mode 100644 index 000000000000..b600c18f0f9f --- /dev/null +++ b/vcl/inc/vcl/spin.h @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_SPIN_H +#define _SV_SPIN_H + +#include <vcl/sv.h> + +class Rectangle; +class OutputDevice; + +// ----------------------------------------------------------------------- + +#define SPIN_DELAY 280 +#define SPIN_SPEED 60 + +// ----------------------------------------------------------------------- + +void ImplDrawSpinButton( OutputDevice* pOutDev, + const Rectangle& rUpperRect, + const Rectangle& rLowerRect, + BOOL bUpperIn, BOOL bLowerIn, + BOOL bUpperEnabled = TRUE, + BOOL bLowerEnabled = TRUE, + BOOL bHorz = FALSE, BOOL bMirrorHorz = FALSE ); + +#endif // _SV_SPIN_H diff --git a/vcl/inc/vcl/spin.hxx b/vcl/inc/vcl/spin.hxx new file mode 100644 index 000000000000..2ca4709de4c5 --- /dev/null +++ b/vcl/inc/vcl/spin.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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_SPIN_HXX +#define _SV_SPIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/ctrl.hxx> +#include <vcl/timer.hxx> + +// -------------- +// - SpinButton - +// -------------- + +class VCL_DLLPUBLIC SpinButton : public Control +{ +private: + AutoTimer maRepeatTimer; + Rectangle maUpperRect; + Rectangle maLowerRect; + Rectangle maFocusRect; + BOOL mbRepeat : 1; + BOOL mbUpperIn : 1; + BOOL mbLowerIn : 1; + BOOL mbInitialUp : 1; + BOOL mbInitialDown : 1; + BOOL mbHorz : 1; + BOOL mbUpperIsFocused : 1; + Link maUpHdlLink; + Link maDownHdlLink; + long mnMinRange; + long mnMaxRange; + long mnValue; + long mnValueStep; + + SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + DECL_DLLPRIVATE_LINK( ImplTimeout, Timer* ); + +public: + SpinButton( Window* pParent, WinBits nStyle = 0 ); + SpinButton( Window* pParent, const ResId& rResId ); + ~SpinButton(); + + virtual void Up(); + virtual void Down(); + + virtual void Resize(); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual void GetFocus(); + virtual void LoseFocus(); + + void SetRangeMin( long nNewRange ); + long GetRangeMin() const { return mnMinRange; } + void SetRangeMax( long nNewRange ); + long GetRangeMax() const { return mnMaxRange; } + void SetRange( const Range& rRange ); + Range GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); } + void SetValue( long nValue ); + long GetValue() const { return mnValue; } + void SetValueStep( long nNewStep ) { mnValueStep = nNewStep; } + long GetValueStep() const { return mnValueStep; } + virtual long PreNotify( NotifyEvent& rNEvt ); + + void SetUpHdl( const Link& rLink ) { maUpHdlLink = rLink; } + const Link& GetUpHdl() const { return maUpHdlLink; } + void SetDownHdl( const Link& rLink ) { maDownHdlLink = rLink; } + const Link& GetDownHdl() const { return maDownHdlLink; } + +private: + // moves the focus to the upper or lower rect. Return TRUE if the focus rect actually changed. + SAL_DLLPRIVATE BOOL ImplMoveFocus( BOOL _bUpper ); + SAL_DLLPRIVATE void ImplCalcFocusRect( BOOL _bUpper ); + + SAL_DLLPRIVATE inline BOOL ImplIsUpperEnabled( ) const + { + return mnValue + mnValueStep <= mnMaxRange; + } + SAL_DLLPRIVATE inline BOOL ImplIsLowerEnabled( ) const + { + return mnValue >= mnMinRange + mnValueStep; + } +}; + +#endif // _SV_SPIN_HXX diff --git a/vcl/inc/vcl/spinfld.hxx b/vcl/inc/vcl/spinfld.hxx new file mode 100644 index 000000000000..7df0b6d95bfc --- /dev/null +++ b/vcl/inc/vcl/spinfld.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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_SPINFLD_HXX +#define _SV_SPINFLD_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/edit.hxx> +#include <vcl/timer.hxx> + +// ------------- +// - SpinField - +// ------------- + +class VCL_DLLPUBLIC SpinField : public Edit +{ +protected: + Edit* mpEdit; + AutoTimer maRepeatTimer; + Rectangle maUpperRect; + Rectangle maLowerRect; + Rectangle maDropDownRect; // noch nicht angebunden... + Link maUpHdlLink; + Link maDownHdlLink; + Link maFirstHdlLink; + Link maLastHdlLink; + BOOL mbRepeat:1, + mbSpin:1, + mbInitialUp:1, + mbInitialDown:1, + mbNoSelect:1, + mbUpperIn:1, + mbLowerIn:1, + mbInDropDown:1; + + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + +private: + DECL_DLLPRIVATE_LINK( ImplTimeout, Timer* ); + SAL_DLLPRIVATE void ImplInitSpinFieldData(); + SAL_DLLPRIVATE void ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rectangle& rDDArea, Rectangle& rSpinUpArea, Rectangle& rSpinDownArea ); + +protected: + SpinField( WindowType nTyp ); + + virtual long Notify( NotifyEvent& rNEvt ); + virtual void Command( const CommandEvent& rCEvt ); + + void EndDropDown(); + + virtual void FillLayoutData() const; + Rectangle * ImplFindPartRect( const Point& rPt ); +public: + SpinField( Window* pParent, WinBits nWinStyle = 0 ); + SpinField( Window* pParent, const ResId& rResId ); + ~SpinField(); + + virtual BOOL ShowDropDown( BOOL bShow ); + + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Resize(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void SetUpHdl( const Link& rLink ) { maUpHdlLink = rLink; } + const Link& GetUpHdl() const { return maUpHdlLink; } + void SetDownHdl( const Link& rLink ) { maDownHdlLink = rLink; } + const Link& GetDownHdl() const { return maDownHdlLink; } + void SetFirstHdl( const Link& rLink ) { maFirstHdlLink = rLink; } + const Link& GetFirstHdl() const { return maFirstHdlLink; } + void SetLastHdl( const Link& rLink ) { maLastHdlLink = rLink; } + const Link& GetLastHdl() const { return maLastHdlLink; } + + virtual Size CalcMinimumSize() const; + virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size CalcSize( USHORT nChars ) const; +}; + +#endif // _SV_SPINFLD_HXX diff --git a/vcl/inc/vcl/split.hxx b/vcl/inc/vcl/split.hxx new file mode 100644 index 000000000000..890ef5365fbc --- /dev/null +++ b/vcl/inc/vcl/split.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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_SPLIT_HXX +#define _SV_SPLIT_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +#define SPLITTER_DEFAULTSTEPSIZE 0xFFFF + +// ------------ +// - Splitter - +// ------------ + +class VCL_DLLPUBLIC Splitter : public Window +{ +private: + Window* mpRefWin; + long mnSplitPos; + long mnLastSplitPos; + long mnStartSplitPos; + Point maDragPos; + Rectangle maDragRect; + BOOL mbHorzSplit; + BOOL mbDragFull; + BOOL mbKbdSplitting; + long mbInKeyEvent; + long mnKeyboardStepSize; + Link maStartSplitHdl; + Link maSplitHdl; + Link maEndSplitHdl; + + SAL_DLLPRIVATE void ImplInitSplitterData(); + SAL_DLLPRIVATE void ImplDrawSplitter(); + SAL_DLLPRIVATE void ImplSplitMousePos( Point& rPos ); + SAL_DLLPRIVATE void ImplStartKbdSplitting(); + SAL_DLLPRIVATE void ImplKbdTracking( KeyCode aKeyCode ); + SAL_DLLPRIVATE BOOL ImplSplitterActive(); + SAL_DLLPRIVATE Splitter* ImplFindSibling(); + SAL_DLLPRIVATE void ImplRestoreSplitter(); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE Splitter (const Splitter &); + SAL_DLLPRIVATE Splitter& operator= (const Splitter &); + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nWinStyle ); + +public: + Splitter( Window* pParent, WinBits nStyle = WB_VSCROLL ); + Splitter( Window* pParent, const ResId& rResId ); + ~Splitter(); + + virtual void StartSplit(); + virtual void EndSplit(); + virtual void Split(); + virtual void Splitting( Point& rSplitPos ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + + virtual long Notify( NotifyEvent& rNEvt ); + + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rPaintRect ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + void StartDrag(); + + void SetDragRectPixel( const Rectangle& rDragRect, + Window* pRefWin = NULL ); + const Rectangle& GetDragRectPixel() const { return maDragRect; } + Window* GetDragWindow() const { return mpRefWin; } + + virtual void SetSplitPosPixel( long nPos ); + long GetSplitPosPixel() const { return mnSplitPos; } + + void SetLastSplitPosPixel( long nNewPos ); + long GetLastSplitPosPixel() const { return mnLastSplitPos; } + + BOOL IsHorizontal() const { return mbHorzSplit; } + + // set the stepsize of the splitter for cursor movement + // the default is 10% of the reference window's width/height + void SetKeyboardStepSize( long nStepSize ); + long GetKeyboardStepSize() const; + + void SetStartSplitHdl( const Link& rLink ) { maStartSplitHdl = rLink; } + const Link& GetStartSplitHdl() const { return maStartSplitHdl; } + void SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; } + void SetEndSplitHdl( const Link& rLink ) { maEndSplitHdl = rLink; } + const Link& GetEndSplitHdl() const { return maEndSplitHdl; } + const Link& GetSplitHdl() const { return maSplitHdl; } +}; + +#endif // _SV_SPLIT_HXX diff --git a/vcl/inc/vcl/splitwin.hxx b/vcl/inc/vcl/splitwin.hxx new file mode 100644 index 000000000000..f028c6969b16 --- /dev/null +++ b/vcl/inc/vcl/splitwin.hxx @@ -0,0 +1,280 @@ +/************************************************************************* + * + * 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_SPLITWIN_HXX +#define _SV_SPLITWIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/dockwin.hxx> + +class Wallpaper; +struct ImplSplitSet; + +// ----------------------- +// - SplitWindowItemBits - +// ----------------------- + +typedef USHORT SplitWindowItemBits; + +// ------------------------------- +// - Bits fuer SplitWindow-Items - +// ------------------------------- + +#define SWIB_FIXED ((SplitWindowItemBits)0x0001) +#define SWIB_RELATIVESIZE ((SplitWindowItemBits)0x0002) +#define SWIB_PERCENTSIZE ((SplitWindowItemBits)0x0004) +#define SWIB_COLSET ((SplitWindowItemBits)0x0008) +#define SWIB_INVISIBLE ((SplitWindowItemBits)0x0010) + +// --------------------- +// - SplitWindow-Types - +// --------------------- + +#define SPLITWINDOW_APPEND ((USHORT)0xFFFF) +#define SPLITWINDOW_ITEM_NOTFOUND ((USHORT)0xFFFF) + +// --------------- +// - SplitWindow - +// --------------- + +class VCL_DLLPUBLIC SplitWindow : public DockingWindow +{ +private: + ImplSplitSet* mpMainSet; + ImplSplitSet* mpBaseSet; + ImplSplitSet* mpSplitSet; + long* mpLastSizes; + Rectangle maDragRect; + long mnDX; + long mnDY; + long mnLeftBorder; + long mnTopBorder; + long mnRightBorder; + long mnBottomBorder; + long mnMaxSize; + long mnMouseOff; + long mnMStartPos; + long mnMSplitPos; + WinBits mnWinStyle; + WindowAlign meAlign; + USHORT mnSplitTest; + USHORT mnSplitPos; + USHORT mnMouseModifier; + BOOL mbDragFull:1, + mbHorz:1, + mbBottomRight:1, + mbCalc:1, + mbRecalc:1, + mbInvalidate:1, + mbSizeable:1, + mbBorder:1, + mbAutoHide:1, + mbFadeIn:1, + mbFadeOut:1, + mbAutoHideIn:1, + mbAutoHideDown:1, + mbFadeInDown:1, + mbFadeOutDown:1, + mbAutoHidePressed:1, + mbFadeInPressed:1, + mbFadeOutPressed:1, + mbFadeNoButtonMode:1, + mbNoAlign:1; + Link maStartSplitHdl; + Link maSplitHdl; + Link maSplitResizeHdl; + Link maAutoHideHdl; + Link maFadeInHdl; + Link maFadeOutHdl; + + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + SAL_DLLPRIVATE void ImplCalcLayout(); + SAL_DLLPRIVATE void ImplUpdate(); + SAL_DLLPRIVATE void ImplUpdateSet( ImplSplitSet* pSet ); + SAL_DLLPRIVATE void ImplSetWindowSize( long nDelta ); + SAL_DLLPRIVATE void ImplSplitMousePos( Point& rMousePos ); + SAL_DLLPRIVATE void ImplGetButtonRect( Rectangle& rRect, long nEx, BOOL bTest ) const; + SAL_DLLPRIVATE void ImplGetAutoHideRect( Rectangle& rRect, BOOL bTest = FALSE ) const; + SAL_DLLPRIVATE void ImplGetFadeInRect( Rectangle& rRect, BOOL bTest = FALSE ) const; + SAL_DLLPRIVATE void ImplGetFadeOutRect( Rectangle& rRect, BOOL bTest = FALSE ) const; + SAL_DLLPRIVATE void ImplDrawButtonRect( const Rectangle& rRect, long nSize ); + SAL_DLLPRIVATE void ImplDrawAutoHide( BOOL bInPaint ); + SAL_DLLPRIVATE void ImplDrawFadeIn( BOOL bInPaint ); + SAL_DLLPRIVATE void ImplDrawFadeOut( BOOL bInPaint ); + SAL_DLLPRIVATE void ImplNewAlign(); + SAL_DLLPRIVATE void ImplDrawGrip( const Rectangle& rRect, BOOL bHorz, BOOL bLeft ); + SAL_DLLPRIVATE void ImplDrawFadeArrow( const Point& rPt, BOOL bHorz, BOOL bLeft ); + SAL_DLLPRIVATE void ImplStartSplit( const MouseEvent& rMEvt ); + + static SAL_DLLPRIVATE void ImplDrawBorder( SplitWindow* pWin ); + static SAL_DLLPRIVATE void ImplDrawBorderLine( SplitWindow* pWin ); + static SAL_DLLPRIVATE void ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, BOOL bHide, + BOOL bRows, BOOL bDown = TRUE ); + static SAL_DLLPRIVATE void ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet ); + static SAL_DLLPRIVATE void ImplDrawBack( SplitWindow* pWindow, const Rectangle& rRect, + const Wallpaper* pWall, const Bitmap* pBitmap ); + static SAL_DLLPRIVATE USHORT ImplTestSplit( ImplSplitSet* pSet, const Point& rPos, + long& rMouseOff, ImplSplitSet** ppFoundSet, USHORT& rFoundPos, + BOOL bRows, BOOL bDown = TRUE ); + static SAL_DLLPRIVATE USHORT ImplTestSplit( SplitWindow* pWindow, const Point& rPos, + long& rMouseOff, ImplSplitSet** ppFoundSet, USHORT& rFoundPos ); + static SAL_DLLPRIVATE void ImplDrawSplitTracking( SplitWindow* pThis, const Point& rPos ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE SplitWindow (const SplitWindow &); + SAL_DLLPRIVATE SplitWindow & operator= (const SplitWindow &); +public: + SplitWindow( Window* pParent, WinBits nStyle = 0 ); + SplitWindow( Window* pParent, const ResId& rResId ); + ~SplitWindow(); + + virtual void StartSplit(); + virtual void Split(); + virtual void SplitResize(); + virtual void AutoHide(); + virtual void FadeIn(); + virtual void FadeOut(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Move(); + virtual void Resize(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void InsertItem( USHORT nId, Window* pWindow, long nSize, + USHORT nPos = SPLITWINDOW_APPEND, USHORT nSetId = 0, + SplitWindowItemBits nBits = 0 ); + void InsertItem( USHORT nId, long nSize, + USHORT nPos = SPLITWINDOW_APPEND, USHORT nSetId = 0, + SplitWindowItemBits nBits = 0 ); + void MoveItem( USHORT nId, USHORT nNewPos, USHORT nNewSetId = 0 ); + void RemoveItem( USHORT nId, BOOL bHide = TRUE ); + void Clear(); + + void SetBaseSet( USHORT nSetId = 0 ); + USHORT GetBaseSet() const; + + void SetSplitSize( USHORT nSetId, long nSplitSize, + BOOL bWithChilds = FALSE ); + long GetSplitSize( USHORT nSetId ) const; + void SetItemBackground( USHORT nSetId ); + void SetItemBackground( USHORT nSetId, const Wallpaper& rWallpaper ); + Wallpaper GetItemBackground( USHORT nSetId ) const; + BOOL IsItemBackground( USHORT nSetId ) const; + void SetItemBitmap( USHORT nSetId, const Bitmap& rBitmap ); + Bitmap GetItemBitmap( USHORT nSetId ) const; + + void SplitItem( USHORT nId, long nNewSize, + BOOL bPropSmall = FALSE, + BOOL bPropGreat = FALSE ); + void SetItemSize( USHORT nId, long nNewSize ); + long GetItemSize( USHORT nId ) const; + /** Set a range that limits the (variable part of the) size with an + upper and a lower bound (both are valid values themselves.) + @param nId + Id of the item for which the size limits are set. + @param aRange + Values of -1 define missing bounds, thus setting a range (-1,-1) + (the default) removes the size limitiation. + */ + void SetItemSizeRange (USHORT nId, const Range aRange); + /** Return the current size limits for the specified item. + */ + Range GetItemSizeRange (USHORT nId) const; + long GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const; + void SetItemBits( USHORT nId, SplitWindowItemBits nNewBits ); + SplitWindowItemBits GetItemBits( USHORT nId ) const; + Window* GetItemWindow( USHORT nId ) const; + USHORT GetSet( USHORT nId ) const; + BOOL GetSet( USHORT nId, USHORT& rSetId, USHORT& rPos ) const; + USHORT GetItemId( Window* pWindow ) const; + USHORT GetItemId( const Point& rPos ) const; + USHORT GetItemPos( USHORT nId, USHORT nSetId = 0 ) const; + USHORT GetItemId( USHORT nPos, USHORT nSetId = 0 ) const; + USHORT GetItemCount( USHORT nSetId = 0 ) const; + BOOL IsItemValid( USHORT nId ) const; + + void SetNoAlign( BOOL bNoAlign ); + BOOL IsNoAlign() const { return mbNoAlign; } + void SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP ); + WindowAlign GetAlign() const { return meAlign; } + BOOL IsHorizontal() const { return mbHorz; } + + BOOL IsSplitting() const { return IsTracking(); } + + void SetMaxSizePixel( long nNewMaxSize ) { mnMaxSize = nNewMaxSize; } + long GetMaxSizePixel() const { return mnMaxSize; } + + static Size CalcWindowSizePixel( const Size& rSize, + WindowAlign eAlign, + WinBits nWinStyle, + BOOL bExtra = FALSE ); + Size CalcWindowSizePixel( const Size& rSize ) + { return CalcWindowSizePixel( rSize, meAlign, mnWinStyle, (mbAutoHide || mbFadeOut) ); } + + Size CalcLayoutSizePixel( const Size& aNewSize ); + + void ShowAutoHideButton( BOOL bShow = TRUE ); + BOOL IsAutoHideButtonVisible() const { return mbAutoHide; } + void ShowFadeInHideButton( BOOL bShow = TRUE ); + void ShowFadeInButton( BOOL bShow = TRUE ) { ShowFadeInHideButton( bShow ); } + BOOL IsFadeInButtonVisible() const { return mbFadeIn; } + void ShowFadeOutButton( BOOL bShow = TRUE ); + BOOL IsFadeOutButtonVisible() const { return mbFadeOut; } + long GetFadeInSize() const; + BOOL IsFadeNoButtonMode() const { return mbFadeNoButtonMode; } + + void SetAutoHideState( BOOL bAutoHide ); + BOOL GetAutoHideState() const { return mbAutoHideIn; } + + Rectangle GetAutoHideRect() const; + Rectangle GetFadeInRect() const; + Rectangle GetFadeOutRect() const; + + void SetStartSplitHdl( const Link& rLink ) { maStartSplitHdl = rLink; } + const Link& GetStartSplitHdl() const { return maStartSplitHdl; } + void SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; } + const Link& GetSplitHdl() const { return maSplitHdl; } + void SetSplitResizeHdl( const Link& rLink ) { maSplitResizeHdl = rLink; } + const Link& GetSplitResizeHdl() const { return maSplitResizeHdl; } + void SetAutoHideHdl( const Link& rLink ) { maAutoHideHdl = rLink; } + const Link& GetAutoHideHdl() const { return maAutoHideHdl; } + void SetFadeInHdl( const Link& rLink ) { maFadeInHdl = rLink; } + const Link& GetFadeInHdl() const { return maFadeInHdl; } + void SetFadeOutHdl( const Link& rLink ) { maFadeOutHdl = rLink; } + const Link& GetFadeOutHdl() const { return maFadeOutHdl; } +}; + +#endif // _SV_SPLITWIN_HXX diff --git a/vcl/inc/vcl/status.hxx b/vcl/inc/vcl/status.hxx new file mode 100644 index 000000000000..810ecf230960 --- /dev/null +++ b/vcl/inc/vcl/status.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * 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_STATUS_HXX +#define _SV_STATUS_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +class ImplStatusItemList; + +// -------------------- +// - Progress-Ausgabe - +// -------------------- + +void VCL_DLLPUBLIC DrawProgress( Window* pWindow, const Point& rPos, + long nOffset, long nPrgsWidth, long nPrgsHeight, + USHORT nPercent1, USHORT nPercent2, USHORT nPercentCount, + const Rectangle& rFramePosSize + ); + +// --------------------- +// - StatusBarItemBits - +// --------------------- + +typedef USHORT StatusBarItemBits; + +// ---------------------------- +// - Bits fuer StatusBarItems - +// ---------------------------- + +#define SIB_LEFT ((StatusBarItemBits)0x0001) +#define SIB_CENTER ((StatusBarItemBits)0x0002) +#define SIB_RIGHT ((StatusBarItemBits)0x0004) +#define SIB_IN ((StatusBarItemBits)0x0008) +#define SIB_OUT ((StatusBarItemBits)0x0010) +#define SIB_FLAT ((StatusBarItemBits)0x0020) +#define SIB_AUTOSIZE ((StatusBarItemBits)0x0040) +#define SIB_USERDRAW ((StatusBarItemBits)0x0080) + +// ------------------- +// - StatusBar-Types - +// ------------------- + +#define STATUSBAR_APPEND ((USHORT)0xFFFF) +#define STATUSBAR_ITEM_NOTFOUND ((USHORT)0xFFFF) +#define STATUSBAR_OFFSET ((long)5) + +// ------------- +// - StatusBar - +// ------------- + +class VCL_DLLPUBLIC StatusBar : public Window +{ + class ImplData; +private: + ImplStatusItemList* mpItemList; + ImplData* mpImplData; + XubString maPrgsTxt; + Point maPrgsTxtPos; + Rectangle maPrgsFrameRect; + long mnPrgsSize; + long mnItemsWidth; + long mnDX; + long mnDY; + long mnCalcHeight; + long mnTextY; + long mnItemY; + USHORT mnCurItemId; + USHORT mnPercent; + USHORT mnPercentCount; + BOOL mbVisibleItems; + BOOL mbFormat; + BOOL mbProgressMode; + BOOL mbInUserDraw; + BOOL mbBottomBorder; + Link maClickHdl; + Link maDoubleClickHdl; + + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplFormat(); + SAL_DLLPRIVATE BOOL ImplIsItemUpdate(); +// #if 0 // _SOLAR__PRIVATE + using OutputDevice::ImplDrawText; +// #endif + SAL_DLLPRIVATE void ImplDrawText( BOOL bOffScreen, long nOldTextWidth ); + SAL_DLLPRIVATE void ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL bDrawFrame ); + SAL_DLLPRIVATE void ImplDrawProgress( BOOL bPaint, + USHORT nOldPerc, USHORT nNewPerc ); + SAL_DLLPRIVATE void ImplCalcProgressRect(); + SAL_DLLPRIVATE Rectangle ImplGetItemRectPos( USHORT nPos ) const; + SAL_DLLPRIVATE USHORT ImplGetFirstVisiblePos() const; + SAL_DLLPRIVATE void ImplCalcBorder(); + +public: + StatusBar( Window* pParent, + WinBits nWinStyle = WB_BORDER | WB_RIGHT ); + StatusBar( Window* pParent, const ResId& rResId ); + ~StatusBar(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Move(); + virtual void Resize(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Click(); + virtual void DoubleClick(); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + void InsertItem( USHORT nItemId, ULONG nWidth, + StatusBarItemBits nBits = SIB_CENTER | SIB_IN, + long nOffset = STATUSBAR_OFFSET, + USHORT nPos = STATUSBAR_APPEND ); + void RemoveItem( USHORT nItemId ); + + void ShowItem( USHORT nItemId ); + void HideItem( USHORT nItemId ); + BOOL IsItemVisible( USHORT nItemId ) const; + + void ShowItems(); + void HideItems(); + BOOL AreItemsVisible() const { return mbVisibleItems; } + + void CopyItems( const StatusBar& rStatusBar ); + void Clear(); + + USHORT GetItemCount() const; + USHORT GetItemId( USHORT nPos ) const; + USHORT GetItemId( const Point& rPos ) const; + USHORT GetItemPos( USHORT nItemId ) const; + Rectangle GetItemRect( USHORT nItemId ) const; + Point GetItemTextPos( USHORT nItemId ) const; + USHORT GetCurItemId() const { return mnCurItemId; } + + ULONG GetItemWidth( USHORT nItemId ) const; + StatusBarItemBits GetItemBits( USHORT nItemId ) const; + long GetItemOffset( USHORT nItemId ) const; + + void SetItemText( USHORT nItemId, const XubString& rText ); + const XubString& GetItemText( USHORT nItemId ) const; + + void SetItemData( USHORT nItemId, void* pNewData ); + void* GetItemData( USHORT nItemId ) const; + + void SetItemCommand( USHORT nItemId, const XubString& rCommand ); + const XubString& GetItemCommand( USHORT nItemId ); + + void SetHelpText( USHORT nItemId, const XubString& rText ); + const XubString& GetHelpText( USHORT nItemId ) const; + + using Window::SetQuickHelpText; + void SetQuickHelpText( USHORT nItemId, const XubString& rText ); + using Window::GetQuickHelpText; + const XubString& GetQuickHelpText( USHORT nItemId ) const; + + void SetHelpId( USHORT nItemId, ULONG nHelpId ); + ULONG GetHelpId( USHORT nItemId ) const; + + void SetBottomBorder( BOOL bBottomBorder = TRUE ); + BOOL IsBottomBorder() const { return mbBottomBorder; } + + void SetTopBorder( BOOL bTopBorder = TRUE ); + BOOL IsTopBorder() const; + + void StartProgressMode( const XubString& rText ); + void SetProgressValue( USHORT nPercent ); + void EndProgressMode(); + BOOL IsProgressMode() const { return mbProgressMode; } + void ResetProgressMode(); + + void SetText( const XubString& rText ); + + void SetHelpText( const XubString& rText ) + { Window::SetHelpText( rText ); } + const XubString& GetHelpText() const + { return Window::GetHelpText(); } + + void SetHelpId( ULONG nId ) + { Window::SetHelpId( nId ); } + ULONG GetHelpId() const + { return Window::GetHelpId(); } + + Size CalcWindowSizePixel() const; + + void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } + const Link& GetClickHdl() const { return maClickHdl; } + void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } + const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + + using Window::SetAccessibleName; + void SetAccessibleName( USHORT nItemId, const XubString& rName ); + using Window::GetAccessibleName; + const XubString& GetAccessibleName( USHORT nItemId ) const; +}; + +#endif // _SV_STATUS_HXX diff --git a/vcl/inc/vcl/stdtext.hxx b/vcl/inc/vcl/stdtext.hxx new file mode 100644 index 000000000000..111e58aca5bf --- /dev/null +++ b/vcl/inc/vcl/stdtext.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_STDTEXT_HXX +#define _VCL_STDTEXT_HXX + +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +class Window; + +// ------------------ +// - Standard-Texte - +// ------------------ + +#define STANDARD_TEXT_FIRST STANDARD_TEXT_SERVICE_NOT_AVAILABLE +#define STANDARD_TEXT_SERVICE_NOT_AVAILABLE ((USHORT)0) +#define STANDARD_TEXT_LAST STANDARD_TEXT_SERVICE_NOT_AVAILABLE + +XubString VCL_DLLPUBLIC GetStandardText( USHORT nStdText ); + +// ------------------------------------- +// - Hilfsmethoden fuer Standard-Texte - +// ------------------------------------- + +void VCL_DLLPUBLIC ShowServiceNotAvailableError( Window* pParent, const XubString& rServiceName, BOOL bError ); + +#endif // _VCL_STDTEXT_HXX diff --git a/vcl/inc/vcl/strhelper.hxx b/vcl/inc/vcl/strhelper.hxx new file mode 100644 index 000000000000..8df83d6f33f4 --- /dev/null +++ b/vcl/inc/vcl/strhelper.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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 _PSPRINT_STRHELPER_HXX_ +#define _PSPRINT_STRHELPER_HXX_ + +#include "vcl/dllapi.h" + +#include <tools/string.hxx> +#include <rtl/math.hxx> + +#include <cstring> + +namespace psp { + +String VCL_DLLPUBLIC GetCommandLineToken( int, const String& ); +ByteString VCL_DLLPUBLIC GetCommandLineToken( int, const ByteString& ); +// gets one token of a unix command line style string +// doublequote, singlequote and singleleftquote protect their respective +// contents + +int VCL_DLLPUBLIC GetCommandLineTokenCount( const String& ); +int VCL_DLLPUBLIC GetCommandLineTokenCount( const ByteString& ); +// returns number of tokens (zero if empty or whitespace only) + +String VCL_DLLPUBLIC WhitespaceToSpace( const String&, BOOL bProtect = TRUE ); +ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, BOOL bProtect = TRUE ); +// returns a string with multiple adjacent occurences of whitespace +// converted to a single space. if bProtect is TRUE (nonzero), then +// doublequote, singlequote and singleleftquote protect their respective +// contents + + +// parses the first double in the string; decimal is '.' only +inline double VCL_DLLPUBLIC StringToDouble( const String& rStr ) +{ + rtl_math_ConversionStatus eStatus; + return rtl::math::stringToDouble( rStr, sal_Unicode('.'), sal_Unicode(0), &eStatus, NULL); +} + +inline double VCL_DLLPUBLIC StringToDouble( const ByteString& rStr ) +{ + rtl_math_ConversionStatus eStatus; + return rtl::math::stringToDouble( rtl::OStringToOUString( rStr, osl_getThreadTextEncoding() ), sal_Unicode('.'), sal_Unicode(0), &eStatus, NULL); +} + +// fills a character buffer with the string representation of a double +// the buffer has to be long enough (e.g. 128 bytes) +// returns the string len +inline int VCL_DLLPUBLIC getValueOfDouble( char* pBuffer, double f, int nPrecision = 0) +{ + rtl::OString aStr( rtl::math::doubleToString( f, rtl_math_StringFormat_G, nPrecision, '.', true ) ); + int nLen = aStr.getLength(); + std::strncpy( pBuffer, aStr.getStr(), nLen+1 ); // copy string including terminating zero + return nLen; +} + +} // namespace + +#endif // _PSPRINT_STRHELPER_HXX_ diff --git a/vcl/inc/vcl/subedit.hxx b/vcl/inc/vcl/subedit.hxx new file mode 100644 index 000000000000..3ea1eaffa864 --- /dev/null +++ b/vcl/inc/vcl/subedit.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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_SUBEDIT_HXX +#define _SV_SUBEDIT_HXX + +#include <vcl/sv.h> +#include <vcl/edit.hxx> + +// --------------- +// - ImplSubEdit - +// --------------- + +class ImplSubEdit : public Edit +{ +public: + ImplSubEdit( Edit* pParent, WinBits nStyle ); + + Edit* GetParent() const { return (Edit*)Edit::GetParent(); } + + virtual void Modify(); +}; + +#endif // _SV_SUBEDIT_HXX diff --git a/vcl/inc/vcl/sv.h b/vcl/inc/vcl/sv.h new file mode 100644 index 000000000000..9296570a71bb --- /dev/null +++ b/vcl/inc/vcl/sv.h @@ -0,0 +1,33 @@ +/************************************************************************* + * + * 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_SV_H +#define _SV_SV_H + +#include <tools/solar.h> + +#endif // _SV_SV_H diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx new file mode 100644 index 000000000000..f90326ce50eb --- /dev/null +++ b/vcl/inc/vcl/svapp.hxx @@ -0,0 +1,517 @@ +/************************************************************************* + * + * 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_SVAPP_HXX +#define _SV_SVAPP_HXX + +#ifndef _VOS_THREAD_HXX +#include <vos/thread.hxx> +#endif +#include <tools/string.hxx> +#include <tools/link.hxx> +#include <tools/unqid.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/apptypes.hxx> +#ifndef _VCL_SETTINGS_HXX +#include <vcl/settings.hxx> +#endif +#include <vcl/vclevent.hxx> +class Link; +class AllSettings; +class DataChangedEvent; +class Accelerator; +class Help; +class OutputDevice; +class Window; +class WorkWindow; +class MenuBar; +class UnoWrapperBase; +class Reflection; +class KeyCode; +class NotifyEvent; +class KeyEvent; +class MouseEvent; + +namespace vos { class IMutex; } +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/connection/XConnection.hpp> + +namespace com { +namespace sun { +namespace star { +namespace lang { + class XMultiServiceFactory; +} +namespace awt { + class XToolkit; + class XDisplayConnection; +} +} } } + +// helper needed by SalLayout implementations as well as svx/source/dialog/svxbmpnumbalueset.cxx +VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 ); + +// -------------------- +// - SystemWindowMode - +// -------------------- + +#define SYSTEMWINDOW_MODE_NOAUTOMODE ((USHORT)0x0001) +#define SYSTEMWINDOW_MODE_DIALOG ((USHORT)0x0002) + +// ------------- +// - EventHook - +// ------------- + +typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData ); + +// -------------------- +// - ApplicationEvent - +// -------------------- + +// Erstmal wieder eingebaut, damit AppEvents auf dem MAC funktionieren +#ifdef UNX +// enum Doppelt in daemon.cxx unter unix Achtung !!! +enum Service { SERVICE_OLE, SERVICE_APPEVENT, SERVICE_IPC }; +#endif + +class VCL_DLLPUBLIC ApplicationAddress +{ +friend class Application; +protected: + UniString aHostName; + UniString aDisplayName; + UniString aDomainName; + int nPID; + +public: + ApplicationAddress(); + ApplicationAddress( const UniString& rDomain ); + ApplicationAddress( const UniString& rHost, + const UniString& rDisp, + const UniString& rDomain ); + ApplicationAddress( const UniString& rHost, int nPID ); + + const UniString& GetHost() const { return aHostName; } + const UniString& GetDisplay() const { return aDisplayName; } + const UniString& GetDomain() const { return aDomainName; } + int GetPID() const { return nPID; } + + BOOL IsConnectToSame( const ApplicationAddress& rAdr ) const; +}; + +inline ApplicationAddress::ApplicationAddress() +{ + nPID = 0; +} + +inline ApplicationAddress::ApplicationAddress( const UniString& rDomain ) +{ + aDomainName = rDomain; + nPID = 0; +} + +inline ApplicationAddress::ApplicationAddress( const UniString& rHost, + const UniString& rDisp, + const UniString& rDomain ) +{ + aHostName = rHost; + aDisplayName = rDisp; + aDomainName = rDomain; + nPID = 0; +} + +inline ApplicationAddress::ApplicationAddress( const UniString& rHost, int nPIDPar ) +{ + aHostName = rHost; + nPID = nPIDPar; +} + +inline BOOL ApplicationAddress::IsConnectToSame( const ApplicationAddress& rAdr ) const +{ + if ( nPID && ((nPID == rAdr.nPID) && (aHostName.Equals( rAdr.aHostName))) ) + return TRUE; + else + return FALSE; +} + +#define APPEVENT_PARAM_DELIMITER '\n' + +#define APPEVENT_OPEN_STRING "Open" +#define APPEVENT_PRINT_STRING "Print" +#define APPEVENT_DISKINSERT_STRING "DiskInsert" +#define APPEVENT_SAVEDOCUMENTS_STRING "SaveDocuments" + +class VCL_DLLPUBLIC ApplicationEvent +{ +private: + UniString aSenderAppName; // Absender Applikationsname + ByteString aEvent; // Event + UniString aData; // Uebertragene Daten + ApplicationAddress aAppAddr; // Absender Addresse + +public: + ApplicationEvent() {} + ApplicationEvent( const UniString& rSenderAppName, + const ApplicationAddress& rAppAddr, + const ByteString& rEvent, + const UniString& rData ); + + const UniString& GetSenderAppName() const { return aSenderAppName; } + const ByteString& GetEvent() const { return aEvent; } + const UniString& GetData() const { return aData; } + const ApplicationAddress& GetAppAddress() const { return aAppAddr; } + + BOOL IsOpenEvent() const; + BOOL IsPrintEvent() const; + BOOL IsDiskInsertEvent() const; + + USHORT GetParamCount() const { return aData.GetTokenCount( APPEVENT_PARAM_DELIMITER ); } + UniString GetParam( USHORT nParam ) const { return aData.GetToken( nParam, APPEVENT_PARAM_DELIMITER ); } +}; + +inline ApplicationEvent::ApplicationEvent( const UniString& rSenderAppName, + const ApplicationAddress& rAppAddr, + const ByteString& rEvent, + const UniString& rData ) : + aSenderAppName( rSenderAppName ), + aEvent( rEvent ), + aData( rData ), + aAppAddr( rAppAddr ) +{ +} + +inline BOOL ApplicationEvent::IsOpenEvent() const +{ + if ( aEvent.Equals( APPEVENT_OPEN_STRING )) + return TRUE; + else + return FALSE; +} + +inline BOOL ApplicationEvent::IsPrintEvent() const +{ + if ( aEvent.Equals( APPEVENT_PRINT_STRING )) + return TRUE; + else + return FALSE; +} + +inline BOOL ApplicationEvent::IsDiskInsertEvent() const +{ + if ( aEvent.Equals( APPEVENT_DISKINSERT_STRING )) + return TRUE; + else + return FALSE; +} + +class VCL_DLLPUBLIC PropertyHandler +{ +public: + virtual void Property( ApplicationProperty& ) = 0; +}; + +// --------------- +// - Application - +// --------------- + +class VCL_DLLPUBLIC Application +{ +public: + Application(); + virtual ~Application(); + + virtual void Main() = 0; + + virtual BOOL QueryExit(); + + virtual void UserEvent( ULONG nEvent, void* pEventData ); + + virtual void ActivateExtHelp(); + virtual void DeactivateExtHelp(); + + virtual void ShowStatusText( const XubString& rText ); + virtual void HideStatusText(); + + virtual void ShowHelpStatusText( const XubString& rText ); + virtual void HideHelpStatusText(); + + virtual void FocusChanged(); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void Init(); + virtual void DeInit(); + + static void InitAppRes( const ResId& rResId ); + + static USHORT GetCommandLineParamCount(); + static XubString GetCommandLineParam( USHORT nParam ); + static const XubString& GetAppFileName(); + + virtual USHORT Exception( USHORT nError ); + static void Abort( const XubString& rErrorText ); + + static void Execute(); + static void Quit(); + static void Reschedule( bool bAllEvents = false ); + static void Yield( bool bAllEvents = false ); + static void EndYield(); + static vos::IMutex& GetSolarMutex(); + static vos::OThread::TThreadIdentifier GetMainThreadIdentifier(); + static ULONG ReleaseSolarMutex(); + static void AcquireSolarMutex( ULONG nCount ); + static void EnableNoYieldMode( bool i_bNoYield ); + static void AddPostYieldListener( const Link& i_rListener ); + static void RemovePostYieldListener( const Link& i_rListener ); + + static BOOL IsInMain(); + static BOOL IsInExecute(); + static BOOL IsShutDown(); + static BOOL IsInModalMode(); + static USHORT GetModalModeCount(); + + static USHORT GetDispatchLevel(); + static BOOL AnyInput( USHORT nType = INPUT_ANY ); + static ULONG GetLastInputInterval(); + static BOOL IsUICaptured(); + static BOOL IsUserActive( USHORT nTest = USERACTIVE_ALL ); + + virtual void SystemSettingsChanging( AllSettings& rSettings, + Window* pFrame ); + static void MergeSystemSettings( AllSettings& rSettings ); + /** validate that the currently selected system UI font is suitable + to display the application's UI. + + A localized test string will be checked if it can be displayed + in the currently selected system UI font. If no glyphs are + missing it can be assumed that the font is proper for display + of the application's UI. + + @returns + <TRUE/> if the system font is suitable for our UI + <FALSE/> if the test string could not be displayed with the system font + */ + static bool ValidateSystemFont(); + + static void SetSettings( const AllSettings& rSettings ); + static const AllSettings& GetSettings(); + static void NotifyAllWindows( DataChangedEvent& rDCEvt ); + + static void AddEventListener( const Link& rEventListener ); + static void RemoveEventListener( const Link& rEventListener ); + static void AddKeyListener( const Link& rKeyListener ); + static void RemoveKeyListener( const Link& rKeyListener ); + static void ImplCallEventListeners( ULONG nEvent, Window* pWin, void* pData ); + static void ImplCallEventListeners( VclSimpleEvent* pEvent ); + static BOOL HandleKey( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent ); + + static ULONG PostKeyEvent( ULONG nEvent, Window *pWin, KeyEvent* pKeyEvent ); + static ULONG PostMouseEvent( ULONG nEvent, Window *pWin, MouseEvent* pMouseEvent ); + static void RemoveMouseAndKeyEvents( Window *pWin ); + static BOOL IsProcessedMouseOrKeyEvent( ULONG nEventId ); + + static ULONG PostUserEvent( ULONG nEvent, void* pEventData = NULL ); + static ULONG PostUserEvent( const Link& rLink, void* pCaller = NULL ); + static BOOL PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData = NULL ); + static BOOL PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller = NULL ); + static void RemoveUserEvent( ULONG nUserEvent ); + + static BOOL InsertIdleHdl( const Link& rLink, USHORT nPriority ); + static void RemoveIdleHdl( const Link& rLink ); + + virtual void AppEvent( const ApplicationEvent& rAppEvent ); + + virtual void Property( ApplicationProperty& ); + void SetPropertyHandler( PropertyHandler* pHandler ); + +#ifndef NO_GETAPPWINDOW + static WorkWindow* GetAppWindow(); +#endif + + static Window* GetFocusWindow(); + static OutputDevice* GetDefaultDevice(); + + static Window* GetFirstTopLevelWindow(); + static Window* GetNextTopLevelWindow( Window* pWindow ); + + static long GetTopWindowCount(); + static Window* GetTopWindow( long nIndex ); + static Window* GetActiveTopWindow(); + + static void SetAppName( const String& rUniqueName ); + static String GetAppName(); + + static void SetDisplayName( const UniString& rDisplayName ); + static UniString GetDisplayName(); + + static unsigned int GetScreenCount(); + // IsMultiDisplay returns: + // true: different screens are separate and windows cannot be moved + // between them (e.g. Xserver with multiple screens) + // false: screens form up one large display area + // windows can be moved between single screens + // (e.g. Xserver with Xinerama, Windows) + static bool IsMultiDisplay(); + static Rectangle GetScreenPosSizePixel( unsigned int nScreen ); + static Rectangle GetWorkAreaPosSizePixel( unsigned int nScreen ); + static rtl::OUString GetScreenName( unsigned int nScreen ); + static unsigned int GetDefaultDisplayNumber(); + // if IsMultiDisplay() == false the return value will be + // nearest screen of the target rectangle + // in case of IsMultiDisplay() == true the return value + // will always be GetDefaultDisplayNumber() + static unsigned int GetBestScreen( const Rectangle& ); + + static const LocaleDataWrapper& GetAppLocaleDataWrapper(); + + static BOOL InsertAccel( Accelerator* pAccel ); + static void RemoveAccel( Accelerator* pAccel ); + static void FlushAccel(); + static BOOL CallAccel( const KeyCode& rKeyCode, USHORT nRepeat = 0 ); + + static ULONG AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData = NULL ); + static void RemoveHotKey( ULONG nId ); + static ULONG AddEventHook( VCLEventHookProc pProc, void* pData = NULL ); + static void RemoveEventHook( ULONG nId ); + static long CallEventHooks( NotifyEvent& rEvt ); + static long CallPreNotify( NotifyEvent& rEvt ); + static long CallEvent( NotifyEvent& rEvt ); + + static void SetHelp( Help* pHelp = NULL ); + static Help* GetHelp(); + + static void EnableAutoHelpId( BOOL bEnabled = TRUE ); + static BOOL IsAutoHelpIdEnabled(); + + static void EnableAutoMnemonic( BOOL bEnabled = TRUE ); + static BOOL IsAutoMnemonicEnabled(); + + static ULONG GetReservedKeyCodeCount(); + static const KeyCode* GetReservedKeyCode( ULONG i ); + static String GetReservedKeyCodeDescription( ULONG i ); + + static void SetDefDialogParent( Window* pWindow ); + static Window* GetDefDialogParent(); + + static void EnableDialogCancel( BOOL bDialogCancel = TRUE ); + static BOOL IsDialogCancelEnabled(); + + static void SetSystemWindowMode( USHORT nMode ); + static USHORT GetSystemWindowMode(); + + static void SetDialogScaleX( short nScale ); + static short GetDialogScaleX(); + + static void SetFontPath( const String& rPath ); + static const String& GetFontPath(); + + static UniqueItemId CreateUniqueId(); + + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > GetDisplayConnection(); + + // The global service manager has to be created before! + static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > GetVCLToolkit(); + static UnoWrapperBase* GetUnoWrapper( BOOL bCreateIfNotExists = TRUE ); + static void SetUnoWrapper( UnoWrapperBase* pWrapper ); + + static void SetFilterHdl( const Link& rLink ); + static const Link& GetFilterHdl(); + + static BOOL IsAccessibilityEnabled(); + + static void EnableHeadlessMode( BOOL bEnable = TRUE ); + static BOOL IsHeadlessModeEnabled(); + + static void ShowNativeErrorBox(const String& sTitle , + const String& sMessage); + + // IME Status Window Control: + + /** Return true if any IME status window can be toggled on and off + externally. + + Must only be called with the Solar mutex locked. + */ + static bool CanToggleImeStatusWindow(); + + /** Toggle any IME status window on and off. + + This only works if CanToggleImeStatusWinodw returns true (otherwise, + any calls of this method are ignored). + + Must only be called with the Solar mutex locked. + */ + static void ShowImeStatusWindow(bool bShow); + + /** Return true if any IME status window should be turned on by default + (this decision can be locale dependent, for example). + + Can be called without the Solar mutex locked. + */ + static bool GetShowImeStatusWindowDefault(); + + /** Returns a string representing the desktop environment + the process is currently running in. + */ + static const ::rtl::OUString& GetDesktopEnvironment(); + + /** Add a file to the system shells recent document list if there is any. + This function may have no effect under Unix because there is no + standard API among the different desktop managers. + + @param rFileUrl + The file url of the document. + + @param rMimeType + The mime content type of the document specified by aFileUrl. + If an empty string will be provided "application/octet-stream" + will be used. + */ + static void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + +private: + + DECL_STATIC_LINK( Application, PostEventHandler, void* ); +}; + +VCL_DLLPUBLIC Application* GetpApp(); + +VCL_DLLPUBLIC BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); +VCL_DLLPUBLIC void DeInitVCL(); + +VCL_DLLPUBLIC BOOL InitAccessBridge( BOOL bAllowCancel, BOOL &rCancelled ); + +// only allowed to call, if no thread is running. You must call JoinMainLoopThread to free all memory. +VCL_DLLPUBLIC void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData ); +VCL_DLLPUBLIC void JoinMainLoopThread(); + +inline void Application::EndYield() +{ + PostUserEvent( Link() ); +} + +#endif // _APP_HXX diff --git a/vcl/inc/vcl/svcompat.hxx b/vcl/inc/vcl/svcompat.hxx new file mode 100644 index 000000000000..9e461da4e54b --- /dev/null +++ b/vcl/inc/vcl/svcompat.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_SVCOMPAT_HXX +#define _SV_SVCOMPAT_HXX + +#include <sv.h> + +// ----------- +// - Defines - +// ----------- + +#define COMPAT_FORMAT( char1, char2, char3, char4 ) \ + ((ULONG)((((ULONG)(char)(char1)))| \ + (((ULONG)(char)(char2))<<8UL)| \ + (((ULONG)(char)(char3))<<16UL)| \ + ((ULONG)(char)(char4))<<24UL)) + + +class SvStream; + +// -------------- +// - ImplCompat - +// -------------- + +class ImplCompat +{ + SvStream* mpRWStm; + UINT32 mnCompatPos; + UINT32 mnTotalSize; + UINT16 mnStmMode; + UINT16 mnVersion; + + ImplCompat() {} + ImplCompat( const ImplCompat& rCompat ) {} + ImplCompat& operator=( const ImplCompat& rCompat ) { return *this; } + BOOL operator==( const ImplCompat& rCompat ) { return FALSE; } + +public: + ImplCompat( SvStream& rStm, USHORT nStreamMode, UINT16 nVersion = 1 ); + ~ImplCompat(); + + UINT16 GetVersion() const { return mnVersion; } +}; + +#endif // _SV_SVCOMPAT_HXX diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx new file mode 100644 index 000000000000..fe69b0c0b4d4 --- /dev/null +++ b/vcl/inc/vcl/svdata.hxx @@ -0,0 +1,456 @@ +/************************************************************************* + * + * 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_SVDATA_HXX +#define _SV_SVDATA_HXX + +#ifndef _VOS_THREAD_HXX +#include <vos/thread.hxx> +#endif +#include <tools/string.hxx> +#include <tools/gen.hxx> +#include <tools/shl.hxx> +#include <tools/link.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/sv.h> +#include <tools/color.hxx> +#include <tools/debug.hxx> +#include <vcl/dllapi.h> +#include <com/sun/star/uno/Reference.hxx> +#include <unotools/options.hxx> + +namespace com { +namespace sun { +namespace star { +namespace lang { + class XMultiServiceFactory; +} +namespace frame { + class XSessionManagerClient; +} +namespace awt { + class XDisplayConnection; +} +}}} + +struct ImplTimerData; +struct ImplFileImageCacheData; +struct ImplConfigData; +class ImplDirectFontSubstitution; +struct ImplHotKey; +struct ImplEventHook; +class Point; +class Rectangle; +class ImpResMgr; +class ResMgr; +class UniqueIndex; +class ImplAccelManager; +class ImplDevFontList; +class ImplFontCache; +class HelpTextWindow; +class ImplTBDragMgr; +class ImplButtonList; +class ImplIdleMgr; +class DbgWindow; +class FloatingWindow; +class AllSettings; +class KeyCode; +class NotifyEvent; +class Timer; +class AutoTimer; +class Help; +class ImageList; +class Image; +class PopupMenu; +class Application; +class OutputDevice; +class Window; +class SystemWindow; +class WorkWindow; +class Dialog; +class VirtualDevice; +class Printer; +class SalFrame; +class SalInstance; +class SalSystem; +class SalProcessWindowList; +class SalTrayList; +class UniqueIdContainer; +class List; +class ImplPrnQueueList; +class ImplVDevCache; +class UnoWrapperBase; +class GraphicConverter; +class ImplWheelWindow; +class SalTimer; +class SalI18NImeStatus; +class DockingManager; +class VclEventListeners2; + +namespace vos { class OMutex; } +namespace vos { class OCondition; } +namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } +namespace utl { class DefaultFontConfiguration; class FontSubstConfiguration; } + +// ----------------- +// - ImplSVAppData - +// ----------------- +class LocaleConfigurationListener : public utl::ConfigurationListener +{ +public: + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); +}; + +struct ImplSVAppData +{ + enum ImeStatusWindowMode + { + ImeStatusWindowMode_UNKNOWN, + ImeStatusWindowMode_HIDE, + ImeStatusWindowMode_SHOW + }; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; + String* mpMSFTempFileName; + AllSettings* mpSettings; // Application settings + LocaleConfigurationListener* mpCfgListener; + VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) + VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) + ImplAccelManager* mpAccelMgr; // Accelerator Manager + XubString* mpAppName; // Application name + XubString* mpAppFileName; // Abs. Application FileName + XubString* mpDisplayName; // Application Display Name + String* mpFontPath; // Additional Fontpath + Help* mpHelp; // Application help + PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute) + UniqueIdContainer* mpUniqueIdCont; // Fuer Eindeutige Id's + ImplIdleMgr* mpIdleMgr; // Idle-Manager + ImplWheelWindow* mpWheelWindow; // WheelWindow + ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung + ImplEventHook* mpFirstEventHook; // Event-Hooks + VclEventListeners2* mpPostYieldListeners; // post yield listeners + ULONG mnLastInputTime; // GetLastInputTime() + USHORT mnDispatchLevel; // DispatchLevel + USHORT mnModalMode; // ModalMode Count + USHORT mnModalDialog; // ModalDialog Count + USHORT mnAccessCount; // AccessHdl Count + USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen + USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing + short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs + BOOL mbInAppMain; // is Application::Main() on stack + BOOL mbInAppExecute; // is Application::Execute() on stack + BOOL mbAppQuit; // is Application::Quit() called + BOOL mbSettingsInit; // TRUE: Settings are initialized + BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + BOOL mbNoYield; // Application::Yield will not wait for events if the queue is empty + // essentially that makes it the same as Application::Reschedule + + /** Controls whether showing any IME status window is toggled on or off. + + Only meaningful if showing IME status windows can be toggled on and off + externally (see Application::CanToggleImeStatusWindow). + */ + ImeStatusWindowMode meShowImeStatusWindow; + + DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* ); + +}; + + +// ----------------- +// - ImplSVGDIData - +// ----------------- + +struct ImplSVGDIData +{ + OutputDevice* mpFirstWinGraphics; // First OutputDevice with a Frame Graphics + OutputDevice* mpLastWinGraphics; // Last OutputDevice with a Frame Graphics + OutputDevice* mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics + OutputDevice* mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics + OutputDevice* mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics + OutputDevice* mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics + VirtualDevice* mpFirstVirDev; // First VirtualDevice + VirtualDevice* mpLastVirDev; // Last VirtualDevice + Printer* mpFirstPrinter; // First Printer + Printer* mpLastPrinter; // Last Printer + ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue + ImplDevFontList* mpScreenFontList; // Screen-Font-List + ImplFontCache* mpScreenFontCache; // Screen-Font-Cache + ImplDirectFontSubstitution* mpDirectFontSubst;// Font-Substitutons defined in Tools->Options->Fonts + GraphicConverter* mpGrfConverter; // Converter for graphics + long mnRealAppFontX; // AppFont X-Numenator for 40/tel Width + long mnAppFontX; // AppFont X-Numenator for 40/tel Width + DialogScaleX + long mnAppFontY; // AppFont Y-Numenator for 80/tel Height + BOOL mbFontSubChanged; // TRUE: FontSubstitution wurde zwischen Begin/End geaendert + utl::DefaultFontConfiguration* mpDefaultFontConfiguration; + utl::FontSubstConfiguration* mpFontSubstConfiguration; + bool mbPrinterPullModel; // true: use pull model instead of normal push model when printing + bool mbNativeFontConfig; // true: do not override UI font + bool mbNoXORClipping; // true: do not use XOR to achieve clipping effects +}; + + +// ----------------- +// - ImplSVWinData - +// ----------------- + +struct ImplSVWinData +{ + Window* mpFirstFrame; // First FrameWindow + Window* mpDefDialogParent; // Default Dialog Parent + WorkWindow* mpAppWin; // Application-Window + Window* mpFocusWin; // window, that has the focus + Window* mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set + Window* mpCaptureWin; // window, that has the mouse capture + Window* mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling) + DbgWindow* mpDbgWin; // debug window + FloatingWindow* mpFirstFloat; // First FloatingWindow in PopupMode + Dialog* mpLastExecuteDlg; // Erster Dialog, der sich in Execute befindet + Window* mpExtTextInputWin; // Window, which is in ExtTextInput + Window* mpTrackWin; // window, that is in tracking mode + AutoTimer* mpTrackTimer; // tracking timer + ImageList* mpMsgBoxImgList; // ImageList for MessageBox + ImageList* mpMsgBoxHCImgList; // ImageList for MessageBox (high contrast mode) + Window* mpAutoScrollWin; // window, that is in AutoScrollMode mode + USHORT mnTrackFlags; // tracking flags + USHORT mnAutoScrollFlags; // auto scroll flags + BOOL mbNoDeactivate; // TRUE: keine Deactivate durchfuehren + BOOL mbNoSaveFocus; // TRUE: menues must not save/restore focus + BOOL mbNoSaveBackground; // TRUE: save background is unnecessary or even less performant +}; + + +// ------------------ +// - ImplSVCtrlData - +// ------------------ + +struct ImplSVCtrlData +{ + ImageList* mpCheckImgList; // ImageList for CheckBoxes + ImageList* mpRadioImgList; // ImageList for RadioButtons + ImageList* mpPinImgList; // ImageList for PIN + ImageList* mpSplitHPinImgList; // ImageList for Horizontale SplitWindows + ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's) + ImageList* mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows) + ImageList* mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows) + Image* mpDisclosurePlus; + Image* mpDisclosurePlusHC; + Image* mpDisclosureMinus; + Image* mpDisclosureMinusHC; + ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox + USHORT mnCheckStyle; // CheckBox-Style for ImageList-Update + USHORT mnRadioStyle; // Radio-Style for ImageList-Update + ULONG mnLastCheckFColor; // Letzte FaceColor fuer CheckImage + ULONG mnLastCheckWColor; // Letzte WindowColor fuer CheckImage + ULONG mnLastCheckWTextColor; // Letzte WindowTextColor fuer CheckImage + ULONG mnLastCheckLColor; // Letzte LightColor fuer CheckImage + ULONG mnLastRadioFColor; // Letzte FaceColor fuer RadioImage + ULONG mnLastRadioWColor; // Letzte WindowColor fuer RadioImage + ULONG mnLastRadioLColor; // Letzte LightColor fuer RadioImage +}; + + +// ------------------ +// - ImplSVHelpData - +// ------------------ + +struct ImplSVHelpData +{ + BOOL mbContextHelp : 1; // is ContextHelp enabled + BOOL mbExtHelp : 1; // is ExtendedHelp enabled + BOOL mbExtHelpMode : 1; // is in ExtendedHelp Mode + BOOL mbOldBalloonMode : 1; // BallonMode, befor ExtHelpMode started + BOOL mbBalloonHelp : 1; // is BalloonHelp enabled + BOOL mbQuickHelp : 1; // is QuickHelp enabled + BOOL mbSetKeyboardHelp : 1; // tiphelp was activated by keyboard + BOOL mbKeyboardHelp : 1; // tiphelp was activated by keyboard + BOOL mbAutoHelpId : 1; // generate HelpIds + BOOL mbRequestingHelp : 1; // In Window::RequestHelp + HelpTextWindow* mpHelpWin; // HelpWindow + ULONG mnLastHelpHideTime; // ticks of last show +}; + +struct ImplSVNWFData +{ + bool mbMenuBarDockingAreaCommonBG; // e.g. WinXP default theme + bool mbDockingAreaSeparateTB; // individual toolbar backgrounds + // instead of one for docking area + bool mbToolboxDropDownSeparate; // two adjacent buttons for + // toolbox dropdown buttons + int mnMenuFormatExtraBorder; // inner popup menu border + bool mbFlatMenu; // no popup 3D border + Color maMenuBarHighlightTextColor; // override higlight text color + // in menubar if not transparent + bool mbOpenMenuOnF10; // on gnome the first menu opens on F10 + bool mbNoFocusRects; // on Aqua focus rects are not used + bool mbNoBoldTabFocus; // on Aqua and Gnome the focused tab has not bold text + bool mbCenteredTabs; // on Aqua, tabs are centered + bool mbNoActiveTabTextRaise; // on Aqua the text for the selected tab + // should not "jump up" a pixel + bool mbProgressNeedsErase; // set true for platforms that should draw the + // window background before drawing the native + // progress bar + bool mbCheckBoxNeedsErase; // set true for platforms that should draw the + // window background before drawing the native + // checkbox + bool mbScrollbarJumpPage; // true for "jump to here" behavior + int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner + // used on the Mac where the system resizer paints over + // our window content +}; + + +// -------------- +// - ImplSVData - +// -------------- + +struct ImplSVData +{ + void* mpSalData; // SalData + SalInstance* mpDefInst; // Default SalInstance + Application* mpApp; // pApp + WorkWindow* mpDefaultWin; // Default-Window + BOOL mbDeInit; // Is VCL deinitializing + ULONG mnThreadCount; // is VCL MultiThread enabled + ImplConfigData* mpFirstConfigData; // Zeiger auf ersten Config-Block + ImplTimerData* mpFirstTimerData; // list of all running timers + SalTimer* mpSalTimer; // interface to sal event loop/timers + SalI18NImeStatus* mpImeStatus; // interface to ime status window + SalSystem* mpSalSystem; // SalSystem interface + ResMgr* mpResMgr; // SV-Resource-Manager + ULONG mnTimerPeriod; // current timer period + ULONG mnTimerUpdate; // TimerCallbackProcs on stack + BOOL mbNotAllTimerCalled;// TRUE: Es muessen noch Timer abgearbeitet werden + BOOL mbNoCallTimer; // TRUE: No Timeout calls + ImplSVAppData maAppData; // indepen data for class Application + ImplSVGDIData maGDIData; // indepen data for Output classes + ImplSVWinData maWinData; // indepen data for Windows classes + ImplSVCtrlData maCtrlData; // indepen data for Control classes + ImplSVHelpData maHelpData; // indepen data for Help classes + ImplSVNWFData maNWFData; + UnoWrapperBase* mpUnoWrapper; + Window* mpIntroWindow; // the splash screen + DockingManager* mpDockingManager; + BOOL mbIsTestTool; + + vos::OThread::TThreadIdentifier mnMainThreadId; + ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XDisplayConnection > mxDisplayConnection; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge; + com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient; + ::vcl::SettingsConfigItem* mpSettingsConfigItem; + std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; +}; + +void ImplInitSVData(); +void ImplDeInitSVData(); +void ImplDestroySVData(); +Window* ImplGetDefaultWindow(); +VCL_DLLPUBLIC ResMgr* ImplGetResMgr(); +VCL_DLLPUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr +DockingManager* ImplGetDockingManager(); +void ImplWindowAutoMnemonic( Window* pWindow ); + +void ImplUpdateSystemProcessWindow(); +Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos ); + +// SVAPP.CXX +BOOL ImplCallHotKey( const KeyCode& rKeyCode ); +void ImplFreeHotKeyData(); +void ImplFreeEventHookData(); + +// WINPROC.CXX +long ImplCallPreNotify( NotifyEvent& rEvt ); +long ImplCallEvent( NotifyEvent& rEvt ); + +extern VCL_DLLPUBLIC ImplSVData* pImplSVData; +inline VCL_DLLPUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; } +inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); } + +bool ImplInitAccessBridge( BOOL bAllowCancel, BOOL &rCancelled ); + +// ----------------------------------------------------------------------- + +// ----------------- +// - ImplSVEmpyStr - +// ----------------- + +// Empty-SV-String + +inline const String& ImplGetSVEmptyStr() + { return String::EmptyString(); } +inline const ByteString& ImplGetSVEmptyByteStr() + { return ByteString::EmptyString(); } + +// ----------------------------------------------------------------------- + +// ---------------------- +// - struct ImplDelData - +// ---------------------- +// ImplDelData is used as a "dog tag" by a window when it +// does something that could indirectly destroy the window +// TODO: wild destruction of a window should not be possible + +struct ImplDelData +{ + ImplDelData* mpNext; + const Window* mpWindow; + BOOL mbDel; + + ImplDelData( const Window* pWindow = NULL ) + : mpNext( NULL ), mpWindow( NULL ), mbDel( FALSE ) + { if( pWindow ) AttachToWindow( pWindow ); } + + virtual ~ImplDelData(); + + bool IsDead() const + { + DBG_ASSERT( mbDel == FALSE, "object deleted while in use !" ); + return (mbDel!=FALSE); + } + BOOL /*deprecated */IsDelete() const { return (BOOL)IsDead(); } + +private: + void AttachToWindow( const Window* ); +}; + +// --------------- +// - ImplSVEvent - +// --------------- + +struct ImplSVEvent +{ + ULONG mnEvent; + void* mpData; + Link* mpLink; + Window* mpWindow; + ImplDelData maDelData; + BOOL mbCall; +}; + +#endif // _SV_SVDATA_HXX diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc new file mode 100644 index 000000000000..059ed1524b7c --- /dev/null +++ b/vcl/inc/vcl/svids.hrc @@ -0,0 +1,261 @@ +/************************************************************************* + * + * 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_SVIDS_HRC +#define _SV_SVIDS_HRC + +#include "svl/solar.hrc" + +#define SV_RESID_STDOFFSET 0 +#define SV_RESID_WINOFFSET 1 +#define SV_RESID_OS2OFFSET 2 +#define SV_RESID_MACOFFSET 3 +#define SV_RESID_UNIXOFFSET 4 +#define SV_RESID_MONOOFFSET 5 + +// Achtung: Diese Id's muessen min. 10 Werte auseinanderliegen, da +// je nach Style noch ein Offset aufgerechnet wird +#define SV_RESID_BITMAP_CHECK 1000 +#define SV_RESID_BITMAP_RADIO 1010 + +#define SV_RESID_BITMAP_MSGBOX 1020 +#define SV_RESID_BITMAP_MSGBOX_HC 1021 + +#define SV_RESID_BITMAP_PIN 1030 + +#define SV_RESID_BITMAP_SPLITHPIN 1040 +#define SV_RESID_BITMAP_SPLITVPIN 1041 +#define SV_RESID_BITMAP_SPLITHARW 1042 +#define SV_RESID_BITMAP_SPLITVARW 1043 + +#define SV_RESID_BITMAP_SCROLLMSK 1050 +#define SV_RESID_BITMAP_SCROLLBMP 1051 +#define SV_RESID_BITMAP_CLOSEDOC 1052 +#define SV_RESID_BITMAP_CLOSEDOCHC 1053 + +#define SV_DISCLOSURE_PLUS 1060 +#define SV_DISCLOSURE_MINUS 1061 +#define SV_DISCLOSURE_PLUS_HC 1062 +#define SV_DISCLOSURE_MINUS_HC 1063 + +#define SV_RESID_MENU_EDIT 2000 +#define SV_MENU_EDIT_UNDO 1 +#define SV_MENU_EDIT_CUT 2 +#define SV_MENU_EDIT_COPY 3 +#define SV_MENU_EDIT_PASTE 4 +#define SV_MENU_EDIT_DELETE 5 +#define SV_MENU_EDIT_SELECTALL 6 +#define SV_MENU_EDIT_INSERTSYMBOL 7 +#define SV_RESID_STRING_NOSELECTIONPOSSIBLE 2001 + +#define SV_MENU_MAC_SERVICES 2002 +#define SV_MENU_MAC_HIDEAPP 2003 +#define SV_MENU_MAC_HIDEALL 2004 +#define SV_MENU_MAC_SHOWALL 2005 +#define SV_MENU_MAC_QUITAPP 2006 + +#define SV_DLG_PRINT 2048 +#define SV_PRINT_OK 1 +#define SV_PRINT_CANCEL 2 +#define SV_PRINT_HELP 3 +#define SV_PRINT_PAGE_PREVIEW 4 +#define SV_PRINT_PAGE_TXT 5 +#define SV_PRINT_PAGE_FORWARD 6 +#define SV_PRINT_PAGE_BACKWARD 7 +#define SV_PRINT_PAGE_EDIT 8 +#define SV_PRINT_TABCTRL 9 +#define SV_PRINT_PRT_TYPE 10 +#define SV_PRINT_PRT_STATUS 11 +#define SV_PRINT_PRT_LOCATION 12 +#define SV_PRINT_PRT_COMMENT 13 +#define SV_PRINT_TOFILE_TXT 14 +#define SV_PRINT_DEFPRT_TXT 15 +#define SV_PRINT_PRINTPREVIEW_TXT 16 + +#define SV_PRINT_TAB_NUP 1 +#define SV_PRINT_PRT_NUP_LAYOUT_FL 1 +#define SV_PRINT_PRT_NUP_DEFAULT_BTN 2 +#define SV_PRINT_PRT_NUP_BROCHURE_BTN 3 +#define SV_PRINT_PRT_NUP_PAGES_BTN 4 +#define SV_PRINT_PRT_NUP_PAGES_BOX 5 +#define SV_PRINT_PRT_NUP_NUM_PAGES_TXT 6 +#define SV_PRINT_PRT_NUP_COLS_EDT 7 +#define SV_PRINT_PRT_NUP_TIMES_TXT 8 +#define SV_PRINT_PRT_NUP_ROWS_EDT 9 +#define SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT 10 +#define SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT 11 +#define SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT 12 +#define SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT 13 +#define SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT 14 +#define SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT 15 +#define SV_PRINT_PRT_NUP_ORIENTATION_TXT 16 +#define SV_PRINT_PRT_NUP_ORIENTATION_BOX 17 +#define SV_PRINT_PRT_NUP_ORDER_TXT 18 +#define SV_PRINT_PRT_NUP_ORDER_BOX 19 +#define SV_PRINT_PRT_NUP_BORDER_CB 20 + +#define SV_PRINT_PRT_NUP_ORIENTATION_AUTOMATIC 0 +#define SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT 1 +#define SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE 2 + +#define SV_PRINT_PRT_NUP_ORDER_LRTD 0 +#define SV_PRINT_PRT_NUP_ORDER_TDLR 1 + +#define SV_PRINT_TAB_JOB 2 +#define SV_PRINT_PRINTERS_FL 1 +#define SV_PRINT_PRINTERS 2 +#define SV_PRINT_PRT_SETUP 3 +#define SV_PRINT_RANGE 4 +#define SV_PRINT_ALL 5 +#define SV_PRINT_PAGERANGE 6 +#define SV_PRINT_SELECTION 7 +#define SV_PRINT_PAGERANGE_EDIT 8 +#define SV_PRINT_COPIES 9 +#define SV_PRINT_COPYCOUNT 10 +#define SV_PRINT_COPYCOUNT_FIELD 11 +#define SV_PRINT_COLLATE 12 +#define SV_PRINT_COLLATE_IMAGE 13 +#define SV_PRINT_BUTTONLINE 14 +#define SV_PRINT_COLLATE_IMG 15 +#define SV_PRINT_NOCOLLATE_IMG 16 +#define SV_PRINT_COLLATE_HC_IMG 17 +#define SV_PRINT_NOCOLLATE_HC_IMG 18 +#define SV_PRINT_NOPAGES 19 +#define SV_PRINT_STATUS_TXT 20 +#define SV_PRINT_LOCATION_TXT 21 +#define SV_PRINT_COMMENT_TXT 22 +#define SV_PRINT_DETAILS_BTN 23 + +#define SV_PRINT_TAB_OPT 3 +#define SV_PRINT_OPT_PRINT_FL 1 +#define SV_PRINT_OPT_TOFILE 2 +#define SV_PRINT_OPT_SINGLEJOBS 3 +#define SV_PRINT_OPT_REVERSE 4 + +#define SV_DLG_PRINT_PROGRESS 2049 +#define SV_PRINT_PROGRESS_CANCEL 1 +#define SV_PRINT_PROGRESS_TEXT 2 + +#define SV_PRINT_NATIVE_STRINGS 2050 +#define SV_PRINT_NOPRINTERWARNING 2051 +#define SV_PRINT_NOCONTENT 2052 + +#define SV_HELPTEXT_CLOSE 10000 +#define SV_HELPTEXT_MINIMIZE 10001 +#define SV_HELPTEXT_MAXIMIZE 10002 +#define SV_HELPTEXT_RESTORE 10003 +#define SV_HELPTEXT_ROLLDOWN 10004 +#define SV_HELPTEXT_ROLLUP 10005 +#define SV_HELPTEXT_HELP 10006 +#define SV_HELPTEXT_ALWAYSVISIBLE 10007 +#define SV_HELPTEXT_FADEIN 10008 +#define SV_HELPTEXT_FADEOUT 10009 +#define SV_HELPTEXT_SPLITFLOATING 10010 +#define SV_HELPTEXT_SPLITFIXED 10011 +#define SV_HELPTEXT_CLOSEDOCUMENT 10012 + +#define SV_BUTTONTEXT_OK 10100 +#define SV_BUTTONTEXT_CANCEL 10101 +#define SV_BUTTONTEXT_YES 10102 +#define SV_BUTTONTEXT_NO 10103 +#define SV_BUTTONTEXT_RETRY 10104 +#define SV_BUTTONTEXT_HELP 10105 +#define SV_BUTTONTEXT_CLOSE SV_HELPTEXT_CLOSE +#define SV_BUTTONTEXT_MORE 10107 +#define SV_BUTTONTEXT_IGNORE 10108 +#define SV_BUTTONTEXT_ABORT 10109 +#define SV_BUTTONTEXT_LESS 10110 + +#define SV_STDTEXT_FIRST SV_STDTEXT_SERVICENOTAVAILABLE +#define SV_STDTEXT_SERVICENOTAVAILABLE 10200 +#define SV_STDTEXT_DONTHINTAGAIN 10201 +#define SV_STDTEXT_DONTASKAGAIN 10202 +#define SV_STDTEXT_DONTWARNAGAIN 10203 +#define SV_STDTEXT_ABOUT 10204 +#define SV_STDTEXT_PREFERENCES 10205 +#define SV_MAC_SCREENNNAME 10206 +#define SV_STDTEXT_ALLFILETYPES 10207 +#define SV_STDTEXT_LAST SV_STDTEXT_ALLFILETYPES + +#define SV_ACCESSERROR_FIRST SV_ACCESSERROR_WRONG_VERSION +#define SV_ACCESSERROR_WRONG_VERSION 10500 +#define SV_ACCESSERROR_BRIDGE_MSG 10501 +#define SV_ACCESSERROR_OK_CANCEL_MSG 10502 +#define SV_ACCESSERROR_MISSING_BRIDGE 10503 +#define SV_ACCESSERROR_FAULTY_JAVA 10504 +#define SV_ACCESSERROR_JAVA_MSG 10505 +#define SV_ACCESSERROR_MISSING_JAVA 10506 +#define SV_ACCESSERROR_JAVA_NOT_CONFIGURED 10507 +#define SV_ACCESSERROR_JAVA_DISABLED 10508 +#define SV_ACCESSERROR_TURNAROUND_MSG 10509 +#define SV_ACCESSERROR_LAST SV_ACCESSERROR_TURNAROUND_MSG + +#define SV_SHORTCUT_HELP 10600 +#define SV_SHORTCUT_CONTEXTHELP 10601 +#define SV_SHORTCUT_ACTIVEHELP 10602 +#define SV_SHORTCUT_DOCKUNDOCK 10603 +#define SV_SHORTCUT_NEXTSUBWINDOW 10604 +#define SV_SHORTCUT_PREVSUBWINDOW 10605 +#define SV_SHORTCUT_TODOCUMENT 10606 +#define SV_SHORTCUT_MENUBAR 10607 +#define SV_SHORTCUT_SPLITTER 10608 + +#define SV_EDIT_WARNING_BOX 10650 + +#define SV_FUNIT_STRINGS 10700 + +#define SV_ICON_SIZE48_START 20000 +#define SV_ICON_SIZE32_START 21000 +#define SV_ICON_SIZE16_START 23000 + +#define SV_ICON_LARGE_START 24000 +#define SV_ICON_SMALL_START 25000 +#define SV_ICON_LARGE_HC_START 26000 +#define SV_ICON_SMALL_HC_START 27000 + +#define SV_ICON_ID_OFFICE 1 +#define SV_ICON_ID_TEXT 2 +#define SV_ICON_ID_TEXT_TEMPLATE 3 +#define SV_ICON_ID_SPREADSHEET 4 +#define SV_ICON_ID_SPREADSHEET_TEMPLATE 5 +#define SV_ICON_ID_DRAWING 6 +#define SV_ICON_ID_DRAWING_TEMPLATE 7 +#define SV_ICON_ID_PRESENTATION 8 +#define SV_ICON_ID_PRESENTATION_TEMPLATE 9 +#define SV_ICON_ID_PRESENTATION_COMPRESSED 10 +#define SV_ICON_ID_MASTER_DOCUMENT 11 +#define SV_ICON_ID_HTML_DOCUMENT 12 +#define SV_ICON_ID_CHART 13 +#define SV_ICON_ID_DATABASE 14 +#define SV_ICON_ID_FORMULA 15 +#define SV_ICON_ID_TEMPLATE 16 +#define SV_ICON_ID_MACRO 17 +#define SV_ICON_ID_PRINTERADMIN 501 + +#define HID_PRINTDLG HID_VCL_START + +#endif // _SV_SVIDS_HRC diff --git a/vcl/inc/vcl/symbol.hxx b/vcl/inc/vcl/symbol.hxx new file mode 100644 index 000000000000..c7a745516856 --- /dev/null +++ b/vcl/inc/vcl/symbol.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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_SYMBOL_HXX +#define _SV_SYMBOL_HXX + +#include <vcl/sv.h> + +// ---------------- +// - Symbol-Types - +// ---------------- + +// By changes you must also change: rsc/vclrsc.hxx +typedef USHORT SymbolType; +#define SYMBOL_DONTKNOW ((SymbolType)0) +#define SYMBOL_IMAGE ((SymbolType)1) +#define SYMBOL_ARROW_UP ((SymbolType)2) +#define SYMBOL_ARROW_DOWN ((SymbolType)3) +#define SYMBOL_ARROW_LEFT ((SymbolType)4) +#define SYMBOL_ARROW_RIGHT ((SymbolType)5) +#define SYMBOL_SPIN_UP ((SymbolType)6) +#define SYMBOL_SPIN_DOWN ((SymbolType)7) +#define SYMBOL_SPIN_LEFT ((SymbolType)8) +#define SYMBOL_SPIN_RIGHT ((SymbolType)9) +#define SYMBOL_FIRST ((SymbolType)10) +#define SYMBOL_LAST ((SymbolType)11) +#define SYMBOL_PREV ((SymbolType)12) +#define SYMBOL_NEXT ((SymbolType)13) +#define SYMBOL_PAGEUP ((SymbolType)14) +#define SYMBOL_PAGEDOWN ((SymbolType)15) +#define SYMBOL_PLAY ((SymbolType)16) +#define SYMBOL_REVERSEPLAY ((SymbolType)17) +#define SYMBOL_RECORD ((SymbolType)18) +#define SYMBOL_STOP ((SymbolType)19) +#define SYMBOL_PAUSE ((SymbolType)20) +#define SYMBOL_WINDSTART ((SymbolType)21) +#define SYMBOL_WINDEND ((SymbolType)22) +#define SYMBOL_WINDBACKWARD ((SymbolType)23) +#define SYMBOL_WINDFORWARD ((SymbolType)24) +#define SYMBOL_CLOSE ((SymbolType)25) +#define SYMBOL_ROLLUP ((SymbolType)26) +#define SYMBOL_ROLLDOWN ((SymbolType)27) +#define SYMBOL_CHECKMARK ((SymbolType)28) +#define SYMBOL_RADIOCHECKMARK ((SymbolType)29) +#define SYMBOL_SPIN_UPDOWN ((SymbolType)30) +#define SYMBOL_FLOAT ((SymbolType)31) +#define SYMBOL_DOCK ((SymbolType)32) +#define SYMBOL_HIDE ((SymbolType)33) +#define SYMBOL_HELP ((SymbolType)34) +#define SYMBOL_OS2CLOSE ((SymbolType)35) +#define SYMBOL_OS2FLOAT ((SymbolType)36) +#define SYMBOL_OS2HIDE ((SymbolType)37) +#define SYMBOL_MENU SYMBOL_SPIN_DOWN + +#define SYMBOL_NOSYMBOL (SYMBOL_DONTKNOW) + +#endif // _SV_SYMBOL_HXX diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx new file mode 100644 index 000000000000..e914adbdffed --- /dev/null +++ b/vcl/inc/vcl/syschild.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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_SYSCHILD_HXX +#define _SV_SYSCHILD_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +struct SystemEnvData; +struct SystemWindowData; + +// --------------------- +// - SystemChildWindow - +// --------------------- + +class VCL_DLLPUBLIC SystemChildWindow : public Window +{ +private: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = FALSE ); + SAL_DLLPRIVATE void ImplTestJavaException( void* pEnv ); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE SystemChildWindow (const SystemChildWindow &); + SAL_DLLPRIVATE SystemChildWindow & operator= (const SystemChildWindow &); + +public: + SystemChildWindow( Window* pParent, WinBits nStyle = 0 ); + // create a SystemChildWindow using the given SystemWindowData + SystemChildWindow( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = TRUE ); + SystemChildWindow( Window* pParent, const ResId& rResId ); + ~SystemChildWindow(); + + const SystemEnvData* GetSystemData() const; + + // per default systemchildwindows erase their background for better plugin support + // however, this might not always be required + void EnableEraseBackground( BOOL bEnable = TRUE ); + BOOL IsEraseBackgroundEnabled(); + + // return the platform specific handle/id of this window; + // in case the flag bUseJava is set, a java compatible overlay window + // is created on which other java windows can be created (plugin interface) + sal_IntPtr GetParentWindowHandle( sal_Bool bUseJava = sal_False ); +}; + +#endif // _SV_SYSCHILD_HXX diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx new file mode 100644 index 000000000000..1146f1b3b842 --- /dev/null +++ b/vcl/inc/vcl/sysdata.hxx @@ -0,0 +1,189 @@ +/************************************************************************* + * + * 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_SYSDATA_HXX +#define _SV_SYSDATA_HXX + +#include <vector> + +#ifdef QUARTZ +// predeclare the native classes to avoid header/include problems +typedef struct CGContext *CGContextRef; +typedef struct CGLayer *CGLayerRef; +#ifdef __OBJC__ +@class NSView; +#else +class NSView; +#endif +#endif + +// ----------------- +// - SystemEnvData - +// ----------------- + +struct SystemEnvData +{ + unsigned long nSize; // size in bytes of this structure +#if defined( WNT ) || defined( OS2 ) + HWND hWnd; // the window hwnd +#elif defined( QUARTZ ) + NSView* pView; // the cocoa (NSView *) implementing this object +#elif defined( UNX ) + void* pDisplay; // the relevant display connection + long aWindow; // the window of the object + void* pSalFrame; // contains a salframe, if object has one + void* pWidget; // the corresponding widget + void* pVisual; // the visual in use + int nScreen; // the current screen of the window + int nDepth; // depth of said visual + long aColormap; // the colormap being used + void* pAppContext; // the application context in use + long aShellWindow; // the window of the frame's shell + void* pShellWidget; // the frame's shell widget +#endif +}; + +#define SystemChildData SystemEnvData + +// -------------------- +// - SystemParentData - +// -------------------- + +struct SystemParentData +{ + unsigned long nSize; // size in bytes of this structure +#if defined( WNT ) || defined( OS2 ) + HWND hWnd; // the window hwnd +#elif defined( QUARTZ ) + NSView* pView; // the cocoa (NSView *) implementing this object +#elif defined( UNX ) + long aWindow; // the window of the object + bool bXEmbedSupport:1; // decides whether the object in question + // should support the XEmbed protocol +#endif +}; + +// -------------------- +// - SystemMenuData - +// -------------------- + +struct SystemMenuData +{ + unsigned long nSize; // size in bytes of this structure +#if defined( WNT ) + HMENU hMenu; // the menu handle of the menu bar +#elif defined( QUARTZ ) + //not defined +#elif defined( UNX ) + long aMenu; // ??? +#endif +}; + +// -------------------- +// - SystemGraphicsData - +// -------------------- + +struct SystemGraphicsData +{ + unsigned long nSize; // size in bytes of this structure +#if defined( WNT ) + HDC hDC; // handle to a device context +#elif defined( QUARTZ ) + CGContextRef rCGContext; // QUARTZ graphic context +#elif defined( UNX ) + void* pDisplay; // the relevant display connection + long hDrawable; // a drawable + void* pVisual; // the visual in use + int nScreen; // the current screen of the drawable + int nDepth; // depth of said visual + long aColormap; // the colormap being used + void* pRenderFormat; // render format for drawable +#endif +}; + + +// -------------------- +// - SystemWindowData - +// -------------------- + +struct SystemWindowData +{ + unsigned long nSize; // size in bytes of this structure +#if defined( WNT ) // meaningless on Windows +#elif defined( QUARTZ ) // meaningless on Mac OS X / Quartz +#elif defined( UNX ) + void* pVisual; // the visual to be used +#endif +}; + + +// -------------------- +// - SystemGlyphData - +// -------------------- + +struct SystemGlyphData +{ + unsigned long index; + double x; + double y; +}; + + +// -------------------- +// - SystemFontData - +// -------------------- + +struct SystemFontData +{ + unsigned long nSize; // size in bytes of this structure +#if defined( WNT ) + HFONT hFont; // native font object +#elif defined( QUARTZ ) + void* aATSUFontID; // native font object +#elif defined( UNX ) + void* nFontId; // native font id + int nFontFlags; // native font flags +#endif + bool bFakeBold; // Does this font need faking the bold style + bool bFakeItalic; // Does this font need faking the italic style + bool bAntialias; // Should this font be antialiased + bool bVerticalCharacterType; // Is the font using vertical character type +}; + +// -------------------- +// - SystemTextLayoutData - +// -------------------- + +struct SystemTextLayoutData +{ + unsigned long nSize; // size in bytes of this structure + std::vector<SystemGlyphData> rGlyphData; // glyph data + int orientation; // Text orientation + SystemFontData aSysFontData; // Font data for the text layout +}; + +#endif // _SV_SYSDATA_HXX diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx new file mode 100644 index 000000000000..b3a7d9b8775e --- /dev/null +++ b/vcl/inc/vcl/syswin.hxx @@ -0,0 +1,281 @@ +/************************************************************************* + * + * 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_SYSWIN_HXX +#define _SV_SYSWIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +class ModalDialog; +class MenuBar; +class TaskPaneList; + +// -------------- +// - Icon-Types - +// -------------- + +#define ICON_DEFAULT 0 +#define ICON_SO_DEFAULT 1 +#define ICON_TEXT_DOCUMENT 2 +#define ICON_TEXT_TEMPLATE 3 +#define ICON_SPREADSHEET_DOCUMENT 4 +#define ICON_SPREADSHEET_TEMPLATE 5 +#define ICON_DRAWING_DOCUMENT 6 +#define ICON_DRAWING_TEMPLATE 7 +#define ICON_PRESENTATION_DOCUMENT 8 +#define ICON_PRESENTATION_TEMPLATE 9 +#define ICON_PRESENTATION_COMPRESSED 10 +#define ICON_GLOBAL_DOCUMENT 11 +#define ICON_HTML_DOCUMENT 12 +#define ICON_CHART_DOCUMENT 13 +#define ICON_DATABASE_DOCUMENT 14 +#define ICON_MATH_DOCUMENT 15 +#define ICON_TEMPLATE 16 +#define ICON_MACROLIBRARY 17 +#define ICON_PLAYER 100 +#define ICON_SETUP 500 + +// ------------------- +// - WindowStateData - +// ------------------- + +#define WINDOWSTATE_MASK_X ((ULONG)0x00000001) +#define WINDOWSTATE_MASK_Y ((ULONG)0x00000002) +#define WINDOWSTATE_MASK_WIDTH ((ULONG)0x00000004) +#define WINDOWSTATE_MASK_HEIGHT ((ULONG)0x00000008) +#define WINDOWSTATE_MASK_STATE ((ULONG)0x00000010) +#define WINDOWSTATE_MASK_MINIMIZED ((ULONG)0x00000020) +#define WINDOWSTATE_MASK_MAXIMIZED_X ((ULONG)0x00000100) +#define WINDOWSTATE_MASK_MAXIMIZED_Y ((ULONG)0x00000200) +#define WINDOWSTATE_MASK_MAXIMIZED_WIDTH ((ULONG)0x00000400) +#define WINDOWSTATE_MASK_MAXIMIZED_HEIGHT ((ULONG)0x00000800) +#define WINDOWSTATE_MASK_POS (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y) +#define WINDOWSTATE_MASK_ALL (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_WIDTH | WINDOWSTATE_MASK_HEIGHT | WINDOWSTATE_MASK_MAXIMIZED_X | WINDOWSTATE_MASK_MAXIMIZED_Y | WINDOWSTATE_MASK_MAXIMIZED_WIDTH | WINDOWSTATE_MASK_MAXIMIZED_HEIGHT | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED) + +#define WINDOWSTATE_STATE_NORMAL ((ULONG)0x00000001) +#define WINDOWSTATE_STATE_MINIMIZED ((ULONG)0x00000002) +#define WINDOWSTATE_STATE_MAXIMIZED ((ULONG)0x00000004) +#define WINDOWSTATE_STATE_ROLLUP ((ULONG)0x00000008) +#define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((ULONG)0x00000010) +#define WINDOWSTATE_STATE_MAXIMIZED_VERT ((ULONG)0x00000020) + +class VCL_DLLPUBLIC WindowStateData +{ +private: + sal_uInt32 mnValidMask; + int mnX; + int mnY; + unsigned int mnWidth; + unsigned int mnHeight; + int mnMaximizedX; + int mnMaximizedY; + unsigned int mnMaximizedWidth; + unsigned int mnMaximizedHeight; + sal_uInt32 mnState; + +public: + WindowStateData() + { + mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0; + mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0; + } + + void SetMask( ULONG nValidMask ) { mnValidMask = nValidMask; } + sal_uInt32 GetMask() const { return mnValidMask; } + + void SetX( int nX ) { mnX = nX; } + int GetX() const { return mnX; } + void SetY( int nY ) { mnY = nY; } + int GetY() const { return mnY; } + void SetWidth( unsigned int nWidth ) { mnWidth = nWidth; } + unsigned int GetWidth() const { return mnWidth; } + void SetHeight( unsigned int nHeight ) { mnHeight = nHeight; } + unsigned int GetHeight() const { return mnHeight; } + void SetState( sal_uInt32 nState ) { mnState = nState; } + sal_uInt32 GetState() const { return mnState; } + void SetMaximizedX( int nRX ) { mnMaximizedX = nRX; } + int GetMaximizedX() const { return mnMaximizedX; } + void SetMaximizedY( int nRY ) { mnMaximizedY = nRY; } + int GetMaximizedY() const { return mnMaximizedY; } + void SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; } + unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; } + void SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; } + unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; } +}; + +// ---------------------- +// - SystemWindow-Types - +// ---------------------- + +#define MENUBAR_MODE_NORMAL ((USHORT)0) +#define MENUBAR_MODE_HIDE ((USHORT)1) + +#define TITLE_BUTTON_DOCKING ((USHORT)1) +#define TITLE_BUTTON_HIDE ((USHORT)2) +#define TITLE_BUTTON_MENU ((USHORT)4) + +// ---------------- +// - SystemWindow - +// ---------------- + + +class VCL_DLLPUBLIC SystemWindow : public Window +{ + friend class WorkWindow; + class ImplData; + +private: + MenuBar* mpMenuBar; + Size maOrgSize; + Size maRollUpOutSize; + Size maMinOutSize; + BOOL mbPined; + BOOL mbRollUp; + BOOL mbRollFunc; + BOOL mbDockBtn; + BOOL mbHideBtn; + BOOL mbSysChild; + USHORT mnMenuBarMode; + USHORT mnIcon; + ImplData* mpImplData; + +#if _SOLAR__PRIVATE +public: + using Window::ImplIsInTaskPaneList; + SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList( Window* pWin ); +#endif + +private: + // Default construction is forbidden and not implemented. + SystemWindow(); + + // Copy assignment is forbidden and not implemented. + SystemWindow (const SystemWindow &); + SystemWindow & operator= (const SystemWindow &); + + SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin ); + +protected: + // Single argument ctors shall be explicit. + explicit SystemWindow( WindowType nType ); + + void SetWindowStateData( const WindowStateData& rData ); + +public: + ~SystemWindow(); + virtual long Notify( NotifyEvent& rNEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + virtual BOOL Close(); + virtual void TitleButtonClick( USHORT nButton ); + virtual void Pin(); + virtual void Roll(); + virtual void Resizing( Size& rSize ); + + void SetIcon( USHORT nIcon ); + USHORT GetIcon() const { return mnIcon; } + // for systems like MacOSX which can display the URL a document is loaded from + // separately from the window title + void SetRepresentedURL( const rtl::OUString& ); + const rtl::OUString& GetRepresentedURL() const; + + void SetZLevel( BYTE nLevel ); + BYTE GetZLevel() const; + + void EnableSaveBackground( BOOL bSave = TRUE ); + BOOL IsSaveBackgroundEnabled() const; + + void ShowTitleButton( USHORT nButton, BOOL bVisible = TRUE ); + BOOL IsTitleButtonVisible( USHORT nButton ) const; + + void SetPin( BOOL bPin ); + BOOL IsPined() const { return mbPined; } + + void RollUp(); + void RollDown(); + BOOL IsRollUp() const { return mbRollUp; } + + void SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; } + Size GetRollUpOutputSizePixel() const { return maRollUpOutSize; } + + void SetMinOutputSizePixel( const Size& rSize ); + const Size& GetMinOutputSizePixel() const { return maMinOutSize; } + void SetMaxOutputSizePixel( const Size& rSize ); + const Size& GetMaxOutputSizePixel() const; + Size GetResizeOutputSizePixel() const; + + void SetWindowState( const ByteString& rStr ); + ByteString GetWindowState( ULONG nMask = WINDOWSTATE_MASK_ALL ) const; + + void SetMenuBar( MenuBar* pMenuBar ); + MenuBar* GetMenuBar() const { return mpMenuBar; } + void SetMenuBarMode( USHORT nMode ); + USHORT GetMenuBarMode() const { return mnMenuBarMode; } + + TaskPaneList* GetTaskPaneList(); + void GetWindowStateData( WindowStateData& rData ) const; + + /** + Returns the screen number the window is on + + The screen number is counted the same way that + <code>Application::GetScreenPosSizePixel</code>, + <code>Application::GetWorkAreaPosSizePixel</code>, + <code>Application::GetScreenName</code> + and of course <code>SystemWindow::SetScreenNumber</code> + are counted in. + + In case the window is positioned on multiple screens the + screen number returned will be of the screen containing the + upper left pixel of the frame area (that is of the client + area on system decorated windows, or the frame area of + undecorated resp. owner decorated windows. + + @returns the screen number + + @see SystemWindow::SetScreenNumber + */ + unsigned int GetScreenNumber() const; + /** + Move the Window to a new screen. The same rules for + positioning apply as in <code>SystemWindow::GetScreenNumber</code> + + The screen number is counted the same way that + <code>Application::GetScreenPosSizePixel</code>, + <code>Application::GetWorkAreaPosSizePixel</code>, + <code>Application::GetScreenName</code> + and of course <code>SystemWindow::GetScreenNumber</code> + are counted in. + + @see GetScreenNumber + */ + void SetScreenNumber( unsigned int nNewScreen ); +}; + +#endif // _SV_SYSWIN_HXX diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx new file mode 100644 index 000000000000..4c63b12f15fe --- /dev/null +++ b/vcl/inc/vcl/tabctrl.hxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * 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_TABCTRL_HXX +#define _SV_TABCTRL_HXX + +#include "vcl/sv.h" +#include "vcl/dllapi.h" +#include "vcl/ctrl.hxx" + +struct ImplTabItem; +struct ImplTabCtrlData; +class ImplTabItemList; +class TabPage; +class PushButton; +class ListBox; + +// -------------------- +// - TabControl-Types - +// -------------------- + +#ifndef TAB_APPEND +#define TAB_APPEND ((USHORT)0xFFFF) +#define TAB_PAGE_NOTFOUND ((USHORT)0xFFFF) +#endif /* !TAB_APPEND */ + +// -------------- +// - TabControl - +// -------------- + +class VCL_DLLPUBLIC TabControl : public Control +{ +private: + void* mpDummyPtr; // FIXME: remove before integration + ImplTabCtrlData* mpTabCtrlData; + long mnLastWidth; + long mnLastHeight; + long mnBtnSize; + long mnMaxPageWidth; + USHORT mnActPageId; + USHORT mnCurPageId; + USHORT mnFirstPagePos; + USHORT mnLastFirstPagePos; + BOOL mbFormat; + BOOL mbRestoreHelpId; + BOOL mbRestoreUnqId; + BOOL mbSingleLine; + BOOL mbScroll; + BOOL mbRestoreSmartId; + BOOL mbSmallInvalidate; + BOOL mbExtraSpace; + Link maActivateHdl; + Link maDeactivateHdl; + + using Control::ImplInitSettings; + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE ImplTabItem* ImplGetItem( USHORT nId ) const; + SAL_DLLPRIVATE void ImplScrollBtnsColor(); + SAL_DLLPRIVATE void ImplSetScrollBtnsState(); + SAL_DLLPRIVATE void ImplPosScrollBtns(); + SAL_DLLPRIVATE Size ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ); + SAL_DLLPRIVATE Rectangle ImplGetTabRect( USHORT nPos, long nWidth = -1, long nHeight = -1 ); + SAL_DLLPRIVATE void ImplChangeTabPage( USHORT nId, USHORT nOldId ); + SAL_DLLPRIVATE BOOL ImplPosCurTabPage(); + SAL_DLLPRIVATE void ImplActivateTabPage( BOOL bNext ); + SAL_DLLPRIVATE void ImplSetFirstPagePos( USHORT nPagePos ); + SAL_DLLPRIVATE void ImplShowFocus(); + SAL_DLLPRIVATE void ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bool bLayout = false, bool bFirstInGroup = false, bool bLastInGroup = false, bool bIsCurrentItem = false ); + SAL_DLLPRIVATE void ImplPaint( const Rectangle& rRect, bool bLayout = false ); + SAL_DLLPRIVATE void ImplFreeLayoutData(); + SAL_DLLPRIVATE long ImplHandleKeyEvent( const KeyEvent& rKeyEvent ); + + DECL_DLLPRIVATE_LINK( ImplScrollBtnHdl, PushButton* pBtn ); + DECL_DLLPRIVATE_LINK( ImplListBoxSelectHdl, ListBox* ); + DECL_DLLPRIVATE_LINK( ImplWindowEventListener, VclSimpleEvent* ); + + +protected: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + + virtual void FillLayoutData() const; + virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); + +public: + TabControl( Window* pParent, + WinBits nStyle = WB_STDTABCONTROL ); + TabControl( Window* pParent, const ResId& rResId ); + ~TabControl(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + virtual void ActivatePage(); + virtual long DeactivatePage(); + + virtual Size GetOptimalSize(WindowSizeType eType) const; + void SetMinimumSizePixel( const Size& ); + + void SetTabPageSizePixel( const Size& rSize ); + Size GetTabPageSizePixel() const; + + // pixel offset for the tab items, default is (0,0) + void SetItemsOffset( const Point& rOffs ); + Point GetItemsOffset() const; + + void InsertPage( const ResId& rResId, + USHORT nPos = TAB_APPEND ); + void InsertPage( USHORT nPageId, const XubString& rText, + USHORT nPos = TAB_APPEND ); + void RemovePage( USHORT nPageId ); + void Clear(); + void EnablePage( USHORT nPageId, bool bEnable = true ); + + USHORT GetPageCount() const; + USHORT GetPageId( USHORT nPos ) const; + USHORT GetPagePos( USHORT nPageId ) const; + USHORT GetPageId( const Point& rPos ) const; + + void SetCurPageId( USHORT nPageId ); + USHORT GetCurPageId() const; + + void SetFirstPageId( USHORT nPageId ); + USHORT GetFirstPageId() const { return GetPageId( mnFirstPagePos ); } + + void SelectTabPage( USHORT nPageId ); + + void SetMaxPageWidth( long nMaxWidth ) { mnMaxPageWidth = nMaxWidth; } + long GetMaxPageWidth() const { return mnMaxPageWidth; } + void ResetMaxPageWidth() { SetMaxPageWidth( 0 ); } + BOOL IsMaxPageWidth() const { return mnMaxPageWidth != 0; } + + void SetTabPage( USHORT nPageId, TabPage* pPage ); + TabPage* GetTabPage( USHORT nPageId ) const; + USHORT GetTabPageResId( USHORT nPageId ) const; + + void SetPageText( USHORT nPageId, const XubString& rText ); + XubString GetPageText( USHORT nPageId ) const; + + void SetHelpText( USHORT nPageId, const XubString& rText ); + const XubString& GetHelpText( USHORT nPageId ) const; + + void SetHelpId( USHORT nPageId, ULONG nHelpId ); + ULONG GetHelpId( USHORT nPageId ) const; + + void SetPageImage( USHORT nPageId, const Image& rImage ); + const Image* GetPageImage( USHORT nPageId ) const; + + void SetHelpText( const XubString& rText ) + { Control::SetHelpText( rText ); } + const XubString& GetHelpText() const + { return Control::GetHelpText(); } + + void SetHelpId( ULONG nId ) + { Control::SetHelpId( nId ); } + ULONG GetHelpId() const + { return Control::GetHelpId(); } + + void SetActivatePageHdl( const Link& rLink ) { maActivateHdl = rLink; } + const Link& GetActivatePageHdl() const { return maActivateHdl; } + void SetDeactivatePageHdl( const Link& rLink ) { maDeactivateHdl = rLink; } + const Link& GetDeactivatePageHdl() const { return maDeactivateHdl; } + + // returns (control relative) bounding rectangle for the + // character at index nIndex relative to the text of page nPageId + using Control::GetCharacterBounds; + Rectangle GetCharacterBounds( USHORT nPageId, long nIndex ) const; + + // returns the index relative to the text of page nPageId (also returned) + // at position rPoint (control relative) + using Control::GetIndexForPoint; + long GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const; + + // returns the bounding rectangle of the union of tab page area and the + // corresponding tab + Rectangle GetTabPageBounds( USHORT nPageId ) const; + + // returns the rectangle of the tab for page nPageId + Rectangle GetTabBounds( USHORT nPageId ) const; +}; + +#endif // _SV_TABCTRL_HXX diff --git a/vcl/inc/vcl/tabdlg.hxx b/vcl/inc/vcl/tabdlg.hxx new file mode 100644 index 000000000000..35543bb6aac0 --- /dev/null +++ b/vcl/inc/vcl/tabdlg.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_TABDLG_HXX +#define _SV_TABDLG_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/dialog.hxx> + +class FixedLine; +class TabControl; + +// ---------------------- +// - TabDialog - +// ---------------------- + +class VCL_DLLPUBLIC TabDialog : public Dialog +{ +private: + FixedLine* mpFixedLine; + Window* mpViewWindow; + WindowAlign meViewAlign; + BOOL mbPosControls; + + SAL_DLLPRIVATE void ImplInitTabDialogData(); + SAL_DLLPRIVATE void ImplPosControls(); + +public: + TabDialog( Window* pParent, + WinBits nStyle = WB_STDTABDIALOG ); + TabDialog( Window* pParent, const ResId& rResId ); + ~TabDialog(); + + virtual void Resize(); + virtual void StateChanged( StateChangedType nStateChange ); + + void AdjustLayout(); + + void SetViewWindow( Window* pWindow ) { mpViewWindow = pWindow; } + Window* GetViewWindow() const { return mpViewWindow; } + void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; } + WindowAlign GetViewAlign() const { return meViewAlign; } +}; + +#endif // _SV_TABDLG_HXX diff --git a/vcl/inc/vcl/tabpage.hxx b/vcl/inc/vcl/tabpage.hxx new file mode 100644 index 000000000000..c653ccca5a30 --- /dev/null +++ b/vcl/inc/vcl/tabpage.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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_TABPAGE_HXX +#define _SV_TABPAGE_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +// ----------- +// - TabPage - +// ----------- + +class VCL_DLLPUBLIC TabPage : public Window +{ +private: + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings(); + +public: + TabPage( Window* pParent, WinBits nStyle = 0 ); + TabPage( Window* pParent, const ResId& rResId ); + + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + + virtual void StateChanged( StateChangedType nStateChange ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void ActivatePage(); + virtual void DeactivatePage(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); +}; + +#endif // _SV_TABPAGE_HXX diff --git a/vcl/inc/vcl/taskpanelist.hxx b/vcl/inc/vcl/taskpanelist.hxx new file mode 100644 index 000000000000..33d75d7e31bd --- /dev/null +++ b/vcl/inc/vcl/taskpanelist.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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_TASKPANELIST_HXX +#define _SV_TASKPANELIST_HXX + +#include <vcl/dllapi.h> + +#include <vector> +#include <vcl/window.hxx> + +class VCL_DLLPUBLIC TaskPaneList +{ + ::std::vector<Window *> mTaskPanes; + Window *FindNextPane( Window *pWindow, BOOL bForward = TRUE ); + Window *FindNextFloat( Window *pWindow, BOOL bForward = TRUE ); + Window *FindNextSplitter( Window *pWindow, BOOL bForward = TRUE ); + +//#if 0 // _SOLAR__PRIVATE +public: + BOOL IsInList( Window *pWindow ); +//#endif + +public: + TaskPaneList(); + ~TaskPaneList(); + + void AddWindow( Window *pWindow ); + void RemoveWindow( Window *pWindow ); + BOOL HandleKeyEvent( KeyEvent aKeyEvent ); +}; + +#endif diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx new file mode 100644 index 000000000000..418e1aa8bf64 --- /dev/null +++ b/vcl/inc/vcl/textlayout.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * 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_TEXTLAYOUT_HXX +#define VCL_TEXTLAYOUT_HXX + +#include "vcl/outdev.hxx" + +#include <tools/solar.h> +#include <tools/string.hxx> + +#include <memory> + +class Control; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ITextLayout + //==================================================================== + class SAL_NO_VTABLE ITextLayout + { + public: + virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, + MetricVector* _pVector, String* _pDisplayText ) = 0; + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual bool DecomposeTextRectAction() const = 0; + }; + + //==================================================================== + //= DefaultTextLayout + //==================================================================== + /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective + methods of an OutputDevice instance, without any inbetween magic. + */ + class DefaultTextLayout : public ITextLayout + { + public: + DefaultTextLayout( OutputDevice& _rTargetDevice ) + :m_rTargetDevice( _rTargetDevice ) + { + } + virtual ~DefaultTextLayout(); + + // ITextLayout overridables + virtual long GetTextWidth( + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ); + virtual bool GetCaretPositions( + const XubString& _rText, + sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual xub_StrLen GetTextBreak( + const XubString& _rText, + long _nMaxTextWidth, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual bool DecomposeTextRectAction() const; + + private: + OutputDevice& m_rTargetDevice; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + class ReferenceDeviceTextLayout; + /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of + a reference device. + */ + class ControlTextRenderer + { + public: + ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ControlTextRenderer(); + + Rectangle DrawText( const Rectangle& _rRect, + const XubString& _rText, USHORT _nStyle = 0, + MetricVector* _pVector = NULL, String* _pDisplayText = NULL ); + + private: + ControlTextRenderer(); // never implemented + ControlTextRenderer( const ControlTextRenderer& ); // never implemented + ControlTextRenderer& operator=( const ControlTextRenderer& ); // never implemented + + private: + ::std::auto_ptr< ReferenceDeviceTextLayout > m_pImpl; + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_TEXTLAYOUT_HXX diff --git a/vcl/inc/vcl/threadex.hxx b/vcl/inc/vcl/threadex.hxx new file mode 100644 index 000000000000..1b48b5d63c9c --- /dev/null +++ b/vcl/inc/vcl/threadex.hxx @@ -0,0 +1,288 @@ +/************************************************************************* + * + * 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 <osl/conditn.h> +#include <osl/thread.h> +#include <tools/link.hxx> +#include <vcl/dllapi.h> + +#if ! defined(_CPPUHELPER_EXC_HLP_HXX_) +#include "cppuhelper/exc_hlp.hxx" +#endif +#include "boost/optional.hpp" +#include <memory> + +namespace vcl +{ + class VCL_DLLPUBLIC ThreadExecutor + { + oslThread m_aThread; + oslCondition m_aFinish; + long m_nReturn; + + #ifdef THREADEX_IMPLEMENTATION + public: + SAL_DLLPRIVATE static void SAL_CALL worker( void* ); + #endif + public: + ThreadExecutor(); + virtual ~ThreadExecutor(); + + virtual long doIt() = 0; + long execute(); + }; + + class VCL_DLLPUBLIC SolarThreadExecutor + { + oslCondition m_aStart; + oslCondition m_aFinish; + long m_nReturn; + bool m_bTimeout; + + DECL_DLLPRIVATE_LINK( worker, void* ); + + public: + SolarThreadExecutor(); + virtual ~SolarThreadExecutor(); + + virtual long doIt() = 0; + long execute() { return impl_execute( NULL ); } + // caution: timeout for getting the solar mutex, not for ending + // the operation of doIt(). If doIt actually gets called within + // the specified timeout, execute will only return after + // doIt() completed + long execute( const TimeValue& _rTimeout ) { return impl_execute( &_rTimeout ); } + + public: + bool didTimeout() const { return m_bTimeout; } + + private: + long impl_execute( const TimeValue* _pTimeout ); + }; + +namespace solarthread { + +/// @internal +namespace detail { + +template <typename FuncT, typename ResultT> +class GenericSolarThreadExecutor : public SolarThreadExecutor +{ +public: + static ResultT exec( FuncT const& func ) + { + typedef GenericSolarThreadExecutor<FuncT, ResultT> ExecutorT; + ::std::auto_ptr<ExecutorT> const pExecutor( new ExecutorT(func) ); + pExecutor->execute(); +#if ! defined(EXCEPTIONS_OFF) + if (pExecutor->m_exc.hasValue()) + ::cppu::throwException( pExecutor->m_exc ); +#endif + return *pExecutor->m_result; + } + +private: + explicit GenericSolarThreadExecutor( FuncT const& func ) + : m_exc(), m_func(func), m_result() {} + + virtual long doIt() + { +#if defined(EXCEPTIONS_OFF) + m_result.reset( m_func() ); +#else + try { + m_result.reset( m_func() ); + } + catch (::com::sun::star::uno::Exception &) { + // only UNO exceptions can be dispatched: + m_exc = ::cppu::getCaughtException(); + } +#endif + return 0; + } + + ::com::sun::star::uno::Any m_exc; + FuncT const m_func; + // using boost::optional here omits the need that ResultT is default + // constructable: + ::boost::optional<ResultT> m_result; +}; + +template <typename FuncT> +class GenericSolarThreadExecutor<FuncT, void> : public SolarThreadExecutor +{ +public: + static void exec( FuncT const& func ) + { + typedef GenericSolarThreadExecutor<FuncT, void> ExecutorT; + ::std::auto_ptr<ExecutorT> const pExecutor( new ExecutorT(func) ); + pExecutor->execute(); +#if ! defined(EXCEPTIONS_OFF) + if (pExecutor->m_exc.hasValue()) + ::cppu::throwException( pExecutor->m_exc ); +#endif + } + +private: + explicit GenericSolarThreadExecutor( FuncT const& func ) + : m_exc(), m_func(func) {} + + virtual long doIt() + { +#if defined(EXCEPTIONS_OFF) + m_func(); +#else + try { + m_func(); + } + catch (::com::sun::star::uno::Exception &) { + // only UNO exceptions can be dispatched: + m_exc = ::cppu::getCaughtException(); + } +#endif + return 0; + } + + ::com::sun::star::uno::Any m_exc; + FuncT const m_func; +}; + +template <typename T> +class copy_back_wrapper +{ +public: + operator T *() const { return &m_holder->m_value; } + operator T &() const { return m_holder->m_value; } + + explicit copy_back_wrapper( T * p ) : m_holder( new data_holder(p) ) {} + + // no thread-safe counting needed here, because calling thread blocks + // until solar thread has executed the functor. + copy_back_wrapper( copy_back_wrapper<T> const& r ) + : m_holder(r.m_holder) { ++m_holder->m_refCount; } + ~copy_back_wrapper() { + --m_holder->m_refCount; + if (m_holder->m_refCount == 0) { + delete m_holder; + } + } +private: + struct data_holder { + T m_value; + T * const m_ptr; + sal_Int32 m_refCount; + data_holder( T * p ) : m_value(*p), m_ptr(p), m_refCount(1) {} + ~data_holder() { *m_ptr = m_value; } + }; + data_holder * const m_holder; +}; + +} // namespace detail + +/** Makes a copy back reference wrapper to be used for inout parameters. + Only use for syncExecute(), the returned wrapper relies on its + implemenation, i.e. the function object is stored in free store. + Type T needs to be copy constructable assignable. + + @see syncExecute() + @param r reference to a stack variable + @return reference wrapper +*/ +template <typename T> +inline detail::copy_back_wrapper<T> inout_by_ref( T & r ) +{ + return detail::copy_back_wrapper<T>(&r); +} + +/** Makes a copy back ptr wrapper to be used for inout parameters. + Only use for syncExecute(), the returned wrapper relies on its + implemenation, i.e. the function object is stored in free store. + Type T needs to be copy constructable assignable. + + @see syncExecute() + @param p pointer to a stack variable + @return ptr wrapper +*/ +template <typename T> +inline detail::copy_back_wrapper<T> inout_by_ptr( T * p ) +{ + return detail::copy_back_wrapper<T>(p); +} + +/** This function will execute the passed functor synchronously in the + solar thread, thus the calling thread will (eventually) be blocked until + the functor has been called. + Any UNO exception that came up calling the functor in the solar thread + will be caught and rethrown in the calling thread. Any non-UNO + exception needs to be handled by the called functor. + The result type of this function needs to be default constructable. + Please keep in mind not to pass addresses to stack variables + (e.g. for out parameters) to foreign threads, use inout_by_ref() + for this purpose. For in parameters, this may not affect you, because + the functor object is copy constructed into free store. This way + you must not use boost::cref()/boost::ref() or similar for objects on + your thread's stack. + Use inout_by_ref() or inout_by_ptr() for this purpose, e.g. + + <pre> + using namespace vcl::solarthread; + + long n = 3; + // calling foo( long & r ): + syncExecute( boost::bind( &foo, inout_by_ref(n) ) ); + // calling foo( long * p ): + syncExecute( boost::bind( &foo, inout_by_ptr(&n) ) ); + + char const* pc = "default"; + // calling foo( char const** ppc ): + syncExecute( boost::bind( &foo, inout_by_ptr(&pc) ) ); + // calling foo( char const*& rpc ): + syncExecute( boost::bind( &foo, inout_by_ref(pc) ) ); + </pre> + + @tpl ResultT result type, defaults to FuncT::result_type to seamlessly + support mem_fn and bind + @tpl FuncT functor type, let your compiler deduce this type + @param func functor object to be executed in solar thread + @return return value of functor +*/ +template <typename ResultT, typename FuncT> +inline ResultT syncExecute( FuncT const& func ) +{ + return detail::GenericSolarThreadExecutor<FuncT, ResultT>::exec(func); +} + +template <typename FuncT> +inline typename FuncT::result_type syncExecute( FuncT const& func ) +{ + return detail::GenericSolarThreadExecutor< + FuncT, typename FuncT::result_type>::exec(func); +} + +} // namespace solarthread +} // namespace vcl + diff --git a/vcl/inc/vcl/timer.hxx b/vcl/inc/vcl/timer.hxx new file mode 100644 index 000000000000..bb325c118844 --- /dev/null +++ b/vcl/inc/vcl/timer.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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_TIMER_HXX +#define _SV_TIMER_HXX + +#include <tools/link.hxx> +#include <vcl/sv.h> +#include <vcl/dllapi.h> + +struct ImplTimerData; +struct ImplSVData; + +// --------- +// - Timer - +// --------- + +class VCL_DLLPUBLIC Timer +{ +protected: + ImplTimerData* mpTimerData; + ULONG mnTimeout; + BOOL mbActive; + BOOL mbAuto; + Link maTimeoutHdl; + +public: + Timer(); + Timer( const Timer& rTimer ); + virtual ~Timer(); + + virtual void Timeout(); + + void Start(); + void Stop(); + + void SetTimeout( ULONG nTimeout ); + ULONG GetTimeout() const { return mnTimeout; } + BOOL IsActive() const { return mbActive; } + + void SetTimeoutHdl( const Link& rLink ) { maTimeoutHdl = rLink; } + const Link& GetTimeoutHdl() const { return maTimeoutHdl; } + + Timer& operator=( const Timer& rTimer ); + +// #ifdef _SOLAR__PRIVATE + static void ImplDeInitTimer(); + static void ImplTimerCallbackProc(); +// #endif +}; + +// ------------- +// - AutoTimer - +// ------------- + +class VCL_DLLPUBLIC AutoTimer : public Timer +{ +public: + AutoTimer(); + AutoTimer( const AutoTimer& rTimer ); + + AutoTimer& operator=( const AutoTimer& rTimer ); +}; + +#endif // _SV_TIMER_HXX diff --git a/vcl/inc/vcl/toolbox.h b/vcl/inc/vcl/toolbox.h new file mode 100644 index 000000000000..33e4e8d2e013 --- /dev/null +++ b/vcl/inc/vcl/toolbox.h @@ -0,0 +1,182 @@ +/************************************************************************* + * + * 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_TOOLBOX_H +#define _SV_TOOLBOX_H + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <vcl/sv.h> +#include <vcl/image.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/controllayout.hxx> +#include <vcl/ImageListProvider.hxx> + +#include <vector> + +#define TB_DROPDOWNARROWWIDTH 11 + +#define TB_MENUBUTTON_SIZE 12 +#define TB_MENUBUTTON_OFFSET 2 + +#define TB_SMALLIMAGESIZE 16 + +#define TB_LARGEIMAGESIZE 26 +#define TB_LARGEIMAGESIZE_INDUSTRIAL 24 +#define TB_LARGEIMAGESIZE_CRYSTAL 22 +#define TB_LARGEIMAGESIZE_OXYGEN 22 + +class Window; + +// ---------------- +// - ImplToolItem - +// ---------------- + +struct ImplToolItem +{ + Window* mpWindow; + void* mpUserData; + Image maImage; + Image maHighImage; + long mnImageAngle; + bool mbMirrorMode; + XubString maText; + XubString maQuickHelpText; + XubString maHelpText; + String maCommandStr; + ULONG mnHelpId; + Rectangle maRect; + Rectangle maCalcRect; + // the overall horizontal item size, including one or more of [image size + textlength + dropdown arrow] + Size maItemSize; + long mnSepSize; + long mnDropDownArrowWidth; + ToolBoxItemType meType; + ToolBoxItemBits mnBits; + TriState meState; + USHORT mnId; + BOOL mbEnabled:1, + mbVisible:1, + mbEmptyBtn:1, + mbShowWindow:1, + mbBreak:1, + mbVisibleText:1; // indicates if text will definitely be drawn, influences dropdown pos + + ImplToolItem(); + ImplToolItem( USHORT nItemId, const Image& rImage, + ToolBoxItemBits nItemBits ); + ImplToolItem( USHORT nItemId, const XubString& rTxt, + ToolBoxItemBits nItemBits ); + ImplToolItem( USHORT nItemId, const Image& rImage, + const XubString& rTxt, + ToolBoxItemBits nItemBits ); + ~ImplToolItem(); + + ImplToolItem( const ImplToolItem& ); + ImplToolItem& operator=(const ImplToolItem&); + + // returns the size of a item, taking toolbox orientation into account + // the default size is the precomputed size for standard items + // ie those that are just ordinary buttons (no windows or text etc.) + // bCheckMaxWidth indicates that item windows must not exceed maxWidth in which case they will be painted as buttons + Size GetSize( BOOL bHorz, BOOL bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ); + + // only useful for buttons: returns if the text or image part or both can be drawn according to current button drawing style + void DetermineButtonDrawStyle( ButtonType eButtonType, BOOL& rbImage, BOOL& rbText ) const; + + // returns the rectangle which contains the drop down arrow + // or an empty rect if there is none + // bHorz denotes the toolbox alignment + Rectangle GetDropDownRect( BOOL bHorz ) const; + + // returns TRUE if the toolbar item is currently clipped, which can happen for docked toolbars + BOOL IsClipped() const; +}; + +namespace vcl +{ + +struct ToolBoxLayoutData : public ControlLayoutData +{ + std::vector< USHORT > m_aLineItemIds; + std::vector< USHORT > m_aLineItemPositions; +}; + + +} /* namespace vcl */ + + +struct ImplToolBoxPrivateData +{ + vcl::ToolBoxLayoutData* m_pLayoutData; + std::vector< ImplToolItem > m_aItems; + + ImplToolBoxPrivateData(); + ~ImplToolBoxPrivateData(); + + void ImplClearLayoutData() { delete m_pLayoutData; m_pLayoutData = NULL; } + + // called when dropdown items are clicked + Link maDropdownClickHdl; + Timer maDropdownTimer; // for opening dropdown items on "long click" + + // large or small buttons ? + ToolBoxButtonSize meButtonSize; + + // the optional custom menu + PopupMenu* mpMenu; + USHORT maMenuType; + ULONG mnEventId; + + // called when menu button is clicked and before the popup menu is executed + Link maMenuButtonHdl; + + // a dummy item representing the custom menu button + ImplToolItem maMenubuttonItem; + long mnMenuButtonWidth; + + Wallpaper maDisplayBackground; + + // support for highcontrast + vcl::IImageListProvider* mpImageListProvider; + vcl::ImageListType meImageListType; + + BOOL mbIsLocked:1, // keeps last lock state from ImplDockingWindowWrapper + mbAssumeDocked:1, // only used during calculations to override current floating/popup mode + mbAssumeFloating:1, + mbAssumePopupMode:1, + mbKeyInputDisabled:1, // no KEY input if all items disabled, closing/docking will be allowed though + mbIsPaintLocked:1, // don't allow paints + mbMenubuttonSelected:1, // menu button is highlighted + mbPageScroll:1, // determines if we scroll a page at a time + mbNativeButtons:1, // system supports native toolbar buttons + mbWillUsePopupMode:1, // this toolbox will be opened in popup mode + mbDropDownByKeyboard:1; // tells whether a dropdown was started by key input +}; + + +#endif // _SV_TOOLBOX_H diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx new file mode 100644 index 000000000000..5cc102842dc3 --- /dev/null +++ b/vcl/inc/vcl/toolbox.hxx @@ -0,0 +1,682 @@ +/************************************************************************* + * + * 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_TOOLBOX_HXX +#define _SV_TOOLBOX_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/dockwin.hxx> +#include <vcl/image.hxx> +#include <vcl/timer.hxx> +#include <vcl/virdev.hxx> + +class UserDrawEvent; + +struct ImplToolItem; +struct ImplToolSizeArray; +struct ImplToolSize; +struct ImplToolBoxPrivateData; +class ImplTrackRect; +class PopupMenu; + +namespace vcl +{ + class IImageListProvider; +} + +// ------------------------- +// - ToolBoxCustomizeEvent - +// ------------------------- + +#define TOOLBOX_CUSTOMIZE_RESIZE ((USHORT)0xFFFE) + +class VCL_DLLPUBLIC ToolBoxCustomizeEvent +{ +private: + ToolBox* mpTargetBox; + void* mpData; + USHORT mnIdFrom; + USHORT mnPosTo; + +public: + ToolBoxCustomizeEvent(); + ToolBoxCustomizeEvent( ToolBox* pDropBox, + USHORT nId, USHORT nPos = 0, + void* pUserData = NULL ); + + ToolBox* GetTargetBox() const { return mpTargetBox; } + USHORT GetTargetPos() const { return mnPosTo; } + USHORT GetSourceId() const { return mnIdFrom; } + void* GetData() const { return mpData; } + BOOL IsResized() const; +}; + +inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent() +{ + mpTargetBox = NULL; + mnIdFrom = 0; + mnPosTo = 0; + mpData = NULL; +} + +inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox, + USHORT nId, USHORT nPos, + void* pUserData ) +{ + mpTargetBox = pDropBox; + mnIdFrom = nId; + mnPosTo = nPos; + mpData = pUserData; +} + +inline BOOL ToolBoxCustomizeEvent::IsResized() const +{ + if ( mnPosTo == TOOLBOX_CUSTOMIZE_RESIZE ) + return TRUE; + else + return FALSE; +} + +// ------------------- +// - ToolBoxItemBits - +// ------------------- + +typedef USHORT ToolBoxItemBits; + +// -------------------------- +// - Bits fuer ToolBoxItems - +// -------------------------- + +// By changes you must also change: rsc/vclrsc.hxx +#define TIB_CHECKABLE ((ToolBoxItemBits)0x0001) +#define TIB_RADIOCHECK ((ToolBoxItemBits)0x0002) +#define TIB_AUTOCHECK ((ToolBoxItemBits)0x0004) +#define TIB_LEFT ((ToolBoxItemBits)0x0008) +#define TIB_AUTOSIZE ((ToolBoxItemBits)0x0010) +#define TIB_DROPDOWN ((ToolBoxItemBits)0x0020) +#define TIB_REPEAT ((ToolBoxItemBits)0x0040) +#define TIB_DROPDOWNONLY ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN) // this button has only drop down functionality +#define TIB_TEXT_ONLY ((ToolBoxItemBits)0x0100) +#define TIB_ICON_ONLY ((ToolBoxItemBits)0x0200) +#define TIB_TEXTICON ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY ) + +// ----------------- +// - ToolBox-Types - +// ----------------- + +#define TOOLBOX_STYLE_OUTBUTTON ((USHORT)0x0001) +#define TOOLBOX_STYLE_HANDPOINTER ((USHORT)0x0002) +#define TOOLBOX_STYLE_FLAT ((USHORT)0x0004) + +#define TOOLBOX_APPEND ((USHORT)0xFFFF) +#define TOOLBOX_ITEM_NOTFOUND ((USHORT)0xFFFF) + +// item ids in the custom menu may not exceed this constant +#define TOOLBOX_MENUITEM_START ((USHORT)0xE000) + +// defines for the menubutton +#define TOOLBOX_MENUTYPE_NONE ((USHORT)0x0000) // no menu at all, scrolling by spin buttons +#define TOOLBOX_MENUTYPE_CLIPPEDITEMS ((USHORT)0x0001) // menu will contain "more" indicator +#define TOOLBOX_MENUTYPE_CUSTOMIZE ((USHORT)0x0002) // menu will contain "customization" and "more" indicator + +// By changes you must also change: rsc/vclrsc.hxx +enum ButtonType { BUTTON_SYMBOL, BUTTON_TEXT, BUTTON_SYMBOLTEXT }; + +// By changes you must also change: rsc/vclrsc.hxx +enum ToolBoxItemType { TOOLBOXITEM_DONTKNOW, TOOLBOXITEM_BUTTON, + TOOLBOXITEM_SPACE, TOOLBOXITEM_SEPARATOR, + TOOLBOXITEM_BREAK }; + +// small or large force an exact toolbox size for proper alignemnt +// dontcare will let the toolbox decide about its size +enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, TOOLBOX_BUTTONSIZE_LARGE }; + +// used for internal sizing calculations +enum FloatingSizeMode { FSMODE_AUTO, FSMODE_FAVOURWIDTH, FSMODE_FAVOURHEIGHT }; + +// ----------- +// - ToolBox - +// ----------- + +class VCL_DLLPUBLIC ToolBox : public DockingWindow +{ + friend class FloatingWindow; + friend class ImplTBDragMgr; + +private: + ImplToolBoxPrivateData* mpData; + VirtualDevice* mpBtnDev; // TODO: remove unused member + ImplToolSizeArray* mpFloatSizeAry; + XubString maCvtStr; + XubString maNextToolBoxStr; + ImageList maImageList; + Timer maTimer; + Rectangle maUpperRect; + Rectangle maLowerRect; + Rectangle maNextToolRect; + Rectangle maOutDockRect; + Rectangle maInDockRect; + Rectangle maPaintRect; + FloatingWindow* mpFloatWin; + USHORT mnKeyModifier; + long mnDX; + long mnDY; + long mnMaxItemWidth; // max item width + long mnMaxItemHeight; // max item height (for standard items) + long mnWinHeight; // max window height (for window items) + long mnBorderX; // custom border + long mnBorderY; + long mnLeftBorder; // inner border + long mnTopBorder; + long mnRightBorder; + long mnBottomBorder; + long mnLastResizeDY; + long mnActivateCount; + USHORT mnLastFocusItemId; + USHORT mnFocusPos; + USHORT mnOutStyle; + USHORT mnHighItemId; + USHORT mnCurItemId; + USHORT mnDownItemId; + USHORT mnCurPos; + USHORT mnLines; // total number of toolbox lines + USHORT mnCurLine; // the currently visible line + USHORT mnCurLines; // number of lines due to line breaking + USHORT mnVisLines; // number of visible lines (for scrolling) + USHORT mnFloatLines; // number of lines during floating mode + USHORT mnDockLines; + USHORT mnConfigItem; + USHORT mnMouseClicks; + USHORT mnMouseModifier; + unsigned int mbDrag:1, + mbSelection:1, + mbCommandDrag:1, + mbUpper:1, + mbLower:1, + mbNextTool:1, + mbIn:1, + mbCalc:1, + mbFormat:1, + mbFullPaint:1, + mbHorz:1, + mbScroll:1, + mbLastFloatMode:1, + mbCustomize:1, + mbCustomizeMode:1, + mbDragging:1, + mbHideStatusText:1, + mbMenuStrings:1, + mbIsShift:1, + mbIsKeyEvent:1, + mbChangingHighlight:1; + WindowAlign meAlign; + WindowAlign meDockAlign; + ButtonType meButtonType; + PointerStyle meLastStyle; + WinBits mnWinStyle; + Link maClickHdl; + Link maDoubleClickHdl; + Link maActivateHdl; + Link maDeactivateHdl; + Link maHighlightHdl; + Link maSelectHdl; + Link maNextToolBoxHdl; + + public: + using Window::ImplInit; + private: + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); +// #if 0 // _SOLAR__PRIVATE + using DockingWindow::ImplInitSettings; +// #endif + SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE ImplToolItem* ImplGetItem( USHORT nId ) const; + SAL_DLLPRIVATE BOOL ImplCalcItem(); + SAL_DLLPRIVATE USHORT ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz ); + SAL_DLLPRIVATE void ImplFormat( BOOL bResize = FALSE ); + SAL_DLLPRIVATE void ImplDrawSpin( BOOL bUpperIn, BOOL bLowerIn ); + SAL_DLLPRIVATE void ImplDrawNext( BOOL bIn ); + SAL_DLLPRIVATE void ImplDrawItem( USHORT nPos, BOOL bHighlight = FALSE, BOOL bPaint = FALSE, BOOL bLayout = FALSE ); + using Window::ImplInvalidate; + SAL_DLLPRIVATE void ImplInvalidate( BOOL bNewCalc = FALSE, BOOL bFullPaint = FALSE ); + SAL_DLLPRIVATE void ImplUpdateItem( USHORT nIndex = 0xFFFF ); + SAL_DLLPRIVATE void ImplStartCustomizeMode(); + SAL_DLLPRIVATE void ImplEndCustomizeMode(); + SAL_DLLPRIVATE const XubString& ImplConvertMenuString( const XubString& rStr ); + SAL_DLLPRIVATE BOOL ImplHandleMouseMove( const MouseEvent& rMEvt, BOOL bRepeat = FALSE ); + SAL_DLLPRIVATE BOOL ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel = FALSE ); + SAL_DLLPRIVATE void ImplChangeHighlight( ImplToolItem* pItem, BOOL bNoGrabFocus = FALSE ); + SAL_DLLPRIVATE BOOL ImplChangeHighlightUpDn( BOOL bUp, BOOL bNoCycle = FALSE ); + SAL_DLLPRIVATE USHORT ImplGetItemLine( ImplToolItem* pCurrentItem ); + SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( USHORT nLine ); + SAL_DLLPRIVATE ImplToolItem* ImplGetLastValidItem( USHORT nLine ); + SAL_DLLPRIVATE BOOL ImplOpenItem( KeyCode aKeyCode ); + SAL_DLLPRIVATE BOOL ImplActivateItem( KeyCode aKeyCode ); + SAL_DLLPRIVATE void ImplShowFocus(); + SAL_DLLPRIVATE void ImplHideFocus(); + SAL_DLLPRIVATE void ImplUpdateInputEnable(); + SAL_DLLPRIVATE void ImplFillLayoutData() const; + SAL_DLLPRIVATE void ImplUpdateCustomMenu(); + SAL_DLLPRIVATE BOOL ImplHasClippedItems(); + SAL_DLLPRIVATE Point ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const; + SAL_DLLPRIVATE void ImplExecuteCustomMenu(); + SAL_DLLPRIVATE BOOL ImplIsFloatingMode() const; + SAL_DLLPRIVATE BOOL ImplIsInPopupMode() const; + SAL_DLLPRIVATE const XubString& ImplGetHelpText( USHORT nItemId ) const; + SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize( FloatingSizeMode eMode ); + SAL_DLLPRIVATE BOOL ImplHasExternalMenubutton(); + SAL_DLLPRIVATE void ImplDrawFloatwinBorder( ImplToolItem* pItem ); + + DECL_DLLPRIVATE_LINK( ImplCallExecuteCustomMenu, void* ); + DECL_DLLPRIVATE_LINK( ImplUpdateHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplResetAutoSizeTriesHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplCustomMenuListener, VclMenuEvent* ); + DECL_DLLPRIVATE_LINK( ImplDropdownLongClickHdl, ToolBox* ); + +//#if 0 // _SOLAR__PRIVATE + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE ToolBox (const ToolBox &); + SAL_DLLPRIVATE ToolBox& operator= (const ToolBox &); + + SAL_DLLPRIVATE void ImplUpdateImageList(); // called if StateChanged +public: + SAL_DLLPRIVATE void ImplFloatControl( BOOL bStart, FloatingWindow* pWindow = NULL ); + SAL_DLLPRIVATE void ImplDisableFlatButtons(); + + static SAL_DLLPRIVATE int ImplGetDragWidth( ToolBox* pThis ); + static SAL_DLLPRIVATE void ImplUpdateDragArea( ToolBox *pThis ); + static SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop, + long& rRight, long& rBottom, const ToolBox *pThis ); + static SAL_DLLPRIVATE void ImplDrawGrip( ToolBox* pThis ); + static SAL_DLLPRIVATE void ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapper *pWrapper ); + static SAL_DLLPRIVATE BOOL ImplDrawNativeBackground( ToolBox* pThis, const Region &rRegion ); + static SAL_DLLPRIVATE void ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegion ); + static SAL_DLLPRIVATE void ImplDrawConstantBackground( ToolBox* pThis, const Region &rRegion, BOOL bIsInPopupMode ); + static SAL_DLLPRIVATE void ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect ); + static SAL_DLLPRIVATE void ImplErase( ToolBox* pThis, const Rectangle &rRect, BOOL bHighlight = FALSE, BOOL bHasOpenPopup = FALSE ); + static SAL_DLLPRIVATE void ImplDrawBorder( ToolBox* pWin ); + static SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem( const ToolBox* pThis ); + static SAL_DLLPRIVATE Size ImplCalcSize( const ToolBox* pThis, USHORT nCalcLines, USHORT nCalcMode = 0 ); + static SAL_DLLPRIVATE void ImplCalcFloatSizes( ToolBox* pThis ); + static SAL_DLLPRIVATE Size ImplCalcFloatSize( ToolBox* pThis, USHORT& rLines ); + static SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMaxSize ); + static SAL_DLLPRIVATE void ImplSetMinMaxFloatSize( ToolBox *pThis ); + static SAL_DLLPRIVATE USHORT ImplCalcLines( ToolBox* pThis, long nToolSize ); + static SAL_DLLPRIVATE USHORT ImplTestLineSize( ToolBox* pThis, const Point& rPos ); + static SAL_DLLPRIVATE void ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, USHORT nLineMode ); + static SAL_DLLPRIVATE USHORT ImplFindItemPos( ToolBox* pBox, const Point& rPos ); + static SAL_DLLPRIVATE USHORT ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList ); + static SAL_DLLPRIVATE void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, BOOL bBlack, BOOL bColTransform, + BOOL bLeft = FALSE, BOOL bTop = FALSE, + long nSize = 6 ); + static SAL_DLLPRIVATE void SetToolArrowClipregion( ToolBox* pBox, long nX, long nY, + BOOL bLeft = FALSE, BOOL bTop = FALSE, + long nSize = 6 ); + static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, BOOL bHighlight ); + static SAL_DLLPRIVATE USHORT ImplCountLineBreaks( const ToolBox *pThis ); + SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } +//#endif + +protected: + void SetCurItemId(USHORT nSet) { mnCurItemId = nSet; } + +public: + ToolBox( Window* pParent, WinBits nStyle = 0 ); + ToolBox( Window* pParent, const ResId& rResId ); + ~ToolBox(); + + virtual void Click(); + virtual void DoubleClick(); + virtual void Activate(); + virtual void Deactivate(); + virtual void Highlight(); + virtual void Select(); + virtual void NextToolBox(); + virtual void Customize( const ToolBoxCustomizeEvent& rCEvt ); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void Move(); + virtual void Resize(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void KeyInput( const KeyEvent& rKEvt ); + + virtual BOOL PrepareToggleFloatingMode(); + virtual void ToggleFloatingMode(); + virtual void StartDocking(); + virtual BOOL Docking( const Point& rPos, Rectangle& rRect ); + virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + virtual void Resizing( Size& rSize ); + + void InsertItem( const ResId& rResId, + USHORT nPos = TOOLBOX_APPEND ); + void InsertItem( USHORT nItemId, const Image& rImage, + ToolBoxItemBits nBits = 0, + USHORT nPos = TOOLBOX_APPEND ); + void InsertItem( USHORT nItemId, const Image& rImage, + const XubString& rText, + ToolBoxItemBits nBits = 0, + USHORT nPos = TOOLBOX_APPEND ); + void InsertItem( USHORT nItemId, const XubString& rText, + ToolBoxItemBits nBits = 0, + USHORT nPos = TOOLBOX_APPEND ); + void InsertWindow( USHORT nItemId, Window* pWindow, + ToolBoxItemBits nBits = 0, + USHORT nPos = TOOLBOX_APPEND ); + void InsertSpace( USHORT nPos = TOOLBOX_APPEND ); + void InsertSeparator( USHORT nPos = TOOLBOX_APPEND, + USHORT nPixSize = 0 ); + void InsertBreak( USHORT nPos = TOOLBOX_APPEND ); + void RemoveItem( USHORT nPos ); + void MoveItem( USHORT nItemId, USHORT nNewPos = TOOLBOX_APPEND ); + void CopyItem( const ToolBox& rToolBox, USHORT nItemId, + USHORT nNewPos = TOOLBOX_APPEND ); + void CopyItems( const ToolBox& rToolBox ); + void Clear(); + void RecalcItems(); + + const ImageList& GetImageList() const { return maImageList; } + void SetImageList( const ImageList& rImageList ); + + void SetButtonType( ButtonType eNewType = BUTTON_SYMBOL ); + ButtonType GetButtonType() const { return meButtonType; } + + // sets a fixed button size (small, large or dontcare (==autosize)) + void SetToolboxButtonSize( ToolBoxButtonSize eSize ); + ToolBoxButtonSize GetToolboxButtonSize() const; + + void SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP ); + WindowAlign GetAlign() const { return meAlign; } + BOOL IsHorizontal() const { return mbHorz; } + + void SetLineCount( USHORT nNewLines ); + USHORT GetLineCount() const { return mnLines; } + USHORT GetCurLine() const { return mnCurLine; } + void ShowLine( BOOL bNext ); + + // Used to enable/disable scrolling one page at a time for toolbar + void SetPageScroll( BOOL b ); + BOOL GetPageScroll(); + + void SetNextToolBox( const XubString& rStr ); + const XubString& GetNextToolBox() const { return maNextToolBoxStr; } + + USHORT GetItemCount() const; + ToolBoxItemType GetItemType( USHORT nPos ) const; + USHORT GetItemPos( USHORT nItemId ) const; + USHORT GetItemPos( const Point& rPos ) const; + USHORT GetItemId( USHORT nPos ) const; + USHORT GetItemId( const Point& rPos ) const; + Rectangle GetItemRect( USHORT nItemId ) const; + Rectangle GetItemPosRect( USHORT nPos ) const; + Rectangle GetItemDropDownRect( USHORT nItemId ) const; + Rectangle GetItemPosDropDownRect( USHORT nPos ) const; + + // retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown) + Point GetItemPopupPosition( USHORT nItemId, const Size& rSize ) const; + + Rectangle GetScrollRect() const; + Rectangle GetMenubuttonRect() const; + USHORT GetCurItemId() const { return mnCurItemId; } + USHORT GetDownItemId() const { return mnDownItemId; } + USHORT GetClicks() const { return mnMouseClicks; } + USHORT GetModifier() const { return mnMouseModifier; } + USHORT GetKeyModifier() const { return mnKeyModifier; } + + void SetItemBits( USHORT nItemId, ToolBoxItemBits nBits ); + ToolBoxItemBits GetItemBits( USHORT nItemId ) const; + + void SetItemData( USHORT nItemId, void* pNewData ); + void* GetItemData( USHORT nItemId ) const; + void SetItemImage( USHORT nItemId, const Image& rImage ); + Image GetItemImage( USHORT nItemId ) const; + void SetItemImageAngle( USHORT nItemId, long nAngle10 ); + long GetItemImageAngle( USHORT nItemId ) const; + void SetItemImageMirrorMode( USHORT nItemId, BOOL bMirror ); + BOOL GetItemImageMirrorMode( USHORT ) const; + void SetItemHighImage( USHORT nItemId, const Image& rImage ); + Image GetItemHighImage( USHORT nItemId ) const; + void SetItemText( USHORT nItemId, const XubString& rText ); + const XubString& GetItemText( USHORT nItemId ) const; + void SetItemWindow( USHORT nItemId, Window* pNewWindow ); + Window* GetItemWindow( USHORT nItemId ) const; + USHORT GetHighlightItemId() const { return mnHighItemId; } + + void StartSelection(); + void EndSelection(); + + void SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease = TRUE ); + BOOL IsItemDown( USHORT nItemId ) const; + + void SetItemState( USHORT nItemId, TriState eState ); + TriState GetItemState( USHORT nItemId ) const; + + void CheckItem( USHORT nItemId, BOOL bCheck = TRUE ); + BOOL IsItemChecked( USHORT nItemId ) const; + + void EnableItem( USHORT nItemId, BOOL bEnable = TRUE ); + BOOL IsItemEnabled( USHORT nItemId ) const; + + void TriggerItem( USHORT nItemId, BOOL bShift = FALSE, BOOL bCtrl = FALSE ); + void ShowItem( USHORT nItemId, BOOL bVisible = TRUE ); + void HideItem( USHORT nItemId ) { ShowItem( nItemId, FALSE ); } + BOOL IsItemVisible( USHORT nItemId ) const; + BOOL IsItemReallyVisible( USHORT nItemId ) const; + + void SetItemCommand( USHORT nItemId, const XubString& rCommand ); + const XubString& GetItemCommand( USHORT nItemId ) const; + + using Window::SetQuickHelpText; + void SetQuickHelpText( USHORT nItemId, const XubString& rText ); + using Window::GetQuickHelpText; + const XubString& GetQuickHelpText( USHORT nItemId ) const; + + void SetHelpText( USHORT nItemId, const XubString& rText ); + const XubString& GetHelpText( USHORT nItemId ) const; + + void SetHelpId( USHORT nItemId, ULONG nHelpId ); + ULONG GetHelpId( USHORT nItemId ) const; + + // window size according to current alignment, floating state and number of lines + Size CalcWindowSizePixel() const; + // window size according to current alignment, floating state and a given number of lines + Size CalcWindowSizePixel( USHORT nCalcLines ) const; + // window size according to current floating state and a given number of lines and a given alignment + Size CalcWindowSizePixel( USHORT nCalcLines, WindowAlign eAlign ) const; + // floating window size according to number of lines (uses the number of line breaks) + Size CalcFloatingWindowSizePixel() const; + // floating window size with a given number of lines + Size CalcFloatingWindowSizePixel( USHORT nCalcLines ) const; + // automatic window size for popoup mode + Size CalcPopupWindowSizePixel() const; + + // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button) + Size CalcMinimumWindowSizePixel() const; + + void SetDockingRects( const Rectangle& rOutRect, + const Rectangle& rInRect ); + void SetFloatingLines( USHORT nFloatLines ); + USHORT GetFloatingLines() const; + + void SetBorder( long nX, long nY ); + long GetBorderX() const { return mnBorderX; } + long GetBorderY() const { return mnBorderY; } + + void SetStyle( WinBits nNewStyle ) { mnWinStyle = nNewStyle; } + WinBits GetStyle() const { return mnWinStyle; } + + // enable/disable undocking + void Lock( BOOL bLock = TRUE ); + + // read configuration to determine locking behaviour + static BOOL AlwaysLocked(); + + void EnableMenuStrings( BOOL bEnable = TRUE ) { mbMenuStrings = (bEnable != 0); } + BOOL IsMenuStringsEnabled() const { return mbMenuStrings; } + + void SetOutStyle( USHORT nNewStyle ); + USHORT GetOutStyle() const { return mnOutStyle; } + + void EnableCustomize( BOOL bEnable = TRUE ); + BOOL IsCustomize() { return mbCustomize; } + void StartCustomize( const Rectangle& rRect, void* pData = NULL ); + void SetCustomizeMode( BOOL ); + BOOL IsInCustomizeMode() const { return mbCustomizeMode; } + + static void StartCustomizeMode(); + static void EndCustomizeMode(); + static BOOL IsCustomizeMode(); + + void SetHelpText( const XubString& rText ) + { DockingWindow::SetHelpText( rText ); } + const XubString& GetHelpText() const + { return DockingWindow::GetHelpText(); } + + void SetHelpId( ULONG nId ) + { DockingWindow::SetHelpId( nId ); } + ULONG GetHelpId() const + { return DockingWindow::GetHelpId(); } + + void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } + const Link& GetClickHdl() const { return maClickHdl; } + void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } + const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + void SetDropdownClickHdl( const Link& rLink ); + const Link& GetDropdownClickHdl() const; + void SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; } + const Link& GetActivateHdl() const { return maActivateHdl; } + void SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; } + const Link& GetDeactivateHdl() const { return maDeactivateHdl; } + void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; } + const Link& GetHighlightHdl() const { return maHighlightHdl; } + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + void SetNextToolBoxHdl( const Link& rLink ) { maNextToolBoxHdl = rLink; } + const Link& GetNextToolBoxHdl() const { return maNextToolBoxHdl; } + + // support for custom menu (eg for configuration) + // note: this menu will also be used to display currently + // clipped toolbox items, so you should only touch + // items that you added by yourself + // the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START + // to allow for customization of the menu the coresponding handler is called + // when the menu button was clicked and before the menu is executed + void SetMenuType( USHORT aType = TOOLBOX_MENUTYPE_CUSTOMIZE ); + USHORT GetMenuType() const; + BOOL IsMenuEnabled() const; + PopupMenu* GetMenu() const; + void SetMenuButtonHdl( const Link& rLink ); + const Link& GetMenuButtonHdl() const; + + // open custommenu + void ExecuteCustomMenu(); + + // allow Click Handler to detect special key + BOOL IsShift() const { return mbIsShift; } + // allow Click Handler to distinguish between mouse and key input + BOOL IsKeyEvent() const { return mbIsKeyEvent; } + + // allows framework to set/query the planned popupmode + BOOL WillUsePopupMode() const; + void WillUsePopupMode( BOOL b); + + // accessibility helpers + + // gets the displayed text + String GetDisplayText() const; + // returns the bounding box for the character at index nIndex + // where nIndex is relative to the starting index of the item + // with id nItemId (in coordinates of the displaying window) + Rectangle GetCharacterBounds( USHORT nItemId, long nIndex ) const; + // -1 is returned if no character is at that point + // if an index is found the corresponding item id is filled in (else 0) + long GetIndexForPoint( const Point& rPoint, USHORT& rItemID ) const; + // returns the number of portions in the result of GetDisplayText() + long GetTextCount() const; + // returns the interval [start,end] of text portion nText + // returns [-1,-1] for an invalid text number + Pair GetTextStartEnd( long nText ) const; + // returns the item id for text portion nText or 0 if nText is invalid + USHORT GetDisplayItemId( long nText ) const; + + const Size& GetDefaultImageSize() const; + void ChangeHighlight( USHORT nPos ); + + void SetImageListProvider(vcl::IImageListProvider* _pProvider); +}; + +inline void ToolBox::CheckItem( USHORT nItemId, BOOL bCheck ) +{ + SetItemState( nItemId, (bCheck) ? STATE_CHECK : STATE_NOCHECK ); +} + +inline BOOL ToolBox::IsItemChecked( USHORT nItemId ) const +{ + return (GetItemState( nItemId ) == STATE_CHECK); +} + +inline Size ToolBox::CalcWindowSizePixel() const +{ + return CalcWindowSizePixel( mnLines ); +} + +inline Rectangle ToolBox::GetScrollRect() const +{ + return maUpperRect.GetUnion( maLowerRect ); +} + +inline void ToolBox::SetDockingRects( const Rectangle& rOutRect, + const Rectangle& rInRect ) +{ + maOutDockRect = rOutRect; + maInDockRect = rInRect; +} + +inline void ToolBox::SetFloatingLines( USHORT nNewLines ) +{ + mnFloatLines = nNewLines; +} + +inline USHORT ToolBox::GetFloatingLines() const +{ + return mnFloatLines; +} + +#endif // _SV_TOOLBOX_HXX diff --git a/vcl/inc/vcl/unobrok.hxx b/vcl/inc/vcl/unobrok.hxx new file mode 100644 index 000000000000..af616e80351a --- /dev/null +++ b/vcl/inc/vcl/unobrok.hxx @@ -0,0 +1,39 @@ +/************************************************************************* + * + * 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 _UNOBROK_HXX +#define _UNOBROK_HXX + +#include <vcl/svdata.hxx> +#include <vos/thread.hxx> + +namespace vcl_accept +{ + sal_Bool accept(const ::rtl::OUString & accDcp, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> & rSMgr); +} + +#endif // _UNOBROK_HXX diff --git a/vcl/inc/vcl/unohelp.hxx b/vcl/inc/vcl/unohelp.hxx new file mode 100644 index 000000000000..5d98b6872a26 --- /dev/null +++ b/vcl/inc/vcl/unohelp.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_UNOHELP_HXX +#define _VCL_UNOHELP_HXX + +#include <com/sun/star/uno/Reference.h> +#include <rtl/ustring.hxx> +#include <vcl/dllapi.h> + +namespace com { +namespace sun { +namespace star { +namespace i18n { + class XBreakIterator; + class XCharacterClassification; + class XCollator; +} +namespace lang { + class XMultiServiceFactory; +} +}}} + +namespace com { +namespace sun { +namespace star { +namespace accessibility { + struct AccessibleEventObject; +} +}}} + +namespace vcl +{ +namespace unohelper +{ + +::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > VCL_DLLPUBLIC GetMultiServiceFactory(); +::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > VCL_DLLPUBLIC CreateBreakIterator(); +::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification> VCL_DLLPUBLIC CreateCharacterClassification(); +::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCollator > VCL_DLLPUBLIC CreateCollator(); +::rtl::OUString VCL_DLLPUBLIC CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD ); +void VCL_DLLPUBLIC NotifyAccessibleStateEventGlobally( const ::com::sun::star::accessibility::AccessibleEventObject& rEventObject ); +}} // namespace vcl::unohelper + +#endif // _VCL_UNOHELP_HXX + diff --git a/vcl/inc/vcl/unohelp2.hxx b/vcl/inc/vcl/unohelp2.hxx new file mode 100644 index 000000000000..e7d8d34e0595 --- /dev/null +++ b/vcl/inc/vcl/unohelp2.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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_UNOHELP2_HXX +#define _VCL_UNOHELP2_HXX + +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <cppuhelper/weak.hxx> +#include <tools/string.hxx> +#include <osl/mutex.hxx> + +namespace com { namespace sun { namespace star { namespace datatransfer { namespace clipboard { + class XClipboard; +} } } } } +#include <vcl/dllapi.h> + +namespace vcl { namespace unohelper { + + class VCL_DLLPUBLIC TextDataObject : + public ::com::sun::star::datatransfer::XTransferable, + public ::cppu::OWeakObject + { + private: + String maText; + + public: + TextDataObject( const String& rText ); + ~TextDataObject(); + + String& GetString() { return maText; } + + // ::com::sun::star::uno::XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw() { OWeakObject::acquire(); } + void SAL_CALL release() throw() { OWeakObject::release(); } + + // ::com::sun::star::datatransfer::XTransferable + ::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); + ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw(::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw(::com::sun::star::uno::RuntimeException); + + /// copies a given string to a given clipboard + static void CopyStringTo( + const String& rContent, + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard + ); + }; + + struct MutexHelper + { + private: + ::osl::Mutex maMutex; + public: + ::osl::Mutex& GetMutex() { return maMutex; } + }; + +}} // namespace vcl::unohelper + +#endif // _VCL_UNOHELP2_HXX + diff --git a/vcl/inc/vcl/unowrap.hxx b/vcl/inc/vcl/unowrap.hxx new file mode 100644 index 000000000000..b11842aa0c6b --- /dev/null +++ b/vcl/inc/vcl/unowrap.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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_UNOWRAP_HXX +#define _VCL_UNOWRAP_HXX + +#include <tools/solar.h> +#include <vcl/dllapi.h> +#include <com/sun/star/uno/Reference.h> + +class XWindowPeer; +class XToolkit; +class XVclToolkit; +class EventList; +class Window; +class OutputDevice; +class MouseEvent; +class CommandEvent; +class KeyEvent; +class Rectangle; +class XVclComponentPeer; +class Menu; + +namespace com { +namespace sun { +namespace star { +namespace awt { + class XGraphics; + class XToolkit; + class XWindowPeer; +} +namespace lang { + class XMultiServiceFactory; +} +} } } + +namespace com { +namespace sun { +namespace star { +namespace accessibility { + class XAccessible; +}}}} + +class VCL_DLLPUBLIC UnoWrapperBase +{ +public: + virtual void Destroy() = 0; + + // Toolkit + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > GetVCLToolkit() = 0; + + // Graphics + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateGraphics( OutputDevice* pOutDev ) = 0; + virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) = 0; + + // Window + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> GetWindowInterface( Window* pWindow, sal_Bool bCreate ) = 0; + virtual void SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace ) = 0; + + virtual void WindowDestroyed( Window* pWindow ) = 0; + + // Accessibility + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar ) = 0; +}; + +#endif // _VCL_UNOWRAP_HXX diff --git a/vcl/inc/vcl/vclenum.hxx b/vcl/inc/vcl/vclenum.hxx new file mode 100644 index 000000000000..a34c633479e7 --- /dev/null +++ b/vcl/inc/vcl/vclenum.hxx @@ -0,0 +1,328 @@ +/************************************************************************* + * + * 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_VCLENUM_HXX +#define _VCL_VCLENUM_HXX + +#include <sal/types.h> +#include <tools/solar.h> + +#ifndef ENUM_TIMEFIELDFORMAT_DECLARED +#define ENUM_TIMEFIELDFORMAT_DECLARED + +// By changes you must also change: rsc/vclrsc.hxx +enum TimeFieldFormat {TIMEF_NONE, TIMEF_SEC, TIMEF_100TH_SEC, TIMEF_SEC_CS, TimeFieldFormat_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_EXTTIMEFIELDFORMAT_DECLARED +#define ENUM_EXTTIMEFIELDFORMAT_DECLARED + +enum ExtTimeFieldFormat { EXTTIMEF_24H_SHORT, EXTTIMEF_24H_LONG, + EXTTIMEF_12H_SHORT, EXTTIMEF_12H_LONG, + EXTTIMEF_DURATION_SHORT, EXTTIMEF_DURATION_LONG }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_EXTDATEFIELDFORMAT_DECLARED +#define ENUM_EXTDATEFIELDFORMAT_DECLARED + +enum ExtDateFieldFormat { XTDATEF_SYSTEM_SHORT, XTDATEF_SYSTEM_SHORT_YY, XTDATEF_SYSTEM_SHORT_YYYY, + XTDATEF_SYSTEM_LONG, + XTDATEF_SHORT_DDMMYY, XTDATEF_SHORT_MMDDYY, XTDATEF_SHORT_YYMMDD, + XTDATEF_SHORT_DDMMYYYY, XTDATEF_SHORT_MMDDYYYY, XTDATEF_SHORT_YYYYMMDD, + XTDATEF_SHORT_YYMMDD_DIN5008, XTDATEF_SHORT_YYYYMMDD_DIN5008, ExtDateFieldFormat_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +// to avoid conflicts with enum's declared otherwise +#define GRADIENT_LINEAR GradientStyle_LINEAR +#define GRADIENT_AXIAL GradientStyle_AXIAL +#define GRADIENT_RADIAL GradientStyle_RADIAL +#define GRADIENT_ELLIPTICAL GradientStyle_ELLIPTICAL +#define GRADIENT_SQUARE GradientStyle_SQUARE +#define GRADIENT_RECT GradientStyle_RECT +#define GRADIENT_FORCE_EQUAL_SIZE GradientStyle_FORCE_EQUAL_SIZE + +#ifndef ENUM_GRADIENTSTYLE_DECLARED +#define ENUM_GRADIENTSTYLE_DECLARED + +enum GradientStyle +{ + GRADIENT_LINEAR = 0, + GRADIENT_AXIAL = 1, + GRADIENT_RADIAL = 2, + GRADIENT_ELLIPTICAL = 3, + GRADIENT_SQUARE = 4, + GRADIENT_RECT = 5, + GradientStyle_FORCE_EQUAL_SIZE = SAL_MAX_ENUM +}; + +#endif + +// ------------------------------------------------------------ + +// to avoid conflicts with enum's declared otherwise +#define HATCH_SINGLE HatchStyle_SINGLE +#define HATCH_DOUBLE HatchStyle_DOUBLE +#define HATCH_TRIPLE HatchStyle_TRIPLE +#define HATCH_FORCE_EQUAL_SIZE HatchStyle_FORCE_EQUAL_SIZE + +#ifndef ENUM_HATCHSTYLE_DECLARED +#define ENUM_HATCHSTYLE_DECLARED + +enum HatchStyle +{ + HATCH_SINGLE = 0, + HATCH_DOUBLE = 1, + HATCH_TRIPLE = 2, + HatchStyle_FORCE_EQUAL_SIZE = SAL_MAX_ENUM +}; + +#endif + +// ------------------------------------------------------------ + +// to avoid conflicts with enum's declared otherwise +#define LINE_NONE LineStyle_NONE +#define LINE_SOLID LineStyle_SOLID +#define LINE_DASH LineStyle_DASH +#define LINE_FORCE_EQUAL_SIZE LineStyle_FORCE_EQUAL_SIZE + +#ifndef ENUM_LINESTYLE_DECLARED +#define ENUM_LINESTYLE_DECLARED + +enum LineStyle +{ + LINE_NONE = 0, + LINE_SOLID = 1, + LINE_DASH = 2, + LineStyle_FORCE_EQUAL_SIZE = SAL_MAX_ENUM +}; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_RASTEROP_DECLARED +#define ENUM_RASTEROP_DECLARED + +enum RasterOp { ROP_OVERPAINT, ROP_XOR, ROP_0, ROP_1, ROP_INVERT }; + +#endif + +// ------------------------------------------------------------ + +#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 USHORT 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 + +enum FontAutoHint { AUTOHINT_DONTKNOW, AUTOHINT_FALSE, AUTOHINT_TRUE }; + +#endif + +#ifndef ENUM_FONTHINTING_DECLARED +#define ENUM_FONTHINTING_DECLARED + +enum FontHinting { HINTING_DONTKNOW, HINTING_FALSE, HINTING_TRUE }; + +#endif + +#ifndef ENUM_FONTHINTSTYLE_DECLARED +#define ENUM_FONTHINTSTYLE_DECLARED + +enum FontHintStyle { HINT_NONE, HINT_SLIGHT, HINT_MEDIUM, HINT_FULL }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_KEYFUNCTYPE_DECLARED +#define ENUM_KEYFUNCTYPE_DECLARED + +enum KeyFuncType { KEYFUNC_DONTKNOW, KEYFUNC_NEW, KEYFUNC_OPEN, KEYFUNC_SAVE, + KEYFUNC_SAVEAS, KEYFUNC_PRINT, KEYFUNC_CLOSE, KEYFUNC_QUIT, + KEYFUNC_CUT, KEYFUNC_COPY, KEYFUNC_PASTE, KEYFUNC_UNDO, + KEYFUNC_REDO, KEYFUNC_DELETE, KEYFUNC_REPEAT, KEYFUNC_FIND, + KEYFUNC_FINDBACKWARD, KEYFUNC_PROPERTIES, KEYFUNC_FRONT, + KeyFuncType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +typedef sal_uInt32 sal_UCS4; // TODO: this should be moved to rtl + +#ifndef ENUM_OUTDEVSUPPORT_DECLARED +#define ENUM_OUTDEVSUPPORT_DECLARED + +enum OutDevSupportType { OutDevSupport_TransparentRect, OutDevSupport_B2DClip, OutDevSupport_B2DDraw }; + +#endif + +#endif // _VCL_VCLENUM_HXX diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx new file mode 100644 index 000000000000..8ccb880fce34 --- /dev/null +++ b/vcl/inc/vcl/vclevent.hxx @@ -0,0 +1,301 @@ +/************************************************************************* + * + * 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_VCLEVENT_HXX +#define _VCL_VCLEVENT_HXX + +#include "tools/link.hxx" +#include "tools/rtti.hxx" +#include "vcl/dllapi.h" +#include "vcl/impdel.hxx" + +#include <com/sun/star/uno/Reference.hxx> + +#include <list> +#include <vector> + +class Window; +class Menu; + +namespace com { namespace sun { namespace star { + namespace accessibility { + class XAccessible; + } +}}} + +#define VCLEVENT_OBJECT_DYING 1 + +// VclWindowEvent: +#define VCLEVENT_WINDOW_CHILDCREATED 500 // pData = Window* +#define VCLEVENT_WINDOW_CHILDDESTROYED 501 // pData = Window* +#define VCLEVENT_WINDOW_PAINT 1000 // pData = Rectangle* +#define VCLEVENT_WINDOW_MOVE 1001 +#define VCLEVENT_WINDOW_RESIZE 1002 +#define VCLEVENT_WINDOW_SHOW 1003 +#define VCLEVENT_WINDOW_HIDE 1004 +#define VCLEVENT_WINDOW_ACTIVATE 1005 +#define VCLEVENT_WINDOW_DEACTIVATE 1006 // pData = Window* = pPrevActiveWindow +#define VCLEVENT_WINDOW_CLOSE 1007 +#define VCLEVENT_WINDOW_GETFOCUS 1008 +#define VCLEVENT_WINDOW_LOSEFOCUS 1009 +#define VCLEVENT_WINDOW_MINIMIZE 1010 +#define VCLEVENT_WINDOW_NORMALIZE 1011 +#define VCLEVENT_WINDOW_KEYINPUT 1012 // pData = KeyEvent* +#define VCLEVENT_WINDOW_KEYUP 1013 // pData = KeyEvent* +#define VCLEVENT_WINDOW_COMMAND 1014 // pData = CommandEvent* +#define VCLEVENT_WINDOW_MOUSEMOVE 1015 // pData = MouseEvent* +#define VCLEVENT_WINDOW_MOUSEBUTTONDOWN 1016 // pData = MouseEvent* +#define VCLEVENT_WINDOW_MOUSEBUTTONUP 1017 // pData = MouseEvent* +#define VCLEVENT_WINDOW_FRAMETITLECHANGED 1018 // pData = XubString* = oldTitle +#define VCLEVENT_APPLICATION_DATACHANGED 1019 // pData = DataChangedEvent* +#define VCLEVENT_WINDOW_ENABLED 1020 +#define VCLEVENT_WINDOW_DISABLED 1021 +#define VCLEVENT_WINDOW_DATACHANGED 1022 // pData = DataChangedEvent* + +// VclWindowEvent +#define VCLEVENT_CONTROL_GETFOCUS 1100 +#define VCLEVENT_CONTROL_LOSEFOCUS 1101 +#define VCLEVENT_BUTTON_CLICK 1102 +#define VCLEVENT_PUSHBUTTON_TOGGLE 1103 +#define VCLEVENT_RADIOBUTTON_TOGGLE 1104 +#define VCLEVENT_CHECKBOX_TOGGLE 1105 +#define VCLEVENT_COMBOBOX_SELECT 1106 +#define VCLEVENT_COMBOBOX_DOUBLECLICK 1107 +#define VCLEVENT_LISTBOX_SELECT 1108 +#define VCLEVENT_LISTBOX_DOUBLECLICK 1109 +#define VCLEVENT_EDIT_MODIFY 1110 +#define VCLEVENT_SCROLLBAR_SCROLL 1111 +#define VCLEVENT_SCROLLBAR_ENDSCROLL 1112 +#define VCLEVENT_SPINBUTTON_UP 1113 +#define VCLEVENT_SPINBUTTON_DOWN 1114 +#define VCLEVENT_SPINFIELD_UP 1115 +#define VCLEVENT_SPINFIELD_DOWN 1116 +#define VCLEVENT_SPINFIELD_FIRST 1117 +#define VCLEVENT_SPINFIELD_LAST 1118 +#define VCLEVENT_STATUSBAR_CLICK 1119 +#define VCLEVENT_STATUSBAR_DOUBLECLICK 1120 +#define VCLEVENT_TOOLBOX_CLICK 1121 +#define VCLEVENT_TOOLBOX_DOUBLECLICK 1122 +#define VCLEVENT_TOOLBOX_ACTIVATE 1123 +#define VCLEVENT_TOOLBOX_DEACTIVATE 1124 +#define VCLEVENT_TOOLBOX_HIGHLIGHT 1125 +#define VCLEVENT_TOOLBOX_SELECT 1126 +// Resort later... +#define VCLEVENT_LISTBOX_SCROLLED 1127 +#define VCLEVENT_COMBOBOX_SCROLLED 1128 +#define VCLEVENT_EDIT_SELECTIONCHANGED 1129 +#define VCLEVENT_DROPDOWN_OPEN 1130 +#define VCLEVENT_DROPDOWN_CLOSE 1131 + +#define VCLEVENT_TOOLBOX_ITEMADDED 1132 // pData = itempos +#define VCLEVENT_TOOLBOX_ITEMREMOVED 1133 // pData = itempos +#define VCLEVENT_TOOLBOX_ALLITEMSCHANGED 1134 +#define VCLEVENT_TOOLBOX_HIGHLIGHTOFF 1135 // pData = itempos +#define VCLEVENT_WINDOW_MENUBARADDED 1136 // pData = pMenuBar +#define VCLEVENT_TABPAGE_ACTIVATE 1137 // pData = pageid +#define VCLEVENT_TABPAGE_DEACTIVATE 1138 // pData = pageid +#define VCLEVENT_TABBAR_PAGEENABLED 1139 // pData = pageid +#define VCLEVENT_TABBAR_PAGEDISABLED 1140 // pData = pageid +#define VCLEVENT_TABBAR_PAGESELECTED 1141 // pData = pageid +#define VCLEVENT_TABBAR_PAGEACTIVATED 1142 // pData = pageid +#define VCLEVENT_TABBAR_PAGEDEACTIVATED 1143 // pData = pageid +#define VCLEVENT_TABBAR_PAGEINSERTED 1144 // pData = pageid +#define VCLEVENT_TABBAR_PAGEREMOVED 1145 // pData = pageid +#define VCLEVENT_TABBAR_PAGEMOVED 1146 // pData = Pair( pagepos_old, pagepos_new ) +#define VCLEVENT_TABBAR_PAGETEXTCHANGED 1147 // pData = pageid +#define VCLEVENT_COMBOBOX_DESELECT 1148 +#define VCLEVENT_TOOLBOX_ITEMTEXTCHANGED 1149 // pData = itempos +#define VCLEVENT_TABPAGE_INSERTED 1150 // pData = pageid +#define VCLEVENT_TABPAGE_REMOVED 1151 // pData = pageid +#define VCLEVENT_TABPAGE_REMOVEDALL 1152 +#define VCLEVENT_LISTBOX_ITEMADDED 1153 // pData = itempos +#define VCLEVENT_LISTBOX_ITEMREMOVED 1154 // pData = itempos, -1=ALL +#define VCLEVENT_COMBOBOX_ITEMADDED 1155 // pData = itempos +#define VCLEVENT_COMBOBOX_ITEMREMOVED 1156 // pData = itempos, -1=ALL +// free 1157 +#define VCLEVENT_WINDOW_MENUBARREMOVED 1158 // pData = pMenuBar +#define VCLEVENT_STATUSBAR_ITEMADDED 1159 // pData = itemid +#define VCLEVENT_STATUSBAR_ITEMREMOVED 1160 // pData = itemid +#define VCLEVENT_STATUSBAR_ALLITEMSREMOVED 1161 +#define VCLEVENT_STATUSBAR_SHOWITEM 1162 // pData = itemid +#define VCLEVENT_STATUSBAR_HIDEITEM 1163 // pData = itemid +#define VCLEVENT_STATUSBAR_SHOWALLITEMS 1164 +#define VCLEVENT_STATUSBAR_HIDEALLITEMS 1165 +#define VCLEVENT_STATUSBAR_DRAWITEM 1166 // pData = itemid +#define VCLEVENT_STATUSBAR_NAMECHANGED 1167 // pData = itemid +#define VCLEVENT_TOOLBOX_ITEMENABLED 1168 // pData = itempos +#define VCLEVENT_TOOLBOX_ITEMDISABLED 1169 // pData = itempos +#define VCLEVENT_TABPAGE_PAGETEXTCHANGED 1170 // pData = pageid +#define VCLEVENT_ROADMAP_ITEMSELECTED 1171 +#define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout +#define VCLEVENT_COMBOBOX_SETTEXT 1173 +// --> OD 2009-04-01 #i92103# +#define VCLEVENT_ITEM_EXPANDED 1174 +#define VCLEVENT_ITEM_COLLAPSED 1175 +// <-- +#define VCLEVENT_DROPDOWN_PRE_OPEN 1176 + +// VclMenuEvent +#define VCLEVENT_MENU_ACTIVATE 1200 +#define VCLEVENT_MENU_DEACTIVATE 1201 +#define VCLEVENT_MENU_HIGHLIGHT 1202 +#define VCLEVENT_MENU_SELECT 1203 +#define VCLEVENT_MENU_ENABLE 1204 +#define VCLEVENT_MENU_INSERTITEM 1205 +#define VCLEVENT_MENU_REMOVEITEM 1206 +#define VCLEVENT_MENU_SUBMENUACTIVATE 1207 +#define VCLEVENT_MENU_SUBMENUDEACTIVATE 1208 +#define VCLEVENT_MENU_SUBMENUCHANGED 1209 +#define VCLEVENT_MENU_DEHIGHLIGHT 1210 +#define VCLEVENT_MENU_DISABLE 1211 +#define VCLEVENT_MENU_ITEMTEXTCHANGED 1212 +#define VCLEVENT_MENU_ITEMCHECKED 1213 +#define VCLEVENT_MENU_ITEMUNCHECKED 1214 +#define VCLEVENT_MENU_ACCESSIBLENAMECHANGED 1215 + +#define VCLEVENT_MENU_SHOW 1250 +#define VCLEVENT_MENU_HIDE 1251 + +#define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED 1216 + +// DockingWindow +#define VCLEVENT_WINDOW_STARTDOCKING 1217 // pData = DockingData +#define VCLEVENT_WINDOW_DOCKING 1218 +#define VCLEVENT_WINDOW_ENDDOCKING 1219 // pData = EndDockingData +#define VCLEVENT_WINDOW_PREPARETOGGLEFLOATING 1220 // pData = BOOL +#define VCLEVENT_WINDOW_TOGGLEFLOATING 1221 +#define VCLEVENT_WINDOW_ENDPOPUPMODE 1222 // pData = EndPopupModeData + +#define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos +#define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText) +#define VCLEVENT_TABLEROW_SELECT 1225 + +class VCL_DLLPUBLIC VclSimpleEvent +{ +private: + ULONG nId; + +public: + VclSimpleEvent( ULONG n ) { nId = n; } + TYPEINFO(); + + ULONG GetId() const { return nId; } +}; + +class VCL_DLLPUBLIC VclWindowEvent : public VclSimpleEvent +{ +private: + Window* pWindow; + void* pData; + +public: + VclWindowEvent( Window* pWin, ULONG n, void* pDat = NULL ) : VclSimpleEvent(n) { pWindow = pWin; pData = pDat; } + TYPEINFO(); + + Window* GetWindow() const { return pWindow; } + void* GetData() const { return pData; } +}; + +/* +class VclMouseEvent : public VclWindowEvent +{ +private: + MouseEvent aEvent; + +public: + VclMouseEvent( Window* pWin, ULONG n, const MouseEvent& rEvent ) : VclWindowEvent( pWin, n ), aEvent(rEvent) { ; } + TYPEINFO(); + + const MouseEvent& GetEvent() const { return aEvent; } +}; +*/ + +class VCL_DLLPUBLIC VclMenuEvent : public VclSimpleEvent +{ +private: + Menu* pMenu; + USHORT mnPos; + +public: + VclMenuEvent( Menu* pM, ULONG n, USHORT nPos ) : VclSimpleEvent(n) { pMenu = pM; mnPos = nPos; } + TYPEINFO(); + + Menu* GetMenu() const { return pMenu; } + USHORT GetItemPos() const { return mnPos; } +}; + +class VCL_DLLPUBLIC VclAccessibleEvent: public VclSimpleEvent +{ +public: + VclAccessibleEvent( ULONG n, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible ); + virtual ~VclAccessibleEvent(); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible() const; + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible; +}; + +class VCL_DLLPUBLIC VclEventListeners : public std::list<Link> +{ +public: + void Call( VclSimpleEvent* pEvent ) const; + + // stops notifying when any handler has processed the event + // and returns TRUE in that case + // a handler must return TRUE to signal that it has processed the event + BOOL Process( VclSimpleEvent* pEvent ) const; +}; + +class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier +{ + std::list< Link > m_aListeners; + + struct ListenerIt + { + std::list< Link >::iterator m_aIt; + bool m_bWasInvalidated; + + ListenerIt(const std::list<Link>::iterator& rIt) + : m_aIt(rIt) + , m_bWasInvalidated( false ) + {} + }; + + std::vector< ListenerIt > m_aIterators; + + +public: + VclEventListeners2(); + ~VclEventListeners2(); + + void addListener( const Link& ); + void removeListener( const Link& ); + + void callListeners( VclSimpleEvent* ); +}; + +#endif // _VCL_VCLEVENT_HXX diff --git a/vcl/inc/vcl/virdev.hxx b/vcl/inc/vcl/virdev.hxx new file mode 100644 index 000000000000..26270ec7703f --- /dev/null +++ b/vcl/inc/vcl/virdev.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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_VIRDEV_HXX +#define _SV_VIRDEV_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/outdev.hxx> + +// ----------------- +// - VirtualDevice - +// ----------------- + +class SalVirtualDevice; +class RmVirtualDevice; +struct SystemGraphicsData; + +class VCL_DLLPUBLIC VirtualDevice : public OutputDevice +{ + friend class Application; + friend class OutputDevice; + +private: + SalVirtualDevice* mpVirDev; + VirtualDevice* mpPrev; + VirtualDevice* mpNext; + USHORT mnBitCount; + BOOL mbScreenComp; + sal_Int8 mnAlphaDepth; + BYTE meRefDevMode; + + SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, USHORT nBitCount, const SystemGraphicsData *pData = NULL ); + SAL_DLLPRIVATE BOOL ImplSetOutputSizePixel( const Size& rNewSize, BOOL bErase ); + + // Copy assignment is forbidden and not implemented. + VirtualDevice (const VirtualDevice &); + VirtualDevice & operator= (const VirtualDevice &); + + /** Used for alpha VDev, to set areas to opaque + + @since #i32109# + */ + SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const Rectangle& rRect ); + + // TODO: add extra member for refdev backward compatibility options + #define REFDEV_FORCE_ZERO_EXTLEAD 0x80 + SAL_DLLPRIVATE bool ForceZeroExtleadBug() const + { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); } +public: + VirtualDevice( USHORT nBitCount = 0 ); + VirtualDevice( const OutputDevice& rCompDev, + USHORT nBitCount = 0 ); + /** Create a virtual device with alpha channel + + @param rCompDev + The generated vdev will be compatible to this device. By + default, Application::GetDefaultDevice() is used here. + + @param nBitCount + Bit depth of the generated virtual device. Use 0 here, to + indicate: take default screen depth. Currently, only 0 and 1 + are allowed here, with 1 denoting binary mask. + + @param nAlphaBitCount + Bit depth of the generated virtual device. Use 0 here, to + indicate: take default screen depth. Currently, only 0 and 1 + are allowed here, with 1 denoting binary mask. + */ + VirtualDevice( const OutputDevice& rCompDev, + USHORT nBitCount, USHORT nAlphaBitCount ); + + /** Create a virtual device using an existing system dependent device or graphics context + Any rendering will happen directly on the context and not on any intermediate bitmap. + Note: This might not be suported on all platforms ! + */ + VirtualDevice( const SystemGraphicsData *pData, USHORT nBitCount ); + + virtual ~VirtualDevice(); + + BOOL SetOutputSizePixel( const Size& rNewSize, BOOL bErase = TRUE ); + BOOL SetOutputSize( const Size& rNewSize, BOOL bErase = TRUE ) + { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); } + + // reference device modes for different compatibility levels + enum RefDevMode { REFDEV_NONE = 0, + REFDEV_MODE06 = 1, // 600 dpi + REFDEV_MODE48 = 2, // 4800 dpi + REFDEV_MODE_MSO1 = 3, + REFDEV_MODE_PDF1 = 4, + REFDEV_CUSTOM = 5 + }; + + void SetReferenceDevice( RefDevMode ); + + void Compat_ZeroExtleadBug(); // enable workaround for #i60495# + + void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); + +private: + SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); + +}; + +#endif // _SV_VIRDEV_HXX diff --git a/vcl/inc/vcl/waitobj.hxx b/vcl/inc/vcl/waitobj.hxx new file mode 100644 index 000000000000..1dcd42d8bcf9 --- /dev/null +++ b/vcl/inc/vcl/waitobj.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_WAITOBJ_HXX +#define _SV_WAITOBJ_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/window.hxx> + +// -------------- +// - WaitObject - +// -------------- + +class VCL_DLLPUBLIC WaitObject +{ +private: + Window* mpWindow; +public: + WaitObject( Window* pWindow ) + { + mpWindow = pWindow; + if ( mpWindow ) + mpWindow->EnterWait(); + } + ~WaitObject(); +}; + +#endif // _SV_WAITOBJ_HXX diff --git a/vcl/inc/vcl/wall.hxx b/vcl/inc/vcl/wall.hxx new file mode 100644 index 000000000000..07611aaf5edc --- /dev/null +++ b/vcl/inc/vcl/wall.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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_WALL_HXX +#define _SV_WALL_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <tools/color.hxx> + +class Rectangle; +class Gradient; +class BitmapEx; +class ImplWallpaper; + +// ------------------- +// - Wallpaper-Types - +// ------------------- + +#define WALLPAPER_NULL WallpaperStyle_NULL +#define WALLPAPER_TILE WallpaperStyle_TILE +#define WALLPAPER_CENTER WallpaperStyle_CENTER +#define WALLPAPER_SCALE WallpaperStyle_SCALE +#define WALLPAPER_TOPLEFT WallpaperStyle_TOPLEFT +#define WALLPAPER_TOP WallpaperStyle_TOP +#define WALLPAPER_TOPRIGHT WallpaperStyle_TOPRIGHT +#define WALLPAPER_LEFT WallpaperStyle_LEFT +#define WALLPAPER_RIGHT WallpaperStyle_RIGHT +#define WALLPAPER_BOTTOMLEFT WallpaperStyle_BOTTOMLEFT +#define WALLPAPER_BOTTOM WallpaperStyle_BOTTOM +#define WALLPAPER_BOTTOMRIGHT WallpaperStyle_BOTTOMRIGHT +#define WALLPAPER_APPLICATIONGRADIENT WallpaperStyle_APPLICATIONGRADIENT +#define WALLPAPER_FORCE_EQUAL_SIZE WallpaperStyle_FORCE_EQUAL_SIZE + +#ifndef ENUM_WALLPAPERSTYLE_DECLARED +#define ENUM_WALLPAPERSTYLE_DECLARED + +enum WallpaperStyle +{ + WALLPAPER_NULL, + WALLPAPER_TILE, + WALLPAPER_CENTER, + WALLPAPER_SCALE, + WALLPAPER_TOPLEFT, + WALLPAPER_TOP, + WALLPAPER_TOPRIGHT, + WALLPAPER_LEFT, + WALLPAPER_RIGHT, + WALLPAPER_BOTTOMLEFT, + WALLPAPER_BOTTOM, + WALLPAPER_BOTTOMRIGHT, + WALLPAPER_APPLICATIONGRADIENT, // defines a gradient that internally covers the whole application + // and uses a color derived from the face color + WALLPAPER_FORCE_EQUAL_SIZE = 0x7fffffff +}; + +#endif + +// ------------- +// - Wallpaper - +// ------------- + +class VCL_DLLPUBLIC Wallpaper +{ +private: + ImplWallpaper* mpImplWallpaper; + + SAL_DLLPRIVATE void ImplMakeUnique( BOOL bReleaseCache = TRUE ); + SAL_DLLPRIVATE Gradient ImplGetApplicationGradient() const; + +//#if 0 // _SOLAR__PRIVATE +public: + SAL_DLLPRIVATE ImplWallpaper* ImplGetImpWallpaper() const { return mpImplWallpaper; } +//#endif + +public: + Wallpaper(); + Wallpaper( const Wallpaper& rWallpaper ); + Wallpaper( const Color& rColor ); + Wallpaper( const BitmapEx& rBmpEx ); + Wallpaper( const Gradient& rGradient ); + ~Wallpaper(); + + void SetColor( const Color& rColor ); + const Color& GetColor() const; + + void SetStyle( WallpaperStyle eStyle ); + WallpaperStyle GetStyle() const; + + void SetBitmap( const BitmapEx& rBitmap ); + void SetBitmap(); + BitmapEx GetBitmap() const; + BOOL IsBitmap() const; + + void SetGradient( const Gradient& rGradient ); + void SetGradient(); + Gradient GetGradient() const; + BOOL IsGradient() const; + + void SetRect( const Rectangle& rRect ); + void SetRect(); + Rectangle GetRect() const; + BOOL IsRect() const; + + BOOL IsFixed() const; + BOOL IsScrollable() const; + + Wallpaper& operator=( const Wallpaper& rWallpaper ); + BOOL operator==( const Wallpaper& rWallpaper ) const; + BOOL operator!=( const Wallpaper& rWallpaper ) const + { return !(Wallpaper::operator==( rWallpaper )); } + BOOL IsSameInstance( const Wallpaper& rWallpaper ) const + { return (mpImplWallpaper == rWallpaper.mpImplWallpaper); } + + friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Wallpaper& rWallpaper ); + friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper ); +}; + +#endif // _SV_WALL_HXX diff --git a/vcl/inc/vcl/wall2.hxx b/vcl/inc/vcl/wall2.hxx new file mode 100644 index 000000000000..e93a8370ee7d --- /dev/null +++ b/vcl/inc/vcl/wall2.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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_WALL2_HXX +#define _SV_WALL2_HXX + +#include <vcl/wall.hxx> + +class ImplWallpaper +{ + friend class Wallpaper; + +private: + Color maColor; + BitmapEx* mpBitmap; + Gradient* mpGradient; + Rectangle* mpRect; + WallpaperStyle meStyle; + ULONG mnRefCount; + BitmapEx* mpCache; + + friend SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper ); + friend SvStream& operator<<( SvStream& rOStm, const ImplWallpaper& rImplWallpaper ); + +public: + ImplWallpaper(); + ImplWallpaper( const ImplWallpaper& rImplWallpaper ); + ~ImplWallpaper(); + + void ImplSetCachedBitmap( BitmapEx& rBmp ); + const BitmapEx* ImplGetCachedBitmap() { return mpCache; } + void ImplReleaseCachedBitmap(); +}; + + +#endif // _SV_WALL2_HXX diff --git a/vcl/inc/vcl/windata.hxx b/vcl/inc/vcl/windata.hxx new file mode 100644 index 000000000000..9436352e4927 --- /dev/null +++ b/vcl/inc/vcl/windata.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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_WINDATA_HXX +#define _SV_WINDATA_HXX + +#include <vcl/sv.h> + +class SalFrame; +class Window; + +// -------------- +// - Prototypes - +// -------------- + +long ImplWindowFrameProc( Window* pInst, SalFrame* pFrame, USHORT nEvent, const void* pEvent ); + +// ----------- +// - HitTest - +// ----------- + +#define WINDOW_HITTEST_INSIDE ((USHORT)0x0001) +#define WINDOW_HITTEST_TRANSPARENT ((USHORT)0x0002) + +#endif // _SV_WINDATA_HXX diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h new file mode 100644 index 000000000000..691c3ed18421 --- /dev/null +++ b/vcl/inc/vcl/window.h @@ -0,0 +1,372 @@ +/************************************************************************* + * + * 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_WINDOW_H +#define _SV_WINDOW_H + +#include <vector> +#include <vcl/sv.h> +#include <vcl/outdev.hxx> +#include <vcl/timer.hxx> +#ifndef _SV_INPUTCTX_HXX +#include <vcl/inputctx.hxx> +#endif +#ifndef _SV_POINTR_HXX +#include <vcl/pointr.hxx> +#endif +#include <vcl/wintypes.hxx> +#include <vcl/vclevent.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <cppuhelper/weakref.hxx> + +#include <vcl/salnativewidgets.hxx> + +#include <list> + +struct SalPaintEvent; +struct ImplDelData; +struct ImplAccessibleInfos; + +class Window; +class VirtualDevice; +class Cursor; +class ImplDevFontList; +class ImplFontCache; +class SmartId; +class VCLXWindow; +class SalFrame; +class SalObject; + + +namespace com { +namespace sun { +namespace star { +namespace accessibility { + class XAccessible; +}}}} + +namespace com { +namespace sun { +namespace star { +namespace rendering { + class XCanvas; +}}}} + +namespace com { +namespace sun { +namespace star { +namespace awt { + class XWindowPeer; + class XWindow; +} +namespace uno { + class Any; + class XInterface; +} +namespace datatransfer { +namespace clipboard { + class XClipboard; +} + +namespace dnd { + class XDropTargetListener; + class XDragGestureRecognizer; + class XDragSource; + class XDropTarget; +} } } } } + +namespace vcl { struct ControlLayoutData; } + + + + +// --------------- +// - ImplWinData - +// --------------- + +struct ImplWinData +{ + UniString* mpExtOldText; + USHORT* mpExtOldAttrAry; + Rectangle* mpCursorRect; + long mnCursorExtWidth; + Rectangle* mpFocusRect; + Rectangle* mpTrackRect; + USHORT mnTrackFlags; + USHORT mnIsTopWindow; + BOOL mbMouseOver; // tracks mouse over for native widget paint effect + BOOL mbEnableNativeWidget; // toggle native widget rendering + SmartId* mpSmartHelpId; + SmartId* mpSmartUniqueId; + ::std::list< Window* > + maTopWindowChildren; +}; + +// ------------------- +// - ImplOverlapData - +// ------------------- + +struct ImplOverlapData +{ + VirtualDevice* mpSaveBackDev; // Gesicherte Hintergrund-Bitmap + Region* mpSaveBackRgn; // Gesicherte Region, was invalidiert werden muss + Window* mpNextBackWin; // Naechstes Fenster mit Hintergrund-Sicherung + ULONG mnSaveBackSize; // Groesse Bitmap fuer Hintergrund-Sicherung + BOOL mbSaveBack; // TRUE: Background sichern + BYTE mnTopLevel; // Level for Overlap-Window +}; + +// ----------------- +// - ImplFrameData - +// ----------------- + +struct ImplFrameData +{ + Timer maPaintTimer; // paint timer + Timer maResizeTimer; // resize timer + InputContext maOldInputContext; // Last set Input Context + Window* mpNextFrame; // next frame window + Window* mpFirstOverlap; // first overlap window + Window* mpFocusWin; // focus window (is also set, when frame doesn't have the focous) + Window* mpMouseMoveWin; // last window, where MouseMove() called + Window* mpMouseDownWin; // last window, where MouseButtonDown() called + Window* mpFirstBackWin; // Erstes Overlap-Window mit Hintergrund-Sicherung + ::std::vector<Window *> maOwnerDrawList; // List of system windows with owner draw decoration + ImplDevFontList* mpFontList; // Font-List for this frame + ImplFontCache* mpFontCache; // Font-Cache for this frame + sal_Int32 mnDPIX; // Original Screen Resolution + sal_Int32 mnDPIY; // Original Screen Resolution + ImplMapRes maMapUnitRes; // for LogicUnitToPixel + ULONG mnAllSaveBackSize; // Groesse aller Bitmaps fuer Hintergrund-Sicherung + ULONG mnFocusId; // FocusId for PostUserLink + ULONG mnMouseMoveId; // MoveId for PostUserLink + long mnLastMouseX; // last x mouse position + long mnLastMouseY; // last y mouse position + long mnBeforeLastMouseX; // last but one x mouse position + long mnBeforeLastMouseY; // last but one y mouse position + long mnFirstMouseX; // first x mouse position by mousebuttondown + long mnFirstMouseY; // first y mouse position by mousebuttondown + long mnLastMouseWinX; // last x mouse position, rel. to pMouseMoveWin + long mnLastMouseWinY; // last y mouse position, rel. to pMouseMoveWin + USHORT mnModalMode; // frame based modal count (app based makes no sense anymore) + ULONG mnMouseDownTime; // mouse button down time for double click + USHORT mnClickCount; // mouse click count + USHORT mnFirstMouseCode; // mouse code by mousebuttondown + USHORT mnMouseCode; // mouse code + USHORT mnMouseMode; // mouse mode + MapUnit meMapUnit; // last MapUnit for LogicUnitToPixel + BOOL mbHasFocus; // focus + BOOL mbInMouseMove; // is MouseMove on stack + BOOL mbMouseIn; // is Mouse inside the frame + BOOL mbStartDragCalled; // is command startdrag called + BOOL mbNeedSysWindow; // set, when FrameSize <= IMPL_MIN_NEEDSYSWIN + BOOL mbMinimized; // set, when FrameSize <= 0 + BOOL mbStartFocusState; // FocusState, beim abschicken des Events + BOOL mbInSysObjFocusHdl; // Innerhalb vom GetFocus-Handler eines SysChilds + BOOL mbInSysObjToTopHdl; // Innerhalb vom ToTop-Handler eines SysChilds + BOOL mbSysObjFocus; // Hat ein SysChild den Focus + + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > mxDragSource; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > mxDropTarget; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard; + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection; + + BOOL mbInternalDragGestureRecognizer; +}; + +// --------------- +// - WindowImpl - +// --------------- + +enum AlwaysInputMode { AlwaysInputNone = 0, AlwaysInputEnabled = 1, AlwaysInputDisabled =2 }; + +class WindowImpl +{ +public: + WindowImpl(); + ~WindowImpl(); + + ImplWinData* mpWinData; + ImplOverlapData* mpOverlapData; + ImplFrameData* mpFrameData; + SalFrame* mpFrame; + SalObject* mpSysObj; + Window* mpFrameWindow; + Window* mpOverlapWindow; + Window* mpBorderWindow; + Window* mpClientWindow; + Window* mpParent; + Window* mpRealParent; + Window* mpFirstChild; + Window* mpLastChild; + Window* mpFirstOverlap; + Window* mpLastOverlap; + Window* mpPrev; + Window* mpNext; + Window* mpNextOverlap; + Window* mpLastFocusWindow; + Window* mpDlgCtrlDownWindow; + VclEventListeners maEventListeners; + VclEventListeners maChildEventListeners; + + // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call + ::com::sun::star::uno::WeakReference< ::com::sun::star::rendering::XCanvas > mxCanvas; + + ImplDelData* mpFirstDel; + void* mpUserData; + Cursor* mpCursor; + Pointer maPointer; + Fraction maZoom; + XubString maText; + Font* mpControlFont; + Color maControlForeground; + Color maControlBackground; + sal_Int32 mnLeftBorder; + sal_Int32 mnTopBorder; + sal_Int32 mnRightBorder; + sal_Int32 mnBottomBorder; + long mnX; + long mnY; + long mnAbsScreenX; + Point maPos; + ULONG mnHelpId; + ULONG mnUniqId; + XubString maHelpText; + XubString maQuickHelpText; + InputContext maInputContext; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible; + ImplAccessibleInfos* mpAccessibleInfos; + VCLXWindow* mpVCLXWindow; + Region maWinRegion; // region to 'shape' the VCL window (frame coordinates) + Region maWinClipRegion; // the (clipping) region that finally corresponds to the VCL window (frame coordinates) + Region maInvalidateRegion; // region that has to be redrawn (frame coordinates) + Region* mpChildClipRegion; // child clip region if CLIPCHILDREN is set (frame coordinates) + Region* mpPaintRegion; // only set during Paint() method call (window coordinates) + WinBits mnStyle; + WinBits mnPrevStyle; + WinBits mnExtendedStyle; + WinBits mnPrevExtendedStyle; + WindowType mnType; + ControlPart mnNativeBackground; + USHORT mnWaitCount; + USHORT mnPaintFlags; + USHORT mnGetFocusFlags; + USHORT mnParentClipMode; + USHORT mnActivateMode; + USHORT mnDlgCtrlFlags; + USHORT mnLockCount; + AlwaysInputMode meAlwaysInputMode; + BOOL mbFrame:1, + mbBorderWin:1, + mbOverlapWin:1, + mbSysWin:1, + mbDialog:1, + mbDockWin:1, + mbFloatWin:1, + mbPushButton:1, + mbVisible:1, + mbDisabled:1, + mbInputDisabled:1, + mbDropDisabled:1, + mbNoUpdate:1, + mbNoParentUpdate:1, + mbActive:1, + mbParentActive:1, + mbReallyVisible:1, + mbReallyShown:1, + mbInInitShow:1, + mbChildNotify:1, + mbChildPtrOverwrite:1, + mbNoPtrVisible:1, + mbPaintFrame:1, + mbInPaint:1, + mbMouseMove:1, + mbMouseButtonDown:1, + mbMouseButtonUp:1, + mbKeyInput:1, + mbKeyUp:1, + mbCommand:1, + mbDefPos:1, + mbDefSize:1, + mbCallMove:1, + mbCallResize:1, + mbWaitSystemResize:1, + mbInitWinClipRegion:1, + mbInitChildRegion:1, + mbWinRegion:1, + mbClipChildren:1, + mbClipSiblings:1, + mbChildTransparent:1, + mbPaintTransparent:1, + mbMouseTransparent:1, + mbDlgCtrlStart:1, + mbFocusVisible:1, + mbTrackVisible:1, + mbUseNativeFocus:1, + mbNativeFocusVisible:1, + mbInShowFocus:1, + mbInHideFocus:1, + mbControlForeground:1, + mbControlBackground:1, + mbAlwaysOnTop:1, + mbCompoundControl:1, + mbCompoundControlHasFocus:1, + mbPaintDisabled:1, + mbAllResize:1, + mbInDtor:1, + mbExtTextInput:1, + mbInFocusHdl:1, + mbOverlapVisible:1, + mbCreatedWithToolkit:1, + mbToolBox:1, + mbSplitter:1, + mbSuppressAccessibilityEvents:1, + mbMenuFloatingWindow:1, + mbDrawSelectionBackground:1, + mbIsInTaskPaneList:1, + mbToolbarFloatingWindow:1, + mbCallHandlersDuringInputDisabled:1, + mbDisableAccessibleLabelForRelation:1, + mbDisableAccessibleLabeledByRelation:1, + mbHelpTextDynamic:1, + mbFakeFocusSet:1; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; +}; + +// ----------------- +// - Hilfsmethoden - +// ----------------- + +long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, + long nX, long nY, ULONG nMsgTime, + USHORT nCode, USHORT nMode ); +void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight ); + +#endif // _SV_WINDOW_H diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx new file mode 100644 index 000000000000..8264767e59ad --- /dev/null +++ b/vcl/inc/vcl/window.hxx @@ -0,0 +1,1109 @@ +/************************************************************************* + * + * 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_WINDOW_HXX +#define _SV_WINDOW_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/outdev.hxx> +#include <tools/resid.hxx> +#ifndef _SV_POINTR_HXX +#include <vcl/pointr.hxx> +#endif +#include <vcl/wintypes.hxx> +#ifndef _SV_APPTYPES_HXX +#include <vcl/apptypes.hxx> +#endif +#include <vcl/inputctx.hxx> +#include <vcl/vclevent.hxx> +// Only for compatibility - because many people outside haven't included event.hxx +#ifndef _VCL_EVENT_HXX +#include <vcl/event.hxx> +#endif +#include <vcl/region.hxx> +#include <vcl/salnativewidgets.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <vcl/smartid.hxx> + +class VirtualDevice; +struct ImplDelData; +struct ImplWinData; +struct ImplOverlapData; +struct ImplFrameData; +struct ImplCalcToTopData; +struct SystemEnvData; +struct SystemParentData; +class ImplBorderWindow; +class VirtualDevice; +class Timer; +class Cursor; +class DockingManager; +class ScrollBar; +class Bitmap; +class Image; +class MouseEvent; +class KeyEvent; +class CommandEvent; +class TrackingEvent; +class HelpEvent; +class DataChangedEvent; +class NotifyEvent; +class SystemWindow; +class SalFrame; +class SalObject; +class MenuFloatingWindow; +class UNOWindowData; +// Nur fuer ExecuteDrag: +struct IDataObject; +class VCLXWindow; +struct ImplAccessibleInfos; + +namespace com { +namespace sun { +namespace star { +namespace accessibility { + class XAccessible; +}}}} + +namespace com { +namespace sun { +namespace star { +namespace rendering { + class XCanvas; + class XSpriteCanvas; +}}}} + +namespace com { +namespace sun { +namespace star { +namespace awt { + class XWindowPeer; + class XWindow; +} +namespace uno { + class Any; + class XInterface; +} +namespace datatransfer { +namespace clipboard { + class XClipboard; +} + +namespace dnd { + class XDragGestureRecognizer; + class XDragSource; + class XDropTarget; +} } } } } + +namespace vcl { struct ControlLayoutData; } + +namespace svt { class PopupWindowControllerImpl; } + +// --------------- +// - WindowTypes - +// --------------- + +// Type fuer GetWindow() +#define WINDOW_PARENT ((USHORT)0) +#define WINDOW_FIRSTCHILD ((USHORT)1) +#define WINDOW_LASTCHILD ((USHORT)2) +#define WINDOW_PREV ((USHORT)3) +#define WINDOW_NEXT ((USHORT)4) +#define WINDOW_FIRSTOVERLAP ((USHORT)5) +#define WINDOW_LASTOVERLAP ((USHORT)6) +#define WINDOW_OVERLAP ((USHORT)7) +#define WINDOW_PARENTOVERLAP ((USHORT)8) +#define WINDOW_CLIENT ((USHORT)9) +#define WINDOW_REALPARENT ((USHORT)10) +#define WINDOW_FRAME ((USHORT)11) +#define WINDOW_BORDER ((USHORT)12) +#define WINDOW_FIRSTTOPWINDOWCHILD ((USHORT)13) +#define WINDOW_LASTTOPWINDOWCHILD ((USHORT)14) +#define WINDOW_PREVTOPWINDOWSIBLING ((USHORT)15) +#define WINDOW_NEXTTOPWINDOWSIBLING ((USHORT)16) + +// Flags for SetPosSizePixel() +#define WINDOW_POSSIZE_X ((USHORT)0x0001) +#define WINDOW_POSSIZE_Y ((USHORT)0x0002) +#define WINDOW_POSSIZE_WIDTH ((USHORT)0x0004) +#define WINDOW_POSSIZE_HEIGHT ((USHORT)0x0008) +#define WINDOW_POSSIZE_POS (WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y) +#define WINDOW_POSSIZE_SIZE (WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT) +#define WINDOW_POSSIZE_POSSIZE (WINDOW_POSSIZE_POS | WINDOW_POSSIZE_SIZE) +#define WINDOW_POSSIZE_ALL (WINDOW_POSSIZE_POSSIZE) +#define WINDOW_POSSIZE_DROPDOWN ((USHORT)0x0010) + +// Flags for Show() +#define SHOW_NOPARENTUPDATE ((USHORT)0x0001) +#define SHOW_NOFOCUSCHANGE ((USHORT)0x0002) +#define SHOW_NOACTIVATE ((USHORT)0x0004) +#define SHOW_FOREGROUNDTASK ((USHORT)0x0008) + +// Flags for SetZOrder() +#define WINDOW_ZORDER_BEFOR ((USHORT)0x0001) +#define WINDOW_ZORDER_BEHIND ((USHORT)0x0002) +#define WINDOW_ZORDER_FIRST ((USHORT)0x0004) +#define WINDOW_ZORDER_LAST ((USHORT)0x0008) + +// Activate-Flags +#define ACTIVATE_MODE_GRABFOCUS ((USHORT)0x0001) + +// ToTop-Flags +#define TOTOP_RESTOREWHENMIN ((USHORT)0x0001) +#define TOTOP_FOREGROUNDTASK ((USHORT)0x0002) +#define TOTOP_NOGRABFOCUS ((USHORT)0x0004) +//#if 0 // _SOLAR__PRIVATE // vcl internal only +#define TOTOP_GRABFOCUSONLY ((USHORT)0x0008) +//#endif + +// Flags for Invalidate +#define INVALIDATE_CHILDREN ((USHORT)0x0001) +#define INVALIDATE_NOCHILDREN ((USHORT)0x0002) +#define INVALIDATE_NOERASE ((USHORT)0x0004) +#define INVALIDATE_UPDATE ((USHORT)0x0008) +#define INVALIDATE_TRANSPARENT ((USHORT)0x0010) +#define INVALIDATE_NOTRANSPARENT ((USHORT)0x0020) +#define INVALIDATE_NOCLIPCHILDREN ((USHORT)0x4000) +// Temporaer fuer Kompatibilitaet +#define INVALIDATE_BACKGROUND INVALIDATE_TRANSPARENT + +// Flags for Validate +#define VALIDATE_CHILDREN ((USHORT)0x0001) +#define VALIDATE_NOCHILDREN ((USHORT)0x0002) + +// Flags for Scroll +#define SCROLL_CLIP ((USHORT)0x0001) +#define SCROLL_CHILDREN ((USHORT)0x0002) +#define SCROLL_NOCHILDREN ((USHORT)0x0004) +#define SCROLL_NOERASE ((USHORT)0x0008) +#define SCROLL_NOINVALIDATE ((USHORT)0x0010) +#define SCROLL_NOWINDOWINVALIDATE ((USHORT)0x0020) +#define SCROLL_USECLIPREGION ((USHORT)0x0040) +#define SCROLL_UPDATE ((USHORT)0x0080) + +// Flags for ParentClipMode +#define PARENTCLIPMODE_CLIP ((USHORT)0x0001) +#define PARENTCLIPMODE_NOCLIP ((USHORT)0x0002) + +// Flags for Invert() +#define INVERT_HIGHLIGHT ((USHORT)0x0001) +#define INVERT_50 ((USHORT)0x0002) + +// Flags for ShowTracking() +#define SHOWTRACK_SMALL ((USHORT)0x0001) +#define SHOWTRACK_BIG ((USHORT)0x0002) +#define SHOWTRACK_SPLIT ((USHORT)0x0003) +#define SHOWTRACK_OBJECT ((USHORT)0x0004) +#define SHOWTRACK_WINDOW ((USHORT)0x1000) +#define SHOWTRACK_CLIP ((USHORT)0x2000) +#define SHOWTRACK_STYLE ((USHORT)0x000F) + +// Flags for StartTracking() +#define STARTTRACK_KEYINPUT ((USHORT)0x0001) +#define STARTTRACK_KEYMOD ((USHORT)0x0002) +#define STARTTRACK_NOKEYCANCEL ((USHORT)0x0004) +#define STARTTRACK_SCROLLREPEAT ((USHORT)0x0008) +#define STARTTRACK_BUTTONREPEAT ((USHORT)0x0010) +#define STARTTRACK_MOUSEBUTTONDOWN ((USHORT)0x0020) +#define STARTTRACK_FOCUSCANCEL ((USHORT)0x0040) + +// Flags for StartAutoScroll() +#define AUTOSCROLL_VERT ((USHORT)0x0001) +#define AUTOSCROLL_HORZ ((USHORT)0x0002) + +// Flags for StateChanged() +typedef USHORT StateChangedType; +#define STATE_CHANGE_INITSHOW ((StateChangedType)1) +#define STATE_CHANGE_VISIBLE ((StateChangedType)2) +#define STATE_CHANGE_UPDATEMODE ((StateChangedType)3) +#define STATE_CHANGE_ENABLE ((StateChangedType)4) +#define STATE_CHANGE_TEXT ((StateChangedType)5) +#define STATE_CHANGE_IMAGE ((StateChangedType)6) +#define STATE_CHANGE_DATA ((StateChangedType)7) +#define STATE_CHANGE_STATE ((StateChangedType)8) +#define STATE_CHANGE_STYLE ((StateChangedType)9) +#define STATE_CHANGE_ZOOM ((StateChangedType)10) +#define STATE_CHANGE_BORDER ((StateChangedType)11) +#define STATE_CHANGE_TRANSPARENT ((StateChangedType)12) +#define STATE_CHANGE_CONTROLFONT ((StateChangedType)13) +#define STATE_CHANGE_CONTROLFOREGROUND ((StateChangedType)14) +#define STATE_CHANGE_CONTROLBACKGROUND ((StateChangedType)15) +#define STATE_CHANGE_READONLY ((StateChangedType)16) +#define STATE_CHANGE_FORMAT ((StateChangedType)17) +#define STATE_CHANGE_EXTENDEDSTYLE ((StateChangedType)18) +#define STATE_CHANGE_MIRRORING ((StateChangedType)19) +#define STATE_CHANGE_USER ((StateChangedType)10000) + +// GetFocusFlags +#define GETFOCUS_TAB ((USHORT)0x0001) +#define GETFOCUS_CURSOR ((USHORT)0x0002) +#define GETFOCUS_MNEMONIC ((USHORT)0x0004) +#define GETFOCUS_FORWARD ((USHORT)0x0010) +#define GETFOCUS_BACKWARD ((USHORT)0x0020) +#define GETFOCUS_AROUND ((USHORT)0x0040) +#define GETFOCUS_UNIQUEMNEMONIC ((USHORT)0x0100) +#define GETFOCUS_INIT ((USHORT)0x0200) +#define GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL ((USHORT)0x0400) + +// Draw-Flags fuer Draw() +#define WINDOW_DRAW_MONO ((ULONG)0x00000001) +#define WINDOW_DRAW_NOBORDER ((ULONG)0x00000002) +#define WINDOW_DRAW_NOCONTROLS ((ULONG)0x00000004) +#define WINDOW_DRAW_NODISABLE ((ULONG)0x00000008) +#define WINDOW_DRAW_NOMNEMONIC ((ULONG)0x00000010) +#define WINDOW_DRAW_NOSELECTION ((ULONG)0x00000020) +#define WINDOW_DRAW_NOFOCUS ((ULONG)0x00000040) +#define WINDOW_DRAW_NOBACKGROUND ((ULONG)0x00000080) +#define WINDOW_DRAW_ROLLOVER ((ULONG)0x00000100) + +// Border-Styles fuer SetBorder() +#define WINDOW_BORDER_NORMAL ((USHORT)0x0001) +#define WINDOW_BORDER_MONO ((USHORT)0x0002) +#define WINDOW_BORDER_ACTIVE ((USHORT)0x0004) +#define WINDOW_BORDER_DOUBLEOUT ((USHORT)0x0008) +#define WINDOW_BORDER_MENU ((USHORT)0x0010) +#define WINDOW_BORDER_NOBORDER ((USHORT)0x1000) +#define WINDOW_BORDER_REMOVEBORDER ((USHORT)0x2000) + +// DialogControl-Flags +#define WINDOW_DLGCTRL_RETURN ((USHORT)0x0001) +#define WINDOW_DLGCTRL_WANTFOCUS ((USHORT)0x0002) +#define WINDOW_DLGCTRL_MOD1TAB ((USHORT)0x0004) +#define WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ((USHORT)0x0008) + +// GetWindowClipRegionPixel-Flags +#define WINDOW_GETCLIPREGION_NULL ((USHORT)0x0001) +#define WINDOW_GETCLIPREGION_NOCHILDREN ((USHORT)0x0002) + +// EndExtTextInput-Flags +#define EXTTEXTINPUT_END_COMPLETE ((USHORT)0x0001) +#define EXTTEXTINPUT_END_CANCEL ((USHORT)0x0002) + +//#if 0 // _SOLAR__PRIVATE +#define IMPL_MINSIZE_BUTTON_WIDTH 70 +#define IMPL_MINSIZE_BUTTON_HEIGHT 22 +#define IMPL_EXTRA_BUTTON_WIDTH 18 +#define IMPL_EXTRA_BUTTON_HEIGHT 10 +#define IMPL_SEP_BUTTON_X 5 +#define IMPL_SEP_BUTTON_Y 5 +#define IMPL_MINSIZE_MSGBOX_WIDTH 150 +#define IMPL_MINSIZE_MSGBOX_HEIGHT 80 +#define IMPL_DIALOG_OFFSET 5 +#define IMPL_DIALOG_BAR_OFFSET 3 +#define IMPL_MSGBOX_OFFSET_EXTRA_X 0 +#define IMPL_MSGBOX_OFFSET_EXTRA_Y 2 +#define IMPL_SEP_MSGBOX_IMAGE 8 + +#define DLGWINDOW_PREV 0 +#define DLGWINDOW_NEXT 1 +#define DLGWINDOW_FIRST 2 +//#endif + +enum WindowSizeType { + WINDOWSIZE_MINIMUM, + WINDOWSIZE_PREFERRED, + WINDOWSIZE_MAXIMUM +}; + +// ---------- +// - Window - +// ---------- + +#ifdef DBG_UTIL +const char* ImplDbgCheckWindow( const void* pObj ); +#endif + +class WindowImpl; +class VCL_DLLPUBLIC Window : public OutputDevice +{ + friend class Cursor; + friend class OutputDevice; + friend class Application; + friend class SystemWindow; + friend class WorkWindow; + friend class Dialog; + friend class MessBox; + friend class DockingWindow; + friend class FloatingWindow; + friend class GroupBox; + friend class PushButton; + friend class RadioButton; + friend class SystemChildWindow; + friend class ImplBorderWindow; + + // TODO: improve missing functionality + // only required because of SetFloatingMode() + friend class ImplDockingWindowWrapper; + friend class ImplPopupFloatWin; + friend class MenuFloatingWindow; + + friend class svt::PopupWindowControllerImpl; + +private: + // NOTE: to remove many dependencies of other modules + // to this central file, all members are now hidden + // in the WindowImpl class and all inline functions + // were removed + // + // Please do *not* add new members or inline functions to class Window, + // but use class WindowImpl instead + // + WindowImpl* mpWindowImpl; + + SAL_DLLPRIVATE void ImplInitWindowData( WindowType nType ); + +#ifdef DBG_UTIL + friend const char* ImplDbgCheckWindow( const void* pObj ); +#endif + friend Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos ); +public: + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ); + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::uno::Any& aSystemWorkWindowToken ); + SAL_DLLPRIVATE WinBits ImplInitRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplWindowRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplSetFrameParent( const Window* pParent ); + SAL_DLLPRIVATE void ImplInsertWindow( Window* pParent ); + SAL_DLLPRIVATE void ImplRemoveWindow( BOOL bRemoveFrameData ); + SAL_DLLPRIVATE Window* ImplGetWindow(); + SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData(); + SAL_DLLPRIVATE SalFrame* ImplGetFrame() const; + SAL_DLLPRIVATE ImplWinData* ImplGetWinData() const; + SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const; + SAL_DLLPRIVATE void ImplCallFocusChangeActivate( Window* pNewOverlapWindow, Window* pOldOverlapWindow ); + SAL_DLLPRIVATE Window* ImplFindWindow( const Point& rFramePos ); + SAL_DLLPRIVATE USHORT ImplHitTest( const Point& rFramePos ); + SAL_DLLPRIVATE Window* ImplGetParent() const; + SAL_DLLPRIVATE Window* ImplGetClientWindow() const; + SAL_DLLPRIVATE Window* ImplGetBorderWindow() const; + SAL_DLLPRIVATE Window* ImplGetFirstOverlapWindow(); + SAL_DLLPRIVATE const Window* ImplGetFirstOverlapWindow() const; + SAL_DLLPRIVATE Window* ImplGetFrameWindow() const; + SAL_DLLPRIVATE BOOL ImplIsRealParentPath( const Window* pWindow ) const; + SAL_DLLPRIVATE BOOL ImplIsChild( const Window* pWindow, BOOL bSystemWindow = FALSE ) const; + SAL_DLLPRIVATE BOOL ImplIsWindowOrChild( const Window* pWindow, BOOL bSystemWindow = FALSE ) const; + SAL_DLLPRIVATE Window* ImplGetSameParent( const Window* pWindow ) const; + SAL_DLLPRIVATE BOOL ImplIsDockingWindow() const; + SAL_DLLPRIVATE BOOL ImplIsFloatingWindow() const; + SAL_DLLPRIVATE BOOL ImplIsToolbox() const; + SAL_DLLPRIVATE BOOL ImplIsSplitter() const; + SAL_DLLPRIVATE BOOL ImplIsPushButton() const; + SAL_DLLPRIVATE BOOL ImplIsOverlapWindow() const; + SAL_DLLPRIVATE void ImplSetActive( BOOL bActive ); + SAL_DLLPRIVATE BOOL ImplIsMouseTransparent() const; + SAL_DLLPRIVATE void ImplSetMouseTransparent( BOOL bTransparent ); + SAL_DLLPRIVATE int ImplTestMousePointerSet(); + SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const; + SAL_DLLPRIVATE void ImplResetReallyVisible(); + SAL_DLLPRIVATE void ImplSetReallyVisible(); + SAL_DLLPRIVATE void ImplCallInitShow(); + SAL_DLLPRIVATE void ImplAddDel( ImplDelData* pDel ); + SAL_DLLPRIVATE void ImplRemoveDel( ImplDelData* pDel ); + SAL_DLLPRIVATE void ImplInitResolutionSettings(); + SAL_DLLPRIVATE void ImplPointToLogic( Font& rFont ) const; + SAL_DLLPRIVATE void ImplLogicToPoint( Font& rFont ) const; + SAL_DLLPRIVATE Point ImplOutputToFrame( const Point& rPos ); + SAL_DLLPRIVATE Point ImplFrameToOutput( const Point& rPos ); + SAL_DLLPRIVATE void ImplOutputToFrame( Rectangle& rRect ); + SAL_DLLPRIVATE void ImplFrameToOutput( Rectangle& rRect ); + SAL_DLLPRIVATE BOOL ImplSysObjClip( const Region* pOldRegion ); + SAL_DLLPRIVATE void ImplUpdateSysObjChildsClip(); + SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip(); + SAL_DLLPRIVATE void ImplUpdateSysObjClip(); + SAL_DLLPRIVATE BOOL ImplSetClipFlagChilds( BOOL bSysObjOnlySmaller = FALSE ); + SAL_DLLPRIVATE BOOL ImplSetClipFlagOverlapWindows( BOOL bSysObjOnlySmaller = FALSE ); + SAL_DLLPRIVATE BOOL ImplSetClipFlag( BOOL bSysObjOnlySmaller = FALSE ); + SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( Region& rRegion ); + SAL_DLLPRIVATE void ImplIntersectWindowRegion( Region& rRegion ); + SAL_DLLPRIVATE void ImplExcludeWindowRegion( Region& rRegion ); + SAL_DLLPRIVATE void ImplExcludeOverlapWindows( Region& rRegion ); + SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( Region& rRegion ); + SAL_DLLPRIVATE void ImplClipBoundaries( Region& rRegion, BOOL bThis, BOOL bOverlaps ); + SAL_DLLPRIVATE BOOL ImplClipChilds( Region& rRegion ); + SAL_DLLPRIVATE void ImplClipAllChilds( Region& rRegion ); + SAL_DLLPRIVATE void ImplClipSiblings( Region& rRegion ); + SAL_DLLPRIVATE void ImplInitWinClipRegion(); + SAL_DLLPRIVATE void ImplInitWinChildClipRegion(); + SAL_DLLPRIVATE Region* ImplGetWinChildClipRegion(); + SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const Region& rInterRegion, Region& rRegion ); + SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const Region& rInterRegion, Region& rRegion ); + SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& rRegion ); + SAL_DLLPRIVATE void ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion, + BOOL bChilds, BOOL bParent, BOOL bSiblings ); + SAL_DLLPRIVATE void ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ); + SAL_DLLPRIVATE void ImplCallOverlapPaint(); + SAL_DLLPRIVATE void ImplPostPaint(); + SAL_DLLPRIVATE void ImplInvalidateFrameRegion( const Region* pRegion, USHORT nFlags ); + SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion( const Region& rRegion ); + SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( Region& rRegion ); + SAL_DLLPRIVATE void ImplInvalidate( const Region* rRegion, USHORT nFlags ); + SAL_DLLPRIVATE void ImplValidateFrameRegion( const Region* rRegion, USHORT nFlags ); + SAL_DLLPRIVATE void ImplValidate( const Region* rRegion, USHORT nFlags ); + SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const Rectangle& rRect, long nHorzScroll, long nVertScroll, BOOL bChilds ); + SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const Rectangle& rRect, long nHorzScroll, long nVertScroll, BOOL bChilds ); + SAL_DLLPRIVATE void ImplScroll( const Rectangle& rRect, long nHorzScroll, long nVertScroll, USHORT nFlags ); + SAL_DLLPRIVATE void ImplUpdateAll( BOOL bOverlapWindows = TRUE ); + SAL_DLLPRIVATE void ImplUpdateWindowPtr( Window* pWindow ); + SAL_DLLPRIVATE void ImplUpdateWindowPtr(); + SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( BOOL bNewFrame ); + SAL_DLLPRIVATE BOOL ImplUpdatePos(); + SAL_DLLPRIVATE void ImplUpdateSysObjPos(); + SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl; } + /** check whether a font is suitable for UI + + The font to be tested will be checked whether it could display a + localized test string. If this is not the case, then the font + is deemed unsuitable as UI font. + + @param rFont + the font to be tested + + @returns + <TRUE/> if the font can be used as UI font + <FALSE/> if the font is unsuitable as UI font + */ + SAL_DLLPRIVATE bool ImplCheckUIFont( const Font& rFont ); + SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl = TRUE ); + SAL_DLLPRIVATE void ImplAlignChilds(); + SAL_DLLPRIVATE void ImplPosSizeWindow( long nX, long nY, long nWidth, long nHeight, USHORT nFlags ); + SAL_DLLPRIVATE void ImplToBottomChild(); + SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData ); + SAL_DLLPRIVATE void ImplCalcChildOverlapToTop( ImplCalcToTopData* pPrevData ); + SAL_DLLPRIVATE void ImplToTop( USHORT nFlags ); + SAL_DLLPRIVATE void ImplStartToTop( USHORT nFlags ); + SAL_DLLPRIVATE void ImplFocusToTop( USHORT nFlags, BOOL bReallyVisible ); + SAL_DLLPRIVATE void ImplShowAllOverlaps(); + SAL_DLLPRIVATE void ImplHideAllOverlaps(); + SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt ); + SAL_DLLPRIVATE void ImplCallMouseMove( USHORT nMouseCode, BOOL bModChanged = FALSE ); + SAL_DLLPRIVATE void ImplGenerateMouseMove(); + SAL_DLLPRIVATE void ImplGrabFocus( USHORT nFlags ); + SAL_DLLPRIVATE void ImplInvertFocus( const Rectangle& rRect ); + SAL_DLLPRIVATE void ImplControlFocus( USHORT nFlags = 0 ); + SAL_DLLPRIVATE Window* ImplGetDlgWindow( USHORT n, USHORT nType, USHORT nStart = 0, USHORT nEnd = 0xFFFF, USHORT* pIndex = NULL ); + SAL_DLLPRIVATE BOOL ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ); + SAL_DLLPRIVATE BOOL ImplHasDlgCtrl(); + SAL_DLLPRIVATE void ImplDlgCtrlNextWindow(); + SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( Window* pWindow, BOOL bGetFocus ); + SAL_DLLPRIVATE Window* ImplFindDlgCtrlWindow( Window* pWindow ); + SAL_DLLPRIVATE long ImplLogicUnitToPixelX( long nX, MapUnit eUnit ); + SAL_DLLPRIVATE long ImplLogicUnitToPixelY( long nY, MapUnit eUnit ); + SAL_DLLPRIVATE BOOL ImplIsWindowInFront( const Window* pTestWindow ) const; + SAL_DLLPRIVATE void ImplSaveOverlapBackground(); + SAL_DLLPRIVATE BOOL ImplRestoreOverlapBackground( Region& rInvRegion ); + SAL_DLLPRIVATE void ImplDeleteOverlapBackground(); + SAL_DLLPRIVATE void ImplInvalidateAllOverlapBackgrounds(); + SAL_DLLPRIVATE static void ImplNewInputContext(); + SAL_DLLPRIVATE void ImplCallActivateListeners(Window*); + SAL_DLLPRIVATE void ImplCallDeactivateListeners(Window*); + DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl, Timer* ); + DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplAsyncStateChangedHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl, void* ); + + SAL_DLLPRIVATE static void ImplCalcSymbolRect( Rectangle& rRect ); + SAL_DLLPRIVATE void ImplHandleScroll( ScrollBar* pHScrl, long nX, ScrollBar* pVScrl, long nY ); + SAL_DLLPRIVATE BOOL ImplGetCurrentBackgroundColor( Color& rCol ); + SAL_DLLPRIVATE BOOL ImplIsAccessibleCandidate() const; + SAL_DLLPRIVATE BOOL ImplIsAccessibleNativeFrame() const; + SAL_DLLPRIVATE USHORT ImplGetAccessibleCandidateChildWindowCount( USHORT nFirstWindowType ) const; + SAL_DLLPRIVATE Window* ImplGetAccessibleCandidateChild( USHORT nChild, USHORT& rChildCount, USHORT nFirstWindowType, BOOL bTopLevel = TRUE ) const; + SAL_DLLPRIVATE BOOL ImplRegisterAccessibleNativeFrame(); + SAL_DLLPRIVATE void ImplRevokeAccessibleNativeFrame(); + SAL_DLLPRIVATE void ImplCallResize(); + SAL_DLLPRIVATE void ImplCallMove(); + SAL_DLLPRIVATE Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle& rRect ) const; + SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const; + SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX(); + SAL_DLLPRIVATE void ImplIncModalCount(); + SAL_DLLPRIVATE void ImplDecModalCount(); + + // retrieves the list of owner draw decorated windows for this window hiearchy + SAL_DLLPRIVATE ::std::vector<Window *>& ImplGetOwnerDrawList(); + SAL_DLLPRIVATE Window* ImplGetTopmostFrameWindow(); + + SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const; + SAL_DLLPRIVATE void ImplNotifyIconifiedState( BOOL bIconified ); + SAL_DLLPRIVATE bool ImplStopDnd(); + SAL_DLLPRIVATE void ImplStartDnd(); + + SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow ); + SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos ); + + SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList(); + SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList ); + SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > + ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const; + +private: + // Default construction is forbidden and not implemented. + SAL_DLLPRIVATE Window(); + + // Copy assignment is forbidden and not implemented. + SAL_DLLPRIVATE Window (const Window &); + SAL_DLLPRIVATE Window & operator= (const Window &); + +protected: + // Single argument ctors shall be explicit. + explicit Window( WindowType nType ); + + void SetCompoundControl( BOOL bCompound ); + + void ImplCallEventListeners( ULONG nEvent, void* pData = NULL ); + void CallEventListeners( ULONG nEvent, void* pData = NULL ); + void FireVclEvent( VclSimpleEvent* pEvent ); + + // FIXME: this is a hack to workaround missing layout functionality + SAL_DLLPRIVATE void ImplAdjustNWFSizes(); +public: + // Single argument ctors shall be explicit. + explicit Window( Window* pParent, WinBits nStyle = 0 ); + + Window( Window* pParent, const ResId& rResId ); + virtual ~Window(); + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyUp( const KeyEvent& rKEvt ); + virtual void PrePaint(); + virtual void Paint( const Rectangle& rRect ); + virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags ); + virtual void Move(); + virtual void Resize(); + virtual void Activate(); + virtual void Deactivate(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void Tracking( const TrackingEvent& rTEvt ); + virtual void UserEvent( ULONG nEvent, void* pEventData ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt ); + virtual Window* GetPreferredKeyInputWindow(); + + /*virtual*/ void AddEventListener( const Link& rEventListener ); + /*virtual*/ void RemoveEventListener( const Link& rEventListener ); + /*virtual*/ void AddChildEventListener( const Link& rEventListener ); + /*virtual*/ void RemoveChildEventListener( const Link& rEventListener ); + + ULONG PostUserEvent( ULONG nEvent, void* pEventData = NULL ); + ULONG PostUserEvent( const Link& rLink, void* pCaller = NULL ); + BOOL PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData = NULL ); + BOOL PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller = NULL ); + void RemoveUserEvent( ULONG nUserEvent ); + void PostStateChanged( StateChangedType nState ); + + void IncrementLockCount(); + void DecrementLockCount(); + BOOL IsLocked( BOOL bChilds = FALSE ) const; + + // returns the input language used for the last key stroke + // may be LANGUAGE_DONTKNOW if not supported by the OS + LanguageType GetInputLanguage() const; + + void SetStyle( WinBits nStyle ); + WinBits GetStyle() const; + WinBits GetPrevStyle() const; + void SetExtendedStyle( WinBits nExtendedStyle ); + WinBits GetExtendedStyle() const; + WinBits GetPrevExtendedStyle() const; + void SetType( WindowType nType ); + WindowType GetType() const; + BOOL IsSystemWindow() const; + BOOL IsDialog() const; + BOOL IsMenuFloatingWindow() const; + BOOL IsToolbarFloatingWindow() const; + BOOL IsTopWindow() const; + SystemWindow* GetSystemWindow() const; + + void EnableAllResize( BOOL bEnable = TRUE ); + BOOL IsAllResizeEnabled() const; + + void SetBorderStyle( USHORT nBorderStyle ); + USHORT GetBorderStyle() const; + void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, + sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const; + Size CalcWindowSize( const Size& rOutSz ) const; + Size CalcOutputSize( const Size& rWinSz ) const; + long CalcTitleWidth() const; + + void EnableClipSiblings( BOOL bClipSiblings = TRUE ); + BOOL IsClipSiblingsEnabled() const; + + void EnableChildTransparentMode( BOOL bEnable = TRUE ); + BOOL IsChildTransparentModeEnabled() const; + + void SetMouseTransparent( BOOL bTransparent ); + BOOL IsMouseTransparent() const; + void SetPaintTransparent( BOOL bTransparent ); + BOOL IsPaintTransparent() const; + void SetDialogControlStart( BOOL bStart ); + BOOL IsDialogControlStart() const; + void SetDialogControlFlags( USHORT nFlags ); + USHORT GetDialogControlFlags() const; + + struct PointerState + { + ULONG mnState; // the button state + Point maPos; // mouse position in output coordinates + }; + PointerState GetPointerState(); + BOOL IsMouseOver(); + + ULONG GetCurrentModButtons(); + + void SetInputContext( const InputContext& rInputContext ); + const InputContext& GetInputContext() const; + void EndExtTextInput( USHORT nFlags ); + BOOL IsExtTextInput() const; + void SetCursorRect( const Rectangle* pRect = NULL, long nExtTextInputWidth = 0 ); + const Rectangle* GetCursorRect() const; + long GetCursorExtTextInputWidth() const; + + void EnableChildNotify( BOOL bEnable ); + BOOL IsChildNotify() const; + + using OutputDevice::SetSettings; + virtual void SetSettings( const AllSettings& rSettings ); + virtual void SetSettings( const AllSettings& rSettings, BOOL bChild ); + void UpdateSettings( const AllSettings& rSettings, BOOL bChild = FALSE ); + void NotifyAllChilds( DataChangedEvent& rDCEvt ); + + void SetPointFont( const Font& rFont ); + Font GetPointFont() const; + void SetZoomedPointFont( const Font& rFont ); + long GetDrawPixel( OutputDevice* pDev, long nPixels ) const; + Font GetDrawPixelFont( OutputDevice* pDev ) const; + void GetFontResolution( sal_Int32& nDPIX, sal_Int32& nDPIY ) const; + + void SetControlFont(); + void SetControlFont( const Font& rFont ); + Font GetControlFont() const; + BOOL IsControlFont() const; + void SetControlForeground(); + void SetControlForeground( const Color& rColor ); + Color GetControlForeground() const; + BOOL IsControlForeground() const; + void SetControlBackground(); + void SetControlBackground( const Color& rColor ); + Color GetControlBackground() const; + BOOL IsControlBackground() const; + + void SetParentClipMode( USHORT nMode = 0 ); + USHORT GetParentClipMode() const; + + void SetWindowRegionPixel(); + void SetWindowRegionPixel( const Region& rRegion ); + const Region& GetWindowRegionPixel() const; + BOOL IsWindowRegionPixel() const; + Region GetWindowClipRegionPixel( USHORT nFlags = 0 ) const; + Region GetPaintRegion() const; + BOOL IsInPaint() const; + // while IsInPaint returns true ExpandPaintClipRegion adds the + // submitted region to the paint clip region so you can + // paint additional parts of your window if necessary + void ExpandPaintClipRegion( const Region& rRegion ); + + void SetParent( Window* pNewParent ); + Window* GetParent() const; + + void Show( BOOL bVisible = TRUE, USHORT nFlags = 0 ); + void Hide( USHORT nFlags = 0 ) { Show( FALSE, nFlags ); } + BOOL IsVisible() const; + BOOL IsReallyVisible() const; + // Do not use this function, use IsReallyVisible() + BOOL IsParentPathVisible() const; + BOOL IsReallyShown() const; + BOOL IsInInitShow() const; + + void Enable( bool bEnable = true, bool bChild = true ); + void Disable( bool bChild = true ) { Enable( false, bChild ); } + BOOL IsEnabled() const; + + void EnableInput( BOOL bEnable = TRUE, BOOL bChild = TRUE ); + void EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin, + const Window* pExcludeWindow = NULL ); + BOOL IsInputEnabled() const; + + /** Override <code>EnableInput</code>. This can be necessary due to other people + using EnableInput for whole window hierarchies. + + + <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are + mutually exclusive; the last setter wins. + @param bAlways + sets always enabled flag + + @param bChild + if true children are recursively set to AlwaysEnableInput + */ + void AlwaysEnableInput( BOOL bAlways, BOOL bChild = TRUE ); + /** returns the current AlwaysEnableInput state + @return + true if window is in AlwaysEnableInput state + */ + BOOL IsAlwaysEnableInput() const; + /** Override <code>EnableInput</code>, counterpart to AlwaysEnableInput. + Windows with AlwaysDisableInput will not get key events even if enabled + and input enabled.This can be necessary due to other people using EnableInput + for whole window hierarchies. + + <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are + mutually exclusive; the last setter wins. + + @param bAlways + sets always disable flag + + @param bChild + if true children are recursively set to AlwaysDisableInput + */ + void AlwaysDisableInput( BOOL bAlways, BOOL bChild = TRUE ); + /** returns the current AlwaysDisableInput state + @return + true if window is in AlwaysEnableInput state + */ + BOOL IsAlwaysDisableInput() const; + /** usually event handlers (see AddEventListener and AddChildEventListener) + are not called on disabled, modal or input disabled windows. There are however rare cases + in which one wants a Window or rather one of its Control subclasses to + not evaluate events but still react to those events externally. In these + rare cases call SetCallHandlersOnInputDisabled( true ) to have your handler + called anyway. + + Currently only mouse events get this special treatment. + + Use this sparingly, chances are if you want to use it you're wroking around + the real problem. + + @param bCall + Enable/Disable calling event handlers for this disabled, modal or input disabled window. + This call is implicity done recursively for possible child windows. + */ + void SetCallHandlersOnInputDisabled( bool bCall ); + /** get state of SetCallHandlersOnInputDisabled + + @returns whether handlers are called regardless of input enabled state + */ + bool IsCallHandlersOnInputDisabled() const; + /** A window is in modal mode if one of its children or subchildren + is a running modal window (a modal dialog) + + @returns TRUE if a child or subchild is a running modal window + */ + BOOL IsInModalMode() const; + + void SetActivateMode( USHORT nMode ); + USHORT GetActivateMode() const; + + void ToTop( USHORT nFlags = 0 ); + void SetZOrder( Window* pRefWindow, USHORT nFlags ); + void EnableAlwaysOnTop( BOOL bEnable = TRUE ); + BOOL IsAlwaysOnTopEnabled() const; + + virtual void SetPosSizePixel( long nX, long nY, + long nWidth, long nHeight, + USHORT nFlags = WINDOW_POSSIZE_ALL ); + virtual void SetPosPixel( const Point& rNewPos ); + virtual Point GetPosPixel() const; + virtual void SetSizePixel( const Size& rNewSize ); + virtual Size GetSizePixel() const; + virtual void SetPosSizePixel( const Point& rNewPos, + const Size& rNewSize ); + virtual void SetOutputSizePixel( const Size& rNewSize ); + BOOL IsDefaultPos() const; + BOOL IsDefaultSize() const; + + // those conversion routines might deliver different results during UI mirroring + Point OutputToScreenPixel( const Point& rPos ) const; + Point ScreenToOutputPixel( const Point& rPos ) const; + // the normalized screen methods work independent from UI mirroring + Point OutputToNormalizedScreenPixel( const Point& rPos ) const; + Point NormalizedScreenToOutputPixel( const Point& rPos ) const; + Point OutputToAbsoluteScreenPixel( const Point& rPos ) const; + Point AbsoluteScreenToOutputPixel( const Point& rPos ) const; + Rectangle GetDesktopRectPixel() const; + // window extents including border and decoratrion + Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; + // window extents of the client window, coordinates to be used in SetPosPixel + Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ) const; + + virtual BOOL IsScrollable() const; + virtual void Scroll( long nHorzScroll, long nVertScroll, + USHORT nFlags = 0 ); + virtual void Scroll( long nHorzScroll, long nVertScroll, + const Rectangle& rRect, USHORT nFlags = 0 ); + virtual void Invalidate( USHORT nFlags = 0 ); + virtual void Invalidate( const Rectangle& rRect, USHORT nFlags = 0 ); + virtual void Invalidate( const Region& rRegion, USHORT nFlags = 0 ); + void Validate( USHORT nFlags = 0 ); + void Validate( const Rectangle& rRect, USHORT nFlags = 0 ); + void Validate( const Region& rRegion, USHORT nFlags = 0 ); + BOOL HasPaintEvent() const; + void Update(); + void Flush(); + void Sync(); + + // toggles new docking support, enabled via toolkit + void EnableDocking( BOOL bEnable = TRUE ); + // retrieves the single dockingmanager instance + static DockingManager* GetDockingManager(); + + void EnablePaint( BOOL bEnable ); + BOOL IsPaintEnabled() const; + void SetUpdateMode( BOOL bUpdate ); + BOOL IsUpdateMode() const; + void SetParentUpdateMode( BOOL bUpdate ); + BOOL IsParentUpdateMode() const; + + void GrabFocus(); + BOOL HasFocus() const; + BOOL HasChildPathFocus( BOOL bSystemWindow = FALSE ) const; + BOOL IsActive() const; + BOOL HasActiveChildFrame(); + USHORT GetGetFocusFlags() const; + void GrabFocusToDocument(); + + /** + * Set this when you need to act as if the window has focus even if it + * doesn't. This is necessary for implementing tab stops inside floating + * windows, but floating windows don't get focus from the system. + */ + void SetFakeFocus( bool bFocus ); + + BOOL IsCompoundControl() const; + BOOL HasCompoundControlFocus() const; + + static sal_uIntPtr SaveFocus(); + static BOOL EndSaveFocus( sal_uIntPtr nSaveId, BOOL bRestore = TRUE ); + + void CaptureMouse(); + void ReleaseMouse(); + BOOL IsMouseCaptured() const; + + void SetPointer( const Pointer& rPointer ); + const Pointer& GetPointer() const; + void EnableChildPointerOverwrite( BOOL bOverwrite = TRUE ); + BOOL IsChildPointerOverwrite() const; + void SetPointerPosPixel( const Point& rPos ); + Point GetPointerPosPixel(); + Point GetLastPointerPosPixel(); + void ShowPointer( BOOL bVisible ); + BOOL IsPointerVisible() const; + void EnterWait(); + void LeaveWait(); + BOOL IsWait() const; + + void SetCursor( Cursor* pCursor ); + Cursor* GetCursor() const; + + void SetZoom( const Fraction& rZoom ); + const Fraction& GetZoom() const; + BOOL IsZoom() const; + long CalcZoom( long n ) const; + + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; + // return the actual text displayed + // this may have e.g. accellerators removed or portions + // replaced by ellipsis + virtual String GetDisplayText() const; + // gets the visible background color. for transparent windows + // this may be the parent's background color; for controls + // this may be a child's background color (e.g. ListBox) + virtual const Wallpaper& GetDisplayBackground() const; + + void SetHelpText( const XubString& rHelpText ); + const XubString& GetHelpText() const; + + void SetQuickHelpText( const XubString& rHelpText ); + const XubString& GetQuickHelpText() const; + + void SetHelpId( ULONG nHelpId ); /// deprecated + ULONG GetHelpId() const; /// deprecated + void SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode = SMART_SET_SMART ); + SmartId GetSmartHelpId() const; + + void SetUniqueId( ULONG nUniqueId ); /// deprecated + ULONG GetUniqueId() const; /// deprecated + void SetSmartUniqueId( const SmartId& aId, SmartIdUpdateMode aMode = SMART_SET_SMART ); + SmartId GetSmartUniqueId() const; + SmartId GetSmartUniqueOrHelpId() const; + + Window* FindWindow( const Point& rPos ) const; + + USHORT GetChildCount() const; + Window* GetChild( USHORT nChild ) const; + Window* GetWindow( USHORT nType ) const; + BOOL IsChild( const Window* pWindow, BOOL bSystemWindow = FALSE ) const; + BOOL IsWindowOrChild( const Window* pWindow, BOOL bSystemWindow = FALSE ) const; + + void SetData( void* pNewData ); + void* GetData() const; + + // Should be merged in the next top level build !!! + Bitmap SnapShot( BOOL bBorder ) const; + Bitmap SnapShot() const; + + void ShowFocus( const Rectangle& rRect ); + void HideFocus(); + + void Invert( const Rectangle& rRect, USHORT nFlags = 0 ); + void Invert( const Polygon& rPoly, USHORT nFlags = 0 ); + + // transparent background for selected or checked items in toolboxes etc. + void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly ); + // the same, but fills a passed Color with a text color complementing the selection background + void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor ); + // support rounded edges in the selection rect + void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor ); + + void ShowTracking( const Rectangle& rRect, + USHORT nFlags = SHOWTRACK_SMALL ); + void HideTracking(); + void InvertTracking( const Rectangle& rRect, + USHORT nFlags = SHOWTRACK_SMALL ); + void InvertTracking( const Polygon& rPoly, USHORT nFlags = 0 ); + + void StartTracking( USHORT nFlags = 0 ); + void EndTracking( USHORT nFlags = 0 ); + BOOL IsTracking() const; + + void StartAutoScroll( USHORT nFlags ); + void EndAutoScroll(); + BOOL IsAutoScroll() const; + + BOOL HandleScrollCommand( const CommandEvent& rCmd, + ScrollBar* pHScrl = NULL, + ScrollBar* pVScrl = NULL ); + + void SaveBackground( const Point& rPos, const Size& rSize, + const Point& rDestOff, VirtualDevice& rSaveDevice ); + + const SystemEnvData* GetSystemData() const; + ::com::sun::star::uno::Any GetSystemDataAny() const; + + // API zum Setzen/Abfragen des Komponenteninterfaces + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( BOOL bCreate = TRUE ); + virtual void SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace ); + + // Accessibility + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible( BOOL bCreate = TRUE ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + void SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ); + + Window* GetAccessibleParentWindow() const; + USHORT GetAccessibleChildWindowCount(); + Window* GetAccessibleChildWindow( USHORT n ); + + void SetAccessibleRole( USHORT nRole ); + USHORT GetAccessibleRole() const; + + void SetAccessibleName( const String& rName ); + String GetAccessibleName() const; + + void SetAccessibleDescription( const String& rDescr ); + String GetAccessibleDescription() const; + + // to avoid sending accessibility events in cases like closing dialogs + // by default checks complete parent path + BOOL IsAccessibilityEventsSuppressed( BOOL bTraverseParentPath = TRUE ); + + /// request XCanvas render interface for this window + ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XCanvas > GetCanvas() const; + /// request XSpriteCanvas render interface for this window + ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XSpriteCanvas > GetSpriteCanvas() const; + /// request fullscreen XSpriteCanvas render interface for this window + ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XSpriteCanvas > GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const; + + /* records all DrawText operations within the passed rectangle; + * a synchronous paint is sent to achieve this + */ + void RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect ); + + // Setzen und Abfragen fuer das Toolkit + VCLXWindow* GetWindowPeer() const; + void SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow ); + + // Merken, ob vom Toolkit erzeugt + BOOL IsCreatedWithToolkit() const; + void SetCreatedWithToolkit( BOOL b ); + + Window* GetLabelFor() const; + Window* GetLabeledBy() const; + virtual Window* GetParentLabelFor( const Window* pLabel ) const; + virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; + KeyEvent GetActivationKey() const; + + // Drag and Drop interfaces + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > GetDropTarget(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > GetDragSource(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer(); + // only for RVP transmission + void GetDragSourceDropTarget(::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& xDragSource,::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > &xDropTarget ); + + // Clipboard/Selection interfaces + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetClipboard(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetPrimarySelection(); + + // Advisory Sizing - what is a good size for this widget ? + virtual Size GetOptimalSize(WindowSizeType eType) const; + + //------------------------------------- + // Native Widget Rendering functions + //------------------------------------- + + // form controls must never use native widgets, this can be toggled here + void EnableNativeWidget( BOOL bEnable = TRUE ); + BOOL IsNativeWidgetEnabled() const; + + // a helper method for a Control's Draw method + void PaintToDevice( OutputDevice* pDevice, const Point& rPos, const Size& rSize ); + + /* mark Window for deletion in top of event queue + */ + void doLazyDelete(); + + virtual XubString GetSurroundingText() const; + virtual Selection GetSurroundingTextSelection() const; +}; + + +#endif // _SV_WINDOW_HXX diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx new file mode 100644 index 000000000000..6da4e4e3d988 --- /dev/null +++ b/vcl/inc/vcl/wintypes.hxx @@ -0,0 +1,33 @@ +/************************************************************************* + * + * 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_WINTYPES_HXX +#define _SV_WINTYPES_HXX + +#include <tools/wintypes.hxx> + +#endif // _SV_WINTYPES_HXX + diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx new file mode 100644 index 000000000000..c710434c79a4 --- /dev/null +++ b/vcl/inc/vcl/wrkwin.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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_WRKWIN_HXX +#define _SV_WRKWIN_HXX + +#include <vcl/sv.h> +#include <vcl/dllapi.h> +#include <vcl/syswin.hxx> + +namespace com { namespace sun { namespace star { namespace uno { class Any; }}}} +struct SystemParentData; + +// ---------------------- +// - WorkWindow - Types - +// ---------------------- + +// Presentation Flags +#define PRESENTATION_HIDEALLAPPS ((USHORT)0x0001) +#define PRESENTATION_NOFULLSCREEN ((USHORT)0x0002) +#define PRESENTATION_NOAUTOSHOW ((USHORT)0x0004) + +// -------------- +// - WorkWindow - +// -------------- + +class VCL_DLLPUBLIC WorkWindow : public SystemWindow +{ +private: + USHORT mnPresentationFlags; + BOOL mbPresentationMode:1, + mbPresentationVisible:1, + mbPresentationFull:1, + mbFullScreenMode:1; + + SAL_DLLPRIVATE void ImplInitWorkWindowData(); + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::uno::Any& aSystemWorkWindowToken ); + +private: + SAL_DLLPRIVATE WorkWindow( const WorkWindow& rWin ); + SAL_DLLPRIVATE WorkWindow& operator =( const WorkWindow& rWin ); + +protected: + WorkWindow( WindowType nType ); + SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData = NULL ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplSetFrameState( ULONG aFrameState ); + +public: + WorkWindow( Window* pParent, const ResId& rResId ); + WorkWindow( Window* pParent, WinBits nStyle = WB_STDWORK ); + WorkWindow( Window* pParent, const ::com::sun::star::uno::Any& aSystemWorkWindowToken, WinBits nStyle = WB_STDWORK ); + WorkWindow( SystemParentData* pParent ); // Not in the REMOTE-Version + ~WorkWindow(); + + virtual BOOL Close(); + + /** The default value of nDisplay = -1 means "don't care" and + allows to backends to use any screen [** or display? terminology!] + they like (most probably the current one). + + NOTE: The default value cannot be 0, because 0 is a legitimate + screen number. + */ + void ShowFullScreenMode( BOOL bFullScreenMode = TRUE, sal_Int32 nDisplay = -1 ); + void EndFullScreenMode() { ShowFullScreenMode( FALSE ); } + BOOL IsFullScreenMode() const { return mbFullScreenMode; } + + void StartPresentationMode( BOOL bPresentation = TRUE, USHORT nFlags = 0, sal_Int32 nDisplay = 0 ); + void EndPresentationMode() { StartPresentationMode( FALSE ); } + BOOL IsPresentationMode() const { return mbPresentationMode; } + + BOOL IsMinimized() const; + + BOOL SetPluginParent( SystemParentData* pParent ); + + void Minimize(); + void Restore(); + + void Maximize( BOOL bMaximize = TRUE ); + BOOL IsMaximized() const; +}; + +#endif // _SV_WRKWIN_HXX diff --git a/vcl/inc/vcl/xconnection.hxx b/vcl/inc/vcl/xconnection.hxx new file mode 100644 index 000000000000..aa9d37430ea6 --- /dev/null +++ b/vcl/inc/vcl/xconnection.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_XCONNECTION_HXX +#define _VCL_XCONNECTION_HXX + +#include <com/sun/star/awt/XDisplayConnection.hpp> +#include <cppuhelper/implbase1.hxx> +#include <osl/mutex.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#ifndef _STLP_LIST +#include <list> +#endif + +namespace vcl { + + class DisplayConnection : + public ::cppu::WeakImplHelper1< ::com::sun::star::awt::XDisplayConnection > + { + ::osl::Mutex m_aMutex; + ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler > > + m_aHandlers; + ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler > > + m_aErrorHandlers; + ::com::sun::star::uno::Any m_aAny; + public: + DisplayConnection(); + virtual ~DisplayConnection(); + + static bool dispatchEvent( void* pThis, void* pData, int nBytes ); + static bool dispatchErrorEvent( void* pThis, void* pData, int nBytes ); + void dispatchDowningEvent(); + + // XDisplayConnection + virtual void SAL_CALL addEventHandler( const ::com::sun::star::uno::Any& window, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw(); + virtual void SAL_CALL removeEventHandler( const ::com::sun::star::uno::Any& window, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler >& handler ) throw(); + virtual void SAL_CALL addErrorHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler >& handler ) throw(); + virtual void SAL_CALL removeErrorHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XEventHandler >& handler ) throw(); + virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw(); + + }; + +} + +#endif // _VCL_XCONNECTION_HXX |